필터 지우기
필터 지우기

How can I solve PDE with boundary condition?

조회 수: 1 (최근 30일)
Riyadh Muttaleb
Riyadh Muttaleb 2017년 8월 17일
댓글: Riyadh Muttaleb 2017년 8월 30일
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
Kuifeng
Kuifeng 2017년 8월 18일
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

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

답변 (2개)

Torsten
Torsten 2017년 8월 18일
Use "bvp4c".
By the way: this is a second-order ODE, not a PDE.
Best wishes
Torsten.

Precise Simulation
Precise Simulation 2017년 8월 24일
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
Riyadh Muttaleb
Riyadh Muttaleb 2017년 8월 30일
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,

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

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by