How do I construct a mesh in PDE Solver from only the boundary points?

3 ビュー (過去 30 日間)
Ghazwan Ghassan
Ghazwan Ghassan 2021 年 5 月 19 日
回答済み: Vinayak 2024 年 5 月 14 日
Basically, the title. I have a non-uniform or clustered mesh on which I would like to solve a particular PDE but I can't figure out how. I know the boundary points and nothing else. Any help?

回答 (1 件)

Vinayak
Vinayak 2024 年 5 月 14 日
Hi Ghazwan
You can use triangulation to get the connections and nodes, which could be fed into thegenerateFromMesh’ function. I have a sample code with points in a distorted circle geometry, that are fed into delaunayTriangulation and a mesh is generated post that.
% Generate random points
numPoints = 10;
theta = linspace(0, 1.95*pi, numPoints);
r = 1; % Radius of the circle
x = r * cos(theta) + rand(1, numPoints) * 0.1; % Adding small randomness
y = r * sin(theta) + rand(1, numPoints) * 0.1;
% Create a PDE model
model = createpde();
% Generate Delaunay triangulation
DT = delaunayTriangulation(x', y');
% Use the triangulation to define the geometry in the PDE model
geometryFromMesh(model, DT.Points', DT.ConnectivityList');
% Generate the mesh
mesh = generateMesh(model,'Hmax',0.2); % Adjust 'Hmax' as needed
% Plot the mesh
figure;
pdemesh(model);
axis equal;
You can read more about triangulation and geometryFromMesh here:
I hope this helps!

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by