[1648] | 1 | subroutine su_gases(nlayer,tracer) |
---|
[253] | 2 | |
---|
[471] | 3 | use gases_h |
---|
| 4 | |
---|
[253] | 5 | implicit none |
---|
| 6 | |
---|
[1648] | 7 | integer,intent(in) :: nlayer |
---|
| 8 | logical,intent(in) :: tracer |
---|
| 9 | |
---|
| 10 | integer igas, ierr |
---|
| 11 | |
---|
[716] | 12 | !================================================================== |
---|
| 13 | ! |
---|
| 14 | ! Purpose |
---|
| 15 | ! ------- |
---|
| 16 | ! Load atmospheric composition info |
---|
| 17 | ! |
---|
| 18 | ! Authors |
---|
| 19 | ! ------- |
---|
| 20 | ! R. Wordsworth (2011) |
---|
| 21 | ! Allocatable arrays by A. Spiga (2011) |
---|
[1648] | 22 | ! Titan's version : J. Vatant d'Ollone (2017) |
---|
| 23 | ! * force igas_X labels and def gnom for N2,CH4,H2 |
---|
| 24 | ! * get rid of variable species ( enrichment dimension will be set in corrk routines ) |
---|
| 25 | ! |
---|
[716] | 26 | !================================================================== |
---|
[253] | 27 | |
---|
[1315] | 28 | !$OMP MASTER |
---|
[1648] | 29 | |
---|
| 30 | |
---|
| 31 | ngasmx = 3 ! N2, CH4, H2 |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | ! load reference level and reference molar fractions from file 'gases.def' |
---|
[716] | 35 | open(90,file='gases.def',status='old',form='formatted',iostat=ierr) |
---|
[1648] | 36 | |
---|
[716] | 37 | if (ierr.eq.0) then |
---|
| 38 | write(*,*) "sugases.F90: reading file gases.def" |
---|
[1648] | 39 | read(90,*) ! header |
---|
| 40 | |
---|
| 41 | ! We allocate gfrac and we set gas molar fractions for the reference level only. |
---|
| 42 | ! This will be useful for the cpp_mu and rayleigh routines |
---|
| 43 | ! Other gas molar fractions are now set in routine callprofilgases |
---|
| 44 | |
---|
| 45 | write(*,*) 'sugases.F90: allocating and reading gas molar fractions from reference level in gases.def...' |
---|
| 46 | |
---|
| 47 | if(.not.allocated(gfrac)) allocate(gfrac(ngasmx,nlayer)) |
---|
| 48 | |
---|
| 49 | read(90,*,iostat=ierr) nivref |
---|
[716] | 50 | if (ierr.ne.0) then |
---|
[1648] | 51 | write(*,*) "sugases.F90: error reading reference level" |
---|
[716] | 52 | write(*,*) " (first line of gases.def) " |
---|
| 53 | call abort |
---|
| 54 | endif |
---|
[1648] | 55 | |
---|
| 56 | print*, "layer", nivref, "is reference level found in gases.def ..." |
---|
| 57 | |
---|
[716] | 58 | do igas=1,ngasmx |
---|
[1648] | 59 | read(90,*,iostat=ierr) gfrac(igas,nivref) |
---|
[716] | 60 | if (ierr.ne.0) then |
---|
[1648] | 61 | write(*,*) 'sugases.F90: error reading reference gas molar fractions in gases.def... aborting' |
---|
[716] | 62 | call abort |
---|
| 63 | endif |
---|
| 64 | enddo !of do igas=1,ngasmx |
---|
[253] | 65 | |
---|
| 66 | |
---|
[1648] | 67 | ! We force gnom = (N2, CH4, H2) and igas_X for Titan |
---|
| 68 | |
---|
| 69 | igas_N2 = 1 |
---|
| 70 | igas_CH4 = 2 |
---|
| 71 | igas_H2 = 3 |
---|
[253] | 72 | |
---|
[716] | 73 | |
---|
[1648] | 74 | if (.not.allocated(gnom)) allocate(gnom(ngasmx)) |
---|
| 75 | gnom(igas_N2) = "N2_" |
---|
| 76 | gnom(igas_CH4) = "CH4" |
---|
| 77 | gnom(igas_H2) = "H2_" |
---|
| 78 | |
---|
| 79 | |
---|
[716] | 80 | else |
---|
| 81 | write(*,*) 'Cannot find required file "gases.def"' |
---|
| 82 | call abort |
---|
| 83 | endif |
---|
[1648] | 84 | |
---|
[716] | 85 | close(90) |
---|
[1315] | 86 | !$OMP END MASTER |
---|
| 87 | !$OMP BARRIER |
---|
[716] | 88 | |
---|
[253] | 89 | end subroutine su_gases |
---|