import Converter.PyTree as C import Transform.PyTree as T import Converter.Internal as Internal import Fast.PyTree as Fast import FastS.PyTree as FastS a = C.convertFile2PyTree('restart.cgns') #============================= # Supprime les champs inutiles #============================= vars = ['centers:Density_M1', 'centers:VelocityX_M1', 'centers:VelocityY_M1', 'centers:VelocityZ_M1', 'centers:Temperature_M1', 'centers:Density_P1', 'centers:VelocityX_P1', 'centers:VelocityY_P1', 'centers:VelocityZ_P1', 'centers:Temperature_P1','centers:TurbulentSANuTilde'] C._rmVars(a, vars) dimPb = Internal.getNodeFromName(a, 'EquationDimension') dimPb = Internal.getValue(dimPb) if dimPb == 2: a = T.subzone(a,(1,1,1),(-1,-1,1)) #================================= # Model #================================= model = Internal.getNodeFromName(a, 'GoverningEquations') model = Internal.getValue(model) if model is None: raise ValueError('GoverningEquations is missing in input file.') #============================== # Sortie champs aux noeuds #============================== vars = ['centers:Density', 'centers:VelocityX', 'centers:VelocityY', 'centers:VelocityZ', 'centers:Temperature'] if model != 'Euler': vars += ['centers:ViscosityEddy', 'centers:TurbulentSANuTilde'] for v in vars: a = C.center2Node(a, v) Internal._rmNodesByName(a,'FlowSolution#Centers') # Supprime les ghost cells Internal._rmGhostCells(a, a, 2, adaptBCs=1) #================================= # Extraction Kp sur les surfaces #================================= [RoInf, RouInf, RovInf, RowInf, RoeInf, PInf, TInf, cvInf, MInf, ReInf, Cs, Gamma, RokInf, RoomegaInf, RonutildeInf, Mus, Cs, Ts, Pr] = C.getState(a) gam1cv = (Gamma-1.)*cvInf RoUInf2I = 1./(RouInf*RouInf+RovInf*RovInf+RowInf*RowInf) C._initVars(a,'{Pressure}={Density}*{Temperature}*%f'%gam1cv) if model != 'Euler': betas = Mus*(Ts+Cs)/(Ts**(3./2.)) C._initVars(a,'{ViscosityMolecular} = %20.16g*sqrt({Temperature})/(1.+%20.16g/{Temperature})'%(betas,Cs)) C._initVars(a,'{mutsmu}=({ViscosityEddy})/({ViscosityMolecular})-1.') C.convertPyTree2File(a, 'out.cgns') w = C.extractBCOfType(a,'BCWall') C._initVars(w,'{Kp}=-2*%f*({Pressure}-%f)*%f'%(RoInf,PInf,RoUInf2I)) C.convertPyTree2File(w, 'wall.cgns')