oomph::VorticityRecoveryHelpers::RecoveryHelper Class Reference

#include <vorticity_smoother.h>

Public Member Functions

 RecoveryHelper ()
 Constructor. More...
 
int maximum_order_of_vorticity_derivative () const
 The maximum order of derivatives calculated in the vorticity recovery. More...
 
int maximum_order_of_velocity_derivative () const
 The maximum order of derivatives calculated in the velocity recovery. More...
 
void set_maximum_order_of_vorticity_derivative (const int &max_deriv)
 The maximum order of derivatives calculated in the vorticity recovery. More...
 
void set_maximum_order_of_velocity_derivative (const int &max_deriv)
 The maximum order of derivatives calculated in the velocity recovery. More...
 
void calculate_number_of_values_per_field ()
 
unsigned npartial_derivative (const unsigned &n) const
 
unsigned ncont_interpolated_values () const
 Number of continuously interpolated values: More...
 

Private Attributes

unsigned Number_of_values_per_field
 
int Maximum_order_of_vorticity_derivative
 
int Maximum_order_of_velocity_derivative
 

Detailed Description

Class to indicate which derivatives of the vorticity/ velocity we want to recover. We choose to immediately instantiate an object of this class by dropping the semi-colon after the class description.

Constructor & Destructor Documentation

◆ RecoveryHelper()

oomph::VorticityRecoveryHelpers::RecoveryHelper::RecoveryHelper ( )
inline

Constructor.

59  {
60  // Set the default (max) order of vorticity derivative to recover
62 
63  // Set the default (max) order of velocity derivative to recover
65  }
int Maximum_order_of_vorticity_derivative
Definition: vorticity_smoother.h:206
int Maximum_order_of_velocity_derivative
Definition: vorticity_smoother.h:211

References Maximum_order_of_velocity_derivative, and Maximum_order_of_vorticity_derivative.

Member Function Documentation

◆ calculate_number_of_values_per_field()

void oomph::VorticityRecoveryHelpers::RecoveryHelper::calculate_number_of_values_per_field ( )
inline

Calculates the number of values per field given the number of vorticity and velocity derivatives to recover (stored as private data)

127  {
128  // Output: u,v,p
130 
131  // Loop over the vorticity derivatives
132  for (unsigned i = 0;
134  i++)
135  {
136  // Update the number of values per field
138  }
139 
140  // Loop over the velocity derivatives
141  for (unsigned i = 1;
143  i++)
144  {
145  // Update the number of values per field
147  }
148  } // End of calculate_number_of_values_per_field
int i
Definition: BiCGSTAB_step_by_step.cpp:9
unsigned Number_of_values_per_field
Definition: vorticity_smoother.h:202
unsigned npartial_derivative(const unsigned &n) const
Definition: vorticity_smoother.h:155

References i, Maximum_order_of_velocity_derivative, Maximum_order_of_vorticity_derivative, npartial_derivative(), and Number_of_values_per_field.

Referenced by set_maximum_order_of_velocity_derivative(), and set_maximum_order_of_vorticity_derivative().

◆ maximum_order_of_velocity_derivative()

int oomph::VorticityRecoveryHelpers::RecoveryHelper::maximum_order_of_velocity_derivative ( ) const
inline

The maximum order of derivatives calculated in the velocity recovery.

76  {
77  // Return the appropriate value
79  } // End of get_maximum_order_of_velocity_derivative

References Maximum_order_of_velocity_derivative.

Referenced by oomph::VorticitySmootherElement< ELEMENT >::VorticitySmootherElement().

◆ maximum_order_of_vorticity_derivative()

int oomph::VorticityRecoveryHelpers::RecoveryHelper::maximum_order_of_vorticity_derivative ( ) const
inline

The maximum order of derivatives calculated in the vorticity recovery.

69  {
70  // Return the appropriate value
72  } // End of get_maximum_order_of_vorticity_derivative

References Maximum_order_of_vorticity_derivative.

Referenced by oomph::VorticitySmootherElement< ELEMENT >::VorticitySmootherElement().

◆ ncont_interpolated_values()

unsigned oomph::VorticityRecoveryHelpers::RecoveryHelper::ncont_interpolated_values ( ) const
inline

Number of continuously interpolated values:

192  {
193  // Return the number of values used per field
195  } // End of ncont_interpolated_values

References Number_of_values_per_field.

Referenced by oomph::VorticitySmootherElement< ELEMENT >::VorticitySmootherElement().

◆ npartial_derivative()

unsigned oomph::VorticityRecoveryHelpers::RecoveryHelper::npartial_derivative ( const unsigned n) const
inline

Helper function that determines the number of n-th order partial derivatives in d-dimensions. Specifically there are (n+d-1)(choose)(d-1) possible n-th order partial derivatives in d-dimensions. Implementation makes use of the code found at: www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/

156  {
157  // This will only work in 2D so n_dim is always 2
158  unsigned n_dim = 2;
159 
160  // Calculate m
161  unsigned n_bins = n + n_dim - 1;
162 
163  // Calculate k
164  unsigned k = n_dim - 1;
165 
166  // Initialise the result
167  unsigned value = 1;
168 
169  // Since C(n_bins,k)=C(n_bins,n_bins-k)
170  if (k > n_bins - k)
171  {
172  // Replace k
173  k = n_bins - k;
174  }
175 
176  // Calculate [n_bins*(n_bins-1)*...*(n_bins-k+1)]/[k*(k-1)*...*1]
177  for (unsigned i = 0; i < k; ++i)
178  {
179  // First update
180  value *= (n_bins - i);
181 
182  // Second update
183  value /= (i + 1);
184  }
185 
186  // Return the result
187  return value;
188  } // End of npartial_derivative
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
char char char int int * k
Definition: level2_impl.h:374
squared absolute value
Definition: GlobalFunctions.h:87

References i, k, n, and Eigen::value.

Referenced by calculate_number_of_values_per_field(), and oomph::VorticitySmootherElement< ELEMENT >::npartial_derivative().

◆ set_maximum_order_of_velocity_derivative()

void oomph::VorticityRecoveryHelpers::RecoveryHelper::set_maximum_order_of_velocity_derivative ( const int max_deriv)
inline

The maximum order of derivatives calculated in the velocity recovery.

104  {
105  // Make sure the user has supplied a valid input value. Note, unlike the
106  // vorticity, we always output the zeroth derivative of the velocity
107  // so we don't use -1 as an input
108  if ((max_deriv < 0) || (max_deriv > 1))
109  {
110  // Throw an error
111  throw OomphLibError("Invalid input value! Should be between 0 and 3!",
114  }
115 
116  // Return the appropriate value
118 
119  // Calculate the value of Number_of_values_per_field with the updated
120  // value of Maximum_order_of_velocity_derivative
122  } // End of set_maximum_order_of_vorticity_derivative
void calculate_number_of_values_per_field()
Definition: vorticity_smoother.h:126
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References calculate_number_of_values_per_field(), Maximum_order_of_velocity_derivative, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ set_maximum_order_of_vorticity_derivative()

void oomph::VorticityRecoveryHelpers::RecoveryHelper::set_maximum_order_of_vorticity_derivative ( const int max_deriv)
inline

The maximum order of derivatives calculated in the vorticity recovery.

83  {
84  // Make sure the user has supplied a valid input value
85  if ((max_deriv < -1) || (max_deriv > 3))
86  {
87  // Throw an error
88  throw OomphLibError(
89  "Invalid input value! Should be between -1 and 3!",
92  }
93 
94  // Return the appropriate value
96 
97  // Calculate the value of Number_of_values_per_field with the updated
98  // value of Maximum_order_of_vorticity_derivative
100  } // End of set_maximum_order_of_vorticity_derivative

References calculate_number_of_values_per_field(), Maximum_order_of_vorticity_derivative, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

Member Data Documentation

◆ Maximum_order_of_velocity_derivative

int oomph::VorticityRecoveryHelpers::RecoveryHelper::Maximum_order_of_velocity_derivative
private

Maximum number of derivatives to retain in the velocity recovery. Note, the value 0 means we don't calculate the derivatives of the velocity

Referenced by calculate_number_of_values_per_field(), maximum_order_of_velocity_derivative(), RecoveryHelper(), and set_maximum_order_of_velocity_derivative().

◆ Maximum_order_of_vorticity_derivative

int oomph::VorticityRecoveryHelpers::RecoveryHelper::Maximum_order_of_vorticity_derivative
private

Maximum number of derivatives to retain in the vorticity recovery. Note, the value -1 means we ONLY output u,v[,w],p.

Referenced by calculate_number_of_values_per_field(), maximum_order_of_vorticity_derivative(), RecoveryHelper(), and set_maximum_order_of_vorticity_derivative().

◆ Number_of_values_per_field

unsigned oomph::VorticityRecoveryHelpers::RecoveryHelper::Number_of_values_per_field
private

Number of values per field; how many of the following do we want: u,v,p,omega,d/dx,d/dy, d^2/dx^2,d^2/dxdy,d^2/dy^2, d^3/dx^3,d^3/dx^2dy,d^3/dxdy^2,d^3/dy^3, du/dx,du/dy,dv/dx,dv/dy

Referenced by calculate_number_of_values_per_field(), and ncont_interpolated_values().


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