Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions cellular_automata_sgs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module cellular_automata_sgs_mod

subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lake,condition_cpl, &
ca_deep_cpl,ca_turb_cpl,ca_shal_cpl,domain_in, &
nblks,isc,iec,jsc,jec,npx,npy,nlev,nthresh,rcell, mytile, &
nca,scells,tlives,nfracseed,nseed,iseed_ca, &
nblks,isc,iec,jsc,jec,npx,npy,nlev,nthresh, mytile, &
nca,ncells,nlives,nfracseed,nseed,iseed_ca, &
nspinup,ca_trigger,blocksize,mpiroot,mpicomm)

use kinddef, only: kind_phys,kind_dbl_prec
Expand Down Expand Up @@ -41,12 +41,11 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak
!CA_DEEP can be either number of plumes in a cluster (nca_plumes=true) or updraft
!area fraction (nca_plumes=false)

integer,intent(in) :: kstep,scells,nca,tlives,nseed,nspinup,mpiroot,mpicomm,mytile
integer,intent(in) :: kstep,ncells,nca,nlives,nseed,nspinup,mpiroot,mpicomm,mytile
integer(kind=kind_dbl_prec), intent(in) :: iseed_ca
real(kind=kind_phys), intent(in) :: nfracseed,dtf,rcell
real(kind=kind_phys), intent(in) :: nfracseed,dtf,nthresh
logical,intent(in) :: restart,ca_trigger,first_time_step
integer, intent(in) :: nblks,isc,iec,jsc,jec,npx,npy,nlev,blocksize
real , intent(out) :: nthresh
real(kind=kind_phys), intent(in) :: sst(:,:),lsmsk(:,:),lake(:,:)
real(kind=kind_phys), intent(inout) :: condition_cpl(:,:)
real(kind=kind_phys), intent(inout) :: ca_deep_cpl(:,:)
Expand All @@ -60,7 +59,6 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak
integer :: halo, k_in, i, j, k
integer :: seed, ierr7,blk, ix, iix, count4,ih,jh
integer :: blocksz,levs
integer :: ncells,nlives
integer, save :: initialize_ca
integer(8) :: count, count_rate, count_max, count_trunc,nx_full
integer(8) :: iscale = 10000000000
Expand All @@ -79,9 +77,9 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak
!nca :: switch for number of cellular automata to be used.
! :: for the moment only 1 CA can be used
!nfracseed :: switch for number of random cells initially seeded
!tlives :: switch for time scale (s)
!nlives :: switch for time scale (s)
!nspinup :: switch for number of itterations to spin up the ca
!scells :: switch for CA cell size (m)
!ncells :: switch for CA cell size (m)
!nca_plumes :: compute number of CA-cells ("plumes") within a NWP gridbox.

if (nca .LT. 1) return
Expand Down Expand Up @@ -117,16 +115,7 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak

!Set time and length scales:
call mpp_get_global_domain(domain_in,xsize=nx,ysize=ny,position=CENTER)
pi=3.14159
re=6371000.
dx=0.5*pi*re/real(nx)
ncells=int(dx/real(scells))
nlives=int(real(tlives)/dtf)
ncells = MIN(ncells,10)
nlives = MAX(nlives,5)

nthresh=rcell*real(ncells)*real(ncells)


if(mype == 1)then
write(*,*)'ncells=',ncells
write(*,*)'nlives=',nlives
Expand Down
17 changes: 4 additions & 13 deletions update_ca.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ subroutine write_ca_restart(timestamp)
character(len=32) :: fn_ca = 'ca_data.nc'

type(FmsNetcdfDomainFile_t) :: CA_restart
integer :: id_restart,ncells,nx,ny,i
integer :: id_restart,nx,ny,i
integer :: is,ie,js,je,nca,nca_g

integer, allocatable, dimension(:) :: buffer
Expand Down Expand Up @@ -183,35 +183,26 @@ subroutine write_ca_restart(timestamp)

end subroutine write_ca_restart

subroutine read_ca_restart(domain_in,scells,nca,ncells_g,nca_g)
subroutine read_ca_restart(domain_in,ncells,nca,ncells_g,nca_g)
!Read restart files
implicit none
type(FmsNetcdfDomainFile_t) :: CA_restart
type(domain2D), intent(inout) :: domain_in
integer,intent(in) :: scells,nca,nca_g,ncells_g
integer,intent(in) :: ncells,nca,nca_g,ncells_g
character(len=32) :: fn_ca = 'ca_data.nc'

character(len=64) :: fname
integer :: id_restart
integer :: nxc,nyc,i
real :: pi,re,dx
integer :: ncells,nx,ny
integer :: nx,ny
character(5) :: indir='INPUT'
logical :: amiopen
integer, allocatable, dimension(:) :: io_layout(:)




call mpp_get_global_domain(domain_in,xsize=nx,ysize=ny,position=CENTER)

!Set time and length scales:
pi=3.14159
re=6371000.
dx=0.5*pi*re/real(nx)
ncells=int(dx/real(scells))
ncells= MIN(ncells,10)

fname = trim(indir)//'/'//trim(fn_ca)
if (nca .gt. 0 ) then
allocate(io_layout(2))
Expand Down