Skip to content

Commit

Permalink
Merge pull request #6215 from gassmoeller/use_conductivity_interface
Browse files Browse the repository at this point in the history
Use conductivity interface to remove code duplication
  • Loading branch information
jdannberg authored Feb 4, 2025
2 parents a357fec + f6f3655 commit ae4290f
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 320 deletions.
29 changes: 5 additions & 24 deletions include/aspect/material_model/entropy_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <aspect/utilities.h>
#include <aspect/simulator_access.h>
#include <aspect/material_model/thermal_conductivity/interface.h>
#include <aspect/material_model/rheology/ascii_depth_profile.h>
#include <aspect/material_model/rheology/drucker_prager.h>
#include <aspect/material_model/steinberger.h>
Expand Down Expand Up @@ -124,31 +125,11 @@ namespace aspect
double max_lateral_eta_variation;

/**
* The value for thermal conductivity. It can be a constant
* for the whole domain, or P-T dependent.
* The thermal conductivity parametrization to use. This material
* model supports either a constant thermal conductivity or a
* pressure- and temperature-dependent thermal conductivity.
*/
double thermal_conductivity_value;
double thermal_conductivity (const double temperature,
const double pressure,
const Point<dim> &position) const;

enum ConductivityFormulation
{
constant,
p_T_dependent
} conductivity_formulation;

/**
* Parameters for the temperature- and pressure dependence of the
* thermal conductivity.
*/
std::vector<double> conductivity_transition_depths;
std::vector<double> reference_thermal_conductivities;
std::vector<double> conductivity_pressure_dependencies;
std::vector<double> conductivity_reference_temperatures;
std::vector<double> conductivity_exponents;
std::vector<double> saturation_scaling;
double maximum_conductivity;
std::unique_ptr<ThermalConductivity::Interface<dim>> thermal_conductivity;

/**
* Information about the location of data files.
Expand Down
45 changes: 7 additions & 38 deletions include/aspect/material_model/steinberger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <aspect/material_model/interface.h>
#include <aspect/material_model/equation_of_state/thermodynamic_table_lookup.h>
#include <aspect/material_model/thermal_conductivity/interface.h>

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


private:
/**
* Compute the pressure- and temperature-dependent thermal
* conductivity either as a constant value, or based on the
* equation given in Stackhouse et al., 2015: First-principles
* calculations of the lattice thermal conductivity of the
* lower mantle, or based on the equation given in Tosi et al.,
* 2013: Mantle dynamics with pressure- and temperature-dependent
* thermal expansivity and conductivity.
*/
double thermal_conductivity (const double temperature,
const double pressure,
const Point<dim> &position) const;

/**
* Whether the compositional fields representing mass fractions
* should be normalized to one when computing their fractions
Expand Down Expand Up @@ -248,31 +237,11 @@ namespace aspect
bool use_lateral_average_temperature;

/**
* The value of the thermal conductivity if a constant thermal
* conductivity is used for the whole domain.
*/
double thermal_conductivity_value;

/**
* Enumeration for selecting which type of conductivity law to use.
*/
enum ConductivityFormulation
{
constant,
p_T_dependent
} conductivity_formulation;

/**
* Parameters for the temperature- and pressure dependence of the
* thermal conductivity.
* The thermal conductivity parametrization to use. This material
* model supports either a constant thermal conductivity or a
* pressure- and temperature-dependent thermal conductivity.
*/
std::vector<double> conductivity_transition_depths;
std::vector<double> reference_thermal_conductivities;
std::vector<double> conductivity_pressure_dependencies;
std::vector<double> conductivity_reference_temperatures;
std::vector<double> conductivity_exponents;
std::vector<double> saturation_scaling;
double maximum_conductivity;
std::unique_ptr<ThermalConductivity::Interface<dim>> thermal_conductivity;

/**
* Compositional prefactors with which to multiply the reference viscosity.
Expand Down
114 changes: 114 additions & 0 deletions include/aspect/material_model/thermal_conductivity/tosi_stackhouse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
Copyright (C) 2025 - 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 LICENSE. If not see
<http://www.gnu.org/licenses/>.
*/

#ifndef _aspect_material_model_thermal_conductivity_tosi_stackhouse_h
#define _aspect_material_model_thermal_conductivity_tosi_stackhouse_h

#include <aspect/material_model/thermal_conductivity/interface.h>


namespace aspect
{
namespace MaterialModel
{
namespace ThermalConductivity
{
using namespace dealii;

/**
* A class that implements a pressure- and temperature-dependent thermal conductivity
* following the formulation of
*
* Nicola Tosi, David A. Yuen, Nico de Koker, Renata M. Wentzcovitch,
* Mantle dynamics with pressure- and temperature-dependent thermal expansivity and conductivity,
* Physics of the Earth and Planetary Interiors, Volume 217,
* 2013, Pages 48-58, ISSN 0031-9201, https://doi.org/10.1016/j.pepi.2013.02.004,
*
* and
*
* Stephen Stackhouse, Lars Stixrude, Bijaya B. Karki,
* First-principles calculations of the lattice thermal conductivity of the lower mantle,
* Earth and Planetary Science Letters, Volume 427, 2015, Pages 11-17, ISSN 0012-821X,
* https://doi.org/10.1016/j.epsl.2015.06.050.
*
* The thermal conductivity parameter sets can be chosen in such a
* way that either the Stackhouse or the Tosi relations are used.
* The conductivity description can consist of several layers with
* different sets of parameters. Note that the Stackhouse
* parametrization is only valid for the lower mantle (bridgmanite).
*
* The default parameters of this class use the Tosi parametrization in the upper
* mantle and the Stackhouse parametrization in the lower mantle, which is how
* it was used in the publication
*
* Juliane Dannberg, Rene Gassmöller, Daniele Thallner, Frederick LaCombe, Courtney Sprain,
* Changes in core–mantle boundary heat flux patterns throughout the supercontinent cycle,
* Geophysical Journal International, Volume 237, Issue 3, June 2024, Pages 1251–1274, https://doi.org/10.1093/gji/ggae075,
*
* which introduced this implementation.
*
* @ingroup MaterialModels
*/
template <int dim>
class TosiStackhouse : public Interface<dim>, public aspect::SimulatorAccess<dim>
{
public:
/**
* Function to compute the thermal conductivities in @p out given the
* inputs in @p in.
*/
void evaluate (const MaterialModel::MaterialModelInputs<dim> &in,
MaterialModel::MaterialModelOutputs<dim> &out) const override;

/**
* Declare the parameters this plugin takes through input files.
*/
static
void
declare_parameters (ParameterHandler &prm);

/**
* Read the parameters from the parameter file.
*/
void
parse_parameters (ParameterHandler &prm) override;

private:
/**
* Parameters for the temperature and pressure dependence of the
* thermal conductivity.
*/
std::vector<double> conductivity_transition_depths;
std::vector<double> reference_thermal_conductivities;
std::vector<double> conductivity_pressure_dependencies;
std::vector<double> conductivity_reference_temperatures;
std::vector<double> conductivity_exponents;
std::vector<double> saturation_scaling;

/**
* The maximum allowed thermal conductivity.
*/
double maximum_conductivity;
};
}
}
}

#endif
Loading

0 comments on commit ae4290f

Please sign in to comment.