30 #ifndef OOMPH_POLAR_FLUID_TRACTION_ELEMENTS_HEADER
31 #define OOMPH_POLAR_FLUID_TRACTION_ELEMENTS_HEADER
40 #include "../generic/Qelements.h"
51 template<
class ELEMENT>
70 virtual inline int u_local_eqn(
const unsigned& n,
const unsigned&
i)
82 unsigned n_node =
nnode();
86 for (
unsigned i = 0;
i < n_node;
i++)
104 for (
unsigned i = 0;
i <
Dim;
i++)
112 (*Traction_fct_pt)(time,
x, result);
203 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(element_pt);
205 if (elem_pt->dim() == 3)
214 throw OomphLibError(
"This flux element will not work correctly "
215 "if nodes are hanging\n",
216 OOMPH_CURRENT_FUNCTION,
217 OOMPH_EXCEPTION_LOCATION);
287 void output(std::ostream& outfile,
const unsigned& nplot)
293 double u(
const unsigned& l,
const unsigned&
i)
299 double x(
const unsigned& l,
const unsigned&
i)
315 template<
class ELEMENT>
323 unsigned n_node = nnode();
326 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
329 Shape psif(n_node), testf(n_node);
332 unsigned n_intpt = integral_pt()->nweight();
335 const double Alpha = alpha();
343 const int multiplier = boundary();
346 const double eta = get_eta();
349 int local_eqn = 0, local_unknown = 0, pext_local_eqn = 0,
350 pext_local_unknown = 0;
358 if (Pext_data_pt == 0)
365 pext_local_eqn = external_local_eqn(External_data_number_of_Pext, 0);
368 pext = Pext_data_pt->
value(0);
372 pext_local_unknown = pext_local_eqn;
377 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
380 double w = integral_pt()->weight(ipt);
384 double J = shape_and_test_at_knot(ipt, psif, testf);
394 for (
unsigned i = 0;
i <
Dim;
i++)
396 interpolated_x[
i] = 0.0;
397 interpolated_u[
i] = 0.0;
402 for (
unsigned l = 0; l < n_node; l++)
405 for (
unsigned i = 0;
i <
Dim;
i++)
408 interpolated_u[
i] += this->nodal_value(l,
i) * psif[l];
409 interpolated_x[
i] += this->nodal_position(l,
i) * psif[l];
415 get_traction(time, interpolated_x, traction);
420 for (
unsigned l = 0; l < n_node; l++)
425 local_eqn = u_local_eqn(l,
i);
430 residuals[local_eqn] -= multiplier * eta * 3.0 *
431 (interpolated_u[
i] / interpolated_x[0]) *
432 testf[l] * interpolated_x[0] * Alpha *
W;
438 residuals[local_eqn] +=
439 pext * testf[l] * interpolated_x[0] * Alpha *
W;
447 for (
unsigned l2 = 0; l2 < n_node; l2++)
453 local_unknown = u_local_eqn(l2, i2);
454 if (local_unknown >= 0)
457 jacobian(local_eqn, local_unknown) -=
458 multiplier * eta * 3.0 * (psif[l2] / interpolated_x[0]) *
459 testf[l] * interpolated_x[0] * Alpha *
W;
469 if (pext_local_unknown >= 0)
472 jacobian(local_eqn, pext_local_unknown) +=
473 testf[l] * interpolated_x[0] * Alpha *
W;
492 if (pext_local_eqn >= 0)
495 residuals[pext_local_eqn] +=
496 interpolated_u[0] * interpolated_x[0] * Alpha *
W;
509 for (
unsigned l2 = 0; l2 < n_node; l2++)
515 local_unknown = u_local_eqn(l2, i2);
516 if (local_unknown >= 0)
519 jacobian(pext_local_eqn, local_unknown) +=
520 psif[l2] * interpolated_x[0] * Alpha *
W;
A class that represents a collection of data; each Data object may contain many different individual ...
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
double J_eulerian_at_knot(const unsigned &ipt) const
Return the Jacobian of the mapping from local to global coordinates at the ipt-th integration point O...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
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 nnode() const
Return the number of nodes.
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 build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
bool has_hanging_nodes() const
Return boolean to indicate if any of the element's nodes are geometrically hanging.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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....
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
An OomphLibError object which should be thrown when an run-time error is encountered....
A class for elements that allow the imposition of an applied traction to the Navier–Stokes equations ...
void output(std::ostream &outfile)
Overload the output function.
const int boundary() const
Boundary.
void get_traction(double time, const Vector< double > &x, Vector< double > &result)
Function to calculate the traction applied to the fluid.
double * Alpha_pt
Pointer to the angle alpha.
~PolarNavierStokesTractionElement()
Destructor should not delete anything.
PolarNavierStokesTractionElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of the index and its limit.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals and the jacobian.
void(*&)(const double &t, const Vector< double > &x, Vector< double > &result) traction_fct_pt()
void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
This function returns the residuals for the traction function. flag=1(or 0): do (or don't) compute th...
unsigned External_data_number_of_Pext
The Data that contains the traded pressure is stored as external Data for the element....
void(* Traction_fct_pt)(const double &time, const Vector< double > &x, Vector< double > &result)
Pointer to an imposed traction function.
unsigned Dim
The highest dimension of the problem.
Data * Pext_data_pt
Pointer to the Data item that stores the external pressure.
const double get_eta() const
Eta.
double x(const unsigned &l, const unsigned &i)
local position
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping.
double u(const unsigned &l, const unsigned &i)
local velocities
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Compute the element's residual Vector and the jacobian matrix Plus the mass matrix especially for eig...
void set_external_pressure_data(Data *pext_data_pt)
Function for setting up external pressure.
void set_eta(double eta)
Function to set Eta.
void set_boundary(int bound)
Function to set boundary.
double *& alpha_pt()
Pointer to Alpha.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
This function returns just the residuals.
virtual int u_local_eqn(const unsigned &n, const unsigned &i)
Access function that returns the local equation numbers for velocity components. u_local_eqn(n,...
void output(std::ostream &outfile, const unsigned &nplot)
Output function: x,y,[z],u,v,[w],p in tecplot format.
const double & alpha() const
Alpha.
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
unsigned Dim
Dimension of zeta tuples (set by get_dim_helper) – needed because we store the scalar coordinates in ...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...