It manipulates arrays (as defined in Converter documentation) or CGNS/Python trees (pyTrees) as data structures.

This module is part of Cassiopee, a free open-source pre- and post-processor for CFD simulations.

When using the Converter array interface, a (or b) denotes an array, and A (or B) denotes a list of arrays. Then, Post module must be imported:

import Post as P

When using the pyTree interface, import the module:
import Post.PyTree as P

In that case, a is a zone node. A is a list of zone nodes or a
complete pyTree.
t = P.renameVars(t, oldVarNameList, newVarNameList)

t = P.importVariables(t1, t2, method=0, eps=1.e-6, addExtra=1)

The computation of some variables (e.g. viscosity) require some constants as input data. In the pyTree version, if a reference state node is defined in the pyTree, then the corresponding reference constants are used. Otherwise, they must be specified as an argument of the function. These constants are:

- 'gamma' for the specific heat ratio,

- 'rgp' for the perfect gas constant (rgp = (gamma-1) * cv),

- 'betas' and 'Cs' (Sutherland's law constants), or 'Cs','Ts' and 'mus'

- 's0' for a constant entropy, defined by:

s0 = sref - rgp gamma/(gamma-1) ln(Tref) + rgp ln(Pref),

where sref, Tref and Pref are defined for a reference state.

Computed variables are defined by their CGNS names:
where sref, Tref and Pref are defined for a reference state.

- 'VelocityX', 'VelocityY', 'VelocityZ' for components of the absolute velocity,

- 'VelocityMagnitude' for the absolute velocity magnitude,

- 'Pressure' for the static pressure (requires: gamma),

- 'Temperature' for the static temperature (requires: gamma, rgp),

- 'Enthalpy' for the enthalpy (requires: gamma),

- 'Entropy' for the entropy (requires: gamma, rgp, s0),

- 'Mach' for the Mach number (requires: gamma),

- 'ViscosityMolecular' for the fluid molecular viscosity (requires: gamma, rgp, Ts, mus, Cs),

- 'PressureStagnation' for stagnation pressure(requires: gamma),

- 'TemperatureStagnation' for stagnation temperature (requires: gamma, rgp),

- 'PressureDynamic' for dynamic pressure (requires: gamma).

- 'VelocityMagnitude' for the absolute velocity magnitude,

- 'Pressure' for the static pressure (requires: gamma),

- 'Temperature' for the static temperature (requires: gamma, rgp),

- 'Enthalpy' for the enthalpy (requires: gamma),

- 'Entropy' for the entropy (requires: gamma, rgp, s0),

- 'Mach' for the Mach number (requires: gamma),

- 'ViscosityMolecular' for the fluid molecular viscosity (requires: gamma, rgp, Ts, mus, Cs),

- 'PressureStagnation' for stagnation pressure(requires: gamma),

- 'TemperatureStagnation' for stagnation temperature (requires: gamma, rgp),

- 'PressureDynamic' for dynamic pressure (requires: gamma).

b = P.computeVariables(a, ['varname1', 'varname2'], gamma=1.4, rgp=287.053, s0=0., betas=1.458e-6, Cs=110.4, mus=1.76e-5, Ts=273.15)
*.or.* B = P.computeVariables(A, ...)

In the pyTree version, if the variable name is prefixed by 'centers:' then the variable is computed at centers only (e.g. 'centers:Pressure'), and if it is not prefixed, then the variable is computed at nodes.
b = P.computeExtraVariable(a, 'varName', gamma=1.4, rgp=287.053, Cs=110.4, mus=1.76e-5, Ts=273.15)
*.or.* B = P.computeExtraVariable(A, 'varName', gamma=1.4, rgp=287.053, Cs=110.4, mus=1.76e-5, Ts=273.15)

t = P.computeWallShearStress(t)
*.or.* P._computeWallShearStress(t) * for the in place version.*

b = P.computeGrad(a, varname) *.or.* B = P.computeGrad(A, varname)

Using Converter.array interface, a(A) denotes the mesh, ac(AC) denotes the fields located at centers. indices is a numpy 1D-array of face list, BCField is the corresponding numpy array of face fields. They are used to force a value at some faces before computing the gradient.

b = P.computeGrad2(a, ac, indices=None, BCField=None) *.or.* B = P.computeGrad2(A, AC, indices=None, BCField=None)

Using the pyTree version, the variable name must be located at cell centers. Indices and BCFields are automatically extracted from BCDataSet nodes: if a BCDataSet node is defined for a BC of the pyTree, the corresponding face fields are imposed when computing the gradient:

b = P.computeGrad2(a,varname) *.or.* B = P.computeGrad2(A, varname)

b = P.computeNormGrad(a, varname) *.or.* B = P.computeNormGrad(A, varname)

b = P.computeCurl(a, ['vectx','vecty','vectz']) *.or.* B = P.computeCurl(A, ['vectx','vecty','vectz'] )

b = P.computeNormCurl(a, ['vectx','vecty','vectz']) *.or.* B = P.computeNormCurl(A, ['vectx','vecty','vectz'] )

b = P.computeDiff(a, varname) *.or.* B = P.computeDiff(A,varname)

b = P.selectCells(a, F, ['var1', 'var2'], strict=0) *.or.* B = P.selectCells(A, F, ['var1', 'var2'], strict=0)

or by a formula:
b = P.selectCells(a, '{x}+{y}>2', strict=0) *.or.* B = P.selectCells(A, '{x}+{y}>2', strict=0)

b = P.selectCells2(a, tag, strict=0) *.or.* B = P.selectCells2(A, TAG, strict=0)

b = P.interiorFaces(a, strict=0)

b = P.exteriorFaces(a,indices=None)

b = P.exteriorFacesStructured(a)

b = P.exteriorElts(a)

b = P.frontFaces(a, tag)

res = P.sharpEdges(A, alphaRef=30.)

res = P.silhouette(A, vector=[1.,0.,0.])

Array version: an indic i-array must be provided, whose dimension ni is equal to the number of elements in the initial triangulation:

b = P.coarsen(a, indic, argqual=0.1, tol=1.e6)

PyTree version: indic is stored as a solution located at centers:

b = P.coarsen(a, indicName='indic', argqual=0.25, tol=1.e-6)

b = P.refine(a, indic)

PyTree version: indic is stored as a solution located at centers:

b = P.refine(a, indicName='indic')

b = P.refine(a, w=1./64.)

b = P.computeIndicatorValue(a, t, varName)

This function computes epsInf, epsSup, indicator such that when indicVal < valInf, the octree is coarsened (indicator=-1), when indicVal > valSup, the octree is refined (indicator=1).

For an octree defined in an array o, and the field in indicVal:

indicator, valInf, valSup = P.computeIndicatorField(o, indicVal, nbTargetPts=-1, bodies=[], refineFinestLevel=1, coarsenCoarsestLevel=1)

For the pyTree version, the name varname of the field on which is based
the indicator must be specified:
o, valInf, valSup = P.computeIndicatorField(o, varname, nbTargetPts=-1, bodies=[], refineFinestLevel=1, coarsenCoarsestLevel=1)

In the pyTree version, extractPoint returns the extracted solution from solutions located at nodes followed by the solution extracted from solutions at centers.

If 'cellN', 'ichim', 'cellnf', 'status', or 'cellNF' variable is defined, it is returned in the last position in the output array. The interpolation order can be 2, 3, or 5.

constraint is a thresold for extrapolation to occur. To enable more extrapolation, rise this value.

If some blocks in A define surfaces, a tolerance 'tol' for interpolation cell search can be defined.

A hook can be defined in order to keep in memory the ADT on the interpolation cell search. It can be built and deleted by createHook and freeHook functions in Converter module, using 'extractMesh' function:

field = P.extractPoint(A, (x,y,z), order=2, constraint=40., tol=1.e-6, hook=None)*.or.* F = P.extractPoint(A, [(x1,y1,z1),(x2,y2,z2)], order=2, constraint=40., tol=1.e-6, hook=None)

b = P.extractPlane(A, (c1, c2, c3, c4), order=2, tol=1.e-6)

Parameter constraint>0 enables to extrapolate from A if interpolation is not possible for some points. Extrapolation order can be 0 or 1 and is defined by extrapOrder.

If mode='robust', extract from the node mesh (solution in centers is first put to nodes, resulting interpolated solution is located in nodes).

If mode='accurate', extract node solution from node mesh and center solution from center mesh (variables don't change location).

A preconditioning tree for the interpolation cell search can be built prior to extractMesh (if is used several times for instance) and is stored in a hook. It can be created and deleted by C.createHook and C.freeHook (see Converter module userguide):

b = P.extractMesh(A, a, order=2, extrapOrder=1, constraint=40., tol=1.e-6, mode='robust', hook=None)

b = P.projectCloudSolution(pts, t, dim=3)

a = P.zipper(A, options=[])

The options argument is a list of arguments such as ["argName", argValue]. Option names can be: - 'overlapTol' for tolerance required between two overlapping grids : if the projection distance between them is under this value then the grids are considered to be overset. Default value is 1.e-5.

- For some cases, 'matchTol' can be set to modify the matching boundaries tolerance. Default value is set 1e-6. In most cases, one needn't modify this parameter.

C = P.usurp(A, B)

When using the pyTree interface, chimera cell nature field must be defined
as a center field in A:
B = P.usurp(A)

Warning: normal of surfaces grids defined by A must be
oriented in the same direction.
b = P.streamLine(A, (x0,y0,z0), ['v1','v2,'v3'], N=2000, dir=2)

b = P.streamRibbon(A, (x0,y0,z0), (nx,ny,nz), ['v1', 'v2', 'v3'], N=2000, dir=2)

b = P.streamSurf(A, c, ['v1','v2,'v3'], N=2000, dir=1)

b = P.isoLine(A, field, val)

B = P.isoSurf(A, field, val)

b = P.isoSurfMC(A, field, val)

res = P.integ([coord], [field], [ratio]=[])

For pyTree interface, the variable to be integrated can be specified. If no variable
is specified, all the fields located at nodes and centers are integrated:
res = P.integ(A, var='')

res = P.integNorm([coord], [field], [ratio]=[])

For pyTree interface, the variable to be integrated can be specified. If no variable
is specified, all the fields located at nodes and centers are integrated:
res = P.integNorm(A, var='')

res = P.integNormProduct([coord], [field], [ratio]=[])

For pyTree interface, the vector field to be integrated must be specified:
res = P.integNormProduct(A, vector=[])

res = P.integMoment([coord], [field], [ratio]=[], center=(0.,0.,0.))

For pyTree interface, the vector of variables to be integrated must be specified:
res = P.integMoment(A, center=(0.,0.,0.), vector=[])

res = P.integMomentNorm([coord], [field], [ratio]=[], center=(cx,cy,cz))

For pyTree interface, the variable to be integrated can be specified. If no variable
is specified, all the fields located at nodes and centers are integrated:
res = P.integMomentNorm(A, center=(cx,cy,cz), var='')

Return to main userguide