https://mooseframework.inl.gov
INSAD3Eqn.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "INSAD3Eqn.h"
11 #include "INSADObjectTracker.h"
12 #include "Function.h"
13 
14 registerMooseObject("NavierStokesApp", INSAD3Eqn);
15 
18 {
20  params.addClassDescription("This material computes properties needed for stabilized formulations "
21  "of the mass, momentum, and energy equations.");
22  params.addRequiredCoupledVar("temperature", "The temperature");
23  params.addParam<MaterialPropertyName>("cp_name", "cp", "The name of the specific heat capacity");
24  return params;
25 }
26 
28  : INSADMaterial(parameters),
29  _temperature(adCoupledValue("temperature")),
30  _grad_temperature(adCoupledGradient("temperature")),
31  _cp(getADMaterialProperty<Real>("cp_name")),
32  _temperature_advective_strong_residual(
33  declareADProperty<Real>("temperature_advective_strong_residual")),
34  _temperature_td_strong_residual(declareADProperty<Real>("temperature_td_strong_residual")),
35  _temperature_ambient_convection_strong_residual(
36  declareADProperty<Real>("temperature_ambient_convection_strong_residual")),
37  _temperature_source_strong_residual(
38  declareADProperty<Real>("temperature_source_strong_residual")),
39  _temperature_advected_mesh_strong_residual(
40  declareADProperty<Real>("temperature_advected_mesh_strong_residual"))
41 {
42 }
43 
44 void
46 {
48 
50  _object_tracker->get<bool>("has_energy_transient", _current_subdomain_id)))
51  _temperature_dot = &adCoupledDot("temperature");
52  else
53  _temperature_dot = nullptr;
54 
56  _object_tracker->get<bool>("has_ambient_convection", _current_subdomain_id)))
57  {
59  _object_tracker->get<Real>("ambient_convection_alpha", _current_subdomain_id);
61  }
62  else
63  {
66  }
67 
68  if ((_has_heat_source = _object_tracker->get<bool>("has_heat_source", _current_subdomain_id)))
69  {
71  {
74  _object_tracker->get<std::string>(
75  "heat_source_var", _current_subdomain_id))
76  .adSln();
77  _heat_source_function = nullptr;
78  }
79  else if (_object_tracker->isTrackerParamValid("heat_source_function", _current_subdomain_id))
80  {
82  _object_tracker->get<FunctionName>("heat_source_function", _current_subdomain_id), _tid);
83  _heat_source_var = nullptr;
84  }
85  }
86  else
87  {
88  _heat_source_var = nullptr;
89  _heat_source_function = nullptr;
90  }
91 }
92 
93 void
95 {
97 
98  // For the remaining terms we make individual properties so they can be consumed by non-SUPG
99  // kernels. This avoids double calculation for the non-supg and supg parts of the residual. We
100  // don't need an individual property for the conductive term because the corresponding non-supg
101  // contribution is integrated by parts and hence there is no double calculation (the 'weak' and
102  // 'strong' terms are diferent in this case)
103 
106 
108  {
109  mooseAssert(_temperature_dot, "The temperature time derivative is null");
110  _temperature_td_strong_residual[_qp] = _cp[_qp] * _rho[_qp] * (*_temperature_dot)[_qp];
111  }
112 
116 
117  if (_has_heat_source)
118  {
119  if (_heat_source_var)
120  _temperature_source_strong_residual[_qp] = -(*_heat_source_var)[_qp];
121  else
122  {
123  mooseAssert(_heat_source_function,
124  "Either the heat source var or the heat source function must be non-null in "
125  "'INSAD3Eqn'");
127  }
128  }
129 
130  if (_has_advected_mesh)
133 }
const MooseArray< Point > & _q_point
FEProblemBase & _fe_problem
Real _ambient_temperature
Definition: INSAD3Eqn.h:46
const ADVariableValue * _temperature_dot
Definition: INSAD3Eqn.h:32
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const ADMaterialProperty< Real > & _cp
Definition: INSAD3Eqn.h:33
SubProblem & _subproblem
Computes properties needed for stabilized formulations of the mass, momentum, and energy equations...
Definition: INSAD3Eqn.h:18
virtual void subdomainSetup() override
Definition: INSADMaterial.C:93
const INSADObjectTracker * _object_tracker
A user object that consumes information from INSAD residual objects and feeds it into this material...
Definition: INSADMaterial.h:94
void computeQpProperties() override
Definition: INSAD3Eqn.C:94
static InputParameters validParams()
Definition: INSAD3Eqn.C:17
static InputParameters validParams()
Definition: INSADMaterial.C:22
void subdomainSetup() override
Definition: INSAD3Eqn.C:45
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
unsigned int _qp
const ADVariableValue & _temperature
Definition: INSAD3Eqn.h:30
const ADVariableValue * _heat_source_var
Definition: INSAD3Eqn.h:48
const T & get(const std::string &name, SubdomainID sub_id) const
Get the internal parameter name.
THREAD_ID _tid
ADMaterialProperty< Real > & _temperature_source_strong_residual
Definition: INSAD3Eqn.h:38
INSAD3Eqn(const InputParameters &parameters)
Definition: INSAD3Eqn.C:27
Real & _t
ADMaterialProperty< Real > & _temperature_ambient_convection_strong_residual
Definition: INSAD3Eqn.h:37
const ADVariableValue & adCoupledDot(const std::string &var_name, unsigned int comp=0) const
const ADTemplateVariableValue< Real > & adSln() const override
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0
bool isTrackerParamValid(const std::string &name, SubdomainID sub_id) const
ADMaterialProperty< Real > & _temperature_td_strong_residual
Definition: INSAD3Eqn.h:36
ADMaterialProperty< Real > & _temperature_advective_strong_residual
Definition: INSAD3Eqn.h:35
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
virtual void computeQpProperties() override
bool _has_ambient_convection
Definition: INSAD3Eqn.h:44
const ADVectorVariableValue & _velocity
velocity
Definition: INSADMaterial.h:31
const ADVariableGradient & _grad_temperature
Definition: INSAD3Eqn.h:31
registerMooseObject("NavierStokesApp", INSAD3Eqn)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _ambient_convection_alpha
Definition: INSAD3Eqn.h:45
bool _has_energy_transient
Whether the energy equation is transient.
Definition: INSAD3Eqn.h:52
void addClassDescription(const std::string &doc_string)
bool _has_advected_mesh
Whether we have mesh convection.
const SubdomainID & _current_subdomain_id
virtual Real value(Real t, const Point &p) const
const ADMaterialProperty< Real > & _rho
density
Definition: INSADMaterial.h:43
bool _has_heat_source
Definition: INSAD3Eqn.h:47
ADMaterialProperty< Real > & _temperature_advected_mesh_strong_residual
The strong residual for the temperature transport term corresponding to mesh velocity in an ALE simul...
Definition: INSAD3Eqn.h:42
ADMaterialProperty< RealVectorValue > & _mesh_velocity
The mesh velocity.
Definition: INSADMaterial.h:67
const Function * _heat_source_function
Definition: INSAD3Eqn.h:49