18
18
#include < AMReX_Array.H>
19
19
#include < AMReX_Vector.H>
20
20
#include < AMReX_MultiFab.H>
21
- #ifndef WARPX_DIM_1D_Z // currently not implemented in 1D
22
21
#include < AMReX_MLLinOp.H>
23
22
#include < AMReX_MLCurlCurl.H>
24
23
#include < AMReX_MLMG.H>
25
24
#include < AMReX_GMRES_MLMG.H>
26
- #endif
27
25
28
26
/* *
29
27
* \brief Curl-curl Preconditioner
@@ -131,16 +129,13 @@ class CurlCurlMLMGPC : public Preconditioner<T,Ops>
131
129
amrex::Vector<amrex::DistributionMapping> m_dmap;
132
130
amrex::IntVect m_gv;
133
131
134
- // currently not implemented in 1D
135
- #ifndef WARPX_DIM_1D_Z
136
132
amrex::Array<amrex::LinOpBCType, AMREX_SPACEDIM> m_bc_lo;
137
133
amrex::Array<amrex::LinOpBCType, AMREX_SPACEDIM> m_bc_hi;
138
134
139
135
std::unique_ptr<amrex::LPInfo> m_info;
140
136
std::unique_ptr<amrex::MLCurlCurl> m_curl_curl;
141
137
std::unique_ptr<amrex::MLMGT<MFArr>> m_solver;
142
138
std::unique_ptr<amrex::GMRESMLMGT<MFArr>> m_gmres_solver;
143
- #endif
144
139
145
140
/* *
146
141
* \brief Read parameters
@@ -208,10 +203,6 @@ void CurlCurlMLMGPC<T,Ops>::Define ( const T& a_U,
208
203
// read preconditioner parameters
209
204
readParameters ();
210
205
211
- // currently not implemented in 1D
212
- #ifdef WARPX_DIM_1D_Z
213
- WARPX_ABORT_WITH_MESSAGE (" CurlCurlMLMGPC not yet implemented for 1D" );
214
- #else
215
206
// create info object for curl-curl op
216
207
m_info = std::make_unique<LPInfo>();
217
208
m_info->setAgglomeration (m_agglomeration);
@@ -256,7 +247,6 @@ void CurlCurlMLMGPC<T,Ops>::Define ( const T& a_U,
256
247
m_gmres_solver->setPrecondNumIters (m_max_iter);
257
248
m_gmres_solver->setVerbose (static_cast <int >(m_verbose));
258
249
}
259
- #endif
260
250
261
251
m_is_defined = true ;
262
252
}
@@ -276,10 +266,7 @@ void CurlCurlMLMGPC<T,Ops>::Update (const T& a_U)
276
266
const RT alpha = (this ->m_dt *PhysConst::c) * (this ->m_dt *PhysConst::c);
277
267
const RT beta = RT (1.0 );
278
268
279
- // currently not implemented in 1D
280
- #ifndef WARPX_DIM_1D_Z
281
269
m_curl_curl->setScalars (alpha, beta);
282
- #endif
283
270
284
271
if (m_verbose) {
285
272
amrex::Print () << " Updating " << amrex::getEnumNameString (PreconditionerType::pc_curl_curl_mlmg)
@@ -322,8 +309,13 @@ void CurlCurlMLMGPC<T,Ops>::Apply (T& a_x, const T& a_b)
322
309
323
310
// Copy initial guess to local object
324
311
#if defined(WARPX_DIM_1D_Z)
325
- // Missing dimensions is x,y in WarpX and y,z in AMReX
326
- WARPX_ABORT_WITH_MESSAGE (" CurlCurlMLMGPC not yet implemented for 1D" );
312
+ // Missing dimensions are x,y in WarpX and y,z in AMReX
313
+ Array<MultiFab,3 > solution { MultiFab (*x_mfarrvec[n][2 ], make_alias, 0 , 1 ),
314
+ MultiFab (*x_mfarrvec[n][1 ], make_alias, 0 , 1 ),
315
+ MultiFab (*x_mfarrvec[n][0 ], make_alias, 0 , 1 ) };
316
+ Array<MultiFab,3 > rhs { MultiFab (*b_mfarrvec[n][2 ], make_alias, 0 , 1 ),
317
+ MultiFab (*b_mfarrvec[n][1 ], make_alias, 0 , 1 ),
318
+ MultiFab (*b_mfarrvec[n][0 ], make_alias, 0 , 1 ) };
327
319
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
328
320
// Missing dimension is y in WarpX and z in AMReX
329
321
Array<MultiFab,3 > solution { MultiFab (*x_mfarrvec[n][0 ], make_alias, 0 , 1 ),
@@ -341,15 +333,12 @@ void CurlCurlMLMGPC<T,Ops>::Apply (T& a_x, const T& a_b)
341
333
MultiFab (*b_mfarrvec[n][2 ], make_alias, 0 , 1 ) };
342
334
#endif
343
335
344
- // currently not implemented in 1D
345
- #ifndef WARPX_DIM_1D_Z
346
336
m_curl_curl->prepareRHS ({&rhs});
347
337
if (m_use_gmres) {
348
338
m_gmres_solver->solve (solution, rhs, m_rtol, m_atol);
349
339
} else {
350
340
m_solver->solve ({&solution}, {&rhs}, m_rtol, m_atol);
351
341
}
352
- #endif
353
342
}
354
343
}
355
344
0 commit comments