필터 지우기
필터 지우기

How to apply boundary conditions in pde toolbox without edge/face id?

조회 수: 8 (최근 30일)
I have a geometry which is changing slightly at each iteration and hence its boundary points change too. I want to apply a Neumann Condition to a "macroscopic edge"( which is a concatenation of several small edges) but I don't know their id from "Edgelabels" as they are more than 100 in number and change at every iteration.
How can I apply the Neumann's condition to the edge set {e_i1, e_i2,......,e_in}?

채택된 답변

Ravi Kumar
Ravi Kumar 2018년 2월 27일
편집: Ravi Kumar 2018년 2월 27일
If you have the same Neumann BC on all edges then you can try:
applyBoundaryCondition(model,'neumann','Edge',1:model.Geometry.NumEdges,'g',1)
Where g = 1 BC is used for illustration.
  댓글 수: 3
Ravi Kumar
Ravi Kumar 2018년 2월 27일
I that case, how are the edges appearing? How are you creating the changed geometry in each iteration?
Any chance you get to know the IDs of the 7 edges that needs to have a different BC?
Vishal Srivastava
Vishal Srivastava 2018년 2월 27일
편집: Vishal Srivastava 2018년 2월 28일
Okay. So I am attaching the geometry at two different instances. The lower boundary is composed of several (nearly 100) edges that get changed by delta_y and hence the change in geometry. I want to solve a pde in this dynamic domain(without the circle) and have a Neumann's condition on the lower changing boundary.
The IDs of rest 7 edges(4 of circle and other 3 of rectangle) is not remaining regular as I checked in two snaps (attached). Those 7 edges have IDs {103, 104, 105, 106, 51, 52, 53} and {103, 104, 105, 106, 54, 55, 56} at two instances when total edges were same in both cases. (=106).
On a broader scale, can you suggest some other possible way to solve pde with dynamic geometry(or some form of parametrization that may ease up the process)?
My goal is: 1)Initiate the simulation. 2)Solve pde with BC on lower(shape changing curvy boundary) 3)Evaluate the change in boundary delta_y = f(u, grad_u etc.) 4)Repeat

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

추가 답변 (2개)

Ravi Kumar
Ravi Kumar 2018년 3월 1일
Here is another approach to determine which edges are micro edges (the little ones at the bottom) and which edges are macro. This is rather a roundabout way, but it would work for you case.
I illustrate with a square example how to identify which edge is bottom edge without using its label, treat this as a micro edges of your case.
% Create a simple model, square geometry with four edges.
model = createpde;
geometryFromEdges(model,@squareg);
% Get hold on hadles to plot with edge labels on.
h1 = pdegplot(model,'EdgeLabels','on');
hp = h1.Parent;
edgeLabelsArray = hp.Children;
labelCells = {edgeLabelsArray(1:4).String};
labelNums = str2num(cell2mat(strip(labelCells','E')));
positionCells = {edgeLabelsArray(1:4).Position};
positionNums = cell2mat(positioncells');
% Y-Coordinate of labels.
yLocationOFLabels = positionNums(:,2);
% Tag an edge to be a macro edge if its label location is above a
% threshold.
yThreshold = -0.5;
macroEdgeFlag = yLocationOFLabels>yThreshold;
macroEdges = labelNums(macroEdgeFlag)
microEdges = labelNums(~macroEdgeFlag)
  댓글 수: 1
Brandon Hayes
Brandon Hayes 2021년 1월 27일
This technique works well for geometry from the "geometryFromEdges" function. However, if you want to import an STL, I found it doesn't work exactly as is. It is close, but I found that there are hidden fields within the handle that must be accessed to get the data. Here is the modification I came up with to get things working. The key is that edgeLabelsArray(1) needs to refer to the "text' handle.
model_scaled = createpde(1);
g = importGeometry(model_scaled,fullfile(main_directory,[image_file(1:end-4),' -- solid.stl']));
scale(g,pixel_per_m_ratio);
mesh_scaled = generateMesh(model_scaled,'Hmax',100e-6 .* pixel_per_m_ratio);
figure
imshow(im_raw)
hold on
h = pdegplot(model_scaled,'EdgeLabels','on');
hold off
hp = h.Parent;
edgeLabelsArray = hp.Children;
edge_labels = edgeLabelsArray(1).String; %get the edge labels of the text field
edge_labels_vector = zeros(1,length(edge_labels));
for ii = 1:length(edge_labels)
edge_labels_vector(ii) = str2num(strip(edge_labels{ii},'E'));
end
edge_vertex_data = edgeLabelsArray(1).VertexData; %get the vertex data where the label is placed

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


Ronald Haynes
Ronald Haynes 2018년 11월 21일
Vishal - did you find a working solution to your problem? I have a very similar situation that I have not been able to find a robust solution for.

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by