Skip to Content.
Sympa Menu

opal - RE: [Opal] Arrays and tables

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

RE: [Opal] Arrays and tables


Chronological Thread 
  • From: "Snuverink Jochem (PSI)" <jochem.snuverink AT psi.ch>
  • To: "Adelmann Andreas (PSI)" <andreas.adelmann AT psi.ch>, Simon Friederich <sifriede AT uni-mainz.de>
  • Cc: "opal AT lists.psi.ch" <opal AT lists.psi.ch>
  • Subject: RE: [Opal] Arrays and tables
  • Date: Fri, 7 Aug 2020 13:40:02 +0000
  • Accept-language: en-US, de-CH

Dear Simon,

 

As Christof wrote in the bug report, the correct syntax is “REAL VECTOR= {};

I am not aware of the option of 2D-arrays.

 

So perhaps then:

 

REAL VECTOR volts = {7.5, 8.0, 8.5, 9.0, 9.5};

REAL VECTOR lags = {239.32815,... };

pb1: RFCAVITY, ...., VOLT = volts[0] * 1e-3, LAG = lags[0] * PI / 180, ...;

 

Note that you can also do:

 

REAL VECTOR volts = {7.5, 8.0, 8.5, 9.0, 9.5} * 1e-3; // in MV

REAL VECTOR lags = {239.32815,... } * PI / 180; // in rads

 

pb1: RFCAVITY, ...., VOLT = volts[0], LAG = lags[0], ...;

 

Best wishes,

Jochem

 

From: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> On Behalf Of Adelmann Andreas (PSI)
Sent: Freitag, 7. August 2020 08:33
To: Simon Friederich <sifriede AT uni-mainz.de>
Cc: opal AT lists.psi.ch
Subject: Re: [Opal] Arrays and tables

 

Dear Simon, indeed it seams that he array feature is broken. 

Even a one dimensional real array does not work. I will file a bug report.

Thanks for reporting! 

 

Cheers A

------
Dr. sc. math. Andreas (Andy) Adelmann
Head a.i. Labor for Scientific Computing and Modelling 
Paul Scherrer Institut OHSA/ CH-5232 Villigen PSI
Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
Zoom ID: 470-582-4086 Password: AdA
-------------------------------------------------------
Friday: ETH HPK G 28   +41 44 633 3076
============================================
The more exotic, the more abstract the knowledge, 
the more profound will be its consequences.
Leon Lederman 
============================================



On 5 Aug 2020, at 11:44, Simon Friederich <sifriede AT uni-mainz.de> wrote:

 

Dear OPAL-Team,

I have a set of configuration parameters for an RFCAVITY element:

volt   lag
7.5    239.328125
8.0    239.2578125
8.5    239.18359375
9.0    239.08984375
9.5    239.01953125

I tried but failed to get the correctly needed syntax:
Can I use an array or table somehow like this?

REAL rf_settings = {
{7.5, 239.328125},
{8.0, 239.2578125},
{8.5, 239.18359375},
{9.0, 239.08984375},
{9.5, 239.01953125},
};

And then use (e.g. setting 0):

pb1: RFCAVITY,...,VOLT=rf_settings[0][0]*1e-3, LAG=rf_settings[0][1]*PI/180,...;

Thank you very much in advance!

Best regards
Simon

-- 
-----------------------------------
Dr. Simon Friederich
Helmholtz-Institut Mainz
Kollaboration B/ACID
Johannes Gutenberg-Universität Mainz
Staudingerweg 18
55128 Mainz, Deutschland
 
Tel.: +49 (0)6131 39-23160
E-Mail: sifriede AT uni-mainz.de
----------------------------------------

 




Archive powered by MHonArc 2.6.19.

Top of Page