Apply Dirichlet BC on Vertex
3 次查看(过去 30 天)
显示 更早的评论
For solvability my problem needs to have at least a single boundary node set as Dirichlet. From the image attached, I would like to place u=0 at vertex 1. I have tried (and it worked) to use a miniscule edge near that vertex and place Diriclet conditions on it. What I don't like about that approach is that since it was more than a single node involved in the tiny edge, I was concerned that it could impact the results.
The two edges (edge 1 and 4) adjacent to vertex 1 should have a homogeneous Neumann condition (u'=0).
Is there a way to use a function and logic (example below) to have the code use Neumann on edges 1 & 4 but when x=xmax and y=ymin if uses Dirichlet?
Somewhat like this:
myPhantomFuncArgs= @(location,state) myPhantomFunc_Q(location,state,xmax,ymin);
applyBoundaryCondition(model,"neumann","Edge",[EdgeBotNotAnode EdgeRightWall],"q",myPhantomFuncArgs,"g",0);
function funcQ = myPhantomFunc_Q(location,state,xmax,ymin)
if (location.x < xmax || location.y > ymin) % Defines NOT vertex 1
funcQ = 0;
else
funcQ = 1; % Condition when at vertex 1.
end
end
This does not work since when funcQ is 1, there is still the gradient portion of the Neumann BC expression!
Thanks for any input.
Paul

0 个评论
采纳的回答
Torsten
2025-4-16
Is there a way to use a function and logic (example below) to have the code use Neumann on edges 1 & 4 but when x=xmax and y=ymin if uses Dirichlet?
No. Boundary conditions have to be set on objects one dimension lower than the region where the PDEs are defined. Since you work in 2d, these boundary objects must be 1d, thus edges.
6 个评论
Torsten
2025-4-17
I have no experience with the PDE Toolbox in particular, but usually, gridding praeprocessors allow to mesh the edges first and then to use this boundary mesh as starting point to measure the interior of the domain. Maybe the User Guide or Support can answer if and how this can be done.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!