Skip to content

Commit

Permalink
Merge pull request #1 from gassmoeller/ascii_profile_rheology
Browse files Browse the repository at this point in the history
Move parameter declaration to allow alias.
  • Loading branch information
alarshi authored Sep 23, 2020
2 parents b5806e1 + 237cf72 commit 83b025f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
6 changes: 5 additions & 1 deletion data/material-model/depth-dependent/visc_depth.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Depth (m) Viscosity (Pa s)
# Test data for ascii data reference state
# Only next line is parsed in format: [nx] because of keyword "POINTS:"
# POINTS: 4
# Columns: depth (m), viscosity (Pa.s)
depth viscosity
0.0000000e+00 1.0000000e+21
1.0000000e+06 5.0000000e+21
2.0000000e+06 5.0000000e+22
Expand Down
6 changes: 4 additions & 2 deletions include/aspect/material_model/rheology/ascii_depth_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ namespace aspect
*/
static
void
declare_parameters (ParameterHandler &prm);
declare_parameters (ParameterHandler &prm,
const std::string &subsection_name = "Ascii data model");

/**
* Read the parameters from the parameter file.
*/
void
parse_parameters (ParameterHandler &prm);
parse_parameters (ParameterHandler &prm,
const std::string &subsection_name = "Ascii data model");

private:

Expand Down
23 changes: 13 additions & 10 deletions source/material_model/depth_dependent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ namespace aspect
{
prm.enter_subsection("Material model");
{
// Depth-dependent parameters from the rheology plugin
Rheology::AsciiDepthProfile<dim>::declare_parameters(prm,
"Depth dependent model");

prm.enter_subsection("Depth dependent model");
{
prm.declare_entry("Base model","simple",
Expand All @@ -163,8 +167,7 @@ namespace aspect
"provided in ``Depth list''. The number of viscosity values specified here must "
"be the same as the number of depths provided in ``Depth list''.");

// Depth-dependent parameters from the rheology plugin
Rheology::AsciiDepthProfile<dim>::declare_parameters(prm);

prm.declare_alias ("Data file name","Viscosity depth file");

prm.enter_subsection("Viscosity depth function");
Expand Down Expand Up @@ -230,14 +233,6 @@ namespace aspect
ExcMessage("Last value in Depth list must be greater than or equal to maximal depth of domain"));
}

if (viscosity_source == File)
{
depth_dependent_rheology = std_cxx14::make_unique<Rheology::AsciiDepthProfile<dim>>();
depth_dependent_rheology->initialize_simulator (this->get_simulator());
depth_dependent_rheology->parse_parameters(prm);
depth_dependent_rheology->initialize();
}

prm.enter_subsection("Viscosity depth function");
{
try
Expand All @@ -256,6 +251,14 @@ namespace aspect
prm.leave_subsection();
}
prm.leave_subsection();

if (viscosity_source == File)
{
depth_dependent_rheology = std_cxx14::make_unique<Rheology::AsciiDepthProfile<dim>>();
depth_dependent_rheology->initialize_simulator (this->get_simulator());
depth_dependent_rheology->parse_parameters(prm, "Depth dependent model");
depth_dependent_rheology->initialize();
}
}
prm.leave_subsection();

Expand Down
12 changes: 8 additions & 4 deletions source/material_model/rheology/ascii_depth_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,24 @@ namespace aspect

template <int dim>
void
AsciiDepthProfile<dim>::declare_parameters (ParameterHandler &prm)
AsciiDepthProfile<dim>::declare_parameters (ParameterHandler &prm,
const std::string &subsection_name)
{
Utilities::AsciiDataBase<dim>::declare_parameters(prm,
"$ASPECT_SOURCE_DIR/data/material-model/rheology/",
"ascii_depth_profile.txt");
"ascii_depth_profile.txt",
subsection_name);
}



template <int dim>
void
AsciiDepthProfile<dim>::parse_parameters (ParameterHandler &prm)
AsciiDepthProfile<dim>::parse_parameters (ParameterHandler &prm,
const std::string &subsection_name)
{
Utilities::AsciiDataBase<dim>::parse_parameters(prm);
Utilities::AsciiDataBase<dim>::parse_parameters(prm,
subsection_name);
}
}
}
Expand Down

0 comments on commit 83b025f

Please sign in to comment.