Effacer les filtres
Effacer les filtres

Set different properties using for loop

1 vue (au cours des 30 derniers jours)
Jose
Jose le 28 Sep 2022
Commenté : Adam Danz le 28 Sep 2022
Hi, I'm modelling an adsorber bed and I need to set two different materials.
I have basic notions of programming and I would do it like this:
L=3.8
nz=380
z=linspace(0,L,Nz);
%Activated alumina first
for z=1:41
epsb=0.26; %bed porosity
dp=5E-3; %activated alumina diameter
tau=3.6; %tortuosity
rpore=4.5E-9; %pore radius
ep=0.28; %particle porosity
rhop=820; %particule density
else
epsb=0.4; %bed porosity
dp=2.7E-3; %Zeolite 13x-APG diameter
tau=4; %tortuosity
rpore=6.25E-10; %pore radius
ep=0.3; %particle porosity
rhop=1099.5; %particule density
end
I'd appreciate your help
  3 commentaires
Jose
Jose le 28 Sep 2022
Modifié(e) : Jose le 28 Sep 2022
The 380 objects/elements its just to simplify the problem it could be 100 or 1000 elements, but the length of the bed is what defines the properties
between 0-0.4 meters, activated alumina adsorps water
between 0.4-3.8 meters, zeolite adsorps CO2
thanks, Adam
Adam Danz
Adam Danz le 28 Sep 2022
I don't have enough background info on what you're doing or how the variables in your quesitons are applied to your model.
Perhaps each variable could be a 1x2 vector where var(1) value of propery var is applied to one material and var(2) applied to the other material.

Connectez-vous pour commenter.

Réponses (1)

David Hill
David Hill le 28 Sep 2022
Recommend a lookup table for the material. Then just index into when data is needed.
matLookup=[0.26,5E-3,3.6,4.5E-9,0.28,820;...
0.4,2.7E-3,4,6.25E-10,0.3,1099.5];
L=3.8
nz=380
z=linspace(0,L,Nz);
for z=1:numel(z)
idx=ismember(z,[1 5 7 9 11 17])+1;%conditional for zeolite
%do some calculations
N(z)=matLookup(idx,1)*matLookup(idx,5)/matLookup(idx,3);
end

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by