class dynamicVariable(boundaryObject):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
+# 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'),
}
dictCodeModeleNumerique = {
-
'Code_Saturne' : ('Lagrangian one-fluid-particle pdf', 'FV', 'CFD_Discrete_Particles',),
'Fluent' : ('FV',),
'Culgi Package': (),
dictCodeFormat = {
'Code_Saturne' : ('Med', 'cgns', 'msh', 'des', 'unv', ),
'Culgi Package': ('cof',),
- 'DEM_SD' : ('geo', 'ascii'),
- 'DFTB+' : ('geo', 'ascii'),
- 'Fluent' : ('FluentFormat', ),
- 'OpenFOAM' : ('OpenFoamFormat', 'Med', ),
+ 'DEM_SD' : ('geo', 'ascii'),
+ 'DFTB+' : ('geo', 'ascii'),
+ 'Fluent' : ('FluentFormat', ),
+ 'OpenFOAM' : ('OpenFoamFormat', 'Med', ),
}
dictMapperFormat = {
'Med Coupling' : ('Med',),
- 'Gmsh' : ('Med', 'OpenFoamFormat'),
+ 'Gmsh' : ('Med', 'OpenFoamFormat'),
}
dictTermeLE = {
('Saturne', 'OpenFOAM') : ('gmsh', 'Saturne2CDM and CDM2OpenFoam'),
('Saturne', 'Fluent') : ( 'Saturne2CDM and CDM2Fluent'),
('Fluent', 'OpenFOAM') : ('Fluent2CDM and CDM2OpenFoam'),
- }
+}
dictVariableDynamique = {
- 'K-Epsilon' : ('pression', 'vitesse moyenne', 'K', 'epsilon'),
- }
+ 'K-Epsilon' : ('K', 'epsilon'),
+}
+#----------------------------------------
def prepareBlocSystemType(systemType) :
+#----------------------------------------
condition = "SystemType == '" + systemType + "'"
Identifier = SIMP(statut='o', typ=(modeleNumDuCompo,'createObject'),)
- SimulatedTimeLapse = SIMP (statut ='o', typ = simulatedTime)
+ 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 + "'"
+ conditionType = "ModelType == '" + typeMod + "'"
NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod],
position='global', intoXML=allValueInDict(dictTypModNumModNum))
dicoBloc = {}
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):
+#-----------------------------------
+def calculCommun(key1, key2, dico):
+#-----------------------------------
+# retourne la liste des valeurs communes a dico[key1] et dico[key2]
monSet=set()
if not key1 in dico: return ()
if not key2 in dico: return ()
if monSet == set() : monSet.add ('No common format')
return list(monSet)
-def allValueInDict( dico):
+#-------------------------
+def allValueInDict(dico):
+#-------------------------
+# retourne la liste de toutes les valeurs possible dans dico
monSet=set()
for clef in dico :
for val in dico[clef] : monSet.add(val)
return monSet
-def creeBlocPourLesFichiers (laCondition, NomDuFichier, ListeFormats, FieldName=False):
+#------------------------------------------------------------------------------------
+def creeBlocPourLesFichiers(laCondition, NomDuFichier, ListeFormats, FieldName=False):
+#-------------------------------------------------------------------------------------
SIMPFormatFichier = SIMP(statut='o', typ = 'TXM', into = tuple(ListeFormats) + ('others',), )
dicoDesBlocs = {}
for formatFich in ListeFormats :
if FieldName:
SIMPFieldName = SIMP(statut='o', typ = 'TXM',)
return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs, FieldName=SIMPFieldName)
- #return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs)
else :
return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs)
+#------------------------------------------------------------------------------------
+def creeBlocPourLesFichiers2(laCondition, NomDuFichier='FileName', ListeFormats=[], FieldName=False):
+#-------------------------------------------------------------------------------------
+# il faut reflechir pour parametrer NomDuFichier
+# et le type (existing... du fichier)
+# et utiliser le creeBlocPourLesFichiers2
+ SIMPFormatFichier = SIMP(statut='o', typ = 'TXM', into = tuple(ListeFormats) + ('others',), )
+ dicoDesBlocs = {}
+ for formatFich in ListeFormats :
+ dicoArgs={}
+ nomBloc = 'b_format_fichier' + str(formatFich)
+ typeDesFichiers = ('Fichier', formatFich + " Files (*." + formatFich + ");;All Files (*)",)
+ blocCondition = "FileFormat == '" + formatFich + "'"
+ dicoArgs[NomDuFichier] = SIMP(statut='o', typ = typeDesFichiers )
+ dicoDesBlocs[nomBloc] = BLOC( condition = blocCondition, **dicoArgs)
+ dicoArgs={}
+ dicoArgs[NomDuFichier]=SIMP(statut='o', typ = ('Fichier','All Files (*)'),),
+ dicoDesBlocs['b_format_fichier_others'] = BLOC(condition="FileFormat == 'others'", **dicoArgs)
+ if FieldName:
+ SIMPFieldName = SIMP(statut='o', typ = 'TXM',)
+ return BLOC(condition=laCondition, FileFormat = SIMPFormatFichier, **dicoDesBlocs, FieldName=SIMPFieldName)
+ else :
+ 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
+# A revoir
dicoBloc = {}
dicoBloc[nomDelaContante] = SIMP( statut='o', typ='R')
return FACT( statut='o',
# statut='o', min=2, max='**',
# typ=Tuple(nbReels),
# validators=VerifTypeTuple(("'R',"*nbReels),),) # end particle
- ), #b_vsaisie
+ ), #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 (*)'),),
- ),
+ ), # fin vtd_txt
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',),
),
)
+#------------------------------
def FactTermeSource(condition):
+#------------------------------
return BLOC (condition=condition,
OriginOfSourceTerm = SIMP( statut='o', typ='TXM',into=['Interaction', 'Chemical Reaction', 'Other Scalar']),
)
-
+#-------------------------------------
def FactTurbulence(statut, ajout=None):
- listInto = ['Fully resolved (DNS)', 'Spatial filtering (LES)', 'One-point moment', 'One-point PDF']
+#-------------------------------------
+ listInto = ['Fully resolved (DNS)', 'Spatial filtering (LES)', 'One-point moment', 'One-point PDF']
if ajout != None : listInto.append(ajout)
- return FACT (statut=statut,
+ 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
+ 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
+ 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
+ ), # 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
+ )# fin lagrangian
+ ), # fin bloc_one_point_pdf
bloc_no_model = BLOC(condition = "TurbulenceModellingType == 'Fully resolved (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
-
+ 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 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'),
+ 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 ?
- ),
- ),
+ Size = SIMP(statut='f', typ='R'), # relevant ?
+ ),# Atom
+ ), # fin b_Atom
b_Molecule = BLOC( condition='ParticleNature == "Molecules"',
- MoleculeName = SIMP( statut='o', typ=(userMolecule,'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),
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']),
- ),
+ ), #fin b_Molecule
b_Dissipative = BLOC( condition='ParticleNature == "Dissipative"',
- DPDName = SIMP( statut='o', typ=(userDPD,'createObject'),),
+ DPDName = SIMP( statut='o', typ=(userDPD,'createObject'),),
BondedParticles = SIMP(statut="o", typ=bool, defaut=False),
- ),
+ ), # b_Dissipative
b_Discrete = BLOC( condition='ParticleNature == "Discrete Particle"',
- DiscreteParticleName = SIMP(statut='o', typ=(userDiscrete,'createObject'),),
+ 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'),
+ 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"',
), # fin List_Of_Interactions
############################
- )
+) # fin Particle
def bloc_CPS():
return BLOC(condition = 'SystemType == "Classical particle system"',
- Particle = Particle('**'),
-)
+ Particle = Particle('**'),
+ )
def bloc_FluideMacro():
return BLOC(condition = 'SystemType == "Continuum system"',
), # fin bloc_NonThermal
bloc_NonNonThermalEffects = BLOC(condition = 'not(ThermalEffects == "Non thermal")',
OriginOfThermalFluxModel = SIMP( statut='o', into =['Given', 'Interaction', 'to be simulated'], typ ='TXM'),
- BlocGiven =creeBlocPourLesFichiers (' OriginOfThermalFluxModel == "Given"', None, ('Med', 'cgns' ), FieldName=1),
+ BlocGiven =creeBlocPourLesFichiers (' OriginOfThermalFluxModel == "Given"', 'FileName', ('Med', 'cgns' ), FieldName=1),
),
),
), # fin bloc_DensityNonThermal
bloc_DensityAndThermalActive = BLOC(condition = ' ThermalEffects == "Active on flow dynamics"',
OriginOfThermalEffects = SIMP( statut='o', into =['Given', 'Constant density'], typ ='TXM', defaut ='Constant density'),
- BlocGiven =creeBlocPourLesFichiers (' OriginOfThermalEffects == "Given"', None, ('Med', 'cgns' ), FieldName=1),
+ BlocGiven =creeBlocPourLesFichiers (' OriginOfThermalEffects == "Given"', 'FileName', ('Med', 'cgns' ), FieldName=1),
BlocConstant = BLOC(condition = 'OriginOfThermalEffects == "Constant density"',
InitialDensity = SIMP(typ='R', statut='o',),
),
b_ModeleNumerique_continuum = prepareBlocSystemType('Continuum system'),
BoundaryConditions = FACT(statut = 'o',
DynamicalVariables = FACT (statut ='o',
- BFlowNatureLaminar=BLOC(condition ='FlowNature == "Laminar"',
- Fluid_Velocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Velocity', homo='constant'),
- Fluid_Pressure = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Pressure', homo='constant'),
+ BFlowNatureLaminar = BLOC(condition ='FlowNature == "Laminar"',
+ Fluid_Velocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Velocity', homo='constant'),
+ Fluid_Pressure = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Pressure', homo='constant'),
),
- BFlowNatureTurbulent=BLOC(condition ='FlowNature == "Turbulent"',
- Avarage_Velocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Velocity', homo='constant'),
- Fluid_Pressure = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Pressure', homo='constant'),
+ BFlowNatureTurbulent = BLOC(condition ='FlowNature == "Turbulent"',
+ Avarage_Velocity = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Average_Velocity', homo='constant'),
+ Fluid_Pressure = SIMP(typ=(dynamicVariable,'createObject'), statut='o', defaut ='Fluid_Pressure', homo='constant'),
),
),
BoundaryCondition = prepareBoundaryCondition(),