Skip to Content.
Sympa Menu

opal - Re: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

Re: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation


Chronological Thread  
  • From: "Calvo Portela, Pedro" <Pedro.Calvo AT ciemat.es>
  • To: "opal AT lists.psi.ch" <opal AT lists.psi.ch>, 陈汐 <chenxi AT impcas.ac.cn>
  • Subject: Re: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation
  • Date: Tue, 10 Dec 2024 09:48:36 +0000
  • Accept-language: es-ES, en-US

Dear XiChen


The geometry is indeed an OPAL feature that is still experimental and needs to be refined. However, it can be used as an element for particle termination. Its integrated employment within the Field solver (SAAMG solver) may present some issues, but it is also available in the latest version of OPAL.

The use of the GEOMETRY command for particle termination is directly included, so you don't have to do anything special in the OPAL compilation. If you want to include SAAMG solver you must install some extra libraries (see https://gitlab.psi.ch/OPAL/src/-/wikis/For%20Developers/Supported-OS-and-required-Software-to-build-OPAL), and add the ENABLE_SAAMG_SOLVER flag in the OPAL compilation (https://gitlab.psi.ch/OPAL/src/-/wikis/For-Developers/Compile-OPAL).

Adding arbitrary geometries to OPAL-cycl requires a careful preparation. OPAL can only handle a geometry for “vacuum space”. Thus, the initial CAD model of the accelerator or any component has to be modified to obtain an inverted solid created by the subtraction of all elements from the geometry. This ’vacuum space’ is exported to *.step format and meshed using GMSH. I have applied the following meshing process with very satisfactory results: 1D->2D->3D->2x Refine by splitting. The meshed geometry is saved into a *.vtk file and converted it into *.h5 format through a vtk2h5grid program, specifically created by the OPAL developer team.

One of the drawbacks is that the vtk2h5grid program is obsolete. In order to use it, you must download the OPAL-1.4.0-1 version (https://gitlab.psi.ch/OPAL/src/-/wikis/OPAL-binary-package-old-versions). vtk2h5grid is included in the binary version, so you could use the opal bin executable (source OPAL-1.4.0-1/etc/profile.d/opal.sh) to skip the compilation from source. To use vtk2h5grid you need to compile hdf5 and H5Hut in a specific way. hdf5 must be compiled with parallel environment, and H5Hut should include a flag to enable the compilation of vtk converter. I attached some scripts with the build recipe that I employed. You could adapt it to your case. The program is very simple and it runs adequately if there was not errors in the meshing process: vtk2h5grid GeomFile.vtk
The use of this deprecated version of OPAL is only for this step of the process. Once you have the geometry file in vtk format, you can use it in the latest OPAL release.

There is a recent option (ENABLEVTK) to save run time when geometry is included (see https://amas.web.psi.ch/opal/Documentation/master/#sec.control.option).

I realize that these instructions are a bit confusing and that OPAL needs to improve on this. We are working on it. If you have any doubts with the geometry generation process, don't hesitate to write me

Best regards
Pedro


-----------------------------------------------
Dr. Pedro Calvo Portela
Particle Accelerator Unit
Technology Department
CIEMAT - Av. Complutense 40, 28040 Madrid (Spain)
Tel: (+34) 914962542 / ext. 362542



De: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> en nombre de 陈汐 <chenxi AT impcas.ac.cn>
Enviado: martes, 10 de diciembre de 2024 3:57
Para: opal AT lists.psi.ch
Asunto: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation
 


Dear Sir/Madam,


I am currently working on simulating the spiral inflector and central region of a cyclotron accelerator using the OPAL. To calculate the beam loss, I need to import the geometry of the spiral inflector electrode and central region into my simulation.

In OPAL, I understand that the GEOMETRY command  can be used to import geometry file information in H5hut file (e.g., Geometry, FILE="input.h5"). In the paper "Realistic Simulation of Cyclotron Spiral Inflector within a Particle-in-Cell Framework", it is mentioned that the geometry can be meshed using GMSH software. However, I could not find any detailed explanation on how to convert the GMSH-generated mesh into an H5hut file for use in OPAL simulations. 


Additionally, I was unable to find relevant information in the OPAL manual (Chapter 20 Geometry)  regarding this conversion.


Could anybody kindly share any methods or tools that convert a GMSH mesh into an H5hut file? Any insights or advice would be greatly appreciated.

Thank you very much for your time and consideration. I look forward to your response.

Best regards,

Xi Chen




Xi Chen
Institute of Modern Physics, Chinese Academy of Sciences (IMP/CAS)
509 Nanchang Road, Lanzhou, Gansu, 730000, China
Tel: +8618759079398









Archive powered by MHonArc 2.6.24.

Top of Page