smflux using analytical expression

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
susonic
Posts: 170
Joined: Tue Aug 21, 2007 5:44 pm
Location: UST21 / Korea
Contact:

smflux using analytical expression

#1 Unread post by susonic »

Hi all, I'm trying to force both wind and pressure by using an analytical expression.
It works but I got a weird value in my output file.
So, is there anyone who can check out what the problem is? I put like this

Code: Select all

# elif defined NWPACIFIC
      OPEN(103,file='pres001.p',status='old')
      DO j=JstrR,JendR
       read(103,*)(Pair(i,j),i=IstrR,IendR)
      END DO
      CLOSE(103)
# elif defined NWPACIFIC
      OPEN(104,file='wind001.u',status='old')
      DO j=JstrR,JendR
       read(104,*)(sustr(i,j),i=IstrR,IendR)
      END DO
      DO j=JstrR,JendR
       DO i=IstrR,IendR
          sustr(i,j)=sustr(i,j)/rho0
       END DO
      END DO
      CLOSE(104)
# elif defined NWPACIFIC
      OPEN(105,file='wind001.v',status='old')
      DO j=JstrR,JendR
       read(105,*)(svstr(i,j),i=IstrR,IendR)
      END DO
      DO j=JstrR,JendR
       DO i=IstrR,IendR
          svstr(i,j)=svstr(i,j)/rho0
       END DO
      END DO
      CLOSE(105)
Any advice or lesson would be great for me.
Thank you.
Regards,
-Peter

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: smflux using analytical expression

#2 Unread post by arango »

Unbelievable :!: I thought that I have seen everything in this forum but this one is a first. If you look any dictionary for analytic(al) you will get something like:
Mathematics:

Subjected to, or capable of being subjected to a methodology involving algebra or other methods of mathematical analysis.
Having parametric equations that represent analytic functions.
This does not imply a quick and dirty way to read a file in ROMS. You have a very poor understanding of parallelism and ROMS coarse grain parallelization which allows both shared-memory and distributed-memory paradigms. Use NetCDF forcing files. If you cannot create a NetCDF file to do the same thing, I don't expect you to use ROMS correctly. You need to learn first how to create and manipulate NetCDF files before running your realistic application.

All the analytical routines (ana_xxx) in ROMS are called inside a parallel region :!: This implies that you cannot have a simple READ or WRITE in such routines. A very special algorithm and/or architecture is required for parallel IO. The same goes for PRINT statements; they also need a special code structure to avoid incorporating parallel bugs or weird behavior. Currently, all the IO in ROMS is serial. I have been making incremental changes to the code to allow parallel IO in the future but it also required a very special handling and NetCDF/HDF libraries.

The other day an user was asking why do we need to set ANA_STFLUX or ANA_SMFLUX. He said that his application was simple and didn't required such surface fluxes. Any application in ROMS requires surface and bottom boundary conditions to the governing equations. This has nothing to do with simplicity. The fact that there is no surface fluxes imply that they are zero. The user still need to prescribe this zero flux to ROMS. By the way,

Code: Select all

      stflx(:,:,itemp)=0.0_r8
      sustr(:,:)=0.0_r8
      svstr(:,:)=0.0_r8
can be considered as an analytical expression.

User avatar
susonic
Posts: 170
Joined: Tue Aug 21, 2007 5:44 pm
Location: UST21 / Korea
Contact:

Re: smflux using analytical expression

#3 Unread post by susonic »

Hi Arango.
Thank you so much for your early reply. And I'm sorry for the lack of understanding
and also made you surprise. :cry:
I'll take your tips and promise that I'll try to study more about ROMS. :)

Regards,
-Peter

User avatar
susonic
Posts: 170
Joined: Tue Aug 21, 2007 5:44 pm
Location: UST21 / Korea
Contact:

Re: smflux using analytical expression

#4 Unread post by susonic »

Hi arango,
I'm still analyzing Netcdf file to make a forcing file for typhoon. :cry:
But I think I can make the forcing file soon. :roll:
Right now I'm trying to simulate the effect of typhoon in the ocean such as 'cold wake'.
Would you let me know what I need to define in my cppflag ? The problem is I don't think ROMS is reading
Pair in my forcing file which is consist of COADS data.
#define UV_ADV
#define UV_QDRAG
#define UV_COR
#define UV_VIS2
#define TS_DIF2
#define MIX_S_UV
#define MIX_S_TS
#define DJ_GRADPS
#define TS_U3HADVECTION
#define TS_C4VADVECTION
#define ANA_BTFLUX
#define ANA_BSFLUX
#define NONLIN_EOS
#define SALINITY
#define SOLVE3D
#define MASKING
#define SPLINES
#define QCORRECTION
#define SCORRECTION
#define SOLAR_SOURCE
#define CURVGRID
#define AVERAGES
#define LMD_MIXING
#ifdef LMD_MIXING
# define LMD_RIMIX
# define LMD_CONVEC
# define LMD_SKPP
# define LMD_BKPP
# define LMD_NONLOCAL
#endif
#define ANA_BSFLUX
#define ANA_BTFLUX
#define NORTH_FSCHAPMAN
#define NORTH_M2FLATHER
#define NORTH_M3RADIATION
#define NORTH_TRADIATION
#define EAST_FSCHAPMAN
#define EAST_M2FLATHER
#define EAST_M3RADIATION
#define EAST_TRADIATION
#define WEST_FSCHAPMAN
#define WEST_M2FLATHER
#define WEST_M3RADIATION
#define WEST_TRADIATION
#define SOUTH_FSCHAPMAN
#define SOUTH_M2FLATHER
#define SOUTH_M3RADIATION
#define SOUTH_TRADIATION
Any tips would be great to me.
Thank you.

-Peter

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#5 Unread post by kate »

Sometimes ROMS tries to figure out what you want with less information than you really have. If you check the logic, it only reads Pair when you ask for BULK_FLUXES, in which you compute stress, etc. from the atmospheric fields. I assume you want Pair for the surface pressure gradient contribution, which is not supported by mainstream ROMS. This is something I should fix in my branch - read Pair if either BULK_FLUXES or the surface pressure gradient term is called for.

Edit: The logic is there in get_data and set_data for ATM_PRESS. I updated my branch to match.

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: smflux using analytical expression

#6 Unread post by linzhenhua »

Hello,one question about the ATM_PRESS and Pair.

I could see ATM_PRESS in the set_data and get_data code,but could not find it in other files in the Nonlinear directory. At least I think it should influence the ocean pressure gradient calculation,right?

e.g. P(z)=Pair+rho*g*(zeta+z)

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#7 Unread post by kate »

Paul Budgell added such a term to prsgrd32.h (but not its siblings) with the cpp flag SLP_GRAD. I changed it to use ATM_PRESS as well - attached here.
Attachments
prsgrd32.h
Pressure gradient routine with ATM_PRESS
(15.41 KiB) Downloaded 395 times

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: smflux using analytical expression

#8 Unread post by linzhenhua »

Hi,Kate

Thanks for your clarification and upload the file.

But still I have one more question.Since you only refer to pregrd32 file,I guess you think this is the only file that should be changed to include the atmospheric pressure.The prsgrd code is called by the 3d calculation.

From the physical view,the atmospheric pressure should not only change 3d calculation but also 2d calculation in my opinion. I guess that the 2d part should also be changed,e.g. step2d_LF_AM3, is it right?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#9 Unread post by kate »

It depends - is this a 3-D simulation? If so, you don't need to change step2d. The pressure change from the atmosphere will become part of the slowly-varying terms on ubar/vbar. These terms are updated once per baroclinic timestep, which should be often enough. However, if you are doing a 2-D simulation, you will have to add it someplace appropriate, since Paul only handles the case of using that one specific 3-D pressure gradient formulation.

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: smflux using analytical expression

#10 Unread post by linzhenhua »

Kate,Thanks for your reply.

Now for the 3d case,Could you clarify the following words:
kate wrote: The pressure change from the atmosphere will become part of the slowly-varying terms on ubar/vbar. These terms are updated once per baroclinic timestep, which should be often enough.
Because now I'm still confused how Pair influence 2d calculation.
It seems that Pair is only used by set_data,get_data and bulk_flux and new version prsgrd.
while prsgrd is only used by rhs3d.

The 2d and 3d equations are not consistent in my opinion.(one with pair and one not)

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#11 Unread post by kate »

See if this makes sense to you:
https://www.myroms.org/wiki/index.php/N ... _Equations
prsgrd contributes to the Ruslow, Rvslow terms and is therefore contributing to the barotropic steps.

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: smflux using analytical expression

#12 Unread post by linzhenhua »

Hi,Kate

Thanks for your information.I try to comprehend the meaning.

The RHS of 2D equation consists of 2 parts,one slow terms,one, say ,fast terms.The difference of the two parts are computed with difference time steps.The slow terms are computed every baroclinic time step,while the fast terms are computed every barotropic time step.

At the beginning of one baroclinic and barotropic integration,first integrate the RHS of 3D equation,and then eliminate the fast terms of the 2D equations at the same time,now results in the slow terms,which is constant during the next few barotropic integration. While the fast terms then evolve with the barotropic time step,and added to the slow terms to drive the 2D forward integration.

The influence of Pair is quite similiar to that of the surface elevation,in that both cause barotropic pressure gradient,but their inclusion into the model is quite different,because the surface elevation vary very fast,while Pair is generally considered to be in a steady state,also for the reason that Pair will influence the pressure gradient calculation,Pair is then chosen to be included in the pregrd file.This is the reason why Pair influence 2D equations. While if the model is in 2D mode,then prsgrd file will not be used,the Pair influence should then be added to the 2D part directly.

Please correct my misunderstanding,any comment?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#13 Unread post by kate »

That sounds right to me.

User avatar
susonic
Posts: 170
Joined: Tue Aug 21, 2007 5:44 pm
Location: UST21 / Korea
Contact:

Re: smflux using analytical expression

#14 Unread post by susonic »

Hi all.
First of all, thanks to Arango's advice, finally I made a forcing file for representing certain typhoon with using Netcdf file.
Well, I was poor at programming. But I'm sure that I learnt a lot throughout this opportunity.

Anyways, I put wind stress and pressure as a forcing for typhoon.
It represented well. I saw the cold wake along the typhoon track.

Since the pressure of typhoon is quite low, the sea level should change.
However, I couldn't find any sea level change when typhoon comes and goes.
So, I was wondering if ROMS reads Pressure and calculates it or not.

Is there anyone who can teach me about it?
And if ROMS doesn't calculate pressure, would you let me know what type of function do I need to add?

Any tips would be appreciated. Thank you in advance.

Regards,

Peter Lee

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: smflux using analytical expression

#15 Unread post by kate »

Go to https://www.myroms.org/wiki/index.php/N ... _Equations and read about Ruslow/Rvslow.

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: smflux using analytical expression

#16 Unread post by linzhenhua »

Some personal opinion.

If you run 3D simulation,you should change ROMS file,using the file from Kate,and should also use this pressure calculation method.

If you have a low pressure at the center while high around,it's possible to get a sea surface elevation in my opinion,through the convergence progress,but you can not anticipate the sea surface elevation exactly balance the atmosphere pressure.An example is that,if you have a linear distribution of atmospheric pressure along one direction,I guess you will not get sea surface elevation at all,not tested.

Please correct me if wrong.

Post Reply