So it seems that rectangles and triangles are now working properly.
I have also checked the phy2log routine, now it seems a bit more complicated, but it is much clearer.
Maybe in the future is worth rethinking to improve speed (specially for quad elements)
Now they give the right electric field.
I have to change 2DCyl.
However, there was some insonsistency between the change of coordinates in phy2log and the Jacobian for the K matrix. I fixed it putting a transpose() in phy2log, but I don't like that solution.
I need to review the basic procedure of phy2log.
After reading some works and reviewing what I had, I've done some
corrections to how the randomb velicities in Maxwellian distributions
are calculated. These should be correct now.
The Poisson equation was not working because I didn't finish
implementing the new type of BCs. Dirichlet is probably untested. I
should stop doing shitty developments and no testing.
I should've commited before, but I wanted to make things compile.
The big change is that I've added a global time step so the parameter
does not need to be passed in each function. This is useful as we are
moving towards using time profiles for boundary conditions and injection
of particles (not in this branch, but in the future and the procedure
will be quite similar)
Planning the new way to do BC in the EM field solver.
Probably I have to change how things are read, but I don't think this is
going to affect the input file.
Just some comments on how I am going to make the desired changes (have a
Dirichlet boundary condition for the electric potential that changes
with time). This might be a good opportunity to rework the boundary
conditions in the electrostatic field and include other things like a
Newmann boundary condition. We will see.
The correction in the node volume is no longer needed as now things are
being calculated right with the last change.
Still, at some point I should review the calculation of the node volume
in 2DCyl.
So the radius for the volume integral in the nodes has to be set with a
1/4 3/4 ratio to match the change in volume as the radius changes along
the volume.
This has a bigger impact close to the edge.
Still unsure if this is the "right" thing to do, but at least it works
okay (it seems).
The manual has been modified to account for the new particlePerEdge
option and to indicate that now when the flux is giving by a flux like
in the Am2 units, the real surface of the inject is used to scale it.
I rewrote how particles are injected. Now the particles per edge and its
weight are calculated in the initialization. There is the possibility
for the user to select the particles per edge.
TODO: Write documentation for new feature.
TODO: Test in 2DCyl
I made some small changes to how things are calculated.
I have also discovered that the issue with different density when
changing injection is not related with the node volume but with the way
injection is carried out. When loading particles from a file, all
provide the same density regardless the cell (node) volume.
I am doing testing in 2DCart as it is easier to set up.
Basically things do not work. I've added a correction to the node volume
in the axis which gives okays results but still this is not perfect. I
need to find a better way to do things.
Also, I've noticed that the density changes with the size of the cells,
which should not happen! I'vw to check this issue.
Trying to have a very simple volume per node assuming a rectangle and
the density at the axis it higher than it should (kinda like when using
the more accurate volume calculation).
This is still weird. I also suspect that the size of the first cell in
the axis will also affect this...
So now each edge has the same number of particles and the weight of each
particle is calculated based on the surface of each edge compared to the
total one.
Only in 2DCyl, still to extend to other geometries.
Not perfect constant density, but the issue might be the node volume.
The number of particles per cell can be defined when giving an initial
distribution fora species. If not, the typical method of using the
species weight is used. This is particularly useful for cylindrical
coordinates in which very little particles might end up in the axis if a
constant weight is used.
Fixed an issue with random integer numbers.
Cylindrical coordinates are not perfect yet:
- Box (cylinder) with initial constant density loses particles at r =
0
- Injection density still low in r = 0
I have to change the injection of particles. Each edge will receive a
similar number of particles and their weight will change to have a
constant density based on the geometry.
Still testing.