Modelling of two phase flow in packed bed (continued)

In summary: I don't know actually, but I think you will be right about the CO2 depositing temporarily on the bed. What I thought would happen (assuming a bed colder than the freezing point of CO2) was that the ambient CO2 enriched stream would enter the cold bed and immediately the CO2 at the 'front' of the stream would freeze. The pure air would carry on through the bed. Then the newly entering stream - which is at ambient temperature - would vaporise the frozen CO2, and the vaporised CO2 plus the CO2 'behind' it in the stream would now be frozen/deposited slightly further downstream. This process repeats until you
  • #106
casualguitar said:
Just one other question - I'll be using the previous HTC functions I made for this (plus a new one for the Sc number). I think there is a bug in one of my functions though. Do you know what the typical ranges for the Pr, Re, Nu, Sc numbers and U in the previous model (model 1) would be? Just to help with the debug!

This is why I suggested in the previous model that you compare the two gas phase correlations given in BSL and your other reference.
casualguitar said:
Also I believe you previously commented on my sleeping patterns (early on in model 1). I see you're also awake at a quite early time of 4am! An early bird or a late night owl?
My dog was barking, and he pooped on the kitchen floor before I could get him outside.
casualguitar said:
Edit:
Lastly, we had the lumping of the convective and conductive terms in the last model for U:
View attachment 299934
Does the same lumping apply for the convective and diffusive mass transfer? Meaning that we would get something like:
$$k_i = \frac{1}{\frac{1}{k_{fs}} + \frac{dp/\beta}{D}}$$
No. There is no diffusion in the solid bed particles. You just use the mass transfer coefficient for the gas phase. The mass transfer model just applies from the bulk gas to the solidification interface.
 
Engineering news on Phys.org
  • #107
Chestermiller said:
Just google "diffusivity of CO2 (and H2O)" in Nitrogen. That should be good enough. BSL will have H2O probably.
Are we looking for a correlation here or assuming a constant?

Chestermiller said:
This is not going to be exact. I would use T at the interface.
Chestermiller said:
This would be adequate too. Like I said, it won't be exact. This is a judgment call.
It will be a small code change to switch between these so that can be decided later

Chestermiller said:
I can't read your handwriting again. Please use Latex or provide a post # from the previous thread.
Screenshot 2022-04-14 at 11.49.26.png

Screenshot 2022-04-14 at 11.50.05.png

So this is the model I would be using (same as model 1) to calculate ##U_g## and ##U_b##. ##U_g## is evaluated using ##\frac{(TI+TG)}{2}## and ##U_B## using ##\frac{(TI+TB)}{2}##. You suggested earlier using ##T_I## for both. Would this not mean that ##U_g## would be equal to ##U_b## always?
 
  • #108
Chestermiller said:
This is why I suggested in the previous model that you compare the two gas phase correlations given in BSL and your other reference.
Would you know the expected order for these parameters (Re, Pr, Nu, U)?
Chestermiller said:
My dog was barking, and he pooped on the kitchen floor before I could get him outside.
Ideal start to the day!
 
  • #109
Chestermiller said:
No. There is no diffusion in the solid bed particles. You just use the mass transfer coefficient for the gas phase. The mass transfer model just applies from the bulk gas to the solidification interface.
I think I understand. So the mass and heat transfer models are equivalent, except we leave out the final 'lumping' equation as we had in the heat transfer model? Leaving us with this mass transfer model:
Screenshot 2022-04-14 at 12.02.54.png

Seem reasonable to you?
 
Last edited:
  • #110
casualguitar said:
I think I understand. So the mass and heat transfer models are equivalent, except we leave out the final 'lumping' equation as we had in the heat transfer model? Leaving us with this mass transfer model:
View attachment 299937
Seem reasonable to you?
No. $$Sh_{loc,i}=(2.19 Re^{\frac{1}{3}}+0.78 Re^{0.619})Sc^{\frac{1}{3}}$$
 
  • #111
Chestermiller said:
No. $$Sh_{loc,i}=(2.19 Re^{\frac{1}{3}}+0.78 Re^{0.619})Sc^{\frac{1}{3}}$$
Whoops yes I got that result also

The last bit seems to be the diffusivity of both CO2 and H2O in N2. A constant value or a temperature dependent correlation? I can find approximate constant values easily (approx 0.22cm2/s and 0.15 cm2/s for water and CO2, both at 273K). There seems to be a lot of literature on this though so correlations should be available

One question - how does this model deal with liquid phase water?
Looking at the heat balances and this equation
Screenshot 2022-04-16 at 00.19.10.png

there seems to be no reason why we couldn't swap out the heat of fusion for the heat of vaporisation here as required.

However for the mass balances we don't seem to have a way to track the amount of liquid present, only solid deposition, so my thought is that this model effectively assumes that water moves from gas phase to solid phase and back very quickly i.e. fast enough to assume no liquid phase is present? Is this the assumption being made in Tuinier et al also?

Besides those correlations to be found, it looks like the computational flow is the next point?

Screenshot 2022-04-16 at 00.27.39.png

Hmm I don't understand at what point we can actually solve for the ##q## values

Similar to the last model we know ##\dot{m}_0## into the bed so we can solve the gas phase mole balance immediately I think. To solve for the ##q## values we need ##T_g## and ##T_b## which we don't have yet, so my guess is that the gas and bed heat balances must be solved simultaneously? Then we can also solve the solid phase mass balance once we have these temperatures and the interface temperature

Once we have ##T_g## and ##T_b## we can solve for the mass flow out of a tank. This cycle then repeats for the other beds
 
  • #112
casualguitar said:
Whoops yes I got that result also

The last bit seems to be the diffusivity of both CO2 and H2O in N2. A constant value or a temperature dependent correlation? I can find approximate constant values easily (approx 0.22cm2/s and 0.15 cm2/s for water and CO2, both at 273K). There seems to be a lot of literature on this though so correlations should be available
See Chapter 17 of BSL.
casualguitar said:
One question - how does this model deal with liquid phase water?
Looking at the heat balances and this equation
View attachment 300047
there seems to be no reason why we couldn't swap out the heat of fusion for the heat of vaporisation here as required.

However for the mass balances we don't seem to have a way to track the amount of liquid present, only solid deposition, so my thought is that this model effectively assumes that water moves from gas phase to solid phase and back very quickly i.e. fast enough to assume no liquid phase is present? Is this the assumption being made in Tuinier et al also?
This is a bit of a dilemma. Tuinier are assuming that water deposits as liquid and CO2 deposits as solid. But there is no allowance for the conversion of deposited liquid water to deposited ice in their approach, even if they did switch from the liquid to the solid vapor pressure curve to describe the behavior during the deposition. The heat of vaporization of water is >540 cal/gm, and the heat of fusion of water is 80 cal/gm, so it may not matter much. They may be using a single value for the heat of phase change of water and a single value for CO2, irrespective of temperature. This neglects:
1. Changes is heat of sublimation or vaporization with temperature
2. Heat of fusion of water
3. Changes in sensible heat of deposits.
4. The deposition processes of H20 and CO2 do not interact
This seems to be the approximation they are using in this model, and it may be a pretty good approximation, in view of other approximations that are inherent in the model.
casualguitar said:
Besides those correlations to be found, it looks like the computational flow is the next point?

View attachment 300048
Hmm I don't understand at what point we can actually solve for the ##q## values
These are expressed in terms of the deposition rates, heats of deposition, bulk temperature of the bed and gas, and heat transfer coefficients by the equations I gave.
casualguitar said:
Similar to the last model we know ##\dot{m}_0## into the bed so we can solve the gas phase mole balance immediately I think. To solve for the ##q## values we need ##T_g## and ##T_b## which we don't have yet, so my guess is that the gas and bed heat balances must be solved simultaneously? Then we can also solve the solid phase mass balance once we have these temperatures and the interface temperature

Once we have ##T_g## and ##T_b## we can solve for the mass flow out of a tank. This cycle then repeats for the other beds
This looks OK. I recommend doing each tank in sequence at a given time step using Crank-Nicholson type approximation.
 
  • #113
Chestermiller said:
These are expressed in terms of the deposition rates, heats of deposition, bulk temperature of the bed and gas, and heat transfer coefficients by the equations I gave.
Yes however I'm not sure yet if they are solved at each position/time step independently of the ODEs they are part of i.e. do we solve for the q values first and then use these values in solving the relevant ODEs, or are the q values solved for at the same time as the ODE is being solved (simultaneously)
Chestermiller said:
I recommend doing each tank in sequence at a given time step using Crank-Nicholson type approximation.
Previously we used the available integrators (ODEint and solve_ivp). Neither of these have a CN approximation available. Are you suggesting hard coding the CN solution, rather than using an integrator library? I have no issue with that the learning might be good. Is there any advantage to hard coding rather than using an available integrator here?
 
  • #114
casualguitar said:
Yes however I'm not sure yet if they are solved at each position/time step independently of the ODEs they are part of i.e. do we solve for the q values first and then use these values in solving the relevant ODEs, or are the q values solved for at the same time as the ODE is being solved (simultaneously)
No. The expressions for the q's are substituted into the two respective heat transfer differential equations.
casualguitar said:
Previously we used the available integrators (ODEint and solve_ivp). Neither of these have a CN approximation available. Are you suggesting hard coding the CN solution, rather than using an integrator library?
Sure. That's not a problem right? I'm suggesting solving them for each tank at each time step using predictor-corrector.
casualguitar said:
I have no issue with that the learning might be good. Is there any advantage to hard coding rather than using an available integrator here?
The available integrators won't do one tank at a time in sequence.
 
  • #115
Chestermiller said:
No. The expressions for the q's are substituted into the two respective heat transfer differential equations.
Got it
Chestermiller said:
Sure. That's not a problem right? I'm suggesting solving them for each tank at each time step using predictor-corrector.
No problem with that. I actually prefer the idea of doing this manually because I think it would be beneficial/interesting to see exactly what's going on (the integrator libraries sort of hide this). It is also what my own supervisor suggested for the previous model (before I used an integrator library)

Chestermiller said:
I'm suggesting solving them for each tank at each time step using predictor-corrector.
Ok. I have never coded something like this manually. I have seen examples of CN being implemented in python though so I can follow these

Chestermiller said:
The available integrators won't do one tank at a time in sequence.
Is this not what we did in the previous model? Solve for all values across all tanks at a single time before continuing to the next time step?

Lastly, if the available integrators won't do one tank at a time in sequence, why choose this approach? What is the advantage of this?

To be clearer on the above question, I'm asking -
Why did we use an integrator for the previous model rather than manually code it, and why is this approach not being used this time around. i.e. what is different between the two models that it is better to manually code CN this time?

Will do a final collation of the equations/correlations this evening and then start the CN solution tomorrow. I think for now I'll assume a constant value for everything I reasonably can i.e. just focus on getting actual solutions to the differential equations without worrying about correlations etc being used right also
 
  • #116
casualguitar said:
Got it

No problem with that. I actually prefer the idea of doing this manually because I think it would be beneficial/interesting to see exactly what's going on (the integrator libraries sort of hide this). It is also what my own supervisor suggested for the previous model (before I used an integrator library)Ok. I have never coded something like this manually. I have seen examples of CN being implemented in python though so I can follow theseIs this not what we did in the previous model? Solve for all values across all tanks at a single time before continuing to the next time step?

Lastly, if the available integrators won't do one tank at a time in sequence, why choose this approach? What is the advantage of this?
Actually, I was mistake about all this. Sorry. There is no reason why the automatic integrator can't be used if the time derivatives of the dependent variables are calculated in the proper sequence. In particular, 1. all the time derivatives for a given tank (value of z) are calculated first, and then 2. the value of ##\dot{m_j}## is calculated for that tank before moving on to the next tank.

I don't know how I didn't realize that, and I almost led you astray. Again, sorry.

Regarding the automatic integrators, they are much more preferable than ad hoc user integration schemes because (a) they make things so easy, only requiring you to provide code for calculating the time derivatives based on the solution vector, (b) they have automatic error (accuracy) control, (c) they have automatic step size control, (d) they have automatic order control, and (e) they are stable. So they are very efficient and powerful. There is no reason why you can't study the literature (e.g., the literature on the Gear integrator) to get an understanding of how this is all accomplished.
casualguitar said:
To be clearer on the above question, I'm asking -
Why did we use an integrator for the previous model rather than manually code it, and why is this approach not being used this time around. i.e. what is different between the two models that it is better to manually code CN this time?
My mistake. Stick with the automatic integrator.
 
  • #117
Chestermiller said:
There is no reason why the automatic integrator can't be used if the time derivatives of the dependent variables are calculated in the proper sequence. In particular, 1. all the time derivatives for a given tank (value of z) are calculated first, and then 2. the value of mj˙ is calculated for that tank before moving on to the next tank.
So ##\dot{m_j}## is the last thing to be calculated for a given tank for a given time step. Understood. However the order of calculation of time derivatives isn't clear to me yet. Does the order actually matter here? Or should it be:
1) the gas and solid phase heat balances are solved first simultaneously
2) the gas and solid deposition mole balances are solved (not simultaneously they can be solved independently)
3) ##\dot{m_j}## for the tank is solved
4) repeated for all tanks

I might be overcomplicating the below, but anyway:

So to be solved are:
- 3 gas phase mole balances
- 3 has phase heat balances
- 1 bed heat balance
- 2 solid phase heat balance (CO2 and H2O)
- 3 'molar flow out of tank' equations

The initial and boundary conditions would be (assuming the bed is initially cold and just has nitrogen in it):

ICs:
- molar holdup of nitrogen
- bed temperature
- nitrogen temperature (same at the bed temperature initially)
- mole fraction of nitrogen (equal to 1 in this case)

BCs:
- molar flow of each component into the bed
- mole fraction of each component into the bed (or we can calculate this from the above)
- temperature of the flow into the bed

So at each point in the bed we are solving for
- the mole fraction of component i (N2,H2O, CO2). We will get three y values at each point
- bed temperature
- temperature of the gas (all components assumed at the same temperature)
- total deposition (moles) of component i
- molar flow of component i

And in addition, the computational flow for solving the system of ODEs mentioned above applies to all components individually i.e. there is no dependence of one component on another? So we are solving the mass/heat balances for each component as if the other components were not present

Is this a reasonable summary?
 
  • #118
casualguitar said:
So ##\dot{m_j}## is the last thing to be calculated for a given tank for a given time step. Understood.
The j refers to the tank number, not the component number.
casualguitar said:
However the order of calculation of time derivatives isn't clear to me yet. Does the order actually matter here? Or should it be:
1) the gas and solid phase heat balances are solved first simultaneously
2) the gas and solid deposition mole balances are solved (not simultaneously they can be solved independently)
3) ##\dot{m_j}## for the tank is solved
4) repeated for all tanks
No. When using the automatic integrator, all dependent variables are being solved for simultaneously.
casualguitar said:
I might be overcomplicating the below, but anyway:

So to be solved are:
- 3 gas phase mole balances
No. Only 2: H2O and CO2. The nitrogen mole fraction is 1 minus the other two.
casualguitar said:
- 3 has phase heat balances
No. There is only one overall gas phase heat balance.
casualguitar said:
- 1 bed heat balance
- 2 solid phase heat balance (CO2 and H2O)
No. The solid phase heat balance is not solved at all. The heat generated in condensing and evaporation are distributed to the gas- and bed heat balances (by the heat flow equations I gave).
casualguitar said:
- 3 'molar flow out of tank' equations
No. There is only one molar flow out-of-tank equation. The j is the tank number , not the component number.
casualguitar said:
The initial and boundary conditions would be (assuming the bed is initially cold and just has nitrogen in it):

ICs:
- molar holdup of nitrogen
- bed temperature
- nitrogen temperature (same at the bed temperature initially)
- mole fraction of nitrogen (equal to 1 in this case)

BCs:
- molar flow of each component into the bed
- mole fraction of each component into the bed (or we can calculate this from the above)
- temperature of the flow into the bed
Yes.
casualguitar said:
So at each point in the bed we are solving for
- the mole fraction of component i (N2,H2O, CO2). We will get three y values at each point
No. Only H2O and CO2 mole fractions are solved for.
casualguitar said:
- bed temperature
- temperature of the gas (all components assumed at the same temperature)
- total deposition (moles) of component i
- molar flow of component i
If, by the latter, you mean the molar flow of component I out of the tank, then no. Even the total molar flow out of each tank is not an integrated time-dependent variable. It is just used to get the total molar flow into the next tank (for the gas phase heat balance in the next tank).

The variables that we are integrating with respect to time at all locations along the column (i.e., all tanks) are

The mole fractions of CO2 and H2O in the gas
The moles of CO2 and H2O deposited per unit area of bed (or per unit volume of column)
The temperature of the gas phase
The temperature of the bed

So there are only 6 coupled time derivatives being integrated per tank.
casualguitar said:
And in addition, the computational flow for solving the system of ODEs mentioned above applies to all components individually i.e. there is no dependence of one component on another? So we are solving the mass/heat balances for each component as if the other components were not present
The heat balances do not apply to all components individually.
 
  • #119
Chestermiller said:
No. When using the automatic integrator, all dependent variables are being solved for simultaneously.
Interesting ok I'll have to get my head around this one. Will take a look at the documentation to see what exactly is going on to solve these
Chestermiller said:
No. Only 2: H2O and CO2. The nitrogen mole fraction is 1 minus the other two.
Got it
Chestermiller said:
No. There is only one overall gas phase heat balance.
Understood yes I should have spotted that given the temperatures of N2,CO2 and H2O are assumed the same
Chestermiller said:
No. The solid phase heat balance is not solved at all. The heat generated in condensing and evaporation are distributed to the gas- and bed heat balances (by the heat flow equations I gave).
Ah I think this is a terminology mix up. By solid phase heat balance I mean the bed heat balance. So its correct to say the solid deposition heat balance is not solved, but the solid bed (the packed bed) heat balance is i.e. this equation:
Screenshot 2022-04-18 at 13.11.22.png

Chestermiller said:
No. There is only one molar flow out-of-tank equation. The j is the tank number , not the component number.
So is it correct to say the assumption of constant composition in the gas phase applies here i.e. when we solve for molar flow out of the tank it is assumed that the flow composition will be the same as the inlet composition, just scaled for the different flowrate?
Chestermiller said:
No. Only H2O and CO2 mole fractions are solved for.
Got it
Chestermiller said:
If, by the latter, you mean the molar flow of component I out of the tank, then no. Even the total molar flow out of each tank is not an integrated time-dependent variable. It is just used to get the total molar flow into the next tank (for the gas phase heat balance in the next tank).
I did mean that yes. Ok understood
Chestermiller said:
The variables that we are integrating with respect to time at all locations along the column (i.e., all tanks) are

The mole fractions of CO2 and H2O in the gas
The moles of CO2 and H2O deposited per unit area of bed (or per unit volume of column)
The temperature of the gas phase
The temperature of the bed

So there are only 6 coupled time derivatives being integrated per tank.
casualguitar said:
ICs:
- molar holdup of nitrogen
- bed temperature
- nitrogen temperature (same at the bed temperature initially)
- mole fraction of nitrogen (equal to 1 in this case)

BCs:
- molar flow of each component into the bed
- mole fraction of each component into the bed (or we can calculate this from the above)
- temperature of the flow into the bed
So if we are not solving any nitrogen related equation directly, I suppose the initial conditions should be adjusted to be:
- molar holdup of H2O and CO2 (both zero initially)
- bed temperature
- nitrogen/CO2/H2O temperature
- mole fractions of H20 and CO2 (both zero initially)

Is it a reasonable next step to solve this set of 6 equations, in a basic way assuming constants instead of using the correlations where possible)? Just to see how these equations themselves will be solved i.e. setting up initial/boundary conditions etc. Then I could build on it by gradually adding in the correlations/expressions
 
  • #120
casualguitar said:
Interesting ok I'll have to get my head around this one. Will take a look at the documentation to see what exactly is going on to solve these

Got it

Understood yes I should have spotted that given the temperatures of N2,CO2 and H2O are assumed the same

Ah I think this is a terminology mix up. By solid phase heat balance I mean the bed heat balance. So its correct to say the solid deposition heat balance is not solved, but the solid bed (the packed bed) heat balance is i.e. this equation:
View attachment 300157

So is it correct to say the assumption of constant composition in the gas phase applies here i.e. when we solve for molar flow out of the tank it is assumed that the flow composition will be the same as the inlet composition, just scaled for the different flowrate?
This has nothing to do with composition. It says that the total number of moles exiting the tank per unit time is equal to the total number of moles per unit time entering minus the rate of change in the number of moles as a result of the rate of temperature increase at constant pressure, and minus the molar rates of solid- and liquid deposition onto the bed.
casualguitar said:
Got it

I did mean that yes. Ok understoodSo if we are not solving any nitrogen related equation directly, I suppose the initial conditions should be adjusted to be:
- molar holdup of H2O and CO2 (both zero initially)
- bed temperature
- nitrogen/CO2/H2O temperature
- mole fractions of H20 and CO2 (both zero initially)
casualguitar said:
Is it a reasonable next step to solve this set of 6 equations, in a basic way assuming constants instead of using the correlations where possible)?
You realize that there are 6 times the number of tanks number of coupled ODEs being solved, right? This involves the solution of 6 times the number of tanks non-linear algebraic equations being solved at each time step.

I guess you can start out by assuming constant values for the heat transfer coefficients and mass transfer coefficients. The actual coding for these could be added later within the derivative determination subroutine.
 
  • #121
Chestermiller said:
This has nothing to do with composition. It says that the total number of moles exiting the tank per unit time is equal to the total number of moles per unit time entering minus the rate of change in the number of moles as a result of the rate of temperature increase at constant pressure, and minus the molar rates of solid- and liquid deposition onto the bed.
Agreed that this is unrelated to composition. However we mentioned earlier that we're not tracking composition changes in the gas phase so would this exiting molar flow technically be of the same composition as the inlet flow. Yes we will lose some of each component to the solid phase, however is it correct to say we assume that this does not affect the gas phase composition?
Chestermiller said:
You realize that there are 6 times the number of tanks number of coupled ODEs being solved, right? This involves the solution of 6 times the number of tanks non-linear algebraic equations being solved at each time step.
So we have 6 ODEs here, and 2 ODEs in the last model, would that be 3 times the number of ODEs being solved? Or am I missing something? But yes it does seem like this could add significantly to the computation time. That said, we don't need thermo to calculate T(H,P) or the density/enthalpy derivative. I think these were quite costly so hopefully this balances out somewhat.

Chestermiller said:
I guess you can start out by assuming constant values for the heat transfer coefficients and mass transfer coefficients. The actual coding for these could be added later within the derivative determination subroutine.
Agreed yes I think constant U, mass transfer coefficient and even constant Cp just to see how the code for this will look. Will start coding on this system tomorrow morning!
 
  • #122
casualguitar said:
Agreed that this is unrelated to composition. However we mentioned earlier that we're not tracking composition changes in the gas phase so would this exiting molar flow technically be of the same composition as the inlet flow. Yes we will lose some of each component to the solid phase, however is it correct to say we assume that this does not affect the gas phase composition?
This is included in the overall molar balance. No assumptions are made about the composition of the molar flux.
casualguitar said:
So we have 6 ODEs here, and 2 ODEs in the last model, would that be 3 times the number of ODEs being solved?
Sure
casualguitar said:
Agreed yes I think constant U, mass transfer coefficient and even constant Cp just to see how the code for this will look. Will start coding on this system tomorrow morning!
The equation F in BSL table 19.2-4 and Exercise 19D.2 seem to suggest that Cp should be evaluated at the existing overall molar composition as ##\sum{y_iC_{P,i}}##.

I should also point out that, in BSL, the molar flux is defined in terms of the mass transfer coefficient by $$\dot{M}_i^"=k_i\left(y_i-\frac{p_i(T)}{P}\right)$$ where ##k_i## has units of moles/m^2s. Under these definitions, the Sherwood number for a porous medium (for use in conjunction with the correlation equation) would be defined as $$\frac{k_iD_p}{(1-\epsilon)cD_i\psi}$$ where, in BSL notation, $$c=\rho_{m}=\frac{P}{RT_I}$$

BSL point out that ##cD_i## is much less dependent on temperature than ##D_i##.
 
  • #123
Chestermiller said:
This is included in the overall molar balance. No assumptions are made about the composition of the molar flux.
Sorry yes I understand now
Chestermiller said:
The equation F in BSL table 19.2-4 and Exercise 19D.2 seem to suggest that Cp should be evaluated at the existing overall molar composition as ∑yiCP,i.
Ok can do, this seems easy enough to implement anyway.

I could use the tank j-1 position composition to evaluate Cp at tank j as ##\sum{y_iC_{P,i}}##. But yes for now I'll leave it constant to simplify, unless there is a reason not to do this. I'd like to solve the ODEs with as little 'surrounding calculations' as possible
Chestermiller said:
I should also point out that, in BSL, the molar flux is defined in terms of the mass transfer coefficient by M˙i"=ki(yi−pi(T)P) where ki has units of moles/m^2s. Under these definitions, the Sherwood number for a porous medium (for use in conjunction with the correlation equation) would be defined as kiDp(1−ϵ)cDiψ where, in BSL notation, c=ρm=PRTI

BSL point out that cDi is much less dependent on temperature than Di.
Understood. I'll switch to this approach then for the mass transfer coefficient function

So in summary for this iteration of this model:

Two mole balances (H2O and CO2):
Screenshot 2022-04-19 at 13.35.37.png

Two solid phase balances (H2O and CO2):
Screenshot 2022-04-19 at 13.48.05.png

One gas phase and one bed heat balance:
Screenshot 2022-04-19 at 13.49.08.png

Screenshot 2022-04-19 at 13.48.44.png


I am tempted to avoid using pythons thermo as much as possible here so save on computation cost and also confusion regarding the solid phase. I think given that thermo can't 'see' the solid phase it will cause some issues down the line so it might be best here to define some other curves manually rather than having to deal with the thermo black box:
- The gas phase N2, H2O and CO2 density curves
- The ideal gas heat capacity curves for N2, H2O and CO2

Is this reasonable?

The only place we will need nitrogen data is in the gas phase heat balance is this correct?

Also we can leave out the CO2 condensation curve completely as we're not in a pressure range that would allow this to occur

As constant in this first iteration of the model (just solving the ODEs really for now) could be the ideal gas heat capacity values, the mass transfer coefficient, component densities, and the heat transfer coefficients

Lastly the initial and boundary conditions are:

ICs:
- molar holdup of H2O and CO2 (both zero initially)
- bed temperature
- gas temperature (= bed temperature)
- mole fractions of H20 and CO2 (both zero initially)

BCs:
- molar flow of each component into the bed
- mole fraction of each component into the bed (or we can calculate this from the above)
- temperature of the flow into the bed

Does the above look reasonable to you?
 

Attachments

  • Screenshot 2022-04-19 at 13.46.41.png
    Screenshot 2022-04-19 at 13.46.41.png
    3.8 KB · Views: 82
  • Screenshot 2022-04-19 at 13.46.22.png
    Screenshot 2022-04-19 at 13.46.22.png
    6.5 KB · Views: 68
  • Screenshot 2022-04-19 at 13.12.22.png
    Screenshot 2022-04-19 at 13.12.22.png
    6 KB · Views: 83
  • #124
casualguitar said:
Sorry yes I understand now

Ok can do, this seems easy enough to implement anyway.

I could use the tank j-1 position composition to evaluate Cp at tank j as ##\sum{y_iC_{P,i}}##.
No. These are at the j position. In the derivative subroutine coding for the j'th tank, the solution vector has values for the y's in the j'th tank.
No. Let the automatic integrator do it all for you.
casualguitar said:
Understood. I'll switch to this approach then for the mass transfer coefficient function

So in summary for this iteration of this model:

Two mole balances (H2O and CO2):
View attachment 300204
Two solid phase balances (H2O and CO2):
View attachment 300207
One gas phase and one bed heat balance:
View attachment 300209
View attachment 300208

- The gas phase N2, H2O and CO2 density curves
- The ideal gas heat capacity curves for N2, H2O and CO2
You're not going to have N2 condense, are you? Why do you need the gas phase densities of the N2, H20, and CO2.
casualguitar said:
Is this reasonable?

The only place we will need nitrogen data is in the gas phase heat balance is this correct?
Why do we need it in the gas phase heat balance. The molar density of the gas phase is P/RT, where P is the total pressure.
casualguitar said:
Also we can leave out the CO2 condensation curve completely as we're not in a pressure range that would allow this to occur
Correct.
casualguitar said:
As constant in this first iteration of the model (just solving the ODEs really for now) could be the ideal gas heat capacity values, the mass transfer coefficient, component densities, and the heat transfer coefficients

Lastly the initial and boundary conditions are:

ICs:
- molar holdup of H2O and CO2 (both zero initially)
- bed temperature
- gas temperature (= bed temperature)
- mole fractions of H20 and CO2 (both zero initially)

BCs:
- molar flow of each component into the bed
Just total molar flow and mole fractions. Tuinier uses mole fractions.
casualguitar said:
- mole fraction of each component into the bed (or we can calculate this from the above)
- temperature of the flow into the bed

Does the above look reasonable to you?
Yes.
 
  • #125
Chestermiller said:
No. These are at the j position. In the derivative subroutine coding for the j'th tank, the solution vector has values for the y's in the j'th tank.
No. Let the automatic integrator do it all for you.
Ok I don't fully understand yet how we can use j position composition values to calculate j position Cp values. I guess this is possible with implicit integrators however I don't have a picture of how this works in my head yet. Will be reading the documentation soon
Chestermiller said:
You're not going to have N2 condense, are you? Why do you need the gas phase densities of the N2, H20, and CO2.
No N2 condensation, however if we're calculating the mass holdup in the heat balance then I thought we would calculate this with density correlations for each of N2,CO2 and H2O however as you have said we can use P/RT here
Chestermiller said:
Just total molar flow and mole fractions. Tuinier uses mole fractions.
Got it, total molar flow and mole fractions, as these will give us the individual component flows of CO2 and H2O for the mass balances
Chestermiller said:
Yes.
Ok great
 
  • #126
Hi Chet, just letting you know I was sidetracked by some other work. Will be back on the ODE code tomorrow morning
 
  • #127
casualguitar said:
Hi Chet, just letting you know I was sidetracked by some other work. Will be back on the ODE code tomorrow morning
Hi Chet, just updating - working on the code now. I didn't really understand what I was doing first time around with regards to using the ODE solver to solve position dependent ODEs, so I'm taking my time on it this time around i.e. I understand how to use the integrator to solve ODEs where there is no spatial discretisation, but adding in spatial discretisation from the coding point of view is difficult
 
  • #128
casualguitar said:
Hi Chet, just updating - working on the code now. I didn't really understand what I was doing first time around with regards to using the ODE solver to solve position dependent ODEs, so I'm taking my time on it this time around i.e. I understand how to use the integrator to solve ODEs where there is no spatial discretisation, but adding in spatial discretisation from the coding point of view is difficult
Not really. Discretizing with respect to the position variable z reduces the equations from a set of PDEs to a set of ODEs. This is the Method of Lines.
 
  • #129
The solution vector consists of a single column vector containing the values of all the time-integrated variables in all the tanks. When you use an automatic integrator, you furnish the integrator with a subroutine which has the solution vector in its calling sequence and which has the coding for mapping the solution vector into a column vector of the time-derivative of the solution vector.

In such a subroutine, I would start out by decomposing the solution vector into the temperatures, mole fractions, and amounts of deposits in the tanks using meaningful tank-indexed parameters like T's, y's, and M's. Then, I would calculate the time derivatives of these using our balanced equations, in terms of dT/dt's, dy/dt's, and dM/dt's. Then I would remap (recompose) these into a single time derivative column vector.

I hope this makes sense.
 
  • #130
Chestermiller said:
The solution vector consists of a single column vector containing the values of all the time-integrated variables in all the tanks. When you use an automatic integrator, you furnish the integrator with a subroutine which has the solution vector in its calling sequence and which has the coding for mapping the solution vector into a column vector of the time-derivative of the solution vector.

In such a subroutine, I would start out by decomposing the solution vector into the temperatures, mole fractions, and amounts of deposits in the tanks using meaningful tank-indexed parameters like T's, y's, and M's. Then, I would calculate the time derivatives of these using our balanced equations, in terms of dT/dt's, dy/dt's, and dM/dt's. Then I would remap (recompose) these into a single time derivative column vector.
Yep this makes complete sense. It is setting up the various arrays in such a way that it is possible/easy to remap them that it difficult (the mass balances are dependent on the number of species but the heat balances are not so it seems to make setting up this subroutine a bit awkward). I will post my pseudocode for this today
 
  • #131
Please, first show me what your tentative layout of the solution vector looks like.
 
  • #132
Just some questions on the mass flow out of a tank equation:
Screenshot 2022-04-27 at 14.32.52.png

This term has a time derivative on the RHS. Is it correct to say that:
1) The time derivative term in this equation comes from solving the gas phase heat balance for ##\frac{\partial T_g}{dt}## and subbing it in here?
2) We will not be including this equation in the integration itself, but just using it to link the flows between tanks
 
Last edited:
  • #133
casualguitar said:
Just some questions on the mass flow out of a tank equation:
View attachment 300643
This term has a time derivative on the RHS. Is it correct to say that:
1) The time derivative term in this equation comes from solving the gas phase heat balance for ##\frac{\partial T_g}{dt}## and subbing it in here?
Yes, the heat balance for tank j.
casualguitar said:
2) We will not be including this equation in the integration itself, but just using it to link the flows between tanks
Yes. It is the last thing you calculate before moving on to calculate the derivatives for the next tank.
 
Last edited:
  • Like
Likes casualguitar
  • #134
Chestermiller said:
Yes, the heat balance for tank j.

Yes. It is the last thing you calculate before moving on to calculate the derivatives for the next tank.
Just commenting to say I'm still working on the code. Should have pseudocode by tomorrow
 
  • #135
casualguitar said:
Just commenting to say I'm still working on the code. Should have pseudocode by tomorrow
Hi Chet, yet another update from me that I am still working on the code (other things came up like experimental work, moving house etc also)
 
  • #136
casualguitar said:
Hi Chet, yet another update from me that I am still working on the code (other things came up like experimental work, moving house etc also)
Just to fill you in slightly on where I'm at - I am trying to set up two functions that set up the ODEs for:
1) the initial/boundary conditions
2) the rest of the system

Here is the function for 'the rest of the system'. Note I have left some non constants as constants just because this is really pseudocode i.e. getting the structure right
Screenshot 2022-05-04 at 15.49.24.png


I should do something similar for the initial/boundary conditions, however I'm a bit stuck as for how to split up the boundary and initial conditions. Working on it though. For reference here is the current 'initial ODE system' code which sets up the ODEs at t=0 which may not make much sense currently:
Screenshot 2022-05-04 at 15.52.09.png

Screenshot 2022-05-04 at 15.52.34.png

Working on it
 
  • #137
Chestermiller said:
Yes, the heat balance for tank j.

Yes. It is the last thing you calculate before moving on to calculate the derivatives for the next tank.
Hey Chet, hope alls well with you.

My apologies, I'm really struggling to set up these initial/boundary conditions. I have found effectively no examples online of solve_ivp being used in this way.

Is it reasonable to implement a simple explicit Euler instead here? I might have to play with the dt depending on the systems stiffness but it would give a first solution. Maybe not too accurate but we could go from there

Are there any big reasons to stick with the automatic integrator?
 
  • #138
casualguitar said:
Hey Chet, hope alls well with you.

My apologies, I'm really struggling to set up these initial/boundary conditions. I have found effectively no examples online of solve_ivp being used in this way.

Is it reasonable to implement a simple explicit Euler instead here? I might have to play with the dt depending on the systems stiffness but it would give a first solution. Maybe not too accurate but we could go from there

Are there any big reasons to stick with the automatic integrator?
Just posting the updates we had over private message -
- boundary condition issues solved
- working on the property/dimensionless number functions

Question:
Just doing the ##h_{fs}## function currently which takes ##Pr##, ##Re## and ##k_g## as inputs.
Screenshot 2022-05-19 at 10.49.35.png

For the ##k_g## value, is it reasonable to use a mole fraction averaged ##k_g## value here? I.e. take the feed mole fractions of CO2, H2O and N2, calculate ##k_g## of each at the given temperature and then return a mole fraction weighted ##k_g## value?

Edit: This would mean I should write correlation functions for N2 also (cp, mu, rho, etc). I have avoided that up until now because N2 is not present in the ODEs

Edit2: Is it also correct to say that ##h_{fs}## is completely independent of the solid properties?
 
Last edited:
  • #139
casualguitar said:
Just posting the updates we had over private message -
- boundary condition issues solved
- working on the property/dimensionless number functions

Question:
Just doing the ##h_{fs}## function currently which takes ##Pr##, ##Re## and ##k_g## as inputs.
View attachment 301632
Where is the Dp?
casualguitar said:
For the ##k_g## value, is it reasonable to use a mole fraction averaged ##k_g## value here? I.e. take the feed mole fractions of CO2, H2O and N2, calculate ##k_g## of each at the given temperature and then return a mole fraction weighted ##k_g## value?
This is only going to be approximate. In any event, BSL gives mixing rules for k.
casualguitar said:
Edit: This would mean I should write correlation functions for N2 also (cp, mu, rho, etc). I have avoided that up until now because N2 is not present in the ODEs
This doesn't seem like a big deal.
casualguitar said:
Edit2: Is it also correct to say that ##h_{fs}## is completely independent of the solid properties?
Of course.
 
  • #140
Chestermiller said:
Where is the Dp?
Typo (this was included in the previous model)
Screenshot 2022-05-19 at 14.33.00.png

This equation returns ##h_{fs}## values in the ##200-1000W/m2K## range for typical Reynolds numbers (up to ##10^4##)

Chestermiller said:
This doesn't seem like a big deal.
Yes its not
Chestermiller said:
Of course.
Nice. Except for the particle diameter I suppose if that is considered to be a solid property

Anyway I'm almost there with these functions. I think I'll post plots of them all with typical dependent variable ranges just to confirm they're all working as expected before moving on.

For reference, the plots will roughly include:
Screenshot 2022-05-19 at 14.41.17.png
 

Similar threads

Replies
2
Views
1K
Replies
6
Views
1K
Replies
0
Views
888
Replies
1
Views
1K
Replies
25
Views
2K
Back
Top