eos.F90 coverage: 75.00 %func 75.04 %block
1) module EOS_module
2)
3) use PFLOTRAN_Constants_module
4) use EOS_Water_module
5) use EOS_Gas_module
6) use EOS_Oil_module
7)
8) implicit none
9)
10) private
11)
12) #include "petsc/finclude/petscsys.h"
13)
14) public :: EOSInit, &
15) EOSRead, &
16) EOSInputRecord, &
17) AllEOSDBaseDestroy
18)
19) contains
20)
21) ! ************************************************************************** !
22)
23) subroutine EOSInit()
24)
25) implicit none
26)
27) call EOSWaterInit()
28) call EOSGasInit()
29) call EOSOilInit()
30)
31) end subroutine EOSInit
32)
33) ! ************************************************************************** !
34)
35) subroutine EOSRead(input,option)
36)
37) use Option_module
38) use Input_Aux_module
39) use String_module
40)
41) implicit none
42)
43) type(input_type), pointer :: input
44) type(option_type) :: option
45)
46) character(len=MAXWORDLENGTH) :: keyword, word, subkeyword
47) character(len=MAXWORDLENGTH) :: test_filename
48) character(len=MAXSTRINGLENGTH) :: string
49) PetscReal :: tempreal, tempreal2
50) PetscReal :: rks_tc = UNINITIALIZED_DOUBLE
51) PetscReal :: rks_pc = UNINITIALIZED_DOUBLE
52) PetscReal :: rks_acen = UNINITIALIZED_DOUBLE
53) PetscReal :: rks_omegaa = UNINITIALIZED_DOUBLE
54) PetscReal :: rks_omegab = UNINITIALIZED_DOUBLE
55) PetscBool :: rks_hydrogen = PETSC_TRUE
56) PetscReal :: temparray(10)
57) PetscReal :: test_t_high, test_t_low, test_p_high, test_p_low
58) PetscInt :: test_n_temp, test_n_pres
59) PetscBool :: test_uniform_temp, test_uniform_pres
60) PetscErrorCode :: ierr
61)
62) input%ierr = 0
63)
64) call InputReadWord(input,option,keyword,PETSC_TRUE)
65) call InputErrorMsg(input,option,'keyword','EOS')
66) call StringToUpper(keyword)
67)
68) select case(trim(keyword))
69) case('WATER')
70) do
71) temparray = 0.d0
72) call InputReadPflotranString(input,option)
73) if (InputCheckExit(input,option)) exit
74) call InputReadWord(input,option,keyword,PETSC_TRUE)
75) call InputErrorMsg(input,option,'keyword','EOS,WATER')
76) call StringToUpper(keyword)
77) select case(trim(keyword))
78) case('DENSITY')
79) temparray = 0.d0
80) call InputReadWord(input,option,word,PETSC_TRUE)
81) call InputErrorMsg(input,option,'DENSITY','EOS,WATER')
82) call StringToUpper(word)
83) select case(trim(word))
84) case('CONSTANT')
85) call InputReadDouble(input,option,temparray(1))
86) call InputErrorMsg(input,option,'VALUE', &
87) 'EOS,WATER,DENSITY,CONSTANT')
88) call InputReadAndConvertUnits(input,temparray(1), &
89) 'kg/m^3','EOS,WATER,DENSITY,CONSTANT',option)
90) case('EXPONENTIAL')
91) call InputReadDouble(input,option,temparray(1))
92) call InputErrorMsg(input,option,'REFERENCE_DENSITY', &
93) 'EOS,WATER,DENSITY,EXPONENTIAL')
94) call InputReadDouble(input,option,temparray(2))
95) call InputErrorMsg(input,option,'REFERENCE_PRESSURE', &
96) 'EOS,WATER,DENSITY,EXPONENTIAL')
97) call InputReadDouble(input,option,temparray(3))
98) call InputErrorMsg(input,option,'WATER_COMPRESSIBILITY', &
99) 'EOS,WATER,DENSITY,EXPONENTIAL')
100) case('IFC67','DEFAULT','BATZLE_AND_WANG','TGDPB01')
101) case default
102) call InputKeywordUnrecognized(word,'EOS,WATER,DENSITY',option)
103) end select
104) call EOSWaterSetDensity(word,temparray)
105) case('ENTHALPY')
106) call InputReadWord(input,option,word,PETSC_TRUE)
107) call InputErrorMsg(input,option,'ENTHALPY','EOS,WATER')
108) call StringToUpper(word)
109) select case(trim(word))
110) case('CONSTANT')
111) call InputReadDouble(input,option,temparray(1))
112) call InputErrorMsg(input,option,'VALUE', &
113) 'EOS,WATER,ENTHALPY,CONSTANT')
114) call InputReadAndConvertUnits(input,temparray(1), &
115) 'J/kmol','EOS,WATER,ENTHALPY,CONSTANT',option)
116) case('IFC67','PAINTER','DEFAULT')
117) case default
118) call InputKeywordUnrecognized(word,'EOS,WATER,ENTHALPY',option)
119) end select
120) call EOSWaterSetEnthalpy(word,temparray)
121) case('VISCOSITY')
122) call InputReadWord(input,option,word,PETSC_TRUE)
123) call InputErrorMsg(input,option,'VISCOSITY','EOS,WATER')
124) call StringToUpper(word)
125) select case(trim(word))
126) case('CONSTANT')
127) call InputReadDouble(input,option,temparray(1))
128) call InputErrorMsg(input,option,'VALUE', &
129) 'EOS,WATER,VISCOSITY,CONSTANT')
130) call InputReadAndConvertUnits(input,temparray(1), &
131) 'Pa-s','EOS,WATER,VISCOSITY,CONSTANT',option)
132) case('DEFAULT','BATZLE_AND_WANG')
133) case default
134) call InputKeywordUnrecognized(word,'EOS,WATER,VISCOSITY', &
135) option)
136) end select
137) call EOSWaterSetViscosity(word,temparray)
138) case('STEAM_DENSITY')
139) call InputReadWord(input,option,word,PETSC_TRUE)
140) call InputErrorMsg(input,option,'STEAM_DENSITY','EOS,WATER')
141) call StringToUpper(word)
142) select case(trim(word))
143) case('CONSTANT')
144) call InputReadDouble(input,option,temparray(1))
145) call InputErrorMsg(input,option,'VALUE', &
146) 'EOS,WATER,STEAM_DENSITY,CONSTANT')
147) call InputReadAndConvertUnits(input,temparray(1), &
148) 'kg/m^3','EOS,WATER,STEAM_DENSITY,CONSTANT',option)
149) case default
150) call InputKeywordUnrecognized(word,'EOS,WATER,STEAM_DENSITY', &
151) option)
152) end select
153) call EOSWaterSetSteamDensity(keyword,temparray)
154) case('STEAM_ENTHALPY')
155) call InputReadWord(input,option,word,PETSC_TRUE)
156) call InputErrorMsg(input,option,'STEAM_ENTHALPY','EOS,WATER')
157) call StringToUpper(word)
158) select case(trim(word))
159) case('CONSTANT')
160) call InputReadDouble(input,option,temparray(1))
161) call InputErrorMsg(input,option,'VALUE', &
162) 'EOS,WATER,STEAM_ENTHALPY,CONSTANT')
163) call InputReadAndConvertUnits(input,temparray(1), &
164) 'J/kmol','EOS,WATER,STEAM_ENTHALPY,CONSTANT',option)
165) case default
166) call InputKeywordUnrecognized(word, &
167) 'EOS,WATER,STEAM_ENTHALPY',option)
168) end select
169) call EOSWaterSetSteamEnthalpy(keyword,temparray)
170) case('TEST')
171) if (option%global_rank == 0) then
172) call InputReadDouble(input,option,test_t_low)
173) call InputErrorMsg(input,option,'T_low', &
174) 'EOS,WATER,TEST')
175) call InputReadDouble(input,option,test_t_high)
176) call InputErrorMsg(input,option,'T_high', &
177) 'EOS,WATER,TEST')
178) call InputReadDouble(input,option,test_p_low)
179) call InputErrorMsg(input,option,'P_low', &
180) 'EOS,WATER,TEST')
181) call InputReadDouble(input,option,test_p_high)
182) call InputErrorMsg(input,option,'P_high', &
183) 'EOS,WATER,TEST')
184) call InputReadInt(input,option,test_n_temp)
185) call InputErrorMsg(input,option,'num_temperatures', &
186) 'EOS,WATER,TEST')
187) call InputReadInt(input,option,test_n_pres)
188) call InputErrorMsg(input,option,'num_pressures', &
189) 'EOS,WATER,TEST')
190) call InputReadWord(input,option,word,PETSC_TRUE)
191) call InputErrorMsg(input,option,'temperature distribution type', &
192) 'EOS,WATER,TEST')
193) if (StringCompareIgnoreCase(word,'uniform')) then
194) test_uniform_temp = PETSC_TRUE
195) else if (StringCompareIgnoreCase(word,'log')) then
196) test_uniform_temp = PETSC_FALSE
197) else
198) option%io_buffer = 'Temperature distribution type "' // &
199) trim(word) // '" for EOS Water not recognized.'
200) call printErrMsg(option)
201) endif
202) call InputReadWord(input,option,word,PETSC_TRUE)
203) call InputErrorMsg(input,option,'pressure distribution type', &
204) 'EOS,WATER,TEST,')
205) if (StringCompareIgnoreCase(word,'uniform')) then
206) test_uniform_pres = PETSC_TRUE
207) else if (StringCompareIgnoreCase(word,'log')) then
208) test_uniform_pres = PETSC_FALSE
209) else
210) option%io_buffer = 'Pressure distribution type "' // &
211) trim(word) // '" for EOS Water not recognized.'
212) call printErrMsg(option)
213) endif
214) call InputReadWord(input,option,word,PETSC_TRUE)
215) test_filename = ''
216) if (input%ierr == 0) then
217) test_filename = word
218) endif
219) call EOSWaterTest(test_t_low,test_t_high,test_p_low,test_p_high, &
220) test_n_temp, test_n_pres, &
221) test_uniform_temp, test_uniform_pres, &
222) test_filename)
223) endif
224) case default
225) call InputKeywordUnrecognized(keyword,'EOS,WATER',option)
226) end select
227) enddo
228) string = ''
229) call EOSWaterVerify(ierr,string)
230) if (ierr /= 0) then
231) option%io_buffer = 'Error in Water EOS'
232) if (len_trim(string) > 1) then
233) option%io_buffer = trim(option%io_buffer) // ': ' // trim(string)
234) endif
235) call printErrMsg(option)
236) endif
237) case('GAS')
238) do
239) call InputReadPflotranString(input,option)
240) if (InputCheckExit(input,option)) exit
241) call InputReadWord(input,option,keyword,PETSC_TRUE)
242) call InputErrorMsg(input,option,'keyword','EOS,GAS')
243) call StringToUpper(keyword)
244) select case(trim(keyword))
245) case('DENSITY')
246) call InputReadWord(input,option,word,PETSC_TRUE)
247) call InputErrorMsg(input,option,'DENSITY','EOS,GAS')
248) call StringToUpper(word)
249) select case(trim(word))
250) case('CONSTANT')
251) call InputReadDouble(input,option,tempreal)
252) call InputErrorMsg(input,option,'VALUE', &
253) 'EOS,GAS,DENSITY,CONSTANT')
254) call InputReadAndConvertUnits(input,tempreal, &
255) 'kg/m^3','EOS,GAS,DENSITY,CONSTANT',option)
256) call EOSGasSetDensityConstant(tempreal)
257) case('RKS')
258) ! if nothing is entered, it will calculate as hydrogen gas
259) do
260) call InputReadPflotranString(input,option)
261) call InputReadStringErrorMsg(input,option, &
262) 'EOS GAS,RKS')
263) if (InputCheckExit(input,option)) exit
264) if (InputError(input)) exit
265) call InputReadWord(input,option,word,PETSC_TRUE)
266) call InputErrorMsg(input,option,'keyword', &
267) 'EOS GAS, RKS')
268) select case(trim(word))
269) case('HYDROGEN')
270) rks_hydrogen = PETSC_TRUE
271) case('NON-HYDROGEN')
272) rks_hydrogen = PETSC_FALSE
273) case('CRITICAL_TEMPERATURE','TC')
274) call InputReadDouble(input,option,rks_tc)
275) call InputErrorMsg(input,option, &
276) 'critical temperature for RKS', &
277) 'EOS GAS,RKS')
278) case('CRITICAL_PRESSURE','PC')
279) call InputReadDouble(input,option,rks_pc)
280) call InputErrorMsg(input,option, &
281) 'critical pressure for RKS', &
282) 'EOS GAS,RKS')
283) case('ACENTRIC,ACENTRIC_FACTOR','ACEN','AC')
284) ! acentric factor is only used for non-hydrogen gas
285) call InputReadDouble(input,option,rks_acen)
286) call InputErrorMsg(input,option, &
287) 'accentric factor for RKS', &
288) 'EOS GAS,RKS')
289) case('OMEGAA','A')
290) call InputReadDouble(input,option,rks_omegaa)
291) call InputErrorMsg(input,option, &
292) 'omega_a factor for RKS', &
293) 'EOS GAS,RKS')
294) case('OMEGAB','B')
295) call InputReadDouble(input,option,rks_omegab)
296) call InputErrorMsg(input,option, &
297) 'omega_b factor for RKS', &
298) 'EOS GAS,RKS')
299) case default
300) call InputKeywordUnrecognized(word, &
301) 'EOS GAS,RKS',option)
302) end select
303) enddo
304) call EOSGasSetDensityRKS(rks_hydrogen,rks_tc,rks_pc,rks_acen, &
305) rks_omegaa,rks_omegab)
306) case('PR_METHANE')
307) call EOSGasSetDensityPRMethane()
308) case('IDEAL','DEFAULT')
309) call EOSGasSetDensityIdeal()
310) case default
311) call InputKeywordUnrecognized(word,'EOS,GAS,DENSITY',option)
312) end select
313) case('ENTHALPY')
314) call InputReadWord(input,option,word,PETSC_TRUE)
315) call InputErrorMsg(input,option,'ENTHALPY','EOS,GAS')
316) call StringToUpper(word)
317) select case(trim(word))
318) case('CONSTANT')
319) call InputReadDouble(input,option,tempreal)
320) call InputErrorMsg(input,option,'VALUE', &
321) 'EOS,GAS,ENTHALPY,CONSTANT')
322) call InputReadAndConvertUnits(input,tempreal, &
323) 'J/kmol','EOS,GAS,ENTHALPY,CONSTANT',option)
324) call EOSGasSetEnergyConstant(tempreal)
325) case('IDEAL_METHANE')
326) call EOSGasSetEnergyIdealMethane()
327) case('IDEAL','DEFAULT')
328) call EOSGasSetEnergyIdeal()
329) case default
330) call InputKeywordUnrecognized(word,'EOS,GAS,ENTHALPY',option)
331) end select
332) case('VISCOSITY')
333) call InputReadWord(input,option,word,PETSC_TRUE)
334) call InputErrorMsg(input,option,'VISCOSITY','EOS,GAS')
335) call StringToUpper(word)
336) select case(trim(word))
337) case('CONSTANT')
338) call InputReadDouble(input,option,tempreal)
339) call InputErrorMsg(input,option,'VALUE', &
340) 'EOS,GAS,VISCOSITY,CONSTANT')
341) call InputReadAndConvertUnits(input,tempreal, &
342) 'Pa-s','EOS,GAS,VISCOSITY,CONSTANT',option)
343) call EOSGasSetViscosityConstant(tempreal)
344) case('DEFAULT')
345) case default
346) call InputKeywordUnrecognized(word,'EOS,GAS,VISCOSITY',option)
347) end select
348) case('HENRYS_CONSTANT')
349) call InputReadWord(input,option,word,PETSC_TRUE)
350) call InputErrorMsg(input,option,'HENRYS_CONSTANT','EOS,GAS')
351) call StringToUpper(word)
352) select case(trim(word))
353) case('CONSTANT')
354) call InputReadDouble(input,option,tempreal)
355) call InputErrorMsg(input,option,'VALUE', &
356) 'EOS,GAS,HENRYS_CONSTANT,CONSTANT')
357) call EOSGasSetHenryConstant(tempreal)
358) case('DEFAULT')
359) call EOSGasSetHenry()
360) case default
361) call InputKeywordUnrecognized(word,'EOS,GAS,HENRYS_CONSTANT', &
362) option)
363) end select
364) case('TEST')
365) if (option%global_rank == 0) then
366) call InputReadDouble(input,option,test_t_low)
367) call InputErrorMsg(input,option,'T_low', &
368) 'EOS,GAS,TEST')
369) call InputReadDouble(input,option,test_t_high)
370) call InputErrorMsg(input,option,'T_high', &
371) 'EOS,GAS,TEST')
372) call InputReadDouble(input,option,test_p_low)
373) call InputErrorMsg(input,option,'P_low', &
374) 'EOS,GAS,TEST')
375) call InputReadDouble(input,option,test_p_high)
376) call InputErrorMsg(input,option,'P_high', &
377) 'EOS,GAS,TEST')
378) call InputReadInt(input,option,test_n_temp)
379) call InputErrorMsg(input,option,'num_temperatures', &
380) 'EOS,GAS,TEST')
381) call InputReadInt(input,option,test_n_pres)
382) call InputErrorMsg(input,option,'num_pressures', &
383) 'EOS,GAS,TEST')
384) call InputReadWord(input,option,word,PETSC_TRUE)
385) call InputErrorMsg(input,option,'temperature distribution type', &
386) 'EOS,GAS,TEST')
387) if (StringCompareIgnoreCase(word,'uniform')) then
388) test_uniform_temp = PETSC_TRUE
389) else if (StringCompareIgnoreCase(word,'log')) then
390) test_uniform_temp = PETSC_FALSE
391) else
392) option%io_buffer = 'Temperature distribution type "' // &
393) trim(word) // '" for EOS Gas not recognized.'
394) call printErrMsg(option)
395) endif
396) call InputReadWord(input,option,word,PETSC_TRUE)
397) call InputErrorMsg(input,option,'pressure distribution type', &
398) 'EOS,GAS,TEST,')
399) if (StringCompareIgnoreCase(word,'uniform')) then
400) test_uniform_pres = PETSC_TRUE
401) else if (StringCompareIgnoreCase(word,'log')) then
402) test_uniform_pres = PETSC_FALSE
403) else
404) option%io_buffer = 'Pressure distribution type "' // &
405) trim(word) // '" for EOS Gas not recognized.'
406) call printErrMsg(option)
407) endif
408) call InputReadWord(input,option,word,PETSC_TRUE)
409) test_filename = ''
410) if (input%ierr == 0) then
411) test_filename = word
412) endif
413) call EOSGasTest(test_t_low,test_t_high,test_p_low,test_p_high, &
414) test_n_temp, test_n_pres, &
415) test_uniform_temp, test_uniform_pres, &
416) test_filename)
417) endif
418) case default
419) call InputKeywordUnrecognized(keyword,'EOS,GAS',option)
420) end select
421) enddo
422) string = ''
423) call EOSGasVerify(ierr,string)
424) if (ierr == 5) then
425) option%io_buffer = 'set to default value for RKS hydrogen'
426) if (len_trim(string) > 1) then
427) option%io_buffer = trim(string) // ': ' // trim(option%io_buffer)
428) endif
429) call printMsg(option)
430) else if (ierr /= 0) then
431) option%io_buffer = 'Error in Gas EOS'
432) if (len_trim(string) > 1) then
433) option%io_buffer = trim(option%io_buffer) // ': ' // trim(string)
434) endif
435) call printErrMsg(option)
436) endif
437) case('OIL')
438) do
439) call InputReadPflotranString(input,option)
440) if (InputCheckExit(input,option)) exit
441) call InputReadWord(input,option,keyword,PETSC_TRUE)
442) call InputErrorMsg(input,option,'keyword','EOS,OIL')
443) call StringToUpper(keyword)
444) select case(trim(keyword))
445) case('DATABASE')
446) call InputReadWord(input,option,word,PETSC_TRUE)
447) call InputErrorMsg(input,option,'EOS,OIL','DATABASE filename')
448) call EOSOilSetEOSDBase(word,option)
449) case('DENSITY')
450) call InputReadWord(input,option,word,PETSC_TRUE)
451) call InputErrorMsg(input,option,'DENSITY','EOS,OIL')
452) call StringToUpper(word)
453) select case(trim(word))
454) case('CONSTANT')
455) call InputReadDouble(input,option,tempreal)
456) call InputErrorMsg(input,option,'VALUE', &
457) 'EOS,OIL,DENSITY,CONSTANT')
458) call InputReadAndConvertUnits(input,tempreal, &
459) 'kg/m^3','EOS,OIL,DENSITY,CONSTANT',option)
460) call EOSOilSetDensityConstant(tempreal)
461) case('LINEAR')
462) call EOSOilSetDensityLinear()
463) do
464) call InputReadPflotranString(input,option)
465) if (InputCheckExit(input,option)) exit
466) call InputReadWord(input,option,subkeyword,PETSC_TRUE)
467) call InputErrorMsg(input,option,'subkeyword','EOS,OIL,VIS')
468) call StringToUpper(subkeyword)
469) select case(subkeyword)
470) case('REFERENCE_VALUE')
471) call InputReadDouble(input,option,tempreal)
472) call InputErrorMsg(input,option,'VALUE', &
473) 'EOS,OIL,DENSITY_LINEAR,REFERENCE_VALUE')
474) call EOSOilSetDenLinearRefDen(tempreal)
475) case('PRES_REF_VAULE')
476) call InputReadDouble(input,option,tempreal)
477) call InputErrorMsg(input,option,'VALUE', &
478) 'EOS,OIL,DENSITY_LINEAR,PRES_REF_VAULE')
479) call EOSOilSetDenLinearRefPres(tempreal)
480) case('TEMP_REF_VALUE')
481) call InputReadDouble(input,option,tempreal)
482) call InputErrorMsg(input,option,'VALUE', &
483) 'EOS,OIL,DENSITY_LINEAR,TEMP_REF_VAULE')
484) call EOSOilSetDenLinearRefTemp(tempreal)
485) case('COMPRESS_COEFF')
486) call InputReadDouble(input,option,tempreal)
487) call InputErrorMsg(input,option,'VALUE', &
488) 'EOS,OIL,DENSITY_LINEAR,COMPRESS_COEFF')
489) call EOSOilSetDenLinearComprCoef(tempreal)
490) case('THERMAL_EXPANSION_COEFF')
491) call InputReadDouble(input,option,tempreal)
492) call InputErrorMsg(input,option,'VALUE', &
493) 'EOS,OIL,DENSITY_LINEAR,THERMAL_EXPANSION_COEFF')
494) call EOSOilSetDenLinearExpanCoef(tempreal)
495) case default
496) call InputKeywordUnrecognized(subkeyword, &
497) 'EOS,OIL,DENSITY_LINEAR',option)
498) end select
499) end do
500) case('DATABASE')
501) call InputReadWord(input,option,word,PETSC_TRUE)
502) call InputErrorMsg(input,option,'EOS,OIL','DEN DBASE filename')
503) call EOSOilSetDenDBase(word,option)
504) case default
505) call InputKeywordUnrecognized(word,'EOS,OIL,DENSITY',option)
506) end select
507) case('ENTHALPY')
508) call InputReadWord(input,option,word,PETSC_TRUE)
509) call InputErrorMsg(input,option,'ENTHALPY','EOS,OIL')
510) call StringToUpper(word)
511) select case(trim(word))
512) case('CONSTANT')
513) call InputReadDouble(input,option,tempreal)
514) call InputErrorMsg(input,option,'VALUE', &
515) 'EOS,OIL,ENTHALPY,CONSTANT')
516) call InputReadAndConvertUnits(input,tempreal, &
517) 'J/kmol','EOS,OIL,ENTHALPY,CONSTANT',option)
518) call EOSOilSetEnthalpyConstant(tempreal)
519) case('LINEAR_TEMP')
520) call InputReadDouble(input,option,tempreal)
521) call InputErrorMsg(input,option,'VALUE', &
522) 'EOS,OIL,ENTHALPY,LINEAR_TEMP')
523) call EOSOilSetEnthalpyLinearTemp(tempreal)
524) case('DATABASE')
525) call InputReadWord(input,option,word,PETSC_TRUE)
526) call InputErrorMsg(input,option,'EOS,OIL','ENT DBASE filename')
527) call EOSOilSetEntDBase(word,option)
528) case default
529) call InputKeywordUnrecognized(word,'EOS,OIL,ENTHALPY',option)
530) end select
531) case('VISCOSITY')
532) call InputReadWord(input,option,word,PETSC_TRUE)
533) call InputErrorMsg(input,option,'VISCOSITY','EOS,OIL')
534) call StringToUpper(word)
535) select case(trim(word))
536) case('CONSTANT')
537) call InputReadDouble(input,option,tempreal)
538) call InputErrorMsg(input,option,'VALUE', &
539) 'EOS,OIL,VISCOSITY,CONSTANT')
540) call InputReadAndConvertUnits(input,tempreal, &
541) 'Pa-s','EOS,OIL,VISCOSITY,CONSTANT',option)
542) call EOSOilSetViscosityConstant(tempreal)
543) case('QUADRATIC')
544) call EOSOilSetViscosityQuad()
545) do
546) call InputReadPflotranString(input,option)
547) if (InputCheckExit(input,option)) exit
548) call InputReadWord(input,option,subkeyword,PETSC_TRUE)
549) call InputErrorMsg(input,option,'subkeyword','EOS,OIL,VIS')
550) call StringToUpper(subkeyword)
551) select case(subkeyword)
552) case('REFERENCE_VALUE')
553) call InputReadDouble(input,option,tempreal)
554) call InputErrorMsg(input,option,'VALUE', &
555) 'EOS,OIL,VISCOSITY_QUAD,REFERENCE_VALUE')
556) call EOSOilSetVisQuadRefVis(tempreal)
557) case('PRES_REF_VAULES')
558) call InputReadDouble(input,option,tempreal)
559) call InputErrorMsg(input,option,'VALUE', &
560) 'EOS,OIL,VISCOSITY_QUAD,PRES_REF_VAULES_1')
561) call InputReadDouble(input,option,tempreal2)
562) call InputErrorMsg(input,option,'VALUE', &
563) 'EOS,OIL,VISCOSITY_QUAD,PRES_REF_VAULES_2')
564) call EOSOilSetVisQuadRefPres(tempreal,tempreal2)
565) case('TEMP_REF_VALUES')
566) call InputReadDouble(input,option,tempreal)
567) call InputErrorMsg(input,option,'VALUE', &
568) 'EOS,OIL,VISCOSITY_QUAD,TEMP_REF_VAULES_1')
569) call InputReadDouble(input,option,tempreal2)
570) call InputErrorMsg(input,option,'VALUE', &
571) 'EOS,OIL,VISCOSITY_QUAD,TEMP_REF_VAULES_2')
572) call EOSOilSetVisQuadRefTemp(tempreal,tempreal2)
573) case('PRES_COEFFICIENTS')
574) call InputReadDouble(input,option,tempreal)
575) call InputErrorMsg(input,option,'VALUE', &
576) 'EOS,OIL,VISCOSITY_QUAD,PRES_COEFF_1')
577) call InputReadDouble(input,option,tempreal2)
578) call InputErrorMsg(input,option,'VALUE', &
579) 'EOS,OIL,VISCOSITY_QUAD,PRES_COEFF_2')
580) call EOSOilSetVisQuadPresCoef(tempreal,tempreal2)
581) case('TEMP_COEFFICIENTS')
582) call InputReadDouble(input,option,tempreal)
583) call InputErrorMsg(input,option,'VALUE', &
584) 'EOS,OIL,VISCOSITY_QUAD,TEMP_COEFF_1')
585) call InputReadDouble(input,option,tempreal2)
586) call InputErrorMsg(input,option,'VALUE', &
587) 'EOS,OIL,VISCOSITY_QUAD,TEMP_COEFF_2')
588) call EOSOilSetVisQuadTempCoef(tempreal,tempreal2)
589) case default
590) call InputKeywordUnrecognized(subkeyword, &
591) 'EOS,OIL, VISCOSITY_QUAD',option)
592) end select
593) end do
594) case('DATABASE')
595) call InputReadWord(input,option,word,PETSC_TRUE)
596) call InputErrorMsg(input,option,'EOS,OIL','VIS DBASE filename')
597) call EOSOilSetVisDBase(word,option)
598) case default
599) call InputKeywordUnrecognized(word,'EOS,OIL,VISCOSITY',option)
600) end select
601) case('FORMULA_WEIGHT')
602) call InputReadDouble(input,option,tempreal)
603) !call InputReadDouble(input,option,fmw_oil)
604) call InputErrorMsg(input,option,'VALUE','EOS,OIL,FORMULA_WEIGHT')
605) call InputReadAndConvertUnits(input,tempreal, &
606) 'g/mol','EOS,OIL,FORMULA_WEIGHT',option)
607) call EOSOilSetFMWConstant(tempreal)
608) case default
609) call InputKeywordUnrecognized(keyword,'EOS,OIL',option)
610) end select
611) enddo
612) ! need to add verifying function - follow EOSgas template
613) string = ''
614) call EOSOilVerify(ierr,string)
615) if (ierr /= 0) then
616) option%io_buffer = 'Error in Oil EOS'
617) if (len_trim(string) > 1) then
618) option%io_buffer = trim(option%io_buffer) // ': ' // trim(string)
619) endif
620) call printErrMsg(option)
621) endif
622) case default
623) call InputKeywordUnrecognized(keyword,'EOS',option)
624) end select
625)
626) end subroutine EOSRead
627)
628) ! **************************************************************************** !
629)
630) subroutine EOSInputRecord()
631) !
632) ! Prints ingested equation of state information to the input record file.
633) !
634) ! Author: Jenn Frederick
635) ! Date: 05/04/2016
636) !
637) use EOS_Water_module
638) use EOS_Gas_module
639) use EOS_Oil_module
640)
641) implicit none
642)
643) PetscInt :: id = INPUT_RECORD_UNIT
644)
645) write(id,'(a)') ' '
646) write(id,'(a)') '---------------------------------------------------------&
647) &-----------------------'
648) write(id,'(a29)',advance='no') '---------------------------: '
649) write(id,'(a)') 'EQUATIONS OF STATE (EOS)'
650)
651) call EOSWaterInputRecord()
652) call EOSGasInputRecord()
653) call EOSOilInputRecord()
654)
655) end subroutine EOSInputRecord
656)
657) ! ************************************************************************** !
658)
659) subroutine AllEOSDBaseDestroy()
660) !
661) ! Author: Paolo Orsini
662) ! Date: 12/14/15
663) !
664)
665) implicit none
666)
667) call EOSOilDBaseDestroy()
668)
669) end subroutine AllEOSDBaseDestroy
670)
671) ! ************************************************************************** !
672)
673) end module EOS_module