Skip to content

Commit

Permalink
Merge pull request #140 from RevathiJambunathan/HSdevmerge_240304
Browse files Browse the repository at this point in the history
HSdevmerge 240304
  • Loading branch information
RevathiJambunathan authored Mar 11, 2024
2 parents 1efba85 + aa672b9 commit 61c83d6
Show file tree
Hide file tree
Showing 84 changed files with 1,083 additions and 663 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ concurrency:

jobs:
run_clang_tidy:
name: clang-tidy
strategy:
matrix:
dim: [1, 2, RZ, 3]
name: clang-tidy-${{ matrix.dim }}D
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
.github/workflows/dependencies/clang14.sh
.github/workflows/dependencies/clang15.sh
- name: set up cache
uses: actions/cache@v4
with:
Expand All @@ -32,26 +35,26 @@ jobs:
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
export CXX=$(which clang++)
export CC=$(which clang)
export CXX=$(which clang++-15)
export CC=$(which clang-15)
cmake -S . -B build_clang_tidy \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DWarpX_DIMS="1;2;RZ;3" \
-DWarpX_MPI=ON \
-DWarpX_COMPUTE=OMP \
-DWarpX_PSATD=ON \
-DWarpX_QED=ON \
-DWarpX_QED_TABLE_GEN=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=SINGLE \
cmake -S . -B build_clang_tidy \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DWarpX_DIMS="${{ matrix.dim }}" \
-DWarpX_MPI=ON \
-DWarpX_COMPUTE=OMP \
-DWarpX_PSATD=ON \
-DWarpX_QED=ON \
-DWarpX_QED_TABLE_GEN=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=SINGLE \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build_clang_tidy -j 4
${{github.workspace}}/.github/workflows/source/makeMakefileForClangTidy.py --input ${{github.workspace}}/ccache.log.txt
make -j4 --keep-going -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach 2ecafcff40132f56eb2b494e1a374684ff97117a && cd -
cd ../amrex && git checkout --detach 24.03 && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_PSATD=TRUE USE_CCACHE=TRUE -j 4
ccache -s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
sudo apt-get -qqq update
sudo apt-get install -y \
cmake \
clang-14 \
clang-tidy-14 \
clang-15 \
clang-tidy-15 \
libblas-dev \
libc++-14-dev \
libc++-15-dev \
libboost-math-dev \
libfftw3-dev \
libfftw3-mpi-dev \
libhdf5-openmpi-dev \
liblapack-dev \
libopenmpi-dev \
libomp-dev \
libomp-15-dev \
ninja-build

# ccache
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Preamble ####################################################################
#
cmake_minimum_required(VERSION 3.20.0)
project(WarpX VERSION 24.02)
project(WarpX VERSION 24.03)

include(${WarpX_SOURCE_DIR}/cmake/WarpXFunctions.cmake)

Expand Down
5 changes: 1 addition & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ Git workflow
------------

The WarpX project uses `git <https://git-scm.com>`_ for version control.
If you are new to git, you can follow one of these tutorials:

- `Learn git with bitbucket <https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud>`_
- `git - the simple guide <http://rogerdudler.github.io/git-guide/>`_
If you are new to git, you can follow `this tutorial <https://swcarpentry.github.io/git-novice/>`__.

Configure your GitHub Account & Development Machine
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions Docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def __init__(self, *args, **kwargs):
# built documents.
#
# The short X.Y version.
version = u'24.02'
version = u'24.03'
# The full version, including alpha/beta/rc tags.
release = u'24.02'
release = u'24.03'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
14 changes: 14 additions & 0 deletions Docs/source/developers/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ For instance, compiling with ``clang++ -Werror`` would be:
export CXXFLAGS="-Werror"
Run Pre-Commit Tests Locally
----------------------------

When proposing code changes to Warpx, we perform a couple of automated stylistic and correctness checks on the code change.
You can run those locally before you push to save some time, install them once like this:

.. code-block:: sh
python -m pip install -U pre-commit
pre-commit install
See `pre-commit.com <https://pre-commit.com>`__ and our ``.pre-commit-config.yaml`` file in the repository for more details.


Run the test suite locally
--------------------------

Expand Down
8 changes: 4 additions & 4 deletions Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ For PICMI Python bindings, configure WarpX to produce a library and call our ``p
.. code-block:: bash
# find dependencies & configure for all WarpX dimensionalities
cmake -S . -B build -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
# build and then call "python3 -m pip install ..."
cmake --build build --target pip_install -j 4
cmake --build build_py --target pip_install -j 4
**That's it!**
You can now :ref:`run a first 3D PICMI script <usage-picmi>` from our :ref:`examples <usage-examples>`.
Expand Down Expand Up @@ -324,10 +324,10 @@ This is the workflow most developers will prefer as it allows rapid re-compiles:
.. code-block:: bash
# build WarpX executables and libraries
cmake -S . -B build -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
# build & install Python only
cmake --build build -j 4 --target pip_install
cmake --build build_py -j 4 --target pip_install
There is also a ``--target pip_install_nodeps`` option that :ref:`skips pip-based dependency checks <developers-local-compile-pylto>`.

Expand Down
6 changes: 6 additions & 0 deletions Docs/source/usage/workflows/python_extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ This object is the Python equivalent to the C++ ``WarpX`` simulation class.
.. py:method:: get_particle_boundary_buffer
.. py:method:: set_potential_on_domain_boundary(potential_[lo/hi]_[x/y/z]: str)
The potential on the domain boundaries can be modified when using the electrostatic solver.
This function updates the strings and function parsers which set the domain
boundary potentials during the Poisson solve.

.. py:method:: set_potential_on_eb(potential: str)
The embedded boundary (EB) conditions can be modified when using the electrostatic solver.
Expand Down
41 changes: 41 additions & 0 deletions Examples/Tests/embedded_boundary_diffraction/analysis_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3
"""
This test checks the implementation of the embedded boundary in cylindrical geometry,
by checking the diffraction of a laser by an embedded boundary here.
We then check that the first minimum of the diffracted intensity pattern
occurs along the angle given by the theoretical Airy pattern, i.e.
theta_diffraction = 1.22 * lambda / d
"""
import os
import sys

import numpy as np
from openpmd_viewer import OpenPMDTimeSeries
from scipy.ndimage import gaussian_filter1d

sys.path.insert(1, '../../../../warpx/Regression/Checksum/')
import checksumAPI

ts = OpenPMDTimeSeries('./EmbeddedBoundaryDiffraction_plt/')

# Extract the intensity as a function of r and z
Ex, info = ts.get_field('E', 'x', iteration=300)
I = gaussian_filter1d(Ex**2, sigma=5, axis=0) # Extract intensity by averaging E^2 over wavelength
irmax = np.argmax( I, axis=-1)

# Find the radius of the first minimum, as a function of z
def r_first_minimum(iz):
ir = len(info.r)//2
while I[iz, ir+1] < I[iz, ir]:
ir += 1
return info.r[ir]
r = np.array([ r_first_minimum(iz) for iz in range(len(info.z)) ])

# Check that this corresponds to the prediction from the Airy pattern
theta_diffraction = np.arcsin(1.22*0.1/0.4)/2
assert np.all( abs(r[50:] - theta_diffraction*info.z[50:]) < 0.03 )

# Open the right plot file
filename = sys.argv[1]
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename, output_format='openpmd')
42 changes: 42 additions & 0 deletions Examples/Tests/embedded_boundary_diffraction/inputs_rz
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This script tests the diffraction of a laser by
# a cylindrical object, represented by an embedded boundary here

max_step = 300
amr.n_cell = 128 256
amr.max_grid_size = 256
amr.max_level = 0

geometry.dims = RZ
geometry.prob_lo = 0. -0.2
geometry.prob_hi = 2 1.4
warpx.cfl = 0.99
algo.particle_shape = 1

boundary.field_lo = none absorbing_silver_mueller
boundary.field_hi = pec absorbing_silver_mueller

# Make the cylindrical object that the laser will diffract on
my_constants.aperture_l = 0.01
my_constants.aperture_r = 0.2
warpx.eb_implicit_function = "if( (abs(z)<0.5*aperture_l) and (x<aperture_r), 1, -1 )"

warpx.n_rz_azimuthal_modes = 2

# Laser
lasers.names = laser1
laser1.profile = Gaussian
laser1.position = 0. 0. -0.1
laser1.direction = 0. 0. 1.
laser1.polarization = 1. 0. 0.
laser1.profile_waist = 1.
laser1.profile_duration = 100
laser1.profile_t_peak = 0
laser1.profile_focal_distance = 0
laser1.e_max = 1.
laser1.wavelength = 0.1

diagnostics.diags_names = diag1
diag1.intervals = 100
diag1.diag_type = Full
diag1.fields_to_plot = Er Et Ez Br Bt Bz
diag1.format = openpmd
Loading

0 comments on commit 61c83d6

Please sign in to comment.