oomph::AlgebraicFishMesh< ELEMENT > Class Template Reference

Fish shaped mesh with algebraic node update function for nodes. More...

#include <fish_mesh.template.h>

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

Public Member Functions

 AlgebraicFishMesh (TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
 AlgebraicFishMesh (GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
virtual ~AlgebraicFishMesh ()
 Destructor: empty. More...
 
void algebraic_node_update (const unsigned &t, AlgebraicNode *&node_pt)
 
virtual void node_update (const bool &update_all_solid_nodes=false)
 
void update_node_update (AlgebraicNode *&node_pt)
 
- Public Member Functions inherited from oomph::AlgebraicMesh
 AlgebraicMesh ()
 
 AlgebraicMesh (const AlgebraicMesh &)=delete
 Broken copy constructor. More...
 
 ~AlgebraicMesh ()
 Broken assignment operator. More...
 
AlgebraicNodenode_pt (const unsigned long &n)
 Return a pointer to the n-th global AlgebraicNode. More...
 
unsigned self_test ()
 Self test: check consistentency of multiple node updates. More...
 
void add_geom_object_list_pt (GeomObject *geom_object_pt)
 
unsigned ngeom_object_list_pt ()
 Return number of geometric objects associated with AlgebraicMesh. More...
 
GeomObjectgeom_object_list_pt (const unsigned &i)
 Access function to the ith GeomObject. 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 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...
 
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...
 
- Public Member Functions inherited from oomph::FishMesh< ELEMENT >
 FishMesh (TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
 FishMesh (GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
virtual ~FishMesh ()
 
GeomObject *& fish_back_pt ()
 Access function to geom object that represents the fish's back. More...
 
FishDomain *& domain_pt ()
 Access function to FishDomain. More...
 
- Public Member Functions inherited from oomph::QuadMeshBase
 QuadMeshBase ()
 Constructor (empty) More...
 
 QuadMeshBase (const QuadMeshBase &node)=delete
 Broken copy constructor. More...
 
void operator= (const QuadMeshBase &)=delete
 Broken assignment operator. More...
 
virtual ~QuadMeshBase ()
 Destructor (empty) More...
 
void setup_boundary_element_info ()
 
void setup_boundary_element_info (std::ostream &outfile)
 

Protected Member Functions

void node_update_in_body (const unsigned &t, AlgebraicNode *&node_pt)
 Algebraic update function for nodes in upper/lower body. More...
 
void node_update_in_fin (const unsigned &t, AlgebraicNode *&node_pt)
 Algebraic update function for nodes in upper/lower fin. More...
 
void setup_algebraic_node_update ()
 
- 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 Member Functions inherited from oomph::FishMesh< ELEMENT >
void build_mesh (TimeStepper *time_stepper_pt)
 Build the mesh, using the geometric object identified by Back_pt. 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...
 
- Protected Types inherited from oomph::FishMesh< ELEMENT >
enum  { Lower_body , Upper_body , Lower_fin , Upper_fin }
 Remesh function ids. 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::FishMesh< ELEMENT >
GeomObjectBack_pt
 Pointer to fish back. More...
 
FishDomainDomain_pt
 Pointer to domain. More...
 
bool Must_kill_fish_back
 Do I need to kill the fish back geom object? More...
 

Detailed Description

template<class ELEMENT>
class oomph::AlgebraicFishMesh< ELEMENT >

Fish shaped mesh with algebraic node update function for nodes.

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

Constructor & Destructor Documentation

◆ AlgebraicFishMesh() [1/2]

template<class ELEMENT >
oomph::AlgebraicFishMesh< ELEMENT >::AlgebraicFishMesh ( TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper)
inline

Constructor: Pass pointer to timestepper. (defaults to (Steady) default timestepper defined in Mesh)

333  : FishMesh<ELEMENT>(time_stepper_pt)
334  {
335  // Setup algebraic node update operations
337  }
void setup_algebraic_node_update()
Definition: fish_mesh.template.cc:682

References oomph::AlgebraicFishMesh< ELEMENT >::setup_algebraic_node_update().

◆ AlgebraicFishMesh() [2/2]

template<class ELEMENT >
oomph::AlgebraicFishMesh< ELEMENT >::AlgebraicFishMesh ( GeomObject back_pt,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Constructor: Pass pointer GeomObject that defines the fish's back and pointer to timestepper (defaults to (Steady) default timestepper defined in Mesh).

344  : FishMesh<ELEMENT>(back_pt, time_stepper_pt)
345  {
346  // Add the geometric object to the list associated with this AlgebraicMesh
348 
349  // Setup algebraic node update operations
351  }
void add_geom_object_list_pt(GeomObject *geom_object_pt)
Definition: algebraic_elements.h:823

References oomph::AlgebraicMesh::add_geom_object_list_pt(), and oomph::AlgebraicFishMesh< ELEMENT >::setup_algebraic_node_update().

◆ ~AlgebraicFishMesh()

template<class ELEMENT >
virtual oomph::AlgebraicFishMesh< ELEMENT >::~AlgebraicFishMesh ( )
inlinevirtual

Destructor: empty.

354 {}

Member Function Documentation

◆ algebraic_node_update()

template<class ELEMENT >
void oomph::AlgebraicFishMesh< ELEMENT >::algebraic_node_update ( const unsigned t,
AlgebraicNode *&  node_pt 
)
inlinevirtual

Update nodal position at time level t (t=0: present; t>0: previous)

Implements oomph::AlgebraicMesh.

359  {
360  // Update with the update function for the node's first (default)
361  // node update fct
362  unsigned id = node_pt->node_update_fct_id();
363 
364  // Upper/lower body
365  if ((id == this->Lower_body) || (id == this->Upper_body))
366  {
368  }
369  // Upper/lower fin
370  else if ((id == this->Lower_fin) || (id == this->Upper_fin))
371  {
373  }
374  else
375  {
376  std::ostringstream error_message;
377  error_message << "The node update fct id is " << id
378  << ", but it should only be one of " << this->Lower_body
379  << ", " << this->Upper_body << ", " << this->Lower_fin
380  << " or " << this->Upper_fin << std::endl;
381  std::string function_name =
382  "AlgebraicFishMesh::algebraic_node_update()";
383 
384  throw OomphLibError(error_message.str(),
387  }
388  }
void node_update_in_body(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for nodes in upper/lower body.
Definition: fish_mesh.template.cc:893
void node_update_in_fin(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for nodes in upper/lower fin.
Definition: fish_mesh.template.cc:949
AlgebraicNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global AlgebraicNode.
Definition: algebraic_elements.h:620
int node_update_fct_id()
Default (usually first if there are multiple ones) node update fct id.
Definition: algebraic_elements.h:146
@ Lower_body
Definition: fish_mesh.template.h:95
@ Lower_fin
Definition: fish_mesh.template.h:97
@ Upper_fin
Definition: fish_mesh.template.h:98
@ Upper_body
Definition: fish_mesh.template.h:96
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References oomph::FishMesh< ELEMENT >::Lower_body, oomph::FishMesh< ELEMENT >::Lower_fin, oomph::AlgebraicMesh::node_pt(), oomph::AlgebraicNode::node_update_fct_id(), oomph::AlgebraicFishMesh< ELEMENT >::node_update_in_body(), oomph::AlgebraicFishMesh< ELEMENT >::node_update_in_fin(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Global_string_for_annotation::string(), oomph::FishMesh< ELEMENT >::Upper_body, and oomph::FishMesh< ELEMENT >::Upper_fin.

◆ node_update()

template<class ELEMENT >
virtual void oomph::AlgebraicFishMesh< ELEMENT >::node_update ( const bool update_all_solid_nodes = false)
inlinevirtual

Resolve the node update function (we neither want the broken empty one in the Mesh base class nor the macro-element-based one in the RefineableQuadMesh base class but the AlgebraicElement one). [It doesn't make sense to use this mesh with SolidElements so we buffer the case if update_all_solid_nodes is set to true.]

Reimplemented from oomph::AlgebraicMesh.

Reimplemented in oomph::AlgebraicRefineableFishMesh< ELEMENT >.

396  {
397 #ifdef PARANOID
398  if (update_all_solid_nodes)
399  {
400  std::string error_message =
401  "Doesn't make sense to use an AlgebraicMesh with\n";
402  error_message +=
403  "SolidElements so specifying update_all_solid_nodes=true\n";
404  error_message += "doesn't make sense either\n";
405 
406  std::string function_name = "AlgebraicFishMesh::node_update()";
407 
408  throw OomphLibError(
410  }
411 #endif
413  }
void node_update(const bool &update_all_solid_nodes=false)
Definition: algebraic_elements.h:653

References oomph::AlgebraicMesh::node_update(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().

Referenced by oomph::AlgebraicRefineableFishMesh< ELEMENT >::node_update().

◆ node_update_in_body()

template<class ELEMENT >
void oomph::AlgebraicFishMesh< ELEMENT >::node_update_in_body ( const unsigned t,
AlgebraicNode *&  node_pt 
)
protected

Algebraic update function for nodes in upper/lower body.

Algebraic update function: Update in (upper or lower) body according to wall shape at time level t (t=0: present; t>0: previous)

895  {
896  // Pointer to geometric object that represents the fish back:
897  GeomObject* back_pt = node_pt->geom_object_pt(unsigned(0));
898 
899  // Fixed reference value: x-position of mouth
900  double x_mouth = this->Domain_pt->x_mouth();
901 
902  // Fixed reference value: Lagrangian coordinate of point
903  // over mouth
904  double zeta_mouth = this->Domain_pt->xi_nose();
905 
906  // Fixed reference value: Lagrangian coordinate of point
907  // near tail
908  double zeta_near_tail = this->Domain_pt->xi_tail();
909 
910  // First reference value: fractional x-position
911  double fract_x = node_pt->ref_value(unsigned(0));
912 
913  // Second reference value: fractional position along
914  // straight line from position on horizontal symmetry line to
915  // point on fish back
916  double fract_y = node_pt->ref_value(1);
917 
918  // Third reference value: Sign (are we above or below the
919  // symmetry line?)
920  double sign = node_pt->ref_value(2);
921 
922  // Get position on fish back
923  Vector<double> zeta(back_pt->nlagrangian());
924  zeta[0] = zeta_mouth + fract_x * (zeta_near_tail - zeta_mouth);
925  Vector<double> r_back(back_pt->ndim());
926  back_pt->position(t, zeta, r_back);
927 
928  // Get position of point on fish back near tail
929  zeta[0] = zeta_near_tail;
930  Vector<double> r_near_tail(back_pt->ndim());
931  back_pt->position(t, zeta, r_near_tail);
932 
933  // Get position on symmetry line
934  Vector<double> r_sym(2);
935  r_sym[0] = x_mouth + fract_x * (r_near_tail[0] - x_mouth);
936  r_sym[1] = 0.0;
937 
938  // Assign new nodal coordinate
939  node_pt->x(t, 0) = r_sym[0] + fract_y * (r_back[0] - r_sym[0]);
940  node_pt->x(t, 1) = sign * (r_sym[1] + fract_y * (r_back[1] - r_sym[1]));
941  }
GeomObject * geom_object_pt(const unsigned &i)
Definition: algebraic_elements.h:229
double ref_value(const unsigned &i)
Definition: algebraic_elements.h:267
double & xi_nose()
Start coordinate on wall (near nose)
Definition: fish_domain.h:101
double & x_mouth()
x-position of mouth
Definition: fish_domain.h:95
double & xi_tail()
End coordinate on wall (near tail)
Definition: fish_domain.h:107
FishDomain * Domain_pt
Pointer to domain.
Definition: fish_mesh.template.h:108
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
T sign(T x)
Definition: cxx11_tensor_builtins_sycl.cpp:172
t
Definition: plotPSD.py:36

References oomph::AlgebraicNode::geom_object_pt(), oomph::GeomObject::ndim(), oomph::GeomObject::nlagrangian(), oomph::GeomObject::position(), oomph::AlgebraicNode::ref_value(), SYCL::sign(), plotPSD::t, oomph::Node::x(), and Eigen::zeta().

Referenced by oomph::AlgebraicFishMesh< ELEMENT >::algebraic_node_update().

◆ node_update_in_fin()

template<class ELEMENT >
void oomph::AlgebraicFishMesh< ELEMENT >::node_update_in_fin ( const unsigned t,
AlgebraicNode *&  node_pt 
)
protected

Algebraic update function for nodes in upper/lower fin.

Algebraic update function: Update in (upper or lower) fin according to wall shape at time level t (t=0: present; t>0: previous)

951  {
952  // Pointer to geometric object that represents the fish back:
953  GeomObject* back_pt = node_pt->geom_object_pt(unsigned(0));
954 
955  // Fixed reference value: End coordinate on fish back
956  double zeta_wall = this->Domain_pt->xi_tail();
957 
958  // Fixed reference value: x-position of end of tail
959  double x_tail = this->Domain_pt->x_fin();
960 
961  // Fixed reference value: y-position of end of tail
962  double y_tail = this->Domain_pt->y_fin();
963 
964  // First reference value: fractional position in x-direction
965  double fract_x = node_pt->ref_value(unsigned(0));
966 
967  // Second reference value: fractional position along
968  // vertical line from position on horizontal symmetry line to
969  // point on upper end of tail
970  double fract_y = node_pt->ref_value(1);
971 
972  // Third reference value: Sign (are we above or below the
973  // symmetry line?)
974  double sign = node_pt->ref_value(2);
975 
976  // Get position on fish back
977  Vector<double> zeta(back_pt->nlagrangian());
978  zeta[0] = zeta_wall;
979  Vector<double> r_back(back_pt->ndim());
980  back_pt->position(t, zeta, r_back);
981 
982  // y-position on top edge of fin:
983  double y_fin_edge = r_back[1] + fract_x * (y_tail - r_back[1]);
984 
985  // Assign new nodal coordinate
986  node_pt->x(t, 0) = r_back[0] + fract_x * (x_tail - r_back[0]);
987  node_pt->x(t, 1) = sign * fract_y * y_fin_edge;
988  }
double & y_fin()
y-position of fin tip
Definition: fish_domain.h:89
double & x_fin()
x-position of fin tip
Definition: fish_domain.h:83

References oomph::AlgebraicNode::geom_object_pt(), oomph::GeomObject::ndim(), oomph::GeomObject::nlagrangian(), oomph::GeomObject::position(), oomph::AlgebraicNode::ref_value(), SYCL::sign(), plotPSD::t, oomph::Node::x(), and Eigen::zeta().

Referenced by oomph::AlgebraicFishMesh< ELEMENT >::algebraic_node_update().

◆ setup_algebraic_node_update()

template<class ELEMENT >
void oomph::AlgebraicFishMesh< ELEMENT >::setup_algebraic_node_update
protected

Setup algebraic update operation for all nodes (separate function because this task needs to be performed by both constructors)

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Setup algebraic update operation. Nodes are "suspended" from the fish's back and the upper edge of the fin. Nodes in the lower half are placed symmetrically.

683  {
684 #ifdef PARANOID
686  AlgebraicElementBase* lower_body_pt =
687  dynamic_cast<AlgebraicElementBase*>(Mesh::element_pt(0));
688 
689  if (lower_body_pt == 0)
690  {
691  std::ostringstream error_message;
692  error_message << "Element in AlgebraicFishMesh must be\n"
693  << "derived from AlgebraicElementBase\n"
694  << "but it is of type: "
695  << typeid(Mesh::element_pt(0)).name() << std::endl;
696 
697  throw OomphLibError(
698  error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
699  }
700 #endif
701 
702  // Read out the number of linear points in the element
703  unsigned n_p =
704  dynamic_cast<ELEMENT*>(FishMesh<ELEMENT>::Mesh::finite_element_pt(0))
705  ->nnode_1d();
706 
707  // Element 0: Lower body
708  //----------------------
709  {
710  unsigned ielem = 0;
711  FiniteElement* el_pt = Mesh::finite_element_pt(ielem);
712 
713  // Loop over rows in y/s_1-direction
714  for (unsigned i1 = 0; i1 < n_p; i1++)
715  {
716  // Loop over rows in x/s_0-direction
717  for (unsigned i0 = 0; i0 < n_p; i0++)
718  {
719  // Local node number
720  unsigned jnod = i0 + i1 * n_p;
721 
722  // One geometric object is involved in update operation
723  Vector<GeomObject*> geom_object_pt(1);
724  geom_object_pt[0] = this->Back_pt;
725 
726  // The update function requires three parameters:
727  Vector<double> ref_value(3);
728 
729  // First reference value: fractional x-position
730  ref_value[0] = double(i0) / double(n_p - 1);
731 
732  // Second reference value: fractional position along
733  // straight line from position on horizontal symmetry line to
734  // point on fish back
735  ref_value[1] = 1.0 - double(i1) / double(n_p - 1);
736 
737  // Third reference value: Sign (are we above or below the
738  // symmetry line?)
739  ref_value[2] = -1.0;
740 
741  // Setup algebraic update for node: Pass update information
742  dynamic_cast<AlgebraicNode*>(el_pt->node_pt(jnod))
743  ->add_node_update_info(this->Lower_body, // enumerated ID
744  this, // mesh
745  geom_object_pt, // vector of geom objects
746  ref_value); // vector of ref. values
747  }
748  }
749  }
750 
751 
752  // Element 1: Lower fin
753  //---------------------
754  {
755  unsigned ielem = 1;
756  FiniteElement* el_pt = Mesh::finite_element_pt(ielem);
757 
758  // Loop over rows in y/s_1-direction
759  for (unsigned i1 = 0; i1 < n_p; i1++)
760  {
761  // Loop over rows in x/s_0-direction
762  for (unsigned i0 = 0; i0 < n_p; i0++)
763  {
764  // Local node number
765  unsigned jnod = i0 + i1 * n_p;
766 
767  // One geometric object is involved in update operation
768  Vector<GeomObject*> geom_object_pt(1);
769  geom_object_pt[0] = this->Back_pt;
770 
771  // The update function requires three parameters:
772  Vector<double> ref_value(3);
773 
774  // First reference value: fractional x-position
775  ref_value[0] = double(i0) / double(n_p - 1);
776 
777  // Second reference value: fractional position along
778  // straight line from position on horizontal symmetry line to
779  // point on fish back
780  ref_value[1] = 1.0 - double(i1) / double(n_p - 1);
781 
782  // Third reference value: Sign (are we above or below the
783  // symmetry line?)
784  ref_value[2] = -1.0;
785 
786  // Setup algebraic update for node: Pass update information
787  dynamic_cast<AlgebraicNode*>(el_pt->node_pt(jnod))
788  ->add_node_update_info(this->Lower_fin, // enumerated ID
789  this, // mesh
790  geom_object_pt, // vector of geom objects
791  ref_value); // vector of ref. values
792  }
793  }
794  }
795 
796 
797  // Element 2: Upper body
798  //----------------------
799  {
800  unsigned ielem = 2;
801  FiniteElement* el_pt = Mesh::finite_element_pt(ielem);
802 
803  // Loop over rows in y/s_1-direction
804  for (unsigned i1 = 0; i1 < n_p; i1++)
805  {
806  // Loop over rows in x/s_0-direction
807  for (unsigned i0 = 0; i0 < n_p; i0++)
808  {
809  // Local node number
810  unsigned jnod = i0 + i1 * n_p;
811 
812  // One geometric object is involved in update operation
813  Vector<GeomObject*> geom_object_pt(1);
814  geom_object_pt[0] = this->Back_pt;
815 
816  // The update function requires three parameters:
817  Vector<double> ref_value(3);
818 
819  // First reference value: fractional x-position
820  ref_value[0] = double(i0) / double(n_p - 1);
821 
822  // Second reference value: fractional position along
823  // straight line from position on horizontal symmetry line to
824  // point on fish back
825  ref_value[1] = double(i1) / double(n_p - 1);
826 
827  // Third reference value: Sign (are we above or below the
828  // symmetry line?)
829  ref_value[2] = 1.0;
830 
831  // Setup algebraic update for node: Pass update information
832  dynamic_cast<AlgebraicNode*>(el_pt->node_pt(jnod))
833  ->add_node_update_info(this->Upper_body, // enumerated ID
834  this, // mesh
835  geom_object_pt, // vector of geom objects
836  ref_value); // vector of ref. values
837  }
838  }
839  }
840 
841 
842  // Element 3: Upper fin
843  //---------------------
844  {
845  unsigned ielem = 3;
846  FiniteElement* el_pt = Mesh::finite_element_pt(ielem);
847 
848  // Loop over rows in y/s_1-direction
849  for (unsigned i1 = 0; i1 < n_p; i1++)
850  {
851  // Loop over rows in x/s_0-direction
852  for (unsigned i0 = 0; i0 < n_p; i0++)
853  {
854  // Local node number
855  unsigned jnod = i0 + i1 * n_p;
856 
857  // One geometric object is involved in update operation
858  Vector<GeomObject*> geom_object_pt(1);
859  geom_object_pt[0] = this->Back_pt;
860 
861  // The update function requires three parameters:
862  Vector<double> ref_value(3);
863 
864  // First reference value: fractional x-position
865  ref_value[0] = double(i0) / double(n_p - 1);
866 
867  // Second reference value: fractional position along
868  // straight line from position on horizontal symmetry line to
869  // point on fish back
870  ref_value[1] = double(i1) / double(n_p - 1);
871 
872  // Third reference value: Sign (are we above or below the
873  // symmetry line?)
874  ref_value[2] = 1.0;
875 
876  // Setup algebraic update for node: Pass update information
877  dynamic_cast<AlgebraicNode*>(el_pt->node_pt(jnod))
878  ->add_node_update_info(this->Upper_fin, // enumerated ID
879  this, // mesh
880  geom_object_pt, // vector of geom objects
881  ref_value); // vector of ref. values
882  }
883  }
884  }
885  }
GeomObject * Back_pt
Pointer to fish back.
Definition: fish_mesh.template.h:105
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
string name
Definition: plotDoE.py:33

References oomph::Mesh::element_pt(), oomph::Mesh::finite_element_pt(), plotDoE::name, oomph::FiniteElement::node_pt(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

Referenced by oomph::AlgebraicFishMesh< ELEMENT >::AlgebraicFishMesh().

◆ update_node_update()

template<class ELEMENT >
void oomph::AlgebraicFishMesh< ELEMENT >::update_node_update ( AlgebraicNode *&  node_pt)
inlinevirtual

Update the geometric references that are used to update node after mesh adaptation. We're assuming that the GeomObject that specifies the fish back does not have sub-objects, therefore no update is required – all reference values can simply be scaled. We simply paranoid-check that this is actually the case, by checking if locate_zeta() returns the original data.

Implements oomph::AlgebraicMesh.

425  {
426 #ifdef PARANOID
427 
428  // Get the start and end Lagrangian coordinates on the
429  // wall from the domain:
430 
432  double xi_nose = this->Domain_pt->xi_nose();
433 
435  double xi_tail = this->Domain_pt->xi_tail();
436 
438  Vector<double> zeta(1);
439  zeta[0] = 0.5 * (xi_nose + xi_tail);
440 
441  Vector<double> s(1);
442  GeomObject* geom_obj_pt = 0;
443  this->Back_pt->locate_zeta(zeta, geom_obj_pt, s);
444 
445  if ((geom_obj_pt != this->Back_pt) || (s[0] != zeta[0]))
446  {
447  std::ostringstream error_message;
448  error_message << "AlgebraicFishMesh only works with GeomObjects\n"
449  << "that do not contain sub-elements (e.g. GeomObjects\n"
450  << "that represent a wall finite element mesh!\n"
451  << "Back_pt : " << this->Back_pt << std::endl
452  << "geom_obj_pt: " << geom_obj_pt << std::endl
453  << "s[0] : " << s[0] << std::endl
454  << "zeta[0] : " << zeta[0] << std::endl;
455 
456  throw OomphLibError(error_message.str(),
459  }
460 #endif
461  }
virtual void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
Definition: geom_objects.h:381
RealScalar s
Definition: level1_cplx_impl.h:130

References oomph::FishMesh< ELEMENT >::Back_pt, oomph::FishMesh< ELEMENT >::Domain_pt, oomph::GeomObject::locate_zeta(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, oomph::FishDomain::xi_nose(), oomph::FishDomain::xi_tail(), and Eigen::zeta().


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