Repository navigation
Expand file tree
/
Copy pathmarv.f90
More file actions
140 lines (118 loc) · 4.6 KB
/
Copy pathmarv.f90
File metadata and controls
140 lines (118 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
subroutine marv(temp,logg,R2D2,ingasnum,logVMR,pcover,&
do_clouds,incloudnum,cloudrad,cloudsig,cloudprof,&
inlinetemps,inpress,inwavenum,inlinelist,cia,ciatemps,&
use_disort,make_cl_pspec,make_oth_pspec,make_cf,do_bff,bff,outspec,&
cl_phot_press,oth_phot_press,cfunc)
use sizes
use main
!f2py integer, parameter :: nlinetemps
!f2py intent(in) logg,R2D2
!f2py intent(inout) temp,logVMR,inpress
!f2py intent(in) use_disort,make_cl_pspec,make_oth_pspec,make_cf,do_bff
!f2py intent(inout) inlinetemps
!f2py intent(inout) cloudrad,cloudsig,cloudprof
!f2py intent(inout) cia, ciatemps
!f2py intent(inout) inlinelist, inwavenum,bff
!f2py intent(inout) do_clouds,pcover,ingasnum,incloudnum
!f2py intent(out) out_spec, cl_phot_press,oth_phot_press,cfunc
real,intent(inout) :: cia(:,:,:)
real,dimension(nciatemps) :: ciatemps
double precision,intent(inout) :: inlinelist(:,:,:,:)
double precision,intent(inout):: temp(:)
real :: R2D2,logg
double precision,intent(inout):: bff(:,:)
real,intent(inout) :: pcover(:)
integer,intent(inout) ::do_clouds(:)
character(len=15),dimension(:),allocatable :: gasname
double precision,dimension(:),allocatable :: molmass
integer,intent(inout) :: ingasnum(:)
character(len=15),dimension(:),allocatable::gaslist,cloudlist
double precision,dimension(:),allocatable:: masslist
double precision,intent(inout) :: logVMR(:,:)
integer,intent(inout) :: incloudnum(:,:)
character(len=15),dimension(:,:),allocatable :: cloudname
double precision,intent(inout) :: cloudrad(:,:,:)
double precision,intent(inout) :: cloudsig(:,:,:)
double precision,intent(inout) :: cloudprof(:,:,:)
double precision,dimension(2,maxwave),intent(OUT):: outspec
double precision,dimension(maxpatch,maxwave),intent(OUT):: cl_phot_press,oth_phot_press
double precision,dimension(:,:),allocatable :: out_spec, clphotspec,othphotspec
double precision,dimension(:,:,:),allocatable :: cf
double precision,dimension(maxpatch,maxwave,maxlayers) :: cfunc
double precision,intent(inout) :: inwavenum(:)
!real,dimension(nlinetemps) :: inlinetemps
real,intent(inout) :: inlinetemps(:)
real,intent(inout) :: inpress(:)
integer :: maxgas,maxcloud,igas,icloud, idum1, idum2
integer :: use_disort,make_oth_pspec,make_cl_pspec,do_bff,make_cf
logical :: othphot,clphot,do_cf
call initlayers(size(inpress))
call initwave(size(inwavenum))
call initgas(size(ingasnum))
call initpatch(size(do_clouds))
call initcloud(size(cloudprof(1,1,:)))
call inittemps(size(inlinetemps))
allocate(molmass(ngas),gasname(ngas))
allocate(cloudname(npatch,nclouds))
allocate(out_spec(2,nwave))
clphot = make_cl_pspec
othphot = make_oth_pspec
do_cf = make_cf
open(10,file="gaslist.dat", status='old')
read(10,*) maxgas
allocate(gaslist(maxgas), masslist(maxgas))
do igas = 1, maxgas
read(10,"(I4,A8,F9.5)") idum1,gaslist(igas),masslist(igas)
end do
close(10)
do igas = 1, ngas
gasname(igas) = adjustl(trim(gaslist(ingasnum(igas))))
molmass(igas) = masslist(ingasnum(igas))
end do
open(10,file="cloudlist.dat", status='old')
read(10,*) maxcloud
allocate(cloudlist(maxcloud))
do icloud = 1, maxcloud
read(10,"(I3,A15)") idum2,cloudlist(icloud)
end do
close(10)
do ipatch = 1, npatch
do icloud = 1, nclouds
! check if we're doing a specific cloud or a generic/mixed cloud
if (incloudnum(ipatch,icloud) .gt. 50) then
cloudname(ipatch,icloud) = "mixto"
else
cloudname(ipatch,icloud) = trim(adjustl(cloudlist(incloudnum(ipatch,icloud))))
endif
end do
end do
deallocate(cloudlist,gaslist,masslist)
call forward(temp,logg,R2D2,gasname,ingasnum,molmass,logVMR,pcover,&
do_clouds,incloudnum,cloudname,cloudrad,cloudsig,cloudprof,&
inlinetemps,inpress,inwavenum,inlinelist,cia,ciatemps,use_disort,&
clphot,othphot,do_cf,do_bff,bff,out_spec,clphotspec,othphotspec,cf)
outspec = 0.d0
outspec(1,1:nwave) = out_spec(1,1:nwave)
outspec(2,1:nwave) = out_spec(2,1:nwave)
cl_phot_press = 0.d0
if (clphot) then
do ipatch = 1, npatch
cl_phot_press(ipatch,1:nwave) = clphotspec(ipatch,1:nwave)
end do
end if
oth_phot_press = 0.d0
if (othphot) then
do ipatch = 1, npatch
oth_phot_press(ipatch,1:nwave) = othphotspec(ipatch,1:nwave)
end do
end if
cfunc = 0.d0
if (do_cf) then
do ipatch = 1, npatch
do ilayer = 1, nlayers
cfunc(ipatch,1:nwave,ilayer) = cf(ipatch,1:nwave,ilayer)
end do
end do
end if
deallocate(out_spec,clphotspec,othphotspec,cf)
end subroutine marv