oomph::VolumeConstraintElement Class Reference

#include <constrained_volume_elements.h>

+ Inheritance diagram for oomph::VolumeConstraintElement:

Public Member Functions

 VolumeConstraintElement (double *prescribed_volume_pt)
 
 VolumeConstraintElement (double *prescribed_volume_pt, Data *p_traded_data_pt, const unsigned &index_of_traded_pressure)
 
 ~VolumeConstraintElement ()
 Empty destructor. More...
 
Datap_traded_data_pt ()
 Access to Data that contains the traded pressure. More...
 
double p_traded ()
 Return the traded pressure value. More...
 
unsigned index_of_traded_pressure ()
 Return the index of Data object at which the traded pressure is stored. More...
 
void fill_in_contribution_to_residuals (Vector< double > &residuals)
 Fill in the residuals for the volume constraint. More...
 
void fill_in_contribution_to_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 Fill in the residuals and jacobian for the volume constraint. More...
 
void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
- 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_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 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 Member Functions

int ptraded_local_eqn ()
 The local eqn number for the traded pressure. More...
 
void fill_in_generic_contribution_to_residuals_volume_constraint (Vector< double > &residuals)
 Fill in the residuals for the volume constraint. More...
 

Private Attributes

doublePrescribed_volume_pt
 Pointer to the desired value of the volume. More...
 
unsigned External_or_internal_data_index_of_traded_pressure
 
bool Traded_pressure_stored_as_internal_data
 
unsigned Index_of_traded_pressure_value
 

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)
 
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)
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Detailed Description

A class that is used to implement the constraint that the fluid volume in a region bounded by associated FaceElements (attached, e.g., to the mesh boundaries that enclose a bubble) must take a specific value. This GeneralisedElement is used only to store the desired volume and a pointer to the (usually pressure) freedom that must be traded for the volume constraint.

Constructor & Destructor Documentation

◆ VolumeConstraintElement() [1/2]

oomph::VolumeConstraintElement::VolumeConstraintElement ( double prescribed_volume_pt)

Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint is created internally (as a Data item with a single pressure value)

61  {
62  // Store pointer to prescribed volume
63  Prescribed_volume_pt = prescribed_volume_pt;
64 
65  // Create data, add as internal data and record the index
66  // (gets deleted automatically in destructor of GeneralisedElement)
68  add_internal_data(new Data(1));
69 
70  // Record that we've created it as internal data
72 
73  // ...and stored the "traded pressure" value as first value
75  }
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
unsigned Index_of_traded_pressure_value
Definition: constrained_volume_elements.h:82
unsigned External_or_internal_data_index_of_traded_pressure
Definition: constrained_volume_elements.h:74
bool Traded_pressure_stored_as_internal_data
Definition: constrained_volume_elements.h:78
double * Prescribed_volume_pt
Pointer to the desired value of the volume.
Definition: constrained_volume_elements.h:69

References oomph::GeneralisedElement::add_internal_data(), External_or_internal_data_index_of_traded_pressure, Index_of_traded_pressure_value, Prescribed_volume_pt, and Traded_pressure_stored_as_internal_data.

◆ VolumeConstraintElement() [2/2]

oomph::VolumeConstraintElement::VolumeConstraintElement ( double prescribed_volume_pt,
Data p_traded_data_pt,
const unsigned index_of_traded_pressure 
)

Constructor: Pass pointer to target volume, pointer to Data item whose value specified by index_of_traded_pressure represents the "Pressure" value that "traded" for the volume contraint. The Data is stored as external Data for this element.

87  {
88  // Store pointer to prescribed volume
89  Prescribed_volume_pt = prescribed_volume_pt;
90 
91  // Add as external data and record the index
94 
95  // Record that it is external data
97 
98  // Record index
100  }
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:307
Data * p_traded_data_pt()
Access to Data that contains the traded pressure.
Definition: constrained_volume_elements.h:124
unsigned index_of_traded_pressure()
Return the index of Data object at which the traded pressure is stored.
Definition: constrained_volume_elements.h:145

References oomph::GeneralisedElement::add_external_data(), External_or_internal_data_index_of_traded_pressure, index_of_traded_pressure(), Index_of_traded_pressure_value, p_traded_data_pt(), Prescribed_volume_pt, and Traded_pressure_stored_as_internal_data.

◆ ~VolumeConstraintElement()

oomph::VolumeConstraintElement::~VolumeConstraintElement ( )
inline

Empty destructor.

121 {}

Member Function Documentation

◆ fill_in_contribution_to_jacobian()

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

Fill in the residuals and jacobian for the volume constraint.

Reimplemented from oomph::GeneralisedElement.

161  {
162  // No contribution to jacobian; see comment in that function
164  residuals);
165  }
void fill_in_generic_contribution_to_residuals_volume_constraint(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
Definition: constrained_volume_elements.cc:38

References fill_in_generic_contribution_to_residuals_volume_constraint().

◆ fill_in_contribution_to_jacobian_and_mass_matrix()

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

Fill in the residuals, jacobian and mass matrix for the volume constraint.

Reimplemented from oomph::GeneralisedElement.

173  {
174  // No contribution to jacobian or mass matrix; see comment in that
175  // function
177  residuals);
178  }

References fill_in_generic_contribution_to_residuals_volume_constraint().

◆ fill_in_contribution_to_residuals()

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

Fill in the residuals for the volume constraint.

Reimplemented from oomph::GeneralisedElement.

153  {
155  residuals);
156  }

References fill_in_generic_contribution_to_residuals_volume_constraint().

◆ fill_in_generic_contribution_to_residuals_volume_constraint()

void oomph::VolumeConstraintElement::fill_in_generic_contribution_to_residuals_volume_constraint ( Vector< double > &  residuals)
private

Fill in the residuals for the volume constraint.

40  {
41  // Note: This element can only be used with the associated
42  // VolumeConstraintBoundingElement elements which compute the actual
43  // enclosed volume; here we only add the contribution to the
44  // residual; everything else, incl. the derivatives of this
45  // residual w.r.t. the nodal positions of the
46  // VolumeConstraintBoundingElements
47  // is handled by them
48  const int local_eqn = this->ptraded_local_eqn();
49  if (local_eqn >= 0)
50  {
51  residuals[local_eqn] -= *Prescribed_volume_pt;
52  }
53  }
int ptraded_local_eqn()
The local eqn number for the traded pressure.
Definition: constrained_volume_elements.h:85

References Prescribed_volume_pt, and ptraded_local_eqn().

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

◆ index_of_traded_pressure()

unsigned oomph::VolumeConstraintElement::index_of_traded_pressure ( )
inline

Return the index of Data object at which the traded pressure is stored.

146  {
148  }

References Index_of_traded_pressure_value.

Referenced by oomph::VolumeConstraintBoundingElement::set_volume_constraint_element(), and VolumeConstraintElement().

◆ p_traded()

double oomph::VolumeConstraintElement::p_traded ( )
inline

Return the traded pressure value.

140  {
142  }
double value(const unsigned &i) const
Definition: nodes.h:293

References Index_of_traded_pressure_value, p_traded_data_pt(), and oomph::Data::value().

◆ p_traded_data_pt()

Data* oomph::VolumeConstraintElement::p_traded_data_pt ( )
inline

Access to Data that contains the traded pressure.

125  {
127  {
128  return internal_data_pt(
130  }
131  else
132  {
133  return external_data_pt(
135  }
136  }
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Definition: elements.h:659
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622

References oomph::GeneralisedElement::external_data_pt(), External_or_internal_data_index_of_traded_pressure, oomph::GeneralisedElement::internal_data_pt(), and Traded_pressure_stored_as_internal_data.

Referenced by p_traded(), oomph::VolumeConstraintBoundingElement::set_volume_constraint_element(), and VolumeConstraintElement().

◆ ptraded_local_eqn()

int oomph::VolumeConstraintElement::ptraded_local_eqn ( )
inlineprivate

The local eqn number for the traded pressure.

86  {
88  {
89  return this->internal_local_eqn(
92  }
93  else
94  {
95  return this->external_local_eqn(
98  }
99  }
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
int external_local_eqn(const unsigned &i, const unsigned &j)
Definition: elements.h:311

References oomph::GeneralisedElement::external_local_eqn(), Index_of_traded_pressure_value, oomph::GeneralisedElement::internal_local_eqn(), and Traded_pressure_stored_as_internal_data.

Referenced by fill_in_generic_contribution_to_residuals_volume_constraint().

Member Data Documentation

◆ External_or_internal_data_index_of_traded_pressure

unsigned oomph::VolumeConstraintElement::External_or_internal_data_index_of_traded_pressure
private

The Data that contains the traded pressure is stored as external or internal Data for the element. What is its index in these containers?

Referenced by p_traded_data_pt(), and VolumeConstraintElement().

◆ Index_of_traded_pressure_value

unsigned oomph::VolumeConstraintElement::Index_of_traded_pressure_value
private

Index of the value in traded pressure data that corresponds to the traded pressure

Referenced by index_of_traded_pressure(), p_traded(), ptraded_local_eqn(), and VolumeConstraintElement().

◆ Prescribed_volume_pt

double* oomph::VolumeConstraintElement::Prescribed_volume_pt
private

Pointer to the desired value of the volume.

Referenced by fill_in_generic_contribution_to_residuals_volume_constraint(), and VolumeConstraintElement().

◆ Traded_pressure_stored_as_internal_data

bool oomph::VolumeConstraintElement::Traded_pressure_stored_as_internal_data
private

The Data that contains the traded pressure is stored as external or internal Data for the element. Which one?

Referenced by p_traded_data_pt(), ptraded_local_eqn(), and VolumeConstraintElement().


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