Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Pdepe Boundary condition
Replies: 3   Last Post: Feb 18, 2013 2:22 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten

Posts: 1,457
Registered: 11/8/10
Re: Pdepe Boundary condition
Posted: Feb 13, 2013 2:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Dhivakar " <dhivakarg@live.com> wrote in message <kff4h7$m4f$1@newscl01ah.mathworks.com>...
> Hello everyone,
> Im trying to solve this equation using pdepe solver, but i colud not fix the boundary conditions correctly into the code.
>
> dCa/dt = k (d2Ca/dZ2)
> the boundary conditions and initial conditions are
>
> dCa/dz = 0 at z = 0, t>0
> Ca(z,t) = 0 at z = L, t>0
> Ca(z,t) = Ca0 at t=0, Z (0,L)
> z is height of medium, z = 0 is surface, z = L is bottom end
>
> code that im using is
> function pdex1
> m = 0;
> x = linspace(0,3,30);
> t = linspace(0,30000,30);
> 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 30 mesh points.')
> xlabel('Distance z(m)')
> ylabel('Time t (days)')
> zlabel('concentraton (kg/m3)')
>
> % A solution profile can also be illuminating.
> figure
> hold on
> for il=1:2:length(t)
> plot(t,u(:,il))
> hold on
> end
> %Gives the plot at the last timestep
> title('Concentration profile')
> xlabel('Time t (days)')
> ylabel('concentraton (kg/m3)')
> % --------------------------------------------------------------
>
> function [c,f,s] = pdex1pde(x,t,u,DuDx)
> c = 29164.8;
> f = DuDx;
> s = 0;
> % --------------------------------------------------------------
>
> function u0 = pdex1ic(x)
> u0 = 1;
>
>
>
> % this part is what is problematic
> % --------------------------------------------------------------
> function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
> pl = 0;
> ql = 0;
> pr = 0;
> qr = 1;
> % --------------------------------------------------------------
>
>
> kindly help me to solve this problem
>
> Thank you


1. In pdex1ic, set u0=0 at x=30.
2. In pdex1bc, set pl=0,ql=1,pr=ur,qr=0.

Best wishes
Torsten.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.