Commit cce1aa35 authored by Kevin Dugan's avatar Kevin Dugan

Adding executioner and timestepper

parent b9f0d92f
SESSION.NAME
integration_example.f
integration_example.sch
//
// Created by Ron Rahaman on 10/18/16.
//
#ifndef GIRAFFE_NEKEXECUTIONER_H
#define GIRAFFE_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);
/**
* 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 //GIRAFFE_NEKEXECUTIONER_H
//
// Created by Ron Rahaman on 10/18/16.
//
#ifndef GIRAFFE_NEKTIMESTEPPER_H
#define GIRAFFE_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;
virtual bool converged() override;
private:
Real _dt;
};
#endif //GIRAFFE_NEKTIMESTEPPER_H
......@@ -15,6 +15,10 @@
// Transfers
#include "MultiAppPolynomialToNek.h"
// Executioners
#include "NekExecutioner.h"
#include "NekTimeStepper.h"
template <>
InputParameters
validParams<GiraffeApp>()
......@@ -58,6 +62,9 @@ GiraffeApp::registerObjects(Factory & factory)
registerUserObject(NekSideIntegralVariableUserObject);
registerTransfer(MultiAppPolynomialToNek);
registerExecutioner(NekExecutioner);
registerTimeStepper(NekTimeStepper);
}
void
......
//
// Created by Ron Rahaman on 10/18/16.
//
#include "NekExecutioner.h"
#include "NekInterface.h"
template<>
InputParameters validParams<NekExecutioner>()
{
InputParameters params = validParams<Transient>();
return params;
}
NekExecutioner::NekExecutioner(const InputParameters & parameters) :
Transient(parameters)
{
}
void NekExecutioner::init() {
Transient::init();
FORTRAN_CALL(Nek5000::nek_init)(_communicator.get());
}
void NekExecutioner::preStep() {
Transient::preStep();
FORTRAN_CALL(Nek5000::nek_init_step)();
}
void NekExecutioner::postStep() {
Transient::postStep();
FORTRAN_CALL(Nek5000::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>();
params.addParam<Real>("dt", 1.0, "Size of the time step");
return params;
}
NekTimeStepper::NekTimeStepper(const InputParameters & parameters) :
TimeStepper(parameters),
_dt(getParam<Real>("dt"))
{
}
Real
NekTimeStepper::computeInitialDT()
{
// TODO: Should report information from Nek
return _dt;
}
Real
NekTimeStepper::computeDT()
{
// TODO: Should report information from Nek
return _dt;
}
void
NekTimeStepper::step()
{
FORTRAN_CALL(Nek5000::nek_step)();
}
bool
NekTimeStepper::converged()
{
// TODO: Should report information from Nek
return true;
}
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