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

Line integration part 2.

parent bfaddb96
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@
#include <omp.h>
#endif
#include <fstream>
#include "gmsh.h"
#include "silo_output.hpp"
#include "maxwell_interface.h"
......@@ -115,6 +117,21 @@ public:
}
};
double
integrate(const model& mod, const maxwell::solver_state& state, line_integrator& lint)
{
return lint.integrate(mod, state.emf_curr.Ex);
}
double
integrate(const model& mod, const maxwell::solver_state_gpu& state, line_integrator& lint)
{
maxwell::field f;
f.resize( mod.num_dofs() );
state.emf_curr.copyout(f);
return lint.integrate(mod, f.Ex);
}
template<typename State>
void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl)
{
......@@ -139,6 +156,8 @@ void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl)
point_3d end(46e-9, 0.0, 38e-9);
line_integrator lint(start, end, 50);
std::ofstream ofs("voltage.dat");
timecounter tc;
tc.tic();
prepare_sources(mod, state, mpl);
......@@ -160,7 +179,7 @@ void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl)
std::cout << "Cycle " << i << ": t = " << state.curr_time << " s";
std::cout << ", DOFs/s: " << (mod.num_dofs()*6*cycle_print_rate)/(time) << std::endl;
tc.tic();
std::cout << "Voltage = " << lint.integrate(mod, state.emf_curr.Ex) << std::endl;
ofs << state.curr_time << " " << integrate(mod, state, lint) << std::endl;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment