Commit 3d9bce05 authored by Ron Rahaman's avatar Ron Rahaman
Browse files

Merge branch 'develop' of xgitlab.cels.anl.gov:rahaman/moon into moosenek-makefile

parents 92fde145 e069bb37
BINNAME=nek5000
LIBNAME=libnek5000.a
LIBNAME=libnek5000
CASENAME=
CASEDIR=
S=
......@@ -18,6 +18,7 @@ F77=
F77LINK=
CC=
P=
PC=
PPPO=
PPS=
G=
......@@ -149,10 +150,10 @@ FL2 = $(L2) $(P) $(PPS_F) -I$(CASEDIR) -I$S -I$(S2) -I$(OPT_INCDIR)
FL3 = $(L3) $(P) $(PPS_F) -I$(CASEDIR) -I$S -I$(OPT_INCDIR)
FL4 = $(L4) $(P) $(PPS_F) -I$(CASEDIR) -I$S -I$(OPT_INCDIR)
cFL0 = $(L0) $(PPS_C) -I$J
cFL2 = $(L2) $(PPS_C) -I$J
cFL3 = $(L3) $(PPS_C) -I$J
cFL4 = $(L4) $(PPS_C) -I$J
cFL0 = $(L0) $(PC) $(PPS_C) -I$J
cFL2 = $(L2) $(PC) $(PPS_C) -I$J
cFL3 = $(L3) $(PC) $(PPS_C) -I$J
cFL4 = $(L4) $(PC) $(PPS_C) -I$J
################################################################################
all : nek5000
......@@ -160,8 +161,7 @@ all : nek5000
objdir:
@mkdir $(OBJDIR) 2>/dev/null; cat /dev/null
nek5000: objdir $(NOBJS)
$(F77) -c $(FL2) $(CASEDIR)/${CASENAME}.f $(MOABNEK_INCLUDES) $(VISITNEK_INCLUDES) $(IMESH_INCLUDES) -o ${OBJDIR}/${CASENAME}.o
nek5000: objdir $(CASEDIR)/${CASENAME}.o $(NOBJS)
$(F77) -o ${BINNAME} $G ${OBJDIR}/${CASENAME}.o $(NOBJS) $(lFLAGS)
@if test -f ${BINNAME}; then \
echo "#############################################################"; \
......@@ -178,9 +178,11 @@ ifeq ($(IFMPI),false)
@rm -rf $S/mpif.h
endif
lib: objdir $(NOBJS)
$(AR) cru ${LIBNAME} $(NOBJS)
ranlib ${LIBNAME}
${OBJDIR}/${CASENAME}.o: objdir $(CASEDIR)/${CASENAME}.f
$(F77) -c $(FL2) $(CASEDIR)/${CASENAME}.f $(MOABNEK_INCLUDES) $(VISITNEK_INCLUDES) $(IMESH_INCLUDES) -o ${OBJDIR}/${CASENAME}.o
lib: objdir $(NOBJS)
$(F77) -shared -o ${LIBNAME}.so $(NOBJS)
clean:
rm -rf ./obj ${BINNAME}
......
#!/bin/bash
# Nek5000 build config file
# (c) 2008,2009,2010 UCHICAGO ARGONNE, LLC
###############################################################################
# VANILLA MAKENEK
###############################################################################
set -o pipefail
# source path
SOURCE_ROOT=$(dirname $(dirname $(pwd)))/Nek5000
......@@ -12,6 +9,12 @@ SOURCE_ROOT_CORE="$SOURCE_ROOT/core"
SOURCE_ROOT_JL="$SOURCE_ROOT/jl"
SOURCE_ROOT_CMT="$SOURCE_ROOT/core/cmt"
# Fortran compiler
F77="mpif77"
# C compiler
CC="mpicc"
# pre-processor symbol list
# (set PPLIST=? to get a list of available symbols)
#PPLIST="?"
......@@ -36,7 +39,7 @@ SOURCE_ROOT_CMT="$SOURCE_ROOT/core/cmt"
# generic compiler flags
#G="-g"
G="-fPIC"
# optimization flags
#OPT_FLAGS_STD=""
......@@ -70,42 +73,6 @@ SOURCE_ROOT_CMT="$SOURCE_ROOT/core/cmt"
#VISIT_INSTALL="/path/to/visit/current/linux-x86_64/"
#VISIT_STOP=true
###############################################################################
# MOOSE MAKENEK
###############################################################################
# Get variables from env, if they exist. Otherwise, set to specified defaults
MOOSE_DIR=${MOOSE_DIR:-$(dirname $(dirname $(pwd)))/moose} #default: moon/moose
LIBMESH_DIR=${LIBMESH_DIR:-$MOOSE_DIR/libmesh/installed} #default: moon/moose/libmesh/installed
METHOD=${METHOD:-opt} #default: optimized
# libmesh-config and libtool are in different places depending on whether you
# are using "installed" or "uninstalled" libmesh.
libmesh_config=${libmesh_config:-$LIBMESH_DIR/bin/libmesh-config} #installed version
if [ ! -x "$libmesh_config" ]; then
libmesh_config="$LIBMESH_DIR/contrib/bin/libmesh-config" #uninstalled version
fi
libmesh_LIBTOOL=${libmesh_config:-$LIBMESH_DIR/contrib/bin/libtool} #installed version
if [ ! -x "$libmesh_LIBTOOL" ]; then
libmesh_LIBTOOL="$LIBMESH_DIR/libtool" #uninstalled version
fi
# Get compilers and flags
libmesh_F77=$(METHOD="$METHOD" $libmesh_config --fc)
libmesh_CC=$(METHOD="$METHOD" $libmesh_config --cc)
libmesh_INCLUDE=$(METHOD="$METHOD" $libmesh_config --include)
libmesh_CPPFLAGS=$(METHOD="$METHOD" $libmesh_config --cppflags)
libmesh_FFLAGS=$(METHOD="$METHOD" $libmesh_config --cflags)
libmesh_CFLAGS=$(METHOD="$METHOD" $libmesh_config --cflags)
libmesh_LIBS=$(METHOD="$METHOD" $libmesh_config --libs)
libmesh_LDFLAGS=$(METHOD="$METHOD" $libmesh_config --ldflags)
# Set compilers and linker
F77="$libmesh_LIBTOOL --tag=F77 $LIBTOOLFLAGS --mode=compile $libmesh_F77 $libmesh_INCLUDE $libmesh_FFLAGS"
CC="$libmesh_LIBTOOL --tag=CC $LIBTOOLFLAGS --mode=compile $libmesh_CC $libmesh_INCLUDE $libmesh_CPPFLAGS $libmesh_CFLAGS"
F77LINK="$libmesh_LIBTOOL --tag=F77 $(LIBTOOLFLAGS) --mode=link $libmesh_F77 $libmesh_LIBS $libmesh_LDFLAGS"
###############################################################################
# DONT'T TOUCH WHAT FOLLOWS !!!
###############################################################################
......@@ -122,5 +89,5 @@ fi
# do some checks and create makefile
source $SOURCE_ROOT_CORE/makenek.inc
# compile
make -j4 -f makefile.nek nek5000 lib 2>&1 | tee compiler.out
exit 0
# make -j4 -f makefile.nek nek5000 lib 2>&1 | tee compiler.out
exit $?
......@@ -237,6 +237,13 @@ case $F77comp in
esac
export PPPO
# assign OS-specific flags
case $(uname) in
Darwin) P="-Wa,-q -Wl,-no_compact_unwind $P"
PC="-Wl,-no_compact_unwind $PC"
;;
esac
# set preprocessor symbols
if [ "$IFMPI" == "false" -o "$IFMPI" == "no" ]; then
IFMPI=false
......@@ -423,6 +430,7 @@ sed -e "s:^F77[ ]*=.*:F77\:=$F77:" \
-e "s:^G[ ]*=.*:G\:=$G:" \
-e "s:^OPT_FLAGS[ ]*=.*:OPT_FLAGS\:=$OPT_FLAGS:" \
-e "s/^P[ ]*=.*/P:=$P/" \
-e "s/^PC[ ]*=.*/PC:=$PC/" \
-e "s/^L0[ ]*=.*/L0=$L0/" \
-e "s/^L2[ ]*=.*/L2=$L2/" \
-e "s/^L3[ ]*=.*/L3=$L3/" \
......@@ -487,8 +495,8 @@ fi
if [ -f .makefile ]; then
sed -e "1i\\
### makefile automatically created by makenek `date +"%m/%d/%Y %T"` ###" \
-e "s:^CASEDIR[ ]*=.*:CASEDIR\:=${CASEDIR}:" \
-e "s:^CASENAME[ ]*=.*:CASENAME\:=${CASENAME}:" .makefile > makefile.nek
-e "s:^CASEDIR[ ]*=.*:CASEDIR\=${CASEDIR}:" \
-e "s:^CASENAME[ ]*=.*:CASENAME\=${CASENAME}:" .makefile > makefile.nek
else
echo "ERROR: Nek Makefile could not be created!"
exit 1
......
......@@ -13,6 +13,32 @@ git clone --recursive https://xgitlab.cels.anl.gov/nek5000/moon.git
This will download and populate the src/moose and src/moose/libmesh.
Building PETSc
--------------
MOON requires PETSc, as described in the [MOOSE installation instructions](http://mooseframework.com/getting-started/). PETSc is not distributed with MOON. PETSc must either be compiled from source or installed as part of the MOOSE Environment package. After installing PETSc, you must define the `$PETSC_DIR` variable in your environment.
Building libmesh
----------------
MOON also requires libmesh, as described in the [MOOSE installation instructions](http://mooseframework.com/getting-started/). The libmesh source code is distributed with MOOSE. It should be compiled using the following scripts:
```
$ cd moose/
$ scripts/update\_and\_rebuild\_libmesh.sh.
```
After installing libmesh, you must define the `$LIBMESH_DIR` in your environment.
Building and Running the Example Problems
-----------------------------------------
MOON is distributed with scripts for building and runninhg coupled example problems. To build and run a given example (e.g.: "integration\_example"), use the following commands:
```
$ cd examples/integration_example/
$ ../../scripts/build_coupled_nek.sh
$ ../../scripts/run_coupled_nek.sh
```
Note that the build and run scripts must be executed from the example subdiretory.
Developing Nek5000 in MOON
--------------------------
Developers may freely modify src/Nek5000 as if it were a normal part of the MOON repo. This is because Nek5000 is included as a Git subtree (rather than a submodule). For routine commits, pushes, and pulls to the MOON repository, no extra Git commands are necessary.
......
......@@ -51,7 +51,7 @@
[Kernels]
[./HeatSource]
type = HeatSource
function = '100.0'
function = '1.0'
variable = temp
[../]
[./HeatDiff]
......@@ -89,18 +89,6 @@
[]
[BCs]
[./top]
type = FunctionDirichletBC
variable = temp
boundary = 'top'
function = bc_func
[../]
[./bottom]
type = FunctionDirichletBC
variable = temp
boundary = 'bottom'
function = bc_func
[../]
[./wall]
type = FunctionDirichletBC
variable = temp
......@@ -282,9 +270,9 @@
[Executioner]
type = Transient
scheme = 'Explicit-Euler' # Others available: backward Euler, Crank-Nicholson, etc.
dt = 0.01 # Initial timestep size
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
num_steps = 20 # DIVERGES AFTER 4 TIMESTEPS
num_steps = 3900 # Number of Steps
nl_rel_tol = 1e-8 # Nonlinear relative tolerance
l_tol = 1e-6 # Linear tolerance
......
......@@ -13,20 +13,20 @@
0.00000 p009
200.000 p010 FINTIME
0.00000 p011 NSTEPS
-0.01000 p012 DT
-0.00100 p012 DT
0.00000 p013 IOCOMM
0.00000 p014 IOTIME
1000.0 p015 IOSTEP
100.0 p015 IOSTEP
0.00000 p016 PSSOLVER: 0=default
0.00000 p017
0.250000E-01 p018 GRID < 0 --> # cells on screen
-1.00000 p019 INTYPE
12.0000 p020 NORDER
0.00000 p018 GRID < 0 --> # cells on screen
0.00000 p019 INTYPE
0.00000 p020 NORDER
1.00000E-06 p021 DIVERGENCE
1.00000E-08 p022 HELMHOLTZ
0.00000 p023 NPSCAL
0.100000E-08 p024 TOLREL
0.100000E-08 p025 TOLABS
0.00000E-08 p024 TOLREL
0.00000E-08 p025 TOLABS
2.00000 p026 COURANT/NTAU
2.00000 p027 TORDER
0.00000 p028 TORDER: mesh velocity (0: p28=p27)
......@@ -36,9 +36,9 @@
0.00000 p032 #BCs in re2 file, if > 0
100.000 p033 : : : MXGEOM
100.000 p034 : : : MAXNEW
0.100000E-03 p035 : : :
0.100000E-03 p036 : : : XMAGNET
0.100000E-01 p037 : : : NGRIDS
0.10000E-03 p035 : : :
0.10000E-03 p036 : : : XMAGNET
0.10000E-01 p037 : : : NGRIDS
0.00000 p038 : : : NORDER2
0.00000 p039 : : : NORDER3
0.00000 p040
......@@ -94,7 +94,7 @@
0.00000 p090 : : :
0.00000 p091 : : :
0.00000 p092
20.0000 p093 Number of previous pressure solns saved
20.00000 p093 Number of previous pressure solns saved
5.00000 p094 start projecting velocity after p94 step
5.00000 p095 start projecting pressure after p95 step
0.00000 p096 : : : which saving algorithm 1 = disca
......
......@@ -69,6 +69,10 @@ c-----------------------------------------------------------------------
ifflow=.false.
if (istep.eq.0) then
call rzero(t,n1)
endif
sint1=0.0
sarea1=0.0
......@@ -86,10 +90,29 @@ c-----------------------------------------------------------------------
call gop(sarea1,wtmp,'+ ',1)
temp_nek=sint1/sarea1
sint1=0.0
sarea1=0.0
do e=1,lelt
do f=1,6
call surface_int(sint,sarea,flux_recon,e,f)
if (cbc(f,e,1).eq.'W ') then
sint1=sint1+sint
sarea1=sarea1+sarea
endif
enddo
enddo
call gop(sint1,wtmp,'+ ',1)
call gop(sarea1,wtmp,'+ ',1)
flux_moose=sint1/sarea1
if (nid.eq.0) then
write(6,*)"*** Temperature: ",tmin," - ",tmax
write(6,*)"*** Average Temperature: ",temp_nek
write(6,*)"*** Average Temperature: ",temp_nek,coeff_tij(1,1)
write(6,*)"*** Average Flux: ",flux_moose,coeff_fij(1,1)
endif
c Will this be overwritten -----------------
......@@ -218,6 +241,7 @@ C=======================================================================
call nek_comm_settings(isyc,itime)
call nek_comm_startstat()
istep = 0
icall = 1
endif
istep=istep+1
......@@ -242,7 +266,7 @@ C=======================================================================
integer pstep
pstep=pstep+1
call heat(pstep)
c call heat(pstep)
return
end
......@@ -449,17 +473,24 @@ c-----------------------------------------------------------------------
common/expansion_fcoef/coeff_fij(nl_max,nf_max)
common/expansion_recon/flux_recon(lx1,ly1,lz1,lelt)
integer e,f
real*8 coeff_base
real*8 fmode(lx1,ly1,lz1,lelt)
ntot=nx1*ny1*nz1*nelt
c --------------------------------------
c The flux from MOOSE must have proper sign
c --------------------------------------
coeff_base=-1.0
c --------------------------------------
call rzero(flux_recon,ntot)
call rzero(fmode,ntot)
do i0=1,n_legendre
do j0=1,m_fourier
call rzero(fmode,ntot)
call nek_mode(fmode,i0,j0)
do i=1,ntot
flux_recon(i,1,1,1)= flux_recon(i,1,1,1)
& + fmode(i,1,1,1)*coeff_fij(i0,j0)
& + coeff_base*fmode(i,1,1,1)*coeff_fij(i0,j0)
enddo
enddo
enddo
......
......@@ -23,7 +23,7 @@
num_steps = 20
[./TimeStepper]
type = NekTimeStepper
dt = 0.01
dt = 0.001
[../]
[]
......
......@@ -33,7 +33,7 @@ NEK_SOURCE_DIR := $(MOON_DIR)/Nek5000
NEK_CASE_DIR := $(CURDIR)
NEK_CASENAME := $(shell basename $(NEK_CASE_DIR))
NEK_OBJ := obj/$(NEK_CASENAME).o
NEK_LIB := $(NEK_CASE_DIR)/libnek5000.a
NEK_LIB := $(NEK_CASE_DIR)/libnek5000.so
include $(NEK_SOURCE_DIR)/nek.mk
# moon
......@@ -47,7 +47,11 @@ APPLICATION_DIR := $(CURDIR)
APPLICATION_NAME := $(shell basename $(APPLICATION_DIR))
MAIN_DIR := $(MOON_DIR)/src
BUILD_EXEC := yes
ifeq ($(shell uname),Darwin)
EXTERNAL_FLAGS := $(NEK_OBJ) $(NEK_LIB) -Wl,-no_compact_unwind
else
EXTERNAL_FLAGS := $(NEK_OBJ) $(NEK_LIB)
endif
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include $(FRAMEWORK_DIR)/app.mk
......
#k!/usr/bin/env bash
#!/usr/bin/env bash
NEK_CASENAME="$(basename $(pwd))"
NEK_SOURCE_DIR="$(dirname $(dirname $(pwd)))/Nek5000"
JOBS=4
while getopts ":j:" opt; do
case $opt in
j ) JOBS=$OPTARG ;;
esac
done
# JOBS=4
# while getopts ":j:" opt; do
# case $opt in
# j ) JOBS=$OPTARG ;;
# esac
# done
# MOOSE issues a warning if these directories do not exist.
# Creating these dirs will suppress that warning
......@@ -21,14 +21,17 @@ if [ -e $SCH_FILE ]; then
rm -f $SCH_FILE
fi
echo "Creating SESSON.NAME..."
echo "Creating SESSON.NAME ..."
echo "$NEK_CASENAME" > SESSION.NAME && pwd >> SESSION.NAME
echo "Building Nek5000 objects..."
echo "Configuring makefile.nek..."
$NEK_SOURCE_DIR/core/makenek $NEK_CASENAME $NEK_SOURCE_DIR
echo "Building libNek5000.a..."
make -j $JOBS -f makefile.nek lib
echo "Building $NEK_CASENAME.o ..."
make -j 4 -f makefile.nek obj/$NEK_CASENAME.o
echo "Building MOON driver..."
make -j $JOBS
echo "Building libNek5000.so ..."
make -j 4 -f makefile.nek lib
echo "Building MOON driver ..."
make -j 4
......@@ -74,7 +74,7 @@ NekSideIntegralVariableUserObject::computeQpIntegral()
// There is an added correction factor that accounts for the surface area of the pin
// The analytic expression is (2 / R / delta z) but we compute numerically as
// (2 / (Surf Area / (2*PI) ) ) = 4PI / Surf Area
return -_diffusion_coefficient[_qp] * _coupled_grad[_qp].norm() * l_poly_val * f_poly_val * 4.0 / M_PI / _surface_area_pp;
return -_diffusion_coefficient[_qp] * _coupled_grad[_qp].norm() * l_poly_val * f_poly_val * 4.0*M_PI / _surface_area_pp;
}
void
NekSideIntegralVariableUserObject::finalize()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment