DAE Problem : cannot understand how to find the problem in my code

1 vue (au cours des 30 derniers jours)
Urvi
Urvi le 28 Sep 2012
This is code to solve 6 ode's and 12 algebraic equations. All of them are interdependent. How do I go about it? I keep getting errors but I am unable to solve it.
**M file**
*M file* function f=ncs1_dae(t,x)
%Input parameters
global alpha A AH AI AO AV ACS beta CPH CPI CPIN CPO CPV dB g hB hI hO hH hV Hmax k M MH min Pset qein R rhol rhov ri ro TIN TR vB lambda;
input()
%Variables
TI=x(1);
........
..........
=x(16);
%f(1) to f(6) are ODEs
f(1)=
f(2)=
f(3)=
f(4)=
f(5)=
f(6)=
%f(7) to f(18) are Algebraic Equations
f(7)=
f(8)=
f(9)=
f(10)=
f(11)=
f(12)=
f(13)=
f(14)=
f(15)=
f(16)=
f(17)=
f(18)=
f=f';
This is what I enter in the command window:
>> x0=[298 298 298 298 1 0.3 0 373 0 0 0 0 0 0 0 0.0013 0.0041 0.0056];
>> tspan=[0 1200];
>> M=[eye(6,18);zeros(12,18)];
>> options=odeset('Mass',M);
>> [t1,x1]=ode15s(f,[0,1200],x0,options);
The warning msg I get is : Warning: Failure at t=3.014342e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (8.881784e-16) at time t. > In ode15s at 753 >> if true
% code
end
  2 commentaires
Walter Roberson
Walter Roberson le 28 Sep 2012
What if the equations are inconsistent?
Urvi
Urvi le 1 Oct 2012
Inconsistent as in? I have 18 variables and 18 equations. All of which are interdependent.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 1 Oct 2012
Modifié(e) : Jan le 1 Oct 2012
You can define an DAE such that there is no feasible point. If the mass matrix is singular, as in your case, the initial slope M(t0, y0) * y'(0) = f(t0, y0) must exist.
Imagine a DAE which describes a point sliding on a circulare wire. If you start the integration with a point apart from the wire, there is no valid first step of the integration, because it is impossible to keep the trajectory on the feasible path.
  1 commentaire
Urvi
Urvi le 1 Oct 2012
Oh ok I get it now! Thanks! Will look into my equations.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Chemistry dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by