diff --git a/deal_main/source/evaluation.hpp b/deal_main/source/evaluation.hpp index bd98b197811278d37d9cbb098e1b1cec1f0a8751..43374c31a7220a5fcc1ce9b7ee7bc24f0b7afa93 100644 --- a/deal_main/source/evaluation.hpp +++ b/deal_main/source/evaluation.hpp @@ -6,6 +6,11 @@ using namespace dealii; +//Initialisation of the evaluation points +const Point<3> p1(0.5, 0.125, 0.875); +const Point<3> p2(0.5, 0.25, 0.875); +const Point<3> p3(0.5, 0.5, 0.875); + //---------------------------------------------------------------- //Class used to evaluate the approx. solution at a given point (If node exists). //---------------------------------------------------------------- diff --git a/deal_main/source/poisson_h.hpp b/deal_main/source/poisson_h.hpp index 57e5d9df60f6ddc265eb6e0b854ab95219306427..1f069c4f7879e395659f171abe5d528d3a2a4111 100644 --- a/deal_main/source/poisson_h.hpp +++ b/deal_main/source/poisson_h.hpp @@ -110,7 +110,6 @@ namespace AspDEQuFEL //------------------------------ //Initialize the problem with first order finite elements //The dof_handler manages enumeration and indexing of all degrees of freedom (relating to the given triangulation) - //When changing the point of the postprocessor one has to also change it in the calculate_exact_error method //------------------------------ template <int dim> Poisson<dim>::Poisson(int order, int max_dof) : max_dofs(max_dof), @@ -121,9 +120,9 @@ namespace AspDEQuFEL pcout(std::cout, (this_mpi_process == 0)), fe(order), dof_handler(triangulation), - postprocessor1(Point<3>(0.5, 0.125, 0.875)), - postprocessor2(Point<3>(0.5, 0.25, 0.875)), - postprocessor3(Point<3>(0.5, 0.5, 0.875)) + postprocessor1(p1), + postprocessor2(p2), + postprocessor3(p3) { } @@ -554,9 +553,9 @@ namespace AspDEQuFEL const unsigned int n_active_cells = triangulation.n_global_active_cells(); const unsigned int n_dofs = dof_handler.n_dofs(); - double local_error_p1 = abs(postprocessor1(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.125, 0.875))); - double local_error_p2 = abs(postprocessor2(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.25, 0.875))); - double local_error_p3 = abs(postprocessor3(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.5, 0.875))); + double local_error_p1 = abs(postprocessor1(dof_handler, local_solution) - Solution<dim>().value(p1)); + double local_error_p2 = abs(postprocessor2(dof_handler, local_solution) - Solution<dim>().value(p2)); + double local_error_p3 = abs(postprocessor3(dof_handler, local_solution) - Solution<dim>().value(p3)); double error_p1 = Utilities::MPI::min(local_error_p1, mpi_communicator); double error_p2 = Utilities::MPI::min(local_error_p2, mpi_communicator); double error_p3 = Utilities::MPI::min(local_error_p3, mpi_communicator); diff --git a/deal_main/source/poisson_hp.hpp b/deal_main/source/poisson_hp.hpp index 8ac469fe403c9583dade020627c87191a486f8f2..bd45219c9bf0f5a61971c90a10b49484a5a32a59 100644 --- a/deal_main/source/poisson_hp.hpp +++ b/deal_main/source/poisson_hp.hpp @@ -125,7 +125,6 @@ namespace AspDEQuFEL //------------------------------ //The dof_handler manages enumeration and indexing of all degrees of freedom (relating to the given triangulation). //Set an adequate maximum degree. - //When changing the point of the postprocessor one has to also change it in the calculate_exact_error method //------------------------------ template <int dim> PoissonHP<dim>::PoissonHP(int max_dof) : max_dofs(max_dof), @@ -136,9 +135,9 @@ namespace AspDEQuFEL pcout(std::cout, (this_mpi_process == 0)), dof_handler(triangulation), max_degree(dim <= 2 ? 7 : 5), - postprocessor1(Point<3>(0.5, 0.125, 0.875)), - postprocessor2(Point<3>(0.5, 0.25, 0.875)), - postprocessor3(Point<3>(0.5, 0.5, 0.875)) + postprocessor1(p1), + postprocessor2(p2), + postprocessor3(p3) { for (unsigned int degree = 2; degree <= max_degree; degree++) { @@ -610,9 +609,9 @@ namespace AspDEQuFEL const unsigned int n_active_cells = triangulation.n_global_active_cells(); const unsigned int n_dofs = dof_handler.n_dofs(); - double local_error_p1 = abs(postprocessor1(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.125, 0.875))); - double local_error_p2 = abs(postprocessor2(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.25, 0.875))); - double local_error_p3 = abs(postprocessor3(dof_handler, local_solution) - Solution<dim>().value(Point<dim>(0.5, 0.5, 0.875))); + double local_error_p1 = abs(postprocessor1(dof_handler, local_solution) - Solution<dim>().value(p1)); + double local_error_p2 = abs(postprocessor2(dof_handler, local_solution) - Solution<dim>().value(p2)); + double local_error_p3 = abs(postprocessor3(dof_handler, local_solution) - Solution<dim>().value(p3)); double error_p1 = Utilities::MPI::min(local_error_p1, mpi_communicator); double error_p2 = Utilities::MPI::min(local_error_p2, mpi_communicator); double error_p3 = Utilities::MPI::min(local_error_p3, mpi_communicator); diff --git a/mfem_main/source/evaluation.hpp b/mfem_main/source/evaluation.hpp index 86d0bb2896e1c6b8b80b5d06a6ad699684f67daf..20b6efd083b7dea78ccf3aef8369844947a16552 100644 --- a/mfem_main/source/evaluation.hpp +++ b/mfem_main/source/evaluation.hpp @@ -7,9 +7,9 @@ using namespace mfem; using namespace std; //Evaluation points for the point-wise error -double p1[] = {0.5, 0.125, 0.875}; -double p2[] = {0.5, 0.25, 0.875}; -double p3[] = {0.5, 0.5, 0.875}; +const vector<double> p1 = {0.5, 0.125, 0.875}; +const vector<double> p2 = {0.5, 0.25, 0.875}; +const vector<double> p3 = {0.5, 0.5, 0.875}; //-------------------------------------------------------------- //Class for evaluating the approximate solution at a given point. Only applicable if the point is a node of the grid. diff --git a/mfem_main/source/poisson.cpp b/mfem_main/source/poisson.cpp index 4ef82ec309ade3d6ecc3ad011c46698c7cef69e5..1d332411fbb17b27c4f47f9e1d992059274344ac 100644 --- a/mfem_main/source/poisson.cpp +++ b/mfem_main/source/poisson.cpp @@ -298,13 +298,20 @@ namespace AspDEQuFEL values.max_error = x.ComputeMaxError(u); values.l2_error = x.ComputeL2Error(u); - double local_error_p1 = abs(postprocessor1(x, *pmesh) - bdr_func(Vector(p1, 3))); + double p1_data[p1.size()]; + double p2_data[p2.size()]; + double p3_data[p3.size()]; + copy(p1.begin(), p1.end(), p1_data); + copy(p2.begin(), p2.end(), p2_data); + copy(p3.begin(), p3.end(), p3_data); + + double local_error_p1 = abs(postprocessor1(x, *pmesh) - bdr_func(Vector(p1_data, p1.size()))); MPI_Reduce(&local_error_p1, &values.error_p1, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD); - double local_error_p2 = abs(postprocessor2(x, *pmesh) - bdr_func(Vector(p2, 3))); + double local_error_p2 = abs(postprocessor2(x, *pmesh) - bdr_func(Vector(p2_data, p2.size()))); MPI_Reduce(&local_error_p2, &values.error_p2, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD); - double local_error_p3 = abs(postprocessor3(x, *pmesh) - bdr_func(Vector(p3, 3))); + double local_error_p3 = abs(postprocessor3(x, *pmesh) - bdr_func(Vector(p3_data, p3.size()))); MPI_Reduce(&local_error_p3, &values.error_p3, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD); table_vector.push_back(values); diff --git a/mfem_main/source/poisson.hpp b/mfem_main/source/poisson.hpp index 78d51d216682bd07f3e1bf30d285a5a1a405bf54..41bed03b9c6676e7994192386a7640d5c876cf22 100644 --- a/mfem_main/source/poisson.hpp +++ b/mfem_main/source/poisson.hpp @@ -20,7 +20,6 @@ namespace AspDEQuFEL using namespace std; //---------------------------------------------------------------- //Class for the Poisson AMR solver - //When changing the point of the postprocessor one has to also change it in the calculate_exact_error method //---------------------------------------------------------------- class Poisson { diff --git a/ngsolve_main/ngsolve_main.py b/ngsolve_main/ngsolve_main.py index 44e1586a2ed612bfb4f55795ab5f7f1b11664b94..f707ed80eb5e522e6da056da93fdc6cbcb2eaee0 100644 --- a/ngsolve_main/ngsolve_main.py +++ b/ngsolve_main/ngsolve_main.py @@ -53,6 +53,7 @@ class Poisson: #User concfiguration (Problem definition) #============================================= #Define the general parameters and functions for the Problem + #The evaluation points have to be adjusted in the exact error method #Define the parameter alpha which is dependant on the used geometry self.alpha = 1.0/2.0 self.r = sqrt((x-0.5)*(x-0.5) + y*y)