44   Vector<double> &residuals)
    73    add_internal_data(
new Data(1)); 
    89   double* prescribed_volume_pt,
    98    add_external_data(p_traded_data_pt);
   121   Vector<double> &residuals)
   128      const unsigned n_node = this->nnode();
   132      DShape dpsifds(n_node,1);
   135      const unsigned n_intpt = this->integral_pt()->nweight();
   141      for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   144        s[0] = this->integral_pt()->knot(ipt,0);
   147        double W = this->integral_pt()->weight(ipt);
   150        this->dshape_local_at_knot(ipt,psif,dpsifds);
   153        Vector<double> interpolated_t1(2,0.0);
   154        Vector<double> interpolated_x(2,0.0);
   155        for(
unsigned l=0;l<n_node;l++)
   158          for(
unsigned i=0;i<2;i++)
   160            interpolated_x[i] += this->nodal_position(l,i)*psif(l);
   161            interpolated_t1[i] += this->nodal_position(l,i)*dpsifds(l,0);
   166        double tlength = interpolated_t1[0]*interpolated_t1[0] + 
   167         interpolated_t1[1]*interpolated_t1[1];
   170        double J = sqrt(tlength);
   173        Vector<double> interpolated_n(2);
   174        this->outer_unit_normal(ipt,interpolated_n);
   178        for(
unsigned k=0;k<2;k++) 
   180          dot += interpolated_x[k]*interpolated_n[k];
   185        residuals[local_eqn] += 0.5*dot*W*J;
   202   const unsigned n_node = this->nnode();
   206   DShape dpsifds(n_node,1);
   209   const unsigned n_intpt = this->integral_pt()->nweight();
   215   for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   218     s[0] = this->integral_pt()->knot(ipt,0);
   221     double W = this->integral_pt()->weight(ipt);
   224     this->dshape_local_at_knot(ipt,psif,dpsifds);
   227     Vector<double> interpolated_t1(2,0.0);
   228     Vector<double> interpolated_x(2,0.0);
   229     for(
unsigned l=0;l<n_node;l++)
   232       for(
unsigned i=0;i<2;i++)
   234         interpolated_x[i] += this->nodal_position(l,i)*psif(l);
   235         interpolated_t1[i] += this->nodal_position(l,i)*dpsifds(l,0);
   240     double tlength = interpolated_t1[0]*interpolated_t1[0] + 
   241      interpolated_t1[1]*interpolated_t1[1];
   244     double J = sqrt(tlength);
   247     Vector<double> interpolated_n(2);
   248     this->outer_unit_normal(ipt,interpolated_n);
   252     for(
unsigned k=0;k<2;k++) 
   254       dot += interpolated_x[k]*interpolated_n[k];
   280   const unsigned n_node = this->nnode();
   284   DShape dpsifds(n_node,1);
   287   const unsigned n_intpt = this->integral_pt()->nweight();
   293   for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   296     s[0] = this->integral_pt()->knot(ipt,0);
   299     double W = this->integral_pt()->weight(ipt);
   302     this->dshape_local_at_knot(ipt,psif,dpsifds);
   305     Vector<double> interpolated_t1(2,0.0);
   306     Vector<double> interpolated_x(2,0.0);
   307     for(
unsigned l=0;l<n_node;l++)
   310       for(
unsigned i=0;i<2;i++)
   312         interpolated_x[i] += this->nodal_position(l,i)*psif(l);
   313         interpolated_t1[i] += this->nodal_position(l,i)*dpsifds(l,0);
   318     double tlength = interpolated_t1[0]*interpolated_t1[0] + 
   319      interpolated_t1[1]*interpolated_t1[1];
   322     double J = sqrt(tlength)*interpolated_x[0];
   325     Vector<double> interpolated_n(2);
   326     this->outer_unit_normal(ipt,interpolated_n);
   330     for(
unsigned k=0;k<2;k++) 
   332       dot += interpolated_x[k]*interpolated_n[k];
   360   Vector<double> &residuals)
   367      const unsigned n_node = this->nnode();
   371      DShape dpsifds(n_node,1);
   374      const unsigned n_intpt = this->integral_pt()->nweight();
   380      for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   383        s[0] = this->integral_pt()->knot(ipt,0);
   386        double W = this->integral_pt()->weight(ipt);
   389        this->dshape_local_at_knot(ipt,psif,dpsifds);
   392        Vector<double> interpolated_t1(2,0.0);
   393        Vector<double> interpolated_x(2,0.0);
   394        for(
unsigned l=0;l<n_node;l++)
   397          for(
unsigned i=0;i<2;i++)
   399            interpolated_x[i] += this->nodal_position(l,i)*psif(l);
   400            interpolated_t1[i] += this->nodal_position(l,i)*dpsifds(l,0);
   405        double tlength = interpolated_t1[0]*interpolated_t1[0] + 
   406         interpolated_t1[1]*interpolated_t1[1];
   410        double J = sqrt(tlength)*interpolated_x[0];
   413        Vector<double> interpolated_n(2);
   414        this->outer_unit_normal(ipt,interpolated_n);
   418        for(
unsigned k=0;k<2;k++) 
   420          dot += interpolated_x[k]*interpolated_n[k];
   425        residuals[local_eqn] += dot*W*J/3.0;
   443   Vector<double> &residuals)
   450     const unsigned n_node = this->nnode();
   454     DShape dpsifds(n_node,2);
   457     const unsigned n_intpt = this->integral_pt()->nweight();
   463     for(
unsigned ipt=0;ipt<n_intpt;ipt++)
   466       for(
unsigned i=0;i<2;i++) {s[i] = this->integral_pt()->knot(ipt,i);}
   469       double W = this->integral_pt()->weight(ipt);
   472       this->dshape_local_at_knot(ipt,psif,dpsifds);
   475       DenseMatrix<double> interpolated_g(2,3,0.0);
   476       Vector<double> interpolated_x(3,0.0);
   477       for(
unsigned l=0;l<n_node;l++)
   480         for(
unsigned i=0;i<3;i++)
   483           const double x_ = this->nodal_position(l,i);
   485           interpolated_x[i] += x_*psif(l);
   487           for(
unsigned j=0;j<2;j++) {interpolated_g(j,i) += x_*dpsifds(l,j);}
   492       Vector<double> interpolated_n(3); 
   494        interpolated_g(0,1)*interpolated_g(1,2) - 
   495        interpolated_g(0,2)*interpolated_g(1,1);
   497        interpolated_g(0,2)*interpolated_g(1,0) - 
   498        interpolated_g(0,0)*interpolated_g(1,2); 
   500        interpolated_g(0,0)*interpolated_g(1,1) - 
   501        interpolated_g(0,1)*interpolated_g(1,0);
   509       for(
unsigned i=0;i<3;i++) {interpolated_n[i] *= this->normal_sign();}
   513       for(
unsigned k=0;k<3;k++) 
   515         dot += interpolated_x[k]*interpolated_n[k];
   521       residuals[local_eqn] += dot*W/3.0;
 double contribution_to_enclosed_volume()
Return this element's contribution to the total volume enclosed. 
 
unsigned Index_of_traded_pressure_value
 
void fill_in_generic_residual_contribution_volume_constraint(Vector< double > &residuals)
Helper function to fill in contributions to residuals (remember that part of the residual is added by...
 
void fill_in_generic_contribution_to_residuals_volume_constraint(Vector< double > &residuals)
Fill in the residuals for the volume constraint. 
 
bool Traded_pressure_stored_as_internal_data
The Data that contains the traded pressure is stored as external or internal Data for the element...
 
void fill_in_generic_residual_contribution_volume_constraint(Vector< double > &residuals)
Helper function to fill in contributions to residuals (remember that part of the residual is added by...
 
VolumeConstraintElement(double *prescribed_volume_pt)
Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint i...
 
double contribution_to_enclosed_volume()
Return this element's contribution to the total volume enclosed. 
 
int ptraded_local_eqn()
The local eqn number for the traded pressure. 
 
double * Prescribed_volume_pt
Pointer to the desired value of the volume. 
 
void fill_in_generic_residual_contribution_volume_constraint(Vector< double > &residuals)
Helper function to fill in contributions to residuals (remember that part of the residual is added by...
 
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...
 
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.