Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| TSU-WAVE Physics Calculations Test | |
| """ | |
| import numpy as np | |
| print("=" * 60) | |
| print("📐 TSU-WAVE Physics Test") | |
| print("=" * 60) | |
| # Constants | |
| g = 9.81 | |
| rho = 1025 # seawater density (kg/m³) | |
| # Test cases from research paper | |
| test_cases = [ | |
| {"name": "Deep Ocean", "H": 6000, "eta": 1.0, "wavelength": 280000}, | |
| {"name": "Shelf Edge", "H": 200, "eta": 5.0, "wavelength": 50000}, | |
| {"name": "Nearshore", "H": 20, "eta": 10.0, "wavelength": 10000}, | |
| ] | |
| for case in test_cases: | |
| print(f"\n📊 {case['name']}:") | |
| print(f" Depth: {case['H']} m, Wave: {case['eta']} m") | |
| # Wave speed | |
| c = np.sqrt(g * case['H']) | |
| print(f" Wave speed: {c:.1f} m/s") | |
| # Energy | |
| E_pot = 0.5 * rho * g * case['eta']**2 | |
| print(f" Potential energy: {E_pot/1000:.1f} kJ/m²") | |
| # Nonlinear parameter | |
| Ur = (case['H']/case['eta']) * (case['wavelength']/case['H'])**2 | |
| print(f" Ursell number: {Ur:.2e}") | |
| if Ur < 0.1: | |
| print(" → Linear regime") | |
| elif Ur < 1: | |
| print(" → Weakly nonlinear") | |
| else: | |
| print(" → Strongly nonlinear") | |
| print("\n" + "=" * 60) | |