26 #ifndef OOMPH_GEOM_OBJECTS_HEADER
27 #define OOMPH_GEOM_OBJECTS_HEADER
32 #include <oomph-lib-config.h>
122 std::ostringstream error_message;
123 error_message <<
"# of Lagrangian coordinates " <<
nlagrangian
124 <<
" cannot be bigger than # of Eulerian ones " <<
ndim
128 OOMPH_CURRENT_FUNCTION,
129 OOMPH_EXCEPTION_LOCATION);
140 const unsigned&
ndim,
149 std::ostringstream error_message;
150 error_message <<
"# of Lagrangian coordinates " <<
nlagrangian
151 <<
" cannot be bigger than # of Eulerian ones " <<
ndim
155 OOMPH_CURRENT_FUNCTION,
156 OOMPH_EXCEPTION_LOCATION);
184 const unsigned& n_dim)
211 std::ostringstream error_message;
213 <<
"GeomObject::ngeom_data() is a broken virtual function.\n"
214 <<
"Please implement it (and its companion "
215 "GeomObject::geom_data_pt())\n"
216 <<
"for any GeomObject whose shape depends on Data whose values may \n"
217 <<
"be unknowns in the global Problem. \n"
218 <<
"If you have arrived here in a parallel job then it may be the case "
220 <<
"that you have not set the keep_all_elements_as_halos() flag to "
222 <<
"for the MeshAsGeomObject representing the lower-dimensional mesh \n"
223 <<
"in a problem with multiple meshes. \n";
225 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
235 std::ostringstream error_message;
237 <<
"GeomObject::geom_data_pt() is a broken virtual function.\n"
238 <<
"Please implement it (and its companion GeomObject::ngeom_data())\n"
239 <<
"for any GeomObject whose shape depends on Data whose values may \n"
240 <<
"be unknowns in the global Problem. \n"
241 <<
"If you have arrived here in a parallel job then it may be the case "
243 <<
"that you have not set the keep_all_elements_as_halos() flag to "
245 <<
"for the MeshAsGeomObject representing the lower-dimensional mesh \n"
246 <<
"in a problem with multiple meshes. \n";
248 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
266 "Calling steady position() from discrete unsteady position()",
267 OOMPH_CURRENT_FUNCTION,
268 OOMPH_EXCEPTION_LOCATION);
280 std::ostringstream error_message;
281 error_message <<
"GeomObject::position() is a broken virtual function.\n"
282 <<
"Please implement it for any GeomObject whose shape\n"
283 <<
"is time-dependent and will be used in the extrusion\n"
284 <<
"of a mesh (in the time direction).\n";
286 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
305 std::ostringstream warning_stream;
307 <<
"Using default (static) assignment " << j
308 <<
"-th time derivative in GeomObject::dposition_dt(...) is zero\n"
309 <<
"Overload for your specific geometric object if this is not \n"
310 <<
"appropriate. \n";
312 "GeomObject::dposition_dt()",
313 OOMPH_EXCEPTION_LOCATION);
315 unsigned n = drdt.size();
316 for (
unsigned i = 0;
i < n;
i++)
331 "You must specify dposition() for your own object! \n",
332 OOMPH_CURRENT_FUNCTION,
333 OOMPH_EXCEPTION_LOCATION);
345 "You must specify d2position() for your own object! \n",
346 OOMPH_CURRENT_FUNCTION,
347 OOMPH_EXCEPTION_LOCATION);
363 "You must specify d2position() for your own object! \n",
364 OOMPH_CURRENT_FUNCTION,
365 OOMPH_EXCEPTION_LOCATION);
385 const bool& use_coordinate_as_initial_guess =
false)
390 sub_geom_object_pt =
this;
408 if (zeta.size() !=
s.size())
410 std::ostringstream error_message;
411 error_message <<
"You've called the default implementation of "
412 <<
"GeomObject::interpolated_zeta() \n"
413 <<
"but zeta.size()=" << zeta.size()
414 <<
"and s.size()=" <<
s.size() << std::endl
415 <<
"This doesn't make sense! You probably have to \n"
416 <<
"overload this function in your specific GeomObject\n";
418 OOMPH_CURRENT_FUNCTION,
419 OOMPH_EXCEPTION_LOCATION);
463 std::ostringstream error_message;
464 error_message <<
"geom_data_pt should have size 1, not "
469 error_message <<
"geom_data_pt[0] should have 1 value, not "
474 OOMPH_CURRENT_FUNCTION,
475 OOMPH_EXCEPTION_LOCATION);
543 std::ostringstream error_message;
544 error_message <<
"t > nprev_values() " <<
t <<
" "
549 OOMPH_CURRENT_FUNCTION,
550 OOMPH_EXCEPTION_LOCATION);
579 ddrdzeta(0, 0, 0) = 0.0;
580 ddrdzeta(0, 0, 1) = 0.0;
604 ddrdzeta(0, 0, 0) = 0.0;
605 ddrdzeta(0, 0, 1) = 0.0;
657 std::ostringstream error_message;
658 error_message <<
"geom_data_pt should have size 1, not "
663 error_message <<
"geom_data_pt[0] should have 2 values, not "
668 OOMPH_CURRENT_FUNCTION,
669 OOMPH_EXCEPTION_LOCATION);
772 std::ostringstream error_message;
773 error_message <<
"t > nprev_values() " <<
t <<
" "
778 OOMPH_CURRENT_FUNCTION,
779 OOMPH_EXCEPTION_LOCATION);
795 drdzeta(0, 0) = -
Geom_data_pt[0]->value(0) * sin(zeta[0]);
796 drdzeta(0, 1) =
Geom_data_pt[0]->value(1) * cos(zeta[0]);
808 ddrdzeta(0, 0, 0) = -
Geom_data_pt[0]->value(0) * cos(zeta[0]);
809 ddrdzeta(0, 0, 1) = -
Geom_data_pt[0]->value(1) * sin(zeta[0]);
825 r[0] = a * cos(zeta[0]);
826 r[1] = b * sin(zeta[0]);
829 drdzeta(0, 0) = -a * sin(zeta[0]);
830 drdzeta(0, 1) = b * cos(zeta[0]);
833 ddrdzeta(0, 0, 0) = -a * cos(zeta[0]);
834 ddrdzeta(0, 0, 1) = -b * sin(zeta[0]);
969 std::ostringstream error_message;
970 error_message <<
"geom_data_pt should have size 1, not "
975 error_message <<
"geom_data_pt[0] should have 3 values, not "
980 OOMPH_CURRENT_FUNCTION,
981 OOMPH_EXCEPTION_LOCATION);
1032 r[0] = X_c +
R * cos(zeta[0]);
1033 r[1] = Y_c +
R * sin(zeta[0]);
1054 std::ostringstream error_message;
1055 error_message <<
"t > nprev_values() " <<
t <<
" "
1060 OOMPH_CURRENT_FUNCTION,
1061 OOMPH_EXCEPTION_LOCATION);
1071 r[0] = X_c +
R * cos(zeta[0]);
1072 r[1] = Y_c +
R * sin(zeta[0]);
1160 r[0] =
A * cos(zeta[1]);
1161 r[1] =
B * sin(zeta[1]);
1184 ddrdzeta(0, 0, 0) = 0.0;
1185 ddrdzeta(0, 0, 1) = 0.0;
1186 ddrdzeta(0, 0, 2) = 0.0;
1188 ddrdzeta(1, 1, 0) = -
A * cos(zeta[1]);
1189 ddrdzeta(1, 1, 1) = -
B * sin(zeta[1]);
1190 ddrdzeta(1, 1, 2) = 0.0;
1192 ddrdzeta(0, 1, 0) = ddrdzeta(1, 0, 0) = 0.0;
1193 ddrdzeta(0, 1, 1) = ddrdzeta(1, 0, 1) = 0.0;
1194 ddrdzeta(0, 1, 2) = ddrdzeta(1, 0, 2) = 0.0;
1204 r[0] =
A * cos(zeta[1]);
1205 r[1] =
B * sin(zeta[1]);
1209 drdzeta(0, 0) = 0.0;
1210 drdzeta(0, 1) = 0.0;
1211 drdzeta(0, 2) = 1.0;
1214 drdzeta(1, 0) = -
A * sin(zeta[1]);
1215 drdzeta(1, 1) =
B * cos(zeta[1]);
1216 drdzeta(1, 2) = 0.0;
1219 ddrdzeta(0, 0, 0) = 0.0;
1220 ddrdzeta(0, 0, 1) = 0.0;
1221 ddrdzeta(0, 0, 2) = 0.0;
1223 ddrdzeta(1, 1, 0) = -
A * cos(zeta[1]);
1224 ddrdzeta(1, 1, 1) = -
B * sin(zeta[1]);
1225 ddrdzeta(1, 1, 2) = 0.0;
1228 ddrdzeta(0, 1, 0) = ddrdzeta(1, 0, 0) = 0.0;
1229 ddrdzeta(0, 1, 1) = ddrdzeta(1, 0, 1) = 0.0;
1230 ddrdzeta(0, 1, 2) = ddrdzeta(1, 0, 2) = 0.0;
////////////////////////////////////////////////////////////////////
double & y_c()
Access function to y-coordinate of centre of circle.
void operator=(const Circle &)=delete
Broken assignment operator.
Circle(const Circle &dummy)=delete
Broken copy constructor.
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: pre...
Circle(const double &x_c, const double &y_c, const double &r, TimeStepper *time_stepper_pt)
Constructor: Pass x and y-coords of centre and radius (all pinned) Circle is static but can be used i...
virtual ~Circle()
Destructor: Clean up if necessary.
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
bool Must_clean_up
Do I need to clean up?
double & x_c()
Access function to x-coordinate of centre of circle.
bool Is_time_dependent
Genuine time-dependence?
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on.
Circle(const Vector< Data * > &geom_data_pt)
Constructor: Pass x and y-coords of centre and radius (all as Data)
Circle(const double &x_c, const double &y_c, const double &r)
Constructor: Pass x and y-coords of centre and radius (all pinned)
double & R()
Access function to radius of circle.
A class that represents a collection of data; each Data object may contain many different individual ...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
////////////////////////////////////////////////////////////////////
void d2position(const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
2nd derivative of position Vector w.r.t. to coordinates: = ddrdzeta(alpha,beta,i)....
Ellipse(const double &A, const double &B)
Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass half axes A and B; both pinned.
Ellipse(const Vector< Data * > &geom_data_pt)
Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass half axes as Data:
void d2position(const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
Position Vector and 1st and 2nd derivs to coordinates: = drdzeta(alpha,i). = ddrdzeta(alpha,...
void operator=(const Ellipse &)=delete
Broken assignment operator.
void set_A_ellips(const double &a)
Set horizontal half axis.
Ellipse(const Ellipse &dummy)=delete
Broken copy constructor.
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: pre...
void set_B_ellips(const double &b)
Set vertical half axis.
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on.
double b_ellips()
Access function for vertical half axis.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
~Ellipse()
Destructor: Clean up if necessary.
bool Must_clean_up
Do I need to clean up?
double a_ellips()
Access function for horizontal half axis.
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
void dposition(const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
Derivative of position Vector w.r.t. to coordinates: = drdzeta(alpha,i).
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Position vector (dummy unsteady version returns steady version)
EllipticalTube(const EllipticalTube &node)=delete
Broken copy constructor.
void operator=(const EllipticalTube &)=delete
Broken assignment operator.
void d2position(const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
Position Vector and 1st and 2nd derivs w.r.t. zeta.
double & a()
Access function to x-half axis.
EllipticalTube(const double &a, const double &b)
Constructor: Specify radius.
double & b()
Access function to y-half axis.
void d2position(const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
Position Vector and 1st and 2nd derivs w.r.t. zeta.
virtual unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
void position(const Vector< double > &zeta, Vector< double > &r) const
Position vector.
/////////////////////////////////////////////////////////////////////
TimeStepper * time_stepper_pt() const
Access function for pointer to time stepper: Null if object is not time-dependent....
unsigned ndim() const
Access function to # of Eulerian coordinates.
virtual void d2position(const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
2nd derivative of position Vector w.r.t. to coordinates: = ddrdzeta(alpha,beta,i)....
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
unsigned NLagrangian
Number of Lagrangian (intrinsic) coordinates.
TimeStepper * Geom_object_time_stepper_pt
Timestepper (used to handle access to geometry at previous timesteps)
virtual unsigned ngeom_data() const
How many items of Data does the shape of the object depend on? This is implemented as a broken virtua...
virtual void interpolated_zeta(const Vector< double > &s, Vector< double > &zeta) const
A geometric object may be composed of many sub-objects each with their own local coordinate....
void set_nlagrangian_and_ndim(const unsigned &n_lagrangian, const unsigned &n_dim)
Set # of Lagrangian and Eulerian coordinates.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
virtual void d2position(const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
Posn Vector and its 1st & 2nd derivatives w.r.t. to coordinates: = drdzeta(alpha,...
void operator=(const GeomObject &)=delete
Broken assignment operator.
GeomObject(const unsigned &ndim)
Constructor: Pass dimension of geometric object (# of Eulerian coords = # of Lagrangian coords; no ti...
unsigned Ndim
Number of Eulerian coordinates.
GeomObject(const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
Constructor: pass # of Eulerian and Lagrangian coordinates and pointer to time-stepper which is used ...
virtual void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
A geometric object may be composed of may sub-objects (e.g. a finite-element representation of a boun...
virtual void dposition(const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
Derivative of position Vector w.r.t. to coordinates: = drdzeta(alpha,i). Evaluated at current time.
virtual void dposition_dt(const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
j-th time-derivative on object at current time: .
virtual ~GeomObject()
(Empty) destructor
virtual void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: pre...
virtual Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on. This is implemented as a bro...
GeomObject(const unsigned &nlagrangian, const unsigned &ndim)
Constructor: pass # of Eulerian and Lagrangian coordinates. No time history available/needed.
unsigned nlagrangian() const
Access function to # of Lagrangian coordinates.
virtual void position(const double &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at the continuous time value, t.
GeomObject(const GeomObject &dummy)=delete
Broken copy constructor.
GeomObject()
Default constructor.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////////
virtual void dposition(const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
Derivative of position Vector w.r.t. to coordinates: = drdzeta(alpha,i). Evaluated at current time.
StraightLine(const StraightLine &dummy)=delete
Broken copy constructor.
StraightLine(const Vector< Data * > &geom_data_pt)
Constructor: One item of geometric data:
~StraightLine()
Destructor: Clean up if necessary.
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
StraightLine(const double &height)
Constructor: Pass height (pinned by default)
bool Must_clean_up
Do I need to clean up?
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
virtual void d2position(const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
Posn Vector and its 1st & 2nd derivatives w.r.t. to coordinates: = drdzeta(alpha,...
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on.
virtual void d2position(const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
2nd derivative of position Vector w.r.t. to coordinates: = ddrdzeta(alpha,beta,i)....
void operator=(const StraightLine &)=delete
Broken assignment operator.
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: pre...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
virtual void assign_initial_values_impulsive(Data *const &data_pt)=0
Initialise the time-history for the Data values corresponding to an impulsive start.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...