Skip to content

Commit

Permalink
Merge branch 'development' into add_external_particle_fields_ohms_law…
Browse files Browse the repository at this point in the history
…_hybrid
  • Loading branch information
clarkse authored Sep 26, 2024
2 parents a546023 + 192e167 commit ae4fc4e
Show file tree
Hide file tree
Showing 26 changed files with 222 additions and 138 deletions.
13 changes: 8 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "mambaforge-latest"
# python: "3.11"

sphinx:
configuration: Docs/source/conf.py
configuration: Docs/source/conf.py

python:
install:
- requirements: Docs/requirements.txt
conda:
environment: Docs/conda.yml
# python:
# install:
# - requirements: Docs/requirements.txt

formats:
- htmlzip
Expand Down
8 changes: 5 additions & 3 deletions Docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2245,15 +2245,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2305,14 +2305,16 @@ PREDEFINED = AMREX_Linux=1 \
WARPX_QED=1 \
WARPX_QED_TABLE_GEN=1

PREDEFINED += "AMREX_ENUM(CLASS,...)=\"enum class CLASS : int { __VA_ARGS__ };\""

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
# macro definition that is found in the sources will be used. Use the PREDEFINED
# tag if you want to use a different macro definition that overrules the
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = AMREX_ENUM

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
5 changes: 3 additions & 2 deletions Docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ More information can be found in Docs/source/developers/documentation.rst.

Install the Python requirements for compiling the documentation:
```
python3 -m pip install -r Docs/requirements.txt
cd Docs/
python3 -m pip install -r requirements.txt
```

### Compiling the documentation

`cd` into the `Docs/` directory and type
Still in the `Docs/` directory, type
```
make html
```
Expand Down
12 changes: 12 additions & 0 deletions Docs/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: readthedocs

channels:
- conda-forge
- nodefaults

dependencies:
- python
- doxygen
- pip
- pip:
- -r requirements.txt
2 changes: 1 addition & 1 deletion Docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# License: BSD-3-Clause-LBNL

# WarpX PICMI bindings w/o C++ component (used for autoclass docs)
-e Python
-e ../Python
breathe
docutils>=0.17.1

Expand Down
7 changes: 3 additions & 4 deletions Docs/source/developers/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ First, make sure you are in the root directory of WarpX's source and install the

.. code-block:: sh
python3 -m pip install -r Docs/requirements.txt
cd Docs/
python3 -m pip install -r requirements.txt
You will also need Doxygen (macOS: ``brew install doxygen``; Ubuntu: ``sudo apt install doxygen``).

Then, to compile the documentation, use
Still in the ``Docs/`` directory, compile the documentation via

.. code-block:: sh
cd Docs/
make html
# This will first compile the Doxygen documentation (execute doxygen)
# and then build html pages from rst files using sphinx and breathe.
Expand Down
7 changes: 7 additions & 0 deletions Docs/source/developers/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ The ``MultiFab`` constructor (for, e.g., ``Ex`` on level ``lev``) is called in `

By default, the ``MultiFab`` are set to ``0`` at initialization. They can be assigned a different value in ``WarpX::InitLevelData``.

Field Names
-----------

The commonly used WarpX field names are defined in:

.. doxygenenum:: warpx::fields::FieldType

Field solver
------------

Expand Down
7 changes: 5 additions & 2 deletions Docs/source/usage/workflows/python_extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ This example accesses the :math:`E_x(x,y,z)` field at level 0 after every time s
warpx = sim.extension.warpx
# data access
E_x_mf = warpx.multifab(f"Efield_fp[x][level=0]")
# vector field E, component x, on the fine patch of MR level 0
E_x_mf = warpx.multifab("Efield_fp", dir=0, level=0)
# scalar field rho, on the fine patch of MR level 0
rho_mf = warpx.multifab("rho_fp", level=0)
# compute
# compute on E_x_mf
# iterate over mesh-refinement levels
for lev in range(warpx.finest_level + 1):
# grow (aka guard/ghost/halo) regions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def compute_virtual_charge_on_spacecraft():
# Compute integral of rho over volume of the domain
# (i.e. total charge of the plasma particles)
rho_integral = (
(rho[1 : nr - 1, 1 : nz - 1] * r[1 : nr - 1, np.newaxis]).sum() * dr * dz
(rho[1 : nr - 1, 1 : nz - 1] * r[1 : nr - 1, np.newaxis]).sum()
* 2
* np.pi
* dr
* dz
)

# Due to an oddity in WarpX (which will probably be solved later)
# we need to multiply `rho` by `-epsilon_0` to get the correct charge
rho_integral *= 2 * np.pi * -scc.epsilon_0 # does this oddity still exist?

# Compute charge of the spacecraft, based on Gauss theorem
q_spacecraft = -rho_integral - scc.epsilon_0 * grad_phi_integral
print("Virtual charge on the spacecraft: %e" % q_spacecraft)
Expand Down
8 changes: 4 additions & 4 deletions Source/BoundaryConditions/PML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ PML::CheckPoint (
{
using ablastr::fields::Direction;

if (fields.has(FieldType::pml_E_fp, Direction{0}, 0))
if (fields.has_vector(FieldType::pml_E_fp, 0))
{
ablastr::fields::VectorField pml_E_fp = fields.get_alldirs(FieldType::pml_E_fp, 0);
ablastr::fields::VectorField pml_B_fp = fields.get_alldirs(FieldType::pml_B_fp, 0);
Expand All @@ -1246,7 +1246,7 @@ PML::CheckPoint (
VisMF::AsyncWrite(*pml_B_fp[2], dir+"_Bz_fp");
}

if (fields.has(FieldType::pml_E_cp, Direction{0}, 0))
if (fields.has_vector(FieldType::pml_E_cp, 0))
{
ablastr::fields::VectorField pml_E_cp = fields.get_alldirs(FieldType::pml_E_cp, 0);
ablastr::fields::VectorField pml_B_cp = fields.get_alldirs(FieldType::pml_B_cp, 0);
Expand All @@ -1267,7 +1267,7 @@ PML::Restart (
{
using ablastr::fields::Direction;

if (fields.has(FieldType::pml_E_fp, Direction{0}, 0))
if (fields.has_vector(FieldType::pml_E_fp, 0))
{
ablastr::fields::VectorField pml_E_fp = fields.get_alldirs(FieldType::pml_E_fp, 0);
ablastr::fields::VectorField pml_B_fp = fields.get_alldirs(FieldType::pml_B_fp, 0);
Expand All @@ -1279,7 +1279,7 @@ PML::Restart (
VisMF::Read(*pml_B_fp[2], dir+"_Bz_fp");
}

if (fields.has(FieldType::pml_E_cp, Direction{0}, 0))
if (fields.has_vector(FieldType::pml_E_cp, 0))
{
ablastr::fields::VectorField pml_E_cp = fields.get_alldirs(FieldType::pml_E_cp, 0);
ablastr::fields::VectorField pml_B_cp = fields.get_alldirs(FieldType::pml_B_cp, 0);
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/BTDiagnostics.H
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private:
* will be used by all snapshots to obtain lab-frame data at the respective
* z slice location.
*/
amrex::Vector<std::unique_ptr<amrex::MultiFab> > m_cell_centered_data;
std::string const m_cell_centered_data_name;
/** Vector of pointers to compute cell-centered data, per level, per component
* using the coarsening-ratio provided by the user.
*/
Expand Down Expand Up @@ -346,7 +346,7 @@ private:
* \param[in] i_buffer snapshot index
*/
void SetSnapshotFullStatus (int i_buffer);
/** Vector of field-data stored in the cell-centered multifab, m_cell_centered_data.
/** Vector of field-data stored in the cell-centered MultiFab.
* All the fields are stored regardless of the specific fields to plot selected
* by the user.
*/
Expand Down
Loading

0 comments on commit ae4fc4e

Please sign in to comment.