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: Xi Chen <chenxi AT impcas.ac.cn>
  • To: Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es>
  • Cc: opal AT lists.psi.ch <opal AT lists.psi.ch>
  • Subject: Re: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation
  • Date: Thu, 19 Dec 2024 10:05:49 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 159.226.251.84) smtp.rcpttodomain=lists.psi.ch smtp.mailfrom=impcas.ac.cn; dmarc=bestguesspass action=none header.from=impcas.ac.cn; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XF8iTC/oG/4kAY7a9jBZTMy7rzp175cFSjQm7BfpHfs=; b=XJTaXqW/g3KTz7Y1LSqLCCO97AAfW/wXED+Rh33sfkjUoWLR+YKYtVnPlyxqASz1cmrsRPEwuvOjT+uHduUnKy1r6RHRCD0ZSy4GzUmd2oO+WhBDslq4AeeAHjAyw4Hhhayuwfo1MCA0y+iljMqum8FEsTCc8dB/VmJA0jBwAR/Vrq1jNe2w6HdxJ2yvLH2rU/gnqFQy3R92gNImk8ybMyETmQ9Y9BOy9BLD5YSKYGO4vsGaj629gyqKvMAfu9GTc/Y3agTmwHbTVu607DTIqApGnZrIb6Jyn3qlgkegQsbMSkIxSfFMG/vU/yXUqiJ6bVo5O/1VOC3EUOLZCz6ZBg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fKiIgvvkVGngoGa0wVc7qwi3Gi+OKgbMGLDrJHHSZM7EkWfqjiPVVqAFbpxHGuZzRlQFG/frZl3JNGg/lElYSgJh3fJkQqj1EtyfhHnr9wE4WNtjoF6RxnTizzGeraFpcYFYeLNxiWF08Ydrent4oqsGafFvstcHWiCCf6PkJBzT154ZDbrPVgxSaGX61VDZCqiEOBjbNcLTPOvu1BhwgXwos0Ci/ZrhyMO7AMPPCZKBpqsM/hAW/rR+2i3C7GsZ4fc6UYw4pzKDGaMPNOqXauHVUjaJtc20xkYcFu6O/OrrbjOd46yuyRogh/MMBJnw9cxWVVH8F09wSmQqtKoSKg==
  • Authentication-results: spf=pass (sender IP is 159.226.251.84) smtp.mailfrom=impcas.ac.cn; dkim=none (message not signed) header.d=none;dmarc=bestguesspass action=none header.from=impcas.ac.cn;compauth=pass reason=109

Dear Pedro,

Thanks for your method to use GEOMETRY command. I have successfully imported the geometry of the central region of the cyclotron into OPAL using the method you suggested, and it works well. However, I have encountered two issues that I would appreciate your guidance on:

Voxel Mesh Size Adjustment:
When I open the testBBox.vtk file exported with the ENABLEVTK option, I find that the voxel mesh size is too large. To improve the accuracy of the geometry, I would like to reduce the size of the voxel mesh. Could you please advise on how to adjust the voxel mesh resolution in OPAL?

Error with SAAMG Solver:
While using the SAAMG solver, I encounter the following error:

*** User error detected by function "ArbitraryDomain::ArbitraryDomain()"
Error> This domain is currently not available.
Error> This domain is currently not available.

This error does not occur when using other solvers.

Any insights or suggestions would be greatly appreciated.

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
---- Replied Message ----
FromCalvo Portela, Pedro<Pedro.Calvo AT ciemat.es>
Date12/10/2024 17:49
Toopal AT lists.psi.ch<opal AT lists.psi.ch>,
陈汐<chenxi AT impcas.ac.cn>
SubjectRe: [Opal] Inquiry on Converting GMSH Mesh to H5hut File for OPAL Simulation

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