https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSADBoussinesqBodyForce.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
11#include "INSADObjectTracker.h"
12#include "FEProblemBase.h"
13
15
18{
20 params.addClassDescription("Computes a body force for natural convection buoyancy.");
21 params.addRequiredCoupledVar("temperature", "temperature variable, for off diagonal jacobian");
22 params.addRequiredParam<RealVectorValue>("gravity", "Direction of the gravity vector");
23 params.addParam<MaterialPropertyName>("alpha_name",
24 "alpha",
25 "The name of the thermal expansion coefficient"
26 "this is of the form rho = rho*(1-alpha (T-T_ref))");
27 params.addParam<MaterialPropertyName>(
28 "ref_temp", "temp_ref", "The name of the reference temperature");
29 return params;
30}
31
33 : ADVectorKernelValue(parameters),
34 _boussinesq_strong_residual(
35 getADMaterialProperty<RealVectorValue>("boussinesq_strong_residual"))
36{
37 if (coupledComponents("temperature") != 1)
38 paramError("temperature", "Only one variable should be used for 'temperature'");
39
40 if (_tid == 0)
41 {
42 // Bypass the UserObjectInterface method because it requires a UserObjectName param which we
43 // don't need
44 auto & obj_tracker = _fe_problem.getUserObject<INSADObjectTracker>("ins_ad_object_tracker");
45
46 const auto alpha_name = getMaterialPropertyName("alpha_name");
47 const auto ref_temp = getMaterialPropertyName("ref_temp");
48
49 for (const auto block_id : blockIDs())
50 {
51 obj_tracker.set("has_boussinesq", true, block_id);
52
53 // We actually want to perform the material property requests during object construction in
54 // order to ensure that material property dependency is recorded correctly (I don't think this
55 // should actually matter for non-Material MaterialPropertyInterface classes, but might as
56 // well be consistent)
57 obj_tracker.set("alpha", alpha_name, block_id);
58 obj_tracker.set("ref_temp", ref_temp, block_id);
59
60 obj_tracker.set("temperature", getVar("temperature", 0)->name(), block_id);
61 obj_tracker.set("gravity", getParam<RealVectorValue>("gravity"), block_id);
62 }
63 }
64}
65
registerMooseObject("NavierStokesApp", INSADBoussinesqBodyForce)
static InputParameters validParams()
virtual const std::set< SubdomainID > & blockIDs() const
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
unsigned int coupledComponents(const std::string &var_name) const
T & getUserObject(const std::string &name, unsigned int tid=0) const
Computes a body force that approximates natural buoyancy in problems where there aren't very large va...
ADRealVectorValue precomputeQpResidual() override
const ADMaterialProperty< RealVectorValue > & _boussinesq_strong_residual
static InputParameters validParams()
INSADBoussinesqBodyForce(const InputParameters &parameters)
Object for tracking what kernels have been added to an INSAD simulation.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(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)
unsigned int _qp
MaterialPropertyName getMaterialPropertyName(const std::string &name) const
const std::string & name() const
void paramError(const std::string &param, Args... args) const
FEProblemBase & _fe_problem