https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14registerMooseObject("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
44void
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);
60 _ambient_temperature = _object_tracker->get<Real>("ambient_temperature", _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
93void
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
118 {
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
133}
registerMooseObject("NavierStokesApp", INSAD3Eqn)
const ADVariableValue & adCoupledDot(const std::string &var_name, unsigned int comp=0) const
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
virtual Real value(Real t, const Point &p) const
Computes properties needed for stabilized formulations of the mass, momentum, and energy equations.
Definition INSAD3Eqn.h:19
const ADVariableValue * _temperature_dot
Definition INSAD3Eqn.h:32
INSAD3Eqn(const InputParameters &parameters)
Definition INSAD3Eqn.C:27
const Function * _heat_source_function
Definition INSAD3Eqn.h:49
static InputParameters validParams()
Definition INSAD3Eqn.C:17
ADMaterialProperty< Real > & _temperature_advective_strong_residual
Definition INSAD3Eqn.h:35
void subdomainSetup() override
Definition INSAD3Eqn.C:45
const ADVariableValue & _temperature
Definition INSAD3Eqn.h:30
ADMaterialProperty< Real > & _temperature_td_strong_residual
Definition INSAD3Eqn.h:36
Real _ambient_temperature
Definition INSAD3Eqn.h:46
ADMaterialProperty< Real > & _temperature_source_strong_residual
Definition INSAD3Eqn.h:38
bool _has_ambient_convection
Definition INSAD3Eqn.h:44
Real _ambient_convection_alpha
Definition INSAD3Eqn.h:45
const ADVariableGradient & _grad_temperature
Definition INSAD3Eqn.h:31
bool _has_energy_transient
Whether the energy equation is transient.
Definition INSAD3Eqn.h:52
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
void computeQpProperties() override
Definition INSAD3Eqn.C:94
const ADVariableValue * _heat_source_var
Definition INSAD3Eqn.h:48
ADMaterialProperty< Real > & _temperature_ambient_convection_strong_residual
Definition INSAD3Eqn.h:37
bool _has_heat_source
Definition INSAD3Eqn.h:47
const ADMaterialProperty< Real > & _cp
Definition INSAD3Eqn.h:33
const INSADObjectTracker * _object_tracker
A user object that consumes information from INSAD residual objects and feeds it into this material.
virtual void computeQpProperties() override
ADMaterialProperty< RealVectorValue > & _mesh_velocity
The mesh velocity.
static InputParameters validParams()
virtual void subdomainSetup() override
bool _has_advected_mesh
Whether we have mesh convection.
const ADMaterialProperty< Real > & _rho
density
const ADVectorVariableValue & _velocity
velocity
bool isTrackerParamValid(const std::string &name, SubdomainID sub_id) const
const T & get(const std::string &name, SubdomainID sub_id) const
Get the internal parameter name.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
THREAD_ID _tid
unsigned int _qp
SubProblem & _subproblem
FEProblemBase & _fe_problem
const SubdomainID & _current_subdomain_id
const MooseArray< Point > & _q_point
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0
Real & _t