Commit 9b6e74df authored by Ron Rahaman's avatar Ron Rahaman

Added derived classes for Nek coupling problems

parent 282929fa
......@@ -96,7 +96,8 @@
#scheme = 'Explicit-Euler'
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
num_steps = 200 # DIVERGES AFTER 6 TIMESTEPS...
#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
......
......@@ -105,10 +105,10 @@
[Executioner]
type = Transient
scheme = bdf2 # Others available: backward Euler, Crank-Nicholson, etc.
scheme = 'Explicit-Euler' # Others available: backward Euler, Crank-Nicholson, etc.
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
num_steps = 10 # DIVERGES AFTER 4 TIMESTEPS
num_steps = 20 # DIVERGES AFTER 4 TIMESTEPS
nl_rel_tol = 1e-8 # Nonlinear relative tolerance
l_tol = 1e-6 # Linear tolerance
......
### makefile automatically created by makenek 10/17/2016 18:29:51 ###
### makefile automatically created by makenek 10/18/2016 11:25:51 ###
BINNAME=nek5000
LIBNAME=libnek5000.a
CASENAME:=rod12
......
......@@ -21,13 +21,14 @@ include $(FRAMEWORK_DIR)/moose.mk
APPLICATION_NAME := ex01
# dep apps
APPLICATION_DIR := $(shell pwd)
APPLICATION_DIR := $(shell pwd)/../../
APPLICATION_NAME := ex01
BUILD_EXEC := yes
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include nek.mk
ADDITIONAL_LIBS := $(nek_LIB) $(nek_OBJ)
include app.mk
include ../test.mk
# Include dependency files for this example
ex_srcfiles := $(shell find $(APPLICATION_DIR) -name "*.C")
......
......@@ -155,7 +155,7 @@ $(app_LIB): $(app_objects) $(app_plugin_deps) $(app_HEADER) $(depend_libs)
$(libmesh_CXX) $(libmesh_CXXFLAGS) -o $@ $(curr_objs) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) -rpath $(curr_dir)/lib $(curr_libs)
@$(libmesh_LIBTOOL) --mode=install --quiet install -c $@ $(curr_dir)/lib
$(app_EXEC): $(app_LIBS) $(mesh_library) $(main_object) $(nek_LIB) $(nek_OBJ)
$(app_EXEC): $(app_LIBS) $(mesh_library) $(main_object)
@echo "Linking Executable "$@"..."
@echo "$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link --quiet $(libmesh_CXX) -Wl,-no_compact_unwind $(libmesh_CXXFLAGS) -o $@ $(main_object) $(nek_LIB) $(nek_OBJ) $(app_LIBS) $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) $(ADDITIONAL_LIBS)"
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link --quiet $(libmesh_CXX) -Wl,-no_compact_unwind $(libmesh_CXXFLAGS) -o $@ $(main_object) $(nek_LIB) $(nek_OBJ) $(app_LIBS) $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) $(ADDITIONAL_LIBS)
......
......@@ -20,16 +20,6 @@ PerfLog Moose::perf_log("HeatConduction");
// Begin the main program.
int main(int argc, char *argv[])
{
// Initialize Nek and print some values from common block
//std::cout << "Hello, Nek!" << std::endl;
int intracomm=0;
nek_init_(intracomm);
std::cout << "test_passing_.temp_nek = " << test_passing_.temp_nek << std::endl;
//std::cout << "nelv = " << dimn_.nelv << std::endl;
//std::cout << "nx1 = " << dimn_.nx1 << std::endl;
//std::cout << "ny1 = " << dimn_.ny1 << std::endl;
//std::cout << "nz1 = " << dimn_.nz1 << std::endl;
//std::cout << "Goodbye, Nek!" << std::endl;
// Initialize MPI, solvers and MOOSE
MooseInit init(argc, argv);
......
eddy_uv
/Users/rahaman/repos/moon/examples/hello_nek
This diff is collapsed.
#!/bin/bash
# Nek5000 build config file
# (c) 2008,2009,2010 UCHICAGO ARGONNE, LLC
# source path
SOURCE_ROOT="$HOME/repos/moon/src/Nek5000"
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="?"
# OPTIONAL SETTINGS
# -----------------
# enable MPI (default true)
#IFMPI="false"
# enable CMT (default false)
#IFCMT="true"
# auxilliary files to compile
# NOTE: source files have to located in the same directory as makenek
# a makefile_usr.inc has to be provided containing the build rules
#USR="foo.o"
# linking flags
#USR_LFLAGS="-L/usr/lib -lfoo"
# generic compiler flags
#G="-g"
G="-Wa,-q"
# optimization flags
#OPT_FLAGS_STD=""
#OPT_FLAGS_MAG=""
# enable AMG coarse grid solver (default XXT)
#IFAMG="true"
#IFAMG_DUMP="true"
# CVODE path
#CVODE_DIR=$HOME/cvode/lib
# MOAB/iMESH path
#MOAB_DIR="$HOME/moab"
# For linking to MOAB, the following might be needed:
# NOTE: compiler specific, use the appropriate one depending on your compiler
# GNU:
# USR_LFLAGS="-lmpi_cxx -lstdc++"
# Intel:
# USR_LFLAGS="-cxxlib"
# PGI:
# USR_LFLAGS="-pgcpplibs"
# USR_LFLAGS=" -lmpi_cxx -lstdc++"
# enable VisIt in situ
# Note: you can override the lib and include paths. VISIT_LIB and VISIT_INC
# If VISIT_STOP is set the simulation will stop after first step and wait
# for VisIt to connect.
#IFVISIT=true
#VISIT_INSTALL="/path/to/visit/current/linux-x86_64/"
#VISIT_STOP=true
###############################################################################
# DONT'T TOUCH WHAT FOLLOWS !!!
###############################################################################
# assign version tag
mver=1
# overwrite source path with optional 2nd argument
if [ -d $2 ] && [ $# -eq 2 ]; then
SOURCE_ROOT="$2"
echo "change source code directory to: ", $SOURCE_ROOT
SOURCE_ROOT_CORE="$SOURCE_ROOT/core"
SOURCE_ROOT_JL="$SOURCE_ROOT/jl"
SOURCE_ROOT_CMT="$SOURCE_ROOT/core/cmt"
fi
# do some checks and create makefile
source $SOURCE_ROOT_CORE/makenek.inc
# compile
make -j4 -f makefile 2>&1 | tee compiler.out
exit 0
#ifndef NEKINTERFACE_H
#define NEKINTERFACE_H
// String length for file paths in Nek5000
#define PATHLEN 132
// Nek Fortran interface
extern "C" {
// CFILES common block
extern struct {
char \
reafle[PATHLEN], \
fldfle[PATHLEN], \
dmpfle[PATHLEN], \
hisfle[PATHLEN], \
schfle[PATHLEN], \
orefle[PATHLEN], \
nrefle[PATHLEN];
} cfiles_;
// DIMN common block
extern struct {
int \
nelv, \
nelt, \
nx1, \
ny1, \
nz1, \
nx2, \
ny2, \
nz2, \
nx3, \
ny3, \
nz3, \
ndim, \
nfield,\
npert, \
nid, \
nxd, \
nyd, \
nzd;
} dimn_;
// DIMN common block
extern struct {
double flux_moose, temp_nek;
} test_passing_;
// subroutine nek_init(intracomm)
void nek_init_(const int&); // Ron likes this better now
void nek_init_step_();
void nek_step_();
void nek_finalize_step_();
}
#endif /* NEKINTERFACE_H */
//
// Created by Ron Rahaman on 10/18/16.
//
#ifndef MOON_NEKEXECUTIONER_H
#define MOON_NEKEXECUTIONER_H
#include "Transient.h"
class NekExecutioner;
template<>
InputParameters validParams<NekExecutioner>();
class NekExecutioner :
public Transient
{
public:
/**
* Constructor
*
* @param parameters The parameters object holding data for the class to use.
*/
NekExecutioner(const InputParameters & parameters);
virtual ~NekExecutioner();
/**
* Initialize the executioner
*/
virtual void init();
/**
* Do whatever is necessary to advance one step.
*/
virtual void preStep();
virtual void takeStep(Real input_dt = -1.0);
virtual void postStep();
/**
* Whether or not the last solve converged.
*/
virtual bool lastSolveConverged();
};
#endif //MOON_NEKEXECUTIONER_H
//
// Created by Ron Rahaman on 10/18/16.
//
#ifndef MOON_NEKTIMESTEPPER_H
#define MOON_NEKTIMESTEPPER_H
#include "TimeStepper.h"
class NekTimestepper;
template<>
InputParameters validParams<NekTimestepper>();
class NekTimestepper : public TimeStepper
{
public:
NekTimestepper(const InputParameters & parameters);
protected:
virtual Real computeInitialDT() override;
virtual Real computeDT() override;
virtual void step() override;
};
#endif //MOON_NEKTIMESTEPPER_H
//
// Created by Ron Rahaman on 10/18/16.
//
#include "NekExecutioner.h"
#include "NekInterface.h"
template<>
InputParameters validParams<NekExecutioner>()
{
InputParameters params = validParams<Transient>();
return params;
}
void NekExecutioner::init() {
Transient::init();
nek_init_(_communicator.get());
}
void NekExecutioner::preStep() {
Transient::preStep();
nek_init_step_();
}
void NekExecutioner::postStep() {
Transient::postStep();
nek_finalize_step_();
}
//
// Created by Ron Rahaman on 10/18/16.
//
#include "NekTimestepper.h"
#include "NekInterface.h"
template<>
InputParameters validParams<NekTimestepper>()
{
InputParameters params = validParams<TimeStepper>();
return params;
}
NekTimestepper::NekTimestepper(const InputParameters & parameters) :
TimeStepper(parameters)
{
}
Real
NekTimestepper::computeInitialDT()
{
return 0;
}
Real
NekTimestepper::computeDT()
{
return 0;
}
void
NekTimestepper::step()
{
nek_step_();
}
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