- 28
- 0
- 约2.66万字
- 约 12页
- 2021-09-06 发布于山东
- 举报
ADI(交替隐式求求解抛物型偏微分方程)程序.
ADI(交替隐式求求解抛物型偏微分方程)程序.
ADI(交替隐式求求解抛物型偏微分方程)程序.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Example of ADI Method for 2D heat equation % % % % u_t = u_{xx} + u_{yy} + f(x,t) % % axb;cyd % % Test problme: % % Exact solution: u(t,x,y) = exp(-t) sin(pi*x) sin(pi*y) % % Source term: f(t,x,y) = exp(-t) sin(pi*x) sin(pi*y) (2pi^2-1) % % % % Files needed for the test: % % % % adi.m: This file, the main calling code. % % f.m:
The file defines the f(t,x,y) % % uexact.m: The exact
solution. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; close all; a = 0; b=1; c=0; d=1; n = 40; tfinal = 1; m = n; h = (b-a)/n; dt=h; h1 = h*h; r=dt/h1; x=a:h:b; y=c:h:d; %-- Initial condition: t = 0; for i=1:m+1, for j=1:m+1, u1(i,j) =
uexact(t,x(i),y(j)); end end %---------- Big loop for time t -------------------------------------
- k_t = fix(tfinal/dt); for k=1:k_t t1 = t + dt; t2 = t + dt/2; %--- sweep in x-direction -----
--------------------------------- for i=2:m, % Boundary condition. u2(1,i) = -
r/2*uexact(t1,x(1),y(i-1)) + (1+r)*uexact(t1,x(1),y(i)) + -r/2*uexact(t1,x(1),y(i+1)); u2(m+1,i) = -r/2*uexact(t1,x(m+1),y(i-1)) + (1+r)*uexact(t1,x(m+1),y(i)) + -
r/2*uexact(t1,x(m+1),y(i+1)); end for j = 2:n, % Look for fixed y(j) b=zeros(m-1,1); for i=2:m, b(i-1) = r^2/4*( u1(i-1,j-1) + u1(i-1,j+1) + u1(i+1,j-1) + u1(i+1,j+1) ) ... +
r/2*( 1-r )*( u1(i-1,j) + u1(i+1,j) + u1(i,j-1) + u1(i,j+1) )... + ( 1-2*r+r^2 )*u1(i,j) - 3/2*dt*exp( 1/2*( (i-1)*h + (j-1)*h ) -t2 ); end b(1) = b(1) + r/2 * u2(1,j); b(m-1) = b(m-1) + r/2 * u2(m+1,j); A = diag( (1+r)*ones(m-1,1) ) + diag( -r/2*ones(m-2,1),1 ) ... + diag(-r/2*ones(m-2,1),-1); ut = A\b; % Solve the diagonal matrix. for i=1:m-1,
u2(i+1,j) = ut(i); end end % Finish x-sweep. %-------------- loop in y -direction ----------- --------------------- for i=1:m+1, % Boundary condition u1(i,1) = uexact(t1,x(i),y(1)); u1(i,n+1) = uexact(t1,x(i),y(m+1)); u1(1,i) =
您可能关注的文档
- 3020A使用说明书剖析.doc
- 30448会计信息系统自考题库资料.doc
- 3112作业活动清单.doc
- 3201工作面采煤机运输安全技术措施..doc
- 3235PVC抽肥器管GDXJ2009038解析.doc
- 326132钢筋问题资料.doc
- 3275民用建筑工程造价及三材消耗量参考指标汇总.doc
- 32823队提高牛心坨区块机械钻速汇总.doc
- 330901高一选考班铝氮测试卷..doc
- 33410瓦斯抽采巷水仓解析.doc
- 山西天一大联考2025-2026学年高二上学期期末学情监测语文试题(试卷+解析).docx
- 山西忻州部分学校2025-2026学年高一上学期2月质量检测数学试题(人教B版)(试卷+解析).docx
- 山西运城市2025-2026学年高二第一学期期末调研测试数学试题(试卷+解析).docx
- 陕西省榆林市榆阳区2025-2026学年八年级上学期期末地理试题(试卷+解析).docx
- 陕西西安市碑林区2025-2026学年度第一学期期末八年级生物试题(试卷+解析).docx
- 四川省广元市苍溪县2025-2026年八年级上学期期末道德与法治试题(试卷+解析).docx
- 江苏泰州市姜堰区2025-2026学年七年级上学期1月期末数学试题(试卷+解析).docx
- 江苏省扬州市邗江区2025-2026学年九年级上学期期末考试化学试题(试卷+解析).docx
- 江西上饶市铅山县2025-2026学年第一学期期末考试八年级数学试题(试卷+解析).docx
- 江苏扬州市高邮市2025-2026学年度第一学期期末学业质量监测试题九年级英语(试卷+解析).docx
最近下载
- UCM轧机的设计原理及其弯辊横移装置的设计.pdf VIP
- 苏教版六年级下册数学 圆柱的体积 教案(教学设计).docx VIP
- 武汉市2024年中考:《物理》考试真题与参考答案.pdf VIP
- 2023年湖北省武汉市中考物理真题卷(含答案与解析).pdf VIP
- 单机架UCM轧机冷轧无取向硅钢板形控制优化.pdf VIP
- 山东省烟台市2024-2025学年高一下学期期末学业水平诊断数学试题(含答案解析).docx VIP
- 专题02 数列求和(解析版).docx VIP
- 2025版静脉输液治疗实践指南.docx VIP
- 部编人教版二年级下册语文全册教学设计(配2026年春改版教材).docx
- 专题05数列求和.docx VIP
原创力文档

文档评论(0)