Skip to content

Commit

Permalink
Always reassemble J for warm start for now. This can be optimized awa…
Browse files Browse the repository at this point in the history
…y later.
  • Loading branch information
tupek2 committed Aug 5, 2024
1 parent 84626f1 commit b4eb80c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/serac/physics/solid_mechanics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
}

adjoints_.push_back(&adjoint_displacement_);

duals_.push_back(&reactions_);

dual_adjoints_.push_back(&reactions_adjoint_load_);

// Create a pack of the primal field and parameter finite element spaces
Expand Down Expand Up @@ -259,7 +257,6 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se

u_.SetSize(true_size);
v_.SetSize(true_size);

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

Expand Down Expand Up @@ -389,9 +386,6 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
du_ = 0.0;
predicted_displacement_ = 0.0;

J_.reset();
J_e_.reset();

if (checkpoint_to_disk_) {
outputStateToDisk();
} else {
Expand Down Expand Up @@ -1775,12 +1769,10 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
*parameters_[parameter_indices].state...);

// use the most recently evaluated Jacobian
if (!J_ || !J_e_) {
auto [_, drdu] = (*residual_)(time_, shape_displacement_, differentiate_wrt(displacement_), acceleration_,
*parameters_[parameter_indices].previous_state...);
J_ = assemble(drdu);
J_e_ = bcs_.eliminateAllEssentialDofsFromMatrix(*J_);
}
auto [_, drdu] = (*residual_)(time_, shape_displacement_, differentiate_wrt(displacement_), acceleration_,
*parameters_[parameter_indices].previous_state...);
J_ = assemble(drdu);
J_e_ = bcs_.eliminateAllEssentialDofsFromMatrix(*J_);

r *= -1.0;

Expand Down

0 comments on commit b4eb80c

Please sign in to comment.