Mailing List picongpu-users@hzdr.de Message #71
From: Khikhlukha Danila <Danila.Khikhlukha@eli-beams.eu>
Subject: RE: [PIConGPU-Users] [PIConGPU-Users] Field initializers
Date: Thu, 16 Jun 2016 10:01:02 +0000
To: picongpu-users@hzdr.de <picongpu-users@hzdr.de>
Hi Axel,
thank you for your replay. Let me please comment on your email step by step.
1. C++ 11: thanks, I'll give it a shot. At the moment I just relaxed const qualifier and initialized test array in a constructor.

2. gasFreeFormula: Thanks for a hint. In fact I was tweaking the gasFreeFormula method to get a custom longitudinal gas profile. Let me please shortly describe a task I was trying to solve. Assume one has an experimentally measured (or simulated) gas profile specified on some grid. I want to use this profile for a pic simulation. The ideal solution IMHO would be to let picongpu to read the experimental profile, store it and re-sample it in a lazy way in gasFreeFormula:: SI:: GasProfile:: operator() by using the interpolation procedure.  Since I was not sure how to read the file for the beginning  I tried to store an experimental profile explicitly as a member of the GasProfile structure.

Resampling an experimental profile externally and saving it to an HDF5 may be another option. However every time one plays with a picongpu grid the this procedure should be repeated...

3.  HDF5 reader: Sorry, my question was not very clear. Unfortunately I didn't get a chance to take a closer look to h5 file format... I was curious if a lot of threads will try to read a custom profile from a file will it impact the performance?

Thanks,
Danila.
________________________________________
From: picongpu-users@hzdr.de [picongpu-users@hzdr.de] on behalf of Huebl, Axel [a.huebl@hzdr.de]
Sent: Thursday, June 16, 2016 11:05 AM
To: picongpu-users@hzdr.de
Subject: Re:  [PIConGPU-Users] [PIConGPU-Users] Field initializers

Hi Danila,

> 1. If there is a way how to switch on the c++11 support for a
> compilation?

works only in `dev` right now, just configure (run cmake) with
  configure -c"-DCMAKE_CXX_STANDARD=11" [...]

nevertheless, this is only a *warning* and still works.
just move your "test" variable *inside* the operator() to get rid of the
error "function-scope static variables cannot be initialized".

> 2. If there is a less dirty way how to plug in a custom gas profile?
> The custom HDF5 file is mentioned in the code, however I didn't find
> the way how to use...

0.1.2:
  - componentsConfig.param: gasFreeFormula https://git.io/vo0zM
  - gasConfig.param: den(x,y,z) https://git.io/vo0z9

so you can define anything you can describe as a function
  f(x, y, z) -> density

is that not general enough?

The alternative is "gasFromHdf5" where you pre-discretize a gas profile
you want to use. I am thinking about providing a python-toolchain to
build such files in the future from primitives [1], but for now one can
simply create it with the same resolution as the planned simulation e.g.
via matlab, h5py or what ever tool can write a HDF5 file with the
density information (a very simple scalar matrix).

> BTW, is it thread safe to read a gas profile from the file?

Depends which kind of threads you refer to. PIConGPU's threads reading
the file are of course coordinated reads and save, but you should not
modify the gas profile file while PIConGPU is reading it.


Best,
Axel

[1] https://github.com/ComputationalRadiationPhysics/picongpu/issues/1502

On 14.06.2016 11:31, Khikhlukha Danila wrote:
> Dear all,
> I'm trying to tweak the gasProfile structure a bit. In fact I want to
> specify a custom 1D gas distribution.
> So currently I'm trying to initialize an array inside a gasProfile
> declaration code:
>             struct
> GasProfile
>
>
> {
>
>
>                 ....
>
>
>                 const float_64 test[10] =
> {0,1,2,3,4,5,6,7,8,9};
>
>                 DINLINE float_64 operator()( floatD_64 pos )
>                 {....
>
> The code above gives an error during the compilation
> .../simulation_defines/param/gasConfig.param(213): warning: field
> initializers are a C++11 feature
> .../simulation_defines/param/gasConfig.param(213): warning: field
> initializers are a C++11 feature
> .../simulation_defines/param/gasConfig.param(200) (col. 37): error:
> Internal Compiler Error (codegen): "function-scope static variables
> cannot be initialized!"
>
> So my questions are:
> 1. If there is a way how to switch on the c++11 support for a
> compilation? (w.r.t.
> https://github.com/ComputationalRadiationPhysics/picongpu/issues/1147)
>
> 2. If there is a less dirty way how to plug in a custom gas profile? The
> custom HDF5 file is mentioned in the code, however I didn't find the way
> how to use... BTW, is it thread safe to read a gas profile from the file?
>
> Thank you in advance,
> Danila.
>
>

--

Axel Huebl
Phone +49 351 260 3582
https://www.hzdr.de/crp
Computational Radiation Physics
Laser Particle Acceleration Division
Helmholtz-Zentrum Dresden - Rossendorf e.V.

Bautzner Landstrasse 400, 01328 Dresden
POB 510119, D-01314 Dresden
Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
          Prof. Dr.Dr.h.c. P. Joehnk
VR 1693 beim Amtsgericht Dresden

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster