From 5098be79e9809ee5c7118bb0d1f05b23763e6e69 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Thu, 25 Apr 2019 14:42:09 +0200 Subject: [PATCH] Pour test et sauvegarde du Cata --- JP/cata_Du_2504.py | 385 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 385 insertions(+) create mode 100644 JP/cata_Du_2504.py diff --git a/JP/cata_Du_2504.py b/JP/cata_Du_2504.py new file mode 100644 index 00000000..5c9ea512 --- /dev/null +++ b/JP/cata_Du_2504.py @@ -0,0 +1,385 @@ +# coding: utf-8 -*- +# + +import os +import types +monFile=os.path.abspath(__file__) + +# ------------------------------------------------- Definition fonction utilisateur +from Accas import * +class Surface_Elementaire(UserASSD): pass +class StudySD(ASSD) : pass +class Specie(UserASSD) : pass +class Bondedparticle(UserASSD) : pass + +def creeSpecie(MC) : + MC.creeObjetClasse(Specie) + return + +def creeBondedparticle(MC) : + MC.creeObjetClasse(Bondedparticle) + return + +def creeSurfaceElementaire(MC) : + MC.creeObjetClasse(Surface_Elementaire) + return + +# ------------------------------------------------- Definition fonction du catalogue ou macro + +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_FICHIER(condition = 'Format == "txt"', + File = SIMP( statut='o', typ=('File','Text Files(*.txt);All Files (*)'),), + ), + td_med_1 = BLOC_FICHIER( condition = 'Format == "Med"', + File = SIMP( statut='o', typ=('File','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 BlocPourLesFiles(laCondition, NomDuFile, ListeFormats): + SIMPFormatFile = SIMP( statut='o', typ='TXM', into=tuple(ListeFormats) +('others',),) + dicoDesBlocs = {} + for formatFich in ListeFormats : + nomBloc = 'b_File_Format' + str(formatFich) + typeDesFiles = ('File', formatFich + " Files (*." + formatFich + ");;All Files (*)",) + blocCondition = "Format_File == '" + formatFich + "'" + dicoDesBlocs[nomBloc] = BLOC_FICHIER( condition = blocCondition, NomDuFile = SIMP( statut='o', typ=typeDesFiles ),) + dicoDesBlocs['b_File_Format_others'] = BLOC_FICHIER(condition = "Format_File == 'others'", NomDuFile = SIMP( statut='o', typ=('File','All Files (*)'),),) + return BLOC( condition = laCondition, Format_File = SIMPFormatFile, **dicoDesBlocs) + + +# ____________________________________________________________________________________________ # + +JdC = JDC_CATA(code='Vimmp',fichierSource=monFile) + + +Study = OPER(nom = 'Study', sd_prod = StudySD, + Title = SIMP( statut='o', typ='TXM'), + Simulated_Time_Lapse = FACT( statut='o', + Initial_Time = SIMP( statut='o', typ='R'), + Duration = SIMP( statut='o', typ='R'), + ), +# + Geometric_Domain= FACT( statut='o', + Shape = SIMP( statut='o', typ='TXM', into=['Shape Simplifiee', 'CAD or Mesh']), + b_Shape = BLOC( condition = 'Shape == "Shape Simplifiee"', + Box = SIMP( statut='o', typ='TXM', into=['Cube', 'Sphere','Cylinder'] ), + b_Cube = BLOC( condition = 'Box == "Cube"', + #Taille_Box_Englobante = SIMP( statut='o', typ='R', max=3, min =3) + # derait etre un Tuple(3) mais a faire apres la projection + Size_Of_Bounding_Box = SIMP( statut='o', typ=Tuple(3), validators=VerifTypeTuple(('R','R','R'),),) + ), # fin b_Cube + b_Boule = BLOC( condition = 'Box == "Sphere"', + Center = SIMP( statut='o', typ='R', max=3, min =3), + # devrait etre un Tuple(3) mais a faire apres la projection + ),# fin b_Boule + b_Cylinder = BLOC( condition = 'Box == "Cylinder"', + Heigth = SIMP( statut="o", typ='R', val_min=0.0, ang='Nanotube length [m]'), + ),# fin b_Tube + b_Boule_ou_Cylinder = BLOC( condition = 'Box == "Sphere" or Box == "Cylinder"', + Radius = SIMP( statut='o', typ='R', val_min=0.0, ang='radius length [m]') , + ),# fin b_Boule_ouCylinder + ), # fin b_Shape +# + b_CAO = BlocPourLesFiles( "Shape == 'CAD or Mesh'",'Domain_File', ['txt','med','I-deas', 'Gmsh', 'top',]), + + Elementary_Surface=SIMP( statut='o', typ='TXM',max='**', siValide=creeSurfaceElementaire), + ), # fin Geometric_Domain + + +# ----------------------------------------------------------------- System_Component ---------------------------------------------------------------------------# + System_Component= FACT( statut='o', max = "**", + + Component = SIMP( statut='o', typ='TXM', into=['particle', 'Fluid','Solid ',], position='global'), + # Physical_Description = FACT( min=1, max= 2, statut='o', + # PN : je ne comprends pas. cela n a pas de sens ?? + + General_Level_Of_Description = SIMP( statut='o', typ='TXM', into=['Microscopic','Mesoscopic', 'Macroscopic'] ), + + b_particle = BLOC( condition = "Component == 'particle'", + #-----------------------------------------------------# + Physical_Description_particle = FACT( statut='o', + #-----------------------------------------------------# + + List_Of_Species = FACT( statut='o', + # ------------------------------# + Number_Of_Species = SIMP( statut='o', typ='I', defaut=1, position='global_jdc'), + Specie = FACT( statut='o', max ="**", + Name_Of_Specie = SIMP( statut='o', typ='TXM', siValide=creeSpecie), + Mass_Molaire = SIMP( statut='o', typ='R',), + Mass_Fraction = SIMP( statut='f', typ='R',), + b_Electrostatique = BLOC( condition = "Permittivity != None", + Charge = SIMP( statut='o', typ='R'), + ), # fin b_Electrostatic + ), # fin Specie + ), # fin List_Of_Species + + List_Of_Bonded_Particles = FACT( statut='f', + # -------------------------------------------# + Bonded_Particles = FACT( statut='o', max = "**", + Name_Of_Bonded_Particles = SIMP( statut='o', typ='TXM',siValide=creeBondedparticle ), + List_Of_Species = SIMP( statut='o', min=2, typ=Specie , 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'), + + bloc_covalent_1 = BLOC( condition = 'Type_Of_Bonded_Interaction in ("Covalent Bond Length","FENE")', + Name_of_Bonded_Particle = SIMP( statut='o', typ=Bondedparticle), + ), # fin bloc_covalent_1 + + bloc_covalent = BLOC( condition = 'Type_Of_Bonded_Interaction == "Covalent Bond Length"', + Bond_Length_Parameters = FACT( statut='o', max="**", + Species_Pair = SIMP( statut='o', max=2, typ='TXM'), + Spring_Stifness = SIMP( statut='o', typ='R', val_min=0), + Mean_Bond_Average = SIMP( statut='o', typ='R', val_min=0), + ), # fin Bond_Length_Parameters + ), # fin bloc_covalent + + 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 ("Covalent Bond Angle", "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', + + 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'), + 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"', + type_Repulsion_and_VdW = SIMP( statut='o', typ='TXM', into = [ 'Lennard_Jones', 'Hard_sphere_model'], position='global' ), + ), # fin bloc_VdW + + bloc_not_elec = BLOC( condition = 'Type_Of_Unbonded_Interaction not in( "electro_magnetic", "no") ', + Species_Pair_Parameters = FACT( statut='o', max="**", + Species_Pair = SIMP( statut='o', max=2, typ='TXM'), + b_Param_Potential_Type_LJ_1 = BLOC( condition = "Type_Of_Unbonded_Interaction == 'Repulsion_and_VdW'", + Radius = SIMP( statut='o', typ='R', val_min=0), + b_PPal_LJ2 = BLOC( condition = "type_Repulsion_and_VdW == 'Lennard_Jones'", + Depth_Of_The_Potential_Well = SIMP( statut='o', typ='R', val_min=0), + ), # fin b_b_PPal_LJ2 + ), # fin b_Param_Potential_Type_LJ_1 + + 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 + ), # Species_Pair_Parameters + ),# fin bloc_not_elec + + ), #fin UnBonded_Interactions + + # ------------------------------- # + + Interaction_External_Field = FACT( statut='o', + Type_of_External_Field = SIMP( statut='o', typ='TXM', into=['gravitational field','electric field','magnetic field', 'Hydrodynamic_Field']), + 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), + ), + 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 Interaction_External_Field + + ), # fin List_Of_Interactions + + ), # fin Physical_Description_particle + + ), #fin b_particle + #--------------------------------------# + Description = FACT( min=1, max =2, statut='o', + #-------------------------------------# + #EFEFEF : La description choisie donne la liste des modèles numériques disponibles pour cette description + + Description_Type = SIMP( statut='o', typ='TXM', into=['Particle_description', 'Field_description'],), + Type_Of_Entity = SIMP( statut='o', typ='TXM', into=['Electron', 'Atom', 'Grain', 'CVE']), + b_particle = BLOC( condition = 'Description_Type == "Particle_description"', + Particle_Model = FACT( statut='o', max ='**', + Type_Of_Approach = SIMP( statut='o', typ='TXM', into=['Kinetic', 'Extended_Kinetic', 'Position']), + ), # Particle_Model + Definition_Numerical_Model = FACT( statut='o', + Numerical_Model = SIMP( statut='o', typ='TXM', into=['MD', 'DPD'], defaut='DPD',position='global'), + b_DPD_and_MD = BLOC( condition = 'Numerical_Model == "DPD" or Numerical_Model == "MD"' , + Structure_Of_The_Evolution_Law = SIMP( statut='o', typ='TXM', into=['Langevin equations'], defaut='Langevin equations'), + ), # b_DPD_and_MD + ), # Definition_Numerical_Model + ), # b_particle + + ), # Type_Of_Description + #), # Level_Of_Description + + #-----------------------------------------------------# + Statistical_Physics = FACT( statut='f', + #-----------------------------------------------------# + Type_Of_Statistical_Physics = SIMP( statut='f', typ='TXM', into=['Equilibrium', 'Non_Equilibrium']), + + b_Statistical_Physics_Equilibrium = BLOC( condition = "Type_Of_Statistical_Physics == 'Equilibrium'", + Distribution = SIMP( statut='o', typ='TXM', into=['nvt','nve']), + b_Nvt = BLOC( condition = "Distribution == 'nvt'", + Target_Temperature = SIMP( statut='o', typ='R') + ), # fin b_nvt + + b_nve = BLOC( condition = "Distribution == 'nve'", + Target_Energie = SIMP( statut='o', typ='R') + ), # fin b_nve + ), # b_Physique_statstique_equilibre + + b_Statistical_Physics_Equilibrium_false = BLOC( condition = "Type_Of_Statistical_Physics == 'Non_Equilibrium'", + Temperature = SIMP( statut='o', typ='R') + ), # b_Physique_statstique_equilibre + + ), # fin Statistical_Physics + + + #-----------------------------------------------------# + Boundary_Conditions = FACT( statut='o',max = '**', # max = nb de facette de bord + #-----------------------------------------------------# + Type_Of_Boundary_Condition = SIMP( statut='o', typ='TXM', into=['Inlet', 'Outlet', 'Symmetry','Periodic', 'Wall'], position='global'), + Applies_To_The_Complete_State_Vector = SIMP( statut='o', typ=bool), + Boundary_Face = SIMP( statut='o', typ='TXM',), + b_periodique = BLOC( condition = "Type_Of_Boundary_Condition == 'Periodic'", + Direction = SIMP( statut='o', typ='TXM', into=['X','Y','Z', 'all']), + ), # b_periodique + b_Variable_CL = BLOC( condition = "Applies_To_The_Complete_State_Vector == False ", + Variable_of_State_Vector = SIMP( statut='o', typ='TXM'), + ), # b_Variable + ), # Boundary_Conditions + #-----------------------------------------------------# + Initials_Conditions = FACT( statut='o', # 1 par valeur du vecteur d etat + #-----------------------------------------------------# + Applies_To_The_Complete_State_Vector = SIMP( statut='o', typ=bool), + b_Variable_CI = BLOC( condition = "Applies_To_The_Complete_State_Vector == False ", + Initial_Condition_For_Each_Variable = FACT( max = "**", statut='o', + State_Vector_Variable = SIMP( statut='o', typ='TXM'), + Type_Initials_Conditions = SIMP( statut='o', typ='TXM', into=['Initial distribution of the state vector', 'Initial values of the state vector variables'], position='global'), + b_distrib = BLOC( condition = "Type_Initials_Conditions == 'Initial distribution of the state vector'", + State_Vector_Initial_Distribution = SIMP( statut='o', typ='TXM', into=['MaxWell', 'Uniform', 'Auto']), + Injection_Subdomain = SIMP( statut='f', typ='TXM'), + ),# b_distrib + b_initials = BLOC( condition = "Type_Initials_Conditions == 'Initial values of the state vector variables'", + File_Vecteur_Etat_Initial = SIMP( statut='o', typ=('File','All Files (*)'),), + Format_File_Vecteur_Etat_Initial = SIMP( statut='o', typ='TXM', into=['txt', 'a definir avec Eric']), + ),# b_initials + ),# Initial_Condition_For_Each_Variable + ), # b_Variable + b_Globale = BLOC( condition = "Applies_To_The_Complete_State_Vector == True ", + Initial_Condition = FACT( statut='o', + Type_Initials_Conditions = SIMP( statut='o', typ='TXM', into=['Initial distribution of the state vector', 'Initial values of the state vector variables'], position='global'), + b_distrib = BLOC( condition = "Type_Initials_Conditions == 'Initial distribution of the state vector'", + State_Vector_Initial_Distribution = SIMP( statut='o', typ='TXM', into=['MaxWell', 'Uniform', 'Auto']), + Injection_Subdomain = SIMP( statut='f', typ='TXM'), + ),# b_distrib + b_initials = BLOC( condition = "Type_Initials_Conditions == 'Initial values of the state vector variables'", + File_Vecteur_Etat_Initial= SIMP( statut='o', typ=('File','All Files (*)'),), + Format_File_Vecteur_Etat_Initial = SIMP( statut='o', typ='TXM', into=['txt', 'a definir avec Eric']), + ),# b_initials + ),# Initial_Condition_For_Each_Variable + ), # b_Globale + ), # Initials_Conditions +) # Study + +Run_Option = PROC( nom='Run_Option', + MyStudy = SIMP( statut='o', typ=StudySD ), + Working_Dir = SIMP( statut='f', typ='TXM'), # + Number_Of_Time = SIMP( statut='o', typ='I'), + )# Run_Option + + +# a refaire en reprenant + + # # lennard_jones si MD et groot_warren DPD + # b_MD = BLOC( condition = 'Numerical_Model == "MD"', + # Potential_Type_MD = SIMP( statut='o', typ='TXM', into=['lennard_jones'], defaut='lennard_jones'), + # ), + # b_DPD = BLOC( condition = 'Numerical_Model == "DPD"', + # Potential_Type_DPD = SIMP( statut='o', typ='TXM', into=['groot_warren'], defaut='groot_warren'), + # ), + # b_DPD_and_MD_2 = BLOC( condition = 'Numerical_Model == "DPD" or Numerical_Model == "MD"' , + # Species_Pair_Parameters = FACT( statut='o', max="**", + # Pair_Interaction = SIMP( statut='o', max=2, typ='TXM'), + # b_Parameters_Potential_Type_Groot_Warren = BLOC( condition = "Numerical_Model == 'DPD'", + # 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), + # ), # b_parameters_potential_type_groot_warren + # b_Parameters_Potential_Type_Lennard_Jones = BLOC( condition = "Numerical_Model == 'MD'", + # Radius = SIMP( statut='o', typ='R', val_min=0), + # Depth_Of_The_Potential_Well = SIMP( statut='o', typ='R', val_min=0), + # ), # b_parameters_potential_type_groot_warren + # ), # species_pair_parameters + # ),# fin b_DPD_and_MD_2 + # b_DPD_Coef = BLOC( condition = 'Numerical_Model == "DPD"' , + # Drag_Coefficient = SIMP( statut='o', typ='R'), # les 2 valent 0 pour MD + # Drag_Force_Cutoff = SIMP( statut='o', typ='R', val_min=0,), + # ), + -- 2.39.2