1 | subroutine call_profilgases(nlayer) |
---|
2 | |
---|
3 | use gases_h |
---|
4 | |
---|
5 | implicit none |
---|
6 | |
---|
7 | |
---|
8 | !============================================================================ |
---|
9 | ! |
---|
10 | ! Purpose |
---|
11 | ! ------- |
---|
12 | ! Set atmospheric composition for Titan main gases (N2, CH4, H2) from : |
---|
13 | ! - Interactive tracers if we run with chemistry |
---|
14 | ! or |
---|
15 | ! - CH4 vertical profile file (profile.def) at firstcall only |
---|
16 | ! |
---|
17 | ! Author |
---|
18 | ! ------ |
---|
19 | ! J. Vatant d'Ollone (2017) |
---|
20 | ! |
---|
21 | !============================================================================ |
---|
22 | |
---|
23 | |
---|
24 | !-------------------------- |
---|
25 | ! 0. Declarations |
---|
26 | ! ------------------------- |
---|
27 | |
---|
28 | integer, intent(in) :: nlayer |
---|
29 | |
---|
30 | |
---|
31 | logical, save :: firstcall=.true. |
---|
32 | !$OMP THREADPRIVATE(firstcall) |
---|
33 | |
---|
34 | |
---|
35 | integer ilay, ierr |
---|
36 | |
---|
37 | |
---|
38 | ! ----------------------------------------------- |
---|
39 | ! 1. First case : no interactive CH4 tracer |
---|
40 | ! ----------------------------------------------- |
---|
41 | |
---|
42 | if (firstcall) then |
---|
43 | |
---|
44 | !$OMP MASTER |
---|
45 | #ifndef MESOSCALE |
---|
46 | ! Load CH4 vertical profile from file 'profile.def' |
---|
47 | open(90,file='profile.def',status='old',form='formatted',iostat=ierr) |
---|
48 | |
---|
49 | if (ierr.eq.0) then |
---|
50 | write(*,*) "call_profilgases.F90: reading file profile.def" |
---|
51 | read(90,*) ! header |
---|
52 | |
---|
53 | write(*,*) "call_profilgases.F90: reading CH4 vertical profile..." |
---|
54 | |
---|
55 | do ilay=1,nlayer |
---|
56 | read(90,*,iostat=ierr) gfrac(igas_CH4,ilay) |
---|
57 | if (ierr.ne.0) then |
---|
58 | write(*,*) 'call_profilgases.F90: error reading CH4 vertical profile... aborting' |
---|
59 | call abort |
---|
60 | endif |
---|
61 | enddo |
---|
62 | #else |
---|
63 | gfrac(igas_CH4,:) = 1.443E-02 |
---|
64 | print*,"MESOSCALE. setting constant CH4",gfrac(igas_CH4,1) |
---|
65 | #endif |
---|
66 | ! Then set H2 (fixed) and N2 (what remains) |
---|
67 | |
---|
68 | gfrac(igas_H2,:) = 1.0E-3 |
---|
69 | gfrac(igas_N2,:) = 1.0 - ( gfrac(igas_CH4,:) + gfrac(igas_H2,:) ) |
---|
70 | |
---|
71 | |
---|
72 | #ifndef MESOSCALE |
---|
73 | else |
---|
74 | write(*,*) 'Cannot find required file "profile.def"' |
---|
75 | call abort |
---|
76 | endif |
---|
77 | |
---|
78 | close(90) |
---|
79 | #endif |
---|
80 | !$OMP END MASTER |
---|
81 | !$OMP BARRIER |
---|
82 | |
---|
83 | firstcall=.false. |
---|
84 | endif ! if (firstcall) |
---|
85 | |
---|
86 | |
---|
87 | ! ----------------------------------------------- |
---|
88 | ! 2. Second case : interactive CH4 tracer |
---|
89 | ! ----------------------------------------------- |
---|
90 | |
---|
91 | end subroutine call_profilgases |
---|