oomph::ImposeFluxForWomersleyElement< DIM > Class Template Reference

#include <womersley_elements.h>

+ Inheritance diagram for oomph::ImposeFluxForWomersleyElement< DIM >:

Public Member Functions

 ImposeFluxForWomersleyElement (Mesh *womersley_mesh_pt, double *prescribed_flux_pt)
 
Datapressure_gradient_data_pt ()
 
double total_volume_flux ()
 Get volume flux through all Womersley elements. More...
 
void get_residuals (Vector< double > &residuals)
 
void get_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
- 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
 
virtual void describe_local_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_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 unsigned self_test ()
 
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
 

Private Attributes

MeshWomersley_mesh_pt
 Pointer to mesh that contains the Womersley elements. More...
 
DataPressure_gradient_data_pt
 
doublePrescribed_flux_pt
 Pointer to current value of prescribed flux. More...
 

Additional Inherited Members

- 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 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_all_generic_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)
 
virtual void fill_in_contribution_to_residuals (Vector< double > &residuals)
 
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_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, 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)
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Detailed Description

template<unsigned DIM>
class oomph::ImposeFluxForWomersleyElement< DIM >

//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// Element to impose volume flux through collection of Womersley elements, in exchange for treating the pressure gradient as an unknown. The pressure gradient is created (as a single-valued Data item) in the constructor for this element which also takes a pointer to the Mesh containing the Womersley elements whose total flux is being controlled. While doing this we tell them that their pressure gradient is now an unknown and must be treated as external Data.

Constructor & Destructor Documentation

◆ ImposeFluxForWomersleyElement()

template<unsigned DIM>
oomph::ImposeFluxForWomersleyElement< DIM >::ImposeFluxForWomersleyElement ( Mesh womersley_mesh_pt,
double prescribed_flux_pt 
)
inline

Constructor: Pass pointer to mesh that contains the Womersley elements whose volume flux is controlled, and pointer to double that contains the instantaneous value of the prescribed flux

512  : Prescribed_flux_pt(prescribed_flux_pt)
513  {
514  // Store the mesh of the flux-controlled Womerersley elements
515  Womersley_mesh_pt = womersley_mesh_pt;
516 
517  // Create the pressure gradient Data
518  Pressure_gradient_data_pt = new Data(1);
520 
521  // Pressure gradient is internal data of this element
523 
524  // Find number of elements in the mesh of Womersley elements
525  // whose total flux is controlled
526  unsigned n_element = womersley_mesh_pt->nelement();
527 
528  // Loop over the elements to tell them that the pressure
529  // gradient is given by the newly created Data object
530  // which is to be treated as external Data.
531  for (unsigned e = 0; e < n_element; e++)
532  {
533  // Upcast from FiniteElement to the present element
534  WomersleyEquations<DIM>* el_pt = dynamic_cast<WomersleyEquations<DIM>*>(
535  womersley_mesh_pt->element_pt(e));
536 
537  // Set the pressure gradient function pointer
538  el_pt->set_pressure_gradient_and_add_as_external_data(
540  }
541  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
double * Prescribed_flux_pt
Pointer to current value of prescribed flux.
Definition: womersley_elements.h:616
Data * Pressure_gradient_data_pt
Definition: womersley_elements.h:613
Mesh * Womersley_mesh_pt
Pointer to mesh that contains the Womersley elements.
Definition: womersley_elements.h:609

References oomph::GeneralisedElement::add_internal_data(), e(), oomph::Mesh::element_pt(), oomph::Mesh::nelement(), oomph::ImposeFluxForWomersleyElement< DIM >::Pressure_gradient_data_pt, oomph::WomersleyEquations< DIM >::set_pressure_gradient_and_add_as_external_data(), oomph::Data::set_value(), and oomph::ImposeFluxForWomersleyElement< DIM >::Womersley_mesh_pt.

Member Function Documentation

◆ get_jacobian()

template<unsigned DIM>
void oomph::ImposeFluxForWomersleyElement< DIM >::get_jacobian ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian 
)
inlinevirtual

Compute element residual Vector and element Jacobian matrix Note: Jacobian is zero because the derivatives w.r.t. to velocity dofs are added by the Womersley elements; the current element's internal Data (the pressure gradient) does not feature in the volume constraint.

Reimplemented from oomph::GeneralisedElement.

593  {
594  // Initialise Jacobian
595  unsigned n_dof = ndof();
596  for (unsigned i = 0; i < n_dof; i++)
597  {
598  for (unsigned j = 0; j < n_dof; j++)
599  {
600  jacobian(i, j) = 0.0;
601  }
602  }
603  // Get residuals
604  get_residuals(residuals);
605  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835
void get_residuals(Vector< double > &residuals)
Definition: womersley_elements.h:575
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References oomph::ImposeFluxForWomersleyElement< DIM >::get_residuals(), i, j, and oomph::GeneralisedElement::ndof().

◆ get_residuals()

template<unsigned DIM>
void oomph::ImposeFluxForWomersleyElement< DIM >::get_residuals ( Vector< double > &  residuals)
inlinevirtual

Compute residual vector: the volume flux constraint determines this element's one-and-only internal Data which represents the pressure gradient

Reimplemented from oomph::GeneralisedElement.

576  {
577  // Local equation number of volume flux constraint -- associated
578  // with the internal data (the unknown pressure gradient)
579  int local_eqn = internal_local_eqn(0, 0);
580  if (local_eqn >= 0)
581  {
582  residuals[local_eqn] += total_volume_flux() - (*Prescribed_flux_pt);
583  }
584  }
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
double total_volume_flux()
Get volume flux through all Womersley elements.
Definition: womersley_elements.h:553

References oomph::GeneralisedElement::internal_local_eqn(), and oomph::ImposeFluxForWomersleyElement< DIM >::total_volume_flux().

Referenced by oomph::ImposeFluxForWomersleyElement< DIM >::get_jacobian().

◆ pressure_gradient_data_pt()

template<unsigned DIM>
Data* oomph::ImposeFluxForWomersleyElement< DIM >::pressure_gradient_data_pt ( )
inline

Read-only access to the single-valued Data item that stores the pressure gradient (to be determined via the flux control)

547  {
549  }

References oomph::ImposeFluxForWomersleyElement< DIM >::Pressure_gradient_data_pt.

◆ total_volume_flux()

template<unsigned DIM>
double oomph::ImposeFluxForWomersleyElement< DIM >::total_volume_flux ( )
inline

Get volume flux through all Womersley elements.

554  {
555  // Initialise
556  double flux = 0.0;
557 
558  // Assemble contributions from elements
559  unsigned nelem = Womersley_mesh_pt->nelement();
560  for (unsigned e = 0; e < nelem; e++)
561  {
562  WomersleyEquations<DIM>* el_pt = dynamic_cast<WomersleyEquations<DIM>*>(
564  if (el_pt != 0) flux += el_pt->get_volume_flux();
565  }
566 
567  // Return total volume flux
568  return flux;
569  }
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59

References e(), oomph::Mesh::element_pt(), ProblemParameters::flux(), oomph::WomersleyEquations< DIM >::get_volume_flux(), oomph::Mesh::nelement(), and oomph::ImposeFluxForWomersleyElement< DIM >::Womersley_mesh_pt.

Referenced by oomph::ImposeFluxForWomersleyElement< DIM >::get_residuals().

Member Data Documentation

◆ Prescribed_flux_pt

template<unsigned DIM>
double* oomph::ImposeFluxForWomersleyElement< DIM >::Prescribed_flux_pt
private

Pointer to current value of prescribed flux.

◆ Pressure_gradient_data_pt

template<unsigned DIM>
Data* oomph::ImposeFluxForWomersleyElement< DIM >::Pressure_gradient_data_pt
private

◆ Womersley_mesh_pt

template<unsigned DIM>
Mesh* oomph::ImposeFluxForWomersleyElement< DIM >::Womersley_mesh_pt
private

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