Help me in Solving PDE

조회 수: 3 (최근 30일)
Muhammad Fahim
Muhammad Fahim 2025년 7월 14일
댓글: William Rose 2025년 7월 15일
How to solve the below problem in MATLAB with finite difference method.
equation:
λ ∂²w/∂t² + ∂w/∂t = Re² e^(iωt) + ∂²w/∂x² + ∂²w/∂y²
initial conditions:
w(t=0) = 0, ∂w/∂t(t=0) = 0
boundary conditions:
w(x=±1) = 0, w(y=±r) = 0
parameters:
λ=6, Re=10, ω=1, r=1, t_final=pi/2.
Stability condition: dt<=(dh^2)/8, where dh=dx=dy.
The figure for these values is attached here
  댓글 수: 4
Torsten
Torsten 2025년 7월 14일
편집: Torsten 2025년 7월 14일
Thank you for the background information. For me as a mathematician, the names of the equations usually help me to find adequate discretization schemes from the literature. Many times I wished I had a better understanding about the physical background - it would have made it much easier to interprete and occasionally discard results.
William Rose
William Rose 2025년 7월 15일
One can interpret the equation as the wave equation for an elastic membrane with fluid resistance and uniform-in-space external forcing, F(t).
The term is the dissipative term due to resistance to motion. If an elastic membrane were actually a fine elastic mesh, then the faster the mesh goes through the air, the more drag there is on it.

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

채택된 답변

William Rose
William Rose 2025년 7월 14일
편집: William Rose 2025년 7월 14일
[Edit: fix typos (none in code).]
Write the finite difference equations and solve it explicitly. This approach is not very elegant or efficient, but it will work if you choose and and small enough, and so they satisfy the stability criteria.
Your equation includes Re² e^(iωt) , where Re=10. Are you trying to take the real part, or do you really want a complex driving force and a complex solution?
Let w be indexed by i,j,k, which correspond to x, y, and t respectively. Then the finite difference equation can be written
Rearrange the equation above to solve for w(i,j,k+1), which is w() at the next time point:
Rearrange some more:
The equation immediately above is what you want: an equation for w at the next time point, in terms of w at earlier time points.
Write code with three nested for loops. The outside loop is over k (time). The inside loops are over i and j (x and y). In the inner-most loop, update w. Enforce the temporal and spatial boundary conditions.
Here is some pseudo code:
% define dx, dy, dt appropriately, respecting the stability criteria
% define imax, jmax, kmax appropriately
w=zeros(imax,jmax,kmax) % initialize w
for k=2:kmax-1
for i=2:imax-1
for j=2:jmax-1
w(i,j,k+1)=(right hand side); % use right hand side of long equation above
end
end
end
k=1,2 corresponds to t=-dt, t=0. w=0 at these times, according to the initial conditions, and we have initialized it as such. The code computes the values for w(i,j,k) starting at k=3, which corresponds to t=+dt. This allows me to apply the initial conditions without getting an invalid array index error.
The i loop goes from 2 to imax-1 so that there won't be an array index error at the edges, and this also enforces the boundary condition on x, which is that w=0 at x=+1,-1.
The j loop goes from 2 to jmax-1 so that there won't be an array index error at the edges, and this also enforces the boundary condition on y, which is that w=0 at y=+1,-1.
Check my equations above carefully, to make sure there are no mistakes.
Good luck.
  댓글 수: 5
Muhammad Fahim
Muhammad Fahim 2025년 7월 15일
이동: Torsten 2025년 7월 15일
Thank you so much for your help. I truly appreciate your time.
William Rose
William Rose 2025년 7월 15일
@Muhammad Fahim, you're welcome.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by