FE Model with function handle

24 次查看(过去 30 天)
Geovane Gomes
Geovane Gomes 2024-7-1,11:34
回答: Umar 2024-7-2,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);

回答(1 个)

Umar
Umar 2024-7-2,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.

类别

Help CenterFile Exchange 中查找有关 Unified Modeling 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by