It is now complete and working. I also added some minor improvements to moduleMesh.f90 using 'associate' to practice.
I noticed there are a lot of things (allocating K, for example) that are common for all meshes and should be moved to a general module.
I was almost sure this was implemented in the past, but it was not working.
Now, if n = 0 or if n is not provided, particles are injected with the normal to the surface.
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.