oomph::HalfRectangleWithHoleMesh< ELEMENT > Class Template Reference

Domain-based mesh for rectangular mesh with circular hole. More...

#include <half_rectangle_with_hole_mesh.h>

+ Inheritance diagram for oomph::HalfRectangleWithHoleMesh< ELEMENT >:

Public Member Functions

 HalfRectangleWithHoleMesh (GeomObject *cylinder_pt, const double &radius, const double &length, const double &up_length, const unsigned &nup, const double &down_length, const unsigned &ndown, const double &width_near_cylinder, const unsigned &ncolumn, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
HalfRectangleWithHoleDomaindomain_pt ()
 Access function to the domain. More...
 
 HalfRectangleWithHoleMesh (GeomObject *cylinder_pt, const double &radius, const double &length, const double &up_length, const unsigned &nup, const double &down_length, const unsigned &ndown, const double &width_near_cylinder, const unsigned &ncolumn, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
HalfRectangleWithHoleDomaindomain_pt ()
 Access function to the domain. More...
 
- 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 setup_boundary_element_info ()
 
virtual void setup_boundary_element_info (std::ostream &outfile)
 
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 node_update (const bool &update_all_solid_nodes=false)
 
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...
 
virtual void read (std::ifstream &restart_file)
 Read solution from restart file. 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)
 
virtual void set_mesh_level_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...
 

Protected Attributes

HalfRectangleWithHoleDomainDomain_pt
 Pointer to the domain. 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
 

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...
 
- 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)
 

Detailed Description

template<class ELEMENT>
class oomph::HalfRectangleWithHoleMesh< ELEMENT >

Domain-based mesh for rectangular mesh with circular hole.

/////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ HalfRectangleWithHoleMesh() [1/2]

template<class ELEMENT >
oomph::HalfRectangleWithHoleMesh< ELEMENT >::HalfRectangleWithHoleMesh ( GeomObject cylinder_pt,
const double radius,
const double length,
const double up_length,
const unsigned nup,
const double down_length,
const unsigned ndown,
const double width_near_cylinder,
const unsigned ncolumn,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Constructor: Pass pointer to geometric object that represents the cylinder, the length and height of the domain. The GeomObject must be parametrised such that \(\zeta \in [0,2\pi]\) sweeps around the circumference in anticlockwise direction. Timestepper defaults to Steady default timestepper.

592  {
593  //Create the domain
594  Domain_pt = new HalfRectangleWithHoleDomain(cylinder_pt,radius,length,
595  up_length,nup,down_length,
596  ndown,width_near_cylinder,
597  ncolumn);
598 
599  //Initialise the node counter
600  unsigned long node_count=0;
601 
602  //Vectors used to get data from domains
603  Vector<double> s(2),r(2);
604 
605  //Setup temporary storage for the Node
606  Vector<Node*> Tmp_node_pt;
607 
608  //Now blindly loop over the macro elements and associate and finite
609  //element with each
610  unsigned nmacro_element = Domain_pt->nmacro_element();
611  for(unsigned e=0;e<nmacro_element;e++)
612  {
613  //Create the FiniteElement and add to the Element_pt Vector
614  Element_pt.push_back(new ELEMENT);
615 
616  //Read out the number of linear points in the element
617  unsigned np =
618  dynamic_cast<ELEMENT*>(finite_element_pt(e))->nnode_1d();
619 
620  //Loop over nodes in the column
621  for(unsigned l1=0;l1<np;l1++)
622  {
623  //Loop over the nodes in the row
624  for(unsigned l2=0;l2<np;l2++)
625  {
626  //Allocate the memory for the node
627  Tmp_node_pt.push_back(finite_element_pt(e)->
628  construct_node(l1*np+l2,time_stepper_pt));
629 
630  //Read out the position of the node from the macro element
631  s[0] = -1.0 + 2.0*(double)l2/(double)(np-1);
632  s[1] = -1.0 + 2.0*(double)l1/(double)(np-1);
634 
635  //Set the position of the node
636  Tmp_node_pt[node_count]->x(0) = r[0];
637  Tmp_node_pt[node_count]->x(1) = r[1];
638 
639  //Increment the node number
640  node_count++;
641  }
642  }
643  } //End of loop over macro elements
644 
645  //Now the elements have been created, but there will be nodes in
646  //common, need to loop over the common edges and sort it, by reassigning
647  //pointers and the deleting excess nodes
648 
649  //Read out the number of linear points in the element
650  unsigned np=dynamic_cast<ELEMENT*>(finite_element_pt(0))->nnode_1d();
651 
652  //Edges between the upstream elements including that immediately below
653  //the cylinder
654  for(unsigned m=0;m<(nup+1);m++)
655  {
656  //Edge between Elements m and m+1
657  for(unsigned n=0;n<np;n++)
658  {
659  //Set the nodes in element m+1 to be the same as in element m
661  = finite_element_pt(m)->node_pt(np*(np-1) + n);
662 
663  //Remove the nodes in element m+1 from the temporary node list
664  delete Tmp_node_pt[(m+1)*np*np + n];
665  Tmp_node_pt[(m+1)*np*np + n] = 0;
666  }
667  }
668 
669  //Edge between Elements nup and nup+1
670  for(unsigned n=0;n<np;n++)
671  {
672  //Set the nodes in element nup+1 to be the same as in element nup
673  finite_element_pt(nup+1)->node_pt(n)
674  = finite_element_pt(nup)->node_pt((np-n-1)*np + (np-1));
675 
676  //Remove the nodes in element nup+1 from the temporary node list
677  delete Tmp_node_pt[(nup+1)*np*np + n];
678  Tmp_node_pt[(nup+1)*np*np + n] = 0;
679  }
680 
681  //Edge between Element nup+1 and nup2
682  for(unsigned n=0;n<np;n++)
683  {
684  //Set the nodes in element nup+2 to be the same as in element nup+1
685  finite_element_pt(nup+2)->node_pt(np*n + np-1)
686  = finite_element_pt(nup+1)->node_pt(np*(np-1) + n);
687 
688  //Remove the nodes in element nup+2 from the temporary node list
689  delete Tmp_node_pt[(nup+2)*np*np + np*n + np-1];
690  Tmp_node_pt[(nup+2)*np*np + np*n + np-1] = 0;
691  }
692 
693  //Edges between the downstream elements including that immediately above
694  //the cylinder
695  for(unsigned m=nup+2;m<(nup+2+ndown);m++)
696  {
697  //Edge between Elements m and m+1
698  for(unsigned n=0;n<np;n++)
699  {
700  //Set the nodes in element m+1 to be the same as in element m
702  = finite_element_pt(m)->node_pt(np*(np-1) + n);
703 
704  //Remove the nodes in element m+1 from the temporary node list
705  delete Tmp_node_pt[(m+1)*np*np + n];
706  Tmp_node_pt[(m+1)*np*np + n] = 0;
707  }
708  }
709 
710 
711  //Now we need to sort out all the edges between the remaining columns
712  //and rows
713  bool first_col=true;
714 
715  unsigned left_col_offset = 0;
716  unsigned right_col_offset = nup+ndown+3;
717  //Loop over the columns
718  for(unsigned j=1;j<ncolumn;j++)
719  {
720  for(unsigned i=0;i<(nup+ndown+1);i++)
721  {
722  //Sort out the left-hand boundary of elements
723  for(unsigned n=0;n<np;n++)
724  {
725  finite_element_pt(right_col_offset)->node_pt(n*np)
726  = finite_element_pt(left_col_offset)->node_pt(n*np + np-1);
727 
728  //Remove the nodes in the element from the temporary node list
729  delete Tmp_node_pt[right_col_offset*np*np + n*np];
730  Tmp_node_pt[right_col_offset*np*np + n*np] = 0;
731  }
732 
733 
734  //Sort out the bottom of the element
735  if(i!=(nup+ndown))
736  {
737  for(unsigned n=1;n<np;n++)
738  {
739  finite_element_pt(right_col_offset+1)->node_pt(n)
740  = finite_element_pt(right_col_offset)->node_pt((np-1)*np + n);
741 
742  //Remove the nodes in the element from the temporary node list
743  delete Tmp_node_pt[(right_col_offset+1)*np*np + n];
744  Tmp_node_pt[(right_col_offset+1)*np*np + n] = 0;
745  }
746  }
747 
748  ++right_col_offset; ++left_col_offset;
749  //Add another offset if the first column
750  if(first_col==true)
751  {
752  if((i==nup-1) || (i==nup)) {++left_col_offset;}
753  }
754  }
755  if(j==1) {first_col=false;}
756  }
757 
758 
759  //Now set the actual true nodes
760  for(unsigned long n=0;n<node_count;n++)
761  {
762  if(Tmp_node_pt[n]!=0) {Node_pt.push_back(Tmp_node_pt[n]);}
763  }
764 
765  //Finally set the nodes on the boundaries
766  set_nboundary(5);
767 
768  //Find the offset for the right hand side
769  unsigned rhs_offset=0;
770  if(ncolumn > 1) {rhs_offset = nup+ndown+3 + (ncolumn-2)*(nup+ndown+1);}
771 
772  for(unsigned n=0;n<np;n++)
773  {
774  //First part of left hand side
775  Node* nod_pt=finite_element_pt(0)->node_pt(n*np);
776  convert_to_boundary_node(nod_pt);
777  add_boundary_node(3,nod_pt);
778 
779  //Part of LHS immediately after hole
780  nod_pt=finite_element_pt(nup+2)->node_pt(n*np);
781  convert_to_boundary_node(nod_pt);
782  add_boundary_node(3,nod_pt);
783 
784  //First part of right hand side
785  nod_pt=finite_element_pt(rhs_offset)->node_pt(n*np + np-1);
786  convert_to_boundary_node(nod_pt);
787  add_boundary_node(1,nod_pt);
788 
789  //First part of lower boundary
790  nod_pt=finite_element_pt(0)->node_pt(n);
791  convert_to_boundary_node(nod_pt);
792  add_boundary_node(0,nod_pt);
793 
794  //First part of upper boundary
795  nod_pt=finite_element_pt(nup+ndown+2)->node_pt(np*(np-1)+n);
796  convert_to_boundary_node(nod_pt);
797  add_boundary_node(2,nod_pt);
798 
799  //First part of hole boundary
800  nod_pt=finite_element_pt(nup)->node_pt(np*(np-1)+n);
801  convert_to_boundary_node(nod_pt);
802  add_boundary_node(4,nod_pt);
803  }
804 
805  //Upstream section
806  for(unsigned n=1;n<np;n++)
807  {
808  for(unsigned m=1;m<nup;m++)
809  {
810  //Next part of left hand side
811  Node* nod_pt=finite_element_pt(m)->node_pt(n*np);
812  convert_to_boundary_node(nod_pt);
813  add_boundary_node(3,nod_pt);
814 
815  //Next part of right hand side
816  nod_pt=finite_element_pt(rhs_offset + m)->node_pt(n*np + np-1);
817  convert_to_boundary_node(nod_pt);
818  add_boundary_node(1,nod_pt);
819  }
820 
821  //Next part of hole
822  Node* nod_pt=finite_element_pt(nup+1)->node_pt(n*np);
823  convert_to_boundary_node(nod_pt);
824  add_boundary_node(4,nod_pt);
825  }
826 
827  //Need to take care with the region around the hole in the special
828  //case of a single column
829  unsigned rhs_extra_offset=1;
830  if(ncolumn>1) {rhs_extra_offset=0;}
831  for(unsigned n=1;n<np;n++)
832  {
833  //Next two parts of left boundary
834  Node* nod_pt=finite_element_pt(nup)->node_pt(n*np);
835  convert_to_boundary_node(nod_pt);
836  add_boundary_node(3,nod_pt);
837 
838  // Next part of right boundary
839  nod_pt=finite_element_pt(rhs_offset + rhs_extra_offset + nup)
840  ->node_pt(n*np + np-1);
841  convert_to_boundary_node(nod_pt);
842  add_boundary_node(1,nod_pt);
843 
844  //Final part of hole boundary
845  nod_pt=finite_element_pt(nup+2)->node_pt(np-1-n);
846  convert_to_boundary_node(nod_pt);
847  add_boundary_node(4,nod_pt);
848  }
849 
850  //Downstream section
851  for(unsigned n=1;n<np;n++)
852  {
853  for(unsigned m=nup+3;m<(nup+ndown+3);m++)
854  {
855  //Next part of left hand side
856  Node* nod_pt=finite_element_pt(m)->node_pt(n*np);
857  convert_to_boundary_node(nod_pt);
858  add_boundary_node(3,nod_pt);
859 
860  //Next part of right hand side
861  if(rhs_offset==0)
862  {
863  nod_pt=finite_element_pt(m)->node_pt(n*np + np-1);
864  convert_to_boundary_node(nod_pt);
865  add_boundary_node(1,nod_pt);
866  }
867  }
868  if(rhs_offset!=0)
869  {
870  for(unsigned m=nup+1;m<(nup+ndown+1);m++)
871  {
872  Node* nod_pt=finite_element_pt(rhs_offset + m)->node_pt(n*np + np-1);
873  convert_to_boundary_node(nod_pt);
874  add_boundary_node(1,nod_pt);
875  }
876  }
877  }
878 
879  //Upper and Lower boundaries
880  unsigned lower_index = nup + ndown + 3;
881  for(unsigned j=1;j<ncolumn;j++)
882  {
883  for(unsigned n=1;n<np;n++)
884  {
885  Node* nod_pt = finite_element_pt(lower_index)->node_pt(n);
886  convert_to_boundary_node(nod_pt);
887  add_boundary_node(0,nod_pt);
888 
889  nod_pt =
890  finite_element_pt(lower_index+nup+ndown)->node_pt(np*(np-1) + n);
891  convert_to_boundary_node(nod_pt);
892  add_boundary_node(2,nod_pt);
893  }
894  lower_index += nup+ndown+1;
895  }
896 
897 
898  //Setup the info
900 
901  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
unsigned nmacro_element()
Number of macro elements in domain.
Definition: domain.h:123
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
HalfRectangleWithHoleDomain * Domain_pt
Pointer to the domain.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:909
void macro_map(const Vector< double > &s, Vector< double > &r)
The mapping from local to global coordinates at the current time : r(s)
Definition: macro_element.h:126
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
Definition: mesh.cc:243
Vector< Node * > Node_pt
Vector of pointers to nodes.
Definition: mesh.h:183
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Definition: mesh.h:505
virtual void setup_boundary_element_info()
Definition: mesh.h:275
void convert_to_boundary_node(Node *&node_pt, const Vector< FiniteElement * > &finite_element_pt)
Definition: mesh.cc:2590
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Definition: mesh.h:186
RealScalar s
Definition: level1_cplx_impl.h:130
int * m
Definition: level2_cplx_impl.h:294
r
Definition: UniformPSDSelfTest.py:20
radius
Definition: UniformPSDSelfTest.py:15
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References e(), i, j, m, n, UniformPSDSelfTest::r, UniformPSDSelfTest::radius, and s.

◆ HalfRectangleWithHoleMesh() [2/2]

template<class ELEMENT >
oomph::HalfRectangleWithHoleMesh< ELEMENT >::HalfRectangleWithHoleMesh ( GeomObject cylinder_pt,
const double radius,
const double length,
const double up_length,
const unsigned nup,
const double down_length,
const unsigned ndown,
const double width_near_cylinder,
const unsigned ncolumn,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Constructor: Pass pointer to geometric object that represents the cylinder, the length and height of the domain. The GeomObject must be parametrised such that \(\zeta \in [0,2\pi]\) sweeps around the circumference in anticlockwise direction. Timestepper defaults to Steady default timestepper.

591  {
592  //Create the domain
593  Domain_pt = new HalfRectangleWithHoleDomain(cylinder_pt,radius,length,
594  up_length,nup,down_length,
595  ndown,width_near_cylinder,
596  ncolumn);
597 
598  //Initialise the node counter
599  unsigned long node_count=0;
600 
601  //Vectors used to get data from domains
602  Vector<double> s(2),r(2);
603 
604  //Setup temporary storage for the Node
605  Vector<Node*> Tmp_node_pt;
606 
607  //Now blindly loop over the macro elements and associate and finite
608  //element with each
609  unsigned nmacro_element = Domain_pt->nmacro_element();
610  for(unsigned e=0;e<nmacro_element;e++)
611  {
612  //Create the FiniteElement and add to the Element_pt Vector
613  Element_pt.push_back(new ELEMENT);
614 
615  //Read out the number of linear points in the element
616  unsigned np =
617  dynamic_cast<ELEMENT*>(finite_element_pt(e))->nnode_1d();
618 
619  //Loop over nodes in the column
620  for(unsigned l1=0;l1<np;l1++)
621  {
622  //Loop over the nodes in the row
623  for(unsigned l2=0;l2<np;l2++)
624  {
625  //Allocate the memory for the node
626  Tmp_node_pt.push_back(finite_element_pt(e)->
627  construct_node(l1*np+l2,time_stepper_pt));
628 
629  //Read out the position of the node from the macro element
630  s[0] = -1.0 + 2.0*(double)l2/(double)(np-1);
631  s[1] = -1.0 + 2.0*(double)l1/(double)(np-1);
633 
634  //Set the position of the node
635  Tmp_node_pt[node_count]->x(0) = r[0];
636  Tmp_node_pt[node_count]->x(1) = r[1];
637 
638  //Increment the node number
639  node_count++;
640  }
641  }
642  } //End of loop over macro elements
643 
644  //Now the elements have been created, but there will be nodes in
645  //common, need to loop over the common edges and sort it, by reassigning
646  //pointers and the deleting excess nodes
647 
648  //Read out the number of linear points in the element
649  unsigned np=dynamic_cast<ELEMENT*>(finite_element_pt(0))->nnode_1d();
650 
651  //Edges between the upstream elements including that immediately below
652  //the cylinder
653  for(unsigned m=0;m<(nup+1);m++)
654  {
655  //Edge between Elements m and m+1
656  for(unsigned n=0;n<np;n++)
657  {
658  //Set the nodes in element m+1 to be the same as in element m
660  = finite_element_pt(m)->node_pt(np*(np-1) + n);
661 
662  //Remove the nodes in element m+1 from the temporary node list
663  delete Tmp_node_pt[(m+1)*np*np + n];
664  Tmp_node_pt[(m+1)*np*np + n] = 0;
665  }
666  }
667 
668  //Edge between Elements nup and nup+1
669  for(unsigned n=0;n<np;n++)
670  {
671  //Set the nodes in element nup+1 to be the same as in element nup
672  finite_element_pt(nup+1)->node_pt(n)
673  = finite_element_pt(nup)->node_pt((np-n-1)*np + (np-1));
674 
675  //Remove the nodes in element nup+1 from the temporary node list
676  delete Tmp_node_pt[(nup+1)*np*np + n];
677  Tmp_node_pt[(nup+1)*np*np + n] = 0;
678  }
679 
680  //Edge between Element nup+1 and nup2
681  for(unsigned n=0;n<np;n++)
682  {
683  //Set the nodes in element nup+2 to be the same as in element nup+1
684  finite_element_pt(nup+2)->node_pt(np*n + np-1)
685  = finite_element_pt(nup+1)->node_pt(np*(np-1) + n);
686 
687  //Remove the nodes in element nup+2 from the temporary node list
688  delete Tmp_node_pt[(nup+2)*np*np + np*n + np-1];
689  Tmp_node_pt[(nup+2)*np*np + np*n + np-1] = 0;
690  }
691 
692  //Edges between the downstream elements including that immediately above
693  //the cylinder
694  for(unsigned m=nup+2;m<(nup+2+ndown);m++)
695  {
696  //Edge between Elements m and m+1
697  for(unsigned n=0;n<np;n++)
698  {
699  //Set the nodes in element m+1 to be the same as in element m
701  = finite_element_pt(m)->node_pt(np*(np-1) + n);
702 
703  //Remove the nodes in element m+1 from the temporary node list
704  delete Tmp_node_pt[(m+1)*np*np + n];
705  Tmp_node_pt[(m+1)*np*np + n] = 0;
706  }
707  }
708 
709 
710  //Now we need to sort out all the edges between the remaining columns
711  //and rows
712  bool first_col=true;
713 
714  unsigned left_col_offset = 0;
715  unsigned right_col_offset = nup+ndown+3;
716  //Loop over the columns
717  for(unsigned j=1;j<ncolumn;j++)
718  {
719  for(unsigned i=0;i<(nup+ndown+1);i++)
720  {
721  //Sort out the left-hand boundary of elements
722  for(unsigned n=0;n<np;n++)
723  {
724  finite_element_pt(right_col_offset)->node_pt(n*np)
725  = finite_element_pt(left_col_offset)->node_pt(n*np + np-1);
726 
727  //Remove the nodes in the element from the temporary node list
728  delete Tmp_node_pt[right_col_offset*np*np + n*np];
729  Tmp_node_pt[right_col_offset*np*np + n*np] = 0;
730  }
731 
732 
733  //Sort out the bottom of the element
734  if(i!=(nup+ndown))
735  {
736  for(unsigned n=1;n<np;n++)
737  {
738  finite_element_pt(right_col_offset+1)->node_pt(n)
739  = finite_element_pt(right_col_offset)->node_pt((np-1)*np + n);
740 
741  //Remove the nodes in the element from the temporary node list
742  delete Tmp_node_pt[(right_col_offset+1)*np*np + n];
743  Tmp_node_pt[(right_col_offset+1)*np*np + n] = 0;
744  }
745  }
746 
747  ++right_col_offset; ++left_col_offset;
748  //Add another offset if the first column
749  if(first_col==true)
750  {
751  if((i==nup-1) || (i==nup)) {++left_col_offset;}
752  }
753  }
754  if(j==1) {first_col=false;}
755  }
756 
757 
758  //Now set the actual true nodes
759  for(unsigned long n=0;n<node_count;n++)
760  {
761  if(Tmp_node_pt[n]!=0) {Node_pt.push_back(Tmp_node_pt[n]);}
762  }
763 
764  //Finally set the nodes on the boundaries
765  set_nboundary(5);
766 
767  //Find the offset for the right hand side
768  unsigned rhs_offset=0;
769  if(ncolumn > 1) {rhs_offset = nup+ndown+3 + (ncolumn-2)*(nup+ndown+1);}
770 
771  for(unsigned n=0;n<np;n++)
772  {
773  //First part of left hand side
774  Node* nod_pt=finite_element_pt(0)->node_pt(n*np);
775  convert_to_boundary_node(nod_pt);
776  add_boundary_node(3,nod_pt);
777 
778  //Part of LHS immediately after hole
779  nod_pt=finite_element_pt(nup+2)->node_pt(n*np);
780  convert_to_boundary_node(nod_pt);
781  add_boundary_node(3,nod_pt);
782 
783  //First part of right hand side
784  nod_pt=finite_element_pt(rhs_offset)->node_pt(n*np + np-1);
785  convert_to_boundary_node(nod_pt);
786  add_boundary_node(1,nod_pt);
787 
788  //First part of lower boundary
789  nod_pt=finite_element_pt(0)->node_pt(n);
790  convert_to_boundary_node(nod_pt);
791  add_boundary_node(0,nod_pt);
792 
793  //First part of upper boundary
794  nod_pt=finite_element_pt(nup+ndown+2)->node_pt(np*(np-1)+n);
795  convert_to_boundary_node(nod_pt);
796  add_boundary_node(2,nod_pt);
797 
798  //First part of hole boundary
799  nod_pt=finite_element_pt(nup)->node_pt(np*(np-1)+n);
800  convert_to_boundary_node(nod_pt);
801  add_boundary_node(4,nod_pt);
802  }
803 
804  //Upstream section
805  for(unsigned n=1;n<np;n++)
806  {
807  for(unsigned m=1;m<nup;m++)
808  {
809  //Next part of left hand side
810  Node* nod_pt=finite_element_pt(m)->node_pt(n*np);
811  convert_to_boundary_node(nod_pt);
812  add_boundary_node(3,nod_pt);
813 
814  //Next part of right hand side
815  nod_pt=finite_element_pt(rhs_offset + m)->node_pt(n*np + np-1);
816  convert_to_boundary_node(nod_pt);
817  add_boundary_node(1,nod_pt);
818  }
819 
820  //Next part of hole
821  Node* nod_pt=finite_element_pt(nup+1)->node_pt(n*np);
822  convert_to_boundary_node(nod_pt);
823  add_boundary_node(4,nod_pt);
824  }
825 
826  //Need to take care with the region around the hole in the special
827  //case of a single column
828  unsigned rhs_extra_offset=1;
829  if(ncolumn>1) {rhs_extra_offset=0;}
830  for(unsigned n=1;n<np;n++)
831  {
832  //Next two parts of left boundary
833  Node* nod_pt=finite_element_pt(nup)->node_pt(n*np);
834  convert_to_boundary_node(nod_pt);
835  add_boundary_node(3,nod_pt);
836 
837  // Next part of right boundary
838  nod_pt=finite_element_pt(rhs_offset + rhs_extra_offset + nup)
839  ->node_pt(n*np + np-1);
840  convert_to_boundary_node(nod_pt);
841  add_boundary_node(1,nod_pt);
842 
843  //Final part of hole boundary
844  nod_pt=finite_element_pt(nup+2)->node_pt(np-1-n);
845  convert_to_boundary_node(nod_pt);
846  add_boundary_node(4,nod_pt);
847  }
848 
849  //Downstream section
850  for(unsigned n=1;n<np;n++)
851  {
852  for(unsigned m=nup+3;m<(nup+ndown+3);m++)
853  {
854  //Next part of left hand side
855  Node* nod_pt=finite_element_pt(m)->node_pt(n*np);
856  convert_to_boundary_node(nod_pt);
857  add_boundary_node(3,nod_pt);
858 
859  //Next part of right hand side
860  if(rhs_offset==0)
861  {
862  nod_pt=finite_element_pt(m)->node_pt(n*np + np-1);
863  convert_to_boundary_node(nod_pt);
864  add_boundary_node(1,nod_pt);
865  }
866  }
867  if(rhs_offset!=0)
868  {
869  for(unsigned m=nup+1;m<(nup+ndown+1);m++)
870  {
871  Node* nod_pt=finite_element_pt(rhs_offset + m)->node_pt(n*np + np-1);
872  convert_to_boundary_node(nod_pt);
873  add_boundary_node(1,nod_pt);
874  }
875  }
876  }
877 
878  //Upper and Lower boundaries
879  unsigned lower_index = nup + ndown + 3;
880  for(unsigned j=1;j<ncolumn;j++)
881  {
882  for(unsigned n=1;n<np;n++)
883  {
884  Node* nod_pt = finite_element_pt(lower_index)->node_pt(n);
885  convert_to_boundary_node(nod_pt);
886  add_boundary_node(0,nod_pt);
887 
888  nod_pt =
889  finite_element_pt(lower_index+nup+ndown)->node_pt(np*(np-1) + n);
890  convert_to_boundary_node(nod_pt);
891  add_boundary_node(2,nod_pt);
892  }
893  lower_index += nup+ndown+1;
894  }
895 
896 
897  //Setup the info
899 
900  }

References e(), i, j, m, n, UniformPSDSelfTest::r, UniformPSDSelfTest::radius, and s.

Member Function Documentation

◆ domain_pt() [1/2]

template<class ELEMENT >
HalfRectangleWithHoleDomain* oomph::HalfRectangleWithHoleMesh< ELEMENT >::domain_pt ( )
inline

Access function to the domain.

904 {return Domain_pt;}

◆ domain_pt() [2/2]

template<class ELEMENT >
HalfRectangleWithHoleDomain* oomph::HalfRectangleWithHoleMesh< ELEMENT >::domain_pt ( )
inline

Access function to the domain.

903 {return Domain_pt;}

Member Data Documentation

◆ Domain_pt

template<class ELEMENT >
HalfRectangleWithHoleDomain * oomph::HalfRectangleWithHoleMesh< ELEMENT >::Domain_pt
protected

Pointer to the domain.


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