diff --git a/README.md b/README.md index 163c641..2c6c285 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,30 @@ This simulation of the Vlasov-Poisson system dimensions uses ______________________________________________________________________ +# How to use + +## Dependencies: + +- [deal.ii](https://dealii.org/) >= 9.6.0 +- OpenMP +- [perf](https://perfwiki.github.io/main/) + [flameGraph](https://github.com/brendangregg/FlameGraph) (optional) + +After cloning the repo to your machine `cd` into it and run: + +``` +mkdir -p build; cd build/ +cmake .. +make +cd .. +``` + +Then check/change `parameters.lua` and run with `./build/nufi_poisson`. +If you want to run with a [FlameGraph](https://www.brendangregg.com/flamegraphs.html) visualization at the end use `./run`. + +______________________________________________________________________ + +# Further description + dimensions: 1x1v status: builds, runs diff --git a/src/nufi_solver.cc b/src/nufi_solver.cc index 480f328..6ed5c5f 100644 --- a/src/nufi_solver.cc +++ b/src/nufi_solver.cc @@ -32,6 +32,7 @@ std::vector NuFISolver::eval_ftilda( const std::vector> &phi_history) const { size_t x_size = X.size(); + const double dt = Parameters::DT; std::vector U(x_size, u); std::vector results(x_size); @@ -47,7 +48,7 @@ std::vector NuFISolver::eval_ftilda( // We omit the initial half-step. while (--n) { for (size_t i = 0; i < x_size; ++i) - X[i] = X[i] - Parameters::DT * U[i]; + X[i] = X[i] - dt * U[i]; AssertThrow( phi_history[n].solution.size() == @@ -68,13 +69,13 @@ std::vector NuFISolver::eval_ftilda( for (size_t i = 0; i < x_size; ++i) { Ex[i] = -tmp[i]; - U[i] = U[i] + Parameters::DT * Ex[i]; + U[i] = U[i] + dt * Ex[i]; } } // The final half-step. for (size_t i = 0; i < x_size; ++i) - X[i] = X[i] - Parameters::DT * U[i]; + X[i] = X[i] - dt * U[i]; tmp = eval(X, grid_struct[phi_history[n].grid_version], phi_history[n].solution); // call eval only once @@ -92,7 +93,7 @@ std::vector NuFISolver::eval_f(unsigned int n, std::vector X, double u, const std::vector> &grid_struct, const std::vector> &phi_history) const { - + const double dt = Parameters::DT; size_t x_size = X.size(); std::vector U(x_size, u); @@ -111,30 +112,30 @@ NuFISolver::eval_f(unsigned int n, std::vector X, double u, phi_history[n].solution); // call eval only once for (size_t i = 0; i < x_size; ++i) { Ex[i] = -tmp[i]; - U[i] = U[i] + 0.5 * Parameters::DT * Ex[i]; + U[i] = U[i] + 0.5 * dt * Ex[i]; } while (--n) { for (size_t i = 0; i < x_size; ++i) - X[i] = X[i] - Parameters::DT * U[i]; + X[i] = X[i] - dt * U[i]; tmp = eval(X, grid_struct[phi_history[n].grid_version], phi_history[n].solution); // call eval only once for (size_t i = 0; i < x_size; ++i) { Ex[i] = -tmp[i]; - U[i] = U[i] + Parameters::DT * Ex[i]; + U[i] = U[i] + dt * Ex[i]; } } // The final half-step. for (size_t i = 0; i < x_size; ++i) - X[i] = X[i] - Parameters::DT * U[i]; + X[i] = X[i] - dt * U[i]; tmp = eval(X, grid_struct[phi_history[n].grid_version], phi_history[n].solution); // call eval only once for (size_t i = 0; i < x_size; ++i) { Ex[i] = -tmp[i]; - U[i] = U[i] + 0.5 * Parameters::DT * Ex[i]; + U[i] = U[i] + 0.5 * dt * Ex[i]; } for (size_t i = 0; i < x_size; ++i)