You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
_calc_vertical_stress() changes the caller's thickness when the last layer is 0 m #120
Found while reviewing #74. Pre-existing on main (b764057); #74 does not change this code.
Problem
_calc_vertical_stress() writes into the caller's thickness array when the last thickness is 0. It sets that entry to 1 m so the halfspace still contributes to the overburden. The arrays passed in by hh_param_from_profile(), hh_param_from_curves(), and Damping_Calibration.get_damping_curves() are views (vs_profile[:-1, 0]), so the write would change the profile.
Those callers drop the real halfspace first, and check_Vs_profile_format() rejects a zero thickness above the last layer, so a valid profile does not hit this today. Calling the helper with a trailing 0 does:
importnumpyasnpimportPySeismoSoil.helper_hh_calibrationashhch=np.array([5.0, 0.0])
rho=np.array([1800.0, 2000.0])
hhc._calc_vertical_stress(h, rho)
print(h) # [5. 1.] -- the 0 m halfspace was changed to 1 m
The same function's density warning names __calc_vertical_stress (two underscores). The function is _calc_vertical_stress.
'Warning in __calc_vertical_stress(): It looks like the unit '
'of mass density is g/cm^3. The correct unit should be kg/m^3.',
)
ifh[-1] ==0: # zero thickness, i.e., half space
h[-1] =1
Fix
Copy h before replacing a zero last thickness, or use a local thickness of 1 m in the stress formula without assigning into h. Print _calc_vertical_stress in the warning.
Activity