39 Vector<double>& residuals)
68 add_internal_data(
new Data(1));
84 double* prescribed_volume_pt,
85 Data* p_traded_data_pt,
86 const unsigned& index_of_traded_pressure)
116 Vector<double>& residuals)
123 const unsigned n_node = this->nnode();
127 DShape dpsifds(n_node, 1);
130 const unsigned n_intpt = this->integral_pt()->nweight();
136 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
139 s[0] = this->integral_pt()->knot(ipt, 0);
142 double W = this->integral_pt()->weight(ipt);
145 this->dshape_local_at_knot(ipt, psif, dpsifds);
148 Vector<double> interpolated_t1(2, 0.0);
149 Vector<double> interpolated_x(2, 0.0);
150 for (
unsigned l = 0; l < n_node; l++)
153 for (
unsigned i = 0; i < 2; i++)
155 interpolated_x[i] += this->nodal_position(l, i) * psif(l);
156 interpolated_t1[i] += this->nodal_position(l, i) * dpsifds(l, 0);
161 double tlength = interpolated_t1[0] * interpolated_t1[0] +
162 interpolated_t1[1] * interpolated_t1[1];
165 double J = sqrt(tlength);
168 Vector<double> interpolated_n(2);
169 this->outer_unit_normal(ipt, interpolated_n);
173 for (
unsigned k = 0; k < 2; k++)
175 dot += interpolated_x[k] * interpolated_n[k];
180 residuals[local_eqn] += 0.5 * dot * W * J;
195 const unsigned n_node = this->nnode();
199 DShape dpsifds(n_node, 1);
202 const unsigned n_intpt = this->integral_pt()->nweight();
208 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
211 s[0] = this->integral_pt()->knot(ipt, 0);
214 double W = this->integral_pt()->weight(ipt);
217 this->dshape_local_at_knot(ipt, psif, dpsifds);
220 Vector<double> interpolated_t1(2, 0.0);
221 Vector<double> interpolated_x(2, 0.0);
222 for (
unsigned l = 0; l < n_node; l++)
225 for (
unsigned i = 0; i < 2; i++)
227 interpolated_x[i] += this->nodal_position(l, i) * psif(l);
228 interpolated_t1[i] += this->nodal_position(l, i) * dpsifds(l, 0);
233 double tlength = interpolated_t1[0] * interpolated_t1[0] +
234 interpolated_t1[1] * interpolated_t1[1];
237 double J = sqrt(tlength);
240 Vector<double> interpolated_n(2);
241 this->outer_unit_normal(ipt, interpolated_n);
245 for (
unsigned k = 0; k < 2; k++)
247 dot += interpolated_x[k] * interpolated_n[k];
252 vol += 0.5 * dot * W * J;
273 const unsigned n_node = this->nnode();
277 DShape dpsifds(n_node, 1);
280 const unsigned n_intpt = this->integral_pt()->nweight();
286 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
289 s[0] = this->integral_pt()->knot(ipt, 0);
292 double W = this->integral_pt()->weight(ipt);
295 this->dshape_local_at_knot(ipt, psif, dpsifds);
298 Vector<double> interpolated_t1(2, 0.0);
299 Vector<double> interpolated_x(2, 0.0);
300 for (
unsigned l = 0; l < n_node; l++)
303 for (
unsigned i = 0; i < 2; i++)
305 interpolated_x[i] += this->nodal_position(l, i) * psif(l);
306 interpolated_t1[i] += this->nodal_position(l, i) * dpsifds(l, 0);
311 double tlength = interpolated_t1[0] * interpolated_t1[0] +
312 interpolated_t1[1] * interpolated_t1[1];
315 double J = sqrt(tlength) * interpolated_x[0];
318 Vector<double> interpolated_n(2);
319 this->outer_unit_normal(ipt, interpolated_n);
323 for (
unsigned k = 0; k < 2; k++)
325 dot += interpolated_x[k] * interpolated_n[k];
330 vol += dot * W * J / 3.0;
353 Vector<double>& residuals)
360 const unsigned n_node = this->nnode();
364 DShape dpsifds(n_node, 1);
367 const unsigned n_intpt = this->integral_pt()->nweight();
373 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
376 s[0] = this->integral_pt()->knot(ipt, 0);
379 double W = this->integral_pt()->weight(ipt);
382 this->dshape_local_at_knot(ipt, psif, dpsifds);
385 Vector<double> interpolated_t1(2, 0.0);
386 Vector<double> interpolated_x(2, 0.0);
387 for (
unsigned l = 0; l < n_node; l++)
390 for (
unsigned i = 0; i < 2; i++)
392 interpolated_x[i] += this->nodal_position(l, i) * psif(l);
393 interpolated_t1[i] += this->nodal_position(l, i) * dpsifds(l, 0);
398 double tlength = interpolated_t1[0] * interpolated_t1[0] +
399 interpolated_t1[1] * interpolated_t1[1];
403 double J = sqrt(tlength) * interpolated_x[0];
406 Vector<double> interpolated_n(2);
407 this->outer_unit_normal(ipt, interpolated_n);
411 for (
unsigned k = 0; k < 2; k++)
413 dot += interpolated_x[k] * interpolated_n[k];
418 residuals[local_eqn] += dot * W * J / 3.0;
436 Vector<double>& residuals)
443 const unsigned n_node = this->nnode();
447 DShape dpsifds(n_node, 2);
450 const unsigned n_intpt = this->integral_pt()->nweight();
456 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
459 for (
unsigned i = 0; i < 2; i++)
461 s[i] = this->integral_pt()->knot(ipt, i);
465 double W = this->integral_pt()->weight(ipt);
468 this->dshape_local_at_knot(ipt, psif, dpsifds);
471 DenseMatrix<double> interpolated_g(2, 3, 0.0);
472 Vector<double> interpolated_x(3, 0.0);
473 for (
unsigned l = 0; l < n_node; l++)
476 for (
unsigned i = 0; i < 3; i++)
479 const double x_ = this->nodal_position(l, i);
481 interpolated_x[i] += x_ * psif(l);
483 for (
unsigned j = 0; j < 2; j++)
485 interpolated_g(j, i) += x_ * dpsifds(l, j);
492 Vector<double> interpolated_n(3);
493 interpolated_n[0] = interpolated_g(0, 1) * interpolated_g(1, 2) -
494 interpolated_g(0, 2) * interpolated_g(1, 1);
495 interpolated_n[1] = interpolated_g(0, 2) * interpolated_g(1, 0) -
496 interpolated_g(0, 0) * interpolated_g(1, 2);
497 interpolated_n[2] = interpolated_g(0, 0) * interpolated_g(1, 1) -
498 interpolated_g(0, 1) * interpolated_g(1, 0);
506 for (
unsigned i = 0; i < 3; i++)
508 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;
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 contribution_to_enclosed_volume()
Return this element's contribution to the total volume enclosed.
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 contribution_to_enclosed_volume()
Return this element's contribution to the total volume enclosed.
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...
int ptraded_local_eqn()
The local eqn number for the traded pressure.
void fill_in_generic_contribution_to_residuals_volume_constraint(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
unsigned Index_of_traded_pressure_value
Index of the value in traded pressure data that corresponds to 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....
Data * p_traded_data_pt()
Access to Data that contains the traded pressure.
VolumeConstraintElement(double *prescribed_volume_pt)
Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint i...
bool Traded_pressure_stored_as_internal_data
The Data that contains the traded pressure is stored as external or internal Data for the element....
int ptraded_local_eqn()
The local eqn number for the traded pressure.
unsigned index_of_traded_pressure()
Return the index of Data object at which the traded pressure is stored.
double * Prescribed_volume_pt
Pointer to the desired value of the volume.