<inport name="study_path" type="string"/>
<outport name="result_inclusions" type="string"/>
<outport name="result_rve" type="string"/>
+ <outport name="volume_fraction" type="double"/>
</inline>
<inline name="init">
<script><code><![CDATA[phase_number=1
rve_size=50.0
-study_path="/local00/bin/MAP/studies/demonstrateur_s_polymers_st_1/"
sieve_curve_in=study_path+"inclusion_size_distribution.txt"
sieve_curve_out=study_path+"pygmee_v2_test_YACS.sieve_out"
repulsion_distance=0.1
-study_name="test YACS"
file_result_inclusions=study_path+"inclusions.txt"
file_result_rve=study_path+"rve.txt"
-finesse=32
+finesse=10
lambda_I=100.
lambda_M=1.
-benhur_template="/local00/bin/EficaV1/MAP/templates/s_polymers_st_1/benhur_template.txt"
]]></code></script>
+ <inport name="study_name" type="string"/>
+ <inport name="study_path" type="string"/>
<outport name="phase_number" type="int"/>
<outport name="sieve_curve_in" type="string"/>
<outport name="sieve_curve_out" type="string"/>
<outport name="finesse" type="int"/>
<outport name="lambda_I" type="double"/>
<outport name="lambda_M" type="double"/>
- <outport name="study_name" type="string"/>
- <outport name="study_path" type="string"/>
- <outport name="benhur_template" type="string"/>
</inline>
<inline name="fdvgrid">
<script><code><![CDATA[import sys
<outport name="lambda_x" type="double"/>
</inline>
<inline name="benhur">
- <script><code><![CDATA[import os, sys
+ <script><code><![CDATA[import sys
+import os
+
+sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'),'../EficasV1/MAP/Templates/s_polymers_st_1'))
-print "benhur for YACS - BEGIN"
-print "benhur for YACS - END"
+from s_polymers_st_1_YACS_nodes import *
+
+component_benhur(finesse, rve_size, file_inclusions, study_name, study_path)
]]></code></script>
<inport name="rve_size" type="double"/>
<inport name="file_inclusions" type="string"/>
<inport name="study_name" type="string"/>
<inport name="study_path" type="string"/>
- <inport name="benhur_template" type="string"/>
</inline>
- <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
+ <inline name="env">
+ <script><code><![CDATA[study_path="/local00/bin/MAP/studies/demonstrateur_s_polymers_st_1/"
+study_name="test YACS"
+]]></code></script>
+ <outport name="study_name" type="string"/>
+ <outport name="study_path" type="string"/>
+ </inline>
<control> <fromnode>pygmee_v2</fromnode> <tonode>benhur</tonode> </control>
- <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
- <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
+ <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
<control> <fromnode>init</fromnode> <tonode>benhur</tonode> </control>
+ <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
+ <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>init</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>benhur</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>fdvgrid</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>pygmee_v2</tonode> </control>
<datalink control="false">
<fromnode>pygmee_v2</fromnode> <fromport>result_inclusions</fromport>
- <tonode>fdvgrid</tonode> <toport>file_inclusions</toport>
+ <tonode>benhur</tonode> <toport>file_inclusions</toport>
</datalink>
<datalink control="false">
<fromnode>pygmee_v2</fromnode> <fromport>result_inclusions</fromport>
- <tonode>benhur</tonode> <toport>file_inclusions</toport>
+ <tonode>fdvgrid</tonode> <toport>file_inclusions</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>phase_number</fromport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>fdvgrid</tonode> <toport>rve_size</toport>
+ <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
+ <tonode>fdvgrid</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>finesse</fromport>
- <tonode>benhur</tonode> <toport>finesse</toport>
+ <tonode>fdvgrid</tonode> <toport>finesse</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>finesse</fromport>
- <tonode>fdvgrid</tonode> <toport>finesse</toport>
+ <tonode>benhur</tonode> <toport>finesse</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>lambda_I</fromport>
<tonode>fdvgrid</tonode> <toport>lambda_M</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>study_name</fromport>
- <tonode>pygmee_v2</tonode> <toport>study_name</toport>
- </datalink>
- <datalink control="false">
- <fromnode>init</fromnode> <fromport>study_name</fromport>
+ <fromnode>env</fromnode> <fromport>study_name</fromport>
<tonode>fdvgrid</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>study_name</fromport>
+ <fromnode>env</fromnode> <fromport>study_name</fromport>
<tonode>benhur</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>study_path</fromport>
- <tonode>benhur</tonode> <toport>study_path</toport>
+ <fromnode>env</fromnode> <fromport>study_name</fromport>
+ <tonode>pygmee_v2</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>study_path</fromport>
- <tonode>pygmee_v2</tonode> <toport>study_path</toport>
+ <fromnode>env</fromnode> <fromport>study_name</fromport>
+ <tonode>init</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>study_path</fromport>
+ <fromnode>env</fromnode> <fromport>study_path</fromport>
<tonode>fdvgrid</tonode> <toport>study_path</toport>
</datalink>
<datalink control="false">
- <fromnode>init</fromnode> <fromport>benhur_template</fromport>
- <tonode>benhur</tonode> <toport>benhur_template</toport>
+ <fromnode>env</fromnode> <fromport>study_path</fromport>
+ <tonode>benhur</tonode> <toport>study_path</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>env</fromnode> <fromport>study_path</fromport>
+ <tonode>init</tonode> <toport>study_path</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>env</fromnode> <fromport>study_path</fromport>
+ <tonode>pygmee_v2</tonode> <toport>study_path</toport>
</datalink>
<parameter>
<tonode>benhur</tonode><toport>file_inclusions</toport>
<value><string></string></value>
</parameter>
- <presentation name="pygmee_v2" x="415.186" y="179.5" width="249.5" height="342"/>
+ <presentation name="env" x="518.009" y="574.447" width="227.5" height="139"/>
+ <presentation name="init" x="9" y="422.773" width="273.5" height="371"/>
+ <presentation name="benhur" x="948.69" y="94.3462" width="223" height="226"/>
<presentation name="fdvgrid" x="888.902" y="551.141" width="227.5" height="284"/>
- <presentation name="init" x="9" y="328" width="273.5" height="458"/>
- <presentation name="benhur" x="848.961" y="95.838" width="223" height="255"/>
- <presentation name="__ROOT__" x="0" y="0" width="1125.9" height="844.141"/>
+ <presentation name="pygmee_v2" x="390.897" y="87.3212" width="249.5" height="342"/>
+ <presentation name="__ROOT__" x="0" y="0" width="1181.19" height="844.141"/>
</proc>
print "fdvgrid for YACS - END"
return lambda_x
+
+def remplaceDICO(chaine,dico) :
+ for mot in dico.keys() :
+ rplact="%"+mot+"%"
+ result=chaine.replace(rplact,str(dico[mot]))
+ chaine=result
+ return chaine
+
+def component_benhur(finesse, rve_size, inclusion_name, study_name, study_path):
+ print "benhur for YACS - BEGIN"
+
+ 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)
+ string_0 = f.read()
+ f.close()
+ # find and replace with BENHUR dictionnary
+ dicoBenhur=dict()
+ dicoBenhur["_RVE_SIZE"]=rve_size
+ dicoBenhur["_MESH_SIZE"]=finesse
+ dicoBenhur["_INCLUSION_FILE"]=inclusion_name
+ dicoBenhur["_PATH_STUDY"]=study_path
+ dicoBenhur["_NAME_SCHEME"]=study_name
+ dicoBenhur["_PATH_BENHUR"]=benhur_path
+ string_1=remplaceDICO(string_0,dicoBenhur)
+ # write into ouput file
+ f=open(monFichierOutput,'wb')
+ f.write(string_1)
+ f.close()
+ # launch of BENHUR on the previous file
+ benhur_path=os.path.join(os.getenv('MAP_DIRECTORY'),'components/benhur/')
+ commande="cd "+benhur_path+"/bin;\n"
+ commande+="./benhur -i "+monFichierOutput+";\n"
+ os.system(commande)
+ print "benhur_input", string_1
+ print "benhur_command", commande
+
+ print "benhur for YACS - END"
SchemaYacs.nodeAvant=SchemaYacs.fdvgridNode
print "FDVGRIDYACS node Ok"
+ def BENHURYACS(self, SchemaYacs, proc):
+ factoryNode = SchemaYacs.monCata._nodeMap["benhur"]
+ SchemaYacs.benhurNode = factoryNode.cloneNode("benhur")
+
+ SchemaYacs.benhurNode.getInputPort("rve_size").edInitPy(self.rve_size)
+ SchemaYacs.benhurNode.getInputPort("finesse").edInitPy(self.finesse)
+ SchemaYacs.benhurNode.getInputPort("study_name").edInitPy(self.study_name)
+ SchemaYacs.benhurNode.getInputPort("study_path").edInitPy(self.study_path)
+
+ proc.edAddChild(SchemaYacs.benhurNode)
+ pout=SchemaYacs.pygmeeNode.getOutputPort("result_inclusions")
+ pin=SchemaYacs.benhurNode.getInputPort("file_inclusions")
+ proc.edAddLink(pout,pin)
+
+ if SchemaYacs.nodeAvant != None :
+ proc.edAddCFLink(SchemaYacs.nodeAvant,SchemaYacs.benhurNode)
+ SchemaYacs.nodeAvant=SchemaYacs.benhurNode
+ print "BENHURYACS 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)
# II - shell functions
def ETUDE(self,execution) :
print "option fdvgrid"
commande+= self.FDVGRID()
return commande
- if (choix=="FEM+mesh") :
+ elif (self.CHOIX=="FEM+mesh") :
print "option Code_Aster"
commande+= self.BENHUR()
commande+= self.ASTER()
return 'python -c "'+commande_python+'"\n'
def BENHUR(self):
- 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"
+ 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+="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"
+ 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
+## 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,execution) :
+ 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"
string_1=self.remplaceCONFIG(string_0,CONFIGliste)
# find and replace with CODE_ASTER dictionnary
dicoAster=dict()
- dicoAster["_MESH_SIZE"]=finesse
+ dicoAster["_MESH_SIZE"]=self.finesse
dicoAster["_ASTER_VERSION"]="STA10"
dicoAster["_NAME_STUDY"]="s_polymers_st_1"
string_2=self.remplaceDICO(string_1,dicoAster)
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"]
+ 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')
commande=commande + "echo 'fin execution de CODE_ASTER';\n"
return commande
- def GMSH(self,execution) :
+ 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"
proc.saveSchema(yacs_schema_filename)
class s_polymers_st_1(CreeSchemaYacs) :
-
- # CTL 20101121 : obsolete, has been transfered to genarator_s_polymers_st_1
- # for better genericity
-## def BENHURYACS(self,proc,dico):
-## monFichierInput=self.config.PATH_BENHUR+"/BHR_files.txt"
-## factoryNode = self.monCata._nodeMap["benhur"]
-## self.benhurNode = factoryNode.cloneNode("benhur")
-## self.benhurNode.getInputPort("fileInput").edInitPy(monFichierInput)
-## self.benhurNode.getInputPort("pathBenhur").edInitPy(self.config.PATH_BENHUR)
-## proc.edAddChild(self.benhurNode)
-## if self.nodeAvant != None :
-## proc.edAddCFLink(self.nodeAvant,self.benhurNode)
-## self.nodeAvant=self.benhurNode
-
# CTL 20101121 : obsolete, has been transfered to genarator_s_polymers_st_1
# for better genericity
## def ASTERYACS(self,proc,dico):