WarpX
Source
FieldSolver
SpectralSolver
SpectralKSpace.H
Go to the documentation of this file.
1
/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe
2
*
3
*
4
* This file is part of WarpX.
5
*
6
* License: BSD-3-Clause-LBNL
7
*/
8
#ifndef WARPX_SPECTRAL_K_SPACE_H_
9
#define WARPX_SPECTRAL_K_SPACE_H_
10
11
#include "
SpectralKSpace_fwd.H
"
12
13
#include "
Utils/WarpX_Complex.H
"
14
15
#include <
AMReX_Array.H
>
16
#include <
AMReX_BoxArray.H
>
17
#include <AMReX_Config.H>
18
#include <
AMReX_GpuContainers.H
>
19
#include <
AMReX_LayoutData.H
>
20
#include <
AMReX_REAL.H
>
21
#include <
AMReX_RealVect.H
>
22
#include <
AMReX_Vector.H
>
23
24
#include <
AMReX_BaseFwd.H
>
25
26
// `KVectorComponent` and `SpectralShiftFactor` hold one 1D array
27
// ("DeviceVector") for each box ("LayoutData"). The arrays are
28
// only allocated if the corresponding box is owned by the local MPI rank.
29
using
RealKVector
=
amrex::Gpu::DeviceVector<amrex::Real>
;
30
using
KVectorComponent
=
amrex::LayoutData< RealKVector >
;
31
using
SpectralShiftFactor
=
amrex::LayoutData
<
32
amrex::Gpu::DeviceVector<Complex>
>;
33
34
// Indicate the type of correction "shift" factor to apply
35
// when the FFT is performed from/to a cell-centered grid in real space.
36
struct
ShiftType
{
37
enum
{
TransformFromCellCentered
=0,
TransformToCellCentered
=1 };
38
};
39
47
class
SpectralKSpace
48
{
49
public
:
50
amrex::BoxArray
spectralspace_ba
;
51
SpectralKSpace
() :
dx
(
amrex
::RealVect::
Zero
) {}
52
SpectralKSpace
(
const
amrex::BoxArray
& realspace_ba,
53
const
amrex::DistributionMapping
& dm,
54
const
amrex::RealVect
realspace_dx );
55
KVectorComponent
getKComponent(
56
const
amrex::DistributionMapping
& dm,
57
const
amrex::BoxArray
& realspace_ba,
58
const
int
i_dim,
const
bool
only_positive_k )
const
;
59
KVectorComponent
getModifiedKComponent(
60
const
amrex::DistributionMapping
& dm,
const
int
i_dim,
61
const
int
n_order,
const
short
grid_type )
const
;
62
SpectralShiftFactor
getSpectralShiftFactor(
63
const
amrex::DistributionMapping
& dm,
const
int
i_dim,
64
const
int
shift_type )
const
;
65
66
protected
:
67
amrex::Array<KVectorComponent, AMREX_SPACEDIM>
k_vec
;
68
// 3D: k_vec is an Array of 3 components, corresponding to kx, ky, kz
69
// 2D: k_vec is an Array of 2 components, corresponding to kx, kz
70
amrex::RealVect
dx
;
71
};
72
73
#endif
SpectralKSpace_fwd.H
SpectralKSpace::k_vec
amrex::Array< KVectorComponent, AMREX_SPACEDIM > k_vec
Definition:
SpectralKSpace.H:67
amrex::PODVector
SpectralKSpace
Class that represents the spectral space.
Definition:
SpectralKSpace.H:47
amrex::RealVect
SpectralKSpace::dx
amrex::RealVect dx
Definition:
SpectralKSpace.H:70
AMReX_BaseFwd.H
amrex::LayoutData< RealKVector >
compute_domain.dx
int dx
Definition:
compute_domain.py:35
ShiftType
Definition:
SpectralKSpace.H:36
amrex::DistributionMapping
AMReX_Vector.H
SpectralKSpace::spectralspace_ba
amrex::BoxArray spectralspace_ba
Definition:
SpectralKSpace.H:50
AMReX_REAL.H
AMReX_RealVect.H
AMReX_GpuContainers.H
ShiftType::TransformToCellCentered
Definition:
SpectralKSpace.H:37
ShiftType::TransformFromCellCentered
Definition:
SpectralKSpace.H:37
InitializationPolicy::Zero
AMReX_Array.H
WarpX_Complex.H
AMReX_BoxArray.H
SpectralKSpace::SpectralKSpace
SpectralKSpace()
Definition:
SpectralKSpace.H:51
amrex::BoxArray
amrex::Array
std::array< T, N > Array
amrex
AMReX_LayoutData.H
Generated by
1.8.13