https://mooseframework.inl.gov
INSADGravityForce.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 "INSADGravityForce.h"
11 #include "INSADObjectTracker.h"
12 #include "FEProblemBase.h"
13 
14 registerMooseObject("NavierStokesApp", INSADGravityForce);
15 
18 {
20  params.addClassDescription("Computes a body force due to gravity.");
21  params.addRequiredParam<RealVectorValue>("gravity", "Direction of the gravity vector");
22  return params;
23 }
24 
26  : ADVectorKernelValue(parameters),
27  _gravity_strong_residual(getADMaterialProperty<RealVectorValue>("gravity_strong_residual"))
28 {
29  // Bypass the UserObjectInterface method because it requires a UserObjectName param which we
30  // don't need
31  auto & obj_tracker = const_cast<INSADObjectTracker &>(
32  _fe_problem.getUserObject<INSADObjectTracker>("ins_ad_object_tracker"));
33  for (const auto block_id : blockIDs())
34  {
35  obj_tracker.set("has_gravity", true, block_id);
36  obj_tracker.set("gravity", getParam<RealVectorValue>("gravity"), block_id);
37  }
38 }
39 
42 {
44 }
T & getUserObject(const std::string &name, unsigned int tid=0) const
static InputParameters validParams()
void set(const std::string &name, const T &value, SubdomainID sub_id)
Set the internal parameter name to value.
ADRealVectorValue precomputeQpResidual() override
virtual const std::set< SubdomainID > & blockIDs() const
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
INSADGravityForce(const InputParameters &parameters)
FEProblemBase & _fe_problem
Computes a body force due to gravity.
registerMooseObject("NavierStokesApp", INSADGravityForce)
void addClassDescription(const std::string &doc_string)
const ADMaterialProperty< RealVectorValue > & _gravity_strong_residual
Object for tracking what kernels have been added to an INSAD simulation.
unsigned int _qp