dhruvbhagtani / toy-model

This is a hybrid model of the global ocean with simplified governing equations to understand large scale circulations.
4 stars 0 forks source link

Function names imply connection to particular scheme -- but is there really such connection? #2

Open navidcy opened 3 years ago

navidcy commented 3 years ago

In the 1D Notebook I see a few function definitions with names that imply connection to a particular scheme. For example,

def adv_x_Euler(f1,hm_old,hm_new):
    a = 0.5 #Speed of advection
    #f3 = -(1/hm_new[1:nx-1])*partial_x(hm_old*f1**2,dx)
    f3 = -(1/hm_new[1:nx-1])*a*partial_x(hm_old*f1,dx)
    return f3

This suggest that this advection scheme is related to Euler. Some issues with this:

cc @AndyHoggANU

dhruvbhagtani commented 3 years ago
  1. So, there are several equations like the crank nicholson, leap frog, alternate direction implicit, etc. The naming convention is just for the ease of readability. Probably I should also mention that we are using the explicit Euler scheme. I haven't written about forward, central or backward difference, because I'm still playing with them, figuring out which is best (like adding artificial diffusion in central difference schemes).
  2. Advection_x requiring two h values is just to try to keep these equations in conservative form, but I see there are problems because I'm not, in a strict way, solving the conservative form. In your previous issue, the equations you've laid out are actually the conservative equations, so it's best that the next test be to try them out.
navidcy commented 3 years ago
  • So, there are several equations like the crank nicholson, leap frog, alternate direction implicit, etc. The naming convention is just for the ease of readability. Probably I should also mention that we are using the explicit Euler scheme. I haven't written about forward, central or backward difference, because I'm still playing with them, figuring out which is best (like adding artificial diffusion in central difference schemes).

Are you saying that there are several advection functions based on the scheme choosen?

  • Advection_x requiring two h values is just to try to keep these equations in conservative form, but I see there are problems because I'm not, in a strict way, solving the conservative form. In your previous issue, the equations you've laid out are actually the conservative equations, so it's best that the next test be to try them out.

OK, let's clear this out then! :)

dhruvbhagtani commented 3 years ago

In this notebook, I've got a fully conservative form with periodic boundary conditions and convergence plots for backward and central difference.