How can I refine a portion of my mesh?

조회 수: 21 (최근 30일)
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2019년 9월 30일
답변: Star Strider 2019년 9월 30일
I have a 2-D grid that needs to be very fine to capture the physics. The problem with using meshgrid or ndgrid is that it plots points outside of my boundary. In order to have a grid that is fine enough, the code either takes several hours to run or the computer runs out of memory. I have identified what points are outside of my geometry in the form of a mxn logical (1's for any point in the boundary, 0's for any point outside of the boundary). I am trying to refine my mesh with the geometry after finding the boundaries. The final mesh will be a non-uniform mesh with 'NaN' at points outside of the geometry and a small grid spacing in x and y-directions. Ideally, the grid would be very fine near the upper and lower walls (y-direction) and widen in the middle, and decrease in grid spacing in the x-direction as the x increases.
Any thoughts on how I can refine an existing grid at specified locations?
  댓글 수: 5
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2019년 9월 30일
No
darova
darova 2019년 9월 30일
Where is the image?

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

채택된 답변

Star Strider
Star Strider 2019년 9월 30일
The arguments to ndgrid (or meshgrid) do not need to be uniform, they can be anything that makes sense to those functions.
Example —
x = -3:0.1:3;
v = exp(-x.^2/3);
[X,Y] = ndgrid(v);
figure
plot(X, Y)
Experiment to get the result you want.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computational Fluid Dynamics (CFD)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by