GithubHelp home page GithubHelp logo

Comments (6)

AminFazlKazemi avatar AminFazlKazemi commented on May 28, 2024

Hi Dr. Huang
This is Amin Fazl kazemi from I.R.Iran. I've just downloaded your description of SOR solving method to find UREF. It is published February 2020 and refers to HN2018 paper, Equation S3. By the way I find no equation marked as "S3" in HN2018 , Atmospheric blocking as a traffic jam in the jet stream. Could you please Help.

By the way I tried to solve Equation 12 of Nakamura&Solomon (2010) to find delta_u , the zonal adjustment to zonal mean zonal wind to yield largrangian mean , UREF
By the way the result is apparently not conserved by time. I donot know what wrong I have done.

Thanks

from hn2016_falwa.

csyhuang avatar csyhuang commented on May 28, 2024

@AminFazlKazemi Equation S3 is in the supplementary materials of the Science paper:
Screen Shot 2022-08-18 at 6 32 05 PM
In realistic atmosphere, Uref is not conserved due to non-conservative processes (dissipation, diabatic heating etc). Do I answer your question?
By the way, please open a new issue when you raise questions. Thank you.

from hn2016_falwa.

AminFazlKazemi avatar AminFazlKazemi commented on May 28, 2024

from hn2016_falwa.

csyhuang avatar csyhuang commented on May 28, 2024

@AminFazlKazemi On top of the variable of the equations being different, NS10 and NH18 are using different boundary conditions. NS10 uses the two poles as boundary, while NH18 is using the equator and the north pole as boundaries. We switched to hemispheric boundary conditions because I encountered the issue that anomalies in the southern hemisphere is causing problematic gradient of Qref in northern hemisphere. This hemispheric boundary conditions suffers from sensitivity on equator field values though, and we switched to using absolute vorticity at $5^\circ$ N as equatorward boundary condition and use direct solver (instead of SOR), which gives a much better signal.

When we tried both boundary conditions, there are substantial difference in Uref at topics and subtropics, but at midlatitude, their patterns were similar. What's the difference you observed between the two cases? Did I answer your question?

from hn2016_falwa.

AminFazlKazemi avatar AminFazlKazemi commented on May 28, 2024

Hi Dr. Huang
I used this code to solve UREF based on Nakamura_Solomon 2010:
` @numba.guvectorize(['(float64[:],int64,float64,float64[:,:],float64[:,:],float64[:],float64[:],float64[:],float64[:,:],int64,int64,float64,float64[:,:])']
, '(z),(),(),(m,z),(m,z),(m),(z),(z),(m,z),(),(),()->(m,z)',target='cpu', nopython=True)

def density_weighted_elliptic_solver(A,max_iter,acceptable_precision,first_guess,epsilon,dmu2,dz2,ru0,forcing,ny,nz,alfa,result):
dz=dz2**.5
dmu=dmu2**.5
precision=1000.
iter_=0
old=first_guess.copy()
for iter_ in range(1,max_iter+1):
for i in range(1,ny-1):
for j in range(int(A[0]),nz-1):

   #print(j,i)  
   if j==0: 
     coeff=1./(ru0[j]*epsilon[i,j]/(ru0[j]*dz2[j]))
     t=forcing[i,j]-( ((ru0[j+1]*epsilon[i,j+1]*(first_guess[i,j+2]-first_guess[i,j+1])-ru0[j]*epsilon[i,j]*first_guess[i,j+1])/(dz2[j]))/ru0[j])
     first_guess[i,j] = (1.-alfa)*first_guess[i,j]+  alfa*coeff*t
   else: 
     epsilon_p=.5*(epsilon[i,j]+epsilon[i,j+1])
     epsilon_m=.5*(epsilon[i,j]+epsilon[i,j-1])
     ru0_p=.5*(ru0[j]+ru0[j+1])
     ru0_m=.5*(ru0[j]+ru0[j-1])
     zarib=1./(-(ru0_p*epsilon_p+ru0_m*epsilon_m)/(ru0[j]*dz2[j])-2./((.25*(dmu[i+1]+dmu[i-1]+2.*dmu[i]))*dmu[i]))    
     t=forcing[i,j]-((first_guess[i+1,j]/(.5*(dmu[i]+dmu[i+1]))+first_guess[i-1,j]/(.5*(dmu[i]+dmu[i-1])))/dmu[i] + (ru0_p*epsilon_p*first_guess[i,j+1]+ru0_m*epsilon_m*first_guess[i,j-1])/(dz2[j])/ru0[j])
     first_guess[i,j] = (1.-alfa)*first_guess[i,j]+  alfa*coeff*t
     

#diff=numpy.abs(calc(first_guess,epsilon,ru0,zs,mus)-forcing)

precision=abs(first_guess[0,0]-old[0,0])
#print("p_",precision)

for i in range(1,ny-1):
  for j in range(int(A[0]),nz-1):
     n=abs(first_guess[i,j]-old[i,j]) 
     if n>precision:
         precision=n
if precision<=acceptable_precision:
    print(iter_,precision)
    break
else:
    print(iter_,precision)
    old=first_guess.copy()

for i in range(1,ny-1):
for j in range(int(A[0]),nz-1):
result[i,j]=first_guess[i,j]
`
I used mu=sin(latitude) directly to differentiate. The program converges but the result is very low amplitude. In fact the resulted UREF is much the same as UBAR and there is something wrong with it.

forcing is the right-hand side of nakamura-Solomon equation 12.

vector A is used to switch between no-slip and surface wave activity boundary condition .

I also coded OPTIMIZED SOR method for NH18-S3 the same way. the result is quite favorable and apparently conserved to a great extent. It is very similar to HN2016_FALWA package and is completely symmetrical around equator.

I would be thankful if you provide me with descriptions about your new boundary condition using absolute vorticity at 5 degrees North instead of ubar+FAWA at equator so that I can apply and test it in my code.

Doc2.pdf

from hn2016_falwa.

csyhuang avatar csyhuang commented on May 28, 2024

Hi @AminFazlKazemi ,
in NHN22 we use direct solver instead of SOR since we have MKL installed. The numerical procedures are outlined in supplementary materials:
https://agupubs.onlinelibrary.wiley.com/action/downloadSupplement?doi=10.1029%2F2021GL097699&file=2021GL097699-sup-0001-Supporting+Information+SI-S01.pdf
Equation (16) is the boundary condition I mentioned.

The part of code using direct solver is already available in this package:

qref, uref, tref, fawa, ubar, tbar = qgfield_object._compute_qref_fawa_and_bc()

The lines doing matrix inversion:
lu, piv, info = dgetrf(qjj)
qjj, info = dgetri(lu, piv)

But this version only works for data with 1 deg x 1 deg lat-lon grid. I am going to generalize this to accommodate arbitrary grids in the upcoming release.

I suggest you use intel MKL version of numpy/scipy to do the matrix inversion. It is very fast and more accurate.

from hn2016_falwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.