Skip to content

Commit ae4290f

Browse files
authored
Merge pull request #6215 from gassmoeller/use_conductivity_interface
Use conductivity interface to remove code duplication
2 parents a357fec + f6f3655 commit ae4290f

File tree

6 files changed

+335
-320
lines changed

6 files changed

+335
-320
lines changed

include/aspect/material_model/entropy_model.h

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <aspect/utilities.h>
2727
#include <aspect/simulator_access.h>
28+
#include <aspect/material_model/thermal_conductivity/interface.h>
2829
#include <aspect/material_model/rheology/ascii_depth_profile.h>
2930
#include <aspect/material_model/rheology/drucker_prager.h>
3031
#include <aspect/material_model/steinberger.h>
@@ -124,31 +125,11 @@ namespace aspect
124125
double max_lateral_eta_variation;
125126

126127
/**
127-
* The value for thermal conductivity. It can be a constant
128-
* for the whole domain, or P-T dependent.
128+
* The thermal conductivity parametrization to use. This material
129+
* model supports either a constant thermal conductivity or a
130+
* pressure- and temperature-dependent thermal conductivity.
129131
*/
130-
double thermal_conductivity_value;
131-
double thermal_conductivity (const double temperature,
132-
const double pressure,
133-
const Point<dim> &position) const;
134-
135-
enum ConductivityFormulation
136-
{
137-
constant,
138-
p_T_dependent
139-
} conductivity_formulation;
140-
141-
/**
142-
* Parameters for the temperature- and pressure dependence of the
143-
* thermal conductivity.
144-
*/
145-
std::vector<double> conductivity_transition_depths;
146-
std::vector<double> reference_thermal_conductivities;
147-
std::vector<double> conductivity_pressure_dependencies;
148-
std::vector<double> conductivity_reference_temperatures;
149-
std::vector<double> conductivity_exponents;
150-
std::vector<double> saturation_scaling;
151-
double maximum_conductivity;
132+
std::unique_ptr<ThermalConductivity::Interface<dim>> thermal_conductivity;
152133

153134
/**
154135
* Information about the location of data files.

include/aspect/material_model/steinberger.h

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <aspect/material_model/interface.h>
2525
#include <aspect/material_model/equation_of_state/thermodynamic_table_lookup.h>
26+
#include <aspect/material_model/thermal_conductivity/interface.h>
2627

2728
#include <aspect/simulator_access.h>
2829
#include <deal.II/fe/component_mask.h>
@@ -116,7 +117,8 @@ namespace aspect
116117
* The viscosity of this model is based on the paper
117118
* Steinberger & Calderwood 2006: "Models of large-scale viscous flow in the
118119
* Earth's mantle with constraints from mineral physics and surface
119-
* observations". The thermal conductivity is constant and the other
120+
* observations". The thermal conductivity is constant or follows a
121+
* pressure-temperature dependent approximation and the other
120122
* parameters are provided via lookup tables from the software PERPLEX.
121123
*
122124
* @ingroup MaterialModels
@@ -202,19 +204,6 @@ namespace aspect
202204

203205

204206
private:
205-
/**
206-
* Compute the pressure- and temperature-dependent thermal
207-
* conductivity either as a constant value, or based on the
208-
* equation given in Stackhouse et al., 2015: First-principles
209-
* calculations of the lattice thermal conductivity of the
210-
* lower mantle, or based on the equation given in Tosi et al.,
211-
* 2013: Mantle dynamics with pressure- and temperature-dependent
212-
* thermal expansivity and conductivity.
213-
*/
214-
double thermal_conductivity (const double temperature,
215-
const double pressure,
216-
const Point<dim> &position) const;
217-
218207
/**
219208
* Whether the compositional fields representing mass fractions
220209
* should be normalized to one when computing their fractions
@@ -248,31 +237,11 @@ namespace aspect
248237
bool use_lateral_average_temperature;
249238

250239
/**
251-
* The value of the thermal conductivity if a constant thermal
252-
* conductivity is used for the whole domain.
253-
*/
254-
double thermal_conductivity_value;
255-
256-
/**
257-
* Enumeration for selecting which type of conductivity law to use.
258-
*/
259-
enum ConductivityFormulation
260-
{
261-
constant,
262-
p_T_dependent
263-
} conductivity_formulation;
264-
265-
/**
266-
* Parameters for the temperature- and pressure dependence of the
267-
* thermal conductivity.
240+
* The thermal conductivity parametrization to use. This material
241+
* model supports either a constant thermal conductivity or a
242+
* pressure- and temperature-dependent thermal conductivity.
268243
*/
269-
std::vector<double> conductivity_transition_depths;
270-
std::vector<double> reference_thermal_conductivities;
271-
std::vector<double> conductivity_pressure_dependencies;
272-
std::vector<double> conductivity_reference_temperatures;
273-
std::vector<double> conductivity_exponents;
274-
std::vector<double> saturation_scaling;
275-
double maximum_conductivity;
244+
std::unique_ptr<ThermalConductivity::Interface<dim>> thermal_conductivity;
276245

277246
/**
278247
* Compositional prefactors with which to multiply the reference viscosity.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
Copyright (C) 2025 - by the authors of the ASPECT code.
3+
4+
This file is part of ASPECT.
5+
6+
ASPECT is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation; either version 2, or (at your option)
9+
any later version.
10+
11+
ASPECT is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with ASPECT; see the file LICENSE. If not see
18+
<http://www.gnu.org/licenses/>.
19+
*/
20+
21+
#ifndef _aspect_material_model_thermal_conductivity_tosi_stackhouse_h
22+
#define _aspect_material_model_thermal_conductivity_tosi_stackhouse_h
23+
24+
#include <aspect/material_model/thermal_conductivity/interface.h>
25+
26+
27+
namespace aspect
28+
{
29+
namespace MaterialModel
30+
{
31+
namespace ThermalConductivity
32+
{
33+
using namespace dealii;
34+
35+
/**
36+
* A class that implements a pressure- and temperature-dependent thermal conductivity
37+
* following the formulation of
38+
*
39+
* Nicola Tosi, David A. Yuen, Nico de Koker, Renata M. Wentzcovitch,
40+
* Mantle dynamics with pressure- and temperature-dependent thermal expansivity and conductivity,
41+
* Physics of the Earth and Planetary Interiors, Volume 217,
42+
* 2013, Pages 48-58, ISSN 0031-9201, https://doi.org/10.1016/j.pepi.2013.02.004,
43+
*
44+
* and
45+
*
46+
* Stephen Stackhouse, Lars Stixrude, Bijaya B. Karki,
47+
* First-principles calculations of the lattice thermal conductivity of the lower mantle,
48+
* Earth and Planetary Science Letters, Volume 427, 2015, Pages 11-17, ISSN 0012-821X,
49+
* https://doi.org/10.1016/j.epsl.2015.06.050.
50+
*
51+
* The thermal conductivity parameter sets can be chosen in such a
52+
* way that either the Stackhouse or the Tosi relations are used.
53+
* The conductivity description can consist of several layers with
54+
* different sets of parameters. Note that the Stackhouse
55+
* parametrization is only valid for the lower mantle (bridgmanite).
56+
*
57+
* The default parameters of this class use the Tosi parametrization in the upper
58+
* mantle and the Stackhouse parametrization in the lower mantle, which is how
59+
* it was used in the publication
60+
*
61+
* Juliane Dannberg, Rene Gassmöller, Daniele Thallner, Frederick LaCombe, Courtney Sprain,
62+
* Changes in core–mantle boundary heat flux patterns throughout the supercontinent cycle,
63+
* Geophysical Journal International, Volume 237, Issue 3, June 2024, Pages 1251–1274, https://doi.org/10.1093/gji/ggae075,
64+
*
65+
* which introduced this implementation.
66+
*
67+
* @ingroup MaterialModels
68+
*/
69+
template <int dim>
70+
class TosiStackhouse : public Interface<dim>, public aspect::SimulatorAccess<dim>
71+
{
72+
public:
73+
/**
74+
* Function to compute the thermal conductivities in @p out given the
75+
* inputs in @p in.
76+
*/
77+
void evaluate (const MaterialModel::MaterialModelInputs<dim> &in,
78+
MaterialModel::MaterialModelOutputs<dim> &out) const override;
79+
80+
/**
81+
* Declare the parameters this plugin takes through input files.
82+
*/
83+
static
84+
void
85+
declare_parameters (ParameterHandler &prm);
86+
87+
/**
88+
* Read the parameters from the parameter file.
89+
*/
90+
void
91+
parse_parameters (ParameterHandler &prm) override;
92+
93+
private:
94+
/**
95+
* Parameters for the temperature and pressure dependence of the
96+
* thermal conductivity.
97+
*/
98+
std::vector<double> conductivity_transition_depths;
99+
std::vector<double> reference_thermal_conductivities;
100+
std::vector<double> conductivity_pressure_dependencies;
101+
std::vector<double> conductivity_reference_temperatures;
102+
std::vector<double> conductivity_exponents;
103+
std::vector<double> saturation_scaling;
104+
105+
/**
106+
* The maximum allowed thermal conductivity.
107+
*/
108+
double maximum_conductivity;
109+
};
110+
}
111+
}
112+
}
113+
114+
#endif

0 commit comments

Comments
 (0)