Commit e20037eb authored by Kevin Dugan's avatar Kevin Dugan

Clearing out old app

parent 51647a0e
This diff is collapsed.
Giraffe
=======
[![build status](https://xgitlab.cels.anl.gov/nek5000/giraffe/badges/develop/build.svg)](https://xgitlab.cels.anl.gov/nek5000/giraffe/commits/develop)
Giraffe uses the [MOOSE](http://www.mooseframework.org/) framework to implement multiphysics coupling with [Nek5000](https://nek5000.mcs.anl.gov/) CFD simulations. The project is a collaboration between [Idaho National Laboratory](https://www.inl.gov/) and [Argonne National Laboratory](https://www.inl.gov/) with contributions from [MIT](https://www.berkeley.edu/) and [UC-Berkeley](https://web.mit.edu/).
Requirements
------------
Giraffe requires the MOOSE environment (including PETSc, libmesh, and MOOSE). This can be installed according to the [MOOSE installation instructions](http://mooseframework.com/getting-started/). After installation you must define the following environment variables:
* `LIBMESH_DIR`: The top-level directory of your libmesh installation. If you follow the MOOSE installation instructions, this should already be set in your environment. A typical command is:
``` Shell
export $LIBMESH_DIR="$HOME/projects/moose/libmesh/installed"
```
* `MOOSE_DIR`: The top-level directory of your MOOSE installation. For Giraffe, this must be additionally set in your environment. A typical command is:
``` Shell
export $MOOSE_DIR="$HOME/projects/moose/"
```
Building Example Problems
-------------------------
### Basic compilation
Giraffe must be separately compiled for each specific problem, since Nek5000 uses static memory allocations that are specific to the problem setup. To build an example problem:
1. In the top-level Giraffe, directory use the `bootstrap` script to generate a `configure` script.
2. In the subdirectory for the example problem, run the `configure` script.
3. In the subdirctory for the example problem, run `make`.
The complete steps for the `integration_example` problem are:
``` Shell
$ cd giraffe
$ ./bootstrap
$ cd examples/integration_example
$ ../../configure
$ make
```
A successful compilation will create libraries and executables in the top-level Giraffe directory (in this case, `giraffe/lib/lib-giraffe-opt.so` and `giraffe/giraffe-opt`). **Note that, even though the libraries and executables are problem specific, they are not output to the problem's director.**
### Additional compilation options
To perform custom compilations, the `configure` script may be run with additional options. Run `./configure --help` to see a complete list of the available options and variables. Some of the most useful are:
* `CASENAME`: Specfies the basename of the Nek5000 `.usr` file. For example, if you were compiling with `integration_example.usr`, then you would specify `CASENAME="integration_example"`. The default value of `CASENAME` is the name of the example subdirectory.
* `MOOSE_DIR`: Inherited from the environment. If it is specified here, it will override the environment's value.
* `LIBMESH_DIR`: Inherited from the environment. If it is specified here, it will override the environment's value.
For the majority of situations, it is not recommended to directly specify compilers and compiler/linker flags to configure script (`CC`, `CFLAGS`, `LDFLAGS`, etc). This is because, by default, the compilers and flags are detected from the libmesh installation, which ensures a consistent compilation of Giraffe.
### Running Example Problems
``` Shell
$ cd giraffe/examples/integration_example
$ ../../giraffe-opt -i coefficient_integration.i
```
The Giraffe executable is output to the top-level Giraffe directory (in this case, `giraffe/giraffe-opt`) but must be run in the example subdirectory. To run the simulation, use:
``` Shell
$ cd examples/integration example/
$ ../../giraffe-opt -i coefficient_integration.i
```
Upon repeated runs, Nek5000 may raise an error if an output `.sch` file is present. If so, delete the `.sch` file and rerun Giraffe.
Developing Giraffe
------------------
Giraffe is ensured to be compatable with the current [MOOSE master branch](https://github.com/idaholab/moose/tree/master). However, Giraffee is **not** necessarily compatable with a current or previous version [Nek5000 master branc](https://github.com/Nek5000/Nek5000/tree/master). Hence, Giraffe includes Nek5000 as a Git **subtree** rather than a submodule.
The use of a subtree means that developers may freely modify Nek5000 as if it were a normal part of the Giraffe repo. For routine commits, pushes, and pulls to the Giraffe repository, no extra Git commands are necessary for changing `giraffe/Nek5000`. With some additional Git commands, developers may also merge upstream changes from [https://github.com/Nek5000/Nek5000](https://github.com/Nek5000/Nek5000) into `giraffe/Nek5000`. Finally, developers may also request to merge changes from `giraffe/Nek5000` to [https://github.com/Nek5000/Nek5000](https://github.com/Nek5000/Nek5000). This [blog post](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) from Atlassian gives a brief rundown of these operations.
#!/bin/sh
autoreconf --install
automake --add-missing --copy >/dev/null 2>&1
###############################################################################
# GIRAFFE MAKEFILE
###############################################################################
#
# Optional Environment variables
# MOOSE_DIR - Root directory of the MOOSE project
# FRAMEWORK_DIR - Location of the MOOSE framework
#
###############################################################################
GIRAFFE_DIR := @abs_srcdir@
MOOSE_DIR := @MOOSE_DIR@
FRAMEWORK_DIR := @MOOSE_DIR@/framework
###############################################################################
# framework
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk
################################## MODULES ####################################
SOLID_MECHANICS := no
CONTACT := no
HEAT_CONDUCTION := yes
WATER_STEAM_EOS := no
MISC := no
PHASE_FIELD := no
XFEM := no
include $(MOOSE_DIR)/modules/modules.mk
################################## GIRAFFE ####################################
# nek
include giraffe.mk
APPLICATION_DIR := $(GIRAFFE_DIR)
APPLICATION_NAME := giraffe
MAIN_DIR := $(APPLICATION_DIR)/src
BUILD_EXEC := yes
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py integration_example)
include $(FRAMEWORK_DIR)/app.mk
###############################################################################
# Additional special case targets should be added here
@CASENAME@
@abs_builddir@
# == Source and destination directories ============================================================
VPATH := @srcdir@/Nek5000/core:@srcdir@/Nek5000/core/cmt:@srcdir@/Nek5000/core/3rd_party:@srcdir@/Nek5000/jl:@srcdir@/src_nek
srcdir := @srcdir@
builddir := @builddir@
nek_objdir := @builddir@/nek_obj
nek_includedir := @builddir@/include
# == Discovered by autoconf script
CASENAME := @CASENAME@
nek_CFLAGS := @CFLAGS@
nek_INCLUDES := -I$(builddir) -I$(nek_includedir) -I$(srcdir)/Nek5000/core -I$(srcdir)/Nek5000/core/cmt -I$(srcdir)/Nek5000/core/3rd_party -I$(srcdir)/Nek5000/jl -I$(srcdir)/src_nek
nek_CPPFLAGS := @CPPFLAGS@ @DEFS@ @nek_DEFS@ $(nek_INCLUDES)
nek_LDFLAGS := @LDFLAGS@
nek_LIBS := @LIBS@
nek_FFLAGS := @FFLAGS@ @FCFLAGS_f@ $(subst -D, @FC_DEFINE@, @DEFS@ @nek_DEFS@) $(nek_INCLUDES)
nek_FLIBS := @FLIBS@
nek_debug_flags := @nek_debug_flags@
nek_opt_flags := @nek_opt_flags@
nek_real8_flags := @nek_real8_flags@
jl_prefix := @jl_prefix@
# == FORTRAN objects ===============================================================================
nek_drive_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), drive))
nek_core_f_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), \
drive1 drive2 plan4 bdry coef conduct connect1 connect2 \
dssum edgec eigsolv gauss genxyz navier1 makeq navier0 \
navier2 navier3 navier4 prepost speclib map2 turb mvmesh ic \
ssolv planx mxm_wrapper hmholtz gfdm_par gfdm_op gfdm_solve \
subs1 subs2 genbox gmres hsmg convect induct perturb navier5 \
navier6 navier7 navier8 fast3d fasts calcz postpro \
cvode_driver vprops qthermal cvode_aux makeq_aux papi nek_in_situ \
readat_new nek_moose @CASENAME@))
nek_math_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), math))
nek_blas_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_blas_obj@)) # blas.o | null
nek_cmt_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_cmt_obj@)) # drive1_cmt.o ... | cmt_dummy.o
nek_lapack_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_lapack_obj@)) # dsygv.o ssygv.o | null
nek_mpi_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_mpi_obj@)) # byte_mpi.o comm_mpi.o | byte_mpi.o comm_mpi.o mpi_dummy.o
nek_mxm_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_mxm_obj@)) # mxm_std.o | mxm_std.o mxm_bgq.o
nek_neknek_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_neknek_obj@)) # singlmesh.o | multimesh.o
nek_flib_obj := $(nek_core_f_obj) $(nek_math_obj) $(nek_blas_obj) $(nek_cmt_obj) \
$(nek_lapack_obj) $(nek_mpi_obj) $(nek_mxm_obj) $(nek_neknek_obj)
# == C objects =====================================================================================
nek_core_c_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), \
byte chelpers nek_comm finiparser iniparser dictionary))
jl_core_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
gs sort sarray_transfer sarray_sort gs_local crystal comm tensor fail fcrystal))
jl_interp_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
findpts findpts_local obbox poly lob_bnd findpts_el_3 findpts_el_2))
jl_cgs_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), @jl_cgs_obj@))
nek_clib_obj := $(nek_core_c_obj) $(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj)
# == MOOSE app flags and objects ==================================================================
# Recursive definition (= rather than :=) is probably the right usage, since they're probably
# defined here after they're referenced by MOOSE makefile
ADDITIONAL_CPPFLAGS = @CPPFLAGS@ @DEFS@ # Used by pattern rules in moose/framework/build.mk
ADDITIONAL_INCLUDES = $(nek_INCLUDES) # Used by pattern rules in moose/framework/build.mk (through app_INCLUDES)
ADDITIONAL_LIBS = $(nek_LIBS) $(nek_FLIBS) # Used during linking in moose/framework/app.mk
ADDITIONAL_APP_OBJECTS = $(nek_flib_obj) $(nek_clib_obj) # Added to dependencies in moose/framework/app.mk
# == Rules =========================================================================================
nek5000: $(nek_drive_obj) $(nek_flib_obj) $(nek_clib_obj)
@echo "Linking Executable "$@"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=link \
$(libmesh_F77) $(libmesh_FFLAGS) -o $@ $^ $(libmesh_LIBS) $(libmesh_LDFLAGS) $(nek_LIBS) $(nek_LDFLAGS) $(nek_FLIBS)
$(nek_drive_obj) $(nek_core_f_obj) $(nek_cmt_obj) $(nek_math_obj) $(nek_mxm_obj): $(nek_objdir)/%.$(obj-suffix): %.f SIZE | $(nek_objdir)
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_mpi_obj) $(nek_neknek_obj): $(nek_objdir)/%.$(obj-suffix): %.f SIZE mpiheader | $(nek_objdir)
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_core_c_obj): $(nek_objdir)/%.$(obj-suffix): %.c | $(nek_objdir)
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_CC) $(nek_CPPFLAGS) $(nek_CFLAGS) -MMD -MP -MF $@.d -MT $@ -c $< -o $@
$(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj): $(nek_objdir)/$(jl_prefix)%.$(obj-suffix): %.c | $(nek_objdir)
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_CC) $(nek_CPPFLAGS) $(nek_CFLAGS) -MMD -MP -MF $@.d -MT $@ -c $< -o $@
mpiheader: | $(nek_includedir)
ifneq ($(findstring mpi_dummy.o, $(nek_mpi_obj)),)
cp $(srcdir)/Nek5000/core/mpi_dummy.h $(nek_includedir)/mpif.h
else
rm -rf $(srcdir)/Nek5000/core/mpif.h $(nek_includedir)/mpif.h
endif
$(nek_objdir) $(nek_includedir):
mkdir -p $@
PHONY: mpiheader
This diff is collapsed.
This diff is collapsed.
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 1
nx = 160
xmax = 80
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
function = '100*sin(3.14159*x/80)'
[../]
[]
[Kernels]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
# This is a circle from x=(-0.5, 0.5) and y=(-0.5,0.5)
file = 2D_circle_sideset.exo
block_id = '1'
block_name = 'interior'
boundary_id = '100'
boundary_name = 'wall'
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
# function = 'exp(-3.14159*(x*x+y*y))'
function = '0.0'
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '1.0'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[Functions]
# BCFunction just returns 0.0 right now
[./bc_func]
type = BCFunction
[../]
[]
[BCs]
[./wall]
type = FunctionDirichletBC
variable = T
boundary = 'wall'
function = bc_func
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '1'
block = 'interior'
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '1'
block = 'interior'
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '1'
block = 'interior'
[../]
[]
# [Postprocessors]
# [./error]
# type = NodalL2Error
# function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
# variable = T
# [../]
# []
[Executioner]
type = Transient
scheme = bdf2 # Others available: backward Euler, Crank-Nicholson, etc.
#scheme = 'Explicit-Euler'
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
#num_steps = 200 # DIVERGES AFTER 6 TIMESTEPS...
num_steps = 1 # DIVERGES AFTER 6 TIMESTEPS...
nl_rel_tol = 1e-8 # Nonlinear relative tolerance
l_tol = 1e-6 # Linear tolerance
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 2
nx = 40
ny = 40
xmax = 80
ymax = 80
[]
[Variables]
[./T]
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '100*sin(3.14159*x/80)*sin(3.14159*y/80)'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[./top]
type = DirichletBC
variable = T
boundary = top
value = 0
[../]
[./bottom]
type = DirichletBC
variable = T
boundary = bottom
value = 0
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 3
nx = 20
ny = 20
nz = 20
xmax = 80
ymax = 80
zmax = 80
[]
[Variables]
[./T]
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '100*sin(3.14159*x/80)*sin(3.14159*y/80)*sin(3.14159*z/80)'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[./top]
type = DirichletBC
variable = T
boundary = top
value = 0
[../]
[./bottom]
type = DirichletBC
variable = T
boundary = bottom
value = 0