Catalyst Modelling with MATLAB: Modeling Concentration Profile in Photoreactor

Click For Summary

Discussion Overview

The discussion revolves around modeling the concentration profile along the thickness of a photocatalyst film in a photoreactor using MATLAB. Participants explore the mathematical formulation of the problem, including boundary conditions and differential equations, while seeking guidance on implementation in MATLAB.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant describes the need to model mass transport by diffusion and the generation rate of a component (phenol) in a photoreactor.
  • Another participant requests resources for learning how to set up boundary conditions and differential equations in MATLAB.
  • A participant presents a second-order differential equation and transforms it into a system of first-order equations, specifying boundary conditions for the problem.
  • The same participant discusses the implementation details in MATLAB, including the use of the bvpinit and bvp4c functions, and provides initial guesses for parameters.
  • Errors encountered during the execution of the MATLAB code are reported, specifically related to the boundary value problem setup.

Areas of Agreement / Disagreement

Participants express varying levels of understanding and experience with MATLAB, and there is no consensus on the resolution of the encountered errors or the correctness of the proposed code.

Contextual Notes

The discussion includes assumptions about the mathematical formulation and the initial conditions used in the MATLAB implementation, which may not be fully resolved or agreed upon by participants.

AAMAIK
Messages
45
Reaction score
0
I have little knowledge of MATLAB. I am trying to model the concentration profile along the photocatalyst film thickness in a photoreactor. Mass Transport takes place by diffusion and the rate of generation of component is given by rA.
Boundary conditions: Concentration of the component that is converted (phenol) on the surface of the catalyst is equal to the bulk
and the concentration gradient with respect to catalyst film thickness evaluated at the other end is equal to zero.
 

Attachments

  • MATLAB 2.png
    MATLAB 2.png
    25.2 KB · Views: 280
  • MATLAB 1.png
    MATLAB 1.png
    39.2 KB · Views: 268
Physics news on Phys.org
I am asking for links from which one could learn how to set up the boundary conditions and the differential equations in MATLAB to find a solution (concentration profile along the catalytic film). I have litttle experience in using MATLAB
 
d^2c/dσ ^2+ θ^2*c/(1+Φ*c)=0
c evaluated at σ =0 is equal to 1
and the first derivative of c with respect to σ evaluated at σ =1 is equal to zero.
I put the equation above in a form of a system of first order equations by introducing the variables c1 and c2.
c1=c
c2=c'
I rewritten the governing equation as
c1'=c2
c2'=θ^2*c1/(1+Φ*c1)
with the transformed boundary condtions
c1(0)=1
c2(1)=0
The boundary value problem requires three pieces of information, the equation to be solved, its associated boundary condtions and initial guess for the solution and the parameters theta and phi.
phi=0.85
theta=4.5521
init=bvpinit(linspace(0,1,50), bc_init,phi,theta) % bc_init is an initial function profile
sol=bvp4c(@rhs_bvp,@bc_bvp, init);
σ= linspace(0, 1, 100)
BS=deval(sol,x)
plot(σ,BS(1,:)) ;I want to build bc_init
function in=bc_init(σ);
in=[cos((pi/2)*σ)];
my input is going to be a vector is my guess for c1 and c2. Looking at the solutions at the boundary points I would guess the solution to behave like Cos(pi/2*σ)
So the solver will take my guess for the parameters phi and theta and produce an initial function evaluated at 50 points between 0 and 1 and send its on sol and operates on the equation and boundary and iterates towards a solution

function bc=bc_bvp(cl,cr,phi,theta)
bc=[cl(1)-1; cr(2)];
The boundary condition function of the vector c evaluated at the values σ=0,1

the function below represents the differential equation
function rhs=rhs_bvp(σ,c,phi,theta)
rhs=[c(2); ((theta)^2*c(1)/(1+phi*c(1)


I tried to run the program but its generating these errors
w = feval(v,x(1),extraArgs{:});

Error in Guess2 (line 5)
init2=bvpinit(linspace(0,1,50),@mat4init,phi,theta);
 

Similar threads

Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
0
Views
1K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K