##
Description

All variables and steps adopted in the development of algorithms must be duly identified with comments in the code. Printing the results in the work window of the Scilab must also be duly identified. Don’t forget to discuss about each result obtained.

Q1) A biofilm with thickness Lf grows on a solid surface, as shown in Figure 3. On the surface of the biofilm, there is a layer with thickness L through which a certain compound A diffuses, which, when entering the biofilm, is subject to an irreversible reaction of first order that converts compound A into compound B.

Figure 3. Diffusion mechanism in the biofilm. (liquid medium, diffusion layer, biofilm, solid surface)

The steady-state mass balance equations that describe the variation in A concentration across the diffusion layer and the biofilm are as follows:

Figure 1. Formula 1

Where D = 0.8 cm2/s is the diffusion coefficient in the diffusion layer, Df = 0.064 cm2/s is the diffusion coefficient in the biofilm, and k = 100 s-1 is the rate for the A to B conversion reaction As boundary conditions, it can be assumed that the concentration of compound A is constant in the liquid medium (x = 0) so that:

Figure 2. Formula 2

The solid surface can be considered impermeable, so that the following condition is satisfied:

Figure 3. Formula 3

Assuming that L = 0.004 cm, Lf = 0.008 cm and CA0 = 0.1 mol/cm3, use the finite difference method with Δx = 0.001 to obtain the distribution of compound A along the diffusion layer and the biofilm. It can be assumed that the mass transfer resistance at the biofilm/diffusion layer interface is negligible, so that the concentration on both sides of the interface is the same.