#
from Accas import *
from prefs_MAP import PATH_MODULE
+from prefs_MAP import PATH_STUDY
+from prefs_MAP import PATH_PYGMEE
+
class Tuple:
def __init__(self,ntuple):
self.ntuple=ntuple
METHODE= PROC(nom="METHODE",op=None,
fr='choix de la methode de calcul (maillage ou grille cartesienne)',
- CHOIX=SIMP(statut = "o",fr="elements finis sur maillage ou differences finies sur grilles", typ='TXM', defaut="FD+grid", into=("FEM+mesh","FD+grid")),
- LANCEMENT=SIMP(statut = "o",fr="lancement de Code_Aster ou de fdvgrid selon le choix", typ='TXM', defaut="oui", into=("oui","non")),
-)
+ CHOIX=SIMP(statut = "o",fr="elements finis sur maillage ou differences finies sur grilles",
+ typ='TXM', defaut="FD+grid", into=("FEM+mesh","FD+grid")),
+ LANCEMENT=SIMP(statut = "o",fr="lancement de Code_Aster ou de fdvgrid selon le choix",
+ typ='TXM', defaut="oui", into=("oui","non")),
+ )
MATERIAUX= PROC(nom="MATERIAUX",op=None,
fr='definition des proprietes du materiau : fuseau, taille du VER, proprietes des phases',
- TAILLE=SIMP(statut = "o",fr="taille du VER", typ='R', defaut=50.),
- FUSEAU = SIMP ( statut = "o", fr="Fichier représentant le fuseau granulaire",typ = "Fichier", defaut=PATH_MODULE+"/s_poly_st_1/inclusion_size_distribution.txt"),
- DISTANCE=SIMP(statut = "o",fr="distance de replusions", typ='R', defaut=0.1),
+ TAILLE=SIMP(statut = "o",fr="taille du VER", typ='R', defaut=50.,equiv="size"),
+ FUSEAU = SIMP ( statut = "o", fr="Fichier représentant le fuseau granulaire",typ = "Fichier", defaut=PATH_STUDY+"/inclusion_size_distribution.txt"),
+ distance=SIMP(statut = "o",fr="distance de replusions", typ='R', defaut=0.1),
CONDUCTIVITE_M=SIMP(statut = "o",fr="conductivite de la matrice", typ='R', defaut=1.0 , val_min =0.),
CONDUCTIVITE_I=SIMP(statut = "o",fr="conductivite des inclusions", typ='R', defaut=10.0, val_min =0.),
+ inclusion_name=SIMP(statut = "f",fr="", typ='TXM',defaut=PATH_STUDY+"/pygmee_v2_test_1.inclusions",cache=1),
+ rve_name=SIMP(statut = "f",fr="", typ='TXM',defaut=PATH_STUDY+"/pygmee_v2_test_1.rvz",cache=1),
+ sieve_in=SIMP(statut = "f",fr="", typ='TXM',defaut=PATH_PYGMEE+"/tests/pygmee_v2_test_1.sieve_in",cache=1),
+ sieve_out=SIMP(statut = "f",fr="", typ='TXM',defaut=PATH_STUDY+"pygmee_v2.sieve_out",cache=1),
)
DISCRETISATION= PROC(nom="DISCRETISATION",op=None,
except :
pass
#____________________________________________________________________________________
-# PYGMEEDict contient une equivalence entre le catalogue Map et les lignes generees
-# comme entete (commentaire ?) dans le fichier d'input de pygmee
#
-
CONFIGliste=('NAME_SCHEME', 'PATH_ASTER', 'PATH_BENHUR', 'PATH_MODULE', 'PATH_PYGMEE', 'PATH_STUDY', 'repIni')
-PYGMEEDict={
- "_PYGMEE_FUSEAU1_b_forme_FICHIER" : "#fuseau 1 (entree de lecfus) format : diametre DCE croissant / fraction cumulee decroisant ",
- "FUSEAU2" : "#fuseau 2 (entree de lecfus) format : diametre DCE croissant / fraction cumulee decroisant",
- "_PYGMEE_TAILLE" : "# taille du VER en microns ",
- "_PYGMEE_DISTANCE" : "# distance de repulsion :",
- }
-
-#_______________________________________________________________________________________________________
-# listeOrdonneeMCPygmee contient une liste (donc ordonnee) des mots clefs pour
-# imposer l'ordre des lignes generees
-listeOrdonneeMCPygmee =('_PYGMEE_FUSEAU1_b_forme_FICHIER', 'FUSEAU2', '_PYGMEE_TAILLE','_PYGMEE_DISTANCE')
-
-
-BENHURDict={
- "_BENHUR_FINESSE" : "discretisation des arretes du VER ",
- }
-
-ASTERDict={
- "_ASTER_LANCEMENT" : "execution de Code_Aster",
- "_ASTER_CONDUCTIVITE_I" : "conductivite des inclusions",
- "_ASTER_CONDUCTIVITE_M" : "conductivite de la matrice",
- }
-
-GMSHDict={
- "_GMSH_LANCEMENT" : "execution de GMSH",
- }
def entryPoint():
"""
else:
return ""
- def METHODE(self,execution) :
- self.config.PATH_STUDY=self.config.PATH_MAP+"/studies/demonstrateur_s_polymers_st_1"
- print "self.config.PATH_STUDY has been forced to :", self.config.PATH_STUDY
- self.dicoMETHODE=self.dictMCVal["METHODE"]
- print "_____________________"
- print self.dicoMETHODE
- result=self.dicoMETHODE['_METHODE_LANCEMENT']
- print '_METHODE_LANCEMENT =', result
- if (result=='oui') :
- composant="pygmee_v2"
- self.size=float(self.dicoMATERIAUX['_MATERIAUX_TAILLE'])
- self.sieve_in=self.config.PATH_PYGMEE+"/tests/pygmee_v2_test_1.sieve_in"
- self.sieve_out=self.config.PATH_STUDY+"/pygmee_v2.sieve_out"
- self.distance=self.dicoMATERIAUX['_MATERIAUX_DISTANCE']
- self.inclusion_name=self.config.PATH_STUDY+"/pygmee_v2_test_1.inclusions"
- self.rve_name=self.config.PATH_STUDY+"/pygmee_v2_test_1.rve"
- pygmee_v2_input=self.config.PATH_STUDY+"/pygmee_v2.input"
- print "pygmee_v2_input =", pygmee_v2_input
- parameter=MAP_parameters()
- parameter.add_component(composant)
- parameter.add_parameter(composant, 'rve_size', self.size)
- parameter.add_parameter(composant, 'phase_number', 1)
- parameter.add_parameter(composant, 'sieve_curve_in', self.sieve_in)
- parameter.add_parameter(composant, 'sieve_curve_out', self.sieve_out)
- parameter.add_parameter(composant, 'repulsion_distance', self.distance)
- parameter.add_parameter(composant, 'study_name', "study")
- parameter.add_parameter(composant, 'file_result_inclusions', self.inclusion_name)
- parameter.add_parameter(composant, 'file_result_rve', self.rve_name)
- commande_python=parameter.write_for_shell(pygmee_v2_input)
- commande="echo 'parametres de PYGMEE v2';\n"
+ def PYGMEE(self) :
+ composant="pygmee_v2"
+ pygmee_v2_input=self.config.PATH_STUDY+"/pygmee_v2.input"
+ parameter=MAP_parameters()
+ parameter.add_component(composant)
+ parameter.add_parameter(composant, 'rve_size', self.size)
+ parameter.add_parameter(composant, 'phase_number', 1)
+ parameter.add_parameter(composant, 'sieve_curve_in', self.sieve_in)
+ parameter.add_parameter(composant, 'sieve_curve_out', self.sieve_out)
+ parameter.add_parameter(composant, 'repulsion_distance', self.distance)
+ parameter.add_parameter(composant, 'study_name', "study")
+ parameter.add_parameter(composant, 'file_result_inclusions', self.inclusion_name)
+ parameter.add_parameter(composant, 'file_result_rve', self.rve_name)
+ commande_python=parameter.write_for_shell(pygmee_v2_input)
+
+ commande="echo 'parametres de PYGMEE v2';\n"
+ commande+= commande_python
+ commande+= "echo 'execution de PYGMEE v2';\n"
+ commande+= "cd "+self.config.PATH_PYGMEE+"/src;\n"
+ commande+= "python pygmee_v2.py -i "+pygmee_v2_input+";\n"
+ commande+= "echo 'fin execution de PYGMEE v2';\n"
+ return commande
- commande+= commande_python
-
- commande+= "echo 'execution de PYGMEE v2';\n"
- commande+= "cd "+self.config.PATH_PYGMEE+"/src;\n"
- commande+= "python pygmee_v2.py -i "+pygmee_v2_input+";\n"
- commande+= "echo 'fin execution de PYGMEE v2';\n"
- self.contrast=float(self.dicoMATERIAUX['_MATERIAUX_CONDUCTIVITE_I']/self.dicoMATERIAUX['_MATERIAUX_CONDUCTIVITE_M'])
- choix=self.dicoMETHODE['_METHODE_CHOIX']
+ def FDVGRID(self):
+ if ( self.FINESSE < 32): self.FINESSE=32
+ self.contrast=float(self.CONDUCTIVITE_I/self.CONDUCTIVITE_M)
+ commande= "echo 'execution de FDVGRID';\n"
+ commande+= "cd "+self.config.PATH_FDVGRID+";\n"
+ commande+= "echo "+ str(self.size)+" > "+"rve.input"+";\n"
+ commande+= "cp " +str(self.config.PATH_STUDY+"/pygmee_v2_test_1.inclusions")+" "+"inclusions.input"+";\n"
+ commande+= "echo "+str(self.contrast)+" > "+"contrast.input"+";\n"
+ commande+= "./fdvgrid 3D 1.0 0.0 0.0 v t "+str(self.FINESSE)+" cross 1e-6 "+";\n"
+ commande+= "echo 'fin execution de FDVGRID';\n"
+ print "commande issue du generator :", commande
+ return commande
- finesse=int(self.dicoDISCRETISATION['_DISCRETISATION_FINESSE'])
+ def METHODE(self,execution) :
+ #if (self.LANCEMENT =='oui') :
+ # if (self.LANCEMENT =='non' : return ""
- if (choix=="FD+grid") :
- commande+= "echo 'execution de FDVGRID';\n"
- commande+= "cd "+self.config.PATH_FDVGRID+";\n"
- if (finesse<32):
- finesse=32
- commande+= "echo "+str(self.size)+" > "+"rve.input"+";\n"
- commande+= "cp "+str(self.config.PATH_STUDY+"/pygmee_v2_test_1.inclusions")+" "+"inclusions.input"+";\n"
- commande+= "echo "+str(self.contrast)+" > "+"contrast.input"+";\n"
- commande+= "./fdvgrid 3D 1.0 0.0 0.0 v t "+str(finesse)+" cross 1e-6 "+";\n"
- commande+= "echo 'fin execution de FDVGRID';\n"
- print "commande issue du generator :", commande
+ commande=self.PYGMEE()
+ if (self.CHOIX=="FD+grid") : commande+= self.FDVGRID()
+ return commande
- if (choix=="FEM+mesh") :
- print "option Code_Aster"
- commande+= "echo 'execution de BENHUR';\n"
+ #if (choix=="FEM+mesh") :
+ # print "option Code_Aster"
+ # commande+= "echo 'execution de BENHUR';\n"
#Lecture du fichier a trous
- print "name_SCHEME =", self.config.NAME_SCHEME
- monFichierInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/benhur_template.txt"
- monFichierOutput=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+str(finesse)+".bhr"
+ # print "name_SCHEME =", self.config.NAME_SCHEME
+ # monFichierInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/benhur_template.txt"
+ # monFichierOutput=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+str(finesse)+".bhr"
- f = file(monFichierInput)
- string_0 = f.read()
- f.close()
+ # f = file(monFichierInput)
+ # string_0 = f.read()
+ # f.close()
# find and replace with CONFIG idctionnary
- string_1=self.remplaceCONFIG(string_0,CONFIGliste)
- dicoBenhur=dict()
- dicoBenhur["_RVE_SIZE"]=self.size
- dicoBenhur["_MESH_SIZE"]=finesse
- dicoBenhur["_INCLUSION_FILE"]=self.inclusion_name
- # find and replace with BENHUR idctionnary
- string_2=self.remplaceDICO(string_1,dicoBenhur)
+ # string_1=self.remplaceCONFIG(string_0,CONFIGliste)
+ # dicoBenhur=dict()
+ # dicoBenhur["_RVE_SIZE"]=self.size
+ # dicoBenhur["_MESH_SIZE"]=finesse
+ # dicoBenhur["_INCLUSION_FILE"]=self.inclusion_name
+ # find and replace with BENHUR dictionnary
+ # string_2=self.remplaceDICO(string_1,dicoBenhur)
# write into ouput file
- f=open(monFichierOutput,'wb')
- f.write(string_2)
- f.close()
+ # f=open(monFichierOutput,'wb')
+ # f.write(string_2)
+ # f.close()
# launch of BENHUR on the previous file
- commande=commande + "cd "+self.config.PATH_BENHUR+"/bin;\n"
- commande=commande + "./benhur -i "+monFichierOutput+";\n"
- commande=commande + "echo 'fin execution de BENHUR';\n"
+ # commande=commande + "cd "+self.config.PATH_BENHUR+"/bin;\n"
+ # commande=commande + "./benhur -i "+monFichierOutput+";\n"
+ # commande=commande + "echo 'fin execution de BENHUR';\n"
- commande+= "echo 'execution de CODE_ASTER';\n"
- monFichierCommInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.comm"
- monFichierExportInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.export"
-
- monFichierCommOutput=self.config.PATH_STUDY+"/s_polymers_st_1_aster.comm"
- monFichierExportOutput=self.config.PATH_STUDY+"/s_polymers_st_1_aster.export"
- # Lecture du fichier a trous a pour le fichier export
- f = file(monFichierExportInput)
- string_0 = f.read()
- f.close()
+ # commande+= "echo 'execution de CODE_ASTER';\n"
+ # monFichierCommInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.comm"
+ # monFichierExportInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.export"
+
+ # monFichierCommOutput=self.config.PATH_STUDY+"/s_polymers_st_1_aster.comm"
+ # monFichierExportOutput=self.config.PATH_STUDY+"/s_polymers_st_1_aster.export"
+ # # Lecture du fichier a trous a pour le fichier export
+ # f = file(monFichierExportInput)
+ # string_0 = f.read()
+ # f.close()
# find and replace with CONFIG dictionnary
- string_1=self.remplaceCONFIG(string_0,CONFIGliste)
+ # string_1=self.remplaceCONFIG(string_0,CONFIGliste)
# find and replace with CODE_ASTER dictionnary
- dicoAster=dict()
- dicoAster["_MESH_SIZE"]=finesse
- dicoAster["_ASTER_VERSION"]="STA10"
- dicoAster["_NAME_STUDY"]="s_polymers_st_1"
- string_2=self.remplaceDICO(string_1,dicoAster)
+ # dicoAster=dict()
+ # dicoAster["_MESH_SIZE"]=finesse
+ # dicoAster["_ASTER_VERSION"]="STA10"
+ # dicoAster["_NAME_STUDY"]="s_polymers_st_1"
+ # string_2=self.remplaceDICO(string_1,dicoAster)
# write into output file
- f=open(monFichierExportOutput,'wb')
- f.write(string_2)
- f.close()
+ # f=open(monFichierExportOutput,'wb')
+ # f.write(string_2)
+ # f.close()
# Lecture du fichier a trous a pour le fichier comm
- f = file(monFichierCommInput)
- string_0 = f.read()
- f.close()
- # find and replace with CONFIG dictionnary
- string_1=self.remplaceCONFIG(string_0,CONFIGliste)
+ # f = file(monFichierCommInput)
+ # string_0 = f.read()
+ # f.close()
+ # # find and replace with CONFIG dictionnary
+ # string_1=self.remplaceCONFIG(string_0,CONFIGliste)
# find and replace with CODE_ASTER dictionnary
- dicoAster=dict()
- dicoAster["_RVE_SIZE"]=self.size
- dicoAster["_CONDUCTIVITE_I"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_I"]
- dicoAster["_CONDUCTIVITE_M"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_M"]
- string_2=self.remplaceDICO(string_1,dicoAster)
- # write into output file
- f=open(monFichierCommOutput,'wb')
- f.write(string_2)
- f.close()
+ # dicoAster=dict()
+ # dicoAster["_RVE_SIZE"]=self.size
+ # dicoAster["_CONDUCTIVITE_I"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_I"]
+ # dicoAster["_CONDUCTIVITE_M"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_M"]
+ # string_2=self.remplaceDICO(string_1,dicoAster)
+ # # write into output file
+ # f=open(monFichierCommOutput,'wb')
+ # f.write(string_2)
+ # f.close()
# launch of CODE_ASTER on the study
- commande=commande + "cd "+self.config.PATH_STUDY+";"
- commande=commande + self.config.PATH_ASTER + "/as_run "+monFichierExportOutput +";\n"
- commande=commande + "echo 'fin execution de CODE_ASTER';\n"
+ # commande=commande + "cd "+self.config.PATH_STUDY+";"
+ # commande=commande + self.config.PATH_ASTER + "/as_run "+monFichierExportOutput +";\n"
+ # commande=commande + "echo 'fin execution de CODE_ASTER';\n"
- commande+= "echo 'execution de GMSH';\n"
- commande+= "gmsh "+self.config.PATH_STUDY+"/s_polymers_st_1_aster.resu.msh;\n"
- commande+= "echo 'fin execution de GMSH';\n"
-
- print commande
+ # commande+= "echo 'execution de GMSH';\n"
+ # commande+= "gmsh "+self.config.PATH_STUDY+"/s_polymers_st_1_aster.resu.msh;\n"
+ # commande+= "echo 'fin execution de GMSH';\n"
+ #
+ # print commande
- print "METHODE Ok - 20101105"
- print "_____________________\n"
- return commande
+ #print "METHODE Ok - 20101105"
+ #print "_____________________\n"
+ #return commande
def MATERIAUX(self,execution) :
self.dicoMATERIAUX=self.dictMCVal["MATERIAUX"]