30 #ifndef OOMPH_FLUID_TRACTION_ELEMENTS_HEADER
31 #define OOMPH_FLUID_TRACTION_ELEMENTS_HEADER
35 #include <oomph-lib-config.h>
40 #include "../generic/Qelements.h"
41 #include "../generic/Telements.h"
52 template<
class ELEMENT>
69 const unsigned&
i)
const
79 virtual inline int u_local_eqn(
const unsigned& n,
const unsigned&
i)
91 unsigned n_node =
nnode();
95 for (
unsigned i = 0;
i < n_node;
i++)
114 for (
unsigned i = 0;
i <
Dim;
i++)
122 (*Traction_fct_pt)(time, x, n, result);
142 const bool& called_from_refineable_constructor =
false)
152 if (!called_from_refineable_constructor)
155 if (element_pt->
dim() == 3)
164 throw OomphLibError(
"This flux element will not work correctly "
165 "if nodes are hanging\n",
166 OOMPH_CURRENT_FUNCTION,
167 OOMPH_EXCEPTION_LOCATION);
209 residuals, jacobian, 1);
219 void output(std::ostream& outfile,
const unsigned& nplot)
235 template<
class ELEMENT>
241 unsigned n_node = nnode();
244 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
247 Shape psif(n_node), testf(n_node);
250 unsigned n_intpt = integral_pt()->nweight();
256 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
259 double w = integral_pt()->weight(ipt);
263 double J = shape_and_test_at_knot(ipt, psif, testf);
272 for (
unsigned i = 0;
i <
Dim;
i++)
274 interpolated_x[
i] = 0.0;
278 for (
unsigned l = 0; l < n_node; l++)
281 for (
unsigned i = 0;
i <
Dim;
i++)
283 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
289 outer_unit_normal(ipt, interpolated_n);
293 get_traction(time, interpolated_x, interpolated_n, traction);
298 for (
unsigned l = 0; l < n_node; l++)
301 for (
unsigned i = 0;
i <
Dim;
i++)
303 local_eqn = u_local_eqn(l,
i);
308 residuals[local_eqn] += traction[
i] * testf[l] *
W;
334 template<
class ELEMENT>
374 residuals, jacobian, 1);
396 template<
class ELEMENT>
402 unsigned u_nodal_index[this->
Dim];
403 for (
unsigned i = 0;
i < this->
Dim;
i++)
406 dynamic_cast<ELEMENT*
>(this->bulk_element_pt())->u_index_nst(
i);
410 unsigned n_node = nnode();
413 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
416 Shape psif(n_node), testf(n_node);
419 unsigned n_intpt = integral_pt()->nweight();
425 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
428 double w = integral_pt()->weight(ipt);
432 double J = this->shape_and_test_at_knot(ipt, psif, testf);
441 for (
unsigned i = 0;
i < this->
Dim;
i++)
443 interpolated_x[
i] = 0.0;
447 for (
unsigned l = 0; l < n_node; l++)
450 for (
unsigned i = 0;
i < this->
Dim;
i++)
452 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
458 this->outer_unit_normal(ipt, interpolated_n);
462 this->get_traction(time, interpolated_x, interpolated_n, traction);
467 unsigned n_master = 1;
468 double hang_weight = 1.0;
475 for (
unsigned l = 0; l < n_node; l++)
478 bool is_node_hanging = this->node_pt(l)->is_hanging();
483 hang_info_pt = this->node_pt(l)->hanging_pt();
486 n_master = hang_info_pt->
nmaster();
495 for (
unsigned m = 0; m < n_master; m++)
498 for (
unsigned i = 0;
i < this->
Dim;
i++)
514 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
536 residuals[local_eqn] += traction[
i] * testf[l] *
W * hang_weight;
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 zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
In a FaceElement, the "global" intrinsic coordinate of the element along the boundary,...
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" 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.
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 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.
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...
Class that contains data for hanging nodes.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
A class for elements that allow the imposition of an applied traction to the Navier–Stokes equations ...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
This function returns just the residuals.
void output(std::ostream &outfile)
Overload the output function.
void(* Traction_fct_pt)(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &result)
Pointer to an imposed traction function.
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.
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(*&)(const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &result) traction_fct_pt()
void fill_in_generic_residual_contribution_fluid_traction(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
This function returns the residuals for the traction function. flag=1(or 0): do (or don't) compute th...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals and the jacobian.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
unsigned Dim
The highest dimension of the problem.
void output(std::ostream &outfile, const unsigned &nplot)
Output function: x,y,[z],u,v,[w],p in tecplot format.
~NavierStokesTractionElement()
Destructor should not delete anything.
void get_traction(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &result)
Function to calculate the traction applied to the fluid.
NavierStokesTractionElement(FiniteElement *const &element_pt, const int &face_index, const bool &called_from_refineable_constructor=false)
Constructor, which takes a "bulk" element and the value of the index and its limit.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
An OomphLibError object which should be thrown when an run-time error is encountered....
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
void refineable_fill_in_generic_residual_contribution_fluid_traction(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
This function returns the residuals for the traction function. flag=1(or 0): do (or don't) compute th...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals and the Jacobian.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
This function returns just the residuals.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values are the same as those in the bulk element.
RefineableNavierStokesTractionElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the face index.
~RefineableNavierStokesTractionElement()
Destructor should not delete anything.
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 ...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...