From 83a559d8e9db9212fababa5b600190903efece62 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Mon, 14 Mar 2022 14:09:14 -0500 Subject: [PATCH 01/15] Added parametric study example --- .../example1d_SAM_ParametricStudy/README.md | 1 + .../example1d.py | 64 ++++ .../example1d_SAM_ParametricStudy/results.csv | 17 + .../sam_template | 336 ++++++++++++++++++ 4 files changed, 418 insertions(+) create mode 100644 examples/example1d_SAM_ParametricStudy/README.md create mode 100644 examples/example1d_SAM_ParametricStudy/example1d.py create mode 100644 examples/example1d_SAM_ParametricStudy/results.csv create mode 100644 examples/example1d_SAM_ParametricStudy/sam_template diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md new file mode 100644 index 00000000..918f6c82 --- /dev/null +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -0,0 +1 @@ +# Example1d - MOOSE/SAM Plugin diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py new file mode 100644 index 00000000..85d25ce5 --- /dev/null +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -0,0 +1,64 @@ +# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC +# SPDX-License-Identifier: MIT + +""" +This is a simple example to demonstrate how to use WATTS +to perform parametric study. This demonstration uses SAM +with a single-channel model. The input power of the channel +is varied. The demonstration also incudes an approach to +save selected results from different runs into a single +CSV file for easier comparison, visualization, post-processing. +""" + +from math import cos, pi +import os +import watts +import pandas as pd +from astropy.units import Quantity + + +params = watts.Parameters() + +# Input parameters to template file + +params['He_inlet_temp'] = Quantity(600, "Celsius") # 873.15 K +params['He_outlet_temp'] = Quantity(850, "Celsius") # 1123.15 K +params['He_cp'] = Quantity(4.9184126, "BTU/(kg*K)") # 5189.2 J/kg-K +params['He_K'] = 0.32802 # W/m-K +params['He_density'] = 3.8815 # kg/m3 +params['He_viscosity'] = 4.16e-5 # Pa.s +params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa +params['num_cool_pins'] = 1*6+2*6+6*2/2 +params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc +params['Lattice_pitch'] = 2.0 +params['FuelPin_rad'] = 0.90 # cm +params['cool_hole_rad'] = 0.60 # cm +params['Coolant_channel_diam'] = (params['cool_hole_rad'] * 2)/100 # in m +params['Graphite_thickness'] = (params['Lattice_pitch'] - params['FuelPin_rad'] - params['cool_hole_rad']) # cm + +params.show_summary(show_metadata=False, sort_by='key') + +# MOOSE Workflow +moose_app_type = "SAM" +app_dir = os.environ[moose_app_type.upper() + "_DIR"] + +power = [100000, 250000, 300000, 400000, 500000] # Watts +endtime = [50, 100, 100, 50, 50] # End time is varied to artificially create results of different lengths. +results_dict = {} # Create empty dictionary +for i in range(len(power)): + params['Tot_assembly_power'] = power[i] + params['endtime'] = endtime[i] + + # Execute WATTS + moose_plugin = watts.PluginMOOSE(moose_app_type.lower() + '_template') # show all the output + moose_plugin.moose_exec = app_dir + "/" + moose_app_type.lower() + "-opt" + moose_result = moose_plugin(params) + + # Add items to dictionary. + results_dict['time_'+str(i+1)] = moose_result.csv_data['time'] + results_dict['max_Tcoolant_'+str(i+1)] = moose_result.csv_data['max_Tcoolant'] + results_dict['max_Tw_'+str(i+1)] = moose_result.csv_data['max_Tw'] + +df = pd.DataFrame(dict([(k, pd.Series(v)) for k, v in results_dict.items()])) # Store dictionary items as dataframe. Columns of unequal lengths are padded with NaN. +df.reindex(sorted(df.columns), axis=1).to_csv('results.csv') # Sort column names alphabetically and save as CSV file. \ No newline at end of file diff --git a/examples/example1d_SAM_ParametricStudy/results.csv b/examples/example1d_SAM_ParametricStudy/results.csv new file mode 100644 index 00000000..67db6726 --- /dev/null +++ b/examples/example1d_SAM_ParametricStudy/results.csv @@ -0,0 +1,17 @@ +,max_Tcoolant_1,max_Tcoolant_2,max_Tcoolant_3,max_Tcoolant_4,max_Tcoolant_5,max_Tw_1,max_Tw_2,max_Tw_3,max_Tw_4,max_Tw_5,time_1,time_2,time_3,time_4,time_5 +0,873.15,873.15,873.15,873.15,873.15,873.15,873.15,873.15,873.15,873.15,0.0,0.0,0.0,0.0,0.0 +1,873.27104921286,873.43810086872,873.49065886366,873.59190621014,873.68855640385,873.28161009639,873.47591550168,873.53971354419,873.6657615605,873.7896951253,1.0,1.0,1.0,1.0,1.0 +2,873.48915321747,873.9513668803,874.09593841533,874.37324679071,874.63647787688,873.51686111721,874.05654234752,874.23313339839,874.58105473883,874.92183964822,2.25,2.25,2.25,2.25,2.25 +3,873.82194978879,874.72504661291,875.00506845726,875.5387550794,876.04104528075,873.87516282324,874.93590423349,875.28112249024,875.95831774038,876.61762676121,3.8125,3.8125,3.8125,3.8125,3.8125 +4,874.27343475392,875.76106198183,876.21726964285,877.07976558,877.88289449909,874.36231506049,876.12245829945,876.69120874201,877.80054902349,878.87213773414,5.765625,5.765625,5.765625,5.765625,5.765625 +5,874.8538848479,877.072824014,877.74430707176,879.00161116296,880.15757781373,874.9909666925,877.63884368919,878.48680672732,880.12907283705,881.70016989853,8.20703125,8.20703125,8.20703125,8.20703125,8.20703125 +6,875.58194423382,878.68797653503,879.6130093482,881.3253473059,882.87623449571,875.78317170824,879.52634436555,880.71180351804,882.9878448061,885.13979476113,11.2587890625,11.2587890625,11.2587890625,11.2587890625,11.2587890625 +7,876.48369397379,880.64317642372,881.85817511776,884.07669579887,886.05063536445,876.76999121326,881.84077515653,883.42452242952,886.43296758297,889.23702430754,15.073486328125,15.073486328125,15.073486328125,15.073486328125,15.073486328125 +8,877.5927620808,882.97994877943,884.51660469873,887.27655011714,889.68059765118,877.99223601368,884.64955696936,886.69273029612,890.52305326699,894.03146484253,19.841857910156,19.841857910156,19.841857910156,19.841857910156,19.841857910156 +9,878.95013382982,885.73874050643,887.61906534972,890.92940430644,893.73981639644,879.50107263029,888.02652607666,890.58562219037,895.30551850243,899.53698863573,25.802322387695,25.802322387695,25.802322387695,25.802322387695,25.802322387695 +10,880.60272774206,888.94902754307,891.17792354183,895.00734023247,898.15881886507,881.35755047396,892.04158649905,895.15952401279,900.79445261705,905.71548203674,33.252902984619,33.252902984619,33.252902984619,33.252902984619,33.252902984619 +11,882.600872861,892.61628293266,895.17176620727,899.43319984754,902.81105744982,883.63123864771,896.74533494383,900.43727507456,906.94441899222,912.45034622658,42.566128730774,42.566128730774,42.566128730774,42.566128730774,42.566128730774 +12,884.14251784475,896.70680642053,899.52935202219,902.48897213256,905.92375655658,885.40785598488,902.14783346776,906.38370510318,911.32509412447,917.11376520378,50.0,54.207660913467,54.207660913467,50.0,50.0 +13,,901.13250000791,904.11762199167,,,,908.19431753527,912.88091825956,,,,68.759576141834,68.759576141834,, +14,,905.73962467973,908.73622781101,,,,914.73933284292,919.70515198246,,,,86.949470177293,86.949470177293,, +15,,908.48960529517,911.3980152664,,,,918.79654965452,923.80513538894,,,,100.0,100.0,, diff --git a/examples/example1d_SAM_ParametricStudy/sam_template b/examples/example1d_SAM_ParametricStudy/sam_template new file mode 100644 index 00000000..2aef058a --- /dev/null +++ b/examples/example1d_SAM_ParametricStudy/sam_template @@ -0,0 +1,336 @@ + + {#- + Create variables + #} + {%- set Mass_flow_rate = Tot_assembly_power / (He_cp * (He_outlet_temp - He_inlet_temp)) %} + {%- set Channel_mass_flow_rate = Mass_flow_rate / num_cool_pins %} + {%- set Coolant_channel_XS = 3.14 * (Coolant_channel_diam/2)**2 %} + {%- set He_velocity = Channel_mass_flow_rate / (He_density * Coolant_channel_XS) %} + {%- set Re_num = Coolant_channel_diam * He_velocity * He_density / He_viscosity %} + {%- set Prandtl_num = He_cp * He_viscosity / He_K %} + {%- set F_blausius = (100*Re_num)**(-0.25) %} + {%- set Nu_DittBoe = 0.023 * (Re_num ** 0.8) * (Prandtl_num ** 0.4) %} + {%- set H_sam = Nu_DittBoe * He_K / Coolant_channel_diam %} + {%- set total_XS_coolant_area_per_fuel_assembly = Coolant_channel_XS * num_cool_pins %} + {%- set surface_area_den = num_fuel_pins * 3.14 * 2 * (FuelPin_rad + Graphite_thickness) / (100 * num_cool_pins * Coolant_channel_XS) %} + {%- set Power_fuel_pin = Tot_assembly_power / (num_fuel_pins) %} + {%- set graph_x = Coolant_channel_diam / 2 + Graphite_thickness / 100 %} + {%- set fuel_x = graph_x + FuelPin_rad / 100 %} + {#- + Render the parameters + #} + +[GlobalParams] + global_init_P = {{ He_Pressure }} + global_init_V = {{ He_velocity }} + global_init_T = {{ He_inlet_temp }} + gravity = '-9.8 0 0' + scaling_factor_var = '1 1e-3 1e-6' + Tsolid_sf = 1e-3 # Scaling factors for solid temperature +[] +[Functions] + active = 'power_dist kf cpf kclad cpclad rhoclad kgraphite cpgraphite rhographite kHe cpHe rhoHe muHe HHe beta_fn' + [./power_dist] # Function name + type = PiecewiseLinear # Function type + axis = x # X-co-ordinate is used for x + x = ' 0.0 0.5 1.0 1.5 2.0' + y = ' 1.0 1.0 1.0 1.0 1.0' + [../] + + + [./kf] #fuel thermal conductivity (UO2); x- Temperature [K], y- Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='600 700 800 900 1000 1100 1200 1300 1400 1500' + y ='55.6153061 51.02219975 47.11901811 43.95203134 41.16924224 38.85202882 36.89323509 35.04777834 33.20027175 31.3520767' + [../] + [./cpf] #fuel matrix specific heat (UO2); x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='44.87198213 57.09373669 71.35471375 87.81224925 106.6236791 127.9463393 151.9375658 178.7546944 208.5550611 241.4960019 277.7348528 317.4289495 360.7356281 407.8122246 458.8160748 513.9045146 573.2348801 636.9645072 705.2507318 778.2508898 856.1223171 939.0223498 1027.108324 1120.537575 1219.467439 1324.055252 1434.458351 1550.83407 1673.339746 1802.132715 1937.370313 2079.209875 2227.808738 2383.324238 2545.91371 2715.73449 2892.943915 3077.69932 3270.158042 3470.477415 3678.814777 3895.327463 4120.172809 4353.508151 4595.490824 4846.278166 5106.027511 5374.896196 5653.041556' + [../] + [./kclad] #clad therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='0 478.1709374 571.7659 668.7480342 769.1357153 871.2212698 969.9012774 1068.58496 1167.263743 1274.445367 2118.255351 5000' + y ='3.812850324 3.812850324 3.453993823 3.678279136 3.812850324 4.0819927 4.440849201 4.665134514 5.068848078 5.651989892 11.43855097 11.43855097' + [../] + [./cpclad] #clad specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='286.38 288.94 291.5 294.06 296.62 299.18 301.74 304.3 306.86 309.42 311.98 314.54 317.1 319.66 322.22 324.78 327.34 329.9 332.46 335.02 337.58 340.14 342.7 345.26 347.82 350.38 352.94 355.5 358.06 360.62 363.18 365.74 336.785 335.2703125 333.95125 332.8278125 331.9 331.1678125 330.63125 330.2903125 330.145 330.1953125 330.44125 330.8828125 331.52 332.3528125 333.38125 334.6053125 336.025' + [../] + [./rhoclad] #clad density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 1000 1025 1050 1075 1100 1125 1150 1175 1200 1225 1250 1275 1300 1325 1350 1375 1400 1425 1450 1475 1500' + y ='6550.89 6547.1975 6543.505 6539.8125 6536.12 6532.4275 6528.735 6525.0425 6521.35 6517.6575 6513.965 6510.2725 6506.58 6502.8875 6499.195 6495.5025 6491.81 6488.1175 6484.425 6480.7325 6477.04 6473.3475 6469.655 6465.9625 6462.27 6458.5775 6454.885 6451.1925 6447.5 6443.8075 6440.115 6436.4225 6485.95 6481.3125 6476.675 6472.0375 6467.4 6462.7625 6458.125 6453.4875 6448.85 6444.2125 6439.575 6434.9375 6430.3 6425.6625 6421.025 6416.3875 6411.75' + [../] + [./kgraphite] #G-348 graphite therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='133.02 128.54 117.62 106.03 96.7 88.61 82.22 76.52 71.78 67.88 64.26' + [../] + [./cpgraphite] #G-348 graphite specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='726.19 933.15 1154.47 1341.07 1486.83 1603.53 1697.43 1773.6 1835.58 1886.68 1929.44' + [../] + [./rhographite] #G-348 graphite density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='295.75 374.15 472.45 574.75 674.75 774.75 874.75 974.85 1074.45 1173.95 1274.05' + y ='1888.5 1886.3 1883.5 1880.4 1877.2 1873.9 1870.5 1867 1863.4 1859.6 1855.7' + [../] + [./kHe] #Helium therm. cond; x- Temperature [K], y-Thermal condiuctivity [W/m-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.16053 0.16754 0.17444 0.18123 0.18792 0.19451 0.20102 0.20743 0.21377 0.22003 0.22622 0.23233 0.23838 0.24437 0.2503 0.25616 0.26198 0.26773 0.27344 0.27909 0.2847 0.29026 0.29578 0.30126 0.30669 0.31208 0.31743 0.32275 0.32802 0.33327 0.33847 0.34365 0.34879 0.3539 0.35897 0.36402 0.36904 0.37403 0.37899 0.38392 0.38883 0.39371 0.39856 0.40339 0.4082 0.41298 0.41774 0.42248 0.42719 0.43188 0.43655 0.4412 0.44583 0.45043 0.45502 0.45959 0.46414 0.46867 0.47318 0.47767 0.48215' + [../] + [./muHe] #Helium viscosity; x- Temperature [K], y-viscosity [Pa.s] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='0.00002016 0.0002148 0.000021921 0.000022782 0.00002363 0.000024467 0.000025294 0.00002611 0.000026917 0.000027715 0.000028504 0.000029285 0.000030058 0.000030823 0.000031582 0.000032333 0.000033078 0.000033816 0.000034549 0.000035275 0.000035996 0.000036711 0.00003742 0.000038125 0.000038825 0.00003952 0.00004021 0.000040895 0.000041576 0.000042253 0.000042926 0.000043595 0.00004426 0.00004492 0.000045578 0.000046231 0.000046881 0.000047528 0.000048171 0.000048811 0.000049447 0.000050081 0.000050711 0.000051338 0.000051963 0.000052584 0.000053203 0.000053818 0.000054432 0.000055042 0.00005565 0.000056255 0.000056858 0.000057458 0.000058056 0.000058651 0.000059244 0.000059835 0.000060424 0.00006101 0.000061594' + [../] + [./cpHe] #Helium specific heat; x- Temperature [K], y- sp. heat [J/kg-K] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='5188.5 5188 5187.6 5187.4 5187.2 5187.2 5187.1 5187.2 5187.2 5187.3 5187.4 5187.5 5187.6 5187.7 5187.8 5187.9 5188 5188.1 5188.2 5188.3 5188.4 5188.5 5188.7 5188.8 5188.8 5188.9 5189 5189.1 5189.2 5189.3 5189.4 5189.5 5189.5 5189.6 5189.7 5189.7 5189.8 5189.9 5189.9 5190 5190.1 5190.1 5190.2 5190.2 5190.3 5190.3 5190.4 5190.4 5190.5 5190.5 5190.6 5190.6 5190.7 5190.7 5190.7 5190.8 5190.8 5190.8 5190.9 5190.9 5190.9' + [../] + [./rhoHe] #Helium density; x- Temperature [K], y- density [kg/m3] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='10.883 10.225 9.6425 9.1224 8.6555 8.234 7.8516 7.5031 7.1842 6.8912 6.6212 6.3715 6.14 5.9246 5.7239 5.5363 5.3605 5.1956 5.0405 4.8944 4.7565 4.6262 4.5028 4.3858 4.2747 4.1691 4.0686 3.9729 3.8815 3.7942 3.7108 3.6309 3.5545 3.4811 3.4108 3.3432 3.2782 3.2157 3.1556 3.0976 3.0418 2.9879 2.9359 2.8857 2.8371 2.7902 2.7448 2.7009 2.6583 2.617 2.577 2.5383 2.5006 2.4641 2.4286 2.3941 2.3606 2.328 2.2963 2.2655 2.2354' + [../] + [./HHe] #Helium Enthalpy; x- Temperature [K], y- denthalpy [j/kg] + type = PiecewiseLinear + x ='300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500' + y ='1585700 1689500 1793300 1897000 2000800 2104500 2208200 2312000 2415700 2519500 2623200 2727000 2830700 2934500 3038200 3142000 3245700 3349500 3453300 3557000 3660800 3764600 3868300 3972100 4075900 4179700 4283400 4387200 4491000 4594800 4698600 4802400 4906200 5010000 5113700 5217500 5321300 5425100 5528900 5632700 5736500 5840300 5944100 6047900 6151700 6255600 6359400 6463200 6567000 6670800 6774600 6878400 6982200 7086000 7189800 7293700 7397500 7501300 7605100 7708900 7812700' + [../] + [./beta_fn] + type = PiecewiseLinear + x = '300 2000' + y = '0 0' + [../] + + [./T_max_fuel] + type = ParsedFunction + value = Tf1+Tf2 + vars = 'Tf1 Tf2' + vals = 'max_Tf_1 max_Tf_2' + [../] + +[] +[EOS] + [./eos] + type = PTFluidPropertiesEOS + p_0 = {{ He_Pressure }} # Pa + fp = fluid_props1 + [../] +[] +[MaterialProperties] + [./fluid_props1] + type = FunctionFluidProperties + rho = rhoHe + beta = beta_fn + cp = cpHe + mu = muHe + k = kHe + enthalpy = HHe + [../] + [./fuel-mat] # Material name + type = SolidMaterialProps + k = kf # Thermal conductivity + Cp = cpf # Specific heat + rho = 1.104e4 # Density + [../] + [./clad-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./graphite-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] + [./leadBUF-mat] # Material name + type = SolidMaterialProps + k = kgraphite # Thermal conductivity + Cp = cpgraphite # Specific heat + rho = rhographite # Density + [../] +[] +[Components] + [./reactor] + type = ReactorPower + initial_power = {{ Tot_assembly_power }} # Initial total reactor power + [../] + + [./CH1] # Component name + type = PBCoreChannel # PBCorechannel component + eos = eos # The equation-of-state name + position = '0 {{Height_FC/5 * 0}} 0' + orientation = '0 1 0' + assembly_type = Block-Channel + n_rods = {{ num_fuel_pins }} + A = {{ total_XS_coolant_area_per_fuel_assembly }} + Dh = {{ Coolant_channel_diam }} + length = {{ Height_FC/5 }} + n_elems = 20 + f = {{ F_blausius }} # User specified friction coefficient (Blausis f=(100 Re)^-0.25 + Hw = {{ H_sam }} # User specified heat transfer coefficient (Dittus-Boelter) + HT_surface_area_density = {{ surface_area_den }} # Heat transfer surface area density, Ph/Ac + name_of_hs = 'fuel graphite' # Heat structure names + Ts_init = {{ He_inlet_temp }} # Initial structure temeprature + n_heatstruct = 2 # Number of heat structures + fuel_type = cylinder # Fuel geometric type, cylinder or plate + width_of_hs = '{{FuelPin_rad/100}} {{ Graphite_thickness/100 }}' # The width of all heat structures + elem_number_of_hs = '50 10' # The element numbers of all heat structures + material_hs = 'fuel-mat graphite-mat' # The material used for all heat structures + power_fraction = '0.2 0.0' # The power fractions of all heat structures + power_shape_function = power_dist # the axial power shape function name + [../] + + [./inlet] #Boundary components + type = PBTDJ + input = 'CH1(in)' + v_bc = {{ He_velocity }} + T_bc = {{ He_inlet_temp }} + eos = eos + [../] + [./outlet] + type = PBTDV + input = 'CH1(out)' + p_bc = '{{ He_Pressure }}' + T_bc = {{ He_outlet_temp }} + eos = eos + [../] +[] +[Postprocessors] + +# [max_Tf] +# type = ParsedPostprocessor +# function = 'max(max(max_Tf_1,max_Tf_2),max(max_Tf_3,max(max_Tf_4,max_Tf_5)))' +# pp_names = 'max_Tf_1 max_Tf_2 max_Tf_3 max_Tf_4 max_Tf_5' +# [] +# +# [avg_Tgraphite] +# type = ParsedPostprocessor +# function = '(avg_Tgraphite_1+avg_Tgraphite_2+avg_Tgraphite_3+avg_Tgraphite_4+avg_Tgraphite_5)/5' +# pp_names = 'avg_Tgraphite_1 avg_Tgraphite_2 avg_Tgraphite_3 avg_Tgraphite_4 avg_Tgraphite_5' +# [] + + [./max_Tcoolant] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = temperature + [../] + [./max_Tw] # Output maximum wall temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = Tw + [../] + [./max_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./max_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = NodalMaxValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] + [./max_Pcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = NodalMaxValue + block = 'CH1:pipe' + variable = pressure + [../] + [./avg_Tcoolant_1] # Output maximum fluid temperature of block CH1:pipe + type = ElementAverageValue + block = 'CH1:pipe' + variable = temperature + [../] + [./avg_Tf_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:fuel' + variable = T_solid + [../] + [./avg_Tgraphite_1] # Output maximum solid temperature of block CH1: solid:fuel + type = ElementAverageValue + block = 'CH1:solid:graphite' + variable = T_solid + [../] +[] + +#[VectorPostprocessors] +# [./vel] +# type = LineValueSampler +# variable = velocity +# start_point = '0 0 0' +# end_point = '0 {{ Height_FC/5 }} 0' +# num_points = 21 +# use_displaced_mesh = true +# sort_by = id +# [../] +#[] + +[Preconditioning] + active = 'SMP_PJFNK' + [./SMP_PJFNK] + type = SMP + full = true + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type' + petsc_options_value = 'lu' + [../] +[] + +[Executioner] + type = Transient + #petsc_options_iname = '-ksp_gmres_restart' + #petsc_options_value = '100' + + dt = 1 + dtmin = 1.e-5 + start_time = 0 + end_time = {{ endtime }} + dtmax = 50.0 + nl_rel_tol = 1e-8 + l_tol = 1e-07 + nl_abs_tol = 1e-6 + nl_max_its = 30 + l_max_its = 200 + + [./TimeStepper] + type = IterationAdaptiveDT + growth_factor = 1.25 + optimal_iterations = 8 + linear_iteration_ratio = 150 + dt = 1 + cutback_factor = 0.8 + cutback_factor_at_failure = 0.8 + [../] + [./Quadrature] + type = SIMPSON + order = SECOND + [../] +[] + +[Outputs] + print_linear_residuals = false + perf_graph = true + [./out] + type = Checkpoint + [../] + [./console] + type = Console + [../] + [./out_displaced] + type = Exodus + use_displaced = true + execute_on = 'initial timestep_end' + sequence = false + [../] + [./csv] + type = CSV + [../] +[] From cfb09f03252d26d80eba95a93cfbacba4ae0686b Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Mon, 14 Mar 2022 14:32:47 -0500 Subject: [PATCH 02/15] Update README.md --- .../example1d_SAM_ParametricStudy/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index 918f6c82..3feb675a 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -1 +1,19 @@ # Example1d - MOOSE/SAM Plugin + +## Purpose + +This example provides a demonstration on how to use WATTS to perform multiple runs and save selected outputs from all runs to a single '.csv' file for ease of comparison, post-processing, and visualization. + +## Code(s) + + +## Keywords + + +## Notes From c58ff8c28c1dc791380b2c8b08b7994ef9a999d2 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Mon, 14 Mar 2022 14:42:41 -0500 Subject: [PATCH 03/15] Updated description in example file --- .../example1d_SAM_ParametricStudy/example1d.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 85d25ce5..e05c6fcd 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -2,12 +2,17 @@ # SPDX-License-Identifier: MIT """ -This is a simple example to demonstrate how to use WATTS -to perform parametric study. This demonstration uses SAM -with a single-channel model. The input power of the channel -is varied. The demonstration also incudes an approach to -save selected results from different runs into a single -CSV file for easier comparison, visualization, post-processing. +This example demonstrates how to use WATTS to perform +multiple runs and extract selected results from the runs. +The demonstration incudes an approach to save selected +results from different runs into a single CSV file for +ease of comparison, visualization, post-processing. +This demonstration uses SAM with a single PbCoreChannel +with a inlet and outlet boundary conditions. The input +power of the channel is varied. The simulation is run +as transient where the end time is varied to artificially +create results of different lengths to show that the +output CSV file can accept columns of different lengths. """ from math import cos, pi From 339b4ab8ceab8e4d51e22151838d8edd230e4bc0 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:33:58 -0500 Subject: [PATCH 04/15] Update examples/example1d_SAM_ParametricStudy/README.md Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index 3feb675a..d69472e3 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -5,9 +5,8 @@ This example provides a demonstration on how to use WATTS to perform multiple runs and save selected outputs from all runs to a single '.csv' file for ease of comparison, post-processing, and visualization. ## Code(s) -
    -
  • SAM
  • -
+ +- SAM ## Keywords
    From 542967e76c5a1fde1ff4ef6c4e454fc00b8fa570 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:34:10 -0500 Subject: [PATCH 05/15] Update examples/example1d_SAM_ParametricStudy/README.md Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index d69472e3..95ebd22c 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -9,10 +9,9 @@ This example provides a demonstration on how to use WATTS to perform multiple ru - SAM ## Keywords -
      -
    • Parametric study
    • -
    • Results extraction
    • -
    • Post-processing
    • -
    + +- Parametric study +- Results extraction +- Post-processing ## Notes From 057e49f8014933bae37646770e84911b825e7d93 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:34:17 -0500 Subject: [PATCH 06/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index e05c6fcd..34c77b82 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -4,7 +4,7 @@ """ This example demonstrates how to use WATTS to perform multiple runs and extract selected results from the runs. -The demonstration incudes an approach to save selected +The demonstration includes an approach to save selected results from different runs into a single CSV file for ease of comparison, visualization, post-processing. This demonstration uses SAM with a single PbCoreChannel From 766d377c8772574297424bb35c46a7b82df834ec Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:34:28 -0500 Subject: [PATCH 07/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 34c77b82..8a836f7c 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -8,7 +8,7 @@ results from different runs into a single CSV file for ease of comparison, visualization, post-processing. This demonstration uses SAM with a single PbCoreChannel -with a inlet and outlet boundary conditions. The input +with inlet and outlet boundary conditions. The input power of the channel is varied. The simulation is run as transient where the end time is varied to artificially create results of different lengths to show that the From bc6eee2dded09522ca3798970a76cec0f2b7952e Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:34:34 -0500 Subject: [PATCH 08/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 8a836f7c..53b489fc 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -33,8 +33,8 @@ params['He_density'] = 3.8815 # kg/m3 params['He_viscosity'] = 4.16e-5 # Pa.s params['He_Pressure'] = Quantity(1015.264164, "psi") # 7e6 Pa -params['num_cool_pins'] = 1*6+2*6+6*2/2 -params['num_fuel_pins'] = 6+6+6+3*6+2*6/2+6/3 +params['num_cool_pins'] = 1*6 + 2*6 + 6*2/2 +params['num_fuel_pins'] = 6 + 6 + 6 + 3*6 + 2*6/2 + 6/3 params['Height_FC'] = Quantity(2000, "mm") # Automatically converts to 'm' for MOOSE and 'cm' for openmc params['Lattice_pitch'] = 2.0 params['FuelPin_rad'] = 0.90 # cm From 538218cb264636a9bd824ca167b105903a076a92 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:34:41 -0500 Subject: [PATCH 09/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 53b489fc..94e7bf48 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -48,7 +48,7 @@ moose_app_type = "SAM" app_dir = os.environ[moose_app_type.upper() + "_DIR"] -power = [100000, 250000, 300000, 400000, 500000] # Watts +power = [100_000, 250_000, 300_000, 400_000, 500_000] # Watts endtime = [50, 100, 100, 50, 50] # End time is varied to artificially create results of different lengths. results_dict = {} # Create empty dictionary for i in range(len(power)): From 1b7f64842d72cb296eb8c6a61980b2fc9df9a2d2 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:35:04 -0500 Subject: [PATCH 10/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 94e7bf48..43ea9f37 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -61,9 +61,9 @@ moose_result = moose_plugin(params) # Add items to dictionary. - results_dict['time_'+str(i+1)] = moose_result.csv_data['time'] - results_dict['max_Tcoolant_'+str(i+1)] = moose_result.csv_data['max_Tcoolant'] - results_dict['max_Tw_'+str(i+1)] = moose_result.csv_data['max_Tw'] + results_dict[f'time_{i+1}'] = moose_result.csv_data['time'] + results_dict[f'max_Tcoolant_{i+1}'] = moose_result.csv_data['max_Tcoolant'] + results_dict[f'max_Tw_{i+1}'] = moose_result.csv_data['max_Tw'] df = pd.DataFrame(dict([(k, pd.Series(v)) for k, v in results_dict.items()])) # Store dictionary items as dataframe. Columns of unequal lengths are padded with NaN. df.reindex(sorted(df.columns), axis=1).to_csv('results.csv') # Sort column names alphabetically and save as CSV file. \ No newline at end of file From b9c87336e6dd40a3b852822f6e10f4447934651d Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:35:11 -0500 Subject: [PATCH 11/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 43ea9f37..36ae52a2 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -65,5 +65,8 @@ results_dict[f'max_Tcoolant_{i+1}'] = moose_result.csv_data['max_Tcoolant'] results_dict[f'max_Tw_{i+1}'] = moose_result.csv_data['max_Tw'] -df = pd.DataFrame(dict([(k, pd.Series(v)) for k, v in results_dict.items()])) # Store dictionary items as dataframe. Columns of unequal lengths are padded with NaN. -df.reindex(sorted(df.columns), axis=1).to_csv('results.csv') # Sort column names alphabetically and save as CSV file. \ No newline at end of file +# Store dictionary items as dataframe. Columns of unequal lengths are padded with NaN. +df = pd.DataFrame({k: pd.Series(v) for k, v in results_dict.items()}) + +# Sort column names alphabetically and save as CSV file +df.sort_index(axis=1).to_csv('results.csv') \ No newline at end of file From 0c6ad4d1692d84c4788bd709dbaeeafdfe832171 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi <35579376+zhieejhia93@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:35:21 -0500 Subject: [PATCH 12/15] Update examples/example1d_SAM_ParametricStudy/example1d.py Co-authored-by: Paul Romano --- examples/example1d_SAM_ParametricStudy/example1d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example1d_SAM_ParametricStudy/example1d.py b/examples/example1d_SAM_ParametricStudy/example1d.py index 36ae52a2..55675e44 100644 --- a/examples/example1d_SAM_ParametricStudy/example1d.py +++ b/examples/example1d_SAM_ParametricStudy/example1d.py @@ -6,7 +6,7 @@ multiple runs and extract selected results from the runs. The demonstration includes an approach to save selected results from different runs into a single CSV file for -ease of comparison, visualization, post-processing. +ease of comparison, visualization, and post-processing. This demonstration uses SAM with a single PbCoreChannel with inlet and outlet boundary conditions. The input power of the channel is varied. The simulation is run From 36cf162e9d9c97e8bbdbaf38bb76178521755ffb Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Wed, 16 Mar 2022 08:40:13 -0500 Subject: [PATCH 13/15] Removed unsed heading in README --- examples/example1d_SAM_ParametricStudy/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index 95ebd22c..786dabef 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -12,6 +12,4 @@ This example provides a demonstration on how to use WATTS to perform multiple ru - Parametric study - Results extraction -- Post-processing - -## Notes +- Post-processing \ No newline at end of file From 3570bb89257e84a0cba0a6becd755dd03c5cd5a0 Mon Sep 17 00:00:00 2001 From: Zhiee Jhia Ooi Date: Thu, 17 Mar 2022 11:40:14 -0500 Subject: [PATCH 14/15] Added file descriptions to README.md --- examples/example1d_SAM_ParametricStudy/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index 786dabef..fe409e3f 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -12,4 +12,10 @@ This example provides a demonstration on how to use WATTS to perform multiple ru - Parametric study - Results extraction -- Post-processing \ No newline at end of file +- Post-processing + +## File descriptions + +- example1d.py: WATTS workflow for this example. This is the file to execute to run the problem described above. +- sam_template: SAM templated input file. +- results.csv: An example of CSV file that will be generated through running this example. \ No newline at end of file From 6aa21803e81ed356cfc4819e65effc9c0a0fa46a Mon Sep 17 00:00:00 2001 From: Nicolas Stauff <67026396+nstauff@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:49:20 -0500 Subject: [PATCH 15/15] Update README.md Added links to the files. --- examples/example1d_SAM_ParametricStudy/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/example1d_SAM_ParametricStudy/README.md b/examples/example1d_SAM_ParametricStudy/README.md index fe409e3f..344b442c 100644 --- a/examples/example1d_SAM_ParametricStudy/README.md +++ b/examples/example1d_SAM_ParametricStudy/README.md @@ -16,6 +16,6 @@ This example provides a demonstration on how to use WATTS to perform multiple ru ## File descriptions -- example1d.py: WATTS workflow for this example. This is the file to execute to run the problem described above. -- sam_template: SAM templated input file. -- results.csv: An example of CSV file that will be generated through running this example. \ No newline at end of file +- [__example1d.py__](example1d.py): WATTS workflow for this example. This is the file to execute to run the problem described above. +- [__sam_template__](sam_template): SAM templated input file. +- [__results.csv__](results.csv): An example of CSV file that will be generated through running this example.