https://mooseframework.inl.gov
LayeredFlowAreaChange.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 "LayeredFlowAreaChange.h"
11 
12 registerMooseObject("ThermalHydraulicsApp", LayeredFlowAreaChange);
13 
16 {
18  params += LayeredBase::validParams();
19  params.addRequiredCoupledVar("displacements",
20  "Displacements, size must match problem dimension.");
21 
22  // this layered object should not be used on the displaced mesh
23  // because it measures deviation from the undisplaced mesh
24  params.suppressParameter<bool>("use_displaced_mesh");
25  params.set<bool>("use_displaced_mesh") = false;
26  params.suppressParameter<std::vector<SubdomainName>>("block");
27 
28  params.addClassDescription(
29  "This layered user object computes the change in cross sectional area "
30  "of a flow channel from the displacement variables. Note: the convention is"
31  "that reduction in flow area is negative. For this to be satisfied, normals must"
32  "point INTO the flow channel.");
33  return params;
34 }
35 
38  LayeredBase(parameters),
39  _dim(_mesh.dimension())
40 {
41  if (coupledComponents("displacements") != _dim)
42  paramError("displacements",
43  "The number of displacement components must be equal to the mesh displacement.");
44 
45  _disp.resize(_dim);
46  for (unsigned int j = 0; j < _dim; ++j)
47  _disp[j] = &coupledValue("displacements", j);
48 }
49 
50 void
52 {
55 }
56 
57 void
59 {
60  unsigned int layer = getLayer(_current_elem->vertex_average());
62  : _layer_bounds[layer + 1] - _layer_bounds[layer];
63  Real integral_value = computeIntegral() / height;
64 
65  setLayerValue(layer, getLayerValue(layer) + integral_value);
66 }
67 
68 Real
70 {
71  Real sum = 0;
72  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
73  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
74 
75  return sum;
76 }
77 
78 Real
80 {
81  RealVectorValue displacements;
82  for (unsigned int j = 0; j < _dim; ++j)
83  displacements(j) = (*_disp[j])[_qp];
84  return -_normals[_qp] * displacements;
85 }
86 
87 void
89 {
91 }
92 
93 void
95 {
98 }
This layered user object computes the change in cross sectional area of a flow channel.
virtual void execute() override
virtual Real computeQpIntegral() override
bool _interval_based
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
std::vector< const VariableValue * > _disp
the displacement vectors
const std::vector< double > y
static InputParameters validParams()
static InputParameters validParams()
virtual void threadJoin(const UserObject &y)
registerMooseObject("ThermalHydraulicsApp", LayeredFlowAreaChange)
void suppressParameter(const std::string &name)
virtual Real getLayerValue(unsigned int layer) const
void setLayerValue(unsigned int layer, Real value)
virtual unsigned int getLayer(const Point &p) const
virtual void initialize()
unsigned int _num_layers
LayeredFlowAreaChange(const InputParameters &parameters)
virtual void finalize()
virtual void threadJoin(const UserObject &y) override
std::vector< Real > _layer_bounds
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeIntegral() override
virtual void initialize() override
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
Real _direction_min
Real _direction_max
virtual void finalize() override
unsigned int _dim
the problem dimension