26 #ifndef OOMPH_ERROR_ESTIMATOR_NAMESPACE_HEADER
27 #define OOMPH_ERROR_ESTIMATOR_NAMESPACE_HEADER
111 std::ostream& outfile,
117 "compute_exact_Z2_error undefined for this element \n";
118 outfile << error_message;
121 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
344 adjacent_elements_pt,
370 const unsigned& num_recovery_terms,
371 const unsigned& num_flux_terms,
404 const unsigned& num_flux_terms,
440 const unsigned& central_node_number,
441 const bool& use_lagrangian_coordinates =
false)
450 "Can't use this error estimator on distributed meshes!",
451 OOMPH_CURRENT_FUNCTION,
452 OOMPH_EXCEPTION_LOCATION);
461 "Can't build error estimator if there are no elements in mesh\n",
462 OOMPH_CURRENT_FUNCTION,
463 OOMPH_EXCEPTION_LOCATION);
468 if (use_lagrangian_coordinates)
472 if (solid_nod_pt != 0)
477 unsigned nregion = elements_to_refine.size();
480 for (
unsigned e = 0;
e < nregion;
e++)
486 unsigned nnod = el_pt->
nnode();
487 for (
unsigned j = 0; j < nnod; j++)
490 for (
unsigned i = 0;
i < dim;
i++)
492 double x = nod_pt->
x(
i);
493 if (use_lagrangian_coordinates)
496 if (solid_nod_pt != 0)
498 x = solid_nod_pt->
xi(
i);
526 const unsigned& central_node_number,
527 const bool& use_lagrangian_coordinates =
false)
535 "Can't build error estimator if there are no elements in mesh\n",
536 OOMPH_CURRENT_FUNCTION,
537 OOMPH_EXCEPTION_LOCATION);
541 unsigned nregion = 1;
567 std::ostringstream warning_stream;
569 <<
"No output defined in DummyErrorEstimator::get_element_errors()\n"
570 <<
"Ignoring doc_info flag.\n";
572 "DummyErrorEstimator::get_element_errors()",
573 OOMPH_EXCEPTION_LOCATION);
577 unsigned nelem = mesh_pt->
nelement();
578 for (
unsigned e = 0;
e < nelem;
e++)
580 elemental_error[
e] = 0.0;
586 for (
unsigned r = 0; r < nregion; r++)
588 bool is_inside =
true;
590 for (
unsigned i = 0;
i < dim;
i++)
592 double x = nod_pt->
x(
i);
596 if (solid_nod_pt != 0)
598 x = solid_nod_pt->
xi(
i);
614 elemental_error[
e] = 1.0;
Information for documentation of results: Directory and file number to enable output in the form RESL...
bool is_doc_enabled() const
Are we documenting?
void disable_doc()
Disable documentation.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
bool Use_lagrangian_coordinates
Use Lagrangian coordinates to decide which element is to be refined.
Vector< Vector< double > > Region_low_bound
Lower bounds for the coordinates of the refinement regions.
DummyErrorEstimator(Mesh *mesh_pt, const Vector< unsigned > &elements_to_refine, const unsigned ¢ral_node_number, const bool &use_lagrangian_coordinates=false)
Constructor. Provide mesh and number of the elements that define the regions within which elements ar...
DummyErrorEstimator(const DummyErrorEstimator &)=delete
Broken copy constructor.
virtual void get_element_errors(Mesh *&mesh_pt, Vector< double > &elemental_error, DocInfo &doc_info)
Compute the elemental error measures for a given mesh and store them in a vector. Doc errors etc.
Vector< Vector< double > > Region_upp_bound
Upper bounds for the coordinates of the refinement regions.
unsigned Central_node_number
Number of local node that is used to identify if an element is located in the refinement region.
DummyErrorEstimator(Mesh *mesh_pt, const Vector< double > &lower_left, const Vector< double > &upper_right, const unsigned ¢ral_node_number, const bool &use_lagrangian_coordinates=false)
Constructor. Provide vectors to "lower left" and "upper right" vertices of refinement region Also spe...
virtual ~DummyErrorEstimator()
Empty virtual destructor.
void operator=(const DummyErrorEstimator &)=delete
Broken assignment operator.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
ElementWithZ2ErrorEstimator(const ElementWithZ2ErrorEstimator &)=delete
Broken copy constructor.
void operator=(const ElementWithZ2ErrorEstimator &)=delete
Broken assignment operator.
virtual unsigned ncompound_fluxes()
A stuitable error estimator for a multi-physics elements may require one Z2 error estimate for each f...
virtual void get_Z2_compound_flux_indices(Vector< unsigned > &flux_index)
Return the compound flux index of each flux component The default (do nothing behaviour) will mean th...
ElementWithZ2ErrorEstimator()
Default empty constructor.
virtual void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)=0
Z2 'flux' terms for Z2 error estimation.
virtual void compute_exact_Z2_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_flux_pt, double &error, double &norm)
Plot the error when compared against a given exact flux. Also calculates the norm of the error and th...
virtual double geometric_jacobian(const Vector< double > &x)
Return the geometric jacobian (should be overloaded in cylindrical and spherical geometries)....
virtual unsigned num_Z2_flux_terms()=0
Number of 'flux' terms for Z2 error estimation.
virtual unsigned nrecovery_order()=0
Order of recovery shape functions.
Base class for spatial error estimators.
void get_element_errors(Mesh *&mesh_pt, Vector< double > &elemental_error)
Compute the elemental error-measures for a given mesh and store them in a vector.
ErrorEstimator()
Default empty constructor.
virtual ~ErrorEstimator()
Empty virtual destructor.
ErrorEstimator(const ErrorEstimator &)=delete
Broken copy constructor.
virtual void get_element_errors(Mesh *&mesh_pt, Vector< double > &elemental_error, DocInfo &doc_info)=0
Compute the elemental error measures for a given mesh and store them in a vector. Doc errors etc.
void operator=(const ErrorEstimator &)=delete
Broken assignment operator.
A general Finite Element class.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
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 .
Generic class for numerical integration schemes:
MapMatrixMixed is a generalised, STL-map-based, sparse(ish) matrix class with mixed indices.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
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...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
unsigned nlagrangian() const
Return number of lagrangian coordinates.
Z2-error-estimator: Elements that can be used with Z2 error estimation should be derived from the bas...
void get_recovered_flux_in_patch(const Vector< ElementWithZ2ErrorEstimator * > &patch_el_pt, const unsigned &num_recovery_terms, const unsigned &num_flux_terms, const unsigned &dim, DenseMatrix< double > *&recovered_flux_coefficient_pt)
Given the vector of elements that make up a patch, the number of recovery and flux terms,...
CombinedErrorEstimateFctPt & combined_error_fct_pt()
Access function: Pointer to combined error estimate function.
unsigned nrecovery_terms(const unsigned &dim)
Return number of coefficients for expansion of recovered fluxes for given spatial dimension of elemen...
Z2ErrorEstimator(const unsigned &recovery_order)
Constructor: Set order of recovery shape functions.
CombinedErrorEstimateFctPt Combined_error_fct_pt
Function pointer to combined error estimator function.
Z2ErrorEstimator()
Constructor: Leave order of recovery shape functions open for now – they will be read out from first ...
virtual ~Z2ErrorEstimator()
Empty virtual destructor.
double reference_flux_norm() const
Access function for prescribed reference flux norm (const. version)
double get_combined_error_estimate(const Vector< double > &compound_error)
Return a combined error estimate from all compound errors.
void setup_patches(Mesh *&mesh_pt, std::map< Node *, Vector< ElementWithZ2ErrorEstimator * > * > &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...
void operator=(const Z2ErrorEstimator &)=delete
Broken assignment operator.
double(* CombinedErrorEstimateFctPt)(const Vector< double > &errors)
Function pointer to combined error estimator function.
double & reference_flux_norm()
Access function for prescribed reference flux norm.
unsigned Recovery_order
Order of recovery polynomials.
double Reference_flux_norm
Prescribed reference flux norm.
void get_element_errors(Mesh *&mesh_pt, Vector< double > &elemental_error)
Compute the elemental error measures for a given mesh and store them in a vector.
CombinedErrorEstimateFctPt combined_error_fct_pt() const
Access function: Pointer to combined error estimate function. Const version.
Z2ErrorEstimator(const Z2ErrorEstimator &)=delete
Broken copy constructor.
void shape_rec(const Vector< double > &x, const unsigned &dim, Vector< double > &psi_r)
Recovery shape functions as functions of the global, Eulerian coordinate x of dimension dim....
Integral * integral_rec(const unsigned &dim, const bool &is_q_mesh)
Integation scheme associated with the recovery shape functions must be of sufficiently high order to ...
unsigned recovery_order() const
Access function for order of recovery polynomials (const version)
void doc_flux(Mesh *mesh_pt, const unsigned &num_flux_terms, MapMatrixMixed< Node *, int, double > &rec_flux_map, const Vector< double > &elemental_error, DocInfo &doc_info)
Doc flux and recovered flux.
unsigned & recovery_order()
Access function for order of recovery polynomials.
bool Recovery_order_from_first_element
Bool to indicate if recovery order is to be read out from first element in mesh or set globally.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...