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
00003 import os,subprocess
00004
00005 AC_file = open (str(Casedir + "/" + "Applied_Conditions.txt"),'w')
00006
00007
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
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
00024 AC_file.write("*SOLID SECTION, ELSET=Eall, MATERIAL=%s \n" %MAT_NAME)
00025 AC_file.write("** \n")
00026
00027
00028 AC_file.write("** LOAD :\n")
00029
00030
00031
00032
00033 AC_file.write("*INITIAL CONDITIONS, TYPE=STRESS, USER \n")
00034
00035
00036 AC_file.write("** \n")
00037 AC_file.write("*STEP \n")
00038 AC_file.write("*STATIC \n")
00039
00040
00041
00042
00043
00044 AC_file.write("** OUTPUT REQUESTS \n")
00045
00046
00047 AC_file.write("*NODE FILE \n")
00048 AC_file.write("U \n")
00049
00050 AC_file.write("*EL FILE \n")
00051 AC_file.write("S \n")
00052
00053 AC_file.write("*NODE PRINT , NSET=Nall \n")
00054 AC_file.write("U \n")
00055
00056 AC_file.write("*EL PRINT , ELSET=Eall \n")
00057 AC_file.write("S \n")
00058
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