Skip to content

Commit

Permalink
Higher order buffer initialization (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 5b56b55 commit 5659597
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 9 deletions.
50 changes: 49 additions & 1 deletion examples/spectral.i
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@
function = 'cos(x/100*2*pi*4)*cos(y/100*2*pi*3)'
[../]
[../]

[./R0_aux]
order = CONSTANT
family = MONOMIAL
[./InitialCondition]
type = FunctionIC
function = 'cos(x/100*2*pi*2)*cos(y/100*2*pi*4)'
[../]
[../]
[./R1_aux]
order = CONSTANT
family = MONOMIAL
[./InitialCondition]
type = FunctionIC
function = 'cos(x/100*2*pi*3)*cos(y/100*2*pi*3)'
[../]
[../]
[./R2_aux]
order = CONSTANT
family = MONOMIAL
[./InitialCondition]
type = FunctionIC
function = 'cos(x/100*2*pi*4)*cos(y/100*2*pi*2)'
[../]
[../]
[]

[Materials]
Expand All @@ -37,7 +62,8 @@
moose_variable = c_aux
[../]
[./R]
type = RankTwoTensorFFTWBuffer
type = RealVectorValueFFTWBuffer
moose_variable = 'R0_aux R1_aux R2_aux'
[../]

# Solver
Expand All @@ -51,6 +77,28 @@
fft_buffer = c
execute_on = FINAL
[../]

[./R0_aux]
type = FFTBufferAux
variable = R0_aux
fft_buffer = R
component = 0
execute_on = FINAL
[../]
[./R1_aux]
type = FFTBufferAux
variable = R1_aux
fft_buffer = R
component = 1
execute_on = FINAL
[../]
[./R2_aux]
type = FFTBufferAux
variable = R2_aux
fft_buffer = R
component = 2
execute_on = FINAL
[../]
[]

[Executioner]
Expand Down
2 changes: 1 addition & 1 deletion include/userobjects/FFTBufferBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FFTBufferBase : public ElementUserObject
FFTBufferBase(const InputParameters & parameters);

virtual void initialize() {}
virtual void execute() {}
virtual void execute();
virtual void finalize() {}
virtual void threadJoin(const UserObject &) {}

Expand Down
13 changes: 6 additions & 7 deletions src/userobjects/FFTBufferBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ FFTBufferBase<T>::FFTBufferBase(const InputParameters & parameters)
if (var->isNodal())
paramError("moose_variable", "Variable must be elemental.");

_moose_variable[i] = &coupledValue("moose_variable");
_moose_variable[i] = &coupledValue("moose_variable", i);
}
}

Expand All @@ -112,17 +112,16 @@ FFTBufferBase<T>::FFTBufferBase(const InputParameters & parameters)

// compute stride and start pointer
_start = reinterpret_cast<Real *>(start(0));
std::ptrdiff_t istride = reinterpret_cast<char *>(start(1)) - reinterpret_cast<char *>(_start);
if (istride % sizeof(Real) != 0)
_stride = reinterpret_cast<char *>(start(1)) - reinterpret_cast<char *>(_start);
if (_stride % sizeof(Real) != 0)
mooseError("Invalid data alignment");
istride /= sizeof(Real);
_stride /= sizeof(Real);
}

template <>
template <typename T>
void
FFTBufferBase<Real>::execute()
FFTBufferBase<T>::execute()
{
std::cout << 'A';
// get grid / buffer location
Point centroid = _current_elem->centroid();
std::size_t a = 0;
Expand Down

0 comments on commit 5659597

Please sign in to comment.