27 #ifndef OOMPH_NAVIER_STOKES_FLUX_CONTROL_ELEMENTS
28 #define OOMPH_NAVIER_STOKES_FLUX_CONTROL_ELEMENTS
32 #include <oomph-lib-config.h>
36 #include "../generic/nodes.h"
37 #include "../navier_stokes/navier_stokes_surface_power_elements.h"
111 double* prescribed_flux_value_pt)
128 for (
unsigned e = 0;
e < n_el;
e++)
205 std::ostringstream error_message;
206 error_message <<
"Dof_number_for_unknown hasn't been set yet!\n"
207 <<
"Please do so using the dof_number_for_unknown()\n"
208 <<
"access function\n";
210 OOMPH_CURRENT_FUNCTION,
211 OOMPH_EXCEPTION_LOCATION);
245 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
250 std::ostringstream error_message;
251 error_message <<
"Dof_number_for_unknown hasn't been set yet!\n"
252 <<
"Please do so using the dof_number_for_unknown()\n"
253 <<
"access function\n";
255 OOMPH_CURRENT_FUNCTION,
256 OOMPH_EXCEPTION_LOCATION);
261 std::pair<unsigned, unsigned> dof_lookup;
267 dof_lookup_list.push_front(dof_lookup);
277 double volume_flux = 0.0;
281 for (
unsigned e = 0;
e < n_el;
e++)
292 if (flux_control_el_pt == 0)
295 "NavierStokesFluxControlElements",
296 OOMPH_CURRENT_FUNCTION,
297 OOMPH_EXCEPTION_LOCATION);
347 template<
class ELEMENT>
357 const bool& called_from_refineable_constructor =
false)
363 if (!called_from_refineable_constructor)
365 ELEMENT* elem_pt =
new ELEMENT;
367 if (elem_pt->dim() == 3)
373 std::ostringstream error_message;
375 <<
"This element does not work properly with refineable bulk \n"
376 <<
"elements in 3D. Please use the refineable version\n"
379 OOMPH_CURRENT_FUNCTION,
380 OOMPH_EXCEPTION_LOCATION);
412 residuals, jacobian, 1);
439 unsigned n_node = this->
nnode();
443 for (
unsigned i = 0;
i < n_node;
i++)
460 unsigned n_node = this->
nnode();
463 Shape psif(n_node), testf(n_node);
475 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
493 for (
unsigned i = 0;
i <
Dim;
i++)
495 traction[
i] = -pressure * unit_normal[
i];
499 for (
unsigned l = 0; l < n_node; l++)
502 for (
unsigned i = 0;
i <
Dim;
i++)
510 residuals[local_eqn] += traction[
i] * testf[l] *
W;
524 if (local_unknown >= 0)
527 double jac_contribution = -unit_normal[
i] * testf[l] *
W;
528 jacobian(local_eqn, local_unknown) += jac_contribution;
531 jacobian(local_unknown, local_eqn) += jac_contribution;
562 template<
class ELEMENT>
606 residuals, jacobian, 1);
618 unsigned u_nodal_index[this->
Dim];
619 for (
unsigned i = 0;
i < this->
Dim;
i++)
629 unsigned n_node = this->
nnode();
632 Shape psif(n_node), testf(n_node);
645 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
663 for (
unsigned i = 0;
i < this->
Dim;
i++)
665 traction[
i] = -pressure * unit_normal[
i];
671 unsigned n_master = 1;
672 double hang_weight = 1.0;
676 for (
unsigned l = 0; l < n_node; l++)
687 n_master = hang_info_pt->
nmaster();
696 for (
unsigned m = 0; m < n_master; m++)
699 for (
unsigned i = 0;
i < this->
Dim;
i++)
725 residuals[local_eqn] +=
726 traction[
i] * testf[l] *
W * hang_weight;
740 if (local_unknown >= 0)
743 double jac_contribution =
744 -unit_normal[
i] * testf[l] *
W * hang_weight;
745 jacobian(local_eqn, local_unknown) += jac_contribution;
748 jacobian(local_unknown, local_eqn) += jac_contribution;
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 ...
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
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 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.
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.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
A Generalised Element class.
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 long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
int external_local_eqn(const unsigned &i, const unsigned &j)
Return the local equation number corresponding to the j-th value stored at the i-th external data.
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....
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.
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.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
double get_volume_flux()
Function to get the integral of the volume flux.
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.
~NavierStokesFluxControlElement()
Destructor should not delete anything.
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 the...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals and the Jacobian including the Jacobian contribution from the flu...
unsigned Dim
The highest dimension of the problem.
NavierStokesFluxControlElement(FiniteElement *const &element_pt, const int &face_index, const bool &called_from_refineable_constructor=false)
Constructor, which takes a "bulk" element and face index.
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 fill_in_contribution_to_residuals(Vector< double > &residuals)
This function returns just the residuals.
A class of elements that allow the determination of the power input and various other fluxes over the...
double get_volume_flux()
Get integral of volume flux.
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector: i.e. the flux constraint.
unsigned ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into - it's set to ...
void fill_in_generic_residual_contribution_flux_control(Vector< double > &residuals)
This function returns the residuals for the flux control master element.
unsigned Dim
spatial dim of NS system
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
Mesh * Flux_control_mesh_pt
Mesh of elements which impose the pressure which controls the net flux.
unsigned & dof_number_for_unknown()
Function to set / get the nodal value of the "DOF type" to which the degree of freedom in this elemen...
~NetFluxControlElement()
Empty Destructor - Data gets deleted automatically.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals, but adds nothing to the Jacobian as this element's Jacobian cont...
unsigned Dof_number_for_unknown
The id number of the "DOF type" to which the degree of freedom in this element is added to....
NetFluxControlElement(const NetFluxControlElement &dummy)=delete
Broken copy constructor.
NetFluxControlElement(Mesh *flux_control_mesh_pt, double *prescribed_flux_value_pt)
Constructor takes a mesh of TemplateFreeNavierStokesFluxControlElementBase elements that impose the p...
Data * pressure_data_pt() const
Function to return a pointer to the Data object whose single value is the pressure applied by the Nav...
unsigned dim() const
Broken assignment operator.
Data * Pressure_data_pt
Data object whose single value is the pressure applied by the elements in the Flux_control_mesh_pt.
double * Prescribed_flux_value_pt
Pointer to the value that stores the prescribed flux.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
bool is_hanging() const
Test whether the node is geometrically hanging.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
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 ...
int local_hang_eqn(Node *const &node_pt, const unsigned &i)
Access function that returns the local equation number for the hanging node variables (values stored ...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values are the same as those in the bulk element.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
This function returns the residuals and the Jacobian including the Jacobian contribution from the flu...
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 the...
~RefineableNavierStokesFluxControlElement()
Destructor should not delete anything.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
This function returns just the residuals.
RefineableNavierStokesFluxControlElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the face index.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
virtual double get_volume_flux()=0
Pure virtual function to calculate integral of the volume flux.
TemplateFreeNavierStokesFluxControlElementBase()
Empty constructor.
virtual ~TemplateFreeNavierStokesFluxControlElementBase()
Empty virtual destructor.
void add_pressure_data(Data *pressure_data_pt)
Function adds to the external data the Data object whose single value is the pressure applied by the ...
unsigned & pressure_data_id()
Access function gives id of external Data object whose single value is the pressure applied by the el...
unsigned Pressure_data_id
Id of external Data object whose single value is the pressure applied by the elements.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...