parent=basecase, data={"desc": "This is the 1st child loadcase."}) gc1 = Premise("gchild lc1", parent=lc1, data={"desc": "This is the 1st child loadcase."}) lc2 = Premise("Load case 2", parent=basecase, data={"desc": "This is the 2nd child loadcase."}) basecase.plugin_func("pressure_containment_all", "pdover2t.dnvgl_st_f101") lc1.rho_cont = np.linspace(100, 1000, 10) print("lc1.rho_cont", lc1.rho_cont) resdict = lc1.pressure_containment_all() print(resdict["p_cont_uty"]) lc1_pcont = Premise("GROUP: lc1 press contain", parent=lc1, data={"desc": "Group lc1 pressure contain calcs."}) _uty = lc1_pcont.pressure_containment_all(rho_cont=100) print("lc1_pcont (rho_cont=100) ", _uty) lc2_pcont = Calc("CallNode: lc2 press contain", parent=lc2, data={"desc": "Group lc2 pressure contain calcs."}, funcname="pressure_containment_all") lc2_pcont.rho_cont = np.linspace(100, 1000, 10) lc2_pcont() basecase.savefile()
lc1_unity = Calc("Stress unity check", lc1_pstress, funcname="allowable_stress_unity_check", argmap={ "sigma": "_pipe_hoop_stress", "allowable": "ys", "df": "design_factor", }) # lc2 = Premise("LoadCase2, pressure 20 bar.", basecase) # lc3 = Premise("LoadCase3, pressure 25 bar.", basecase, # parameters={ # "P": 25 * 10**5, # pipe internal pressure in Pa # } ) lc2 = basecase.add_child(lc1.copy()) lc2.name = "LoadCase2, pressure 20 bar." lc2.P = 20 * 10**5 lc3 = basecase.add_child(lc1.copy()) lc3.name = "LoadCase3, pressure 25 bar." lc3.P = 25 * 10**5 for _n in basecase: if callable(_n): _n() basecase.savefile(study_file) if OPEN_EXISTING_STUDY: print(f"Open Existing study from `pflacs` file «{study_file}».") #print("locals()", locals()) basecase = Premise.openfile(study_file)
base.plugin_func(seawater.dens) base.add_param("rho_seawater_check", desc="calculated water density (kg/m3)") base.rho_seawater_check = base.dens() print( f'{base.get_param_desc("rho_seawater_check")} = {base.rho_seawater_check}') if base.rho_seawater != base.rho_seawater_check: print( f"Warning: calculated seawater density {base.rho_seawater_check} not equal to assumed value {base.rho_seawater}." ) base.plugin_func(numpy.interp, argmap={ "x": "S", "xp": "salinities", "fp": "densities" }, newname="interp_water_density") base.add_param("salinities", desc="water salinity range") base.add_param("densities", desc="water density range") base.salinities = numpy.linspace(30, 40, 11) base.densities = base.dens(S=base.salinities) rho_interp = base.interp_water_density() print(f"Interpolated water density = {rho_interp}, for salinity = {base.S} ") rho_interp = base.interp_water_density(S=39.5) print(f"Interpolated water density = {rho_interp}, for salinity = 39.5 ") base.savefile("external_libs_test.pflacs")
parameters={ "KP": [0.3, 15.0], "h_l": -420, "LC": 1, "D": 0.6172 + 2*0.0242, "t": 0.0242, }, data={"desc": "P-01 section 2, KP 0.3-15."}) P01_3 = Premise("P-01 section 3, KP 15-79.7", parent=P01, parameters={ "KP": [15.0, 79.7], "LC": 1, "D": 0.6172 + 2*0.0214, "t": 0.0214, }, data={"desc": "P-01 section 3, KP 15-79.7."}) rootnode.plugin_func("pressure_containment_all", "pdover2t.dnvgl_st_f101") rootnode.plugin_func("pipe_collapse_all", "pdover2t.dnvgl_st_f101") lc1_cont = Calc("Calc: lc2 press contain", parent=P01_1, parameters={ "h_l": -370, }, data={"desc": "Group lc2 pressure contain calcs."}, funcname="pressure_containment_all") rootnode.savefile()