SinusoidalWall Class Reference
+ Inheritance diagram for SinusoidalWall:

Public Member Functions

 SinusoidalWall (const double &height, const double &amplitude, const double &zeta_min, const double &zeta_max)
 
 SinusoidalWall (const Vector< Data * > &geom_data_pt)
 
 ~SinusoidalWall ()
 Destructor: Clean up if necessary. More...
 
doubleheight ()
 Access function for horizontal half axis. More...
 
doubleamplitude ()
 Access function for vertical half axis. More...
 
void position (const Vector< double > &zeta, Vector< double > &r) const
 Position vector at Lagrangian coordinate zeta. More...
 
void position (const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
virtual void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
unsigned ngeom_data () const
 How many items of Data does the shape of the object depend on? More...
 
Datageom_data_pt (const unsigned &j)
 
- Public Member Functions inherited from oomph::GeomObject
 GeomObject ()
 Default constructor. More...
 
 GeomObject (const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
 
 GeomObject (const GeomObject &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const GeomObject &)=delete
 Broken assignment operator. More...
 
virtual ~GeomObject ()
 (Empty) destructor More...
 
unsigned nlagrangian () const
 Access function to # of Lagrangian coordinates. More...
 
unsigned ndim () const
 Access function to # of Eulerian coordinates. More...
 
void set_nlagrangian_and_ndim (const unsigned &n_lagrangian, const unsigned &n_dim)
 Set # of Lagrangian and Eulerian coordinates. More...
 
TimeStepper *& time_stepper_pt ()
 
TimeSteppertime_stepper_pt () const
 
virtual void position (const double &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition_dt (const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
 
virtual void locate_zeta (const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
 
virtual void interpolated_zeta (const Vector< double > &s, Vector< double > &zeta) const
 

Private Attributes

Vector< Data * > Geom_data_pt
 Vector of pointers to Data items that affects the object's shape. More...
 
bool Must_clean_up
 Do I need to clean up? More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::GeomObject
unsigned NLagrangian
 Number of Lagrangian (intrinsic) coordinates. More...
 
unsigned Ndim
 Number of Eulerian coordinates. More...
 
TimeStepperGeom_object_time_stepper_pt
 

Detailed Description

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Geometric object representing a sinusoidal wall, parametrised by

\[ x = \zeta \]

\[ y = H + A \sin\left(\frac{2\pi \left(\zeta-\zeta_{\mbox{min}}\right)} {\zeta_{\mbox{max}}-\zeta_{\mbox{min}}} \right)\]

Constructor & Destructor Documentation

◆ SinusoidalWall() [1/2]

SinusoidalWall::SinusoidalWall ( const double height,
const double amplitude,
const double zeta_min,
const double zeta_max 
)
inline

Constructor: Pass height, amplitude, zeta min and zeta max (all are pinned by default)

81  : GeomObject(1,2)
82  {
83  // Make space for the geometric data
84  Geom_data_pt.resize(1);
85 
86  // Create data: Four value, no time dependence, free by default
87  Geom_data_pt[0] = new Data(4);
88 
89  // I've created the data, I have to clean up
90  Must_clean_up=true;
91 
92  // Pin the data
93  for (unsigned i=0;i<4;i++) {Geom_data_pt[0]->pin(i);}
94 
95  // Give it a value: Initial height
96  Geom_data_pt[0]->set_value(0,height);
97  Geom_data_pt[0]->set_value(1,amplitude);
98  Geom_data_pt[0]->set_value(2,zeta_min);
99  Geom_data_pt[0]->set_value(3,zeta_max);
100  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: spine_channel.cc:295
double & amplitude()
Access function for vertical half axis.
Definition: spine_channel.cc:154
double & height()
Access function for horizontal half axis.
Definition: spine_channel.cc:151
bool Must_clean_up
Do I need to clean up?
Definition: spine_channel.cc:298
Definition: nodes.h:86
GeomObject()
Default constructor.
Definition: geom_objects.h:104

References Global_Physical_Variables::height(), and i.

◆ SinusoidalWall() [2/2]

SinusoidalWall::SinusoidalWall ( const Vector< Data * > &  geom_data_pt)
inline

Constructor: One item of geometric data, containing four values:

Geom_data_pt[0]->value(0) = height
Geom_data_pt[0]->value(1) = amplitude
Geom_data_pt[0]->value(2) = zeta_min
Geom_data_pt[0]->value(3) = zeta_max
111  : GeomObject(1,2)
112  {
113 #ifdef PARANOID
114  if(geom_data_pt.size()!=1)
115  {
116  std::ostringstream error_stream;
117  error_stream
118  << "Wrong size for geom_data_pt " << geom_data_pt.size() << std::endl;
119  if (geom_data_pt[0]->nvalue()!=1)
120  {
121  error_stream << "Wrong geom_data_pt[0]->nvalue() "
122  << geom_data_pt[0]->nvalue() << std::endl;
123  }
124 
125  throw OomphLibError(error_stream.str(),
128  }
129 #endif
130  Geom_data_pt.resize(1);
132 
133  // Data has been created externally: Must not clean up
134  Must_clean_up=false;
135  }
Data * geom_data_pt(const unsigned &j)
Definition: spine_channel.cc:289
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
Definition: oomph_definitions.h:222
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ ~SinusoidalWall()

SinusoidalWall::~SinusoidalWall ( )
inline

Destructor: Clean up if necessary.

141  {
142  // Do I need to clean up?
143  if (Must_clean_up)
144  {
145  delete Geom_data_pt[0];
146  Geom_data_pt[0]=0;
147  }
148  }

Member Function Documentation

◆ amplitude()

double& SinusoidalWall::amplitude ( )
inline

Access function for vertical half axis.

154 {return *Geom_data_pt[0]->value_pt(1);}

◆ d2position() [1/2]

virtual void SinusoidalWall::d2position ( const Vector< double > &  zeta,
RankThreeTensor< double > &  ddrdzeta 
) const
inlinevirtual

2nd derivative of position Vector w.r.t. to coordinates: \( \frac{d^2R_i}{d \zeta_\alpha d \zeta_\beta}\) = ddrdzeta(alpha,beta,i). Evaluated at current time.

Reimplemented from oomph::GeomObject.

239  {
240  // Get parametres
241  double A = Geom_data_pt[0]->value(1);
242  double zeta_min = Geom_data_pt[0]->value(2);
243  double zeta_max = Geom_data_pt[0]->value(3);
244  double Lz = zeta_max-zeta_min;
245 
246  // Derivative of tangent vector
247  ddrdzeta(0,0,0)=0.0;
249  A*sin(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz)/(Lz*Lz);
250  }
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
double Pi
Definition: two_d_biharmonic.cc:235
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
double Lz
Length of domain in z-direction.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:68

References Global_Parameters::Lz, BiharmonicTestFunctions2::Pi, sin(), and Eigen::zeta().

◆ d2position() [2/2]

virtual void SinusoidalWall::d2position ( const Vector< double > &  zeta,
Vector< double > &  r,
DenseMatrix< double > &  drdzeta,
RankThreeTensor< double > &  ddrdzeta 
) const
inlinevirtual

Posn Vector and its 1st & 2nd derivatives w.r.t. to coordinates: \( \frac{dR_i}{d \zeta_\alpha}\) = drdzeta(alpha,i). \( \frac{d^2R_i}{d \zeta_\alpha d \zeta_\beta}\) = ddrdzeta(alpha,beta,i). Evaluated at current time.

Reimplemented from oomph::GeomObject.

261  {
262  // Get parametres
263  double H = Geom_data_pt[0]->value(0);
264  double A = Geom_data_pt[0]->value(1);
265  double zeta_min = Geom_data_pt[0]->value(2);
266  double zeta_max = Geom_data_pt[0]->value(3);
267  double Lz = zeta_max-zeta_min;
268 
269  // Position Vector
270  r[0] = zeta[0];
271  r[1] = H + A*sin(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz);
272 
273  // Tangent vector
274  drdzeta(0,0)=1.0;
275  drdzeta(0,1)=MathematicalConstants::Pi*A*
276  cos(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz)/Lz;
277 
278  // Derivative of tangent vector
279  ddrdzeta(0,0,0)=0.0;
281  A*sin(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz)/(Lz*Lz);
282  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
r
Definition: UniformPSDSelfTest.py:20

References cos(), H, Global_Parameters::Lz, BiharmonicTestFunctions2::Pi, UniformPSDSelfTest::r, sin(), and Eigen::zeta().

◆ dposition()

virtual void SinusoidalWall::dposition ( const Vector< double > &  zeta,
DenseMatrix< double > &  drdzeta 
) const
inlinevirtual

Derivative of position Vector w.r.t. to coordinates: \( \frac{dR_i}{d \zeta_\alpha}\) = drdzeta(alpha,i). Evaluated at current time.

Reimplemented from oomph::GeomObject.

220  {
221  // Get parametres
222  double A = Geom_data_pt[0]->value(1);
223  double zeta_min = Geom_data_pt[0]->value(2);
224  double zeta_max = Geom_data_pt[0]->value(3);
225  double Lz = zeta_max-zeta_min;
226 
227  // Tangent vector
228  drdzeta(0,0)=1.0;
229  drdzeta(0,1)=MathematicalConstants::Pi*A*
230  cos(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz)/Lz;
231  }

References cos(), Global_Parameters::Lz, BiharmonicTestFunctions2::Pi, and Eigen::zeta().

◆ geom_data_pt()

Data* SinusoidalWall::geom_data_pt ( const unsigned j)
inlinevirtual

Return pointer to the j-th Data item that the object's shape depends on

Reimplemented from oomph::GeomObject.

289 {return Geom_data_pt[j];}
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References j.

◆ height()

double& SinusoidalWall::height ( )
inline

Access function for horizontal half axis.

151 {return *Geom_data_pt[0]->value_pt(0);}

◆ ngeom_data()

unsigned SinusoidalWall::ngeom_data ( ) const
inlinevirtual

How many items of Data does the shape of the object depend on?

Reimplemented from oomph::GeomObject.

285 {return Geom_data_pt.size();}

◆ position() [1/2]

void SinusoidalWall::position ( const unsigned t,
const Vector< double > &  zeta,
Vector< double > &  r 
) const
inlinevirtual

Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: previous timestep.

Reimplemented from oomph::GeomObject.

186  {
187 #ifdef PARANOID
188  if (t>Geom_data_pt[0]->time_stepper_pt()->nprev_values())
189  {
190  std::ostringstream error_stream;
191  error_stream
192  << "t > nprev_values() in SpikedLine: " << t << " "
193  << Geom_data_pt[0]->time_stepper_pt()->nprev_values() << std::endl;
194 
195  throw OomphLibError(error_stream.str(),
198  }
199 #endif
200 
201  // Get parameters
202  double H = Geom_data_pt[0]->value(t,0);
203  double A = Geom_data_pt[0]->value(t,1);
204  double zeta_min = Geom_data_pt[0]->value(t,2);
205  double zeta_max = Geom_data_pt[0]->value(t,3);
206  double Lz = zeta_max-zeta_min;
207 
208  // Position Vector at time level t
209  r[0] = zeta[0];
210  r[1] = H + A*sin(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz);
211  }
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
t
Definition: plotPSD.py:36

References H, Global_Parameters::Lz, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, BiharmonicTestFunctions2::Pi, UniformPSDSelfTest::r, sin(), plotPSD::t, and Eigen::zeta().

◆ position() [2/2]

void SinusoidalWall::position ( const Vector< double > &  zeta,
Vector< double > &  r 
) const
inlinevirtual

Position vector at Lagrangian coordinate zeta.

Implements oomph::GeomObject.

159  {
160 #ifdef PARANOID
161  if (r.size()!=Ndim)
162  {
163  throw OomphLibError("The vector r has the wrong dimension\n",
166  }
167 #endif
168  // Get parameters
169  double H = Geom_data_pt[0]->value(0);
170  double A = Geom_data_pt[0]->value(1);
171  double zeta_min = Geom_data_pt[0]->value(2);
172  double zeta_max = Geom_data_pt[0]->value(3);
173  double Lz = zeta_max-zeta_min;
174 
175  // Position Vector
176  r[0] = zeta[0];
177  r[1] = H + A*sin(MathematicalConstants::Pi*(zeta[0]-zeta_min)/Lz);
178  }
unsigned Ndim
Number of Eulerian coordinates.
Definition: geom_objects.h:431

References H, Global_Parameters::Lz, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, BiharmonicTestFunctions2::Pi, UniformPSDSelfTest::r, sin(), and Eigen::zeta().

Member Data Documentation

◆ Geom_data_pt

Vector<Data*> SinusoidalWall::Geom_data_pt
private

Vector of pointers to Data items that affects the object's shape.

◆ Must_clean_up

bool SinusoidalWall::Must_clean_up
private

Do I need to clean up?


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