assert isinstance(eos, sph.EquationOfState3d) #assert np.isscalar(rho) #assert np.isscalar(eps) #assert np.isreal(rho) #assert np.isreal(eps) # Assign thermo values to fields and calculate pressure pressure.rhof[0] = rho pressure.epsf[0] = eps eos.setPressure(pressure.peef, pressure.rhof, pressure.epsf) # Extract pressure from field and return return pressure.peef[0] # End function pressure # Static fake node list and thermo fields for function pressure pressure.nodes = sph.makeVoidNodeList('fakenodes',1) pressure.rhof = sph.ScalarField('rho',pressure.nodes) pressure.epsf = sph.ScalarField('eps',pressure.nodes) pressure.peef = sph.ScalarField('pee',pressure.nodes) class HydrostaticQIC1LayerDensityProfile(): """Callable hydrostatic quasi-incompressible density profile.""" #--------------------------------------------------------------------------- # The constructor #--------------------------------------------------------------------------- def __init__(self, R, eos, rho0=None, rmin=0, units=None, nbins=100): """Class constructor for quasi-incompressible density profile. Assuming a barely compressible, one-layer planet, a pressure profile in hydrostatic equilibrium can be found by integrating the hydrostatic