source: trunk/LMDZ.TITAN/libf/phytitan/call_profilgases.F90 @ 2236

Last change on this file since 2236 was 1648, checked in by jvatant, 8 years ago

Modifications to custom radiative transfer to Titan
+ Enables an altitude dependant gfrac for CIA computations

-> many radical changes in su_gases and co ..
-> read vertical CH4 profile with call_profilgases
-> Now you need a 'profile.def' that I will add in the deftank

+ Added interpolate CIA routines for CH4
+ Added temporary mean aerosol profile opacity routine (disr_haze)

File size: 2.1 KB
Line 
1subroutine 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     
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       
63        ! Then set H2 (fixed) and N2 (what remains)
64
65        gfrac(igas_H2,:) = 1.0E-3
66        gfrac(igas_N2,:) = 1.0 - ( gfrac(igas_CH4,:) + gfrac(igas_H2,:) )
67       
68     else
69        write(*,*) 'Cannot find required file "profile.def"'
70        call abort
71     endif
72
73     close(90)
74!$OMP END MASTER
75!$OMP BARRIER
76     
77     firstcall=.false.
78  endif ! if (firstcall)
79
80
81  ! -----------------------------------------------
82  ! 2. Second case : interactive CH4 tracer
83  ! -----------------------------------------------
84 
85end subroutine call_profilgases
Note: See TracBrowser for help on using the repository browser.