31 #ifndef OOMPH_YOUNGLAPLACE_ELEMENTS_HEADER 32 #define OOMPH_YOUNGLAPLACE_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 42 #include "../generic/nodes.h" 43 #include "../generic/Qelements.h" 105 virtual inline double u(
const unsigned& n)
const 117 void output(std::ostream &outfile,
const unsigned &n_plot);
121 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
128 virtual void output_fct(std::ostream &outfile,
const unsigned &n_plot,
132 throw OomphLibError(
"These equations are steady => no time dependence",
133 OOMPH_CURRENT_FUNCTION,
134 OOMPH_EXCEPTION_LOCATION);
141 double& error,
double& norm);
146 const double& time,
double& error,
double& norm)
148 throw OomphLibError(
"These equations are steady => no time dependence",
149 OOMPH_CURRENT_FUNCTION,
150 OOMPH_EXCEPTION_LOCATION);
179 if (kappa_pt->
nvalue()!=1)
182 OOMPH_CURRENT_FUNCTION,
183 OOMPH_EXCEPTION_LOCATION);
215 unsigned n_node =
nnode();
225 for(
unsigned j=0;j<2;j++)
231 for(
unsigned l=0;l<n_node;l++)
234 for(
unsigned j=0;j<2;j++)
236 flux[j] +=
u(l)*dpsidx(l,j);
254 for (
unsigned i=0;
i<3;
i++)
257 for (
unsigned j=0;j<2;j++)
259 dspine_base[
i][j]=0.0;
266 (*Spine_base_fct_pt)(x,spine_base,dspine_base);
282 for (
unsigned i=0;
i<3;
i++)
285 for (
unsigned j=0; j<2; j++)
296 (*Spine_fct_pt)(x,spine,dspine);
316 unsigned n_node =
nnode();
328 for(
unsigned l=0;l<n_node;l++)
330 interpolated_u+=
u(l)*psi[l];
333 return(interpolated_u);
348 for (
unsigned i=0;
i<n_rows;
i++)
351 for (
unsigned j=0; j<n_cols; j++)
365 for (
unsigned i=0;
i<n;
i++)
367 lambda_times_v[
i] = lambda*v[
i];
378 for (
unsigned i=0;
i<n;
i++)
391 unsigned n=v1.size();
392 for (
unsigned i=0;
i<n;
i++)
394 scalar += v1[
i]*v2[
i];
405 if ( (v1.size() != v2.size()) || (v1.size()!=3) )
408 throw OomphLibError(
"Vectors must be of dimension 3 for cross-product!",
409 OOMPH_CURRENT_FUNCTION,
410 OOMPH_EXCEPTION_LOCATION);
413 v_cross[0]=v1[1]*v2[2]-v1[2]*v2[1];
414 v_cross[1]=v1[2]*v2[0]-v1[0]*v2[2];
415 v_cross[2]=v1[0]*v2[1]-v1[1]*v2[0];
424 unsigned n=v1.size();
425 for (
unsigned i=0;
i<n;
i++)
473 template <
unsigned NNODE_1D>
482 static const unsigned Initial_Nvalue[];
508 {
return Initial_Nvalue[n];}
516 void output(std::ostream &outfile,
const unsigned &n_plot)
521 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
528 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
549 template<
unsigned NNODE_1D>
588 Prescribed_height_pt=prescribed_height_pt;
591 Control_node_pt=control_node_pt;
627 residuals[Height_ctrl_local_eqn]=
628 Control_node_pt->value(0)-(*Prescribed_height_pt);
A Generalised Element class.
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 ...
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...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void assign_additional_local_eqn_numbers()
Setup local equation number for the height-control equation.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i: Mainly used for error estimation.
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.
SpineBaseFctPt & spine_base_fct_pt()
Access function to function pointer that specifies spine base vector field.
Data * kappa_pt()
Access function: Pointer Data object that stores kappa (const version – kappa must be set with set_k...
YoungLaplaceEquations(const YoungLaplaceEquations &dummy)
Broken copy constructor.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
Data *& kappa_pt()
Access function to the pointer to the Data object that stores the curvature.
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)...
A general Finite Element class.
unsigned Height_ctrl_local_eqn
Local equation number of 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 output(std::ostream &outfile)
Output function.
double * Prescribed_height_pt
Pointer to value that stores the controlled height.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void operator=(const YoungLaplaceEquations &)
Broken assignment operator.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
unsigned self_test()
Self-test: Return 0 for OK.
unsigned required_nvalue(const unsigned &n) const
Required # of `values' (pinned or dofs) at node n.
Data * Kappa_pt
Pointer to Data item that stores kappa as its first value – private to ensure that it must be set wi...
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
void(* SpineBaseFctPt)(const Vector< double > &x, Vector< double > &spine_base, Vector< Vector< double > > &dspine_base)
Function pointer to "spine base" function.
SpineFctPt & spine_fct_pt()
Access function to function pointer that specifies spine vector field.
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...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
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...
void output(std::ostream &outfile)
Output with default number of plot points.
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 output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln at n_plot^2 plot points.
unsigned Kappa_index
Index of Kappa_pt in the element's storage of external Data.
QYoungLaplaceElement(const QYoungLaplaceElement< NNODE_1D > &dummy)
Broken copy constructor.
static void scalar_times_vector(const double &lambda, const Vector< double > &v, Vector< double > &lambda_times_v)
Multiply a vector by a scalar.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
static void cross_product(const Vector< double > &v1, const Vector< double > &v2, Vector< double > &v_cross)
Cross-product: v_cross= v1 x v2.
A class that represents a collection of data; each Data object may contain many different individual ...
Node * Control_node_pt
Pointer to node at which the height is controlled.
void(* SpineFctPt)(const Vector< double > &x, Vector< double > &spine, Vector< Vector< double > > &dspine)
Function pointer to "spine" function.
static double scalar_product(const Vector< double > &v1, const Vector< double > &v2)
Scalar product between two vectors.
virtual double u(const unsigned &n) const
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...
static void vector_sum(const Vector< double > &v1, const Vector< double > &v2, Vector< double > &vs)
Vectorial sum of two vectors.
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
double interpolated_u(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
bool use_spines() const
Use spines or not? (Based on availability of function pointers to to spine and spine base vector fiel...
double get_kappa() const
Get curvature.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
HeightControlElement(Node *control_node_pt, double *prescribed_height_pt)
QYoungLaplaceElement()
Constructor: Call constructors for QElement and YoungLaplace equations.
SpineBaseFctPt Spine_base_fct_pt
Pointer to spine base function:
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...
static double two_norm(const Vector< double > &v)
2-norm of a vector
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 ...
void operator=(const QYoungLaplaceElement< NNODE_1D > &)
Broken assignment operator.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
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.
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...
void set_kappa(Data *kappa_pt)
Set curvature data (and add it to the element's external Data)
unsigned nnode() const
Return the number of nodes.
SpineFctPt Spine_fct_pt
Pointer to spine function:
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...
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...
void position(const Vector< double > &s, Vector< double > &r) const
Get position vector to meniscus at local coordinate s.
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...
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...