|
Peano
|
Functions | |
| rotation_matrix (axis, theta) | |
| Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians. | |
| draw_R (scale=1.0, origin=[0.0, 0.0, 0.0], plane=0, random_shift=True, shift_scale=0.05) | |
| Draw a letter R consisting of 17 particles. | |
Variables | |
| parser = argparse.ArgumentParser(description="Test periodic boundary conditions") | |
| Parse user input. | |
| dest | |
| type | |
| int | |
| default | |
| help | |
| action | |
| args = parser.parse_args() | |
| int | dimensions = 2 |
| Generate ExaParty project. | |
| int | hydro_dimensions = 2 |
| project | |
| particle | |
| particle_set = project.add_particle_species(particle) | |
| build_mode = peano4.api.output.CompileMode.DEBUG | |
| list | offset = [0, 0, 0] |
| list | domain_size = [1, 1, 1] |
| list | periodic_boundary_conditions = [True, True, False] |
| min_end_time | |
| max_end_time | |
| first_plot_time_stamp | |
| time_in_between_plots | |
| periodic_BC | |
| plotter_precision | |
| str | particle_force = "" |
| Declare the force acting on the particle. | |
| float | search_radius = args.cell_size / 100.0 |
| Initialisation snippet for the particle. | |
| tuple | initialisation_snippet |
| R1 = draw_R(scale=0.2, origin=[0.1, 0.4, 0.5], plane=0) | |
| R2 = draw_R(scale=0.2, origin=[0.7, 0.4, 0.5], plane=0) | |
| R3 = draw_R(scale=0.2, origin=[0.4, 0.1, 0.5], plane=0) | |
| R4 = draw_R(scale=0.2, origin=[0.4, 0.7, 0.5], plane=0) | |
| R5 = draw_R(scale=0.2, origin=[0.1, 0.1, 0.5], plane=0) | |
| R6 = draw_R(scale=0.2, origin=[0.1, 0.7, 0.5], plane=0) | |
| R7 = draw_R(scale=0.2, origin=[0.7, 0.1, 0.5], plane=0) | |
| R8 = draw_R(scale=0.2, origin=[0.7, 0.7, 0.5], plane=0) | |
| coords = np.concatenate((R1, R2, R3, R4, R5, R6, R7, R8), axis=0) | |
| 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/"] |
| overwrite | |
| Always | |
| throw_away_data_after_generation | |
| make_clean_first | |
| True | |
| number_of_parallel_builds | |
| list | output_files |
| test_periodic_BC-2D.draw_R | ( | scale = 1.0, |
|
origin = [0.0, 0.0, 0.0], |
|||
plane = 0, |
|||
random_shift = True, |
|||
shift_scale = 0.05 |
|||
| ) |
Draw a letter R consisting of 17 particles.
scale: what the total size of the letter R should be. origin: where to put lower left corner of R plane: along which plane to put the letter: 0: x-y plane. 1: y-z plane. 2: x-z plane. 3: rotate by 45deg around axis (1, 1, 1,) perturb: Whether to randomly shift the resulting array by up to shift_scale. Use this to avoid having particles end up overlapping once the simulation is running.
returns: numpy array of 3D coordinates of 17 particles
Definition at line 288 of file test_periodic_BC-2D.py.
References rotation_matrix().

| test_periodic_BC-2D.rotation_matrix | ( | axis, | |
| theta | |||
| ) |
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians.
https://stackoverflow.com/questions/6802577/rotation-of-3d-vector
Definition at line 266 of file test_periodic_BC-2D.py.
Referenced by draw_R().

| test_periodic_BC-2D.action |
Definition at line 23 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.Always |
Definition at line 440 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.args = parser.parse_args() |
Definition at line 89 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.build_mode = peano4.api.output.CompileMode.DEBUG |
Definition at line 120 of file test_periodic_BC-2D.py.
Definition at line 372 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.default |
Definition at line 17 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.dest |
Definition at line 17 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.dimensions = 2 |
Generate ExaParty project.
Definition at line 96 of file test_periodic_BC-2D.py.
| list test_periodic_BC-2D.dirs = ["vertexdata/", "repositories/", "globaldata/", "observers/"] |
Definition at line 435 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.domain_size = [1, 1, 1] |
Definition at line 127 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.first_plot_time_stamp |
Definition at line 136 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.help |
Definition at line 17 of file test_periodic_BC-2D.py.
| int test_periodic_BC-2D.hydro_dimensions = 2 |
Definition at line 97 of file test_periodic_BC-2D.py.
| tuple test_periodic_BC-2D.initialisation_snippet |
Definition at line 172 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.int |
Definition at line 17 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.make_clean_first |
Definition at line 442 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.max_end_time |
Definition at line 135 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.min_end_time |
Definition at line 134 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.number_of_parallel_builds |
Definition at line 442 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.offset = [0, 0, 0] |
Definition at line 126 of file test_periodic_BC-2D.py.
| list test_periodic_BC-2D.output_files |
Definition at line 445 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.overwrite |
Definition at line 440 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.parser = argparse.ArgumentParser(description="Test periodic boundary conditions") |
Parse user input.
Definition at line 15 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.particle |
Definition at line 107 of file test_periodic_BC-2D.py.
| str test_periodic_BC-2D.particle_force = "" |
Declare the force acting on the particle.
No force. We just need the particles to drift along calmly with the same velocity they start out with.
Definition at line 156 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.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.api.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.
Definition at line 407 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.particle_set = project.add_particle_species(particle) |
Definition at line 116 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.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 426 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.periodic_BC |
Definition at line 138 of file test_periodic_BC-2D.py.
Definition at line 128 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.plotter_precision |
Definition at line 139 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.project |
Definition at line 100 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R1 = draw_R(scale=0.2, origin=[0.1, 0.4, 0.5], plane=0) |
Definition at line 361 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R2 = draw_R(scale=0.2, origin=[0.7, 0.4, 0.5], plane=0) |
Definition at line 362 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R3 = draw_R(scale=0.2, origin=[0.4, 0.1, 0.5], plane=0) |
Definition at line 363 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R4 = draw_R(scale=0.2, origin=[0.4, 0.7, 0.5], plane=0) |
Definition at line 364 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R5 = draw_R(scale=0.2, origin=[0.1, 0.1, 0.5], plane=0) |
Definition at line 366 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R6 = draw_R(scale=0.2, origin=[0.1, 0.7, 0.5], plane=0) |
Definition at line 367 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R7 = draw_R(scale=0.2, origin=[0.7, 0.1, 0.5], plane=0) |
Definition at line 368 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.R8 = draw_R(scale=0.2, origin=[0.7, 0.7, 0.5], plane=0) |
Definition at line 369 of file test_periodic_BC-2D.py.
| float test_periodic_BC-2D.search_radius = args.cell_size / 100.0 |
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 171 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.throw_away_data_after_generation |
Definition at line 440 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.time_in_between_plots |
Definition at line 137 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.True |
Definition at line 442 of file test_periodic_BC-2D.py.
| test_periodic_BC-2D.type |
Definition at line 17 of file test_periodic_BC-2D.py.