www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FXBoundaryFluxUserObject Class Referencefinal

This boundary FX evaluator calculates the flux. More...

#include <FXBoundaryFluxUserObject.h>

Inheritance diagram for FXBoundaryFluxUserObject:
[legend]

Public Member Functions

 FXBoundaryFluxUserObject (const InputParameters &parameters)
 
const FunctionSeriesgetFunctionSeries () const
 Return a reference to the underlying function series. More...
 
virtual Real getValue () final
 
virtual void finalize () final
 
virtual void initialize () final
 
virtual Real spatialValue (const Point &location) const final
 
virtual void threadJoin (const UserObject &sibling) final
 
Real operator[] (std::size_t index) const
 Get the value of the coefficient at the corresponding index. More...
 
const std::vector< std::size_t > & getCharacteristics () const
 Get a reference to the characteristics array. More...
 
const std::vector< Real > & getCoefficients () const
 Get a read-only reference to the vector of coefficients. More...
 
std::vector< Real > & getCoefficients ()
 Get a writeable reference to the vector of coefficients. More...
 
std::string getCoefficientsTable () const
 Get a formatted string of the coefficients. More...
 
std::size_t getSize () const
 Get the size, aka number of coefficients. More...
 
bool isCompatibleWith (const MutableCoefficientsInterface &other) const
 Checks to see if another instance is compatible. More...
 
bool isSizeEnforced () const
 Returns true if the size of the coefficient array is fixed and enforced. More...
 
void enforceSize (bool enforce)
 Toggle whether the size of the coefficient array can be changed. More...
 
void importCoefficients (const MutableCoefficientsInterface &other)
 Import the coefficients from another instance. More...
 
void resize (std::size_t size, Real fill=0.0, bool fill_out_to_size=true)
 Resize the array, using the value for fill if the new size is larger. More...
 
void setCharacteristics (const std::vector< std::size_t > &new_characteristics)
 Sets the characteristics array. More...
 
void setCoefficients (const std::vector< Real > &new_coefficients)
 Set the coefficients using a copy operation. More...
 
void setCoefficients (std::vector< Real > &&dropin_coefficients)
 Set the coefficients using a move operation (only works with temp objects) More...
 

Protected Member Functions

virtual Real computeQpIntegral () final
 
virtual Point getCentroid () const final
 Get the centroid of the evaluated unit. More...
 
virtual Real getVolume () const final
 Get the volume of the evaluated unit. More...
 
virtual Real computeIntegral () final
 
virtual void coefficientsChanged ()
 Called when the coefficients have been changed. More...
 

Protected Attributes

const std::string _diffusivity_name
 Name of the diffusivity property in the local material. More...
 
const MaterialProperty< Real > & _diffusivity
 Value of the diffusivity. More...
 
std::vector< std::vector< Real > > _coefficient_history
 History of the expansion coefficients for each solve. More...
 
std::vector< Real > _coefficient_partials
 Current coefficient partial sums. More...
 
FunctionSeries_function_series
 Reference to the underlying function series. More...
 
const bool _keep_history
 Keep the expansion coefficients after each solve. More...
 
const bool _print_state
 Flag to prints the state of the zeroth instance in finalize() More...
 
const Real _standardized_function_volume
 Volume of the standardized functional space of integration. More...
 
Real _volume
 Moose volume of evaluation. More...
 
std::vector< std::size_t > & _characteristics
 An array of integer characteristics that can be used to check compatibility. More...
 
std::vector< Real > & _coefficients
 The coefficient array. More...
 
bool _enforce_size
 Boolean that locks or allows resizing of the coefficient array. More...
 
const bool _print_coefficients
 Boolean to flag if the coefficients should be printed when set. More...
 

Detailed Description

This boundary FX evaluator calculates the flux.

Definition at line 23 of file FXBoundaryFluxUserObject.h.

Constructor & Destructor Documentation

◆ FXBoundaryFluxUserObject()

FXBoundaryFluxUserObject::FXBoundaryFluxUserObject ( const InputParameters &  parameters)

Definition at line 31 of file FXBoundaryFluxUserObject.C.

32  : FXBoundaryBaseUserObject(parameters),
33  _diffusivity_name(parameters.get<std::string>("diffusivity")),
34  _diffusivity(getMaterialProperty<Real>(_diffusivity_name))
35 {
36 }
FXBoundaryBaseUserObject(const InputParameters &parameters)
const MaterialProperty< Real > & _diffusivity
Value of the diffusivity.
const std::string _diffusivity_name
Name of the diffusivity property in the local material.

Member Function Documentation

◆ coefficientsChanged()

virtual void MutableCoefficientsInterface::coefficientsChanged ( )
inlineprotectedvirtualinherited

◆ computeIntegral()

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::computeIntegral ( )
finalprotectedvirtualinherited

Definition at line 136 of file FXIntegralBaseUserObject.h.

137 {
138  Real sum = 0.0;
139  const Point centroid = getCentroid();
140 
141  // Check to see if this element/side is within the valid boundaries
142  if (!_function_series.isInPhysicalBounds(centroid))
143  return 0.0;
144 
145  // Loop over the quadrature points
146  for (_qp = 0; _qp < _q_point.size(); ++_qp)
147  {
148  // Get the functional terms for a vectorized approach
149  _function_series.setLocation(_q_point[_qp]);
150  const std::vector<Real> & term_evaluations = _function_series.getGeneration();
151 
152  // Evaluate the functional expansion coefficients at each quadrature point
153  const Real local_contribution = computeQpIntegral();
154  const Real common_evaluation = local_contribution * _JxW[_qp] * _coord[_qp];
155  for (std::size_t c = 0; c < _coefficient_partials.size(); ++c)
156  _coefficient_partials[c] += term_evaluations[c] * common_evaluation;
157 
158  sum += local_contribution;
159  }
160 
161  _volume += getVolume();
162 
163  return sum;
164 }
virtual Real getVolume() const=0
Get the volume of the evaluated unit.
void setLocation(const Point &point)
Set the current evaluation location.
const std::vector< Real > & getGeneration()
Returns a vector of the generation-evaluated functional series at the current location.
FunctionSeries & _function_series
Reference to the underlying function series.
virtual Point getCentroid() const=0
Get the centroid of the evaluated unit.
bool isInPhysicalBounds(const Point &point) const
Returns true if the provided point is within the set physical boundaries.
std::vector< Real > _coefficient_partials
Current coefficient partial sums.

◆ computeQpIntegral()

Real FXBoundaryFluxUserObject::computeQpIntegral ( )
finalprotectedvirtual

Definition at line 39 of file FXBoundaryFluxUserObject.C.

40 {
41  return -_diffusivity[_qp] * _grad_u[_qp] * _normals[_qp];
42 }
const MaterialProperty< Real > & _diffusivity
Value of the diffusivity.

◆ enforceSize()

void MutableCoefficientsInterface::enforceSize ( bool  enforce)
inherited

Toggle whether the size of the coefficient array can be changed.

Definition at line 110 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries(), and MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface().

111 {
112  _enforce_size = enforce;
113 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.

◆ finalize()

void FXIntegralBaseUserObject< SideIntegralVariableUserObject >::finalize ( )
finalvirtualinherited

Definition at line 168 of file FXIntegralBaseUserObject.h.

169 {
170  // Sum the coefficient arrays over all processes
171  _communicator.sum(_coefficient_partials);
172  _communicator.sum(_volume);
173 
174  // Normalize the volume of the functional expansion to the FX standard space
175  const Real volume_normalization = _standardized_function_volume / _volume;
176  for (auto & partial : _coefficient_partials)
177  partial *= volume_normalization;
178 
179  // We now have the completely evaluated coefficients
181 
182  // The average value is the same as the zeroth coefficient
183  _integral_value = _coefficient_partials[0];
184 
185  if (_keep_history)
187 
188  if (_print_state)
189  {
191  _console << COLOR_YELLOW << _function_series << COLOR_DEFAULT << std::endl;
192  }
193 }
void setCoefficients(const std::vector< Real > &new_coefficients)
Set the coefficients using a copy operation.
const bool _keep_history
Keep the expansion coefficients after each solve.
FunctionSeries & _function_series
Reference to the underlying function series.
const bool _print_state
Flag to prints the state of the zeroth instance in finalize()
const Real _standardized_function_volume
Volume of the standardized functional space of integration.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console
std::vector< std::vector< Real > > _coefficient_history
History of the expansion coefficients for each solve.
std::vector< Real > _coefficient_partials
Current coefficient partial sums.

◆ getCentroid()

Point FXBoundaryBaseUserObject::getCentroid ( ) const
finalprotectedvirtualinherited

Get the centroid of the evaluated unit.

Implements FXIntegralBaseUserObject< SideIntegralVariableUserObject >.

Definition at line 35 of file FXBoundaryBaseUserObject.C.

36 {
37  return _current_side_elem->centroid();
38 }

◆ getCharacteristics()

const std::vector< std::size_t > & MutableCoefficientsInterface::getCharacteristics ( ) const
inherited

Get a reference to the characteristics array.

Definition at line 50 of file MutableCoefficientsInterface.C.

51 {
52  return _characteristics;
53 }
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.

◆ getCoefficients() [1/2]

const std::vector< Real > & MutableCoefficientsInterface::getCoefficients ( ) const
inherited

Get a read-only reference to the vector of coefficients.

Definition at line 56 of file MutableCoefficientsInterface.C.

57 {
58  return _coefficients;
59 }
std::vector< Real > & _coefficients
The coefficient array.

◆ getCoefficients() [2/2]

std::vector< Real > & MutableCoefficientsInterface::getCoefficients ( )
inherited

Get a writeable reference to the vector of coefficients.

Definition at line 62 of file MutableCoefficientsInterface.C.

63 {
64  return _coefficients;
65 }
std::vector< Real > & _coefficients
The coefficient array.

◆ getCoefficientsTable()

std::string MutableCoefficientsInterface::getCoefficientsTable ( ) const
inherited

Get a formatted string of the coefficients.

Definition at line 68 of file MutableCoefficientsInterface.C.

69 {
70  std::stringbuf string;
71  std::ostream table(&string);
72 
73  table << *this;
74 
75  return string.str();
76 }

◆ getFunctionSeries()

const FunctionSeries & FXIntegralBaseUserObject< SideIntegralVariableUserObject >::getFunctionSeries ( ) const
inherited

Return a reference to the underlying function series.

Definition at line 197 of file FXIntegralBaseUserObject.h.

198 {
199  return _function_series;
200 }
FunctionSeries & _function_series
Reference to the underlying function series.

◆ getSize()

std::size_t MutableCoefficientsInterface::getSize ( ) const
inherited

Get the size, aka number of coefficients.

Definition at line 79 of file MutableCoefficientsInterface.C.

Referenced by MutableCoefficientsInterface::isCompatibleWith(), and operator<<().

80 {
81  return _coefficients.size();
82 }
std::vector< Real > & _coefficients
The coefficient array.

◆ getValue()

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::getValue ( )
finalvirtualinherited

Definition at line 204 of file FXIntegralBaseUserObject.h.

205 {
206  return _integral_value;
207 }

◆ getVolume()

Real FXBoundaryBaseUserObject::getVolume ( ) const
finalprotectedvirtualinherited

Get the volume of the evaluated unit.

Implements FXIntegralBaseUserObject< SideIntegralVariableUserObject >.

Definition at line 41 of file FXBoundaryBaseUserObject.C.

42 {
43  return _current_side_volume;
44 }

◆ importCoefficients()

void MutableCoefficientsInterface::importCoefficients ( const MutableCoefficientsInterface other)
inherited

Import the coefficients from another instance.

Definition at line 116 of file MutableCoefficientsInterface.C.

Referenced by MultiAppFXTransfer::execute().

117 {
118  if (!isCompatibleWith(other))
119  mooseError("Cannot import coefficients from incompatible MutableCoefficientsInterface");
120 
122 
124  _console << *this;
125 
127 }
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool isCompatibleWith(const MutableCoefficientsInterface &other) const
Checks to see if another instance is compatible.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ initialize()

void FXIntegralBaseUserObject< SideIntegralVariableUserObject >::initialize ( )
finalvirtualinherited

Definition at line 211 of file FXIntegralBaseUserObject.h.

212 {
213  IntegralBaseVariableUserObject::initialize();
214 
215  // Clear the partial sums
216  for (auto & partial : _coefficient_partials)
217  partial = 0;
218 
219  _volume = 0;
220 }
std::vector< Real > _coefficient_partials
Current coefficient partial sums.

◆ isCompatibleWith()

bool MutableCoefficientsInterface::isCompatibleWith ( const MutableCoefficientsInterface other) const
inherited

Checks to see if another instance is compatible.

Definition at line 85 of file MutableCoefficientsInterface.C.

Referenced by MultiAppFXTransfer::execute(), and MutableCoefficientsInterface::importCoefficients().

86 {
87  // Check the coefficient sizes if requested
88  if ((_enforce_size && other._enforce_size) && getSize() != other.getSize())
89  return false;
90 
91  // Check the size of the characteristics array
92  if (_characteristics.size() != other._characteristics.size())
93  return false;
94 
95  // Check the values of the characteristics array
96  for (std::size_t i = 0; i < _characteristics.size(); ++i)
97  if (_characteristics[i] != other._characteristics[i])
98  return false;
99 
100  return true;
101 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.
std::size_t getSize() const
Get the size, aka number of coefficients.

◆ isSizeEnforced()

bool MutableCoefficientsInterface::isSizeEnforced ( ) const
inherited

Returns true if the size of the coefficient array is fixed and enforced.

Definition at line 104 of file MutableCoefficientsInterface.C.

105 {
106  return _enforce_size;
107 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.

◆ operator[]()

Real MutableCoefficientsInterface::operator[] ( std::size_t  index) const
inherited

Get the value of the coefficient at the corresponding index.

Definition at line 44 of file MutableCoefficientsInterface.C.

45 {
46  return _coefficients[index];
47 }
std::vector< Real > & _coefficients
The coefficient array.

◆ resize()

void MutableCoefficientsInterface::resize ( std::size_t  size,
Real  fill = 0.0,
bool  fill_out_to_size = true 
)
inherited

Resize the array, using the value for fill if the new size is larger.

Definition at line 130 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries().

131 {
132  if (size != _coefficients.size())
133  {
134  if (_enforce_size &&
135  (size > _coefficients.size() || (size < _coefficients.size() && !fill_out_to_size)))
136  mooseError("Cannot resize coefficient array with size enforcement enabled.");
137 
138  _coefficients.resize(size, fill);
139 
141  _console << *this;
142 
144  }
145 }
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ setCharacteristics()

void MutableCoefficientsInterface::setCharacteristics ( const std::vector< std::size_t > &  new_characteristics)
inherited

Sets the characteristics array.

Definition at line 148 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries().

150 {
151  _characteristics = new_characteristics;
152 }
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.

◆ setCoefficients() [1/2]

void MutableCoefficientsInterface::setCoefficients ( const std::vector< Real > &  new_coefficients)
inherited

Set the coefficients using a copy operation.

Definition at line 155 of file MutableCoefficientsInterface.C.

Referenced by MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface().

156 {
157  if (_enforce_size && new_coefficients.size() != _coefficients.size())
158  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
159  "enabled.");
160 
161  _coefficients = new_coefficients;
162 
164  _console << *this;
165 
167 }
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ setCoefficients() [2/2]

void MutableCoefficientsInterface::setCoefficients ( std::vector< Real > &&  dropin_coefficients)
inherited

Set the coefficients using a move operation (only works with temp objects)

Definition at line 170 of file MutableCoefficientsInterface.C.

171 {
172  if (_enforce_size && dropin_coefficients.size() != _coefficients.size())
173  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
174  "enabled.");
175 
176  _coefficients = dropin_coefficients;
177 
179  _console << *this;
180 
182 }
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ spatialValue()

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::spatialValue ( const Point &  location) const
finalvirtualinherited

Definition at line 237 of file FXIntegralBaseUserObject.h.

238 {
239  _function_series.setLocation(location);
240 
242 }
void setLocation(const Point &point)
Set the current evaluation location.
FunctionSeries & _function_series
Reference to the underlying function series.
Real expand()
Expand the function series at the current location and with the current coefficients.
std::vector< Real > & _coefficients
The coefficient array.

◆ threadJoin()

void FXIntegralBaseUserObject< SideIntegralVariableUserObject >::threadJoin ( const UserObject &  sibling)
finalvirtualinherited

Definition at line 224 of file FXIntegralBaseUserObject.h.

225 {
228 
229  for (std::size_t c = 0; c < _coefficient_partials.size(); ++c)
231 
232  _volume += sibling._volume;
233 }
This class interacts with a MooseApp through functional expansions.
std::vector< Real > _coefficient_partials
Current coefficient partial sums.

Member Data Documentation

◆ _characteristics

std::vector<std::size_t>& MutableCoefficientsInterface::_characteristics
protectedinherited

◆ _coefficient_history

std::vector<std::vector<Real> > FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_coefficient_history
protectedinherited

History of the expansion coefficients for each solve.

Definition at line 93 of file FXIntegralBaseUserObject.h.

◆ _coefficient_partials

std::vector<Real> FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_coefficient_partials
protectedinherited

Current coefficient partial sums.

Definition at line 96 of file FXIntegralBaseUserObject.h.

◆ _coefficients

std::vector<Real>& MutableCoefficientsInterface::_coefficients
protectedinherited

◆ _diffusivity

const MaterialProperty<Real>& FXBoundaryFluxUserObject::_diffusivity
protected

Value of the diffusivity.

Definition at line 36 of file FXBoundaryFluxUserObject.h.

Referenced by computeQpIntegral().

◆ _diffusivity_name

const std::string FXBoundaryFluxUserObject::_diffusivity_name
protected

Name of the diffusivity property in the local material.

Definition at line 33 of file FXBoundaryFluxUserObject.h.

◆ _enforce_size

bool MutableCoefficientsInterface::_enforce_size
protectedinherited

◆ _function_series

FunctionSeries& FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_function_series
protectedinherited

Reference to the underlying function series.

Definition at line 99 of file FXIntegralBaseUserObject.h.

Referenced by FXBoundaryBaseUserObject::FXBoundaryBaseUserObject().

◆ _keep_history

const bool FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_keep_history
protectedinherited

Keep the expansion coefficients after each solve.

Definition at line 102 of file FXIntegralBaseUserObject.h.

◆ _print_coefficients

const bool MutableCoefficientsInterface::_print_coefficients
protectedinherited

Boolean to flag if the coefficients should be printed when set.

Definition at line 120 of file MutableCoefficientsInterface.h.

Referenced by MutableCoefficientsInterface::importCoefficients(), MutableCoefficientsInterface::resize(), and MutableCoefficientsInterface::setCoefficients().

◆ _print_state

const bool FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_print_state
protectedinherited

Flag to prints the state of the zeroth instance in finalize()

Definition at line 105 of file FXIntegralBaseUserObject.h.

◆ _standardized_function_volume

const Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_standardized_function_volume
protectedinherited

Volume of the standardized functional space of integration.

Definition at line 108 of file FXIntegralBaseUserObject.h.

◆ _volume

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_volume
protectedinherited

Moose volume of evaluation.

Definition at line 111 of file FXIntegralBaseUserObject.h.


The documentation for this class was generated from the following files: