Crate openfoamparser[−][src]
OpenFOAM Parser
openfoamparser lets you parse OpenFOAM simulation results just like the Python library openfoamparser.
Known limitations:
- Parsing binary files is not supported yet.
Getting Started
The following example loads an existing vector field:
extern crate nalgebra as na; use std::path::PathBuf; use na::{Vector3, Point3}; use openfoamparser as ofp; let d: PathBuf = [ env!("CARGO_MANIFEST_DIR"), "resources/test/cavity/" ].iter().collect(); // Load the mesh (and nothing else): let mut fm = ofp::FoamMesh::new(&d).unwrap(); // Load the cell centers from time step 0.5 s. // This requires that the following or a similar command has been run: // `runApplication postProcess -func writeCellCentres -latestTime` fm.read_cell_centers(d.join("0.5/C")).unwrap(); // Load the flow speeds from the same time step: let flow: Vec<Vector3<f64>> = ofp::parse_internal_field( fm.path.join("0.5/U"), |s| ofp::parse_vector3(s) ).unwrap(); // …
Structs
Boundary | |
FoamMesh |
Functions
parse_internal_field | Parse an internal field such as a cell centers file. |
parse_point3 | |
parse_vector3 |