From: pascale.noyret Date: Wed, 24 Feb 2021 15:13:44 +0000 (+0100) Subject: ajout du type de particle dans les BC X-Git-Tag: V210224_osthus~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c87084da0dbb3be149632edae5bb232ff48fe92;p=tools%2Feficas.git ajout du type de particle dans les BC --- diff --git a/Vimmp/cata_CSAndCPS_v16.py b/Vimmp/cata_CSAndCPS_v16.py index 5328d294..66eb4ef8 100644 --- a/Vimmp/cata_CSAndCPS_v16.py +++ b/Vimmp/cata_CSAndCPS_v16.py @@ -1,4 +1,5 @@ from Accas import * +VERSION_CATALOGUE='VimmpV16' class composant(ASSD):pass class mapper(ASSD):pass @@ -186,30 +187,6 @@ def creeBlocPourLesFichiers(laCondition, Prefixe='Empty', ListeFormats=[], Field dicoDesBlocs[FieldName] = SIMPFieldName return BLOC(condition=laCondition, **dicoDesBlocs) -#--------------------------------------------------------------------- -def prepareBlocParticleDynVarOld(condition, nomDuFact, nomDelaContante) : -#--------------------------------------------------------------------- - dicoDesBlocs = {} - dicoDuFact = {} - dicoDuFact[nomDelaContante] = SIMP(typ=(dynamicVariableParticle,'createObject'), statut='o', defaut = nomDelaContante, homo='constant') - monFact = FACT ( statut ='o', - **dicoDuFact, - blocSteadyState = BLOC(condition = 'SteadyState == True', - blocFluidInSame = creeBlocPourLesFichiers('InSameFile == False', 'Position', ('Med', 'cgns' ), None), - blocGivenPosition = BLOC(condition = 'OriginOfDynamicalVariables == "Given"', - PositionFieldName = SIMP(typ='TXM',statut='o'), - ), - blocInteractionPosition = BLOC(condition = 'OriginOfDynamicalVariables == "Interaction"', - InteractionName = SIMP(typ=interaction,statut='o'), - Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Create and choose suitable interaction'), - ), - ), - blocSimulatedPosition = prepareBlocInitialisation(condition = 'VariablesSimulation == True'), - ) - dicoDesBlocs[nomDuFact] = monFact - return BLOC(condition=condition,**dicoDesBlocs) - - #--------------------------------------------------------------------- def prepareBlocAmbiantMediaField(condition, nomDuFact, nomDelaContante) : #--------------------------------------------------------------------- @@ -230,9 +207,9 @@ def prepareBlocAmbiantMediaField(condition, nomDuFact, nomDelaContante) : Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Create and choose suitable interaction'), ), ), - blocConsigne = BLOC(condition = 'SteadyState == False', - Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet. Will ask for a range of calculation steps.'), - ), #BlocNotSteady + blocConsigne = BLOC(condition = 'SteadyState == False', + Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet. Will ask for a range of calculation steps.'), + ), #BlocNotSteady FieldAppliesOnAllSpecies = SIMP(statut='o', typ=bool, defaut=True), blocPorteEspece = BLOC(condition = 'FieldAppliesOnAllSpecies == False ', AppliesToSpecies = SIMP(statut='o', typ=userParticle, max= '**', homo='SansOrdreNiDoublon'), # faire un typ = "espece" @@ -255,9 +232,15 @@ def prepareTermeSource(condition): ), ) -#------------------------------ -def prepareTermeSourceDynVar(condition): -#------------------------------ +#---------------------------------------- +def prepareTermeSourceParticle(condition): +#--------------------------------------- +# les differences avec prepareTermeSource sont +# le type de TakenFrom +# le into +# il est possible de factoriser les 2 fonctions en utilisant un intoXML mais cela +# affaiblit la possibilite de controle du XSD + return BLOC (condition=condition, OriginOfSourceTerm = SIMP(statut='o', typ='TXM',into=['Interaction', 'Other Particle']), blocOriginOfSourceTermInteraction = BLOC(condition = 'OriginOfSourceTerm == "Interaction"', @@ -269,9 +252,9 @@ def prepareTermeSourceDynVar(condition): ), ) -#------------------------------------------------------ +#--------------------------------------------------------------------------------- def prepareFactTurbulence(statut, ajout=None , position=None, positionChoice=None): -#------------------------------------------------------ +#--------------------------------------------------------------------------------- listInto = ['Fully resolved (DNS)', 'Spatial filtering (LES)', 'One-point moment', 'One-point PDF'] if ajout != None : listInto.append(ajout) return FACT(statut=statut, @@ -325,10 +308,9 @@ def prepareFactTurbulence(statut, ajout=None , position=None, positionChoice=Non # ), # fin bloc_no_model ) # fin du return de la fonction factTurbulence -#------------------------------------------------------ +#-------------------------------------- def prepareFactTurbulenceForParticule(): -#statut, ajout=None , position=None, positionChoice=None): -#------------------------------------------------------ +#-------------------------------------- listInto = ['Fully resolved (DNS)', 'Spatial filtering (LES)', 'One-point moment', 'One-point PDF'] return FACT(statut='o', NatureOfFlow = SIMP(typ='TXM', statut='o', into =['Laminar', 'Turbulent'], position='global'), @@ -352,22 +334,24 @@ def prepareFactTurbulenceForParticule(): blocTMD = BLOC(condition ='NatureOfFlow == "Turbulent" and "Drag" in TypeOfHydroDynamicForce', TurbulenceModelDispersion = SIMP (statut ='o', typ='TXM', into = ['Langevin']), BlocInitialisationLangevin = BLOC(condition ='TurbulenceModelDispersion == "Langevin"', - InitialisationType = SIMP(statut='o', into =['ByInteraction', 'ByFile' ], typ ='TXM', defaut='ByValue'), + InitialisationType = SIMP(statut='o', into =['ByInteraction', 'ByFile' ], typ ='TXM', ), blocByFile = creeBlocPourLesFichiers('OrigineType == "ByFile"', '', ListeFormats = 'all', FieldName=None), blocByInteraction = BLOC(condition = 'InitialisationType == "ByInteraction"', - InteractionName = SIMP(typ=interaction,statut='o'), - Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Create and choose suitable interaction'), + Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Create and choose suitable interactions'), + InteractionNameForPressure = SIMP(typ=interaction,statut='o'), + InteractionNameForVelocity = SIMP(typ=interaction,statut='o'), + InteractionNameForEpsilon = SIMP(typ=interaction,statut='o'), + InteractionNameForRij = SIMP(typ=interaction,statut='o'), ), ), ), ),# fin bloc Turbulent ) # fin du return de la fonction factTurbulence -#------------------------------------------------------ -def prepareFactTurbulenceScalaire(statut, ajout=None , position=None): -#------------------------------------------------------ +#-------------------------------------------------------- +def prepareFactTurbulenceScalaire(statut, 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, position=position ), @@ -377,9 +361,9 @@ def prepareFactTurbulenceScalaire(statut, ajout=None , position=None): into=['Algebraic flux models','Turbulent diffusivity models', 'Scalar-flux transport equations']), # Ce bloc consigne ne passe pas dans la projection XSD # blocAlgebraic = BLOC(condition= "RANSModel == 'Algebraic flux models'", - # blocConsigne = BLOC(condition= "RANSModel == 'Algebraic flux models'", - # Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet'), - # ), # fin blocAlgebraic + blocConsigne = BLOC(condition= "RANSModel == 'Algebraic flux models'", + Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet'), + ), # fin blocAlgebraic blocTDM = BLOC(condition = "RANSModel == 'Turbulent diffusivity models'", TDMChoice = SIMP(typ='TXM', statut='o', into=['SGDH', 'GGDH',]), ), # fin blocTDM @@ -432,9 +416,9 @@ def prepareFactTurbulenceScalaire(statut, ajout=None , position=None): def prepareBlocCPS(): #-------------------- return BLOC(condition = 'SystemType == "Classical particle system"', - Particles = prepareParticles(), -#------------------------------- AmbiantMediaInteraction ---------------------------------- + +# ----------------------------- AmbiantMediaInteraction ---------------------------------- AmbiantMediaInteraction = FACT(statut='o', MomentumExchange = FACT(statut='o', withMomentumExchange = SIMP(statut='o', typ=bool, defaut=False), @@ -510,8 +494,6 @@ def prepareBlocCPS(): ), # fin AdditionalSamplingOfAmbientMedia ), # fin AmbiantMediaInteraction - - ParticleParticleInteraction = FACT(statut='o', max = "**", # -------------------------------------------------------# BondedInteractions = prepareBondedInteractions(), @@ -540,7 +522,7 @@ def prepareBlocCPS(): ConstraintsAndReducedStatisticalDescription = FACT(statut='o', Constraint= FACT(statut='o', - TypeOfConstraint = SIMP( typ='TXM', statut='o', into=['Quasi-static methods','Brownian dynamics','Presumed transport','Time-marching equilibrium','Time-marching non-equilibrium'],defaut='Time-marching non-equilibrium', max ='**', position='reCalculeEtape', homo='SansOrdreNiDoublon'), + TypeOfConstraint = SIMP( typ='TXM', statut='o', into=['Quasi-static_methods','Brownian_dynamics','Presumed_transport','Time-marching_equilibrium','Time-marching_non-equilibrium'],defaut=['Time-marching_non-equilibrium',], max ='**', position='reCalculeEtape', homo='SansOrdreNiDoublon'), ), ), @@ -554,47 +536,65 @@ def prepareBlocCPS(): ParticleDiameter = FACT(statut ='o', Diameter = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Diameter', homo='constant'), ToSimulate = SIMP(typ=bool, statut ='o', defaut = True,), - blocSimulatedDiameter = prepareBlocInitialisation(condition = 'ToSimulate == True', ajoutPossible='Not needed'), - #blocNoSimulatedDiameter = prepareBlocOrigine(condition = 'ToSimulate == False'), + blocSimulatedDiameter = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), ), ParticleMass = FACT(statut ='o', Mass = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Mass', homo='constant'), ToSimulate = SIMP(typ=bool, statut ='o', defaut = True,), - blocSimulatedMass = prepareBlocInitialisation(condition = 'ToSimulate == True', ajoutPossible ='Not needed'), - #blocNoSimulatedMass = prepareBlocOrigine(condition = 'ToSimulate == False'), + blocSimulatedMass = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), ), ParticlePosition = FACT(statut ='o', Position = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Position', homo='constant'), ToSimulate = SIMP(typ=bool, statut ='o', defaut = True,), - blocSimulatedPosition = prepareBlocInitialisationSansTermeSource(condition = 'ToSimulate == True', ajoutPossible='Not needed'), - blocNoSimulatedPosition = prepareBlocOrigine(condition = 'ToSimulate == False'), + blocSimulatedPosition = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=False), + blocNoSimulatedPosition = prepareBlocOrigine(condition = 'ToSimulate == False') ), blocNoBrownianDynamics = BLOC(condition = '(TypeOfConstraint != None) and not("Brownian dynamics" in TypeOfConstraint)', ParticleVelocity = FACT(statut ='o', Velocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Velocity', homo='constant'), ToSimulate = SIMP(typ=bool, statut ='o', defaut = True,), - blocSimulatedVelocity = prepareBlocInitialisation(condition = 'ToSimulate == True', ajoutPossible='Not needed'), - blocNotSimulatedVelocity = prepareBlocOrigine(condition = 'ToSimulate == False',), + blocSimulatedVelocity = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), + # blocNotSimulatedVelocity = prepareBlocOrigine(condition = 'ToSimulate == False',), ), #fin VelocityDefinition blocHydrodynamic = BLOC(condition = '"Hydrodynamic" in MomentumFieldType', FluidVelocitySeenByParticles = FACT(statut ='o', - FluidSeenVelocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='FluidSeenVelocity', homo='constant'), + FluidSeenVelocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='FluidSeenVelocity', homo='constant'), ToSimulate = SIMP(typ=bool, statut ='o', defaut = True,), - blocHydrodynamicVelocity = prepareBlocInitialisation(condition = 'ToSimulate == True', ajoutPossible='Not needed'), - blocNotHydrodynamicVelocity = prepareBlocOrigine(condition = 'ToSimulate == False',), + blocHydrodynamicVelocity = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), + #blocNotHydrodynamicVelocity = prepareBlocOrigine(condition = 'ToSimulate == False',), ) , ) , ), #blocNoBrownianDynamics ), #fin StateVector )# fin du prepareBlocCps +#---------------------- def prepareParticles(): - return FACT(statut='o', max='**', +#---------------------- + return FACT(statut='o', max='**', ParticleNature = SIMP(statut='o', typ='TXM', into=['Atom', 'Molecule', 'Dissipative Particle', 'Fluid Particle', 'Discrete Particle']), - blocAtom = BLOC(condition='ParticleNature == "Atom"', - ParticleName = SIMP(statut='o', typ=(userAtom,'createObject'),), + blocAtomName = BLOC(condition='ParticleNature == "Atom"', + ParticleName = SIMP(statut='o', typ=(userAtom,'createObject') ), InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), + ), + + blocMoleculeName = BLOC(condition='ParticleNature == "Molecule"', + ParticleName = SIMP(statut='o', typ=(userMolecule,'createObject')), + InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), + ), + + blocDissipativeName = BLOC(condition='ParticleNature == "Dissipative Particle"', + ParticleName = SIMP(statut='o', typ=(userDPD,'createObject')), + InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), + ), + + blocDiscreteName = BLOC(condition='ParticleNature == "Discrete Particle"', + ParticleName = SIMP(statut='o', typ=(userDiscrete,'createObject')), + InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), + ), + + blocAtom = BLOC(condition='ParticleNature == "Atom"', ChemicalSpecies = SIMP(statut='o', typ='TXM'), ElectricCharge = SIMP(statut='f', typ='R'), MagneticMoment = SIMP(statut='f', typ='R'), @@ -603,29 +603,23 @@ def prepareParticles(): ), # fin b_Atom # --------------- Molecules ------------------ blocMolecule = BLOC(condition='ParticleNature == "Molecule"', - ParticleName = SIMP(statut='o', typ=(userMolecule,'createObject'),), - InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), Shape = SIMP(statut='o', typ='TXM', into=['Linear', 'Trigonal Planar', 'Angular', 'Tetrahedral', 'Octahedral', 'Trigonal pyramid', 'Other']), - Size = SIMP(statut='f', typ='R'), # relevant ? ElectricCharge = SIMP(statut='f', typ='R'), MagneticMoment = SIMP(statut='f', typ='R'), + Size = SIMP(statut='f', typ='R'), # relevant ? ), #fin b_Molecule # --------------- Dissipative ------------------ blocDissipative = BLOC(condition='ParticleNature == "Dissipative Particle"', - ParticleName = SIMP(statut='o', typ=(userDPD,'createObject'),), - InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), - #BondedParticles = SIMP(statut="o", typ=bool, defaut=False), - ), # b_Dissipative + BondedParticles = SIMP(statut="o", typ=bool, defaut=False), + ), # b_Dissipative # --------------- Discrete Particle ------------------ blocDiscrete = BLOC(condition='ParticleNature == "Discrete Particle"', - ParticleName = SIMP(statut='o', typ=(userDiscrete,'createObject'),), - InitialNumberOfParticles = SIMP(statut='o', typ='I', val_min=0), TypeOfDiscreteParticle = SIMP(statut='o', typ='TXM', into=['Solid', 'Droplets', 'Bubbles','Bio Organism'],), blocTypeDPSolid = BLOC(condition ='TypeOfDiscreteParticle == "Solid"', - PrimaryOrAggregate = SIMP(statut='o', typ='TXM', into=['Primary Particle', 'Assemblage / Aggregate'], position = 'global'), - b_SolidPrimary = BLOC(condition='PrimaryOrAggregate == "Primary Particle"', - ), + PrimaryOrAggregate = SIMP(statut='o', typ='TXM', into=['Primary Particle', 'Assemblage / Aggregate'], ), +# b_SolidPrimary = BLOC(condition='PrimaryOrAggregate == "Primary Particle"', +# ), b_SolidAggregate = BLOC(condition='PrimaryOrAggregate == "Assemblage / Aggregate"', Morphology = FACT (statut ='o', NumberOfPrimaryParticles = SIMP(statut='o', typ='I', val_min=0), @@ -637,7 +631,6 @@ def prepareParticles(): ), # --------------- Bio Organism ------------------ blocTypeBioSolid = BLOC(condition='TypeOfDiscreteParticle == "Bio Organism"', - #ParticleName = SIMP(statut='o', typ=(userBioSolid,'createObject'),), TypeOfOrganism = SIMP(statut='o', typ='TXM', into=['Unicellular', 'Multicellular']), blocUnicellular = BLOC(condition ='TypeOfOrganism=="Unicellular"', Unicellular = SIMP(statut='o', typ='TXM', into=["Bactaria"], defaut='Bactaria') @@ -679,7 +672,7 @@ def prepareParticles(): ), ), # Properties ), # b_Discrete - ) # fin Particle + ) # fin Particle #--------------------------------- def prepareContactPhenomena(): @@ -801,15 +794,15 @@ def prepareActionsAtDistanceForWall(): ) # fin bloc ) # fin prepareActionsAtADistanceForWall -#--------------------------------- +#-------------------------------------------- def prepareBondedInteractions(fromWall=False): #--------------------------------- intoHorsWall=[ 'Bond stretching', 'Angle bending', 'Torsional motion', 'Frozen or collective motion',] intoWall=[ 'Bond stretching', 'Angle bending', 'Torsional motion', 'Frozen or collective motion','Contact mechanics'] if fromWall : mesInto=intoWall - #monBondedParticles = SIMP(statut='o', typ='TXM', defaut='True', into=['True',]) - monBondedParticles = SIMP(statut='o', typ=bool, defaut=1, into=[True,]) + #monBondedParticles = SIMP(statut='o', typ='TXM', defaut='True', into=['True',]) #PNPN + monBondedParticles = SIMP(statut='o', typ=bool, defaut=1, ) else : mesInto=intoHorsWall monBondedParticles = SIMP(statut='o', typ=bool, defaut=False) @@ -823,7 +816,7 @@ def prepareBondedInteractions(fromWall=False): ), blocNoTopologyFile = BLOC (condition = 'DescribedWithTopologyFile == False', BondedInteraction = FACT (statut ='o', max ='**', - NatureOfBondedInteraction = SIMP(statut='o', typ='TXM', into= mesInto), + NatureOfBondedInteraction = SIMP(statut='o', typ='TXM', into= mesInto, intoXML = intoWall), bBondStretching = BLOC ( condition = 'NatureOfBondedInteraction == "Bond stretching"', TypeOfBondStretching = SIMP(statut='o', typ='TXM', into=[ 'Bond harmonic potential', 'FENE',],), # ------------ FENE ------------------ @@ -885,9 +878,9 @@ def prepareBondedInteractions(fromWall=False): ), # blocBondedInteractop, ) # fin Bonded_Interaction -# _______________________________________ +#--------------------------------- def prepareBlocOrigine(condition): -# _______________________________________ +#--------------------------------- return BLOC(condition = condition, Origin = FACT(statut ='o', OriginType = SIMP(statut='o', into =['ByValue', 'ByFile', 'ByInteraction'], typ ='TXM', defaut='ByValue'), @@ -901,12 +894,10 @@ def prepareBlocOrigine(condition): ), ), ) -# _______________________________________ -def prepareBlocInitialisation(condition,ajoutPossible=None): -# _______________________________________ +#---------------------------------------- +def prepareBlocInitialisation(condition): +#---------------------------------------- monIntoType = ['ByValue', 'ByFile', 'ByInteraction'] - if ajoutPossible != None : - monIntoType.append(ajoutPossible) return BLOC(condition = condition, Initialisation = FACT(statut ='o', InitialisationType = SIMP(statut='o', into = monIntoType, typ ='TXM', defaut='ByValue'), @@ -920,16 +911,25 @@ def prepareBlocInitialisation(condition,ajoutPossible=None): ), ), SourceTerm = SIMP(typ=bool, statut='o', defaut=False), - blocSourceTerm = prepareTermeSourceDynVar('SourceTerm==True'), + blocSourceTerm = prepareTermeSource('SourceTerm==True'), ) #blocSimulatedPressure -def prepareBlocInitialisationSansTermeSource(condition,ajoutPossible=None): - monIntoType = ['ByValue', 'ByFile', 'ByInteraction'] - if ajoutPossible != None : - monIntoType.append(ajoutPossible) - return BLOC(condition = condition, +#----------------------------------------------------------------- +def prepareBlocInitialisationParticle(condition, termeSource=True): +#----------------------------------------------------------------- + monIntoType = ['ByValue', 'ByFile', 'ByInteraction','Not needed' ] + #dicoTermeSource = {} + #if termeSource : + # dicoTermeSource['SourceTerm'] = SIMP(typ=bool, statut='o', defaut=False), + # dicoTermeSource['blocSourceTerm'] = prepareTermeSourceParticle('SourceTerm==True') + + if termeSource : + return BLOC(condition = condition, Initialisation = FACT(statut ='o', InitialisationType = SIMP(statut='o', into =monIntoType, typ ='TXM', defaut='ByValue'), + blocNotNeeded = BLOC(condition = 'InitialisationType != "Not needed"', + ParticleIdentifier=SIMP(statut='o', typ = userParticle), + ), blocByFile = creeBlocPourLesFichiers('InitialisationType == "ByFile"', '', ListeFormats = listeFormatGenerique, FieldName='FieldName'), blocByInteraction = BLOC(condition = 'InitialisationType == "ByInteraction"', InteractionName = SIMP(typ=interaction,statut='o'), @@ -938,8 +938,27 @@ def prepareBlocInitialisationSansTermeSource(condition,ajoutPossible=None): blocByValue = BLOC(condition = 'InitialisationType == "ByValue"', Value = SIMP (statut ='o', typ='R'), ), + SourceTerm = SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = prepareTermeSourceParticle('SourceTerm==True') ), - ) #blocSimulatedPressure + ) # + else: + return BLOC(condition = condition, + Initialisation = FACT(statut ='o', + InitialisationType = SIMP(statut='o', into =monIntoType, typ ='TXM', defaut='ByValue'), + blocNotNeeded = BLOC(condition = 'InitialisationType != "Not needed"', + ParticleIdentifier=SIMP(statut='o', typ = userParticle), + ), + blocByFile = creeBlocPourLesFichiers('InitialisationType == "ByFile"', '', ListeFormats = listeFormatGenerique, FieldName='FieldName'), + blocByInteraction = BLOC(condition = 'InitialisationType == "ByInteraction"', + InteractionName = SIMP(typ=interaction,statut='o'), + Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Create and choose suitable interaction'), + ), + blocByValue = BLOC(condition = 'InitialisationType == "ByValue"', + Value = SIMP (statut ='o', typ='R'), + ), + ), + ) # #--------------------------- def prepareBlocFluideMacro(): @@ -978,9 +997,9 @@ def prepareBlocFluideMacro(): blocGivenOrInteraction = BLOC(condition = 'OriginOfDynamicalVariables in ["Given", "Interaction",]', SteadyState = SIMP(typ=bool, statut ='o', defaut = True, position = 'global'), # blocNotSteady = BLOC(condition = 'SteadyState == False', - blocConsigne = BLOC(condition = 'SteadyState == False', - Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet. Will ask for a range of calculation steps.'), - ), #blocNotSteady + # blocConsigne = BLOC(condition = 'SteadyState == False', + # Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Not implemented yet. Will ask for a range of calculation steps.'), + # ), #blocNotSteady blocSteady = BLOC(condition = 'SteadyState == True', blocGiven = BLOC(condition = 'OriginOfDynamicalVariables == "Given"', InSameFile = SIMP(typ=bool, statut ='o', defaut = True, position = 'reCalculeEtape'), @@ -1093,7 +1112,7 @@ def prepareBlocFluideMacro(): blocTurbulenceRSMChoice1 = BLOC(condition = "RSMChoice !=None", RijDefinition = FACT(statut ='o', Name = SIMP(typ=(scalar,'createObject'), statut='o', defaut ='Rij', homo='constant'), - blocSteadyState = BLOC(condition = 'SteadyState == True', + blocSteady = BLOC(condition = 'SteadyState == True', blocRijInSame = creeBlocPourLesFichiers('InSameFile == False', 'Rij', ('Med', 'cgns' ), None), blocRijGiven = BLOC(condition = 'OriginOfDynamicalVariables == "Given"', RijFieldName = SIMP(typ='TXM',statut='o'), @@ -1104,7 +1123,7 @@ def prepareBlocFluideMacro(): ), ), blocSimulatedRijDefinition = prepareBlocInitialisation(condition = 'VariablesSimulation == True'), - ), + ), ), # blocTurbulenceRSMChoice1 ), #BFlowNatureTurbulent ), # DynamicalVariables @@ -1191,9 +1210,9 @@ def prepareBlocFluideMacro(): # il faut une validation de coherence entre l existence de tous les turbulencesModelling )# fin bloc_FluideMacro -#---------------------------------------- +#----------------------------------------- def ActiveOnFlowEffect(inTemperature=True): -#---------------------------------------- +#----------------------------------------- return 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"', @@ -1213,8 +1232,11 @@ def ActiveOnFlowEffect(inTemperature=True): ), ) -#-----------------------------------------------------# +#------------------------------# def prepareBoundaryCondition(): +#------------------------------# +# on en fait 1 bloc seul pour CS and CPS +# pour pas de souci dans la projection XSD return FACT(statut='o',max = '**', # max = nb de facette de bord TypeOfBoundaryCondition = SIMP(statut='o', typ='TXM', into=['Inlet', 'Outlet', 'Symmetry','Periodicity', 'Wall', 'Free Surface'], ), @@ -1226,46 +1248,48 @@ def prepareBoundaryCondition(): ), ), blocDesigne_Shape = BLOC(condition = "SystemType == 'Classical particle system'", - #ApplyOnGroups = SIMP (statut ='o', typ=spatialRegion, max='**' + #ApplyOnGroups = SIMP (statut ='o', typ=spatialRegion, max='**') ApplyOnGroups = SIMP (statut ='o', typ=meshGroup, max='**', homo='SansOrdreNiDoublon', filtre=( '(set(MeshIdentifiers).intersection( set(self.getParentsWithId().getListeUserASSD("MeshId")) ) != set()) ', ( ('MeshIdentifiers', 'self.etape.getChild("blocModeleNumeriqueClassical").getChild("NumericalModel")'), ) ), ), ), - - blocOnStateVariable = BLOC(condition = "TypeOfBoundaryCondition not in ['Wall', 'Outlet']", + + + blocOnStateVariable = BLOC(condition = "(TypeOfBoundaryCondition in ['Inlet', 'Symmetry','Periodicity', 'Free Surface'] and SystemType == 'Continuum system') or (SystemType == 'Classical particle system' and TypeOfBoundaryCondition not in ['Outlet','Inlet'])" , ApplyOnStateVariable = SIMP (statut ='o', typ=stateVariable, max='**', homo='SansOrdreNiDoublon', filtre=( 'etape in set(self.getEtapes()) ', (('etape', None),), ), #Il ne faut pas proposer les variables d'état des autres composants. - ), #PNPN A FAIRE : fenetreIhm='menuDeroulant' + ), #PNPN A FAIRE : fenetreIhm='menuDeroulant' ), + blocPeriodique = BLOC(condition = "TypeOfBoundaryCondition == 'Periodicity'", Direction = SIMP(statut='o', typ='TXM', into=['X','Y','Z', 'XYZ']), ), # b_periodique - blocInlet = BLOC(condition = "TypeOfBoundaryCondition == 'Inlet'", - FormulationOfBoundary= SIMP(statut='o', typ='TXM', into=['Dirichlet','Neumann','Cauchy']), - blocDirichlet = BLOC(condition = 'FormulationOfBoundary == "Dirichlet"', - regles=(AU_MOINS_UN('InletProfile','IntegratedValue','IntegratedVectorValue',), + + blocInlet1 = BLOC(condition = "TypeOfBoundaryCondition == 'Inlet' and SystemType == 'Continuum system'", + FormulationOfBoundary= SIMP(statut='o', typ='TXM', into=['Dirichlet','Neumann','Cauchy']), + blocDirichlet = BLOC(condition = 'FormulationOfBoundary == "Dirichlet"', + regles=(AU_MOINS_UN('InletProfile','IntegratedValue','IntegratedVectorValue',), EXCLUS ('InletProfile','IntegratedValue','IntegratedVectorValue',), ), - Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = "Choose between InletProfile,IntegratedValue,IntegratedVectorValue "), - InletProfile = SIMP (statut ='f', typ='TXM'), - IntegratedValue = SIMP (statut='f', typ='R'), - IntegratedVectorValue = FACT(statut='f', - U = SIMP (statut ='o', typ='R'), - V = SIMP (statut ='o', typ='R'), - W = SIMP (statut ='o', typ='R'), - ), - #PN : faire une regle - ), - blocNeumann = BLOC(condition = 'FormulationOfBoundary == "Neumann"', + Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = "Choose between InletProfile,IntegratedValue,IntegratedVectorValue "), + InletProfile = SIMP (statut ='f', typ='TXM'), + IntegratedValue = SIMP (statut='f', typ='R'), + IntegratedVectorValue = FACT(statut='f', + U = SIMP (statut ='o', typ='R'), + V = SIMP (statut ='o', typ='R'), + W = SIMP (statut ='o', typ='R'), + ), + ),# fin Dirichlet + blocNeumann = BLOC(condition = 'FormulationOfBoundary == "Neumann"', FluxFile = SIMP (statut ='o', typ=('Fichier', " ;;All Files (*)"),) - ), - blocCauchy = BLOC(condition = 'FormulationOfBoundary == "Cauchy"', + ), + blocCauchy = BLOC(condition = 'FormulationOfBoundary == "Cauchy"', ImposedFlux = SIMP (statut ='o', typ='TXM'), _IntegratedValue = SIMP (statut='o', typ='R'), ), - ), # b_inlet - blocWall = BLOC(condition = "TypeOfBoundaryCondition == 'Wall'", + ), # b_inlet1 + blocWall = BLOC(condition = "TypeOfBoundaryCondition == 'Wall' and SystemType == 'Continuum system'", VelocityAtBoundary = FACT(statut='o', SlipVelocity = SIMP(statut='o', typ='R', defaut= 0.0), WallMotion = FACT(statut='o', @@ -1275,7 +1299,7 @@ def prepareBoundaryCondition(): ), ), LevelOfDescription = FACT(statut='o', - blocWall = BLOC(condition = "FlowNature == 'Turbulent'", ##JP+CH TODO : Choix des lois en fct du type du TurbulenceModelingType + blocWallInside = BLOC(condition = "FlowNature == 'Turbulent'", ##JP+CH TODO : Choix des lois en fct du type du TurbulenceModelingType WallFunction = SIMP(statut ='o', typ='TXM', into=['No wall function','1-scale model (Log law)', '2-scale model (Log law)','Scalable 2-scale model (Log law)', @@ -1284,31 +1308,12 @@ def prepareBoundaryCondition(): ), ), # b_Wall - ) # Boundary_Conditions - - -#-----------------------------------------------------# -def prepareBoundaryConditionParticle(): - return FACT(statut='o',max = '**', # max = nb de facette de bord - TypeOfBoundaryCondition = SIMP(statut='o', typ='TXM', into=['Inlet', 'Outlet', 'Symmetry','Periodicity', 'Wall', 'Free Surface'], ), - - ApplyOnGroups = SIMP(statut ='o', typ=meshGroup, max='**', homo='SansOrdreNiDoublon', - filtre=( '(set(MeshIdentifiers).intersection( set(self.getParentsWithId().getListeUserASSD("MeshId")) ) != set()) ', - ( ('MeshIdentifiers', 'self.etape.getChild("blocModeleNumeriqueClassical").getChild("NumericalModel")'), ) - ), - ), - blocWall = BLOC(condition = "TypeOfBoundaryCondition == 'Wall'", + blocWall2 = BLOC(condition = "TypeOfBoundaryCondition == 'Wall' and SystemType == 'Classical particle system'", ChoiceOfParticleWallInteraction = SIMP(statut='o', typ = wallInteractionId) ), # b_Wall - blocOnStateVariable = BLOC(condition = "TypeOfBoundaryCondition not in ['Outlet','Inlet']", - ApplyOnStateVariable = SIMP (statut ='o', typ=stateVariable, max='**', homo='SansOrdreNiDoublon', - filtre=( 'etape in set(self.getEtapes()) ', (('etape', None),), ), #Il ne faut pas proposer les variables d'état des autres composants. - ), #PNPN A FAIRE : fenetreIhm='menuDeroulant' - ), - blocPeriodique = BLOC(condition = "TypeOfBoundaryCondition == 'Periodicity'", - Direction = SIMP(statut='o', typ='TXM', into=['X','Y','Z', 'XYZ']), - ), # b_periodique - blocInlet = BLOC(condition = "TypeOfBoundaryCondition == 'Inlet'", + + blocInlet2 = BLOC(condition = "TypeOfBoundaryCondition == 'Inlet' and SystemType == 'Classical particle system'", + TypeOfParticleInjected = SIMP(statut='o', typ = userParticle), NumberOfParticleInjected = SIMP(statut='o', typ = 'I', val_min = 1), InjectionEveryNTimeSteps = SIMP(statut='o', typ = 'I', val_min = 0), DiameterOfParticleInjected = SIMP(statut='o', typ = 'R', val_min = 0), @@ -1328,47 +1333,16 @@ def prepareBoundaryConditionParticle(): ), ), ),# blocNoBrownianDynamics - ), # b_inlet - ) # Boundary_Conditions + ), # bInlet2 -# def prepareBoundaryCondition(): -# return FACT(statut='o',max = '**', # max = nb de facette de bord -# ApplyOnStateVariable = SIMP (statut ='o', typ=stateVariable, ), #PNPN A FAIRE : fenetreIhm='menuDeroulant' -# blocDesigneMesh = BLOC(condition = "SystemType == 'Continuum system'", -# ApplyOnGroups = SIMP (statut ='o', typ=meshGroup, max='**', homo='SansOrdreNiDoublon'), -# ), -# blocDesigne_Shape = BLOC(condition = "SystemType == 'Classical particle system'", -# ApplyOnCadGroups = SIMP (statut ='o', typ=spatialRegion, max='**'), -# ), -# TypeOfBoundaryCondition = SIMP(statut='o', typ='TXM', into=['Inlet', 'Outlet', 'Symmetry','Periodicity', 'Wall', 'Free Surface'], ), -# blocPeriodique = BLOC(condition = "TypeOfBoundaryCondition == 'Periodic'", -# Direction = SIMP(statut='o', typ='TXM', into=['X','Y','Z', 'XYZ']), -# ), # b_periodique -# blocInlet = BLOC(condition = "TypeOfBoundaryCondition == 'Inlet'", -# FormulationOfBoundary= SIMP(statut='o', typ='TXM', into=['Dirichlet','Neumann','Cauchy']), -# blocDirichlet = BLOC(condition = 'FormulationOfBoundary == "Dirichlet"', -# regles=(AU_MOINS_UN('InletProfile','IntegratedValue','IntegratedVectorValue',), -# EXCLUS ('InletProfile','IntegratedValue','IntegratedVectorValue',), ), -# #Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = "Choose between InletProfile,IntegratedValue,IntegratedVectorValue "), -# InletProfile = SIMP (statut ='f', typ='TXM'), -# IntegratedValue = SIMP (statut='f', typ='R'), -# IntegratedVectorValue = FACT(statut='f', -# x = SIMP (statut ='o', typ='R'), -# y = SIMP (statut ='o', typ='R'), -# z = SIMP (statut ='o', typ='R'), -# ), -# #PN : faire une regle -# ), -# blocNeumann = BLOC(condition = 'FormulationOfBoundary == "Neumann"', -# Flux = SIMP (statut ='o', typ='TXM'), -# ), -# blocCauchy = BLOC(condition = 'FormulationOfBoundary == "Cauchy"', -# ImposedFlux = SIMP (statut ='o', typ='TXM'), -# IntegratedValue = SIMP (statut='o', typ='R'), -# ), -# ), # b_inlet -# ) # Boundary_Conditions + blocApplyOnParticle = BLOC(condition = "SystemType == 'Classical particle system' and TypeOfBoundaryCondition != 'Inlet'" , + ApplyOnAllsParticle = SIMP(typ=bool, statut ='o', defaut = True,), + blocSpecifyParticle = BLOC(condition = "ApplyOnAllsParticle == False" , + ApplyOnParticles = SIMP(statut ='o',max="**", typ = userParticle), + ), + ), + ) # Boundary_Conditions @@ -1387,55 +1361,29 @@ Component = OPER(nom='Component', sd_prod=composant, blocModeleNumeriqueQuantum = prepareBlocSystemType('Quantum system'), blocModeleNumeriqueClassical = prepareBlocSystemType('Classical particle system'), blocModeleNumeriqueContinuum = prepareBlocSystemType('Continuum system'), - BCFluide = BLOC ( condition = 'SystemType == "Continuum system"', - BoundaryConditions = FACT(statut = 'o', - BoundaryCondition = prepareBoundaryCondition(), - ), - ), - BCParticle = BLOC ( condition = 'SystemType == "Classical particle system"', - BoundaryConditions = FACT(statut = 'o', - BoundaryCondition = prepareBoundaryConditionParticle(), - ), - ), -) -Species = PROC(nom='Species', - Specie = FACT(statut='o', max ="**", - Name = SIMP(statut='o', typ=(especeChimique,'createObject') ), - MolarMass = SIMP(statut='f', typ='R',), - ) + # Exemple de reecriture d'un BLOC_XOR pour eviter la generation d'un type xsd double + # BCFluide = BLOC ( condition = 'SystemType == "Continuum system"', + # BoundaryConditions = FACT(statut = 'o', + # BoundaryCondition = prepareBoundaryCondition(), + # ), + # ), + # BCParticle = BLOC ( condition = 'SystemType == "Classical particle system"', + # BoundaryConditions = FACT(statut = 'o', + # BoundaryCondition = prepareBoundaryConditionParticle(), + # ), + # ), + BoundaryConditions = FACT(statut = 'o', + BoundaryCondition = prepareBoundaryCondition(), + ), ) -def monBlocInteractionTypeChamp (): - return BLOC (condition = '1 == 1' , # a distinguer selon les cas - fieldNameInOrigine = SIMP(typ='TXM', statut='o'), - fieldNameInDestination = SIMP(typ='TXM', statut='o'), - ) - - -def SelonLeTypeDeFormatDisponibleMapper(condition): - TransferType = SIMP(typ='TXM', statut='o', into =['File', 'Memory', 'CorbaObject']) - maListe = list(dictCodeFormat.keys()) - dicoArgs={} - index=0 - for Solv1 in maListe[index:]: - for Solv2 in maListe[index:]: - #print (Solv1,Solv2, calculCommun(Solv1, Solv2,dictCodeFormat)) - print ('PNPN attention changement de dictCodeFormat tant que getEficasAttribut n est pas correct') - conditionSolv = 'TransferType == "File" and getEficasAttribut(origine,"Solver")==Solv1 and getEficasAttribut(destination,"Solver")==Solv2' , - conditionSolv = 'TransferType == "File"' - monBlocFichier=creeBlocPourLesFichiers (conditionSolv, '', calculCommun(Solv1, Solv2,dictCodeFormat),None) - dicoArgs['monBlocFichier'+str(index)]=monBlocFichier - index=index+1 - BlocChamp = BLOC(condition = "TransferType=='File'", FieldName=SIMP(typ='TXM', statut='o')) - dicoArgs['BlocChamp'] = BlocChamp - return BLOC(condition = condition,TransferType=TransferType, **dicoArgs) - Interpolator = OPER (nom= 'Interpolator',sd_prod=interpolator, InterpolatorType=SIMP(statut='o', typ='TXM', into = list(dictInterpolatorFormat.keys())), blocMedCoupling= BLOC(condition="InterpolatorType == 'Med Coupling'", TargetMeshIdentifier = SIMP(statut ='o', typ = meshIdentifier,), InterpolationType = SIMP(statut ='o', typ='TXM', into=['P0P0','P0P1','P1P1','P1P0'],), + DefaultValueForUnmatchedMeshTargetEntity = SIMP(statut='o', typ ='R', defaut=-1), ), ) Converter = OPER (nom= 'Converter',sd_prod=converter) @@ -1443,9 +1391,7 @@ Converter = OPER (nom= 'Converter',sd_prod=converter) Interactions = PROC(nom='Interactions', IOAspects = FACT(statut='o', - #WorkingDirectory = SIMP(statut='o', typ='Repertoire', defaut='/tmp'), - FileTransfer = FACT(statut='f', max='**', TransferId = SIMP(statut='o', typ=(fileId,'createObject'),), monBlocFormat = creeBlocPourLesFichiers('1', '', listeFormatGenerique, FieldName=None ), @@ -1458,7 +1404,6 @@ Interactions = PROC(nom='Interactions', ), ), - Interaction = FACT(max = '**', InteractionName = SIMP(statut='o', typ=(interaction,'createObject'),), From = SIMP(typ=modeleNumDuCompo, statut='o'), @@ -1486,19 +1431,11 @@ Interactions = PROC(nom='Interactions', ), ) - - EnvironementAspects = PROC(nom ="EnvironementAspects", WorkflowName = SIMP(statut='o', typ='TXM', defaut='MyStudyCasename'), #PN: -> path WorkingDirectory = SIMP(statut='o', typ='Repertoire', defaut='/tmp'), ) -#Le dictionnaire dict_condition est un dictionnaire utilisé par eficas -# pour les position='global_jdc' et position='inGetAttribut' -dict_condition={ -'ChoiceOfApproach': ('Interactions', 'Component'), -'Interactions' : ( 'Component'), -} TemporalAspects = PROC(nom ="TemporalAspects", Simulated_Time_Laps = FACT(statut='o', max='**', @@ -1516,9 +1453,6 @@ TemporalAspects = PROC(nom ="TemporalAspects", ), ) - - - # # ----------------------------------------- SpatialAspects = PROC(nom='SpatialAspects', @@ -1582,6 +1516,15 @@ SpatialAspects = PROC(nom='SpatialAspects', ), # Boundary_Constraints ) # fin Geometric_Domain -TEXTE_NEW_JDC = "\ -Velocity=scalar()\ -" +#Le dictionnaire dict_condition est un dictionnaire utilisé par eficas +# pour les position='global_jdc' et position='inGetAttribut' +dict_condition={ + 'ChoiceOfApproach': ('Interactions', 'Component'), + 'Interactions' : ( 'Component'), +#NumericalMethod +#TVMChoice +#TypeOfConstraint + +} + +#TEXTE_NEW_JDC = " "