forked from AMReX-Astro/initial_models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGInitModels.mak
159 lines (110 loc) · 4.88 KB
/
GInitModels.mak
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
# A set of useful macros for putting together one of the initial model
# generator routines
# include the main Makefile stuff
include $(FBOXLIB_HOME)/Tools/F_mk/GMakedefs.mak
# default target (make just takes the one that appears first)
ALL: init_1d.$(suf).exe
#-----------------------------------------------------------------------------
# core FBoxLib directories
FBOXLIB_CORE := Src/BaseLib
FPP_DEFINES += -DAMREX_DEVICE=""
#-----------------------------------------------------------------------------
# Microphysics directories needed
EOS_TOP_DIR := $(MICROPHYSICS_HOME)/EOS
NETWORK_TOP_DIR := $(MICROPHYSICS_HOME)/networks
# the helmeos has an include file -- also add a target to link the table
# into the problem directory.
ifeq ($(findstring helmholtz, $(EOS_DIR)), helmholtz)
ALL: table
EOS_PATH := $(EOS_TOP_DIR)/helmholtz
endif
table:
@if [ ! -f helm_table.dat ]; then echo ${bold}Linking helm_table.dat${normal}; ln -s $(EOS_PATH)/helm_table.dat .; fi
MICROPHYS_CORE := $(MICROPHYSICS_HOME)/EOS \
$(MICROPHYSICS_HOME)/networks \
$(MICROPHYSICS_HOME)/interfaces \
$(MICROPHYSICS_HOME)/unit_test
# add in the network, EOS
MICROPHYS_CORE += $(EOS_TOP_DIR)/$(EOS_DIR) \
$(NETWORK_TOP_DIR)/$(NETWORK_DIR) \
# get any additional network dependencies
include $(NETWORK_TOP_DIR)/$(strip $(NETWORK_DIR))/NETWORK_REQUIRES
# explicitly add in any source defined in the build directory
f90sources += $(MODEL_SOURCES)
f90sources += $(READER_SOURCES)
#-----------------------------------------------------------------------------
# core FBoxLib directories
Fmpack := $(foreach dir, $(FBOXLIB_CORE), $(FBOXLIB_HOME)/$(dir)/GPackage.mak)
Fmlocs := $(foreach dir, $(FBOXLIB_CORE), $(FBOXLIB_HOME)/$(dir))
Fmincs :=
# auxillary directories
Fmpack += $(foreach dir, $(MICROPHYS_CORE), $(dir)/GPackage.mak)
Fmlocs += $(foreach dir, $(MICROPHYS_CORE), $(dir))
# include the necessary GPackage.mak files that define this setup
include $(Fmpack)
# we need a probin.f90, since the various microphysics routines can
# have runtime parameters
F90sources += probin.F90
PROBIN_TEMPLATE := $(MICROPHYSICS_HOME)/unit_test/dummy.probin.template
PROBIN_PARAMETER_DIRS = $(INITIAL_MODEL_HOME) .
EXTERN_PARAMETER_DIRS += $(MICROPHYS_CORE) $(NETWORK_TOP_DIR)
PROBIN_PARAMETERS := $(shell $(FBOXLIB_HOME)/Tools/F_scripts/findparams.py $(PROBIN_PARAMETER_DIRS))
EXTERN_PARAMETERS := $(shell $(FBOXLIB_HOME)/Tools/F_scripts/findparams.py $(EXTERN_PARAMETER_DIRS))
probin.F90: $(PROBIN_PARAMETERS) $(EXTERN_PARAMETERS) $(PROBIN_TEMPLATE)
@echo " "
@echo "${bold}WRITING probin.f90${normal}"
$(FBOXLIB_HOME)/Tools/F_scripts/write_probin.py \
-t $(PROBIN_TEMPLATE) -o probin.F90 -n probin \
--pa "$(PROBIN_PARAMETERS)" --pb "$(EXTERN_PARAMETERS)"
@echo " "
read_mesa.f90: $(INITIAL_MODEL_HOME)/read_mesa/read_mesa.f90
cp ../read_mesa/read_mesa.f90 .
# $(LINK.f90) -o read_mesa.o $(objects) $(libraries)
@echo SUCCESS
# vpath defines the directories to search for the source files
# VPATH_LOCATIONS to first search in the problem directory
# Note: GMakerules.mak will include '.' at the start of the
VPATH_LOCATIONS += . $(Fmlocs)
# list of directories to put in the Fortran include path
FINCLUDE_LOCATIONS += $(Fmincs)
#-----------------------------------------------------------------------------
# build_info stuff
deppairs: build_info.f90
build_info.f90:
@echo " "
@echo "${bold}WRITING build_info.f90${normal}"
$(FBOXLIB_HOME)/Tools/F_scripts/makebuildinfo.py \
--modules "$(Fmdirs) $(MICROPHYS_CORE) $(UNIT_DIR)" \
--FCOMP "$(COMP)" \
--FCOMP_version "$(FCOMP_VERSION)" \
--f90_compile_line "$(COMPILE.f90)" \
--f_compile_line "$(COMPILE.f)" \
--C_compile_line "$(COMPILE.c)" \
--link_line "$(LINK.f90)" \
--fboxlib_home "$(FBOXLIB_HOME)" \
--source_home "$(MICROPHYSICS_HOME)" \
--network "$(NETWORK_DIR)" \
--integrator "$(INTEGRATOR_DIR)" \
--eos "$(EOS_DIR)"
@echo " "
$(odir)/build_info.o: build_info.f90
$(COMPILE.f90) $(OUTPUT_OPTION) build_info.f90
rm -f build_info.f90
init_1d.$(suf).exe: $(objects)
$(LINK.f90) -o init_1d.$(suf).exe $(objects) $(libraries)
@echo SUCCESS
# include the fParallel Makefile rules
include $(FBOXLIB_HOME)/Tools/F_mk/GMakerules.mak
#-----------------------------------------------------------------------------
# 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 $($*)
#-----------------------------------------------------------------------------
# cleaning. Add more actions to 'clean' and 'realclean' to remove
# probin.f90 and build_info.f90 -- this is where the '::' in make comes
# in handy
clean::
$(RM) probin.F90
$(RM) build_info.f90
$(RM) read_mesa.f90