27 #ifndef OOMPH_YOUNGLAPLACE_ELEMENTS_HEADER
28 #define OOMPH_YOUNGLAPLACE_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
38 #include "../generic/nodes.h"
39 #include "../generic/Qelements.h"
84 virtual inline double u(
const unsigned& n)
const
98 void output(std::ostream& outfile,
const unsigned& n_plot);
103 const unsigned& n_plot,
111 std::ostream& outfile,
112 const unsigned& n_plot,
116 throw OomphLibError(
"These equations are steady => no time dependence",
117 OOMPH_CURRENT_FUNCTION,
118 OOMPH_EXCEPTION_LOCATION);
135 throw OomphLibError(
"These equations are steady => no time dependence",
136 OOMPH_CURRENT_FUNCTION,
137 OOMPH_EXCEPTION_LOCATION);
178 OOMPH_CURRENT_FUNCTION,
179 OOMPH_EXCEPTION_LOCATION);
211 unsigned n_node =
nnode();
221 for (
unsigned j = 0; j < 2; j++)
227 for (
unsigned l = 0; l < n_node; l++)
230 for (
unsigned j = 0; j < 2; j++)
232 flux[j] +=
u(l) * dpsidx(l, j);
250 for (
unsigned i = 0;
i < 3;
i++)
252 spine_base[
i] = x[
i];
253 for (
unsigned j = 0; j < 2; j++)
255 dspine_base[
i][j] = 0.0;
262 (*Spine_base_fct_pt)(x, spine_base, dspine_base);
278 for (
unsigned i = 0;
i < 3;
i++)
281 for (
unsigned j = 0; j < 2; j++)
292 (*Spine_fct_pt)(x, spine, dspine);
312 unsigned n_node =
nnode();
324 for (
unsigned l = 0; l < n_node; l++)
344 for (
unsigned i = 0;
i < n_rows;
i++)
347 for (
unsigned j = 0; j < n_cols; j++)
359 unsigned n = v.size();
360 for (
unsigned i = 0;
i < n;
i++)
362 lambda_times_v[
i] = lambda * v[
i];
371 unsigned n = v.size();
372 for (
unsigned i = 0;
i < n;
i++)
385 unsigned n = v1.size();
386 for (
unsigned i = 0;
i < n;
i++)
388 scalar += v1[
i] * v2[
i];
399 if ((v1.size() != v2.size()) || (v1.size() != 3))
401 throw OomphLibError(
"Vectors must be of dimension 3 for cross-product!",
402 OOMPH_CURRENT_FUNCTION,
403 OOMPH_EXCEPTION_LOCATION);
406 v_cross[0] = v1[1] * v2[2] - v1[2] * v2[1];
407 v_cross[1] = v1[2] * v2[0] - v1[0] * v2[2];
408 v_cross[2] = v1[0] * v2[1] - v1[1] * v2[0];
416 unsigned n = v1.size();
417 for (
unsigned i = 0;
i < n;
i++)
419 vs[
i] = v1[
i] + v2[
i];
459 template<
unsigned NNODE_1D>
494 void output(std::ostream& outfile,
const unsigned& n_plot)
502 const unsigned& n_plot,
512 const unsigned& n_plot,
532 template<
unsigned NNODE_1D>
534 :
public virtual QElement<1, NNODE_1D>
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 ...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
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 ...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
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 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 nnode() const
Return the number of nodes.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
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 ...
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Return the local equation number corresponding to the j-th value stored at the i-th internal 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....
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
void assign_additional_local_eqn_numbers()
Setup local equation number for the height-control equation.
unsigned Curvature_data_index
In which component (in the vector of the element's internal Data) is the unknown curvature stored?
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector: The height constraint. [Note: Jacobian is comp...
Node * Control_node_pt
Pointer to node at which the height is controlled.
double * Prescribed_height_pt
Pointer to value that stores the controlled height.
HeightControlElement(Node *control_node_pt, double *prescribed_height_pt)
Constructor: Pass pointer to node at which the height is controlled and pointer to double that stores...
Data *& kappa_pt()
Access function to the pointer to the Data object that stores the curvature.
unsigned Height_ctrl_local_eqn
Local equation number of the height-control equation.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double value(const unsigned &i) const
Return i-th value (dofs or pinned) at this node either directly or via hanging node representation....
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
QYoungLaplaceElement()
Constructor: Call constructors for QElement and YoungLaplace equations.
QYoungLaplaceElement(const QYoungLaplaceElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function at n_plot^2 plot points.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solutio at n_plot^2 plot points.
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
void operator=(const QYoungLaplaceElement< NNODE_1D > &)=delete
Broken assignment operator.
unsigned required_nvalue(const unsigned &n) const
Required # of ‘values’ (pinned or dofs) at node n.
void output(std::ostream &outfile)
Output function.
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution at n_plot^2 plot points (calls the steady version...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
A class for all isoparametric elements that solve the YoungLaplace equations.
SpineBaseFctPt & spine_base_fct_pt()
Access function to function pointer that specifies spine base vector field.
static double two_norm(const Vector< double > &v)
2-norm of a vector
static void scalar_times_vector(const double &lambda, const Vector< double > &v, Vector< double > &lambda_times_v)
Multiply a vector by a scalar.
void(* SpineBaseFctPt)(const Vector< double > &x, Vector< double > &spine_base, Vector< Vector< double >> &dspine_base)
Function pointer to "spine base" function.
void set_kappa(Data *kappa_pt)
Set curvature data (and add it to the element's external Data)
static double scalar_product(const Vector< double > &v1, const Vector< double > &v2)
Scalar product between two vectors.
double interpolated_u(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
virtual void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output exact soln at n_plot^2 plot points (dummy time-dependent version to keep intel compiler happy)
unsigned self_test()
Self-test: Return 0 for OK.
static void allocate_vector_of_vectors(unsigned n_rows, unsigned n_cols, Vector< Vector< double >> &v)
Helper fct: Allocate storage for a vector of vectors of doubles to v(n_rows,n_cols) and initialise ea...
virtual int u_local_eqn(const unsigned &n)
Get the local equation number of the (one and only) unknown stored at local node n (returns -1 if val...
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln at n_plot^2 plot points.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
SpineFctPt & spine_fct_pt()
Access function to function pointer that specifies spine vector field.
void output(std::ostream &outfile)
Output with default number of plot points.
void exact_position(const Vector< double > &s, Vector< double > &r, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Get exact position vector to meniscus at local coordinate s.
void(* SpineFctPt)(const Vector< double > &x, Vector< double > &spine, Vector< Vector< double >> &dspine)
Function pointer to "spine" function.
YoungLaplaceEquations()
Constructor: Initialise pointers to NULL, so by default prescribed kappa evaluates to zero,...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
virtual void get_spine_base(const Vector< double > &x, Vector< double > &spine_base, Vector< Vector< double >> &dspine_base) const
Get spine base vector field: Defaults to standard cartesian representation if no spine base fct point...
virtual double u(const unsigned &n) const
Access function: Nodal function value at local node n Uses suitably interpolated value for hanging no...
double get_kappa() const
Get curvature.
void get_spine(const Vector< double > &x, Vector< double > &spine, Vector< Vector< double >> &dspine) const
Get spine vector field: Defaults to standard cartesian representation if no spine base fct pointers h...
bool use_spines() const
Use spines or not? (Based on availability of function pointers to to spine and spine base vector fiel...
void position(const Vector< double > &s, Vector< double > &r) const
Get position vector to meniscus at local coordinate s.
unsigned Kappa_index
Index of Kappa_pt in the element's storage of external Data.
static void cross_product(const Vector< double > &v1, const Vector< double > &v2, Vector< double > &v_cross)
Cross-product: v_cross= v1 x v2.
Data * Kappa_pt
Pointer to Data item that stores kappa as its first value – private to ensure that it must be set wit...
SpineFctPt Spine_fct_pt
Pointer to spine function:
void operator=(const YoungLaplaceEquations &)=delete
Broken assignment operator.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i: Mainly used for error estimation.
SpineBaseFctPt Spine_base_fct_pt
Pointer to spine base function:
Data * kappa_pt()
Access function: Pointer Data object that stores kappa (const version – kappa must be set with set_ka...
YoungLaplaceEquations(const YoungLaplaceEquations &dummy)=delete
Broken copy constructor.
static void vector_sum(const Vector< double > &v1, const Vector< double > &v2, Vector< double > &vs)
Vectorial sum of two vectors.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...