Confusion about Nudging Coefficient

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
justina0622
Posts: 23
Joined: Fri Jan 29, 2010 6:17 pm
Location: GSO URI

Confusion about Nudging Coefficient

#1 Unread post by justina0622 »

Dear ROMS Users,

I have a confusion about the Nudging Coefficient. Take TNUDG as the example. What is TNUDG for? Is it corresponding to WEST/NORTH/EAST/SOUTH_NUDGING or corresponding to TCLM_NUDGING?

From the description in the link: https://www.myroms.org/wiki/index.php/B ... _condition, and description for OBCFAC in *.in files
( OBCFAC Factor between passive (outflow) and active (inflow) open
! boundary conditions. The nudging time scales for the
! active (inflow) conditions are obtained by multiplying
! the passive values by OBCFAC. If OBCFAC > 1, nudging on
! inflow is stronger than on outflow (recommended).
),


it seems that, the TNUDG is for boundary nudging.

However, according to ana_nudgcoef.h,


# ifdef NORTH_TNUDGING
# ifdef TCLM_NUDGING
DO itrc=1,NT(ng)
IF (DOMAIN(ng)%NorthEast_Corner(tile)) THEN
Tobc_out(itrc,ng,inorth)= &
& CLIMA(ng)%Tnudgcof(Lm(ng),Mm(ng)+1,itrc)
Tobc_in (itrc,ng,inorth)=obcfac(ng)*Tobc_out(itrc,ng,inorth)
END IF
IF (DOMAIN(ng)%Northern_Edge(tile)) THEN
DO i=IstrR,IendR
CLIMA(ng)%Tnudgcof(i,Mm(ng)+1,itrc)=0.0_r8
END DO
END IF
END DO
...



my understanding is that, if define climatology and boundary nudging at the same time,
they will share the same TNUDG coefficient except that boundary nudging has a factor of OBCFAC. Am I right?

So, when I define both WEST/NORTH/EAST/SOUTH_NUDGING and TCLM_NUDGING, what should I do to nudge the boundary and climatology in different days, such as with climatology nudging for 1 year length, but boundary nudging for 2 days? Or I should ask, it this possible?

Thank you.

Sincerely,
Qian
Qianqian@URI

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

Re: Confusion about Nudging Coefficient

#2 Unread post by kate »

You are correct that TNUDG is being used for more than one thing. What I have done is gone to the section of code where it is being used for SSS nudging and hacked in a multiplicative factor there (with comment and cpp #ifdef). It's very much a kludge.

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Confusion about Nudging Coefficient

#3 Unread post by wilkin »

The best approach is to configure a private ana_nudgcoef.h (in your project Functionals directory that is set in your build script) for the 3-D domain-wide nudging, and leave Tnudg in ocean.in to apply only to the boundaries.

There is a template for ana_nudgcoef.h in the source code in the Functionals directory but it uses Tnudg from ocean.in. So don't follow it too closely. Pay attention to the units of the nudging scales because they are already in inverse time in ana_nudgcoef.h.

An advantage of customizing ana_nudgcoef.h is that you create a spatial distribution for the nudging that makes sense for your application, rather than applying the same nudging time scale everywhere. Most users want relatively little nudging in the centre of the domain where you want ROMS physics to prevail.

Having a private version of ana_nudgcoef.h will shadow the version in the distributed source code, and you don't need to touch the main source code. It also makes it easier (and safer) to manage multiple projects with different nudging setups.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

justina0622
Posts: 23
Joined: Fri Jan 29, 2010 6:17 pm
Location: GSO URI

Re: Confusion about Nudging Coefficient

#4 Unread post by justina0622 »

Thanks a lot for kate and wilkin's reply. Now I know how to get what I want.
Qian
Qianqian@URI

justina0622
Posts: 23
Joined: Fri Jan 29, 2010 6:17 pm
Location: GSO URI

Re: Confusion about Nudging Coefficient

#5 Unread post by justina0622 »

Dear Users,

We have made several tests about the nudging problem according to the suggestion.

When climatology nudging is defined, we set the nudging coefficients from 5 days to 60 days 8 grids away from the boundary(changed from DAAMEE_4 application
cff1=1.0_r8/(5.0_r8*86400.0_r8)
cff2=1.0_r8/(60.0_r8*86400.0_r8)
DO j=JstrR,MIN(8,JendR)
DO i=IstrR,IendR
wrk(i,j)=cff2+REAL(8-j,r8)*(cff1-cff2)/8.0_r8
END DO
END DO
# ifdef ZCLM_NUDGING
DO j=JstrR,JendR
DO i=IstrR,IendR
CLIMA(ng)%Znudgcof(i,j)=wrk(i,j)
END DO
END DO
# endif
...

). Since there is warning not changing the code about the boundary coefficient, we didn't change it. In my understanding about the code below, the boundary nudging coefficient is set to the value of climatology nudging coefficient at the corresponding location (so 5 days at the southern boundary), and then the climatology nudg coef at the southern boundary is set to zero; however, in the comment part of ana_nudgcoef,h, it is said that: 'Notice that interior nudging coefficient defined above are zero out when boundary condition nudging'. How does it zero out the interior climatology nudg coefficient? I cannot see from the code.
!-----------------------------------------------------------------------
! Set nudging coefficients (1/s) for passive/active (outflow/inflow)
! open boundary conditions. Weak nudging is expected in passive
! outflow conditions and strong nudging is expected in active inflow
! conditions. Notice that interior nudging coefficient defined
! above are zero out when boundary condition nudging.
The USER needs
! to adapt this to his/her application!
!-----------------------------------------------------------------------
!


# ifdef SOUTH_FSNUDGING
# ifdef ZCLM_NUDGING
IF (DOMAIN(ng)%SouthWest_Corner(tile)) THEN
FSobc_out(ng,isouth)=CLIMA(ng)%Znudgcof(1,0)
FSobc_in (ng,isouth)=obcfac(ng)*FSobc_out(ng,isouth)
END IF
IF (DOMAIN(ng)%Southern_Edge(tile)) THEN
DO i=IstrR,IendR
CLIMA(ng)%Znudgcof(i,0)=0.0_r8
END DO
END IF
# ifdef DISTRIBUTE
IF (ng.eq.Ngrids) THEN
CALL mp_collect (ng, model, Ngrids, IniVal, FSobc_out(:,isouth))
CALL mp_collect (ng, model, Ngrids, IniVal, FSobc_in (:,isouth))
END IF
# endif
# else
IF (DOMAIN(ng)%SouthWest_Test(tile)) THEN
FSobc_out(ng,isouth)=Znudg(ng)
FSobc_in (ng,isouth)=obcfac(ng)*Znudg(ng)
END IF
# endif
# endif



The main problem we came into with this application is that: At the western boundary, there is a very sharp gradient in temperature. A strip of lower temperature appears. Would anyone please give us some suggestions? Thank you very much. Following is the cppdef about the nudging.

# define EAST_FSCHAPMAN
# define EAST_M2FLATHER
# define EAST_M3RADIATION
# define EAST_M3NUDGING
# define EAST_TRADIATION
# define EAST_TNUDGING

# define WEST_FSCHAPMAN
# define WEST_M2FLATHER
# define WEST_M3RADIATION
# define WEST_M3NUDGING
# define WEST_TRADIATION
# define WEST_TNUDGING

# define SOUTH_FSCHAPMAN
# define SOUTH_M2FLATHER
# define SOUTH_M3RADIATION
# define SOUTH_M3NUDGING
# define SOUTH_TRADIATION
# define SOUTH_TNUDGING

/**/
# define TCLIMATOLOGY
# define TCLM_NUDGING
# define M3CLIMATOLOGY
# define M3CLM_NUDGING

Thanks a lot.
Qian
Attachments
ann6.jpg
595B8A8A-346B-494A-B8AB-F3F7A4AE633B.jpg
595B8A8A-346B-494A-B8AB-F3F7A4AE633B.jpg (21.23 KiB) Viewed 13503 times
Qianqian@URI

saulo
Posts: 11
Joined: Wed Dec 19, 2007 4:44 pm
Location: School of Ocean and Earth Science and Technology

Re: Confusion about Nudging Coefficient

#6 Unread post by saulo »

From the code in ana_nudgecoef.h if you want to have just a relaxation boundary condition you must activate the option for climatological nudging (grid interior) such as TCLM_NUDGING, even if you don't want a widespread climatological nudging.
So if I want to have a fairly strong nudging at the boundary I need to code values for Tnudgcof(i,j,itemp) that are space dependent: zero in the interior and high on the boundaries in ana_nudgecoef.h.
Question is that sufficient or activation of TCLM_NUDGING means I need to alter other modules, subroutines and/or .h files?

Thanks!

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Confusion about Nudging Coefficient

#7 Unread post by wilkin »

If you want to have nudging ONLY on the boundary points - i.e. strictly on the perimeter - then you don't need TCLM_NUDGING. There are options in the open boundary conditions to do this.

In the most recent version of the code this option is activated with the "Nud" options in ocean.in.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

LiuZHQ
Posts: 46
Joined: Mon Apr 06, 2009 5:12 pm
Location: The Hong Kong University of Sci&Tech

Re: Confusion about Nudging Coefficient

#8 Unread post by LiuZHQ »

looks like the OBC didn't handle the coastal trapped waves well.
Since you seleted Flather, did you also include tidal forcing in your application?

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: Confusion about Nudging Coefficient

#9 Unread post by mengqingjun »

I am still confused about the nudging coefficient.
In my application I set LBC as follows:
ad_LBC(isFsur) == Clo Clo Clo Clo ! free-surface
ad_LBC(isUbar) == Clo Clo Clo Clo ! 2D U-momentum
ad_LBC(isVbar) == Clo Clo Clo Clo ! 2D U-momentum
ad_LBC(isUvel) == Clo Clo Clo Clo ! 3D U-momentum
ad_LBC(isVvel) == Clo Clo Clo Clo ! 3D V-momentum
ad_LBC(isMtke) == Clo Clo Clo Clo ! mixing TKE

ad_LBC(isTvar) == Clo Clo Clo Clo \ ! temperature
Clo Clo Clo Clo ! salinity

and:

! Nudging/relaxation time scales, inverse scales will be computed
! internally, [1:Ngrids].

TNUDG == 0.0d0 0.0d0 ! days
ZNUDG == 0.0d0 ! days
M2NUDG == 0.0d0 ! days
M3NUDG == 0.0d0 ! days

! Factor between passive (outflow) and active (inflow) open boundary
! conditions, [1:Ngrids]. If OBCFAC > 1, nudging on inflow is stronger
! than on outflow (recommended).

OBCFAC == 0.0d0 ! nondimensional


In my .h file:
#define UV_ADV
#define UV_COR
#define UV_QDRAG
#define DJ_GRADPS
#ifdef TS_U3ADV_SPLIT
# define TS_DIF4
# define DIFF_GRID
# define MIX_GEO_TS
#endif
#ifdef UV_U3ADV_SPLIT
# define UV_VIS4
# define VISC_GRID
# define MIX_GEO_UV
#endif
#define NONLIN_EOS
#define SALINITY
#define SOLVE3D
#define MASKING
#define SPLINES
#define QCORRECTION
#define SRELAXATION
#define CURVGRID
#ifdef LMD_MIXING
# define LMD_RIMIX
# define LMD_CONVEC
# define LMD_SKPP
# define LMD_NONLOCAL
#endif
#define ANA_BSFLUX
#define ANA_BTFLUX
I only have the *grd.nc,*frc.nc and *ini.nc as input files.It seems that there are not any nudging !!
But why In my log file:

Analytical header files used:

/data/mengqingjun/Projects/bhd2/ana_btflux.h
/data/mengqingjun/Projects/bhd2/ana_nudgcoef.h
Could anyone help me?

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: Confusion about Nudging Coefficient

#10 Unread post by mengqingjun »

ps. I mean that how the ana_nudgcoef.h was used ?

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Confusion about Nudging Coefficient

#11 Unread post by wilkin »

You have used:

Code: Select all

ad_LBC(...
Those are for the adjoint model. But you have made them CLO meaning closed, so no nudging anyway.

Nudging is used with either:

(1) open boundary option RadNud (for radiation and nudging) but you need to have a boundary conditions file for that (BRYNAME).
or
(2) nudging is applied "everywhere" depending on the configuration in ana_nudgcoef.h and values in TNUDG etc. If you have an ana_nudgcoef.h in your project directory ROMS will compile it. That's why you get the message ...
Analytical header files used:
...
/data/mengqingjun/Projects/bhd2/ana_nudgcoef.h
but I see no option that causes ROMS to use those coefficients.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: Confusion about Nudging Coefficient

#12 Unread post by mengqingjun »

Sorry, I make a mistake ,I used LBC():
LBC(isFsur) == Clo Clo Clo Clo ! free-surface
LBC(isUbar) == Clo Clo Clo Clo ! 2D U-momentum
LBC(isVbar) == Clo Clo Clo Clo ! 2D V-momentum
LBC(isUvel) == Clo Clo Clo Clo ! 3D U-momentum
LBC(isVvel) == Clo Clo Clo Clo ! 3D V-momentum
LBC(isMtke) == Clo Clo Clo Clo ! mixing TKE

LBC(isTvar) == Clo Clo Clo Clo \ ! temperature
Clo Clo Clo Clo ! salinity

But it all closed anyway!
If you have an ana_nudgcoef.h in your project directory ROMS will compile it. That's why you get the message ...
Does it mean that Although the ana_nudgcoef.h was compiled, even the file was not used ,but I can get the message ?

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: Confusion about Nudging Coefficient

#13 Unread post by mengqingjun »

ps. Are there some CPP definitations that could control wheather the file ana_nudgcoef.h will be compiled or not ?

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Confusion about Nudging Coefficient

#14 Unread post by wilkin »

Yes, you have:

#define SRELAXATION

which requires Tnudg.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: Confusion about Nudging Coefficient

#15 Unread post by mengqingjun »

Thank you John for your quick replies !
Except for SRELAXATION TCLM_NUDGING ,are there any other else CPP definations that will compile the file ana_nudgcoef.h?
Coulkd I think that even some files for examole ana_nudgcoef.h was compiled ,they may not be used when run the application ?
Thanks! :)

apaula_oceano
Posts: 3
Joined: Tue Apr 10, 2012 2:24 pm
Location: IOUSP

Re: Confusion about Nudging Coefficient

#16 Unread post by apaula_oceano »

Hello all,

I followed wilkin's suggestion and created a private ana_nudgcoef.h to configure a spatial distribution of the nudging coefficients for my experiment.
I wonder is there is any way of having the nudging coefficient spatial distribution (matrices) as output, in one of the avg/his/dia/etc files.

Thanks in advance,

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Confusion about Nudging Coefficient

#17 Unread post by wilkin »

Rather than use ana_nudgcoef for a complicated configuration of spatially varying nudging coefficients, there is the facility now (since 03/13/14) to specify them within a standalone netcdf file identified within ocean.in

Code: Select all

 NUDNAME == ocean_nud.nc
The new options are described here:
https://www.myroms.org/projects/src/ticket/627

This would allow you to keep a record in a netcdf file of the set-up, and to load them into whatever software you use for analysis if that is the reason you ask whether the analytical set-up could be written to output.

Also note that with the changes described at https://www.myroms.org/projects/src/ticket/627 the nudging coefficients for 3-D variables include the k-index so that they can be made to vary appropriately in the vertical for your application. This is a significant improvement on the 2-dimensional only nudging coefficients in previous versions of ROMS.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply