How to create internal boundary conditions using "IF" function to solve PDEs

조회 수: 10 (최근 30일)
Hi guys, I am very new to Matlab and have a quick question for anybody willing to try and answer it. I am looking to create a 2 dimensional domain which is has an area lx*ly, lx = 4.6 and ly=3.3.I am discretizing using a staggered grid with U being the flow on the X plane and V being the flow on the Y plane. I want to apply a boundary conditon over the area inclosed by lx=0.45:1.47 and ly=0:2 to say there is no flow. I am essentially trying to cut out the area from the domain using the "IF" function. Is this possible to do and if so how would I go about doing it. I can set up the question with the IF function but the results do not change when I set Ue=0 and Ve=0.

채택된 답변

Alan Weiss
Alan Weiss 2015년 7월 29일
If I understand you correctly, then I think that you have to change the geometry of your problem to have a hole.
It doesn't sound as if you are using PDE Toolbox, but if you are, then I do not understand your comment about using a staggered grid. So perhaps I do not understand you at all. But if you are using PDE Toolbox, then it is easy to change the geometry to exclude a rectangular hole; see the instructions for command-line work, or the PDE app approach.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 2
Eoghan Mc Enery
Eoghan Mc Enery 2015년 7월 29일
Hi Alan,
Thank you for answering my question. I was not using the PDETool. I created a regular rectangular grid which was lx in length and ly in height. The grid had nx cells on x plane and ny cells on y plane. Each cell had a length of hx and hy respectively. I defined x and y as;
x=0:hx:lx
y=0:hy:ly
I then used a solver to calculate the finite element method for each node along x and y based on an average of its neighbouring nodes. This method worked perfectly for the regular square grid but I cant seem to get it to work for the more complex geometry. I have now created a mesh for the geometry using the 'initmesh' PDE tool but cannot link the mesh I have created into my original solver. Ideally I would like to be able to have the program read my mesh as points for x and y.
When using PDETool is it necessary to also use assempde to solve the PDE or are there other ways to apply PDEs to the mesh? Sorry if my questions are a bit unclear I am very new to Matlab.
Alan Weiss
Alan Weiss 2015년 7월 30일
편집: Alan Weiss 2015년 7월 30일
Sorry to say, but PDE Toolbox supports only triangular meshes in 2-D, not rectangular meshes. One potential way to get what you want is to use PDE Toolbox to solve the problem on a triangular mesh, then interpolate the solution back to a rectangular mesh. If you have R2014b or later, you can use a pdeInterpolant to calculate the interpolation.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by