Skip to content

Commit

Permalink
Higher order type transforms (idaholab#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen authored and recuero committed Apr 29, 2020
1 parent 5659597 commit 27f5b84
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
14 changes: 12 additions & 2 deletions src/executioners/SpectralExecutionerBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,23 @@ SpectralExecutionerBase::execute()
_fe_problem.outputStep(EXEC_INITIAL);
_fe_problem.advanceState();

mooseInfo("SpectralExecutionerBase::execute()");

auto & c = getFFTBuffer<Real>("c");
c.forward();

auto & R = getFFTBuffer<RealVectorValue>("R");
R.forward();

_time_step = 1;
_fe_problem.execute(EXEC_FINAL);
_time = _time_step;
_fe_problem.outputStep(EXEC_FINAL);
_fe_problem.advanceState();

c.backward();
R.backward();

_time_step = 2;
_fe_problem.execute(EXEC_FINAL);
_time = _time_step;
_fe_problem.outputStep(EXEC_FINAL);
}
35 changes: 30 additions & 5 deletions src/userobjects/FFTWBufferBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,38 @@ FFTWBufferBase<T>::FFTWBufferBase(const InputParameters & parameters)
_perf_fft(this->registerTimedSection("fftw_execute", 2))
{
// create plans
std::vector<fftw_r2r_kind> kind(_dim, FFTW_R2HC);
{
TIME_SECTION(_perf_plan);
_forward_plan = fftw_plan_r2r(_dim, _grid.data(), _start, _start, kind.data(), FFTW_ESTIMATE);
_backward_plan = fftw_plan_r2r(_dim, _grid.data(), _start, _start, kind.data(), FFTW_ESTIMATE);

std::vector<fftw_r2r_kind> forward_kind(_dim, FFTW_R2HC);
_forward_plan = fftw_plan_many_r2r(_dim,
_grid.data(),
_how_many,
_start,
_grid.data(),
_stride,
1,
_start,
_grid.data(),
_stride,
1,
forward_kind.data(),
FFTW_ESTIMATE);

std::vector<fftw_r2r_kind> backward_kind(_dim, FFTW_HC2R);
_backward_plan = fftw_plan_many_r2r(_dim,
_grid.data(),
_how_many,
_start,
_grid.data(),
_stride,
1,
_start,
_grid.data(),
_stride,
1,
backward_kind.data(),
FFTW_ESTIMATE);
}
}

Expand All @@ -41,8 +68,6 @@ template <typename T>
void
FFTWBufferBase<T>::forward()
{
mooseInfo("FFTWBufferBase<T>::forward()");

// execute plan
{
TIME_SECTION(_perf_fft);
Expand Down

0 comments on commit 27f5b84

Please sign in to comment.