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.

Error while calling External C function

Please login with a confirmed email address before reporting spam

Dear users,
I'm quite new to Comsol and I'm trying to create a function of time and space which could be later used in my model. Unfortunately I cannot use a Matlab function because my version is too old so I'm trying to run an external c function. I could successfully run the case that is included in COMSOL Multiphysics
Programming Reference Manual with f=sin(x)/x and now I was trying to add a variable to the model and to plot the function.
When I call my function from Comsol I got the error "There is no function with 1 arguments", I tried to combine differently x and y but I always got the same message. I attach here the file with the function and the screenshot with the error.
Thanks to all for your help
Regards,
Matteo


2 Replies Last Post Aug 26, 2016, 8:31 a.m. EDT
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Aug 26, 2016, 8:19 a.m. EDT
Hello Mateo,
Welcome to COMSOL.
As it turns out, you may be looking for a more complicated solution than necessary. You see, the COMSOL graphical user interface is interpreted, so if, for example, you want the temperature on a boundary to be equal to x*y*t (where x and y and the coordinates and t is time) then all you need to do to make that happen is type x*y*t in the GUI text field. There is no need to call an external function for something like that.
Quite advanced expressions can be entered that way. For more information on the syntax and available mathematical functions and operators, please refer to the Reference Manual, version 5.2a, Chapter 5.

All this being said, there are a few cases where you do need to call external functions. To determine if you are in one of those situations, it would help if you shared with the Forum what exactly you are trying to achieve with this function and what the function looks like precisely.
Best regards,
Jeff
Hello Mateo, Welcome to COMSOL. As it turns out, you may be looking for a more complicated solution than necessary. You see, the COMSOL graphical user interface is interpreted, so if, for example, you want the temperature on a boundary to be equal to x*y*t (where x and y and the coordinates and t is time) then all you need to do to make that happen is type x*y*t in the GUI text field. There is no need to call an external function for something like that. Quite advanced expressions can be entered that way. For more information on the syntax and available mathematical functions and operators, please refer to the Reference Manual, version 5.2a, Chapter 5. All this being said, there are a few cases where you do need to call external functions. To determine if you are in one of those situations, it would help if you shared with the Forum what exactly you are trying to achieve with this function and what the function looks like precisely. Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Aug 26, 2016, 8:31 a.m. EDT
I want to study the mechanical response of concrete at high temperature. I know that with Comsol it is possible to add the pore pressure in the solid and the temperature distribution in order to calculate the mechanical response. Since I already calculated the temperature and pressure as function of time and space in another program I would like to design a function which allows me to interpolate my data, f(x,y,z,t) and give to Comsol the variable T or P.
I know it is possible to interpolate data from a matrix with the interpolation function, but from what I read I can specify only 3 variable ( for example x,y,z or x,y,t). Until now I didn't find any other way to solve my problem so I'm also curious if there are other simpler ways.

Thanks for your help

Regards,

Matteo
I want to study the mechanical response of concrete at high temperature. I know that with Comsol it is possible to add the pore pressure in the solid and the temperature distribution in order to calculate the mechanical response. Since I already calculated the temperature and pressure as function of time and space in another program I would like to design a function which allows me to interpolate my data, f(x,y,z,t) and give to Comsol the variable T or P. I know it is possible to interpolate data from a matrix with the interpolation function, but from what I read I can specify only 3 variable ( for example x,y,z or x,y,t). Until now I didn't find any other way to solve my problem so I'm also curious if there are other simpler ways. Thanks for your help Regards, Matteo

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.