https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SBMBase.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 "SBMBase.h"
12
13template <typename Parent>
16{
17 InputParameters params = Parent::validParams();
18 params.addParam<UserObjectName>(
19 "sbm_distance_uo",
20 "UserObject that provides signed distance and normal vector calculations.");
21
22 return params;
23}
24
25template <typename Parent>
27 : Parent(parameters), _sbm_distance_uo(nullptr)
28{
29}
30
31template <typename Parent>
32void
34{
35 if (perform_shifted())
36 {
37 if (!this->isParamSetByUser("sbm_distance_uo"))
38 mooseError("SBMBase: 'sbm_distance_uo' must be set when using shifted integration.");
39 else
40 _sbm_distance_uo =
41 &static_cast<Parent &>(*this).template getUserObject<BoundaryShortestDistanceToSurface>(
42 "sbm_distance_uo");
43 }
44}
45
46template <typename Parent>
47Real
49{
50 return std::pow(this->_current_elem->volume(), 1.0 / this->_mesh.dimension());
51}
52
53template <typename Parent>
54const RealVectorValue
56{
57 const auto elem_side = std::make_pair(this->_current_elem->id(), this->_current_side);
58 return _sbm_distance_uo->surrogateDistance(elem_side, this->_qp);
59}
60
61template <typename Parent>
62const RealVectorValue
64{
65 const auto elem_side = std::make_pair(this->_current_elem->id(), this->_current_side);
66 return _sbm_distance_uo->trueNormal(elem_side, this->_qp);
67}
68
69// Explicit template instantiations
70
71template class SBMBase<IntegratedBC>;
void mooseError(Args &&... args)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Template base providing signed-distance and normal-vector utilities for SBM objects.
Definition SBMBase.h:27
SBMBase(const InputParameters &parameters)
Definition SBMBase.C:26
static InputParameters validParams()
Definition SBMBase.C:15
Real h() const
Returns the characteristic mesh size, computed as (element_volume)^(1/dim)
Definition SBMBase.C:48
virtual void initialSetup() override
Definition SBMBase.C:33
const RealVectorValue trueNormal() const
Returns the true normal vector at the projected point on the true interface.
Definition SBMBase.C:63
const RealVectorValue surrogateDistance() const
Returns the shortest distance vector from the current quadrature point to the true interface.
Definition SBMBase.C:55