From: Charles Toulemonde Date: Thu, 25 Nov 2010 08:21:11 +0000 (+0000) Subject: aster and gmsh YACS nodes for s_polymers_st_1 X-Git-Tag: V2_1_1_beta~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c9fd2a21d2dc15cd5a90c6e4d6b0e945d4971a21;p=modules%2Feficas.git aster and gmsh YACS nodes for s_polymers_st_1 --- diff --git a/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml b/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml index f29c1d3e..96466521 100644 --- a/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml +++ b/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml @@ -22,7 +22,7 @@ @@ -105,30 +106,73 @@ component_benhur(finesse, rve_size, file_inclusions, study_name, study_path) + + + + + + + + + + + + + + + + + + + - pygmee_v2 benhur pygmee_v2 fdvgrid - init benhur + pygmee_v2 benhur init fdvgrid + init aster_s_polymers_st_1 + init benhur init pygmee_v2 - env init - env benhur + benhur aster_s_polymers_st_1 env fdvgrid + env aster_s_polymers_st_1 + env benhur + env init env pygmee_v2 + aster_s_polymers_st_1 gmsh_post pygmee_v2 result_inclusions - benhur file_inclusions + fdvgrid file_inclusions pygmee_v2 result_inclusions - fdvgrid file_inclusions + benhur file_inclusions init phase_number @@ -154,6 +198,10 @@ study_name="test YACS" init file_result_rve pygmee_v2 file_result_rve + + init rve_size + fdvgrid rve_size + init rve_size benhur rve_size @@ -164,7 +212,11 @@ study_name="test YACS" init rve_size - fdvgrid rve_size + aster_s_polymers_st_1 rve_size + + + init finesse + benhur finesse init finesse @@ -172,16 +224,32 @@ study_name="test YACS" init finesse - benhur finesse + aster_s_polymers_st_1 finesse init lambda_I fdvgrid lambda_I + + init lambda_I + aster_s_polymers_st_1 lambda_I + + + init lambda_M + aster_s_polymers_st_1 lambda_M + init lambda_M fdvgrid lambda_M + + benhur result_mesh + aster_s_polymers_st_1 mesh + + + env study_name + pygmee_v2 study_name + env study_name fdvgrid study_name @@ -192,7 +260,7 @@ study_name="test YACS" env study_name - pygmee_v2 study_name + aster_s_polymers_st_1 study_name env study_name @@ -200,11 +268,11 @@ study_name="test YACS" env study_path - fdvgrid study_path + benhur study_path env study_path - benhur study_path + aster_s_polymers_st_1 study_path env study_path @@ -214,14 +282,28 @@ study_name="test YACS" env study_path pygmee_v2 study_path + + env study_path + fdvgrid study_path + + + env aster_path + aster_s_polymers_st_1 aster_path + + + aster_s_polymers_st_1 result_gmsh + gmsh_post result_gmsh + benhurfile_inclusions - - - - - - + + + + + + + + diff --git a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py index dd48f3ae..abd910b4 100644 --- a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py +++ b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py @@ -79,11 +79,12 @@ def remplaceDICO(chaine,dico) : def component_benhur(finesse, rve_size, inclusion_name, study_name, study_path): print "benhur for YACS - BEGIN" + finesse=int(finesse) + Template_path=os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/') monFichierInput=Template_path+"benhur_template.txt" monFichierOutput=Template_path+"s_polymers_st_1_benhur_"+str(finesse)+".bhr" - benhur_path=os.path.join(os.getenv('MAP_DIRECTORY'), 'components/benhur/') f = file(monFichierInput) @@ -107,7 +108,78 @@ def component_benhur(finesse, rve_size, inclusion_name, study_name, study_path): commande="cd "+benhur_path+"/bin;\n" commande+="./benhur -i "+monFichierOutput+";\n" os.system(commande) - print "benhur_input", string_1 - print "benhur_command", commande + + result_mesh=study_path+'/'+study_name+'_benhur_'+str(finesse)+'.msh' + result_log=study_path+'/'+study_name+'_benhur_'+str(finesse)+'.log' + + print 'result_mesh =', result_mesh + print 'result_log =', result_log print "benhur for YACS - END" + + return (result_mesh, result_log) + +def component_aster_s_polymers_st_1(rve_size, finesse, lambda_I, lambda_M, study_name, study_path, aster_path): + print "aster_s_polymers_st_1 for YACS - BEGIN" + + finesse=int(finesse) + + Template_path=os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/') + monFichierCommInput=Template_path+"s_polymers_st_1_aster_template.comm" + monFichierExportInput=Template_path+"s_polymers_st_1_aster_template.export" + + monFichierCommOutput=study_path+"/s_polymers_st_1_aster.comm" + monFichierExportOutput=study_path+"/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 CODE_ASTER dictionnary + dicoAster=dict() + dicoAster["_MESH_SIZE"]=str(finesse) + dicoAster["_ASTER_VERSION"]="STA10" + dicoAster["_NAME_STUDY"]="s_polymers_st_1" + dicoAster["_PATH_STUDY"]=study_path + dicoAster["_CONDUCTIVITE_I"]=str(lambda_I) + dicoAster["_CONDUCTIVITE_M"]=str(lambda_M) + string_1=remplaceDICO(string_0,dicoAster) + # write into output file + f=open(monFichierExportOutput,'wb') + f.write(string_1) + 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 CODE_ASTER dictionnary + # find and replace with CODE_ASTER dictionnary + dicoAster=dict() + dicoAster["_RVE_SIZE"]=str(rve_size) + dicoAster["_CONDUCTIVITE_I"]=str(lambda_I) + dicoAster["_CONDUCTIVITE_M"]=str(lambda_M) + string_1=remplaceDICO(string_0,dicoAster) + # write into output file + f=open(monFichierCommOutput,'wb') + f.write(string_1) + f.close() + + # launch of CODE_ASTER on the study + commande="cd "+study_path+";" + commande+=commande + aster_path + "/as_run "+monFichierExportOutput +";\n" + os.system(commande) + + print "aster_s_polymers_st_1 for YACS - END" + + result_gmsh=study_path+"/s_polymers_st_1_aster.resu.msh" + + return result_gmsh + +def component_gmsh_post(result_gmsh): + print "gmsh_post for YACS - BEGIN" + commande="gmsh "+result_gmsh+";" + os.system(commande) + + print "gmsh_post for YACS - END" + + return diff --git a/generator/generator_s_polymers_st_1.py b/generator/generator_s_polymers_st_1.py index 5749f80b..d1610702 100644 --- a/generator/generator_s_polymers_st_1.py +++ b/generator/generator_s_polymers_st_1.py @@ -127,10 +127,51 @@ class s_poly_st_1Generator(MapGenerator): SchemaYacs.nodeAvant=SchemaYacs.benhurNode print "BENHURYACS node Ok" + def ASTERYACS(self, SchemaYacs, proc): + factoryNode = SchemaYacs.monCata._nodeMap["aster_s_polymers_st_1"] + SchemaYacs.aster_s_polymers_st_1Node = factoryNode.cloneNode("aster_s_polymers_st_1") + + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("lambda_I").edInitPy(self.lambda_I) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("lambda_M").edInitPy(self.lambda_M) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("study_name").edInitPy(self.study_name) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("study_path").edInitPy(self.study_path) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("rve_size").edInitPy(self.rve_size) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("finesse").edInitPy(self.finesse) + SchemaYacs.aster_s_polymers_st_1Node.getInputPort("aster_path").edInitPy(self.config.PATH_ASTER) + + proc.edAddChild(SchemaYacs.aster_s_polymers_st_1Node) + pout=SchemaYacs.benhurNode.getOutputPort("result_mesh") + pin=SchemaYacs.aster_s_polymers_st_1Node.getInputPort("mesh") + proc.edAddLink(pout,pin) + + if SchemaYacs.nodeAvant != None : + proc.edAddCFLink(SchemaYacs.nodeAvant,SchemaYacs.aster_s_polymers_st_1Node) + SchemaYacs.nodeAvant=SchemaYacs.aster_s_polymers_st_1Node + print "ASTERYACS node Ok" + + + def GMSHYACS(self, SchemaYacs, proc): + factoryNode = SchemaYacs.monCata._nodeMap["gmsh_post"] + SchemaYacs.gmsh_postNode = factoryNode.cloneNode("gmsh_post") + + proc.edAddChild(SchemaYacs.gmsh_postNode) + pout=SchemaYacs.aster_s_polymers_st_1Node.getOutputPort("result_gmsh") + pin=SchemaYacs.gmsh_postNode.getInputPort("result_gmsh") + proc.edAddLink(pout,pin) + + if SchemaYacs.nodeAvant != None : + proc.edAddCFLink(SchemaYacs.nodeAvant,SchemaYacs.gmsh_postNode) + SchemaYacs.nodeAvant=SchemaYacs.gmsh_postNode + print "GMSHYACS node Ok" + def METHODEYACS(self, SchemaYacs, proc): self.PYGMEEYACS(SchemaYacs, proc) - if (self.CHOIX=="FD+grid") : self.FDVGRIDYACS(SchemaYacs,proc) - if (self.CHOIX=="FEM+mesh") : self.BENHURYACS(SchemaYacs,proc) + if (self.CHOIX=="FD+grid") : + self.FDVGRIDYACS(SchemaYacs,proc) + if (self.CHOIX=="FEM+mesh") : + self.BENHURYACS(SchemaYacs,proc) + self.ASTERYACS(SchemaYacs,proc) + self.GMSHYACS(SchemaYacs,proc) # II - shell functions def ETUDE(self,execution) : @@ -177,107 +218,47 @@ class s_poly_st_1Generator(MapGenerator): elif (self.CHOIX=="FEM+mesh") : print "option Code_Aster" commande+= self.BENHUR() - commande+= self.ASTER() + commande+= self.ASTER_s_polymers_st_1() commande+= self.GMSH() return commande # III - code and component functions def PYGMEE(self) : commande_python="import os,sys;\n" - commande_python+="sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'), '../EficasV1/MAP/Templates/s_polymers_st_1'));\n" + commande_python+="sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/'));\n" commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" commande_python+="volume_fraction=component_pygmee_v2("+str(self.rve_size)+",1,"+str(self.sieve_curve_in)+","+str(self.sieve_curve_out)+","+str(self.repulsion_distance)+","+str(self.study_name)+","+str(self.study_path)+","+str(self.inclusion_name)+","+str(self.rve_name)+");\n" return 'python -c "'+commande_python+'"\n' def FDVGRID(self): commande_python="import os,sys;\n" - commande_python+="sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'), '../EficasV1/MAP/Templates/s_polymers_st_1'));\n" + commande_python+="sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/'));\n" commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" commande_python+="lambda_x=component_fdvgrid("+str(self.lambda_I)+","+str(self.lambda_M)+","+str(self.rve_size)+",'"+str(self.inclusion_name)+"',"+str(self.finesse)+");\n" return 'python -c "'+commande_python+'"\n' def BENHUR(self): commande_python="import os,sys;\n" - commande_python+="sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'), '../EficasV1/MAP/Templates/s_polymers_st_1'));\n" + commande_python+="sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/'));\n" commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" - commande_python+="component_benhur("+str(self.finesse)+","+str(self.rve_size)+","+str(self.inclusion_name)+",'"+str(self.study_name)+"',"+str(self.study_path)+");\n" + commande_python+="component_benhur("+str(self.finesse)+","+str(self.rve_size)+",'"+str(self.inclusion_name)+"','"+str(self.study_name)+"','"+str(self.study_path)+"');\n" return 'python -c "'+commande_python+'"\n' - -## 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" -## 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 dictionnary -## string_2=self.remplaceDICO(string_1,dicoBenhur) -## # write into ouput file -## 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" -## return commande - - def ASTER(self) : - 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) - # find and replace with CODE_ASTER dictionnary - dicoAster=dict() - dicoAster["_MESH_SIZE"]=self.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() - - # 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) - # find and replace with CODE_ASTER dictionnary - dicoAster=dict() - dicoAster["_RVE_SIZE"]=self.rve_size - dicoAster["_CONDUCTIVITE_I"]=self.lambda_I - dicoAster["_CONDUCTIVITE_M"]=self.lambda_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" - return commande + def ASTER_s_polymers_st_1(self) : + commande_python="import os,sys;\n" + commande_python+="sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/'));\n" + commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" + commande_python+="component_aster_s_polymers_st_1("+str(self.rve_size)+","+str(self.finesse)+","+str(self.lambda_I)+","+str(self.lambda_M)+",'"+str(self.study_name)+"','"+str(self.study_path)+"','"+self.config.PATH_ASTER+"');\n" + return 'python -c "'+commande_python+'"\n' def GMSH(self) : - 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" - return commande + commande_python="import os,sys;\n" + commande_python+="sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/'));\n" + commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" + commande_python+="component_gmsh_post('"+str(self.study_path+"/s_polymers_st_1_aster.resu.msh")+"');\n" + return 'python -c "'+commande_python+'"\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" +## return commande