osiris-code / osiris

OSIRIS Particle-In-Cell code
GNU Affero General Public License v3.0
42 stars 6 forks source link

Compiling osiris #1

Closed rl3418 closed 11 months ago

rl3418 commented 1 year ago

I'm trying to compile Osiris using intel-suite/2019.4, gcc/5.4.0, hdf5/1.10.5-parallel, mpi/intel-2018.1.163. I modified the configuration file according to my system setups, but I'm not sure where I should link the libraries -lz -ldl and a bunch of other libraries. At the moment they are linked to mpi. make returned with error as -lz and a few other libraries could not be found. I've checked that the libraries are indeed located in usr/lib64. I've attached the the configuration file and the make outputs here.

osiris_sys.log make_o.log make_e.log

rl3418 commented 1 year ago

I think the problem is that the -fast option (F90 flag) is forcing static linkage. The system was looking for libz.a which do not exist. I removed the -fast flag and compiled again. This time -ld successfully found the libraries, but I'm getting a message saying that

ld: os-dutil-hdf5.o: undefined reference to symbol 'h5t_mp_h5tclosef' /apps/hdf5/1.10.5/lib/libhdf5_fortran.so.102: error adding symbols: DSO missing from command line

rl3418 commented 1 year ago

I don't get the above error when static fortran libraries are used. For -lz I only have the shared library file. If I force the linkage for -lz to be shared, linking osiris.e fails at the last step saying that

os-stringutil.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC

But I think the -fPIC flag is already turned on in osiris/source/Makefile.wrapper

tsung1029 commented 1 year ago

Hi:

I have not looked at your compile log yet but I have the following suggestions.

(1) The libz.a library is sometimes compiled with HDF to reduce file size (it is a compression algorithm.). So if you do not have libz installed on your computer then you don't need it @ link time.

(2) I am a bit concerned about your undefined references in os-dutil-hdf5.o, that symbol does not appear inside the source code so I do not know how the error message appeared. Hopefully taking care of the above issue will fix this as well but if it doesn't please do reach out.

Frank

rl3418 commented 1 year ago

I've managed to compile the executable. But I'm a bit concerned with the warning messages. I got a message saying that

vdf/os-vdf-define.f03(1145): warning #6477: Fortran 2003 does not allow this statement or directive. !DIR$ vector nontemporal

I used intel-suite/2019.4 for fortran libraries and exectuables

rl3418 commented 1 year ago

What should I do if I want calculate some parameters and define my own variables? If I do this outside the modules, I get a message saying that '{' must follow section name.

rl3418 commented 1 year ago

I ran a few tested problems today, and I now have a basics understanding of the modules. I've got a few points that need clarification.

  1. How to calculate parameters and store my own variables? Could they be accessed within the sections?
  2. Does Osiris support GPU accelerated simulations?
  3. Is it necessary to add d0 after each value? Doesn't everything need to be converted to normalised units anyway? I don't see why we need to specify a certain value is in normalised unit.
  4. Is it possible to include By(x,t) and Bz(x,t) for a 1D simulation?

el_mag_fld below is what I used to set the external fields. ext_b_mfunc(1) behaves as expected. But if I make ext_b_mfunc(3)='if((x1>10-t),cos(0.1*(x1-t)),0.0)', ext_b3 just returns 0. I saw the same behaviour with ext_b_mfunc(2).

el_mag_fld { ext_fld = "dynamic", type_ext_b="math func", ext_b_mfunc(1:3)='if((x1>10-t),cos(0.1*(x1-t)),0.0)','0.0','0.0', }

diag_emf { ndump_fac = 5, reports = "b1",'b2','b3','ext_b1','ext_b2','ext_b3',
}

rl3418 commented 1 year ago

What is the difference between the two inputs below. The first one returned the expected field, but the other one just returned 0.

el_mag_fld { ext_fld = "dynamic", type_ext_b(3) = "math func", ext_b_mfunc(3) = 'if((x1>1.0),cos(0.1(x1-1.0-t)),0.0)', } el_mag_fld { ext_fld = "dynamic", type_ext_b="math func", type_ext_e="math func", ext_b_mfunc(1)='0.0', ext_b_mfunc(2)='0.0', ext_e_mfunc(1:3)='0.0','0.0','0.0', ext_b_mfunc(3)='if((x1>1.0),cos(0.1(x1-1.0-t)),0.0)', }

tsung1029 commented 1 year ago

Hi:

There are a lot of issues raised here and I will do my best to answer them.

(1) It is not possible to define constants inside OSIRIS input files.

(2) The GPU-enabled version of OSIRIS is under development and is not yet available in the open source repo yet. It will become widely available after the publication of the GPU paper, which is currently under preparation.

(3) I don't think it is necessary to add "d0" at the end of floating point values.

(4) It is possible to add b2(x1,t) and b3(x1,t) to 1D simulations. In 1D OSIRIS is 1D 3V and will respond to external magnetic fields along x2 and x3.

Frank

rl3418 commented 1 year ago

Okay, thanks for the clarification. You said it is not possible to define constants inside OSIRIS input files. Is there anything you recommend to do, if I want to transform the parameters from lab to the boosted frame? It involves a bit of calculations to get the transformed parameters.

jacobpierce1 commented 1 year ago

Hi rl3418,

Depending on what you are doing, you may be able to use the built-in boosted frame diagnostics. There is a tutorial written in source/boost/README.md. Right now it only works for the E and B fields and charge and current density. Boosted raw particle data is not currently supported.

Jacob

On Aug 24, 2023, at 3:16 AM, rl3418 @.***> wrote:

Okay, thanks for the clarification. You said it is not possible to define constants inside OSIRIS input files. Is there anything you recommend to do, if I want to transform the parameters from lab to the boosted frame? It involves a bit of calculations to get the transformed parameters.

— Reply to this email directly, view it on GitHub https://github.com/osiris-code/osiris/issues/1#issuecomment-1691407404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KYAKW3PFKANJRPSGEBGLXW4SZXANCNFSM6AAAAAA3BPWDUE. You are receiving this because you are subscribed to this thread.

rl3418 commented 1 year ago

Is this not available in the open source version? I don't see a boost folder under the source directory.

jacobpierce1 commented 1 year ago

Hi rl3418,

Apologies — I misread. I thought you had raised this issue with the development version of OSIRIS. The boosted diagnostics are not yet available in the open source version.

Jacob

On Aug 25, 2023, at 7:03 AM, rl3418 @.***> wrote:

Is this not available in the open source version? I don't see a boost folder under the source directory.

— Reply to this email directly, view it on GitHub https://github.com/osiris-code/osiris/issues/1#issuecomment-1693410883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KYAMBXNODUX7NOPKP5Z3XXCWCNANCNFSM6AAAAAA3BPWDUE. You are receiving this because you commented.

rl3418 commented 1 year ago

I am trying to figure out how to initialise the particles from a RAW file. The instructions from the manual is not entirely clear.

  1. Should set any variable under udist? Or do I just leave that blank?
  2. For a 1D simulation the RAW outputs have 6 datasets. ene, p1, p2, p3, q, x1. I wish to know how to set the weight of the macro-particles. q is the only dataset that I don't recognize. Does it control the macro-particle weight?
jacobpierce1 commented 1 year ago

Hi rl3418,

  1. It should work if you leave udist blank.
  2. Yes, q controls the macro-particle weight. For applications that use a uniform number of particles per cell, you would use q_j = rho_j / PPC where q_j is the charge of the jth particle, rho_j is the charge density at the position of particle j, and PPC is the number of particles per cell.

Jacob

rl3418 commented 1 year ago

Is OSIRIS capable of injecting particles from the boundary?

rl3418 commented 1 year ago

I guess the cathode module inject the particles. Is it possible to initialise the injected particles based on a input hdf5 file? I don't see the option under 'prof_type'. But can I just set init_type="file" under the species block to achieve this.