OscillatingCylinder Class Reference

Oscillating cylinder class. More...

+ Inheritance diagram for OscillatingCylinder:

Public Member Functions

 OscillatingCylinder (double *radius_pt, double *amplitude_pt, Time *time_pt)
 
virtual ~OscillatingCylinder ()
 Destructor: Empty. More...
 
doubleamplitude ()
 Access function for the amplitude (lvalue) More...
 
Timetime_pt ()
 Access function for the Time pointer. More...
 
void position (const Vector< double > &xi, Vector< double > &r) const
 
void position (const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
 
virtual void position (const double &t, const Vector< double > &xi, Vector< double > &r) const
 
virtual void velocity (const double &t, Vector< double > &u) const
 Velocity at any given point on the rigid cylinder at time, t. More...
 
 OscillatingCylinder (double *radius_pt, double *amplitude_pt, Time *time_pt, const bool &use_transition_phase=true)
 
virtual ~OscillatingCylinder ()
 Destructor: Empty. More...
 
doubleamplitude ()
 Access function for the amplitude (lvalue) More...
 
void position (const Vector< double > &xi, Vector< double > &r) const
 
void position (const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
 
 OscillatingCylinder (double *radius_pt, double *amplitude_pt, Time *time_pt)
 
virtual ~OscillatingCylinder ()
 Destructor: Empty. More...
 
doubleamplitude ()
 Access function for the amplitude (lvalue) More...
 
Timetime_pt ()
 Access function for the Time pointer. More...
 
void position (const Vector< double > &xi, Vector< double > &r) const
 
void position (const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
 
virtual void position (const double &t, const Vector< double > &xi, Vector< double > &r) const
 
virtual void velocity (const double &t, Vector< double > &u) const
 Velocity at any given point on the rigid cylinder at time, t. More...
 
- 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 unsigned ngeom_data () const
 
virtual Datageom_data_pt (const unsigned &j)
 
virtual void dposition_dt (const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
 
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
 
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

doubleRadius_pt
 Radius of the cylinder. More...
 
doubleAmplitude_pt
 Non-dimensionalised amplitude of the cylinder motion. More...
 
TimeTime_pt
 Pointer to the current time in the problem. More...
 
bool Use_transition_phase
 

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

Oscillating cylinder class.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ OscillatingCylinder() [1/3]

OscillatingCylinder::OscillatingCylinder ( double radius_pt,
double amplitude_pt,
Time time_pt 
)
inline

Constructor: Pass in the radius, the amplitude of the cylinder motion, the simulation Strouhal number and a pointer to time object.

52  :
53  GeomObject(1,2),
54  Radius_pt(radius_pt),
55  Amplitude_pt(amplitude_pt),
57  {}
Time * time_pt()
Access function for the Time pointer.
Definition: extrude_with_macro_element_representation.cc:70
double * Radius_pt
Radius of the cylinder.
Definition: extrude_with_macro_element_representation.cc:166
Time * Time_pt
Pointer to the current time in the problem.
Definition: extrude_with_macro_element_representation.cc:172
double * Amplitude_pt
Non-dimensionalised amplitude of the cylinder motion.
Definition: extrude_with_macro_element_representation.cc:169
GeomObject()
Default constructor.
Definition: geom_objects.h:104

◆ ~OscillatingCylinder() [1/3]

virtual OscillatingCylinder::~OscillatingCylinder ( )
inlinevirtual

Destructor: Empty.

60 {}

◆ OscillatingCylinder() [2/3]

OscillatingCylinder::OscillatingCylinder ( double radius_pt,
double amplitude_pt,
Time time_pt,
const bool use_transition_phase = true 
)
inline

Constructor: Pass radius, amplitude of the motion, the excitation wavelength and pointer to time object.

108  :
109  GeomObject(1,2),
110  Radius_pt(radius_pt),
111  Amplitude_pt(amplitude_pt),
112  Time_pt(time_pt),
113  Use_transition_phase(use_transition_phase)
114  {}
bool Use_transition_phase
Definition: flow_past_oscillating_cylinder.cc:191

◆ ~OscillatingCylinder() [2/3]

virtual OscillatingCylinder::~OscillatingCylinder ( )
inlinevirtual

Destructor: Empty.

117 {}

◆ OscillatingCylinder() [3/3]

OscillatingCylinder::OscillatingCylinder ( double radius_pt,
double amplitude_pt,
Time time_pt 
)
inline

Constructor: Pass in the radius, the amplitude of the cylinder motion, the simulation Strouhal number and a pointer to time object.

119  :
120  GeomObject(1,2),
121  Radius_pt(radius_pt),
122  Amplitude_pt(amplitude_pt),
124  {}

◆ ~OscillatingCylinder() [3/3]

virtual OscillatingCylinder::~OscillatingCylinder ( )
inlinevirtual

Destructor: Empty.

127 {}

Member Function Documentation

◆ amplitude() [1/3]

double& OscillatingCylinder::amplitude ( )
inline

Access function for the amplitude (lvalue)

64  {
65  // Return the value of the amplitude
66  return *Amplitude_pt;
67  } // End of amplitude

◆ amplitude() [2/3]

double& OscillatingCylinder::amplitude ( )
inline

Access function for the amplitude (lvalue)

121  {
122  // Return the value of the amplitude
123  return *Amplitude_pt;
124  } // End of amplitude

◆ amplitude() [3/3]

double& OscillatingCylinder::amplitude ( )
inline

Access function for the amplitude (lvalue)

131  {
132  // Return the value of the amplitude
133  return *Amplitude_pt;
134  } // End of amplitude

◆ position() [1/8]

virtual void OscillatingCylinder::position ( const double t,
const Vector< double > &  xi,
Vector< double > &  r 
) const
inlinevirtual

Parametrised position on object: r(zeta). Evaluated at the continuous time value, t.

Reimplemented from oomph::GeomObject.

136  {
137  // Calculate the coordinate before translation
138  position(xi,r);
139 
140  // Scaling factor
141  double arg=2.0*MathematicalConstants::Pi;
142 
143  // Calculate the translation
144  double translation=(*Amplitude_pt)*sin(arg*t);
145 
146  // Update the y-coordinate
147  r[1]+=translation;
148  } // End of position
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
void position(const Vector< double > &xi, Vector< double > &r) const
Definition: extrude_with_macro_element_representation.cc:78
double Pi
Definition: two_d_biharmonic.cc:235
r
Definition: UniformPSDSelfTest.py:20
t
Definition: plotPSD.py:36

References oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, sin(), and plotPSD::t.

◆ position() [2/8]

virtual void OscillatingCylinder::position ( const double t,
const Vector< double > &  xi,
Vector< double > &  r 
) const
inlinevirtual

Parametrised position on object: r(zeta). Evaluated at the continuous time value, t.

Reimplemented from oomph::GeomObject.

203  {
204  // Calculate the coordinate before translation
205  position(xi,r);
206 
207  // Scaling factor
208  double arg=2.0*MathematicalConstants::Pi;
209 
210  // Calculate the translation
211  double translation=(*Amplitude_pt)*sin(arg*t);
212 
213  // Update the y-coordinate
214  r[1]+=translation;
215  } // End of position

References oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, sin(), and plotPSD::t.

◆ position() [3/8]

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

Current position vector to material point at Lagrangian coordinate xi (unsteady version). Implementation includes a transition phase where the cylinder oscillates to a smaller amplitude than the target value. Used to ensure that the solution isn't drastically different to that at the next time step. This can be disabled by setting Use_transition_phase to false.

Reimplemented from oomph::GeomObject.

97  {
98  // We can only use this if t=0
99  if (t!=0)
100  {
101  // Create an output stream
102  std::ostringstream error_message_stream;
103 
104  // Create an error message
105  error_message_stream << "Trying to access the position at time history "
106  << "value, t: " << t << ".\nThis doesn't make sense "
107  << "in the space-time mesh!" << std::endl;
108 
109  // Throw the error message
110  throw OomphLibError(error_message_stream.str(),
113  }
114 
115  // Calculate the coordinate before translation
116  position(xi,r);
117 
118  // Get current time
119  double time=Time_pt->time(t);
120 
121  // Scaling factor
122  double arg=2.0*MathematicalConstants::Pi;
123 
124  // Calculate the translation
125  double translation=(*Amplitude_pt)*sin(arg*time);
126 
127  // Update the y-coordinate
128  r[1]+=translation;
129  } // End of position
Definition: oomph_definitions.h:222
double & time()
Return the current value of the continuous time.
Definition: timesteppers.h:123
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, sin(), plotPSD::t, oomph::Time::time(), and Flag_definition::Time_pt.

◆ position() [4/8]

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

Current position vector to material point at Lagrangian coordinate xi (unsteady version). Implementation includes a transition phase where the cylinder oscillates to a smaller amplitude than the target value. Used to ensure that the solution isn't drastically different to that at the next time step. This can be disabled by setting Use_transition_phase to false.

Reimplemented from oomph::GeomObject.

147  {
148  // Calculate the coordinate before translation
149  position(xi,r);
150 
151  // Get current time
152  double time=Time_pt->time(t);
153 
154  // Scaling factor
155  double arg=2.0*MathematicalConstants::Pi;
156 
157  // Calculate the translation
158  double translation=(*Amplitude_pt)*sin(arg*time);
159 
160  // If the user wishes to use a transition phase
162  {
163  // Time for transition (equal to two periods)
164  double t_transition=2.0;
165 
166  // If we're not past the transition point
167  if (time<t_transition)
168  {
169  // Scale the translation
170  translation*=(time/t_transition)*exp(1.0-(time/t_transition));
171  }
172  } // if (Use_transition_phase)
173 
174  // Update the y-coordinate
175  r[1]+=translation;
176  } // End of position
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615

References Eigen::bfloat16_impl::exp(), oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, sin(), plotPSD::t, oomph::Time::time(), and Flag_definition::Time_pt.

◆ position() [5/8]

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

Current position vector to material point at Lagrangian coordinate xi (unsteady version). Implementation includes a transition phase where the cylinder oscillates to a smaller amplitude than the target value. Used to ensure that the solution isn't drastically different to that at the next time step. This can be disabled by setting Use_transition_phase to false.

Reimplemented from oomph::GeomObject.

164  {
165  // We can only use this if t=0
166  if (t!=0)
167  {
168  // Create an output stream
169  std::ostringstream error_message_stream;
170 
171  // Create an error message
172  error_message_stream << "Trying to access the position at time history "
173  << "value, t: " << t << ".\nThis doesn't make sense "
174  << "in the space-time mesh!" << std::endl;
175 
176  // Throw the error message
177  throw OomphLibError(error_message_stream.str(),
180  }
181 
182  // Calculate the coordinate before translation
183  position(xi,r);
184 
185  // Get current time
186  double time=Time_pt->time(t);
187 
188  // Scaling factor
189  double arg=2.0*MathematicalConstants::Pi;
190 
191  // Calculate the translation
192  double translation=(*Amplitude_pt)*sin(arg*time);
193 
194  // Update the y-coordinate
195  r[1]+=translation;
196  } // End of position

References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, sin(), plotPSD::t, oomph::Time::time(), and Flag_definition::Time_pt.

◆ position() [6/8]

void OscillatingCylinder::position ( const Vector< double > &  xi,
Vector< double > &  r 
) const
inlinevirtual

Current position vector to material point at Lagrangian coordinate xi (steady version)

Implements oomph::GeomObject.

80  {
81  // X-coordinate
82  r[0]=(*Radius_pt)*cos(xi[0]);
83 
84  // Y-coordinate
85  r[1]=(*Radius_pt)*sin(xi[0]);
86  } // End of position
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136

References cos(), UniformPSDSelfTest::r, and sin().

Referenced by CylinderAndInterfaceDomain::CylinderAndInterfaceDomain(), RectangleWithHoleDomain::macro_element_boundary(), oomph::HalfRectangleWithHoleDomain::macro_element_boundary(), CylinderAndInterfaceDomain::macro_element_boundary(), oomph::AlgebraicCylinderWithFlagMesh< ELEMENT >::node_update_IX(), and oomph::AlgebraicCylinderWithFlagMesh< ELEMENT >::node_update_VIII().

◆ position() [7/8]

void OscillatingCylinder::position ( const Vector< double > &  xi,
Vector< double > &  r 
) const
inlinevirtual

Current position vector to material point at Lagrangian coordinate xi (steady version)

Implements oomph::GeomObject.

130  {
131  // X-coordinate
132  r[0]=(*Radius_pt)*cos(xi[0]);
133 
134  // Y-coordinate
135  r[1]=(*Radius_pt)*sin(xi[0]);
136  } // End of position

References cos(), UniformPSDSelfTest::r, and sin().

◆ position() [8/8]

void OscillatingCylinder::position ( const Vector< double > &  xi,
Vector< double > &  r 
) const
inlinevirtual

Current position vector to material point at Lagrangian coordinate xi (steady version)

Implements oomph::GeomObject.

147  {
148  // X-coordinate
149  r[0]=(*Radius_pt)*cos(xi[0]);
150 
151  // Y-coordinate
152  r[1]=(*Radius_pt)*sin(xi[0]);
153  } // End of position

References cos(), UniformPSDSelfTest::r, and sin().

◆ time_pt() [1/2]

Time* OscillatingCylinder::time_pt ( )
inline

Access function for the Time pointer.

71  {
72  // Return the Time pointer
73  return Time_pt;
74  } // End of time_pt

References Flag_definition::Time_pt.

◆ time_pt() [2/2]

Time* OscillatingCylinder::time_pt ( )
inline

Access function for the Time pointer.

138  {
139  // Return the Time pointer
140  return Time_pt;
141  } // End of time_pt

References Flag_definition::Time_pt.

◆ velocity() [1/2]

virtual void OscillatingCylinder::velocity ( const double t,
Vector< double > &  u 
) const
inlinevirtual

Velocity at any given point on the rigid cylinder at time, t.

152  {
153  // Scaling factor
154  double arg=2.0*MathematicalConstants::Pi;
155 
156  // Zero velocity component in the x-direction
157  u[0]=0.0;
158 
159  // Calculate the (non-zero) velocity component in the y-direction
160  u[1]=arg*(*Amplitude_pt)*cos(arg*t);
161  } // End of velocity

References cos(), oomph::MathematicalConstants::Pi, and plotPSD::t.

Referenced by NavierStokesProblem< ELEMENT >::apply_boundary_conditions().

◆ velocity() [2/2]

virtual void OscillatingCylinder::velocity ( const double t,
Vector< double > &  u 
) const
inlinevirtual

Velocity at any given point on the rigid cylinder at time, t.

219  {
220  // Scaling factor
221  double arg=2.0*MathematicalConstants::Pi;
222 
223  // Zero velocity component in the x-direction
224  u[0]=0.0;
225 
226  // Calculate the (non-zero) velocity component in the y-direction
227  u[1]=arg*(*Amplitude_pt)*cos(arg*t);
228  } // End of velocity

References cos(), oomph::MathematicalConstants::Pi, and plotPSD::t.

Member Data Documentation

◆ Amplitude_pt

double * OscillatingCylinder::Amplitude_pt
private

Non-dimensionalised amplitude of the cylinder motion.

◆ Radius_pt

double * OscillatingCylinder::Radius_pt
private

Radius of the cylinder.

◆ Time_pt

Time * OscillatingCylinder::Time_pt
private

Pointer to the current time in the problem.

◆ Use_transition_phase

bool OscillatingCylinder::Use_transition_phase
private

Boolean variable to indicate whether or not to use a transition phase at the start of the simulation. Defaults to true.


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