subroutine testconservmass(ngrid,nlayer, & ps,surfmass) use comgeomfi_h implicit none !================================================================== ! Purpose ! ------- ! Test conservation of n2 mass ! ! Inputs ! ------ ! ngrid Number of vertical columns ! nlayer Number of layers ! pplev(ngrid,nlayer+1) Pressure levels ! surfmass ! ! Authors ! ------- ! Tanguy Bertrand 2015 ! !================================================================== #include "dimensions.h" #include "dimphys.h" #include "comcstfi.h" #include "surfdat.h" #include "comvert.h" #include "callkeys.h" #include "tracer.h" !----------------------------------------------------------------------- ! Arguments INTEGER ngrid, nlayer REAL ps(ngrid) REAL surfmass(ngrid) ! LOCAL VARIABLES INTEGER l,ig,iq REAL atmmass REAL pstot ! OUTPUT REAL atmmasstot REAL surfmasstot REAL totmass !----------------------------------------------------------------------- atmmass=0.0 atmmasstot=0.0 surfmasstot=0.0 pstot=0.0 do ig = 2, ngrid-1 ! mass atm kg/m2 atmmass = ps(ig)/g pstot = pstot+ps(ig)*area(ig) ! mass atm kg atmmasstot= atmmasstot + atmmass*area(ig) surfmasstot= surfmasstot + surfmass(ig)*area(ig) enddo atmmasstot= atmmasstot + ps(1)/g*area(1)*iim atmmasstot= atmmasstot + ps(ngrid)/g*area(ngrid)*iim surfmasstot= surfmasstot + surfmass(1)*area(1)*iim surfmasstot= surfmasstot + surfmass(ngrid)*area(ngrid)*iim pstot= pstot + ps(1)*area(1)*iim pstot= pstot + ps(ngrid)*area(ngrid)*iim atmmasstot= atmmasstot/(totarea+(iim-1)*(area(1)+area(ngrid))) pstot= pstot/(totarea+(iim-1)*(area(1)+area(ngrid))) surfmasstot = surfmasstot/(totarea+(iim-1)*(area(1)+area(ngrid))) totmass=surfmasstot+atmmasstot ! print*,'-------------------------------------------' ! print*,'Total mass surface : ',surfmasstot,' kg m-2' ! print*,'Total mass atmosphere :',atmmasstot,' kg m-2' ! print*,'Total mean pressure:',pstot,' Pa' print*,'Total mass : ',surfmasstot+atmmasstot,' kg m-2' end subroutine testconservmass