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

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

#include <FXBoundaryValueUserObject.h>

Inheritance diagram for FXBoundaryValueUserObject:
[legend]

Public Member Functions

 FXBoundaryValueUserObject (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 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

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...
 

Private Attributes

const ConsoleStream & _console
 MooseObject instance of this to provide access to _console More...
 

Detailed Description

This boundary FX evaluator calculates the values.

Definition at line 22 of file FXBoundaryValueUserObject.h.

Constructor & Destructor Documentation

◆ FXBoundaryValueUserObject()

FXBoundaryValueUserObject::FXBoundaryValueUserObject ( const InputParameters &  parameters)

Definition at line 26 of file FXBoundaryValueUserObject.C.

27  : FXBoundaryBaseUserObject(parameters)
28 {
29 }

Member Function Documentation

◆ coefficientsChanged()

virtual void MutableCoefficientsInterface::coefficientsChanged ( )
inlineprotectedvirtualinherited

◆ computeIntegral()

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::computeIntegral ( )
finalprotectedvirtualinherited

Definition at line 135 of file FXIntegralBaseUserObject.h.

136 {
137  Real sum = 0.0;
138  const Point centroid = getCentroid();
139 
140  // Check to see if this element/side is within the valid boundaries
141  if (!_function_series.isInPhysicalBounds(centroid))
142  return 0.0;
143 
144  // Loop over the quadrature points
145  for (_qp = 0; _qp < _q_point.size(); ++_qp)
146  {
147  // Get the functional terms for a vectorized approach
148  _function_series.setLocation(_q_point[_qp]);
149  const std::vector<Real> & term_evaluations = _function_series.getGeneration();
150 
151  // Evaluate the functional expansion coefficients at each quadrature point
152  const Real local_contribution = computeQpIntegral();
153  const Real common_evaluation = local_contribution * _JxW[_qp] * _coord[_qp];
154  for (std::size_t c = 0; c < _coefficient_partials.size(); ++c)
155  _coefficient_partials[c] += term_evaluations[c] * common_evaluation;
156 
157  sum += local_contribution;
158  }
159 
160  _volume += getVolume();
161 
162  return sum;
163 }

◆ enforceSize()

void MutableCoefficientsInterface::enforceSize ( bool  enforce)
inherited

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

Definition at line 111 of file MutableCoefficientsInterface.C.

112 {
113  _enforce_size = enforce;
114 }

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

◆ finalize()

void FXIntegralBaseUserObject< SideIntegralVariableUserObject >::finalize ( )
finalvirtualinherited

Definition at line 167 of file FXIntegralBaseUserObject.h.

168 {
169  // Sum the coefficient arrays over all processes
170  _communicator.sum(_coefficient_partials);
171  _communicator.sum(_volume);
172 
173  // Normalize the volume of the functional expansion to the FX standard space
174  const Real volume_normalization = _standardized_function_volume / _volume;
175  for (auto & partial : _coefficient_partials)
176  partial *= volume_normalization;
177 
178  // We now have the completely evaluated coefficients
180 
181  // The average value is the same as the zeroth coefficient
182  _integral_value = _coefficient_partials[0];
183 
184  if (_keep_history)
186 
187  if (_print_state)
188  {
190  _console << COLOR_YELLOW << _function_series << COLOR_DEFAULT << std::endl;
191  }
192 }

◆ 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 51 of file MutableCoefficientsInterface.C.

52 {
53  return _characteristics;
54 }

◆ getCoefficients() [1/2]

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

Get a writeable reference to the vector of coefficients.

Definition at line 63 of file MutableCoefficientsInterface.C.

64 {
65  return _coefficients;
66 }

◆ getCoefficients() [2/2]

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

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

Definition at line 57 of file MutableCoefficientsInterface.C.

58 {
59  return _coefficients;
60 }

◆ getCoefficientsTable()

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

Get a formatted string of the coefficients.

Definition at line 69 of file MutableCoefficientsInterface.C.

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

◆ getFunctionSeries()

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

Return a reference to the underlying function series.

Definition at line 196 of file FXIntegralBaseUserObject.h.

197 {
198  return _function_series;
199 }

◆ getSize()

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

Get the size, aka number of coefficients.

Definition at line 80 of file MutableCoefficientsInterface.C.

81 {
82  return _coefficients.size();
83 }

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

◆ getValue()

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::getValue ( )
finalvirtualinherited

Definition at line 203 of file FXIntegralBaseUserObject.h.

204 {
205  return _integral_value;
206 }

◆ 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 117 of file MutableCoefficientsInterface.C.

118 {
119  if (!isCompatibleWith(other))
120  mooseError("Cannot import coefficients from incompatible MutableCoefficientsInterface");
121 
123 
125  _console << *this;
126 
128 }

Referenced by MultiAppFXTransfer::execute().

◆ initialize()

void FXIntegralBaseUserObject< SideIntegralVariableUserObject >::initialize ( )
finalvirtualinherited

Definition at line 210 of file FXIntegralBaseUserObject.h.

211 {
212  IntegralBaseVariableUserObject::initialize();
213 
214  // Clear the partial sums
215  for (auto & partial : _coefficient_partials)
216  partial = 0;
217 
218  _volume = 0;
219 }

◆ isCompatibleWith()

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

Checks to see if another instance is compatible.

Definition at line 86 of file MutableCoefficientsInterface.C.

87 {
88  // Check the coefficient sizes if requested
89  if ((_enforce_size && other._enforce_size) && getSize() != other.getSize())
90  return false;
91 
92  // Check the size of the characteristics array
93  if (_characteristics.size() != other._characteristics.size())
94  return false;
95 
96  // Check the values of the characteristics array
97  for (std::size_t i = 0; i < _characteristics.size(); ++i)
98  if (_characteristics[i] != other._characteristics[i])
99  return false;
100 
101  return true;
102 }

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

◆ isSizeEnforced()

bool MutableCoefficientsInterface::isSizeEnforced ( ) const
inherited

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

Definition at line 105 of file MutableCoefficientsInterface.C.

106 {
107  return _enforce_size;
108 }

◆ operator[]()

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

Get the value of the coefficient at the corresponding index.

Definition at line 45 of file MutableCoefficientsInterface.C.

46 {
47  return _coefficients[index];
48 }

◆ 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 131 of file MutableCoefficientsInterface.C.

132 {
133  if (size != _coefficients.size())
134  {
135  if (_enforce_size &&
136  (size > _coefficients.size() || (size < _coefficients.size() && !fill_out_to_size)))
137  mooseError("Cannot resize coefficient array with size enforcement enabled.");
138 
139  _coefficients.resize(size, fill);
140 
142  _console << *this;
143 
145  }
146 }

Referenced by FunctionSeries::FunctionSeries().

◆ setCharacteristics()

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

Sets the characteristics array.

Definition at line 149 of file MutableCoefficientsInterface.C.

151 {
152  _characteristics = new_characteristics;
153 }

Referenced by FunctionSeries::FunctionSeries().

◆ setCoefficients() [1/2]

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

Set the coefficients using a copy operation.

Definition at line 156 of file MutableCoefficientsInterface.C.

157 {
158  if (_enforce_size && new_coefficients.size() != _coefficients.size())
159  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
160  "enabled.");
161 
162  _coefficients = new_coefficients;
163 
165  _console << *this;
166 
168 }

Referenced by MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface().

◆ 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 171 of file MutableCoefficientsInterface.C.

172 {
173  if (_enforce_size && dropin_coefficients.size() != _coefficients.size())
174  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
175  "enabled.");
176 
177  _coefficients = dropin_coefficients;
178 
180  _console << *this;
181 
183 }

◆ spatialValue()

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

Definition at line 236 of file FXIntegralBaseUserObject.h.

237 {
238  _function_series.setLocation(location);
239 
241 }

◆ threadJoin()

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

Definition at line 223 of file FXIntegralBaseUserObject.h.

224 {
227 
228  for (std::size_t c = 0; c < _coefficient_partials.size(); ++c)
230 
231  _volume += sibling._volume;
232 }

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 92 of file FXIntegralBaseUserObject.h.

◆ _coefficient_partials

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

Current coefficient partial sums.

Definition at line 95 of file FXIntegralBaseUserObject.h.

◆ _coefficients

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

◆ _console

const ConsoleStream& MutableCoefficientsInterface::_console
privateinherited

MooseObject instance of this to provide access to _console

Definition at line 123 of file MutableCoefficientsInterface.h.

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

◆ _enforce_size

bool MutableCoefficientsInterface::_enforce_size
protectedinherited

◆ _function_series

FunctionSeries& FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_function_series
protectedinherited

Reference to the underlying function series.

Definition at line 98 of file FXIntegralBaseUserObject.h.

◆ _keep_history

const bool FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_keep_history
protectedinherited

Keep the expansion coefficients after each solve.

Definition at line 101 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 119 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 104 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 107 of file FXIntegralBaseUserObject.h.

◆ _volume

Real FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_volume
protectedinherited

Moose volume of evaluation.

Definition at line 110 of file FXIntegralBaseUserObject.h.


The documentation for this class was generated from the following files:
MutableCoefficientsInterface::_print_coefficients
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
Definition: MutableCoefficientsInterface.h:119
FXIntegralBaseUserObject
This class interacts with a MooseApp through functional expansions.
Definition: FXIntegralBaseUserObject.h:43
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::getCentroid
virtual Point getCentroid() const=0
Get the centroid of the evaluated unit.
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_coefficient_history
std::vector< std::vector< Real > > _coefficient_history
History of the expansion coefficients for each solve.
Definition: FXIntegralBaseUserObject.h:92
FunctionSeries::expand
Real expand()
Expand the function series at the current location and with the current coefficients.
Definition: FunctionSeries.C:263
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_coefficient_partials
std::vector< Real > _coefficient_partials
Current coefficient partial sums.
Definition: FXIntegralBaseUserObject.h:95
MutableCoefficientsInterface::_console
const ConsoleStream & _console
MooseObject instance of this to provide access to _console
Definition: MutableCoefficientsInterface.h:123
MutableCoefficientsInterface::_coefficients
std::vector< Real > & _coefficients
The coefficient array.
Definition: MutableCoefficientsInterface.h:113
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_volume
Real _volume
Moose volume of evaluation.
Definition: FXIntegralBaseUserObject.h:110
FunctionSeries::isInPhysicalBounds
bool isInPhysicalBounds(const Point &point) const
Returns true if the provided point is within the set physical boundaries.
Definition: FunctionSeries.C:238
MutableCoefficientsInterface::_characteristics
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.
Definition: MutableCoefficientsInterface.h:107
MutableCoefficientsInterface::getSize
std::size_t getSize() const
Get the size, aka number of coefficients.
Definition: MutableCoefficientsInterface.C:80
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::getVolume
virtual Real getVolume() const=0
Get the volume of the evaluated unit.
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_keep_history
const bool _keep_history
Keep the expansion coefficients after each solve.
Definition: FXIntegralBaseUserObject.h:101
FunctionSeries::getGeneration
const std::vector< Real > & getGeneration()
Returns a vector of the generation-evaluated functional series at the current location.
Definition: FunctionSeries.C:216
FXBoundaryBaseUserObject::FXBoundaryBaseUserObject
FXBoundaryBaseUserObject(const InputParameters &parameters)
Definition: FXBoundaryBaseUserObject.C:23
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_function_series
FunctionSeries & _function_series
Reference to the underlying function series.
Definition: FXIntegralBaseUserObject.h:98
MutableCoefficientsInterface::coefficientsChanged
virtual void coefficientsChanged()
Called when the coefficients have been changed.
Definition: MutableCoefficientsInterface.h:107
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_print_state
const bool _print_state
Flag to prints the state of the zeroth instance in finalize()
Definition: FXIntegralBaseUserObject.h:104
MutableCoefficientsInterface::setCoefficients
void setCoefficients(const std::vector< Real > &new_coefficients)
Set the coefficients using a copy operation.
Definition: MutableCoefficientsInterface.C:156
FXIntegralBaseUserObject< SideIntegralVariableUserObject >::_standardized_function_volume
const Real _standardized_function_volume
Volume of the standardized functional space of integration.
Definition: FXIntegralBaseUserObject.h:107
MutableCoefficientsInterface::isCompatibleWith
bool isCompatibleWith(const MutableCoefficientsInterface &other) const
Checks to see if another instance is compatible.
Definition: MutableCoefficientsInterface.C:86
MutableCoefficientsInterface::_enforce_size
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
Definition: MutableCoefficientsInterface.h:116
FunctionSeries::setLocation
void setLocation(const Point &point)
Set the current evaluation location.
Definition: FunctionSeries.C:244