Defining the nodes of mesh on boundary as vertices over an airfoil

16 views (last 30 days)
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 Comments
Dyuman Joshi
Dyuman Joshi on 2 Sep 2023
@Aparna, why did you delete your previous question asking for making/importing a 2D geometry to solve a PDE?
Also, you can solve PDEs via the PDE Modeler App - Solve 2-D PDEs Using the PDE Modeler App.
Aparna
Aparna on 2 Sep 2023
I figured out the previous question so didn't want to put that on the forum. Thank you for asking.
I'll give the PDE modeler app a try! But will it let me give commands without requiring a manual input? Because I'm trying to run a topology optimisation prgoram and I would be having to automate the process. So having to choose the boundaries and enter the values for each iteration would definitely not be feasible.
I've attached the e591.txt coordinate file as well.

Sign in to comment.

Answers (1)

Milan Bansal
Milan Bansal on 1 Feb 2024
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.
Hope this helps!

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!