Clear Filters
Clear Filters

How to simulate a counter current fixed Bed Reactor

2 views (last 30 days)
Hey,
my actual Code ist below
% Iterationsschleife im Zersetzer
for i=2:length(t)
nNa(i)=nNa(i-1)-r(i-1);
cNa(i)=nNa(i)/(nHg+nNa(i));
mNa(i)=nNa(i)*MNa/1000;
nEtOH(i)=nEtOH(i-1)-r(i-1)-nvEtOH(i-1);
mEtOH(i)=nEtOH(i)*MEtOH/1000;
nNaEt(i)=nNaEt(i-1)+r(i-1);
mNaEt(i)=nNaEt(i)*MNaEt/1000;
cNaEt(i)=nNaEt(i)/(nEtOH(i)+nNaEt(i));
wNaEt(i)=mNaEt(i)/(mEtOH(i)+mNaEt(i));
y(i)=fun_Leitfaehigkeit(cNaEt(i),T(i-1)); %elektr. Leitfähigkeit in 1/Ohm oder S/m
eta(i)=fun_NatriumethylatViskositaet(wNaEt(i),TK(i-1))/1000; %Viskosität in kg/(m*s)
rho(i)=fun_EthylatDichte(wNaEt(i),TK(i-1)); % Dichte in kg/m³
cel(i)=wNaEt(i)/MNaEt*rho(i)/1000; %Elektrolytkonzentration in mol/m³
D(i)=y(i)*R*TK(i-1)/F^2; %Diffusionskoeffizient in m²/s
Sc(i)=eta(i-1)/rho(i-1)/D(i-1); %Schmidt-Zahl
Re(i)=1/(1-Epsilon)*rho(i)*vl/eta(i)*dKat; %Reynolds-Zahl Kurzweil S.289
Sh(i)=A*Re(i)^B*Sc(i)^C; %Sherwood-Zahl
j(i)=Sh(i)*F*D(i)/dh; %Stromdichte in A/m²
I(i)=j(i)*AKat; %Stromstärke in A
rk(i)=I(i)/F; % Reaktionsgeschwindigkeit in mol/s
k(i)=k0*exp(-EA/(R*TK(i-1)));
rr(i)=k(i)*cNa(i)^0.5; %Reaktionsgeschwindigkeit in mol/s
if rk(i)>rr(i);
r(i)=rr(i);
else r(i)=rk(i);
end
H2(i)=r(i)*0.5;
nvEtOH(i)=H2(i)/(1-x);
HvEtOH(i)=dHvEtOH*nvEtOH(i);
Gr(i)=Hr-Sr*TK(i-1)/1000+Hsolv;
cpEt(i)=fun_Waermekapazitaet(cNaEt(i),TK(i-1)); % in J/mol
dGr(i)=r(1)*Gr(i)+HvEtOH(i); %in kJ/mol
dTK(i)=abs((dGr(i)*1000-QHgdt)/(cpEt(i)*((nNaEt(i)+nEtOH(i)+nvEtOH(i)))));
TK(i)=TK(i-1)+dTK(i);
T(i)=TK(i)-273.15;
end
goal=(nNa(1)-nNa(end))==3527
This Code runs my fixed Bed Reactor as a cocurrent Reactor with variables nEtOH and nNa. I want to write this code as a countercurrent Reactor, nEtOH(1) meets nNa(end) and nEtOH(end) meets nNa(1) and i have absolutly no idea how to do this. A classic logarithmic mean concentration difference is not accurate enough.
I have build this model on the Data from my Reactor. In this example nNa(1) and nEtOH(1) is given, but i also want to let this loop calculate nNa(1) itself, by defining my "goal". Help is higly welcome.

Accepted Answer

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath on 24 Jul 2023
Here's how you can modify your code for a countercurrent reactor:
% Update initial conditions for countercurrent reactor
nNa(1) = % Define the initial value for nNa(1) (e.g., nNa_initial_value)
% Iterationsschleife im Zersetzer
for i = 2:length(t)
% ... (existing code remains the same) ...
% Update boundary conditions for countercurrent reactor
nNa(end) = % Define the value of nNa at the end (e.g., nNa_end_value)
nEtOH(end) = % Define the value of nEtOH at the end (e.g., nEtOH_end_value)
% ... (remaining code remains the same) ...
% Check if the goal is met
goal = (nNa(1) - nNa(end)) == 3527;
if goal
break; % Exit the loop if the goal is met
end
end
  • In the code above, you need to define the initial value for nNa(1) as well as the values for nNa at the end and nEtOH at the end, based on your specific problem and conditions. The loop will continue until the goal is met, i.e., (nNa(1) - nNa(end)) is equal to 3527.
  • Keep in mind that modifying the reactor type from cocurrent to countercurrent may require further adjustments to the equations and parameters, depending on the specific characteristics of your system. Make sure to double-check the physical meaning of each parameter and equation to ensure the model accurately represents the countercurrent reactor.

More Answers (0)

Categories

Find more on Reaction Engineering in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!