From: pascale.noyret Date: Mon, 30 Nov 2020 13:48:08 +0000 (+0100) Subject: chgt bloc thermalEffect X-Git-Tag: V210224_osthus~84^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a49ed0daecefcfb4d2b9f33b7ce033357fbbaa13;p=tools%2Feficas.git chgt bloc thermalEffect --- diff --git a/Vimmp/cata_CSAndCPS_v5.py b/Vimmp/cata_CSAndCPS_v5.py new file mode 100644 index 00000000..65fbf727 --- /dev/null +++ b/Vimmp/cata_CSAndCPS_v5.py @@ -0,0 +1,742 @@ +from Accas import * + +class composant(ASSD):pass +class mapper(ASSD):pass +class converter(mapper):pass +class modeleNumDuCompo(UserASSD):pass +class especeChimique(UserASSD):pass +class userParticle(UserASSD) :pass +class userAtom(userParticle) :pass +class userMolecule(userParticle) :pass +class userDiscrete(userParticle) :pass +class userDPD(userParticle) :pass + +class spatialRegion(UserASSD):pass +class cadShape(spatialRegion):pass +#class meshGroup(spatialRegion,UserASSDMultiple):pass +class meshGroup(spatialRegion):pass +class meshIdentifier(spatialRegion):pass +class systemGeometry(UserASSD):pass +class simulatedTime(UserASSD):pass + +class scalar(UserASSD):pass + + +#dictSystemTypeModeleNumerique = { 'Quantum system' : (), +# 'Classical particle system' : ('MD', 'DPD', 'LBM', 'SDPD','SPH','CFD_Discrete_Particles'), +# 'Continuum system' :('Fluid_Fields','Fluid_Particles', 'SPH','Lagrangian one-particle pdf'), +# } +# + +# PN a faire --> ajouter un MC modeleNumerique ( apres avoir renomme le modeleNumerique actuel en classe de modele numerique) et le dictionnaire d apres +dictTypModNumModNum = { + ('Continuum system','Particles') : ('SPH','Lagrangian one-fluid-particle pdf'), + ('Continuum system','Fields') : ('FV','FEM', 'Spectral method'), + ('Classical particle system','Particles') : ('MD', 'DPD', 'SDPD','SPH','CFD_Discrete_Particles'), + ('Classical particle system','Fields') : ('LBM',), + ('Quantum system','Particles') : ('Particle method',), + ('Quantum system','Fields') : ('Wave',), +} + +dictCodeModeleNumerique = { + + 'Code_Saturne' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'Fluent' : ('FV',), + 'Culgi Package': (), + 'DEM_SD' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'DFTB+' : ('density functional tight binding method',), + 'DL_MESO_DPD' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'DL_MESO_LBE' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'DL_POLY_4' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'GROMACS' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'GROMACS_LS' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'LAMMPS' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'NWChem' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'OpenFOAM' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',), + 'Quantum EXPRESSO' : ('Particle method', 'Wave',), + 'RHEO_AGGRATE' : ('Particle method', 'Wave',), + 'RHEO_DROP' : ('Particle method', 'Wave',), + 'STAR_CCM+' : ('FV', 'Particles',), + 'Code Nill' : ('Spectral method', ), +} + +dictCodeFormat = { + 'Code_Saturne' : ('Med', 'cgns', 'msh', 'des', 'unv', ), + 'Culgi Package': ('cof',), + 'DEM_SD' : ('geo', 'ascii'), + 'DFTB+' : ('geo', 'ascii'), + 'Fluent' : ('FluentFormat', ), + 'OpenFOAM' : ('OpenFoamFormat', 'Med', ), +} + +dictMapperFormat = { + 'Med Coupling' : ('Med',), + 'Gmsh' : ('Med', 'OpenFoamFormat'), +} + +dictTermeLE = { + ('Fields','Particles') : ('Fluid_Velocity_Field', + 'Fluid_Temperature_Field', + 'Fluid_Species_Mass_Fraction_Fluid',), + ('Particles','Fields') : ('Fluid_Particle_Momentum_Exchange_Field', + 'Fluid_Particle_Thermal_Exchange_Field', + 'Lagrangian one-particle pdfFluid_Particle_Mass_Source_Field', + 'Particle_Volumetric_Concentration_Modified_Fluid_Viscosity', + 'Particle_Extra_Stress_Tensor'), + ('Particles','Particles') : ('Pas encore fait'), + ('Fields','Fields') : ('Pas encore fait'), +} + +dictCodeConvertisseur = { + ('Saturne', 'OpenFOAM') : ('gmsh', 'Saturne2CDM and CDM2OpenFoam'), + ('Saturne', 'Fluent') : ( 'Saturne2CDM and CDM2Fluent'), + ('Fluent', 'OpenFOAM') : ('Fluent2CDM and CDM2OpenFoam'), + } + + +def prepareBlocSystemType(systemType) : + condition = "SystemType == '" + systemType + "'" + Identifier = SIMP(statut='o', typ=(modeleNumDuCompo,'createObject'),) + SimulatedTimeLapse = SIMP (statut ='o', typ = simulatedTime) + ModelType = SIMP(statut='o', typ='TXM', into = ('Particles', 'Fields'), position='inGetAttribut') + dicoArgs={} + + for typeMod in ('Particles', 'Fields'): + conditionType = "ModelType == '" + typeMod + "'" + NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod], + position='global', intoXML=allValueInDict(dictTypModNumModNum)) + dicoBloc = {} + for modeleNumerique in list(dictTypModNumModNum[systemType,typeMod]): + conditionNum = "NumericalMethod == '" + modeleNumerique + "'" + setCode = set() + for code in dictCodeModeleNumerique.keys(): + if modeleNumerique in dictCodeModeleNumerique[code]: setCode.add(code) + Solver = SIMP(statut='o', typ='TXM', into=list(setCode), intoXML=list(dictCodeModeleNumerique.keys()) ) + monNomBloc='b_ModelName_' + modeleNumerique.replace(' ','_') + if setCode !=set(): dicoBloc[monNomBloc]=BLOC(condition=conditionNum, nomXML='b_ModelName',Solver=Solver) + dicoArgs['b_modelType'+typeMod] = BLOC(condition=conditionType, NumericalMethod=NumericalMethod,**dicoBloc) + + blocMeshRef = BLOC(condition = '(ModelType == "Fields") and (NumericalMethod == "FV")', + #blocMeshRef = BLOC(condition = 'NumericalMethod == "FV"', + Mesh_Identifiers = SIMP (statut ='o', max ='**', typ = meshIdentifier),) + dicoArgs['blocMeshRef'] = blocMeshRef + NumericalModel = FACT(statut='o', max= '**', Identifier=Identifier, ModelType=ModelType, + SimulatedTimeLapse=SimulatedTimeLapse, **dicoArgs) + return BLOC(condition=condition, nomXML='b_systemType', NumericalModel=NumericalModel) + +def calculCommun( key1, key2, dico): + monSet=set() + if not key1 in dico: return () + if not key2 in dico: return () + for val in dico[key1]: + if val in dico[key2]: + monSet.add(val) + if monSet == set() : monSet.add ('No common format') + return list(monSet) + +def allValueInDict( dico): + monSet=set() + for clef in dico : + for val in dico[clef] : monSet.add(val) + return monSet + +def creeBlocPourLesFichiers (laCondition, NomDuFichier, ListeFormats): + SIMPFormatFichier = SIMP(statut='o', typ = 'TXM', into = tuple(ListeFormats) + ('others',), ) + dicoDesBlocs = {} + for formatFich in ListeFormats : + nomBloc = 'b_format_fichier' + str(formatFich) + typeDesFichiers = ('Fichier', formatFich + " Files (*." + formatFich + ");;All Files (*)",) + blocCondition ="FileFormat == '" + formatFich + "'" + dicoDesBlocs[nomBloc] = BLOC( condition = blocCondition, FileName = SIMP(statut='o', typ = typeDesFichiers ),) + 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, ajout=None): + listInto = ['No Model (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, ), + bloc_one_point = BLOC(condition= "TurbulenceModellingType == 'One-point moment'", + RANSModel = SIMP(statut="o", typ="TXM", into=['Turbulent-Viscosity Model(TVM)', 'Reynolds Stress Model (RSM)']), + bloc_TVM = BLOC(condition= "RANSModel == 'Turbulent-Viscosity Model(TVM)'", + TVMChoice = SIMP(typ='TXM', statut='o', into=['k-epsilon', 'k-omega']), + ), # fin bloc_TVM + bloc_RSM = BLOC(condition = "RANSModel == 'Reynolds Stress Model (RSM)'", + RSMChoice = SIMP(typ='TXM', statut='o', into=['Rotta', 'LRR-IP','LRR-QI','SSG']), + ), # fin bloc_RSM + ), # fin bloc_one_point + bloc_one_spatial = BLOC(condition = "TurbulenceModellingType == 'Spatial filtering (LES)'", + ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['Field-based LES', 'Filtered Density Function (FDF)']), + SubgridScaleModel = SIMP(typ='TXM', statut='o', into=['No SGS', 'Smagorinsky','Dynamical model', 'SGS Transport Equations']), + ), # fin bloc_one_spatial + bloc_one_point_pdf = BLOC(condition = "TurbulenceModellingType == 'One-point PDF'", + ChoiceOfApproach = SIMP(typ='TXM', statut='o', into=['One-point Eulerian PDF', 'One-particle Lagrangian PDF']), + bloc_lagrangian_pdf=BLOC(condition = "ChoiceOfApproach == 'One-particle Lagrangian PDF'", + StochasticModel = SIMP(typ='TXM', statut='o', into=['Langevin','Other'], defaut='Langevin'), + )# fin lagrangian + ), # fin bloc_one_point_pdf + bloc_no_model = BLOC(condition = "TurbulenceModellingType == 'No Model (DNS)'", + ChoiceOfApproach = SIMP(statut='o', typ='TXM', into=['Field-based DNS', 'N-Particle Method']), + bloc_Field = BLOC(condition = "ChoiceOfApproach == 'Field-based DNS'", + NumericalMethod=SIMP(statut='o', typ='TXM', into=['FV', 'Spectral Method']), + ),# fin bloc_Field + bloc_N_particle = BLOC(condition = "ChoiceOfApproach == 'N-Particle Method'", + NumericalMethod=SIMP(statut='o', typ='TXM', into=['SPH', 'Vortex Method']), + ),# fin bloc_N_particle + ), # fin bloc_no_model +)# fin du bloc return de la fonction factTurbulence + +def Particle(cardinalite) : + return FACT (statut='o', max=cardinalite, + ParticleNature = SIMP( statut='o', typ='TXM', into=['Atoms', 'Molecules', 'Dissipative', 'Fluid Particle', 'Discrete Particle']), + b_Atom = BLOC( condition='ParticleNature == "Atoms"', + AtomsName = SIMP( statut='o', typ=(userAtom,'createObject'),), + Atom = FACT (statut ='o', max= '**', + ChemicalSpecie = SIMP( statut='o', typ='TXM'), + Number = SIMP (statut ='o', typ = 'I'), + ElectricCharge = SIMP( statut='o', typ='R'), + MagneticMoment = SIMP( statut='o', typ='R'), + Size = SIMP( statut='f', typ='R'), # relevant ? + ), + ), + b_Molecule = BLOC( condition='ParticleNature == "Molecules"', + 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), + ), + ElectricCharge = SIMP( statut='o', typ='R'), + MagneticMoment = SIMP( statut='o', typ='R'), + Shape = SIMP( statut='f', typ='TXM', into=['Linear', 'Trigonal Planar', 'Angular', 'Tetrahedral', 'Octahedral', 'Trigonal pyramid', 'Other']), + ), + b_Dissipative = BLOC( condition='ParticleNature == "Dissipative"', + DPDName = SIMP( statut='o', typ=(userDPD,'createObject'),), + BondedParticles = SIMP(statut="o", typ=bool, defaut=False), + ), + b_Discrete = BLOC( condition='ParticleNature == "Discrete Particle"', + 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'), + b_SolidPrimary = BLOC( condition='TypeOfSolid == "Primary Particle"', + ), + b_SolidAggregate = BLOC( condition='TypeOfSolid == "Assemblage / Aggregate"', + ), + ), + b_TypeBio_Solid = BLOC( condition='TypeOfDiscreteParticle == "Bio Organism"', + TypeOfOrganism = SIMP( statut='o', typ='TXM', into=['Unicellular', 'Multicellular']), + b_Unicellular = BLOC( condition ='TypeOfOrganism=="Unicellular"', + Unicellular = SIMP( statut='o', typ='TXM', into=["Bactaria"], defaut='Bactaria') + ), + b_Multicellular = BLOC( condition ='TypeOfOrganism=="Multicellular"', + Multicellular = SIMP( statut='o', typ='TXM', into=["Animal","Fongus","Plant"]) + ), + ), # b_TypeBio_Solid + Properties = FACT ( statut ='o', + Geometry = SIMP( statut='o', typ='TXM', into=['Sphere', 'Ellopsoids', 'Other Shape']), + b_geom_Sphere = BLOC( condition = 'Geometry == "Sphere"', + ParticleRadius = SIMP( statut='o', typ ='R', val_min = 0), + ), + Weight = FACT (statut = 'o', + Mass = SIMP( statut='o', typ ='R', val_min = 0), + Density = SIMP( statut='o', typ ='R', val_min = 0), + ), + Mechanical = SIMP( statut='o', typ='TXM', into=['Rigid', 'Flexible', 'Deformable']), + b_SolidAggregate = BLOC( condition='TypeOfSolid == "Assemblage / Aggregate"', + Morphological = FACT (statut = 'o', + Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut='Choose optional properties'), + FractalDimension = SIMP( statut='f', typ='R'), + NumberOfPrimaryParticle = SIMP (statut ='f',typ='I'), + EquivalentSize = SIMP( statut='f', typ='R'), + 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(): + return BLOC(condition = 'SystemType == "Classical particle system"', + Particle = Particle('**'), +) + +def bloc_FluideMacro(): + return BLOC(condition = 'SystemType == "Continuum system"', + FluidComplexe = SIMP(typ=bool, statut='o', defaut = False,), + + 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 + +# ---------------------- Effets thermiques + + Thermal = FACT (statut ='o', + ThermalEffects = SIMP(typ='TXM', statut='o', into =['Non thermal', + 'Passive on flow dynamics', 'Active on flow dynamics'], defaut='Non thermal'), + + bloc_NonThermalEffects = BLOC(condition = ' ThermalEffects == "Non thermal"', + InitialTemperature = SIMP(typ='R', statut='o', val_min=-273.15 ), + ), # fin bloc_NonThermal + + bloc_ThermalEffects_Passive = BLOC(condition =' ThermalEffects == "Passive on flow dynamics"', + ThermalFluxModel = FACT('o', + NatureOfThermalFluxModel = SIMP( statut='o', into =['Given', 'Simulated'], typ ='TXM'), + BlocGiven =creeBlocPourLesFichiers (' NatureOfThermalFluxModel == "Given"', None, ('Med', 'cgns' ), + ), + ), + ), # fin bloc_ThermalEffects_Passive + + bloc_ThermalEffects_Active = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', + ), # fin bloc_ThermalEffects_Active + + 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 + + + bloc_ThermalEffects = BLOC(condition = ' ThermalEffects == "Active on flow dynamics" or ThermalEffects == "Passive on flow dynamics"', + bloc_scalar_thermal_flux = BLOC (condition = "FlowNature == 'Turbulent'", + ThermalFluxModel = FactTurbulence('f'), + ),# fin bloc_scalar_thermal_flux + WithChemicalReactions = SIMP(typ=bool, statut ='o', defaut = False), + ), # fin bloc_ThermalEffects + ),# fin Fact Thermal + +# ---------------------- Effets thermiques + +# Thermal = FACT (statut ='o', +# ThermalEffects = SIMP(typ='TXM', statut='o', into =['Non thermal', +# 'Passive on flow dynamics', 'Active on flow dynamics'], defaut='Non thermal'), +# +# bloc_NonThermalEffects = BLOC(condition = ' ThermalEffects == "Non thermal" or ThermalEffects == "Passive on flow dynamics"', +# InitialTemperature = SIMP(typ='R', statut='o', val_min=-273.15 ), +# ), # fin bloc_NonThermal +# +# 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 +# +# bloc_ThermalEffects_Active = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"', +# DensityEquationOfState = SIMP(typ='TXM', statut='o', into =['Variable density', 'Compressible']), +## PNJPM est ce suffisant ? +# ), # fin bloc_ThermalEffects_Active +# +# bloc_ThermalEffects = BLOC(condition = ' ThermalEffects == "Active on flow dynamics" or ThermalEffects == "Passive on flow dynamics"', +# bloc_scalar_thermal_flux = BLOC (condition = "FlowNature == 'Turbulent'", +# ThermalFluxModel = FactTurbulence('f'), +# ),# fin bloc_scalar_thermal_flux +# WithChemicalReactions = SIMP(typ=bool, statut ='o', defaut = False), +# ), # fin bloc_ThermalEffects +# ),# fin Fact Thermal + +# ---------------------- Scalaire additional + bloc_scalar_FluidTurbulentOrLaminar = BLOC(condition = "(FluidComplexe == False and FlowNature == 'Turbulent') or (FluidComplexe == 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 + ),# 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 + ),# Scalar + ),# AdditionalScalars + ), # fin FluidTurbulentandNonComplexe + #bloc_scalar_FluidLaminaireandNonComplexe = BLOC (condition = "FluidComplexe == False and FlowNature == 'Laminar'", + # AdditionalScalars = FACT (statut = 'o', + # Scalar = FACT ( statut = 'f', max ='**', + # Name = SIMP(typ='TXM', statut='o',), + # ),# Scalar + # ),# AdditionalScalars + #), # fin FluidLaminaireandNonComplexe + # il faut une validation de coherence entre l existence de tous les turbulencesModelling + )# fin bloc_FluideMacro + +JdC = JDC_CATA ( + code = 'Vimmp', + # faire un validateur qui verifie que si on active reactions chimiques il faut que les masses molaires soient rentrees +) + +Component = OPER(nom='Component', sd_prod=composant, + SystemType = SIMP(typ='TXM', into=['Quantum system', 'Classical particle system', 'Continuum system'], statut='o',position='global'), + PhysicalDescription = FACT(statut = 'o', + b_FluideMacro = bloc_FluideMacro(), + b_bloc_CPS = bloc_CPS(), + ), + b_ModeleNumerique_quantum = prepareBlocSystemType('Quantum system'), + b_ModeleNumerique_classical = prepareBlocSystemType('Classical particle system'), + b_ModeleNumerique_continuum = prepareBlocSystemType('Continuum system'), +) + +Species = PROC(nom='Species', + Specie = FACT( statut='o', max ="**", + Name = SIMP( statut='o', typ=(especeChimique,'createObject') ), + masse_molaire = SIMP( statut='f', typ='R',), + ) +) + +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 TousSelonLeTypeDeFormatDisponible(condition, labelName='fileName'): + 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, 'FileName', calculCommun(Solv1, Solv2,dictCodeFormat)) + # dicoArgs['monBlocFichier'+str(index)]=monBlocFichier + # index=index+1 + mesFormats=set() + for solv1 in dictCodeFormat.keys() : + for f in dictCodeFormat[solv1] : mesFormats.add(f) + conditionSolv='transferType == "File"' + BlocFichier=creeBlocPourLesFichiers (conditionSolv, labelName, mesFormats) + dicoArgs['BlocFichier']=BlocFichier + monBlocChamp = BLOC(condition = "transferType=='File'", FieldName=SIMP(typ='TXM', statut='o')) + dicoArgs['monBlocChamp']=monBlocChamp + return BLOC(condition = condition,transferType=transferType, **dicoArgs) + +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, 'FileName', calculCommun(Solv1, Solv2,dictCodeFormat)) + dicoArgs['monBlocFichier'+str(index)]=monBlocFichier + index=index+1 + monBlocChamp = BLOC(condition = "transferType=='File'", FieldName=SIMP(typ='TXM', statut='o')) + dicoArgs['monBlocChamp']=monBlocChamp + return BLOC(condition = condition,transferType=transferType, **dicoArgs) + +Mapper = OPER (nom= 'Mapper',sd_prod=mapper, + Solver=SIMP(statut='o', typ='TXM', into = list(dictMapperFormat.keys())), + ) +Converter = OPER (nom= 'Converter',sd_prod=converter) + +Interactions = PROC(nom='Interactions', + Interaction = FACT( max = '**', + origine = SIMP(typ=modeleNumDuCompo, statut='o'), + destination = SIMP(typ=modeleNumDuCompo, statut='o'), + monBloc_FFFF = BLOC ( + condition = 'getEficasAttribut(origine,"ModelType") == "Fields" and getEficasAttribut(destination,"ModelType") == "Fields"' , + termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Fields','Fields'],fenetreIhm='menuDeroulant'), + ), + monBloc_DPDP = BLOC ( + condition = 'getEficasAttribut(origine,"ModelType") == "Particles" and getEficasAttribut(destination,"ModelType") == "Particles"' , + termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Particles','Particles'],fenetreIhm='menuDeroulant'), + ), + monBloc_FFDP = BLOC ( + condition = 'getEficasAttribut(origine,"ModelType") == "Fields" and getEficasAttribut(destination,"ModelType") == "Particles"' , + termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Fields','Particles'],fenetreIhm='menuDeroulant'), + ), + monBloc_DPFF = BLOC ( + condition = 'getEficasAttribut(origine,"ModelType") == "Particles" and getEficasAttribut(destination,"ModelType") == "Fields"' , + termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Particles','Fields'],fenetreIhm='menuDeroulant'), + ), + couplingPart = FACT( statut='o', + couplingMode = SIMP(typ='TXM', statut='o', into =['direct', 'scaling', 'conversion']), + monBlocDirect = TousSelonLeTypeDeFormatDisponible( "couplingMode=='direct'" ), + monBlocIn = BLOC ( condition = "couplingMode=='scaling' or couplingMode=='conversion'", + OutFromComponent = FACT( statut='o', + monBlocFormat = TousSelonLeTypeDeFormatDisponible( "1", labelName = 'outFromMapperFileName' ), + ), + ), + monBlocMapper = BLOC ( condition = "couplingMode=='scaling' or couplingMode=='conversion'", + ConversionNode = FACT( min=1, max='**', statut ='o', + tool = SIMP(typ=mapper, statut ='o'), + OutFromMapper = FACT (statut ='o', + monBlocFormat = TousSelonLeTypeDeFormatDisponible( "1", labelName = 'outFromMapperFileName' ), + ), + ), + ), + ), + monBlocUseConverter = BLOC ( condition = "couplingMode=='use converter'", + myConverter = SIMP(typ=converter, statut ='o') + ), + ), +) + +dict_condition={ +'ModelType' : ('Interactions', 'Component'), +#'NumericalMethod' : ('Interactions', 'Component'), +# 'TypeOfSolid' : ('Component',) +} + +Temporal_Aspects = PROC( nom ="Temporal_Aspects", + Simulated_Time_Laps = FACT (statut='o', max='**', + name = SIMP(statut='o', typ=(simulatedTime,'createObject'),), + initialTime = SIMP( statut='o', typ='R'), + finalTime = SIMP( statut='o', typ='R'), + timeDiscretization = SIMP( statut ='o', typ = 'TXM', into = ['Constant Time Step', 'Varying Time Step']), + bloc_Constant = BLOC (condition = 'timeDiscretization == "Constant Time Step"', + constantTimeStep = SIMP (statut ='o', typ = 'R'), + ), + bloc_Varying = BLOC (condition = 'timeDiscretization == "Varying Time Step"', + CFLNumberCriteria = SIMP (statut ='o', typ = 'R'), + FourierNumberCriteria = SIMP (statut ='o', typ = 'R'), + ), + ), +) +# +Spatial_Aspects = PROC( nom='Spatial_Aspects', + System_Geometry = FACT ( statut='o', max='**', + System_Geometry_name = SIMP( statut='o', typ=(systemGeometry, 'createObject'),), + Shape = FACT (statut ='f', max='**', + Shape_Nature = SIMP( statut='o', typ='TXM', into=['Typical Geometry', 'CAD']), + b_Shape = BLOC( condition = 'Shape_Nature == "Typical Geometry"', + 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'),),) + Size_Of_Bounding_Box = SIMP( statut='o', typ='R', max=3, min=3, ), + ), # fin b_Cube + b_Boule = BLOC( condition = 'Box == "Sphere"', + Center = SIMP( statut='o', typ='R', max=3, min =3), + ),# 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 = creeBlocPourLesFichiers( "Shape_Nature == 'CAD'",'Domain_File', ['txt','I-deas', 'Gmsh', 'top',]), + ShapeIdentifier=SIMP( statut='o', typ=(cadShape,'createObject'),max='**',), + ), # fin Shape + ),# System_Geometry + Spatial_Discretization = FACT ( statut='f', max="**", + Mesh_Name = SIMP( statut='o', typ=(meshIdentifier,'createObject')), + b_Mesh = creeBlocPourLesFichiers( "1 == 1",'Domain_File', ['med', 'Gmsh',]), + GroupIdentifier = SIMP( statut='o', typ=(meshGroup,'createObject'),max='**',), + ), + Boundary_Constraints = FACT (statut = 'f', + Motion = FACT ( statut='f', + Motion_Nature = SIMP(statut='o', typ='TXM', into=['Fixed boudary', 'Translational motion', 'Rotational motion', 'Scaling']), + b_Translational_motion=BLOC(condition = 'Motion_Nature == "Translational motion"', + Translation_Velocity=SIMP( statut='o', typ='R'), + boundaries=SIMP( statut='o', typ=spatialRegion,max='**' ), + ), + b_Rotational_motion=BLOC(condition = 'Motion_Nature == "Rotational motion"', + Rotation_Rate=SIMP( statut='o', typ='R'), + boundaries=SIMP( statut='o', typ=spatialRegion,max='**' ), + ), + b_fixed=BLOC(condition = 'Motion_Nature == "Fixed boudary"', + boundaries=SIMP( statut='o', typ=spatialRegion,max='**', homo='SansOrdreNiDoublon'), + #boundaries=SIMP( statut='o', typ=spatialRegion,max='**' ), + ), + ), +#PN decrire page 28 + Mapping = FACT ( statut='f', + ), + ), # Boundary_Constraints +) # fin Geometric_Domain + + + +