Skip to Content.
Sympa Menu

opal - RE: [Opal] 3DElectroStatic

opal AT

Subject: The OPAL Discussion Forum

List archive

RE: [Opal] 3DElectroStatic

Chronological Thread  
  • From: Daniel Winklehner <winklehn AT>
  • To: masao nakao <nakaom AT>, "Gsell Achim (PSI)" <achim.gsell AT>
  • Cc: "opal AT" <opal AT>
  • Subject: RE: [Opal] 3DElectroStatic
  • Date: Mon, 28 Sep 2020 15:29:02 +0000
  • Accept-language: en-US

Dear Masao,

We recently discovered some issues with the ArbitraryDomain class and had to
deactivate it in the OPAL 2.4 release. We are working on fixing the problems
and will hopefully have it back online in 2.6.


Daniel Winklehner
Research Scientist
Massachusetts Institute of Technology
Laboratory for Nuclear Science
Phone: +1 617 715 4280
Email: winklehn AT

-----Original Message-----
From: opal-request AT <opal-request AT> On Behalf Of
masao nakao
Sent: Monday, September 28, 2020 10:48
To: Gsell Achim (PSI) <achim.gsell AT>
Cc: nakaom AT; opal AT
Subject: Re: [Opal] 3DElectroStatic

Dear Achim,

Thank you for your kindly reply about SAAMG and vtk2h5grid.
I have installed vtk and vtk2h5grid and converted mesh file of inflector to
h5 file.
Then, I found that OPAL returns error such as:

Error> *** User error detected by function
Error>     This domain is currently not available.
Error>     This domain is currently not available.
application called MPI_Abort(MPI_COMM_WORLD, -100) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=-100
system msg for write_line failure : Bad file descriptor

I have attached the OPAL input file to this email.

Yours  sincerely,

On 2020/08/18 17:15, Gsell Achim (PSI) wrote:
> Dear Masao
>> On 18 Aug 2020, at 08:10, masao nakao <nakaom AT
>> <mailto:nakaom AT>> wrote:
>> Dear Achim,
>> I would like to simulate an AVF cyclotron injection system using
>> inflector electrodes. And so far I have been able to simulate the
>> case where a single particle can be injected into the central plane
>> with the electric field calculated by TOSCA.
>> Next, I would like to calculate including the space-charge effect at
>> an injection current of ~10 mA. I was able to save the mesh shape of
>> the inflector electrodes as a vtk file, but I have to convert it to
>> h5block format and input it to OPAL. Can you tell me how to convert
>> vtk to h5block format and input it to OPAL?
> H5hut includes a converter. Unfortunately you have to compile it
> yourself. Here is a short recipe to compile H5hut with the converter:
> * compile/install a serial(!) version of HDF5 1.8 or 1.10
> (
> * compile/install VTK 8.2 (
> * clone the H5hut repository (
> * configure H5hut with (replace *_PREFIX with the installation
> directories of HDF5, VTK)
> configure --enable-vtkconverter --with-hdf5=HDF5_PREFIX
> --with-vtk=VTK_PREFIX
> * compile & install
> make && make install
> * convert your (legacy!) VTK file
> vtk2h5grid FILENAME
> If you have problems compiling the converter, I can convert the file
> for you.
> Best
> Achim
>> Thank you.
>> Yours, sincerely,
>> Masao
>> On 2020/03/20 21:41, Daniel Winklehner wrote:
>>> Dear Masao,
>>> Yes, you can do it, but it requires some fiddling around at the moment.
>>> The most important question is: what beam current are you
>>> simulating? Is space charge an important factor or not so much?
>>> If space charge is very important for your application, you will
>>> have to compile OPAL with the SAAMG option ON. To my knowledge,
>>> there is no binary package that supports usage of the SAAMG solver
>>> that you can just download, but Achim can correct me on that.
>>> If space-charge is unimportant, you can use the OPAL 2.2 binary.
>>> In both cases, you will need to prepare the electric AND magnetic
>>> fields as 3D fieldmaps in the center of the cyclotron as *.h5part
>>> format files. OPAL-cycl, by default, uses the midplane field only
>>> and gets the z =/= 0 components from a series expansion. For the
>>> electrostatic inflector, you will need a more accurate field
>>> description along the spiral trajectory. There have been some email
>>> list discussions recently on how to transform 3D field data from
>>> ANSYS/TOSCA/COMSOL to h5part using a C script called
>>> ascii2h5part.cpp. I am using python with h5py, which works too. See
>>> attached for electrostatic case. Resulting fields can be checked
>>> with VisIt 3.1.1.
>>> The fields can be loaded into OPAL-cycl by using the BANDRF type
>>> cyclotron and loading the fields as RF cavity fields with frequency
>>> = 1e-36 (i.e. static fields) and RFPHI = 0.0 and PI/2 for electric
>>> and magnetic fields, respectively. The units for these fields should
>>> be kV/mm (MV/m) and mm.
>>> Finally, the geometry can be loaded as well. Firstly, as the
>>> boundary for particle termination, if you are interested in the
>>> losses. Secondly, as the boundary conditions for the SAAMG field
>>> solver (if you are using it). For geometry preparation, you will
>>> need the "negative" or "vacuum" space rather than the individual
>>> electrodes. This is described in the paper you mentioned. Just
>>> create a cylinder that encloses all your electrodes (maybe start
>>> with just the spirals) and subtract the electrodes from the cylinder
>>> as a Boolean operation in the program of your choice. Inventor
>>> works, so does FreeCAD (which is open source). Save as iges, stp,
>>> etc. and open in GMSH. In gmsh, you can mesh your geometry and save
>>> the mesh as vtk. Achim write a C++ program that translates vtk to
>>> h5block, which is the format OPAL needs for geometry.
>>> If you do use SAAMG, you have to use the "SPIRAL" cyclotron type
>>> instead of BANDRF.
>>> I will write up better instructions for the whole process over the
>>> weekend and provide a simple example input deck to help along with
>>> getting started on this non-trivial process.
>>> Best,
>>>    Daniel
>>> -----Original Message-----
>>> From: opal-request AT <mailto:opal-request AT>
>>> <opal-request AT <mailto:opal-request AT>> On
>>> Behalf Of masao nakao
>>> Sent: Friday, March 20, 2020 07:44
>>> To: opal AT <mailto:opal AT>
>>> Cc: nakaom AT <mailto:nakaom AT>
>>> Subject: [Opal] Fwd: 3DElectroStatic
>>> Dear OPAL developers,
>>> I would like to simulate injection system of AVF cycltoron with
>>> electrostatic inflector.
>>> Though OPAL manual shows 3DElectroStatic is "Not implemented
>>> yet."(p.173), a paper [1] shows results by OPAL. How can I calcurate
>>> like that? I have 3D electric field data culculated by TOSCA.
>>> Thank you.
>>> [1] "Realistic simulations of a cyclotron spiral inflector within a
>>> particle-in-cell framework"
>>> Daniel Winklehner et al.
>>> Yours, sincerely,
>>> Masao
>>> --
>>> Masao Nakao
>>> Osaka University
>>> Research Center for Nuclear Physics
>>> Mail : nakaom AT <mailto:nakaom AT>
>>> Phone: 06-6879-8914
>>> FAX  : 06-6879-8899
> Senior Scientist
> Paul Scherrer Institut
> Laboratory for Scientific Computing and Modeling
> OHSA/D04
> 5232 Villigen PSI

中尾 政夫 (Nakao Masao)
群馬大学 重粒子線医学研究センター
Mail : nakaom AT
電話 : 027-220-8378
FAX  : 027-220-8379
携帯 : 070-7774-6423
内線 : 23755

Archive powered by MHonArc 2.6.19.

Top of Page