Skip to content

Commit

Permalink
Add tests for all coordinate systems
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed May 31, 2024
1 parent 86dadef commit 2cf4c22
Show file tree
Hide file tree
Showing 13 changed files with 7,714 additions and 12 deletions.
26 changes: 14 additions & 12 deletions source/heating_model/function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ namespace aspect
{
for (unsigned int q=0; q<heating_model_outputs.heating_source_terms.size(); ++q)
{
// return a constant value
// convert the position into the selected coordinate system
const Point<dim> position = material_model_inputs.position[q];
const Utilities::NaturalCoordinate<dim> point =
this->get_geometry_model().cartesian_to_other_coordinates(position, coordinate_system);

// then compute the heating function value at this position
heating_model_outputs.heating_source_terms[q] = heating_model_function.value(Utilities::convert_array_to_point<dim>(point.get_coordinates()))
* material_model_outputs.densities[q];
heating_model_outputs.lhs_latent_heat_terms[q] = 0.0;
Expand Down Expand Up @@ -74,19 +76,19 @@ namespace aspect
{
prm.enter_subsection("Heating model");
{
prm.declare_entry ("Coordinate system", "cartesian",
Patterns::Selection ("cartesian|spherical|depth"),
"A selection that determines the assumed coordinate "
"system for the function variables. Allowed values "
"are `cartesian', `spherical', and `depth'. `spherical' coordinates "
"are interpreted as r,phi or r,phi,theta in 2d/3d "
"respectively with theta being the polar angle. `depth' "
"will create a function, in which only the first "
"parameter is non-zero, which is interpreted to "
"be the depth of the point.");

prm.enter_subsection("Function");
{
prm.declare_entry ("Coordinate system", "cartesian",
Patterns::Selection ("cartesian|spherical|depth"),
"A selection that determines the assumed coordinate "
"system for the function variables. Allowed values "
"are `cartesian', `spherical', and `depth'. `spherical' coordinates "
"are interpreted as r,phi or r,phi,theta in 2d/3d "
"respectively with theta being the polar angle. `depth' "
"will create a function, in which only the first "
"parameter is non-zero, which is interpreted to "
"be the depth of the point.");

Functions::ParsedFunction<dim>::declare_parameters (prm, 1);
}
prm.leave_subsection();
Expand Down
67 changes: 67 additions & 0 deletions tests/heating_function.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# A test for the function heating plugin.
# The heating function is given in cartesian coordinates.

set Dimension = 2
set End time = 0.0
set Use years in output instead of seconds = false

subsection Geometry model
set Model name = spherical shell

subsection Spherical shell
set Inner radius = 0.55
set Outer radius = 1.0
set Opening angle = 360
end
end

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

subsection Material model
set Model name = simple

subsection Simple model
set Reference density = 1
set Viscosity = 1
set Thermal expansion coefficient = 0
end
end

subsection Gravity model
set Model name = radial constant
end

subsection Initial temperature model
set Model name = function

subsection Function
set Function expression = 0
end
end

subsection Heating model
set List of model names = function

subsection Function
set Function expression = x
end
end

subsection Mesh refinement
set Initial adaptive refinement = 0
set Strategy = thermal energy density
set Initial global refinement = 2
set Time steps between mesh refinement = 0
end

subsection Postprocess
set List of postprocessors = heating statistics, visualization

subsection Visualization
set List of output variables = heating
set Output format = gnuplot
set Time between graphical output = 0.0
end
end
17 changes: 17 additions & 0 deletions tests/heating_function/screen-output
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Number of active cells: 192 (on 3 levels)
Number of degrees of freedom: 2,832 (1,728+240+864)

*** Timestep 0: t=0 seconds, dt=0 seconds
Skipping temperature solve because RHS is zero.
Rebuilding Stokes preconditioner...
Solving Stokes system... 34+0 iterations.

Postprocessing:
Heating rate (average/total): 3.083e-17 W/kg, 6.755e-17 W
Writing graphical output: output-heating_function/solution/solution-00000

Termination requested by criterion: end time



Loading

0 comments on commit 2cf4c22

Please sign in to comment.