Applying Neumann boundary conditions to a system
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Bach
el 2 de Mzo. de 2023
Respondida: Abhijeet
el 6 de Mzo. de 2023
Hi there,
My system comprises a 2D rectangular plate of legnth 1 unit and width 2 units. I am currently trying to apply Neumann boundary conditions to this system.
So far, I have formed a discrete Laplaican using the delsq function and now want to impose Neumann boundary conditions at all sides of the plane although I am struggling to work out how I can do this.
Any suggestions as to how I could go about doing this would be greatly appreciated.
Best regards,
0 comentarios
Respuesta aceptada
Abhijeet
el 6 de Mzo. de 2023
Hi,
To impose Neumann boundary conditions, modify the Laplacian matrix to account for the boundary conditions. The Laplacian matrix is formed using the delsq function, which discretizes the Laplacian operator.
To impose Neumann boundary conditions, modify the Laplacian matrix by adjusting the rows and columns corresponding to the boundary nodes. Here is some sample code that demonstrates how to modify the Laplacian matrix to impose Neumann boundary conditions on a rectangular plate with a length of 1 unit and a width of 2 units:
% Let nx be the number of grid points in x direction
% Lap be the Laplacian Matrix formed by the delsq function
% Modify the Laplacian matrix to impose Neumann boundary conditions on all sides of the plate
for i = 1:nx
% Modify the top and bottom rows
Lap(i,:) = Lap(i,:) - Lap(i,1);
Lap(i,:) = Lap(i,:) - Lap(i,end);
% Modify the left and right columns
Lap(:,i) = Lap(:,i) - Lap(1,i);
Lap(:,i) = Lap(:,i) - Lap(end,i);
end
Thanks
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!