Help me in Solving PDE

4 visualizzazioni (ultimi 30 giorni)
Muhammad Fahim
Muhammad Fahim il 14 Lug 2025
Commentato: William Rose il 15 Lug 2025
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 Commenti
Torsten
Torsten il 14 Lug 2025
Modificato: Torsten il 14 Lug 2025
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 il 15 Lug 2025
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.

Accedi per commentare.

Risposta accettata

William Rose
William Rose il 14 Lug 2025
Modificato: William Rose il 14 Lug 2025
[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 Commenti
Muhammad Fahim
Muhammad Fahim il 15 Lug 2025
Spostato: Torsten il 15 Lug 2025
Thank you so much for your help. I truly appreciate your time.
William Rose
William Rose il 15 Lug 2025
@Muhammad Fahim, you're welcome.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by