|
33 | 33 | #include "../athena_arrays.hpp"
|
34 | 34 | #include "../coordinates/coordinates.hpp"
|
35 | 35 | #include "../eos/eos.hpp"
|
36 |
| -#include "../fft/athena_fft.hpp" |
37 | 36 | #include "../field/field.hpp"
|
38 | 37 | #include "../globals.hpp"
|
39 | 38 | #include "../hydro/hydro.hpp"
|
|
42 | 41 | #include "../outputs/outputs.hpp"
|
43 | 42 | #include "../parameter_input.hpp"
|
44 | 43 |
|
| 44 | +#ifdef FFT |
| 45 | +#include "../fft/athena_fft.hpp" |
| 46 | +#endif |
| 47 | + |
45 | 48 | #if !MAGNETIC_FIELDS_ENABLED
|
46 | 49 | #error "This problem generator requires magnetic fields"
|
47 | 50 | #endif
|
@@ -143,12 +146,13 @@ void Mesh::InitUserMeshData(ParameterInput *pin) {
|
143 | 146 | msg << "### FATAL ERROR in jgg.cpp ProblemGenerator" << std::endl
|
144 | 147 | << "FFT option is required for error output." << std::endl;
|
145 | 148 | ATHENA_ERROR(msg);
|
146 |
| -#endif |
| 149 | +#else |
147 | 150 | if (Globals::my_rank==0 || (Globals::nranks>1 && Globals::my_rank == 1)) {
|
148 | 151 | fft_data = new fftw_complex[mesh_size.nx2];
|
149 | 152 | fplan = fftw_plan_dft_1d(mesh_size.nx2, fft_data, fft_data,
|
150 | 153 | FFTW_FORWARD, FFTW_ESTIMATE);
|
151 | 154 | }
|
| 155 | +#endif |
152 | 156 |
|
153 | 157 | // allocateDataField
|
154 | 158 | AllocateRealUserMeshDataField(4);
|
@@ -476,9 +480,9 @@ void Mesh::UserWorkInLoop() {
|
476 | 480 | Real vol = pmb->pcoord->GetCellVolume(k,j,i);
|
477 | 481 | Real SN = std::sin(kx*x1+ky*x2+kz*x3);
|
478 | 482 | if (mesh_size.nx3>1) { // 3D
|
479 |
| - ruser_mesh_data[0](tk,tj,ti) = 2.0*pmb->pfield->bcc(IB1,k,j,i)*vol*SN; |
480 |
| - } else { // 2D |
481 | 483 | ruser_mesh_data[0](tk,tj,ti) = 2.0*pmb->pfield->bcc(IB3,k,j,i)*vol*SN;
|
| 484 | + } else { // 2D |
| 485 | + ruser_mesh_data[0](tk,tj,ti) = 2.0*pmb->pfield->bcc(IB1,k,j,i)*vol*SN; |
482 | 486 | }
|
483 | 487 | } else { // ipert == 2
|
484 | 488 | ruser_mesh_data[0](tk,tj,ti) = (pmb->pfield->bcc(IB1,k,j,i)-rbx)/dbx0;
|
@@ -621,6 +625,7 @@ void Mesh::UserWorkInLoop() {
|
621 | 625 | }
|
622 | 626 | }
|
623 | 627 | #endif
|
| 628 | +#ifdef FFT |
624 | 629 | // fft execution
|
625 | 630 | if (ipert == 2) {
|
626 | 631 | int exe_rank_dby = (Globals::nranks>1)? 1 : 0;
|
@@ -688,6 +693,7 @@ void Mesh::UserWorkInLoop() {
|
688 | 693 | }
|
689 | 694 | }
|
690 | 695 | }
|
| 696 | +#endif |
691 | 697 | } // flag
|
692 | 698 | return;
|
693 | 699 | }
|
|
0 commit comments