30 #ifndef OOMPH_GEOM_OBJ_WITH_BOUNDARY_HEADER 31 #define OOMPH_GEOM_OBJ_WITH_BOUNDARY_HEADER 36 #include <oomph-lib-config.h> 89 const double& zeta_bound,
100 const double& zeta_bound,
106 std::ostringstream error_message;
108 <<
"You must create a <1,2> Geom Object that provides a\n" 109 <<
"mapping from the 1D boundary coordinate to the 2D\n" 110 <<
"intrinsic Lagrangian coordinate of disk-like object\n" 113 OOMPH_CURRENT_FUNCTION,
114 OOMPH_EXCEPTION_LOCATION);
118 std::ostringstream error_message;
120 <<
"Boundary_parametrising_geom_object_pt must point to\n" 121 <<
"GeomObject with one Lagrangian coordinate. Yours has " 125 OOMPH_CURRENT_FUNCTION,
126 OOMPH_EXCEPTION_LOCATION);
130 std::ostringstream error_message;
132 <<
"Boundary_parametrising_geom_object_pt must point to\n" 133 <<
"GeomObject with two Eulerian coordinates. Yours has " 137 OOMPH_CURRENT_FUNCTION,
138 OOMPH_EXCEPTION_LOCATION);
172 const double& zeta_bound,
178 std::ostringstream error_message;
180 <<
"Broken virtual function; please implement for your\n" 181 <<
"derived version of this class!" 184 OOMPH_CURRENT_FUNCTION,
185 OOMPH_EXCEPTION_LOCATION);
192 std::ofstream& two_d_boundaries_file,
193 std::ofstream& three_d_boundaries_file)
195 std::ofstream boundaries_tangent_file;
196 std::ofstream boundaries_normal_file;
197 std::ofstream boundaries_binormal_file;
199 two_d_boundaries_file,
200 three_d_boundaries_file,
201 boundaries_tangent_file,
202 boundaries_normal_file,
203 boundaries_binormal_file);
214 std::ofstream& two_d_boundaries_file,
215 std::ofstream& three_d_boundaries_file,
216 std::ofstream& boundaries_tangent_file,
217 std::ofstream& boundaries_normal_file,
218 std::ofstream& boundaries_binormal_file)
222 double zeta_bound=0.0;
227 for (
unsigned b=0;b<nb;b++)
229 two_d_boundaries_file <<
"ZONE" << std::endl;
230 three_d_boundaries_file <<
"ZONE" << std::endl;
231 boundaries_tangent_file <<
"ZONE" << std::endl;
232 boundaries_normal_file <<
"ZONE" << std::endl;
233 boundaries_binormal_file <<
"ZONE" << std::endl;
238 for (
unsigned i=0;
i<n;
i++)
241 (zeta_max-zeta_min)*
double(
i)/double(n-1);
251 two_d_boundaries_file << zeta[0] <<
" " 256 three_d_boundaries_file << r[0] <<
" " 264 boundaries_tangent_file << r[0] <<
" " 272 boundaries_normal_file << r[0] <<
" " 280 boundaries_binormal_file << r[0] <<
" " 283 << binormal[0] <<
" " 284 << binormal[1] <<
" " 285 << binormal[2] <<
" " 300 std::ostringstream error_message;
301 error_message <<
"Please use another region id different from zero.\n" 302 <<
"It is internally used as the default region number.\n";
304 OOMPH_CURRENT_FUNCTION,
305 OOMPH_EXCEPTION_LOCATION);
308 unsigned n=zeta_in_region.size();
311 std::ostringstream error_message;
312 error_message <<
"Vector specifying zeta coordinates of point in\n" 313 <<
"region has be length 2; yours has length " 316 OOMPH_CURRENT_FUNCTION,
317 OOMPH_EXCEPTION_LOCATION);
321 std::map<unsigned, Vector<double> >::iterator it;
327 std::ostringstream error_message;
328 error_message <<
"The region id (" << r <<
") that you are using for" 330 <<
"your region is already in use. Use another\n" 331 <<
"region id and verify that you are not re-using\n" 332 <<
" previously defined regions ids.\n"<<std::endl;
334 OOMPH_CURRENT_FUNCTION,
335 OOMPH_EXCEPTION_LOCATION);
389 const double& z_offset=0.0) :
390 Epsilon(epsilon),
N(n), Z_offset(z_offset)
414 OOMPH_CURRENT_FUNCTION,
415 OOMPH_EXCEPTION_LOCATION);
435 for (
unsigned b=0;b<n;b++)
454 double radius=sqrt(r[0]*r[0]+r[1]*r[1]);
455 double phi=atan2(r[1],r[0]);
456 r[2]=Z_offset+w(radius,phi);
472 const double& zeta_bound,
478 double phi=zeta_bound;
483 r[2]=Z_offset+w(1.0,phi);
488 dr_dr[2]=dwdr(1.0,phi);
489 double inv_norm=1.0/sqrt(dr_dr[0]*dr_dr[0]+
493 normal[0]=dr_dr[0]*inv_norm;
494 normal[1]=dr_dr[1]*inv_norm;
495 normal[2]=dr_dr[2]*inv_norm;
498 dr_dphi[0]=-sin(phi);
500 dr_dphi[2]=dwdphi(1.0,phi);
502 inv_norm=1.0/sqrt(dr_dphi[0]*dr_dphi[0]+
503 dr_dphi[1]*dr_dphi[1]+
504 dr_dphi[2]*dr_dphi[2]);
506 tangent[0]=dr_dphi[0]*inv_norm;
507 tangent[1]=dr_dphi[1]*inv_norm;
508 tangent[2]=dr_dphi[2]*inv_norm;
510 binormal[0]=tangent[1]*normal[2]-tangent[2]*normal[1];
511 binormal[1]=tangent[2]*normal[0]-tangent[0]*normal[2];
512 binormal[2]=tangent[0]*normal[1]-tangent[1]*normal[0];
519 double w(
const double& r,
const double& phi)
const 521 return Epsilon*cos(
double(
N)*phi)*pow(r,2);
525 double dwdr(
const double& r,
const double& phi)
const 527 return Epsilon*cos(
double(
N)*phi)*2.0*r;
531 double dwdphi(
const double& r,
const double& phi)
const 533 return -Epsilon*double(
N)*sin(
double(
N)*phi)*pow(r,2);
570 (
const double& h_annulus,
571 const double& epsilon,
573 const double& z_offset=0.0) :
582 double r_annulus=1.0-h_annulus;
598 zeta_in_region[0]=0.0;
599 zeta_in_region[0]=1.0-0.5*h_annulus;
void add_region_coordinates(const unsigned &r, Vector< double > &zeta_in_region)
Specify intrinsic coordinates of a point within a specified region – region ID, r, should be positive.
std::map< unsigned, Vector< double > > Zeta_in_region
Map to store zeta coordinates of points that identify regions.
Warped disk in 3d: zeta[0]=x; zeta[1]=y (so it doesn't have coordinate singularities), with specification of two boundaries (b=0,1) that turn the whole thing into a circular disk.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void zeta_on_boundary(const unsigned &b, const double &zeta_bound, Vector< double > &zeta) const
Compute 2D vector of intrinsic coordinates at 1D boundary coordinate zeta_bound on boundary b: ...
WarpedCircularDisk()
Empty default constructor.
double zeta_boundary_start(const unsigned &b) const
Initial value of 1D boundary coordinate zeta_bound on boundary b:
virtual void boundary_triad(const unsigned &b, const double &zeta_bound, Vector< double > &r, Vector< double > &tangent, Vector< double > &normal, Vector< double > &binormal)
Boundary triad on boundary b at boundary coordinate zeta_bound. Broken virtual.
void output_boundaries_and_triads(const unsigned &nplot, std::ofstream &two_d_boundaries_file, std::ofstream &three_d_boundaries_file, std::ofstream &boundaries_tangent_file, std::ofstream &boundaries_normal_file, std::ofstream &boundaries_binormal_file)
Output boundaries and triad at nplot plot points. Streams:
const double Pi
50 digits from maple
Vector< double > Zeta_boundary_start
Storage for initial value of 1D boundary coordinate on boundary b:
void operator=(const WarpedCircularDiskWithAnnularInternalBoundary &)
Broken assignment operator.
Vector< double > Zeta_boundary_end
Storage for final value of 1D boundary coordinate on boundary b:
double w(const double &r, const double &phi) const
Vertical deflection.
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
std::map< unsigned, Vector< double > > zeta_in_region() const
Return map that stores zeta coordinates of points that identify regions.
double zeta_boundary_end(const unsigned &b) const
Final value of 1D boundary coordinate zeta_bound on boundary b:
GeomObject * boundary_parametrising_geom_object_pt(const unsigned &b) const
Pointer to GeomObject<1,2> that parametrises intrinisc coordinates along boundary b...
double h_annulus() const
Thickness of annular region (distance of internal boundary from outer edge of unit circle) ...
WarpedCircularDisk(const WarpedCircularDisk &dummy)
Broken copy constructor.
unsigned N
Wavenumber of non-axisymmetric deformation.
double dwdr(const double &r, const double &phi) const
Deriv of vertical deflection w.r.t. radius.
Steady ellipse with half axes A and B as geometric object: .
void output_boundaries(const unsigned &nplot, std::ofstream &two_d_boundaries_file, std::ofstream &three_d_boundaries_file)
Output boundaries at nplot plot points. Streams:
unsigned nlagrangian() const
Access function to # of Lagrangian coordinates.
void operator=(const WarpedCircularDisk &)
Broken assignment operator.
double Epsilon
Amplitude of non-axisymmetric deformation.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
void boundary_triad(const unsigned &b, const double &zeta_bound, Vector< double > &r, Vector< double > &tangent, Vector< double > &normal, Vector< double > &binormal)
Boundary triad on boundary b at boundary coordinate zeta_bound.
Vector< GeomObject * > Boundary_parametrising_geom_object_pt
Pointer to GeomObject<1,2> that parametrises intrinisc coordinates along boundary b; essentially prov...
Warped disk in 3d: zeta[0]=x; zeta[1]=y (so it doesn't have coordinate singularities), with specification of two boundaries (b=0,1) that turn the whole thing into a circular disk. In addition has two internal boundaries (b=2,3), a distance h_annulus from the outer edge. Annual (outer) region is region 1.
virtual ~WarpedCircularDiskWithAnnularInternalBoundary()
Destructor (empty; cleanup happens in base class)
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...
double H_annulus
Thickness of annular region (distance of internal boundary from outer edge of unit circle) ...
WarpedCircularDisk(const double &epsilon, const unsigned &n, const double &z_offset=0.0)
unsigned ndim() const
Access function to # of Eulerian coordinates.
double & epsilon()
Access fct to amplitude of disk warping.
void position_on_boundary(const unsigned &b, const double &zeta_bound, Vector< double > &r) const
Compute 3D vector of Eulerian coordinates at 1D boundary coordinate zeta_bound on boundary b: ...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
DiskLikeGeomObjectWithBoundaries()
Constructor.
virtual ~WarpedCircularDisk()
Destructor.
double dwdphi(const double &r, const double &phi) const
Deriv of vertical deflection w.r.t. angle.
double Z_offset
Vertical offset.
unsigned nboundary() const
How many boundaries do we have?