Building the hydrodynamics package

Finally we come to building a Spheral physics package, in this case one of the hydrodynamics packages:

151#-------------------------------------------------------------------------------
152# Construct the hydro physics object.
153#-------------------------------------------------------------------------------
154hydro = FSISPH(dataBase = db,
155               W = WT)
156packages = [hydro]
157
158output("hydro")
159output("  hydro.cfl")
160output("  hydro.compatibleEnergyEvolution")
161output("  hydro.densityUpdate")
162output("  hydro.HEvolution")

In this case we are building an FSISPH [2] hydrodynamics object, which is a variation on Smoothed Particle Hydrodynamics. Typically there are many options to these Physics objects, for most of which we are using the defaults here. The required arguments are the DataBase of NodeLists (db), and the chosen interpolation kernel (WT). It’s generally good practice to print (output) some of the major options the package is using to capture in the script output, such as we do in this example on lines 158–162.

Note

In many Spheral scripts you may have multiple physics packages (for instance hydrodynamics, gravity, porosity, etc.) A standard pattern is to build up a Python list of these packages (such as is started here on line 156 in the variable packages – then as we build any other Physics packages we simply append them to this list. In this example there is only the one Physics model running though so the situation is simplified. The utility of this packages list will come up when we build the time integrator in The time integration choice.