def computeVorticityMagnitude(t): t2 = Internal.copyRef(t) presvx = C.isNamePresent(t2, 'centers:VorticityX') if presvx == -1: t2 = computeVorticity(t) t2 = C.magnitude( t2, ['centers:VorticityX', 'centers:VorticityY', 'centers:VorticityZ']) if presvx == -1: t2 = C.rmVars( t2, ['centers:VorticityX', 'centers:VorticityY', 'centers:VorticityZ']) Internal._renameNode(t2, 'magnitudeVorticityXVorticityYVorticityZ', 'VorticityMagnitude') return t2
def computeVorticity(t): t2 = Internal.copyRef(t) presvx = C.isNamePresent(t2, 'VelocityX') if presvx == -1: presvxc = C.isNamePresent(t2, 'centers:VelocityX') if presvxc > -1: t2 = C.center2Node(t2, [ 'centers:VelocityX', 'centers:VelocityY', 'centers:VelocityZ' ]) else: t2 = P.computeVariables(t2, ['VelocityX', 'VelocityY', 'VelocityZ']) t2 = P.computeCurl(t2, ['VelocityX', 'VelocityY', 'VelocityZ']) if presvx == -1: t2 = C.rmVars(t2, ['VelocityX', 'VelocityY', 'VelocityZ']) Internal._renameNode(t2, 'rotx', 'VorticityX') Internal._renameNode(t2, 'roty', 'VorticityY') Internal._renameNode(t2, 'rotz', 'VorticityZ') return t2
# - distance2Walls (pyTree) - import Dist2Walls.PyTree as Dist2Walls import Generator.PyTree as G import Converter.PyTree as C import Converter.Internal as Internal import Geom.PyTree as D import Converter.elsAProfile as elsAProfile a = G.cart((0., 0., 0.), (0.1, 0.1, 0.1), (10, 10, 10)) sphere = D.sphere((1.2, 0., 0.), 0.2, 100) t = C.newPyTree(['Base', a]) t = Dist2Walls.distance2Walls(t, sphere) Internal._renameNode(t, 'FlowSolution#Centers', 'FlowSolution#Init') tp = elsAProfile.addTurbulentDistanceIndex(t) C.convertPyTree2File(tp, 'out.cgns')