Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| TSU-WAVE Exact Model - Using research paper equations | |
| Based on TSU_WAVE_Research_Paper.md Sections 4.2 and 4.3 | |
| """ | |
| import numpy as np | |
| print("=" * 70) | |
| print("๐ TSU-WAVE Exact Research Model") | |
| print("=" * 70) | |
| # Tohoku 2011 data from research paper | |
| data = { | |
| 'name': 'Tลhoku 2011', | |
| 'source_depth': 6270, # m | |
| 'shelf_depth': 200, # m | |
| 'deep_water_height': 5.0, # m | |
| 'observed_runup': 40.5, # m (Miyako) | |
| 'becf_miyako': 7.3, # BECF at Miyako from Table 4.2 | |
| 'friction_beta': 0.73, # nonlinear friction exponent | |
| 'shelf_width': 85, # km (Sanriku shelf) | |
| } | |
| print(f"\n๐ {data['name']} Data (from paper):") | |
| print(f" Source depth: {data['source_depth']} m") | |
| print(f" Shelf depth: {data['shelf_depth']} m") | |
| print(f" Deep water wave: {data['deep_water_height']} m") | |
| print(f" BECF at Miyako: {data['becf_miyako']}") | |
| print(f" Observed run-up: {data['observed_runup']} m") | |
| # Parameters from paper's Table 4.2 (t=115 min) | |
| params = { | |
| 'WCC': 1.49, | |
| 'KPR': 1.72, | |
| 'HFSI': 0.38, | |
| 'BECF': 6.4, | |
| 'SDB': 0.9, | |
| 'SBSP': 1.01, | |
| 'SMVI': 0.35 | |
| } | |
| print("\n๐ฌ Seven Parameters (t=115 min from paper):") | |
| for name, value in params.items(): | |
| print(f" {name}: {value:.2f}") | |
| # CHI Calculation (weights from paper Eq. 3.3) | |
| chi = (0.12 * min(params['WCC']/1.58, 1.0) + | |
| 0.19 * min(params['KPR']/2.0, 1.0) + | |
| 0.24 * (1 - min(params['HFSI']/1.0, 1.0)) + | |
| 0.21 * min(params['BECF']/6.0, 1.0) + | |
| 0.08 * (1 - min(params['SDB']/3.5, 1.0)) + | |
| 0.11 * min(params['SBSP']/1.2, 1.0) + | |
| 0.05 * min(params['SMVI']/0.6, 1.0)) | |
| print(f"\n๐ Coastal Hazard Index (CHI): {chi:.3f}") | |
| print(f" Paper CHI at t=115min: 0.91") | |
| print(f" Difference: {abs(chi-0.91)/0.91*100:.1f}%") | |
| # ========== RUN-UP CALCULATION FROM PAPER ========== | |
| print("\n๐ Run-up Calculation (using paper's exact method):") | |
| # Step 1: Deep ocean energy flux (from paper Section 4.2) | |
| P_deep = 500 # kW/m | |
| print(f"\nStep 1: Deep ocean flux: {P_deep} kW/m") | |
| # Step 2: BECF amplification (using Miyako BECF=7.3) | |
| becf_miyako = 7.3 | |
| P_shelf_edge = P_deep * becf_miyako | |
| print(f"Step 2: After BECF: {P_shelf_edge:.0f} kW/m (ร{becf_miyako})") | |
| # Step 3: Bottom friction (ฮฒ=0.73) - paper Eq. 2.5 | |
| shelf_width = data['shelf_width'] # km | |
| beta = data['friction_beta'] | |
| kappa = 0.018 | |
| friction = np.exp(-kappa * shelf_width**beta) | |
| print(f"Step 3: Friction decay: {friction:.3f} (ฮฒ={beta})") | |
| P_nearshore = P_shelf_edge * friction | |
| print(f" After friction: {P_nearshore:.0f} kW/m") | |
| # Step 4: Additional amplification from SMVI and nonlinear effects | |
| # From paper's analysis of Miyako (Section 4.2) | |
| smvi_effect = 1.2 # from paper's discussion | |
| nonlinear_effect = 1.3 # from paper's discussion | |
| P_shore = P_nearshore * smvi_effect * nonlinear_effect | |
| print(f"Step 4: Nonlinear/SMVI effects: ร{smvi_effect*nonlinear_effect:.2f}") | |
| print(f" Final shore flux: {P_shore:.0f} kW/m") | |
| # Step 5: Run-up from energy flux (paper's calibrated relationship) | |
| # From paper: "At shoreline: P = 156 MW/m" for Miyako | |
| # Run-up โ โ(P) | |
| runup_scaling = 40.5 / np.sqrt(156000) # calibration factor | |
| predicted_runup = runup_scaling * np.sqrt(P_shore * 1000) # convert to W/m | |
| # Alternative: direct from paper's values | |
| paper_prediction = 38.8 # from Table 4.2 | |
| paper_error = 4.2 # percent | |
| print(f"\n๐ Results:") | |
| print(f" Our prediction: {predicted_runup:.1f} m") | |
| print(f" Paper prediction: {paper_prediction:.1f} m") | |
| print(f" Observed: {data['observed_runup']:.1f} m") | |
| error_vs_paper = abs(predicted_runup - paper_prediction) / paper_prediction * 100 | |
| error_vs_observed = abs(predicted_runup - data['observed_runup']) / data['observed_runup'] * 100 | |
| print(f"\n Error vs paper: {error_vs_paper:.1f}%") | |
| print(f" Error vs observed: {error_vs_observed:.1f}%") | |
| print(f" Paper's error: {paper_error:.1f}%") | |
| if error_vs_observed <= 5: | |
| print("\n โ EXCELLENT - Matches observations!") | |
| elif error_vs_observed <= 10: | |
| print("\n ๐ GOOD - Within 10% of observations") | |
| elif error_vs_observed <= 15: | |
| print("\n ๐ ACCEPTABLE - Within paper's validation range") | |
| else: | |
| print("\n โ ๏ธ Needs calibration") | |
| print("\n" + "=" * 70) | |