17 static void benchmarkSolver(
ISolver& solver, Benchmark::Context& context) {
22 solver.
create(storage, material);
25 while (context.running()) {
31 Profiler::getInstance().printStatistics(logger);
35 BENCHMARK(
"SymmetricSolver simple",
"[solvers]", Benchmark::Context& context) {
39 benchmarkSolver(solver, context);
42 BENCHMARK(
"AsymmetricSolver simple",
"[solvers]", Benchmark::Context& context) {
46 benchmarkSolver(solver, context);
49 BENCHMARK(
"EnergyConservingSolver simple",
"[solvers]", Benchmark::Context& context) {
53 benchmarkSolver(solver, context);
56 BENCHMARK(
"GravitySolver simple",
"[solvers]", Benchmark::Context& context) {
60 benchmarkSolver(solver, context);
64 template <
typename TSolver>
65 void test(
const std::string path) {
68 std::ofstream ofs(path);
69 for (
Size threadCnt = 1; threadCnt <= 16; ++threadCnt) {
76 solver.
create(*storage, material);
82 for (
Size i = 0; i < 2; ++i) {
83 std::cout <<
"prepare " << i << std::endl;
84 integrator.step(tbb, solver, stats);
88 for (
Size i = 0; i < 50; ++i) {
89 std::cout <<
"step " << i << std::endl;
90 integrator.step(tbb, solver, stats);
93 std::cout << threadCnt <<
" " << duration << std::endl;
94 ofs << threadCnt <<
" " << duration << std::endl;
98 BENCHMARK(
"Thread scaling",
"[solvers]", Benchmark::Context& context) {
99 test<AsymmetricSolver>(
"scaling_asym.txt");
100 test<SymmetricSolver<DIMENSIONS>>(
"scaling_sym.txt");
101 test<GravitySolver<AsymmetricSolver>>(
"scaling_gravity.txt");
102 while (context.running()) {
SPH solver with asymmetric particle evaluation.
uint32_t Size
Integral type used to index arrays (by default).
SPH solver including gravity.
Helper functions performing common tasks in unit testing and benchmarks.
BENCHMARK("SymmetricSolver simple", "[solvers]", Benchmark::Context &context)
NAMESPACE_SPH_BEGIN EquationHolder getStandardEquations(const RunSettings &settings, const EquationHolder &other)
Standard SPH equation set, using density and specific energy as independent variables.
Standard SPH formulation that uses continuity equation for solution of density.
Basic SPH solver, evaluating all interactions symmetrically.
Implements IScheduler interface using TBB.
Algorithms for temporal evolution of the physical model.
Generic SPH solver, evaluating equations for each particle separately.
See Owen 2009: A compatibly differenced total energy conserving form of SPH.
Extension of a generic SPH solver, including gravitational interactions of particles.
Material settings and functions specific for one material.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Base class for all solvers.
virtual void integrate(Storage &storage, Statistics &stats)=0
Computes derivatives of all time-dependent quantities.
virtual void create(Storage &storage, IMaterial &material) const =0
Initializes all quantities needed by the solver in the storage.
Predictor-corrector second-order timestepping.
Settings & set(const TEnum idx, TValue &&value, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0)
Saves a value into the settings.
Object holding various statistics about current run.
Container storing all quantities used within the simulations.
MaterialView getMaterial(const Size matIdx) const
Returns an object containing a reference to given material.
Scheduler encapsulating Intel Thread Building Blocks (TBB).
Thread pool capable of executing tasks concurrently.
static SharedPtr< ThreadPool > getGlobalInstance()
Returns the global instance of the thread pool.
Basic time-measuring tool. Starts automatically when constructed.
int64_t elapsed(const TimerUnit unit) const
Returns elapsed time in timer units. Does not reset the timer.
Generic storage and input/output routines of settings.
@ ENERGY
Initial specific internal energy.
@ DENSITY
Density at zero pressure.
Storage getSolidStorage(const Size particleCnt, BodySettings settings, const IDomain &domain)
Returns a storage with stress tensor.