Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hycom_mean to MSCPROGS #271

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -604,3 +604,7 @@ hycom/hycom_ALL/hycom_2.2.72_ALL/topo/src_2.2.72/topo_smooth_skip
hycom/hycom_ALL/hycom_2.2.72_ALL/topo/src_2.2.72/topo_subset
hycom/hycom_ALL/hycom_2.2.72_ALL/topo/src_2.2.72/topo_zcells
hycom/hycom_ALL/hycom_2.2.72_ALL/topo/src_2.2.72/topo_zthin

hycom/MSCPROGS/src/Hyc2proj/TMP/*
hycom/MSCPROGS/src/IceDriftNC/TMP/*

52 changes: 52 additions & 0 deletions hycom/MSCPROGS/src/Average/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## hycom_mean

```hycom_mean``` is F90 version of ```hycom/hycom_ALL/hycom_2.2.72_ALL/meanstd/src/hycom_mean``` for making an ensemble average of hycom archive files. Note that other options, such as meanstd or meansq, available in the original ```hycom_mean``` are not available at this moment.

### Step1. Prepare configuration file ```mean_hycom.in```:

```
50 'kk ' = number of layers involved
0 'meansq' = form meansq, rather than mean (0=F,1=T)
2 'narchs' = number of archives to read (==0 to end input)
file_mem001.a
file_mem002.a
0 'narchs' = number of archives to read (==0 to end input)
file_mean
```

where ```narchs``` is number of hycom ab files to be averaged,

```
file_mem001.a
file_mem002.a
```

are a list of input hycom a files,

```
file_mean
```

specifies a name of mean ab files: ```file_mean.a```,```file_mean.b```, generated by ```hycom_mean```.

### Step 2. Run script at command line:

```bash
hycom_mean < mean_hycom.in
```

### Notes

Upon change of BGC variables list on hycom b file, you need to modify variable registraion in ```mod_mean.F90```.

In order to use ```hycom_mean``` with HYCOM-CICE setup without ECOSMO, you need to turn off ECOSMO option set in ```hycom_mean.F90``` by changing:

```
lecosmo = .true.
```

to

```
lecosmo = .false.
```
72 changes: 72 additions & 0 deletions hycom/MSCPROGS/src/Average/bigrid.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
subroutine bigrid(depth)
use mod_mean ! HYCOM mean array interface
use mod_za ! HYCOM array I/O interface
implicit none

integer :: i, j
real, dimension(0:ii,0:jj) :: depth

! --- set land/sea masks for irregular basin in c-grid configuration
! --- q,u,v,p are vorticity, u-velocity, v-velocity, and mass points, resp.
! --- 'depth' = basin depth array, zero values indicate land

integer, allocatable, dimension (:,:) :: ip0

allocate( ip0(0:ii,0:jj) )

write (lp,'(a,6i6)') 'bigrid called with ii,jj,ii1,jj1 =', ii,jj,ii1,jj1

! --- mass points are defined where water depth is greater than zero
do i=0,ii
do j=0,jj
if (depth(i,j).gt.0.) then
ip0(i,j)=1
else
ip0(i,j)=0
endif
enddo
enddo

do i=1,ii
do j=1,jj
ip(i,j)=ip0(i,j)
enddo
enddo

! --- u,v points are located halfway between any 2 adjoining mass points
do j=1,jj
do i=1,ii
if (ip0(i-1,j).gt.0.and.ip0(i,j).gt.0) then
iu(i,j)=1
else
iu(i,j)=0
endif
if (ip0(i,j-1).gt.0.and.ip0(i,j).gt.0) then
iv(i,j)=1
else
iv(i,j)=0
endif
enddo
enddo

do j=1,jj
do i=1,ii
iq(i,j)=0

! --- 'interior' q points require water on all 4 sides.
if (min0(ip(i,j),ip(i-1,j),ip(i,j-1),ip(i-1,j-1)).gt.0) then
iq(i,j)=1
endif

! --- 'promontory' q points require water on 3
! --- (or at least 2 diametrically opposed) sides
if ((ip(i,j).gt.0.and.ip(i-1,j-1).gt.0).or.(ip(i-1,j).gt.0.and.ip(i,j-1).gt.0)) then
iq(i,j)=1
endif
enddo
enddo

deallocate( ip0 )

return
end subroutine bigrid
Loading