opal AT lists.psi.ch
Subject: The OPAL Discussion Forum
List archive
- From: Taufik Ssi <taufikis AT gmail.com>
- To: "Calvo Portela, Pedro" <Pedro.Calvo AT ciemat.es>, opal <opal AT lists.psi.ch>
- Subject: Re: [Opal] 3D electric fields data
- Date: Mon, 24 Feb 2020 05:20:57 -0500
- Authentication-results: localhost; iprev=pass (mail-qt1-f180.google.com) smtp.remote-ip=209.85.160.180; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com
Dear Pedro,Thank you. I have succeeded compiling ascii2h5block.cpp.I compiled it in OPAL-1.4.0-1 binary package environment by running this command "source /home/taufik/OPAL-1.4.0-1/etc/profile.d/opal.sh" before.If I set the library to OPAL-1.4.0-1 in the compile_ascii3h5block.sh file, I still got an error. Thus, in the compile_ascii3h5block.sh file, I set the library path to OPAL-2.2.0 instead of OPAL-1.4.0-1.Best regards,TaufikOn Fri, Feb 21, 2020 at 6:40 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:Hi Taufik
Respect to gcc installation, I don't know what is the problem. Maybe there are some pre-requirements...
Respect to ascii2h5block, the last days some issue about this (https://gitlab.psi.ch/OPAL/src/issues/469) has been detected. I will work on that, and told you. But it seems a problem in your path to HDF5. You have to ensure where you have installed hdf5 and put it on the path properly
PD: Remember to include the futures mails opalist in CC
Best regardsPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: viernes, 21 de febrero de 2020 11:19
Para: Calvo Portela, Pedro
Asunto: Re: [Opal] 3D electric fields data
Dear Pedro,
Thank you for spending your time for guiding me. I have tried to compile ascii2h5block using OPAL-1.4. But I still have some error related to h5_file_t file as shown in the attachment (compile_err). what should I do?
I have succeed to install up to build boost stage of section 3.2.2, but my colleague stack to the gcc installation stage as shown in the attachment(GCC error.txt). Do you know what cause this error?
Best regards
Taufik
On Fri, Feb 14, 2020 at 4:12 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Tauffik
Sorry for the delay, I was a bit busy....
To clone OPAL and compile from source you need special acces to the repository. But you don't need to do it for your purpose.
You have to follow the recipes in the links of section 3.2.2
Anyway, you can compile ascii2h5block your OPAL-1.4 binary package, and then read it with:
source /home/pedrocp/OPAL-1.4.0-1/etc/profile.d/opal.sh
After, you could change your source to other oapl version
/home/pcalvo/software/bin is the directory where i compile and install opal, you could remove this reference in your pathCheersPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: viernes, 07 de febrero de 2020 4:04
Para: Calvo Portela, Pedro
Asunto: Re: [Opal] 3D electric fields data
Dear Pedro,
in your file there is this command:export PATH=$PATH:/home/pcalvo/opal_binaries/OPAL-1.4.0-1/include/:/home/pcalvo/opal_binaries/OPAL-1.4.0-1/bin/:/home/pcalvo/opal_binaries/OPAL-1.4.0-1/lib/:/home/pcalvo/software/bin:/home/pcalvo/software/lib/:/home/pcalvo/software/include:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin/:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/pcalvo/bin/ export LD_LIBRARY_PATH=/home/pcalvo/opal_binaries/OPAL-1.4.0-1/lib/:$LD_LIBRARY_PATH export HDF5_INCLUDE=/home/pcalvo/src/hdf5-1.10.0/includewhat program/library is referred from /home/pcalvo/software/bin ?I also try to compile from beginning as you suggested, starting from section 3.2. of https://gitlab.psi.ch/OPAL/src/wikis/For-Developers/Compile-OPAL#user-content-build-everything-from-scratch ,and run this command git clone git AT gitlab.psi.ch:OPAL/build-recipes.git , but I got this message:
[taufik@localhost ~]$ git clone git AT gitlab.psi.ch:OPAL/build-recipes.git
Cloning into 'build-recipes'...
git AT gitlab.psi.ch: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[taufik@localhost ~]$Is it necessary to run git clone git AT gitlab.psi.ch:OPAL/build-recipes.git?Best regards,Taufik
On Tue, Feb 4, 2020 at 3:16 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Taufik
It seems that your are compiling wrong the file. It is not intuitive, and it was the same in my case when I started to work with OPAL.
I've developed a script to run ascii2h5block some years ago, although it is a bit rudimentary, I send you attached. You have to change the directories abd the OPAL version properly.
I think that your problem is that you have to link all the libraries in the path, and include some flags in the compilation
CheersPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: lunes, 03 de febrero de 2020 12:13
Para: Calvo Portela, Pedro
Asunto: Re: [Opal] 3D electric fields data
Dear Pedro,
I have solved the H5hut.h error but now the output of compiling ascii2h5block_asgic.cpp shown in the attachment. I think I still face some error. Do you understand how to solve this problem?If this problem can not be solved, I will try to follow your installation suggestion in https://gitlab.psi.ch/OPAL/src/wikis/For%20Developers/Compile-OPAL#user-content-build-everything-from-scratch. From which section should I started, 3.2.1 or 3.2.2?
Thank you.
Best regards,Taufik
On Mon, Feb 3, 2020 at 2:35 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Taufik
I would need to know why the installation process failed.
Anyway, to install H5hut, you have to install before some other programs that H5hut could need, as gmp, mpfr, mpc, gcc, cmake and HDF5. You have some instructions in https://gitlab.psi.ch/OPAL/src/wikis/For-Developers/Compile-OPAL, in section 3.2. To install H5hut, you could follow https://gitlab.psi.ch/OPAL/build-recipes/raw/master/090-build-h5hut
I suggest you to install all the software by terminal a directory in your home, to prevent confusion with the path
Don't hesitate to write me with any questions, and include the next doubts in the opallist mailing list, because there are more people with more knowledge about this
CheersPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: domingo, 02 de febrero de 2020 14:47
Para: Calvo Portela, Pedro
Asunto: Re: [Opal] 3D electric fields data
Dear Pedro,
I have got the electric field data as an input for ascii2h5block_asgic.cpp , in Cartesian coordinates. However I have a problem while compiling it. When I tried to compile with g++ I got this error H5hut.h: No such file or directory #include "H5hut.h". I tried to download by H5hut source from git clone https://gitlab.psi.ch/H5hut/src.git and follow the installation procedure as in this link: https://gitlab.psi.ch/H5hut/src/wikis/Installation/Installation but failed. Please help me how to install it. I just begin studying Linux for understanding Opal.
Best regards,
Taufik
On Fri, Jan 24, 2020 at 2:51 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Taufik
I send you the Matlab interpolation file. If you have any problem with interpolation, please tell me.
CheersPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: viernes, 24 de enero de 2020 0:17
Para: Calvo Portela, Pedro
Asunto: Re: [Opal] 3D electric fields data
Dear Pedro,
Ok. I would like to have the example. Please send to me.
Regards,Taufik
On Wed, Jan 22, 2020, 15:11 Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Taufik
I tell you how I get the electric field for BANDRF.
I get the data from ANSYS, and then I have to get a file compatible with ascii2h5block_asgic.cpp. So, I've develop a MATLAB program to interpolate the data to cartesian coordinates employing the properly mesh that I want for my h5part file. I could provide you an example of this file, if you need it. Then, I run cpp program with the properly limits and size of the mesh.
CheersPedro
De: Taufik Ssi [taufikis AT gmail.com]
Enviado: domingo, 19 de enero de 2020 11:37
Para: Snuverink Jochem (PSI)
CC: Calvo Portela, Pedro; opal
Asunto: Re: [Opal] 3D electric fields data
Thank you.How is the format of the electric field data from the TOSCA? Should I get the data from the TOSCA at the points of a polar coordinate and write the data in the Cartesian coordinate?
Best regards,Taufik
On Mon, Jan 13, 2020 at 10:13 PM Snuverink Jochem (PSI) <jochem.snuverink AT psi.ch> wrote:
Dear Taufik,
Please find the file attached.
Best regards,
Jochem
On 10/01/2020 08:30, Taufik Ssi wrote:
Dear Pedro Calvo Portela,
Thank you. I installed OPAL from binary distribution. In OPAL 2.0.2 version, there is src folder but it's only empty folder. Meanwhile, there is no such folder In the OPAL 2.2.0. So how to get ascii2h5block_asgic.cpp?
Best regards,
Taufik
Center for Accelerator Science and Technology -
National Nuclear Energy agency of Indonesia
On Thu, Jan 9, 2020 at 4:34 AM Calvo Portela, Pedro <Pedro.Calvo AT ciemat.es> wrote:
Dear Taufik
The file format needed in TYPE=BANDRF is h5part. You can convert any ascii data file to h5part with the cpp program found in src/tools/BandRF/ascii2h5block_asgic.cpp, in your opal directory. You have to modify the geometric limits of the region of the electric field and the mesh inside this file
Cheers
Pedro Calvo Portela
Unidad de Aceleradores - CIEMAT
Avenida Complutense 40, Edificio 7
28040 Madrid
Tel: +34 – 91 496 2554
De: opal-request AT lists.psi.ch [opal-request AT lists.psi.ch] en nombre de Taufik Ssi [taufikis AT gmail.com]
Enviado: jueves, 09 de enero de 2020 8:40
Para: opal
Asunto: [Opal] 3D electric fields dataDear All,
I want to import Dee electric fields data for cyclotron particle tracking
simulation. From OPAL manual, it can be done by using TYPE=BANDRF.
However, I am still confused about how the 3D electric field data format
should be written. Can anyone help me with this case?
Thanks,Best regards,Taufik
/* Purpose: Convert ANSIS E & B-Field data into H5hut (H5block) format for usage in OPAL. Usage: ascii2h5block efield.txt hfield.txt ehfield To visulize use Visit: https://wci.llnl.gov/codes/visit/ Ch. Wang & A. Adelmann, 2011 D. Winklehner, 2013 ToDo: make it more generic / duh -DW static2: Changed it to reflect new field files from Daniela on Sep. 15 2014 static2a: 0-Hfield for IsoDAR central region RF */ #include <fstream> #include <ios> #include <iostream> #include "H5hut.h" #include <cassert> #include <string> #include <algorithm> #include <cmath> int main(int argc,char *argv[]) { if (argc != 3) { std::cout << "Wrong number of arguments: ascii2h5block efield.txt outfield" << std::endl; exit(1); } std::string efin(argv[1]); std::string ehfout(argv[2]); std::string ehfout_c = ehfout + std::string("_CYC.h5part"); std::cout << "--------------------------------------------------------" << std::endl; std::cout << "Using " << efin << " to create " << ehfout_c << std::endl; // Open file streams std::ifstream finE; finE.open(efin.c_str()); assert(finE.is_open()); // Get number of lines int nlinesE = std::count(std::istreambuf_iterator<char>(finE), std::istreambuf_iterator<char>(), '\n'); std::cout << "Lines in finE: " << nlinesE << std::endl; // Header has 2 lines //int nlines = nlinesE; int nlines = nlinesE - 2; // Reset iterator finE.seekg(0, finE.beg); std::string templine; // Skip the 5 header lines for (int i = 0; i < 2; i++){ std::getline(finE, templine); } /* Set frequency (TODO: ask AA if this is the right thing to do for static fields -DW) */ h5_float64_t freq = 77.64e6; //77.64 MHz ->Hz h5_float64_t *FieldstrengthEz = new h5_float64_t[nlines]; h5_float64_t *FieldstrengthEx = new h5_float64_t[nlines]; h5_float64_t *FieldstrengthEy = new h5_float64_t[nlines]; /*h5_float64_t *FieldstrengthHz = new h5_float64_t[nlines]; h5_float64_t *FieldstrengthHx = new h5_float64_t[nlines]; h5_float64_t *FieldstrengthHy = new h5_float64_t[nlines];*/ // Daniela's latest files don't have the x,y,z coordinates anymore // Got the following from the readme file accompanying the fields: h5_float64_t xbegin = -200.0; h5_float64_t xend = 200.0; h5_float64_t ybegin = -200.0; h5_float64_t yend = 200.0; h5_float64_t zbegin = -15.0; h5_float64_t zend = 15.0; // Init the arrays for fields double *Ex = new double[nlines]; double *Ey = new double[nlines]; double *Ez = new double[nlines]; double X,Y,Z; /*N.B.: Daniela's files now have the structure: Bx,By,Bz; no complex numbers units are cm, V/cm and Gauss */ for (int i = 0; i < nlines; i++) { finE >> X >> Y >> Z >>Ex[i] >> Ey[i] >> Ez[i]; } finE.close(); double Emax = 0.0; double E_temp; int i_temp = 0; for (int i = 0; i < nlines; i++){ E_temp = std::sqrt(Ex[i] * Ex[i] + Ey[i] * Ey[i] + Ez[i] * Ez[i]); if (E_temp > Emax) { Emax = E_temp; i_temp = i; } } std::cout << "Hardcoded limits: x(" << xbegin << "/" << xend << ") cm" << std::endl; std::cout << "Hardcoded limits: y(" << ybegin << "/" << yend << ") cm" << std::endl; std::cout << "Hardcoded limits: z(" << zbegin << "/" << zend << ") cm" << std::endl; // Set spacing // TODO: Make program find spacing automatically -DW double spacing = 1.0; std::cout << "Hardcoded spacing: " << spacing << " mm" << std::endl; double gridPx_temp = (xend - xbegin) / spacing + 1.0; double gridPy_temp = (yend - ybegin) / spacing + 1.0; double gridPz_temp = (zend - zbegin) / spacing + 1.0; int gridPx = (int) gridPx_temp; int gridPy = (int) gridPy_temp; int gridPz = (int) gridPz_temp; int nlines_hc = gridPx * gridPy * gridPz; std::cout << "Hardcoded nlines: " << nlines_hc << std::endl; std::cout << "File nlines: " << nlines << std::endl; std::cout << "Grid dimensions: Px = " << gridPx << " , Py = " << gridPy << " , Pz = " << gridPz << std::endl; std::cout << "E_max = (" << Ex[i_temp] << ", "<< Ey[i_temp] << ", " << Ez[i_temp] << ") V/m at index " << i_temp << "." << std::endl; std::cout << "Converting from V/cm and cm to kV/mm and mm before saving h5part" << std::endl; // Here we also convert from from G to kG /*for (int i = 0; i < gridPz; i++) { for (int j = 0; j < gridPy; j++) { for (int k = 0; k < gridPx; k++) { FieldstrengthEx[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Ex[i+j*gridPz+k*gridPz*gridPy])*1e-4; FieldstrengthEy[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Ey[i+j*gridPz+k*gridPz*gridPy])*1e-4; FieldstrengthEz[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Ez[i+j*gridPz+k*gridPz*gridPy])*1e-4; FieldstrengthHx[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ex[i+j*gridPz+k*gridPz*gridPy])*1e-3; FieldstrengthHy[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ey[i+j*gridPz+k*gridPz*gridPy])*1e-3; FieldstrengthHz[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ez[i+j*gridPz+k*gridPz*gridPy])*1e-3; } } }*/ // Here we also convert from V/cm to kV/mm (MV/m) for (int i = 0; i < gridPz; i++) { for (int j = 0; j < gridPy; j++) { for (int k = 0; k < gridPx; k++) { FieldstrengthEx[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ex[i+j*gridPz+k*gridPz*gridPy])*1e-6; FieldstrengthEy[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ey[i+j*gridPz+k*gridPz*gridPy])*1e-6; FieldstrengthEz[k+j*gridPx+i*gridPx*gridPy]=static_cast<h5_float64_t>(Ez[i+j*gridPz+k*gridPz*gridPy])*1e-6; /*FieldstrengthHx[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Hx[i+j*gridPz+k*gridPz*gridPy])*1e-3; FieldstrengthHy[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Hy[i+j*gridPz+k*gridPz*gridPy])*1e-3; FieldstrengthHz[k+j*gridPx+i*gridPx*gridPy]=0.0; //static_cast<h5_float64_t>(Hz[i+j*gridPz+k*gridPz*gridPy])*1e-3;*/ } } } // Change spacing and limits from cm to mm /*spacing *= 10.0; xbegin *= 10; ybegin *= 10; zbegin *= 10; xend *= 10; yend *= 10; zend *= 10;*/ // Write h5part file for OPAL-CYC h5_err_t h5err; h5_file_t file = H5OpenFile(ehfout_c.c_str(), H5_O_WRONLY, H5_PROP_DEFAULT); H5SetStep(file, 0); h5err = H5Block3dSetView(file, 0, gridPx - 1, 0, gridPy - 1, 0, gridPz - 1); if(file) { H5Block3dWriteVector3dFieldFloat64 ( file, /*!< IN: file handle */ "Efield", /*!< IN: name of dataset to write */ FieldstrengthEx, /*!< IN: X axis data */ FieldstrengthEy, /*!< IN: Y axis data */ FieldstrengthEz /*!< IN: Z axis data */ ); h5err = H5Block3dSetFieldSpacing(file, "Efield", spacing, spacing, spacing); h5err = H5Block3dSetFieldOrigin(file, "Efield", xbegin, ybegin, zbegin); /*H5Block3dWriteVector3dFieldFloat64 ( file, /*!< IN: file handle */ /*"Hfield", /*!< IN: name of dataset to write */ /*FieldstrengthHx, /*!< IN: X axis data */ /*FieldstrengthHy, /*!< IN: Y axis data */ /*FieldstrengthHz /*!< IN: Z axis data */ /*); h5err = H5Block3dSetFieldSpacing(file, "Hfield", spacing, spacing, spacing); h5err = H5Block3dSetFieldOrigin(file, "Hfield", xbegin, ybegin, zbegin);*/ // Frequency here really in Hz ??? -DW H5WriteFileAttribFloat64 ( file, /*!< [in] Handle to open file */ "Resonance Frequency(Hz)", /*!< [in] Name of attribute */ &freq, /*!< [in] Array of attribute values */ 1 /*!< [in] Number of array elements */ ); H5CloseFile(file); } /* // Write text file for OPAL-T std::ofstream foutEH; foutEH.open(ehfout_t.c_str()); assert(foutEH.is_open()); // Change spacing and limits to cm spacing = spacing * 1.0e-1; xbegin *= 1.0e-1; ybegin *= 1.0e-1; zbegin *= 1.0e-1; xend *= 1.0e-1; yend *= 1.0e-1; zend *= 1.0e-1; // Header foutEH << "3DDynamic\tXYZ\n"; foutEH << freq*1e-6 << "\n"; // frequency in MHz foutEH << xbegin << "\t" << xend << "\t" << gridPx-1 << "\n"; //cm / cm / # foutEH << ybegin << "\t" << yend << "\t" << gridPy-1 << "\n"; //cm / cm / # foutEH << zbegin << "\t" << zend << "\t" << gridPz-1 << "\n"; //cm / cm / # // Fielddata // Here we also convert from V/cm to kV/mm (MV/m) and from G to T (NB the difference to the CYC field!) foutEH.setf(ios::scientific,ios::floatfield); foutEH.precision(5); for (int i=0; i<nlines; i++) { foutEH << Ex[i]*1e-4 << "\t" << Ey[i]*1e-4 << "\t" << Ez[i]*1e-4 << "\t"; foutEH << Hx[i]*1e-4 << "\t" << Hy[i]*1e-4 << "\t" << Hz[i]*1e-4 << "\n"; } foutEH.close(); */ std::cout << "Done, bye ..." << std::endl; std::cout << "--------------------------------------------------------" << std::endl; }
Attachment:
cyclotron2.in
Description: Binary data
Attachment:
opal_error
Description: Binary data
- Re: [Opal] 3D electric fields data, Taufik Ssi, 02/22/2020
- Re: [Opal] 3D electric fields data, Taufik Ssi, 02/24/2020
- Re: [Opal] 3D electric fields data, Calvo Portela, Pedro, 02/25/2020
- Re: [Opal] 3D electric fields data, Taufik Ssi, 02/24/2020
Archive powered by MHonArc 2.6.19.