subroutine ch_baloper C *--------------------------------------------------------- #if defined (DOC) * ***s/r ch_baloper - Apply variable transformation(s) in grid space using * balance operator(s). * * *Author : Y.J. Rochon, ARQX/MSC, April 2007 * *Revision: * * ------------------- * * PURPOSE: Apply variable transformation(s) in grid space using * balance operator(s). * * See divbal.ftn or bmass.ftn for reference. * *Arguments: * * INPUT * * OUTPUT * *----------------------------------------------------------- #endif IMPLICIT NONE C C Global variables C #include "pardim.cdk"
#include "comdim.cdk"
#include "comlun.cdk"
#include "comgem.cdk"
#include "comleg.cdk"
#include "comgd0.cdk"
#include "comchem.cdk"
#include "combalop.cdk"
C C* Local variables C integer j,j1,jlon,jlat,jv1,jv2,jv12,jv22,jnj1,jnj2 C if (nbalop.eq.0) return C WRITE(NULOUT,*) ' ' WRITE(NULOUT,*) 'Enter CH_BALOPER' WRITE(NULOUT,*) ' ' C DO J=1,NBALOP C C Identify array ranges for variables C jv1=nbalsrc(j) jv2=nbaldest(j) jv12=jv1+nflev-1 jv22=jv2+nflev-1 C C Identify range for operator C jnj1=1+(j-1)*nj jnj2=nj+(j-1)*nj C C Apply requested operator C IF (NBALI(J).eq.1) THEN C C Matrix operator: Does not include spatial correlation and C is a function only of latitude and vertical level. C DO JLON = 1, NI gd(jlon,jv2:jv22,1:nj)= & gd(jlon,jv2:jv22,1:nj) + & balop(1,1:nflev,jnj1:jnj2)* & gd(jlon,jv1:jv12,1:nj) END DO C ELSE C C Matrix operator: Includes vertical correlation and C is a function only of latitude and vertical level. C DO JLAT = 1, NJ DO JLON = 1, NI DO j1=1,nflev gd(jlon,jv2+j1-1,jlat)= & gd(jlon,jv2+j1-1,jlat) + & sum(balop(j1,1:nflev,jlat-1+jnj1)* & gd(jlon,jv1:jv12,jlat)) END DO END DO END DO C END IF END DO C WRITE(NULOUT,*) ' ' WRITE(NULOUT,*) 'Exit CH_BALOPER' WRITE(NULOUT,*) ' ' C RETURN END