30 #ifndef OOMPH_ERROR_ESTIMATOR_NAMESPACE_HEADER 31 #define OOMPH_ERROR_ESTIMATOR_NAMESPACE_HEADER 116 virtual unsigned num_Z2_flux_terms()=0;
133 std::ostream &outfile,
135 double& error,
double& norm)
138 =
"compute_exact_Z2_error undefined for this element \n";
139 outfile << error_message;
142 OOMPH_CURRENT_FUNCTION,
143 OOMPH_EXCEPTION_LOCATION);
152 virtual unsigned nvertex_node()
const =0;
156 virtual Node* vertex_node_pt(
const unsigned& j)
const =0;
159 virtual unsigned nrecovery_order()=0;
323 Recovery_order(recovery_order), Recovery_order_from_first_element(false),
324 Reference_flux_norm(0.0), Combined_error_fct_pt(0)
332 Recovery_order_from_first_element(true), Reference_flux_norm(0.0),
333 Combined_error_fct_pt(0)
380 {
return Combined_error_fct_pt;}
385 {
return Combined_error_fct_pt;}
393 adjacent_elements_pt,
403 double get_combined_error_estimate(
const Vector<double> &compound_error);
412 void get_recovered_flux_in_patch(
414 const unsigned& num_recovery_terms,
415 const unsigned& num_flux_terms,
423 unsigned nrecovery_terms(
const unsigned& dim);
436 Integral* integral_rec(
const unsigned &dim,
const bool &is_q_mesh);
446 void doc_flux(
Mesh* mesh_pt,
447 const unsigned& num_flux_terms,
486 const unsigned& central_node_number,
487 const bool& use_lagrangian_coordinates=
false) :
488 Use_lagrangian_coordinates(use_lagrangian_coordinates),
489 Central_node_number(central_node_number)
496 "Can't use this error estimator on distributed meshes!",
497 OOMPH_CURRENT_FUNCTION,
498 OOMPH_EXCEPTION_LOCATION);
507 "Can't build error estimator if there are no elements in mesh\n",
508 OOMPH_CURRENT_FUNCTION,
509 OOMPH_EXCEPTION_LOCATION);
514 if (use_lagrangian_coordinates)
520 dim=solid_nod_pt-> nlagrangian();
523 unsigned nregion=elements_to_refine.size();
524 Region_low_bound.resize(nregion);
525 Region_upp_bound.resize(nregion);
526 for (
unsigned e=0;
e<nregion;
e++)
528 Region_low_bound[
e].resize(dim,1.0e20);
529 Region_upp_bound[
e].resize(dim,-1.0e20);
531 unsigned nnod=el_pt->
nnode();
532 for (
unsigned j=0;j<nnod;j++)
535 for (
unsigned i=0;
i<dim;
i++)
537 double x=nod_pt->
x(
i);
538 if (use_lagrangian_coordinates)
543 x=solid_nod_pt->
xi(
i);
546 if (x<Region_low_bound[e][
i])
548 Region_low_bound[
e][
i]=x;
550 if (x>Region_upp_bound[e][i])
552 Region_upp_bound[
e][
i]=x;
572 const unsigned& central_node_number,
573 const bool& use_lagrangian_coordinates=
false) :
574 Use_lagrangian_coordinates(use_lagrangian_coordinates),
575 Central_node_number(central_node_number)
582 "Can't build error estimator if there are no elements in mesh\n",
583 OOMPH_CURRENT_FUNCTION,
584 OOMPH_EXCEPTION_LOCATION);
589 Region_low_bound.resize(nregion);
590 Region_upp_bound.resize(nregion);
591 Region_low_bound[0]=lower_left;
592 Region_upp_bound[0]=upper_right;
628 std::ostringstream warning_stream;
630 <<
"No output defined in DummyErrorEstimator::get_element_errors()\n" 631 <<
"Ignoring doc_info flag.\n";
633 "DummyErrorEstimator::get_element_errors()",
634 OOMPH_EXCEPTION_LOCATION);
637 unsigned nregion=Region_low_bound.size();
639 for (
unsigned e=0;
e<nelem;
e++)
641 elemental_error[
e]=0.0;
646 for (
unsigned r=0;r<nregion;r++)
649 unsigned dim=Region_low_bound[r].size();
650 for (
unsigned i=0;
i<dim;
i++)
652 double x=nod_pt->
x(
i);
653 if (Use_lagrangian_coordinates)
658 x=solid_nod_pt->
xi(
i);
661 if (x<Region_low_bound[r][
i])
666 if (x>Region_upp_bound[r][i])
674 elemental_error[
e]=1.0;
ErrorEstimator()
Default empty constructor.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
unsigned Recovery_order
Order of recovery polynomials.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
ErrorEstimator(const ErrorEstimator &)
Broken copy constructor.
void operator=(const ErrorEstimator &)
Broken assignment operator.
bool is_doc_enabled() const
Are we documenting?
unsigned & recovery_order()
Access function for order of recovery polynomials.
Information for documentation of results: Directory and file number to enable output in the form RESL...
Vector< Vector< double > > Region_upp_bound
Upper 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...
virtual ~DummyErrorEstimator()
Empty virtual destructor.
A general Finite Element class.
unsigned Central_node_number
Number of local node that is used to identify if an element is located in the refinement region...
Base class for spatial error estimators.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
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...
CombinedErrorEstimateFctPt Combined_error_fct_pt
Function pointer to combined error estimator function.
virtual double geometric_jacobian(const Vector< double > &x)
Return the geometric jacobian (should be overloaded in cylindrical and spherical geometries). Default value one is suitable for Cartesian coordinates.
virtual unsigned ncompound_fluxes()
A stuitable error estimator for a multi-physics elements may require one Z2 error estimate for each f...
unsigned long nelement() const
Return number of elements in the mesh.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
Vector< Vector< double > > Region_low_bound
Lower bounds for the coordinates of the refinement regions.
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...
Z2ErrorEstimator(const unsigned &recovery_order)
Constructor: Set order of recovery shape functions.
double Reference_flux_norm
Prescribed reference flux norm.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
void operator=(const ElementWithZ2ErrorEstimator &)
Broken assignment operator.
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...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
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. ...
bool Recovery_order_from_first_element
double reference_flux_norm() const
Access function for prescribed reference flux norm (const. version)
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
void disable_doc()
Disable documentation.
unsigned recovery_order() const
Access function for order of recovery polynomials (const version)
virtual ~Z2ErrorEstimator()
Empty virtual destructor.
A Class for nodes that deform elastically (i.e. position is an unknown in the problem). The idea is that the Eulerian positions are stored in a Data object and the Lagrangian coordinates are stored in addition. The pointer that addresses the Eulerian positions is set to the pointer to Value in the Data object. Hence, SolidNode uses knowledge of the internal structure of Data and must be a friend of the Data class. In order to allow a mesh to deform via an elastic-style equation in deforming-domain problems, the positions are stored separately from the values, so that elastic problems may be combined with any other type of problem.
CombinedErrorEstimateFctPt & combined_error_fct_pt()
Access function: Pointer to combined error estimate function.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
ElementWithZ2ErrorEstimator(const ElementWithZ2ErrorEstimator &)
Broken copy constructor.
double & reference_flux_norm()
Access function for prescribed reference flux norm.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void operator=(const Z2ErrorEstimator &)
Broken assignment operator.
Z2ErrorEstimator(const Z2ErrorEstimator &)
Broken copy constructor.
bool Use_lagrangian_coordinates
Use Lagrangian coordinates to decide which element is to be refined.
ElementWithZ2ErrorEstimator()
Default empty constructor.
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.
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...
Z2ErrorEstimator()
Constructor: Leave order of recovery shape functions open for now – they will be read out from first...
DummyErrorEstimator(const DummyErrorEstimator &)
Broken copy constructor.
void operator=(const DummyErrorEstimator &)
Broken assignment operator.
unsigned nnode() const
Return the number of nodes.
virtual ~ErrorEstimator()
Empty virtual destructor.