Skip to content

6: Time Integration with RK4 #16

@philipnickel

Description

@philipnickel

Description

Implement explicit time integration using the classical 4th-order Runge-Kutta method. Create the full time-stepping loop that advances the free surface variables.

Background

The state vector y = [η, φ̃] evolves according to:

dy/dt = RHS(y)

where RHS involves:

  1. Building K matrix from current η
  2. Solving σ-Laplace for Φ
  3. Recovering w̃
  4. Evaluating free surface RHS

Each RK4 step requires 4 RHS evaluations (4 Laplace solves per time step).

Tasks

  • Implement generic RK4 stepper
  • Implement full RHS function
    • Input: current [η, φ̃]
    • Build K matrix
    • Assemble and solve Laplace
    • Recover w̃
    • Evaluate R_η, R_φ
    • Output: [R_η, R_φ]
  • Implement time loop with output storage
  • Implement CFL-based time step selection
  • Test RK4 on simple ODE
  • Implement standing wave test case

Acceptance Criteria

  • RK4 achieves 4th-order convergence on test ODE (dy/dt = -y)
  • Standing wave simulation runs for 10+ periods without crashing
  • Oscillation period matches analytical T = 2π/ω within 1%
  • Amplitude preserved within 5% after 10 periods
  • Phase error < 10% after 10 periods

Test Configuration: Standing Wave

Domain: x ∈ [0, λ/2] where λ = 2π/k
BCs: Neumann (walls) at x = 0 and x = λ/2
Initial: η(x,0) = H·cos(kx), φ̃(x,0) = 0
Expected: η(x,t) = H·cos(kx)·cos(ωt)
Parameters: kh = 1, H/h = 0.01 (small amplitude)
Duration: 10 wave periods

Deliverables

  • Time series plot of η at x = 0
  • Comparison with analytical standing wave
  • Energy vs time plot

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreEssential functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions