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.

ODE simple problem

Please login with a confirmed email address before reporting spam

Hi, I have a two problems.
I'm trying to solve simple differential equation in the form of:
dA/dt=-k*t*A
initial conditions:
k=1
A=5e-4
At=5e-4
This equation is describing reaction kinetics. To be more precise, first order reaction.
My problem is that obtained kinetic curve, is rather sigmoidal not expotential as expected. I was trying to change time step without success.
My second problem is more complex.
dA/dt=-k*t*(A^0.75)
initial conditions:
k=1
A=5e-4
At=5e-4
ERROR:
Nonlinear solver did not converge.
Time : 0.3011554385215172
Attempt to evaluate non-integral power of negative number.
Last time step is not converged.
How to fix those problems? Any ideas?
Best regards
Marek

3 Replies Last Post Feb 24, 2014, 6:26 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 21, 2014, 3:33 p.m. EST
Marek,
I believe the first order reaction is not
dA/dt=-k*t*A
but
dA/dt=-k*A, the solution of which is an exponential as you expect.
I also suspect that in your second equation
dA/dt=-k*t*(A^0.75)
that the explicit time factor in the right side is wrong and thus
dA/dt=-k*(A^0.75)
is the more likely equation, which would represent a multibody reaction. If not you might try solving
dA^4/dt=-k^4*t^4*(A^3)
which would be a similar solution with integer exponents
Marek, I believe the first order reaction is not dA/dt=-k*t*A but dA/dt=-k*A, the solution of which is an exponential as you expect. I also suspect that in your second equation dA/dt=-k*t*(A^0.75) that the explicit time factor in the right side is wrong and thus dA/dt=-k*(A^0.75) is the more likely equation, which would represent a multibody reaction. If not you might try solving dA^4/dt=-k^4*t^4*(A^3) which would be a similar solution with integer exponents

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 24, 2014, 3:06 a.m. EST
Hi,

Just a comment about the error "Attempt to evaluate non-integral power of negative number." It occurs because A becomes (just slightly) negative. To avoid it, you can select the "Allow complex-valued output from functions with real input" check box in the Advanced node's settings (under the Time-Dependent Solver node). You also need to inform the Time-Dependent Solver that the solution now is complex valued by selecting the "Allow complex numbers" check box in its settings window's Advanced section. These instructions are valid at least in version 4.4 (the latest COMSOL version).

Best regards,
Magnus Ringh, COMSOL
Hi, Just a comment about the error "Attempt to evaluate non-integral power of negative number." It occurs because A becomes (just slightly) negative. To avoid it, you can select the "Allow complex-valued output from functions with real input" check box in the Advanced node's settings (under the Time-Dependent Solver node). You also need to inform the Time-Dependent Solver that the solution now is complex valued by selecting the "Allow complex numbers" check box in its settings window's Advanced section. These instructions are valid at least in version 4.4 (the latest COMSOL version). Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 24, 2014, 6:26 a.m. EST
Yes, you're right.
I did not notice the difference between At and A * t in COMSOL.
Regarding the equation:
dA / dt =-k * (A ^ 0.75)
Again, you're right, this equation describes a multi-step reaction. 0.75 its an order of the reaction determined from the experiments. Kinetic curve has rather oscilation shape (one maximum of [A] during the measurements). Now I'm wondering if I can obtain similar kinetic curve using mathematical model.
I assumed that k is constant, however k=k'*[B]. In my case, changes of B can be neglected. So final version of the equation can be given as above.
In COMSOL i have written:
-k*A^(0.75)-At
name: A
Initial value (u_0)
5e-4
Initial value (u_t0)
5e-4
According to Magnus Ringh suggestion, I have selected the "Allow complex-valued output from functions with real input".
I still can not be solved.

Best regards
Yes, you're right. I did not notice the difference between At and A * t in COMSOL. Regarding the equation: dA / dt =-k * (A ^ 0.75) Again, you're right, this equation describes a multi-step reaction. 0.75 its an order of the reaction determined from the experiments. Kinetic curve has rather oscilation shape (one maximum of [A] during the measurements). Now I'm wondering if I can obtain similar kinetic curve using mathematical model. I assumed that k is constant, however k=k'*[B]. In my case, changes of B can be neglected. So final version of the equation can be given as above. In COMSOL i have written: -k*A^(0.75)-At name: A Initial value (u_0) 5e-4 Initial value (u_t0) 5e-4 According to Magnus Ringh suggestion, I have selected the "Allow complex-valued output from functions with real input". I still can not be solved. Best regards

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.