Borrar filtros
Borrar filtros

FE Model with function handle

24 visualizaciones (últimos 30 días)
Geovane Gomes
Geovane Gomes el 1 de Jul. de 2024 a las 11:34
Respondida: Umar el 2 de Jul. de 2024 a las 3:03
Hello everyone.
Is it possible to use a function handle within a femodel? So I could change the value of a material property or load, for example:
gm = multicuboid(0.5,0.1,0.1);
pdegplot(gm,FaceLabels="on",FaceAlpha=0.5);
% without function handles
model = femodel(AnalysisType="structuralStatic", ...
Geometry=gm);
E = 210e3;
P = 1000;
nu = 0.3;
model.MaterialProperties = materialProperties(YoungsModulus=E,PoissonsRatio=nu);
model.FaceLoad(2) = faceLoad(Pressure=P);
model.FaceBC(5) = faceBC("Constraint","fixed");
model = generateMesh(model);
r = solve(model);
pdeplot3D(r.Mesh,"Deformation",r.Displacement,"ColorMap",r.VonMisesStress);
% using function handles
model = femodel(AnalysisType="structuralStatic", ...
Geometry=gm);
E = @(x) x(1);
P = @(x) x(2);
model.MaterialProperties = materialProperties(YoungsModulus=E,PoissonsRatio=nu);
model.FaceLoad(2) = faceLoad(Pressure=P);
model.FaceBC(5) = faceBC("Constraint","fixed");
model = generateMesh(model);
values = [210e3 1000];
r = solve(model(values)); % I know it's wrong, once variable model has only one element, but I want to replace YoungsModulus property by values(1) and faceLoad(2) by values(2)
Index exceeds the number of array elements. Index must not exceed 1.
pdeplot3D(r.Mesh,"Deformation",r.Displacement,"ColorMap",r.VonMisesStress);

Respuestas (1)

Umar
Umar el 2 de Jul. de 2024 a las 3:03
Hi Geovane,
You asked Is it possible to use a function handle within a femodel? So I could change the value of a material property or load.
My answer is yes, it is possible to employ function handles within a femodel in Matlab. By utilizing function handles, you can dynamically adjust material properties or loads during the simulation process. This flexibility allows for the creation of more versatile and adaptive femodels that can respond to changing conditions or requirements.
Hope that answers your question.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by