Commit graph

57 commits

Author SHA1 Message Date
6b96d56c9d Init for edges changed. Now, input 2026-02-13 10:58:31 +01:00
58e2fa7566 Working towards compilation with submodules 2026-02-09 13:52:52 +01:00
fbbb0d5d13 fPsi functions for edges
I need to make a common module for mesh, many functions for elements are
shared.

Also, try to reduce the 'select type' statements, but I don't know
enough Fortran for it.
2026-02-05 15:30:50 +01:00
3d7b1ce476 Fixed!
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)
2025-08-03 22:14:19 +02:00
7e193b9fa8 Minor changes, no improvement made yet 2025-08-03 15:32:55 +02:00
fb9d1ad837 Update moduleMesh2DCyl.f90
This is not needed.
2024-07-11 16:44:29 +00:00
72dd3c9073 I think I have it
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).
2024-07-11 17:40:57 +02:00
bc8f205287 Clean-up!
Trying to reduce warnings and unused variables in the code. This should
not be in this branch.
2024-07-11 15:55:02 +02:00
667a2ecd93 So, no idea...
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.
2024-07-09 21:57:32 +02:00
11831a973d Still not working
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...
2024-07-09 21:25:30 +02:00
b36f9c2615 Shifting towards constant number of particles per edge
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.
2024-07-09 17:49:42 +02:00
626e970d82 Some progress
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
2024-07-06 19:14:44 +02:00
6b5ac16e4b Still working on it
No uniform density yet...
2024-07-06 10:12:03 +02:00
b972120ed5 Switching to variable particle weight
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.
2024-07-04 10:56:13 +02:00
6b78ae3738 Added an adhoc factor to correct injection
I think that the volume of the nodes is not being well calculated, maybe
we need a better volume calculation for this, using multiple points (as
it is done for K)
2024-07-03 22:04:28 +02:00
e277fe6ddb PI is no needed here 2024-06-30 08:48:51 +00:00
59a322a4c7 Clean up
Fixing calculation of node volumes.
2024-06-30 10:46:05 +02:00
cd7bf66bd8 A workaround
The random position for edges in the axis is corrected so that there is
a more uniform charge density in the axis.

Still, things are not perfect and this is something to really look into
in the future.
2024-06-30 10:36:36 +02:00
4cadfe5367 Seems are a bit better
There is still less density in the axis. I don't find a reason why.
There must be a modification to the weight...
2024-06-29 22:22:10 +02:00
5386114d15 Cylindrical injection working better
Seems things are a bit better. Still, more cases are needed and still
not perfectly uniform...
2024-06-29 14:58:48 +02:00
c6470819e8 Issue with calculating coordinates in quads
The third coordinate (unused) was causing some errors when it was
becomming too large.
2024-06-26 15:11:01 +02:00
8d35123508 First Coulomb implementation that works
After fixing all possible divisions by zero I was able to find in the
Coulomb collision I think that this is a first working implementation of
a Coulomb operator based on moments.

Still to test a few things, modify the manual but I would say that I'm
satisfiyed right now. This operator won't be used that often but maybe
improving efficiency is still needed.

In the future a binary operator is required to be able to study cases
out of Maxwellian equilibrium.
2023-07-04 17:01:02 +02:00
386ddd82dd Probes in 0 iteration
Probes are now written at the 0 iteration.

Additionally, and this shouldn't be done, some small changes to the quad
elements. This should be done in a separate commit, but I'm lazy.
2023-02-23 13:36:31 +01:00
de1d4567f3 Issue for particles in quad cell
Due to a high convergence value (1.0e-2) in phy2logQuad (variable conv),
    particles were being stuck in some elements, reaching a segmentation
    fault. The new limit (1.0e-4) should avoid this.
2023-02-09 15:32:04 +01:00
f86641110c Issue in connectivity between Quad elements
For unstructured meshes, the quad elements where not being propertly
connected as not all possibilities were tested. This should be fixed
now.
2023-02-09 12:15:18 +01:00
7ce1b7a4dd Reducing overhead when no collisions are present
Particles are added to lists only if there are MCC collisions. Hopefully
this will reduce overhead when OpenMP is used and no collisions are
active.
2023-01-07 12:12:37 +01:00
746c5bea09 First step of performance improvement
Finalysing first step of performance improvement focusing on reducing
iteration CPU time by improving calculation of basic element functions,
which took a lot of the CPU time
2023-01-06 21:02:54 +01:00
7b7a5c45ca Small improvement
Very small improvement in performance.

Still, partialDer takes too long to compute.
Trying to find ways to improve it.
2023-01-06 15:18:04 +01:00
ba272de4e3 DOES NOT COMPILE: Break
Small break of changing functions.
Still some geometries to change.
2023-01-06 12:16:54 +01:00
7f6afd6a87 Mark_1
First thing that I am kinda happy with.

Still some things to improve but at least push is good.
2023-01-05 22:43:51 +01:00
15d64f3e68 Passing nNodes as argument
It seems that this improves results as passing the size of the arrays as
an argument is better than getting it from self.
2023-01-05 21:22:13 +01:00
6f24b5f1f6 Small changes before trying something big
I think that creating arrays with self%nNodes takes a lot of time.
I'm trying now to pass the number of nodes as argument.
2023-01-05 20:32:45 +01:00
26bd73597d Small improvement for 2DCyl
Nothing important, but overhead in dPsi has been reduced.
2023-01-05 18:47:33 +01:00
2486ef6316 Reduction in pushing
Reduction in 10-20% of time spend in pushing in 2DCyl thanks to
rewriting fPsi and dPsi.
2023-01-05 16:47:13 +01:00
0db76083ec fPsi no longer allocates memory
I noticed that phy2logquad had a lot of overhead. Trying to reducing it
by simplifying calls to fPsi, dPsi and such.

The function for fPsi has been made so no memory is allocated and works
under the assumption that the input array has the right size (1:numNodes)
2023-01-01 12:12:06 +01:00
a8bea6102f Final commit for volume nodes
1D Rad is fixed.

Still there might be an issue with the triangles in 2D Cyl.
2022-12-24 11:41:12 +01:00
dd1fca3fee Fix for node volume
An issue in the node volume calculation in cylindrical coordinates was
found. This was causing wrong conservation of current. Still to test
with ALPHIE_Grid case.

Still to check triangular element.
Still to theck 1D radial geometry
2022-12-20 15:51:43 +01:00
23e2fe9bae I'm dying with hay fever but I have to commit
I'm feeling awful but I have work in my desktop that I need to commit so
I can work with my laptop while I'm at the IEPC 2022 in Boston.
2022-06-10 16:07:14 +02:00
cbb5fe0bf2 Merge branch 'feature/collisionPairs' into feature/electromagnetic
Merging branches and fixing a number of important issues:

- Initial particles were not being assigned to the list of particles.

- List of particles was being erased every iteration, even if species
  was not pushed.

These caused issues with the calculation of collisions when a species
was frozen.

Now, things should work properly. All particles are properly added to
the volume list and the list is erased ONLY if the species has been
updated.

I hope that collisions are now properly accounted for per species pair.
2022-04-23 20:48:34 +02:00
4e9514876e Number of collisions per collision pair
Now the number of collisions is calculated per species pair. This allows
that the randomly particles selected for collisions do not have
collisions assigned.
2022-04-23 19:00:33 +02:00
78a97ed7a0 Improve to collisions
Improvement into the collision model to better compute number of
particles collisions.
2022-04-23 18:57:27 +02:00
8006f9d768 First EM pusher
First implementation of Electromagnetic pusher.

Some testing is still required.

Documentation needs to be upgraded to match the changes in this branch.
2022-04-09 08:57:06 +02:00
9af3429395 Issue with random position in volumes
Fixed an issue in which  the position in triangular an thetrahedron
elements were not correctly being computed.

Other minor issues fixed:
  - Units in input file now do not use '/'.
  - Collisions accuratly conserve momentum.
  - Minor improvements in mass calculation in collisions.
2021-05-24 12:37:16 +02:00
35bd61fda9 Common scatter subroutine
All subroutines of scattering particle properties to the nodes of a
volume have been converged into one in moduleMesh.
2021-04-21 23:40:58 +02:00
a681b9f533 0D Grid geometry
Implementation of the 0D grid to test collisional processes.

An OMP_LOCK was added to the nodes to properly write perform the
scattering (it is weird that multiple threads work in the same node at
the same time, but in 0D happens everytime).

Added a new case to test the 0D geometry.

User Manual updated with the new options.
2021-04-13 21:48:44 +02:00
e25b567d36 Now the initial state has the same format as the mesh file, i.e., is
easy to use a file from a previous run without processing it into a
plain text file.

Although the previous method presented some updates for 1D small cases,
this is quite easy to do with any type of simulations and, in the
future, with different mesh formats.
2021-04-13 16:55:50 +02:00
a2631f6b78 Impliementation of a collision mesh which is independent for the mesh
used to scatter particles and compute the EM field.
2021-04-03 09:20:46 +02:00
3f91d9e1ed Reading of mesh files has been made independent from geometry and
prepared to accept different formats.
2021-03-29 09:45:51 +02:00
46348c86ee Improved some general things using pointers. 2021-03-28 16:52:01 +02:00
ec128902ad The integer part%sp that referenced the species index has been
substituted for a pointer to the species.
2021-03-28 15:55:26 +02:00