Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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 using analytic function

Please login with a confirmed email address before reporting spam

Hi,
I am solving a 3D Helmholtz problem. The model can be defined by a cube and in the middle of it, I introduced a thin body region that has flux of a given sinusoidal function. I am not able to solve it as there is an error saying

Failed to evaluate expression.
- Expression: d((disp*test(mod1.u))*(dvol),{test@1})


disp being the name of the analytic function. The function i am interested in has the form of A*sin(pi*x).

When I repeat the problem by replacing the function with a constant value, the problem solves normally.

I have attached a sample file here for reference.

Hope someone can help me.

Thank you.

Best rgards,
EH


5 Replies Last Post 28 mars 2012, 13:45 UTC−4
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 janv. 2012, 03:20 UTC−5
Hi

have you tried to define the derivative of your analytical function, manually ? (see the definition of your analytical function)
it looks like COMSOL is not managing to derive your A*sin(pi*x) function

--
Good luck
Ivar
Hi have you tried to define the derivative of your analytical function, manually ? (see the definition of your analytical function) it looks like COMSOL is not managing to derive your A*sin(pi*x) function -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 janv. 2012, 03:38 UTC−5
Hi Ivar,

Well, the derivative with respect to x will be A*pi*cos(pi*x) and 0 with respect to y and z. I entered these manually and I still get the same kind of error. Do you know what might be the problem here?

Thank you.


Best regards,
EH
Hi Ivar, Well, the derivative with respect to x will be A*pi*cos(pi*x) and 0 with respect to y and z. I entered these manually and I still get the same kind of error. Do you know what might be the problem here? Thank you. Best regards, EH

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 janv. 2012, 04:20 UTC−5
Hi

I hadn't open your file, but when you refer to "disp" you need to write disp(x) or disp(y) or whatever that is correct, as the "x" in the function argument is a dummy variable name, you could have called it y, z, or t or whatever. when referring to functions the arguments to be use

then it solves ;) and the derivatives are taken correctly by COMSOL

--
Good luck
Ivar
Hi I hadn't open your file, but when you refer to "disp" you need to write disp(x) or disp(y) or whatever that is correct, as the "x" in the function argument is a dummy variable name, you could have called it y, z, or t or whatever. when referring to functions the arguments to be use then it solves ;) and the derivatives are taken correctly by COMSOL -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 janv. 2012, 04:36 UTC−5
Hi,
Yup it solves now. I never thought a missing (x) was the issue. Anyway, it is runnign now. Thank you for your help.


Best wishes,
EH
Hi, Yup it solves now. I never thought a missing (x) was the issue. Anyway, it is runnign now. Thank you for your help. Best wishes, EH

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 mars 2012, 13:45 UTC−4
Ivar- you are amazing. I used the answers you've been giving people in like 20 different threads and pieced together how to use a basic analytical function. Thanks!
Ivar- you are amazing. I used the answers you've been giving people in like 20 different threads and pieced together how to use a basic analytical function. Thanks!

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.