1 |
jahn |
1.2 |
C $Header: /u/gcmpack/MITgcm_contrib/darwin2/pkg/darwin/wavebands_init_vari.F,v 1.1 2011/04/13 18:56:25 jahn Exp $ |
2 |
|
|
C $Name: $ |
3 |
jahn |
1.1 |
|
4 |
|
|
c ANNA wavebands_init_vari.F assigns actual values to choices made by coin-flips in darwin_generate_phyto.F |
5 |
|
|
c ANNA wavebands_init_vari.F creates output files |
6 |
|
|
|
7 |
|
|
#include "DARWIN_OPTIONS.h" |
8 |
|
|
|
9 |
|
|
CBOP |
10 |
|
|
C !ROUTINE: WAVEBANDS_INIT_VARI |
11 |
|
|
C !INTERFACE: |
12 |
|
|
SUBROUTINE WAVEBANDS_INIT_VARI(myThid) |
13 |
|
|
|
14 |
|
|
C !DESCRIPTION: \bv |
15 |
|
|
C *==========================================================* |
16 |
|
|
C | SUBROUTINE WAVEBANDS_INIT_VARI |
17 |
|
|
C | o assigns actual values to choices made by coin-flips |
18 |
|
|
C | in darwin_generate_phyto.F; creates output files |
19 |
|
|
C *==========================================================* |
20 |
|
|
C \ev |
21 |
|
|
|
22 |
|
|
C !USES: |
23 |
|
|
implicit none |
24 |
|
|
C == Global variables === |
25 |
|
|
#include "DARWIN_SIZE.h" |
26 |
|
|
#include "SPECTRAL_SIZE.h" |
27 |
|
|
#ifdef WAVEBANDS |
28 |
|
|
#include "WAVEBANDS_PARAMS.h" |
29 |
|
|
#endif |
30 |
|
|
|
31 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
32 |
|
|
C == Routine arguments == |
33 |
|
|
C myThid :: my Thread Id number |
34 |
|
|
INTEGER myThid |
35 |
|
|
CEOP |
36 |
|
|
|
37 |
|
|
#ifdef WAVEBANDS |
38 |
|
|
|
39 |
jahn |
1.2 |
C !FUNCTIONS: |
40 |
|
|
LOGICAL MASTER_CPU_THREAD |
41 |
|
|
EXTERNAL MASTER_CPU_THREAD |
42 |
|
|
|
43 |
jahn |
1.1 |
C !LOCAL VARIABLES: |
44 |
|
|
C == Local variables == |
45 |
|
|
_RL outfile(npmax,tlam) |
46 |
|
|
_RL outfile_ps(npmax,tlam) |
47 |
|
|
|
48 |
|
|
INTEGER np,nl,i,ilam, nap |
49 |
|
|
INTEGER IniUnit1, IniUnit2, IniUnit3 |
50 |
|
|
INTEGER IniUnit4, IniUnit5, IniUnit6 |
51 |
|
|
INTEGER IniUnit7 |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
c ANNA associate the pigment / abs choices for phytoplankton with actual absorption spectra |
55 |
|
|
c make sure pigment types and actual spectra match - here keep 1-4 in same order as datafile |
56 |
|
|
do np = 1, npmax |
57 |
|
|
|
58 |
|
|
do nap=1, tnabp |
59 |
|
|
if (ap_type(np).eq.nap) then |
60 |
|
|
do i = 1,tlam |
61 |
|
|
aphy_chl(np,i) = ap(nap,i) |
62 |
|
|
aphy_chl_ps(np,i) = ap_ps(nap,i) |
63 |
|
|
#ifdef DAR_RADTRANS |
64 |
|
|
bphy_chl(np,i) = bp(nap,i) |
65 |
|
|
#ifdef DAR_NONSPECTRAL_BACKSCATTERING_RATIO |
66 |
|
|
bbphy_chl(np,i) = bp(nap,i)*darwin_bbphy(nap) |
67 |
|
|
#else |
68 |
|
|
bbphy_chl(np,i) = bbp(nap,i) |
69 |
|
|
#endif |
70 |
|
|
#endif |
71 |
|
|
enddo |
72 |
|
|
endif |
73 |
|
|
enddo |
74 |
|
|
|
75 |
|
|
c checking the output .dat file will reveal this |
76 |
|
|
if(ap_type(np).eq.0) then |
77 |
|
|
do i=1,tlam |
78 |
|
|
aphy_chl(np,i) = 9.9d2 |
79 |
|
|
aphy_chl_ps(np,i) = 9.9d2 |
80 |
|
|
#ifdef DAR_RADTRANS |
81 |
|
|
bphy_chl(np,i) = 9.9d2 |
82 |
|
|
bbphy_chl(np,i) = 9.9d2 |
83 |
|
|
#endif |
84 |
|
|
enddo |
85 |
|
|
endif |
86 |
|
|
|
87 |
|
|
enddo |
88 |
|
|
|
89 |
|
|
c ANNA create output files for WAVEBANDS |
90 |
|
|
c ANNA see format_helps folder for more info on file structures |
91 |
|
|
|
92 |
|
|
c file for ap_types assigned via coin flips |
93 |
jahn |
1.2 |
IF (MASTER_CPU_THREAD(myThid)) THEN |
94 |
jahn |
1.1 |
CALL MDSFINDUNIT( IniUnit1, mythid ) |
95 |
|
|
open(IniUnit1,file='p-ini-char-aptype.dat', |
96 |
|
|
& status='unknown') |
97 |
|
|
CALL MDSFINDUNIT( IniUnit2, mythid ) |
98 |
|
|
open(IniUnit2,file='p_ini_char_aptype_nohead.dat', |
99 |
|
|
& status='unknown') |
100 |
|
|
write(IniUnit1,*)'np ap_type' !to have bp_type for backscattering too |
101 |
|
|
do np = 1,npmax |
102 |
|
|
write(IniUnit1,120)np,ap_type(np) |
103 |
|
|
write(IniUnit2,120)np,ap_type(np) |
104 |
|
|
enddo |
105 |
|
|
close(IniUnit1) |
106 |
|
|
close(IniUnit2) |
107 |
|
|
120 format(2i5) |
108 |
jahn |
1.2 |
ENDIF |
109 |
jahn |
1.1 |
|
110 |
|
|
c file of total absorption spectra |
111 |
|
|
c rows = pwaves, columns = np |
112 |
|
|
do np=1,npmax |
113 |
|
|
do ilam=1,tlam |
114 |
|
|
outfile(np,ilam) = aphy_chl(np,ilam) |
115 |
|
|
enddo |
116 |
|
|
enddo |
117 |
jahn |
1.2 |
IF (MASTER_CPU_THREAD(myThid)) THEN |
118 |
jahn |
1.1 |
CALL MDSFINDUNIT( IniUnit3, mythid ) |
119 |
|
|
open(IniUnit3,file='p-ini-char-apspec.dat', |
120 |
|
|
& status='unknown') |
121 |
|
|
CALL MDSFINDUNIT( IniUnit4, mythid ) |
122 |
|
|
open(IniUnit4,file='p_ini_char_aspec_nohead.dat', |
123 |
|
|
& status='unknown') |
124 |
|
|
write(IniUnit3,*)'Rows = pwaves. Columns = np' |
125 |
|
|
write(IniUnit3,*)'pwaves found in pwaves-check.dat' |
126 |
|
|
write(IniUnit3,*)'col_1 to col_<npmax>' |
127 |
|
|
write(IniUnit3,*)'is absorption aphy_chl (m-2 mg chla-1)' |
128 |
|
|
do ilam=1,tlam |
129 |
|
|
write(IniUnit3,130)(outfile(np,ilam),np=1,npmax) |
130 |
|
|
write(IniUnit4,130)(outfile(np,ilam),np=1,npmax) |
131 |
|
|
enddo |
132 |
|
|
c make sure outfile is defined above with the correct size |
133 |
|
|
close(IniUnit3) |
134 |
|
|
close(IniUnit4) |
135 |
jahn |
1.2 |
ENDIF |
136 |
jahn |
1.1 |
|
137 |
|
|
c file for absorption spectra of PS's only |
138 |
|
|
c rows = pwaves, columns = np |
139 |
|
|
do np=1,npmax |
140 |
|
|
do ilam=1,tlam |
141 |
|
|
outfile_ps(np,ilam) = aphy_chl_ps(np,ilam) |
142 |
|
|
enddo |
143 |
|
|
enddo |
144 |
jahn |
1.2 |
IF (MASTER_CPU_THREAD(myThid)) THEN |
145 |
jahn |
1.1 |
CALL MDSFINDUNIT( IniUnit5, mythid ) |
146 |
|
|
open( IniUnit5,file='p-ini-char-apspec-psc.dat', |
147 |
|
|
& status='unknown') |
148 |
|
|
CALL MDSFINDUNIT( IniUnit6, mythid ) |
149 |
|
|
open( IniUnit6,file='p_ini_char_aspec_psc_nohead.dat', |
150 |
|
|
& status='unknown') |
151 |
|
|
write(IniUnit5,*)'Rows = pwaves. Columns = np' |
152 |
|
|
write(IniUnit5,*)'pwaves found in pwaves-check.dat' |
153 |
|
|
write(IniUnit5,*)'Is absoprtion by photosynthetic' |
154 |
|
|
write(IniUnit5,*)'pigments only aphy_chl_ps (m-2 mg chla-1)' |
155 |
|
|
do ilam=1,tlam |
156 |
|
|
write(IniUnit5,130)(outfile_ps(np,ilam),np=1,npmax) |
157 |
|
|
write(IniUnit6,130)(outfile_ps(np,ilam),np=1,npmax) |
158 |
|
|
enddo |
159 |
|
|
close(IniUnit5) |
160 |
|
|
close(IniUnit6) |
161 |
|
|
130 format(9999f10.4) |
162 |
jahn |
1.2 |
ENDIF |
163 |
jahn |
1.1 |
|
164 |
|
|
|
165 |
|
|
c file for wavebands used |
166 |
jahn |
1.2 |
IF (MASTER_CPU_THREAD(myThid)) THEN |
167 |
jahn |
1.1 |
c open(23,file='pwaves-check.dat',status='new') |
168 |
|
|
CALL MDSFINDUNIT( IniUnit7, mythid ) |
169 |
|
|
open( IniUnit7,file='pwaves-check.dat', |
170 |
|
|
& status='unknown') |
171 |
|
|
write(IniUnit7,140)pwaves |
172 |
|
|
close(IniUnit7) |
173 |
|
|
140 format(i5) |
174 |
jahn |
1.2 |
ENDIF |
175 |
jahn |
1.1 |
|
176 |
jahn |
1.2 |
#endif /* WAVEBANDS */ |
177 |
jahn |
1.1 |
|
178 |
|
|
return |
179 |
|
|
end |