Skip to content

Commit

Permalink
Fix reaction terms and update some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anne-glerum committed Nov 25, 2021
1 parent 1356965 commit b331551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions source/material_model/rheology/elasticity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ namespace aspect
// Use the viscosity corresponding to the stresses selected above.
// out.viscosities is computed during the assembly of the Stokes equations
// based on the current_linearization_point. This means that it will be updated after every
// nonlinear Stokes iteration, and is ahead of the stresses that are used in the force term.
// nonlinear Stokes iteration.
const double effective_creep_viscosity = out.viscosities[i];

// Fill elastic force outputs $\frac{-\eta_{effcreep} \tau_0}{\eta_{e}}$.
force_out->elastic_force[i] = -1. *effective_creep_viscosity / calculate_elastic_viscosity(average_elastic_shear_moduli[i])
force_out->elastic_force[i] = -1. * effective_creep_viscosity / calculate_elastic_viscosity(average_elastic_shear_moduli[i])
* stress_0_advected;
}
}
Expand Down Expand Up @@ -400,12 +400,13 @@ namespace aspect
// stress_new = ( ( 1. - ( dt / dte ) ) * stress_old ) + ( ( dt / dte ) * stress_new ) ;
// }

// Fill reaction terms
for (unsigned int j = 0; j < SymmetricTensor<2,dim>::n_independent_components ; ++j)
// Fill reaction terms.
// Subtract the current composition in in.composition, instead of the composition from the
// previous timestep that is used as stress_t
for (unsigned int j = 0; j < SymmetricTensor<2,dim>::n_independent_components; ++j)
{
out.reaction_terms[i][j] = -stress_t[i][SymmetricTensor<2,dim>::unrolled_to_component_indices(j)]
+ stress_0[SymmetricTensor<2,dim>::unrolled_to_component_indices(j)];
std::cout << "reaction term " << i << "," << j << ": " << out.reaction_terms[i][j] << std::endl;
out.reaction_terms[i][j] = -in.composition[i][j]
+ stress_0[SymmetricTensor<2, dim>::unrolled_to_component_indices(j)];
}
}
}
Expand Down Expand Up @@ -461,7 +462,10 @@ namespace aspect
const double elastic_viscosity = calculate_elastic_viscosity(average_elastic_shear_moduli[i]);

// The total stress of timestep t.
const SymmetricTensor<2, dim> stress_t = 2. * effective_creep_viscosity * (deviator(in.strain_rate[i]) + stress_0_t / (2. * elastic_viscosity));
// TODO: Do we somehow need to take into account the user-set minimum value for the
// sqrt of the second invariant of the strain rate?
const SymmetricTensor<2, dim>
stress_t = 2. * effective_creep_viscosity * (deviator(in.strain_rate[i]) + stress_0_t / (2. * elastic_viscosity));

// Fill reaction rates.
// Assume dte is always equal to dt.
Expand Down
2 changes: 1 addition & 1 deletion source/material_model/rheology/visco_plastic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace aspect
{
// When we compute the viscosity for the Stokes assembly
// the ve stresses stored in in.composition are the rotated
// and advected stresses from the advection solve ($\tau^{0}$).
// and advected stresses from the advection solve ($\tau^{0adv}$).
// The square root of the second moment invariant is returned.
const double viscoelastic_strain_rate_invariant = elastic_rheology.calculate_viscoelastic_strain_rate(in.strain_rate[i],
stress_0_advected,
Expand Down

0 comments on commit b331551

Please sign in to comment.