13 #if !defined(KRATOS_L2_ERROR_CALCULATOR_UTILITY)
14 #define KRATOS_L2_ERROR_CALCULATOR_UTILITY
54 auto& r_vectorial_error = r_node.FastGetSolutionStepValue(VECTORIAL_ERROR);
55 r_vectorial_error = r_node.FastGetSolutionStepValue(VELOCITY) - r_node.FastGetSolutionStepValue(EXACT_VELOCITY);
57 auto& r_scalar_error = r_node.FastGetSolutionStepValue(SCALAR_ERROR);
58 r_scalar_error = r_node.FastGetSolutionStepValue(PRESSURE) - r_node.FastGetSolutionStepValue(EXACT_PRESSURE);
64 double total_area = 0.0, result = 0.0;
67 for (
const auto& r_node : r_model_part.
Nodes())
69 double local_area = r_node.FastGetSolutionStepValue(NODAL_AREA);
70 total_area += local_area;
71 double error_x = r_node.FastGetSolutionStepValue(VECTORIAL_ERROR_X);
72 double error_y = r_node.FastGetSolutionStepValue(VECTORIAL_ERROR_Y);
74 if (
dim == 3) error_z += r_node.FastGetSolutionStepValue(VECTORIAL_ERROR_Z);
75 double squared_modulus = std::pow(error_x,2)+std::pow(error_y,2)+std::pow(error_z,2);
76 result += squared_modulus * local_area;
79 return std::sqrt(result/total_area);
85 double total_area = 0.0, result = 0.0;
87 for (
const auto& r_node : r_model_part.
Nodes())
89 double local_area = r_node.FastGetSolutionStepValue(NODAL_AREA);
90 total_area += local_area;
91 double error_p = r_node.FastGetSolutionStepValue(SCALAR_ERROR);
92 result += std::pow(error_p,2) * local_area;
95 return std::sqrt(result/total_area);
Geometry base class.
Definition: geometry.h:71
Definition: L2_error_calculator_utility.h:29
ModelPart::NodesContainerType::iterator NodeIterator
Definition: L2_error_calculator_utility.h:40
Geometry< NodeType > GeometryType
Definition: L2_error_calculator_utility.h:35
double GetL2VectorErrorNorm(ModelPart &r_model_part)
Definition: L2_error_calculator_utility.h:62
ModelPart::ElementsContainerType::iterator ElementIterator
Definition: L2_error_calculator_utility.h:39
Matrix MatrixType
Definition: L2_error_calculator_utility.h:38
Kratos::Vector ShapeFunctionsType
Definition: L2_error_calculator_utility.h:41
KRATOS_CLASS_POINTER_DEFINITION(L2ErrorNormCalculator)
L2ErrorNormCalculator()
Definition: L2_error_calculator_utility.h:45
double GetL2ScalarErrorNorm(ModelPart &r_model_part)
Definition: L2_error_calculator_utility.h:83
Node NodeType
Definition: L2_error_calculator_utility.h:33
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: L2_error_calculator_utility.h:36
Vector VectorType
Definition: L2_error_calculator_utility.h:37
virtual ~L2ErrorNormCalculator()
Definition: L2_error_calculator_utility.h:48
void ComputeDofsErrors(ModelPart &r_model_part)
Definition: L2_error_calculator_utility.h:50
Properties PropertiesType
Definition: L2_error_calculator_utility.h:34
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
int dim
Definition: sensitivityMatrix.py:25