Skip to content

Tsunami Simulator with parallel computing in modern Fortran

Notifications You must be signed in to change notification settings

NickSchmitt/Fortran-Tsunami-Simulator

Repository files navigation

Tsunami Simulator with parallel computing in modern Fortran


Linear 1-D Advection Equation


The rate of change of $u$ in time equals the advective speed $c$ times the spatial gradient of $u$.

test


Discretizing Partial Derivatives


Discretization is “the process of transferring continuous functions, models, variables, and equations into discrete counterparts. This process is usually carried out as a first step toward making them suitable for numerical evaluation and implementation on digital computers.”

In a continuous function, we know the value of u at time step n. We are trying to know the value of u at time step n+1.

The Discrete approximation corresponds to the gradient times the speed. The higher the speed or the gradient, the steeper the line of discrete approximation.

To discretize time and space with finite differences:

  • Rate of change of u in time can be approximated as u over time step (Δu/Δt).

  • The rate of change of u in space can be approximated as u over grid spacing (Δu/Δx).

  • Finite difference in time

test

  • Finite difference in space

test


Casting Derivatives Into Code


test


  • Take the difference in space, u(i,n) - u(i-1,n).
  • Divide difference by grid spacing dx. (u(i,n) -u(i-1,n))/dx = the rate of change in space.
  • Multiply gradient by propagation speed c. c * (u(i,n)-u(i-1,n))/dx = rate of change in time (tendency).
  • Multiply tendency by time step, add to current value.

Releases

No releases published

Packages

No packages published