84 double* prescribed_volume_pt,
85 Data* p_traded_data_pt,
86 const unsigned& index_of_traded_pressure)
123 const unsigned n_node = this->
nnode();
127 DShape dpsifds(n_node, 1);
136 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
150 for (
unsigned l = 0; l < n_node; l++)
153 for (
unsigned i = 0;
i < 2;
i++)
161 double tlength = interpolated_t1[0] * interpolated_t1[0] +
162 interpolated_t1[1] * interpolated_t1[1];
165 double J = sqrt(tlength);
173 for (
unsigned k = 0; k < 2; k++)
180 residuals[local_eqn] += 0.5 *
dot *
W * J;
195 const unsigned n_node = this->
nnode();
199 DShape dpsifds(n_node, 1);
208 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
222 for (
unsigned l = 0; l < n_node; l++)
225 for (
unsigned i = 0;
i < 2;
i++)
233 double tlength = interpolated_t1[0] * interpolated_t1[0] +
234 interpolated_t1[1] * interpolated_t1[1];
237 double J = sqrt(tlength);
245 for (
unsigned k = 0; k < 2; k++)
252 vol += 0.5 *
dot *
W * J;
273 const unsigned n_node = this->
nnode();
277 DShape dpsifds(n_node, 1);
286 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
300 for (
unsigned l = 0; l < n_node; l++)
303 for (
unsigned i = 0;
i < 2;
i++)
311 double tlength = interpolated_t1[0] * interpolated_t1[0] +
312 interpolated_t1[1] * interpolated_t1[1];
323 for (
unsigned k = 0; k < 2; k++)
330 vol +=
dot *
W * J / 3.0;
360 const unsigned n_node = this->
nnode();
364 DShape dpsifds(n_node, 1);
373 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
387 for (
unsigned l = 0; l < n_node; l++)
390 for (
unsigned i = 0;
i < 2;
i++)
398 double tlength = interpolated_t1[0] * interpolated_t1[0] +
399 interpolated_t1[1] * interpolated_t1[1];
411 for (
unsigned k = 0; k < 2; k++)
418 residuals[local_eqn] +=
dot *
W * J / 3.0;
443 const unsigned n_node = this->
nnode();
447 DShape dpsifds(n_node, 2);
456 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
459 for (
unsigned i = 0;
i < 2;
i++)
473 for (
unsigned l = 0; l < n_node; l++)
476 for (
unsigned i = 0;
i < 3;
i++)
483 for (
unsigned j = 0; j < 2; j++)
485 interpolated_g(j,
i) += x_ * dpsifds(l, j);
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++)
513 for (
unsigned k = 0; k < 3; 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.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
A class that represents a collection of data; each Data object may contain many different individual ...
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s. Overloaded to get information from bulk...
int & normal_sign()
Sign of outer unit normal (relative to cross-products of tangent vectors in the corresponding "bulk" ...
virtual void dshape_local_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsids) const
Return the geometric shape function and its derivative w.r.t. the local coordinates at the ipt-th int...
unsigned nnode() const
Return the number of nodes.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
double nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. If the node is hanging, the appropriate interpolation is ...
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 add_external_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) external data object to the element and return its index (i....
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
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.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
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.
double dot(const Vector< double > &a, const Vector< double > &b)
Probably not always best/fastest because not optimised for dimension but useful...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...