Peano
Loading...
Searching...
No Matches
testDensityCalculation.py
Go to the documentation of this file.
1# This file is part of the SWIFT2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from swift2.particle.SPHLeapfrogFixedSearchRadius import SPHLeapfrogFixedSearchRadius
4from swift2.particle.AlgorithmStep import AlgorithmStep
5
6import peano4
7import dastgen2
9
10from abc import ABC
11import copy
12
14 """!
15 Test only the density calculation algorithmic step.
16 Inherit everything from SPHLeapfrogFixedSearchRadius, just
17 modify the algorithm steps.
18
19
20 """
21
23 self,
24 name,
25 dimensions_hydro,
26 cfl_factor,
27 initial_time_step_size,
28 particles_per_cell=5,
29 min_h=0.6,
30 max_h=0.5,
31 ):
32 # Init the SPH particle
33 super(testDensityCalculation, self).__init__(
34 name = name,
35 dimensions_hydro = dimensions_hydro,
36 cfl_factor = cfl_factor,
37 initial_time_step_size=initial_time_step_size,
38 particles_per_cell=particles_per_cell,
39 min_h=min_h,
40 max_h=max_h,
41 use_optimised_coalesced_memory_access_kernels=False,
42 asserts=False,
43 )
44
45 # Now overwrite the Algorithm and Init steps.
48
49 return
50
51
53 """
54 Set up the internal list of algorithm steps for this particle.
55 We need to maintain an individual instance of this list for cases
56 where we modify the algorithm steps later on. This can happen for
57 example when adding debugging/dependency checks later on.
58
59
60 The algorithm steps shall be a list of AlgorithmStep objects to be
61 executed in that order.
62
63 Definitions of the algorithm steps stored in the algorithm_steps_dict are
64 placed in _setup_algorithm_steps_dict(self). The dict is set up during
65 instantiation of this class.
66
67 """
68
69 steps = [
70 self.algorithm_steps_dict["Density"],
71 self.algorithm_steps_dict["ReduceGlobalQuantities"],
72 ]
73
74 self._algorithm_steps_algorithm_steps_algorithm_steps = [copy.deepcopy(i) for i in steps]
75
76 return
77
79 """
80 Define the algorithm steps to be taken during initialization here.
81 This follows the same logic as _setup_algorithm_steps. See documentation
82 there for more info.
83
84 Make sure self._setup_algorithm_steps_dict() has been called before.
85 """
86 initsteps = []
87
88 # return deep copies of algorithms steps. Otherwise,
89 # modifications down the line (like the dependency checks)
90 # will cause trouble.
91 self._initialisation_steps_initialisation_steps_initialisation_steps = [copy.deepcopy(i) for i in initsteps]
92
93 return
94
95
_setup_initialisation_steps(self)
Define the algorithm steps to be taken during initialization here.
_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.
_setup_algorithm_steps(self)
Set up the internal list of algorithm steps for this particle.
__init__(self, name, dimensions_hydro, cfl_factor, initial_time_step_size, particles_per_cell=5, min_h=0.6, max_h=0.5)
Initialise the particle.
_setup_initialisation_steps(self)
Define the algorithm steps to be taken during initialization here.
_setup_algorithm_steps(self)
Set up the internal list of algorithm steps for this particle.