-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* documented example input file * update get_started input file and provide an example notebook * examples/get_started can have any filename * add a get_started * put style and guidelines into contributing * clean up contrib doc * remove redundant doc page * eol * typo Co-authored-by: Severin Diederichs <65728274+SeverinDiederichs@users.noreply.github.com>
- Loading branch information
1 parent
9f6a1e7
commit 752d650
Showing
11 changed files
with
191 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Contribute to Hipace++ | ||
====================== | ||
|
||
We welcome new contributors! | ||
|
||
To contribute to Hipace++, the steps are as follows: | ||
- Fork the Hipace++ repo, so you have your own fork | ||
- Pull the latest development from baseline, and create your ``<new branch>`` from it | ||
- Commit your changes as usual, and push them on your fork | ||
- Open a PR between ``<new branch>`` on your for and ``development`` on baseline | ||
|
||
Documentation | ||
------------- | ||
|
||
Hipace++ has a full (functions and classes and their members, albeit sometimes basic) Doxygen-readable documentation. You can compile it with | ||
|
||
.. code-block:: bash | ||
cd docs | ||
doxygen | ||
open doxyhtml/index.html | ||
The last line would work on MacOS. On another platform, open the html file with your favorite browser. | ||
|
||
The Hipace++ Doxygen documentation can be found `here <../_static/doxyhtml/index.html>`__. | ||
|
||
Style and conventions | ||
--------------------- | ||
|
||
- All new element (class, member of a class, struct, function) declared in a .H file must have a Doxygen-readable documentation | ||
- Indent four spaces | ||
- No tabs allowed | ||
- No end-of-line whitespaces allowed | ||
- Classes use CamelCase | ||
- Objects use snake_case | ||
- Lines should not have >100 characters | ||
- The declaration and definition of a function should have a space between the function name and the first bracket (``my_function (...)``), function calls should not (``my_function(...)``). | ||
This is a convention introduce in AMReX so ``git grep "my_function ("`` returns only the declaration and definition, not the many function calls. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Get started | ||
=========== | ||
|
||
A full Hipace++ input file can be found below, with a detailed description of the main parameters. | ||
All the input parameters available in the simulation are available in the :doc:`parameters` section. | ||
|
||
.. literalinclude:: ../../../examples/get_started/inputs_normalized | ||
|
||
This input file is ``inputs_normalized`` in ``examples/get_started/``, which is the recommended place to start running a first simulation. | ||
|
||
See the :doc:`../building/building` section to install the code locally or on your favorite platform. | ||
After compiling Hipace++ from the Hipace++ root directory, execute | ||
|
||
.. code-block:: bash | ||
cd examples/get_started/ | ||
../../build/bin/hipace inputs # run the simulation | ||
Then you can use the `openPMD-viewer <https://github.com/openPMD/openPMD-viewer>`__ to read the simulation output data. Directory `examples/get_started/` also contains this :download:`example notebook <../../../examples/get_started/notebook.ipynb>`. Reading the simulation output only takes these few Python commands: | ||
|
||
.. code-block:: python | ||
# import statements | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from openpmd_viewer import OpenPMDTimeSeries | ||
# Read the simulation data | ||
ts = OpenPMDTimeSeries('./diags/hdf5/') | ||
# Get beam and field data at iteration 20 | ||
iteration = 20 | ||
x, z = ts.get_particle(species='beam', iteration=iteration, var_list=['x', 'z']) | ||
F, m = ts.get_field(field='Ez', iteration=iteration) | ||
Other examples can be found in ``examples/`` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
### AMReX parameters | ||
################################ | ||
amr.n_cell = 64 64 100 # number of grid points in x, y, z | ||
amr.blocking_factor = 1 # blocking factor. n_cell must be divisible by it | ||
amr.max_level = 0 # level of mesh refinement. Currently, only 0 available | ||
|
||
#### General simulation settings | ||
################################ | ||
max_step = 20 # max time step. 0 computes the fields of the initial beam | ||
hipace.output_period = 1 # output period. Last step is always written | ||
hipace.normalized_units = 1 # unit system: SI units: 0, normalized units: 1 | ||
hipace.dt = 4.4 # Time step | ||
|
||
### Simulation domain | ||
################################ | ||
geometry.coord_sys = 0 # 0: Cartesian | ||
geometry.is_periodic = 1 1 0 # Is periodic? | ||
geometry.prob_lo = -8. -8. -6 # physical domain: dimension must be provided | ||
geometry.prob_hi = 8. 8. 6 # in the respective unit system | ||
|
||
### Beam(s) | ||
################################ | ||
beams.names = beam # name(s) of the beam(s) | ||
beam.injection_type = fixed_weight # injection type: fixed_weight, fixed_ppc, or from_file | ||
beam.num_particles = 100000 # number of constant weight particles | ||
beam.position_mean = 0. 0. 0 # mean position in x,y,z in the respective unit system | ||
beam.position_std = 0.3 0.3 1.41 # rms size in x,y,z in the respecitve unit system | ||
beam.density = 3. # peak density | ||
beam.u_mean = 0. 0. 2000 # normalized mean momentum in x,y,z | ||
beam.u_std = 0. 0. 0. # normalized rms of the momentum in x,y,z | ||
|
||
### Plasma | ||
################################ | ||
plasmas.names = plasma # name(s) of the plasma(s) | ||
plasma.element = electron # type of plasma: electron, proton, or an element e.g. He | ||
plasma.density = 1. # peak density in the respective unit systems | ||
plasma.ppc = 1 1 # particles per cell in x,y | ||
|
||
### Diagnostics | ||
################################ | ||
diagnostic.diag_type = xz # 2D xz slice output. Options: xyz, xz, yz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"%matplotlib notebook\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"from openpmd_viewer import OpenPMDTimeSeries" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Replace the string below, to point to your data\n", | ||
"ts = OpenPMDTimeSeries('./diags/hdf5/')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Interactive GUI\n", | ||
"ts.slider()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"iteration = 20\n", | ||
"x, z = ts.get_particle(species='beam', iteration=iteration, var_list=['x', 'z'])\n", | ||
"F, m = ts.get_field(field='Ez', iteration=iteration)\n", | ||
"plt.figure()\n", | ||
"plt.imshow(F, extent=m.imshow_extent, origin='lower')\n", | ||
"plt.scatter(x, z, color='k', s=.02)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |