boundary conditions in nodes of a plate

15 visualizzazioni (ultimi 30 giorni)
I have defined a mesh and different subdomains. These may change depending of the number of regions that I need to create, therefore the edge numbering changes. Is there any way that I can apply boundary conditions to all the left edge of the plate. Sorry if the question is silly, I am quite new in Matlab

Risposta accettata

Gayatri Rathod
Gayatri Rathod il 30 Mar 2023
Hi Jorge,
In MATLAB, you can apply boundary conditions to specific edges of a mesh using the applyBoundaryCondition function. Here's an general example of how you can apply a boundary condition to all the left edges of your mesh, regardless of their numbering:
% Get the coordinates of all the nodes in the mesh
nodes = pdegeom(msh.MeshInfo);
% Find all the left edges by checking if their starting coordinates have x = xmin
xmin = min(nodes(1,:));
left_edges = find(nodes(1,msh.MeshEdges(1,:))==xmin);
% Apply boundary conditions to all the left edges
for i = 1:length(left_edges)
edge_number = left_edges(i);
applyBoundaryCondition(model,'edge',edge_number,'u',0);
end
Here, ‘msh is the object representing your mesh and model is the object representing your PDE model. First use pdegeom to extract the coordinates of all the nodes in the mesh. We then find all the left edges by looking for edges whose starting node has the smallest x-coordinate. Finally, we loop over all the left edges and apply a Dirichlet boundary condition with u=0.
Note: You can adjust the boundary condition type and value as needed for your specific problem, above code is just sample example.
You can read more about the pdegeom, find and applyBoundaryCondition from the following documentations: pdegeom Documentation, find function Documentation,applyBoundaryCondition Documentation.
Hope it helps!  
Regards,
Gayatri Rathod

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by