![]() |
Peano
|
Variables | |
parser = argparse.ArgumentParser(description="SPH benchmarking script") | |
Parse user input. | |
dest | |
type | |
int | |
default | |
help | |
action | |
required | |
choices | |
args = parser.parse_args() | |
list | project_namespace = ["benchmarks", "swift2", "densityTest"] |
Generate SWIFT project. | |
dimensions = args.dimensions | |
project | |
int | HYDRO_DIMENSIONS = 1 |
HYDRO_PART_NUMBER = str(args.particle_number) | |
Set parameters for the SPH simulation If no parameters are passed to the swift2 project, it initializes with default values. | |
particle | |
GLOBAL_TIME_STEP_SIZE = args.timestep_size | |
CFL_CONSTANT = particle._cfl_factor | |
list | gamma_hydro_list = [str(5 / 3), str(7 / 5), str(4 / 3), str(2 / 1)] |
list | gamma_hydro_list_symbols |
list | GAMMA = gamma_hydro_list[0] |
list | GAMMA_HYDRO_SYMBOL = gamma_hydro_list_symbols[0] |
kernel = args.kernel | |
KERNEL_SYMBOL = sphtools.sph_kernel_macro_name[kernel] | |
KERNEL_SUPPORT_RAD = sphtools.sph_kernel_H_over_h[HYDRO_DIMENSIONS - 1][kernel] | |
int | hydro_h_max = args.cell_size / 2 |
h_hydro_max | |
particle_set = project.add_particle_species(particle) | |
build_mode = peano4.output.CompileMode.Asserts | |
list | offset = [0, 0, 0] |
list | domain_size = [1, 1, 1] |
list | periodic_boundary_conditions = [False, False, False] |
min_end_time | |
max_end_time | |
first_plot_time_stamp | |
time_in_between_plots | |
periodic_BC | |
plotter_precision | |
ICs = swift2.scenario.TestDensityCalculation() | |
Initialisation snippet for the particle. | |
initialisation_snippet = ICs.initialisation_snippet | |
Npart = args.particle_number | |
coords = np.zeros((Npart**HYDRO_DIMENSIONS, 3)) | |
endpoint | |
x = np.linspace(offset, 1, Npart, endpoint=False) | |
y = np.linspace(offset, 1, Npart, endpoint=False) | |
xp = xp.reshape((np.prod(xp.shape),)) | |
yp = yp.reshape((np.prod(yp.shape),)) | |
particle_plotter | |
Set up the plotter. | |
peano4_project = project.generate_Peano4_project(verbose=args.verbose) | |
Generate plain Peano 4 project. | |
list | dirs = ["vertexdata/", "repositories/", "globaldata/", "observers/"] |
Cleanup and compilation. | |
overwrite | |
Always | |
throw_away_data_after_generation | |
make_clean_first | |
True | |
number_of_parallel_builds | |
list | output_files |
test-density-calculation.action |
Definition at line 26 of file test-density-calculation.py.
test-density-calculation.Always |
Definition at line 379 of file test-density-calculation.py.
test-density-calculation.args = parser.parse_args() |
Definition at line 101 of file test-density-calculation.py.
test-density-calculation.build_mode = peano4.output.CompileMode.Asserts |
Definition at line 193 of file test-density-calculation.py.
test-density-calculation.CFL_CONSTANT = particle._cfl_factor |
Definition at line 148 of file test-density-calculation.py.
test-density-calculation.choices |
Definition at line 98 of file test-density-calculation.py.
test-density-calculation.coords = np.zeros((Npart**HYDRO_DIMENSIONS, 3)) |
Definition at line 241 of file test-density-calculation.py.
test-density-calculation.default |
Definition at line 20 of file test-density-calculation.py.
test-density-calculation.dest |
Definition at line 20 of file test-density-calculation.py.
test-density-calculation.dimensions = args.dimensions |
Definition at line 110 of file test-density-calculation.py.
list test-density-calculation.dirs = ["vertexdata/", "repositories/", "globaldata/", "observers/"] |
Cleanup and compilation.
Definition at line 372 of file test-density-calculation.py.
test-density-calculation.domain_size = [1, 1, 1] |
Definition at line 198 of file test-density-calculation.py.
test-density-calculation.endpoint |
Definition at line 245 of file test-density-calculation.py.
test-density-calculation.first_plot_time_stamp |
Definition at line 207 of file test-density-calculation.py.
list test-density-calculation.GAMMA = gamma_hydro_list[0] |
Definition at line 158 of file test-density-calculation.py.
list test-density-calculation.gamma_hydro_list = [str(5 / 3), str(7 / 5), str(4 / 3), str(2 / 1)] |
Definition at line 151 of file test-density-calculation.py.
list test-density-calculation.gamma_hydro_list_symbols |
Definition at line 152 of file test-density-calculation.py.
list test-density-calculation.GAMMA_HYDRO_SYMBOL = gamma_hydro_list_symbols[0] |
Definition at line 159 of file test-density-calculation.py.
test-density-calculation.GLOBAL_TIME_STEP_SIZE = args.timestep_size |
Definition at line 147 of file test-density-calculation.py.
test-density-calculation.h_hydro_max |
Definition at line 170 of file test-density-calculation.py.
test-density-calculation.help |
Definition at line 20 of file test-density-calculation.py.
int test-density-calculation.HYDRO_DIMENSIONS = 1 |
Definition at line 117 of file test-density-calculation.py.
int test-density-calculation.hydro_h_max = args.cell_size / 2 |
Definition at line 169 of file test-density-calculation.py.
test-density-calculation.HYDRO_PART_NUMBER = str(args.particle_number) |
Set parameters for the SPH simulation If no parameters are passed to the swift2 project, it initializes with default values.
The values of the parameters can be modified or retrieved using the set/get methods.
Definition at line 120 of file test-density-calculation.py.
test-density-calculation.ICs = swift2.scenario.TestDensityCalculation() |
Initialisation snippet for the particle.
If we work with only one particle, then we can simply set its velocity. However, our script works both if we only module the earth but also when we model earth and sun explicitly. In the latter case, we have to ensure that only the earth is given an initial velocity.
Definition at line 233 of file test-density-calculation.py.
test-density-calculation.initialisation_snippet = ICs.initialisation_snippet |
Definition at line 234 of file test-density-calculation.py.
test-density-calculation.int |
Definition at line 20 of file test-density-calculation.py.
test-density-calculation.kernel = args.kernel |
Definition at line 163 of file test-density-calculation.py.
test-density-calculation.KERNEL_SUPPORT_RAD = sphtools.sph_kernel_H_over_h[HYDRO_DIMENSIONS - 1][kernel] |
Definition at line 165 of file test-density-calculation.py.
test-density-calculation.KERNEL_SYMBOL = sphtools.sph_kernel_macro_name[kernel] |
Definition at line 164 of file test-density-calculation.py.
test-density-calculation.make_clean_first |
Definition at line 381 of file test-density-calculation.py.
test-density-calculation.max_end_time |
Definition at line 206 of file test-density-calculation.py.
test-density-calculation.min_end_time |
Definition at line 205 of file test-density-calculation.py.
test-density-calculation.Npart = args.particle_number |
Definition at line 240 of file test-density-calculation.py.
test-density-calculation.number_of_parallel_builds |
Definition at line 381 of file test-density-calculation.py.
test-density-calculation.offset = [0, 0, 0] |
Definition at line 197 of file test-density-calculation.py.
list test-density-calculation.output_files |
Definition at line 384 of file test-density-calculation.py.
test-density-calculation.overwrite |
Definition at line 379 of file test-density-calculation.py.
test-density-calculation.parser = argparse.ArgumentParser(description="SPH benchmarking script") |
Parse user input.
Definition at line 18 of file test-density-calculation.py.
test-density-calculation.particle |
Definition at line 123 of file test-density-calculation.py.
test-density-calculation.particle_plotter |
Set up the plotter.
A plotter has to be told explicitly which data to visualisation. We visualise the velocity here as scalar attribute. To some degree, this is redundant info as we implicitly have the position of the particle and can "see" its velocity when we play through a movie. But the explicit visualisation shows how to handle attributes per particle.
When we create the plotter, we have to inform it how to enumerate the individual snapshots. Obviously, we can just count through the snapshots. In this case, you have to pass the constant peano4.toolbox.particles.PlotParticlesInVTKFormat.CountTimeSteps into the field time_stamp_evaluation. You can also define your own time stamp. For this, it is useful to know that each particle definition in the Python script will yield a particle class with the same name in the subnamespace globaldata. Every particle class in return has a class attribute
getSpecies()
which returns an object that holds global information about this particle type.
particle_plotter = peano4.toolbox.particles.PlotParticlesInVTKFormat( "particles", particle_set, time_stamp_evaluation=peano4.toolbox.particles.PlotParticlesInVTKFormat.CountTimeSteps )
Definition at line 304 of file test-density-calculation.py.
test-density-calculation.particle_set = project.add_particle_species(particle) |
Definition at line 190 of file test-density-calculation.py.
test-density-calculation.peano4_project = project.generate_Peano4_project(verbose=args.verbose) |
Generate plain Peano 4 project.
See commments above (for the force interaction kernel) why we might want to have some of the constants from the Python script within the C++ code base that's generated.
Definition at line 330 of file test-density-calculation.py.
test-density-calculation.periodic_BC |
Definition at line 209 of file test-density-calculation.py.
list test-density-calculation.periodic_boundary_conditions = [False, False, False] |
Definition at line 199 of file test-density-calculation.py.
test-density-calculation.plotter_precision |
Definition at line 210 of file test-density-calculation.py.
test-density-calculation.project |
Definition at line 112 of file test-density-calculation.py.
list test-density-calculation.project_namespace = ["benchmarks", "swift2", "densityTest"] |
Generate SWIFT project.
Definition at line 108 of file test-density-calculation.py.
test-density-calculation.required |
Definition at line 49 of file test-density-calculation.py.
test-density-calculation.throw_away_data_after_generation |
Definition at line 379 of file test-density-calculation.py.
test-density-calculation.time_in_between_plots |
Definition at line 208 of file test-density-calculation.py.
test-density-calculation.True |
Definition at line 381 of file test-density-calculation.py.
test-density-calculation.type |
Definition at line 20 of file test-density-calculation.py.
Definition at line 248 of file test-density-calculation.py.
test-density-calculation.xp = xp.reshape((np.prod(xp.shape),)) |
Definition at line 251 of file test-density-calculation.py.
Definition at line 249 of file test-density-calculation.py.
test-density-calculation.yp = yp.reshape((np.prod(yp.shape),)) |
Definition at line 251 of file test-density-calculation.py.