ApplyingBC_IC.py

Go to the documentation of this file.
00001 def ApplyingBC_IC(Casedir,YoungModulus,PoissonCoeff,OUTER_GRID_No1,OUTER_GRID_No2,OUTER_GRID_No3) :
00002     # Variables generales
00003     import os,subprocess
00004     #
00005     AC_file = open (str(Casedir + "/" + "Applied_Conditions.txt"),'w')
00006     #
00007     # a) BOUNDARY conditions in order to prevent the billet to any solid displacement
00008     AC_file.write("** \n")
00009     AC_file.write("** BOUNDARY Conditions :\n")
00010     AC_file.write("*BOUNDARY\n")
00011     AC_file.write("%i, 1, 3\n" %OUTER_GRID_No1)
00012     AC_file.write("*BOUNDARY\n")
00013     AC_file.write("%i, 2, 3\n" %OUTER_GRID_No2)
00014     AC_file.write("*BOUNDARY \n")
00015     AC_file.write("%i, 3\n" %OUTER_GRID_No3)
00016     AC_file.write("** \n")
00017     #
00018     # b) MATERIAL description :
00019     MAT_NAME = "EL"
00020     AC_file.write("*MATERIAL, NAME=%s \n" %MAT_NAME)
00021     AC_file.write("*ELASTIC \n")
00022     AC_file.write("%f, %f \n" %(YoungModulus,PoissonCoeff)) 
00023     #    Assign the material properties to the desired group of elements :
00024     AC_file.write("*SOLID SECTION, ELSET=Eall, MATERIAL=%s \n" %MAT_NAME)
00025     AC_file.write("** \n")
00026     #
00027     # c) Define the load :
00028     AC_file.write("** LOAD :\n")
00029     #-Load_1: Points Loading :
00030     #-Load_1: AC_file.write("*NSET, NSET=LOAD \n")  # list of Nodes where Concentrated Load will be applied
00031     #-Load_1: AC_file.write("??, ??, ??, ... \n") 
00032     #-Load_2 : For applying Internal (residual) stresses (cf.  user-subroutine "sigini.f") :
00033     AC_file.write("*INITIAL CONDITIONS, TYPE=STRESS, USER \n")
00034     #
00035     # d) FEM-calculation  pilote :
00036     AC_file.write("** \n")
00037     AC_file.write("*STEP \n")
00038     AC_file.write("*STATIC \n")
00039     #-Load_1: AC_file.write("*CLOAD \n")  #  for Applying Concentrated Load 
00040     #-Load_1: AC_file.write("LOAD,3,Magnitude_per_Node \n")  # force acting in the Z-dir, force magnitude per Node
00041 
00042     #
00043     # e) Specify  the OUTPUT requested :
00044     AC_file.write("** OUTPUT REQUESTS \n")
00045     # If one wants to store each 0^th step the results of present calculation for future restarts
00046     # AC_file.write("*Restart, write, frequency=0 \n")  
00047     AC_file.write("*NODE FILE \n")  
00048     AC_file.write("U \n")   #  displacements expressed in the GLOBAL Coord System
00049     # AC_file.write("** \n")
00050     AC_file.write("*EL FILE \n")
00051     AC_file.write("S \n")  #  (Cauchy) Stresses 
00052     #
00053     AC_file.write("*NODE PRINT , NSET=Nall \n")  
00054     AC_file.write("U \n")   #  displacements expressed in the GLOBAL Coord System
00055     # AC_file.write("** \n")
00056     AC_file.write("*EL PRINT , ELSET=Eall \n")
00057     AC_file.write("S \n")  #  (Cauchy) Stresses 
00058     # AC_file.write("** \n")
00059     #
00060     AC_file.write("*END STEP")
00061     #
00062     AC_file.close() 
00063     os.chdir(str(Casedir))
00064     if os.name != "posix":
00065         process = subprocess.Popen("type geometry_fe_input.inp Applied_Conditions.txt> final_fe_input.inp",shell=True)
00066         process.wait()
00067         process = subprocess.Popen("del /Q geometry_fe_input.inp",shell=True)
00068         process.wait()
00069     else:
00070         CommandLine = "cat Applied_Conditions.txt >> geometry_fe_input.inp"
00071 
00072 
00073     #
00074     return

Generated on Wed Nov 23 18:59:56 2011 for FreeCAD by  doxygen 1.6.1