Skip to content

Commit 299ef55

Browse files
committed
Build System: Add 1D Geometry
1 parent a83c9c0 commit 299ef55

File tree

3 files changed

+36
-37
lines changed

3 files changed

+36
-37
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ option(WarpX_SENSEI "SENSEI in situ diagnostics" OFF)
6060
option(WarpX_QED "QED support (requires PICSAR)" ON)
6161
option(WarpX_QED_TABLE_GEN "QED table generation (requires PICSAR and Boost)" OFF)
6262

63-
set(WarpX_DIMS_VALUES 2 3 RZ)
64-
set(WarpX_DIMS 3 CACHE STRING "Simulation dimensionality (2/3/RZ)")
63+
set(WarpX_DIMS_VALUES 1 2 3 RZ)
64+
set(WarpX_DIMS 3 CACHE STRING "Simulation dimensionality (1/2/3/RZ)")
6565
set_property(CACHE WarpX_DIMS PROPERTY STRINGS ${WarpX_DIMS_VALUES})
6666
if(NOT WarpX_DIMS IN_LIST WarpX_DIMS_VALUES)
6767
message(FATAL_ERROR "WarpX_DIMS (${WarpX_DIMS}) must be one of ${WarpX_DIMS_VALUES}")
@@ -263,6 +263,8 @@ if(WarpX_DIMS STREQUAL 3)
263263
target_compile_definitions(WarpX PUBLIC WARPX_DIM_3D)
264264
elseif(WarpX_DIMS STREQUAL 2)
265265
target_compile_definitions(WarpX PUBLIC WARPX_DIM_XZ)
266+
elseif(WarpX_DIMS STREQUAL 1)
267+
target_compile_definitions(WarpX PUBLIC WARPX_DIM_1D)
266268
elseif(WarpX_DIMS STREQUAL RZ)
267269
target_compile_definitions(WarpX PUBLIC WARPX_DIM_RZ)
268270
endif()
@@ -331,12 +333,10 @@ install(TARGETS ${WarpX_INSTALL_TARGET_NAMES}
331333
# simplified library alias
332334
# this is currently expected by Python bindings
333335
if(WarpX_LIB)
334-
if(WarpX_DIMS STREQUAL 3)
335-
set(lib_suffix "3d")
336-
elseif(WarpX_DIMS STREQUAL 2)
337-
set(lib_suffix "2d")
338-
elseif(WarpX_DIMS STREQUAL RZ)
336+
if(WarpX_DIMS STREQUAL RZ)
339337
set(lib_suffix "rz")
338+
else()
339+
set(lib_suffix "${WarpX_DIMS}d")
340340
endif()
341341
if(WIN32)
342342
set(mod_ext "dll")

Docs/source/developers/dimensionality.rst

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Dimensions CMake Option
1313
========== ===================
1414
**3D3V** ``WarpX_DIMS=3``
1515
**2D3V** ``WarpX_DIMS=2``
16+
**1D3V** ``WarpX_DIMS=1``
1617
**RZ** ``WarpX_DIMS=RZ``
1718
========== ===================
1819

@@ -23,35 +24,37 @@ Defines
2324

2425
Depending on the build variant of WarpX, the following preprocessor macros will be set:
2526

26-
================== =========== =========== ===========
27-
Macro 3D3V 2D3V RZ
28-
================== =========== =========== ===========
29-
``AMREX_SPACEDIM`` ``3`` ``2`` ``2``
30-
``WARPX_DIM_3D`` **defined** *undefined* *undefined*
31-
``WARPX_DIM_XZ`` *undefined* **defined** *undefined*
32-
``WARPX_DIM_RZ`` *undefined* *undefined* **defined**
33-
================== =========== =========== ===========
27+
================== =========== =========== =========== ===========
28+
Macro 3D3V 2D3V 1D3V RZ
29+
================== =========== =========== =========== ===========
30+
``AMREX_SPACEDIM`` ``3`` ``2`` ``1`` ``2``
31+
``WARPX_DIM_3D`` **defined** *undefined* *undefined* *undefined*
32+
``WARPX_DIM_1D`` *undefined* *undefined* **defined** *undefined*
33+
``WARPX_DIM_XZ`` *undefined* **defined** *undefined* *undefined*
34+
``WARPX_DIM_RZ`` *undefined* *undefined* *undefined* **defined**
35+
================== =========== =========== =========== ===========
3436

3537
At the same time, the following conventions will apply:
3638

37-
==================== =========== =========== ===========
38-
**Convention** **3D3V** **2D3V** **RZ**
39-
-------------------- ----------- ----------- -----------
39+
==================== =========== =========== =========== ===========
40+
**Convention** **3D3V** **2D3V** **1D3V** **RZ**
41+
-------------------- ----------- ----------- ----------- -----------
4042
*Fields*
41-
-----------------------------------------------------------
42-
AMReX Box dimensions ``3`` ``2`` ``2``
43-
WarpX axis labels ``x, y, z`` ``x, z`` ``x, z``
44-
-------------------- ----------- ----------- -----------
43+
------------------------------------------------------------------------
44+
AMReX Box dimensions ``3`` ``2`` ``1`` ``2``
45+
WarpX axis labels ``x, y, z`` ``x, z`` ``z`` ``x, z``
46+
-------------------- ----------- ----------- ----------- -----------
4547
*Particles*
46-
-----------------------------------------------------------
47-
AMReX AoS ``.pos()`` ``0, 1, 2`` ``0, 1`` ``0, 1``
48-
WarpX position names ``x, y, z`` ``x, z`` ``r, z``
49-
extra SoA attribute ``theta``
50-
==================== =========== =========== ===========
48+
------------------------------------------------------------------------
49+
AMReX AoS ``.pos()`` ``0, 1, 2`` ``0, 1`` ``0`` ``0, 1``
50+
WarpX position names ``x, y, z`` ``x, z`` ``z`` ``r, z``
51+
extra SoA attribute ``theta``
52+
==================== =========== =========== =========== ===========
5153

5254
Please see the following sections for particle AoS and SoA details.
5355

5456
Conventions
5557
-----------
5658

5759
In 2D3V, we assume that the position of a particle in ``y`` is equal to ``0``.
60+
In 1D3V, we assume that the position of a particle in ``x`` and ``y`` is equal to ``0``.

cmake/WarpXFunctions.cmake

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ function(set_warpx_binary_name)
160160
endif()
161161
foreach(tgt IN LISTS _ALL_TARGETS)
162162
set_target_properties(${tgt} PROPERTIES OUTPUT_NAME "warpx")
163-
if(WarpX_DIMS STREQUAL 3)
164-
set_property(TARGET ${tgt} APPEND_STRING PROPERTY OUTPUT_NAME ".3d")
165-
elseif(WarpX_DIMS STREQUAL 2)
166-
set_property(TARGET ${tgt} APPEND_STRING PROPERTY OUTPUT_NAME ".2d")
167-
elseif(WarpX_DIMS STREQUAL RZ)
163+
if(WarpX_DIMS STREQUAL RZ)
168164
set_property(TARGET ${tgt} APPEND_STRING PROPERTY OUTPUT_NAME ".RZ")
165+
else()
166+
set_property(TARGET ${tgt} APPEND_STRING PROPERTY OUTPUT_NAME ".${WarpX_DIMS}d")
169167
endif()
170168

171169
if(WarpX_MPI)
@@ -226,12 +224,10 @@ function(set_warpx_binary_name)
226224
endif()
227225
if(WarpX_LIB)
228226
# alias to the latest build; this is the one expected by Python bindings
229-
if(WarpX_DIMS STREQUAL 3)
230-
set(lib_suffix "3d")
231-
elseif(WarpX_DIMS STREQUAL 2)
232-
set(lib_suffix "2d")
233-
elseif(WarpX_DIMS STREQUAL RZ)
227+
if(WarpX_DIMS STREQUAL RZ)
234228
set(lib_suffix "rz")
229+
else()
230+
set(lib_suffix "${WarpX_DIMS}d")
235231
endif()
236232
if(WIN32)
237233
set(mod_ext "dll")

0 commit comments

Comments
 (0)