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
13
15 """!
16 Test only the density calculation algorithmic step.
17 Inherit everything from SPHLeapfrogFixedSearchRadius, just
18 modify the algorithm steps.
19
20
21 """
22
24 self,
25 name,
26 dimensions_hydro,
27 cfl_factor,
28 initial_time_step_size,
29 particles_per_cell=5,
30 min_h=0.6,
31 max_h=0.5,
32 ):
33 # Init the SPH particle
34 super(testDensityCalculation, self).__init__(
35 name=name,
36 dimensions_hydro=dimensions_hydro,
37 cfl_factor=cfl_factor,
38 initial_time_step_size=initial_time_step_size,
39 min_h=min_h,
40 max_h=max_h,
41 )
42
43 # Now overwrite the Algorithm and Init steps.
46
47 return
48
50 """
51 Set up the internal list of algorithm steps for this particle.
52 We need to maintain an individual instance of this list for cases
53 where we modify the algorithm steps later on. This can happen for
54 example when adding debugging/dependency checks later on.
55
56
57 The algorithm steps shall be a list of AlgorithmStep objects to be
58 executed in that order.
59
60 Definitions of the algorithm steps stored in the algorithm_steps_dict are
61 placed in _setup_algorithm_steps_dict(self). The dict is set up during
62 instantiation of this class.
63
64 """
65
66 steps = [
67 self.algorithm_steps_dict["SPH_Density"],
68 self.algorithm_steps_dict["SPH_ReduceGlobalQuantities"],
69 ]
70
71 self._algorithm_steps_algorithm_steps_algorithm_steps = [copy.deepcopy(i) for i in steps]
72
73 return
74
76 """
77 Define the algorithm steps to be taken during initialization here.
78 This follows the same logic as _setup_algorithm_steps. See documentation
79 there for more info.
80
81 Make sure self._setup_algorithm_steps_dict() has been called before.
82 """
83 initsteps = []
84
85 # return deep copies of algorithms steps. Otherwise,
86 # modifications down the line (like the dependency checks)
87 # will cause trouble.
88 self._initialisation_steps_initialisation_steps_initialisation_steps = [copy.deepcopy(i) for i in initsteps]
89
90 return
_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.