Commit graph

68 commits

Author SHA1 Message Date
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
e23fc2fc2c Small progress
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.
2024-07-11 11:21:38 +02:00
9d961bb85f Removing weight from edges
This parameter is no longer needed.

Also removing the cumulative sum of weights from the injection.
2024-07-10 21:57:22 +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
4585390b50 Fixing issue
Fixing an issue with reading tables led me to other issues with
collisions that I think are fixed right now. I am testing with the 1D
ionization model for ALPHIE and things seems to be working properly.
2023-11-21 09:53:36 +01:00
e05c0d4635 Coulomb Scattering fully conservative
Coulomb scattering is now fully conservative thanks to the method in
lemos2009small.

The trick was to conserve the momentum and energy of ALL particles
involved in the scattering in each cell.

The substeps in Coulomb collisions have been removed as they are no
longer necessary.

Still some issues with e-i, but I don't know right now.
2023-07-16 14:30:49 +02:00
c3a6f77ffc Combining ij - ji collisions
In an attempt to make the operator fully conservarive I have combined ij
and ji collisions (when i/=j).

Now the matter is to find a way that makes this conserve momentum and
energy for intraspecies.
2023-07-12 15:17:26 +02:00
28b2bf206a Added the possibility to have sub-steps
Now per each Coulomb collision process there is the possibility to do
sub-steps. This helps in improving accuracy without reducing the time
step of the problem.
2023-07-12 14:21:29 +02:00
a891360b7a Still unsure, but things fixed
There was an issue with the calculation of theta and phi for the
rotation from W to C. This was causing some velocities not being
correct.

Now the angles are properly computed. Still unsure about the e-i
collisions as they seem to be quite small. Probably a numerical issue
with the mass ratios still exists.
2023-07-12 11:38:12 +02:00
f63e34e266 Not fully conservative but works
The code is still not fully conservative in intra-species collisions
(small error) but at least now is working.

I have to test species with different weight.

I have to implement a fully conservation for intra-species.
2023-07-11 18:55:20 +02:00
63fc2842be Small changes
Just some small changes to the code to improve its quality.

Nothing regarding conservation was done yet.
2023-07-11 11:22:19 +02:00
c45ffa5380 Dear various gods, finally...
I had to go back to sherlock2008montecarlo to properly understand the
change in frame of reference and how to translate that into the code.
The language there is clear and understandable for a dumb person like
me.

Now I have a Coulomb linear operator that at least works.

However, still not fully 100% conservative, need to fix this with a
correction for intra-species collisions.

I skip gym today because I was unable to focus on other things than
this.
2023-07-11 09:58:50 +02:00
d75af4bda7 Trying to implement Lemos Coulomb Scatering
I was having tones of issues with the previous implementation. I think
the problem was the velocity vector and how it was returning to the
normal reference frame.

I hope this new implementation works better.
2023-07-11 07:51:49 +02:00
a26dc04051 I hate Coulomb and his Scattering
I found no way to ensure conservation in the linear Coulomb operator.
Thus, now two collisions have to be declared if sp_i /= sp_j: collision
ij and collision ji.

This does not conserve energy so please use under your own risk, like
everything else.

Still, I think something is wrong with this implementation and I'm
really tired.
2023-07-07 16:36:31 +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
ed6c2c46e4 I'm a fucking idiot
The limit I set to avoid divisions by zero was wront and collisions were
being skipped. It is corrected now.
2023-03-29 10:08:11 +02:00
f4448d9e7a Fixed segmentation fault in Coulomb collisions
When the relative velocity between a charged particle and the background
for Coulomb collisions (W in the code) was low, there was a
segmentation fault. This is fixed now as if the norm of the relative
velocity (normW) in the code is too low, no collision is applied.
2023-03-12 17:02:12 +01:00
a70788b95d Fix an issue with compilation
Copy paste error. Now the code compiles.
2023-03-08 19:42:15 +01:00
fe94615a27 First conservative implementation of Coulomb
I am doing a trick in which I ensure that energy is conserved for
Coulomb collisions. This was not happening and what an issue for
different mass ratios. Still, this can cause an issue on getting the
right relaxation rates, still necessary to check it.
2023-03-08 16:37:45 +01:00
f8af7a8dae No progress in fixing Coulomb collisions with mass ratio
I am starting to think that the only fix is to reduce the time step, but
that is too harsh.
2023-03-07 10:10:54 +01:00
6113ac3305 Correction with conservation
Now the method is much better in conserving total energy.
However, still there is an issue with collisions between species of
dispaprate mass.
2023-03-06 16:16:17 +01:00
601103105f First attempt at Coulomb collisions
First attemp for Coulomb collisions based on the moments distribtuions.
Still the method is not done and far from being complete but input
options and basic math are implemented.
2023-02-24 21:46:01 +01: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
4e9a592982 Returning to previous version of moduleMesh.f90
Having initialization in some variables was causing issues in 1D
geometry, so I reverted the file to one working.
2023-02-10 18:53:19 +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
f5be04587a First step towards reading .vtu mesh
Just setting up the required functions.
2023-02-04 15:41:13 +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
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
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
c5c4cbefbf Output ready
Output for Gmsh2 ready.

Unfortunatly, code repetition was required.
2022-12-14 18:30:14 +01:00
ae8aa9075e Change in calculation of reduced mass and relative energy
Now reduced mass and relative energy are calculated on the fly per
collision.
2022-12-09 09:54:44 +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
5b5dadce39 Restructuring the geometry and pushers
The geometry and push structure has been reworked to allow eassy adding
new pushers.

Documentation not updated yet.

Baseline for merging Cartesian pushers into one.
2022-04-08 19:06:12 +02:00
b6a7eb9ced Adding a time step for collisions
A new option has been added in which MCC are computed with its own time
step.

If no time is provided, then the minimum time step of the simulation is
employed.
2021-06-15 10:40:13 +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
027b346a84 Copy input files to output folder
After reading the input, the code copies the JSON input file but the
mesh(es) to the output directory.
2021-04-21 16:01:01 +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
0ffdb8578a Merge branch 'development' into feature/0DGrid
Conflicts:
	src/modules/mesh/moduleMesh.f90
2021-04-13 17:46:20 +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
d2b36632c9 Implementation of 0D grid for analysis of collisional operators.
Still need to add a 0D pusher and the corresponding input configuration
and documentation.
2021-04-12 18:54:33 +02:00
cbcefb06c8 Final implementation of a specific mesh for MCC, added a case for
cylFlow that used two meshes and the User Manual has been updated.
2021-04-05 09:45:57 +02:00