cadet / CADET-Python-Simulator

All component things in the world are changeable. They are not lasting. Work hard to gain your own salvation.
1 stars 0 forks source link

Add residual implementation for visocisities #4

Open daklauss opened 2 months ago

daklauss commented 2 months ago

In GitLab by @schmoelder on Jul 2, 2024, 15:13

There are different models for calculating viscosities, see also Wikipedia.

At first, we will start with a simple Arrhenius model

Arrhenius

$$ \ln \eta{mix} = \sum{i=1}^{N} x{i} \ln \eta{i} $$

where $\eta{mix}$ is the viscosity of the liquid mixture, $\eta{i}$ is the viscosity for fluid component $i$ when flowing as a pure fluid, and $x_{i}$ is the molar fraction of component $i$ in the liquid mixture.

Note, this requires knowing the viscosities for each component of the mixture. To simplify this, we will at first make the following assumptions:

Then, we can also formulate the mixing viscosity of different streams as such:

$$ \ln \eta{mix, u} = \sum{j=1}^{N{inlets}} \frac{Q{j}}{Q{total}} \ln \eta{j} $$

where $\eta{mix, u}$ is the viscosity of the liquid mixture entering unit operation $u$, $\eta{j}$ is the viscosity of the liquid leaving the upstream unit operation $j$, and $Q_{j}$ is the flow rate of that unit operation flowing into unit operation $u$.

$$ Q{total} = \sum{j=1}^{N_{inlets}} Q_j $$

While we already understand how to calculate this on system level (when coupling unit operations), we still don't know how to implement this in residual form for the unit operation. Maybe @AntoniaBerger can help us? :nerd:

daklauss commented 2 months ago

In GitLab by @schmoelder on Jul 3, 2024, 09:48

This comment serves to summarize the following assumption:

$$ \frac{Qj}{Q{total}} = x_i $$

As reminder, we use the following indices:

When mixing two streams with different flow rates $Q_i$, we assume that the volumetric fraction is proportional to the molar fraction.

Implicitly, this means that

First, the molar fraction $x_j$ is defined as

$$ x_j = \frac{n_j}{\sum_l n_l} = \frac{n_j}{\sum_l n_l} $$

with: $$ n_{total} = \sumj^{N{inlets}} n_j $$

$$ \rho_j = m_j / V $$

$$ M_j = m_j / n_j $$

$$ Q_j = dV / dt $$


$$x_j = \frac{m_j/M_j}{\sum_j m_j/M_j}$$

$$x_i = \frac{(\rho_i V)/M_i}{\sum_j (\rho_i V)/M_j}$$

hier: noch nicht ganz sicher... hehe

$$x_i = \frac{(\rho_i Q)/M_i}{\sum_j (\rho_i Q)/M_j}$$

daklauss commented 2 months ago

In GitLab by @AntoniaBerger on Jul 5, 2024, 09:50

Some people tend to work with volume fraction rather than flow fraction. (1) With that the mixture from two inlets (CASE 1) and the mixture from the bulk mix with one inlet (CASE 2) would have the same viscosity:

CASE 1:

$\Rightarrow$

CASE 2:

$\Rightarrow$

This way we could model the viscosity as a funktion of volume over time and not directly over time.

Maybe this makes sense...

daklauss commented 2 months ago

In GitLab by @AntoniaBerger on Jul 8, 2024, 10:53

More (but not total) generel:

For CASE 2: CSTR ($\eta_2$) and one Inlet ($\eta_2$):

For $t=0$ we have: $$ln(\eta_{mix}^{(0)}) = \phi_1^{(0)} ln(\eta_1) + \phi_2^{(0)} ln(\eta_2)$$ with $$ \phi_j^{(0)} = \frac{V^{0}_j}{V^{(0)}_1 + V^{(0)}2} $$ And $t=1$ we have: $$ln(\eta{mix}^{(1)}) = \phi_1^{(1)} ln(\eta_1) + \phi2^{(1)} ln(\eta{mix}^{(0)})$$

So we have for a iteration step $t = i$:

$$ln(\eta_{mix}^{(i)}) = \phi_1^{(i)} ln(\eta_1) + \phi2^{(i)} ln(\eta{mix}^{(i-1)})$$

If we interpret the last equation as an $ith$ euler method step ( i.e $y{i} = y{i-1} + f(t^{(i-1)},y_{i-1})$) from an unknown differential equation ( i.e $\dot{y} = f(t,y)$) we see that the equation correspond to a constant "ODE" ($\dot{y} = c(t)$). Which can be solved by integretaion. This leads me to the assumption that we don't need a differential equation discribing velocity for the CSTR unit. Instead we get a DAE with one addtionally algebraic equation for velocity.

@schmoelder , @d.klauss what do you think? Do you agree with me?