[mcstas-users] [McStas 2.7] Pol_FieldBox with tabled magnetic field
Erik B Knudsen
erkn at fysik.dtu.dk
Mon Dec 14 12:58:09 CET 2020
Dear Nicola,
Thank you for the report. This ought to work, but I will take another
look at the instrument you kindly supplied, and report back.
The first warning message about macros and whitespace can safely be
ignored. I merely means, that strictly speaking, the generated code does
not quite adhere to the c99-standard, in that some macros do not end up
having correct whitespace.
...but for the real issue - hang on and I will report back soon.
cheers
Erik
On 13/12/2020 17:22, MARTIN Nicolas wrote:
> Dear McStas users,
>
> I am currently trying to simulate the effect of a guide field on the
> beam polarization of a SANS instrument, using McStas 2.7 on Windows 10
> 64 bits.
>
> To that end, I calculate this field analytically on a regular 3D grid
> and export the output in an ASCII text file.
>
> This file is then used as the argument of a /Pol_FieldBox/ component.
>
>
> My test instrument is compiling well, besides the following warning message:
>
>
> C:\mcstas-2.7\lib\tools\Python\mcrun\..\mccodelib\..\..\..\optics\Pol_FieldBox.comp:
> At top level:
>
> C:\mcstas-2.7\lib\tools\Python\mcrun\..\mccodelib\..\..\..\optics\Pol_FieldBox.comp:76:19:
> warning: ISO C99 requires whitespace after the macro name
>
> ((double *)field_parameters)[2]=Bz;
>
>
> Note that this doesn't prevent me from accessing the "/Start
> simulation/" window of the /mcgui/.
>
> Although McStas seems to read the content of my field file correctly
> (number of points and step sizes are OK), I get the following error
> message when trying to perform the simulation:
>
> Opening input file 'fieldbox.dat' (Table_Read_Offset)
> interpolator_load: Axis 0: step=0.004, unique values=12220, from file
> 'fieldbox.dat'.
> interpolator_load: Axis 1: step=0.004, unique values=1110, from file
> 'fieldbox.dat'.
> interpolator_load: Axis 2: step=0.004, unique values=100, from file
> 'fieldbox.dat'.
> interpolator: file 'fieldbox.dat' with 12221 points. Space is 3D, Field
> is 3D. Using method 'kdtree'.
> interpolator_interpolate: ERROR: invalid interpolator method from file
> 'fieldbox.dat'.
>
> The result is exactly the same with the "/flipfield.dat/" file (provided
> in the "/\\mcstas-2.7\lib\data/" folder).
>
>
> My instrument and field files are attached to this e-mail.
>
>
> Has anyone already encountered this interpolator issue? Any clue to fix it?
>
> Should I arrange my input data in a different way? Use a different
> number of decimal places?
>
>
> Many thanks in advance for your help, kind regards,
>
> Nicolas
>
> _______________________________
> Dr. Nicolas MARTIN
> Laboratoire Léon Brillouin
> UMR12 CEA-CNRS
> Bât 563 CEA Saclay - p. 105
> 91191 Gif-sur-Yvette Cedex
> France
> _/E-mail:/_ nicolas.martin at cea.fr <mailto:nicolas.martin at cea.fr> /
> nicolas.martin84 at gmail.com <mailto:nicolas.martin84 at gmail.com>
>
> _______________________________________________
> mcstas-users mailing list
> mcstas-users at mcstas.org
> https://mailman2.mcstas.org/mailman/listinfo/mcstas-users
>
--
Erik Bergbäck Knudsen, Research Engineer | DTU | morituri
NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te
phone: (+45) 2132 6655 |<>-<>| salutant
More information about the mcstas-users
mailing list