From 0afa789a143acfbae4e3c2b8f39566d61a5cdaab Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Tue, 23 Jun 2020 14:36:45 +0200 Subject: [PATCH] 1ere fusion avec cata_Vimmp formation --- Vimmp/cata_CSAndCPS.py | 188 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 184 insertions(+), 4 deletions(-) diff --git a/Vimmp/cata_CSAndCPS.py b/Vimmp/cata_CSAndCPS.py index eb21fe33..d658187a 100755 --- a/Vimmp/cata_CSAndCPS.py +++ b/Vimmp/cata_CSAndCPS.py @@ -122,6 +122,44 @@ def creeBlocPourLesFichiers (laCondition, NomDuFichier, ListeFormats): dicoDesBlocs['b_format_fichier_others'] = BLOC(condition="FileFormat == 'others'", FileName = SIMP(statut='o', typ = ('Fichier','All Files (*)'),),) return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs) +def champ(nomDelaContante, labels ,nbReels ) : +# ajouter les extensions pour le fichier et les blocs associes +# certains champs ne seront jamais uniformes + #Input_Mode = SIMP( statut='o', typ='TXM', into=('uniform value','values directly assigned','values read in file','analytical function', 'call to a service')), +#PNPN : Passer le nom du champ pour le label du vecteur + dicoBloc = {} + dicoBloc[nomDelaContante] = SIMP( statut='o', typ='R') + return FACT( statut='o', + Input_Mode = SIMP( statut='o', typ='TXM', into=('uniform value','values directly assigned','values read in file','analytical function',)), + b_uniforme = BLOC( condition = "Input_Mode == 'uniform value'", **dicoBloc), + b_vsaisies = BLOC( condition = "Input_Mode == 'values directly assigned'", + Field = SIMP( typ='R', statut='o', max ='**'), + #Vecteur = SIMP( fenetreIhm='Tableau', homo = labels, + # statut='o', min=2, max='**', + # typ=Tuple(nbReels), + # validators=VerifTypeTuple(("'R',"*nbReels),),) # end particle + ), #b_vsaisie + b_vdsfich = BLOC( condition = "Input_Mode == 'values read in file'", + Format = SIMP( statut='o', typ='TXM', into=['txt','Med',], position='global' ), + td_txt = BLOC(condition = 'Format == "txt"', + File = SIMP( statut='o', typ=('Fichier','Text Files(*.txt);All Files (*)'),), + ), + td_med_1 = BLOC( condition = 'Format == "Med"', + File = SIMP( statut='o', typ=('Fichier','Med Files(*.med);All Files (*)'),), + ), + td_med_2 = BLOC( condition = 'Format == "Med"', + FieldName = SIMP( statut='o', typ='TXM',), + ), + ), + b_vfct = BLOC( condition = "Input_Mode == 'analytical function'", + Function = SIMP( statut='o', typ='TXM',), + ), + #b_vserc = BLOC( condition = "Input_Mode == 'call to a service'", + # Service = SIMP( statut='o', typ='TXM',), + #), + ) + + def FactTurbulence(statut): @@ -172,7 +210,7 @@ def Particle(cardinalite) : ), ), b_Molecule = BLOC( condition='ParticleNature == "Molecules"', - MoleculeName = SIMP( statut='o', typ=(userParticle,'createObject'),), + MoleculeName = SIMP( statut='o', typ=(userMolecule,'createObject'),), ChemicalSpecie = FACT ( max='**', statut='o', ChemicalSpecieName = SIMP( statut='o', typ=userAtom), Proportion = SIMP( statut='o', typ='R', val_max =1), @@ -189,7 +227,7 @@ def Particle(cardinalite) : DiscreteParticleName = SIMP(statut='o', typ=(userDiscrete,'createObject'),), TypeOfDiscreteParticle = SIMP( statut='o', typ='TXM', into=['Solid', 'Droplets', 'Bubbles','Bio Organism'],), b_TypeDP_Solid = BLOC( condition ='TypeOfDiscreteParticle == "Solid"', - TypeOfSolid = SIMP( statut='o', typ='TXM', into=['Primary Particle', 'Assemblage / Aggregate'], position = 'global_jdc'), + TypeOfSolid = SIMP( statut='o', typ='TXM', into=['Primary Particle', 'Assemblage / Aggregate'], position = 'global'), b_SolidPrimary = BLOC( condition='TypeOfSolid == "Primary Particle"', ), b_SolidAggregate = BLOC( condition='TypeOfSolid == "Assemblage / Aggregate"', @@ -223,8 +261,150 @@ def Particle(cardinalite) : Porosoty = SIMP( statut='f', typ='R'), ), # Morphological ), # b_SolidAggregate + ElectroMagnetic = FACT (statut = 'f', + ElectricCharge = SIMP( statut='o', typ='R'), + MagneticMoment = SIMP( statut='o', typ='R'), + ), + b_SolidAggregateBonded = BLOC( condition='TypeOfSolid == "Assemblage / Aggregate"', + BondedParticles = FACT( + ListOfBondedParticles = SIMP(statut='o', max='**', typ = userParticle), + ), + ), ), # Properties ), # b_Discrete +############################ + + List_Of_Bonded_Particles = FACT( statut='f', + # -------------------------------------------# + Bonded_Particles = FACT( statut='o', max = "**", + Name_Of_Bonded_Particles = SIMP( statut='o', typ='TXM'), + Species_in_Particle = SIMP( statut='o', min=2, typ='TXM' , max = "**"), + ), # Bonded_Particles + ), # List_Of_Bonded_Particles + + List_Of_Interactions = FACT( statut='o', max = "**", + # --------------------------------------------------# + + Bonded_Interactions = FACT( statut='o', max = "**", + + #Type_Of_Bonded_Interaction = SIMP( statut='o', typ='TXM', into=['No', 'Covalent Bond Length', 'FENE', 'Covalent Bond Angle', 'Dihedral Angles', 'Improper Dihedral', 'Frozen Motion' ], defaut='No', position='global'), + Type_Of_Bonded_Interaction = SIMP( statut='o', typ='TXM', into=['No', 'Covalent Bond Length', 'FENE', 'Covalent Bond Angle', 'Dihedral Angles', 'Improper Dihedral', 'Frozen Motion' ], defaut='No'), + + #La saisie de l'ensemble des liaisons d'un meme type peut se faire ds le meme bloc (soit ds un fichier, soit manuelle) + #Une seule valeur de distante? est a saisir pour l'ensemble + # bloc_covalent_1 = BLOC( condition = 'Type_Of_Bonded_Interaction in ("Covalent Bond Length","FENE")', + # ), # fin bloc_covalent_1 + bloc_covalent_length = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Length"', + Interaction_Length_Parameters = FACT( statut='o', max="**", + Apply_To_Bonded_Particles = SIMP( statut='o', max='**', typ='TXM'), + Spring_Stifness = SIMP( statut='o', typ='R', val_min=0), + Mean_Bond_Length = SIMP( statut='o', typ='R', val_min=0), + ), # fin Interation_Length_Parameters + ), # fin Bond_Length_Parameters + bloc_covalent_angle = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Angle"', + Interaction_Angles_Parameters = FACT( statut='o', max="**", + Apply_To_Bonded_Particles = SIMP( statut='o', max='**', typ='TXM'), + Spring_Stifness = SIMP( statut='o', typ='R', val_min=0), + Mean_Bond_Angle = SIMP( statut='o', typ='R', val_min=0), + ), # fin Interation_Angles_Parameters + ), # fin bloc_covalent_length_and_angle + + #bloc_covalent_length_and_angle = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Length" or Type_Of_Bonded_Interaction == "Covalent Bond Angle"', + # Bond_Parameters = FACT( statut='o', max="**", + # Apply_To_Bonded_Particles = SIMP( statut='o', max='**', typ='TXM'), + # Spring_Stifness = SIMP( statut='o', typ='R', val_min=0), + # bloc_covalent_length = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Length"', + # Mean_Bond_Length = SIMP( statut='o', typ='R', val_min=0), + # ), # fin Bond_Length_Parameters + # bloc_covalent_angle = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Angle"', + # Mean_Bond_Angle = SIMP( statut='o', typ='R', val_min=0), + # ), # fin Bond_Length_Parameters + # ), # fin Bond_Length_Parameters + #), # fin bloc_covalent_length_and_angle + + bloc_FENE = BLOC( condition = 'Type_Of_Bonded_Interaction == "FENE"', + Applies_To_All_Particles = SIMP( statut='o', typ=bool, defaut=True), + bloc_not_on_all = BLOC( condition = 'Applies_To_All_Particles == False', + FENE_Parameters = FACT( statut='o', max="**", + Species_Pair = SIMP( statut='o', max=2, typ='TXM'), + Spring_Constant_H = SIMP( statut='o', typ='R', val_min=0), + LMax = SIMP( statut='o', typ='R', val_min=0), + ), # fin FENE_Parameters + ), # fin bloc_not_on_all + bloc_on_all = BLOC( condition = 'Applies_To_All_Particles == True', + Spring_Constant_H = SIMP( statut='o', typ='R', val_min=0), + LMax = SIMP( statut='o', typ='R', val_min=0), + ), # fin bloc_on_all + ), # fin bloc_FENE + + bloc_le_reste = BLOC( condition = 'Type_Of_Bonded_Interaction in ("Dihedral Angles", "Improper Dihedral", "Frozen Motion")', + Particle_Name = SIMP( statut="f", typ='TXM'), + #Consigne = SIMP( statut="o", homo="information", typ="TXM", defaut='Not Implemented Yet'), + + ), + ), # fin Bonded_Interaction + + # ------------------------------- # + + Unbonded_Interactions = FACT( statut='o', max= "**", + + Type_Of_Unbonded_Interaction = SIMP( statut='o', typ='TXM', into=['No', 'electro_magnetic', 'Repulsion_and_VdW', 'Soft_Potentiel', ], defaut='No', position='global',fenetreIhm='menuDeroulant'), + + bloc_elec = BLOC( condition = 'Type_Of_Unbonded_Interaction == "electro_magnetic"', + Permittivity = SIMP( statut='o', typ='R', position='global_jdc'), + Magnetic = SIMP( statut='o', typ=bool, defaut=False,), + bloc_magnetic = BLOC( condition = 'Magnetic == True', + Permability = SIMP( statut='o', typ='R'), + ), # bloc_magnetic + ),# fin bloc_elec + + bloc_VdW = BLOC( condition = 'Type_Of_Unbonded_Interaction == "Repulsion_and_VdW"', + Species_Pair_Parameters = FACT( statut='o', max="**", + Type_Repulsion_and_VdW = SIMP( statut='o', typ='TXM', into = [ 'Lennard_Jones', 'Hard_sphere_model']), + Species_Pair = SIMP( statut='o', max=2, typ='TXM'), + VdW_Radius = SIMP( statut='o', typ='R', val_min=0), + b_Lennard = BLOC( condition = "Type_Repulsion_and_VdW == 'Lennard_Jones'", + Depth_Of_The_Potential_Well = SIMP( statut='o', typ='R', val_min=0), + ), # fin b_Lennard + ), # fin Species_Pair_Parameters + ), # bloc_VdW + + b_Param_Soft_Potentiel = BLOC( condition = "Type_Of_Unbonded_Interaction == 'Soft_Potentiel'", + Groot_Warren_Repulsion = SIMP( statut='o', typ='R', defaut=25.0, val_min=0), + Groot_Warren_Cutoff = SIMP( statut='o', typ='R', defaut=1.0, val_min=0), + Drag_Coefficient = SIMP( statut='o', typ='R'), # les 2 valent 0 pour MD + Drag_Force_Cutoff = SIMP( statut='o', typ='R', val_min=0), + ), # b_Param_Soft_Potentiel + + ), # fin UnBonded_Interactions + + # ------------------------------- # + + External_Field_Interaction = FACT( statut='o', max= "**", + Type_Of_Interaction_With_An_External_Field = SIMP( statut='o', typ='TXM', into=['No','gravitational field','electric field','magnetic field', 'Hydrodynamic_Field'], fenetreIhm='menuDeroulant', defaut ='No'), + b_gravite = BLOC( condition = 'Type_Of_Interaction_With_An_External_Field=="gravitational field"', + G = SIMP( statut='o', typ='R', defaut=9.81), + ), + b_elect = BLOC( condition = 'Type_Of_Interaction_With_An_External_Field=="electric field"', + Electric_Field = champ('E', ('E',), 1), + ), + b_magnetic = BLOC( condition = 'Type_Of_Interaction_With_An_External_Field=="magnetic field"', + Magnetic_Field = champ('B', ('B',), 1), + ), + b_hydrodynamic = BLOC( condition = 'Type_Of_Interaction_With_An_External_Field=="hydrodynamic field"', + Hydrodynamic_Field = champ('U', ('U',), 1), + ), + b_External_Field_Interaction = BLOC( condition = 'Type_Of_Interaction_With_An_External_Field != "No"', + Field_Applies_On_All_Species = SIMP( statut='o', typ=bool, defaut=True), + b_porte_espece = BLOC( condition = 'Field_Applies_On_All_Species == False ', + Species_List = SIMP( statut='o', typ='TXM', max= '**'), # faire un typ = "espece" + ), + ), # fin b_External_Field_Interaction + ), # fin Interaction_External_Field + + ), # fin List_Of_Interactions + +############################ ) def bloc_CPS(): @@ -236,7 +416,7 @@ def bloc_CPS(): def bloc_FluideMacro(): return BLOC(condition = 'SystemType == "Continuum system"', - PhysicalDescription = FACT (statut ='o', + PhysicalDescription = FACT (statut ='o', FluidComplexe = SIMP(typ=bool, statut='o', defaut = False), FlowNature = SIMP(typ='TXM', statut='o', into =['Laminar', 'Turbulent'], position='global'), @@ -406,7 +586,7 @@ Interactions = PROC(nom='Interactions', ), ) dict_condition={'NumericalMethod' : ('Interactions', 'Component'), - 'TypeOfSolid' : ('Component',) +# 'TypeOfSolid' : ('Component',) } Simulated_Time_Lapse = PROC( nom ="Simulated_Time_Lapse", -- 2.39.2