Peano
Loading...
Searching...
No Matches
exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius Class Reference
Inheritance diagram for exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius:
Collaboration diagram for exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius:

Public Member Functions

 __init__ (self, name, dimensions_hydro=2, cfl_factor=0.1, initial_time_step_size=1e-4, constant_time_step_size=True, exaparty_project_namespace="SPH", particles_per_cell=0, min_h=0.3, max_h=0.3)
 set_parameters (self)
 This function translates "global" particle parameters which are constant throughout the simulation (like CFL factor, minimal time step size, viscosity parameters...) into dastgen attributes of the C++ particle class.
 alpha_av (self)
 Viscosity parameters of the Minimal SPH model.
 alpha_av (self, alpha_av)
 beta_av (self)
 beta_av (self, beta_av)
 get_cpp_namespace_from_project_namespace (self)
 Transform namespace into cpp format.
 readme_descriptor (self)
 Create default readme descriptor.
Public Member Functions inherited from exaparty.api.particle.SPHParticle.SPHParticle
 __init__ (self, name, dimensions_hydro=2, cfl_factor=0.1, initial_time_step_size=1e-4, constant_time_step_size=True, exaparty_project_namespace="SPH", particles_per_cell=0, min_h=0.3, max_h=0.3)
 algorithm_steps (self)
 Return algorithm steps: A list of AlgorithmStep objects to be executed in that order for this particle.
 initialisation_steps (self)
 Return the list of algorithm steps to be executed during initialisation.
 hydro_dimensions (self)
 Forbid users to modify hydro dimensions on-the-fly.
 hydro_dimensions (self, hydro_dimensions)
 eta_factor (self)
 Set the eta factor used by the SPH kernel to target a certain number of neighbour particles.
 eta_factor (self, eta_factor)
 h_hydro_min (self)
 Set the limits allowed for the SPH smoothing length.
 h_hydro_min (self, h_hydro_min)
 h_hydro_max (self)
 h_hydro_max (self, h_hydro_max)
 h_tolerance (self)
 Tolerance for Newton-Raphson convergence criterion.
 h_tolerance (self, h_tolerance)
 h_max_iterations (self)
 Max number of iterations to adapt the SPH smoothing length.
 h_max_iterations (self, h_max_iterations)
 mantissa_size (self)
 Set the mantissa size of doubles and Peano double arrays if we want to use reduced precission via Clang annotations.
 mantissa_size (self, mantissa_size)
 switch_namespace_of_all_particle_iterators (self, new_namespace, old_namespace="::exaparty::kernels::")
 Switch the prefix (namespace) of all particle iterators.
Public Member Functions inherited from exaparty.api.particle.Particle.Particle
 __init__ (self, name, particles_per_cell, min_h, max_h)
 Initialise the particle.
Public Member Functions inherited from peano4.api.toolbox.particles.Particle.Particle
 __init__ (self, name)
 Constructor.
Public Member Functions inherited from peano4.api.datamodel.DaStGen2.DaStGen2
 __init__ (self, name)
 Construct a DaStGen2 object.
 configure (self, namespace, association, subdirectory="", temporary_subdirectory="")
 Configure output.
 additional_load_and_store_arguments (self)
 additional_load_and_store_arguments (self, new_arguments)
 hosts_smart_pointer_attribute (self)
 Does class host a smart pointer attribute.
Public Member Functions inherited from peano4.api.datamodel.DoF.DoF
 __init__ (self, name)
 Create a degree of freedom object.
 get_full_qualified_type (self)
 get_logical_type_name (self)
 What should the data type be called within the data repository, or within action sets.
 get_enumeration_type (self)
 What should the data type be called within the data repository.
 additional_load_and_store_arguments_for_other_dof (self, argument_name, use_dof_association=None)
 You can make Peano's store and load arguments of any DoF depend on other DoFs that you have loaded before.
 subnamespace (self)

Data Fields

 balsara = dastgen2.attributes.Double("balsara")
 rot_v = peano4.api.dastgen2.Peano4DoubleArray("rot_v", "Dimensions")
 div_v = dastgen2.attributes.Double("div_v")
 v_sig_AV = dastgen2.attributes.Double("v_sig_AV")
 soundSpeed = dastgen2.attributes.Double("soundSpeed")
 algorithm_steps_dict = get_algorithm_step_dict(self)
Data Fields inherited from exaparty.api.particle.SPHParticle.SPHParticle
 mass = dastgen2.attributes.Double("mass")
 velocity = peano4.api.dastgen2.Peano4DoubleArray("v", "Dimensions")
 acceleration = peano4.api.dastgen2.Peano4DoubleArray("a", "Dimensions")
 density = dastgen2.attributes.Double("density")
 pressure = dastgen2.attributes.Double("pressure")
 smoothL = dastgen2.attributes.Double("smoothingLength", initval=0.0)
 u = dastgen2.attributes.Double("u")
 uDot = dastgen2.attributes.Double("uDot")
 v_full = peano4.api.dastgen2.Peano4DoubleArray("v_full", "Dimensions")
 u_full = dastgen2.attributes.Double("u_full")
 wcount = dastgen2.attributes.Double("wcount")
 wcount_dh = dastgen2.attributes.Double("wcount_dh")
 f = dastgen2.attributes.Double("f")
 hDot = dastgen2.attributes.Double("hDot")
 rho_dh = dastgen2.attributes.Double("rho_dh")
 sml_iteration_count
 sml_iter_left_bound = dastgen2.attributes.Double("smlIterLeftBound")
 sml_iter_right_bound = dastgen2.attributes.Double("smlIterRightBound")
 has_no_neighbours = dastgen2.attributes.Boolean("hasNoNeighbours")
 sml_converged
 density_neighbourcount
 force_neighbourcount
Data Fields inherited from exaparty.api.particle.Particle.Particle
 particles_per_cell = particles_per_cell
 min_h = min_h
 max_h = max_h
Data Fields inherited from peano4.api.toolbox.particles.Particle.Particle
 partid = dastgen2.attributes.Integer("partid", ifdefs=["PeanoDebug > 0"], initval="-1")
Data Fields inherited from peano4.api.datamodel.DaStGen2.DaStGen2
 generator = None
 data = dastgen2.DataModel(name)
 peano4_mpi_and_storage_aspect = peano4.api.dastgen2.MPIAndStorageAspect(peano4.api.datamodel.DoFAssociation.Undef)
Data Fields inherited from peano4.api.datamodel.DoF.DoF
 association = DoFAssociation.Undef
 name = name
list namespace = []
 grid_selector = None
 subdirectory = subdirectory
 temporary_subdirectory = temporary_subdirectory

Protected Member Functions

 _setup_algorithm_steps (self)
 Set up the internal list of algorithm steps for this particle.
 _setup_initialisation_steps (self)
 Define the algorithm steps to be taken during initialization here.
Protected Member Functions inherited from exaparty.api.particle.Particle.Particle
 _dependency_checks_modify_steps (self, steplist, step_type_name, peano4_event_enum)
 Add dependency checks as well as mesh consistency checks to the algorithm steps.
 _add_dependency_checks (self)
 Add dependency (particle consistency) checks.

Protected Attributes

float _alpha_av = 0.8
float _beta_av = 3.0
Protected Attributes inherited from exaparty.api.particle.SPHParticle.SPHParticle
str _sph_flavour = "none"
 _cfl_factor = cfl_factor
 _initial_time_step_size = initial_time_step_size
 _constant_time_step_size = constant_time_step_size
 _hydro_dimensions = dimensions_hydro
float _eta_factor = 1.2348
int _h_max_iterations = 30
int _h_hydro_min = 1e-6
tuple _h_hydro_max
int _h_tolerance = 1e-4
 _exaparty_project_namespace = exaparty_project_namespace
 _mantissa_size = mantissa_size
Protected Attributes inherited from exaparty.api.particle.Particle.Particle
 _algorithm_steps = modified_steps
 _initialisation_steps = modified_steps
Protected Attributes inherited from peano4.api.datamodel.DoF.DoF
list _additional_load_and_store_arguments = []

Additional Inherited Members

Static Public Attributes inherited from exaparty.api.particle.Particle.Particle
str DependencyChecks_Attribute_Prefix = "dependencyChecks"
list DependencyChecks_Ifdefs = ["PeanoDebug > 0"]
Static Public Attributes inherited from peano4.api.datamodel.DaStGen2.DaStGen2
str readme_package_descriptor

Detailed Description

SPH particle with fixed search radius

Same as LeapfrogFixedSearchRadius but augmented for full SPH.
Implements the Minimal SPH scheme.

Simple particle with a fixed search radius h which moves according
to leapfrog KDK scheme.
By default, it uses global time stepping,
i.e. the combination of maximum velocity and minimal mesh size determines
the time step size of the subsequent time step. Besides the default
variables x and h, the particle has the following properties:

- a vector a which is the acceleration;
- a vector v which is the velocity.

You can add further properties via

     myparticle.data.add_attribute( peano4.api.dastgen2.Peano4DoubleArray("myFancyArray","Dimensions") )

in your code. Or you can create a subclass which adds additional fields
after it has called the baseline constructor.

You will need to add further properties for any SPH project.

## Force calculation

particle_particle_interaction_over_particle_sets_kernel is a C++ string which defines a force between two
particles. It has access to three important objects:

- localParticles is a container (list) over pointers to local particles
- activeParticles is a container (list) over pointers to active particles
- marker is a cell marker which identifies the current cell.

Please consult the guidebook for a definition of local and active particles
but take into account that the local particles always are a subset of the
active particles.

Besides the actual particle-to-particle calculation, i.e. a force
calculation, users can also provide kernels that kick in when you touch
particles for the first time before you actually compute any
particle-particle interaction, and there is a plug-in point what you do
just once the particle-particle interaction has terminated. The latter
point is reached before we do the actual time stepping. In both plug-in
points, you have a vertex marker which gives you the position of the
vertex to which a particular is associated, and you have the localParticles.
This is a vector of pointers in this particular case.

The force calculation does exist in two variants: There's the default one
and then we have one that is aggressively optimised. The latter one requires
us to have properly sorted particle-mesh associations.

## Precision

By default, all particle attributes are modelled as doubles or arrays of
doubles. This might be overly precise. You can alter the precision through
our LLVM compiler modifications if you invoke the following commands on a
particle species:

~~~~~~~~~~~~~~~~~~~~~~~~~~
particle.mass.valid_mantissa_bits         = args.mantissa_size
particle.velocity.valid_mantissa_bits     = args.mantissa_size
particle.acceleration.valid_mantissa_bits = args.mantissa_size
particle.density.valid_mantissa_bits      = args.mantissa_size
particle.pressure.valid_mantissa_bits     = args.mantissa_size
particle.smoothL.valid_mantissa_bits      = args.mantissa_size
particle.u.valid_mantissa_bits            = args.mantissa_size
particle.uDot.valid_mantissa_bits         = args.mantissa_size
particle.f.valid_mantissa_bits            = args.mantissa_size
particle.wcount_dh.valid_mantissa_bits    = args.mantissa_size
particle.rho_dh.valid_mantissa_bits       = args.mantissa_size
particle.wcount.valid_mantissa_bits       = args.mantissa_size
particle.hDot.valid_mantissa_bits         = args.mantissa_size
particle.balsara.valid_mantissa_bits      = args.mantissa_size
particle.rot_v.valid_mantissa_bits        = args.mantissa_size
particle.div_v.valid_mantissa_bits        = args.mantissa_size
particle.v_sig_AV.valid_mantissa_bits     = args.mantissa_size
particle.soundSpeed.valid_mantissa_bits   = args.mantissa_size
particle.v_full.valid_mantissa_bits       = args.mantissa_size
particle.u_full.valid_mantissa_bits       = args.mantissa_size
~~~~~~~~~~~~~~~~~~~~~~~~~~

This is an example. You can also add ony a few of these fields, and picking
a value for args.mantissa_size is obviously up to you. We refrain from
illustrating that you can also alter the precision of the position and
maximum search radius of a particle this way. This is on purpose: We have
made bad experience with such modifications.

## Boundary conditions

Boundary conditions for ExaParty are @ref exaparty_boundary_conditions "discussed on a separate page".
If you decide that you want to plug into the drift mechanism of
this SPH flavour, you typically add something similar to the
code snippet below to your code:

~~~~~~~~~~~~~~~~~~~~~~

particle.algorithm_steps_dict["Drift"].touch_vertex_last_time_kernel += " " " if (::exaparty::boundaryconditions::isVertexOnGlobalBoundary(marker,DomainOffset,DomainSize)) { ::exaparty::kernels::forAllParticles< [&](const peano4::datamanagement::VertexMarker& marker, globaldata::" " " + name + " " "& assignedParticle)->void { exaparty.boundaryconditions.applyFixedBoundaryCondition( assignedParticle, marker, DomainOffset, DomainSize, 0.1, _spacetreeId ); },

The spaced-out syntax is just there to ensure that the Python documentation syntax is not broken.

## Attributes

name: String
To be in line with other conventions, I recommend you start with an
uppercase letter. This has to be a valid C++ identifier, i.e. don't
use any special symbols besides an underscore.

## Vectorisation

This type can be used with aggressively optimised kernels if you follow
@ref page_exaparty_performance_optimisation Performance optimisation and use
the map_particle_steps_onto_separate_mesh_traversals_insert_dummy_sweeps_for_coalesced_memory_access
graph compiler from the Sequential suite; or literally any other
flavour which yields coalesced memory.

@see peano4::datamanagement::CellMarker
@see peano4::datamanagement::VertexMarker

Definition at line 18 of file SPHLeapfrogFixedSearchRadius.py.

Constructor & Destructor Documentation

◆ __init__()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.__init__ ( self,
name,
dimensions_hydro = 2,
cfl_factor = 0.1,
initial_time_step_size = 1e-4,
constant_time_step_size = True,
exaparty_project_namespace = "SPH",
particles_per_cell = 0,
min_h = 0.3,
max_h = 0.3 )

Definition at line 169 of file SPHLeapfrogFixedSearchRadius.py.

References __init__().

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _setup_algorithm_steps()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._setup_algorithm_steps ( self)
protected

Set up the internal list of algorithm steps for this particle.

We need to maintain an individual instance of this list for cases where we modify the algorithm steps later on. This can happen for example when adding debugging/dependency checks later on.

The algorithm steps shall be a list of AlgorithmStep objects to be executed in that order.

Definitions of the algorithm steps stored in the algorithm_steps_dict are placed in get_algorithm_steps_dict(self). The dict is set up during instantiation of this class, and reads in all available algorithm steps defined in AlgorithmStepLibrary.py.

Leapfrog consists basically of four steps per particle. We first determine the force. Then we update the velocity by half a timestep and move the particle by a full timestep. Then the force is re-computed and the second half of the velocity update is done. Some variations of this KDK form re-arrange the steps executed per timestep to avoid a second force loop. We can't do this here because we're not planning on running with fixed time step sizes throughout the run.

Reimplemented from exaparty.api.particle.SPHParticle.SPHParticle.

Reimplemented in exaparty.api.particle.tests.testDensityCalculation.testDensityCalculation.

Definition at line 284 of file SPHLeapfrogFixedSearchRadius.py.

References exaparty.api.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius._algorithm_steps, exaparty.api.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius._algorithm_steps, exaparty.api.particle.Particle.Particle._algorithm_steps, and algorithm_steps_dict.

Referenced by exaparty.api.particle.tests.testDensityCalculation.testDensityCalculation.__init__().

Here is the caller graph for this function:

◆ _setup_initialisation_steps()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._setup_initialisation_steps ( self)
protected

Define the algorithm steps to be taken during initialization here.

This follows the same logic as _setup_algorithm_steps. See documentation there for more info.

Make sure get_algorithm_steps_dict(self) has been called before.

Reimplemented from exaparty.api.particle.SPHParticle.SPHParticle.

Reimplemented in exaparty.api.particle.tests.testDensityCalculation.testDensityCalculation.

Definition at line 325 of file SPHLeapfrogFixedSearchRadius.py.

References exaparty.api.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius._initialisation_steps, exaparty.api.particle.Particle.Particle._initialisation_steps, and algorithm_steps_dict.

Referenced by exaparty.api.particle.tests.testDensityCalculation.testDensityCalculation.__init__().

Here is the caller graph for this function:

◆ alpha_av() [1/2]

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.alpha_av ( self)

Viscosity parameters of the Minimal SPH model.

Default SWIFT values are alpha_av=0.8 and beta_av=3.

Definition at line 355 of file SPHLeapfrogFixedSearchRadius.py.

References _alpha_av.

◆ alpha_av() [2/2]

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.alpha_av ( self,
alpha_av )

Definition at line 365 of file SPHLeapfrogFixedSearchRadius.py.

References _alpha_av.

◆ beta_av() [1/2]

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.beta_av ( self)

Definition at line 371 of file SPHLeapfrogFixedSearchRadius.py.

References _alpha_av.

◆ beta_av() [2/2]

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.beta_av ( self,
beta_av )

Definition at line 375 of file SPHLeapfrogFixedSearchRadius.py.

References _beta_av.

◆ get_cpp_namespace_from_project_namespace()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.get_cpp_namespace_from_project_namespace ( self)

Transform namespace into cpp format.

Could be used to append namespace to constants in kernels (not used currently).

Reimplemented from exaparty.api.particle.SPHParticle.SPHParticle.

Definition at line 380 of file SPHLeapfrogFixedSearchRadius.py.

References exaparty.api.particle.SPHParticle.SPHParticle._exaparty_project_namespace.

◆ readme_descriptor()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.readme_descriptor ( self)

Create default readme descriptor.

You might want to overwrite this for your particular particle species to get more detailed info the the README.md file generated by Peano.

Reimplemented from exaparty.api.particle.SPHParticle.SPHParticle.

Definition at line 392 of file SPHLeapfrogFixedSearchRadius.py.

◆ set_parameters()

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.set_parameters ( self)

This function translates "global" particle parameters which are constant throughout the simulation (like CFL factor, minimal time step size, viscosity parameters...) into dastgen attributes of the C++ particle class.

If you modify any of the attributes manually outside of the particle initialisation, e.g. by invoking

particle = SPHLeapfrogFixedSearchRadius(initial_time_step_size=ABC, ...)
particle.initial_time_step_size = XYZ

you need to call this function manually so your changes propagate into the generated C++ files.

Reimplemented from exaparty.api.particle.SPHParticle.SPHParticle.

Definition at line 250 of file SPHLeapfrogFixedSearchRadius.py.

References _alpha_av, _beta_av, convert::data::PatchData.data, peano4.api.datamodel.DaStGen2.DaStGen2.data, and set_parameters().

Referenced by set_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _alpha_av

float exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._alpha_av = 0.8
protected

Definition at line 201 of file SPHLeapfrogFixedSearchRadius.py.

Referenced by alpha_av(), alpha_av(), beta_av(), and set_parameters().

◆ _beta_av

float exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._beta_av = 3.0
protected

Definition at line 202 of file SPHLeapfrogFixedSearchRadius.py.

Referenced by beta_av(), and set_parameters().

◆ algorithm_steps_dict

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.algorithm_steps_dict = get_algorithm_step_dict(self)

◆ balsara

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.balsara = dastgen2.attributes.Double("balsara")

Definition at line 214 of file SPHLeapfrogFixedSearchRadius.py.

◆ div_v

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.div_v = dastgen2.attributes.Double("div_v")

Definition at line 221 of file SPHLeapfrogFixedSearchRadius.py.

◆ rot_v

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.rot_v = peano4.api.dastgen2.Peano4DoubleArray("rot_v", "Dimensions")

Definition at line 216 of file SPHLeapfrogFixedSearchRadius.py.

◆ soundSpeed

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.soundSpeed = dastgen2.attributes.Double("soundSpeed")

Definition at line 223 of file SPHLeapfrogFixedSearchRadius.py.

◆ v_sig_AV

exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius.v_sig_AV = dastgen2.attributes.Double("v_sig_AV")

Definition at line 222 of file SPHLeapfrogFixedSearchRadius.py.


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