From: pascale.noyret Date: Wed, 2 Dec 2020 15:40:02 +0000 (+0100) Subject: K-Epsilon X-Git-Tag: V210224_osthus~72^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=97ab763828e8bdced4370ec14c4e8097367443cf;p=tools%2Feficas.git K-Epsilon --- diff --git a/Vimmp/cata_CSAndCPS_v7.py b/Vimmp/cata_CSAndCPS_v7.py index 3f81db8d..df8b07d5 100644 --- a/Vimmp/cata_CSAndCPS_v7.py +++ b/Vimmp/cata_CSAndCPS_v7.py @@ -20,9 +20,9 @@ class systemGeometry(UserASSD):pass class simulatedTime(UserASSD):pass class constitutiveRelation(UserASSD):pass -class boundaryObject(UserASSD) : pass -class scalar(boundaryObject):pass -class dynamicVariable(boundaryObject):pass +class stateVariable(UserASSD) : pass +class scalar(stateVariable):pass +class dynamicVariable(stateVariable):pass # PN a faire --> ajouter un MC modeleNumerique ( apres avoir renomme le modeleNumerique actuel en classe de modele numerique) @@ -91,9 +91,10 @@ dictCodeConvertisseur = { ('Fluent', 'OpenFOAM') : ('Fluent2CDM and CDM2OpenFoam'), } -dictVariableDynamique = { - 'K-Epsilon' : ('K', 'epsilon'), -} +#dictScalarsImplicites = { +# 'K-Epsilon' : ('K', 'Epsilon'), +# 'K-Omega' : ('K', 'Omega'), +#} #---------------------------------------- def prepareBlocSystemType(systemType) : @@ -106,7 +107,7 @@ def prepareBlocSystemType(systemType) : for typeMod in ('Particles', 'Fields'): conditionType = "ModelType == '" + typeMod + "'" - NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod], + NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod], position='global', intoXML=allValueInDict(dictTypModNumModNum)) dicoBloc = {} for modeleNumerique in list(dictTypModNumModNum[systemType,typeMod]): @@ -143,7 +144,7 @@ def calculCommun(key1, key2, dico): #------------------------- def allValueInDict(dico): #------------------------- -# retourne la liste de toutes les valeurs possible dans dico +# retourne la liste de toutes les valeurs possibles dans dico monSet=set() for clef in dico : for val in dico[clef] : monSet.add(val) @@ -195,9 +196,10 @@ def champ(nomDelaContante, labels ,nbReels ) : #--------------------------------------------- # ajouter les extensions pour le fichier et les blocs associes # certains champs ne seront jamais uniformes - +# probablement a refaire #PNPN : Passer le nom du champ pour le label du vecteur # A revoir + dicoBloc = {} dicoBloc[nomDelaContante] = SIMP( statut='o', typ='R') return FACT( statut='o', @@ -238,40 +240,44 @@ def FactTermeSource(condition): OriginOfSourceTerm = SIMP( statut='o', typ='TXM',into=['Interaction', 'Chemical Reaction', 'Other Scalar']), ) -#------------------------------------- -def FactTurbulence(statut, ajout=None): -#------------------------------------- +#------------------------------------------------------ +def FactTurbulence(statut, ajout=None , position=None): +#------------------------------------------------------ listInto = ['Fully resolved (DNS)', 'Spatial filtering (LES)', 'One-point moment', 'One-point PDF'] if ajout != None : listInto.append(ajout) return FACT(statut=statut, - TurbulenceModellingType = SIMP(typ='TXM', statut='o', into =listInto, ), + TurbulenceModellingType = SIMP(typ='TXM', statut='o', into =listInto, ), bloc_one_point = BLOC(condition= "TurbulenceModellingType == 'One-point moment'", - RANSModel = SIMP(statut="o", typ="TXM", into=['Turbulent-Viscosity Model(TVM)', 'Reynolds Stress Model (RSM)']), - bloc_TVM = BLOC(condition= "RANSModel == 'Turbulent-Viscosity Model(TVM)'", - TVMChoice = SIMP(typ='TXM', statut='o', into=['k-epsilon', 'k-omega']), - ), # fin bloc_TVM - bloc_RSM = BLOC(condition = "RANSModel == 'Reynolds Stress Model (RSM)'", - RSMChoice = SIMP(typ='TXM', statut='o', into=['Rotta', 'LRR-IP','LRR-QI','SSG']), - ), # fin bloc_RSM + RANSModel = SIMP(statut="o", typ="TXM", + into=['Turbulent-Viscosity Model (TVM)', 'Reynolds Stress Model (RSM)']), + bloc_TVM = BLOC(condition= "RANSModel == 'Turbulent-Viscosity Model (TVM)'", + TVMChoice = SIMP(typ='TXM', statut='o', into=['K-Epsilon', 'K-Omega'] , position=position), + ), # fin bloc_TVM + bloc_RSM = BLOC(condition = "RANSModel == 'Reynolds Stress Model (RSM)'", + RSMChoice = SIMP(typ='TXM', statut='o', into=['Rotta', 'LRR-IP','LRR-QI','SSG']), + ), # fin bloc_RSM ), # fin bloc_one_point + bloc_one_spatial = BLOC(condition = "TurbulenceModellingType == 'Spatial filtering (LES)'", - ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['Field-based LES', 'Filtered Density Function (FDF)']), - SubgridScaleModel = SIMP(typ='TXM', statut='o', into=['No SGS', 'Smagorinsky','Dynamical model', 'SGS Transport Equations']), + ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['Field-based (LES)', 'Filtered Density Function (FDF)']), + SubgridScaleModel = SIMP(typ='TXM', statut='o', into=['No SGS', 'Smagorinsky','Dynamical model', 'SGS Transport Equations']), ), # fin bloc_one_spatial bloc_one_point_pdf = BLOC(condition = "TurbulenceModellingType == 'One-point PDF'", - ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['One-point Eulerian PDF', 'One-particle Lagrangian PDF']), - bloc_lagrangian_pdf=BLOC(condition = "ChoiceOfApproach == 'One-particle Lagrangian PDF'", - StochasticModel = SIMP(typ='TXM', statut='o', into=['Langevin','Other'], defaut='Langevin'), - )# fin lagrangian + ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['One-point Eulerian PDF', 'One-particle Lagrangian PDF']), + bloc_lagrangian_pdf = BLOC(condition = "ChoiceOfApproach == 'One-particle Lagrangian PDF'", + StochasticModel = SIMP(typ='TXM', statut='o', into=['Langevin','Other'], defaut='Langevin'), + )# fin lagrangian ), # fin bloc_one_point_pdf bloc_no_model = BLOC(condition = "TurbulenceModellingType == 'Fully resolved (DNS)'", - ChoiceOfApproach = SIMP(statut='o', typ='TXM', into=['Field-based DNS', 'N-Particle Method']), - bloc_Field = BLOC(condition = "ChoiceOfApproach == 'Field-based DNS'", - NumericalMethod=SIMP(statut='o', typ='TXM', into=['FV', 'Spectral Method']), - ),# fin bloc_Field - bloc_N_particle = BLOC(condition = "ChoiceOfApproach == 'N-Particle Method'", - NumericalMethod=SIMP(statut='o', typ='TXM', into=['SPH', 'Vortex Method']), - ),# fin bloc_N_particle + ChoiceOfApproach = SIMP(statut='o', typ='TXM', into=['Field-based (DNS)', 'N-Particle Method']), + bloc_Field = BLOC(condition = "ChoiceOfApproach == 'Field-based (DNS)'", + NumericalMethod = SIMP(statut='o', typ='TXM', into=['FV', 'Spectral Method'], + intoXML=['FV', 'Spectral Method','SPH', 'Vortex Method']), + ),# fin bloc_Field + bloc_N_particle = BLOC(condition = "ChoiceOfApproach == 'N-Particle Method'", + NumericalMethod = SIMP(statut='o', typ='TXM', into=['SPH', 'Vortex Method'], + intoXML=['FV', 'Spectral Method','SPH', 'Vortex Method']), + ),# fin bloc_N_particle ), # fin bloc_no_model ) # fin du return de la fonction factTurbulence @@ -488,40 +494,44 @@ def Particle(cardinalite) : ############################ ) # fin Particle +#--------------- def bloc_CPS(): +#--------------- return BLOC(condition = 'SystemType == "Classical particle system"', Particle = Particle('**'), ) +#---------------------- def bloc_FluideMacro(): +#---------------------- return BLOC(condition = 'SystemType == "Continuum system"', ComplexFluid = SIMP(typ=bool, statut='o', defaut = False, position='global'), - FlowNature = SIMP(typ='TXM', statut='o', into =['Laminar', 'Turbulent'], position='global'), + FlowNature = SIMP(typ='TXM', statut='o', into =['Laminar', 'Turbulent'], position='global'), bloc_FlowNature_Turbulent = BLOC(condition = ' FlowNature == "Turbulent"', - TurbulenceForFlowDynamics = FactTurbulence('o'), - ), #------ fin bloc_FlowNature_Turbulent + TurbulenceForFlowDynamics = FactTurbulence('o',position='global'), + ), #------ fin bloc_FlowNature_Turbulent # ---------------------- Effets thermiques Thermal = FACT (statut ='o', - ThermalEffects = SIMP(typ='TXM', statut='o', into =['Non thermal', - 'Passive on flow dynamics', 'Active on flow dynamics'], defaut='Non thermal', position='global' ), - TemperatureInitialisation = FACT( statut ='o', - bloc_NonThermalEffects = BLOC(condition = ' ThermalEffects == "Non thermal"', - InitialTemperature = SIMP(typ='R', statut='o', val_min=-273.15 ), - ), # fin bloc_NonThermal - bloc_NonNonThermalEffects = BLOC(condition = 'not(ThermalEffects == "Non thermal")', - OriginOfThermalFluxModel = SIMP( statut='o', into =['Given', 'Interaction', 'to be simulated'], typ ='TXM'), - BlocGiven =creeBlocPourLesFichiers (' OriginOfThermalFluxModel == "Given"', 'FileName', ('Med', 'cgns' ), FieldName=1), - ), - ), - - bloc_ThermalEffects_Active = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', - ActiveOnFlowEffect = FACT(statut = 'o', max='**', - RelationType = SIMP( statut='o', into =['Equation Of State', 'Force-Flux Relation'], typ ='TXM'), - bloc_EOS=BLOC( condition = 'RelationType == "Equation Of State"', - TypeOfEquationOfState = SIMP( statut='o', into =['variable density', 'compressible'], typ ='TXM'), - ), - bloc_NonEOSAndSimple=BLOC( condition = 'RelationType == "Force-Flux Relation" and ComplexFluid == False', + ThermalEffects = SIMP(typ='TXM', statut='o', into =['Non thermal', + 'Passive on flow dynamics', 'Active on flow dynamics'], defaut='Non thermal', position='global' ), + TemperatureInitialisation = FACT( statut ='o', + bloc_NonThermalEffects = BLOC(condition = ' ThermalEffects == "Non thermal"', + ReferenceTemperature = SIMP(typ='R', statut='o', val_min=-273.15 ), + ), # fin bloc_NonThermal + bloc_NonNonThermalEffects = BLOC(condition = 'not(ThermalEffects == "Non thermal")', + OriginOfThermalFluxField = SIMP( statut='o', into =['Given', 'Interaction', 'to be simulated'], typ ='TXM'), + BlocGiven = creeBlocPourLesFichiers('OriginOfThermalFluxField == "Given"', 'FileName', ('Med', 'cgns' ), FieldName=1), + ), # fin bloc_NonNonThermalEffects + ),# fin TemperatureInitialisation + + bloc_ThermalEffects_Active = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', + ActiveOnFlowEffect = FACT(statut = 'o', max='**', + RelationType = SIMP(statut = 'o', into =['Equation Of State', 'Force-Flux Relation'], typ ='TXM'), + bloc_EOS = BLOC(condition = 'RelationType == "Equation Of State"', + TypeOfEquationOfState = SIMP( statut='o', into =['variable density', 'compressible'], typ ='TXM'), + ), + bloc_NonEOSAndSimple=BLOC( condition = 'RelationType == "Force-Flux Relation" and ComplexFluid == False', TypeOfForceFluxRelation = SIMP( statut='o', into =['Viscosity', 'Diffusivity', 'Thermal Conductivity'], intoXML=['Viscosity', 'Diffusivity', 'Thermal Conductivity','Shear-stress closure', 'Scalar flux'], typ ='TXM'), blocViscosity=BLOC( condition = 'TypeOfForceFluxRelation == "Viscosity"', AFAIRE=SIMP(typ='TXM', statut = 'o', defaut = 'Initialisation ?') @@ -536,7 +546,7 @@ def bloc_FluideMacro(): bloc_NonEOSAndComplex=BLOC( condition = 'RelationType == "Force-Flux Relation" and ComplexFluid == True', TypeOfForceFluxRelation = SIMP( statut='o', into =['Shear-stress closure', 'Scalar flux'], typ ='TXM', intoXML=['Viscosity', 'Diffusivity', 'Thermal Conductivity','Shear-stress closure', 'Scalar flux']), ), - ), + ), # fin ActiveOnFlowEffect ), # fin bloc_ThermalEffects_Active DensityInitialisation = FACT( statut ='o', @@ -569,10 +579,28 @@ def bloc_FluideMacro(): Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='Temperature', homo='constant'), SourceTerm=SIMP(typ=bool, statut='o', defaut=False), blocSourceTerm = FactTermeSource('SourceTerm==True'), - # bloc_scalar_FluidTurbulentandNonComplexe = BLOC (condition = "FlowNature == 'Turbulent'", - # ImplicitScalarFluxModel = FactTurbulence('f'), - # ) # bloc_scalar_FluidTurbulentandNonComplexe - ),# ObligatoireScalaire + ),# TemperatureScalar + ), + bloc_Turbulence_TWMChoice1 = BLOC(condition = 'TVMChoice == "K-Epsilon" or TVMChoice == "K-Omega"', + KScalar =FACT(statut ='o', + Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='K', homo='constant'), + SourceTerm=SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = FactTermeSource('SourceTerm==True'), + ), + ), + bloc_Turbulence_TWMChoice2 = BLOC(condition = 'TVMChoice == "K-Epsilon"', + EpsilonScalar =FACT(statut ='o', + Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='Epsilon', homo='constant'), + SourceTerm=SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = FactTermeSource('SourceTerm==True'), + ), + ), + bloc_Turbulence_TWMChoice3 = BLOC(condition = 'TVMChoice == "K-Omega"', + OmegaScalar =FACT(statut ='o', + Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='Omega', homo='constant'), + SourceTerm=SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = FactTermeSource('SourceTerm==True'), + ), ), Scalar = FACT(statut = 'o', max ='**', Name = SIMP(typ=(scalar,'createObject'), statut='o',), @@ -590,7 +618,7 @@ def bloc_FluideMacro(): #-----------------------------------------------------# def prepareBoundaryCondition(): return FACT( statut='o',max = '**', # max = nb de facette de bord - applyOnEssai = SIMP (statut ='o', typ=boundaryObject, ), + applyOnStateVariable = SIMP (statut ='o', typ=stateVariable ), Type_Of_Boundary_Condition = SIMP( statut='o', typ='TXM', into=['Inlet', 'Outlet', 'Symmetry','Periodicity', 'Wall', 'Free Surface'], ), b_periodique = BLOC( condition = "Type_Of_Boundary_Condition == 'Periodic'", Direction = SIMP( statut='o', typ='TXM', into=['X','Y','Z', 'XYZ']),