您的当前位置:首页正文

problem_set

2022-06-15 来源:知库网
ProblemSetfor“IntrotoCFD”Notes

Considerthefollowingdifferentialequation

d2u

−2u3=0;2dx

0≤x≤9;

u(0)=1,

u(9)=0.1

•Applythefinite-differencemethodtothisequationtogetalinearizeddifferenceequa-tionatgridpointiawayfromtheboundary.Notethatasecond-orderdifference

approximationforthesecond-derivativeis

󰀂

dudx2

2

󰀃

i

󰀄󰀁ui−1−2ui+ui+12

=+O∆x

∆x2

•Assemblethediscretesystemofequationsforafour-pointgridintoamatrixsystemoftheform

[A]{u}={b}where

{u}={u1u2u3u4}T

•DevelopaMATLABprogramtosolvethefinite-differenceequationsonagridwithNpoints.Applythiscodetoobtainthesolutionona4-pointgrid(∆x=3).Fortheinitialguess,usealinearvariationbetweenthetwoboundaryvalues.Convergeyoursolutionuntiltheresidualisbelow10−6.Plottheresidualsvs.iterationnumber.Hint:InMATLAB,initializeallelementsof[A]tozero.Forrowiof[A]when2≤i≤N−1,youneedtosetonlytheelementsAi,i−1,Ai,iandAi,i+1.

•Plotthefinite-differencesolutionobtainedonthe4-pointgridandcompareitwiththeexactsolution

1

uexact=

x+1•UseyourMATLABprogramtoobtainthesolutionona7-pointgrid(∆x=1.5).Plotthesolutionandcompareitwiththesolutionforthe4-pointgridandtheexactsolution.

1

因篇幅问题不能全部显示,请点此查看更多更全内容