Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master python script runs fds and python experiment script. #167

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added Scripts/bl
Empty file.
3 changes: 3 additions & 0 deletions Verification/Kinetics/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Verification/Kinetics/.idea/Kinetics.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Verification/Kinetics/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Verification/Kinetics/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Verification/Kinetics/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions Verification/Kinetics/Master.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import subprocess
import argparse
#import csv
import json
import os


# create the parser
parser = argparse.ArgumentParser()
# add an argument
parser.add_argument('experiment')
parser.add_argument('material')

# parse arguments
args = parser.parse_args()

material = 'MaCFP_PMMA_NIST'

year = str(2021)
json_file_path = '../../PMMA/Material_Properties/' + year + '/' + args.material + '.json'


# read the json file
try:
with open(json_file_path, 'r') as file:
year = str(2021)
kdata = json.load(file)
except:
year = str(2023)
with open(json_file_path, 'r') as file:
kdata = json.load(file)

A = kdata['Kinetics']['Pre-exponential'] # pre-exponential , 1/s
E = kdata['Kinetics']['Activation Energy'] # activation energy , J/mol




# Read fds script
with open('properties.txt', 'r') as file:
file_lines = file.readlines()
# Write fds script
file_lines[6] = " A(1) = " + str(A) + "\n"
file_lines[7] = " E(1) = " + str(E) + "\n"

file_lines[20] = " A(1) = " + str(A) + "\n"
file_lines[21] = " E(1) = " + str(E) + "\n"
with open('properties.txt', 'w') as file:
for line in file_lines:
file.write(line)



os.system('cmd /c "fds_local NIST_TGA_10K.fds"')# NIST_TGA_10K.fds"')#NIST_TGA_10K$$$$




# run experiment
subprocess.run(["py", args.experiment + ".py",args.material])

#remove unnecesary fds files
try:
os.remove("NIST_TGA_10K_cat_steps.csv")
os.remove("NIST_TGA_10K_cat.binfo")
os.remove("NIST_TGA_10K_cat.end")
os.remove("NIST_TGA_10K_cat.out")
os.remove("NIST_TGA_10K_cat.sinfo")
os.remove("NIST_TGA_10K_cat.smv")
os.remove("NIST_TGA_10K_cat_1_1.s3d")
os.remove("NIST_TGA_10K_cat_1_2.s3d")
os.remove("NIST_TGA_10K_cat_1_2.s3d.sz")
os.remove("NIST_TGA_10K_cat_1_3.s3d")
os.remove("NIST_TGA_10K_cat_1_3.s3d.sz")
os.remove("NIST_TGA_10K_cat_git.txt")
os.remove("NIST_TGA_10K_cat_hrr.csv")
os.remove("NIST_TGA_10K_cat_cpu.csv")
os.remove("NIST_TGA_10K_cat_1_1.s3d.sz")

os.remove("NIST_TGA_10K_cat_devc.csv")

except:
exc = 1
35 changes: 35 additions & 0 deletions Verification/Kinetics/NIST_TGA_10K.fds
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
&HEAD CHID='NIST_TGA_10K', TITLE='5 mg of Black PMMA heated at 10 K/min' /

&MESH IJK=3,3,3, XB=-0.015,0.015,-0.015,0.015,0.000,0.030 /

&TIME T_END=500., WALL_INCREMENT=1, DT=0.1 /

&MISC TMPA=27., Y_O2_INFTY=0.001 /

&RADI RADIATION=F /

&CATF OTHER_FILES='properties.txt' /

&SURF ID='PMMA BC'
COLOR='BLACK'
TMP_GAS_FRONT=727., RAMP_TMP_GAS_FRONT='T-ramp'
HEAT_TRANSFER_COEFFICIENT=500.
N_LAYER_CELLS_MAX=1
MATL_ID='BLACK PMMA'
BACKING='INSULATED'
THICKNESS=0.0001 /

&RAMP ID='T-ramp', T= 0., F=0. /
&RAMP ID='T-ramp', T=4200., F=1. /

&VENT XB=-0.005,0.005,-0.005,0.005,0.000,0.000, SURF_ID='PMMA BC' /

&DUMP DT_DEVC=6. /

&DEVC ID='Temperature', XYZ=0,0,0, IOR=3, QUANTITY='WALL TEMPERATURE', CONVERSION_ADDEND=273.15, UNITS='[K]' /
&DEVC ID='Mass', XYZ=0,0,0, IOR=3, QUANTITY='NORMALIZED MASS', CONVERSION_FACTOR=5, UNITS='[mg]' /
&DEVC ID='Heat Flow', XYZ=0,0,0, IOR=3, QUANTITY='NORMALIZED HEATING RATE', UNITS='[W/g]' /

&TAIL /


80 changes: 80 additions & 0 deletions Verification/Kinetics/NIST_TGA_10K_cat.fds
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
&HEAD CHID='NIST_TGA_10K_cat', TITLE='(Concatenated) 5 mg of Black PMMA heated at 10 K/min' /

&MESH IJK=3,3,3, XB=-0.015,0.015,-0.015,0.015,0.000,0.030 /

&TIME T_END=500., WALL_INCREMENT=1, DT=0.1 /

&MISC TMPA=27., Y_O2_INFTY=0.001 /

&RADI RADIATION=F /


&SURF ID='PMMA BC'
COLOR='BLACK'
TMP_GAS_FRONT=727., RAMP_TMP_GAS_FRONT='T-ramp'
HEAT_TRANSFER_COEFFICIENT=500.
N_LAYER_CELLS_MAX=1
MATL_ID='BLACK PMMA'
BACKING='INSULATED'
THICKNESS=0.0001 /

&RAMP ID='T-ramp', T= 0., F=0. /
&RAMP ID='T-ramp', T=4200., F=1. /

&VENT XB=-0.005,0.005,-0.005,0.005,0.000,0.000, SURF_ID='PMMA BC' /

&DUMP DT_DEVC=6. /

&DEVC ID='Temperature', XYZ=0,0,0, IOR=3, QUANTITY='WALL TEMPERATURE', CONVERSION_ADDEND=273.15, UNITS='[K]' /
&DEVC ID='Mass', XYZ=0,0,0, IOR=3, QUANTITY='NORMALIZED MASS', CONVERSION_FACTOR=5, UNITS='[mg]' /
&DEVC ID='Heat Flow', XYZ=0,0,0, IOR=3, QUANTITY='NORMALIZED HEATING RATE', UNITS='[W/g]' /

# Start of file properties.txt :
&SPEC ID='MMA', FORMULA='C5H8O2', SPECIFIC_HEAT=1.1, RADCAL_ID='MMA', SIGMALJ=4.701, EPSILONKLJ=205.78 /

&REAC FUEL='MMA', SOOT_YIELD=0.022, CO_YIELD=0.01, RADIATIVE_FRACTION=0.31 / Tewarson, 4th SFPE Handbook, Table 3-4.16

&MATL ID='BLACK PMMA'
ABSORPTION_COEFFICIENT=2870.
A(1) = 28500000000000.0
E(1) = 191000.0
EMISSIVITY=0.96
DENSITY= 1210.
SPEC_ID='MMA'
NU_SPEC= 0.02
MATL_ID='PMMA_INT'
NU_MATL=0.98
CONDUCTIVITY_RAMP ='k_PMMA'
SPECIFIC_HEAT_RAMP = 'cp_PMMA'
HEAT_OF_REACTION = 5. /

&MATL ID='PMMA_INT'
ABSORPTION_COEFFICIENT=2870.
A(1) = 28500000000000.0
E(1) = 191000.0
EMISSIVITY=0.96
DENSITY= 1210.
SPEC_ID='MMA'
NU_SPEC= 0.98
MATL_ID='PMMA_CHAR'
NU_MATL=0.02
CONDUCTIVITY_RAMP ='k_PMMA'
SPECIFIC_HEAT_RAMP = 'cp_PMMA'
HEAT_OF_REACTION = 817. /

&MATL ID='PMMA_CHAR'
ABSORPTION_COEFFICIENT=2870.
EMISSIVITY=0.96
DENSITY=1210.
CONDUCTIVITY_RAMP = 'k_PMMA'
SPECIFIC_HEAT_RAMP = 'cp_PMMA' /

&RAMP ID='k_PMMA', T= 20., F=0.160 /
&RAMP ID='k_PMMA', T=122., F=0.160 /
&RAMP ID='k_PMMA', T=500., F=0.015 /

&RAMP ID='cp_PMMA', T= 20., F=1.05 /
&RAMP ID='cp_PMMA', T=122., F=1.90 /
&RAMP ID='cp_PMMA', T=500., F=3.22 /

&TAIL /
Loading