Defining the nodes of mesh on boundary as vertices over an airfoil
16 次查看(过去 30 天)
显示 更早的评论
Hi, I'm trying to define the outer nodes of an airfoil mesh as vertices of the model so as to assign force values at these points. But when i try to do so using the addVertex function I get this error 'Specified point too far from the boundaries' and only about 3/4th of the nodes are added as vertices. But I know for a fact that all the nodes do lie on the surface as the mesh is generated from the same geometry. Can anyone please tell me how I can fix this?
Would be of great help. Thank you!
3 个评论
Dyuman Joshi
2023-9-2
@Aparna, why did you delete your previous question asking for making/importing a 2D geometry to solve a PDE?
回答(1 个)
Milan Bansal
2024-2-1
Hi Aparna,
I understand that you are facing the error "Specified point too far from the boundaries." when using the "addVertex" function for defining the outer nodes of the air-foil mesh as vertices.
The error can be resolved by increasing the value of the "Hmax" parameter in the "generateMesh" function. This will ensure sufficient mesh size when creating the mesh. Also, increase the value of alpha radius ("alpha") when creating alpha shape using the "alphaShape" function.
Please modify your code as shown in the code snippet below. (The changes are prefixed by "%%%")
% airfoil import
filename = 'e591.txt';
% Read the airfoil coordinate file using importdata
data = importdata(filename);
% Extract X and Y coordinates from the data
%%% Modification: data(:,1) intead of data.data(:,1)
X1 = data(:, 1);
Y1 = data(:, 2);
XY = data;
% Define airfoil geometry (example)
x_upper = X1(1:35,:);
y_upper = Y1(1:35,:);
x_lower = X1(36:end,:);
y_lower = Y1(36:end,:);
% Define airfoil geometry (example coordinates)
airfoil_upper = [x_upper,y_upper]; % Upper surface points
airfoil_lower = [x_lower,y_lower]; % Lower surface points
% Define compliant airfoil structure geometry (example coordinates)
x_12= [airfoil_upper;airfoil_lower]; % Airfoil outline points
pg = polyshape(x_12(:, 1), x_12(:, 2));
plot(pg);
tr = triangulation(pg);
% Create a PEDE Model
pdem = createpde('structural','static-planestress');
tnodes = tr.Points';
telements = tr.ConnectivityList';
g=geometryFromMesh(pdem,tnodes,telements);
%%% Modification : 'Hmax' value changed from 0.02 to 0.5
msh=generateMesh(pdem,'Hmax',0.5);
%%% Modification : 'alpha' value changed from 0.01 to 1.5
alpha = 1.5;
hull = alphaShape(msh.Nodes(1,:)', msh.Nodes(2,:)', alpha);
% get boundary faces
[BF, outer_points] = boundaryFacets(hull);
max_val=max(outer_points(:,1));
index=find(outer_points == max_val);
outer_points_complete=[outer_points(index:end,:);outer_points(1:index,:)];
outer_points=outer_points_complete(1:2:end-1,:);
figure
pdemesh(pdem);
hold on;
addVertex(g,"Coordinates",outer_points);
pdegplot(pdem,"EdgeLabels","on","VertexLabels","on")
Please refer to the following documentation links to learn more about "generateMesh" and "alphaShape" function.
- https://www.mathworks.com/help/pde/ug/pde.pdemodel.generatemesh.html
- https://www.mathworks.com/help/matlab/ref/alphashape.html
Hope this helps!
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!