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.

Iterative Solution vs Circular Variable Dependency

Please login with a confirmed email address before reporting spam

I am trying to implement some equations that can only be solved iteratively. The equations vary based on position and radius. Essentially these equatiosn are to model the effect of incoporating hyematocrit, density and viscosity variations on flow and velocity. I tried adding all the equatiosn into COMSOL version 4.1 as Global definitions. The error that it spits out is " circular variable dependency detected". Will COMSOL be able to solved the iterative solution or do i just ahve a typo somewhere in my expressions/variables?

5 Replies Last Post Jul 13, 2012, 4:05 a.m. EDT
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 Mar 8, 2011, 3:32 p.m. EST
Hi

iterative solving means working in steps, but cutting the loop such that you avoid the circular reference.
Check the solver settngs if COMSOL has chosen a direct method then you'll get certainly a circular reference => try to add an iterative node.

But even without, it's easy to write a circular reference when you work with higly coupled models, so it's always worth to recheck it ;)

--
Good luck
Ivar
Hi iterative solving means working in steps, but cutting the loop such that you avoid the circular reference. Check the solver settngs if COMSOL has chosen a direct method then you'll get certainly a circular reference => try to add an iterative node. But even without, it's easy to write a circular reference when you work with higly coupled models, so it's always worth to recheck it ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 8, 2011, 6:23 p.m. EST
Hi Ivar,

How do I add this iterative node?

Alternatively, I was thinking I could call MATLAB to solve for that one variable when it is required. Is this possible? I am much more familiar with MATLAB and can easily code that there.

Pleas provide insight into both the node and matlab methods

Melanie
Hi Ivar, How do I add this iterative node? Alternatively, I was thinking I could call MATLAB to solve for that one variable when it is required. Is this possible? I am much more familiar with MATLAB and can easily code that there. Pleas provide insight into both the node and matlab methods Melanie

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 Mar 9, 2011, 1:14 a.m. EST
Hi

in V4 you right click the solver node (quite deep inside the solver sequence) and add an iterative node, then it will appear side by side to the Direct node which will be disabled automatiacally, to remove the iterative node, enable the Direct node first and then delete the iterative one. Or reset the solver sequence

Now I have a doubt how it was in 3.5a that's getting too old ;)

Matlab can always be used


--
Good luck
Ivar
Hi in V4 you right click the solver node (quite deep inside the solver sequence) and add an iterative node, then it will appear side by side to the Direct node which will be disabled automatiacally, to remove the iterative node, enable the Direct node first and then delete the iterative one. Or reset the solver sequence Now I have a doubt how it was in 3.5a that's getting too old ;) Matlab can always be used -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 15, 2011, 2:34 p.m. EST
I have the same problem.

y=f(x(i-1));

x=f(y(i));

where i is time step number

when two variables are dependent on each other and have to iterate sequentially in each time step to update, it came up with the ''circular variable dependency detected' problem. Even though I am using a "time discrete solver", and turn on the "Iterative" node in the solver. It is easy to realize in matlab or other language packages, but how can I do it in comsol.

Thanks in advance,

Yao
I have the same problem. y=f(x(i-1)); x=f(y(i)); where i is time step number when two variables are dependent on each other and have to iterate sequentially in each time step to update, it came up with the ''circular variable dependency detected' problem. Even though I am using a "time discrete solver", and turn on the "Iterative" node in the solver. It is easy to realize in matlab or other language packages, but how can I do it in comsol. Thanks in advance, Yao

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jul 13, 2012, 4:05 a.m. EDT
I have tried adding an iterative node to the solver, but the error "circular variable dependency detected" still occurs. I have two variables that are T-dependent (Heat Transfer model) but they are expressed such that they are dependent on each other: Xm = f(Jv, T) and Jv = f(Xm, T).

I have thought of simplifying the expressions such that one variable remains, such as Xm(T) or Jv(T), but the resulting form is non-linear and I can't generate the expression.

Any advice would really help. Thanks!

--
Abe


Hi

in V4 you right click the solver node (quite deep inside the solver sequence) and add an iterative node, then it will appear side by side to the Direct node which will be disabled automatiacally, to remove the iterative node, enable the Direct node first and then delete the iterative one. Or reset the solver sequence

Now I have a doubt how it was in 3.5a that's getting too old ;)

Matlab can always be used


--
Good luck
Ivar


I have tried adding an iterative node to the solver, but the error "circular variable dependency detected" still occurs. I have two variables that are T-dependent (Heat Transfer model) but they are expressed such that they are dependent on each other: Xm = f(Jv, T) and Jv = f(Xm, T). I have thought of simplifying the expressions such that one variable remains, such as Xm(T) or Jv(T), but the resulting form is non-linear and I can't generate the expression. Any advice would really help. Thanks! -- Abe [QUOTE] Hi in V4 you right click the solver node (quite deep inside the solver sequence) and add an iterative node, then it will appear side by side to the Direct node which will be disabled automatiacally, to remove the iterative node, enable the Direct node first and then delete the iterative one. Or reset the solver sequence Now I have a doubt how it was in 3.5a that's getting too old ;) Matlab can always be used -- Good luck Ivar [/QUOTE]

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.