how to set the spong layer

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
rongzr
Posts: 35
Joined: Mon Jul 17, 2006 4:03 pm
Location: OUC/UMCES

how to set the spong layer

#1 Unread post by rongzr »

In the ROMS code, they just give a simple example


#ifdef SPONGE
!
!-----------------------------------------------------------------------
! Increase horizontal mixing in the sponge areas.
!-----------------------------------------------------------------------
!
!! User modifiable section. Please specify the appropiate sponge area
!! by increasing its horizontal mixing coefficients.
!!

# if defined ADRIA02
!
! Adriatic Sea southern sponge areas.
!
fac=4.0_r8
# if defined UV_VIS2
DO i=IstrR,IendR
DO j=JstrR,MIN(6,JendR)
cff=visc2(ng)+REAL(6-j,r8)*(fac*visc2(ng)-visc2(ng))/6.0_r8
visc2_r(i,j)=cff
visc2_p(i,j)=cff
END DO
DO j=MAX(JstrR,7),JendR
visc2_r(i,j)=0.0_r8
visc2_p(i,j)=0.0_r8
END DO

END DO

I just wonder whether here is wrong: the viscosity cannot be set to zero outside the sponge layer. Why here it's set to zero? If I define my own case,should I set it to my value?

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

Re: how to set the spong layer

#2 Unread post by jacopo »

In many application the viscosity is simply zero because numerical schemes for advection may already include implicit mixing.
Of course, I suppose you can set whatever viscosity value you want.
Does it make sense to you?

cheers,

Jacopo

rongzr
Posts: 35
Joined: Mon Jul 17, 2006 4:03 pm
Location: OUC/UMCES

Re: how to set the spong layer

#3 Unread post by rongzr »

Thanks Jacopo.
I’m still a little confused. In the same subroutine (ana_hmixoef.h), if define VISC_GRID, they set the horizontal viscosity according to the grid size:
cff=visc2(ng)/grdmax(ng)
DO j=JstrR,JendR
DO i=IstrR,IendR
visc2_r(i,j)=cff*grdscl(i,j)
END DO
END DO
I suppose the variable visc2_r should be the horizontal varied viscosity.
Then I just wonder, if not define VISC_GRID, the horizontal viscosity should at least being set to the value VISC2 in the *.in file rather than zero, right???
Last edited by rongzr on Wed Feb 04, 2009 3:07 pm, edited 1 time in total.

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

Re: how to set the spong layer

#4 Unread post by jacopo »

rongzr wrote: if define VISC_GRID, they set the horizontal viscosity according to the grid size:
cff=visc2(ng)/grdmax(ng)
DO j=JstrR,JendR
DO i=IstrR,IendR
visc2_r(i,j)=cff*grdscl(i,j)
END DO
END DO
I suppose the variable visc2_r should be the horizontal varied viscosity.
Then I just wonder, if not define VISC_GRID, the horizontal viscosity should at least being set to the value TNU2 in the *.in file rather than zero, right???
I'm not sure to see your last point.

If you want a sponge layer, your visc2 must be non zero, in fact

Code: Select all

cff=visc2(ng)+REAL(6-j,r8)*(fac*visc2(ng)-visc2(ng))/6.0_r8
cff would be simply zero if visc2(ng)==0.

At the same time, if you have a non-zero visc2(ng) you cannot write that visc2_r outside the sponge layer is equal to visc2(ng) IF you want a zero viscosity far from the boundaries. In this case, you have then to explicitly set

Code: Select all

        DO j=MAX(JstrR,7),JendR
          visc2_r(i,j)=0.0_r8
          visc2_p(i,j)=0.0_r8
        END DO
This is true whether VISC_GRID is defined or not

This is just my two cents, I haven't checked the full code before replying :oops:

cheers,

Jacopo

PS. I have edited once this topic after first posting. There was a wrong statement.

rongzr
Posts: 35
Joined: Mon Jul 17, 2006 4:03 pm
Location: OUC/UMCES

Re: how to set the spong layer

#5 Unread post by rongzr »

Hi,Jacopo, Thanks. I got your point.
In my case, I will never set the horizontal viscosity to zero. So I just set visc2_r outside the sponge layer to visc2(ng) or visc2_r( visc2(ng)/grdmax(ng)*grdscl(i,j), when VISC_GRID is defined).

In my understanding, if not define the sponge layer, the horizontal viscosity is set to VISC2(which is given in the ocean.in file), right? So, in what kind of situation, can the horizontal viscosity be set to zero? I never saw people set it to zero, do you have any reference?
Last edited by rongzr on Wed Feb 04, 2009 3:08 pm, edited 1 time in total.

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

Re: how to set the spong layer

#6 Unread post by jacopo »

rongzr wrote:Hi,Jacopo, Thanks. I got your point.
In my case, I will never set the horizontal viscosity to zero.
[...]
In my understanding, if not define the sponge layer, the horizontal viscosity is set to TNU2(which is given in the ocean.in file)
yeah, you can set whatever value you need, of course, and this is visc2(ng) value. (Note that you typed TNU2 a few times. tnus2 is the diffusivity and it applies to tracers, not momentum)
rongzr wrote: So I just set visc2_r outside the sponge layer to visc2(ng) or visc2_r( visc2(ng)/grdmax(ng)*grdscl(i,j), when VISC_GRID is defined).
yep.
rongzr wrote: In my understanding, if not define the sponge layer, the horizontal viscosity is set to TNU2(which is given in the ocean.in file), right? So, in what kind of situation, can the horizontal viscosity be set to zero? I never saw people set it to zero, do you have any reference?
Again, the horizontal viscosity is set to VISC2, not TNU2.

The 3rd order upstream advection scheme http://www.myroms.org/Papers/shch_mcw_1999.pdf does include implicit diffusion, so sometimes, in certain application, you don't need additional horizontal smoothing of momentum. Other schemes might require explicit viscosity. Probably if you search the forum you will find additional posts about this topic.

cheers

rongzr
Posts: 35
Joined: Mon Jul 17, 2006 4:03 pm
Location: OUC/UMCES

Re: how to set the spong layer

#7 Unread post by rongzr »

Thanks,Jacopo. It's clear to me now!
I mistook TNU2 to VISC2. I have edited it.

Post Reply