Peano 4
Loading...
Searching...
No Matches
swift2.Project.Project Class Reference

Swift2 project. More...

Inheritance diagram for swift2.Project.Project:
Collaboration diagram for swift2.Project.Project:

Public Member Functions

 __init__ (self, namespace, project_name, directory=".", executable="swift2")
 
 set_load_balancing (self, load_balancer_name, load_balancer_arguments)
 load_balancer_name: string Should be full-qualified name of the load balancer.
 
 set_Peano4_installation (self, src_path, mode=peano4.output.CompileMode.Release)
 src_path: string Path (relative or absolute) to the src directory of Peano.
 
 real_mesh_size (self, target_h)
 Translate a mesh size into its real Peano mesh size.
 
 set_global_simulation_parameters (self, dimensions, offset, domain_size, min_end_time, max_end_time, first_plot_time_stamp, time_in_between_plots, periodic_BC=[False, False, False], plotter_precision=5)
 offset and size should be lists with dimensions double entries.
 
 set_output_path (self, path)
 
 add_particle_species (self, Particle particle)
 Add a new particle species (type) to the project.
 
 generate_Peano4_project (self, verbose=False)
 Build the Peano4 project.
 
 main_file_template (self)
 

Data Fields

 algorithm_step_create_grid
 
 algorithm_step_initial_conditions
 
 algorithm_step_plot
 
 additional_action_sets_per_solver_step
 
 algorithm_steps_task_graph_compiler
 
 initialisation_steps_task_graph_compiler
 

Static Public Attributes

str LibraryDebug = "_debug"
 
str LibraryRelease = ""
 
str LibraryTrace = "_trace"
 
str LibraryAsserts = "_asserts"
 
str LibraryStats = "_stats"
 

Protected Attributes

 _project
 
 _domain_offset
 
 _domain_size
 
 _dimensions
 
 _min_terminal_time
 
 _max_terminal_time
 
 _first_plot_time_stamp
 
 _time_in_between_plots
 
 _load_balancer_name
 
 _load_balancer_arguments
 
 _Peano_src_directory
 
 _build_mode
 
 _executable_name
 
 _periodic_BC
 
 _output_path
 
 _particle_species
 
 _particle_species_set
 
 _global_max_h
 
 _plotter_precision
 

Private Member Functions

 __compute_global_max_h (self)
 
 __export_constants (self)
 We export SWIFT's constants.
 
 __real_max_mesh_size (self)
 
 __configure_makefile (self)
 
 __generate_global_state_files (self)
 

Detailed Description

Swift2 project.

Represents an abstract SWIFT 2 project. An SWIFT 2 project is a Peano 4 project with a particular set of actions (algorithmic phases) that you can choose from and with particular solver types. It realises a builder mechanism, i.e. you build up your SWIFT 2 project and then you finally tell the project "give me the Peano 4 project". From hereon, you can use this Peano 4 project to actually set up the Peano 4 application.

Please do not use this class directly. Use one of its subclasses.

See also
generate_Peano4_project()

Definition at line 23 of file Project.py.

Constructor & Destructor Documentation

◆ __init__()

swift2.Project.Project.__init__ ( self,
namespace,
project_name,
directory = ".",
executable = "swift2" )

Definition at line 42 of file Project.py.

Member Function Documentation

◆ __compute_global_max_h()

swift2.Project.Project.__compute_global_max_h ( self)
private

Definition at line 116 of file Project.py.

Referenced by swift2.Project.Project.generate_Peano4_project().

Here is the caller graph for this function:

◆ __configure_makefile()

swift2.Project.Project.__configure_makefile ( self)
private

Definition at line 300 of file Project.py.

References Scenarios.Acoustic_planar_waves.Acoustic_planar_waves._dimensions, Scenarios.Advection_linear.Advection_linear._dimensions, Scenarios.Elastic_planar_waves.Elastic_planar_waves._dimensions, Scenarios.Euler_gaussian_bell.Euler_gaussian_bell._dimensions, Scenarios.Euler_isotropic_vortex.Euler_isotropic_vortex._dimensions, Scenarios.Scenario.Scenario._dimensions, Scenarios.SWE_radial_dam_break.SWE_radial_dam_break._dimensions, Scenarios.SWE_resting_lake.SWE_resting_lake._dimensions, exahype2.Project.Project._dimensions, petsc.Project.Project._dimensions, peano4.visualisation.output.Interactive.Interactive._dimensions, peano4.visualisation.output.PatchFile.PatchFile._dimensions, peano4.visualisation.output.Visualiser.Visualiser._dimensions, peano4.visualisation.output.VTU.VTU._dimensions, swift2.Project.Project._dimensions, convert::input::PeanoTextPatchFileReader._dimensions, tarch::plotter::griddata::blockstructured::PeanoHDF5PatchFileWriter._dimensions, tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter._dimensions, exahype2.Project.Project._executable_name, petsc.Project.Project._executable_name, swift2.Project.Project._executable_name, exahype2.Project.Project._project, petsc.Project.Project._project, peano4.solversteps.Steps.Steps._project, and swift2.Project.Project._project.

Referenced by exahype2.Project.Project.generate_Peano4_project(), petsc.Project.Project.generate_Peano4_project(), and swift2.Project.Project.generate_Peano4_project().

Here is the caller graph for this function:

◆ __export_constants()

swift2.Project.Project.__export_constants ( self)
private

We export SWIFT's constants.

Besides the constants from SWIFT, I also export some parameters from Peano onto the SWIFT constants file. Therefore, it is important that you parse the configure output before we export the constants.

Definition at line 123 of file Project.py.

References Scenarios.Acoustic_planar_waves.Acoustic_planar_waves._dimensions, Scenarios.Advection_linear.Advection_linear._dimensions, Scenarios.Elastic_planar_waves.Elastic_planar_waves._dimensions, Scenarios.Euler_gaussian_bell.Euler_gaussian_bell._dimensions, Scenarios.Euler_isotropic_vortex.Euler_isotropic_vortex._dimensions, Scenarios.Scenario.Scenario._dimensions, Scenarios.SWE_radial_dam_break.SWE_radial_dam_break._dimensions, Scenarios.SWE_resting_lake.SWE_resting_lake._dimensions, exahype2.Project.Project._dimensions, petsc.Project.Project._dimensions, peano4.visualisation.output.Interactive.Interactive._dimensions, peano4.visualisation.output.PatchFile.PatchFile._dimensions, peano4.visualisation.output.Visualiser.Visualiser._dimensions, peano4.visualisation.output.VTU.VTU._dimensions, swift2.Project.Project._dimensions, convert::input::PeanoTextPatchFileReader._dimensions, tarch::plotter::griddata::blockstructured::PeanoHDF5PatchFileWriter._dimensions, tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter._dimensions, exahype2.Project.Project._domain_offset, petsc.Project.Project._domain_offset, swift2.Project.Project._domain_offset, Scenarios.Acoustic_planar_waves.Acoustic_planar_waves._domain_size, Scenarios.Elastic_planar_waves.Elastic_planar_waves._domain_size, Scenarios.Euler_gaussian_bell.Euler_gaussian_bell._domain_size, Scenarios.Euler_isotropic_vortex.Euler_isotropic_vortex._domain_size, Scenarios.Scenario.Scenario._domain_size, Scenarios.SWE_radial_dam_break.SWE_radial_dam_break._domain_size, Scenarios.SWE_resting_lake.SWE_resting_lake._domain_size, exahype2.Project.Project._domain_size, petsc.Project.Project._domain_size, swift2.Project.Project._domain_size, exahype2.Project.Project._first_plot_time_stamp, swift2.Project.Project._first_plot_time_stamp, exahype2.Project.Project._max_terminal_time, swift2.Project.Project._max_terminal_time, exahype2.Project.Project._min_terminal_time, swift2.Project.Project._min_terminal_time, exahype2.Project.Project._project, petsc.Project.Project._project, peano4.solversteps.Steps.Steps._project, swift2.Project.Project._project, exahype2.Project.Project._time_in_between_plots, and swift2.Project.Project._time_in_between_plots.

Referenced by petsc.Project.Project.__configure_makefile(), exahype2.Project.Project.generate_Peano4_project(), and swift2.Project.Project.generate_Peano4_project().

Here is the caller graph for this function:

◆ __generate_global_state_files()

◆ __real_max_mesh_size()

swift2.Project.Project.__real_max_mesh_size ( self)
private

Definition at line 297 of file Project.py.

References swift2.Project.Project._global_max_h, and swift2.Project.Project.real_mesh_size().

Here is the call graph for this function:

◆ add_particle_species()

swift2.Project.Project.add_particle_species ( self,
Particle particle )

Add a new particle species (type) to the project.

You get the container back in which the particles are handled on the rank. Use this one where another action set requires a particle set.

Definition at line 377 of file Project.py.

References swift2.Project.Project._particle_species, and swift2.Project.Project._particle_species_set.

◆ generate_Peano4_project()

swift2.Project.Project.generate_Peano4_project ( self,
verbose = False )

Build the Peano4 project.

The main job of this routine is to add all the action sets et al that you require to run this ExaHyPE2 application.

This routine generates a Peano project, i.e. the domain-specific ExaHyPE view is translated into a Peano model. Once you have called this routine, any changes to the ExaHyPE 2 configuration do not propagate into the Peano setup anymore. If you alter the ExaHyPE setup, you have to call generate_Peano4_project() again to get a new snapshot/version of the Peano setup.

Initial grid

The initial grid will be a regular one, spanned through

According to the documentation of peano4.toolbox.CreateRegularGrid, the action set will produce a mesh that is just finer than the mesh width passed, so we meet the max mesh width, but do not create a mesh that is significantly finer.

As we insert particles in SPH, we have therefore to make this initial resolution three times coarser than what we allow, as we only insert particles into the finest mesh.

Task graph compiler

The core contribution of the generation is the task graph compiler which really is a mapping of algorithm steps per particle species onto grid sweeps. The actual mapping is outsourced into the function represented by self.task_graph_compiler. This way, users can switch the translator's behaviour. This function returns a sequence of mesh traversals. On top of that, we have the default traversals to create a grid, to plot it, and to initialise the setup.

Once we have our three default steps plus a sequence of algorithmic steps per time step, we run through the following steps:

  • Create a particle set around each species and add it to the project as global variable. This is the global container administering these guys.
  • Tell each algorithmic step to use this particle set. An exception could be the grid creation. At this point, we don't have particles yet. We add the data structure nevertheless. It ensures that we have all the data in place, and it we also then can be sure that everything is properly initialised. The actual particle set will be empty at this point of the simulation.
  • Ensure that plotting and initialisation use the update particle-grid association properly. The plot has to update it, as previous steps might have started a resort yet might not have finished it.
  • Add all the algorithmic steps, including the default ones, to the project.

Particle initialisation and proper sorting

The particle initialisation might end up with an invalid association of particles to vertices. The graph compiler might make the first step of a time step sequence sort if and only if the last one has altered the particles' position. Consequently, we might end up with an initialisation which yields an inconsistent data association. We therefore make it sort the particles, but we need another grid sweep to finalise this sort in case we have to do some global rearrangements. This is our rationale why we realise the initialisation in two steps.

Definition at line 391 of file Project.py.

References swift2.Project.Project.__compute_global_max_h(), exahype2.Project.Project.__configure_makefile(), petsc.Project.Project.__configure_makefile(), swift2.Project.Project.__configure_makefile(), exahype2.Project.Project.__export_constants(), petsc.Project.Project.__export_constants(), swift2.Project.Project.__export_constants(), swift2.Project.Project.__generate_global_state_files(), exahype2.Project.Project._build_mode, petsc.Project.Project._build_mode, swift2.Project.Project._build_mode, swift2.Project.Project._global_max_h, swift2.Project.Project._particle_species_set, exahype2.Project.Project._Peano_src_directory, petsc.Project.Project._Peano_src_directory, swift2.Project.Project._Peano_src_directory, exahype2.Project.Project._project, petsc.Project.Project._project, peano4.solversteps.Steps.Steps._project, swift2.Project.Project._project, swift2.Project.Project.additional_action_sets_per_solver_step, petsc.Project.Project.algorithm_step_create_grid, swift2.Project.Project.algorithm_step_create_grid, swift2.Project.Project.algorithm_step_initial_conditions, petsc.Project.Project.algorithm_step_plot, swift2.Project.Project.algorithm_step_plot, swift2.Project.Project.algorithm_steps_task_graph_compiler, peano4.toolbox.api.EnumerateCellsAndVerticesOnEnclaveMesh.create_cell_marker(), peano4.toolbox.api.EnumerateCellsAndVerticesOnEnclaveMesh.create_vertex_marker(), and swift2.Project.Project.initialisation_steps_task_graph_compiler.

Here is the call graph for this function:

◆ main_file_template()

swift2.Project.Project.main_file_template ( self)

Definition at line 610 of file Project.py.

◆ real_mesh_size()

swift2.Project.Project.real_mesh_size ( self,
target_h )

◆ set_global_simulation_parameters()

swift2.Project.Project.set_global_simulation_parameters ( self,
dimensions,
offset,
domain_size,
min_end_time,
max_end_time,
first_plot_time_stamp,
time_in_between_plots,
periodic_BC = [False, False, False],
plotter_precision = 5 )

offset and size should be lists with dimensions double entries.

first_plot_time_stamp: Float Is irrelevant if time_in_between_plots equals zero

time_in_between_plots: Float Set to zero if you don't want to have any plots

max_end_time: Float If you set it zero (or actually any value msmaller than min_end_time), then the code will run until the cell that lags behind the most hits the min time. If you specify a valid max time however, you can stop the sim as soon as the most advanced cell exceeds this threshold.

Definition at line 304 of file Project.py.

References Scenarios.Acoustic_planar_waves.Acoustic_planar_waves._dimensions, Scenarios.Advection_linear.Advection_linear._dimensions, Scenarios.Elastic_planar_waves.Elastic_planar_waves._dimensions, Scenarios.Euler_gaussian_bell.Euler_gaussian_bell._dimensions, Scenarios.Euler_isotropic_vortex.Euler_isotropic_vortex._dimensions, Scenarios.Scenario.Scenario._dimensions, Scenarios.SWE_radial_dam_break.SWE_radial_dam_break._dimensions, Scenarios.SWE_resting_lake.SWE_resting_lake._dimensions, exahype2.Project.Project._dimensions, petsc.Project.Project._dimensions, peano4.visualisation.output.Interactive.Interactive._dimensions, peano4.visualisation.output.PatchFile.PatchFile._dimensions, peano4.visualisation.output.Visualiser.Visualiser._dimensions, peano4.visualisation.output.VTU.VTU._dimensions, swift2.Project.Project._dimensions, convert::input::PeanoTextPatchFileReader._dimensions, tarch::plotter::griddata::blockstructured::PeanoHDF5PatchFileWriter._dimensions, tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter._dimensions, exahype2.Project.Project._domain_offset, petsc.Project.Project._domain_offset, swift2.Project.Project._domain_offset, Scenarios.Acoustic_planar_waves.Acoustic_planar_waves._domain_size, Scenarios.Elastic_planar_waves.Elastic_planar_waves._domain_size, Scenarios.Euler_gaussian_bell.Euler_gaussian_bell._domain_size, Scenarios.Euler_isotropic_vortex.Euler_isotropic_vortex._domain_size, Scenarios.Scenario.Scenario._domain_size, Scenarios.SWE_radial_dam_break.SWE_radial_dam_break._domain_size, Scenarios.SWE_resting_lake.SWE_resting_lake._domain_size, exahype2.Project.Project._domain_size, petsc.Project.Project._domain_size, swift2.Project.Project._domain_size, exahype2.Project.Project._first_plot_time_stamp, swift2.Project.Project._first_plot_time_stamp, exahype2.Project.Project._max_terminal_time, swift2.Project.Project._max_terminal_time, exahype2.Project.Project._min_terminal_time, swift2.Project.Project._min_terminal_time, exahype2.Project.Project._periodic_BC, swift2.Project.Project._periodic_BC, exahype2.Project.Project._plotter_precision, petsc.Project.Project._plotter_precision, swift2.Project.Project._plotter_precision, exahype2.Project.Project._time_in_between_plots, and swift2.Project.Project._time_in_between_plots.

◆ set_load_balancing()

swift2.Project.Project.set_load_balancing ( self,
load_balancer_name,
load_balancer_arguments )

load_balancer_name: string Should be full-qualified name of the load balancer.

By default, I recommend to pass "toolbox::loadbalancing::strategies::SpreadOutHierarchically", but you might be well-advices to study different classes within the namespace toolbox::loadbalancing.

load_balancer_arguments: string If your load balancing requires parameters, add them here. It is a string that will be copied into the C++ class instantiation. Please add the brackets yourself, i.e. "(3,4,5)" is fine, but "3,4,5" is not. The only exception is the empty parameter list. Here, you can/should simply add the empty string.

Definition at line 78 of file Project.py.

References exahype2.Project.Project._load_balancer_arguments, petsc.Project.Project._load_balancer_arguments, swift2.Project.Project._load_balancer_arguments, exahype2.Project.Project._load_balancer_name, petsc.Project.Project._load_balancer_name, and swift2.Project.Project._load_balancer_name.

◆ set_output_path()

swift2.Project.Project.set_output_path ( self,
path )

◆ set_Peano4_installation()

swift2.Project.Project.set_Peano4_installation ( self,
src_path,
mode = peano4.output.CompileMode.Release )

src_path: string Path (relative or absolute) to the src directory of Peano.

This path should hold both the headers (in subdirectories) and all the static libraries.

mode: peano4.output.CompileMode

Definition at line 104 of file Project.py.

References exahype2.Project.Project._build_mode, petsc.Project.Project._build_mode, swift2.Project.Project._build_mode, exahype2.Project.Project._Peano_src_directory, petsc.Project.Project._Peano_src_directory, and swift2.Project.Project._Peano_src_directory.

Field Documentation

◆ _build_mode

◆ _dimensions

◆ _domain_offset

◆ _domain_size

◆ _executable_name

swift2.Project.Project._executable_name
protected

◆ _first_plot_time_stamp

◆ _global_max_h

swift2.Project.Project._global_max_h
protected

◆ _load_balancer_arguments

◆ _load_balancer_name

◆ _max_terminal_time

◆ _min_terminal_time

◆ _output_path

◆ _particle_species

swift2.Project.Project._particle_species
protected

◆ _particle_species_set

swift2.Project.Project._particle_species_set
protected

◆ _Peano_src_directory

◆ _periodic_BC

◆ _plotter_precision

◆ _project

◆ _time_in_between_plots

◆ additional_action_sets_per_solver_step

swift2.Project.Project.additional_action_sets_per_solver_step

Definition at line 69 of file Project.py.

Referenced by swift2.Project.Project.generate_Peano4_project().

◆ algorithm_step_create_grid

swift2.Project.Project.algorithm_step_create_grid

◆ algorithm_step_initial_conditions

swift2.Project.Project.algorithm_step_initial_conditions

Definition at line 64 of file Project.py.

Referenced by swift2.Project.Project.generate_Peano4_project().

◆ algorithm_step_plot

swift2.Project.Project.algorithm_step_plot

◆ algorithm_steps_task_graph_compiler

swift2.Project.Project.algorithm_steps_task_graph_compiler

Definition at line 71 of file Project.py.

Referenced by swift2.Project.Project.generate_Peano4_project().

◆ initialisation_steps_task_graph_compiler

swift2.Project.Project.initialisation_steps_task_graph_compiler

Definition at line 74 of file Project.py.

Referenced by swift2.Project.Project.generate_Peano4_project().

◆ LibraryAsserts

str swift2.Project.Project.LibraryAsserts = "_asserts"
static

Definition at line 101 of file Project.py.

◆ LibraryDebug

str swift2.Project.Project.LibraryDebug = "_debug"
static

Definition at line 98 of file Project.py.

◆ LibraryRelease

str swift2.Project.Project.LibraryRelease = ""
static

Definition at line 99 of file Project.py.

◆ LibraryStats

str swift2.Project.Project.LibraryStats = "_stats"
static

Definition at line 102 of file Project.py.

◆ LibraryTrace

str swift2.Project.Project.LibraryTrace = "_trace"
static

Definition at line 100 of file Project.py.


The documentation for this class was generated from the following file: