5. Solver Module#
This module contains the solver functions of BuckPy.
- buckpy.buckpy_solver.calc_fric_forces(np_array, restr_left, restr_right)[source]#
Accumulate friction forces from each end of the array. The calculated values are at the center of each element, accounting for the average increase between the element and its surrounding elements.
- Parameters:
np_array (numpy.ndarray) – Array containing the local friction force for each element without accounting for surrounding values.
restr_left (float) – Constant force to be added at the left of the force profile.
restr_right (float) – Constant force to be added at the right of the force profile.
- Returns:
np_cumsum_left (numpy.ndarray) – Cumulated friction force from the left.
np_cumsum_right (numpy.ndarray) – Cumulated friction force from the right.
np_rolling_mean_left (numpy.ndarray) – Average friction force increment from the left.
np_rolling_mean_right (numpy.ndarray) – Average friction force increment from the right.
- buckpy.buckpy_solver.calc_friction_force_from_buckle(np_scen, np_case, ielt_buckle, phase_str)#
Calculate the effective axial frictional forces for each element in a scenario.
- Parameters:
np_scen (numpy.ndarray) – 2D array containing scenario-specific data, where rows represent different parameters and columns represent elements.
np_case (numpy.ndarray) – 2D array containing case-specific data, where rows represent different parameters and columns represent elements.
ielt_buckle (int) – Index of the buckle element.
phase_str (str) – Phase label indicating whether the calculation is for “HT” (hydrotest) or “OP” (operational) phase.
- Returns:
np_ff_buckle – 1D array containing the computed friction forces for each element in the scenario.
- Return type:
numpy.ndarray
- buckpy.buckpy_solver.exec_buckpy(fric_sampling, np_distr, np_scen, np_ends, n_sim, bl_verbose=False)[source]#
Execute buckpy methodology
- Parameters:
fric_sampling (int) – Switch to select the sampling method of the lateral friction: 0 for ‘per Element’ or 1 ‘per OOS Reference Length’
np_distr (numpy.ndarray) – 3-D array describing the stochastic distributions: - dim 1: properties - dim 2: elements - dim 3: values
np_scen (numpy.ndarray) – Array containing the pipeline desing data on assessed mesh.
np_ends (numpy.ndarray) – Array containing information about the boundary conditions at the ends of the pipeline.
n_sim (int) – Number of Monte-Carlo simulations to be run.
bl_verbose (boolean, optional) – True if intermediate printouts are required (False by default).
- Returns:
df_pp_plot (DataFrame) – Definition on assessed mesh of CBF and EAF in different conditions for case to plot.
df_VAP_plot (DataFrame) – Definition of virtual anchor points for case to plot.
df_pp_buckle_prop (DataFrame) – Results for all buckles triggered.
- buckpy.buckpy_solver.exec_worker_stack(n_sim_start, n_sim_end, np_distr, np_scen, np_ends, fric_sampling, mp_output)[source]#
Run a stack of random simulations using a single worker and add the results to the post-processing queue mp_output.
- Parameters:
n_sim_start (int) – Number of the first simulation to be executed by the current worker.
n_sim_end (int) – Number of the last simulation to be executed by the current worker (i.e., this simulation number is not executed in this call to the function).
np_distr (NumPy array) – 3-D numpy array containing the stochastic distributions (dim 1: properties, dim 2: elements, dim 3: values).
np_scen (NumPy array) – Numpy array containing the design data along the pipeline route (mesh) that remains constant among deterministic and Monte-Carlo simulations (except the stochastic distributions).
np_ends (NumPy array) – Returns a numpy array with the definition of the tie-ins at the pipeline ends.
fric_sampling (int) – Switch to select the sampling method of the soil lateral friction factor (0 for ‘per Element’ or 1 ‘per OOS Reference Length’).
mp_output (Queue) – Results are added to this Queue for subsequent post-processing.
- buckpy.buckpy_solver.preprocess_case(np_prob_var, np_scen, np_ends, bl_det=False)[source]#
Preprocess case based on scenario definition and probabilistic variables.
- Parameters:
np_prob_var (numpy.ndarray) – Probabilistic variables for the case (shape: 4 x n_elements).
np_scen (numpy.ndarray) – Scenario data array (rows = properties, columns = elements).
np_ends (numpy.ndarray) – End boundary condition array (rows = properties, columns = ends).
bl_det (bool, optional) – If True, use mean values; if False, use sampled values. Default is False.
- Returns:
np_case – Case array (21 x n_elements) with rows: - 0 : MUAX - 1 : MULAT_HT - 2 : MULAT_OP - 3 : HOOS - 4 : CBF_HT - 5 : CBF_OP - 6 : LFF_INST - 7 : LFF_HT - 8 : LFF_OP - 9 : RFF_INST - 10 : RFF_HT - 11 : RFF_OP - 12 : EAF_INST - 13 : EAF_HT - 14 : EAF_P_OP - 15 : EAF_OP - 16 : EAF_OP_UNBUCK - 17 : LDELTAF_HT - 18 : RDELTAF_HT - 19 : LDELTAF_OP - 20 : RDELTAF_OP
- Return type:
numpy.ndarray
Notes
Computes CBF and frictional forces based on route type and boundary conditions, and builds effective axial force (EAF) profiles for installation, hydrotest, and operation.
- buckpy.buckpy_solver.run_monte_carlo(n_worker, n_sim, np_distr, np_scen, np_ends, fric_sampling, bl_verbose=False)[source]#
Set to run the Monte-Carlo simulations using multiple workers and gather the properties of the buckles that have triggered.
- Parameters:
n_worker (int) – Number of worker processes spawned in the multiprocess.
n_sim (int) – Number of Monte-Carlo simulations to be run.
np_distr (NumPy array) – 3-D numpy array containing the stochastic distributions (dim 1: properties, dim 2: elements, dim 3: values).
np_scen (NumPy array) – Numpy array containing the design data along the pipeline route (mesh) that remains constant among deterministic and Monte-Carlo simulations (except the stochastic distributions).
np_ends (NumPy array) – Returns a numpy array with the definition of the tie-ins at the pipeline ends.
fric_sampling (int) – Switch to select the sampling method of the soil lateral friction factor (0 for ‘per Element’ or 1 ‘per OOS Reference Length’).
bl_verbose (boolean, optional) – True if intermediate printouts are required (False by default).
- Returns:
list_buckle_prop – Array containing for each simulation the properties of the buckle(s) that has(ve) triggered.
- Return type:
List[np.ndarray]
- buckpy.buckpy_solver.sample_randomness_case(fric_sampling, np_distr, np_scen)#
Samples the stochastic variables (HOOS and friction factors).
- Parameters:
fric_sampling (int) – Switch to select the sampling method of the lateral friction: 0 for ‘per Element’ or 1 ‘per OOS Reference Length’
np_distr (numpy.ndarray) – 3-D array describing the stochastic distributions: Dim 1 = Properties, Dim 2 = Elements and Dim 3 = values
np_scen (numpy.ndarray) – Array containing the pipeline desing data on assessed mesh.
- Returns:
np_prob_var – Definition of probabilistic variables on assessed mesh. Rows correspond to properties: MUAX = 0, MULAT_HT = 1, MULAT_OP = 2, HOOS = 3
- Return type:
numpy.ndarray
Notes
The returned np_prob_var has values by columns corresponding to mesh elements over 4 rows corresponding to properties defined above.
MUAX: Axial friction coefficientMULAT_HT: Lateral friction coefficient for Hydrotest conditionMULAT_OP: Lateral friction coefficient for Operation conditionHOOS: Soil property indicator
- buckpy.buckpy_solver.solve_case(np_scen, np_case)#
Calculate effective force profiles during hydrotest and operation and identify buckle properties.
- Parameters:
np_scen (numpy.ndarray) – Scenario array (rows = properties, columns = elements).
np_case (numpy.ndarray) – Case array (rows = properties, columns = elements).
- Returns:
np_pp_buckle (numpy.ndarray) – 2D array (n_buckles x 8) with columns: - 0 : SIM_PP - 1 : KP_PP - 2 : ROUTE_TYPE_PP - 3 : MUAX_PP - 4 : MULAT_OP_PP - 5 : HOOS_PP - 6 : CBF_OP_PP - 7 : VAS_PP
np_case (numpy.ndarray) – Updated case array (21 x n_elements).
vap_list (list[list]) – [element_index, KP, ESF_op] for virtual anchor points (sorted by KP).
Notes
Buckle identification is performed in stages (HT, OP pressure-only, OP pressure+temperature), updating EAF profiles after each buckle is found.