1 | include(dom.inc)
2 |
3 | SUBROUTINE KBARANDPHI(celldata,LICO,LICO2,LIH2O,ICO,ICO2,IH2O, &
4 | & MIXDATA,nallbands)
5 |
6 | ! ******************************************************************!
7 | ! ******************************************************************!
8 | ! !
9 | ! SUBROUTINE FOR THE CALCULATION OF Kappa moy AND Phi FROM THE !
10 | ! CELLS' TEMPERATURE, PRESSURE AND SPECIES MASS CONCENTRATIONS !
11 | ! !
12 | ! INPUT : T en K ---> celldata(1) !
13 | ! : P en atm ---> celldata(2) !
14 | ! : X_H2O ---> celldata(3) !
15 | ! : X_CO2 ---> celldata(4) !
16 | ! : X_CO ---> celldata(5) !
17 | ! : X_O2 ---> celldata(6) !
18 | ! : X_N2 ---> celldata(7) !
19 | ! : X_SOOT ---> celldata(8) !
20 | ! !
21 | ! OUTPUT : Kappa_moy_Mix en m-1 ---> MIXDATA(1) !
22 | ! Phi_Mix sans unite ---> MIXDATA(2) !
23 | ! !
24 | ! Kappa_moy_H2O en m-1 ---> SNBDATA(1,...) !
25 | ! Kappa_moy_CO2 en m-1 ---> SNBDATA(...,3,...) !
26 | ! Kappa_moy_CO en m-1 ---> SNBDATA(...,5,...) !
27 | ! Phi_H2O sans unite ---> SNBDATA(...,2,...) !
28 | ! Phi_CO2 sans unite ---> SNBDATA(...,4...) !
29 | ! Phi_CO sans unite ---> SNBDATA(...,6) !
30 | ! !
31 | ! !
32 | ! ******************************************************************!
33 | ! ******************************************************************!
34 |
35 | ! Only for test
36 | ! USE mod_pmm
37 | USE mod_slave
38 |
39 | IMPLICIT NONE
40 |
41 | ! IN
42 | DOM_INT :: ICO, ICO2, IH2O, nallbands
43 | DOM_REAL, DIMENSION(8) :: celldata
44 | LOGICAL :: LICO,LICO2,LIH2O
45 |
46 | ! OUT
47 | DOM_REAL, DIMENSION(2) :: MIXDATA
48 |
49 | ! LOCAL
50 | DOM_INT :: IT
51 | DOM_REAL :: RT
52 | DOM_REAL :: T296, T273, T900
53 | DOM_REAL :: XN2, GAM, XDCO
54 | DOM_REAL :: XDCO2, RATT, XDH2O
55 | DOM_REAL :: SUMBIGB
56 | DOM_REAL, DIMENSION(6) :: SNBDATA
57 | DOM_REAL, DIMENSION(3) :: BIGB
58 |
59 | BIGB = 0.
60 | SNBDATA = 0.
61 |
62 | ! -------------------------------------------------!
63 | ! Test on the temperature value !
64 | ! -------------------------------------------------!
65 |
66 | ! print*, pmm_rank, " Inside kbarandphi"
67 |
68 | IF (celldata(1).gt.2900) THEN
69 | WRITE(*,*) "ERROR : Temperature must belong to the "
70 | WRITE(*,*) " interval 300K-2900K"
71 | WRITE(*,*) " celldata = ", celldata
72 | STOP
73 | ENDIF
74 |
75 | IF (celldata(2).le.0.) THEN
76 | WRITE(*,*) "ERROR : Negative or null pressure"
77 | WRITE(*,*) " celldata = ", celldata
78 | STOP
79 | ENDIF
80 |
81 | ! -------------------------------------------------!
82 | ! Get the temperature interval IT and the distance !
83 | ! to the inferior temperature in the tables RT !
84 | ! -------------------------------------------------!
85 | CALL TMNO(celldata(1),RT,IT)
86 |
87 | ! print*, pmm_rank, " TMNO of ",celldata(1)," gives:", RT, IT
88 |
89 | T296 = 296./celldata(1)
90 | T273 = 273./celldata(1)
91 | T900 = 900./celldata(1)
92 | XN2 = 1.-celldata(5)-celldata(4)-celldata(3)
93 |
94 | ! IF (pmm_rank.eq.0) THEN
95 | ! print*, " +++ KBAR and PHI:", IT, RT
96 | ! ENDIF
97 |
98 | IF(LICO) THEN
99 | GAM = 0.07*celldata(4)+0.06* &
100 | & (celldata(5)+XN2+celldata(3))
101 | GAM = celldata(2)*GAM*SQRT(T273)
102 | SNBDATA(5) = s_KCO(IT,ICO)+RT*(s_KCO(IT+1,ICO)-s_KCO(IT,ICO))
103 | SNBDATA(5) = 100.*SNBDATA(5)*celldata(2)*celldata(5)
104 | XDCO = s_DCO(IT,ICO)+RT*(s_DCO(IT+1,ICO)-s_DCO(IT,ICO))
105 | SNBDATA(6) = 2.*GAM*XDCO
106 | IF (SNBDATA(6).eq.0.) THEN
107 | BIGB(3) = 0.
108 | ELSE
109 | BIGB(3) = SNBDATA(5)**2/SNBDATA(6)
110 | ENDIF
111 |
112 | ! IF (pmm_rank.eq.0) THEN
113 | ! print*, " idx CO:", ICO
114 | ! print*, " k_snb CO:", s_KCO(IT,ICO)
115 | ! print*, " d_snb CO:", s_DCO(IT,ICO)
116 | ! print*, " gamma CO:", GAM
117 | ! print*, " kbar CO:", SNBDATA(5)
118 | ! print*, " delta CO:", XDCO
119 | ! ENDIF
120 |
121 | ENDIF
122 |
123 | IF(LICO2) THEN
124 | GAM = 0.07*celldata(4)+0.058*XN2+0.15*celldata(3)
125 | IF(celldata(1).LE.900.) THEN
126 | GAM = celldata(2)*GAM*(T296)**0.7
127 | ELSE
128 | GAM = celldata(2)*GAM*0.45913*SQRT(T900)
129 | ENDIF
130 | SNBDATA(3) = s_KC(IT,ICO2)+RT*(s_KC(IT+1,ICO2)-s_KC(IT,ICO2))
131 | SNBDATA(3) = 100.*SNBDATA(3)*celldata(2)*celldata(4)
132 | XDCO2 = s_DC(IT,ICO2)+RT*(s_DC(IT+1,ICO2)-s_DC(IT,ICO2))
133 | SNBDATA(4) = 2.*GAM*XDCO2
134 | IF (SNBDATA(4).eq.0.) THEN
135 | BIGB(2) = 0.
136 | ELSE
137 | BIGB(2) = SNBDATA(3)**2/SNBDATA(4)
138 | ENDIF
139 |
140 | ! IF (pmm_rank.eq.0) THEN
141 | ! print*, " k_snb CO2:", s_KC(IT,ICO2)
142 | ! print*, " d_snb CO2:", s_DC(IT,ICO2)
143 | ! print*, " gamma CO2:", GAM
144 | ! print*, " kbar CO2:", SNBDATA(3)
145 | ! print*, " delta CO2:", XDCO2
146 | ! ENDIF
147 |
148 | ENDIF
149 |
150 | IF(LIH2O) THEN
151 | RATT = SQRT(T296)
152 | GAM = 0.066*(7.0*RATT*celldata(3)+ &
153 | & 1.2*(celldata(3)+XN2)+1.5*celldata(4))*RATT
154 | GAM = celldata(2)*GAM
155 | SNBDATA(1) = s_KH(IT,IH2O)+RT*(s_KH(IT+1,IH2O)-s_KH(IT,IH2O))
156 | SNBDATA(1) = 100.*SNBDATA(1)*celldata(2)*celldata(3)
157 | XDH2O = s_DH(IT,IH2O)+RT*(s_DH(IT+1,IH2O)-s_DH(IT,IH2O))
158 | SNBDATA(2) = 2.*GAM*XDH2O
159 | IF (SNBDATA(2).eq.0.) THEN
160 | BIGB(1) = 0.
161 | ELSE
162 | BIGB(1) = SNBDATA(1)**2/SNBDATA(2)
163 | ENDIF
164 |
165 | ! IF (pmm_rank.eq.0) THEN
166 | ! print*, " k_snb H2O:", s_KH(IT,IH2O)
167 | ! print*, " d_snb H2O:", s_DH(IT,IH2O)
168 | ! print*, " T296 H2O:", T296
169 | ! print*, " XH2O H2O:", celldata(3)
170 | ! print*, " XCO2 H2O:", celldata(4)
171 | ! print*, " XN2 H2O:", XN2
172 | ! print*, " gamma H2O:", GAM
173 | ! print*, " kbar H2O:", SNBDATA(1)
174 | ! print*, " delta H2O:", XDH2O
175 | ! print*, " press H2O:", celldata(2)
176 | ! ENDIF
177 |
178 | ENDIF
179 |
180 | !-----------------------!
181 | ! Gaz mixture modelling !
182 | !-----------------------!
183 |
184 | MIXDATA(1) = SNBDATA(1)+SNBDATA(3)+SNBDATA(5)
185 |
186 | SUMBIGB = BIGB(1) + BIGB(2) + BIGB(3)
187 |
188 | IF (SUMBIGB.ne.0.) THEN
189 | MIXDATA(2) = MIXDATA(1)**2/SUMBIGB
190 | ELSE
191 | MIXDATA(2) = 0.
192 | ENDIF
193 |
194 | ! IF (pmm_rank.eq.0) THEN
195 | ! print*, " +++ k_mix, phi_mix:", MIXDATA(1), MIXDATA(2)
196 | ! ENDIF
197 |
198 | END SUBROUTINE KBARANDPHI