PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
wall_normal_profile.py File Reference

Reduce a field-statistics window into wall-normal profiles for DNS comparison. More...

Go to the source code of this file.

Namespaces

namespace  wall_normal_profile
 

Functions

 wall_normal_profile.find_repo_root ()
 Locate the PICurv checkout from the shipped example or from a case picurv init made.
 
 wall_normal_profile.load_spectra_helpers ()
 Import the PICGRID and PETSc-Vec readers from generators/spectra.gen.
 
 wall_normal_profile.read_window (checkpoint_dir, window, block)
 Resolve a statistics window by name inside one committed checkpoint bundle.
 
 wall_normal_profile.homogeneous_statistics (checkpoint_dir, window_name, grid_path, block, homogeneous)
 Reduce one statistics window's velocity moments over homogeneous directions.
 
 wall_normal_profile.friction_velocity_from_wall_model (csv_path, start, end)
 Mean wall shear the wall model applied over a time interval, as a velocity.
 
 wall_normal_profile.main (argv=None)
 Entry point.
 

Variables

 wall_normal_profile.REPO_ROOT = find_repo_root()
 
 wall_normal_profile.SPECTRA_GEN = os.path.join(REPO_ROOT, "generators", "spectra.gen")
 
dict wall_normal_profile.AXIS_TO_KJI = {"Xi": 2, "Eta": 1, "Zeta": 0}
 
dict wall_normal_profile.AXIS_TO_COMPONENT = {"Xi": 0, "Eta": 1, "Zeta": 2}
 
tuple wall_normal_profile.M2_PAIRS = ((0, 0), (0, 1), (0, 2), (1, 1), (1, 2), (2, 2))
 

Detailed Description

Reduce a field-statistics window into wall-normal profiles for DNS comparison.

field_statistics accumulates per-cell time moments and is BC-agnostic, so it works unchanged under periodic boundaries. What the postprocessor does not have is a spatial reduction: nothing averages a statistics field over homogeneous directions. Comparing against a channel DNS needs exactly that, so this script does the reduction outside the postprocessor, reading the window payloads directly from one committed checkpoint bundle.

The window is looked up by name in the bundle's checkpoint.meta, which also supplies its sample count and effective time bounds; its payloads are statistics/window_NNNN/block_NNNN/{Ucat_mean,Ucat_m2,weight}.dat. Ucat_m2 holds the six centred, weighted sums M2 in the order (xx, xy, xz, yy, yz, zz), so the per-cell temporal covariance is M2/W. The covariance over the homogeneous plane adds the spatial covariance of the per-cell time means:

<u_a' u_b'> = mean(M2_ab / W) + mean(U_a U_b) - mean(U_a) mean(U_b)

where mean() runs over the two directions that are not wall-normal. The two walls are then folded onto one half-channel (the Reynolds shear stress changes sign under the reflection), and the result is written as a CSV of

y, y+, U+, u'+, v'+, w'+, -<u'v'>+

together with the log-law and viscous-sublayer reference curves.

The friction velocity comes from one of:

The PICGRID and PETSc-binary readers are imported from generators/spectra.gen, which owns the DMDA interior-extraction convention (a cell-centred payload is sized (IM+1, JM+1, KM+1) and the physical interior is [1:KM, 1:JM, 1:IM]), and the metadata parser from picurv_cli, rather than duplicated.

Usage:

wall_normal_profile.py \\
--checkpoint RUN/output/checkpoints/step_000000050000 --window stationary \\
--grid RUN/inputs/grid/grid.run --wall-axis Eta --stream-axis Zeta \\
--viscosity 5.0e-05 --wall-model-csv RUN/output/analysis/metrics/wall_model.csv \\
--output profile.csv

Definition in file wall_normal_profile.py.