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.

Problems when using external matlab functions

Please login with a confirmed email address before reporting spam

Hi,

I need help on problems when using external matlab functions in comsol 4.2.
My model uses Laminar Flow and ALE module.

I wish to calculate curvature of one boundary in MATLAB, and returns the result to COMSOL. However, when I just defined the matlab function in global definitions, the error messages appeared:

Syntax error in expression.
- Expression: nojac(0.5*min(mod1.spf.ck*sqrt((0.5*mod1.spf.res_p/(sqrt(emetric_spatial(1[1],0[1])+emetric_spatial(0[1],1[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_spatial(mod1.u-d(r,TIME),mod1.w-d(z,TIME))/(emetric_spatial(1[1],0[1])+emetric_spatial(0[1],1[1])))*pi*r)*min(sqrt((d(mod1.u-d(r,TIME),r)^2+d(mod1.u-d(r,TIME),z)^2+if(abs(r)<0.0010*h,d(mod1.u-d(r,TIME),r),(mod1.u-d(r,TIME))/r)^2+d(mod1.w-d(z,TIME),r)^2+d(mod1.w-d(z,TIME),z)^2+sqrt(eps))/((d(mod1.u-d(r,TIME),r)*mod1.spf.gijrr+d(mod1.u-d(r,TIME),z)*mod1.spf.gijzr)*d(mod1.u-d(r,TIME),r)+(d(mod1.u-d(r,TIME),r)*mod1.spf.gijrz+d(mod1.u-d(r,TIME),z)*mod1.spf.gijzz)*d(mod1.u-d(r,TIME),z)+(d(mod1.w-d(z,TIME),r)*mod1.spf.gijrr+d(mod1.w-d(z,TIME),z)*mod1.spf.gijzr)*d(mod1.w-d(z,TIME),r)+(d(mod1.w-d(z,TIME),r)*mod1.spf.gijrz+d(mod1.w-d(z,TIME),z)*mod1.spf.gijzz)*d(mod1.w-d(z,TIME),z)+sqrt(eps*mod1.spf.gijij))),mod1.spf.rho*sqrt(emetric_spatial(mod1.u-d(r,TIME),mod1.w-d(z,TIME))/(emetric_spatial(1[1],0[1])+emetric_spatial(0[1],1[1])))/(12*mod1.spf.mu)))*mod1.spf.rho*(-mod1.spf.gijrr*(test(mod1.pr)*mod1.spf.betaT*mod1.pr+test(mod1.ur)*mod1.ur+test(mod1.wr)*mod1.wr)-mod1.spf.gijrz*(test(mod1.pr)*mod1.spf.betaT*mod1.pz+test(mod1.ur)*mod1.uz+test(mod1.wr)*mod1.wz)-mod1.spf.gijzr*(test(mod1.pz)*mod1.spf.betaT*mod1.pr+test(mod1.uz)*mod1.ur+test(mod1.wz)*mod1.wr)-mod1.spf.gijzz*(test(mod1.pz)*mod1.spf.betaT*mod1.pz+test(mod1.uz)*mod1.uz+test(mod1.wz)*mod1.wz))


As long as I disable the definition, my comsol program runs just fine.

How to solve the problem? It is wired to me.

Thank you!

0 Replies Last Post 2 ago 2011, 06:48 GMT-4
COMSOL Moderator

Hello Yuanyuan Shen

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.