-
Notifications
You must be signed in to change notification settings - Fork 241
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
fix latent heat viscosity prefactor #6214
base: main
Are you sure you want to change the base?
Conversation
@@ -131,18 +136,27 @@ namespace aspect | |||
// for the first layer, so we have to use phase+1 as the index. | |||
if (composition.size()==0) | |||
{ | |||
phase_dependence += phaseFunction * density_jumps[phase]; | |||
viscosity_phase_dependence *= 1. + phaseFunction * (phase_prefactors[phase+1]-1.); | |||
phase_dependence += phaseFunction * density_jumps[transition_index]; |
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.
can you fix/delete the comment 3 lines above?
source/material_model/latent_heat.cc
Outdated
|
||
// Viscosities | ||
if (transition_index+1 < phase_function.n_phases_for_each_composition()[0]) // 1st compositional field | ||
viscosity_phase_prefactors[0] = std::pow(10, |
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.
viscosity_phase_prefactors[0] = std::pow(10, | |
viscosity_phase_prefactors[0] = std::pow(10., |
source/material_model/latent_heat.cc
Outdated
+ (1. - phaseFunction) * std::log10(viscosity_phase_prefactors[0])); | ||
else if (transition_index+2 < phase_function.n_phases_for_each_composition()[0] | ||
+ phase_function.n_phases_for_each_composition()[1]) // 2nd compositional field | ||
viscosity_phase_prefactors[1] = std::pow(10, |
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.
viscosity_phase_prefactors[1] = std::pow(10, | |
viscosity_phase_prefactors[1] = std::pow(10., |
source/material_model/latent_heat.cc
Outdated
if (composition.size()==0) | ||
out.viscosities[i] = out.viscosities[i]*viscosity_phase_prefactors[0]; | ||
else | ||
out.viscosities[i] = (std::pow(10, ((1-composition[0]) * std::log10(out.viscosities[i]*viscosity_phase_prefactors[0]) |
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.
out.viscosities[i] = (std::pow(10, ((1-composition[0]) * std::log10(out.viscosities[i]*viscosity_phase_prefactors[0]) | |
out.viscosities[i] = (std::pow(10., ((1-composition[0]) * std::log10(out.viscosities[i]*viscosity_phase_prefactors[0]) |
source/material_model/latent_heat.cc
Outdated
"viscosity (modified by any compositional prefactors) will be multiplied " | ||
"by this factor to get the corresponding viscosity for each phase. " | ||
"List must have the same number of entries as there are phases, that is one " | ||
"more than Phase transition depths for each composition that is used in the " |
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.
do you want to quote this parameter?
1299048
to
38227d4
Compare
38227d4
to
2b2b703
Compare
@tjhei Thank you for the review! |
The list of viscosity prefactors that would change the viscosity at phase transitions in the latent heat material model did not work correctly if more than one compositional field was used. Specifically, individual layers would have the wrong viscosities, and the length of the list of prefactors that had to be specified in the input file made no sense. This specific setup had no test case, which is likely why we did not notice when we broke this.
The problem was that the prefactors are specified relative to each other, but when they are applied, they are multiplied on top of each other (due to the way the phase function works). This means they have to be scaled after they are read in, and this scaling depends on how many phase transitions are occurring above a given phase, and the old interface just had no good way of figuring that out. Therefore, there was no good way for fixing this without also changing the interface for this input parameter. I changed the interface to be consistent with what we use for all other phase transition parameters (the map parsing from the material model utilities), which has the advantage that there's a good default for models with and without chemical heterogeneities. I also fixed the computation of the viscosities in the individual phases, and changed the averaging between phases to a log average (which is consistent with the rest of the material model, which already uses log averaging for viscosities).
For new features/models or changes of existing features: