Skip to content

Commit

Permalink
remove one lookup case from steinberger
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmyhill committed Aug 25, 2023
1 parent 06ce805 commit 94811c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
22 changes: 5 additions & 17 deletions source/material_model/steinberger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,12 @@ namespace aspect
equation_of_state.parse_parameters(prm);

// Assign background field and do some error checking
has_background_field = ((equation_of_state.number_of_lookups() == 1) ||
(equation_of_state.number_of_lookups() == this->introspection().n_chemical_composition_fields() + 1));
AssertThrow ((equation_of_state.number_of_lookups() == 1) ||
(equation_of_state.number_of_lookups() == this->introspection().n_chemical_composition_fields()) ||
has_background_field = (equation_of_state.number_of_lookups() == this->introspection().n_chemical_composition_fields() + 1);
AssertThrow ((equation_of_state.number_of_lookups() == this->introspection().n_chemical_composition_fields()) ||
(equation_of_state.number_of_lookups() == this->introspection().n_chemical_composition_fields() + 1),
ExcMessage("The Steinberger material model assumes that either there is a single material "
"in the simulation, or that all compositional fields of the type "
"chemical composition correspond to mass fractions of different "
"materials. There must either be one material lookup file, the same "
ExcMessage("The Steinberger material model assumes that all compositional fields of the type "
"chemical composition (the default type) correspond to mass fractions of different "
"materials. There must either be the same "
"number of material lookup files as compositional fields of type chemical "
"composition, or one additional file (if a background field is used). You "
"have "
Expand All @@ -554,15 +551,6 @@ namespace aspect
std::vector<std::string> chemical_field_names = this->introspection().chemical_composition_field_names();
std::vector<std::string> compositional_field_names = this->introspection().get_composition_names();

// If there is only one lookup, the list of Viscosity prefactors should have length one.
// The following if statement applies when defined fields of type chemical composition
// are not intended to be used as volume fractions of distinct materials.
if (equation_of_state.number_of_lookups() == 1)
{
chemical_field_names.clear();
compositional_field_names.clear();
}

if (has_background_field)
{
chemical_field_names.insert(chemical_field_names.begin(),"background");
Expand Down
3 changes: 2 additions & 1 deletion tests/steinberger_phases.prm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# It is intended to test the ability of the steinberger
# material model to use the first data file as a background
# composition, and ignore other compositional fields if
# only a single material file is provided.
# they do not have the type "chemical composition".

set CFL number = 1.0
set End time = 1e5
Expand All @@ -19,6 +19,7 @@ end

subsection Compositional fields
set Number of fields = 1
set Types of fields = generic
end

subsection Initial composition model
Expand Down
5 changes: 3 additions & 2 deletions tests/steinberger_several_fields.prm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This is a copy of the steinberger single field test.
# It is intended to test the ability of the steinberger
# material model to use the first data file as a background
# composition, and ignore several other compositional
# fields if only a single material file is provided.
# composition, and ignore other compositional fields if
# they do not have the type "chemical composition".

set CFL number = 1.0
set End time = 1e5
Expand All @@ -19,6 +19,7 @@ end

subsection Compositional fields
set Number of fields = 3
set Types of fields = generic, generic, generic
end

subsection Initial composition model
Expand Down

0 comments on commit 94811c4

Please sign in to comment.