diff --git a/include/poisson_solver/poisson_solver.h b/include/poisson_solver/poisson_solver.h index a739f74..cad68a6 100755 --- a/include/poisson_solver/poisson_solver.h +++ b/include/poisson_solver/poisson_solver.h @@ -56,7 +56,8 @@ class PoissonSolver { double target_accuracy, int num_cycles, int solver_intervall, - int solver_offset); + int solver_offset, + bool do_solver); void solvePotential(const blitz::Array charge_density, int cpu_sync); @@ -75,6 +76,7 @@ class PoissonSolver { const int num_cycles_; const int solver_intervall_; const int solver_offset_; + const bool do_solver_; // density binning defined on the cell centers, potential defined // such that it exists on the cell edges so that the azimuthal diff --git a/simulation_config/function_examples.json b/simulation_config/function_examples.json index 7073f21..20b4241 100755 --- a/simulation_config/function_examples.json +++ b/simulation_config/function_examples.json @@ -54,6 +54,13 @@ "yValuesKey": "/vz(ms)", "prefactor": 1 } + }, + "f5": { + "Exponential": { + "scale": -1, + "prefactor": 1, + "comment": "f5 = prefactor*exp(scale*x)" + } } }, "3dto1D examples": { diff --git a/simulation_config/test_parameter.json b/simulation_config/test_parameter.json index 64e2822..8447ed7 100755 --- a/simulation_config/test_parameter.json +++ b/simulation_config/test_parameter.json @@ -568,6 +568,15 @@ } } } + }, + "GradientField": { + "VectorFieldFunctionInZ": { + "zFunction": { + "Constant3D": { + "constant": 2.5 + } + } + } } }, "GravityField": { @@ -616,7 +625,8 @@ "TargetAccuracy": 1e-7, "NumCycles": 2e4, "Intervall": 1, - "Offset": 9 + "Offset": 9, + "DoSolver": "true" }, "Simulation": { "SimulatedEvents": 1, @@ -639,9 +649,7 @@ "OverwriteLast": "true" }, "DeletionLogger": { - "Species": [ - "all" - ], + "Species": "all", "Intervall": "EachSync", "OverwriteLast": "true" }, diff --git a/simulation_config/test_poisson_parameter.json b/simulation_config/test_poisson_parameter.json index 67c6166..8256a4f 100755 --- a/simulation_config/test_poisson_parameter.json +++ b/simulation_config/test_poisson_parameter.json @@ -565,6 +565,15 @@ } } } + }, + "GradientField": { + "VectorFieldFunctionInZ": { + "zFunction": { + "Constant3D": { + "constant": 0 + } + } + } } }, "PoissonSolver": { @@ -585,13 +594,30 @@ "GlobalPositionBinning" ] }, + "Boundary": { + "Top": { + "type": "neumann", + "value": 0 + }, + "Bottom": { + "type": "dirichlet", + "value": 0 + }, + "Hull": { + "type": "dirichlet", + "value": 0 + } + }, "TargetAccuracy": 1e-7, - "NumCycles": 2e4 + "NumCycles": 2e4, + "Intervall": 1, + "Offset": 0 }, "Simulation": { "SimulatedEvents": 1, "EventStride": 1, - "PoissonOffset": 0 + "PoissonOffset": 0, + "DoSolver": "false" }, "Output": { "folder": "output", diff --git a/src/generators/poisson_solver_generator.cpp b/src/generators/poisson_solver_generator.cpp index 299c66b..1156469 100644 --- a/src/generators/poisson_solver_generator.cpp +++ b/src/generators/poisson_solver_generator.cpp @@ -51,10 +51,14 @@ namespace generator { int num_cycles = parameter.intValue(json_path_append({"PoissonSolver"}, {"NumCycles"})); + + bool do_solver = parameter.boolValue(json_path_append({"PoissonSolver"}, + {"DoSolver"}), true); return std::shared_ptr(new PoissonSolver(boundaries.at("Bottom"), boundaries.at("Top"), boundaries.at("Hull"), geometry, position_binning, - electrodes, target_accuracy, num_cycles, solver_intervall, solver_offset)); + electrodes, target_accuracy, num_cycles, solver_intervall, solver_offset, + do_solver)); } std::map buildBoundaries(Parameter& parameter, diff --git a/src/poisson_solver/poisson_solver.cpp b/src/poisson_solver/poisson_solver.cpp index 68748ca..beef55e 100755 --- a/src/poisson_solver/poisson_solver.cpp +++ b/src/poisson_solver/poisson_solver.cpp @@ -17,7 +17,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary, double target_accuracy, int num_cycles, int solver_intervall, - int solver_offset) + int solver_offset, + bool do_solver) : bottom_boundary_(bottom_boundary), top_boundary_(top_boundary), hull_boundary_(hull_boundary), @@ -34,7 +35,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary, target_accuracy_(target_accuracy), num_cycles_(num_cycles), solver_intervall_(solver_intervall), - solver_offset_(solver_offset) { + solver_offset_(solver_offset), + do_solver_(do_solver) { blitz::TinyVector stepsize = density_binning_.stepsize(); for (int i = potential_.lbound(0); i <= potential_.ubound(0); ++i) { @@ -84,8 +86,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary, void PoissonSolver::solvePotential( const blitz::Array charge_density, int cpu_sync) { - if ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_) - && (cpu_sync > 0))) { + if ((!do_solver_) || ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_) + && (cpu_sync > 0)))) { return; } DEBUG_LEVEL_3("Interpolating chargedensity.");