SpikedLine Class Reference
+ Inheritance diagram for SpikedLine:

Public Member Functions

 SpikedLine (const Vector< Data * > &geom_data_pt)
 
 SpikedLine (const double &height, const double &amplitude, const double &zeta_min, const double &zeta_max)
 
 ~SpikedLine ()
 Destructor: Clean up if necessary. 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

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Steady, spiked 1D line in 2D space

\[ x = \zeta \]

\[ y = \left\{ \begin{array}{cl} H + 2A\left(\frac{\zeta - \zeta_{\mbox{min}}} {\zeta_{\mbox{max}} - \zeta_{\mbox{min}}}\right) & \mbox{for } \zeta \leq \frac{1}{2} \left(\zeta_{\mbox{max}} + \zeta_{\mbox{min}}\right)\\H + 2A\left(\frac{\zeta - \zeta_{\mbox{max}}} {\zeta_{\mbox{min}} - \zeta_{\mbox{max}}}\right) & \mbox{for } \zeta > \frac{1}{2} \left(\zeta_{\mbox{max}} + \zeta_{\mbox{min}}\right)\\ \end{array} \right.\]

Constructor & Destructor Documentation

◆ SpikedLine() [1/2]

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

Constructor: Four item of geometric data:

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
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: spine_channel2.cc:315
double height(const double &x)
Height of domain.
Definition: simple_spine_channel.cc:429
88  : GeomObject(1,2)
89  {
90 #ifdef PARANOID
91  if (geom_data_pt.size()!=1)
92  {
93  std::ostringstream error_stream;
94  error_stream
95  << "Wrong size for geom_data_pt " << geom_data_pt.size() << std::endl;
96  if (geom_data_pt[0]->nvalue()!=1)
97  {
98  error_stream << "Wrong geom_data_pt[0]->nvalue() "
99  << geom_data_pt[0]->nvalue() << std::endl;
100  }
101 
102  throw OomphLibError(error_stream.str(),
105  }
106 #endif
107  Geom_data_pt.resize(1);
109 
110  // Data has been created externally: Must not clean up
111  Must_clean_up=false;
112  }
bool Must_clean_up
Do I need to clean up?
Definition: spine_channel2.cc:318
Data * geom_data_pt(const unsigned &j)
Definition: spine_channel2.cc:309
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
GeomObject()
Default constructor.
Definition: geom_objects.h:104
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.

◆ SpikedLine() [2/2]

SpikedLine::SpikedLine ( 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)

119  : GeomObject(1,2)
120  {
121  // Create Data for deflected-line object
122  Geom_data_pt.resize(1);
123 
124  // Create data: Four value, no timedependence, free by default
125  Geom_data_pt[0] = new Data(4);
126 
127  // I've created the data, I need to clean up
128  Must_clean_up=true;
129 
130  // Pin the data
131  for (unsigned i=0;i<4;i++) {Geom_data_pt[0]->pin(i);}
132 
133  // Give it a value: Initial height
134  Geom_data_pt[0]->set_value(0,height);
135  Geom_data_pt[0]->set_value(1,amplitude);
136  Geom_data_pt[0]->set_value(2,zeta_min);
137  Geom_data_pt[0]->set_value(3,zeta_max);
138  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Definition: nodes.h:86

References Global_Physical_Variables::height(), and i.

◆ ~SpikedLine()

SpikedLine::~SpikedLine ( )
inline

Destructor: Clean up if necessary.

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

Member Function Documentation

◆ d2position() [1/2]

virtual void SpikedLine::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.

254  {
255  // Derivative of tangent vector
256  ddrdzeta(0,0,0)=0.0;
257  ddrdzeta(0,0,1)=0.0;
258  }

◆ d2position() [2/2]

virtual void SpikedLine::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.

269  {
270  // Get parametres
271  double H = Geom_data_pt[0]->value(0);
272  double A = Geom_data_pt[0]->value(1);
273  double zeta_min = Geom_data_pt[0]->value(2);
274  double zeta_max = Geom_data_pt[0]->value(3);
275  double halfLz = (zeta_max-zeta_min)/2.0;
276 
277  // Position Vector
278  r[0] = zeta[0];
279  if (zeta[0]-zeta_min<=halfLz)
280  {
281  r[1] = H + A*(zeta[0]-zeta_min)/halfLz;
282  }
283  else
284  {
285  r[1] = H - A*(zeta[0]-zeta_max)/halfLz;
286  }
287 
288  // Tangent vector
289  drdzeta(0,0)=1.0;
290  if (zeta[0]-zeta_min<=halfLz)
291  {
292  drdzeta(0,1)=A/halfLz;
293  }
294  else
295  {
296  drdzeta(0,1)=-A/halfLz;
297  }
298 
299  // Derivative of tangent vector
300  ddrdzeta(0,0,0)=0.0;
301  ddrdzeta(0,0,1)=0.0;
302  }
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
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
r
Definition: UniformPSDSelfTest.py:20

References H, UniformPSDSelfTest::r, and Eigen::zeta().

◆ dposition()

virtual void SpikedLine::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.

229  {
230  // Get parametres
231  double A = Geom_data_pt[0]->value(1);
232  double zeta_min = Geom_data_pt[0]->value(2);
233  double zeta_max = Geom_data_pt[0]->value(3);
234  double halfLz = (zeta_max-zeta_min)/2.0;
235 
236  // Tangent vector
237  drdzeta(0,0)=1.0;
238  if (zeta[0]-zeta_min<=halfLz)
239  {
240  drdzeta(0,1)=A/halfLz;
241  }
242  else
243  {
244  drdzeta(0,1)=-A/halfLz;
245  }
246  }

References Eigen::zeta().

◆ geom_data_pt()

Data* SpikedLine::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.

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

References j.

◆ ngeom_data()

unsigned SpikedLine::ngeom_data ( ) const
inlinevirtual

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

Reimplemented from oomph::GeomObject.

305 {return Geom_data_pt.size();}

◆ position() [1/2]

void SpikedLine::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.

189  {
190 #ifdef PARANOID
191  if (t>Geom_data_pt[0]->time_stepper_pt()->nprev_values())
192  {
193  std::ostringstream error_stream;
194  error_stream
195  << "t > nprev_values() in SpikedLine: " << t << " "
196  << Geom_data_pt[0]->time_stepper_pt()->nprev_values() << std::endl;
197 
198  throw OomphLibError(error_stream.str(),
201  }
202 #endif
203 
204  // Get parametres
205  double H = Geom_data_pt[0]->value(t,0);
206  double A = Geom_data_pt[0]->value(t,1);
207  double zeta_min = Geom_data_pt[0]->value(t,2);
208  double zeta_max = Geom_data_pt[0]->value(t,3);
209  double halfLz = (zeta_max-zeta_min)/2.0;
210 
211  // Position Vector
212  r[0] = zeta[0];
213  if (zeta[0]-zeta_min<=halfLz)
214  {
215  r[1] = H + A*(zeta[0]-zeta_min)/halfLz;
216  }
217  else
218  {
219  r[1] = H - A*(zeta[0]-zeta_max)/halfLz;
220  }
221  }
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
t
Definition: plotPSD.py:36

References H, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, UniformPSDSelfTest::r, plotPSD::t, and Eigen::zeta().

◆ position() [2/2]

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

Position Vector at Lagrangian coordinate zeta.

Implements oomph::GeomObject.

155  {
156 #ifdef PARANOID
157  if (r.size()!=Ndim)
158  {
159  throw OomphLibError("The vector r has the wrong dimension\n",
162  }
163 #endif
164  // Get parametres
165  double H = Geom_data_pt[0]->value(0);
166  double A = Geom_data_pt[0]->value(1);
167  double zeta_min = Geom_data_pt[0]->value(2);
168  double zeta_max = Geom_data_pt[0]->value(3);
169  double halfLz = (zeta_max-zeta_min)/2.0;
170 
171  // Position Vector
172  r[0] = zeta[0];
173  if (zeta[0]-zeta_min<=halfLz)
174  {
175  r[1] = H + A*(zeta[0]-zeta_min)/halfLz;
176  }
177  else
178  {
179  r[1] = H - A*(zeta[0]-zeta_max)/halfLz;
180  }
181  }
unsigned Ndim
Number of Eulerian coordinates.
Definition: geom_objects.h:431

References H, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, UniformPSDSelfTest::r, and Eigen::zeta().

Member Data Documentation

◆ Geom_data_pt

Vector<Data*> SpikedLine::Geom_data_pt
private

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

◆ Must_clean_up

bool SpikedLine::Must_clean_up
private

Do I need to clean up?


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