フィルターのクリア

How to solve fick's 2nd law of diffusion equation?

22 ビュー (過去 30 日間)
Nonlinear
Nonlinear 2017 年 11 月 21 日
コメント済み: Nonlinear 2017 年 11 月 24 日
Hello everybody,
I am trying to solve a PDE which has the form:
dC/dt = (1+c)^2/{(1+c)^2+1}d2C/dx2
Can Matlab solve such a equation like that? If it can, how can I set it up?
Thanks for any help.

採用された回答

Precise Simulation
Precise Simulation 2017 年 11 月 22 日
Modeling and simulation of convection and diffusion is certainly possible to solve in Matlab with the FEA Toolbox, as shown in the model example below:
% Set up 1D domain from 0..1 with 20 elements.
fea.sdim = { 'x' };
fea.grid = linegrid( 20, 0, 1);
% Add covection and diffusion physics mode.
fea = addphys( fea, @convectiondiffusion, {'C'} );
% Define diffusion coefficient.
fea.phys.cd.eqn.coef{2,end} = {'d_coef'};
fea.expr = { 'c', {'1.23'} ;
'd_coef', {'(1+c)^2/((1+c)^2+1)'} };
% Use c = -1 on right boundary, and insulation
% flux boundary conditions on the left.
fea.phys.cd.bdr.sel = [ 1 3 ];
fea.phys.cd.bdr.coef{1,end}{1} = -1;
% Check, parse, and solve problem
% with initial condition 'C=2*x'.
fea = parsephys( fea );
fea = parseprob( fea );
[fea.sol.u,tlist] = ...
solvetime( fea, 'dt', 0.1, 'tmax', 1, 'init', {'2*x'} );
% Alternatively, solvestat can be used for stationary problems.
% Postprocessing.
isol = length(tlist);
postplot( fea, 'surfexpr', 'C', 'solnum', isol )
title( ['Solution at time, t = ',num2str(tlist(isol))] )
ylabel( 'Concentration, C' )
  1 件のコメント
Nonlinear
Nonlinear 2017 年 11 月 24 日
Thank you very much for your help.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!