MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT > Class Template Reference

#include <canyon_spine_mesh.h>

+ Inheritance diagram for MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >:

Public Member Functions

 MyCanyonMesh (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 Xsim
 
double Zsim
 
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 MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >

Quarter of a canyon mesh Mesh with outer part assumed to be a straight line and inner part a cylinder with given radius, but axially uniform. The outer face is given by the plane z = zmin The cylinder axis is given by the line x = xmin, z = zmax The interface elements are constructed on the inner (cylindrical) boundary.

Constructor & Destructor Documentation

◆ MyCanyonMesh()

template<class ELEMENT , class INTERFACE_ELEMENT >
MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::MyCanyonMesh ( 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, number of elements in z-direciton, the maximum and minimum values of x, y and z. The radius of the inner cylinder is R and the rotation flag specifies whether the mesh is aligned with the lower wall (z=zmin) or the side wall (x=max) The later is accomplished by a simple rotation of all coordinates through a right-angle.

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.

235  :
236  SimpleCubicMesh<ELEMENT >(nx,ny,nz,x_min,x_max,y_min,y_max,z_min,z_max,
237  time_stepper_pt)
238 {
239  // We've called the "generic" constructor for the RectangularQuadMesh
240  // which doesn't do much...
241  // Now set up the parameters that characterise the mesh geometry
242  // then call the constructor
243 
244 // Axis of the cilinder
245  this->Xsim = 0.0;
246 
247  this->Zsim = 1.0;
248 
249  //Set rotation
250  this->Rotation_flag = rotation_flag;
251 
252  change_radius(R);
253 
254  build_single_layer_mesh(time_stepper_pt);
255 }
@ R
Definition: StatisticsVector.h:21
double Zsim
Definition: canyon_spine_mesh.h:203
void change_radius(double R)
Definition: canyon_spine_mesh.h:93
double Xsim
Definition: canyon_spine_mesh.h:201
unsigned Rotation_flag
Definition: canyon_spine_mesh.h:207
virtual void build_single_layer_mesh(TimeStepper *time_stepper_pt)
Definition: canyon_spine_mesh.h:262
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 MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::build_single_layer_mesh(), MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::change_radius(), R, MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Rotation_flag, MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Xsim, and MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Zsim.

Member Function Documentation

◆ build_single_layer_mesh()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyCanyonMesh< 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

264 {
265 
266 // Set rotation
267  if(Rotation_flag == 1) //rotation around y--axis
268  for(unsigned i = 0;i< this->nnode();i++)
269  {
270  double x_node = this->node_pt(i)->x(0);
271  double z_node = this->node_pt(i)->x(2);
272  this->node_pt(i)->x(0) = -z_node +1.0;
273  this->node_pt(i)->x(2) = x_node;
274  }
275 
276 
277 
278  //Read out the number of elements in the x-direction
279  unsigned n_x = this->Nx;
280  unsigned n_y = this->Ny;
281  unsigned n_z = this->Nz;
282 
283 
284 
285  //Set up the pointers to elements in the bulk
286  unsigned nbulk=nelement();
287  Bulk_element_pt.reserve(nbulk);
288  for(unsigned e=0;e<nbulk;e++)
289  {
290 // Bulk_element_pt.push_back(this->finite_element_pt(e));
291  Bulk_element_pt.push_back(dynamic_cast<ELEMENT*>(this->finite_element_pt(e)));
292  }
293 
294  //Allocate memory for the spines and fractions along spines
295  //---------------------------------------------------------
296 
297  //Read out number of linear points in the element
298  unsigned n_p = dynamic_cast<ELEMENT*>(finite_element_pt(0))->nnode_1d();
299 
300  //Allocate store for the spines: (different in the case of periodic meshes !!)
301  Spine_pt.reserve(((n_p-1)*n_x+1)*((n_p-1)*n_y+1));
302 
303 
304 // NOW WE GO THROUH ALL THE ELEMENTS OF THE LOWER LAYERS AND ATTACHING THE SPINES
305 
306 // FIRST ELEMENT: Element 0
307 
308 
309 
310 for(unsigned l1=0;l1<n_p;l1++) //y loop over the nodes
311 {
312  for(unsigned l2=0;l2<n_p;l2++) //x loop over the nodes
313  {
314 
315  //Node j + i*np
316 // Vector to the origin node, it will be passed as argument for the a later update of the spine
317  Vector<double> origin_node(3);
318  origin_node[0] = element_node_pt(0,l2+l1*n_p)->x(0);
319  origin_node[1] = element_node_pt(0,l2+l1*n_p)->x(1);
320  origin_node[2] = element_node_pt(0,l2+l1*n_p)->x(2);
321 
322  double hinit = init_spine_height( element_node_pt(0,l2+l1*n_p) );
323  //Assign the new spine within the cilinder
324  Spine* new_spine_pt=new Spine( hinit);
325  new_spine_pt->set_geom_parameter(origin_node);
326  Spine_pt.push_back(new_spine_pt);
327 
328  // Get pointer to node
329  SpineNode* nod_pt=element_node_pt(0,l2+l1*n_p); // Element 0; node j + i*n_p
330  //Set the pointer to the spine
331  nod_pt->spine_pt() = new_spine_pt;
332  //Set the fraction
333  nod_pt->fraction() = 0.0;
334  // Pointer to the mesh that implements the update fct
335  nod_pt->spine_mesh_pt() = this;
336 
337  //Loop vertically along the spine
338  //Loop over the elements
339  for(unsigned long k=0;k<n_z;k++)
340  {
341  //Loop over the vertical nodes, apart from the first
342  for(unsigned l3=1;l3<n_p;l3++)
343  {
344  // Get pointer to node
345  SpineNode* nod_pt=element_node_pt(k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
346  //Set the pointer to the spine
347  nod_pt->spine_pt() = new_spine_pt;
348  //Set the fraction
349  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
350  // Pointer to the mesh that implements the update fct
351  nod_pt->spine_mesh_pt() = this;
352  }
353  }
354  }
355 }
356 
357 
358 
359  //LOOP OVER OTHER ELEMENTS IN THE FIRST ROW
360  //-----------------------------------------
361 
362 // The procedure is the same but we have to identify the before defined spines for not defining them two times
363 
364 for(unsigned j=1;j<n_x;j++) //loop over the elements in the first row
365 {
366 
367  for(unsigned l1=0;l1<n_p;l1++) //y loop over the nodes
368  {
369 
370  for(unsigned l2=1;l2<n_p;l2++) //x loop over the nodes
371  {
372 
373  //Node j + i*np
374  Vector<double> origin_node(3);
375  origin_node[0] = element_node_pt(j,l2+l1*n_p)->x(0);
376  origin_node[1] = element_node_pt(j,l2+l1*n_p)->x(1);
377  origin_node[2] = element_node_pt(j,l2+l1*n_p)->x(2);
378  double hinit = init_spine_height( element_node_pt(j,l2+l1*n_p) );
379  //Assign the new spine
380  Spine* new_spine_pt=new Spine( hinit);
381  new_spine_pt->set_geom_parameter(origin_node);
382 
383  Spine_pt.push_back(new_spine_pt);
384 
385 
386  // Get pointer to node
387  SpineNode* nod_pt=element_node_pt(j,l2+l1*n_p); // Element j; node l2 + l1*n_p
388  //Set the pointer to the spine
389  nod_pt->spine_pt() = new_spine_pt;
390  //Set the fraction
391  nod_pt->fraction() = 0.0;
392  // Pointer to the mesh that implements the update fct
393  nod_pt->spine_mesh_pt() = this;
394 
395  //Loop vertically along the spine
396  //Loop over the elements
397  for(unsigned long k=0;k<n_z;k++)
398  {
399  //Loop over the vertical nodes, apart from the first
400  for(unsigned l3=1;l3<n_p;l3++)
401  {
402  // Get pointer to node
403  SpineNode* nod_pt=element_node_pt(j+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
404  //Set the pointer to the spine
405  nod_pt->spine_pt() = new_spine_pt;
406  //Set the fraction
407  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
408  // Pointer to the mesh that implements the update fct
409  nod_pt->spine_mesh_pt() = this;
410  }
411  }
412 
413 
414  }
415  }
416 }
417 
418 //REST OF THE ELEMENTS
419 // Now we loop over the rest of the elements. We will separe the first of each row being al the rest equal
420 
421 
422 
423 for(unsigned long i=1;i<n_y;i++)
424 {
425 //FIRST ELEMENT OF THE ROW
426 
427  //First line of nodes is copied from the element of the bottom
428 
429  for(unsigned l1=1;l1<n_p;l1++) //y loop over the nodes
430  {
431 
432  for(unsigned l2=0;l2<n_p;l2++) //x loop over the nodes
433  {
434 
435  //Node j + i*np
436  Vector<double> origin_node(3);
437  origin_node[0] = element_node_pt(i*n_x,l2+l1*n_p)->x(0);
438  origin_node[1] = element_node_pt(i*n_x,l2+l1*n_p)->x(1);
439  origin_node[2] = element_node_pt(i*n_x,l2+l1*n_p)->x(2);
440  double hinit = init_spine_height( element_node_pt(i*n_x,l2+l1*n_p) );
441  //Assign the new spine
442  Spine* new_spine_pt= new Spine( hinit);
443  new_spine_pt->set_geom_parameter(origin_node);
444 
445  Spine_pt.push_back(new_spine_pt);
446 
447 
448  // Get pointer to node
449  SpineNode* nod_pt=element_node_pt(i*n_x,l2+l1*n_p); // Element i*n_x; node l2 + l1*n_p
450  //Set the pointer to the spine
451  nod_pt->spine_pt() = new_spine_pt;
452  //Set the fraction
453  nod_pt->fraction() = 0.0;
454  // Pointer to the mesh that implements the update fct
455  nod_pt->spine_mesh_pt() = this;
456 
457  //Loop vertically along the spine
458  //Loop over the elements
459  for(unsigned long k=0;k<n_z;k++)
460  {
461  //Loop over the vertical nodes, apart from the first
462  for(unsigned l3=1;l3<n_p;l3++)
463  {
464  // Get pointer to node
465  SpineNode* nod_pt=element_node_pt(i*n_x+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
466  //Set the pointer to the spine
467  nod_pt->spine_pt() = new_spine_pt;
468  //Set the fraction
469  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
470  // Pointer to the mesh that implements the update fct
471  nod_pt->spine_mesh_pt() = this;
472  }
473  }
474 
475 
476  }
477  }
478 
479 
480 
481 
482 
483  // REST OF THE ELEMENTS OF THE ROW
484  for(unsigned j=1;j<n_x;j++)
485  {
486 
487 
488 //First line of nodes is copied from the element of the bottom
489 
490  for(unsigned l1=1;l1<n_p;l1++) //y loop over the nodes
491  {
492 
493  for(unsigned l2=1;l2<n_p;l2++) //x loop over the nodes
494  {
495 
496  //Node j + i*np
497  Vector<double> origin_node(3);
498  origin_node[0] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(0);
499  origin_node[1] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(1);
500  origin_node[2] = element_node_pt(j+i*n_x,l2+l1*n_p)->x(2);
501  double hinit = init_spine_height( element_node_pt(j+i*n_x,l2+l1*n_p) );
502  //Assign the new spine with radius as unit length
503  Spine* new_spine_pt=new Spine( hinit);
504  new_spine_pt->set_geom_parameter(origin_node);
505 
506 
507  Spine_pt.push_back(new_spine_pt);
508 
509 
510  // Get pointer to node
511  SpineNode* nod_pt=element_node_pt(j+i*n_x,l2+l1*n_p); // Element j + i*n_x; node l2 + l1*n_p
512  //Set the pointer to the spine
513  nod_pt->spine_pt() = new_spine_pt;
514  //Set the fraction
515  nod_pt->fraction() = 0.0;
516  // Pointer to the mesh that implements the update fct
517  nod_pt->spine_mesh_pt() = this;
518 
519  //Loop vertically along the spine
520  //Loop over the elements
521  for(unsigned long k=0;k<n_z;k++)
522  {
523  //Loop over the vertical nodes, apart from the first
524  for(unsigned l3=1;l3<n_p;l3++)
525  {
526  // Get pointer to node
527  SpineNode* nod_pt=element_node_pt(j+i*n_x+k*n_x*n_y,l3*n_p*n_p+l2+l1*n_p);
528  //Set the pointer to the spine
529  nod_pt->spine_pt() = new_spine_pt;
530  //Set the fraction
531  nod_pt->fraction()=(double(k)+double(l3)/double(n_p-1))/double(n_z);
532  // Pointer to the mesh that implements the update fct
533  nod_pt->spine_mesh_pt() = this;
534  }
535  }
536 
537 
538  }
539  }
540 
541  }
542 
543 
544 }
545 
546 
547 
548 
549 
550 
551  //Assign the 2D Line elements
552  //---------------------------
553 
554  //Get the present number of elements
555  unsigned long element_count = Element_pt.size();
556 
557  //Loop over the elements on the plane
558  for(unsigned l1=0;l1<n_y;l1++)
559  for(unsigned l2=0;l2<n_x;l2++)
560  {
561  {
562  //Construct a new 2D surface element on the face on which the local
563  //coordinate 2 is fixed at its max. value (1)
564  FiniteElement *interface_element_element_pt =
565  new INTERFACE_ELEMENT(finite_element_pt(n_x*n_y*(n_z-1)+l2+l1*n_x),3);
566 
567 
568  //Push it back onto the stack
569  Element_pt.push_back(interface_element_element_pt);
570 
571  //Push it back onto the stack of interface elements
572  Interface_element_pt.push_back(interface_element_element_pt);
573 
574  element_count++;
575  }
576  }
577 
578 
579 //Update the node positions in the mesh
580  this->node_update();
581 
582 }
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: canyon_spine_mesh.h:147
Vector< FiniteElement * > Interface_element_pt
Vector of pointers to interface elements.
Definition: canyon_spine_mesh.h:190
Vector< FiniteElement * > Bulk_element_pt
Vector of pointers to element in the fluid layer.
Definition: canyon_spine_mesh.h:187
unsigned long nbulk() const
Number of elements in bulk.
Definition: canyon_spine_mesh.h:87
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 MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::MyCanyonMesh().

◆ bulk_element_pt()

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

◆ change_radius()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::change_radius ( double  R)
inline
94  {
95  double scaled_R = R/(this->Zmax - this->Zmin);
96  if ( (scaled_R<0.95) && (scaled_R>0.05) )
97  Radius = R;
98  else
99  {
100  std::ostringstream error_stream;
101  error_stream
102  <<
103  "We can not constract so small elements so close to the origin\n"
104  << "Choose a different radius (actual scaled radius = "<<scaled_R<<
105  std::endl;
106  throw OomphLibError(error_stream.str(),
109  }
110  }
double Radius
Sacled radius of the canyon (must be between 0 and one.
Definition: canyon_spine_mesh.h:193
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 MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::MyCanyonMesh().

◆ flush_spine_element_and_node_storage()

template<class ELEMENT , class INTERFACE_ELEMENT >
void MyCanyonMesh< 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...

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

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

◆ init_spine_height()

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::init_spine_height ( SpineNode spine_node_pt)
inline
148  {
149 
150  //set distance to the axis
151  double daxis = sqrt( (this->Xsim - spine_node_pt->x(0) ) *(this->Xsim - spine_node_pt->x(0) )+(this->Zsim - spine_node_pt->x(2) ) * (this->Zsim - spine_node_pt->x(2)));
152  double init_h = ( daxis - radius() ) ;
153  return init_h;
154 
155  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
double radius()
Definition: canyon_spine_mesh.h:90

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

◆ interface_element_pt()

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

◆ nbulk()

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

◆ ninterface_element()

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

◆ radius()

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

References Global_Physical_Variables::Radius.

◆ spine_node_update()

template<class ELEMENT , class INTERFACE_ELEMENT >
virtual void MyCanyonMesh< 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 
119  //Get fraction along the spine
120  double W = spine_node_pt->fraction();
121  //Get spine height
122  double H = spine_node_pt->h();
123 
124  //Get the position of the node at the origin
125  //The geometric data is is the x,y,z position of the wall
126  //to which the spine is affixed
127  Vector<double> origin_pt(3);
128  origin_pt[0] = spine_node_pt->spine_pt()->geom_parameter(0);
129  origin_pt[2] = spine_node_pt->spine_pt()->geom_parameter(2);
130 
131  //set scale norm vector
132  double norm =
133  sqrt( (Xsim - origin_pt[0] ) * (Xsim - origin_pt[0] )+
134  (Zsim - origin_pt[2] ) * (Zsim - origin_pt[2]) );
135 
136  //Set th x coordinate
137  spine_node_pt->x(0) = origin_pt[0] + H*W* (Xsim - origin_pt[0] )/norm;
138 
139  //Set the value of z
140  spine_node_pt->x(2) = origin_pt[2] + H*W* (Zsim - origin_pt[2] )/norm;
141 
142  }
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 *> MyCanyonMesh< 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 *> MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Interface_element_pt
protected

Vector of pointers to interface elements.

◆ Radius

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyCanyonMesh< 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 MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Rotation_flag
protected

◆ Xsim

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Xsim
protected

◆ Zsim

template<class ELEMENT , class INTERFACE_ELEMENT >
double MyCanyonMesh< ELEMENT, INTERFACE_ELEMENT >::Zsim
protected

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