Permalink
Please sign in to comment.
Browse files
Merge pull request #12648 from tophmatthews/ad_dt_12633
Added ADHeatConductionTimeDerivative
- Loading branch information...
Showing
with
156 additions
and 22 deletions.
- +26 −0 modules/heat_conduction/doc/content/source/kernels/ADHeatConductionTimeDerivative.md
- +37 −0 modules/heat_conduction/include/kernels/ADHeatConductionTimeDerivative.h
- +2 −1 modules/heat_conduction/src/kernels/ADHeatConduction.C
- +41 −0 modules/heat_conduction/src/kernels/ADHeatConductionTimeDerivative.C
- +45 −15 modules/heat_conduction/test/tests/ad_heat_conduction/test.i
- +1 −1 modules/heat_conduction/test/tests/ad_heat_conduction/tests
- +4 −5 modules/heat_conduction/test/tests/verify_against_analytical/ad_1D_transient.i
@@ -0,0 +1,26 @@ | |||
# ADHeatConductionTimeDerivative | |||
|
|||
## Description | |||
|
|||
The `ADHeatConductionTimeDerivative` kernel implements a time derivative for the domain $\Omega$ given by | |||
|
|||
\begin{equation} | |||
\underbrace{\rho c_p \frac{\partial u}{\partial t}}_{\textrm{ADHeatConductionTimeDerivative}} + | |||
\sum_{i=1}^n \beta_i = 0 \in \Omega. | |||
\end{equation} | |||
where $\rho$ is the material density, $c_p$ is the specific heat, and the second term on the left hand side corresponds to the strong forms of | |||
other kernels. The corresponding `ADHeatConductionTimeDerivative` weak form using inner-product notation is | |||
|
|||
\begin{equation} | |||
R_i(u_h) = (\psi_i, \rho c_p\frac{\partial u_h}{\partial t}) \quad \forall \psi_i, | |||
\end{equation} | |||
where $u_h$ is the approximate solution and $\psi_i$ is a finite element test function. | |||
|
|||
The Jacobian is given by automatic differentiation, and should be perfect as long as $c_p$ and $\rho$ | |||
are provided using `ADMaterial` derived objects. | |||
|
|||
!syntax parameters /ADKernels/ADHeatConductionTimeDerivative<RESIDUAL> | |||
|
|||
!syntax inputs /ADKernels/ADHeatConductionTimeDerivative<RESIDUAL> | |||
|
|||
!syntax children /ADKernels/ADHeatConductionTimeDerivative<RESIDUAL> |
@@ -0,0 +1,37 @@ | |||
//* This file is part of the MOOSE framework | |||
//* https://www.mooseframework.org | |||
//* | |||
//* All rights reserved, see COPYRIGHT for full restrictions | |||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | |||
//* | |||
//* Licensed under LGPL 2.1, please see LICENSE for details | |||
//* https://www.gnu.org/licenses/lgpl-2.1.html | |||
#ifndef ADHEATCONDUCTIONTIMEDERIVATIVE_H | |||
#define ADHEATCONDUCTIONTIMEDERIVATIVE_H | |||
|
|||
#include "ADTimeDerivative.h" | |||
|
|||
template <ComputeStage compute_stage> | |||
class ADHeatConductionTimeDerivative; | |||
|
|||
declareADValidParams(ADHeatConductionTimeDerivative); | |||
|
|||
template <ComputeStage compute_stage> | |||
class ADHeatConductionTimeDerivative : public ADTimeDerivative<compute_stage> | |||
{ | |||
public: | |||
ADHeatConductionTimeDerivative(const InputParameters & parameters); | |||
|
|||
protected: | |||
virtual ADResidual computeQpResidual() override; | |||
|
|||
/// Specific heat material property | |||
const MaterialProperty<Real> & _specific_heat; | |||
|
|||
/// Density material property | |||
const MaterialProperty<Real> & _density; | |||
|
|||
usingTimeKernelMembers; | |||
}; | |||
|
|||
#endif // ADHEATCONDUCTIONTIMEDERIVATIVE_H |
@@ -0,0 +1,41 @@ | |||
//* This file is part of the MOOSE framework | |||
//* https://www.mooseframework.org | |||
//* | |||
//* All rights reserved, see COPYRIGHT for full restrictions | |||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | |||
//* | |||
//* Licensed under LGPL 2.1, please see LICENSE for details | |||
//* https://www.gnu.org/licenses/lgpl-2.1.htmlo | |||
#include "ADHeatConductionTimeDerivative.h" | |||
|
|||
registerADMooseObject("HeatConductionApp", ADHeatConductionTimeDerivative); | |||
|
|||
defineADValidParams( | |||
ADHeatConductionTimeDerivative, | |||
ADTimeDerivative, | |||
params.addClassDescription( | |||
"AD Time derivative term $\\rho c_p \\frac{\\partial T}{\\partial t}$ of " | |||
"the heat equation for quasi-constant specific heat $c_p$ and the density $\\rho$."); | |||
params.set<bool>("use_displaced_mesh") = true; | |||
params.addParam<MaterialPropertyName>("specific_heat", | |||
"specific_heat", | |||
"Property name of the specific heat material property"); | |||
params.addParam<MaterialPropertyName>("density_name", | |||
"density", | |||
"Property name of the density material property");); | |||
|
|||
template <ComputeStage compute_stage> | |||
ADHeatConductionTimeDerivative<compute_stage>::ADHeatConductionTimeDerivative( | |||
const InputParameters & parameters) | |||
: ADTimeDerivative<compute_stage>(parameters), | |||
_specific_heat(adGetADMaterialProperty<Real>("specific_heat")), | |||
_density(adGetADMaterialProperty<Real>("density_name")) | |||
{ | |||
} | |||
|
|||
template <ComputeStage compute_stage> | |||
ADResidual | |||
ADHeatConductionTimeDerivative<compute_stage>::computeQpResidual() | |||
{ | |||
return _specific_heat[_qp] * _density[_qp] * ADTimeDerivative<compute_stage>::computeQpResidual(); | |||
} |
0 comments on commit
aa1248f