-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ec0d83
commit 368133a
Showing
8 changed files
with
302 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
New: A new initial temperature condition was added that adds a random | ||
noise of user prescribed magnitude to the initial temperature field. | ||
The same type of plugin was added for initial compositions. | ||
<br> | ||
(Rene Gassmoeller, 2017/06/19) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
Copyright (C) 2017 by the authors of the ASPECT code. | ||
This file is part of ASPECT. | ||
ASPECT is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2, or (at your option) | ||
any later version. | ||
ASPECT is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with ASPECT; see the file doc/COPYING. If not see | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#ifndef _aspect_initial_composition_random_perturbation_h | ||
#define _aspect_initial_composition_random_perturbation_h | ||
|
||
#include <aspect/initial_composition/interface.h> | ||
|
||
DEAL_II_DISABLE_EXTRA_DIAGNOSTICS | ||
#include <boost/random.hpp> | ||
DEAL_II_ENABLE_EXTRA_DIAGNOSTICS | ||
|
||
namespace aspect | ||
{ | ||
namespace InitialComposition | ||
{ | ||
using namespace dealii; | ||
|
||
/** | ||
* A class that describes a perturbation for the initial composition fields | ||
* for any geometry model or dimension. The perturbation follows | ||
* a random noise of a prescribed magnitude. | ||
* | ||
* @ingroup InitialCompositions | ||
*/ | ||
template <int dim> | ||
class RandomPerturbation : public Interface<dim> | ||
{ | ||
public: | ||
/** | ||
* Constructor. | ||
*/ | ||
RandomPerturbation(); | ||
|
||
/** | ||
* Return the initial temperature as a function of position. | ||
*/ | ||
virtual | ||
double initial_composition (const Point<dim> &position, | ||
const unsigned int compositional_index) const; | ||
|
||
/** | ||
* Declare the parameters this class takes through input files. | ||
*/ | ||
static | ||
void | ||
declare_parameters (ParameterHandler &prm); | ||
|
||
/** | ||
* Read the parameters this class declares from the parameter file. | ||
*/ | ||
virtual | ||
void | ||
parse_parameters (ParameterHandler &prm); | ||
|
||
|
||
private: | ||
/** | ||
* The maximal magnitude of the random noise. | ||
*/ | ||
double magnitude; | ||
|
||
/** | ||
* Random number generator. | ||
*/ | ||
mutable boost::mt19937 random_number_generator; | ||
}; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
Copyright (C) 2017 by the authors of the ASPECT code. | ||
This file is part of ASPECT. | ||
ASPECT is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2, or (at your option) | ||
any later version. | ||
ASPECT is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with ASPECT; see the file doc/COPYING. If not see | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#include <aspect/initial_composition/random_perturbation.h> | ||
|
||
namespace aspect | ||
{ | ||
namespace InitialComposition | ||
{ | ||
template <int dim> | ||
RandomPerturbation<dim>:: | ||
RandomPerturbation () | ||
: | ||
random_number_generator(5432) | ||
{ | ||
} | ||
|
||
template <int dim> | ||
double | ||
RandomPerturbation<dim>:: | ||
initial_composition (const Point<dim> &/*position*/, | ||
const unsigned int /*compositional_index*/) const | ||
{ | ||
// Uniform distribution on the interval [0,1]. This | ||
// will be used to generate the random composition perturbation. | ||
boost::uniform_01<double> uniform_distribution_01; | ||
|
||
return magnitude * 2.0 * (uniform_distribution_01(random_number_generator) - 0.5); | ||
} | ||
|
||
template <int dim> | ||
void | ||
RandomPerturbation<dim>::declare_parameters (ParameterHandler &prm) | ||
{ | ||
prm.enter_subsection ("Initial composition model"); | ||
{ | ||
prm.enter_subsection("Random perturbation"); | ||
{ | ||
prm.declare_entry ("Magnitude", "1.0", | ||
Patterns::Double (0), | ||
"The magnitude of the random perturbation."); | ||
} | ||
prm.leave_subsection (); | ||
} | ||
prm.leave_subsection (); | ||
} | ||
|
||
|
||
template <int dim> | ||
void | ||
RandomPerturbation<dim>::parse_parameters (ParameterHandler &prm) | ||
{ | ||
prm.enter_subsection ("Initial composition model"); | ||
{ | ||
prm.enter_subsection("Random perturbation"); | ||
{ | ||
magnitude = prm.get_double ("Magnitude"); | ||
} | ||
prm.leave_subsection (); | ||
} | ||
prm.leave_subsection (); | ||
} | ||
} | ||
} | ||
|
||
// explicit instantiations | ||
namespace aspect | ||
{ | ||
namespace InitialComposition | ||
{ | ||
ASPECT_REGISTER_INITIAL_COMPOSITION_MODEL(RandomPerturbation, | ||
"random perturbation", | ||
"An initial composition anomaly that perturbs the composition " | ||
"following a random noise with uniform distribution and user " | ||
"specified magnitude.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Test to check the status of the random initial temperature perturbation | ||
# plugin. | ||
|
||
set End time = 0 | ||
|
||
subsection Boundary temperature model | ||
set List of model names = box | ||
end | ||
|
||
|
||
subsection Gravity model | ||
set Model name = vertical | ||
end | ||
|
||
|
||
subsection Geometry model | ||
set Model name = box | ||
|
||
subsection Box | ||
set X extent = 1 | ||
set Y extent = 1 | ||
end | ||
end | ||
|
||
|
||
subsection Initial temperature model | ||
set List of model names = function | ||
|
||
subsection Function | ||
set Function expression = 0.5 | ||
end | ||
end | ||
|
||
subsection Compositional fields | ||
set Number of fields = 2 | ||
end | ||
|
||
subsection Initial composition model | ||
set List of model names = function, random perturbation | ||
|
||
subsection Random perturbation | ||
set Magnitude = 0.2 | ||
end | ||
|
||
subsection Function | ||
set Function expression = 0.5;0.0 | ||
end | ||
end | ||
|
||
|
||
subsection Material model | ||
set Model name = simpler | ||
end | ||
|
||
|
||
subsection Mesh refinement | ||
set Initial adaptive refinement = 0 | ||
set Initial global refinement = 3 | ||
end | ||
|
||
|
||
subsection Model settings | ||
set Tangential velocity boundary indicators = left, right, bottom, top | ||
end | ||
|
||
subsection Postprocess | ||
set List of postprocessors = composition statistics | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
Number of active cells: 64 (on 4 levels) | ||
Number of degrees of freedom: 1,526 (578+81+289+289+289) | ||
|
||
*** Timestep 0: t=0 years | ||
Solving temperature system... 0 iterations. | ||
Solving C_1 system ... 0 iterations. | ||
Solving C_2 system ... 0 iterations. | ||
Rebuilding Stokes preconditioner... | ||
Solving Stokes system... 2+0 iterations. | ||
|
||
Postprocessing: | ||
Compositions min/max/mass: 0.3001/0.6984/0.4938 // -0.2/0.1996/-0.01184 | ||
|
||
Termination requested by criterion: end time | ||
|
||
|
||
+---------------------------------------------+------------+------------+ | ||
+---------------------------------+-----------+------------+------------+ | ||
+---------------------------------+-----------+------------+------------+ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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: Number of degrees of freedom for all compositions | ||
# 8: Iterations for temperature solver | ||
# 9: Iterations for composition solver 1 | ||
# 10: Iterations for composition solver 2 | ||
# 11: Iterations for Stokes solver | ||
# 12: Velocity iterations in Stokes preconditioner | ||
# 13: Schur complement iterations in Stokes preconditioner | ||
# 14: Minimal value for composition C_1 | ||
# 15: Maximal value for composition C_1 | ||
# 16: Global mass for composition C_1 | ||
# 17: Minimal value for composition C_2 | ||
# 18: Maximal value for composition C_2 | ||
# 19: Global mass for composition C_2 | ||
0 0.000000000000e+00 0.000000000000e+00 64 659 289 578 0 0 0 2 3 2 3.00090365e-01 6.98414874e-01 4.93781411e-01 -1.99952361e-01 1.99564844e-01 -1.18366501e-02 |