-
Notifications
You must be signed in to change notification settings - Fork 7
Add new ϵ_nonlinear
keyword to the Stokes solvers
#347
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
base: main
Are you sure you want to change the base?
Conversation
# compute buoyancy forces and viscosity | ||
compute_ρg!(ρg, phase_ratios, rheology, args) | ||
compute_viscosity!(stokes, phase_ratios, args, rheology, viscosity_cutoff) | ||
displacement2velocity!(stokes, dt, flow_bcs) | ||
|
||
while iter ≤ iterMax | ||
iterMin < iter && ((err / err_it1) < ϵ_rel || err < ϵ_abs) && break | ||
# iterMin < iter && ((err / err_it1) < ϵ_rel && err < ϵ_abs) && break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# iterMin < iter && ((err / err_it1) < ϵ_rel && err < ϵ_abs) && break | |
iterMin < iter && ((err / err_it1) < ϵ_rel || err < ϵ_abs) && break |
this needs to be like this. otherwise it doesn't break if the relative tolerance is below its set value but the abs is not. same vise versa.
And I think it shouldn't be commented as there's no break condition anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be &&
, otherwise imagine you have ϵ_rel=1e-2
and your PT iterations starts at an error in the order of 1e2
, then it would break at around err=1e0
, which is not what you want
@@ -724,8 +725,9 @@ function _solve!( | |||
isnan(err) && error("NaN(s)") | |||
end | |||
|
|||
if igg.me == 0 && ((err / err_it1) < ϵ_rel || (err < ϵ_abs)) | |||
if igg.me == 0 && iterMin < iter && ((err / err_it1) < ϵ_rel && err < ϵ_abs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if igg.me == 0 && iterMin < iter && ((err / err_it1) < ϵ_rel && err < ϵ_abs) | |
if igg.me == 0 && iterMin < iter && ((err / err_it1) < ϵ_rel ||err < ϵ_abs) |
see above
Adds a new keyword
ϵ_nonlinear
(Inf
by default) to the Stokes solvers. Non linearities (viscosity and plastic corrections) are not considered while the global error iserr > ϵ_nonlinear
. Seems to help convergence in highly complex models.