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?
how to set the spong layer
Re: how to set the spong layer
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
Of course, I suppose you can set whatever viscosity value you want.
Does it make sense to you?
cheers,
Jacopo
Re: how to set the spong layer
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???
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.
Re: how to set the spong layer
I'm not sure to see your last point.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???
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
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 just my two cents, I haven't checked the full code before replying
cheers,
Jacopo
PS. I have edited once this topic after first posting. There was a wrong statement.
Re: how to set the spong layer
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?
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.
Re: how to set the spong layer
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: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)
yep.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).
Again, the horizontal viscosity is set to VISC2, not TNU2.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?
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
Re: how to set the spong layer
Thanks,Jacopo. It's clear to me now!
I mistook TNU2 to VISC2. I have edited it.
I mistook TNU2 to VISC2. I have edited it.