-
Notifications
You must be signed in to change notification settings - Fork 1
/
drive_rrtm.pl
executable file
·66 lines (50 loc) · 1.69 KB
/
drive_rrtm.pl
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
#!/usr/bin/perl -w
# This driver runs various versions of RRTM for a series of cases and stores the output
$band_gen_dir="/project/p1905/band_build_with_flux/test_gb3/";
$code = ("/project/p1905/band_build/rrtm_lw_so2_kaust/rrtm_v3.3.1_linux_pgf90");
$band_id = '3';
$band_num = $band_id;
$band_name = 'band'.$band_id;
$rrtm_dir = './test_'.$band_name;
$kg_file = 'k_gB0'.$band_id.'.f';
$kg_file_base = $kg_file.'.base';
print $kg_file,$kg_file_base,"\n";
print $band_num,"\n";
chdir($rrtm_dir);
@case_names = glob("INPUT_RRTM.GARAND*o*");
$ncases = @case_names;
print $ncases,"\n";
@case_tags = ();
for ($ic=0;$ic<$ncases; $ic++) {
$case_tags[$ic] = substr($case_names[$ic],11);
}
chdir("../");
@kminor_files = glob("$band_gen_dir/k_minor*.txt");
$nfiles = @kminor_files;
print $nfiles,"\n";
foreach $il (@kminor_files) {
chdir ("src/");
system ("/bin/rm $kg_file");
system ("/bin/cp $kg_file_base $kg_file");
system ("cat $il >> $kg_file");
$minor_map = substr(`basename $il`,8);
$minor_map = substr($minor_map,0,-5);
$map_lev = substr($minor_map,11);
print $minor_map," ",$map_lev,"\n";
system ("cp $kg_file $kg_file.$minor_map");
chdir ("../");
system ("make -f makefiles/make_rrtm");
system ("ls -l rrtm_v3.3.1_linux_pgf90");
chdir($rrtm_dir);
for ($ic=0;$ic<$ncases;$ic++) {
system ("/bin/rm INPUT_RRTM OUTPUT_RRTM");
system ("cp $case_names[$ic] INPUT_RRTM");
system ("echo $map_lev > minor_map_level");
system ($code);
print ($case_tags[$ic],"\n");
print ($band_name,"\n");
print ($minor_map,"\n");
system ("/bin/mv OUTPUT_RRTM OUTPUT_RRTM.$case_tags[$ic].$band_name.$minor_map");
}
chdir ("../");
}