- marked as major
Output density grid
Issue #32
resolved
Add the ability to output a 3D density grid similar to Delta(k) that already exists.
Comments (3)
-
reporter -
reporter This is now possible with the new analysis hooks. One can define a callable object in the parameter file and register it. Sample:
from PKDGRAV import add_analysis, ASSIGNMENT_ORDER class MassGrid: grid = 0 order = ASSIGNMENT_ORDER.PCS def __init__(self,name,grid,order=ASSIGNMENT_ORDER.PCS): self.name = name self.grid = grid self.order = order def __call__(self,msr,step,time,**kwargs): if step % 10 == 0: print('calculating density grid') msr.grid_create(self.grid) msr.assign_mass(order=self.order) msr.grid_write(f'{self.name}.{step:05d}') msr.grid_delete() def ephemeral(self,msr,**kwargs): return msr.grid_ephemeral(self.grid) add_analysis(MassGrid('GRID',nGrid))
-
reporter - changed status to resolved
- Log in to comment