How can I solve PDE with boundary condition?

1 visualización (últimos 30 días)
Riyadh Muttaleb
Riyadh Muttaleb el 17 de Ag. de 2017
Comentada: Riyadh Muttaleb el 30 de Ag. de 2017
Hi All, I do have Ws dC/dz + Kc d2C/dz2 - X=0 where Ws and X are constant Z from (0 to 5 step 0.5) and I do have Kc values each 0.5 m,
How can I solve this PDE with Matlab, using B.C. (C at 0= 10) and (C at 5 =0)
Thanks in advance
Riyadh
  1 comentario
Kuifeng
Kuifeng el 18 de Ag. de 2017
Example answer, Ref to Chap 5, Part 5.2 Steady 1D Convection and diffusion of 'An introduction to computational fluid dynamics 2nd edition' by Versteeg and Malalasekera

Iniciar sesión para comentar.

Respuestas (2)

Torsten
Torsten el 18 de Ag. de 2017
Use "bvp4c".
By the way: this is a second-order ODE, not a PDE.
Best wishes
Torsten.

Precise Simulation
Precise Simulation el 24 de Ag. de 2017
Alternatively, if you still prefer to solve it as a PDE, you can quite easily input and solve it with the FEATool Multiphysics FEM Finite Element toolbox directly in Matlab. The small m-script below shows how this can be achieved
% FEATool FEA problem definition.
fea.sdim = {'z'}; % Space coordinate/dimension name.
fea.dvar = {'C'}; % Dependent variable name.
fea.sfun = {'sflag1'}; % 1st order P1 FEM shape function.
s_eqn = 'Ws*Cz + Kc*Cz_z - X = 0'; % String equation definition.
fea.eqn = parseeqn( s_eqn, fea.dvar, fea.sdim );
fea.grid = linegrid( 10, 0, 5 ); % Line grid/mesh.
fea.coef = { 'Ws' 1; 'Kc' '2*z'; 'X' '3' }; % Equation coefficents/expressions.
fea.bdr.d = {10 0}; % Dirichlet BCs.
fea.bdr.n = {[] []}; % (Optional) Neumann BCs.
% Check, parse, and solve FEA problem.
fea = parseprob( fea );
fea.sol.u = solvestat( fea );
% Postprocess and visualize solution.
postplot( fea, 'surfexpr', 'C' )
  1 comentario
Riyadh Muttaleb
Riyadh Muttaleb el 30 de Ag. de 2017
Sorry for late response, In was in small vacation, I tried to implement the m-script, but an error says that "Undefined function or variable 'parseeqn'"
Thank you,

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by