Line data Source code
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 : // Navier-Stokes includes 11 : #include "INSADStabilized3Eqn.h" 12 : 13 : registerMooseObject("NavierStokesApp", INSADStabilized3Eqn); 14 : 15 : InputParameters 16 1698 : INSADStabilized3Eqn::validParams() 17 : { 18 1698 : InputParameters params = INSADTauMaterialTempl<INSAD3Eqn>::validParams(); 19 1698 : params.addClassDescription("This is the material class used to compute the stabilization " 20 : "parameter tau for momentum and tau_energy for the energy equation."); 21 3396 : params.addParam<MaterialPropertyName>( 22 : "k_name", "k", "the name of the thermal conductivity material property"); 23 3396 : params.addParam<MaterialPropertyName>( 24 : "grad_k_name", 25 : "grad_k", 26 : "the name of the gradient of the thermal conductivity material property"); 27 1698 : return params; 28 0 : } 29 : 30 1332 : INSADStabilized3Eqn::INSADStabilized3Eqn(const InputParameters & parameters) 31 : : INSADTauMaterialTempl<INSAD3Eqn>(parameters), 32 1332 : _second_temperature(adCoupledSecond("temperature")), 33 2664 : _k(getADMaterialProperty<Real>("k_name")), 34 1332 : _grad_k(hasADMaterialProperty<RealVectorValue>("grad_k_name") 35 1332 : ? &getADMaterialProperty<RealVectorValue>("grad_k_name") 36 : : nullptr), 37 1332 : _tau_energy(declareADProperty<Real>("tau_energy")), 38 2664 : _temperature_strong_residual(declareADProperty<Real>("temperature_strong_residual")) 39 : { 40 1332 : } 41 : 42 : void 43 14142520 : INSADStabilized3Eqn::computeQpProperties() 44 : { 45 : using std::sqrt; 46 : 47 14142520 : INSADTauMaterialTempl<INSAD3Eqn>::computeQpProperties(); 48 : 49 28285040 : const auto dissipation_coefficient = _k[_qp] / (_rho[_qp] * _cp[_qp]); 50 14142520 : const auto transient_part = _has_energy_transient ? 4. / (_dt * _dt) : 0.; 51 56570080 : _tau_energy[_qp] = _alpha / sqrt(transient_part + (2. * _speed / _hmax) * (2. * _speed / _hmax) + 52 28285040 : 9. * (4. * dissipation_coefficient / (_hmax * _hmax)) * 53 42427560 : (4. * dissipation_coefficient / (_hmax * _hmax))); 54 : 55 : // Start with the conductive term 56 28285040 : _temperature_strong_residual[_qp] = -_k[_qp] * _second_temperature[_qp].tr(); 57 14142520 : if (_grad_k) 58 0 : _temperature_strong_residual[_qp] -= (*_grad_k)[_qp] * _grad_temperature[_qp]; 59 : 60 : // advective 61 14142520 : _temperature_strong_residual[_qp] += _temperature_advective_strong_residual[_qp]; 62 : 63 14142520 : if (_has_energy_transient) 64 1341448 : _temperature_strong_residual[_qp] += _temperature_td_strong_residual[_qp]; 65 : 66 14142520 : if (_has_ambient_convection) 67 248832 : _temperature_strong_residual[_qp] += _temperature_ambient_convection_strong_residual[_qp]; 68 : 69 14142520 : if (_has_heat_source) 70 331776 : _temperature_strong_residual[_qp] += _temperature_source_strong_residual[_qp]; 71 : 72 14142520 : if (_has_advected_mesh) 73 690184 : _temperature_strong_residual[_qp] += _temperature_advected_mesh_strong_residual[_qp]; 74 14142520 : }