https://mooseframework.inl.gov
GravityInterface.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 "GravityInterface.h"
11 #include "MooseUtils.h"
12 #include "Numerics.h"
13 
16 {
18  params.addParam<RealVectorValue>(
19  "gravity_vector", THM::default_gravity_vector, "Gravitational acceleration vector [m/s^2]");
20  return params;
21 }
22 
24  : _gravity_vector(parameters.get<RealVectorValue>("gravity_vector")),
25  _gravity_magnitude(_gravity_vector.norm()),
26  _gravity_is_zero(MooseUtils::absoluteFuzzyEqual(_gravity_magnitude, 0.0)),
27  _gravity_direction(_gravity_is_zero ? RealVectorValue(0.0, 0.0, 0.0) : _gravity_vector.unit())
28 {
29 }
GravityInterface(const InputParameters &parameters)
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
InputParameters emptyInputParameters()
auto norm(const T &a) -> decltype(std::abs(a))
static VectorValue< Real > default_gravity_vector
Definition: Numerics.h:29
const Elem & get(const ElemType type_in)