diff --git a/doc/user-manual/bibliography.bib.sav b/doc/user-manual/bibliography.bib.sav new file mode 100644 index 0000000..b8b6483 --- /dev/null +++ b/doc/user-manual/bibliography.bib.sav @@ -0,0 +1,77 @@ +% Encoding: UTF-8 + +@InProceedings{boris1970relativistic, + author = {Boris, Jay P}, + booktitle = {Proc. Fourth Conf. Num. Sim. Plasmas}, + title = {Relativistic plasma simulation-optimization of a hybrid code}, + year = {1970}, + pages = {3--67}, +} + +@article{higginson2020corrected, + title={A corrected method for Coulomb scattering in arbitrarily weighted particle-in-cell plasma simulations}, + author={Higginson, Drew Pitney and Holod, Ihor and Link, Anthony}, + journal={Journal of Computational Physics}, + volume={413}, + pages={109450}, + year={2020}, + publisher={Elsevier} +} + +@Misc{gfortranURL, + author = {GNU Project}, + title = {gfortran - the GNU Fortran compiler}, + howpublished = {\url{https://gcc.gnu.org/wiki/GFortran}}, +} + +@Misc{ifortURL, + author = {Intel\textsuperscript{\textregistered}}, + title = {Intel\textsuperscript{\textregistered} Fortran Compiler}, + howpublished = {\url{https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/fortran-compiler.html}}, +} + +@Misc{openblasURL, + title = {OpenBLAS, an optimized BLAS library}, + howpublished = {\url{https://www.openblas.net/}}, +} + +@Misc{jsonfortranURL, + title = {JSON-Fortran}, + howpublished = {\url{https://github.com/jacobwilliams/json-fortran}}, +} + +@Misc{jsonURL, + title = {JSON, JavaScript Object Notation}, + howpublished = {\url{https://www.json.org/json-en.html}}, +} + +@Misc{gmshURL, + author = {Christophe Geuzaine and Jean-François Remacle}, + title = {Gmsh}, + howpublished = {\url{https://gmsh.info/}}, +} + +@Article{welford1962note, + author = {Welford, BP}, + journal = {Technometrics}, + title = {Note on a method for calculating corrected sums of squares and products}, + year = {1962}, + number = {3}, + pages = {419--420}, + volume = {4}, + publisher = {Taylor \& Francis}, +} + +@Article{sherlock2008monte, + author = {Sherlock, Mark}, + journal = {Journal of Computational Physics}, + title = {A Monte-Carlo method for Coulomb collisions in hybrid plasma models}, + year = {2008}, + number = {4}, + pages = {2286--2292}, + volume = {227}, + groups = {Particle-in-cell}, + publisher = {Elsevier}, +} + +@Comment{jabref-meta: databaseType:bibtex;} diff --git a/doc/user-manual/fpakc_UserManual.pdf b/doc/user-manual/fpakc_UserManual.pdf index 2453bb7..37d8014 100644 Binary files a/doc/user-manual/fpakc_UserManual.pdf and b/doc/user-manual/fpakc_UserManual.pdf differ diff --git a/doc/user-manual/fpakc_UserManual.tex b/doc/user-manual/fpakc_UserManual.tex index daf42c3..fd48ed2 100644 --- a/doc/user-manual/fpakc_UserManual.tex +++ b/doc/user-manual/fpakc_UserManual.tex @@ -708,11 +708,15 @@ make \begin{itemize} \item \textbf{species}: Character. Name of species as defined in the object \textbf{species}. - \item \textbf{file}: Character. - Output file from previous run used as an initial state for the species. - The file format must be the same as in \textbf{geometry.meshType} - Initial particles are assumed to have a Maxwellian distribution. - File must be located at \textbf{output.path}. + \item \textbf{file}: Character. + Output file from previous run used as an initial state for the species. + The file format must be the same as in \textbf{geometry.meshType} + Initial particles are assumed to have a Maxwellian distribution. + File must be located at \textbf{output.path}. + \item \textbf{particlesPerCell}: Integer. + Optional. + Initial number of particles per cell. + If not, the number of particles per cell will be assigned based on the species weight and the cell volume. \end{itemize} \end{itemize} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/modules/init/moduleInput.f90 b/src/modules/init/moduleInput.f90 index 7a1b206..e30bf97 100644 --- a/src/modules/init/moduleInput.f90 +++ b/src/modules/init/moduleInput.f90 @@ -324,7 +324,8 @@ MODULE moduleInput REAL(8):: densityCen !Mean velocity and temperature at particle position REAL(8):: velocityXi(1:3), temperatureXi - INTEGER:: nNewPart = 0.D0 + INTEGER:: nNewPart = 0 + REAL(8):: weight = 0.D0 CLASS(meshCell), POINTER:: cell TYPE(particle), POINTER:: partNew REAL(8):: vTh @@ -343,6 +344,9 @@ MODULE moduleInput !Reads node values at the nodes filename = path // spFile CALL mesh%readInitial(filename, density, velocity, temperature) + !Check if initial number of particles is given + CALL config%get(object // '.particlesPerCell', nNewPart, found) + !For each volume in the node, create corresponding particles DO e = 1, mesh%numCells !Scale variables @@ -355,7 +359,11 @@ MODULE moduleInput densityCen = mesh%cells(e)%obj%gatherF((/ 0.D0, 0.D0, 0.D0 /), nNodes, sourceScalar) !Calculate number of particles - nNewPart = INT(densityCen * (mesh%cells(e)%obj%volume*Vol_ref) / species(sp)%obj%weight) + IF (.NOT. found) THEN + nNewPart = FLOOR(densityCen * (mesh%cells(e)%obj%volume*Vol_ref) / species(sp)%obj%weight) + + END IF + weight = densityCen * (mesh%cells(e)%obj%volume*Vol_ref) / REAL(nNewPart) !Allocate new particles DO p = 1, nNewPart @@ -392,7 +400,7 @@ MODULE moduleInput partNew%n_in = .TRUE. - partNew%weight = species(sp)%obj%weight + partNew%weight = weight !Assign particle to temporal list of particles CALL partInitial%add(partNew)