Skip to content

Commit

Permalink
Merge pull request #2253 from gassmoeller/fix_depth_dependent_initial…
Browse files Browse the repository at this point in the history
…ization

Fix base model initialization for depth dependent material model
  • Loading branch information
gassmoeller committed May 21, 2018
2 parents 6f22c2c + d29daa4 commit 1490ab4
Show file tree
Hide file tree
Showing 9 changed files with 765 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/aspect/material_model/depth_dependent.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ namespace aspect
class DepthDependent : public MaterialModel::Interface<dim>, public ::aspect::SimulatorAccess<dim>
{
public:
/**
* Initialize the base model at the beginning of the run.
*/
virtual
void initialize();

/**
* Update the base model and viscosity function at the beginning of
* each timestep.
*/
virtual
void update();

/**
* Function to compute the material properties in @p out given the
* inputs in @p in.
Expand Down
25 changes: 25 additions & 0 deletions source/material_model/depth_dependent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@ namespace aspect
{
namespace MaterialModel
{
template <int dim>
void
DepthDependent<dim>::initialize()
{
base_model->initialize();
}



template <int dim>
void
DepthDependent<dim>::update()
{
base_model->update();

// we get time passed as seconds (always) but may want
// to reinterpret it in years
if (this->convert_output_to_years())
viscosity_function.set_time (this->get_time() / year_in_seconds);
else
viscosity_function.set_time (this->get_time());
}



template <int dim>
void
DepthDependent<dim>::read_viscosity_file(const std::string &filename,
Expand Down
174 changes: 174 additions & 0 deletions tests/depth_dependent_box_function_time_dependent.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Test depth-dependent material model using simple material model as
# base model with depth-dependence specified by user-provided function.
# This is an extended copy from depth_dependent_box_function that
# uses a time dependent function to prescribe depth dependent viscosity.

# At the top, we define the number of space dimensions we would like to
# work in:
set Dimension = 2

# There are several global variables that have to do with what
# time system we want to work in and what the end time is. We
# also designate an output directory.
set Use years in output instead of seconds = true
set End time = 1.0e8
set Output directory = output-depth-dependent-box-function-time-dependent

# Then there are variables that describe the tolerance of
# the linear solver as well as how the pressure should
# be normalized. Here, we choose a zero average pressure
# at the surface of the domain (for the current geometry, the
# surface is defined as the top boundary).

set Pressure normalization = surface
set Surface pressure = 0


# Then come a number of sections that deal with the setup
# of the problem to solve. The first one deals with the
# geometry of the domain within which we want to solve.
# The sections that follow all have the same basic setup
# where we select the name of a particular model (here,
# the box geometry) and then, in a further subsection,
# set the parameters that are specific to this particular
# model.
subsection Geometry model
set Model name = box

subsection Box
set X extent = 3.0e6
set Y extent = 3.0e6
end
end


# The next section deals with the initial conditions for the
# temperature (there are no initial conditions for the
# velocity variable since the velocity is assumed to always
# be in a static equilibrium with the temperature field).
# There are a number of models with the 'function' model
# a generic one that allows us to enter the actual initial
# conditions in the form of a formula that can contain
# constants. We choose a linear temperature profile that
# matches the boundary conditions defined below plus
# a small perturbation:
subsection Initial temperature model
set Model name = function

subsection Function
set Variable names = x,z
set Function constants = p=10.0, L=3.0e6, pi=3.1415926536, k=1
set Function expression = 2773.0 - z/L*(2500.0) + p*cos(k*pi*x/L)*sin(k*pi*z/L/2.0)
end
end


# Then follows a section that describes the boundary conditions
# for the temperature. The model we choose is called 'box' and
# allows to set a constant temperature on each of the four sides
# of the box geometry. In our case, we choose something that is
# heated from below and cooled from above. (As will be seen
# in the next section, the actual temperature prescribed here
# at the left and right does not matter.)
subsection Boundary temperature model
set List of model names = box

subsection Box
set Bottom temperature = 2773
set Left temperature = 0
set Right temperature = 0
set Top temperature = 273.0
end
end


# We then also have to prescribe several other parts of the model such as
# which boundaries actually carry a prescribed boundary temperature, whereas
# all other parts of the boundary are insulated (i.e., no heat flux through
# these boundaries; this is also often used to specify symmetry boundaries).
# The parameters below this comment were created by the update script
# as replacement for the old 'Model settings' subsection. They can be
# safely merged with any existing subsections with the same name.

subsection Boundary temperature model
set Fixed temperature boundary indicators = bottom, top
end

subsection Boundary velocity model
set Tangential velocity boundary indicators = left, right, bottom, top
end


# The following two sections describe first the
# direction (vertical) and magnitude of gravity and the
# material model (i.e., density, viscosity, etc). We have
# discussed the settings used here in the introduction to
# this cookbook in the manual already.
subsection Gravity model
set Model name = vertical

subsection Vertical
set Magnitude = 2e-5 # = Ra / Thermal expansion coefficient
end
end


subsection Material model
set Model name = depth dependent
subsection Depth dependent model
set Base model = simple
set Depth dependence method = Function
subsection Viscosity depth function
set Variable names = d,t
set Function expression = if(d>6.70e5,3.0e22*(1.0+t/1e8),1.0e21*(1.0+t/1e8));
end
end
subsection Simple model
set Reference density = 3300.0
set Reference specific heat = 1250.0
set Reference temperature = 0
set Thermal conductivity = 4.0
set Thermal expansion coefficient = 2e-5
set Viscosity = 1e25
end
end


# The settings above all pertain to the description of the
# continuous partial differential equations we want to solve.
# The following section deals with the discretization of
# this problem, namely the kind of mesh we want to compute
# on. We here use a globally refined mesh without
# adaptive mesh refinement.
subsection Mesh refinement
set Initial global refinement = 4
set Initial adaptive refinement = 0
set Time steps between mesh refinement = 0
end


# The final part is to specify what ASPECT should do with the
# solution once computed at the end of every time step. The
# process of evaluating the solution is called `postprocessing'
# and we choose to compute velocity and temperature statistics,
# statistics about the heat flux through the boundaries of the
# domain, and to generate graphical output files for later
# visualization. These output files are created every time
# a time step crosses time points separated by 0.01. Given
# our start time (zero) and final time (0.5) this means that
# we will obtain 50 output files.
subsection Postprocess
set List of postprocessors = velocity statistics, temperature statistics, heat flux statistics, depth average

subsection Depth average
set Time between graphical output = 0
end
end

subsection Solver parameters
set Temperature solver tolerance = 1e-10

subsection Stokes solver parameters
set Linear solver tolerance = 1e-7
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# This file was generated by the deal.II library.


#
# For a description of the GNUPLOT format see the GNUPLOT manual.
#
# <x> <y> <temperature> <adiabatic_temperature> <adiabatic_pressure> <adiabatic_density> <adiabatic_density_derivative> <velocity_magnitude> <sinking_velocity> <viscosity> <vertical_heat_flux>
0 -1e+07 398 0 0 3300 0 9.26353e-09 7.38108e-10 1e+21 0.00333333
300000 -1e+07 398 0 0 3300 0 9.26353e-09 7.38108e-10 1e+21 0.00333333

0 0 398 0 0 3300 0 9.26353e-09 7.38108e-10 1e+21 0.00333333
300000 0 398 0 0 3300 0 9.26353e-09 7.38108e-10 1e+21 0.00333333


300000 -1e+07 648 0 22000 3300 0 6.26512e-09 1.79074e-09 1e+21 0.00333334
600000 -1e+07 648 0 22000 3300 0 6.26512e-09 1.79074e-09 1e+21 0.00333334

300000 0 648 0 22000 3300 0 6.26512e-09 1.79074e-09 1e+21 0.00333334
600000 0 648 0 22000 3300 0 6.26512e-09 1.79074e-09 1e+21 0.00333334


600000 -1e+07 898 0 43801.8 3300 0 4.5035e-09 2.14901e-09 2.275e+22 0.00333334
900000 -1e+07 898 0 43801.8 3300 0 4.5035e-09 2.14901e-09 2.275e+22 0.00333334

600000 0 898 0 43801.8 3300 0 4.5035e-09 2.14901e-09 2.275e+22 0.00333334
900000 0 898 0 43801.8 3300 0 4.5035e-09 2.14901e-09 2.275e+22 0.00333334


900000 -1e+07 1148 0 66000 3300 0 4.40525e-09 2.15821e-09 3e+22 0.00333334
1.2e+06 -1e+07 1148 0 66000 3300 0 4.40525e-09 2.15821e-09 3e+22 0.00333334

900000 0 1148 0 66000 3300 0 4.40525e-09 2.15821e-09 3e+22 0.00333334
1.2e+06 0 1148 0 66000 3300 0 4.40525e-09 2.15821e-09 3e+22 0.00333334


1.2e+06 -1e+07 1398 0 88000 3300 0 4.45951e-09 2.0215e-09 3e+22 0.00333334
1.5e+06 -1e+07 1398 0 88000 3300 0 4.45951e-09 2.0215e-09 3e+22 0.00333334

1.2e+06 0 1398 0 88000 3300 0 4.45951e-09 2.0215e-09 3e+22 0.00333334
1.5e+06 0 1398 0 88000 3300 0 4.45951e-09 2.0215e-09 3e+22 0.00333334


1.5e+06 -1e+07 1648 0 110000 3300 0 4.34517e-09 1.77607e-09 3e+22 0.00333334
1.8e+06 -1e+07 1648 0 110000 3300 0 4.34517e-09 1.77607e-09 3e+22 0.00333334

1.5e+06 0 1648 0 110000 3300 0 4.34517e-09 1.77607e-09 3e+22 0.00333334
1.8e+06 0 1648 0 110000 3300 0 4.34517e-09 1.77607e-09 3e+22 0.00333334


1.8e+06 -1e+07 1898 0 132000 3300 0 4.07347e-09 1.45248e-09 3e+22 0.00333333
2.1e+06 -1e+07 1898 0 132000 3300 0 4.07347e-09 1.45248e-09 3e+22 0.00333333

1.8e+06 0 1898 0 132000 3300 0 4.07347e-09 1.45248e-09 3e+22 0.00333333
2.1e+06 0 1898 0 132000 3300 0 4.07347e-09 1.45248e-09 3e+22 0.00333333


2.1e+06 -1e+07 2148 0 154000 3300 0 3.69673e-09 1.07374e-09 3e+22 0.00333333
2.4e+06 -1e+07 2148 0 154000 3300 0 3.69673e-09 1.07374e-09 3e+22 0.00333333

2.1e+06 0 2148 0 154000 3300 0 3.69673e-09 1.07374e-09 3e+22 0.00333333
2.4e+06 0 2148 0 154000 3300 0 3.69673e-09 1.07374e-09 3e+22 0.00333333


2.4e+06 -1e+07 2398 0 176000 3300 0 3.28028e-09 6.58265e-10 3e+22 0.00333333
2.7e+06 -1e+07 2398 0 176000 3300 0 3.28028e-09 6.58265e-10 3e+22 0.00333333

2.4e+06 0 2398 0 176000 3300 0 3.28028e-09 6.58265e-10 3e+22 0.00333333
2.7e+06 0 2398 0 176000 3300 0 3.28028e-09 6.58265e-10 3e+22 0.00333333


2.7e+06 -1e+07 2648 0 198000 3300 0 2.92812e-09 2.2172e-10 3e+22 0.00333333
3e+06 -1e+07 2648 0 198000 3300 0 2.92812e-09 2.2172e-10 3e+22 0.00333333

2.7e+06 0 2648 0 198000 3300 0 2.92812e-09 2.2172e-10 3e+22 0.00333333
3e+06 0 2648 0 198000 3300 0 2.92812e-09 2.2172e-10 3e+22 0.00333333


0 0 398 0 0 3300 0 9.13657e-09 7.26982e-10 2e+21 0.00333333
300000 0 398 0 0 3300 0 9.13657e-09 7.26982e-10 2e+21 0.00333333

0 1e+08 398 0 0 3300 0 9.13657e-09 7.26982e-10 2e+21 0.00333333
300000 1e+08 398 0 0 3300 0 9.13657e-09 7.26982e-10 2e+21 0.00333333


300000 0 648 0 22000 3300 0 6.22864e-09 1.77038e-09 2e+21 0.00333334
600000 0 648 0 22000 3300 0 6.22864e-09 1.77038e-09 2e+21 0.00333334

300000 1e+08 648 0 22000 3300 0 6.22864e-09 1.77038e-09 2e+21 0.00333334
600000 1e+08 648 0 22000 3300 0 6.22864e-09 1.77038e-09 2e+21 0.00333334


600000 0 898 0 43801.8 3300 0 4.4673e-09 2.12958e-09 4.55e+22 0.00333334
900000 0 898 0 43801.8 3300 0 4.4673e-09 2.12958e-09 4.55e+22 0.00333334

600000 1e+08 898 0 43801.8 3300 0 4.4673e-09 2.12958e-09 4.55e+22 0.00333334
900000 1e+08 898 0 43801.8 3300 0 4.4673e-09 2.12958e-09 4.55e+22 0.00333334


900000 0 1148 0 66000 3300 0 4.36631e-09 2.13994e-09 6e+22 0.00333334
1.2e+06 0 1148 0 66000 3300 0 4.36631e-09 2.13994e-09 6e+22 0.00333334

900000 1e+08 1148 0 66000 3300 0 4.36631e-09 2.13994e-09 6e+22 0.00333334
1.2e+06 1e+08 1148 0 66000 3300 0 4.36631e-09 2.13994e-09 6e+22 0.00333334


1.2e+06 0 1398 0 88000 3300 0 4.42128e-09 2.00527e-09 6e+22 0.00333334
1.5e+06 0 1398 0 88000 3300 0 4.42128e-09 2.00527e-09 6e+22 0.00333334

1.2e+06 1e+08 1398 0 88000 3300 0 4.42128e-09 2.00527e-09 6e+22 0.00333334
1.5e+06 1e+08 1398 0 88000 3300 0 4.42128e-09 2.00527e-09 6e+22 0.00333334


1.5e+06 0 1648 0 110000 3300 0 4.30968e-09 1.76239e-09 6e+22 0.00333334
1.8e+06 0 1648 0 110000 3300 0 4.30968e-09 1.76239e-09 6e+22 0.00333334

1.5e+06 1e+08 1648 0 110000 3300 0 4.30968e-09 1.76239e-09 6e+22 0.00333334
1.8e+06 1e+08 1648 0 110000 3300 0 4.30968e-09 1.76239e-09 6e+22 0.00333334


1.8e+06 0 1898 0 132000 3300 0 4.04169e-09 1.44164e-09 6e+22 0.00333333
2.1e+06 0 1898 0 132000 3300 0 4.04169e-09 1.44164e-09 6e+22 0.00333333

1.8e+06 1e+08 1898 0 132000 3300 0 4.04169e-09 1.44164e-09 6e+22 0.00333333
2.1e+06 1e+08 1898 0 132000 3300 0 4.04169e-09 1.44164e-09 6e+22 0.00333333


2.1e+06 0 2148 0 154000 3300 0 3.66899e-09 1.06591e-09 6e+22 0.00333333
2.4e+06 0 2148 0 154000 3300 0 3.66899e-09 1.06591e-09 6e+22 0.00333333

2.1e+06 1e+08 2148 0 154000 3300 0 3.66899e-09 1.06591e-09 6e+22 0.00333333
2.4e+06 1e+08 2148 0 154000 3300 0 3.66899e-09 1.06591e-09 6e+22 0.00333333


2.4e+06 0 2398 0 176000 3300 0 3.25642e-09 6.53538e-10 6e+22 0.00333333
2.7e+06 0 2398 0 176000 3300 0 3.25642e-09 6.53538e-10 6e+22 0.00333333

2.4e+06 1e+08 2398 0 176000 3300 0 3.25642e-09 6.53538e-10 6e+22 0.00333333
2.7e+06 1e+08 2398 0 176000 3300 0 3.25642e-09 6.53538e-10 6e+22 0.00333333


2.7e+06 0 2648 0 198000 3300 0 2.90722e-09 2.2014e-10 6e+22 0.00333333
3e+06 0 2648 0 198000 3300 0 2.90722e-09 2.2014e-10 6e+22 0.00333333

2.7e+06 1e+08 2648 0 198000 3300 0 2.90722e-09 2.2014e-10 6e+22 0.00333333
3e+06 1e+08 2648 0 198000 3300 0 2.90722e-09 2.2014e-10 6e+22 0.00333333


22 changes: 22 additions & 0 deletions tests/depth_dependent_box_function_time_dependent/statistics
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 1: Time step number
# 2: Time (years)
# 3: Time step size (years)
# 4: Number of mesh cells
# 5: Number of Stokes degrees of freedom
# 6: Number of temperature degrees of freedom
# 7: Iterations for temperature solver
# 8: Iterations for Stokes solver
# 9: Velocity iterations in Stokes preconditioner
# 10: Schur complement iterations in Stokes preconditioner
# 11: RMS velocity (m/year)
# 12: Max. velocity (m/year)
# 13: Minimal temperature (K)
# 14: Average temperature (K)
# 15: Maximal temperature (K)
# 16: Average nondimensional temperature (K)
# 17: Outward heat flux through boundary with indicator 0 ("left") (W)
# 18: Outward heat flux through boundary with indicator 1 ("right") (W)
# 19: Outward heat flux through boundary with indicator 2 ("bottom") (W)
# 20: Outward heat flux through boundary with indicator 3 ("top") (W)
0 0.000000000000e+00 0.000000000000e+00 256 2467 1089 0 47 48 47 5.32752679e-09 1.56401506e-08 2.73000000e+02 1.52300000e+03 2.77300000e+03 5.00000000e-01 -1.85851936e-02 1.85851936e-02 -1.00000000e+04 1.00000000e+04
1 1.000000000000e+08 1.000000000000e+08 256 2467 1089 5 41 42 42 5.27518932e-09 1.53609838e-08 2.73000000e+02 1.52299999e+03 2.77300000e+03 4.99999995e-01 -1.91901050e-02 1.92081091e-02 -1.00000000e+04 9.99997158e+03

0 comments on commit 1490ab4

Please sign in to comment.