oomph::SphericalNavierStokesEquations Class Referenceabstract

#include <spherical_navier_stokes_elements.h>

+ Inheritance diagram for oomph::SphericalNavierStokesEquations:

Public Types

typedef void(* SphericalNavierStokesBodyForceFctPt) (const double &time, const Vector< double > &x, Vector< double > &body_force)
 
typedef double(* SphericalNavierStokesSourceFctPt) (const double &time, const Vector< double > &x)
 
- Public Types inherited from oomph::FiniteElement
typedef void(* SteadyExactSolutionFctPt) (const Vector< double > &, Vector< double > &)
 
typedef void(* UnsteadyExactSolutionFctPt) (const double &, const Vector< double > &, Vector< double > &)
 

Public Member Functions

double cot (const double &th) const
 
 SphericalNavierStokesEquations ()
 
const doublere () const
 Reynolds number. More...
 
const doublere_st () const
 Product of Reynolds and Strouhal number (=Womersley number) More...
 
double *& re_pt ()
 Pointer to Reynolds number. More...
 
double *& re_st_pt ()
 Pointer to product of Reynolds and Strouhal number (=Womersley number) More...
 
const doubleviscosity_ratio () const
 
double *& viscosity_ratio_pt ()
 Pointer to Viscosity Ratio. More...
 
const doubledensity_ratio () const
 
double *& density_ratio_pt ()
 Pointer to Density ratio. More...
 
const doublere_invfr () const
 Global inverse Froude number. More...
 
double *& re_invfr_pt ()
 Pointer to global inverse Froude number. More...
 
const doublere_invro () const
 Global Reynolds number multiplied by inverse Rossby number. More...
 
double *& re_invro_pt ()
 Pointer to global inverse Froude number. More...
 
const Vector< double > & g () const
 Vector of gravitational components. More...
 
Vector< double > *& g_pt ()
 Pointer to Vector of gravitational components. More...
 
SphericalNavierStokesBodyForceFctPtbody_force_fct_pt ()
 Access function for the body-force pointer. More...
 
SphericalNavierStokesBodyForceFctPt body_force_fct_pt () const
 Access function for the body-force pointer. Const version. More...
 
SphericalNavierStokesSourceFctPtsource_fct_pt ()
 Access function for the source-function pointer. More...
 
SphericalNavierStokesSourceFctPt source_fct_pt () const
 Access function for the source-function pointer. Const version. More...
 
virtual unsigned npres_spherical_nst () const =0
 Function to return number of pressure degrees of freedom. More...
 
double u_spherical_nst (const unsigned &n, const unsigned &i) const
 
double u_spherical_nst (const unsigned &t, const unsigned &n, const unsigned &i) const
 
virtual unsigned u_index_spherical_nst (const unsigned &i) const
 
double du_dt_spherical_nst (const unsigned &n, const unsigned &i) const
 
void disable_ALE ()
 
void enable_ALE ()
 
virtual double p_spherical_nst (const unsigned &n_p) const =0
 
virtual void fix_pressure (const unsigned &p_dof, const double &p_value)=0
 Pin p_dof-th pressure dof and set it to value specified by p_value. More...
 
virtual int p_nodal_index_spherical_nst () const
 
double pressure_integral () const
 Integral of pressure over element. More...
 
double dissipation () const
 Return integral of dissipation over element. More...
 
double dissipation (const Vector< double > &s) const
 Return dissipation at local coordinate s. More...
 
void get_vorticity (const Vector< double > &s, Vector< double > &vorticity) const
 Compute the vorticity vector at local coordinate s. More...
 
double kin_energy () const
 Get integral of kinetic energy over element. More...
 
double d_kin_energy_dt () const
 Get integral of time derivative of kinetic energy over element. More...
 
void strain_rate (const Vector< double > &s, DenseMatrix< double > &strain_rate) const
 Strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i) More...
 
void get_traction (const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
 
void get_load (const Vector< double > &s, const Vector< double > &N, Vector< double > &load)
 
void get_pressure_and_velocity_mass_matrix_diagonal (Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)
 
void output (std::ostream &outfile)
 
void output (std::ostream &outfile, const unsigned &nplot)
 
void output (FILE *file_pt)
 
void output (FILE *file_pt, const unsigned &nplot)
 
void full_output (std::ostream &outfile)
 
void full_output (std::ostream &outfile, const unsigned &nplot)
 
void output_veloc (std::ostream &outfile, const unsigned &nplot, const unsigned &t)
 
void output_vorticity (std::ostream &outfile, const unsigned &nplot)
 
void output_fct (std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
 
void output_fct (std::ostream &outfile, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
 
void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 
void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
void compute_error_e (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dr_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dtheta_pt, double &u_error, double &u_norm, double &p_error, double &p_norm)
 
void compute_shear_stress (std::ostream &outfile)
 
void extract_velocity (std::ostream &outfile)
 
Vector< doubleactual (const Vector< double > &x)
 
Vector< doubleactual_dr (const Vector< double > &x)
 
Vector< doubleactual_dth (const Vector< double > &x)
 
void fill_in_contribution_to_residuals (Vector< double > &residuals)
 Compute the element's residual Vector. More...
 
void fill_in_contribution_to_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
void interpolated_u_spherical_nst (const Vector< double > &s, Vector< double > &veloc) const
 Compute vector of FE interpolated velocity u at local coordinate s. More...
 
double interpolated_u_spherical_nst (const Vector< double > &s, const unsigned &i) const
 Return FE interpolated velocity u[i] at local coordinate s. More...
 
double interpolated_dudx_spherical_nst (const Vector< double > &s, const unsigned &i, const unsigned &j) const
 
double interpolated_p_spherical_nst (const Vector< double > &s) const
 Return FE interpolated pressure at local coordinate s. More...
 
- Public Member Functions inherited from oomph::FSIFluidElement
 FSIFluidElement ()
 Constructor. More...
 
 FSIFluidElement (const FSIFluidElement &)=delete
 Broken copy constructor. More...
 
void operator= (const FSIFluidElement &)=delete
 Broken assignment operator. More...
 
virtual void identify_load_data (std::set< std::pair< Data *, unsigned >> &paired_load_data)=0
 
virtual void identify_pressure_data (std::set< std::pair< Data *, unsigned >> &paired_pressure_data)=0
 
- Public Member Functions inherited from oomph::FiniteElement
void set_dimension (const unsigned &dim)
 
void set_nodal_dimension (const unsigned &nodal_dim)
 
void set_nnodal_position_type (const unsigned &nposition_type)
 Set the number of types required to interpolate the coordinate. More...
 
void set_n_node (const unsigned &n)
 
int nodal_local_eqn (const unsigned &n, const unsigned &i) const
 
double dJ_eulerian_at_knot (const unsigned &ipt, Shape &psi, DenseMatrix< double > &djacobian_dX) const
 
 FiniteElement ()
 Constructor. More...
 
virtual ~FiniteElement ()
 
 FiniteElement (const FiniteElement &)=delete
 Broken copy constructor. More...
 
virtual bool local_coord_is_valid (const Vector< double > &s)
 Broken assignment operator. More...
 
virtual void move_local_coord_back_into_element (Vector< double > &s) const
 
void get_centre_of_gravity_and_max_radius_in_terms_of_zeta (Vector< double > &cog, double &max_radius) const
 
virtual void local_coordinate_of_node (const unsigned &j, Vector< double > &s) const
 
virtual void local_fraction_of_node (const unsigned &j, Vector< double > &s_fraction)
 
virtual double local_one_d_fraction_of_node (const unsigned &n1d, const unsigned &i)
 
virtual void set_macro_elem_pt (MacroElement *macro_elem_pt)
 
MacroElementmacro_elem_pt ()
 Access function to pointer to macro element. More...
 
void get_x (const Vector< double > &s, Vector< double > &x) const
 
void get_x (const unsigned &t, const Vector< double > &s, Vector< double > &x)
 
virtual void get_x_from_macro_element (const Vector< double > &s, Vector< double > &x) const
 
virtual void get_x_from_macro_element (const unsigned &t, const Vector< double > &s, Vector< double > &x)
 
virtual void set_integration_scheme (Integral *const &integral_pt)
 Set the spatial integration scheme. More...
 
Integral *const & integral_pt () const
 Return the pointer to the integration scheme (const version) More...
 
virtual void shape (const Vector< double > &s, Shape &psi) const =0
 
virtual void shape_at_knot (const unsigned &ipt, Shape &psi) const
 
virtual void dshape_local (const Vector< double > &s, Shape &psi, DShape &dpsids) const
 
virtual void dshape_local_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsids) const
 
virtual void d2shape_local (const Vector< double > &s, Shape &psi, DShape &dpsids, DShape &d2psids) const
 
virtual void d2shape_local_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsids, DShape &d2psids) const
 
virtual double J_eulerian (const Vector< double > &s) const
 
virtual double J_eulerian_at_knot (const unsigned &ipt) const
 
void check_J_eulerian_at_knots (bool &passed) const
 
void check_jacobian (const double &jacobian) const
 
double dshape_eulerian (const Vector< double > &s, Shape &psi, DShape &dpsidx) const
 
virtual double dshape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsidx) const
 
virtual double dshape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsi, DenseMatrix< double > &djacobian_dX, RankFourTensor< double > &d_dpsidx_dX) const
 
double d2shape_eulerian (const Vector< double > &s, Shape &psi, DShape &dpsidx, DShape &d2psidx) const
 
virtual double d2shape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsidx, DShape &d2psidx) const
 
virtual void assign_nodal_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void describe_nodal_local_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void assign_all_generic_local_eqn_numbers (const bool &store_local_dof_pt)
 
Node *& node_pt (const unsigned &n)
 Return a pointer to the local node n. More...
 
Node *const & node_pt (const unsigned &n) const
 Return a pointer to the local node n (const version) More...
 
unsigned nnode () const
 Return the number of nodes. More...
 
virtual unsigned nnode_1d () const
 
double raw_nodal_position (const unsigned &n, const unsigned &i) const
 
double raw_nodal_position (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double raw_dnodal_position_dt (const unsigned &n, const unsigned &i) const
 
double raw_dnodal_position_dt (const unsigned &n, const unsigned &j, const unsigned &i) const
 
double raw_nodal_position_gen (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_nodal_position_gen (const unsigned &t, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_dnodal_position_gen_dt (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_dnodal_position_gen_dt (const unsigned &j, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double nodal_position (const unsigned &n, const unsigned &i) const
 
double nodal_position (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double dnodal_position_dt (const unsigned &n, const unsigned &i) const
 Return the i-th component of nodal velocity: dx/dt at local node n. More...
 
double dnodal_position_dt (const unsigned &n, const unsigned &j, const unsigned &i) const
 
double nodal_position_gen (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double nodal_position_gen (const unsigned &t, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double dnodal_position_gen_dt (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double dnodal_position_gen_dt (const unsigned &j, const unsigned &n, const unsigned &k, const unsigned &i) const
 
virtual void get_dresidual_dnodal_coordinates (RankThreeTensor< double > &dresidual_dnodal_coordinates)
 
virtual unsigned required_nvalue (const unsigned &n) const
 
unsigned nnodal_position_type () const
 
bool has_hanging_nodes () const
 
unsigned nodal_dimension () const
 Return the required Eulerian dimension of the nodes in this element. More...
 
virtual unsigned nvertex_node () const
 
virtual Nodevertex_node_pt (const unsigned &j) const
 
virtual Nodeconstruct_node (const unsigned &n)
 
virtual Nodeconstruct_node (const unsigned &n, TimeStepper *const &time_stepper_pt)
 
virtual Nodeconstruct_boundary_node (const unsigned &n)
 
virtual Nodeconstruct_boundary_node (const unsigned &n, TimeStepper *const &time_stepper_pt)
 
int get_node_number (Node *const &node_pt) const
 
virtual Nodeget_node_at_local_coordinate (const Vector< double > &s) const
 
double raw_nodal_value (const unsigned &n, const unsigned &i) const
 
double raw_nodal_value (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double nodal_value (const unsigned &n, const unsigned &i) const
 
double nodal_value (const unsigned &t, const unsigned &n, const unsigned &i) const
 
unsigned dim () const
 
virtual ElementGeometry::ElementGeometry element_geometry () const
 Return the geometry type of the element (either Q or T usually). More...
 
virtual double interpolated_x (const Vector< double > &s, const unsigned &i) const
 Return FE interpolated coordinate x[i] at local coordinate s. More...
 
virtual double interpolated_x (const unsigned &t, const Vector< double > &s, const unsigned &i) const
 
virtual void interpolated_x (const Vector< double > &s, Vector< double > &x) const
 Return FE interpolated position x[] at local coordinate s as Vector. More...
 
virtual void interpolated_x (const unsigned &t, const Vector< double > &s, Vector< double > &x) const
 
virtual double interpolated_dxdt (const Vector< double > &s, const unsigned &i, const unsigned &t)
 
virtual void interpolated_dxdt (const Vector< double > &s, const unsigned &t, Vector< double > &dxdt)
 
unsigned ngeom_data () const
 
Datageom_data_pt (const unsigned &j)
 
void position (const Vector< double > &zeta, Vector< double > &r) const
 
void position (const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
 
void dposition_dt (const Vector< double > &zeta, const unsigned &t, Vector< double > &drdt)
 
virtual double zeta_nodal (const unsigned &n, const unsigned &k, const unsigned &i) const
 
void interpolated_zeta (const Vector< double > &s, Vector< double > &zeta) const
 
void locate_zeta (const Vector< double > &zeta, GeomObject *&geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
 
virtual void node_update ()
 
virtual void identify_field_data_for_interactions (std::set< std::pair< Data *, unsigned >> &paired_field_data)
 
virtual void identify_geometric_data (std::set< Data * > &geometric_data_pt)
 
virtual double s_min () const
 Min value of local coordinate. More...
 
virtual double s_max () const
 Max. value of local coordinate. More...
 
double size () const
 
virtual double compute_physical_size () const
 
virtual void point_output_data (const Vector< double > &s, Vector< double > &data)
 
void point_output (std::ostream &outfile, const Vector< double > &s)
 
virtual unsigned nplot_points_paraview (const unsigned &nplot) const
 
virtual unsigned nsub_elements_paraview (const unsigned &nplot) const
 
void output_paraview (std::ofstream &file_out, const unsigned &nplot) const
 
virtual void write_paraview_output_offset_information (std::ofstream &file_out, const unsigned &nplot, unsigned &counter) const
 
virtual void write_paraview_type (std::ofstream &file_out, const unsigned &nplot) const
 
virtual void write_paraview_offsets (std::ofstream &file_out, const unsigned &nplot, unsigned &offset_sum) const
 
virtual unsigned nscalar_paraview () const
 
virtual void scalar_value_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
 
virtual void scalar_value_fct_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
 
virtual void scalar_value_fct_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
 
virtual std::string scalar_name_paraview (const unsigned &i) const
 
virtual void output (const unsigned &t, std::ostream &outfile, const unsigned &n_plot) const
 
virtual void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, const SolutionFunctorBase &exact_soln) const
 Output a time-dependent exact solution over the element. More...
 
virtual void get_s_plot (const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
 
virtual std::string tecplot_zone_string (const unsigned &nplot) const
 
virtual void write_tecplot_zone_footer (std::ostream &outfile, const unsigned &nplot) const
 
virtual void write_tecplot_zone_footer (FILE *file_pt, const unsigned &nplot) const
 
virtual unsigned nplot_points (const unsigned &nplot) const
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 Calculate the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 Calculate the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (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 (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_abs_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error)
 
void integrate_fct (FiniteElement::SteadyExactSolutionFctPt integrand_fct_pt, Vector< double > &integral)
 Integrate Vector-valued function over element. More...
 
void integrate_fct (FiniteElement::UnsteadyExactSolutionFctPt integrand_fct_pt, const double &time, Vector< double > &integral)
 Integrate Vector-valued time-dep function over element. More...
 
virtual void build_face_element (const int &face_index, FaceElement *face_element_pt)
 
virtual unsigned self_test ()
 
virtual unsigned get_bulk_node_number (const int &face_index, const unsigned &i) const
 
virtual int face_outer_unit_normal_sign (const int &face_index) const
 Get the sign of the outer unit normal on the face given by face_index. More...
 
virtual unsigned nnode_on_face () const
 
void face_node_number_error_check (const unsigned &i) const
 Range check for face node numbers. More...
 
virtual CoordinateMappingFctPt face_to_bulk_coordinate_fct_pt (const int &face_index) const
 
virtual BulkCoordinateDerivativesFctPt bulk_coordinate_derivatives_fct_pt (const int &face_index) const
 
- Public Member Functions inherited from oomph::GeneralisedElement
 GeneralisedElement ()
 Constructor: Initialise all pointers and all values to zero. More...
 
virtual ~GeneralisedElement ()
 Virtual destructor to clean up any memory allocated by the object. More...
 
 GeneralisedElement (const GeneralisedElement &)=delete
 Broken copy constructor. More...
 
void operator= (const GeneralisedElement &)=delete
 Broken assignment operator. More...
 
Data *& internal_data_pt (const unsigned &i)
 Return a pointer to i-th internal data object. More...
 
Data *const & internal_data_pt (const unsigned &i) const
 Return a pointer to i-th internal data object (const version) More...
 
Data *& external_data_pt (const unsigned &i)
 Return a pointer to i-th external data object. More...
 
Data *const & external_data_pt (const unsigned &i) const
 Return a pointer to i-th external data object (const version) More...
 
unsigned long eqn_number (const unsigned &ieqn_local) const
 
int local_eqn_number (const unsigned long &ieqn_global) const
 
unsigned add_external_data (Data *const &data_pt, const bool &fd=true)
 
bool external_data_fd (const unsigned &i) const
 
void exclude_external_data_fd (const unsigned &i)
 
void include_external_data_fd (const unsigned &i)
 
void flush_external_data ()
 Flush all external data. More...
 
void flush_external_data (Data *const &data_pt)
 Flush the object addressed by data_pt from the external data array. More...
 
unsigned ninternal_data () const
 Return the number of internal data objects. More...
 
unsigned nexternal_data () const
 Return the number of external data objects. More...
 
unsigned ndof () const
 Return the number of equations/dofs in the element. More...
 
void dof_vector (const unsigned &t, Vector< double > &dof)
 Return the vector of dof values at time level t. More...
 
void dof_pt_vector (Vector< double * > &dof_pt)
 Return the vector of pointers to dof values. More...
 
void set_internal_data_time_stepper (const unsigned &i, TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void assign_internal_eqn_numbers (unsigned long &global_number, Vector< double * > &Dof_pt)
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
void add_internal_value_pt_to_map (std::map< unsigned, double * > &map_of_value_pt)
 
virtual void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void complete_setup_of_dependencies ()
 
virtual void get_residuals (Vector< double > &residuals)
 
virtual void get_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void get_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void get_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void get_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void get_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void get_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void get_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void get_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void get_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_norm (double &norm)
 
virtual unsigned ndof_types () const
 
virtual void get_dof_numbers_for_unknowns (std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
 
- Public Member Functions inherited from oomph::GeomObject
 GeomObject ()
 Default constructor. More...
 
 GeomObject (const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
 
 GeomObject (const GeomObject &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const GeomObject &)=delete
 Broken assignment operator. More...
 
virtual ~GeomObject ()
 (Empty) destructor More...
 
unsigned nlagrangian () const
 Access function to # of Lagrangian coordinates. More...
 
unsigned ndim () const
 Access function to # of Eulerian coordinates. More...
 
void set_nlagrangian_and_ndim (const unsigned &n_lagrangian, const unsigned &n_dim)
 Set # of Lagrangian and Eulerian coordinates. More...
 
TimeStepper *& time_stepper_pt ()
 
TimeSteppertime_stepper_pt () const
 
virtual void position (const double &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
virtual void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
- Public Member Functions inherited from oomph::NavierStokesElementWithDiagonalMassMatrices
 NavierStokesElementWithDiagonalMassMatrices ()
 Empty constructor. More...
 
virtual ~NavierStokesElementWithDiagonalMassMatrices ()
 Virtual destructor. More...
 
 NavierStokesElementWithDiagonalMassMatrices (const NavierStokesElementWithDiagonalMassMatrices &)=delete
 Broken copy constructor. More...
 
void operator= (const NavierStokesElementWithDiagonalMassMatrices &)=delete
 Broken assignment operator. More...
 

Static Public Attributes

static Vector< doubleGamma
 Vector to decide whether the stress-divergence form is used or not. More...
 
- Static Public Attributes inherited from oomph::FiniteElement
static double Tolerance_for_singular_jacobian = 1.0e-16
 Tolerance below which the jacobian is considered singular. More...
 
static bool Accept_negative_jacobian = false
 
static bool Suppress_output_while_checking_for_inverted_elements
 
- Static Public Attributes inherited from oomph::GeneralisedElement
static bool Suppress_warning_about_repeated_internal_data
 
static bool Suppress_warning_about_repeated_external_data = true
 
static double Default_fd_jacobian_step = 1.0e-8
 

Protected Member Functions

virtual int p_local_eqn (const unsigned &n) const =0
 
virtual double dshape_and_dtest_eulerian_spherical_nst (const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
 
virtual double dshape_and_dtest_eulerian_at_knot_spherical_nst (const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
 
virtual void pshape_spherical_nst (const Vector< double > &s, Shape &psi) const =0
 Compute the pressure shape functions at local coordinate s. More...
 
virtual void pshape_spherical_nst (const Vector< double > &s, Shape &psi, Shape &test) const =0
 
virtual void get_body_force_spherical_nst (const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
 
virtual double get_source_spherical_nst (double time, const unsigned &ipt, const Vector< double > &x)
 
virtual void fill_in_generic_residual_contribution_spherical_nst (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
 
- Protected Member Functions inherited from oomph::FiniteElement
virtual void assemble_local_to_eulerian_jacobian (const DShape &dpsids, DenseMatrix< double > &jacobian) const
 
virtual void assemble_local_to_eulerian_jacobian2 (const DShape &d2psids, DenseMatrix< double > &jacobian2) const
 
virtual void assemble_eulerian_base_vectors (const DShape &dpsids, DenseMatrix< double > &interpolated_G) const
 
template<unsigned DIM>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
virtual double invert_jacobian_mapping (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
virtual double local_to_eulerian_mapping (const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
double local_to_eulerian_mapping (const DShape &dpsids, DenseMatrix< double > &inverse_jacobian) const
 
virtual double local_to_eulerian_mapping_diagonal (const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
virtual void dJ_eulerian_dnodal_coordinates (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<unsigned DIM>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
virtual void d_dshape_eulerian_dnodal_coordinates (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<unsigned DIM>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
virtual void transform_derivatives (const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
 
void transform_derivatives_diagonal (const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
 
virtual void transform_second_derivatives (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<unsigned DIM>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<unsigned DIM>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
virtual void fill_in_jacobian_from_nodal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
void fill_in_jacobian_from_nodal_by_fd (DenseMatrix< double > &jacobian)
 
virtual void update_before_nodal_fd ()
 
virtual void reset_after_nodal_fd ()
 
virtual void update_in_nodal_fd (const unsigned &i)
 
virtual void reset_in_nodal_fd (const unsigned &i)
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 Zero-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 One-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 Two-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
- Protected Member Functions inherited from oomph::GeneralisedElement
unsigned add_internal_data (Data *const &data_pt, const bool &fd=true)
 
bool internal_data_fd (const unsigned &i) const
 
void exclude_internal_data_fd (const unsigned &i)
 
void include_internal_data_fd (const unsigned &i)
 
void clear_global_eqn_numbers ()
 
void add_global_eqn_numbers (std::deque< unsigned long > const &global_eqn_numbers, std::deque< double * > const &global_dof_pt)
 
virtual void assign_internal_and_external_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_additional_local_eqn_numbers ()
 
int internal_local_eqn (const unsigned &i, const unsigned &j) const
 
int external_local_eqn (const unsigned &i, const unsigned &j)
 
void fill_in_jacobian_from_internal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_internal_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
virtual void update_before_internal_fd ()
 
virtual void reset_after_internal_fd ()
 
virtual void update_in_internal_fd (const unsigned &i)
 
virtual void reset_in_internal_fd (const unsigned &i)
 
virtual void update_before_external_fd ()
 
virtual void reset_after_external_fd ()
 
virtual void update_in_external_fd (const unsigned &i)
 
virtual void reset_in_external_fd (const unsigned &i)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void fill_in_contribution_to_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void fill_in_contribution_to_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void fill_in_contribution_to_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void fill_in_contribution_to_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void fill_in_contribution_to_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 

Protected Attributes

doubleViscosity_Ratio_pt
 
doubleDensity_Ratio_pt
 
doubleRe_pt
 Pointer to global Reynolds number. More...
 
doubleReSt_pt
 Pointer to global Reynolds number x Strouhal number (=Womersley) More...
 
doubleReInvFr_pt
 
doubleReInvRo_pt
 
Vector< double > * G_pt
 Pointer to global gravity Vector. More...
 
SphericalNavierStokesBodyForceFctPt Body_force_fct_pt
 Pointer to body force function. More...
 
SphericalNavierStokesSourceFctPt Source_fct_pt
 Pointer to volumetric source function. More...
 
bool ALE_is_disabled
 
- Protected Attributes inherited from oomph::FiniteElement
MacroElementMacro_elem_pt
 Pointer to the element's macro element (NULL by default) More...
 
- Protected Attributes inherited from oomph::GeomObject
unsigned NLagrangian
 Number of Lagrangian (intrinsic) coordinates. More...
 
unsigned Ndim
 Number of Eulerian coordinates. More...
 
TimeStepperGeom_object_time_stepper_pt
 

Static Private Attributes

static int Pressure_not_stored_at_node = -100
 
static double Default_Physical_Constant_Value = 0.0
 Navier–Stokes equations static data. More...
 
static double Default_Physical_Ratio_Value = 1.0
 Navier–Stokes equations static data. More...
 
static Vector< doubleDefault_Gravity_vector
 Static default value for the gravity vector. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from oomph::FiniteElement
static const unsigned Default_Initial_Nvalue = 0
 Default value for the number of values at a node. More...
 
static const double Node_location_tolerance = 1.0e-14
 
static const unsigned N2deriv [] = {0, 1, 3, 6}
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Detailed Description

A class for elements that solve the Navier–Stokes equations, in axisymmetric spherical polar coordinates. This contains the generic maths – any concrete implementation must be derived from this.

We also provide all functions required to use this element in FSI problems, by deriving it from the FSIFluidElement base class.

Member Typedef Documentation

◆ SphericalNavierStokesBodyForceFctPt

typedef void(* oomph::SphericalNavierStokesEquations::SphericalNavierStokesBodyForceFctPt) (const double &time, const Vector< double > &x, Vector< double > &body_force)

Function pointer to body force function fct(t,x,f(x)) x is a Vector!

◆ SphericalNavierStokesSourceFctPt

typedef double(* oomph::SphericalNavierStokesEquations::SphericalNavierStokesSourceFctPt) (const double &time, const Vector< double > &x)

Function pointer to source function fct(t,x) x is a Vector!

Constructor & Destructor Documentation

◆ SphericalNavierStokesEquations()

oomph::SphericalNavierStokesEquations::SphericalNavierStokesEquations ( )
inline

Constructor: NULL the body force and source function and make sure the ALE terms are included by default.

228  {
229  // Set all the Physical parameter pointers to the default value zero
235  // Set the Physical ratios to the default value of 1
238  }
SphericalNavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
Definition: spherical_navier_stokes_elements.h:119
double * Density_Ratio_pt
Definition: spherical_navier_stokes_elements.h:94
static double Default_Physical_Ratio_Value
Navier–Stokes equations static data.
Definition: spherical_navier_stokes_elements.h:80
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
Definition: spherical_navier_stokes_elements.h:102
Vector< double > * G_pt
Pointer to global gravity Vector.
Definition: spherical_navier_stokes_elements.h:113
double * ReInvRo_pt
Definition: spherical_navier_stokes_elements.h:110
double * Re_pt
Pointer to global Reynolds number.
Definition: spherical_navier_stokes_elements.h:99
double * Viscosity_Ratio_pt
Definition: spherical_navier_stokes_elements.h:90
static double Default_Physical_Constant_Value
Navier–Stokes equations static data.
Definition: spherical_navier_stokes_elements.h:76
double * ReInvFr_pt
Definition: spherical_navier_stokes_elements.h:106
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
Definition: spherical_navier_stokes_elements.h:83
SphericalNavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Definition: spherical_navier_stokes_elements.h:116
bool ALE_is_disabled
Definition: spherical_navier_stokes_elements.h:124

References Default_Gravity_vector, Default_Physical_Constant_Value, Default_Physical_Ratio_Value, Density_Ratio_pt, G_pt, Re_pt, ReInvFr_pt, ReInvRo_pt, ReSt_pt, and Viscosity_Ratio_pt.

Member Function Documentation

◆ actual()

Vector<double> oomph::SphericalNavierStokesEquations::actual ( const Vector< double > &  x)
inline
622  {
623  const double Re = this->re();
624 
625  double r = x[0];
626  double theta = x[1];
627  Vector<double> ans(4, 0.0);
628 
629  ans[2] = r * sin(theta);
630  ans[3] = 0.5 * Re * r * r * sin(theta) * sin(theta);
631 
632  return (ans);
633  }
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
const double & re() const
Reynolds number.
Definition: spherical_navier_stokes_elements.h:249
double theta
Definition: two_d_biharmonic.cc:236
double Re
Reynolds number.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:61
r
Definition: UniformPSDSelfTest.py:20
list x
Definition: plotDoE.py:28

References UniformPSDSelfTest::r, GlobalPhysicalVariables::Re, re(), sin(), BiharmonicTestFunctions2::theta, and plotDoE::x.

◆ actual_dr()

Vector<double> oomph::SphericalNavierStokesEquations::actual_dr ( const Vector< double > &  x)
inline
638  {
639  const double Re = this->re();
640 
641  double r = x[0];
642  double theta = x[1];
643  Vector<double> ans(4, 0.0);
644 
645  ans[2] = sin(theta);
646  ans[3] = Re * r * sin(theta) * sin(theta);
647 
648  return (ans);
649  }

References UniformPSDSelfTest::r, GlobalPhysicalVariables::Re, re(), sin(), BiharmonicTestFunctions2::theta, and plotDoE::x.

◆ actual_dth()

Vector<double> oomph::SphericalNavierStokesEquations::actual_dth ( const Vector< double > &  x)
inline
654  {
655  const double Re = this->re();
656 
657  double r = x[0];
658  double theta = x[1];
659  Vector<double> ans(4, 0.0);
660 
661  ans[2] = r * cos(theta);
662  ans[3] = Re * r * r * sin(theta) * cos(theta);
663 
664  return (ans);
665  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136

References cos(), UniformPSDSelfTest::r, GlobalPhysicalVariables::Re, re(), sin(), BiharmonicTestFunctions2::theta, and plotDoE::x.

◆ body_force_fct_pt() [1/2]

SphericalNavierStokesBodyForceFctPt& oomph::SphericalNavierStokesEquations::body_force_fct_pt ( )
inline

Access function for the body-force pointer.

336  {
337  return Body_force_fct_pt;
338  }

References Body_force_fct_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ body_force_fct_pt() [2/2]

SphericalNavierStokesBodyForceFctPt oomph::SphericalNavierStokesEquations::body_force_fct_pt ( ) const
inline

Access function for the body-force pointer. Const version.

342  {
343  return Body_force_fct_pt;
344  }

References Body_force_fct_pt.

◆ compute_error() [1/2]

void oomph::SphericalNavierStokesEquations::compute_error ( std::ostream &  outfile,
FiniteElement::SteadyExactSolutionFctPt  exact_soln_pt,
double error,
double norm 
)
virtual

Validate against exact solution. Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element

Validate against exact velocity solution Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element.

Reimplemented from oomph::FiniteElement.

240  {
241  error = 0.0;
242  norm = 0.0;
243 
244  // Vector of local coordinates
245  Vector<double> s(2);
246 
247  // Vector for coordintes
248  Vector<double> x(2);
249 
250  // Set the value of n_intpt
251  unsigned n_intpt = integral_pt()->nweight();
252 
253 
254  outfile << "ZONE" << std::endl;
255 
256  // Exact solution Vector (u,v,w,p)
257  Vector<double> exact_soln(4);
258 
259  // Loop over the integration points
260  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
261  {
262  // Assign values of s
263  for (unsigned i = 0; i < 2; i++)
264  {
265  s[i] = integral_pt()->knot(ipt, i);
266  }
267 
268  // Get the integral weight
269  double w = integral_pt()->weight(ipt);
270 
271  // Get jacobian of mapping
272  double J = J_eulerian(s);
273 
274  // Premultiply the weights and the Jacobian
275  double W = w * J;
276 
277  // Get x position as Vector
278  interpolated_x(s, x);
279 
280  // Get the exact solution at this point
281  (*exact_soln_pt)(x, exact_soln);
282 
283  // Velocity error
284  for (unsigned i = 0; i < 3; i++)
285  {
286  norm += exact_soln[i] * exact_soln[i] * W;
289  }
290 
291  // Output x,y,...,u_exact
292  for (unsigned i = 0; i < 2; i++)
293  {
294  outfile << x[i] << " ";
295  }
296 
297  // Output x,y,[z],u_error,v_error,[w_error]
298  for (unsigned i = 0; i < 3; i++)
299  {
300  outfile << exact_soln[i] - interpolated_u_spherical_nst(s, i) << " ";
301  }
302  outfile << std::endl;
303  }
304  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3962
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
virtual double J_eulerian(const Vector< double > &s) const
Definition: elements.cc:4103
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
void interpolated_u_spherical_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
Definition: spherical_navier_stokes_elements.h:702
RealScalar s
Definition: level1_cplx_impl.h:130
void exact_soln(const double &time, const Vector< double > &x, Vector< double > &soln)
Definition: unstructured_two_d_curved.cc:301
int error
Definition: calibrate.py:297
@ W
Definition: quadtree.h:63

References calibrate::error, ProblemParameters::exact_soln(), i, oomph::FiniteElement::integral_pt(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), J, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), s, w, oomph::QuadTreeNames::W, oomph::Integral::weight(), and plotDoE::x.

◆ compute_error() [2/2]

void oomph::SphericalNavierStokesEquations::compute_error ( std::ostream &  outfile,
FiniteElement::UnsteadyExactSolutionFctPt  exact_soln_pt,
const double time,
double error,
double norm 
)
virtual

Validate against exact solution at given time Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element

Validate against exact velocity solution at given time. Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element.

Reimplemented from oomph::FiniteElement.

162  {
163  error = 0.0;
164  norm = 0.0;
165 
166  // Vector of local coordinates
167  Vector<double> s(2);
168 
169  // Vector for coordintes
170  Vector<double> x(2);
171 
172  // Set the value of n_intpt
173  unsigned n_intpt = integral_pt()->nweight();
174 
175  outfile << "ZONE" << std::endl;
176 
177  // Exact solution Vector (u,v,[w],p)
178  Vector<double> exact_soln(4);
179 
180  // Loop over the integration points
181  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
182  {
183  // Assign values of s
184  for (unsigned i = 0; i < 2; i++)
185  {
186  s[i] = integral_pt()->knot(ipt, i);
187  }
188 
189  // Get the integral weight
190  double w = integral_pt()->weight(ipt);
191 
192  // Get jacobian of mapping
193  double J = J_eulerian(s);
194 
195  // Premultiply the weights and the Jacobian
196  double W = w * J;
197 
198  // Get x position as Vector
199  interpolated_x(s, x);
200 
201  // Get exact solution at this point
202  (*exact_soln_pt)(time, x, exact_soln);
203 
204  // Velocity error
205  for (unsigned i = 0; i < 3; i++)
206  {
207  norm += exact_soln[i] * exact_soln[i] * W;
210  }
211 
212  // Output x,y,...,u_exact
213  for (unsigned i = 0; i < 2; i++)
214  {
215  outfile << x[i] << " ";
216  }
217 
218  // Output x,y,[z],u_error,v_error,[w_error]
219  for (unsigned i = 0; i < 3; i++)
220  {
221  outfile << exact_soln[i] - interpolated_u_spherical_nst(s, i) << " ";
222  }
223 
224  outfile << std::endl;
225  }
226  }

References calibrate::error, ProblemParameters::exact_soln(), i, oomph::FiniteElement::integral_pt(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), J, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), s, w, oomph::QuadTreeNames::W, oomph::Integral::weight(), and plotDoE::x.

◆ compute_error_e()

void oomph::SphericalNavierStokesEquations::compute_error_e ( std::ostream &  outfile,
FiniteElement::SteadyExactSolutionFctPt  exact_soln_pt,
FiniteElement::SteadyExactSolutionFctPt  exact_soln_dr_pt,
FiniteElement::SteadyExactSolutionFctPt  exact_soln_dtheta_pt,
double u_error,
double u_norm,
double p_error,
double p_norm 
)

Validate against exact solution. Solution is provided direct from exact_soln function. Plot at a given number of plot points and compute the energy error and energy norm of the velocity solution over the element.

Validate against exact velocity solution Solution is provided via direct coding. Plot at a given number of plot points and compute energy error and energy norm of velocity solution over element.

Exact solution Vectors (u,v,[w],p) -

  • need two extras to deal with the derivatives in the energy norm
321  {
322  u_error = 0.0;
323  p_error = 0.0;
324  u_norm = 0.0;
325  p_norm = 0.0;
326 
327  // Vector of local coordinates
328  Vector<double> s(2);
329 
330  // Vector for coordinates
331  Vector<double> x(2);
332 
333  // Set the value of n_intpt
334  unsigned n_intpt = integral_pt()->nweight();
335 
336 
339  Vector<double> exact_soln(4);
340  Vector<double> exact_soln_dr(4);
341  Vector<double> exact_soln_dth(4);
342 
343 
344  // Loop over the integration points
345  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
346  {
347  // Assign values of s
348  for (unsigned i = 0; i < 2; i++)
349  {
350  s[i] = integral_pt()->knot(ipt, i);
351  }
352 
353  // Get the integral weight
354  double w = integral_pt()->weight(ipt);
355 
356  // Get jacobian of mapping
357  double J = J_eulerian(s);
358 
359  // Premultiply the weights and the Jacobian
360  double W = w * J;
361 
362  // Get x position as Vector
363  interpolated_x(s, x);
364 
365  // Get exact solution at the point x using the 'actual' functions
366  (*exact_soln_pt)(x, exact_soln);
367  (*exact_soln_dr_pt)(x, exact_soln_dr);
368  (*exact_soln_dtheta_pt)(x, exact_soln_dth);
369 
370  // exact_soln = actual(x);
371  // exact_soln_dr = actual_dr(x);
372  // exact_soln_dth = actual_dth(x);
373 
374 
375  double r = x[0];
376  double theta = x[1];
377 
378  W *= r * r * sin(theta);
379 
380 
381  // Velocity error in energy norm
382  // Owing to the additional terms arising from the phi-components, we can't
383  // loop over the velocities. Calculate each section separately instead.
384 
385  // Norm calculation involves the double contraction of two tensors, so we
386  // take the summation of nine separate components for clarity. Fortunately
387  // most of the components zero out in the axisymmetric case.
388  //---------------------------------------------
389  // Entry (1,1) in dyad matrix
390  // No contribution
391  // Entry (1,2) in dyad matrix
392  // No contribution
393  // Entry (1,3) in dyad matrix
394  u_norm += (1 / (r * r)) * exact_soln[2] * exact_soln[2] * W;
395  //----------------------------------------------
396  // Entry (2,1) in dyad matrix
397  // No contribution
398  // Entry (2,2) in dyad matrix
399  // No contribution
400  // Entry (2,3) in dyad matrix
401  u_norm += cot(theta) * cot(theta) * (1 / (r * r)) * exact_soln[2] *
402  exact_soln[2] * W;
403  //-----------------------------------------------
404  // Entry (3,1) in dyad matrix
405  u_norm += exact_soln_dr[2] * exact_soln_dr[2] * W;
406  // Entry (3,2) in dyad matrix
407  u_norm += (1 / (r * r)) * exact_soln_dth[2] * exact_soln_dth[2] * W;
408  // Entry (3,3) in dyad matrix
409  // No contribution
410  //-----------------------------------------------
411  // End of norm calculation
412 
413 
414  // Error calculation involves the summation of 9 squared components,
415  // stated separately here for clarity
416  //---------------------------------------------
417  // Entry (1,1) in dyad matrix
418  u_error += interpolated_dudx_spherical_nst(s, 0, 0) *
420  // Entry (1,2) in dyad matrix
421  u_error += (1 / (r * r)) *
426  W;
427  // Entry (1,3) in dyad matrix
428  u_error += (1 / (r * r)) *
431  //---------------------------------------------
432  // Entry (2,1) in dyad matrix
433  u_error += interpolated_dudx_spherical_nst(s, 1, 0) *
435  // Entry (2,2) in dyad matrix
436  u_error += (1 / (r * r)) *
441  W;
442  // Entry (2,3) in dyad matrix
443  u_error += (1 / (r * r)) * cot(theta) * cot(theta) *
446  //---------------------------------------------
447  // Entry (3,1) in dyad matrix
448  u_error += (exact_soln_dr[2] - interpolated_dudx_spherical_nst(s, 2, 0)) *
449  (exact_soln_dr[2] - interpolated_dudx_spherical_nst(s, 2, 0)) *
450  W;
451  // Entry (3,2) in dyad matrix
452  u_error +=
453  (1 / (r * r)) *
454  (exact_soln_dth[2] - interpolated_dudx_spherical_nst(s, 2, 1)) *
455  (exact_soln_dth[2] - interpolated_dudx_spherical_nst(s, 2, 1)) * W;
456  // Entry (3,3) in dyad matrix
457  u_error += (1 / (r * r)) *
462  W;
463  //---------------------------------------------
464  // End of velocity error calculation
465 
466  // Pressure error in L2 norm - energy norm not required here as the
467  // pressure only appears undifferentiated in the NS SPC weak form.
468 
469  p_norm += exact_soln[3] * exact_soln[3] * W;
470 
471  p_error += (exact_soln[3] - interpolated_p_spherical_nst(s)) *
473 
474 
475  // Output r and theta coordinates
476  for (unsigned i = 0; i < 2; i++)
477  {
478  outfile << x[i] << " ";
479  }
480 
481  // Output the velocity error details in the energy norm
482  outfile << u_error << " " << u_norm << " ";
483  // Output the pressure error details in the L2 norm
484  outfile << p_error << " " << p_norm << " ";
485  outfile << std::endl;
486 
487  } // End loop over integration points
488 
489  } // End of function statement
double interpolated_dudx_spherical_nst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
Definition: spherical_navier_stokes_elements.h:753
double cot(const double &th) const
Definition: spherical_navier_stokes_elements.h:218
double interpolated_p_spherical_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
Definition: spherical_navier_stokes_elements.h:780

References cot(), ProblemParameters::exact_soln(), i, oomph::FiniteElement::integral_pt(), interpolated_dudx_spherical_nst(), interpolated_p_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), J, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), UniformPSDSelfTest::r, s, sin(), BiharmonicTestFunctions2::theta, w, oomph::QuadTreeNames::W, oomph::Integral::weight(), and plotDoE::x.

◆ compute_shear_stress()

void oomph::SphericalNavierStokesEquations::compute_shear_stress ( std::ostream &  outfile)
497  {
498  // Vector of local coordinates
499  Vector<double> s(2);
500 
501  // Vector for coordinates
502  Vector<double> x(2);
503 
504  // Number of plot points
505  unsigned Npts = 3;
506 
507  // Declaration of the shear stress variable
508  double shear = 0.0;
509 
510 
511  // Assign values of s
512  for (unsigned i = 0; i < Npts; i++)
513  {
514  s[0] = 1.0;
515  s[1] = -1 + 2.0 * i / (Npts - 1);
516 
517 
518  // Get position as global coordinate
519  interpolated_x(s, x);
520 
521  // Output r and theta coordinates
522  outfile << x[0] << " ";
523  outfile << x[1] << " ";
524 
525  // Output the shear stress at the current coordinate
526  double r = x[0];
528  (1 / r) * interpolated_u_spherical_nst(s, 2);
529  outfile << shear << " ";
530 
531  outfile << std::endl;
532  }
533  }
shear
Definition: plotDoE.py:31

References i, interpolated_dudx_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), UniformPSDSelfTest::r, s, plotDoE::shear, and plotDoE::x.

◆ cot()

double oomph::SphericalNavierStokesEquations::cot ( const double th) const
inline

Include a cot function to simplify the NS momentum and jacobian expressions

219  {
220  return (1 / tan(th));
221  }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 tan(const bfloat16 &a)
Definition: BFloat16.h:633

References Eigen::bfloat16_impl::tan().

Referenced by compute_error_e(), and strain_rate().

◆ d_kin_energy_dt()

double oomph::SphericalNavierStokesEquations::d_kin_energy_dt ( ) const

Get integral of time derivative of kinetic energy over element.

Get integral of time derivative of kinetic energy over element:

1415  {
1416  throw OomphLibError("Not tested for spherical Navier-Stokes elements",
1419 
1420 
1421  // Initialise
1422  double d_kin_en_dt = 0.0;
1423 
1424  // Set the value of n_intpt
1425  const unsigned n_intpt = integral_pt()->nweight();
1426 
1427  // Set the Vector to hold local coordinates
1428  Vector<double> s(2);
1429 
1430  // Get the number of nodes
1431  const unsigned n_node = this->nnode();
1432 
1433  // Storage for the shape function
1434  Shape psi(n_node);
1435  DShape dpsidx(n_node, 2);
1436 
1437  // Get the value at which the velocities are stored
1438  unsigned u_index[3];
1439  for (unsigned i = 0; i < 3; i++)
1440  {
1441  u_index[i] = this->u_index_spherical_nst(i);
1442  }
1443 
1444  // Loop over the integration points
1445  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
1446  {
1447  // Get the jacobian of the mapping
1448  double J = dshape_eulerian_at_knot(ipt, psi, dpsidx);
1449 
1450  // Get the integral weight
1451  double w = integral_pt()->weight(ipt);
1452 
1453  // Now work out the velocity and the time derivative
1454  Vector<double> interpolated_u(3, 0.0), interpolated_dudt(3, 0.0);
1455 
1456  // Loop over the shape functions
1457  for (unsigned l = 0; l < n_node; l++)
1458  {
1459  // Loop over the velocity components
1460  for (unsigned i = 0; i < 3; i++)
1461  {
1462  interpolated_u[i] += nodal_value(l, u_index[i]) * psi(l);
1463  interpolated_dudt[i] += du_dt_spherical_nst(l, u_index[i]) * psi(l);
1464  }
1465  }
1466 
1467  // Get mesh velocity bit
1468  if (!ALE_is_disabled)
1469  {
1470  Vector<double> mesh_velocity(2, 0.0);
1471  DenseMatrix<double> interpolated_dudx(3, 2, 0.0);
1472 
1473  // Loop over nodes again
1474  for (unsigned l = 0; l < n_node; l++)
1475  {
1476  // Mesh can only move in the first two directions
1477  for (unsigned i = 0; i < 2; i++)
1478  {
1479  mesh_velocity[i] += this->dnodal_position_dt(l, i) * psi(l);
1480  }
1481 
1482  // Now du/dx bit
1483  for (unsigned i = 0; i < 3; i++)
1484  {
1485  for (unsigned j = 0; j < 2; j++)
1486  {
1487  interpolated_dudx(i, j) +=
1488  this->nodal_value(l, u_index[i]) * dpsidx(l, j);
1489  }
1490  }
1491  }
1492 
1493  // Subtract mesh velocity from du_dt
1494  for (unsigned i = 0; i < 3; i++)
1495  {
1496  for (unsigned k = 0; k < 2; k++)
1497  {
1498  interpolated_dudt[i] -= mesh_velocity[k] * interpolated_dudx(i, k);
1499  }
1500  }
1501  }
1502 
1503 
1504  // Loop over directions and add up u du/dt terms
1505  double sum = 0.0;
1506  for (unsigned i = 0; i < 3; i++)
1507  {
1508  sum += interpolated_u[i] * interpolated_dudt[i];
1509  }
1510 
1511  d_kin_en_dt += sum * w * J;
1512  }
1513 
1514  return d_kin_en_dt;
1515  }
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
virtual double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3325
double dnodal_position_dt(const unsigned &n, const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt at local node n.
Definition: elements.h:2333
virtual unsigned u_index_spherical_nst(const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:387
double du_dt_spherical_nst(const unsigned &n, const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:395
char char char int int * k
Definition: level2_impl.h:374
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References ALE_is_disabled, oomph::FiniteElement::dnodal_position_dt(), oomph::FiniteElement::dshape_eulerian_at_knot(), du_dt_spherical_nst(), i, oomph::FiniteElement::integral_pt(), J, j, k, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), oomph::Integral::nweight(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, u_index_spherical_nst(), w, and oomph::Integral::weight().

◆ density_ratio()

const double& oomph::SphericalNavierStokesEquations::density_ratio ( ) const
inline

Density ratio for element: Element's density relative to the viscosity used in the definition of the Reynolds number

288  {
289  return *Density_Ratio_pt;
290  }

References Density_Ratio_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ density_ratio_pt()

double*& oomph::SphericalNavierStokesEquations::density_ratio_pt ( )
inline

Pointer to Density ratio.

294  {
295  return Density_Ratio_pt;
296  }

References Density_Ratio_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ disable_ALE()

void oomph::SphericalNavierStokesEquations::disable_ALE ( )
inlinevirtual

Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!

Reimplemented from oomph::FiniteElement.

425  {
426  ALE_is_disabled = true;
427  }

References ALE_is_disabled.

Referenced by oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::disable_ALE().

◆ dissipation() [1/2]

double oomph::SphericalNavierStokesEquations::dissipation ( ) const

Return integral of dissipation over element.

1087  {
1088  // Initialise
1089  double diss = 0.0;
1090 
1091  // Set the value of n_intpt
1092  unsigned n_intpt = integral_pt()->nweight();
1093 
1094  // Set the Vector to hold local coordinates
1095  Vector<double> s(2);
1096 
1097  // Loop over the integration points
1098  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
1099  {
1100  // Assign values of s
1101  for (unsigned i = 0; i < 2; i++)
1102  {
1103  s[i] = integral_pt()->knot(ipt, i);
1104  }
1105 
1106  // Get the integral weight
1107  double w = integral_pt()->weight(ipt);
1108 
1109  // Get Jacobian of mapping
1110  double J = J_eulerian(s);
1111 
1112  // Get strain rate matrix
1113  DenseMatrix<double> strainrate(3, 3);
1114  strain_rate(s, strainrate);
1115 
1116  // Initialise
1117  double local_diss = 0.0;
1118  for (unsigned i = 0; i < 3; i++)
1119  {
1120  for (unsigned j = 0; j < 3; j++)
1121  {
1122  local_diss += 2.0 * strainrate(i, j) * strainrate(i, j);
1123  }
1124  }
1125 
1126  diss += local_diss * w * J;
1127  }
1128 
1129  return diss;
1130  }
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i)
Definition: spherical_navier_stokes_elements.cc:1197

References i, oomph::FiniteElement::integral_pt(), J, j, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), s, strain_rate(), w, and oomph::Integral::weight().

Referenced by full_output(), and output().

◆ dissipation() [2/2]

double oomph::SphericalNavierStokesEquations::dissipation ( const Vector< double > &  s) const

Return dissipation at local coordinate s.

1176  {
1177  // Get strain rate matrix
1178  DenseMatrix<double> strainrate(3, 3);
1179  strain_rate(s, strainrate);
1180 
1181  // Initialise
1182  double local_diss = 0.0;
1183  for (unsigned i = 0; i < 3; i++)
1184  {
1185  for (unsigned j = 0; j < 3; j++)
1186  {
1187  local_diss += 2.0 * strainrate(i, j) * strainrate(i, j);
1188  }
1189  }
1190 
1191  return local_diss;
1192  }

References i, j, s, and strain_rate().

◆ dshape_and_dtest_eulerian_at_knot_spherical_nst()

virtual double oomph::SphericalNavierStokesEquations::dshape_and_dtest_eulerian_at_knot_spherical_nst ( const unsigned ipt,
Shape psi,
DShape dpsidx,
Shape test,
DShape dtestdx 
) const
protectedpure virtual

Compute the shape functions and derivatives w.r.t. global coords at ipt-th integration point Return Jacobian of mapping between local and global coordinates.

Implemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ dshape_and_dtest_eulerian_spherical_nst()

virtual double oomph::SphericalNavierStokesEquations::dshape_and_dtest_eulerian_spherical_nst ( const Vector< double > &  s,
Shape psi,
DShape dpsidx,
Shape test,
DShape dtestdx 
) const
protectedpure virtual

Compute the shape functions and derivatives w.r.t. global coords at local coordinate s. Return Jacobian of mapping between local and global coordinates.

Implemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

◆ du_dt_spherical_nst()

double oomph::SphericalNavierStokesEquations::du_dt_spherical_nst ( const unsigned n,
const unsigned i 
) const
inline

i-th component of du/dt at local node n. Uses suitably interpolated value for hanging nodes.

396  {
397  // Get the data's timestepper
398  TimeStepper* time_stepper_pt = this->node_pt(n)->time_stepper_pt();
399 
400  // Initialise dudt
401  double dudt = 0.0;
402 
403  // Loop over the timesteps, if there is a non Steady timestepper
404  if (time_stepper_pt->type() != "Steady")
405  {
406  // Find the index at which the dof is stored
407  const unsigned u_nodal_index = this->u_index_spherical_nst(i);
408 
409  // Number of timsteps (past & present)
410  const unsigned n_time = time_stepper_pt->ntstorage();
411  // Loop over the timesteps
412  for (unsigned t = 0; t < n_time; t++)
413  {
414  dudt +=
415  time_stepper_pt->weight(1, t) * nodal_value(t, n, u_nodal_index);
416  }
417  }
418 
419  return dudt;
420  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
unsigned ntstorage() const
Definition: timesteppers.h:601
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
Definition: timesteppers.h:594
std::string type() const
Definition: timesteppers.h:490
t
Definition: plotPSD.py:36

References n, oomph::FiniteElement::nodal_value(), oomph::FiniteElement::node_pt(), oomph::TimeStepper::ntstorage(), plotPSD::t, oomph::GeomObject::time_stepper_pt(), oomph::Data::time_stepper_pt(), oomph::TimeStepper::type(), u_index_spherical_nst(), and oomph::TimeStepper::weight().

Referenced by d_kin_energy_dt(), oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), fill_in_generic_residual_contribution_spherical_nst(), and full_output().

◆ enable_ALE()

void oomph::SphericalNavierStokesEquations::enable_ALE ( )
inlinevirtual

(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative. Note: By default, ALE is enabled, at the expense of possibly creating unnecessary work in problems where the mesh is, in fact, stationary.

Reimplemented from oomph::FiniteElement.

434  {
435  ALE_is_disabled = false;
436  }

References ALE_is_disabled.

Referenced by oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::enable_ALE().

◆ extract_velocity()

void oomph::SphericalNavierStokesEquations::extract_velocity ( std::ostream &  outfile)
541  {
542  // Vector of local coordinates
543  Vector<double> s(2);
544 
545  // Vector for coordinates
546  Vector<double> x(2);
547 
548  // Number of plot points
549  unsigned Npts = 3;
550 
551 
552  // Assign values of s
553  for (unsigned i = 0; i < Npts; i++)
554  {
555  s[1] = 1.0;
556  s[0] = -1 + 2.0 * i / (Npts - 1);
557 
558 
559  // Get position as global coordinate
560  interpolated_x(s, x);
561  double r = x[0];
562  double theta = x[1];
563 
564  // Output r and theta coordinates
565  outfile << r << " ";
566  outfile << theta << " ";
567 
568  // Output the velocity at the current coordinate
569  outfile << interpolated_u_spherical_nst(s, 0) << " ";
570  outfile << interpolated_u_spherical_nst(s, 1) << " ";
571  outfile << interpolated_u_spherical_nst(s, 2) << " ";
572  outfile << interpolated_p_spherical_nst(s) << " ";
573 
574  // Output shear stress along the given radius
575  double shear = interpolated_dudx_spherical_nst(s, 2, 0) -
576  (1 / r) * interpolated_u_spherical_nst(s, 2);
577  outfile << shear << " ";
578 
579  // Coordinate setup for norm
580  double J = J_eulerian(s);
581  if (i != 1)
582  {
583  double w = integral_pt()->weight(i);
584  double W = w * J;
585  W *= r * r * sin(theta);
586 
587  // Output the velocity integral at current point
588  double u_int = 0.0;
589  for (unsigned j = 0; j < 3; j++)
590  {
591  u_int += interpolated_u_spherical_nst(s, j) * W;
592  }
593  outfile << u_int << " ";
594 
595  // Output the pressure integral at current point
596  double p_int = interpolated_p_spherical_nst(s) * W;
597  outfile << p_int;
598  outfile << std::endl;
599  }
600 
601  else
602  {
603  double w = integral_pt()->weight(5);
604  double W = w * J;
605  W *= r * r * sin(theta);
606 
607  // Output the velocity integral at current point
608  double u_int = 0.0;
609  for (unsigned j = 0; j < 3; j++)
610  {
611  u_int += interpolated_u_spherical_nst(s, j) * W;
612  }
613  outfile << u_int << " ";
614 
615  // Output the pressure integral at current point
616  double p_int = interpolated_p_spherical_nst(s) * W;
617  outfile << p_int;
618  outfile << std::endl;
619  }
620  }
621  }

References i, oomph::FiniteElement::integral_pt(), interpolated_dudx_spherical_nst(), interpolated_p_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), J, j, oomph::FiniteElement::J_eulerian(), UniformPSDSelfTest::r, s, plotDoE::shear, sin(), BiharmonicTestFunctions2::theta, w, oomph::QuadTreeNames::W, oomph::Integral::weight(), and plotDoE::x.

◆ fill_in_contribution_to_jacobian()

void oomph::SphericalNavierStokesEquations::fill_in_contribution_to_jacobian ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian 
)
inlinevirtual

Add the elemental contribution to the jacobian matrix. and the residuals vector. Note that this function will NOT initialise the residuals vector or the jacobian matrix. It must be called after the residuals vector and jacobian matrix have been initialised to zero. The default is to use finite differences to calculate the jacobian

Reimplemented from oomph::FiniteElement.

683  {
684  // Call the generic routine with the flag set to 1
686  residuals, jacobian, GeneralisedElement::Dummy_matrix, 1);
687  }
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
virtual void fill_in_generic_residual_contribution_spherical_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Definition: spherical_navier_stokes_elements.cc:1566

References oomph::GeneralisedElement::Dummy_matrix, and fill_in_generic_residual_contribution_spherical_nst().

Referenced by oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::fill_in_contribution_to_jacobian().

◆ fill_in_contribution_to_jacobian_and_mass_matrix()

void oomph::SphericalNavierStokesEquations::fill_in_contribution_to_jacobian_and_mass_matrix ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian,
DenseMatrix< double > &  mass_matrix 
)
inlinevirtual

Add the element's contribution to its residuals vector, jacobian matrix and mass matrix

Reimplemented from oomph::GeneralisedElement.

695  {
696  // Call the generic routine with the flag set to 2
698  residuals, jacobian, mass_matrix, 2);
699  }

References fill_in_generic_residual_contribution_spherical_nst().

Referenced by oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::fill_in_contribution_to_jacobian_and_mass_matrix().

◆ fill_in_contribution_to_residuals()

void oomph::SphericalNavierStokesEquations::fill_in_contribution_to_residuals ( Vector< double > &  residuals)
inlinevirtual

Compute the element's residual Vector.

Reimplemented from oomph::GeneralisedElement.

669  {
670  // Call the generic residuals function with flag set to 0
671  // and using a dummy matrix argument
673  residuals,
676  0);
677  }

References oomph::GeneralisedElement::Dummy_matrix, and fill_in_generic_residual_contribution_spherical_nst().

Referenced by oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::fill_in_contribution_to_residuals().

◆ fill_in_generic_residual_contribution_spherical_nst()

void oomph::SphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian,
DenseMatrix< double > &  mass_matrix,
unsigned  flag 
)
protectedvirtual

Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobian as well.

Reimplemented in oomph::RefineableSphericalNavierStokesEquations.

1571  {
1572  // Return immediately if there are no dofs
1573  if (ndof() == 0) return;
1574 
1575  // Find out how many nodes there are
1576  const unsigned n_node = nnode();
1577 
1578  // Get continuous time from timestepper of first node
1579  double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
1580 
1581  // Find out how many pressure dofs there are
1582  const unsigned n_pres = npres_spherical_nst();
1583 
1584  // Find the indices at which the local velocities are stored
1585  unsigned u_nodal_index[3];
1586  for (unsigned i = 0; i < 3; i++)
1587  {
1588  u_nodal_index[i] = u_index_spherical_nst(i);
1589  }
1590 
1591  // Set up memory for the shape and test functions
1592  Shape psif(n_node), testf(n_node);
1593  DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
1594 
1595  // Set up memory for pressure shape and test functions
1596  Shape psip(n_pres), testp(n_pres);
1597 
1598  // Number of integration points
1599  const unsigned n_intpt = integral_pt()->nweight();
1600 
1601  // Set the Vector to hold local coordinates
1602  Vector<double> s(2);
1603 
1604  // Get Physical Variables from Element
1605  // Reynolds number must be multiplied by the density ratio
1606  const double scaled_re = re() * density_ratio();
1607  const double scaled_re_st = re_st() * density_ratio();
1608  const double scaled_re_inv_ro = re_invro() * density_ratio();
1609  // double scaled_re_inv_fr = re_invfr()*density_ratio();
1610  // double visc_ratio = viscosity_ratio();
1611  Vector<double> G = g();
1612 
1613  // Integers to store the local equations and unknowns
1614  int local_eqn = 0, local_unknown = 0;
1615 
1616  // Loop over the integration points
1617  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
1618  {
1619  // Assign values of s
1620  for (unsigned i = 0; i < 2; i++) s[i] = integral_pt()->knot(ipt, i);
1621  // Get the integral weight
1622  double w = integral_pt()->weight(ipt);
1623 
1624  // Call the derivatives of the shape and test functions
1626  ipt, psif, dpsifdx, testf, dtestfdx);
1627 
1628  // Call the pressure shape and test functions
1629  pshape_spherical_nst(s, psip, testp);
1630 
1631  // Premultiply the weights and the Jacobian
1632  const double W = w * J;
1633 
1634  // Calculate local values of the pressure and velocity components
1635  // Allocate
1636  double interpolated_p = 0.0;
1637  Vector<double> interpolated_u(3, 0.0);
1638  Vector<double> interpolated_x(2, 0.0);
1639  Vector<double> mesh_velocity(2, 0.0);
1640  Vector<double> dudt(3, 0.0);
1641  DenseMatrix<double> interpolated_dudx(3, 2, 0.0);
1642 
1643  // Calculate pressure
1644  for (unsigned l = 0; l < n_pres; l++)
1645  {
1646  interpolated_p += p_spherical_nst(l) * psip(l);
1647  }
1648 
1649 
1650  // Calculate velocities and derivatives:
1651 
1652  // Loop over nodes
1653  for (unsigned l = 0; l < n_node; l++)
1654  {
1655  // cache the shape functions
1656  double psi_ = psif(l);
1657  // Loop over the positions separately
1658  for (unsigned i = 0; i < 2; i++)
1659  {
1660  interpolated_x[i] += raw_nodal_position(l, i) * psi_;
1661  }
1662 
1663  // Loop over velocity directions (three of these)
1664  for (unsigned i = 0; i < 3; i++)
1665  {
1666  // Get the nodal value
1667  const double u_value = raw_nodal_value(l, u_nodal_index[i]);
1668  interpolated_u[i] += u_value * psi_;
1669  dudt[i] += du_dt_spherical_nst(l, i) * psi_;
1670 
1671  // Loop over derivative directions
1672  for (unsigned j = 0; j < 2; j++)
1673  {
1674  interpolated_dudx(i, j) += u_value * dpsifdx(l, j);
1675  }
1676  }
1677  }
1678 
1679  if (!ALE_is_disabled)
1680  {
1681  OomphLibWarning("ALE is not tested for spherical Navier Stokes",
1682  "SphericalNS::fill_in...",
1684  // Loop over nodes
1685  for (unsigned l = 0; l < n_node; l++)
1686  {
1687  // Loop over directions (only DIM (2) of these)
1688  for (unsigned i = 0; i < 2; i++)
1689  {
1690  mesh_velocity[i] += this->raw_dnodal_position_dt(l, i) * psif(l);
1691  }
1692  }
1693  }
1694 
1695  // Get the user-defined body force terms
1696  Vector<double> body_force(3);
1698 
1699  // Get the user-defined source function
1700  // double source = get_source_spherical_nst(time(),ipt,interpolated_x);
1701 
1702 
1703  // MOMENTUM EQUATIONS
1704  //------------------
1705 
1706  const double r = interpolated_x[0];
1707  const double r2 = r * r;
1708  const double sin_theta = sin(interpolated_x[1]);
1709  const double cos_theta = cos(interpolated_x[1]);
1710  const double cot_theta = cos_theta / sin_theta;
1711 
1712  const double u_r = interpolated_u[0];
1713  const double u_theta = interpolated_u[1];
1714  const double u_phi = interpolated_u[2];
1715 
1716  // Loop over the test functions
1717  for (unsigned l = 0; l < n_node; l++)
1718  {
1719  // Cannot loop over the velocity components,
1720  // so address each of them separately
1721 
1722  // FIRST: r-component momentum equation
1723 
1724  unsigned i = 0;
1725 
1726  // If it's not a boundary condition
1727  local_eqn = nodal_local_eqn(l, u_nodal_index[i]);
1728  if (local_eqn >= 0)
1729  {
1730  // Convective r-terms
1731  double conv = u_r * interpolated_dudx(0, 0) * r;
1732 
1733  // Convective theta-terms
1734  conv += u_theta * interpolated_dudx(0, 1);
1735 
1736  // Remaining convective terms
1737  conv -= (u_theta * u_theta + u_phi * u_phi);
1738 
1739  // Add the time-derivative term and the convective terms
1740  // to the sum
1741  double sum = (scaled_re_st * r2 * dudt[0] + r * scaled_re * conv) *
1742  sin_theta * testf[l];
1743 
1744  // Subtract the mesh velocity terms
1745  if (!ALE_is_disabled)
1746  {
1747  sum -= scaled_re_st *
1748  (mesh_velocity[0] * interpolated_dudx(0, 0) * r +
1749  mesh_velocity[1] * (interpolated_dudx(0, 1) - u_theta)) *
1750  r * sin_theta * testf[l];
1751  }
1752 
1753  // Add the Coriolis term
1754  sum -= 2.0 * scaled_re_inv_ro * sin_theta * u_phi * r2 * sin_theta *
1755  testf[l];
1756 
1757  // r-derivative test function component of stress tensor
1758  sum += (-interpolated_p + 2.0 * interpolated_dudx(0, 0)) * r2 *
1759  sin_theta * dtestfdx(l, 0);
1760 
1761  // theta-derivative test function component of stress tensor
1762  sum +=
1763  (r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1764  sin_theta * dtestfdx(l, 1);
1765 
1766  // Undifferentiated test function component of stress tensor
1767  sum += 2.0 *
1768  ((-r * interpolated_p + interpolated_dudx(1, 1) + 2.0 * u_r) *
1769  sin_theta +
1770  u_theta * cos_theta) *
1771  testf(l);
1772 
1773  // Make the residuals negative for consistency with the
1774  // other Navier-Stokes equations
1775  residuals[local_eqn] -= sum * W;
1776 
1777  // CALCULATE THE JACOBIAN
1778  if (flag)
1779  {
1780  // Loop over the velocity shape functions again
1781  for (unsigned l2 = 0; l2 < n_node; l2++)
1782  {
1783  // Cannot loop over the velocity components
1784  // --- need to compute these separately instead
1785 
1786  unsigned i2 = 0;
1787 
1788  // If at a non-zero degree of freedom add in the entry
1789  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
1790  if (local_unknown >= 0)
1791  {
1792  // Convective r-term contribution
1793  double jac_conv = r * (psif(l2) * interpolated_dudx(0, 0) +
1794  u_r * dpsifdx(l2, 0));
1795 
1796  // Convective theta-term contribution
1797  jac_conv += u_theta * dpsifdx(l2, 1);
1798 
1799  // Add the time-derivative contribution and the convective
1800  // contribution to the sum
1801  double jac_sum =
1802  (scaled_re_st * node_pt(l2)->time_stepper_pt()->weight(1, 0) *
1803  psif(l2) * r2 +
1804  scaled_re * jac_conv * r) *
1805  testf(l);
1806 
1807  // Subtract the mesh-velocity terms
1808  if (!ALE_is_disabled)
1809  {
1810  jac_sum -= scaled_re_st *
1811  (mesh_velocity[0] * dpsifdx(l2, 0) * r +
1812  mesh_velocity[1] * dpsifdx(l2, 1)) *
1813  r * sin_theta * testf(l);
1814  }
1815 
1816 
1817  // Contribution from the r-derivative test function part
1818  // of stress tensor
1819  jac_sum += 2.0 * dpsifdx(l2, 0) * dtestfdx(l, 0) * r2;
1820 
1821  // Contribution from the theta-derivative test function part
1822  // of stress tensor
1823  jac_sum += dpsifdx(l2, 1) * dtestfdx(l, 1);
1824 
1825 
1826  // Contribution from the undifferentiated test function part
1827  // of stress tensor
1828  jac_sum += 4.0 * psif[l2] * testf(l);
1829 
1830  // Add the total contribution to the jacobian multiplied
1831  // by the jacobian weight
1832  jacobian(local_eqn, local_unknown) -= jac_sum * sin_theta * W;
1833 
1834  // Mass matrix term
1835  if (flag == 2)
1836  {
1837  mass_matrix(local_eqn, local_unknown) +=
1838  scaled_re_st * psif[l2] * testf[l] * r2 * sin_theta * W;
1839  }
1840  }
1841  // End of i2=0 section
1842 
1843 
1844  i2 = 1;
1845 
1846  // If at a non-zero degree of freedom add in the entry
1847  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
1848  if (local_unknown >= 0)
1849  {
1850  // No time derivative contribution
1851 
1852  // Convective contribution
1853  double jac_sum = scaled_re *
1854  (interpolated_dudx(0, 1) - 2.0 * u_theta) *
1855  psif(l2) * r * sin_theta * testf(l);
1856 
1857  // Mesh velocity terms
1858  if (!ALE_is_disabled)
1859  {
1860  jac_sum += scaled_re_st * mesh_velocity[1] * psif(l2) * r *
1861  sin_theta * testf(l);
1862  }
1863 
1864  // Contribution from the theta-derivative test function
1865  // part of stress tensor
1866  jac_sum +=
1867  (r * dpsifdx(l2, 0) - psif(l2)) * dtestfdx(l, 1) * sin_theta;
1868 
1869  // Contribution from the undifferentiated test function
1870  // part of stress tensor
1871  jac_sum += 2.0 *
1872  (dpsifdx(l2, 1) * sin_theta + psif(l2) * cos_theta) *
1873  testf(l);
1874 
1875  // Add the full contribution to the jacobian matrix
1876  jacobian(local_eqn, local_unknown) -= jac_sum * W;
1877 
1878  } // End of i2=1 section
1879 
1880 
1881  i2 = 2;
1882 
1883  // If at a non-zero degree of freedom add in the entry
1884  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
1885  if (local_unknown >= 0)
1886  {
1887  // Single convective-term contribution
1888  jacobian(local_eqn, local_unknown) += 2.0 * scaled_re * u_phi *
1889  psif(l2) * r * sin_theta *
1890  testf[l] * W;
1891 
1892  // Coriolis term
1893  jacobian(local_eqn, local_unknown) +=
1894  2.0 * scaled_re_inv_ro * sin_theta * psif(l2) * r2 *
1895  sin_theta * testf[l] * W;
1896  }
1897  // End of i2=2 section
1898  }
1899  // End of the l2 loop over the test functions
1900 
1901  // Now loop over pressure shape functions
1902  // This is the contribution from pressure gradient
1903  for (unsigned l2 = 0; l2 < n_pres; l2++)
1904  {
1905  /*If we are at a non-zero degree of freedom in the entry*/
1906  local_unknown = p_local_eqn(l2);
1907  if (local_unknown >= 0)
1908  {
1909  jacobian(local_eqn, local_unknown) +=
1910  psip(l2) * (r2 * dtestfdx(l, 0) + 2.0 * r * testf(l)) *
1911  sin_theta * W;
1912  }
1913  }
1914  } // End of Jacobian calculation
1915 
1916  } // End of if not boundary condition statement
1917  // End of r-component momentum equation
1918 
1919 
1920  // SECOND: theta-component momentum equation
1921 
1922  i = 1;
1923 
1924  // IF it's not a boundary condition
1925  local_eqn = nodal_local_eqn(l, u_nodal_index[i]);
1926  if (local_eqn >= 0)
1927  {
1928  // All convective terms
1929  double conv = (u_r * interpolated_dudx(1, 0) * r +
1930  u_theta * interpolated_dudx(1, 1) + u_r * u_theta) *
1931  sin_theta -
1932  u_phi * u_phi * cos_theta;
1933 
1934  // Add the time-derivative and convective terms to the
1935  // residuals sum
1936  double sum =
1937  (scaled_re_st * dudt[1] * r2 * sin_theta + scaled_re * r * conv) *
1938  testf(l);
1939 
1940  // Subtract the mesh velocity terms
1941  if (!ALE_is_disabled)
1942  {
1943  sum -= scaled_re_st *
1944  (mesh_velocity[0] * interpolated_dudx(1, 0) * r +
1945  mesh_velocity[1] * (interpolated_dudx(1, 1) + u_r)) *
1946  r * sin_theta * testf(l);
1947  }
1948 
1949  // Add the Coriolis term
1950  sum -= 2.0 * scaled_re_inv_ro * cos_theta * u_phi * r2 * sin_theta *
1951  testf[l];
1952 
1953  // r-derivative test function component of stress tensor
1954  sum +=
1955  (r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1956  r * sin_theta * dtestfdx(l, 0);
1957 
1958  // theta-derivative test function component of stress tensor
1959  sum +=
1960  (-r * interpolated_p + 2.0 * interpolated_dudx(1, 1) + 2.0 * u_r) *
1961  dtestfdx(l, 1) * sin_theta;
1962 
1963  // Undifferentiated test function component of stress tensor
1964  sum -=
1965  ((r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1966  sin_theta -
1967  (-r * interpolated_p + 2.0 * u_r + 2.0 * u_theta * cot_theta) *
1968  cos_theta) *
1969  testf(l);
1970 
1971  // Add the sum to the residuals,
1972  //(Negative for consistency)
1973  residuals[local_eqn] -= sum * W;
1974 
1975  // CALCULATE THE JACOBIAN
1976  if (flag)
1977  {
1978  // Loop over the velocity shape functions again
1979  for (unsigned l2 = 0; l2 < n_node; l2++)
1980  {
1981  // Cannot loop over the velocity components
1982  // --- need to compute these separately instead
1983 
1984  unsigned i2 = 0;
1985 
1986  // If at a non-zero degree of freedom add in the entry
1987  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
1988  if (local_unknown >= 0)
1989  {
1990  // No time derivative contribution
1991 
1992  // Convective terms
1993  double jac_sum = scaled_re *
1994  (r2 * interpolated_dudx(1, 0) + r * u_theta) *
1995  psif(l2) * sin_theta * testf(l);
1996 
1997  // Mesh velocity terms
1998  if (!ALE_is_disabled)
1999  {
2000  jac_sum -= scaled_re_st * mesh_velocity[1] * psif(l2) * r *
2001  sin_theta * testf(l);
2002  }
2003 
2004  // Contribution from the r-derivative
2005  // test function part of stress tensor
2006  jac_sum += dpsifdx(l2, 1) * dtestfdx(l, 0) * sin_theta * r;
2007 
2008  // Contribution from the theta-derivative test function
2009  // part of stress tensor
2010  jac_sum += 2.0 * psif(l2) * dtestfdx(l, 1) * sin_theta;
2011 
2012  // Contribution from the undifferentiated test function
2013  // part of stress tensor
2014  jac_sum -=
2015  (dpsifdx(l2, 1) * sin_theta - 2.0 * psif(l2) * cos_theta) *
2016  testf(l);
2017 
2018  // Add the sum to the jacobian
2019  jacobian(local_eqn, local_unknown) -= jac_sum * W;
2020  }
2021  // End of i2=0 section
2022 
2023 
2024  i2 = 1;
2025 
2026  // If at a non-zero degree of freedom add in the entry
2027  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2028  if (local_unknown >= 0)
2029  {
2030  // Contribution from the convective terms
2031  double jac_conv = r * u_r * dpsifdx(l2, 0) +
2032  u_theta * dpsifdx(l2, 1) +
2033  (interpolated_dudx(1, 1) + u_r) * psif(l2);
2034 
2035  // Add the time-derivative term and the
2036  // convective terms
2037  double jac_sum =
2038  (scaled_re_st * node_pt(l2)->time_stepper_pt()->weight(1, 0) *
2039  psif(l2) * r2 +
2040  scaled_re * r * jac_conv) *
2041  testf(l) * sin_theta;
2042 
2043 
2044  // Mesh velocity terms
2045  if (!ALE_is_disabled)
2046  {
2047  jac_sum -= scaled_re_st *
2048  (mesh_velocity[0] * dpsifdx(l2, 0) * r +
2049  mesh_velocity[1] * dpsifdx(l2, 1)) *
2050  r * sin_theta * testf(l);
2051  }
2052 
2053  // Contribution from the r-derivative test function
2054  // part of stress tensor
2055  jac_sum += (r * dpsifdx(l2, 0) - psif(l2)) * r *
2056  dtestfdx(l, 0) * sin_theta;
2057 
2058  // Contribution from the theta-derivative test function
2059  // part of stress tensor
2060  jac_sum += 2.0 * dpsifdx(l2, 1) * dtestfdx(l, 1) * sin_theta;
2061 
2062  // Contribution from the undifferentiated test function
2063  // part of stress tensor
2064  jac_sum -= ((r * dpsifdx(l2, 0) - psif(l2)) * sin_theta -
2065  2.0 * psif(l2) * cot_theta * cos_theta) *
2066  testf(l);
2067 
2068  // Add the contribution to the jacobian
2069  jacobian(local_eqn, local_unknown) -= jac_sum * W;
2070 
2071  // Mass matrix term
2072  if (flag == 2)
2073  {
2074  mass_matrix(local_eqn, local_unknown) +=
2075  scaled_re_st * psif[l2] * testf[l] * r2 * sin_theta * W;
2076  }
2077  }
2078  // End of i2=1 section
2079 
2080 
2081  i2 = 2;
2082 
2083  // If at a non-zero degree of freedom add in the entry
2084  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2085  if (local_unknown >= 0)
2086  {
2087  // Only a convective term contribution
2088  jacobian(local_eqn, local_unknown) += scaled_re * 2.0 * r *
2089  psif(l2) * u_phi *
2090  cos_theta * testf(l) * W;
2091 
2092  // Coriolis term
2093  jacobian(local_eqn, local_unknown) +=
2094  2.0 * scaled_re_inv_ro * cos_theta * psif(l2) * r2 *
2095  sin_theta * testf[l] * W;
2096  }
2097  // End of i2=2 section
2098  }
2099  // End of the l2 loop over the test functions
2100 
2101  /*Now loop over pressure shape functions*/
2102  /*This is the contribution from pressure gradient*/
2103  for (unsigned l2 = 0; l2 < n_pres; l2++)
2104  {
2105  /*If we are at a non-zero degree of freedom in the entry*/
2106  local_unknown = p_local_eqn(l2);
2107  if (local_unknown >= 0)
2108  {
2109  jacobian(local_eqn, local_unknown) +=
2110  psip(l2) * r *
2111  (dtestfdx(l, 1) * sin_theta + cos_theta * testf[l]) * W;
2112  }
2113  }
2114  } /*End of Jacobian calculation*/
2115 
2116  } // End of if not boundary condition statement
2117  // End of theta-component of momentum
2118 
2119 
2120  // THIRD: phi-component momentum equation
2121 
2122  i = 2;
2123 
2124  // IF it's not a boundary condition
2125  local_eqn = nodal_local_eqn(l, u_nodal_index[i]);
2126  if (local_eqn >= 0)
2127  {
2128  // Convective r-terms
2129  double conv = u_r * interpolated_dudx(2, 0) * r * sin_theta;
2130 
2131  // Convective theta-terms
2132  conv += u_theta * interpolated_dudx(2, 1) * sin_theta;
2133 
2134  // Remaining convective terms
2135  conv += u_phi * (u_r * sin_theta + u_theta * cos_theta);
2136 
2137  // Add the time-derivative term and the convective terms to the sum
2138  double sum =
2139  (scaled_re_st * r2 * dudt[2] * sin_theta + scaled_re * conv * r) *
2140  testf(l);
2141 
2142  // Mesh velocity terms
2143  if (!ALE_is_disabled)
2144  {
2145  sum -= scaled_re_st *
2146  (mesh_velocity[0] * interpolated_dudx(2, 0) * r +
2147  mesh_velocity[1] * interpolated_dudx(2, 1)) *
2148  r * sin_theta * testf(l);
2149  }
2150 
2151  // Add the Coriolis term
2152  sum += 2.0 * scaled_re_inv_ro *
2153  (cos_theta * u_theta + sin_theta * u_r) * r2 * sin_theta *
2154  testf[l];
2155 
2156  // r-derivative test function component of stress tensor
2157  sum += (r2 * interpolated_dudx(2, 0) - r * u_phi) * dtestfdx(l, 0) *
2158  sin_theta;
2159 
2160  // theta-derivative test function component of stress tensor
2161  sum += (interpolated_dudx(2, 1) * sin_theta - u_phi * cos_theta) *
2162  dtestfdx(l, 1);
2163 
2164  // Undifferentiated test function component of stress tensor
2165  sum -= ((r * interpolated_dudx(2, 0) - u_phi) * sin_theta +
2166  (interpolated_dudx(2, 1) - u_phi * cot_theta) * cos_theta) *
2167  testf(l);
2168 
2169  // Add the sum to the residuals
2170  residuals[local_eqn] -= sum * W;
2171 
2172 
2173  // CALCULATE THE JACOBIAN
2174  if (flag)
2175  {
2176  // Loop over the velocity shape functions again
2177  for (unsigned l2 = 0; l2 < n_node; l2++)
2178  {
2179  // Cannot loop over the velocity components
2180  // -- need to compute these separately instead
2181 
2182  unsigned i2 = 0;
2183 
2184  // If at a non-zero degree of freedom add in the entry
2185  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2186  if (local_unknown >= 0)
2187  {
2188  // Contribution from convective terms
2189  jacobian(local_eqn, local_unknown) -=
2190  scaled_re * (r * interpolated_dudx(2, 0) + u_phi) * psif(l2) *
2191  testf(l) * r * sin_theta * W;
2192 
2193  // Coriolis term
2194  jacobian(local_eqn, local_unknown) -=
2195  2.0 * scaled_re_inv_ro * sin_theta * psif(l2) * r2 *
2196  sin_theta * testf[l] * W;
2197  }
2198  // End of i2=0 section
2199 
2200  i2 = 1;
2201 
2202  // If at a non-zero degree of freedom add in the entry
2203  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2204  if (local_unknown >= 0)
2205  {
2206  // Contribution from convective terms
2207  jacobian(local_eqn, local_unknown) -=
2208  scaled_re *
2209  (interpolated_dudx(2, 1) * sin_theta + u_phi * cos_theta) *
2210  r * psif(l2) * testf(l) * W;
2211 
2212 
2213  // Coriolis term
2214  jacobian(local_eqn, local_unknown) -=
2215  2.0 * scaled_re_inv_ro * cos_theta * psif(l2) * r2 *
2216  sin_theta * testf[l] * W;
2217  }
2218  // End of i2=1 section
2219 
2220 
2221  i2 = 2;
2222 
2223  // If at a non-zero degree of freedom add in the entry
2224  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2225  if (local_unknown >= 0)
2226  {
2227  // Convective terms
2228  double jac_conv = r * u_r * dpsifdx(l2, 0) * sin_theta;
2229 
2230  // Convective theta-term contribution
2231  jac_conv += u_theta * dpsifdx(l2, 1) * sin_theta;
2232 
2233  // Contribution from the remaining convective terms
2234  jac_conv += (u_r * sin_theta + u_theta * cos_theta) * psif(l2);
2235 
2236  // Add the convective and time derivatives
2237  double jac_sum =
2238  (scaled_re_st * node_pt(l2)->time_stepper_pt()->weight(1, 0) *
2239  psif(l2) * r2 * sin_theta +
2240  scaled_re * r * jac_conv) *
2241  testf(l);
2242 
2243 
2244  // Mesh velocity terms
2245  if (!ALE_is_disabled)
2246  {
2247  jac_sum -= scaled_re_st *
2248  (mesh_velocity[0] * dpsifdx(l2, 0) * r +
2249  mesh_velocity[1] * dpsifdx(l2, 1)) *
2250  r * sin_theta * testf(l);
2251  }
2252 
2253  // Contribution from the r-derivative test function
2254  // part of stress tensor
2255  jac_sum += (r * dpsifdx(l2, 0) - psif(l2)) * dtestfdx(l, 0) *
2256  r * sin_theta;
2257 
2258  // Contribution from the theta-derivative test function
2259  // part of stress tensor
2260  jac_sum += (dpsifdx(l2, 1) * sin_theta - psif(l2) * cos_theta) *
2261  dtestfdx(l, 1);
2262 
2263  // Contribution from the undifferentiated test function
2264  // part of stress tensor
2265  jac_sum -=
2266  ((r * dpsifdx(l2, 0) - psif(l2)) * sin_theta +
2267  (dpsifdx(l2, 1) - psif(l2) * cot_theta) * cos_theta) *
2268  testf(l);
2269 
2270  // Add to the jacobian
2271  jacobian(local_eqn, local_unknown) -= jac_sum * W;
2272 
2273  // Mass matrix term
2274  if (flag == 2)
2275  {
2276  mass_matrix(local_eqn, local_unknown) +=
2277  scaled_re_st * psif(l2) * testf[l] * r2 * sin_theta * W;
2278  }
2279  }
2280  // End of i2=2 section
2281  }
2282  // End of the l2 loop over the test functions
2283 
2284  // We assume phi-derivatives to be zero
2285  // No phi-contribution to the pressure gradient to include here
2286 
2287  } // End of Jacobian calculation
2288 
2289  } // End of if not boundary condition statement
2290  // End of phi-component of momentum
2291 
2292  } // End of loop over shape functions
2293 
2294 
2295  // CONTINUITY EQUATION
2296  //-------------------
2297 
2298  // Loop over the shape functions
2299  for (unsigned l = 0; l < n_pres; l++)
2300  {
2301  local_eqn = p_local_eqn(l);
2302  // If not a boundary conditions
2303  // Can't loop over the velocity components, so put these in separately
2304  if (local_eqn >= 0)
2305  {
2306  residuals[local_eqn] += ((2.0 * u_r + r * interpolated_dudx(0, 0) +
2307  interpolated_dudx(1, 1)) *
2308  sin_theta +
2309  u_theta * cos_theta) *
2310  r * testp(l) * W;
2311 
2312  // CALCULATE THE JACOBIAN
2313  if (flag)
2314  {
2315  // Loop over the velocity shape functions
2316  for (unsigned l2 = 0; l2 < n_node; l2++)
2317  {
2318  // Can't loop over velocity components, so put these in separately
2319 
2320  // Contribution from the r-component
2321  unsigned i2 = 0;
2322  /*If we're at a non-zero degree of freedom add it in*/
2323  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2324 
2325  if (local_unknown >= 0)
2326  {
2327  jacobian(local_eqn, local_unknown) +=
2328  (2.0 * psif(l2) + r * dpsifdx(l2, 0)) * r * sin_theta *
2329  testp(l) * W;
2330  }
2331  // End of contribution from r-component
2332 
2333 
2334  // Contribution from the theta-component
2335  i2 = 1;
2336  /*If we're at a non-zero degree of freedom add it in*/
2337  local_unknown = nodal_local_eqn(l2, u_nodal_index[i2]);
2338 
2339  if (local_unknown >= 0)
2340  {
2341  jacobian(local_eqn, local_unknown) +=
2342  r * (dpsifdx(l2, 1) * sin_theta + psif(l2) * cos_theta) *
2343  testp(l) * W;
2344  }
2345  // End of contribution from theta-component
2346 
2347  } // End of loop over l2
2348  } // End of Jacobian calculation
2349 
2350  } // End of if not boundary condition
2351  } // End of loop over l
2352  }
2353  }
JacobiRotation< float > G
Definition: Jacobi_makeGivens.cpp:2
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Definition: elements.h:1432
double raw_dnodal_position_dt(const unsigned &n, const unsigned &i) const
Definition: elements.h:2256
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2576
double raw_nodal_position(const unsigned &n, const unsigned &i) const
Definition: elements.cc:1686
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835
virtual double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
Definition: spherical_navier_stokes_elements.h:311
virtual double p_spherical_nst(const unsigned &n_p) const =0
const double & density_ratio() const
Definition: spherical_navier_stokes_elements.h:287
virtual void get_body_force_spherical_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
Definition: spherical_navier_stokes_elements.h:166
const Vector< double > & g() const
Vector of gravitational components.
Definition: spherical_navier_stokes_elements.h:323
virtual int p_local_eqn(const unsigned &n) const =0
virtual unsigned npres_spherical_nst() const =0
Function to return number of pressure degrees of freedom.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
Definition: spherical_navier_stokes_elements.h:255
Time *const & time_pt() const
Access function for the pointer to time (const version)
Definition: timesteppers.h:572
double & time()
Return the current value of the continuous time.
Definition: timesteppers.h:123
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
double u_r(const double &time, const Vector< double > &x)
Calculate the time dependent form of the r-component of displacement.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:130
double u_theta(const double &time, const Vector< double > &x)
Calculate the time dependent form of the theta-component of displacement.
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:146

References ALE_is_disabled, Global_Parameters::body_force(), cos(), density_ratio(), dshape_and_dtest_eulerian_at_knot_spherical_nst(), du_dt_spherical_nst(), G, g(), get_body_force_spherical_nst(), i, oomph::FiniteElement::integral_pt(), oomph::FiniteElement::interpolated_x(), J, j, oomph::Integral::knot(), oomph::GeneralisedElement::ndof(), oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_local_eqn(), oomph::FiniteElement::node_pt(), npres_spherical_nst(), oomph::Integral::nweight(), OOMPH_EXCEPTION_LOCATION, p_local_eqn(), p_spherical_nst(), pshape_spherical_nst(), UniformPSDSelfTest::r, oomph::FiniteElement::raw_dnodal_position_dt(), oomph::FiniteElement::raw_nodal_position(), oomph::FiniteElement::raw_nodal_value(), re(), re_invro(), re_st(), s, sin(), oomph::Time::time(), oomph::TimeStepper::time_pt(), oomph::Data::time_stepper_pt(), u_index_spherical_nst(), Global_Parameters::u_r(), Global_Parameters::u_theta(), w, oomph::QuadTreeNames::W, oomph::Integral::weight(), and oomph::TimeStepper::weight().

Referenced by fill_in_contribution_to_jacobian(), fill_in_contribution_to_jacobian_and_mass_matrix(), and fill_in_contribution_to_residuals().

◆ fix_pressure()

virtual void oomph::SphericalNavierStokesEquations::fix_pressure ( const unsigned p_dof,
const double p_value 
)
pure virtual

Pin p_dof-th pressure dof and set it to value specified by p_value.

Implemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

◆ full_output() [1/2]

void oomph::SphericalNavierStokesEquations::full_output ( std::ostream &  outfile)
inline

Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format. Default number of plot points

543  {
544  unsigned nplot = 5;
545  full_output(outfile, nplot);
546  }
void full_output(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.h:542

Referenced by oomph::QSphericalCrouzeixRaviartElement::full_output().

◆ full_output() [2/2]

void oomph::SphericalNavierStokesEquations::full_output ( std::ostream &  outfile,
const unsigned nplot 
)

Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format. nplot points in each coordinate direction

Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format. Specified number of plot points in each coordinate direction

921  {
922  throw OomphLibError(
924 
925  // Vector of local coordinates
926  Vector<double> s(2);
927 
928  // Acceleration
929  Vector<double> dudt(3);
930 
931  // Mesh elocity
932  Vector<double> mesh_veloc(3, 0.0);
933 
934  // Tecplot header info
935  outfile << tecplot_zone_string(nplot);
936 
937  // Find out how many nodes there are
938  unsigned n_node = nnode();
939 
940  // Set up memory for the shape functions
941  Shape psif(n_node);
942  DShape dpsifdx(n_node, 2);
943 
944  // Loop over plot points
945  unsigned num_plot_points = nplot_points(nplot);
946  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
947  {
948  // Get local coordinates of plot point
949  get_s_plot(iplot, nplot, s);
950 
951  // Call the derivatives of the shape and test functions
952  dshape_eulerian(s, psif, dpsifdx);
953 
954  // Allocate storage
955  Vector<double> mesh_veloc(3);
956  Vector<double> dudt(3);
957  Vector<double> dudt_ALE(3);
958  DenseMatrix<double> interpolated_dudx(3, 2);
959 
960  // Initialise everything to zero
961  for (unsigned i = 0; i < 3; i++)
962  {
963  mesh_veloc[i] = 0.0;
964  dudt[i] = 0.0;
965  dudt_ALE[i] = 0.0;
966  for (unsigned j = 0; j < 2; j++)
967  {
968  interpolated_dudx(i, j) = 0.0;
969  }
970  }
971 
972  // Calculate velocities and derivatives
973 
974 
975  // Loop over directions
976  for (unsigned i = 0; i < 3; i++)
977  {
978  // Get the index at which velocity i is stored
979  unsigned u_nodal_index = u_index_spherical_nst(i);
980  // Loop over nodes
981  for (unsigned l = 0; l < n_node; l++)
982  {
983  dudt[i] += du_dt_spherical_nst(l, u_nodal_index) * psif(l);
984  mesh_veloc[i] += dnodal_position_dt(l, i) * psif(l);
985 
986  // Loop over derivative directions for velocity gradients
987  for (unsigned j = 0; j < 2; j++)
988  {
989  interpolated_dudx(i, j) +=
990  nodal_value(l, u_nodal_index) * dpsifdx(l, j);
991  }
992  }
993  }
994 
995 
996  // Get dudt in ALE form (incl mesh veloc)
997  for (unsigned i = 0; i < 3; i++)
998  {
999  dudt_ALE[i] = dudt[i];
1000  for (unsigned k = 0; k < 2; k++)
1001  {
1002  dudt_ALE[i] -= mesh_veloc[k] * interpolated_dudx(i, k);
1003  }
1004  }
1005 
1006 
1007  // Coordinates
1008  for (unsigned i = 0; i < 2; i++)
1009  {
1010  outfile << interpolated_x(s, i) << " ";
1011  }
1012 
1013  // Velocities
1014  for (unsigned i = 0; i < 3; i++)
1015  {
1016  outfile << interpolated_u_spherical_nst(s, i) << " ";
1017  }
1018 
1019  // Pressure
1020  outfile << interpolated_p_spherical_nst(s) << " ";
1021 
1022  // Accelerations
1023  for (unsigned i = 0; i < 3; i++)
1024  {
1025  outfile << dudt_ALE[i] << " ";
1026  }
1027 
1028  // Dissipation
1029  outfile << dissipation(s) << " ";
1030 
1031 
1032  outfile << std::endl;
1033  }
1034 
1035  // Write tecplot footer (e.g. FE connectivity lists)
1036  write_tecplot_zone_footer(outfile, nplot);
1037  }
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Definition: elements.h:3161
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Definition: elements.h:3148
virtual unsigned nplot_points(const unsigned &nplot) const
Definition: elements.h:3186
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Definition: elements.h:3174
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3298
double dissipation() const
Return integral of dissipation over element.
Definition: spherical_navier_stokes_elements.cc:1086

References dissipation(), oomph::FiniteElement::dnodal_position_dt(), oomph::FiniteElement::dshape_eulerian(), du_dt_spherical_nst(), oomph::FiniteElement::get_s_plot(), i, interpolated_p_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), j, k, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), oomph::FiniteElement::nplot_points(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, oomph::FiniteElement::tecplot_zone_string(), u_index_spherical_nst(), and oomph::FiniteElement::write_tecplot_zone_footer().

◆ g()

◆ g_pt()

Vector<double>*& oomph::SphericalNavierStokesEquations::g_pt ( )
inline

Pointer to Vector of gravitational components.

330  {
331  return G_pt;
332  }

References G_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ get_body_force_spherical_nst()

virtual void oomph::SphericalNavierStokesEquations::get_body_force_spherical_nst ( const double time,
const unsigned ipt,
const Vector< double > &  s,
const Vector< double > &  x,
Vector< double > &  result 
)
inlineprotectedvirtual

Calculate the body force at a given time and local and/or Eulerian position. This function is virtual so that it can be overloaded in multi-physics elements where the body force might depend on another variable.

Reimplemented in oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement.

171  {
172  // If the function pointer is zero return zero
173  if (Body_force_fct_pt == 0)
174  {
175  // Loop over three spatial dimensions and set body forces to zero
176  for (unsigned i = 0; i < 3; i++)
177  {
178  result[i] = 0.0;
179  }
180  }
181  // Otherwise call the function
182  else
183  {
184  (*Body_force_fct_pt)(time, x, result);
185  }
186  }

References Body_force_fct_pt, i, and plotDoE::x.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ get_load()

void oomph::SphericalNavierStokesEquations::get_load ( const Vector< double > &  s,
const Vector< double > &  N,
Vector< double > &  load 
)
inlinevirtual

This implements a pure virtual function defined in the FSIFluidElement class. The function computes the traction (on the viscous scale), at the element's local coordinate s, that the fluid element exerts onto an adjacent solid element. The number of arguments is imposed by the interface defined in the FSIFluidElement – only the unit normal N (pointing into the fluid!) is actually used in the computation.

Implements oomph::FSIFluidElement.

495  {
496  // Note: get_traction() computes the traction onto the fluid
497  // if N is the outer unit normal onto the fluid; here we're
498  // exepcting N to point into the fluid so we're getting the
499  // traction onto the adjacent wall instead!
500  get_traction(s, N, load);
501  }
void load(Archive &ar, ParticleHandler &handl)
Definition: Particles.h:21
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Definition: spherical_navier_stokes_elements.cc:1137
@ N
Definition: constructor.cpp:22

References get_traction(), load(), N, and s.

◆ get_pressure_and_velocity_mass_matrix_diagonal()

void oomph::SphericalNavierStokesEquations::get_pressure_and_velocity_mass_matrix_diagonal ( Vector< double > &  press_mass_diag,
Vector< double > &  veloc_mass_diag,
const unsigned which_one = 0 
)
virtual

Compute the diagonal of the velocity/pressure mass matrices. If which one=0, both are computed, otherwise only the pressure (which_one=1) or the velocity mass matrix (which_one=2 – the LSC version of the preconditioner only needs that one) NOTE: pressure versions isn't implemented yet because this element has never been tried with Fp preconditoner.

Implements oomph::NavierStokesElementWithDiagonalMassMatrices.

66  {
67 #ifdef PARANOID
68  if ((which_one == 0) || (which_one == 1))
69  {
70  throw OomphLibError("Computation of diagonal of pressure mass matrix is "
71  "not impmented yet.\n",
74  }
75 #endif
76 
77  // Resize and initialise
78  veloc_mass_diag.assign(ndof(), 0.0);
79 
80  // find out how many nodes there are
81  const unsigned n_node = nnode();
82 
83  // find number of coordinates
84  const unsigned n_value = 3;
85 
86  // find the indices at which the local velocities are stored
87  Vector<unsigned> u_nodal_index(n_value);
88  for (unsigned i = 0; i < n_value; i++)
89  {
90  u_nodal_index[i] = this->u_index_spherical_nst(i);
91  }
92 
93  // Set up memory for test functions
94  Shape test(n_node);
95 
96  // Number of integration points
97  unsigned n_intpt = integral_pt()->nweight();
98 
99  // Integer to store the local equations no
100  int local_eqn = 0;
101 
102  // Loop over the integration points
103  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
104  {
105  // Get the integral weight
106  double w = integral_pt()->weight(ipt);
107 
108  // Get determinant of Jacobian of the mapping
109  double J = J_eulerian_at_knot(ipt);
110 
111  // Premultiply weights and Jacobian
112  double W = w * J;
113 
114  // Get the velocity test functions - there is no explicit
115  // function to give the test function so use shape
116  shape_at_knot(ipt, test);
117 
118  // Need to get the position to sort out the jacobian properly
119  double r = 0.0;
120  double theta = 0.0;
121  for (unsigned l = 0; l < n_node; l++)
122  {
123  r += this->nodal_position(l, 0) * test(l);
124  theta += this->nodal_position(l, 1) * test(l);
125  }
126 
127  // Multiply by the geometric factor
128  W *= r * r * sin(theta);
129 
130  // Loop over the veclocity test functions
131  for (unsigned l = 0; l < n_node; l++)
132  {
133  // Loop over the velocity components
134  for (unsigned i = 0; i < n_value; i++)
135  {
136  local_eqn = nodal_local_eqn(l, u_nodal_index[i]);
137 
138  // If not a boundary condition
139  if (local_eqn >= 0)
140  {
141  // Add the contribution
142  veloc_mass_diag[local_eqn] += test[l] * test[l] * W;
143  } // End of if not boundary condition statement
144  } // End of loop over dimension
145  } // End of loop over test functions
146  }
147  }
double nodal_position(const unsigned &n, const unsigned &i) const
Definition: elements.h:2317
virtual double J_eulerian_at_knot(const unsigned &ipt) const
Definition: elements.cc:4168
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Definition: elements.cc:3220
squared absolute sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2 sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square nearest sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round nearest integer not less than the given sa Eigen::floor DOXCOMMA ArrayBase::ceil not a number test
Definition: GlobalFunctions.h:109
Definition: indexed_view.cpp:20

References i, oomph::FiniteElement::integral_pt(), J, oomph::FiniteElement::J_eulerian_at_knot(), oomph::GeneralisedElement::ndof(), oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_local_eqn(), oomph::FiniteElement::nodal_position(), oomph::Integral::nweight(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, UniformPSDSelfTest::r, oomph::FiniteElement::shape_at_knot(), sin(), Eigen::test, BiharmonicTestFunctions2::theta, u_index_spherical_nst(), w, oomph::QuadTreeNames::W, and oomph::Integral::weight().

◆ get_source_spherical_nst()

virtual double oomph::SphericalNavierStokesEquations::get_source_spherical_nst ( double  time,
const unsigned ipt,
const Vector< double > &  x 
)
inlineprotectedvirtual

Calculate the source fct at given time and Eulerian position

193  {
194  // If the function pointer is zero return zero
195  if (Source_fct_pt == 0)
196  {
197  return 0;
198  }
199  // Otherwise call the function
200  else
201  {
202  return (*Source_fct_pt)(time, x);
203  }
204  }

References Source_fct_pt, and plotDoE::x.

◆ get_traction()

void oomph::SphericalNavierStokesEquations::get_traction ( const Vector< double > &  s,
const Vector< double > &  N,
Vector< double > &  traction 
)

Compute traction (on the viscous scale) exerted onto the fluid at local coordinate s. N has to be outer unit normal to the fluid.

1140  {
1141  // Get velocity gradients
1142  DenseMatrix<double> strainrate(3, 3);
1143  strain_rate(s, strainrate);
1144 
1145  // Get pressure
1146  double press = interpolated_p_spherical_nst(s);
1147 
1148  // Loop over traction components
1149  for (unsigned i = 0; i < 3; i++)
1150  {
1151  // If we are in the r and theta direction
1152  // initialise the traction
1153  if (i < 2)
1154  {
1155  traction[i] = -press * N[i];
1156  }
1157  // Otherwise it's zero because the normal cannot have a component
1158  // in the phi direction
1159  else
1160  {
1161  traction[i] = 0.0;
1162  }
1163  // Loop over the possible traction directions
1164  for (unsigned j = 0; j < 2; j++)
1165  {
1166  traction[i] += 2.0 * strainrate(i, j) * N[j];
1167  }
1168  }
1169  }

References i, interpolated_p_spherical_nst(), j, N, s, and strain_rate().

Referenced by get_load().

◆ get_vorticity()

void oomph::SphericalNavierStokesEquations::get_vorticity ( const Vector< double > &  s,
Vector< double > &  vorticity 
) const

Compute the vorticity vector at local coordinate s.

Compute 2D vorticity vector at local coordinate s (return in one and only component of vorticity vector

1302  {
1303  throw OomphLibError("Not tested for spherical Navier-Stokes elements",
1306 
1307 #ifdef PARANOID
1308  if (vorticity.size() != 1)
1309  {
1310  std::ostringstream error_message;
1311  error_message << "Computation of vorticity in 2D requires a 1D vector\n"
1312  << "which contains the only non-zero component of the\n"
1313  << "vorticity vector. You've passed a vector of size "
1314  << vorticity.size() << std::endl;
1315 
1316  throw OomphLibError(
1317  error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1318  }
1319 #endif
1320 
1321  // Specify spatial dimension
1322  unsigned DIM = 2;
1323 
1324  // Velocity gradient matrix
1325  DenseMatrix<double> dudx(DIM);
1326 
1327  // Find out how many nodes there are in the element
1328  unsigned n_node = nnode();
1329 
1330  // Set up memory for the shape and test functions
1331  Shape psi(n_node);
1332  DShape dpsidx(n_node, DIM);
1333 
1334  // Call the derivatives of the shape functions
1335  dshape_eulerian(s, psi, dpsidx);
1336 
1337  // Initialise to zero
1338  for (unsigned i = 0; i < DIM; i++)
1339  {
1340  for (unsigned j = 0; j < DIM; j++)
1341  {
1342  dudx(i, j) = 0.0;
1343  }
1344  }
1345 
1346  // Loop over veclocity components
1347  for (unsigned i = 0; i < DIM; i++)
1348  {
1349  // Get the index at which the i-th velocity is stored
1350  unsigned u_nodal_index = u_index_spherical_nst(i);
1351  // Loop over derivative directions
1352  for (unsigned j = 0; j < DIM; j++)
1353  {
1354  // Loop over nodes
1355  for (unsigned l = 0; l < n_node; l++)
1356  {
1357  dudx(i, j) += nodal_value(l, u_nodal_index) * dpsidx(l, j);
1358  }
1359  }
1360  }
1361 
1362  // Z-component of vorticity
1363  vorticity[0] = dudx(1, 0) - dudx(0, 1);
1364  }
#define DIM
Definition: linearised_navier_stokes_elements.h:44

References DIM, oomph::FiniteElement::dshape_eulerian(), i, j, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, and u_index_spherical_nst().

Referenced by output_vorticity().

◆ interpolated_dudx_spherical_nst()

double oomph::SphericalNavierStokesEquations::interpolated_dudx_spherical_nst ( const Vector< double > &  s,
const unsigned i,
const unsigned j 
) const
inline

Return matrix entry dudx(i,j) of the FE interpolated velocity derivative at local coordinate s

756  {
757  // Find number of nodes
758  unsigned n_node = nnode();
759  // Local shape function
760  Shape psi(n_node);
761  DShape dpsidx(n_node, 2);
762  // Find values of shape function
763  (void)dshape_eulerian(s, psi, dpsidx);
764 
765  // Get nodal index at which i-th velocity is stored
766  unsigned u_nodal_index = u_index_spherical_nst(i);
767 
768  // Initialise value of u
769  double interpolated_dudx = 0.0;
770  // Loop over the local nodes and sum
771  for (unsigned l = 0; l < n_node; l++)
772  {
773  interpolated_dudx += nodal_value(l, u_nodal_index) * dpsidx(l, j);
774  }
775 
776  return (interpolated_dudx);
777  }

References oomph::FiniteElement::dshape_eulerian(), i, j, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), s, and u_index_spherical_nst().

Referenced by compute_error_e(), compute_shear_stress(), and extract_velocity().

◆ interpolated_p_spherical_nst()

double oomph::SphericalNavierStokesEquations::interpolated_p_spherical_nst ( const Vector< double > &  s) const
inline

Return FE interpolated pressure at local coordinate s.

781  {
782  // Find number of nodes
783  unsigned n_pres = npres_spherical_nst();
784  // Local shape function
785  Shape psi(n_pres);
786  // Find values of shape function
787  pshape_spherical_nst(s, psi);
788 
789  // Initialise value of p
790  double interpolated_p = 0.0;
791  // Loop over the local nodes and sum
792  for (unsigned l = 0; l < n_pres; l++)
793  {
794  interpolated_p += p_spherical_nst(l) * psi[l];
795  }
796 
797  return (interpolated_p);
798  }

References npres_spherical_nst(), p_spherical_nst(), pshape_spherical_nst(), and s.

Referenced by compute_error_e(), extract_velocity(), full_output(), oomph::RefineableQSphericalCrouzeixRaviartElement::further_build(), oomph::RefineableQSphericalTaylorHoodElement::get_interpolated_values(), get_traction(), oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::output(), output(), and pressure_integral().

◆ interpolated_u_spherical_nst() [1/2]

double oomph::SphericalNavierStokesEquations::interpolated_u_spherical_nst ( const Vector< double > &  s,
const unsigned i 
) const
inline

Return FE interpolated velocity u[i] at local coordinate s.

729  {
730  // Find number of nodes
731  unsigned n_node = nnode();
732  // Local shape function
733  Shape psi(n_node);
734  // Find values of shape function
735  shape(s, psi);
736 
737  // Get nodal index at which i-th velocity is stored
738  unsigned u_nodal_index = u_index_spherical_nst(i);
739 
740  // Initialise value of u
741  double interpolated_u = 0.0;
742  // Loop over the local nodes and sum
743  for (unsigned l = 0; l < n_node; l++)
744  {
745  interpolated_u += nodal_value(l, u_nodal_index) * psi[l];
746  }
747 
748  return (interpolated_u);
749  }
virtual void shape(const Vector< double > &s, Shape &psi) const =0

References i, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), s, oomph::FiniteElement::shape(), and u_index_spherical_nst().

◆ interpolated_u_spherical_nst() [2/2]

void oomph::SphericalNavierStokesEquations::interpolated_u_spherical_nst ( const Vector< double > &  s,
Vector< double > &  veloc 
) const
inline

Compute vector of FE interpolated velocity u at local coordinate s.

704  {
705  // Find number of nodes
706  unsigned n_node = nnode();
707  // Local shape function
708  Shape psi(n_node);
709  // Find values of shape function
710  shape(s, psi);
711 
712  for (unsigned i = 0; i < 3; i++)
713  {
714  // Index at which the nodal value is stored
715  unsigned u_nodal_index = u_index_spherical_nst(i);
716  // Initialise value of u
717  veloc[i] = 0.0;
718  // Loop over the local nodes and sum
719  for (unsigned l = 0; l < n_node; l++)
720  {
721  veloc[i] += nodal_value(l, u_nodal_index) * psi[l];
722  }
723  }
724  }

References i, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_value(), s, oomph::FiniteElement::shape(), and u_index_spherical_nst().

Referenced by compute_error(), compute_error_e(), compute_shear_stress(), extract_velocity(), full_output(), oomph::RefineableQSphericalTaylorHoodElement::get_interpolated_values(), oomph::RefineableQSphericalCrouzeixRaviartElement::get_interpolated_values(), oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::get_wind_spherical_adv_diff(), kin_energy(), oomph::RefineableBuoyantQSphericalCrouzeixRaviartElement::output(), and output().

◆ kin_energy()

double oomph::SphericalNavierStokesEquations::kin_energy ( ) const

Get integral of kinetic energy over element.

Get integral of kinetic energy over element:

1371  {
1372  // Initialise
1373  double kin_en = 0.0;
1374 
1375  // Set the value of n_intpt
1376  unsigned n_intpt = integral_pt()->nweight();
1377 
1378  // Set the Vector to hold local coordinates
1379  Vector<double> s(2);
1380 
1381  // Loop over the integration points
1382  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
1383  {
1384  // Assign values of s
1385  for (unsigned i = 0; i < 2; i++)
1386  {
1387  s[i] = integral_pt()->knot(ipt, i);
1388  }
1389 
1390  // Get the integral weight
1391  double w = integral_pt()->weight(ipt);
1392 
1393  // Get Jacobian of mapping
1394  double J = J_eulerian(s);
1395 
1396  // Loop over directions
1397  double veloc_squared = 0.0;
1398  for (unsigned i = 0; i < 3; i++)
1399  {
1400  veloc_squared += interpolated_u_spherical_nst(s, i) *
1402  }
1403 
1404  kin_en += 0.5 * veloc_squared * w * J;
1405  }
1406 
1407  return kin_en;
1408  }

References i, oomph::FiniteElement::integral_pt(), interpolated_u_spherical_nst(), J, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), s, w, and oomph::Integral::weight().

◆ npres_spherical_nst()

virtual unsigned oomph::SphericalNavierStokesEquations::npres_spherical_nst ( ) const
pure virtual

◆ output() [1/4]

void oomph::SphericalNavierStokesEquations::output ( FILE *  file_pt)
inlinevirtual

C-style output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points

Reimplemented from oomph::FiniteElement.

Reimplemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

530  {
531  unsigned nplot = 5;
532  output(file_pt, nplot);
533  }
void output(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.h:517

References output().

◆ output() [2/4]

void oomph::SphericalNavierStokesEquations::output ( FILE *  file_pt,
const unsigned nplot 
)
virtual

C-style output function: x,y,[z],u,v,[w],p in tecplot format. nplot points in each coordinate direction

C-style output function: x,y,[z],u,v,[w],p in tecplot format. Specified number of plot points in each coordinate direction.

Reimplemented from oomph::FiniteElement.

Reimplemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

877  {
878  // Vector of local coordinates
879  Vector<double> s(2);
880 
881  // Tecplot header info
882  fprintf(file_pt, "%s", tecplot_zone_string(nplot).c_str());
883 
884  // Loop over plot points
885  unsigned num_plot_points = nplot_points(nplot);
886  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
887  {
888  // Get local coordinates of plot point
889  get_s_plot(iplot, nplot, s);
890 
891  // Coordinates
892  for (unsigned i = 0; i < 2; i++)
893  {
894  fprintf(file_pt, "%g ", interpolated_x(s, i));
895  }
896 
897  // Velocities
898  for (unsigned i = 0; i < 3; i++)
899  {
900  fprintf(file_pt, "%g ", interpolated_u_spherical_nst(s, i));
901  }
902 
903  // Pressure
904  fprintf(file_pt, "%g \n", interpolated_p_spherical_nst(s));
905  }
906  fprintf(file_pt, "\n");
907 
908  // Write tecplot footer (e.g. FE connectivity lists)
909  write_tecplot_zone_footer(file_pt, nplot);
910  }

References oomph::FiniteElement::get_s_plot(), i, interpolated_p_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nplot_points(), s, oomph::FiniteElement::tecplot_zone_string(), and oomph::FiniteElement::write_tecplot_zone_footer().

◆ output() [3/4]

void oomph::SphericalNavierStokesEquations::output ( std::ostream &  outfile)
inlinevirtual

Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points

Reimplemented from oomph::FiniteElement.

Reimplemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

518  {
519  unsigned nplot = 5;
520  output(outfile, nplot);
521  }

Referenced by output(), oomph::QSphericalCrouzeixRaviartElement::output(), and oomph::QSphericalTaylorHoodElement::output().

◆ output() [4/4]

void oomph::SphericalNavierStokesEquations::output ( std::ostream &  outfile,
const unsigned nplot 
)
virtual

Output function: x,y,[z],u,v,[w],p in tecplot format. nplot points in each coordinate direction

Output function: x,y,[z],u,v,[w],p in tecplot format. Specified number of plot points in each coordinate direction.

Reimplemented from oomph::FiniteElement.

Reimplemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

813  {
814  // Vector of local coordinates
815  Vector<double> s(2);
816 
817  // Tecplot header info
818  outfile << tecplot_zone_string(nplot);
819 
820  // Loop over plot points
821  unsigned num_plot_points = nplot_points(nplot);
822  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
823  {
824  // Get local coordinates of plot point
825  get_s_plot(iplot, nplot, s);
826 
827  // Coordinates in Cartesian Coordinates
828  // for(unsigned i=0;i<DIM;i++)
829  // {
830  // outfile << interpolated_x(s,i) << " ";
831  // }
832 
833  // Output the coordinates in Cartesian coordintes
834  double r = interpolated_x(s, 0);
835  double theta = interpolated_x(s, 1);
836  // The actual Cartesian values
837  outfile << r * sin(theta) << " " << r * cos(theta) << " ";
838 
839  // Now the x and y velocities
840  double u_r = interpolated_u_spherical_nst(s, 0);
842 
843  outfile << u_r * sin(theta) + u_theta * cos(theta) << " "
844  << u_r * cos(theta) - u_theta * sin(theta) << " ";
845 
846  // Now the polar coordinates
847  // outfile << r << " " << theta << " ";
848 
849  // Velocities r, theta, phi
850  for (unsigned i = 0; i < 3; i++)
851  {
852  outfile << interpolated_u_spherical_nst(s, i) << " ";
853  }
854 
855  // Pressure
856  outfile << interpolated_p_spherical_nst(s) << " ";
857 
858  // Dissipation
859  outfile << dissipation(s) << " ";
860 
861  outfile << std::endl;
862  }
863 
864  // Write tecplot footer (e.g. FE connectivity lists)
865  write_tecplot_zone_footer(outfile, nplot);
866  }

References cos(), dissipation(), oomph::FiniteElement::get_s_plot(), i, interpolated_p_spherical_nst(), interpolated_u_spherical_nst(), oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nplot_points(), UniformPSDSelfTest::r, s, sin(), oomph::FiniteElement::tecplot_zone_string(), BiharmonicTestFunctions2::theta, Global_Parameters::u_r(), Global_Parameters::u_theta(), and oomph::FiniteElement::write_tecplot_zone_footer().

◆ output_fct() [1/2]

void oomph::SphericalNavierStokesEquations::output_fct ( std::ostream &  outfile,
const unsigned nplot,
const double time,
FiniteElement::UnsteadyExactSolutionFctPt  exact_soln_pt 
)
virtual

Output exact solution specified via function pointer at a given time and at a given number of plot points. Function prints as many components as are returned in solution Vector.

Output "exact" solution at a given time Solution is provided via function pointer. Plot at a given number of plot points. Function prints as many components as are returned in solution Vector.

Reimplemented from oomph::FiniteElement.

691  {
692  // Vector of local coordinates
693  Vector<double> s(2);
694 
695  // Vector for coordinates
696  Vector<double> x(2);
697 
698  // Tecplot header info
699  outfile << tecplot_zone_string(nplot);
700 
701  // Exact solution Vector
702  Vector<double> exact_soln;
703 
704  // Loop over plot points
705  unsigned num_plot_points = nplot_points(nplot);
706  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
707  {
708  // Get local coordinates of plot point
709  get_s_plot(iplot, nplot, s);
710 
711  // Get x position as Vector
712  interpolated_x(s, x);
713 
714  // Get exact solution at this point
715  (*exact_soln_pt)(time, x, exact_soln);
716 
717  // Output x,y,...
718  for (unsigned i = 0; i < 3; i++)
719  {
720  outfile << x[i] << " ";
721  }
722 
723  // Output "exact solution"
724  for (unsigned i = 0; i < exact_soln.size(); i++)
725  {
726  outfile << exact_soln[i] << " ";
727  }
728 
729  outfile << std::endl;
730  }
731 
732  // Write tecplot footer (e.g. FE connectivity lists)
733  write_tecplot_zone_footer(outfile, nplot);
734  }

References ProblemParameters::exact_soln(), oomph::FiniteElement::get_s_plot(), i, oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nplot_points(), s, oomph::FiniteElement::tecplot_zone_string(), oomph::FiniteElement::write_tecplot_zone_footer(), and plotDoE::x.

◆ output_fct() [2/2]

void oomph::SphericalNavierStokesEquations::output_fct ( std::ostream &  outfile,
const unsigned nplot,
FiniteElement::SteadyExactSolutionFctPt  exact_soln_pt 
)
virtual

Output exact solution specified via function pointer at a given number of plot points. Function prints as many components as are returned in solution Vector

Output "exact" solution Solution is provided via function pointer. Plot at a given number of plot points. Function prints as many components as are returned in solution Vector.

Reimplemented from oomph::FiniteElement.

634  {
635  // Vector of local coordinates
636  Vector<double> s(2);
637 
638  // Vector for coordintes
639  Vector<double> x(2);
640 
641  // Tecplot header info
642  outfile << tecplot_zone_string(nplot);
643 
644  // Exact solution Vector
645  Vector<double> exact_soln;
646 
647 
648  // Loop over plot points
649  unsigned num_plot_points = nplot_points(nplot);
650  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
651  {
652  // Get local coordinates of plot point
653  get_s_plot(iplot, nplot, s);
654 
655  // Get x position as Vector
656  interpolated_x(s, x);
657 
658  // Get exact solution at this point
659  (*exact_soln_pt)(x, exact_soln);
660 
661  // Output x,y,...
662  for (unsigned i = 0; i < 3; i++)
663  {
664  outfile << x[i] << " ";
665  }
666 
667  // Output "exact solution"
668  for (unsigned i = 0; i < exact_soln.size(); i++)
669  {
670  outfile << exact_soln[i] << " ";
671  }
672 
673  outfile << std::endl;
674  }
675 
676  // Write tecplot footer (e.g. FE connectivity lists)
677  write_tecplot_zone_footer(outfile, nplot);
678  }

References ProblemParameters::exact_soln(), oomph::FiniteElement::get_s_plot(), i, oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nplot_points(), s, oomph::FiniteElement::tecplot_zone_string(), oomph::FiniteElement::write_tecplot_zone_footer(), and plotDoE::x.

◆ output_veloc()

void oomph::SphericalNavierStokesEquations::output_veloc ( std::ostream &  outfile,
const unsigned nplot,
const unsigned t 
)

Output function: x,y,[z],u,v,[w] in tecplot format. nplot points in each coordinate direction at timestep t (t=0: present; t>0: previous timestep)

Output function: Velocities only x,y,[z],u,v,[w] in tecplot format at specified previous timestep (t=0: present; t>0: previous timestep). Specified number of plot points in each coordinate direction.

746  {
747  // Find number of nodes
748  unsigned n_node = nnode();
749 
750  // Local shape function
751  Shape psi(n_node);
752 
753  // Vectors of local coordinates and coords and velocities
754  Vector<double> s(2);
755  Vector<double> interpolated_x(2);
756  Vector<double> interpolated_u(3);
757 
758  // Tecplot header info
759  outfile << tecplot_zone_string(nplot);
760 
761  // Loop over plot points
762  unsigned num_plot_points = nplot_points(nplot);
763  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
764  {
765  // Get local coordinates of plot point
766  get_s_plot(iplot, nplot, s);
767 
768  // Get shape functions
769  shape(s, psi);
770 
771  // Loop over directions
772  for (unsigned i = 0; i < 3; i++)
773  {
774  interpolated_x[i] = 0.0;
775  interpolated_u[i] = 0.0;
776  // Get the index at which velocity i is stored
777  unsigned u_nodal_index = u_index_spherical_nst(i);
778  // Loop over the local nodes and sum
779  for (unsigned l = 0; l < n_node; l++)
780  {
781  interpolated_u[i] += nodal_value(t, l, u_nodal_index) * psi[l];
782  interpolated_x[i] += nodal_position(t, l, i) * psi[l];
783  }
784  }
785 
786  // Coordinates
787  for (unsigned i = 0; i < 2; i++)
788  {
789  outfile << interpolated_x[i] << " ";
790  }
791 
792  // Velocities
793  for (unsigned i = 0; i < 3; i++)
794  {
795  outfile << interpolated_u[i] << " ";
796  }
797 
798  outfile << std::endl;
799  }
800 
801  // Write tecplot footer (e.g. FE connectivity lists)
802  write_tecplot_zone_footer(outfile, nplot);
803  }

References oomph::FiniteElement::get_s_plot(), i, oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_position(), oomph::FiniteElement::nodal_value(), oomph::FiniteElement::nplot_points(), s, oomph::FiniteElement::shape(), plotPSD::t, oomph::FiniteElement::tecplot_zone_string(), u_index_spherical_nst(), and oomph::FiniteElement::write_tecplot_zone_footer().

◆ output_vorticity()

void oomph::SphericalNavierStokesEquations::output_vorticity ( std::ostream &  outfile,
const unsigned nplot 
)

Output function: x,y,[z], [omega_x,omega_y,[and/or omega_z]] in tecplot format. nplot points in each coordinate direction

Output function for vorticity. x,y,[z],[omega_x,omega_y,[and/or omega_z]] in tecplot format. Specified number of plot points in each coordinate direction.

1048  {
1049  // Vector of local coordinates
1050  Vector<double> s(2);
1051 
1052  // Create vorticity vector of the required size
1053  Vector<double> vorticity(1);
1054 
1055  // Tecplot header info
1056  outfile << tecplot_zone_string(nplot);
1057 
1058  // Loop over plot points
1059  unsigned num_plot_points = nplot_points(nplot);
1060  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
1061  {
1062  // Get local coordinates of plot point
1063  get_s_plot(iplot, nplot, s);
1064 
1065  // Coordinates
1066  for (unsigned i = 0; i < 2; i++)
1067  {
1068  outfile << interpolated_x(s, i) << " ";
1069  }
1070 
1071  // Get vorticity
1072  get_vorticity(s, vorticity);
1073 
1074  outfile << vorticity[0] << std::endl;
1075  ;
1076  }
1077 
1078  // Write tecplot footer (e.g. FE connectivity lists)
1079  write_tecplot_zone_footer(outfile, nplot);
1080  }
void get_vorticity(const Vector< double > &s, Vector< double > &vorticity) const
Compute the vorticity vector at local coordinate s.
Definition: spherical_navier_stokes_elements.cc:1300

References oomph::FiniteElement::get_s_plot(), get_vorticity(), i, oomph::FiniteElement::interpolated_x(), oomph::FiniteElement::nplot_points(), s, oomph::FiniteElement::tecplot_zone_string(), and oomph::FiniteElement::write_tecplot_zone_footer().

◆ p_local_eqn()

virtual int oomph::SphericalNavierStokesEquations::p_local_eqn ( const unsigned n) const
protectedpure virtual

Access function for the local equation number information for the pressure. p_local_eqn[n] = local equation number or < 0 if pinned

Implemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ p_nodal_index_spherical_nst()

virtual int oomph::SphericalNavierStokesEquations::p_nodal_index_spherical_nst ( ) const
inlinevirtual

Return the index at which the pressure is stored if it is stored at the nodes. If not stored at the nodes this will return a negative number.

Reimplemented in oomph::QSphericalTaylorHoodElement.

449  {
451  }
static int Pressure_not_stored_at_node
Definition: spherical_navier_stokes_elements.h:72

References Pressure_not_stored_at_node.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst().

◆ p_spherical_nst()

virtual double oomph::SphericalNavierStokesEquations::p_spherical_nst ( const unsigned n_p) const
pure virtual

◆ pressure_integral()

double oomph::SphericalNavierStokesEquations::pressure_integral ( ) const

Integral of pressure over element.

Return pressure integrated over the element.

1522  {
1523  // Initialise
1524  double press_int = 0;
1525 
1526  // Set the value of n_intpt
1527  unsigned n_intpt = integral_pt()->nweight();
1528 
1529  // Set the Vector to hold local coordinates
1530  Vector<double> s(2);
1531 
1532  // Loop over the integration points
1533  for (unsigned ipt = 0; ipt < n_intpt; ipt++)
1534  {
1535  // Assign values of s
1536  for (unsigned i = 0; i < 2; i++)
1537  {
1538  s[i] = integral_pt()->knot(ipt, i);
1539  }
1540 
1541  // Get the integral weight
1542  double w = integral_pt()->weight(ipt);
1543 
1544  // Get Jacobian of mapping
1545  double J = J_eulerian(s);
1546 
1547  // Premultiply the weights and the Jacobian
1548  double W = w * J;
1549 
1550  // Get pressure
1551  double press = interpolated_p_spherical_nst(s);
1552 
1553  // Add
1554  press_int += press * W;
1555  }
1556 
1557  return press_int;
1558  }

References i, oomph::FiniteElement::integral_pt(), interpolated_p_spherical_nst(), J, oomph::FiniteElement::J_eulerian(), oomph::Integral::knot(), oomph::Integral::nweight(), s, w, oomph::QuadTreeNames::W, and oomph::Integral::weight().

◆ pshape_spherical_nst() [1/2]

virtual void oomph::SphericalNavierStokesEquations::pshape_spherical_nst ( const Vector< double > &  s,
Shape psi 
) const
protectedpure virtual

◆ pshape_spherical_nst() [2/2]

virtual void oomph::SphericalNavierStokesEquations::pshape_spherical_nst ( const Vector< double > &  s,
Shape psi,
Shape test 
) const
protectedpure virtual

Compute the pressure shape and test functions at local coordinate s

Implemented in oomph::QSphericalTaylorHoodElement, and oomph::QSphericalCrouzeixRaviartElement.

◆ re()

const double& oomph::SphericalNavierStokesEquations::re ( ) const
inline

◆ re_invfr()

const double& oomph::SphericalNavierStokesEquations::re_invfr ( ) const
inline

Global inverse Froude number.

300  {
301  return *ReInvFr_pt;
302  }

References ReInvFr_pt.

◆ re_invfr_pt()

double*& oomph::SphericalNavierStokesEquations::re_invfr_pt ( )
inline

Pointer to global inverse Froude number.

306  {
307  return ReInvFr_pt;
308  }

References ReInvFr_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ re_invro()

const double& oomph::SphericalNavierStokesEquations::re_invro ( ) const
inline

Global Reynolds number multiplied by inverse Rossby number.

312  {
313  return *ReInvRo_pt;
314  }

References ReInvRo_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ re_invro_pt()

double*& oomph::SphericalNavierStokesEquations::re_invro_pt ( )
inline

Pointer to global inverse Froude number.

318  {
319  return ReInvRo_pt;
320  }

References ReInvRo_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ re_pt()

double*& oomph::SphericalNavierStokesEquations::re_pt ( )
inline

Pointer to Reynolds number.

262  {
263  return Re_pt;
264  }

References Re_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ re_st()

const double& oomph::SphericalNavierStokesEquations::re_st ( ) const
inline

Product of Reynolds and Strouhal number (=Womersley number)

256  {
257  return *ReSt_pt;
258  }

References ReSt_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), and fill_in_generic_residual_contribution_spherical_nst().

◆ re_st_pt()

double*& oomph::SphericalNavierStokesEquations::re_st_pt ( )
inline

Pointer to product of Reynolds and Strouhal number (=Womersley number)

268  {
269  return ReSt_pt;
270  }

References ReSt_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ source_fct_pt() [1/2]

SphericalNavierStokesSourceFctPt& oomph::SphericalNavierStokesEquations::source_fct_pt ( )
inline

Access function for the source-function pointer.

348  {
349  return Source_fct_pt;
350  }

References Source_fct_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ source_fct_pt() [2/2]

SphericalNavierStokesSourceFctPt oomph::SphericalNavierStokesEquations::source_fct_pt ( ) const
inline

Access function for the source-function pointer. Const version.

354  {
355  return Source_fct_pt;
356  }

References Source_fct_pt.

◆ strain_rate()

void oomph::SphericalNavierStokesEquations::strain_rate ( const Vector< double > &  s,
DenseMatrix< double > &  strain_rate 
) const

Strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i)

Get strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i)

1199  {
1200  // Velocity components
1201  Vector<double> interpolated_u(3, 0.0);
1202  // Coordinates
1203  double interpolated_r = 0.0;
1204  double interpolated_theta = 0.0;
1205  // Velocity gradient matrix
1206  DenseMatrix<double> dudx(3, 2, 0.0);
1207 
1208 
1209  // Find out how many nodes there are in the element
1210  unsigned n_node = nnode();
1211 
1212  // Set up memory for the shape and test functions
1213  Shape psi(n_node);
1214  DShape dpsidx(n_node, 2);
1215 
1216  // Call the derivatives of the shape functions
1217  dshape_eulerian(s, psi, dpsidx);
1218 
1219  // Get the values of the positions
1220  for (unsigned l = 0; l < n_node; l++)
1221  {
1222  interpolated_r += this->nodal_position(l, 0) * psi(l);
1223  interpolated_theta += this->nodal_position(l, 1) * psi(l);
1224  }
1225 
1226 
1227  // Loop over velocity components
1228  for (unsigned i = 0; i < 3; i++)
1229  {
1230  // Get the index at which the i-th velocity is stored
1231  unsigned u_nodal_index = u_index_spherical_nst(i);
1232  // Loop over nodes
1233  for (unsigned l = 0; l < n_node; l++)
1234  {
1235  // Get the velocity value
1236  const double nodal_u = this->nodal_value(l, u_nodal_index);
1237  // Add in the velocities
1238  interpolated_u[i] += nodal_u * psi(l);
1239  // Loop over the derivative directions
1240  for (unsigned j = 0; j < 2; j++)
1241  {
1242  dudx(i, j) += nodal_u * dpsidx(l, j);
1243  }
1244  }
1245  }
1246 
1247  // Assign those strain rates without any negative powers of the radius
1248  strainrate(0, 0) = dudx(0, 0);
1249  strainrate(0, 1) = 0.0;
1250  strainrate(0, 2) = 0.0;
1251  ;
1252  strainrate(1, 1) = 0.0;
1253  strainrate(1, 2) = 0.0;
1254  strainrate(2, 2) = 0.0;
1255 
1256 
1257  // Add the negative powers of the radius, unless we are
1258  // at the origin
1259  if (std::fabs(interpolated_r) > 1.0e-15)
1260  {
1261  const double pi = MathematicalConstants::Pi;
1262  double inverse_r = 1.0 / interpolated_r;
1263 
1264  // Should we include the cot terms (default no)
1265  bool include_cot_terms = false;
1266  double cot_theta = 0.0;
1267  // If we in the legal range then include cot
1268  if ((std::fabs(interpolated_theta) > 1.0e-15) &&
1269  (std::fabs(pi - interpolated_theta) > 1.0e-15))
1270  {
1271  include_cot_terms = true;
1272  cot_theta = this->cot(interpolated_theta);
1273  }
1274 
1275  strainrate(0, 1) =
1276  0.5 * (dudx(1, 0) + (dudx(0, 1) - interpolated_u[1]) * inverse_r);
1277  strainrate(0, 2) = 0.5 * (dudx(2, 0) - interpolated_u[2] * inverse_r);
1278  strainrate(1, 1) = (dudx(1, 1) + interpolated_u[0]) * inverse_r;
1279 
1280  if (include_cot_terms)
1281  {
1282  strainrate(1, 2) =
1283  0.5 * (dudx(2, 1) - interpolated_u[2] * cot_theta) * inverse_r;
1284  strainrate(2, 2) =
1285  (interpolated_u[0] + interpolated_u[1] * cot_theta) * inverse_r;
1286  }
1287  }
1288 
1289  // Sort out the symmetries
1290  strainrate(1, 0) = strainrate(0, 1);
1291  strainrate(2, 0) = strainrate(0, 2);
1292  strainrate(2, 1) = strainrate(1, 2);
1293  }
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
const Mdouble pi
Definition: ExtendedMath.h:23
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157

References cot(), oomph::FiniteElement::dshape_eulerian(), boost::multiprecision::fabs(), i, j, oomph::FiniteElement::nnode(), oomph::FiniteElement::nodal_position(), oomph::FiniteElement::nodal_value(), constants::pi, oomph::MathematicalConstants::Pi, s, and u_index_spherical_nst().

Referenced by dissipation(), get_traction(), and oomph::RefineableSphericalNavierStokesEquations::get_Z2_flux().

◆ u_index_spherical_nst()

virtual unsigned oomph::SphericalNavierStokesEquations::u_index_spherical_nst ( const unsigned i) const
inlinevirtual

◆ u_spherical_nst() [1/2]

double oomph::SphericalNavierStokesEquations::u_spherical_nst ( const unsigned n,
const unsigned i 
) const
inline

Velocity i at local node n. Uses suitably interpolated value for hanging nodes. The use of u_index_spherical_nst() permits the use of this element as the basis for multi-physics elements. The default is to assume that the i-th velocity component is stored at the i-th location of the node

368  {
370  }

References i, n, oomph::FiniteElement::nodal_value(), and u_index_spherical_nst().

◆ u_spherical_nst() [2/2]

double oomph::SphericalNavierStokesEquations::u_spherical_nst ( const unsigned t,
const unsigned n,
const unsigned i 
) const
inline

Velocity i at local node n at timestep t (t=0: present; t>0: previous). Uses suitably interpolated value for hanging nodes.

377  {
379  }

References i, n, oomph::FiniteElement::nodal_value(), plotPSD::t, and u_index_spherical_nst().

◆ viscosity_ratio()

const double& oomph::SphericalNavierStokesEquations::viscosity_ratio ( ) const
inline

Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of the Reynolds number

275  {
276  return *Viscosity_Ratio_pt;
277  }

References Viscosity_Ratio_pt.

◆ viscosity_ratio_pt()

double*& oomph::SphericalNavierStokesEquations::viscosity_ratio_pt ( )
inline

Pointer to Viscosity Ratio.

281  {
282  return Viscosity_Ratio_pt;
283  }

References Viscosity_Ratio_pt.

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build().

Member Data Documentation

◆ ALE_is_disabled

bool oomph::SphericalNavierStokesEquations::ALE_is_disabled
protected

Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed. Only set to true if you're sure that the mesh is stationary.

Referenced by d_kin_energy_dt(), disable_ALE(), enable_ALE(), oomph::RefineableSphericalNavierStokesEquations::fill_in_generic_residual_contribution_spherical_nst(), fill_in_generic_residual_contribution_spherical_nst(), and oomph::RefineableSphericalNavierStokesEquations::further_build().

◆ Body_force_fct_pt

SphericalNavierStokesBodyForceFctPt oomph::SphericalNavierStokesEquations::Body_force_fct_pt
protected

◆ Default_Gravity_vector

Vector< double > oomph::SphericalNavierStokesEquations::Default_Gravity_vector
staticprivate

Static default value for the gravity vector.

Navier-Stokes equations default gravity vector.

Referenced by SphericalNavierStokesEquations().

◆ Default_Physical_Constant_Value

double oomph::SphericalNavierStokesEquations::Default_Physical_Constant_Value = 0.0
staticprivate

Navier–Stokes equations static data.

Static default value for the physical constants (all initialised to zero)

Referenced by SphericalNavierStokesEquations().

◆ Default_Physical_Ratio_Value

double oomph::SphericalNavierStokesEquations::Default_Physical_Ratio_Value = 1.0
staticprivate

Navier–Stokes equations static data.

Static default value for the physical ratios (all are initialised to one)

Referenced by SphericalNavierStokesEquations().

◆ Density_Ratio_pt

double* oomph::SphericalNavierStokesEquations::Density_Ratio_pt
protected

Pointer to the density ratio (relative to the density used in the definition of the Reynolds number)

Referenced by density_ratio(), density_ratio_pt(), oomph::RefineableSphericalNavierStokesEquations::further_build(), and SphericalNavierStokesEquations().

◆ G_pt

Vector<double>* oomph::SphericalNavierStokesEquations::G_pt
protected

◆ Gamma

Vector< double > oomph::SphericalNavierStokesEquations::Gamma
static

Vector to decide whether the stress-divergence form is used or not.

Navier–Stokes equations static data.

◆ Pressure_not_stored_at_node

int oomph::SphericalNavierStokesEquations::Pressure_not_stored_at_node = -100
staticprivate

Static "magic" number that indicates that the pressure is not stored at a node

"Magic" negative number that indicates that the pressure is not stored at a node. This cannot be -1 because that represents the positional hanging scheme in the hanging_pt object of nodes

Referenced by p_nodal_index_spherical_nst().

◆ Re_pt

double* oomph::SphericalNavierStokesEquations::Re_pt
protected

◆ ReInvFr_pt

double* oomph::SphericalNavierStokesEquations::ReInvFr_pt
protected

Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number)

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build(), re_invfr(), re_invfr_pt(), and SphericalNavierStokesEquations().

◆ ReInvRo_pt

double* oomph::SphericalNavierStokesEquations::ReInvRo_pt
protected

Pointer to global Reynolds number x inverse Rossby number (used when in a rotating frame)

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build(), re_invro(), re_invro_pt(), and SphericalNavierStokesEquations().

◆ ReSt_pt

double* oomph::SphericalNavierStokesEquations::ReSt_pt
protected

Pointer to global Reynolds number x Strouhal number (=Womersley)

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build(), re_st(), re_st_pt(), and SphericalNavierStokesEquations().

◆ Source_fct_pt

SphericalNavierStokesSourceFctPt oomph::SphericalNavierStokesEquations::Source_fct_pt
protected

◆ Viscosity_Ratio_pt

double* oomph::SphericalNavierStokesEquations::Viscosity_Ratio_pt
protected

Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds number)

Referenced by oomph::RefineableSphericalNavierStokesEquations::further_build(), SphericalNavierStokesEquations(), viscosity_ratio(), and viscosity_ratio_pt().


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