2
$\begingroup$

I'm trying to solve the following first order parabolic partial differential equation,

\begin{equation*} X \frac{\partial V}{ \partial Q} = -\frac{1}{2} \sigma^2 \frac{\partial^2 V}{\partial X^2} + rV + p \min (X, 0) \end{equation*}

subject to conditions \begin{equation*} \begin{split} V &= 0 \hspace{27pt} \text{as} \hspace{20pt} X \rightarrow \infty \\ V &= pQ \hspace{20pt} \text{as} \hspace{20pt} X \rightarrow -\infty \\ \frac{1}{2} \sigma^2 \frac{\partial^2 V}{\partial X^2} - rV &= 0 \hspace{20pt} \text{if} \hspace{20pt} X < 0 \hspace{10pt} \text{and} \hspace{10pt} Q = 0 \\ \frac{1}{2} \sigma^2 \frac{\partial^2 V}{\partial X^2} - rV &= 0 \hspace{20pt} \text{if} \hspace{20pt} X > 0 \hspace{10pt} \text{and} \hspace{10pt} Q = Q_{max} \end{split} \end{equation*}

What I understand is that Matlab pdepe solver solves \begin{equation*} c \Big(x, t, u, \frac{\partial u}{\partial x} \Big) \frac{\partial u}{\partial t} = x^{-m} \frac{\partial }{\partial x} \Big( x^{m} f \Big( x, t, u, \frac{\partial u}{\partial x} \Big) \Big) + s \Big( x, t, u, \frac{\partial u}{\partial x} \Big) \end{equation*}

So if redefine my model, \begin{equation*} X \frac{\partial V}{ \partial Q} = -\frac{1}{2} \sigma^2 \frac{\partial^2 V}{\partial X^2} + rV + p \min (X, 0) \end{equation*} I can let \begin{equation*} \begin{split} c &= X \\ f &= -\frac{1}{2} \sigma^2 \frac{\partial V}{\partial X} \\ s &= rV + p \min (X, 0) \\ m &= 0 \end{split} \end{equation*}

My question is: how do I get the boundary condition supposedly in the form \begin{equation*} p(x,t,u) + q(x,t) f \Big( x,t,u, \frac{\partial u}{\partial x} \Big) = 0 \end{equation*}

and how do I capture conditions as stated above? The domain should be divided into two regions, one (X < 0) for solving upwards, and the other (X > 0) in which solve downwards. Along the boundary X = 0 the solutions must be matched.

I'm a bit lost at this point. Any insight would really help. Thanks!

Edit: If I let the following be p,f, and q for the boundary condition \begin{equation*} \begin{split} p &= -rV \\ f &= -\frac{1}{2} \sigma^2 \frac{\partial V}{\partial X} \\ q &= 1 \end{split} \end{equation*} would this be correct in capturing the above mentioned conditions?

This is the code in Matlab:

function pde
global sigma r p
sigma = 0.5; 
r = 0.01;
p = 1;

x_inf = 25;
N = 10;
M = 20;
delta_x = x_inf/N;
q_max = 1;
delta_q = q_max/M;

m = 0;
x = linspace(0, delta_x, 2*N);
t = linspace(0, delta_q, M);

sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
% Extract the first solution component as u.
u = sol(:,:,1);

% A surface plot is often a good way to study a solution.
surf(x,t,u) 
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance x')
ylabel('Time t')

% --------------------------------------------------------------
function [c,f,s] = pdex1pde(x,q,v,DvDx)
global sigma r p
c = x;
f = -(1/2)*sigma*DvDx;
s = r*v + p*min(x,0);
% --------------------------------------------------------------
function u0 = pdex1ic(~)
u0 = 0;
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex1bc(xl,vl,xr,vr,q)
global r
pl = -r*vl; 
ql = 1;
pr = -r*vr;
qr = 1; 

Any insight at all on the steps to solving this (whether in Matlab with pdepe or not) will be very much appreciated!

$\endgroup$
2
  • $\begingroup$ pdepe expects an initial-boundary value problem (see its docs), but you have some slightly odd conditions: the latter two each define a second-order ODE on just halves of the domain, one at start time, one at end time. I don't see how you'd convert that to an IBVP. Also, you don't seem to have any conditions at all on the other halves of the domain. Is it definitely well-posed? $\endgroup$ – Kirill Nov 30 '15 at 3:39
  • $\begingroup$ All I know is that since this is a battery storage model, the domain should be divided into two regions, one (X < 0) for solving upwards, and the other (X > 0) in which solve downwards. Along the boundary X = 0 the solutions must be matched. I'm not sure how to capture this with pdepe, or if it can be captured at all. $\endgroup$ – meraxes Nov 30 '15 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.