Skip to content
Snippets Groups Projects
Commit a5068e3a authored by Matteo Cicuttin's avatar Matteo Cicuttin
Browse files

Comparison between GMSH-FEM and GMSH-GPU-DG ok.

parent 7ba32158
No related branches found
No related tags found
No related merge requests found
sim.name = "capacitor" -- simulation name
sim.dt = 1e-14 -- timestep size
sim.timesteps = 1001 -- num of iterations
sim.timesteps = 101 -- num of iterations
sim.gmsh_model = "capacitor.msh" -- gmsh model filename
sim.use_gpu = 0 -- 0: cpu, 1: gpu
sim.approx_order = 1 -- approximation order
sim.approx_order = 2 -- approximation order
sim.time_integrator = "leapfrog" -- time integration method
postpro.silo_output_rate = 10 -- rate at which to write silo files
postpro.silo_output_rate = 100 -- rate at which to write silo files
postpro.cycle_print_rate = 10 -- console print rate
local diel_epsr = 10 -- Permittivity of the capacitor dielectric
......@@ -103,6 +103,15 @@ end
-- Apply the current source to entity 2
sources[2] = current_source
function on_timestepping_finished()
if ( do_IO ) then
print("\x1b[32m*** GMSH-FEM COMPARISON DATA ***\x1b[0m")
--compare_at_gauss_points() -- NOT MPI SAFE
end
end
-- Dump charging current profile for debug
if ( do_IO ) then
local file = io.open("current_profile.dat", "w")
......
......@@ -92,6 +92,6 @@ function on_timestepping_finished()
if ( do_IO ) then
print("\x1b[32m*** GMSH-FEM COMPARISON DATA ***\x1b[0m")
print("Error on Ey: " .. err.Ey)
--compare_at_gauss_points() -- NOT MPI SAFE
compare_at_gauss_points() -- NOT MPI SAFE
end
end
......@@ -4,4 +4,4 @@ Box(1) = {0, 0, 0, 1, 1, 1};
Physical Volume(1000) = {1};
Physical Surface(2000) = {1,2,3,4,5,6};
MeshSize{:} = 0.2;
MeshSize{:} = 0.05;
......@@ -169,7 +169,7 @@ compare_at_gauss_points(const model& mod, const solver_state& state, const param
auto Ezd = Fh.Ez - qpFval.Fz;
errorsq_dg_vs_gmshfem += pqp.weight() * (Exd*Exd + Eyd*Eyd + Ezd*Ezd);
normsq_dg += pqp.weight() * (Fh.Ex*Fh.Ex + Fh.Ey*Fh.Ey + Fh.Ez*Fh.Ez);
normsq_gmshfem += pqp.weight() * (qpFval.Fy*qpFval.Fy);
normsq_gmshfem += pqp.weight() * (qpFval.Fx*qpFval.Fx + qpFval.Fy*qpFval.Fy + qpFval.Fz*qpFval.Fz);
auto p = pqp.point();
auto Ey_ana = std::sin(M_PI*p.x())*std::sin(M_PI*p.z())*std::cos(2.*M_PI*211.98528005809e6*state.curr_time);
......@@ -186,13 +186,14 @@ compare_at_gauss_points(const model& mod, const solver_state& state, const param
std::cout << sgr::Bredfg << "Errors and norms:" << sgr::reset << std::endl;
std::cout << " Analytic norm: " << std::sqrt(normsq_ana) << std::endl;
std::cout << " Computed norm (DG): " << std::sqrt(normsq_dg) << ", off by " << norm_dg_error << " %" << std::endl;
std::cout << sgr::BGreenfg;
std::cout << sgr::BYellowfg;
std::cout << " Computed norm (FEM): " << std::sqrt(normsq_gmshfem) << ", off by " << norm_gmshfem_error << " %" << std::endl;
std::cout << sgr::reset;
std::cout << " DG vs. FEM: " << std::sqrt(errorsq_dg_vs_gmshfem) << std::endl;
auto dgvsfem_percent = 100.*std::sqrt(errorsq_dg_vs_gmshfem)/std::sqrt(normsq_gmshfem);
std::cout << " DG vs. FEM: " << std::sqrt(errorsq_dg_vs_gmshfem) << ", " << dgvsfem_percent << " %" << std::endl;
std::cout << " DG vs. analytic: " << std::sqrt(errorsq_dg_vs_ana) << std::endl;
std::cout << sgr::BGreenfg;
std::cout << sgr::BYellowfg;
std::cout << " FEM vs. analytic: " << std::sqrt(errorsq_gmshfem_vs_ana) << std::endl;
std::cout << sgr::reset;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment