Effacer les filtres
Effacer les filtres

FE Model with function handle

24 vues (au cours des 30 derniers jours)
Geovane Gomes
Geovane Gomes le 1 Juil 2024 à 11:34
Réponse apportée : Umar le 2 Juil 2024 à 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);

Réponses (1)

Umar
Umar le 2 Juil 2024 à 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.

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by