-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathMake.Castro
More file actions
394 lines (294 loc) · 10.5 KB
/
Copy pathMake.Castro
File metadata and controls
394 lines (294 loc) · 10.5 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
CASTRO_HOME ?= /path/to/Castro
# clang-tidy support via AMReX
CLANG_TIDY_CONFIG_FILE := $(CASTRO_HOME)/.clang-tidy
# space-separated list of paths to skip when running clang-tidy
CLANG_TIDY_IGNORE_SOURCES = $(AMREX_HOME)/Src $(MICROPHYSICS_HOME)
# radiation needs hypre
HYPRE_DIR ?= /path/to/Hypre
TOP := $(CASTRO_HOME)
# Allow a problem setup to define a root location.
# Otherwise, assume we're building in the current directory.
PROBLEM_DIR ?= ./
# Microphysics is a git submodule of Castro. By default
# we assume it is in the external/ directory.
# The user may override this with their own installation
# of Microphysics as long as they set the environment variable
# MICROPHYSICS_HOME.
MICROPHYSICS_HOME ?= $(TOP)/external/Microphysics
# Check to make sure that Microphysics actually exists,
# using an arbitrary file that must exist to check.
# Throw an error if we don't have Microphysics.
ifeq ("$(wildcard $(MICROPHYSICS_HOME)/Make.Microphysics)","")
$(error Microphysics has not been downloaded. Please run "git submodule update --init" from the top level of the code)
endif
# Locations within Microphysics
EOS_HOME ?= $(MICROPHYSICS_HOME)/EOS
NETWORK_HOME ?= $(MICROPHYSICS_HOME)/networks
CONDUCTIVITY_HOME ?= $(MICROPHYSICS_HOME)/conductivity
BL_NO_FORT := TRUE
# AMReX is a git submodule of Castro. By default
# we assume it is in the external/ directory.
# The user may override this with their own installation
# of AMReX as long as they set the environment variable
# AMREX_HOME.
AMREX_HOME ?= $(TOP)/external/amrex
# Check to make sure that AMReX actually exists,
# using an arbitrary file that must exist to check.
# Throw an error if we don't have AMReX.
ifeq ("$(wildcard $(AMREX_HOME)/Tools/GNUMake/Make.defs)","")
$(error AMReX has not been downloaded. Please run "git submodule update --init" from the top level of the code)
endif
# Require C++17
CXXSTD := c++17
# Use Lazy QueueReduction for the timing outputs
LAZY := TRUE
# default integrator
INTEGRATOR_DIR ?= VODE
# number of passively advected quantities that are not species or auxiliary
NUMADV ?= 0
# number of radiation groups
NGROUPS ?= 1
# this can be turned off for unit tests, etc., and not
# the entire Castro build
USE_ALL_CASTRO ?= TRUE
USE_AMR_CORE ?= TRUE
# all Castro problems use a dimension-agnostic interface
DIMENSION_AGNOSTIC = TRUE
EBASE = Castro
# EXTERN_CORE is simply a list of the directories we use in EOS,
# Networks and Util this list will be searched for runtime parameters
EXTERN_CORE ?=
ifeq ($(USE_SDC), TRUE)
$(error USE_SDC is no longer supported. Use with USE_SIMPLIFIED_SDC or USE_TRUE_SDC)
endif
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_TRUE_SDC), TRUE)
$(error USE_SIMPLIFIED_SDC cannot be combined with USE_TRUE_SDC)
endif
endif
# need to put any build suffices before Make.defs
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifneq ($(USERSuffix),)
USERSuffix := .SMPLSDC$(USERSuffix)
else
USERSuffix = .SMPLSDC
endif
endif
ifeq ($(USE_TRUE_SDC), TRUE)
ifneq ($(USERSuffix),)
USERSuffix := .TRUESDC$(USERSuffix)
else
USERSuffix = .TRUESDC
endif
endif
USE_MLMG = FALSE
ifeq ($(USE_RAD), TRUE)
USE_HYPRE := TRUE
USE_MLMG = TRUE
endif
ifeq ($(USE_MPI), TRUE)
# Use thread support in MPI to support asynchronous I/O
MPI_THREAD_MULTIPLE := TRUE
# But keep the suffix MPI, not MTMPI, for simplicity
MPI_THREAD_MULTIPLE_UPDATE_SUFFIX := FALSE
endif
ifeq ($(USE_CUDA),TRUE)
CUDA_VERBOSE = FALSE
endif
AMREX_NO_PROBINIT := TRUE
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
ifeq ($(USE_GPU),TRUE)
# We don't currently support host-side OpenMP being enabled
# when using GPUs. Throw an error to prevent this case.
ifeq ($(USE_OMP),TRUE)
$(error OpenMP is not supported by Castro when building with GPU support)
endif
endif
ifeq ($(USE_GPU_PRINTF),TRUE)
DEFINES += -DALLOW_GPU_PRINTF
endif
CASTRO_AUTO_SOURCE_DIR := $(TmpBuildDir)/castro_sources/$(optionsSuffix).EXE
all: build_status check_network $(executable)
@echo SUCCESS
build_status:
$(AMREX_HOME)/Tools/C_scripts/describe_sources.py \
--git_names "Castro AMReX Microphysics" \
--git_dirs "$(TOP) $(AMREX_HOME) $(MICROPHYSICS_HOME)"
# If we make and then make again with a different network, undefined
# behavior may result. One should always do a `make clean` before
# changing networks. This tries to check if there is an inconsistency.
check_network:
$(CASTRO_HOME)/Util/scripts/check_network.py $(NETWORK_DIR) $(CASTRO_AUTO_SOURCE_DIR)
@if [ ! -d $(CASTRO_AUTO_SOURCE_DIR) ]; then mkdir -p $(CASTRO_AUTO_SOURCE_DIR); fi
echo $(NETWORK_DIR) > $(CASTRO_AUTO_SOURCE_DIR)/NETWORK_USED
# The default is to include the sponge functionality
DEFINES += -DSPONGE
#------------------------------------------------------------------------------
# Castro directories
#------------------------------------------------------------------------------
ifeq ($(USE_ALL_CASTRO), TRUE)
Bdirs := Source/driver Source/hydro \
Source/problems Source/sources
endif
NUM_MODELS ?= 1
DIM_MODEL ?= 1
# Only 1 or 2 dimensions are supported for now.
ifeq ($(filter $(DIM_MODEL),1 2),)
$(error Invalid DIM_MODEL=$(DIM_MODEL). Must be 1 or 2.)
endif
ifeq ($(DIM_MODEL), 1)
MAX_NPTS_MODEL ?= 10000
else ifeq ($(DIM_MODEL), 2)
MAX_NPTS_X_MODEL ?= 10000
MAX_NPTS_Y_MODEL ?= 10000
endif
ifeq ($(USE_MODEL_PARSER), TRUE)
Bdirs += Util/model_parser
DEFINES += -DMODEL_PARSER \
-DNUM_MODELS=$(NUM_MODELS) \
-DDIM_MODEL=$(DIM_MODEL)
ifeq ($(DIM_MODEL), 1)
DEFINES += -DNPTS_MODEL=$(MAX_NPTS_MODEL)
else ifeq ($(DIM_MODEL), 2)
DEFINES += -DNPTS_X_MODEL=$(MAX_NPTS_X_MODEL) \
-DNPTS_Y_MODEL=$(MAX_NPTS_Y_MODEL)
endif
endif
ifeq ($(USE_RNG_STATE_INIT), TRUE)
DEFINES += -DRNG_STATE_INIT
endif
# add / define any special physics we need
ifeq ($(USE_MHD), TRUE)
Bdirs += Source/mhd
DEFINES += -DMHD
endif
ifeq ($(USE_GRAV), TRUE)
Bdirs += Source/gravity Source/scf
DEFINES += -DGRAVITY
USE_MLMG = TRUE
endif
ifeq ($(USE_GR), TRUE)
DEFINES += -DGR_GRAV
endif
ifeq ($(USE_REACT), TRUE)
Bdirs += Source/reactions
DEFINES += -DREACTIONS
endif
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
DEFINES += -DSDC_EVOLVE_ENERGY
endif
ifeq ($(USE_TRUE_SDC), TRUE)
Bdirs += Source/sdc
endif
ifeq ($(USE_DIFFUSION), TRUE)
Bdirs += Source/diffusion
DEFINES += -DDIFFUSION
USE_MLMG = TRUE
USE_CONDUCTIVITY = TRUE
endif
ifeq ($(USE_HYBRID_MOMENTUM), TRUE)
ifeq ($(DIM), 3)
DEFINES += -DHYBRID_MOMENTUM
else
$(error USE_HYBRID_MOMENTUM requires 3-d)
endif
endif
ifeq ($(USE_SHOCK_VAR), TRUE)
DEFINES += -DSHOCK_VAR
endif
ifeq ($(USE_POST_SIM), TRUE)
DEFINES += -DDO_PROBLEM_POST_SIMULATION
endif
ifeq ($(USE_RAD), TRUE)
Bdirs += Source/radiation Source/radiation/_interpbndry
DEFINES += -DRADIATION
DEFINES += -DRAD_INTERP
DEFINES += -DNGROUPS=$(NGROUPS)
endif
ifeq ($(USE_MAESTRO_INIT), TRUE)
DEFINES += -DBL_NOLINEVALUES -DBL_PARALLEL_IO -DMAESTRO_INIT
CEXE_headers += DataServices.H AmrData.H AmrvisConstants.H
CEXE_sources += DataServices.cpp AmrData.cpp
FEXE_sources += FABUTIL_$(DIM)D.F
VPATH_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata
INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata
endif
ifeq ($(USE_ROTATION), TRUE)
Bdirs += Source/rotation
DEFINES += -DROTATION
endif
ifeq ($(USE_SPECIES_SOURCES), TRUE)
DEFINES += -DCONS_SPECIES_HAVE_SOURCES
endif
ifeq ($(USE_PARTICLES), TRUE)
Bdirs += Source/particles
endif
Bpack += $(foreach dir, $(Bdirs), $(TOP)/$(dir)/Make.package)
Blocs += $(foreach dir, $(Bdirs), $(TOP)/$(dir))
#------------------------------------------------------------------------------
# AMReX
#------------------------------------------------------------------------------
# core AMReX directories -- note the Make.package for these adds these
# directories into VPATH_LOCATIONS and INCLUDE_LOCATIONS for us, so we
# don't need to do it here
ifeq ($(USE_AMR_CORE), TRUE)
Pdirs := Base AmrCore Amr Boundary
else
Pdirs := Base
endif
ifeq ($(USE_PARTICLES), TRUE)
Pdirs += Particle
endif
ifeq ($(USE_MLMG), TRUE)
Pdirs += LinearSolvers/MLMG
endif
Bpack += $(foreach dir, $(Pdirs), $(AMREX_HOME)/Src/$(dir)/Make.package)
#------------------------------------------------------------------------------
# microphysics
#------------------------------------------------------------------------------
# Specify that we want to write any automatically generated network
# file (including the general_null network) to our temporary build
# directory
NETWORK_OUTPUT_PATH = $(CASTRO_AUTO_SOURCE_DIR)
include $(MICROPHYSICS_HOME)/Make.Microphysics_extern
Bpack += $(foreach dir, $(EXTERN_CORE), $(dir)/Make.package)
Blocs += $(foreach dir, $(EXTERN_CORE), $(dir))
#------------------------------------------------------------------------------
# external libraries
#------------------------------------------------------------------------------
ifeq ($(USE_HDF5), TRUE)
INCLUDE_LOCATIONS += $(HDF5_DIR)/include
INCLUDE_LOCATIONS += $(HDF5_INCL)
LIBRARY_LOCATIONS += $(HDF5_DIR)/lib
LIBRARIES += -lhdf5 -lhdf5_fortran -lhdf5 -lz
endif
#------------------------------------------------------------------------------
# include all of the necessary directories
#------------------------------------------------------------------------------
include $(Bpack)
f90EXE_sources += $(ca_f90EXE_sources)
F90EXE_sources += $(ca_F90EXE_sources)
INCLUDE_LOCATIONS += $(Blocs)
VPATH_LOCATIONS += $(Blocs)
#------------------------------------------------------------------------------
# autogenerated source files
#------------------------------------------------------------------------------
include $(TOP)/Exec/Make.auto_source
#------------------------------------------------------------------------------
# finish up
#------------------------------------------------------------------------------
include $(AMREX_HOME)/Tools/GNUMake/Make.rules
clean::
$(SILENT) $(RM) extern.F90 prob_params_auto.F90 extern_parameters.H extern_parameters_F.H extern_parameters.cpp
$(SILENT) $(RM) AMReX_buildInfo.cpp
$(SILENT) $(RM) $(CASTRO_AUTO_SOURCE_DIR)/*.H $(CASTRO_AUTO_SOURCE_DIR)/*.[fF]90 $(CASTRO_AUTO_SOURCE_DIR)/*.cpp
# these files are now created directly in the CASTRO_AUTO_SOURCE_DIR so eventually we
# can get rid of explicitly removing them (this is for backwards compatibility)
clean::
$(RM) set_conserved.H set_primitive.H set_godunov.H set_indices.F90 state_sizes.f90
# for debugging. To see the value of a Makefile variable,
# e.g. Fmlocs, simply do "make print-Fmlocs". This will print out the
# value.
print-%::
@echo "$* is $($*)"
@$(RM) AMReX_buildInfo.cpp