From 59171d927042a6eb40840cea95d322dbcbccf633 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Wed, 24 Feb 2021 09:40:38 +0100 Subject: [PATCH] souci sur initialisation --- Vimmp/cata_CSAndCPS_v15.py | 49 ++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/Vimmp/cata_CSAndCPS_v15.py b/Vimmp/cata_CSAndCPS_v15.py index 2e786d47..09578ca9 100644 --- a/Vimmp/cata_CSAndCPS_v15.py +++ b/Vimmp/cata_CSAndCPS_v15.py @@ -532,33 +532,33 @@ 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'), + blocSimulatedDiameter = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), #blocNoSimulatedDiameter = prepareBlocOrigine(condition = 'ToSimulate == False'), ), 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',particle=True), + blocSimulatedMass = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), #blocNoSimulatedMass = prepareBlocOrigine(condition = 'ToSimulate == False'), ), 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', particle=True), + 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',particle=True), + 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',particle=True), + blocHydrodynamicVelocity = prepareBlocInitialisationParticle(condition = 'ToSimulate == True', termeSource=True), blocNotHydrodynamicVelocity = prepareBlocOrigine(condition = 'ToSimulate == False',), ) , ) , @@ -916,14 +916,39 @@ def prepareBlocInitialisation(condition,ajoutPossible=None,particle=False): blocSourceTerm = prepareTermeSourceDynVar('SourceTerm==True'), ) #blocSimulatedPressure -def prepareBlocInitialisationSansTermeSource(condition,ajoutPossible=None, particle=True): - 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'] = prepareTermeSourceDynVar('SourceTerm==True') + + if termeSource : + return BLOC(condition = condition, Initialisation = FACT(statut ='o', - ParticleIdentifier=SIMP(statut='o', typ = userParticle), 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'), + ), + SourceTerm = SIMP(typ=bool, statut='o', defaut=False), + blocSourceTerm = prepareTermeSourceDynVar('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'), -- 2.39.2