subroutine globalaverage2d(ngrid,var,globaverage2d) use comgeomfi_h implicit none !================================================================== ! Purpose ! ------- ! ! Inputs ! ------ ! ngrid Number of vertical columns ! ! Authors ! ------- ! Tanguy Bertrand 2015 ! !================================================================== #include "dimensions.h" #include "dimphys.h" #include "comcstfi.h" #include "surfdat.h" !#include "comsaison.h" #include "comvert.h" #include "callkeys.h" #include "tracer.h" !----------------------------------------------------------------------- ! Arguments INTEGER ngrid REAL var(ngrid) ! LOCAL VARIABLES INTEGER ig ! OUTPUT REAL globaverage2d !----------------------------------------------------------------------- globaverage2d = 0.d0 DO ig=2,ngrid-1 globaverage2d = globaverage2d + var(ig)*area(ig) END DO globaverage2d = globaverage2d + var(1)*area(1)*iim globaverage2d = globaverage2d + var(ngrid)*area(ngrid)*iim globaverage2d = globaverage2d/(totarea+(area(1)+area(ngrid))*(iim-1)) end subroutine globalaverage2d