From b3d895596ed37b9db175239c84623e3857b18766 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Mon, 30 Nov 2020 19:21:38 +0100 Subject: [PATCH] echange Eric --- Vimmp/cata_CSAndCPS_v5.py | 139 +++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 33 deletions(-) diff --git a/Vimmp/cata_CSAndCPS_v5.py b/Vimmp/cata_CSAndCPS_v5.py index 0396f897..bafd4807 100644 --- a/Vimmp/cata_CSAndCPS_v5.py +++ b/Vimmp/cata_CSAndCPS_v5.py @@ -153,6 +153,7 @@ def creeBlocPourLesFichiers (laCondition, NomDuFichier, ListeFormats, FieldName= if FieldName: SIMPFieldName = SIMP(statut='o', typ = 'TXM',) return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs, FieldName=SIMPFieldName) + #return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs) else : return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs) @@ -194,6 +195,10 @@ def champ(nomDelaContante, labels ,nbReels ) : ) +def FactTermeSource(condition): + return BLOC (condition=condition, + Origin = SIMP( statut='o', typ='TXM',into=['question JP'] + )) def FactTurbulence(statut, ajout=None): @@ -449,42 +454,60 @@ def bloc_CPS(): def bloc_FluideMacro(): return BLOC(condition = 'SystemType == "Continuum system"', - FluidComplexe = SIMP(typ=bool, statut='o', defaut = False,), + ComplexFluid = SIMP(typ=bool, statut='o', defaut = False, 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 - ConstitutiveRelation = FACT(statut ='o',max='**', - Name = SIMP(statut='o', typ=(constitutiveRelation,'createObject'),), - Nature = SIMP( statut='o', into =['EOS', 'FFR'], typ ='TXM'), - bloc_NonThermalEffectsAndNoEffect = BLOC(condition = ' ThermalEffects == "Non thermal" or ThermalEffects == "Passive on flow dynamics"', - DensityEquationOfState = SIMP(typ='TXM', statut='o', into =['Constant density'], defaut = 'Constant density'), - ), # fin bloc_NonThermalEffectsAndNoEffect - - ), +# ConstitutiveRelation = FACT(statut ='o',max='**', +# Name = SIMP(statut='o', typ=(constitutiveRelation,'createObject'),), +# Nature = SIMP( statut='o', into =['Equation Of State', 'Force Field Relation'], typ ='TXM'), +# ), # ---------------------- Effets thermiques + #bloc_NonThermalEffectsAndNoEffect = BLOC(condition = ' ThermalEffects == "Non thermal" or ThermalEffects == "Passive on flow dynamics"', + # DensityEquationOfState = SIMP(typ='TXM', statut='o', into =['Constant density'], defaut = 'Constant density'), + # ), # fin bloc_NonThermalEffectsAndNoEffect 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'), + 'Passive on flow dynamics', 'Active on flow dynamics'], defaut='Non thermal', position='global' ), - bloc_NonThermalEffects = BLOC(condition = ' ThermalEffects == "Non thermal"', - InitialTemperature = SIMP(typ='R', statut='o', val_min=-273.15 ), + + 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'], typ ='TXM'), + BlocGiven =creeBlocPourLesFichiers (' NatureOfThermalFluxModel == "Given"', None, ('Med', 'cgns' ), FieldName=1), + ), + ), - bloc_ThermalEffects_Passive = BLOC(condition =' ThermalEffects == "Passive on flow dynamics"', - ThermalFluxModel = FACT(statut = 'o', - NatureOfThermalFluxModel = SIMP( statut='o', into =['Given', 'Simulated'], typ ='TXM'), - BlocGiven =creeBlocPourLesFichiers (' NatureOfThermalFluxModel == "Given"', None, ('Med', 'cgns' ), FieldName=1), - ), - ), # fin bloc_ThermalEffects_Passive + DensityInitialisation = FACT( statut ='o', + bloc_DensityNonThermal = BLOC(condition = ' ThermalEffects == "Non thermal" or ThermalEffects == "Passive on flow dynamics"', + DensityEquationOfState = SIMP(typ='TXM', statut='o', into =['Constant density'], defaut = 'Constant density'), + InitialDensity = SIMP(typ='R', statut='o',), + ), # fin bloc_DensityNonThermal + bloc_DensityAndThermalActive = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', + DensityEquationOfState = SIMP(typ='TXM', statut='o', into =['variable density', 'compressible'], ), + ), + ), # fin DensityInitialisation bloc_ThermalEffects_Active = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', - ActiveOnFlowEffect = FACT(statut = 'o', - onConstitutiveRelation = SIMP(statut='o', typ=constitutiveRelation, max='**',), - ), - ), # fin bloc_ThermalEffects_Active + ActiveOnFlowEffect = FACT(statut = 'o', max='**', + RelationType = SIMP( statut='o', into =['Equation Of State', 'Force Field Relation'], typ ='TXM'), + bloc_EOS=BLOC( condition = 'RelationType == "Equation Of State"', + TypeOfEquationOfState = SIMP( statut='o', into =['variable', 'compressible'], typ ='TXM'), + ), + bloc_NonEOSAndSimple=BLOC( condition = 'RelationType == "Force Field Relation" and ComplexFluid == False', + TypeOfEquationOfState = SIMP( statut='o', into =['Newtonian', 'Fick Law', 'Fourier Law'], intoXML=['Newtonian', 'Fick Law', 'Fourier Law','Shear-stress closure', 'Scalar flux'], typ ='TXM'), + ), + bloc_NonEOSAndComplex=BLOC( condition = 'RelationType == "Force Field Relation" and ComplexFluid == True', + TypeOfEquationOfState = SIMP( statut='o', into =['Shear-stress closure', 'Scalar flux'], typ ='TXM', intoXML=['Newtonian', 'Fick Law', 'Fourier Law','Shear-stress closure', 'Scalar flux']), + ), + ), + ), # fin bloc_ThermalEffects_Active ),# fin Fact Thermal @@ -517,26 +540,33 @@ def bloc_FluideMacro(): # ),# fin Fact Thermal # ---------------------- Scalaire additional - bloc_scalar_FluidTurbulentOrLaminar = BLOC(condition = "(FluidComplexe == False and FlowNature == 'Turbulent') or (FluidComplexe == False and FlowNature == 'Laminar')", + bloc_scalar_FluidTurbulentOrLaminar = BLOC(condition = "(ComplexFluid == False and FlowNature == 'Turbulent') or (ComplexFluid == False and FlowNature == 'Laminar')", Scalars = FACT(statut = 'o', bloc_FlowNature_Turbulent_For_Scalars = BLOC(condition = ' FlowNature == "Turbulent"', ScalarsTurbulenceModelling = FactTurbulence('o', ajout='NoOne'), ), - ImplicitScalar =FACT(statut ='o', - Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='ObligatoireScalaire', homo='constant'), - bloc_scalar_FluidTurbulentandNonComplexe = BLOC (condition = "FlowNature == 'Turbulent'", - ImplicitScalarFluxModel = FactTurbulence('f'), - ) # bloc_scalar_FluidTurbulentandNonComplexe + bloc_ThermalEffects_On = BLOC(condition = ' ThermalEffects == "Active on flow dynamics" or ThermalEffects == "Passive on flow dynamics"', + TemperatureScalar =FACT(statut ='o', + 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 + ), Scalar = FACT(statut = 'o', max ='**', Name = SIMP(typ=(scalar,'createObject'), statut='o',), bloc_scalar_FluidTurbulentandNonComplexe = BLOC (condition = "FlowNature == 'Turbulent'", ScalarFluxModel = FactTurbulence('f'), - ) # bloc_scalar_FluidTurbulentandNonComplexe + ), # bloc_scalar_FluidTurbulentandNonComplexe + SourceTerm=SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = FactTermeSource('SourceTerm==True'), ),# Scalar ),# AdditionalScalars + #UtiliseLesScalaires=SIMP(typ=scalar, statut='o',) ), # fin FluidTurbulentandNonComplexe - #bloc_scalar_FluidLaminaireandNonComplexe = BLOC (condition = "FluidComplexe == False and FlowNature == 'Laminar'", + #bloc_scalar_FluidLaminaireandNonComplexe = BLOC (condition = "ComplexFluid == False and FlowNature == 'Laminar'", # AdditionalScalars = FACT (statut = 'o', # Scalar = FACT ( statut = 'f', max ='**', # Name = SIMP(typ='TXM', statut='o',), @@ -546,6 +576,48 @@ def bloc_FluideMacro(): # il faut une validation de coherence entre l existence de tous les turbulencesModelling )# fin bloc_FluideMacro +#-----------------------------------------------------# +def prepareBoundaryCondition(): + return FACT( statut='f',max = '**', # max = nb de facette de bord + Apply_to_Wich_Quantity = SIMP( statut='o', typ='TXM', into=['Mass FLux', 'Scalars']), + applyOnEssai2 = SIMP (statut ='o', typ=scalar, ), + + b_on_scalar=BLOC(condition='Apply_to_Wich_Quantity == "Scalars"', + applyOn = SIMP (statut ='o', typ=scalar, ), + + 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']), + ), # b_periodique + + b_inOrOutlet = BLOC( condition = "Type_Of_Boundary_Condition == 'Inlet' or Type_Of_Boundary_Condition == 'Outlet'", + Formulation_of_Boundary= SIMP( statut='o', typ='TXM', into=['Dirichlet','Neumann','Cauchy']), + b_Formulation_of_Boundary_dirichlet = BLOC( condition = 'Formulation_of_Boundary == "Dirichlet"', + InletProfile = SIMP (statut ='o', typ='TXM', defaut='QuestionJP'), + IntegratedValue = SIMP ( statut='o', typ='R'), + #PN : faire une regle + ), +# b_Formulation_of_Boundary_Neumann = BLOC( condition = 'Formulation_of_Boundary == "Neumann"', +# ), +# b_Formulation_of_Boundary_Cauchy = BLOC( condition = 'Formulation_of_Boundary == "Cauchy"', +# ), +# ), # b_inOrOutlet + +# #b_non_periodique = BLOC( condition = "Type_Of_Boundary_Condition != 'Periodic'", +# # Boundary_Face = SIMP( statut='o', typ= spatialRegion), +# #Apply_to_Wich_Quantity = SIMP( statut='o', typ='TXM', into=['Mass FLux', 'Velocity', 'Temperature','Scalars','all',]), + ), + + # Formulation_of_Boundary= SIMP( statut='o', typ='TXM', into=['Dirichlet','Neumann']), + # b_Formulation_of_Boundary_dirichlet = BLOC( condition = 'Formulation_of_Boundary == "Dirichlet"', + # Value = SIMP ( statut='o', typ='R'), + # ), + ), # b_non_periodique + ) # Boundary_Conditions + + + + JdC = JDC_CATA ( code = 'Vimmp', # faire un validateur qui verifie que si on active reactions chimiques il faut que les masses molaires soient rentrees @@ -560,6 +632,7 @@ Component = OPER(nom='Component', sd_prod=composant, b_ModeleNumerique_quantum = prepareBlocSystemType('Quantum system'), b_ModeleNumerique_classical = prepareBlocSystemType('Classical particle system'), b_ModeleNumerique_continuum = prepareBlocSystemType('Continuum system'), + BoundaryConditions = prepareBoundaryCondition(), ) Species = PROC(nom='Species', @@ -741,6 +814,6 @@ Spatial_Aspects = PROC( nom='Spatial_Aspects', ), # Boundary_Constraints ) # fin Geometric_Domain - - - +TEXTE_NEW_JDC = "\ +Velocity=scalar()\ +" -- 2.39.2