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.

showing the error circular variable dependency

Please login with a confirmed email address before reporting spam

I have to solve two coupled equations.
They are
1)
A ∂T/∂t+k/r*∂/∂r (r*∂T/∂r)+B*T*∂a/∂t=0 , Where A=(rho*c)eff = constant, B=1/s*(1-rho)*c*1000/M=constant , k=constant,
with initial condition at t=0, T=Tambient=308K and two boundary conditions are at r=0 ∂T/∂r=0 and at r=R, -k*∂T/∂r=hout*(T-Tambient)


2)
∂a/∂t=C*exp(E/(R*T))*(f(T)-a); C is constant, with initial condition ∂a/∂t (at t=0 )=0

while i am solving, the error message showing that
Circular variable dependency detected.
- Variable: a
- Geometry: 1
- Domain: 1

should you help me.

3 Replies Last Post 2017年6月6日 GMT-4 07:32

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年11月5日 GMT-5 03:32
I guess the problem is not in Comsol. Your initial condition ∂a/∂t (at t=0 ) = 0 makes a(t=0) = f(308K). But the numerical integration cannot start as the time derivative is initially zero. Try a small number like 0.001 instead. I do not know if you have to explicitly define also the initial condition of a.

Good luck
Lasse
I guess the problem is not in Comsol. Your initial condition ∂a/∂t (at t=0 ) = 0 makes a(t=0) = f(308K). But the numerical integration cannot start as the time derivative is initially zero. Try a small number like 0.001 instead. I do not know if you have to explicitly define also the initial condition of a. Good luck Lasse

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年11月5日 GMT-5 05:19
Hi,

This error message means that a variable somewhere is defined in terms of itself. It cannot be seen directly from your equations. It is more a matter of how you have implemented them.

Using an example from structural mechanics, we sometimes see this error in the following context:

The constitutive law (built into the Linear Elastic material) is

stress = E*strain

It a user tries to enter a variable in the text field for E, say 'my_E', defined as

my_E = 2E11 - 1E3*stress,

then this error will be triggered, since the stress implicitly defines itself. A substitution will give

stress = (2E11 - 1E3*stress)*strain

The symbolic algebra machinery detects this, and issues the error message.

There are two types of remedies:

1. Reformulate your expressions. This works in most cases. In the case above, the equivalent expression

my_E = 2E11/(1+1E3*strain)

would work.

2. If this type of dependency is really necessary, then there are more sophisticated ways of dealing with it. The basic idea is to use an intermediate variable, which does not provide a circular dependency. This technique is explained in the Model Library example stress_dependent_elasticity.

www.comsol.com/model/modeling-stress-dependent-elasticity-14441

Regards,
Henrik
Hi, This error message means that a variable somewhere is defined in terms of itself. It cannot be seen directly from your equations. It is more a matter of how you have implemented them. Using an example from structural mechanics, we sometimes see this error in the following context: The constitutive law (built into the Linear Elastic material) is stress = E*strain It a user tries to enter a variable in the text field for E, say 'my_E', defined as my_E = 2E11 - 1E3*stress, then this error will be triggered, since the stress implicitly defines itself. A substitution will give stress = (2E11 - 1E3*stress)*strain The symbolic algebra machinery detects this, and issues the error message. There are two types of remedies: 1. Reformulate your expressions. This works in most cases. In the case above, the equivalent expression my_E = 2E11/(1+1E3*strain) would work. 2. If this type of dependency is really necessary, then there are more sophisticated ways of dealing with it. The basic idea is to use an intermediate variable, which does not provide a circular dependency. This technique is explained in the Model Library example stress_dependent_elasticity. http://www.comsol.com/model/modeling-stress-dependent-elasticity-14441 Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年6月6日 GMT-4 07:32
Hi Henrik,
I tried to use the alternative method you suggest, to create an intermediate variable, unsuccessfully. I need to use the Moving Mesh method in 2D, using as prescibed deformation dx = ux and dy = uy, i.e. the gradient of the solution. When I do this, the circular variable dependency triggers: could you please suggest a solution?
Regards
Antonino
Hi Henrik, I tried to use the alternative method you suggest, to create an intermediate variable, unsuccessfully. I need to use the Moving Mesh method in 2D, using as prescibed deformation dx = ux and dy = uy, i.e. the gradient of the solution. When I do this, the circular variable dependency triggers: could you please suggest a solution? Regards Antonino

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.