Defining mass matrix for solving transport equation

조회 수: 1 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2019년 1월 7일
댓글: Deepa Maheshvare 2019년 9월 23일
I want to solve the following 1-D pde which is discretized in spacial direction to solve using ode15s.
Dc/Dt = D*D^c/Dx^2 - v*Dc/Dx.
With initial condition,
c(x,0) = Co
Boundary conditions ,
Dirichlet boundary condition at left boundary,
c(0,t) = cl;
Neumann boundary condition at right boundary,
dc/dx = 0;
I'm not very clear about defining the mass matrix for the input options in the call to ode15s
options = odeset('Mass',M,'RelTol',1e-4,'AbsTol',[1e-6 1e-10 1e-6]);
[t,y] = ode15s(@fun,tspan,y0,options);
I'm trying to solve the above system as a index-1 DAE. The first row and second row of the mass matrix will contain one's in the diagonal entries.
I am not sure how the left boundary condition has to be specified in the mass matrix.
Could someone explain?
  댓글 수: 13
Torsten
Torsten 2019년 1월 8일
function S = Jacpat(N)
% Define the sparsity structure of the Jacobian by indicating which
% variables appear in which equations. This is done by inspection of
% the function 'f' above for evaluating the equations.
S = sparse(N,N);
for i = 2:(N-1)
S(i,i-1) = 1; % c(i-1)
S(i,i) = 1; % c(i)
S(i,i+1) = 1; % c(i+1)
end
S(N,N-1) = 1; % c(N-1)
S(N,N) = 1; % c(N)
Deepa Maheshvare
Deepa Maheshvare 2019년 9월 23일
Hello, Could you please explain why half-step size is considered for discretizaition at the boundary node that was explained here . Is there any name for this type of scheme?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by