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.

using a matlab function, error message

Michael Rembe Certified Consultant

Please login with a confirmed email address before reporting spam

Hi,

I use a MATLAB-function called dichte. dichte is a function from 3 concentrations and temperature. I set up my function as a matrix-function, so I can run my function from matlab with matrices.

I defined my function as a global matlab function and I can use my function, f.i. plotting results (call of MATLAB works, the function is found, ...).

If I use the function in a Fz-term of a flow model, I get the error message:
"Syntax error in expression.
- Expression: nojac(0.5*min(mod1.spf.ck*sqrt((0.5*mod1.spf.res_p/(sqrt(emetric(1,0)+emetric(0,1))*mod1.spf.rho))^2+(mod1.spf.tau_m*mod1.spf.res_u)^2+(mod1.spf.tau_m*mod1.spf.res_v)^2+(mod1.spf.tau_m*mod1.spf.res_w)^2),2*sqrt(emetric(mod1.u,mod1.w)/(emetric(1,0)+emetric(0,1)))*pi*r)*min(sqrt((d(mod1.u,r)^2+d(mod1.u,z)^2+if(abs(r)<0.0010*h,d(mod1.u,r),mod1.u/r)^2+d(mod1.w,r)^2+d(mod1.w,z)^2+sqrt(eps))/((d(mod1.u,r)*mod1.spf.gijrr+d(mod1.u,z)*mod1.spf.gijzr)*d(mod1.u,r)+(d(mod1.u,r)*mod1.spf.gijrz+d(mod1.u,z)*mod1.spf.gijzz)*d(mod1.u,z)+(d(mod1.w,r)*mod1.spf.gijrr+d(mod1.w,z)*mod1.spf.gijzr)*d(mod1.w,r)+(d(mod1.w,r)*mod1.spf.gijrz+d(mod1.w,z)*mod1.spf.gijzz)*d(mod1.w,z)+sqrt(eps*mod1.spf.gijij))),0.25*mod1.spf.rho*if(shapeorder(mod1.u)==2,1/12,1/3)*sqrt(emetric(mod1.u,mod1.w)/(emetric(1[1],0[1])+emetric(0[1],1[1])))/mod1.spf.mu))*mod1.spf.rho*(-mod1.spf.gijrr*(test(mod1.ur)*mod1.ur+test(mod1.wr)*mod1.wr)-mod1.spf.gijrz*(test(mod1.ur)*mod1.uz+test(mod1.wr)*mod1.wz)-mod1.spf.gijzr*(test(mod1.uz)*mod1.ur+test(mod1.wz)*mod1.wr)-mod1.spf.gijzz*(test(mod1.uz)*mod1.uz+test(mod1.wz)*mod1.wz))"

The reason is the call of the function like dichte(c1,c2,c3,T). If I replace my function with 1000, COMSOL works.

What can I do? Are there any answers?

Thank you very much!

Best regards,
Michael

0 Replies Last Post 22.08.2011, 06:38 GMT-4
COMSOL Moderator

Hello Michael Rembe

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.