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.
A "Gloabl equation" problem
Posted 23 mag 2011, 16:35 GMT-4 Version 5.0 14 Replies
Please login with a confirmed email address before reporting spam
To solve the ODE, I add a Global Equation under the Heat Transfer (ht) node, and the settings are as follows:
Name: fc
f(u, ut, utt, t): fct-(Tm-T)*switch(t)
Initial value (u_0): 0
When I try to solve the whole model, an error occurred:
Failed to evaluate variable Jacobian.
- Variable: mod1.T
- Global scope
Why?
the model file was attached.
Thank you!
Attachments:
Please login with a confirmed email address before reporting spam
are you sure your "switch" is derivable ? normally you should use only smooth functions that might de derived at least once, ideally twice, you can use the Heavyside functions to smoothen "switches"
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
The ODE is a scalar space-independent equation for a single scalar variable, so it is not possible to use T, which is the dependent variable for the temperature in the 1D domain and therefore a field quantity T = T(x,t). It has a local scope in the domain; hence the error message. Depending on the application (how is T defined for this ODE?), possible approaches could be to use:
* the value of T in a point
* the average temperature in the domain
* or replace the ODE with a "distributed ODE" (a PDE interface with no space derivatives; in 4.2 such a "Domain ODE and DAE" interface is predefined), where you solve an ODE in each point along the 1D domain.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
Hi,
The ODE is a scalar space-independent equation for a single scalar variable, so it is not possible to use T, which is the dependent variable for the temperature in the 1D domain and therefore a field quantity T = T(x,t). It has a local scope in the domain; hence the error message. Depending on the application (how is T defined for this ODE?), possible approaches could be to use:
* the value of T in a point
* the average temperature in the domain
* or replace the ODE with a "distributed ODE" (a PDE interface with no space derivatives; in 4.2 such a "Domain ODE and DAE" interface is predefined), where you solve an ODE in each point along the 1D domain.
Best regards,
Magnus Ringh, COMSOL
Thank you, Magnus Ringh, it worked when I replaced the ODE with a "distributed ODE".
But now I encountered a another problem. For equation dfc/dt=(Tm-T)*switch(t), the model can work. When I used another ODE, i.e., dfc/dt=(Tm-T)*switch(t)* fc^(2/3), an error occurred:
Attempt to evaluate negative power of zero.
- Function: ^
Failed to evaluate expression.
- Expression: d(d((-(mod1.fct-(Tm-mod1.T)*switch(t/unit_s_cf)*mod1.fc^(2/3)/unit_K_cf)*test(mod1.fc))*(dvol),{test@2}),mod1.fc)
It was so strange! Why comsol regard (2/3) as a negative power?
Please login with a confirmed email address before reporting spam
The expression is for computing the Jacobian (derivatvive) of the equation and takes the derivative of fc^(2/3) with respect to fc ("d" is the differentiation operator), which results in a negative power. If fc = 0, then fc^(-1/3), for example, is undefined.
You can perhaps change the initial value of fc to move it away from zero to avoid this problem.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
Thank you
Please login with a confirmed email address before reporting spam
Hi guys, I am having the same problem. I was trying to see how can I use "distributed ODE" option. I am using COMSOL 4.1 and I can't find the way to use distributed ODE. Can anybody please explain?
Thank you
You can use the PDE interface, since there is no distributed ODE in 4.1.
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I am attempting something similar. Instead of an ODE, I have a transcendental function of the form
MS=M0*tanh(MS*TC/(M0*T))
in the ODE physics. M0 and TC are constants while T is the dependent variable (temperature) in the heat transfer physics. MS is to be used in the heat source term in the heat transfer physics.
I obtained basically the same error, viz Failed to evaluate variable Jacobian: Variable: mod1.T; Global scope.
Since my global function is a transcendental function and not an ODE, I assume that the Distributed ODE is no longer applicable.
Can anyone help me with this issue?
Thank you.
Sincerely,
EH
Please login with a confirmed email address before reporting spam
could it be that your eqation as a little issue around T=0, at least to derive a valuable derivative of the function.
I agree normally T > 0 but sometimes with the initial conditions by default at all = 0 one get fooled
It's just a suggestion, not sure its the true issue
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Thanks for the quick reply. Well, I have specified the initial values for T to be 310K. The idea here is to solve the transcendental function first to get MS using the initial T. Then with the calculated MS, the heat transfer is solved. Using the value of T, the transcendental fucntion is again solved for the next time step and this is repeated.
It seems that I couldnt get the first run to solve. By the way, are the initial values of (u_0) and (u_t0) important or can they just be zero? Do the initial values refer to the values at time zero or are they the initial values used for solving the transcendental functions via iterative methods?
Thank you.
Best regards,
EH
Please login with a confirmed email address before reporting spam
the u_0 and u_t0 are the initial values the programme is using for the Global Equation, SO THEY ARE IMPORTANT !
Try setting your u_0 to 310, the same for u_t0 (even if this one is only used if the time dependent solver is active)
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
This is a rather wide-ranging discussion, and I see that the original question was about switching a heat load on and off at known times during the simulation. For this type of pulsed heat loading, you will find the following blog helpful:
www.comsol.com/blogs/modeling-a-periodic-heat-load/
Best Regards,
Please login with a confirmed email address before reporting spam
I saw this thread while I was looking for help for almost similar two equations. I used Coefficient form PDE for the heat equation and Distributed ODE to solve fc. The fc here is defined as dimensionless variable.
My question is how to set up a time dependent study in which simulation stops when fc reaches 1 at every point in the domain, rather then specifying time range for the transient Analysis.
Thank you
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.