Skip to content

Commit

Permalink
Fix conflicts from merging with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jderouillat committed Nov 29, 2019
2 parents 6b78ea6 + 29537ad commit 45bb3d7
Show file tree
Hide file tree
Showing 18 changed files with 1,087 additions and 446 deletions.
113 changes: 113 additions & 0 deletions benchmarks/tst3d_14_electron_sphere_field_initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
###### Namelist for the field initialization of an electron sphere in AM geometry

import math


dx = 1.
dtrans = 1.
dt = 0.8*dx
nx = 128
ntrans = 128
Lx = nx * dx
Ltrans = ntrans*dtrans
npatch_x = 8
npatch_trans = 8

# Sphere density
n0 = 1.

# Sphere position and Radius
R_sphere = 20.
center_sphere = nx*dx/2.


# normalized density of a sphere with uniform density
def nsphere_(x,y,z):
r_sq = (y-Ltrans/2.)**2+(z-Ltrans/2.)**2
if ( (x-center_sphere)**2+r_sq < R_sphere**2 ):
return n0
else:
return 0.

Main(
geometry = "3Dcartesian",

interpolation_order = 2,

timestep = dt,
simulation_time = 1.*dt,

cell_length = [dx, dtrans, dtrans],
grid_length = [ Lx, Ltrans, Ltrans],


number_of_patches = [npatch_x,npatch_trans,npatch_trans ],

clrw = nx/npatch_x,

EM_boundary_conditions = [
["silver-muller","silver-muller"],
["silver-muller","silver-muller"],
["silver-muller","silver-muller"],
],

solve_poisson = True,
poisson_max_iteration = 50000,
print_every = 100,

random_seed = smilei_mpi_rank
)



Species(
name = "electronSphere",
position_initialization = "regular",
momentum_initialization = "cold",
particles_per_cell = 8,
c_part_max = 1.0,
mass = 1.0,
charge = -1.0,
charge_density = nsphere_,
mean_velocity = [0.0, 0.0, 0.0],
pusher = "boris",
time_frozen = 0.0,
boundary_conditions = [
["remove", "remove"],
["remove", "remove"],
["remove", "remove"],
],
)



list_fields = ['Ex','Ey','Ez','Rho']


DiagFields(
every = 20,
fields = list_fields
)

DiagProbe(
every = 10,
origin = [0., Main.grid_length[1]/2., Main.grid_length[2]/2.],
corners = [
[Main.grid_length[0], Main.grid_length[1]/2., Main.grid_length[2]/2.]
],
number = [nx],
fields = list_fields
)

DiagProbe(
every = 10,
origin = [0., 0., Main.grid_length[2]/2.],
corners = [
[Main.grid_length[0], 0., Main.grid_length[2]/2.],
[0., Main.grid_length[1], Main.grid_length[2]/2.],
],
number = [nx, ntrans],
fields = list_fields
)


96 changes: 96 additions & 0 deletions benchmarks/tstAM_13_electron_sphere_field_initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
###### Namelist for the field initialization of an electron sphere in AM geometry

import math


dx = 1.
dtrans = 1.
dt = 0.8*dx
nx = 128
ntrans = 64
Lx = nx * dx
Ltrans = ntrans*dtrans
npatch_x = 8
npatch_r = 8

# Sphere density
n0 = 1.

# Sphere position and Radius
R_sphere = 20.
center_sphere = nx*dx/2.


# normalized density of a sphere with uniform density
def nsphere_(x,r):
if ( (x-center_sphere)**2+r**2 < R_sphere**2 ):
return n0
else:
return 0.

Main(
geometry = "AMcylindrical",

interpolation_order = 2,

timestep = dt,
simulation_time = 1.*dt,

cell_length = [dx, dtrans],
grid_length = [ Lx, Ltrans],

number_of_AM = 1,

number_of_patches = [npatch_x,npatch_r ],

clrw = nx/npatch_x,

EM_boundary_conditions = [
["silver-muller","silver-muller"],
["buneman","buneman"],
],

solve_poisson = True,
poisson_max_iteration = 50000,
print_every = 100,

random_seed = smilei_mpi_rank
)



Species(
name = "electronSphere",
position_initialization = "regular",
momentum_initialization = "cold",
particles_per_cell = 20,
c_part_max = 1.0,
mass = 1.0,
charge = -1.0,
charge_density = nsphere_,
mean_velocity = [0.0, 0.0, 0.0],
pusher = "boris",
time_frozen = 0.0,
boundary_conditions = [
["remove", "remove"],
["reflective", "remove"],
],
)



list_fields = ['Ex','Ey','Ez','Bx','By','Bz','Rho','Jx','Jy']

DiagFields(
every = 200,
# fields = list_fields
)


DiagProbe(
every = 200,
origin = [0., -ntrans*dtrans,0.],
corners = [ [nx*dx,-ntrans*dtrans,0.], [0,ntrans*dtrans,0.] ],
number = [nx, 2*ntrans]
)

58 changes: 31 additions & 27 deletions doc/Sphinx/namelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ The block ``Main`` is **mandatory** and has the following syntax::

.. warning::

The ``"AMcylindrical"`` geometry is currently proposed in beta version.
The ``"AMcylindrical"`` geometry has some restrictions.
Boundary conditions must be set to ``"remove"`` for particles,
``"silver-muller"`` for longitudinal EM boundaries and
``"buneman"`` for transverse EM boundaries.
Vectorization, collisions, scalar diagnostics, Poisson solver and
Vectorization, collisions, scalar diagnostics and
order-4 interpolation are not supported yet.

.. py:data:: interpolation_order
Expand Down Expand Up @@ -643,9 +643,9 @@ Each species has to be defined in a ``Species`` block::
:type: A python list of integers.

This list sets the number of evenly spaced particles per cell per dimension at their initial positions.
The size of the list must be the simulation particle dimension. It can be used only if `position_initialization` is set to `regular`.
The product of the elements of the provided list must be equal to `particles_per_cell`.
This list sets the number of evenly spaced particles per cell per dimension at their initial positions.
The numbers are given in the order [`Nx`, `Ny`, `Nz`] in cartesian geometries and [`Nx`, `Nr`, `Ntheta`] in `AMcylindrical` in which
case we advise to use :math:`Ntheta \geq 4\times (number\_of\_AM-1)`.

Expand Down Expand Up @@ -1024,7 +1024,7 @@ Each particle injector has to be defined in a ``ParticleInjector`` block::
:default: ``tconstant()``

The temporal envelope of the injector.

----

.. rst-class:: experimental
Expand All @@ -1034,8 +1034,9 @@ Each particle injector has to be defined in a ``ParticleInjector`` block::
Particle Merging
^^^^^^^^^^^^^^^^

The macro-particle merging method is documented in the :doc:`corresponding page <particle_merging>`.
It is defined in the ``Species`` block::
The macro-particle merging method is documented in
the :doc:`corresponding page <particle_merging>`.
It is optionnally specified in the ``Species`` block::

Species(
....
Expand All @@ -1055,19 +1056,20 @@ It is defined in the ``Species`` block::

.. py:data:: merging_method
:default: ``None``
:default: ``"none"``

The particle merging method to use:

* ``none``: the merging process is not activated
* ``vranic_cartesian``: merging process using the method of M. Vranic with a cartesian momentum space decomposition
* ``vranic_spherical``: merging process using the method of M. Vranic with a spherical momentum space decomposition
* ``"none"``: no merging
* ``"vranic_cartesian"``: method of M. Vranic with a cartesian momentum-space decomposition
* ``"vranic_spherical"``: method of M. Vranic with a spherical momentum-space decomposition

.. py:data:: merge_every
:default: ``0``

The particle merging time selection (:ref:`time selection <TimeSelections>`).
Number of timesteps between each merging event
**or** a :ref:`time selection <TimeSelections>`.

.. py:data:: min_particles_per_cell
Expand All @@ -1091,38 +1093,38 @@ It is defined in the ``Species`` block::
:default: ``[16,16,16]``

The momentum space discretization.
A list of 3 integers defining the number of sub-groups in each direction
for the momentum-space discretization.

.. py:data:: merge_discretization_scale
:default: ``linear``
:default: ``"linear"``

The momentum discretization scale. The scale can be ``linear`` or ``log``.
The ``log`` scale only works with the spherical discretization for the moment.
In logarithmic scale, Smilei needs a minimum momentum value to avoid 0.
This value is provided by the parameter ``merge_min_momentum``.
By default, this value is set to :math:`10^{-5}`.
The momentum discretization scale:: ``"linear"`` or ``"log"``.
The ``"log"`` scale only works with the spherical discretization at the moment.

.. py:data:: merge_min_momentum
:default: ``1e-5``

:red:`[for experts]` The minimum momentum value when the log scale is chosen (``merge_discretization_scale = log``).
To set a minimum value is compulsory to avoid the potential 0 value in the log domain.
:red:`[for experts]` The minimum momentum value when the log scale
is chosen (``merge_discretization_scale = log``).
This avoids a potential 0 value in the log domain.

.. py:data:: merge_min_momentum_cell_length
:default: ``[1e-10,1e-10,1e-10]``

:red:`[for experts]` The minimum momentum cell length for the discretization.
If the specified discretization induces smaller momentum cell length,
then the number of momentum cell (momentum cell size) is set to 1 in this direction.
:red:`[for experts]` The minimum sub-group length for the momentum-space
discretization (below which the number of sub-groups is set to 1).

.. py:data:: merge_accumulation_correction
:default: ``True``

:red:`[for experts]` Activation of the accumulation correction (see :ref:`vranic_accululation_effect` for more information). The correction only works in linear scale.
:red:`[for experts]` Activates the accumulation correction
(see :ref:`vranic_accululation_effect` for more information).
The correction only works in linear scale.



Expand Down Expand Up @@ -2422,8 +2424,8 @@ The full list of available scalars is given in the table below.
+----------------+---------------------------------------------------------------------------+
| **Space- & time-integrated Energies lost/gained at boundaries** |
+----------------+---------------------------------------------------------------------------+
| | Ukin_bnd | | Kinetic contribution exchanged at the boundaries during the timestep |
| | Uelm_bnd | | EM contribution exchanged at boundaries during the timestep |
| | Ukin_bnd | | Time-accumulated kinetic energy exchanged at the boundaries |
| | Uelm_bnd | | Time-accumulated EM energy exchanged at boundaries |
| | | | |
| | PoyXminInst | | Poynting contribution through xmin boundary during the timestep |
| | PoyXmin | | Time-accumulated Poynting contribution through xmin boundary |
Expand Down Expand Up @@ -2525,7 +2527,9 @@ This is done by including a block ``DiagFields``::
In ``AMcylindrical`` geometry, the ``x``, ``y`` and ``z``
indices are replaced by ``l`` (longitudinal), ``r`` (radial) and ``t`` (theta). In addition,
the angular Fourier modes are denoted by the suffix ``_mode_i`` where ``i``
is the mode number. In summary, the list of fields reads as follows.
is the mode number.
If a field is specified without its associated mode number, all available modes will be included.
In summary, the list of fields reads as follows.

.. rst-class:: nowrap

Expand Down
Loading

0 comments on commit 45bb3d7

Please sign in to comment.