MyTipMesh< ELEMENT, INTERFACE_ELEMENT > Class Template Reference

coincides with the numeration of the spines More...

#include <tip_spine_mesh.h>

+ Inheritance diagram for MyTipMesh< ELEMENT, INTERFACE_ELEMENT >:

Public Member Functions

 MyTipMesh (const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &x_min, const double &x_max, const double &y_min, const double &y_max, const double &z_min, const double &z_max, const double &R, const unsigned &rotation_flag, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
FiniteElement *& interface_element_pt (const unsigned long &i)
 Access functions for pointers to interface elements. More...
 
unsigned long ninterface_element () const
 Number of elements on interface. More...
 
FiniteElement *& bulk_element_pt (const unsigned long &i)
 Access functions for pointers to elements in bulk. More...
 
unsigned long nbulk () const
 Number of elements in bulk. More...
 
double radius ()
 
void change_radius (double R)
 
virtual void spine_node_update (SpineNode *spine_node_pt)
 
double init_spine_height (SpineNode *spine_node_pt)
 
void flush_spine_element_and_node_storage ()
 
- Public Member Functions inherited from oomph::SimpleCubicMesh< ELEMENT >
 SimpleCubicMesh (const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &lx, const double &ly, const double &lz, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
 SimpleCubicMesh (const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
const unsignednx () const
 Access function for number of elements in x directions. More...
 
const unsignedny () const
 Access function for number of elements in y directions. More...
 
const unsignednz () const
 Access function for number of elements in y directions. More...
 
- Public Member Functions inherited from oomph::BrickMeshBase
 BrickMeshBase ()
 Constructor (empty) More...
 
 BrickMeshBase (const BrickMeshBase &)=delete
 Broken copy constructor. More...
 
virtual ~BrickMeshBase ()
 Broken assignment operator. More...
 
void setup_boundary_element_info ()
 
void setup_boundary_element_info (std::ostream &outfile)
 
- Public Member Functions inherited from oomph::Mesh
 Mesh ()
 Default constructor. More...
 
 Mesh (const Vector< Mesh * > &sub_mesh_pt)
 
void merge_meshes (const Vector< Mesh * > &sub_mesh_pt)
 
virtual void reset_boundary_element_info (Vector< unsigned > &ntmp_boundary_elements, Vector< Vector< unsigned >> &ntmp_boundary_elements_in_region, Vector< FiniteElement * > &deleted_elements)
 Virtual function to perform the reset boundary elements info rutines. More...
 
template<class BULK_ELEMENT >
void doc_boundary_coordinates (const unsigned &b, std::ofstream &the_file)
 
virtual void scale_mesh (const double &factor)
 
 Mesh (const Mesh &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Mesh &)=delete
 Broken assignment operator. More...
 
virtual ~Mesh ()
 Virtual Destructor to clean up all memory. More...
 
void flush_element_and_node_storage ()
 
void flush_element_storage ()
 
void flush_node_storage ()
 
Node *& node_pt (const unsigned long &n)
 Return pointer to global node n. More...
 
Nodenode_pt (const unsigned long &n) const
 Return pointer to global node n (const version) More...
 
GeneralisedElement *& element_pt (const unsigned long &e)
 Return pointer to element e. More...
 
GeneralisedElementelement_pt (const unsigned long &e) const
 Return pointer to element e (const version) More...
 
const Vector< GeneralisedElement * > & element_pt () const
 Return reference to the Vector of elements. More...
 
Vector< GeneralisedElement * > & element_pt ()
 Return reference to the Vector of elements. More...
 
FiniteElementfinite_element_pt (const unsigned &e) const
 
Node *& boundary_node_pt (const unsigned &b, const unsigned &n)
 Return pointer to node n on boundary b. More...
 
Nodeboundary_node_pt (const unsigned &b, const unsigned &n) const
 Return pointer to node n on boundary b. More...
 
void set_nboundary (const unsigned &nbound)
 Set the number of boundaries in the mesh. More...
 
void remove_boundary_nodes ()
 Clear all pointers to boundary nodes. More...
 
void remove_boundary_nodes (const unsigned &b)
 
void remove_boundary_node (const unsigned &b, Node *const &node_pt)
 Remove a node from the boundary b. More...
 
void add_boundary_node (const unsigned &b, Node *const &node_pt)
 Add a (pointer to) a node to the b-th boundary. More...
 
void copy_boundary_node_data_from_nodes ()
 
bool boundary_coordinate_exists (const unsigned &i) const
 Indicate whether the i-th boundary has an intrinsic coordinate. More...
 
unsigned long nelement () const
 Return number of elements in the mesh. More...
 
unsigned long nnode () const
 Return number of nodes in the mesh. More...
 
unsigned ndof_types () const
 Return number of dof types in mesh. More...
 
unsigned elemental_dimension () const
 Return number of elemental dimension in mesh. More...
 
unsigned nodal_dimension () const
 Return number of nodal dimension in mesh. More...
 
void add_node_pt (Node *const &node_pt)
 Add a (pointer to a) node to the mesh. More...
 
void add_element_pt (GeneralisedElement *const &element_pt)
 Add a (pointer to) an element to the mesh. More...
 
virtual void reorder_nodes (const bool &use_old_ordering=true)
 
virtual void get_node_reordering (Vector< Node * > &reordering, const bool &use_old_ordering=true) const
 
template<class BULK_ELEMENT , template< class > class FACE_ELEMENT>
void build_face_mesh (const unsigned &b, Mesh *const &face_mesh_pt)
 
unsigned self_test ()
 Self-test: Check elements and nodes. Return 0 for OK. More...
 
void max_and_min_element_size (double &max_size, double &min_size)
 
double total_size ()
 
void check_inverted_elements (bool &mesh_has_inverted_elements, std::ofstream &inverted_element_file)
 
void check_inverted_elements (bool &mesh_has_inverted_elements)
 
unsigned check_for_repeated_nodes (const double &epsilon=1.0e-12)
 
Vector< Node * > prune_dead_nodes ()
 
unsigned nboundary () const
 Return number of boundaries. More...
 
unsigned long nboundary_node (const unsigned &ibound) const
 Return number of nodes on a particular boundary. More...
 
FiniteElementboundary_element_pt (const unsigned &b, const unsigned &e) const
 Return pointer to e-th finite element on boundary b. More...
 
Nodeget_some_non_boundary_node () const
 
unsigned nboundary_element (const unsigned &b) const
 Return number of finite elements that are adjacent to boundary b. More...
 
int face_index_at_boundary (const unsigned &b, const unsigned &e) const
 
virtual void dump (std::ofstream &dump_file, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
void dump (const std::string &dump_file_name, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
void output_paraview (std::ofstream &file_out, const unsigned &nplot) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
 
void output (std::ostream &outfile)
 Output for all elements. More...
 
void output (std::ostream &outfile, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output (FILE *file_pt)
 Output for all elements (C-style output) More...
 
void output (FILE *file_pt, const unsigned &nplot)
 Output at f(n_plot) points in each element (C-style output) More...
 
void output (const std::string &output_filename)
 Output for all elements. More...
 
void output (const std::string &output_filename, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt)
 Output a given Vector function at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt)
 
void output_boundaries (std::ostream &outfile)
 Output the nodes on the boundaries (into separate tecplot zones) More...
 
void output_boundaries (const std::string &output_filename)
 
void assign_initial_values_impulsive ()
 Assign initial values for an impulsive start. More...
 
void shift_time_values ()
 
void calculate_predictions ()
 
void set_nodal_and_elemental_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void set_consistent_pinned_values_for_continuation (ContinuationStorageScheme *const &continuation_stepper_pt)
 Set consistent values for pinned data in continuation. More...
 
bool does_pointer_correspond_to_mesh_data (double *const &parameter_pt)
 Does the double pointer correspond to any mesh data. More...
 
void set_nodal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 Set the timestepper associated with the nodal data in the mesh. More...
 
void set_elemental_internal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
virtual void compute_norm (double &norm)
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 Returns the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
bool is_mesh_distributed () const
 Boolean to indicate if Mesh has been distributed. More...
 
OomphCommunicatorcommunicator_pt () const
 
void delete_all_external_storage ()
 Wipe the storage for all externally-based elements. More...
 
- Public Member Functions inherited from oomph::SpineMesh
virtual ~SpineMesh ()
 Destructor to clean up the memory allocated to the spines. More...
 
Spine *& spine_pt (const unsigned long &i)
 Return the i-th spine in the mesh. More...
 
const Spinespine_pt (const unsigned long &i) const
 Return the i-th spine in the mesh (const version) More...
 
unsigned long nspine () const
 Return the number of spines in the mesh. More...
 
void add_spine_pt (Spine *const &spine_pt)
 Add a spine to the mesh. More...
 
SpineNodenode_pt (const unsigned long &n)
 Return a pointer to the n-th global SpineNode. More...
 
SpineNodeelement_node_pt (const unsigned long &e, const unsigned &n)
 
unsigned long assign_global_spine_eqn_numbers (Vector< double * > &Dof_pt)
 Assign spines to Spine_pt vector of element. More...
 
void describe_spine_dofs (std::ostream &out, const std::string &current_string) const
 
void set_mesh_level_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void set_spine_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 Assign time stepper to spines data. More...
 
void set_consistent_pinned_spine_values_for_continuation (ContinuationStorageScheme *const &continuation_stepper_pt)
 
bool does_pointer_correspond_to_spine_data (double *const &parameter_pt)
 
void node_update (const bool &update_all_solid_nodes=false)
 
void dump (std::ofstream &dump_file) const
 Overload the dump function so that the spine data is dumped. More...
 
void read (std::ifstream &restart_file)
 Overload the read function so that the spine data is also read. More...
 

Protected Member Functions

virtual void build_single_layer_mesh (TimeStepper *time_stepper_pt)
 
- Protected Member Functions inherited from oomph::SimpleCubicMesh< ELEMENT >
void build_mesh (TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 Generic mesh construction function: contains all the hard work. More...
 
- Protected Member Functions inherited from oomph::Mesh
unsigned long assign_global_eqn_numbers (Vector< double * > &Dof_pt)
 Assign (global) equation numbers to the nodes. More...
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 Assign local equation numbers in all elements. More...
 
void convert_to_boundary_node (Node *&node_pt, const Vector< FiniteElement * > &finite_element_pt)
 
void convert_to_boundary_node (Node *&node_pt)
 

Protected Attributes

Vector< FiniteElement * > Bulk_element_pt
 Vector of pointers to element in the fluid layer. More...
 
Vector< FiniteElement * > Interface_element_pt
 Vector of pointers to interface elements. More...
 
double Radius
 Sacled radius of the canyon (must be between 0 and one. More...
 
double Xax
 
double Yax
 
double Zax
 
unsigned Rotation_flag
 
- Protected Attributes inherited from oomph::SimpleCubicMesh< ELEMENT >
unsigned Nx
 Number of elements in x direction. More...
 
unsigned Ny
 Number of elements in y direction. More...
 
unsigned Nz
 Number of elements in y direction. More...
 
double Xmin
 Minimum value of x coordinate. More...
 
double Xmax
 Maximum value of x coordinate. More...
 
double Ymin
 Minimum value of y coordinate. More...
 
double Ymax
 Minimum value of y coordinate. More...
 
double Zmin
 Minimum value of z coordinate. More...
 
double Zmax
 Maximum value of z coordinate. More...
 
- Protected Attributes inherited from oomph::Mesh
Vector< Vector< Node * > > Boundary_node_pt
 
bool Lookup_for_elements_next_boundary_is_setup
 
Vector< Vector< FiniteElement * > > Boundary_element_pt
 
Vector< Vector< int > > Face_index_at_boundary
 
Vector< Node * > Node_pt
 Vector of pointers to nodes. More...
 
Vector< GeneralisedElement * > Element_pt
 Vector of pointers to generalised elements. More...
 
std::vector< boolBoundary_coordinate_exists
 
- Protected Attributes inherited from oomph::SpineMesh
Vector< Spine * > Spine_pt
 A Spine mesh contains a Vector of pointers to spines. More...
 

Additional Inherited Members

- Public Types inherited from oomph::Mesh
typedef void(FiniteElement::* SteadyExactSolutionFctPt) (const Vector< double > &x, Vector< double > &soln)
 
typedef void(FiniteElement::* UnsteadyExactSolutionFctPt) (const double &time, const Vector< double > &x, Vector< double > &soln)
 
- Static Public Attributes inherited from oomph::Mesh
static Steady< 0 > Default_TimeStepper
 The Steady Timestepper. More...
 
static bool Suppress_warning_about_empty_mesh_level_time_stepper_function
 Static boolean flag to control warning about mesh level timesteppers. More...
 

Detailed Description

template<class ELEMENT, class INTERFACE_ELEMENT>
class MyTipMesh< ELEMENT, INTERFACE_ELEMENT >

coincides with the numeration of the spines

Quater of a canieon mesh Mesh with outer part cubic and inner part cilindric The outer face is given by the plane z = zmin The cilinder axis is given by the line x = xmin, z = zmax

Constructor & Destructor Documentation

◆ MyTipMesh()

template<class ELEMENT , class INTERFACE_ELEMENT >
MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::MyTipMesh ( const unsigned nx,
const unsigned ny,
const unsigned nz,
const double x_min,
const double x_max,
const double y_min,
const double y_max,
const double z_min,
const double z_max,
const double R,
const unsigned rotation_flag,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)

Constructor: Pass number of elements in x-direction, number of elements in y-direction, axial length, height of layer, and pointer to timestepper (defaults to Steady timestepper)

Constructor for spine 3D mesh: Pass number of elements in x-direction, number of elements in y-direction, number elements in z-direction, axial length, deep and height of layer, and pointer to timestepper (defaults to Static timestepper).

The mesh contains a layer of spinified fluid elements (of type ELEMENT; e.g SpineElement<CrozierRaviartElement<2>) and a surface layer of corresponding Spine interface elements of type INTERFACE_ELEMENT, e.g. SpineLineNavierStokesInterfaceElement<ELEMENT> for 2D planar problems.

238  :
239  SimpleCubicMesh<ELEMENT >(nx,ny,nz,x_min,x_max,y_min,y_max,z_min,z_max,
240  time_stepper_pt)
241 {
242 // Point to which all spines point
243  this->Xax = 0.0;
244 
245  this->Yax = 0.0;
246 
247  this->Zax = 1.0;
248 
249  this->Rotation_flag = rotation_flag;
250 
251 
252  change_radius(R);
253 
254 
255  // Periodic?
256 // MySimpleCubicQuadMesh<ELEMENT >::Xperiodic = false;
257 
258  // Now build the mesh:
259  build_single_layer_mesh(time_stepper_pt);
260 }
@ R
Definition: StatisticsVector.h:21
virtual void build_single_layer_mesh(TimeStepper *time_stepper_pt)
Definition: tip_spine_mesh.h:267
double Yax
Definition: tip_spine_mesh.h:205
void change_radius(double R)
Definition: tip_spine_mesh.h:92
double Zax
Definition: tip_spine_mesh.h:207
double Xax
Definition: tip_spine_mesh.h:203
unsigned Rotation_flag
Definition: tip_spine_mesh.h:211
Simple cubic 3D Brick mesh class.
Definition: simple_cubic_mesh.template.h:47
const unsigned & ny() const
Access function for number of elements in y directions.
Definition: simple_cubic_mesh.template.h:114
const unsigned & nx() const
Access function for number of elements in x directions.
Definition: simple_cubic_mesh.template.h:108
const unsigned & nz() const
Access function for number of elements in y directions.
Definition: simple_cubic_mesh.template.h:120

References MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::build_single_layer_mesh(), MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::change_radius(), R, MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Rotation_flag, MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Xax, MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Yax, and MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Zax.

Member Function Documentation

◆ build_single_layer_mesh()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::build_single_layer_mesh ( TimeStepper time_stepper_pt)
protectedvirtual

Helper function to actually build the single-layer spine mesh (called from various constructors)

Helper function that actually builds the single-layer spine mesh based on the parameters set in the various constructors

269 {
270 
271 // Set rotation
272  if(Rotation_flag == 1) //rotation around y--axis
273  for(unsigned i = 0;i< this->nnode();i++)
274  {
275  double x_node = this->node_pt(i)->x(0);
276  double z_node = this->node_pt(i)->x(2);
277  this->node_pt(i)->x(0) = -z_node +1.0;
278  this->node_pt(i)->x(2) = x_node;
279  }
280 
281  if(Rotation_flag == 2) //rotation around y--axis
282  for(unsigned i = 0;i< this->nnode();i++)
283  {
284  double y_node = this->node_pt(i)->x(1);
285  double z_node = this->node_pt(i)->x(2);
286  this->node_pt(i)->x(1) = z_node - 1.0;
287  this->node_pt(i)->x(2) = -y_node;
288  }
289 
290 //Read out the number of elements in the x-direction
291  unsigned n_x = this->Nx;
292  unsigned n_y = this->Ny;
293  unsigned n_z = this->Nz;
294 
295 
296 
297  //Set up the pointers to elements in the bulk
298  unsigned nbulk=nelement();
299  Bulk_element_pt.reserve(nbulk);
300  for(unsigned e=0;e<nbulk;e++)
301  {
302  Bulk_element_pt.push_back(this->finite_element_pt(e));
303  }
304 
305  //Allocate memory for the spines and fractions along spines
306  //---------------------------------------------------------
307 
308  //Read out number of linear points in the element
309  unsigned n_p = dynamic_cast<ELEMENT*>(finite_element_pt(0))->nnode_1d();
310 
311  //Allocate store for the spines: (different in the case of periodic meshes !!)
312  Spine_pt.reserve(((n_p-1)*n_x+1)*((n_p-1)*n_y+1));
313 
314 
315 // NOW WE GO THROUH ALL THE ELEMENTS OF THE LOWER LAYERS AND ATTACHING THE SPINES
316 
317 // FIRST ELEMENT: Element 0
318 
319 
320 
321 for(unsigned l1=0;l1<n_p;l1++) //y loop over the nodes
322 {
323  for(unsigned l2=0;l2<n_p;l2++) //x loop over the nodes
324  {
325 
326  //Node j + i*np
327 // Vector to the origin node, it will be passed as argument for the a later update of the spine
328  Vector<double> origin_node(3);
329  origin_node[0] = element_node_pt(0,l2+l1*n_p)->x(0);
330  origin_node[1] = element_node_pt(0,l2+l1*n_p)->x(1);
331  origin_node[2] = element_node_pt(0,l2+l1*n_p)->x(2);
332 
333  double hinit = init_spine_height( element_node_pt(0,l2+l1*n_p) );
334  //Assign the new spine within the cilinder
335 // Spine* new_spine_pt=new Spine( hinit,origin_node );
336  Spine* new_spine_pt=new Spine(hinit);
337  new_spine_pt->set_geom_parameter(origin_node);
338  Spine_pt.push_back(new_spine_pt);
339 
340  // Get pointer to node
341  SpineNode* nod_pt=element_node_pt(0,l2+l1*n_p); // Element 0; node j + i*n_p
342  //Set the pointer to the spine
343  nod_pt->spine_pt() = new_spine_pt;
344  //Set the fraction
345  nod_pt->fraction() = 0.0;
346  // Pointer to the mesh that implements the update fct
347  nod_pt->spine_mesh_pt() = this;
348 
349  //Loop vertically along the spine
350  //Loop over the elements
351  for(unsigned long k=0;k<n_z;k++)
352  {
353  //Add bottom spine to element (equal to the one defined before the for structure (for k=0) or the top of the last one)
354  //dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y])->add_spine(new_spine_pt);
355 
356  //Loop over the vertical nodes, apart from the first
357  for(unsigned l3=1;l3<n_p;l3++)
358  {
359  // Get pointer to node
360  SpineNode* nod_pt=element_node_pt(k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
361  //Set the pointer to the spine
362  nod_pt->spine_pt() = new_spine_pt;
363  //Set the fraction
364  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
365  // Pointer to the mesh that implements the update fct
366  nod_pt->spine_mesh_pt() = this;
367  }
368  }
369 
370 
371  }
372 }
373 
374 
375 
376  //LOOP OVER OTHER ELEMENTS IN THE FIRST ROW
377  //-----------------------------------------
378 
379 // The procedure is the same but we have to identify the before defined spines for not defining them two times
380 
381 for(unsigned j=1;j<n_x;j++) //loop over the elements in the first row
382 {
383 
384  for(unsigned l1=0;l1<n_p;l1++) //y loop over the nodes
385  {
386 
387 
388  // First we copy the last row of nodes into the first row of the new element (and extend to the third dimension)
389  /*for(unsigned k=0;k<n_z;k++)
390  {
391  //Recover the Spine of the before defined element
392  Spine* old_spine = dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+j-1])->spine_pt(l1*n_p+n_p-1);
393  //Add before defined spine to element
394  dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+j])->add_spine(old_spine);
395  }*/
396 
397 
398  for(unsigned l2=1;l2<n_p;l2++) //x loop over the nodes
399  {
400 
401  //Node j + i*np
402  Vector<double> origin_node(3);
403  origin_node[0] = element_node_pt(j,l2+l1*n_p)->x(0);
404  origin_node[1] = element_node_pt(j,l2+l1*n_p)->x(1);
405  origin_node[2] = element_node_pt(j,l2+l1*n_p)->x(2);
406 
407  double hinit = init_spine_height( element_node_pt(j,l2+l1*n_p) );
408  //Assign the new spine
409  Spine* new_spine_pt=new Spine( hinit);
410  new_spine_pt->set_geom_parameter(origin_node);
411 
412  Spine_pt.push_back(new_spine_pt);
413 
414 
415  // Get pointer to node
416  SpineNode* nod_pt=element_node_pt(j,l2+l1*n_p); // Element j; node l2 + l1*n_p
417  //Set the pointer to the spine
418  nod_pt->spine_pt() = new_spine_pt;
419  //Set the fraction
420  nod_pt->fraction() = 0.0;
421  // Pointer to the mesh that implements the update fct
422  nod_pt->spine_mesh_pt() = this;
423 
424  //Loop vertically along the spine
425  //Loop over the elements
426  for(unsigned long k=0;k<n_z;k++)
427  {
428  //Add bottom spine to element (equal to the one defined before the for structure (for k=0) or the top of the last one)
429  //dynamic_cast<ELEMENT*>(Element_pt[j+k*n_x*n_y])->add_spine(new_spine_pt);
430  //Loop over the vertical nodes, apart from the first
431  for(unsigned l3=1;l3<n_p;l3++)
432  {
433  // Get pointer to node
434  SpineNode* nod_pt=element_node_pt(j+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
435  //Set the pointer to the spine
436  nod_pt->spine_pt() = new_spine_pt;
437  //Set the fraction
438  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
439  // Pointer to the mesh that implements the update fct
440  nod_pt->spine_mesh_pt() = this;
441  }
442  }
443 
444 
445  }
446  }
447 }
448 
449 //REST OF THE ELEMENTS
450 // Now we loop over the rest of the elements. We will separe the first of each row being al the rest equal
451 
452 
453 
454 for(unsigned long i=1;i<n_y;i++)
455 {
456 //FIRST ELEMENT OF THE ROW
457 
458  //First line of nodes is copied from the element of the bottom
459 
460 /* for(unsigned l2=0;l2<n_p;l2++)
461  {
462 
463  for(unsigned long k=0;k<n_z;k++)
464  {
465  //Recover the Spine of the before defined element
466  Spine* old_spine = dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+(i-1)*n_x])->spine_pt(n_p*(n_p-1)+l2);
467  //Add before defined spine to element
468  dynamic_cast<ELEMENT*>(Element_pt[i*n_x+k*n_x*n_y])->add_spine(old_spine);
469  }
470 
471  }*/
472 
473 
474 
475  for(unsigned l1=1;l1<n_p;l1++) //y loop over the nodes
476  {
477 
478  for(unsigned l2=0;l2<n_p;l2++) //x loop over the nodes
479  {
480 
481  //Node j + i*np
482  Vector<double> origin_node(3);
483  origin_node[0] = element_node_pt(i*n_x,l2+l1*n_p)->x(0);
484  origin_node[1] = element_node_pt(i*n_x,l2+l1*n_p)->x(1);
485  origin_node[2] = element_node_pt(i*n_x,l2+l1*n_p)->x(2);
486 
487  double hinit = init_spine_height( element_node_pt(i*n_x,l2+l1*n_p) );
488  //Assign the new spine
489  Spine* new_spine_pt= new Spine( hinit);
490  new_spine_pt->set_geom_parameter(origin_node);
491 
492 
493  Spine_pt.push_back(new_spine_pt);
494 
495 
496  // Get pointer to node
497  SpineNode* nod_pt=element_node_pt(i*n_x,l2+l1*n_p); // Element i*n_x; node l2 + l1*n_p
498  //Set the pointer to the spine
499  nod_pt->spine_pt() = new_spine_pt;
500  //Set the fraction
501  nod_pt->fraction() = 0.0;
502  // Pointer to the mesh that implements the update fct
503  nod_pt->spine_mesh_pt() = this;
504 
505  //Loop vertically along the spine
506  //Loop over the elements
507  for(unsigned long k=0;k<n_z;k++)
508  {
509  //Add bottom spine to element (equal to the one defined before the for structure (for k=0) or the top of the last one)
510  // dynamic_cast<ELEMENT*>(Element_pt[i*n_x+k*n_x*n_y])->add_spine(new_spine_pt);
511  //Loop over the vertical nodes, apart from the first
512  for(unsigned l3=1;l3<n_p;l3++)
513  {
514  // Get pointer to node
515  SpineNode* nod_pt=element_node_pt(i*n_x+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
516  //Set the pointer to the spine
517  nod_pt->spine_pt() = new_spine_pt;
518  //Set the fraction
519  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
520  // Pointer to the mesh that implements the update fct
521  nod_pt->spine_mesh_pt() = this;
522  }
523  }
524 
525 
526  }
527  }
528 
529 
530 
531 
532 
533  // REST OF THE ELEMENTS OF THE ROW
534  for(unsigned j=1;j<n_x;j++)
535  {
536 
537 
538 //First line of nodes is copied from the element of the bottom
539 /* for(unsigned l2=0;l2<n_p;l2++)
540  {
541 
542  for(unsigned long k=0;k<n_z;k++)
543  {
544  //Recover the Spine of the before defined element
545  Spine* old_spine = dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+(i-1)*n_x+j])->spine_pt(n_p*(n_p-1)+l2);
546  //Add before defined spine to element
547  dynamic_cast<ELEMENT*>(Element_pt[i*n_x+k*n_x*n_y+j])->add_spine(old_spine);
548  }
549 
550  }*/
551 
552 
553 
554  for(unsigned l1=1;l1<n_p;l1++) //y loop over the nodes
555  {
556 
557  // First we copy the last row of nodes into the first row of the new element (and extend to the third dimension)
558  /* for(unsigned long k=0;k<n_z;k++)
559  {
560  //Recover the Spine of the before defined element
561  Spine* old_spine = dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+(j-1)+i*n_x])->spine_pt(l1*n_p+n_p-1);
562  //Add before defined spine to element
563  dynamic_cast<ELEMENT*>(Element_pt[k*n_x*n_y+j+i*n_x])->add_spine(old_spine);
564  }*/
565 
566  for(unsigned l2=1;l2<n_p;l2++) //x loop over the nodes
567  {
568 
569  //Node j + i*np
570  Vector<double> origin_node(3);
571  origin_node[0] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(0);
572  origin_node[1] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(1);
573  origin_node[2] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(2);
574  double hinit = init_spine_height( element_node_pt(j+i*n_x,l2+l1*n_p) );
575 
576  //Assign the new spine with radius as unit length
577  Spine* new_spine_pt=new Spine( hinit);
578  new_spine_pt->set_geom_parameter(origin_node);
579 
580 
581  Spine_pt.push_back(new_spine_pt);
582 
583 
584  // Get pointer to node
585  SpineNode* nod_pt=element_node_pt(j+i*n_x,l2+l1*n_p); // Element j + i*n_x; node l2 + l1*n_p
586  //Set the pointer to the spine
587  nod_pt->spine_pt() = new_spine_pt;
588  //Set the fraction
589  nod_pt->fraction() = 0.0;
590  // Pointer to the mesh that implements the update fct
591  nod_pt->spine_mesh_pt() = this;
592 
593  //Loop vertically along the spine
594  //Loop over the elements
595  for(unsigned long k=0;k<n_z;k++)
596  {
597  //Add bottom spine to element (equal to the one defined before the for structure (for k=0) or the top of the last one)
598  //dynamic_cast<ELEMENT*>(Element_pt[j+i*n_x+k*n_x*n_y])->add_spine(new_spine_pt);
599  //Loop over the vertical nodes, apart from the first
600  for(unsigned l3=1;l3<n_p;l3++)
601  {
602  // Get pointer to node
603  SpineNode* nod_pt=element_node_pt(j+i*n_x+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
604  //Set the pointer to the spine
605  nod_pt->spine_pt() = new_spine_pt;
606  //Set the fraction
607  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
608  // Pointer to the mesh that implements the update fct
609  nod_pt->spine_mesh_pt() = this;
610  }
611  }
612 
613 
614  }
615  }
616 
617  }
618 
619 
620 }
621 
622 
623 
624 
625 
626 
627  //Assign the 2D Line elements
628  //---------------------------
629 
630  //Get the present number of elements
631  unsigned long element_count = Element_pt.size();
632 
633  //Loop over the elements on the plane
634  for(unsigned l1=0;l1<n_y;l1++)
635  for(unsigned l2=0;l2<n_x;l2++)
636  {
637  {
638  //Construct a new 2D surface element on the face on which the local
639  //coordinate 2 is fixed at its max. value (1)
640  FiniteElement *interface_element_element_pt =
641  new INTERFACE_ELEMENT(finite_element_pt(n_x*n_y*(n_z-1)+l2+l1*n_x),3);
642 
643 
644  //Push it back onto the stack
645  Element_pt.push_back(interface_element_element_pt);
646 
647  //Push it back onto the stack of interface elements
648  Interface_element_pt.push_back(interface_element_element_pt);
649 
650  //Now assign the spines to the elements
651  /*for(unsigned i=0;i<n_p;i++) // y coordinate loop
652  {
653  for(unsigned j=0;j<n_p;j++) // x coordinate loop
654  {
655  //Push the spines back onto the stack
656  dynamic_cast<INTERFACE_ELEMENT*>
657  (Element_pt[element_count])->
658  add_spine(element_node_pt(n_x*n_y*(n_z-1)+l2+l1*n_x,n_p*n_p*(n_p-1)+j+i*n_p)->spine_pt());
659  }
660  }*/
661  element_count++;
662  }
663  }
664 
665 // We update all nodes
666 this->node_update();
667 
668 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double init_spine_height(SpineNode *spine_node_pt)
Definition: tip_spine_mesh.h:149
Vector< FiniteElement * > Interface_element_pt
Vector of pointers to interface elements.
Definition: tip_spine_mesh.h:192
unsigned long nbulk() const
Number of elements in bulk.
Definition: tip_spine_mesh.h:86
Vector< FiniteElement * > Bulk_element_pt
Vector of pointers to element in the fluid layer.
Definition: tip_spine_mesh.h:189
Definition: elements.h:1313
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Definition: mesh.h:186
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
unsigned Ny
Number of elements in y direction.
Definition: simple_cubic_mesh.template.h:130
unsigned Nz
Number of elements in y direction.
Definition: simple_cubic_mesh.template.h:133
unsigned Nx
Number of elements in x direction.
Definition: simple_cubic_mesh.template.h:127
Vector< Spine * > Spine_pt
A Spine mesh contains a Vector of pointers to spines.
Definition: spines.h:616
SpineNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global SpineNode.
Definition: spines.h:648
void node_update(const bool &update_all_solid_nodes=false)
Definition: spines.cc:84
SpineNode * element_node_pt(const unsigned long &e, const unsigned &n)
Definition: spines.h:669
Definition: spines.h:328
SpineMesh *& spine_mesh_pt()
Definition: spines.h:391
Spine *& spine_pt()
Access function to spine.
Definition: spines.h:372
double & fraction()
Set reference to fraction along spine.
Definition: spines.h:378
Definition: spines.h:64
void set_geom_parameter(const Vector< double > &geom_parameter)
Definition: spines.h:273
char char char int int * k
Definition: level2_impl.h:374
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References e(), oomph::SpineNode::fraction(), i, j, k, GlobalParameters::Nx, GlobalParameters::Ny, Global_Parameters::Nz, oomph::Spine::set_geom_parameter(), oomph::SpineNode::spine_mesh_pt(), and oomph::SpineNode::spine_pt().

Referenced by MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::MyTipMesh().

◆ bulk_element_pt()

template<class ELEMENT , class INTERFACE_ELEMENT >
FiniteElement* & MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::bulk_element_pt ( const unsigned long &  i)
inline

◆ change_radius()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::change_radius ( double  R)
inline
93  {
94  double scaled_R = R/(this->Zmax - this->Zmin);
95  if ( (scaled_R<0.95) && (scaled_R>0.05) )
96  Radius = R;
97  else
98  {
99  std::ostringstream error_stream;
100  error_stream
101  <<
102  "We can not constract so small elements so close to the origin\n"
103  <<"Choose a different radius (actual scaled radius = "<<scaled_R<<"\n";
104 
105  throw OomphLibError(error_stream.str(),
108  }
109  }
double Radius
Sacled radius of the canyon (must be between 0 and one.
Definition: tip_spine_mesh.h:195
Definition: oomph_definitions.h:222
double Zmax
Maximum value of z coordinate.
Definition: simple_cubic_mesh.template.h:151
double Zmin
Minimum value of z coordinate.
Definition: simple_cubic_mesh.template.h:148
#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, R, Global_Physical_Variables::Radius, Global_Parameters::Zmax, and Global_Parameters::Zmin.

Referenced by MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::MyTipMesh().

◆ flush_spine_element_and_node_storage()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::flush_spine_element_and_node_storage ( )
inline

Flush storage for spines, elements and nodes by emptying the vectors that store the pointers to them. This is useful if a particular mesh is only built to generate a small part of a bigger mesh. Once the elements and nodes have been created, they are typically copied into the new mesh and the auxiliary mesh can be deleted. However, if we simply call the destructor of the auxiliary mesh, it will also wipe out the nodes and elements, because it still "thinks" it's in charge of these...

175  {
176  //Clear vectors of pointers to the nodes and elements
177  Interface_element_pt.clear();
178  Node_pt.clear();
179  Element_pt.clear();
180  Spine_pt.clear();
181  }
Vector< Node * > Node_pt
Vector of pointers to nodes.
Definition: mesh.h:183

Referenced by CombTipSpineMesh< ELEMENT, INTERFACE_ELEMENT >::build_single_layer_mesh().

◆ init_spine_height()

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::init_spine_height ( SpineNode spine_node_pt)
inline
150  {
151 
152  //set distance to the axis
153  double daxis = sqrt( (this->Xax - spine_node_pt->x(0) ) *(this->Xax - spine_node_pt->x(0) )+(this->Yax - spine_node_pt->x(1) ) * (this->Yax - spine_node_pt->x(1))
154  + (this->Zax - spine_node_pt->x(2) ) * (this->Zax - spine_node_pt->x(2)) );
155  double init_h = ( daxis - radius() ) ;
156  return init_h;
157 
158  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
double radius()
Definition: tip_spine_mesh.h:89

References UniformPSDSelfTest::radius, sqrt(), and oomph::Node::x().

◆ interface_element_pt()

template<class ELEMENT , class INTERFACE_ELEMENT >
FiniteElement* & MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::interface_element_pt ( const unsigned long &  i)
inline

◆ nbulk()

template<class ELEMENT , class INTERFACE_ELEMENT >
unsigned long MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::nbulk ( ) const
inline

◆ ninterface_element()

template<class ELEMENT , class INTERFACE_ELEMENT >
unsigned long MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::ninterface_element ( ) const
inline

◆ radius()

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::radius ( )
inline
89 {return Radius;}

References Global_Physical_Variables::Radius.

◆ spine_node_update()

template<class ELEMENT , class INTERFACE_ELEMENT >
virtual void MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::spine_node_update ( SpineNode spine_node_pt)
inlinevirtual

General node update function implements pure virtual function defined in SpineMesh base class and performs specific node update actions: along vertical spines

Implements oomph::SpineMesh.

117  {
118  //Get fraction along the spine
119  double W = spine_node_pt->fraction();
120  //Get spine height
121  double H = spine_node_pt->h();
122  //Get the position of the node at the origin
123  // SpineNode* origin_pt = dynamic_cast<SpineNode*>(spine_node_pt->spine_pt()->geom_data_pt(0));
124  Vector<double> origin_pt(3);
125  origin_pt[0] = spine_node_pt->spine_pt()->geom_parameter(0);
126  origin_pt[1] = spine_node_pt->spine_pt()->geom_parameter(1);
127  origin_pt[2] = spine_node_pt->spine_pt()->geom_parameter(2);
128 
129  //set scale norm vector
130  double norm = sqrt( (Xax - origin_pt[0] ) * (Xax - origin_pt[0] )+ (Yax - origin_pt[1] ) * (Yax - origin_pt[1] ) +
131  (Zax - origin_pt[2] ) * (Zax - origin_pt[2]) );
132 
133  //Set the x coordinate
134  spine_node_pt->x(0) = origin_pt[0] + H*W* (Xax - origin_pt[0] )/norm;
135 
136  //Set the y coordinate
137  spine_node_pt->x(1) = origin_pt[1] + H*W* (Yax - origin_pt[1] )/norm;
138 
139  //Set the value of z
140  spine_node_pt->x(2) = origin_pt[2] + H*W* (Zax - origin_pt[2] )/norm;
141 
142 
143 
144  }
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
double & h()
Access function to spine height.
Definition: spines.h:397
double & geom_parameter(const unsigned &i)
Definition: spines.h:287
@ W
Definition: quadtree.h:63

References oomph::SpineNode::fraction(), oomph::Spine::geom_parameter(), H, oomph::SpineNode::h(), oomph::SpineNode::spine_pt(), sqrt(), oomph::QuadTreeNames::W, and oomph::Node::x().

Member Data Documentation

◆ Bulk_element_pt

template<class ELEMENT , class INTERFACE_ELEMENT >
Vector<FiniteElement *> MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Bulk_element_pt
protected

Vector of pointers to element in the fluid layer.

◆ Interface_element_pt

template<class ELEMENT , class INTERFACE_ELEMENT >
Vector<FiniteElement *> MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Interface_element_pt
protected

Vector of pointers to interface elements.

◆ Radius

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Radius
protected

Sacled radius of the canyon (must be between 0 and one.

◆ Rotation_flag

template<class ELEMENT , class INTERFACE_ELEMENT >
unsigned MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Rotation_flag
protected

◆ Xax

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Xax
protected

◆ Yax

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Yax
protected

◆ Zax

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyTipMesh< ELEMENT, INTERFACE_ELEMENT >::Zax
protected

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