Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Newton iterations in the CompositeViscoPlastic rheology more efficient #5946

Closed
wants to merge 7 commits into from

Conversation

bobmyhill
Copy link
Member

@bobmyhill bobmyhill commented Jun 26, 2024

This PR does a few small things that facilitate efficient calculation of CompositeViscoPlastic viscosities:

  • The approximate Peierls creep rheology has a new function compute_approximate_log_strain_rate_and_derivative, mirroring compute_exact_log_strain_rate_and_derivative already in the code.
  • A new power law Drucker-Prager rheology is introduced, that replaces a strain-rate invariant yield stress with a yield stress that varies as a function of strain rate.
  • CompositeViscoPlastic is modified to use the approximate Peierls creep rheology and the power law Drucker-Prager rheology.
  • The internal Newton iteration scheme inside CompositeViscoPlastic is modified to iterate over the log stress to get the correct total log strain rate. The change from iterating on stress and strain to log stress and strain, and the use of pure power law rheologies (at fixed state) leads to much improved performance, typically requiring 1--6 relatively inexpensive iterations rather than 1--20+ more expensive iterations with the old code.

Further improvements in efficiency can be made in future PRs, particularly in the approximate Peierls creep rheology (see #5945).

I'm happy to split this PR up if necessary. All brought together here because I developed the features in tandem, and to demonstrate the eventual goal.

@bobmyhill bobmyhill changed the title Make Newton iterations on composite viscoplastic efficient Make Newton iterations in the CompositeViscoPlastic rheology more efficient Jun 26, 2024
@bobmyhill
Copy link
Member Author

/rebuild

Copy link
Member

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very promising and I am curious how it performs in practice. I left a bunch of comments, but mostly small renaming and documentation requests.

source/material_model/rheology/composite_visco_plastic.cc Outdated Show resolved Hide resolved
source/material_model/rheology/composite_visco_plastic.cc Outdated Show resolved Hide resolved
source/material_model/rheology/peierls_creep.cc Outdated Show resolved Hide resolved
source/material_model/rheology/peierls_creep.cc Outdated Show resolved Hide resolved
1800 1.28447e+17 568948 1e-11 0.749975 0.250025 2.2682e-17 0 1.28447e-11
1900 1.09563e+17 191256 1e-11 0.962698 0.0373021 2.59166e-19 0 1.09563e-11
2000 1.02964e+17 59280.1 1e-11 0.99654 0.00345962 2.26225e-21 0 1.02964e-11
1000 3.45602e+19 6.89205e+08 1e-11 1.29846e-06 0.00363514 0.0654305 0.930933 3.45602e-09
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So at low temperatures the changes lead to higher viscosities and stresses. Is that because of the power law of the drucker prager rheology? Do you approach the old values as your stress exponent goes to infinity? I just want to make sure the difference we see is caused by the functional change in the drucker prager rheology, and not by the change to the Newton iteration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and yes.

  • As the temperature goes down, the purely viscous stress at a given strain rate increases.
  • The "yield stress" in the new Drucker Prager flow law is associated with a constant reference strain rate
  • At a fixed strain rate, the ratio of plastic strain to viscous strain will increase as temperature decreases.

At even lower temperatures, plastic strain increasingly will dominate, and so the stress will tend towards a constant value. That value will depend on the "yield stress", reference strain rate and actual strain rate.

@bobmyhill
Copy link
Member Author

Hi @gassmoeller , thanks for the detailed review!
I've now added the variable grain size we talked about at the user meeting. This PR is increasingly becoming a testing ground for all the features we need, so I'm happy to split it up when we're happy it's the way we want it to go.

@bobmyhill
Copy link
Member Author

@gassmoeller, @anne-glerum

Today @anne-glerum pointed me at the stress limiter in the viscoplastic rheology:

case stress_limiter:
{
//Step 5b-1: always rescale the viscosity back to the yield surface
const double viscosity_limiter = yield_stress / (2.0 * ref_strain_rate)
* std::pow((edot_ii/ref_strain_rate),
1./exponents_stress_limiter[j] - 1.0);
effective_viscosity = 1. / ( 1./viscosity_limiter + 1./non_yielding_viscosity);
break;
}

This is exactly the same as DruckerPragerPower:

DruckerPragerPower<dim>::compute_viscosity (const double cohesion,
const double angle_internal_friction,
const double pressure,
const double effective_strain_rate,
const double max_yield_stress) const
{
const double yield_stress = compute_yield_stress(cohesion, angle_internal_friction, pressure, max_yield_stress);
const double stress = yield_stress * std::pow(effective_strain_rate/drucker_prager_edot_ref, 1./drucker_prager_stress_exponent);
const double apparent_viscosity = stress / (2. * effective_strain_rate);
return apparent_viscosity;
}

What do you think about renaming DruckerPragerPower to StressLimiter and then using it in both ViscoPlastic and CompositeViscoPlastic?

The only thing that bothers me is that in visco_plastic, the parameter "Reference strain rate" is used both to initialise the strain rate in the first time step, and also to set the reference strain rate in the stress limiter. I don't know what the best solution is:

  • to add a new parameter (changing existing behaviour),
  • for ViscoPlastic to inherit the parameter value from StressLimiter (we agreed that this was a bad idea™ at the hack).
  • To not use the new StressLimiter rheology in ViscoPlastic (seems like a wasted opportunity)

Any thoughts?

@gassmoeller
Copy link
Member

What do you think about renaming DruckerPragerPower to StressLimiter and then using it in both ViscoPlastic and CompositeViscoPlastic?

Yes, reusing code is always good.

The only thing that bothers me is that in visco_plastic, the parameter "Reference strain rate" is used both to initialise the strain rate in the first time step, and also to set the reference strain rate in the stress limiter. I don't know what the best solution is:
Any thoughts?

That seems like an earlier oversight, in particular because the use in the stress limiter is not even documented in the input parameter comment (it only mentions that the strain rate is used during the first time step). I would say let's introduce the new parameter and use that one.

For a future PR: In order to use the DruckerPragerPower as stress limiter in ViscoPlastic do you need a different limiting stress for different compositional fields? (I just noticed that the stress limiter seems to allow different values for different fields, while DruckerPragerPower seems to use a single yield stress).

This PR is increasingly becoming a testing ground for all the features we need, so I'm happy to split it up when we're happy it's the way we want it to go.

Yes, let's focus on one thing at a time. As far as I can see there are three things mixed up in this PR:

  • grain size for composite visco plastic
  • log stress Newton iterations
  • DruckerPragerPower

It would be ideal to separate this in 3 PRs, but you know better what can be cleanly separated and what not. I will leave that decision up to you, but please do not add anything else in this PR (like using DruckerPragerPower in visco_plastic).

@bobmyhill
Copy link
Member Author

Thanks @gassmoeller , that all seems sensible.
I noticed the different number of stress exponents in VP, and raised an issue here: #5961. I don't think there's a particular need for that (maybe you disagree) but I do think I should implement different Max yield stresses. That isn't in the base DP rheology yet though. Is that what you meant?

@gassmoeller
Copy link
Member

I don't think there's a particular need for that (maybe you disagree)

I do not disagree, but I would like to check with @anne-glerum and @naliboff if those different exponents were implemented on purpose and if they have use cases for them. Removing unnecessary functionality is good, but removing functionality that is needed and/or already in production use would be bad.

but I do think I should implement different Max yield stresses. That isn't in the base DP rheology yet though. Is that what you meant?

That wasnt what I meant, but it seems reasonable and more useful than the different exponents. Something for a follow-up PR though.

@bobmyhill
Copy link
Member Author

Addressed by #5978.

@bobmyhill bobmyhill closed this Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants