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.

Defining parameters as vector

Please login with a confirmed email address before reporting spam

Hello everyone,

I am trying to define a parameter as a vector, but using {1, 2, 3} gives the error "Vector parameter definitions are not allowed". I tried different syntaxes but it seems that the probleme comes from the place where I try to define the vector.

I intend to use this vector as an argument for an external C function as it seems that Comsol can pass such argument. The external function is used to define boundary conditions.

Does anyone have any idea on either how to define parameter as vector or how to use vector as input for an external function ?

Thank you for your help.


3 Replies Last Post Jun 9, 2022, 12:45 p.m. EDT
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Jun 8, 2022, 3:30 p.m. EDT

Hi,

parameters in Comsol are scalars, which can take complex values. You can define vector components as parameters and pass those to the external function.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi, parameters in Comsol are scalars, which can take complex values. You can define vector components as parameters and pass those to the external function. Cheers Edgar

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Jun 9, 2022, 10:02 a.m. EDT

Hello Edgar, thank you for your response. Using complex values will only work for 2D vectors ? Also I may not have used the right word, I am trying to define an array for programming purpose which can store numerous information in a single parameter/variable, more than a vector in the mathematical way. Sorry for the mistake.

Hello Edgar, thank you for your response. Using complex values will only work for 2D vectors ? Also I may not have used the right word, I am trying to define an array for programming purpose which can store numerous information in a single parameter/variable, more than a vector in the mathematical way. Sorry for the mistake.

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Jun 9, 2022, 12:45 p.m. EDT

Well, the procedure will be the same. You need to split the structure into its scalar components and pass those to the external function.

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Well, the procedure will be the same. You need to split the structure into its scalar components and pass those to the external function.

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.