28#ifndef OOMPH_VORTICITY_SMOOTHER_HEADER
29#define OOMPH_VORTICITY_SMOOTHER_HEADER
33#include <oomph-lib-config.h>
46 namespace VorticityRecoveryHelpers
89 "Invalid input value! Should be between -1 and 3!",
111 throw OomphLibError(
"Invalid input value! Should be between 0 and 3!",
177 for (
unsigned i = 0;
i <
k; ++
i)
222 template<
class ELEMENT>
247 .maximum_order_of_vorticity_derivative();
252 .maximum_order_of_velocity_derivative();
316 const unsigned&
i)
const
330 "Not recovering anything so this shouldn't be called.",
438 <<
"with a vorticity or velocity derivative!"
461 const unsigned&
i)
const
467 unsigned derivative_index =
i;
530 <<
"Something's wrong!";
558 std::pair<unsigned, unsigned>
id =
666 unsigned n_terms = 0;
686 unsigned n_terms = 0;
773 unsigned n_node = this->nnode();
779 this->shape(
s,
psif);
782 for (
unsigned i = 0;
i <
N_dim;
i++)
797 values[
N_dim] = this->interpolated_p_nst(
s);
804 unsigned nnod = this->nnode();
807 for (
unsigned j = 0;
j <
nnod;
j++)
826 const unsigned&
nplot)
835 unsigned n_node = this->nnode();
857 for (
unsigned i = 0;
i <
N_dim;
i++)
860 x[
i] = this->interpolated_x(
s,
i);
908 unsigned n_node = this->nnode();
936 for (
unsigned i = 0;
i <
N_dim;
i++)
939 x[
i] = this->interpolated_x(
s,
i);
946 for (
unsigned i = 0;
i <
N_dim;
i++)
949 outfile << this->interpolated_u_nst(
s,
i) <<
" ";
953 outfile << this->interpolated_p_nst(
s) <<
" ";
997 const unsigned&
nplot)
const
1019 file_out << this->interpolated_u_nst(
s,
i) << std::endl;
1025 file_out << this->interpolated_p_nst(
s) << std::endl;
1034 std::pair<unsigned, unsigned>
id =
1048 error_stream <<
"These VorticitySmoother elements only store "
1050 <<
"but i is currently: " <<
i << std::endl;
1115 return "d^3/dx^2dy";
1118 return "d^3/dxdy^2";
1145 error_stream <<
"These Navier Stokes elements only store "
1147 <<
"but i is currently: " <<
i << std::endl;
1168 unsigned n_node = this->nnode();
1190 this->shape(
s,
psif);
1193 for (
unsigned i = 0;
i <
N_dim;
i++)
1196 x[
i] = this->interpolated_x(
s,
i);
1203 for (
unsigned i = 0;
i <
N_dim;
i++)
1206 outfile << this->interpolated_u_nst(
s,
i) <<
" ";
1210 outfile << this->interpolated_p_nst(
s) <<
" ";
1246 unsigned n_node = this->nnode();
1264 for (
unsigned j = 0;
j < 2;
j++)
1278 const unsigned& index)
const
1281 unsigned n_node = this->nnode();
1331 oomph_info <<
"Never get here!" << std::endl;
1341 unsigned n_node = this->nnode();
1359 for (
unsigned j = 0;
j < 2;
j++)
1371 const unsigned& index)
const
1374 unsigned n_node = this->nnode();
1410 oomph_info <<
"Never get here!" << std::endl;
1420 unsigned n_node = this->nnode();
1438 for (
unsigned j = 0;
j < 2;
j++)
1456 const unsigned& index)
const
1459 unsigned n_node = this->nnode();
1507 oomph_info <<
"Never get here!" << std::endl;
1518 unsigned n_node = this->nnode();
1558 const unsigned& index)
const
1561 unsigned n_node = this->nnode();
1619 oomph_info <<
"Never get here!" << std::endl;
1639 throw OomphLibError(
"Can't calculate this; not recovering enough data.",
1659 unsigned n_node = this->nnode();
1668 unsigned n_intpt = this->integral_pt()->nweight();
1683 s[
ii] = this->integral_pt()->knot(
ipt,
ii);
1687 this->interpolated_x(
s, x);
1690 double w = this->integral_pt()->weight(
ipt);
1744 unsigned n_node = this->nnode();
1750 this->shape(
s,
psif);
1835 template<
class ELEMENT>
1884 psi_r[3] = x[0] * x[0];
1885 psi_r[4] = x[0] * x[1];
1886 psi_r[5] = x[1] * x[1];
1894 psi_r[3] = x[0] * x[0];
1895 psi_r[4] = x[0] * x[1];
1896 psi_r[5] = x[1] * x[1];
1897 psi_r[6] = x[0] * x[0] * x[0];
1898 psi_r[7] = x[0] * x[0] * x[1];
1899 psi_r[8] = x[0] * x[1] * x[1];
1900 psi_r[9] = x[1] * x[1] * x[1];
1905 error_stream <<
"Recovery shape functions for recovery order "
1907 <<
" haven't yet been implemented for 2D" << std::endl;
1981 error_stream <<
"Recovery shape functions for recovery order "
1983 <<
" haven't yet been implemented for 2D" << std::endl;
2019 for (
unsigned e = 0;
e <
nelem;
e++)
2033 for (
unsigned n = 0;
n <
nnod;
n++)
2055 <<
"\n\n======================================================\n"
2058 <<
"\nhave different preferences for the order of the recovery"
2059 <<
"\nshape functions. We are using: Recovery_order="
2062 <<
"======================================================\n\n";
2068 for (
unsigned e = 0;
e <
nelem;
e++)
2082 vertex_node_pt.push_back(
nod_pt);
2089 for (
unsigned e = 0;
e <
nel;
e++)
2144 error_stream <<
"Not recovering anything. Change the maximum number "
2145 <<
"of derivatives to recover.";
2161 el_pt->get_maximum_order_of_recoverable_vorticity_derivative();
2165 el_pt->get_maximum_order_of_recoverable_velocity_derivative();
2224 <<
"Case order has not been set. Something's wrong!";
2261 for (
unsigned e = 0;
e <
nelem;
e++)
2279 for (
unsigned i = 0;
i < 2;
i++)
2317 el_pt->get_raw_vorticity_deriv(
2323 el_pt->get_raw_vorticity_second_deriv(
2329 el_pt->get_raw_vorticity_third_deriv(
2335 el_pt->get_raw_velocity_deriv(
2341 oomph_info <<
"Never get here." << std::endl;
2471 ELEMENT*
const el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt->
element_pt(0));
2474 unsigned smoothed_vorticity_index =
el_pt->smoothed_vorticity_index();
2478 el_pt->get_maximum_order_of_recoverable_vorticity_derivative();
2482 el_pt->get_maximum_order_of_recoverable_velocity_derivative();
2506 el_pt->nvorticity_derivatives_to_recover();
2510 el_pt->nvelocity_derivatives_to_recover();
2517 std::map<Node*, unsigned>
count;
2572 for (
unsigned e = 0;
e <
nelem;
e++)
2575 ELEMENT*
const el_pt = (*(
it->second))[
e];
2606 (*recovered_vorticity_coefficient_pt)[
i] *
psi_r[
i];
2628 for (
unsigned j = 0;
j <
nnod;
j++)
2659 oomph_info <<
"Time for vorticity recovery [sec]: "
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
Information for documentation of results: Directory and file number to enable output in the form RESL...
void disable_doc()
Disable documentation.
virtual double geometric_jacobian(const Vector< double > &x)
Return the geometric jacobian (should be overloaded in cylindrical and spherical geometries)....
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
virtual void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size (broken virtual)
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
unsigned nnode() const
Return the number of nodes.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Generic class for numerical integration schemes:
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nnode() const
Return number of nodes in the mesh.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
An OomphLibError object which should be thrown when an run-time error is encountered....
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
unsigned nvertex_node() const
Number of vertex nodes in the element.
Empty base class for Telements (created so that we can use dynamic_cast<>() to figure out if a an ele...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
Class to indicate which derivatives of the vorticity/ velocity we want to recover....
int maximum_order_of_velocity_derivative() const
The maximum order of derivatives calculated in the velocity recovery.
unsigned Number_of_values_per_field
Number of values per field; how many of the following do we want: u,v,p,omega,d/dx,...
int Maximum_order_of_vorticity_derivative
Maximum number of derivatives to retain in the vorticity recovery. Note, the value -1 means we ONLY o...
void set_maximum_order_of_velocity_derivative(const int &max_deriv)
The maximum order of derivatives calculated in the velocity recovery.
RecoveryHelper()
Constructor.
void calculate_number_of_values_per_field()
Calculates the number of values per field given the number of vorticity and velocity derivatives to r...
int Maximum_order_of_velocity_derivative
Maximum number of derivatives to retain in the velocity recovery. Note, the value 0 means we don't ca...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values:
unsigned npartial_derivative(const unsigned &n) const
Helper function that determines the number of n-th order partial derivatives in d-dimensions....
void set_maximum_order_of_vorticity_derivative(const int &max_deriv)
The maximum order of derivatives calculated in the vorticity recovery.
int maximum_order_of_vorticity_derivative() const
The maximum order of derivatives calculated in the vorticity recovery.
Overloaded element that allows projection of vorticity.
int get_maximum_order_of_velocity_derivative() const
The maximum order of derivatives calculated in the velocity recovery. Note, this value can only be se...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values:
unsigned Smoothed_vorticity_index
Index of smoothed vorticity – followed by derivatives; in 2D this has value 3.
unsigned npartial_derivative(const unsigned &n) const
Call the function written in VorticityRecoveryHelpers.
std::pair< unsigned, unsigned > recovered_dof_to_container_id(const unsigned &i) const
Helper function that, given the local dof number of the i-th vorticity or velocity derivative,...
void get_raw_vorticity_second_deriv(const Vector< double > &s, double &dvorticity_dxdy, const unsigned &index) const
Get raw derivative of smoothed derivative vorticity [0]: d^2/dx^2, [1]: d^2/dxdy, [2]: d^2/dy^2.
void vorticity_and_its_derivs(const Vector< double > &s, Vector< Vector< double > > &vort_and_derivs) const
Compute smoothed vorticity and its derivatives.
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
unsigned smoothed_vorticity_index() const
Index of smoothed vorticity – followed by derivatives.
void scalar_value_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
std::pair< unsigned, unsigned > vorticity_dof_to_container_id(const unsigned &i) const
Helper function that, given the local dof number of the i-th vorticity or velocity derivative,...
ExactVorticityFctPt Exact_vorticity_fct_pt
Pointer to function that specifies exact vorticity and derivs (for validation).
double vorticity_error_squared(const unsigned &i)
Compute the element's contribution to the (squared) L2 norm of the difference between exact and smoot...
unsigned Maximum_order_of_recoverable_velocity_derivatives
The current maximum order of velocity derivatives that can be recovered. Currently,...
unsigned get_maximum_order_of_recoverable_vorticity_derivative() const
The maximum order of vorticity derivative that can be recovered. This is set in the constructor and s...
unsigned Maximum_order_of_recoverable_vorticity_derivatives
The current maximum order of vorticity derivatives that can be recovered. Currently,...
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Re-implements broken virtual function in base class.
unsigned nvorticity_derivatives_to_recover() const
The number of terms calculated in the vorticity recovery. Also includes the zeroth derivative,...
void get_raw_velocity_deriv(const Vector< double > &s, Vector< double > &dveloc_dx) const
Get raw derivative of velocity.
VorticitySmootherElement()
Constructor.
void output(std::ostream &outfile, const unsigned &nplot)
Overloaded output function: Output velocity, pressure and the smoothed vorticity.
int Maximum_order_of_velocity_derivative
Maximum number of derivatives to retain in the velocity recovery. Note, the value 0 means we don't ca...
unsigned stored_dof_to_recoverable_dof(const unsigned &i) const
Given the STORED dof number, this function returns the global recovered number. For example,...
void output_smoothed_vorticity(std::ostream &outfile, const unsigned &nplot)
Output the velocity, smoothed vorticity and derivatives.
int get_maximum_order_of_vorticity_derivative() const
The maximum order of derivatives calculated in the vorticity recovery. Note, this value can only be s...
void get_raw_vorticity_third_deriv(const Vector< double > &s, Vector< double > &dvorticity_dxdxdy) const
Get raw derivative of smoothed derivative vorticity [0]: d^3/dx^3, [1]: d^3/dx^2dy,...
void get_raw_vorticity_deriv(const Vector< double > &s, double &dvorticity_dx, const unsigned &index) const
Get raw derivative of smoothed vorticity.
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
unsigned Number_of_values_per_field
Number of values per field; how many of the following do we want: u,v,p,omega,d/dx,...
void get_raw_vorticity_deriv(const Vector< double > &s, Vector< double > &dvorticity_dx) const
Get raw derivative of smoothed vorticity.
unsigned get_maximum_order_of_recoverable_velocity_derivative() const
The maximum order of velocity derivative that can be recovered. This is set in the constructor and sh...
int Maximum_order_of_vorticity_derivative
Maximum number of derivatives to retain in the vorticity recovery. Note, the value -1 means we ONLY o...
unsigned required_nvalue(const unsigned &n) const
Number of values required at local node n. In order to simplify matters, we allocate storage for pres...
unsigned nvelocity_derivatives_to_recover() const
The number of derivatives calculated in the velocity recovery. This does NOT include the zeroth deriv...
void output_analytical_veloc_and_vorticity(std::ostream &outfile, const unsigned &nplot)
Output exact velocity, vorticity, derivatives and indicator based on functions specified by two funct...
Vector< Vector< double > > create_container_for_vorticity_and_derivatives() const
Helper function to create a container for the vorticity and its partial derivatives....
void pin_smoothed_vorticity()
Pin all smoothed vorticity quantities.
ExactVorticityFctPt & exact_vorticity_fct_pt()
Access function: Pointer to function that specifies exact vorticity and derivatives (for validation).
void(* ExactVorticityFctPt)(const Vector< double > &x, Vector< Vector< double > > &vort_and_derivs)
Typedef for pointer to function that specifies the exact vorticity and derivatives (for validation)
void get_raw_velocity_deriv(const Vector< double > &s, double &dveloc_dx, const unsigned &index) const
Get raw derivative of velocity.
void get_raw_vorticity_third_deriv(const Vector< double > &s, double &dvorticity_dxdxdy, const unsigned &index) const
Get raw derivative of smoothed derivative vorticity [0]: d^3/dx^3, [1]: d^3/dx^2dy,...
void get_raw_vorticity_second_deriv(const Vector< double > &s, Vector< double > &dvorticity_dxdy) const
Get raw derivative of smoothed derivative vorticity.
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation returns V1 for the first one,...
ExactVorticityFctPt exact_vorticity_fct_pt() const
Access function: Pointer to function that specifies exact vorticity and derivatives (for validation) ...
unsigned N_dim
Number of dimensions in the element.
Smoother for vorticity in 2D.
unsigned & recovery_order()
Access function for order of recovery polynomials.
unsigned nrecovery_order() const
Get the recovery order.
void recover_vorticity(Mesh *mesh_pt, DocInfo &doc_info)
Recover vorticity from patches – output intermediate steps to directory specified by DocInfo object.
void recover_vorticity(Mesh *mesh_pt)
Recover vorticity from patches.
virtual ~VorticitySmoother()
Empty virtual destructor.
VorticitySmoother(const VorticitySmoother &)=delete
Broken copy constructor.
Integral * integral_rec(const bool &is_q_mesh)
Integation scheme associated with the recovery shape functions must be of sufficiently high order to ...
void shape_rec(const Vector< double > &x, Vector< double > &psi_r)
Recovery shape functions as functions of the global, Eulerian coordinate x of dimension dim....
VorticitySmoother(const unsigned &recovery_order)
Constructor: Set order of recovery shape functions.
void operator=(const VorticitySmoother &)=delete
Broken assignment operator.
unsigned Recovery_order
Order of recovery polynomials.
void get_recovered_vorticity_in_patch(const Vector< ELEMENT * > &patch_el_pt, const unsigned &num_recovery_terms, Vector< double > *&recovered_vorticity_coefficient_pt, unsigned &n_deriv)
Given the vector of elements that make up a patch, compute the vector of recovered vorticity coeffici...
void setup_patches(Mesh *&mesh_pt, std::map< Node *, Vector< ELEMENT * > * > &adjacent_elements_pt, Vector< Node * > &vertex_node_pt)
Setup patches: For each vertex node pointed to by nod_pt, adjacent_elements_pt[nod_pt] contains the p...
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
double timer()
returns the time in seconds after some point in past
class oomph::VorticityRecoveryHelpers::RecoveryHelper Recovery_helper
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...