Skip to content

Commit

Permalink
Get rid of some memory overhead \style.
Browse files Browse the repository at this point in the history
  • Loading branch information
tupek2 committed Aug 2, 2024
1 parent 3a856d4 commit ef830f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
14 changes: 4 additions & 10 deletions src/serac/physics/solid_mechanics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
v_.SetSize(true_size);

du_.SetSize(true_size);
dr_.SetSize(true_size);
predicted_displacement_.SetSize(true_size);

shape_displacement_ = 0.0;
Expand Down Expand Up @@ -386,7 +385,6 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
u_ = 0.0;
v_ = 0.0;
du_ = 0.0;
dr_ = 0.0;
predicted_displacement_ = 0.0;

if (checkpoint_to_disk_) {
Expand Down Expand Up @@ -1606,9 +1604,6 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
/// vector used to store the change in essential bcs between timesteps
mfem::Vector du_;

/// vector used to store forces arising from du_ when applying time-dependent bcs
mfem::Vector dr_;

/// @brief used to communicate the ODE solver's predicted displacement to the residual operator
mfem::Vector u_;

Expand Down Expand Up @@ -1766,20 +1761,19 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
du_[j] -= displacement_(j);
}

dr_ = r;
dr_ *= -1.0;
r *= -1.0;

mfem::EliminateBC(*J_, *J_e_, constrained_dofs, du_, dr_);
mfem::EliminateBC(*J_, *J_e_, constrained_dofs, du_, r);
for (int i = 0; i < constrained_dofs.Size(); i++) {
int j = constrained_dofs[i];
dr_[j] = du_[j];
r[j] = du_[j];
}

auto& lin_solver = nonlin_solver_->linearSolver();

lin_solver.SetOperator(*J_);

lin_solver.Mult(dr_, du_);
lin_solver.Mult(r, du_);
displacement_ += du_;
}
};
Expand Down
1 change: 0 additions & 1 deletion src/serac/physics/solid_mechanics_contact.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ class SolidMechanicsContact<order, dim, Parameters<parameter_space...>,
using SolidMechanicsBase::d_residual_d_;
using SolidMechanicsBase::DERIVATIVE;
using SolidMechanicsBase::displacement_;
using SolidMechanicsBase::dr_;
using SolidMechanicsBase::du_;
using SolidMechanicsBase::J_;
using SolidMechanicsBase::J_e_;
Expand Down

0 comments on commit ef830f3

Please sign in to comment.