| 1 | subroutine massn2(ngrid,nlayer,pplev,qsurf,dqsurf,pdpsurf, & |
|---|
| 2 | ptimestep) |
|---|
| 3 | |
|---|
| 4 | use comgeomfi_h |
|---|
| 5 | implicit none |
|---|
| 6 | |
|---|
| 7 | !================================================================== |
|---|
| 8 | ! Purpose |
|---|
| 9 | ! ------- |
|---|
| 10 | ! Test conservation of n2 mass |
|---|
| 11 | ! |
|---|
| 12 | ! Inputs |
|---|
| 13 | ! ------ |
|---|
| 14 | ! ngrid Number of vertical columns |
|---|
| 15 | ! nlayer Number of layers |
|---|
| 16 | ! pplev(ngrid,nlayer+1) Pressure levels |
|---|
| 17 | ! surfmass |
|---|
| 18 | ! |
|---|
| 19 | ! Authors |
|---|
| 20 | ! ------- |
|---|
| 21 | ! Tanguy Bertrand 2015 |
|---|
| 22 | ! |
|---|
| 23 | !================================================================== |
|---|
| 24 | |
|---|
| 25 | #include "dimensions.h" |
|---|
| 26 | #include "dimphys.h" |
|---|
| 27 | #include "comcstfi.h" |
|---|
| 28 | #include "surfdat.h" |
|---|
| 29 | #include "comvert.h" |
|---|
| 30 | #include "callkeys.h" |
|---|
| 31 | #include "tracer.h" |
|---|
| 32 | |
|---|
| 33 | !----------------------------------------------------------------------- |
|---|
| 34 | ! Arguments |
|---|
| 35 | |
|---|
| 36 | INTEGER ngrid, nlayer |
|---|
| 37 | REAL pplev(ngrid,nlayer+1) |
|---|
| 38 | REAL qsurf(ngrid) |
|---|
| 39 | REAL dqsurf(ngrid) |
|---|
| 40 | REAL pdpsurf(ngrid) |
|---|
| 41 | REAL ptimestep |
|---|
| 42 | |
|---|
| 43 | ! LOCAL VARIABLES |
|---|
| 44 | INTEGER l,ig,iq |
|---|
| 45 | REAL atmmass |
|---|
| 46 | REAL pstot |
|---|
| 47 | REAL zps(ngrid) |
|---|
| 48 | REAL zqsurf(ngrid) |
|---|
| 49 | |
|---|
| 50 | ! OUTPUT |
|---|
| 51 | REAL atmmasstot |
|---|
| 52 | REAL surfmasstot |
|---|
| 53 | REAL totmass |
|---|
| 54 | !----------------------------------------------------------------------- |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | atmmass=0.0 |
|---|
| 58 | atmmasstot=0.0 |
|---|
| 59 | surfmasstot=0.0 |
|---|
| 60 | pstot=0.0 |
|---|
| 61 | zps(:)=0. |
|---|
| 62 | zqsurf(:)=0. |
|---|
| 63 | |
|---|
| 64 | do ig = 1, ngrid |
|---|
| 65 | zps(ig)=pplev(ig,1)+pdpsurf(ig)*ptimestep |
|---|
| 66 | zqsurf(ig)=qsurf(ig)+dqsurf(ig)*ptimestep |
|---|
| 67 | |
|---|
| 68 | atmmass = zps(ig)/g |
|---|
| 69 | pstot = pstot+zps(ig)*area(ig) |
|---|
| 70 | |
|---|
| 71 | atmmasstot= atmmasstot + atmmass*area(ig) |
|---|
| 72 | surfmasstot= surfmasstot + zqsurf(ig)*area(ig) |
|---|
| 73 | |
|---|
| 74 | enddo |
|---|
| 75 | |
|---|
| 76 | atmmasstot= atmmasstot/totarea |
|---|
| 77 | pstot= pstot/totarea |
|---|
| 78 | surfmasstot = surfmasstot/totarea |
|---|
| 79 | totmass=surfmasstot+atmmasstot |
|---|
| 80 | |
|---|
| 81 | ! print*,'-------------------------------------------' |
|---|
| 82 | print*,'Total mass surface : ',surfmasstot,' kg m-2' |
|---|
| 83 | print*,'Total mass atmosphere :',atmmasstot,' kg m-2' |
|---|
| 84 | print*,'Total mean pressure:',pstot,' Pa' |
|---|
| 85 | print*,'Total mass : ',surfmasstot+atmmasstot,' kg m-2' |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | end subroutine massn2 |
|---|