Asked by Deepa Maheshvare
on 7 Jan 2019

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?

Opportunities for recent engineering grads.

Apply Today
## 12 Comments

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657549

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657643

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657646

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657653

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657658

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_657769

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658056

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658066

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658097

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658101

## Deepa Maheshvare (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658133

## Torsten (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/438547-defining-mass-matrix-for-solving-transport-equation#comment_658135

Sign in to comment.