- Your mesh is sufficiently refined and uniform to accurately capture the solution's features across different domain sizes.
- The function @g1 used in the Neumann boundary condition is correctly scaled to reflect changes in (L_x) and (L_y).
- Solver settings are optimized for the problem scale and complexity.
Laplace equation with mixed boundary condition
6 次查看(过去 30 天)
显示 更早的评论
I am solving the Laplace equation with a mixed boundary condition on a rectangular area (Lx,Ly) and using this function "applyBoundaryCondition" for implementing the Neumann boundary condition.
applyBoundaryCondition(model_bulk1,'neumann','Edge',2,'g',@g1,'q',0);
I have the analytical solution and I know that the solution should only depend on Lx/Ly not values of Lx,Ly itself.
But the solution depends on the specific value of Lx, Ly
Any idea of why this happens?
0 个评论
回答(1 个)
Nipun
2024-5-16
Hi Mohammad,
I understand that you are trying to solve the Laplace equation with a mixed boundary condition on a rectangular area defined by dimensions (L_x) and (L_y). You are using the applyBoundaryCondition function for implementing the Neumann boundary condition on your model. Despite expecting the solution to depend only on the ratio (L_x/L_y), you find that it varies with the specific values of (L_x) and (L_y). This issue could stem from several factors related to the setup of your numerical model or the implementation of boundary conditions.
To address this issue, ensure the following:
Here is a concise approach to refine your mesh and check the implementation of your boundary condition in MATLAB:
% Assuming 'model_bulk1' is your PDE model
% Refine the mesh
generateMesh(model_bulk1, 'Hmax', min(Lx, Ly)/20); % Adjust 'Hmax' as needed
% Apply Neumann boundary condition with correct scaling in '@g1'
applyBoundaryCondition(model_bulk1, 'neumann', 'Edge', 2, 'g', @g1, 'q', 0);
% Ensure @g1 function is correctly scaled for Lx and Ly
function flux = g1(region, state)
% Example implementation, adjust according to your problem
flux = someScalingFunction(region.x, region.y); % Adjust this function
end
% Solve the PDE
result = solvepde(model_bulk1);
% Post-processing and visualization (as needed)
Ensure that someScalingFunction in the g1 function is appropriately defined to reflect the dependency on (L_x/Ly) rather than their absolute values. Additionally, review solver settings to ensure they are suitable for the scale of your problem, adjusting tolerance and iteration limits as necessary.
Hope this helps.
Regards,
Nipun
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!