-
Notifications
You must be signed in to change notification settings - Fork 0
/
cesm_1_2_2.patch
164 lines (148 loc) · 5.79 KB
/
cesm_1_2_2.patch
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Index: models/atm/cam/bld/Makefile.in
===================================================================
--- models/atm/cam/bld/Makefile.in (revision 65288)
+++ models/atm/cam/bld/Makefile.in (working copy)
@@ -42,6 +42,8 @@
# Use this to replace default Fortran compiler optimization.
# COSP_LIBDIR Directory where COSP library will be built.
# MCT_LIBDIR Directory where MCT library will be built.
+# CATALYST_LDFLAGS Catalyst linking flags
+# CATALYST_INC Search path for Catalyst mod file
#
# Note: An internal implementation of the ESMF time-manager interface is provided
# with the sequential CCSM distribution in models/utils/esmf_wrf_timemgr.
@@ -68,7 +70,7 @@
dirs := . $(shell cat Filepath)
# Set cpp search path, include netcdf
-cpp_dirs := $(dirs) $(INC_NETCDF) $(INC_MPI) $(INC_PNETCDF)
+cpp_dirs := $(dirs) $(INC_NETCDF) $(INC_MPI) $(INC_PNETCDF) $(CATALYST_INC)
cpp_path := $(foreach dir,$(cpp_dirs),-I$(dir)) # format for command line
# Expand any tildes in directory names. Change spaces to colons.
@@ -113,7 +115,7 @@
endif
$(MODEL_EXEDIR)/$(EXENAME): $(OBJS)
- $(LINKER) -o $@ $(OBJS) $(NC_LDFLAGS) $(LDFLAGS)
+ $(LINKER) -o $@ $(OBJS) $(NC_LDFLAGS) $(LDFLAGS) $(CATALYST_LDFLAGS)
ifneq ($(strip $(COSP_LIBDIR)),)
# Rules to build COSP in its own library. Add abortutils dependency so
Index: models/atm/cam/bld/configure
===================================================================
--- models/atm/cam/bld/configure (revision 65288)
+++ models/atm/cam/bld/configure (working copy)
@@ -187,6 +187,7 @@
-cache <file> Name of output cache file (default: config_cache.xml).
-cachedir <file> Name of directory where output cache file is written (default: CAM build directory).
+ -catalyst Link with ParaView Catalyst.
-ccsm_seq Switch to specify that CAM is being built from within sequential CCSM scripts.
-help [or -h] Print usage to STDOUT.
-silent [or -s] Turns on silent mode - only fatal messages issued.
@@ -289,6 +290,7 @@
"cache=s" => \$opts{'cache'},
"cachedir=s" => \$opts{'cachedir'},
"carma=s" => \$opts{'carma'},
+ "catalyst" => \$opts{'catalyst'},
"cam_bld=s" => \$opts{'cam_bld'},
"cam_exe=s" => \$opts{'cam_exe'},
"cam_exedir=s" => \$opts{'cam_exedir'},
@@ -514,6 +516,8 @@
my $ccsm_seq = (defined $opts{'ccsm_seq'}) ? 1 : 0;
$cfg_ref->set('ccsm_seq', $ccsm_seq);
+my $catalyst = (defined $opts{'catalyst'}) ? 1 : 0;
+
# Note that when building within the CCSM scripts the CAM Makefile is not written
# since the CCSM build does not use it. Many of the checks to ensure that a working
# CAM Makefile is produced are disabled when the ccsm option is set. Use the $cam_build
@@ -1952,6 +1956,10 @@
$cfg_cppdefs .= " -DCLUBB_REAL_TYPE=dp";
}
+if ($catalyst) {
+ $cfg_cppdefs .= " -DCATALYST";
+}
+
#-----------------------------------------------------------------------------------------------
# External libraries ###########################################################################
#-----------------------------------------------------------------------------------------------
@@ -2086,6 +2094,18 @@
}
}
+# Catalyst
+my $catalyst_ldflags = "";
+my $catalyst_inc = "";
+if ($catalyst) {
+ my $catalyst_build_dir = "cam_catalyst_adapter";
+ $catalyst_ldflags = "-L${catalyst_build_dir} -lcam_catalyst_adapter";
+ my $catalyst_src_dir = "${cam_root}/models/atm/cam/cam_catalyst_adapter/";
+ $catalyst_inc = "${catalyst_build_dir} $catalyst_src_dir";
+}
+
+
+
# PNetCDF library
my $pnc_lib = '';
if ($cam_build) {
@@ -2812,6 +2832,8 @@
INC_NETCDF := $nc_inc
LIB_NETCDF := $nc_lib
NC_LDFLAGS := $nc_ldflags
+CATALYST_LDFLAGS := $catalyst_ldflags
+CATALYST_INC := $catalyst_inc
MOD_NETCDF := $nc_mod
INC_PNETCDF := $pnc_inc
LIB_PNETCDF := $pnc_lib
Index: models/atm/cam/src/cpl_mct/atm_comp_mct.F90
===================================================================
--- models/atm/cam/src/cpl_mct/atm_comp_mct.F90 (revision 65288)
+++ models/atm/cam/src/cpl_mct/atm_comp_mct.F90 (working copy)
@@ -50,6 +50,9 @@
use runtime_opts , only: read_namelist
use phys_control , only: cam_chempkg_is
use scamMod , only: single_column,scmlat,scmlon
+#if (defined CATALYST )
+ use fv_catalyst_adapter , only: catalyst_init, catalyst_finalize
+#endif
!
! !PUBLIC TYPES:
@@ -174,6 +177,12 @@
call memmon_dump_fort('memmon.out','atm_init_mct:start::',lbnum)
endif
#endif
+#if (defined CATALYST )
+ ! call catalsyt_init only once (the second time atm_init_mct is called)
+ if(.not. present(NLFilename)) then
+ call catalyst_init()
+ endif
+#endif
call seq_cdata_setptrs(cdata_a, ID=ATMID, mpicom=mpicom_atm, &
gsMap=gsMap_atm, dom=dom_a, infodata=infodata)
@@ -650,6 +659,10 @@
type(mct_aVect) ,intent(inout) :: x2a_a
type(mct_aVect) ,intent(inout) :: a2x_a
+#if (defined CATALYST )
+ call catalyst_finalize()
+#endif
+
call cam_final( cam_out, cam_in )
end subroutine atm_final_mct
Index: models/atm/cam/src/physics/cam/physpkg.F90
===================================================================
--- models/atm/cam/src/physics/cam/physpkg.F90 (revision 65288)
+++ models/atm/cam/src/physics/cam/physpkg.F90 (working copy)
@@ -821,6 +821,11 @@
end subroutine phys_init
+#if (defined CATALYST)
+include "fv_add_and_coprocess.F90"
+#endif
+
+
!
!-----------------------------------------------------------------------
!
@@ -958,6 +963,10 @@
#endif
end if
+#if (defined CATALYST )
+ call fv_add_and_coprocess(phys_state);
+#endif
+
end subroutine phys_run1
!