30 #include "../generic/integral.h"
105 unsigned n_dim = parent_pt->
dim();
126 for (
unsigned i = 0;
i < spatial_dim;
i++)
128 dot += unit_normal[
i] * wall_normal[
i];
140 wall_tangent[0] = -wall_normal[1];
141 wall_tangent[1] = wall_normal[0];
144 double ca_local =
ca();
147 for (
unsigned i = 0;
i < 2;
i++)
152 residuals[local_eqn] +=
153 (sigma_local / ca_local) * (sin(
contact_angle()) * wall_normal[
i] +
170 double ca_local =
ca();
175 for (
unsigned i = 0;
i < 2;
i++)
180 residuals[local_eqn] += (sigma_local / ca_local) * m[
i];
211 residuals, jacobian, flag, psif, dpsifds, interpolated_n,
W);
240 unsigned n_dim = parent_pt->
dim();
246 unsigned n_node = this->
nnode();
253 for (
unsigned ipt = 0; ipt < n_intpt; ++ipt)
267 for (
unsigned n = 0; n < n_node; n++)
269 const double psi_local = psi(n);
270 const double dpsi_local = dpsids(n, 0);
271 for (
unsigned i = 0;
i < spatial_dim;
i++)
274 interpolated_t1[
i] += pos * dpsi_local;
275 x[
i] += pos * psi_local;
280 double t_length = 0.0;
281 for (
unsigned i = 0;
i < spatial_dim; ++
i)
283 t_length += interpolated_t1[
i] * interpolated_t1[
i];
299 for (
unsigned i = 0;
i < spatial_dim;
i++)
301 dot += unit_normal[
i] * wall_normal[
i];
306 for (
unsigned i = 0;
i < spatial_dim;
i++)
308 binorm[
i] = unit_normal[
i] -
dot * wall_normal[
i];
312 const double sigma_local =
316 const double ca_local =
ca();
324 for (
unsigned l = 0; l < n_node; l++)
327 for (
unsigned i = 0;
i < 3;
i++)
337 residuals[local_eqn] +=
338 (sigma_local / ca_local) *
339 (sin(theta) * wall_normal[
i] + cos(theta) * binorm[
i]) *
357 const double sigma_local =
361 const double ca_local =
ca();
364 for (
unsigned l = 0; l < n_node; l++)
367 for (
unsigned i = 0;
i < 3;
i++)
377 residuals[local_eqn] +=
378 m[
i] * (sigma_local / ca_local) * psi(l) *
W;
398 for (
unsigned i = 0;
i < spatial_dim;
i++)
400 dot += unit_normal[
i] * wall_normal[
i];
404 for (
unsigned l = 0; l < n_node; l++)
423 residuals, jacobian, flag, psi, dpsids, unit_normal,
W);
458 for (
unsigned l = 0; l < n_node; l++)
475 unsigned n_node = this->
nnode();
481 const unsigned el_dim = this->
dim();
483 DShape dpsifds(n_node, el_dim);
495 DShape dpsifdS(n_node, n_dim);
496 DShape dpsifdS_div(n_node, n_dim);
508 double p_ext =
pext();
511 int local_eqn = 0, local_unknown = 0;
517 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
520 for (
unsigned i = 0;
i < el_dim;
i++)
539 for (
unsigned l = 0; l < n_node; l++)
541 const double psi_ = psif(l);
543 for (
unsigned i = 0;
i < n_dim;
i++)
552 for (
unsigned j = 0; j < el_dim; j++)
565 psif, dpsifds, interpolated_t,
interpolated_x, dpsifdS, dpsifdS_div);
573 double Sigma = this->
sigma(s);
576 for (
unsigned l = 0; l < n_node; l++)
579 for (
unsigned i = 0;
i < n_dim;
i++)
588 residuals[local_eqn] -= (Sigma / Ca) * dpsifdS_div(l,
i) * J *
W;
594 residuals[local_eqn] -=
595 p_ext * interpolated_n[
i] * psif(l) * J *
W;
603 if (local_unknown >= 0)
605 jacobian(local_eqn, local_unknown) -=
606 interpolated_n[
i] * psif(l) * J *
W;
620 for (
unsigned k = 0; k < n_dim; k++)
622 residuals[local_eqn] +=
624 interpolated_n[k] * psif(l) * J *
W;
631 for (
unsigned l2 = 0; l2 < n_node; l2++)
634 for (
unsigned i2 = 0; i2 < n_dim; i2++)
639 if (local_unknown >= 0)
641 jacobian(local_eqn, local_unknown) +=
642 psif(l2) * interpolated_n[i2] * psif(l) * J *
W;
673 const unsigned& n_plot)
675 const unsigned el_dim = this->
dim();
686 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
692 for (
unsigned i = 0;
i < n_dim;
i++)
694 for (
unsigned i = 0;
i < n_velocity;
i++)
698 outfile << 0.0 <<
"\n";
712 const unsigned el_dim = this->
dim();
723 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
729 for (
unsigned i = 0;
i < n_dim;
i++)
735 for (
unsigned i = 0;
i < n_velocity;
i++)
741 fprintf(file_pt,
"%g \n", 0.0);
743 fprintf(file_pt,
"\n");
765 const unsigned n_shape = psi.
nindex1();
766 const unsigned n_dim = 2;
770 double a11 = interpolated_t(0, 0) * interpolated_t(0, 0) +
771 interpolated_t(0, 1) * interpolated_t(0, 1);
774 for (
unsigned l = 0; l < n_shape; l++)
776 for (
unsigned i = 0;
i < n_dim;
i++)
778 dpsidS(l,
i) = dpsids(l, 0) * interpolated_t(0,
i) / a11;
807 const unsigned n_shape = psi.
nindex1();
808 const unsigned n_dim = 2;
812 double a11 = interpolated_t(0, 0) * interpolated_t(0, 0) +
813 interpolated_t(0, 1) * interpolated_t(0, 1);
816 for (
unsigned l = 0; l < n_shape; l++)
818 for (
unsigned i = 0;
i < n_dim;
i++)
820 dpsidS(l,
i) = dpsids(l, 0) * interpolated_t(0,
i) / a11;
822 dpsidS_div(l,
i) = dpsidS(l,
i);
826 const double r = interpolated_x[0];
830 for (
unsigned l = 0; l < n_shape; l++)
832 dpsidS_div(l, 0) += psi(l) / r;
836 return r * sqrt(a11);
855 const unsigned n_shape = psi.
nindex1();
856 const unsigned n_dim = 3;
861 for (
unsigned al = 0; al < 2; al++)
863 for (
unsigned be = 0; be < 2; be++)
868 for (
unsigned i = 0;
i < n_dim;
i++)
870 amet[al][be] += interpolated_t(al,
i) * interpolated_t(be,
i);
876 double det_a = amet[0][0] * amet[1][1] - amet[0][1] * amet[1][0];
879 aup[0][0] = amet[1][1] / det_a;
880 aup[0][1] = -amet[0][1] / det_a;
881 aup[1][0] = -amet[1][0] / det_a;
882 aup[1][1] = amet[0][0] / det_a;
886 for (
unsigned l = 0; l < n_shape; l++)
889 const double dpsi_temp[2] = {
890 aup[0][0] * dpsids(l, 0) + aup[0][1] * dpsids(l, 1),
891 aup[1][0] * dpsids(l, 0) + aup[1][1] * dpsids(l, 1)};
893 for (
unsigned i = 0;
i < n_dim;
i++)
895 dpsidS(l,
i) = dpsi_temp[0] * interpolated_t(0,
i) +
896 dpsi_temp[1] * interpolated_t(1,
i);
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
Vector< unsigned > Bulk_node_number
List of indices of the local node numbers in the "bulk" element that correspond to the local node num...
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
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...
void get_local_coordinate_in_bulk(const Vector< double > &s, Vector< double > &s_bulk) const
Calculate the vector of local coordinate in the bulk element given the local coordinates in this Face...
A general Finite Element class.
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...
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
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 ...
virtual void dshape_local(const Vector< double > &s, Shape &psi, DShape &dpsids) const
Function to compute the geometric shape functions and derivatives w.r.t. local coordinates at local c...
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
double dnodal_position_dt(const unsigned &n, const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt at local node n.
Vector< unsigned > U_index_interface_boundary
Index at which the i-th velocity component is stored in the element's nodes.
virtual int kinematic_local_eqn(const unsigned &n)=0
Function that is used to determine the local equation number of the kinematic equation associated wit...
void wall_unit_normal(const Vector< double > &x, Vector< double > &normal)
Function that returns the unit normal of the bounding wall directed out of the fluid.
double * Contact_angle_pt
Pointer to the desired value of the contact angle (if any)
virtual void add_additional_residual_contributions_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const Vector< double > &interpolated_n, const double &W)
Empty helper function to calculate the additional contributions arising from the node update strategy...
double & contact_angle()
Return value of the contact angle.
void set_contact_angle(double *const &angle_pt, const bool &strong=true)
Set a pointer to the desired contact angle. Optional boolean (defaults to true) chooses strong imposi...
double ca()
Return the value of the capillary number.
unsigned Contact_angle_flag
Flag used to determine whether the contact angle is to be used (0 if not), and whether it will be app...
Base class establishing common interfaces and functions for all Navier-Stokes-like fluid interface el...
virtual double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &dpsidS, DShape &dpsidS_div)=0
Compute the surface gradient and surface divergence operators given the shape functions,...
virtual void add_additional_residual_contributions_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const DShape &dpsifdS, const DShape &dpsifdS_div, const Vector< double > &s, const Vector< double > &interpolated_x, const Vector< double > &interpolated_n, const double &W, const double &J)
Helper function to calculate the additional contributions to the resisuals and Jacobian that arise fr...
const double & st() const
The value of the Strouhal number.
double u(const unsigned &j, const unsigned &i)
Return the i-th velocity component at local node j.
virtual int kinematic_local_eqn(const unsigned &n)=0
Access function that returns the local equation number for the (scalar) kinematic equation associated...
Vector< unsigned > U_index_interface
Nodal index at which the i-th velocity component is stored.
double pext() const
Return the value of the external pressure.
virtual double sigma(const Vector< double > &s_local)
Virtual function that specifies the non-dimensional surface tension as a function of local position w...
double interpolated_u(const Vector< double > &s, const unsigned &i)
Calculate the i-th velocity component at the local coordinate s.
Data * Pext_data_pt
Pointer to the Data item that stores the external pressure.
void output(std::ostream &outfile)
Overload the output function.
const double & ca() const
The value of the Capillary number.
int pext_local_eqn()
Access function for the local equation number that corresponds to the external pressure.
static double Default_Physical_Constant_Value
Default value for physical constants.
virtual void fill_in_generic_residual_contribution_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Helper function to calculate the residuals and (if flag==1) the Jacobian of the equations....
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.
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
void fill_in_generic_residual_contribution_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Overload the helper function to calculate the residuals and (if flag==true) the Jacobian – this funct...
void fill_in_generic_residual_contribution_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Overload the helper function to calculate the residuals and (if flag==1) the Jacobian – this function...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
unsigned nindex1() const
Return the range of index 1 of the shape function object.
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
double dot(const Vector< double > &a, const Vector< double > &b)
Probably not always best/fastest because not optimised for dimension but useful...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...