Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Question about the Application builder

Please login with a confirmed email address before reporting spam

Hello, I would like to get an evaluated value by the « global evaluation », in the “results” section, into a variable defined in the application builder, section “methods”.

Please see the atatched image.

My purpose is to store it as a « double ». That why I defined the variable, here called “test”, as: double test = It rises a type conflict if I try this written. double test = model.result().numerical("gev1");

Is someone have any idea how to write it correctly? Thanks,

Regards, Bertrand



1 Reply Last Post 03.05.2018, 15:09 GMT-4
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 03.05.2018, 15:09 GMT-4
Updated: 7 years ago 03.05.2018, 15:10 GMT-4

Hi Bertrand, you need to use the folllowing:

The reason for this, is that the Global Evaluation feature can return two dimensional arrays if you have parametric sweeps or a time dependent model, so the method will get the first value.

See the COMSOL Programming Reference Manual for more information.

Dan

Hi Bertrand, you need to use the folllowing: \textrm{double test = model.result().numerical("gev1").getReal()[0][0];} The reason for this, is that the Global Evaluation feature can return two dimensional arrays if you have parametric sweeps or a time dependent model, so the \textrm{getReal()[0][0]} method will get the first value. See the COMSOL Programming Reference Manual for more information. Dan

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.