CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   CO2 boundary conditions (https://www.cfd-online.com/Forums/openfoam-solving/251500-co2-boundary-conditions.html)

b.simpson August 21, 2023 08:20

CO2 boundary conditions
 
Hey

I am using OpenFOAMv8. I have a natural ventilation setup where I want to model the concentrations of CO2. I am unsure whether I have correctly setup the CO2 boundary condition file.

I have an inlet sources that represent people breathing. I want the CO2 source at this inlet to be 5% of the air entering into the model. I also want their to be a background CO2 concentration of 400ppm. As the CO2 BC file has no dimensions I tried to set the CO2 sources as a proportion hence why i have put a value of 0.05 for the inlet and 0.0004 for the internalField.

Does anyone know if my current CO2 BC file is correct?

Regards

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "0";
    object      inback_CO2;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField  uniform 0.0004;

boundaryField
{
    "xmin|xmax|ymin|ymax|zmax"
    {
        type            inletOutlet;
        inletValue      $internalField;
        value          $internalField;
    }
        Inlet
    {
        type            inletOutlet;
        inletValue      uniform 0.05;
        value          uniform 0.05;
    }
    "zmin|Ceiling|Floor|East_Wall|North_Wall|South_Wall|West_Wall|Computer01|Person01|Computer02|Person02"
    {
        type            zeroGradient;
    }
       
        #includeEtc "caseDicts/setConstraintTypes"
}


// ************************************************************************* //


b.simpson August 31, 2023 09:40

Does anyone have any idea about this?

Tobermory September 5, 2023 05:13

Ben - this response may be a little late, but here are a few things to think about:

- you haven't told us what solver you are running, nor what your thermophys set up is ... this might have some influence on density calculation, scalar spefication etc.
- regardless most of the solvers in OF work with mass fractions, for multi-component mixtures, so you need to be very clear whenever you are working with concentrations on whether the concentration is by mass or by mole (volume); often threshold concentrations are stated by mole, in which case you will need to convert.
- there doesn't seem to be anything obviously wrong with your CO2 initial field, or the value on Inlet ... unless these are concs by mole
- you xmin/xmax etc inletOutlet boundary needs some attention: what is the concentration of CO2 in the fluid that enters the domain through these boundaries? You need to tell it.
- have you adjusted the concentations of air (or the other gas components) in the domain and at the other boundaries to account for the presence of the CO2 in the mix?

Good luck.

b.simpson September 20, 2023 08:04

Thank you for your response.

Apologies I should have included this information in my original post.

I am using buoyantSimpleFOAM in OpenFOAM-v8 with the k-omega SST model.

As I am wanting to match my background CO2 concentrations to the current atmospheric values of around 400ppm so I am working with concentrations by volume.

I have not adjusted the concentration of air in the domain and at the boundaries based on the presence of CO2. I am unsure how to achieve this.

I have included my 0/U, thermophisical and CO2 functionObject files to hopefully better explain what I am working with.

Thanks for your advise.

regards.
Ben

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v1812                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (0 0 0);

boundaryField
{
    "xmin|xmax|ymin|ymax|zmax"
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }
        Inlet
    {
        type            fixedValue;
        value          uniform (0 0.025 0);
    }
        "zmin|Ceiling|Floor|East_Wall|North_Wall|South_Wall|West_Wall|Computer01|Person01|Computer02|Person02"
    {
        type            noSlip;
    }
       
        #includeEtc "caseDicts/setConstraintTypes"
}

// ************************************************************************* //

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v1812                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

thermoType
{
    type            heRhoThermo;
    mixture        pureMixture;
    transport      const;
    thermo          eConst;
    equationOfState Boussinesq;
    specie          specie;
    energy          sensibleInternalEnergy;
}

mixture
{
    specie
    {
        molWeight      28.9;
    }
    equationOfState
    {
        rho0            1;
        T0              300;
        beta            3e-03;
    }
    thermodynamics
    {
        Cv              712;
        Hf              0;
    }
    transport
    {
        mu              1e-05;
        Pr              0.7;
    }
}

inback_CO2
{
    specie
    {
        molWeight      44.01;
    }
    thermodynamics
    {
        Tlow            200;
        Thigh          5000;
        Tcommon        1000;
        highCpCoeffs    ( 4.45362 0.00314017 -1.27841e-06 2.394e-10 -1.66903e-14 -48967 -0.955396 );
        lowCpCoeffs    ( 2.27572 0.00992207 -1.04091e-05 6.86669e-09 -2.11728e-12 -48373.1 10.1885 );
    }
    transport
    {
        As              1.67212e-06;
        Ts              170.672;
    }
}

// ************************************************************************* //

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v1812                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
               
inback_CO2
        {
                type                            scalarTransport;
                libs                                ("libsolverFunctionObjects.so");
                writeControl              timeStep;
                writeInterval              1;
                active                  true;
                autoSchemes            false;
                nCorr                  0;
                resetOnStartUp                false;
                field                                inback_CO2;
                fvOptions     
                {
               
                }
        }

// *********************************************************************** //


Tobermory September 20, 2023 12:21

Aahh - okay, that makes sense. Your boundaries look okay (ignore my earlier comment about xmin/xmax - I just didn't read you boundary file properly), but there's still the mass/mole fraction issue. For the air/CO2 mix the X=400ppm (volume or mole fraction) is equivalent to a mass fraction of Y = X*44.01/(X*44.01 + (1-X)*28.96) = 6.08e-4 kg/kg. And the 5% vol/vol inlet value is equivalent to 7.4% by mass.

As I mentioned, the solvers work in terms of mass fraction, so these are the values that you should be using for the internalField and inlet boundary in 0/inback_CO2. When processing the results (which will be mass fractions), you'll have to convert back to volume fractions with X = (Y/44.01)/[(Y/44.01) + ((1-Y)/28.96)].

Finally, note that the way you are modelling the CO2 is as a passive scalar, i.e. as a tracer field. This is fine so long as the gas concentrations are low, in which case the mixture density remains very close to that for air (which is what the passive scalar approach assumes); for higher gas concentrations, the density will increase due to the presence of the CO2 and you need to model the gas as an active scalar, with a different approach. For your case, with concentrations of 5% or less, you are probably okay, but I thought that I'd mention it anyway.

b.simpson September 21, 2023 05:07

Thank you for your answer. That is very helpful and makes a lot of sense.

Out of curiosity what is the approach for modelling CO2 as an active scalar? and is there a rule of thumb or check to know when you should be modelling CO2 with a passive or active scalar?

Thanks for your help with this query.

Tobermory September 21, 2023 05:15

Good question with a tricky answer: it depends! For your particular case (small temperature variations, low concentrations, flow driven by advection rather than buoyancy), the main impact that the CO2 has on the fluid flow is its different density. Differences in viscosity, heat capacity etc. are not significant ... the denser fluid just changes the pressure field. You can do a calculation on the mixture density, as a function of CO2 concentration, and compare this to the air density ... if the difference is a few percent, then this is probably not important. This changes, of course, if there is no advection driving the flow, since then fluid movement is driven solely by buoyancy forces, and of course there is no buoyancy force with a passive scalar approach.

To model active scalars, you need to use a different OpenFOAM solver - you're using v8, so that would typically be rhoReactingFoam. It's a bit of a sledgehammer approach, since you need to turn off the reactions, and its a weakly compressible flow solver, but it works pretty well.


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