34 #ifndef CONSTRAINED_FLUID_VOLUME_ELEMENTS_HEADER    35 #define CONSTRAINED_FLUID_VOLUME_ELEMENTS_HEADER    39   #include <oomph-lib-config.h>    43 #include "../generic/Qelements.h"    44 #include "../generic/spines.h"    45 #include "../axisym_navier_stokes/axisym_navier_stokes_elements.h"    93    if (Traded_pressure_stored_as_internal_data)
    96       this->internal_local_eqn(
    97        External_or_internal_data_index_of_traded_pressure,
    98        Index_of_traded_pressure_value);
   103       this->external_local_eqn(
   104        External_or_internal_data_index_of_traded_pressure,
   105        Index_of_traded_pressure_value);     
   112   Vector<double> &residuals);
   135   if (Traded_pressure_stored_as_internal_data)
   137     return internal_data_pt(
   138      External_or_internal_data_index_of_traded_pressure);
   142     return external_data_pt(
   143      External_or_internal_data_index_of_traded_pressure);
   165                                        DenseMatrix<double> &jacobian)
   175   Vector<double> &residuals,
   176   DenseMatrix<double> &jacobian,
   177   DenseMatrix<double> &mass_matrix)
   223    if(Traded_pressure_stored_at_node)
   225      return this->nodal_local_eqn(Data_number_of_traded_pressure,
   226                                   Index_of_traded_pressure_value);
   230      return this->external_local_eqn(Data_number_of_traded_pressure,
   231                                      Index_of_traded_pressure_value);
   240   virtual void fill_in_generic_residual_contribution_volume_constraint(
   241    Vector<double> &residuals)=0;
   257   this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   271                                     &vol_constraint_el_pt, 
   272                                     const bool &check_nodal_data=
true)
   287     const unsigned n_node = this->nnode();
   288     for(
unsigned n=0;n<n_node;n++)
   291       Node* 
const nod_pt = this->node_pt(n);
   293       unsigned n_value = nod_pt->nvalue();
   296       for(
unsigned i=0;i<n_value;i++)
   298         if(nod_pt->eqn_number_pt(i) == global_eqn_number)
   300           Traded_pressure_stored_at_node = 
true;
   301           Data_number_of_traded_pressure = n;
   302           Index_of_traded_pressure_value = i;
   313   Data_number_of_traded_pressure=
   317   Index_of_traded_pressure_value=vol_constraint_el_pt->
   349   void  fill_in_generic_residual_contribution_volume_constraint(
   350    Vector<double> &residuals);
   361   double contribution_to_enclosed_volume();
   380  template<
class ELEMENT>
   383    public virtual FaceGeometry<ELEMENT>
   391                                             const int &face_index) : 
   392   FaceGeometry<ELEMENT>(),
   397      element_pt->build_face_element(face_index,
this);
   404                                         DenseMatrix<double> &jacobian)
   407    this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   411    this->fill_in_jacobian_from_solid_position_by_fd(jacobian);
   418                     const unsigned &i)
 const   419   {
return FaceElement::zeta_nodal(n,k,i);}
   432  template<
class ELEMENT>
   435   public virtual SpineElement<FaceGeometry<ELEMENT> >
   443                                              const int &face_index) :
   444    SpineElement<FaceGeometry<ELEMENT> >(),
   449       element_pt->build_face_element(face_index,
this);
   457                                          DenseMatrix<double> &jacobian)
   460     this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   463     this->fill_in_jacobian_from_geometric_data(jacobian); 
   470                      const unsigned &i)
 const   471    {
return FaceElement::zeta_nodal(n,k,i);}
   502   void  fill_in_generic_residual_contribution_volume_constraint(
   503    Vector<double> &residuals);
   515   double contribution_to_enclosed_volume();
   525    const unsigned n_node = this->nnode();
   529    DShape dpsifds(n_node,1);
   532    const unsigned n_intpt = this->integral_pt()->nweight();
   538    for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   541      s[0] = this->integral_pt()->knot(ipt,0);
   544      double W = this->integral_pt()->weight(ipt);
   547      this->dshape_local_at_knot(ipt,psif,dpsifds);
   551      Vector<double> interpolated_u(2,0.0);
   552      Vector<double> interpolated_t1(2,0.0);
   553      Vector<double> interpolated_x(2,0.0);
   554      for(
unsigned l=0;l<n_node;l++)
   557        for(
unsigned i=0;i<2;i++)
   559          interpolated_x[i] += this->nodal_position(l,i)*psif(l);
   560          interpolated_u[i] += this->node_pt(l)->value(
   561           dynamic_cast<AxisymmetricNavierStokesEquations*>(bulk_element_pt())
   562           ->u_index_axi_nst(i))*psif(l);
   563          interpolated_t1[i] += this->nodal_position(l,i)*dpsifds(l,0);
   568      double tlength = interpolated_t1[0]*interpolated_t1[0] + 
   569       interpolated_t1[1]*interpolated_t1[1];
   572      double J = sqrt(tlength)*interpolated_x[0];
   575      Vector<double> interpolated_n(2);
   576      this->outer_unit_normal(ipt,interpolated_n);
   580      for(
unsigned k=0;k<2;k++) 
   582        dot += interpolated_u[k]*interpolated_n[k];
   611  template<
class ELEMENT>
   614    public virtual FaceGeometry<ELEMENT>
   622     FiniteElement* 
const &element_pt, 
   623     const int &face_index) : 
   624   FaceGeometry<ELEMENT>(),
   629      element_pt->build_face_element(face_index,
this);
   636                                         DenseMatrix<double> &jacobian)
   639    this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   643    this->fill_in_jacobian_from_solid_position_by_fd(jacobian);
   650                     const unsigned &i)
 const   651   {
return FaceElement::zeta_nodal(n,k,i);}
   666  template<
class ELEMENT>
   669   public virtual SpineElement<FaceGeometry<ELEMENT> >
   677      FiniteElement* 
const &element_pt, 
const int &face_index) :
   678    SpineElement<FaceGeometry<ELEMENT> >(),
   683       element_pt->build_face_element(face_index,
this);
   691                                          DenseMatrix<double> &jacobian)
   694     this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   697     this->fill_in_jacobian_from_geometric_data(jacobian); 
   704                      const unsigned &i)
 const   705    {
return FaceElement::zeta_nodal(n,k,i);}
   738   void  fill_in_generic_residual_contribution_volume_constraint(
   739    Vector<double> &residuals);
   767  template<
class ELEMENT>
   770  public virtual FaceGeometry<ELEMENT>
   778     FiniteElement* 
const &element_pt, 
const int &face_index) :
   779   FaceGeometry<ELEMENT>(),
   784      element_pt->build_face_element(face_index,
this);
   793                                         DenseMatrix<double> &jacobian)
   796    this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   800    this->fill_in_jacobian_from_solid_position_by_fd(jacobian);
   808                     const unsigned &i)
 const   809   {
return FaceElement::zeta_nodal(n,k,i);}
   828  template<
class ELEMENT>
   831  public virtual SpineElement<FaceGeometry<ELEMENT> >
   839                                              const int &face_index) :
   840  SpineElement<FaceGeometry<ELEMENT> >(),
   845    element_pt->build_face_element(face_index,
this);
   854                                        DenseMatrix<double> &jacobian)
   857   this->fill_in_generic_residual_contribution_volume_constraint(residuals);
   860   this->fill_in_jacobian_from_geometric_data(jacobian); 
   868                    const unsigned &i)
 const   869  {
return FaceElement::zeta_nodal(n,k,i);}
 VolumeConstraintBoundingElement()
Constructor initialise the boolean flag We expect the traded pressure data to be stored externally...
 
~VolumeConstraintElement()
Empty destructor. 
 
ElasticAxisymmetricVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
SpineLineVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...
 
unsigned Index_of_traded_pressure_value
 
void fill_in_generic_contribution_to_residuals_volume_constraint(Vector< double > &residuals)
Fill in the residuals for the volume constraint. 
 
ElasticSurfaceVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
unsigned Index_of_traded_pressure_value
 
LineVolumeConstraintBoundingElement()
Empty Contructor. 
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in the residuals and jacobian for the volume constraint. 
 
~VolumeConstraintBoundingElement()
Empty Destructor. 
 
~LineVolumeConstraintBoundingElement()
Empty Destructor. 
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
bool Traded_pressure_stored_at_node
Boolean to indicate whether the traded pressure is stored externally or at a node (this can happen in...
 
bool Traded_pressure_stored_as_internal_data
The Data that contains the traded pressure is stored as external or internal Data for the element...
 
AxisymmetricVolumeConstraintBoundingElement()
Empty Contructor. 
 
SpineAxisymmetricVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
VolumeConstraintElement(double *prescribed_volume_pt)
Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint i...
 
double contribution_to_volume_flux()
Return this element's contribution to the volume flux over the boundary. 
 
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Fill in the residuals, jacobian and mass matrix for the volume constraint. 
 
~AxisymmetricVolumeConstraintBoundingElement()
Empty Destructor. 
 
void set_volume_constraint_element(VolumeConstraintElement *const &vol_constraint_el_pt, const bool &check_nodal_data=true)
Set the "master" volume constraint element The setup here is a bit more complicated than one might ex...
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
double p_traded()
Return the traded pressure value. 
 
SpineSurfaceVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...
 
int ptraded_local_eqn()
The local eqn number for the traded pressure. 
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
double * Prescribed_volume_pt
Pointer to the desired value of the volume. 
 
unsigned Data_number_of_traded_pressure
The Data that contains the traded pressure is usually stored as external Data for this element...
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
 
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
~SurfaceVolumeConstraintBoundingElement()
Empty Desctructor. 
 
int ptraded_local_eqn()
The local eqn number for the traded pressure. 
 
unsigned External_or_internal_data_index_of_traded_pressure
The Data that contains the traded pressure is stored as external or internal Data for the element...
 
SurfaceVolumeConstraintBoundingElement()
Empty Contructor. 
 
Data * p_traded_data_pt()
Access to Data that contains the traded pressure. 
 
unsigned index_of_traded_pressure()
Return the index of Data object at which the traded pressure is stored. 
 
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in contribution to residuals and Jacobian. 
 
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in the residuals for the volume constraint. 
 
ElasticLineVolumeConstraintBoundingElement(FiniteElement *const &element_pt, const int &face_index)
Contructor: Specify bulk element and index of face to which this face element is to be attached...