forked from idaholab/magpie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate working transform (idaholab#401)
- Loading branch information
Showing
11 changed files
with
253 additions
and
11 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,64 @@ | ||
[Mesh] | ||
type = MyTRIMMesh | ||
dim = 2 | ||
xmax = 100 | ||
ymax = 100 | ||
nx = 100 | ||
ny = 100 | ||
[] | ||
|
||
[Problem] | ||
type = FFTProblem | ||
[] | ||
|
||
[AuxVariables] | ||
[./c_aux] | ||
order = CONSTANT | ||
family = MONOMIAL | ||
[./InitialCondition] | ||
type = FunctionIC | ||
function = 'cos(x/100*2*pi*4)*cos(y/100*2*pi*3)' | ||
[../] | ||
[../] | ||
[] | ||
|
||
[Materials] | ||
[./test] | ||
type = ParsedMaterial | ||
args = c | ||
function = c*c | ||
[../] | ||
[] | ||
|
||
[UserObjects] | ||
# Buffers | ||
[./c] | ||
type = RealFFTWBuffer | ||
moose_variable = c_aux | ||
[../] | ||
[./R] | ||
type = RankTwoTensorFFTWBuffer | ||
[../] | ||
|
||
# Solver | ||
# ... | ||
[] | ||
|
||
[AuxKernels] | ||
[./c_aux] | ||
type = FFTBufferAux | ||
variable = c_aux | ||
fft_buffer = c | ||
execute_on = FINAL | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = SpectralExecutionerBase | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
execute_on = 'INITIAL FINAL' | ||
perf_graph = true | ||
[] |
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,53 @@ | ||
/**********************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ | ||
/* */ | ||
/* Copyright 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "Executioner.h" | ||
#include "FFTWBufferBase.h" | ||
#include "FFTProblem.h" | ||
|
||
// System includes | ||
#include <string> | ||
|
||
// Forward declarations | ||
class InputParameters; | ||
|
||
/** | ||
* FFT Executioner base class. | ||
*/ | ||
class SpectralExecutionerBase : public Executioner | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
SpectralExecutionerBase(const InputParameters & parameters); | ||
|
||
virtual void init() override; | ||
virtual void execute() override; | ||
virtual bool lastSolveConverged() const override { return true; } | ||
|
||
protected: | ||
template <typename T> | ||
FFTBufferBase<T> & getFFTBuffer(const std::string & name); | ||
|
||
Real _system_time; | ||
int & _time_step; | ||
Real & _time; | ||
|
||
PerfID _final_timer; | ||
|
||
FFTProblem * _fft_problem; | ||
}; | ||
|
||
template <typename T> | ||
FFTBufferBase<T> & | ||
SpectralExecutionerBase::getFFTBuffer(const std::string & name) | ||
{ | ||
return _fft_problem->getFFTBuffer<Real>("c"); | ||
} |
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
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
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
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
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
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
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,68 @@ | ||
/**********************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ | ||
/* */ | ||
/* Copyright 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/**********************************************************************/ | ||
|
||
#include "SpectralExecutionerBase.h" | ||
#include "InputParameters.h" | ||
|
||
// testing | ||
registerMooseObject("MagpieApp", SpectralExecutionerBase); | ||
|
||
InputParameters | ||
SpectralExecutionerBase::validParams() | ||
{ | ||
InputParameters params = Executioner::validParams(); | ||
params.addClassDescription("Executioner for FFT simulations."); | ||
params.addParam<Real>("time", 0.0, "System time"); | ||
return params; | ||
} | ||
|
||
SpectralExecutionerBase::SpectralExecutionerBase(const InputParameters & parameters) | ||
: Executioner(parameters), | ||
_system_time(getParam<Real>("time")), | ||
_time_step(_fe_problem.timeStep()), | ||
_time(_fe_problem.time()), | ||
_final_timer(registerTimedSection("final", 1)), | ||
_fft_problem(dynamic_cast<FFTProblem *>(&_fe_problem)) | ||
{ | ||
|
||
if (!_fft_problem) | ||
mooseError("Use Problem/type=FFTProblem with a spectral executioner"); | ||
} | ||
|
||
void | ||
SpectralExecutionerBase::init() | ||
{ | ||
if (_app.isRecovering()) | ||
{ | ||
_console << "\nCannot recover FFT solves!\nExiting...\n" << std::endl; | ||
return; | ||
} | ||
|
||
// checkIntegrity(); | ||
_fe_problem.execute(EXEC_PRE_MULTIAPP_SETUP); | ||
_fe_problem.initialSetup(); | ||
} | ||
|
||
void | ||
SpectralExecutionerBase::execute() | ||
{ | ||
_time_step = 0; | ||
_time = _time_step; | ||
_fe_problem.outputStep(EXEC_INITIAL); | ||
_fe_problem.advanceState(); | ||
|
||
mooseInfo("SpectralExecutionerBase::execute()"); | ||
|
||
auto & c = getFFTBuffer<Real>("c"); | ||
c.forward(); | ||
|
||
_time_step = 1; | ||
_fe_problem.execute(EXEC_FINAL); | ||
_time = _time_step; | ||
_fe_problem.outputStep(EXEC_FINAL); | ||
} |
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
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