diff --git a/doc/modules/changes/20250127_gassmoeller b/doc/modules/changes/20250127_gassmoeller
new file mode 100644
index 00000000000..8268bf296ff
--- /dev/null
+++ b/doc/modules/changes/20250127_gassmoeller
@@ -0,0 +1,6 @@
+New: ASPECT now has an interface for plugins that describe thermal
+conductivity. This is useful to share functionality to compute
+thermal conductivity across material models. Material models can,
+but do not have to make use of these plugins.
+
+(Rene Gassmoeller, 2025/01/27)
diff --git a/include/aspect/material_model/simpler.h b/include/aspect/material_model/simpler.h
index f2f89c8aa02..cf4ff1a2487 100644
--- a/include/aspect/material_model/simpler.h
+++ b/include/aspect/material_model/simpler.h
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
namespace aspect
{
@@ -74,8 +75,7 @@ namespace aspect
*/
private:
- double k_value;
-
+ ThermalConductivity::Constant thermal_conductivity;
Rheology::ConstantViscosity constant_rheology;
EquationOfState::LinearizedIncompressible equation_of_state;
};
diff --git a/include/aspect/material_model/thermal_conductivity/constant.h b/include/aspect/material_model/thermal_conductivity/constant.h
new file mode 100644
index 00000000000..566e3d2f89c
--- /dev/null
+++ b/include/aspect/material_model/thermal_conductivity/constant.h
@@ -0,0 +1,74 @@
+/*
+ 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
+ .
+*/
+
+#ifndef _aspect_material_model_thermal_conductivity_constant_h
+#define _aspect_material_model_thermal_conductivity_constant_h
+
+#include
+
+
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ namespace ThermalConductivity
+ {
+ using namespace dealii;
+
+ /**
+ * A class that implements a constant thermal conductivity.
+ *
+ * @ingroup MaterialModels
+ */
+ template
+ class Constant : public Interface
+ {
+ public:
+ /**
+ * Function to compute the thermal conductivities in @p out given the
+ * inputs in @p in.
+ */
+ void evaluate (const MaterialModel::MaterialModelInputs &in,
+ MaterialModel::MaterialModelOutputs &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:
+ /**
+ * The thermal conductivity.
+ */
+ double k;
+ };
+ }
+ }
+}
+
+#endif
diff --git a/include/aspect/material_model/thermal_conductivity/interface.h b/include/aspect/material_model/thermal_conductivity/interface.h
new file mode 100644
index 00000000000..19d8db1f901
--- /dev/null
+++ b/include/aspect/material_model/thermal_conductivity/interface.h
@@ -0,0 +1,62 @@
+/*
+ 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
+ .
+*/
+
+#ifndef _aspect_material_model_thermal_conductivity_interface_h
+#define _aspect_material_model_thermal_conductivity_interface_h
+
+#include
+#include
+#include
+
+
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ namespace ThermalConductivity
+ {
+ using namespace dealii;
+
+ /**
+ * A base class for parametrizations of the thermal conductivity. Classes derived
+ * from this class will need to implement a function that computes the thermal
+ * conductivities in @p out given the inputs in @p in. Derived classes can in addition
+ * implement the functions of the base class Plugins::InterfaceBase as needed (e.g.
+ * to read in input parameters or update the parametrization at the beginning of time steps).
+ *
+ * @ingroup MaterialModels
+ */
+ template
+ class Interface : public Plugins::InterfaceBase
+ {
+ public:
+ /**
+ * Function to compute the thermal conductivities in @p out given the
+ * inputs in @p in.
+ */
+ virtual
+ void evaluate (const MaterialModel::MaterialModelInputs &in,
+ MaterialModel::MaterialModelOutputs &out) const = 0;
+ };
+ }
+ }
+}
+
+#endif
diff --git a/source/material_model/simpler.cc b/source/material_model/simpler.cc
index b4d83672e94..a3ced17df31 100644
--- a/source/material_model/simpler.cc
+++ b/source/material_model/simpler.cc
@@ -44,6 +44,8 @@ namespace aspect
// The Simpler model does not depend on composition
EquationOfStateOutputs eos_outputs (1);
+ thermal_conductivity.evaluate(in,out);
+
for (unsigned int i=0; i::declare_parameters (prm);
-
- prm.declare_entry ("Thermal conductivity", "4.7",
- Patterns::Double (0.),
- "The value of the thermal conductivity $k$. "
- "Units: \\si{\\watt\\per\\meter\\per\\kelvin}.");
+ ThermalConductivity::Constant::declare_parameters (prm);
Rheology::ConstantViscosity::declare_parameters(prm,5e24);
}
prm.leave_subsection();
@@ -94,9 +91,7 @@ namespace aspect
prm.enter_subsection("Simpler model");
{
equation_of_state.parse_parameters (prm);
-
- k_value = prm.get_double ("Thermal conductivity");
-
+ thermal_conductivity.parse_parameters (prm);
constant_rheology.parse_parameters(prm);
}
prm.leave_subsection();
diff --git a/source/material_model/thermal_conductivity/constant.cc b/source/material_model/thermal_conductivity/constant.cc
new file mode 100644
index 00000000000..68a8056151d
--- /dev/null
+++ b/source/material_model/thermal_conductivity/constant.cc
@@ -0,0 +1,77 @@
+/*
+ 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
+ .
+*/
+
+#include
+
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ namespace ThermalConductivity
+ {
+ template
+ void
+ Constant::evaluate (const MaterialModel::MaterialModelInputs &/*in*/,
+ MaterialModel::MaterialModelOutputs &out) const
+ {
+ for (auto &thermal_conductivity: out.thermal_conductivities)
+ thermal_conductivity = k;
+ }
+
+
+
+ template
+ void
+ Constant::declare_parameters (ParameterHandler &prm)
+ {
+ prm.declare_entry ("Thermal conductivity", "4.7",
+ Patterns::Double (0.),
+ "The value of the thermal conductivity $k$. "
+ "Units: \\si{\\watt\\per\\meter\\per\\kelvin}.");
+ }
+
+
+
+ template
+ void
+ Constant::parse_parameters (ParameterHandler &prm)
+ {
+ k = prm.get_double ("Thermal conductivity");
+ }
+ }
+ }
+}
+
+// explicit instantiations
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ namespace ThermalConductivity
+ {
+#define INSTANTIATE(dim) \
+ template class Constant;
+
+ ASPECT_INSTANTIATE(INSTANTIATE)
+
+#undef INSTANTIATE
+ }
+ }
+}