-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0d41353
Showing
41 changed files
with
11,304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
SOURCE CODE LICENSE AGREEMENT | ||
BoxLib Version 2014-02-28, Copyright (c) 2013, | ||
The Regents of the University of California, | ||
through Lawrence Berkeley National Laboratory | ||
(subject to receipt of any required approvals from the U.S. | ||
Dept. of Energy). All rights reserved." | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
(1) Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
(2) Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
(3) Neither the name of the University of California, Lawrence | ||
Berkeley National Laboratory, U.S. Dept. of Energy nor the names of | ||
its contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
You are under no obligation whatsoever to provide any bug fixes, | ||
patches, or upgrades to the features, functionality or performance of | ||
the source code ("Enhancements") to anyone; however, if you choose to | ||
make your Enhancements available either publicly, or directly to | ||
Lawrence Berkeley National Laboratory, without imposing a separate | ||
written license agreement for such Enhancements, then you hereby grant | ||
the following license: a non-exclusive, royalty-free perpetual | ||
license to install, use, modify, prepare derivative works, incorporate | ||
into other computer software, distribute, and sublicense such | ||
enhancements or derivative works thereof, in binary and source code | ||
form. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
#MPI := | ||
MPI := t | ||
|
||
#OMP := | ||
OMP := t | ||
|
||
NDEBUG := t | ||
#NDEBUG := | ||
|
||
### Edit compiler options in comps/$(COMP).mak | ||
COMP := GNU | ||
# COMP := Intel | ||
|
||
### | ||
ifdef MPI | ||
# Set USE_MPI_WRAPPERS := t to use mpif90 or mpiifort, | ||
# otherwise you need to specify mpi_include_dir, mpi_lib_dir, and mpi_libraries. | ||
USE_MPI_WRAPPERS := t | ||
ifndef USE_MPI_WRAPPERS | ||
MPI_HOME := /usr/local | ||
mpi_include_dir = $(strip $(MPI_HOME))/include | ||
mpi_lib_dir = $(strip $(MPI_HOME))/lib | ||
mpi_libraries += -lmpich -lpthread | ||
endif | ||
endif | ||
|
||
MKVERBOSE := t | ||
|
||
######################################################################### | ||
|
||
COMP := $(strip $(COMP)) | ||
|
||
ifdef MPI | ||
mpi_suffix := .mpi | ||
endif | ||
ifdef OMP | ||
omp_suffix := .omp | ||
endif | ||
ifndef NDEBUG | ||
debug_suffix := .debug | ||
endif | ||
|
||
suf=$(COMP)$(debug_suffix)$(mpi_suffix)$(omp_suffix) | ||
|
||
odir=. | ||
mdir=. | ||
tdir=. | ||
|
||
tdir = t/$(suf) | ||
odir = $(tdir)/o | ||
mdir = $(tdir)/m | ||
|
||
F_C_LINK := UNDERSCORE | ||
|
||
SOURCE_HOME := src | ||
|
||
fsources := $(notdir $(wildcard $(SOURCE_HOME)/*.f)) | ||
f90sources := $(notdir $(wildcard $(SOURCE_HOME)/*.f90)) | ||
F90sources := $(notdir $(wildcard $(SOURCE_HOME)/*.F90)) | ||
csources := $(notdir $(wildcard $(SOURCE_HOME)/*.c)) | ||
|
||
ifdef MPI | ||
f90sources := $(filter-out parallel_stubs.f90,$(f90sources)) | ||
else | ||
f90sources := $(filter-out parallel.f90,$(f90sources)) | ||
endif | ||
|
||
ifdef OMP | ||
f90sources := $(filter-out omp_stubs.f90,$(f90sources)) | ||
else | ||
f90sources := $(filter-out omp.f90,$(f90sources)) | ||
endif | ||
|
||
libraries = | ||
|
||
fpp_flags = | ||
fld_flags = | ||
|
||
ifeq ($(wildcard comps/$(COMP).mak),) | ||
$(error "comps/$(COMP).mak does not exist") | ||
else | ||
include comps/$(COMP).mak | ||
endif | ||
|
||
ifdef mpi_include_dir | ||
fpp_flags += -I $(mpi_include_dir) | ||
endif | ||
|
||
ifdef mpi_lib_dir | ||
fld_flags += -L $(mpi_lib_dir) | ||
endif | ||
|
||
MODDEP := scripts/moddep.pl | ||
MKDEP := scripts/mkdep.pl | ||
|
||
FPPFLAGS += $(fpp_flags) -I $(SOURCE_HOME) | ||
LDFLAGS += $(fld_flags) | ||
libraries += $(mpi_libraries) | ||
|
||
CPPFLAGS += -DBL_FORT_USE_$(F_C_LINK) -I $(SOURCE_HOME) | ||
|
||
objects = $(addprefix $(odir)/, \ | ||
$(sort $(f90sources:.f90=.o)) \ | ||
$(sort $(F90sources:.F90=.o)) \ | ||
$(sort $(fsources:.f=.o)) \ | ||
$(sort $(csources:.c=.o)) \ | ||
) | ||
sources = \ | ||
$(sort $(f90sources)) \ | ||
$(sort $(F90sources)) \ | ||
$(sort $(fsources) ) \ | ||
$(sort $(csources) ) | ||
|
||
c_includes = $(SOURCE_HOME) | ||
f_includes = $(SOURCE_HOME) | ||
|
||
vpath %.c $(SOURCE_HOME) | ||
vpath %.f $(SOURCE_HOME) | ||
vpath %.f90 $(SOURCE_HOME) | ||
vpath %.F90 $(SOURCE_HOME) | ||
|
||
COMPILE.f = $(FC) $(FFLAGS) $(FPPFLAGS) -c | ||
COMPILE.f90 = $(F90) $(F90FLAGS) $(FPPFLAGS) -c | ||
COMPILE.F90 = $(F90) $(F90FLAGS) $(F90PPFLAGS) $(FPPFLAGS) -c | ||
|
||
LINK.f90 = $(F90) $(F90FLAGS) $(FPPFLAGS) $(LDFLAGS) | ||
|
||
default: main.$(suf).exe | ||
|
||
main.$(suf).exe: $(objects) | ||
$(LINK.f90) -o main.$(suf).exe $(objects) $(libraries) | ||
|
||
clean:: | ||
$(RM) ./*.o ./*.mod $(mdir)/*.mod $(odir)/*.o *.$(suf).exe *~ | ||
$(RM) $(tdir)/f90.depends $(tdir)/c.depends | ||
$(RM) TAGS tags | ||
|
||
realclean:: clean | ||
$(RM) -fr t | ||
$(RM) *.exe | ||
|
||
TAGS: $(sources) | ||
ctags -e --verbose=yes --fortran-kinds=+i $(abspath $^) | ||
|
||
tags: $(sources) | ||
ctags --verbose=yes --fortran-kinds=+i $^ | ||
|
||
# should prevent deletion of .o files | ||
.SECONDARY: $(objects) | ||
|
||
|
||
%.$(suf).exe:%.f90 $(objects) | ||
ifdef MKVERBOSE | ||
$(LINK.f90) -o main.$(suf).exe $< $(objects) $(libraries) | ||
else | ||
@echo "Linking $@ ..." | ||
@$(LINK.f90) -o main.$(suf).exe $< $(objects) $(libraries) | ||
endif | ||
|
||
${odir}/%.o: %.f | ||
@if [ ! -d $(odir) ]; then mkdir -p $(odir); fi | ||
@if [ ! -d $(mdir) ]; then mkdir -p $(mdir); fi | ||
ifdef MKVERBOSE | ||
$(COMPILE.f) -o $@ $< | ||
else | ||
@echo "Building $< ..." | ||
@$(COMPILE.f) -o $@ $< | ||
endif | ||
|
||
${odir}/%.o: %.f90 | ||
@if [ ! -d $(odir) ]; then mkdir -p $(odir); fi | ||
@if [ ! -d $(mdir) ]; then mkdir -p $(mdir); fi | ||
ifdef MKVERBOSE | ||
$(COMPILE.f90) -o $@ $< | ||
else | ||
@echo "Building $< ..." | ||
@$(COMPILE.f90) -o $@ $< | ||
endif | ||
|
||
${odir}/%.o: %.F90 | ||
@if [ ! -d $(odir) ]; then mkdir -p $(odir); fi | ||
@if [ ! -d $(mdir) ]; then mkdir -p $(mdir); fi | ||
ifdef MKVERBOSE | ||
$(COMPILE.F90) -o $@ $< | ||
else | ||
@echo "Building $< ..." | ||
@$(COMPILE.F90) -o $@ $< | ||
endif | ||
|
||
${odir}/%.o: %.c | ||
@if [ ! -d $(odir) ]; then mkdir -p $(odir); fi | ||
ifdef MKVERBOSE | ||
$(COMPILE.c) -o $@ $< | ||
else | ||
@echo "Building $< ..." | ||
@$(COMPILE.c) -o $@ $< | ||
endif | ||
|
||
$(tdir)/f90.depends: $(fsources) $(f90sources) $(F90sources) | ||
@if [ ! -d $(tdir) ]; then mkdir -p $(tdir); fi | ||
ifdef MKVERBOSE | ||
perl $(MODDEP) $(f_includes) --odir $(odir) $^ > $(tdir)/f90.depends | ||
else | ||
@echo "Building f90/f dependency File ..." | ||
@perl $(MODDEP) $(f_includes) --odir $(odir) $^ > $(tdir)/f90.depends | ||
endif | ||
|
||
$(tdir)/c.depends: $(csources) | ||
@if [ ! -d $(tdir) ]; then mkdir -p $(tdir); fi | ||
ifdef MKVERBOSE | ||
perl $(MKDEP) $(c_includes) --odir $(odir) $^ > $(tdir)/c.depends | ||
else | ||
@echo "Building c dependency File ..." | ||
@perl $(MKDEP) $(c_includes) --odir $(odir) $^ > $(tdir)/c.depends | ||
endif | ||
|
||
ifneq ($(MAKECMDGOALS),realclean) | ||
ifneq ($(MAKECMDGOALS),clean) | ||
include $(tdir)/f90.depends | ||
|
||
ifdef csources | ||
include $(tdir)/c.depends | ||
endif | ||
endif | ||
endif | ||
|
||
#----------------------------------------------------------------------------- | ||
# 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 $($*) | ||
|
||
#----------------------------------------------------------------------------- | ||
# If a file requires special compiler flags (say -O0), one can do | ||
# something like below, where SPECIALF90FLAGS is modified based on the | ||
# result of "make print-F90FLAGS". | ||
# | ||
#SPECIALF90FLAGS := -O0 -Jt/GNU.mpi.omp/m -I t/GNU.mpi.omp/m -ftree-vectorize -fno-range-check -fopenmp | ||
#${odir}/xxx.o: src/xxx.f90 | ||
# $(F90) $(SPECIALF90FLAGS) $(FPPFLAGS) -c -o $@ $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
This is a minimalist version of SMC, a combustion code that solves | ||
compressible Navier-Stokes equations for viscous multi-component | ||
reacting flows. SMC is developed at the Center for Computational | ||
Sciences and Engineering (CCSE) at Lawrence Berkeley National | ||
Laboratory. It uses the BoxLib library | ||
(https://ccse.lbl.gov/BoxLib/), also developed at CCSE. This | ||
minimalist version of SMC includes a stripped down version of BoxLib. | ||
Therefore, the full version of BoxLib is not needed. | ||
|
||
The code is mainly written in Fortran 90, with some parts in C. | ||
Parallelization is implemented with hybrid MPI/OpenMP. However, SMC | ||
can also be built with pure MPI, or pure OpenMP, or neither. | ||
|
||
GNU make is used to build the code. The following options can be | ||
specified in the GNUmakefile: | ||
|
||
* MPI := t | ||
This determines whether we are using the Message Passing | ||
Interface (MPI) library. Leaving this option empty will disable | ||
MPI. If MPI is enabled, you need to specify how to link to the MPI | ||
library. You can set USE_MPI_WRAPPERS := t, then mpif90 will be | ||
used. Or you can set "mpi_include_dir", "mpi_lib_dir", and | ||
"mpi_libraries" to appropriate values in GNUmakefile. | ||
|
||
* OMP := | ||
This determines whether we are using OpenMP. Leaving this option | ||
empty disables OpenMP. | ||
|
||
* NDEBUG := | ||
This option determines whether we compile with support for debugging | ||
(usually also enabling some runtime checks). Setting NDEBUG := t | ||
turns off debugging. | ||
|
||
* COMP := GNU | ||
Set this to your compiler of choice (e.g., GNU). Specific options | ||
for a certain compiler are stored in the comps/$(COMP).mak file. | ||
|
||
* MIC := | ||
Set this if compiling for Intel Xeon Phi. | ||
|
||
* MKVERBOSE := t | ||
This determines the verbosity of the building process. | ||
|
||
To build an executable, type "make" in the SMC directory. The | ||
executable will have a name like main.GNU.debug.mpi.exe depending | ||
on the compiler and some other options specified in the GNUmakefile. | ||
There are some other options provided by the GNUmakefile. You can | ||
type "make TAGS" or "make tags" to generate tag file for Email or vi. | ||
You can type "make clean" or "make realclean" to remove files | ||
generated during the make process. | ||
|
||
Runtime parameters can be specified in the inputs_SMC file, which must | ||
be placed in the directory where the executable is run. Below are a | ||
list of selected runtime parameters and default values. | ||
|
||
* n_cellx = -1 | ||
* n_celly = -1 | ||
* n_cellz = -1 | ||
|
||
Number of cells in the x, y, and z-directions. They must be greater than 4. | ||
|
||
* max_grid_size = 64 | ||
|
||
This determines the largest grid size of a box. If max_grid_size is | ||
too big, there might be fewer boxes than MPI tasks, and then some | ||
processors will be idle. However, if it is too small, each MPI task | ||
may have too many small boxes, and the performance will be affected. | ||
Thus, max_grid_size must be chosen according to the number of cells | ||
and the number of MPI tasks. Ideally, you would like to have one | ||
box for each MPI task to minimize the communication cost. | ||
|
||
* verbose = 0 | ||
|
||
This determines verbosity. | ||
|
||
* stop_time = -1.d0 | ||
|
||
Simulation stop time. | ||
|
||
* max_step = 1 | ||
|
||
Maximum number of timesteps in the simulation. | ||
|
||
Note that there are a number of OMP COLLAPSE clauses in the code. | ||
These tend to trigger compiler bugs. If the code crashes, try to run | ||
it without "COLLAPSE". | ||
|
||
More information about SMC can be found in the paper "High-Order | ||
Algorithms for Compressible Reacting Flow with Complex Chemistry" by | ||
M. Emmett, W. Zhang, and J.B. Bell | ||
(http://arxiv.org/abs/1309.7327). If you have any questions, please | ||
contact Weiqun Zhang ([email protected]). |
Oops, something went wrong.