PDEmodel with in house geometry? (vs. femodel)

4 visualizaciones (últimos 30 días)
Michela
Michela el 11 de Jun. de 2024
Respondida: Yatharth el 17 de Jun. de 2024
Hello everyone!
I am trying to solve a heat transfer problem with flow in a cylinder using PDE toolbox. I reported the beginning of my code below - I am currently stuck with adding a geometry.
I have worked with heat transfer problems using femodel before, but never figured out how to make a 3D geometry in Matlab (e.g. multicylinder below) and add it to a pdemodel. It seems that the only option is importGeometry, but I do not have an stl file to import and I would prefer to keep it within Matlab with no file imports. Does anybody have suggestions? Thank you!
model1= createpde;
% Setting Variables
geom = multicylinder(1,1);
pdegplot(model1,'FaceLabels','on','CellLabels','on','EdgeLabels','on')
% Setting PDE Coefficients
m =@(location,state)-k*(location.x.^2+location.y.^2)^(1/2);
d =@(location,state)(location.x.^2+location.y.^2)^(1/2)*rho*cp*v_max*(1-((location.x.^2+location.y.^2)^(1/2)/R)^2);
c =@(location,state)k*(location.x.^2+location.y.^2)^(1/2);
f =@(location,state)(4*mu*(v_max^2)/R^2)*((location.x.^2+location.y.^2)^(3/2)/R^2);
a = 0;
Coeff = specifyCoefficients(model1,"m",m,"d",d,"c",c,"a",a,"f",f)

Respuestas (1)

Yatharth
Yatharth el 17 de Jun. de 2024
Hi Michela,
After creating the geometry, you need to add it to your model. This is where it seems your code may be missing a step. You should use the "geometryFromEdges" function for 2D geometries or "geometryFromMesh" for 3D geometries. Since "multicylinder" creates a 3D geometry, you should generate a mesh and then add it:
% Decompose the geometry into a mesh
[meshNodes, meshElements] = generateMesh(geom, 'Hmax', 0.1); % Adjust 'Hmax' as needed for mesh density
% Add the geometry to the model
geometryFromMesh(model1, meshNodes, meshElements);
Here are the relevant links for you to refer:

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by