johnrobertlawson / WEM

WRF Ensemble Management (USE EVAC)
30 stars 16 forks source link

map scale factor and velocity derivative #6

Open weinihou opened 7 years ago

weinihou commented 7 years ago

It's a great tool, but I think maybe you should improve it from some basic parts.

For example, you didn't take the map scale factors into account, so the derivative dudx dvdy and so on are not so precise. And in the similar way, you just interpolate the u v to mass grids and then calculate the derivative, but maybe you should do this directly in the staggered grids as NCL does.

Hoping WEM would be better and better :)

MeteoBoy4 commented 7 years ago

Hi! I noticed your profound insight about calculating derivative considering map scale factors and staggering.

And now I have some problems understanding the vorticity calculation in NCL WRF code (wrf_pvo.f)

   DO k = 1,nz
    DO j = 1,ny
        jp1 = MIN(j+1, ny)
        jm1 = MAX(j-1, 1)
        DO i = 1,nx
            ip1 = MIN(i+1, nx)
            im1 = MAX(i-1, 1)
!           PRINT *,jp1,jm1,ip1,im1
            dsx = (ip1 - im1) * dx
            dsy = (jp1 - jm1) * dy
            mm = msft(i,j)*msft(i,j)
!           PRINT *,j,i,u(i,jp1,k),msfu(i,jp1),u(i,jp1,k)/msfu(i,jp1)
            dudy = 0.5D0*(u(i,jp1,k)/msfu(i,jp1) + u(i+1,jp1,k)/msfu(i+1,jp1) - &
                 u(i,jm1,k)/msfu(i,jm1) - u(i+1,jm1,k)/msfu(i+1,jm1))/dsy*mm
            dvdx = 0.5D0*(v(ip1,j,k)/msfv(ip1,j) + v(ip1,j+1,k)/msfv(ip1,j+1) - &
                 v(im1,j,k)/msfv(im1,j) - v(im1,j+1,k)/msfv(im1,j+1))/dsx*mm
            avort = dvdx - dudy + cor(i,j)
            av(i,j,k) = avort*1.D5
        END DO
    END DO
  END DO

I can not understand why multiply by square of map scale factor on mass grid, can you help me? Thanks you very much :)

@weinihou

weinihou commented 7 years ago

Hi, I show the short process of derivation in the attachment, it's in fact the original formula.


孙世玮

南京大学大气科学学院 E-mail: sunshiwei.atmo@gmail.com


Shiwei Sun

School of Atmospheric Sciences, Nanjing University E-mail: sunshiwei.atmo@gmail.com

2017-06-20 16:17 GMT+08:00 Chiqin Li notifications@github.com:

Hi! I noticed your profound insight about calculating derivative considering map scale factors and staggering.

And now I have some problems understanding the vorticity calculation in NCL WRF code (wrf_pvo.f)

DO k = 1,nz DO j = 1,ny jp1 = MIN(j+1, ny) jm1 = MAX(j-1, 1) DO i = 1,nx ip1 = MIN(i+1, nx) im1 = MAX(i-1, 1) ! PRINT ,jp1,jm1,ip1,im1 dsx = (ip1 - im1) dx dsy = (jp1 - jm1) dy mm = msft(i,j)msft(i,j) ! PRINT ,j,i,u(i,jp1,k),msfu(i,jp1),u(i,jp1,k)/msfu(i,jp1) dudy = 0.5D0(u(i,jp1,k)/msfu(i,jp1) + u(i+1,jp1,k)/msfu(i+1,jp1) - & u(i,jm1,k)/msfu(i,jm1) - u(i+1,jm1,k)/msfu(i+1,jm1))/dsymm dvdx = 0.5D0(v(ip1,j,k)/msfv(ip1,j) + v(ip1,j+1,k)/msfv(ip1,j+1) - & v(im1,j,k)/msfv(im1,j) - v(im1,j+1,k)/msfv(im1,j+1))/dsxmm avort = dvdx - dudy + cor(i,j) av(i,j,k) = avort1.D5 END DO END DO END DO

I can not understand why multiply by square of map scale factor on mass grid, can you help me? Thanks you very much :)

@weinihou https://github.com/weinihou

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/johnrobertlawson/WEM/issues/6#issuecomment-309679581, or mute the thread https://github.com/notifications/unsubscribe-auth/AXVrs5oNRCk3Kij4ZjOmhXUVs0mSyb8bks5sF4AcgaJpZM4Lcnhb .

weinihou commented 7 years ago

Sorry, I'm not familiar with the Git system. I sent you an E-mail with attachment ~

It's about the Curvilinear Coordinates, and you may get some information in https://en.wikipedia.org/wiki/Curvilinear_coordinates or https://en.wikipedia.org/wiki/Orthogonal_coordinates

MeteoBoy4 commented 7 years ago

Thank you for your reply. Now it makes much sense to me :) @weinihou

winash12 commented 6 years ago

I am a late entrant to this thread. But I did not see the derivation for the map scale factor the vorticity. Was there an attachment ?