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