-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6211 from gassmoeller/add_conductivity_interface
Implement thermal conductivity plugins
- Loading branch information
Showing
6 changed files
with
225 additions
and
11 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 |
---|---|---|
@@ -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. | ||
<br> | ||
(Rene Gassmoeller, 2025/01/27) |
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
74 changes: 74 additions & 0 deletions
74
include/aspect/material_model/thermal_conductivity/constant.h
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,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 | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _aspect_material_model_thermal_conductivity_constant_h | ||
#define _aspect_material_model_thermal_conductivity_constant_h | ||
|
||
#include <aspect/material_model/thermal_conductivity/interface.h> | ||
|
||
|
||
namespace aspect | ||
{ | ||
namespace MaterialModel | ||
{ | ||
namespace ThermalConductivity | ||
{ | ||
using namespace dealii; | ||
|
||
/** | ||
* A class that implements a constant thermal conductivity. | ||
* | ||
* @ingroup MaterialModels | ||
*/ | ||
template <int dim> | ||
class Constant : public Interface<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: | ||
/** | ||
* The thermal conductivity. | ||
*/ | ||
double k; | ||
}; | ||
} | ||
} | ||
} | ||
|
||
#endif |
62 changes: 62 additions & 0 deletions
62
include/aspect/material_model/thermal_conductivity/interface.h
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,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 | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _aspect_material_model_thermal_conductivity_interface_h | ||
#define _aspect_material_model_thermal_conductivity_interface_h | ||
|
||
#include <aspect/global.h> | ||
#include <aspect/plugins.h> | ||
#include <aspect/material_model/interface.h> | ||
|
||
|
||
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 <int dim> | ||
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<dim> &in, | ||
MaterialModel::MaterialModelOutputs<dim> &out) const = 0; | ||
}; | ||
} | ||
} | ||
} | ||
|
||
#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,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 | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <aspect/material_model/thermal_conductivity/constant.h> | ||
|
||
namespace aspect | ||
{ | ||
namespace MaterialModel | ||
{ | ||
namespace ThermalConductivity | ||
{ | ||
template <int dim> | ||
void | ||
Constant<dim>::evaluate (const MaterialModel::MaterialModelInputs<dim> &/*in*/, | ||
MaterialModel::MaterialModelOutputs<dim> &out) const | ||
{ | ||
for (auto &thermal_conductivity: out.thermal_conductivities) | ||
thermal_conductivity = k; | ||
} | ||
|
||
|
||
|
||
template <int dim> | ||
void | ||
Constant<dim>::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 <int dim> | ||
void | ||
Constant<dim>::parse_parameters (ParameterHandler &prm) | ||
{ | ||
k = prm.get_double ("Thermal conductivity"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// explicit instantiations | ||
namespace aspect | ||
{ | ||
namespace MaterialModel | ||
{ | ||
namespace ThermalConductivity | ||
{ | ||
#define INSTANTIATE(dim) \ | ||
template class Constant<dim>; | ||
|
||
ASPECT_INSTANTIATE(INSTANTIATE) | ||
|
||
#undef INSTANTIATE | ||
} | ||
} | ||
} |