Post-processing
Contents
Post-processing#
For post-processing that require knowledge of the velocity at arbitrary points in the fluid,
SkellySim supports an “interactive” mode where it runs inside a containing python process in
listener
mode. This allows you to exploit the SkellySim machinery on demand to
calculate various quantities without intermediate storage. This is extremely useful to generate
your own velocity fields, stream lines, and vortex lines at any given simulation point. Please
see the following to get started: examples/listener_mode/listener_example.py.
Trajectory format#
The trajectory format is a single file that consists of consecutive ‘frames’ with data
serialized in the msgpack
format. This makes doing post-processing in your language of
choice reasonably straightforward, though most existing code is centered around python
,
since that’s what the configuration language and visualization are implemented in. Writing
readers in other languages, especially those that have builtin map
and list
types, shouldn’t be too much of a problem though.
Each frame of data is simply a nested dictionary of key-value pairs, which we provide a
convenience wrapper class for in Python
. There is some example usage of this class in
Getting started, and we suggest users work from there or directly from
examples/analysis_example.py.
TrajectoryReader class#
- class skelly_sim.reader.TrajectoryReader(toml_file: str = 'skelly_config.toml')#
Utility wrapper for reading SkellySim trajectories. Provides a dict-like interface for access.
- times#
Simulation time of the corresponding frames
- Type
List[float]
- config_data#
Global toml data associated with the simulation
- Type
dict
- load_frame(frameno: int)#
Loads a trajectory frame into memory, replacing the last loaded frame
If an invalid frame number is provided, then throws an IndexError.
- Parameters
frameno (int) – Frame of simulation to load. Valid values are [0, len(TrajectoryReader) - 1]
Listener class#
- class skelly_sim.reader.Listener(toml_file: str = 'skelly_config.toml', binary: str = 'skelly_sim')#
Utility wrapper for interacting with the SkellySim binary directly for various post-processing tasks. Rather than interacting with stored binary data, this allows you to generate analysis data (such as streamlines and velocity fields) on the fly.
- config_data#
Global toml data associated with the simulation
- Type
dict
- request(command: skelly_sim.reader.Request)#
Execute request on listener subprocess
- Parameters
command (Request) – Request payload
- Return type
Dictionary of result data. Should be relatively self-documenting. Check examples or res.keys().
Request class#
- class skelly_sim.reader.Request#
Dataclass for a request to skelly_sim’s listener functionality
- frame_no#
Frame index of interest in trajectory
- Type
int, default:
0
- evaluator#
Pair evaluator: “FMM”, “CPU”, or “GPU”. CPU and GPU are typically fastest for smaller systems
- Type
str, default:
CPU
- streamlines#
Streamlines to build
- Type
StreamlinesRequest, default:
StreamlinesRequest()
- vortexlines#
Vortex lines to build
- Type
StreamlinesRequest, default:
StreamlinesRequest()
- velocity_field#
Velocity field to build
- Type
VelocityFieldRequest, default
VelocityFieldRequest()
StreamlinesRequest class#
- class skelly_sim.reader.StreamlinesRequest#
Dataclass for requesting multiple streamlines
- dt_init#
Initial timestep for streamline integrator (adaptive timestepper). Output points in streamline will be roughly dt_init separated in time
- Type
float, default:
0.1
- t_final#
Final time to integrate to for streamline
- Type
float, default:
1.0
- abs_err#
Absolute tolerance in integrator. Lower will be more accurate, but take longer to evaluate
- Type
float, default:
1E-10
- rel_err#
Relative tolerance in integrator. Lower will be more accurate, but take longer to evaluate
- Type
float, default:
1E-6
- back_integrate#
Additionally integrate from [0, -t_final]
- Type
bool, default:
True
- x0#
Position of the initial streamline seeds [[x0,y0,z0],[x1,y1,z1],…]
- Type
NDArray[Shape[“Any, 3”], Float64], default:
np.zeros(shape=(0, 3))
, units:μm