89 double* prescribed_volume_pt,
128 const unsigned n_node = this->nnode();
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);
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);
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();
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);
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);
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();
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);
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];
326 this->outer_unit_normal(ipt,interpolated_n);
330 for(
unsigned k=0;k<2;k++)
332 dot += interpolated_x[k]*interpolated_n[k];
367 const unsigned n_node = this->nnode();
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);
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];
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;
450 const unsigned n_node = this->nnode();
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);
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);}
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.
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
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.
A class that represents a collection of data; each Data object may contain many different individual ...
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...
double dot(const Vector< double > &a, const Vector< double > &b)
Probably not always best/fastest because not optimised for dimension but useful...
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) internal data object to the element and return the index required to obtain it ...
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.