CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Continuity Equation for multicomponent simulation (https://www.cfd-online.com/Forums/cfx/222631-continuity-equation-multicomponent-simulation.html)

lordluan December 2, 2019 13:24

Continuity Equation for multicomponent simulation
 
I'm working with a pair of gases (ethanol e air), one of them is adsorbed by a porous medium. The ideia to describe the phenomena is to add a mass source term to the continuity equation by creating a subdomain which englobes the whole porous medium, then in the settings I can add a source term to the continuity equation (as well as others equation like mass fraction to the ethanol that I didn't use). My question is since in the settings of Sources I can only add the source term to the continuity and it seems that I am adding the source term to the global continuity equation. Is there a way to add a source to the continuity equation of the ethanol?

Opaque December 2, 2019 15:45

Careful with your mass balances.

A term in the material/multicomponent equation is to be treated carefully, it should not add mass to the system, but drive the transport of the material.

Adding mass to the system it should only be done using continuity sources. A continuity source must be specified in detail, i.e you must include its composition.

If you attempt to do it by adding sources to the material components you must be extremely careful to conserve global mass. Recall the summation of all the material component equations should be the same as the global continuity equation. That is the reason there is a constrain material component; otherwise, the system will over specified.

lordluan December 3, 2019 08:57

1 Attachment(s)
Quote:

Originally Posted by Opaque (Post 751273)
Careful with your mass balances.

A term in the material/multicomponent equation is to be treated carefully, it should not add mass to the system, but drive the transport of the material.

Adding mass to the system it should only be done using continuity sources. A continuity source must be specified in detail, i.e you must include its composition.

If you attempt to do it by adding sources to the material components you must be extremely careful to conserve global mass. Recall the summation of all the material component equations should be the same as the global continuity equation. That is the reason there is a constrain material component; otherwise, the system will over specified.

Thanks for answering, Opaque. I understand what you're saying. Please have a look at the pic bellow.

It is a print from CFX, the continuity that is chosen is the correspondent to the ethanol ou the global one? In the fluid models settings I put ethanol to have a transport equation and air to be constraint.

I am reading the documentation and doing some tests to find out. Any news I will share here.

Opaque December 3, 2019 10:49

If Sm (mass source strength)
- is positive only ethanol is being added
- and, if negative only ethanol is being removed (here the sink options kicks in for the specific behavior)

The corresponding source terms are included in all solved transport equations.

It should work for you.

Antanas December 5, 2019 00:35

Quote:

Originally Posted by lordluan (Post 751350)
Thanks for answering, Opaque. I understand what you're saying. Please have a look at the pic bellow.

It is a print from CFX, the continuity that is chosen is the correspondent to the ethanol ou the global one? In the fluid models settings I put ethanol to have a transport equation and air to be constraint.

I am reading the documentation and doing some tests to find out. Any news I will share here.

Sources are added per phase. Specified component mass fraction controls which part of the source corresponds to it. Because you set ethanol mf to 1, the source adds (or substracts) only ethanol.

lordluan December 7, 2019 04:53

Thanks for the reply, but, apparently, it didn't work. Since the mass fraction increased, instead of decrease. Antanas and Opaque, is there another way of making CFX understand that the source term is only to ethanol?

Opaque December 8, 2019 17:54

Could you post the settings for your source?

lordluan December 9, 2019 09:25

1 Attachment(s)
Quote:

Originally Posted by Opaque (Post 751839)
Could you post the settings for your source?

Sure, Opaque. I am attaching a photo and the whole code.

LIBRARY:
CEL:
EXPRESSIONS:
A = 132.89 [s^-1]
E = 139.5 [kJ mol^-1]
Ea = 22.97 [kJ mol^-1]
Ps = 0.1041 [Pa]
R0 = 0.0083145 [kJ mol^-1 K^-1]
Sm = -(1-volpor)*roP*k1*(qe-q)
fm = 1-fluid.air.mf
k1 = A*e^(-(Ea/(R0*T)))
q = qe*(1-e^(-k1*t))
qe = qs*exp(-(((R0*(T/E))*ln(Ps/(ptot))))^2)
qs = 1.2 [kg kg^-1]
roP = 464.1 [kg m^-3]
END
END
MATERIAL: ADSOR
Material Group = User
Option = Pure Substance
Thermodynamic State = Solid
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 464.1 [kg m^-3]
Molar Mass = 12 [g mol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 1375 [J kg^-1 K^-1]
END
REFERENCE STATE:
Option = Automatic
END
THERMAL CONDUCTIVITY:
Option = Value
Thermal Conductivity = 0.2 [W m^-1 K^-1]
END
END
END
MATERIAL: Air Ideal Gas
Material Description = Air Ideal Gas (constant Cp)
Material Group = Air Data,Calorically Perfect Ideal Gases
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Molar Mass = 28.96 [kg kmol^-1]
Option = Ideal Gas
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 1.0044E+03 [J kg^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Specific Enthalpy = 0. [J/kg]
Reference Specific Entropy = 0. [J/kg/K]
Reference Temperature = 25 [C]
END
DYNAMIC VISCOSITY:
Dynamic Viscosity = 1.831E-05 [kg m^-1 s^-1]
Option = Value
END
THERMAL CONDUCTIVITY:
Option = Value
Thermal Conductivity = 2.61E-2 [W m^-1 K^-1]
END
ABSORPTION COEFFICIENT:
Absorption Coefficient = 0.01 [m^-1]
Option = Value
END
SCATTERING COEFFICIENT:
Option = Value
Scattering Coefficient = 0.0 [m^-1]
END
REFRACTIVE INDEX:
Option = Value
Refractive Index = 1.0 [m m^-1]
END
END
END
MATERIAL: Mix
Material Group = User
Materials List = air,ethanol
Option = Variable Composition Mixture
Thermodynamic State = Gas
MIXTURE PROPERTIES:
Option = Ideal Mixture
EQUATION OF STATE:
Option = Ideal Mixture
END
SPECIFIC HEAT CAPACITY:
Option = Ideal Mixture
END
END
END
MATERIAL: N2
Material Group = User
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 0.8556 [kg m^-3]
Molar Mass = 28.0134 [g mol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 29.271 [cal g^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Temperature = 399 [K]
END
END
END
MATERIAL: air
Material Group = User
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 1.185 [kg m^-3]
Molar Mass = 28.96 [kg kmol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 1.0044E+03 [J kg^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Specific Enthalpy = 0 [J kg^-1]
Reference Specific Entropy = 0 [J kg^-1 K^-1]
Reference Temperature = 25 [C]
END
DYNAMIC VISCOSITY:
Dynamic Viscosity = 20.86e-6 [Pa s]
Option = Value
END
THERMAL EXPANSIVITY:
Option = Value
Thermal Expansivity = 0.003356 [K^-1]
END
END
END
MATERIAL: ethanol
Material Group = User
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 736.1 [kg m^-3]
Molar Mass = 46.0684 [g mol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 3.19 [J kg^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Temperature = 25 [C]
END
DYNAMIC VISCOSITY:
Dynamic Viscosity = 10.4e-6 [Pa s]
Option = Value
END
END
END
MATERIAL: iPentano
Material Group = User
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 2.2337 [kg m^-3]
Molar Mass = 72.15 [g mol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 154.15 [J kg^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Temperature = 400 [K]
END
END
END
MATERIAL: nPentano
Material Group = User
Option = Pure Substance
Thermodynamic State = Gas
PROPERTIES:
Option = General Material
EQUATION OF STATE:
Density = 2.2345 [kg m^-3]
Molar Mass = 72.17 [g mol^-1]
Option = Value
END
SPECIFIC HEAT CAPACITY:
Option = Value
Specific Heat Capacity = 2.13 [J kg^-1 K^-1]
Specific Heat Type = Constant Pressure
END
REFERENCE STATE:
Option = Specified Point
Reference Pressure = 1 [atm]
Reference Temperature = 400 [K]
END
END
END
END
FLOW: Flow Analysis 1
SOLUTION UNITS:
Angle Units = [rad]
Length Units = [m]
Mass Units = [kg]
Solid Angle Units = [sr]
Temperature Units = [K]
Time Units = [s]
END
ANALYSIS TYPE:
Option = Transient
EXTERNAL SOLVER COUPLING:
Option = None
END
INITIAL TIME:
Option = Automatic with Value
Time = 0 [min]
END
TIME DURATION:
Option = Total Time
Total Time = 20 [min]
END
TIME STEPS:
Option = Timesteps
Timesteps = 1 [min]
END
END
DOMAIN: Default Domain
Coord Frame = Coord 0
Domain Type = Porous
Location = ADSORVENT
BOUNDARY: In
Boundary Type = INLET
Location = IN
BOUNDARY CONDITIONS:
COMPONENT: ethanol
Mass Fraction = 0.4
Option = Mass Fraction
END
FLOW REGIME:
Option = Subsonic
END
MASS AND MOMENTUM:
Normal Speed = 0.03 [m s^-1]
Option = Normal Speed
END
TURBULENCE:
Option = Medium Intensity and Eddy Viscosity Ratio
END
END
END
BOUNDARY: Out
Boundary Type = OPENING
Location = OUT
BOUNDARY CONDITIONS:
COMPONENT: ethanol
Mass Fraction = fm
Option = Mass Fraction
END
FLOW DIRECTION:
Option = Normal to Boundary Condition
END
FLOW REGIME:
Option = Subsonic
END
MASS AND MOMENTUM:
Option = Opening Pressure and Direction
Relative Pressure = 1 [atm]
END
TURBULENCE:
Option = Medium Intensity and Eddy Viscosity Ratio
END
END
END
BOUNDARY: Wall
Boundary Type = WALL
Location = WALL
BOUNDARY CONDITIONS:
MASS AND MOMENTUM:
Option = No Slip Wall
END
WALL ROUGHNESS:
Option = Smooth Wall
END
END
END
DOMAIN MODELS:
BUOYANCY MODEL:
Option = Non Buoyant
END
DOMAIN MOTION:
Option = Stationary
END
MESH DEFORMATION:
Option = None
END
REFERENCE PRESSURE:
Reference Pressure = 1 [atm]
END
END
FLUID DEFINITION: fluid
Material = Mix
Option = Material Library
MORPHOLOGY:
Option = Continuous Fluid
END
END
FLUID MODELS:
COMBUSTION MODEL:
Option = None
END
COMPONENT: air
Option = Constraint
END
COMPONENT: ethanol
Option = Transport Equation
END
HEAT TRANSFER MODEL:
Fluid Temperature = 352 [K]
Option = Isothermal
END
THERMAL RADIATION MODEL:
Option = None
END
TURBULENCE MODEL:
Option = k epsilon
END
TURBULENT WALL FUNCTIONS:
Option = Scalable
END
END
POROSITY MODELS:
AREA POROSITY:
Option = Isotropic
END
LOSS MODEL:
Loss Velocity Type = Superficial
Option = Isotropic Loss
ISOTROPIC LOSS MODEL:
Option = Permeability and Loss Coefficient
Permeability = 8.379e-12 [m^2]
Resistance Loss Coefficient = 3.447e5 [m^-1]
END
END
VOLUME POROSITY:
Option = Value
Volume Porosity = 0.4075
END
END
SOLID DEFINITION: adsor
Material = ADSOR
Option = Material Library
MORPHOLOGY:
Option = Continuous Solid
END
END
SOLID MODELS:
HEAT TRANSFER MODEL:
Option = Isothermal
Solid Temperature = 352 [K]
END
THERMAL RADIATION MODEL:
Option = None
END
END
SUBDOMAIN: TermoFonte
Coord Frame = Coord 0
Location = ADSORVENT
SOURCES:
EQUATION SOURCE: continuity
Multiply by Porosity = Off
Option = Fluid Mass Source
Sink Option = Local Mass Fractions and Temperature
Source = Sm
VARIABLE: ed
Option = Value
Value = 1 [m^2 s^-3]
END
VARIABLE: ethanol.mf
Option = Value
Value = 1 []
END
VARIABLE: ke
Option = Value
Value = 1 [m^2 s^-2]
END
VARIABLE: vel
Option = Cartesian Vector Components
xValue = 1 [m s^-1]
yValue = 1 [m s^-1]
zValue = 1 [m s^-1]
END
END
END
END
END
INITIALISATION:
Option = Automatic
INITIAL CONDITIONS:
Velocity Type = Cartesian
CARTESIAN VELOCITY COMPONENTS:
Option = Automatic with Value
U = 0 [m s^-1]
V = 2.52e-3 [m s^-1]
W = 0 [m s^-1]
END
COMPONENT: ethanol
Mass Fraction = 0.3
Option = Automatic with Value
END
STATIC PRESSURE:
Option = Automatic with Value
Relative Pressure = 0 [Pa]
END
TURBULENCE INITIAL CONDITIONS:
Option = Medium Intensity and Eddy Viscosity Ratio
END
END
END
OUTPUT CONTROL:
RESULTS:
File Compression Level = Default
Include Mesh = No
Option = Selected Variables
Output Variables List = Absolute Pressure,Pressure,ethanol.Molar \
Concentration,ethanol.Mass Fraction,ethanol.Mass Concentration
END
TRANSIENT RESULTS: Transient Results 1
File Compression Level = Default
Include Mesh = On
Option = Selected Variables
Output Boundary Flows = All
Output Equation Residuals = All
Output Variable Operators = All
Output Variables List = ethanol.Molar Concentration,ethanol.Mass \
Fraction,ethanol.Mass Concentration,ethanol.Molar Fraction
OUTPUT FREQUENCY:
Option = Every Timestep
END
END
END
SOLVER CONTROL:
Turbulence Numerics = First Order
ADVECTION SCHEME:
Option = High Resolution
END
CONVERGENCE CONTROL:
Maximum Number of Coefficient Loops = 10
Minimum Number of Coefficient Loops = 1
Timescale Control = Coefficient Loops
END
CONVERGENCE CRITERIA:
Residual Target = 1.E-4
Residual Type = RMS
END
TRANSIENT SCHEME:
Option = Second Order Backward Euler
TIMESTEP INITIALISATION:
Option = Automatic
END
END
END
END
COMMAND FILE:
Version = 18.2
Results Version = 18.2
END
SIMULATION CONTROL:
EXECUTION CONTROL:
EXECUTABLE SELECTION:
Double Precision = No
Large Problem = No
END
INTERPOLATOR STEP CONTROL:
Runtime Priority = Standard
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
END
PARALLEL HOST LIBRARY:
HOST DEFINITION: lordluan
Host Architecture String = winnt-amd64
Installation Root = C:\Program Files\ANSYS Inc\v%v\CFX
END
END
PARTITIONER STEP CONTROL:
Multidomain Option = Automatic
Runtime Priority = Standard
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
PARTITION SMOOTHING:
Maximum Partition Smoothing Sweeps = 100
Option = Smooth
END
PARTITIONING TYPE:
MeTiS Type = k-way
Option = MeTiS
Partition Size Rule = Automatic
END
END
RUN DEFINITION:
Run Mode = Full
Solver Input File = C:\Users\Lordluan \luan
\Downloads\TCC\Teste2\9_v5_transient.def
Solver Results File = C:\Users\Lordluan \
luan\Downloads\TCC\Teste2\9_v5_transient_004.res
END
SOLVER STEP CONTROL:
Runtime Priority = Standard
MEMORY CONTROL:
Memory Allocation Factor = 1.0
END
PARALLEL ENVIRONMENT:
Number of Processes = 1
Start Method = Serial
END
END
END
END

Opaque December 9, 2019 09:43

Based on your settings, the total amount of mass removed (assuming Sm < 0) would be something along

volumeInt(Sm * Ethanol.mf)@TermoFonte


Your source specification is based on Local Mass Fractions, that is, it will remove whatever is "available" of Ethanol in the subdomain.

If you look at the output file summary (end of the run), how much is the mass flow for the subdomain? Look at the P-Mass summary as well as the Ethanol.Mass Fraction summary

lordluan December 9, 2019 20:35

Quote:

Originally Posted by Opaque (Post 751944)
Based on your settings, the total amount of mass removed (assuming Sm < 0) would be something along

volumeInt(Sm * Ethanol.mf)@TermoFonte


Your source specification is based on Local Mass Fractions, that is, it will remove whatever is "available" of Ethanol in the subdomain.

If you look at the output file summary (end of the run), how much is the mass flow for the subdomain? Look at the P-Mass summary as well as the Ethanol.Mass Fraction summary

Opaque, I am facing convergence problems, soon, I will be capable of answering your questions. Thank you very much for the help.

Antanas December 10, 2019 23:10

Quote:

Originally Posted by lordluan (Post 751783)
Thanks for the reply, but, apparently, it didn't work. Since the mass fraction increased, instead of decrease. Antanas and Opaque, is there another way of making CFX understand that the source term is only to ethanol?

Change Sink Option under MCF/Energy sink option from local mass fraction to specified mass fraction.

PS Refer to SteamJet tutorial for reference

Opaque December 11, 2019 10:39

Let me explain the issue with sinks better.

Let say at a given control volume there is 1 [kg] of mixture spread equally between two components, i.e. Mass Fraction = 0.5 for both.

We introduce a sink, and establish a mass flow of 0.75 [kg s^-1] with a composition of 0 and 1. That means, in one timestep (true or false) we are requesting a total mass for a given component that is not available in the control volume; therefore, violating the physics.

Summary: sinks are trickier to implement than injections, and the requested net value must be physically possible based on the integration parameters.

That is no different than an outlet with a mass flow larger than what the system can handle based on the inlet conditions and wall settings.

ghorrocks December 11, 2019 17:46

Opaque - but doesn't that mean that the mass sink is not matched to a mass flux entering the control volume - in other words, the time step is not converged. It will then do iterations to match the mass flux through the control volume faces with the mass leaving via the mass sink.

Doesn't that mean you can specify a mass sink as big as you like? Of course providing the system can supply the flow rate required, and providing you achieve a converged solution. I can see how larger mass sinks would be harder to converge.

Opaque December 12, 2019 09:48

The algorithm will iterate until the solution is converged and achieve the required sink if "possible", i.e. the "sink" is physically limited by boundary conditions and time step.

For a given time step is not guaranteed the physics can supply the mass flow rate being removed at a given location.

A similar issue will be with an energy sink, if we remove too much energy that cannot arrive at the location either by advection or diffusion, then the temperature could become unphysical.

Boundary conditions/sources/sink are limited by physics compatibility.

viraj20feb May 19, 2020 13:37

Multicomponent stationary heat and mass transfer
 
Hello,


I am trying to simulate heat and mass transfer in two multicomponent stationary mixtures. I realize that in the current OF versions, we cannot define a multicomponent phase as stationary while using reactingEulerFoam solvers. Has anyone tried to implement this or can anyone direct me in the right direction so that I can proceed?


Thank you!

ghorrocks May 19, 2020 18:36

This is the CFX forum. Try the OpenFoam forum.


All times are GMT -4. The time now is 10:01.