[MITgcm-support] how to compute flux to get eta balance

Chun-Yan Zhou c.zhou at dundee.ac.uk
Sun Sep 2 17:13:48 EDT 2012


Hi all,
I did a regional model with south and east boundary driven by boundary velocity, but the mean eta increase slowly along with time. So I meed to modify the south boundary v velocity and east boundary u velocity in order to get flux in and flux out balance.

The south boundary has 174 points and 40 layers while east boundary has 226 points and 40 layers.
my understanding after looking through the manual is that
south boundary : the flux in each grid = hfacc*drf*dxg*masks*vsouth
east boundary :  the flux in each grid =  hfacc*drf*dyg*maskw*ueast
Therefore, I compute the flux in and flux out the model area as follows,but I am not sure I use the right formula, because there is also hfacs,hfacw,drc parameters. Can anyone confirm whether the formula is right or wrong?

vin=0;
for i=1:174
for k=1:40
vin=vin+hfacc(i,1,k)*drf(1,1,k)*dxg(i,1)*masks(i,2,k)*vsouth(i,k);
end
end

uout=0;
for j=1:226
for k=1:40
uout=uout+hfacc(174,j,k)*drf(1,1,k)*dyg(174,j)*maskw(174,j,k)*ueast(j,k);
end
end




Chunyan Zhou
Division of Civil Engineering
School of Engineering, Physics and Mathematics
College of Art, Science and Engineering
Fulton Building,G19
University of Dundee
Dundee, UK DD1 4HN
Tel. 01382 385431



________________________________________
From: mitgcm-support-request at mitgcm.org [mitgcm-support-request at mitgcm.org]
Sent: 24 August 2012 02:43
To: mitgcm-support at mitgcm.org
Subject: MITgcm-support Digest, Vol 110, Issue 17

Send MITgcm-support mailing list submissions to
        mitgcm-support at mitgcm.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mitgcm.org/mailman/listinfo/mitgcm-support
or, via email, send a message with subject or body 'help' to
        mitgcm-support-request at mitgcm.org

You can reach the person managing the list at
        mitgcm-support-owner at mitgcm.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MITgcm-support digest..."


Today's Topics:

   1. using gather/scatter to work with global fields (Katherine Quinn)
   2. Re: using gather/scatter to work with global fields
      (Matthew Mazloff)
   3. Re: using gather/scatter to work with global fields
      (Katherine Quinn)
   4. Re: using gather/scatter to work with global fields
      (Matthew Mazloff)
   5. vertical velocities in high-res runs (Andreas Klocker)


----------------------------------------------------------------------

Message: 1
Date: Thu, 23 Aug 2012 13:40:55 -0400
From: Katherine Quinn <kquinn at aer.com>
To: mitgcm-support at mitgcm.org
Subject: [MITgcm-support] using gather/scatter to work with global
        fields
Message-ID: <50366B27.4040901 at aer.com>
Content-Type: text/plain; CHARSET=US-ASCII; format=flowed

Hi all,
Within the MITgcm code (not matlab) I need to gather tiled variables
into a global array, specifically I'm trying to gather XC and YC.  I'm
using the subroutine gather_2d_r4, which suggests "barrier calls" before
and after but it seems no matter what various barrier calls I use, when
I look at the global array there's chunks of tiles missing.  Other
relevant info - the MITgcm setup is for ecco version 4 runs, with
all_exch2 turned on.
Here's the relevant portions of my code, please suggest what I'm doing
wrong:

C     == Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "EESUPPORT.h"
#include "PARAMS.h"
#ifdef ALLOW_EXCH2
# include "W2_EXCH2_SIZE.h"
# include "W2_EXCH2_TOPOLOGY.h"
# include "W2_EXCH2_PARAMS.h"
#endif /* ALLOW_EXCH2 */
#include "EEBUFF_SCPU.h"
#include "GRID.h"

C     INPUT/OUTPUT PARAMETERS:
C     == Routine arguments ==
C     myThid - Thread number for this instance of the routine.
       INTEGER  myThid

C     LOCAL VARIABLES:
       LOGICAL zeroBuff, useExch2ioLayOut
       INTEGER xSize, ySize
#ifdef ALLOW_EXCH2
       _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
       _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
#else  /* ALLOW_EXCH2 */
       _RS  XC_global(Nx,Ny)
       _RS  YC_global(Nx,Ny)
#endif /* ALLOW_EXCH2 */

C Set dimensions and flags (e.g. mdsio_write_field.F)
       xSize = Nx
       ySize = Ny
       useExch2ioLayOut = .FALSE.
       zeroBuff = .TRUE.
#ifdef ALLOW_EXCH2
       IF ( W2_useE2ioLayOut ) THEN
          xSize = exch2_global_Nx
          ySize = exch2_global_Ny
          useExch2ioLayOut = .TRUE.
       ENDIF
#endif /* ALLOW_EXCH2 */

C gather XC and YC into global model grid

       CALL BAR2( myThid )
       _BEGIN_MASTER( myThid )
       CALL GATHER_2D_R4(
      O                  XC_global,
      I                  XC,
      I                  xSize, ySize,
      I                  useExch2ioLayOut,
      I                  zeroBuff,
      I                  myThid )
       _END_MASTER( myThid )
       CALL BAR2( myThid )

       _BEGIN_MASTER( myThid )
       CALL GATHER_2D_R4(
      O                  YC_global,
      I                  YC,
      I                  xSize, ySize,
      I                  useExch2ioLayOut,
      I                  zeroBuff,
      I                  myThid )
       _END_MASTER( myThid )
       CALL BAR2( myThid )



--
Katherine J. Quinn
Atmospheric and Environmental Research         voice: 781-761-2234
131 Hartwell Avenue                              fax: 781-761-2299
Lexington, MA  02421-3126                     e-mail: kquinn at aer.com



------------------------------

Message: 2
Date: Thu, 23 Aug 2012 11:03:09 -0700
From: Matthew Mazloff <mmazloff at ucsd.edu>
To: <mitgcm-support at mitgcm.org>
Subject: Re: [MITgcm-support] using gather/scatter to work with global
        fields
Message-ID: <C862A330-E66C-42A4-BE97-E2F1F95842B2 at ucsd.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hi Katherine

Do you have
DISABLE_MPI_READY_TO_RECEIVE
defined.  If you do, perhaps try it with it undefined.

-Matt



On Aug 23, 2012, at 10:40 AM, Katherine Quinn wrote:

> Hi all,
> Within the MITgcm code (not matlab) I need to gather tiled variables
> into a global array, specifically I'm trying to gather XC and YC.
> I'm using the subroutine gather_2d_r4, which suggests "barrier
> calls" before and after but it seems no matter what various barrier
> calls I use, when I look at the global array there's chunks of tiles
> missing.  Other relevant info - the MITgcm setup is for ecco version
> 4 runs, with all_exch2 turned on.
> Here's the relevant portions of my code, please suggest what I'm
> doing wrong:
>
> C     == Global variables ===
> #include "SIZE.h"
> #include "EEPARAMS.h"
> #include "EESUPPORT.h"
> #include "PARAMS.h"
> #ifdef ALLOW_EXCH2
> # include "W2_EXCH2_SIZE.h"
> # include "W2_EXCH2_TOPOLOGY.h"
> # include "W2_EXCH2_PARAMS.h"
> #endif /* ALLOW_EXCH2 */
> #include "EEBUFF_SCPU.h"
> #include "GRID.h"
>
> C     INPUT/OUTPUT PARAMETERS:
> C     == Routine arguments ==
> C     myThid - Thread number for this instance of the routine.
>      INTEGER  myThid
>
> C     LOCAL VARIABLES:
>      LOGICAL zeroBuff, useExch2ioLayOut
>      INTEGER xSize, ySize
> #ifdef ALLOW_EXCH2
>      _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
>      _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
> #else  /* ALLOW_EXCH2 */
>      _RS  XC_global(Nx,Ny)
>      _RS  YC_global(Nx,Ny)
> #endif /* ALLOW_EXCH2 */
>
> C Set dimensions and flags (e.g. mdsio_write_field.F)
>      xSize = Nx
>      ySize = Ny
>      useExch2ioLayOut = .FALSE.
>      zeroBuff = .TRUE.
> #ifdef ALLOW_EXCH2
>      IF ( W2_useE2ioLayOut ) THEN
>         xSize = exch2_global_Nx
>         ySize = exch2_global_Ny
>         useExch2ioLayOut = .TRUE.
>      ENDIF
> #endif /* ALLOW_EXCH2 */
>
> C gather XC and YC into global model grid
>
>      CALL BAR2( myThid )
>      _BEGIN_MASTER( myThid )
>      CALL GATHER_2D_R4(
>     O                  XC_global,
>     I                  XC,
>     I                  xSize, ySize,
>     I                  useExch2ioLayOut,
>     I                  zeroBuff,
>     I                  myThid )
>      _END_MASTER( myThid )
>      CALL BAR2( myThid )
>
>      _BEGIN_MASTER( myThid )
>      CALL GATHER_2D_R4(
>     O                  YC_global,
>     I                  YC,
>     I                  xSize, ySize,
>     I                  useExch2ioLayOut,
>     I                  zeroBuff,
>     I                  myThid )
>      _END_MASTER( myThid )
>      CALL BAR2( myThid )
>
>
>
> --
> Katherine J. Quinn
> Atmospheric and Environmental Research         voice: 781-761-2234
> 131 Hartwell Avenue                              fax: 781-761-2299
> Lexington, MA  02421-3126                     e-mail: kquinn at aer.com
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support




------------------------------

Message: 3
Date: Thu, 23 Aug 2012 14:50:53 -0400
From: Katherine Quinn <kquinn at aer.com>
To: mitgcm-support at mitgcm.org
Subject: Re: [MITgcm-support] using gather/scatter to work with global
        fields
Message-ID: <50367B8D.4000106 at aer.com>
Content-Type: text/plain; CHARSET=US-ASCII; format=flowed

Hi Matt,
DISABLE_MPI_READY_TO_RECEIVE already is undefined.
Any other ideas?  All this barrier, process, tiles stuff is driving me
batty.
cheers, Katy

Katherine Quinn wrote:
> Matthew Mazloff mmazloff at ucsd.edu
> Thu Aug 23 14:03:09 EDT 2012
>
> Hi Katherine
>
> Do you have
> DISABLE_MPI_READY_TO_RECEIVE
> defined.  If you do, perhaps try it with it undefined.
>
> -Matt
>
> Katherine Quinn wrote:
>> Hi all,
>> Within the MITgcm code (not matlab) I need to gather tiled variables
>> into a global array, specifically I'm trying to gather XC and YC.  I'm
>> using the subroutine gather_2d_r4, which suggests "barrier calls"
>> before and after but it seems no matter what various barrier calls I
>> use, when I look at the global array there's chunks of tiles missing.
>> Other relevant info - the MITgcm setup is for ecco version 4 runs,
>> with all_exch2 turned on.
>> Here's the relevant portions of my code, please suggest what I'm doing
>> wrong:
>>
>> C     == Global variables ===
>> #include "SIZE.h"
>> #include "EEPARAMS.h"
>> #include "EESUPPORT.h"
>> #include "PARAMS.h"
>> #ifdef ALLOW_EXCH2
>> # include "W2_EXCH2_SIZE.h"
>> # include "W2_EXCH2_TOPOLOGY.h"
>> # include "W2_EXCH2_PARAMS.h"
>> #endif /* ALLOW_EXCH2 */
>> #include "EEBUFF_SCPU.h"
>> #include "GRID.h"
>>
>> C     INPUT/OUTPUT PARAMETERS:
>> C     == Routine arguments ==
>> C     myThid - Thread number for this instance of the routine.
>>       INTEGER  myThid
>>
>> C     LOCAL VARIABLES:
>>       LOGICAL zeroBuff, useExch2ioLayOut
>>       INTEGER xSize, ySize
>> #ifdef ALLOW_EXCH2
>>       _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
>>       _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
>> #else  /* ALLOW_EXCH2 */
>>       _RS  XC_global(Nx,Ny)
>>       _RS  YC_global(Nx,Ny)
>> #endif /* ALLOW_EXCH2 */
>>
>> C Set dimensions and flags (e.g. mdsio_write_field.F)
>>       xSize = Nx
>>       ySize = Ny
>>       useExch2ioLayOut = .FALSE.
>>       zeroBuff = .TRUE.
>> #ifdef ALLOW_EXCH2
>>       IF ( W2_useE2ioLayOut ) THEN
>>          xSize = exch2_global_Nx
>>          ySize = exch2_global_Ny
>>          useExch2ioLayOut = .TRUE.
>>       ENDIF
>> #endif /* ALLOW_EXCH2 */
>>
>> C gather XC and YC into global model grid
>>
>>       CALL BAR2( myThid )
>>       _BEGIN_MASTER( myThid )
>>       CALL GATHER_2D_R4(
>>      O                  XC_global,
>>      I                  XC,
>>      I                  xSize, ySize,
>>      I                  useExch2ioLayOut,
>>      I                  zeroBuff,
>>      I                  myThid )
>>       _END_MASTER( myThid )
>>       CALL BAR2( myThid )
>>
>>       _BEGIN_MASTER( myThid )
>>       CALL GATHER_2D_R4(
>>      O                  YC_global,
>>      I                  YC,
>>      I                  xSize, ySize,
>>      I                  useExch2ioLayOut,
>>      I                  zeroBuff,
>>      I                  myThid )
>>       _END_MASTER( myThid )
>>       CALL BAR2( myThid )
>>
>>
>>
>

--
Katherine J. Quinn
Atmospheric and Environmental Research         voice: 781-761-2234
131 Hartwell Avenue                              fax: 781-761-2299
Lexington, MA  02421-3126                     e-mail: kquinn at aer.com



------------------------------

Message: 4
Date: Thu, 23 Aug 2012 18:37:05 -0700
From: Matthew Mazloff <mmazloff at ucsd.edu>
To: <mitgcm-support at mitgcm.org>
Subject: Re: [MITgcm-support] using gather/scatter to work with global
        fields
Message-ID: <E0AC6D20-5E4E-418E-A32D-3BA2433A04A7 at ucsd.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hi Katy,

The only time I've seen this before is if the model run ends before it
has had time to finish writing some of the output.  If this is showing
up in writing of XC and YC, are you running many timesteps?  I could
see this happening if you only run 1 timestep -- try running for longer.

Otherwise, I am afraid I am out of ideas.

-Matt


On Aug 23, 2012, at 11:50 AM, Katherine Quinn wrote:

> Hi Matt,
> DISABLE_MPI_READY_TO_RECEIVE already is undefined.
> Any other ideas?  All this barrier, process, tiles stuff is driving
> me batty.
> cheers, Katy
>
> Katherine Quinn wrote:
>> Matthew Mazloff mmazloff at ucsd.edu
>> Thu Aug 23 14:03:09 EDT 2012
>> Hi Katherine
>> Do you have
>> DISABLE_MPI_READY_TO_RECEIVE
>> defined.  If you do, perhaps try it with it undefined.
>> -Matt
>> Katherine Quinn wrote:
>>> Hi all,
>>> Within the MITgcm code (not matlab) I need to gather tiled
>>> variables into a global array, specifically I'm trying to gather
>>> XC and YC.  I'm using the subroutine gather_2d_r4, which suggests
>>> "barrier calls" before and after but it seems no matter what
>>> various barrier calls I use, when I look at the global array
>>> there's chunks of tiles missing.  Other relevant info - the MITgcm
>>> setup is for ecco version 4 runs, with all_exch2 turned on.
>>> Here's the relevant portions of my code, please suggest what I'm
>>> doing wrong:
>>>
>>> C     == Global variables ===
>>> #include "SIZE.h"
>>> #include "EEPARAMS.h"
>>> #include "EESUPPORT.h"
>>> #include "PARAMS.h"
>>> #ifdef ALLOW_EXCH2
>>> # include "W2_EXCH2_SIZE.h"
>>> # include "W2_EXCH2_TOPOLOGY.h"
>>> # include "W2_EXCH2_PARAMS.h"
>>> #endif /* ALLOW_EXCH2 */
>>> #include "EEBUFF_SCPU.h"
>>> #include "GRID.h"
>>>
>>> C     INPUT/OUTPUT PARAMETERS:
>>> C     == Routine arguments ==
>>> C     myThid - Thread number for this instance of the routine.
>>>      INTEGER  myThid
>>>
>>> C     LOCAL VARIABLES:
>>>      LOGICAL zeroBuff, useExch2ioLayOut
>>>      INTEGER xSize, ySize
>>> #ifdef ALLOW_EXCH2
>>>      _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
>>>      _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
>>> #else  /* ALLOW_EXCH2 */
>>>      _RS  XC_global(Nx,Ny)
>>>      _RS  YC_global(Nx,Ny)
>>> #endif /* ALLOW_EXCH2 */
>>>
>>> C Set dimensions and flags (e.g. mdsio_write_field.F)
>>>      xSize = Nx
>>>      ySize = Ny
>>>      useExch2ioLayOut = .FALSE.
>>>      zeroBuff = .TRUE.
>>> #ifdef ALLOW_EXCH2
>>>      IF ( W2_useE2ioLayOut ) THEN
>>>         xSize = exch2_global_Nx
>>>         ySize = exch2_global_Ny
>>>         useExch2ioLayOut = .TRUE.
>>>      ENDIF
>>> #endif /* ALLOW_EXCH2 */
>>>
>>> C gather XC and YC into global model grid
>>>
>>>      CALL BAR2( myThid )
>>>      _BEGIN_MASTER( myThid )
>>>      CALL GATHER_2D_R4(
>>>     O                  XC_global,
>>>     I                  XC,
>>>     I                  xSize, ySize,
>>>     I                  useExch2ioLayOut,
>>>     I                  zeroBuff,
>>>     I                  myThid )
>>>      _END_MASTER( myThid )
>>>      CALL BAR2( myThid )
>>>
>>>      _BEGIN_MASTER( myThid )
>>>      CALL GATHER_2D_R4(
>>>     O                  YC_global,
>>>     I                  YC,
>>>     I                  xSize, ySize,
>>>     I                  useExch2ioLayOut,
>>>     I                  zeroBuff,
>>>     I                  myThid )
>>>      _END_MASTER( myThid )
>>>      CALL BAR2( myThid )
>>>
>>>
>>>
>
> --
> Katherine J. Quinn
> Atmospheric and Environmental Research         voice: 781-761-2234
> 131 Hartwell Avenue                              fax: 781-761-2299
> Lexington, MA  02421-3126                     e-mail: kquinn at aer.com
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support




------------------------------

Message: 5
Date: Fri, 24 Aug 2012 11:43:15 +1000
From: Andreas Klocker <andreas.klocker at anu.edu.au>
To: mitgcm-support at mitgcm.org
Subject: [MITgcm-support] vertical velocities in high-res runs
Message-ID: <5036DC33.3080200 at anu.edu.au>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Hi everyone,

I've got a little problem with vertical velocities in I high-res run which I don't understand and I have no idea how to get rid of that problem.

The model is a channel with realistic topography, 1/20 deg resolution, 150 vertical layers, see below data file for more info.

The problem: As you can see in the attached figure of the vertical velocity I always get two lines (which not quite follow isopycnals) which have very strong grid-scale vertical velocities along them which do not make sense. I tried both advection scheme 7 and 33 and it doesn't make much of a difference. When I add more Smagorinsky visc. the whole velocity filed gets much smoother and less energetic but the problem of the grid-scale noise doesn't change. If I use KPP it produces large vertical diff. in those regions but the problem doesn't go away...I'm not sure what else to try...

Has anyone got an idea what could cause that problem and how to solve it?

cheers,
Andreas

# Continuous equation parameters
  &PARM01
  tRef               = 150*5.0,
  sRef               = 150*34.5,
  viscAr= 5.6614e-04,
  diffKrT=1.e-5,
  diffKrS=1.e-5,
  no_slip_sides=.FALSE.,
  no_slip_bottom=.TRUE.,
  rhonil=1027.5,
  rhoConstFresh=999.8,
  eosType='JMD95Z',
# hFacMinDr=50.,
# hFacMin=0.5,
  hFacInf=0.01,
  hFacSup=2.,
  select_rStar=2,
  nonlinFreeSurf=4,
  implicitDiffusion=.TRUE.,
  implicitViscosity=.TRUE.,
# ivdc_kappa=100.,
  viscC4Leith=2.,
  viscC4Leithd=2.,
  viscC2Leith=1.5,
  viscC2Leithd=1.5,
  viscA4GridMax=0.5,
  viscC2Smag=1.5,
# viscA4=2.0E8,
# viscAhD=60,
  useAreaViscLength=.TRUE.,
  sideDragFactor=0.,
# highOrderVorticity  = .TRUE.,
  useAbsVorticity=.TRUE.,
  selectVortScheme=2,
  selectKEscheme=3,
  bottomDragQuadratic = 0.0025,
  tempAdvScheme=7,
  saltAdvScheme=7,
  StaggerTimeStep=.TRUE.,
  multiDimAdvection=.TRUE.,
  vectorInvariantMomentum=.TRUE.,
  implicitFreeSurface=.TRUE.,
  exactConserv=.TRUE.,
# debuglevel=4,
  convertFW2Salt=-1
  useRealFreshWaterFlux=.TRUE.,
  useSingleCPUio=.TRUE.,
  globalFiles=.TRUE.,
  allowFreezing=.TRUE.,
# useJamartWetPoints=.TRUE.,
  &

--
===============================================
Dr. Andreas Klocker
Research Fellow

Center of Excellence for Climate System Science
&
Geophysical Fluid Dynamics Group
Research School of Earth Sciences
Room J7.221, Jaeger 7 Building
The Australian National University
Canberra ACT 0200 Australia

T:     +61 2 6125 0920
M:     +61 437 870 182
W:     http://web.mit.edu/aklocker/www/
skype: andiklocker
===============================================

-------------- next part --------------
A non-text attachment was scrubbed...
Name: w_vertical_slice.png
Type: image/png
Size: 963233 bytes
Desc: not available
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20120824/41c52e32/attachment.png>

------------------------------

_______________________________________________
MITgcm-support mailing list
MITgcm-support at mitgcm.org
http://mitgcm.org/mailman/listinfo/mitgcm-support


End of MITgcm-support Digest, Vol 110, Issue 17
***********************************************


The University of Dundee is a registered Scottish Charity, No: SC015096




More information about the MITgcm-support mailing list