Last active
February 25, 2022 20:46
-
-
Save robinknowles/022854daf258fa39e882bbe296fc9793 to your computer and use it in GitHub Desktop.
An example of using sampledSurfaces to export patches from OpenFOAM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OpenFOAM v2112 function using sampledSurfaces for patch/surface export | |
// Includes: | |
// - multiple file formats; | |
// - point-data export; | |
// - near-wall interpolation; | |
// | |
// Can be tested on motorBike tutorial data, using: | |
// postProcess -func sample -latestTime | |
sample | |
{ | |
type surfaces; | |
libs (sampling); | |
fields ( p U ); | |
writeControl writeTime; | |
// Set the default export format | |
surfaceFormat vtp; | |
// Tweak the cell-point interpolation to give near-wall values, | |
// especially useful for near-wall velocities. | |
interpolationScheme cellPointWallModified; | |
formatOptions | |
{ | |
// Set VTP write format to binary to reduce on-disk size | |
vtp | |
{ | |
format binary; | |
} | |
obj | |
{ | |
// compression true; // uncomment to write gzipped OBJ files | |
} | |
} | |
surfaces | |
( | |
// Export motorBikeGroup patches as binary VTP | |
motorbike-surfs | |
{ | |
type patch; | |
patches (motorBikeGroup); | |
// Export interpolated point-based data | |
interpolate true; | |
} | |
// Export motorBikeGroup patches in EnSight format | |
motorbike-surfs | |
{ | |
type patch; | |
patches (motorBikeGroup); | |
// Override the default export format - use ascii Ensight | |
surfaceFormat ensight; | |
// Export cell/face-based data | |
interpolate false; | |
} | |
// Export motorBikeGroup patches in OBJ format | |
motorbike-surfs | |
{ | |
type patch; | |
patches (motorBikeGroup); | |
// Override the default export format - use OBJ (no fields exported) | |
surfaceFormat obj; | |
} | |
); | |
} | |
// ************************************************************************* // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exporting patches with sampledSurfaces
An OpenFOAM v2112 function using sampledSurfaces for patch/surface export
Includes:
Try it out on the
motorBike
tutorial data (working in OpenFOAMv2112
&v2106
).Save the file above to
system/sample
then run: