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.

global equations (ODE) and global variables

Please login with a confirmed email address before reporting spam

Hi, I'm trying to define an equation in global equations and it is corresponded with the coordinates x and y (or certain global variable), e.g.:

States
Name (u) Equation f(u,ut,utt,t) Init (u)
u u-rho 0

where rho is defined as sqrt(x^2+y^2) in Global Expressions. However, I get an error as follows:

Error: 6170
Failed to evaluate variable.
- Variable: x
- Global scope
Failed to evaluate variable.
- Variable: rho
- Defined as: sqrt(((x)^2+(y)^2))
Failed to evaluate expression.
- Expression: u-rho

I would like to ask if there is a way to define the global equation such that it accepts a global variable like rho? If not, how can I use coupling variable or some other ways to get the coordinates in the whole domain. By the way, how can I obtain the Jacobian numerically in Comsol? Thank you very much for your advice and help!


5 Replies Last Post 21 nov 2013, 06:30 GMT-5
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 10 dic 2010, 01:27 GMT-5
Hi

most probably because "rho" is defined alread inside COMSOl for the material density. Read the errorlist from bottom to top, he first error was "rho". But I might be wrong, it's just my first guess ;)

COMSOL does not always flag when you use and redefine an internal variable, bacause its "allowed" and required if you are tweaking the equations, you are supposed to be the "master" and to know ... it's just that there are som many things to "know" when you mix up all these physics so nicely ...

--
Good luck
Ivar
Hi most probably because "rho" is defined alread inside COMSOl for the material density. Read the errorlist from bottom to top, he first error was "rho". But I might be wrong, it's just my first guess ;) COMSOL does not always flag when you use and redefine an internal variable, bacause its "allowed" and required if you are tweaking the equations, you are supposed to be the "master" and to know ... it's just that there are som many things to "know" when you mix up all these physics so nicely ... -- Good luck Ivar

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10 dic 2010, 02:54 GMT-5
Hi,

The problem here is that global equations and variables cannot depend on space coordinates such as x and y.

It seems that you define u = rho, where rho is a function of x and y. You can define rho using a domain variable (in version 4) or a subdomain expression variable (in version 3.5) without any equation. If you want u as a dependent variable, you can solve u = rho as a very simple PDE in the domain.

Best regards,
Magnus Ringh, COMSOL
Hi, The problem here is that global equations and variables cannot depend on space coordinates such as x and y. It seems that you define u = rho, where rho is a function of x and y. You can define rho using a domain variable (in version 4) or a subdomain expression variable (in version 3.5) without any equation. If you want u as a dependent variable, you can solve u = rho as a very simple PDE in the domain. Best regards, Magnus Ringh, COMSOL

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 10 dic 2010, 03:32 GMT-5
Hi

should also have taught about that one, you have told me that before Magnus ;)

--
Good luck
Ivar
Hi should also have taught about that one, you have told me that before Magnus ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 dic 2010, 08:37 GMT-5
Hi, Magnus

Thank you for your reply.

Indeed, I should solve the nonlinear equations like
r=f(rp,thetap,theta)
theta=g(rp,thetap)
where r=sqrt(x^2+y^2) and theta=angle(x+i*y) are the polar coordinates in certain domain, respectively. f and g are known nonlinear functions. The equations is actually a transformation from (rp,thetap) to (r,theta). And the problem is that for give postion (x,y) (or (r,theta)) in certain domain, (rp,thetap) should be calculated and then the Jacobian
?r/?rp ?r/?thetap
?theta/?rp ?theta/?thetap
or
|?x/?xp ?x/?yp|
|?y/?xp ?y/?yp|
where xp=rp*cos(thetap) and yp=rp*sin(thetap), respectively.

Best regards,
rediaof eda
Hi, Magnus Thank you for your reply. Indeed, I should solve the nonlinear equations like r=f(rp,thetap,theta) theta=g(rp,thetap) where r=sqrt(x^2+y^2) and theta=angle(x+i*y) are the polar coordinates in certain domain, respectively. f and g are known nonlinear functions. The equations is actually a transformation from (rp,thetap) to (r,theta). And the problem is that for give postion (x,y) (or (r,theta)) in certain domain, (rp,thetap) should be calculated and then the Jacobian ?r/?rp ?r/?thetap ?theta/?rp ?theta/?thetap or |?x/?xp ?x/?yp| |?y/?xp ?y/?yp| where xp=rp*cos(thetap) and yp=rp*sin(thetap), respectively. Best regards, rediaof eda

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 21 nov 2013, 06:30 GMT-5
Dear Magnus

I have the same problem " Failed to evaluate variable Jacobian, Global scope " But I dont habe actually any global variables...

I had a simulation with AC/DC which simulates Three-phase electric power and it wokrd.


I modified the simlation so that i inserted an electrical circuit which replaces the 3 voltage sources for the 3 phase and after this it dosent work anymore.. I cant find a reason for it
Dear Magnus I have the same problem " Failed to evaluate variable Jacobian, Global scope " But I dont habe actually any global variables... I had a simulation with AC/DC which simulates Three-phase electric power and it wokrd. I modified the simlation so that i inserted an electrical circuit which replaces the 3 voltage sources for the 3 phase and after this it dosent work anymore.. I cant find a reason for it

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.