CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How to define Vacuum Conditions in OpenFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2019, 08:05
Default How to define Vacuum Conditions in OpenFoam
  #1
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Hello Everyone,


I am using chtMultiRegionSimpleFoam and my Openfoam version is 4.1


I am trying to simulate radiation heat transfer in a vacuum.


My questions are the following:


1. How can we generate a vacuum? For example If I have one rectangular region and I want to make it a vacuum, Do I need to change themophysical properties?


2. which radiation model would be suitable for vacuum?


I shall be very thankful for your help.


Thank you
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 06:43
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


1. Just set the reference pressure to your needs in the fvSolution file. I assume that you have a closed volume.
Change from what?



2. It depends. The medium is participating in the radiation, or not? It is optically thick, or not?
simrego is offline   Reply With Quote

Old   August 12, 2019, 06:52
Default
  #3
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!


1. Just set the reference pressure to your needs in the fvSolution file. I assume that you have a closed volume.
Change from what?



2. It depends. The medium is participating in the radiation, or not? It is optically thick, or not?



Thank you so much for your reply.


My geometry is attached. Please have a look


The green region is a heater, and the blue region is the air, that I want to make vacuum. because I want to see the behavior of radiations in the vacuum coming out from the green heater.


Please let me know if you need further clarification about the case.


thank you
Attached Images
File Type: jpg vacuum.jpg (22.6 KB, 47 views)
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 06:53
Default
  #4
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!


1. Just set the reference pressure to your needs in the fvSolution file. I assume that you have a closed volume.
Change from what?



2. It depends. The medium is participating in the radiation, or not? It is optically thick, or not?



I am putting viewFactor radiation model in the region air, and radiation model Opaque on the heater.
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 08:24
Default
  #5
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Since this is air, the viewFactor model seems fine.
For the vacuum what is the pressure in the vacuum? And again this is a closed volume, right? without inlets/outlets.
simrego is offline   Reply With Quote

Old   August 12, 2019, 08:37
Default
  #6
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
Since this is air, the viewFactor model seems fine.
For the vacuum what is the pressure in the vacuum? And again this is a closed volume, right? without inlets/outlets.

Yes this is a closed volume without inlets/outlets. Below is the mesh information for my air region:


Code:
2
(
    defaultFaces
    {
        type            wall;
        nFaces          8400;
        startFace       319164;
    }

    vacuum_to_heater
    {
        type            mappedWall;
        inGroups        1 ( wall );
        nFaces          336;
        startFace       327564;
        sampleMode      nearestPatchFace;
        sampleRegion    heater;
        samplePatch     heater_to_vacuum;
    }

)
Vacuum is the name of my Air region.

The pressure I am using is 1 bar, you can see below the changeDictionaryDict of my air(vacuum name used in the case) region:
I have put the zero velocity, so that there should be no heat transfer through convection.



Code:
boundary
{
    defaultFaces
    {
        type            wall;
    }
}

T
{
    internalField   uniform 300;

    boundaryField
    {
        defaultFaces
        {
            type            zeroGradient;
        }

        "vacuum_to_.*"
        {

            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     fluidThermo;
            value           uniform 300;
        }
    }
}

U
{
    internalField   uniform (0 0 0);

    boundaryField
    {

        defaultFaces
        {
            type            noSlip;
        }
        "vacuum_to_.*"
        {
            type            noSlip;
        }

    }
}

p_rgh
{
    internalField   uniform 0;

    boundaryField
    {

        defaultFaces
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }

        ".*"
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }
    }
}

p
{
    internalField   uniform 100000;

    boundaryField
    {
        ".*"
        {
            type            fixedValue;
            value           uniform 100000;
        }
    }
}
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 09:50
Default
  #7
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
In this solver the calculated pressure field is p_rgh. p is calculated from p_rgh. You should just set calculated BC for every p field. Also these values are only the initial values. In your air/fvSolution file you have to define a reference cell, and a referecne pressure. You can set it to 1bar if your pressure is 1 bar in the domain.
For the material properties you can use what you want, but you need a temperature dependent density. You will have some convective heat transfer. In the U file all you do is set the velocity on the boundaries to zero, which is correct for a wall. But in the domain you will have non zero velocities. (nonuniform temperature field -> nonuniform density -> fluid will start moving.)
simrego is offline   Reply With Quote

Old   August 12, 2019, 10:03
Default
  #8
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
In this solver the calculated pressure field is p_rgh. p is calculated from p_rgh. You should just set calculated BC for every p field. Also these values are only the initial values. In your air/fvSolution file you have to define a reference cell, and a referecne pressure. You can set it to 1bar if your pressure is 1 bar in the domain.
For the material properties you can use what you want, but you need a temperature dependent density. You will have some convective heat transfer. In the U file all you do is set the velocity on the boundaries to zero, which is correct for a wall. But in the domain you will have non zero velocities. (nonuniform temperature field -> nonuniform density -> fluid will start moving.)

So, the boundary conditions and initial values for p_rgh would remain as they are? like below:
Code:
p_rgh
{
    internalField   uniform 0;

    boundaryField
    {

        defaultFaces
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }

        ".*"
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }
    }
}

And for pressure I should put on each boundary "calculated"?



Material properties of my air region is below:


Code:
thermoType
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

mixture
{
    specie
    {
        nMoles          1;
        molWeight       28.9;
    }
    thermodynamics
    {
        Cp              1000;
        Hf              0;
    }
    transport
    {
        mu              1.8e-05;
        Pr              0.7;
    }
}

But there is no entry for density (rho). shall I put one?


I exactly dont know How to define the reference cell and reference pressure? Below is my air/fvSolution file


Code:
solvers
{
    rho
    {
        solver          PCG
        preconditioner  DIC;
        tolerance       1e-7;
        relTol          0;
    }

    p_rgh
    {
        solver           GAMG;
        tolerance        1e-7;
        relTol           0.01;

        smoother         GaussSeidel;

        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator     faceAreaPair;
        mergeLevels      1;

        maxIter          10;
    }

    "(U|h|k|epsilon)"
    {
        solver           PBiCG;
        preconditioner   DILU;
        tolerance        1e-7;
        relTol           0.1;
    }
}

SIMPLE
{
    momentumPredictor on;
    nNonOrthogonalCorrectors 2;
    pRefCell        0;
    pRefValue       100000;
    rhoMin          rhoMin [1 -3 0 0 0] 700;
    rhoMax          rhoMax [1 -3 0 0 0] 1200;
}

relaxationFactors
{
    fields
    {
        rho             1;
        p_rgh           0.7;
    }
    equations
    {
        U               0.7;
        h               0.7;
        nuTilda         0.7;
        k               0.7;
        epsilon         0.7;
        omega           0.7;
        "ILambda.*"     0.7;
        Qr              0.7;
    }
}

// ************************************************************************* //
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 10:21
Default
  #9
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
So for p you can use calculated. The solver solves for p_rgh, and calculate p from p_rgh. So just let the solver to calculate everything for p.
For p_rgh, you should set the initial values to 1 bar since this is your operating pressure, and it can speed up the convergence if you have a better guess with the initial values.
Just replace every uniform 0; to uniform 100000; in the p_rgh sub-dictionary



You don't need rho because of that line:
equationOfState perfectGas;

with this model you calculate rho from molweight, temperature, and pressure. This is accurate but it can be unstable.
Your fvSolution seems fine, but your rhoMin and rhoMax will maked you mad. air density will be around 1, but you limit it between 700-1200. You can comment that lines out and use the limiter only if your density blows up (if during the solution you will have really large or small densities).
And you could use smaller relaxation factors. These kind of problems can be really unstable (bad convergence).
simrego is offline   Reply With Quote

Old   August 12, 2019, 10:55
Default
  #10
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
So for p you can use calculated. The solver solves for p_rgh, and calculate p from p_rgh. So just let the solver to calculate everything for p.
For p_rgh, you should set the initial values to 1 bar since this is your operating pressure, and it can speed up the convergence if you have a better guess with the initial values.
Just replace every uniform 0; to uniform 100000; in the p_rgh sub-dictionary



You don't need rho because of that line:
equationOfState perfectGas;

with this model you calculate rho from molweight, temperature, and pressure. This is accurate but it can be unstable.
Your fvSolution seems fine, but your rhoMin and rhoMax will maked you mad. air density will be around 1, but you limit it between 700-1200. You can comment that lines out and use the limiter only if your density blows up (if during the solution you will have really large or small densities).
And you could use smaller relaxation factors. These kind of problems can be really unstable (bad convergence).

I changed the boundary conditions for p and p_rgh like below:


Code:
p_rgh
{
    internalField   uniform 100000;

    boundaryField
    {

        defaultFaces
        {
            type            fixedFluxPressure;
            value           uniform 100000;
        }

        ".*"
        {
            type            fixedFluxPressure;
            value           uniform 100000;
        }
    }
}

p
{
    internalField   uniform 100000;

    boundaryField
    {
        ".*"
        {
            type            calculated;
            value           uniform 100000;
        }
    }
}

First I tried putting 0 value in p instead of 100000, but then the solver was giving error, then I changed that also to 100000 like p_rgh. Is this correct?



And I removed those two lines for rhomin and rhomax from fvSolutions.
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 11:14
Default
  #11
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Yes, it should.
It crashed because of your "density model" i think.
you set the p for 0. For the first time it will tries to calculate the density as:
rho = p/(R*T)
With 0 p you will get 0 density. And everything goes wrong.

In the next step it should be fine since p is recalculated from p_rgh and it will be correct. But you can't get there since you failed already.
So 1bar for p is correct, but doesn't really matter since it is just an initial value. Just survive the first few iterations!


And now your case is running?
simrego is offline   Reply With Quote

Old   August 12, 2019, 11:31
Default
  #12
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
Yes, it should.
It crashed because of your "density model" i think.
you set the p for 0. For the first time it will tries to calculate the density as:
rho = p/(R*T)
With 0 p you will get 0 density. And everything goes wrong.

In the next step it should be fine since p is recalculated from p_rgh and it will be correct. But you can't get there since you failed already.
So 1bar for p is correct, but doesn't really matter since it is just an initial value. Just survive the first few iterations!


And now your case is running?

Yes. with the initial values and boundary conditions I attached in the last post, the solver is running.


I am sorry I have one another question related to fvOptions. In my heater region inside the air region, I am putting power using fvOptions file. I want to put 10W of power in that. The volume of my heater region is 1e-12 cubic meter. What value should I write in fvOptions if I am using specific volume mode?



shall I divide 10 watts with the volume of heater and then put the result in fvOptions?


Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
 
    scalarSemiImplicitSourceCoeffs
    {
        selectionMode   all; // all, cellSet, cellZone, points
       // cellZone        hot;        
        //cellSet         c1;
        volumeMode      specific; // absolute;
        injectionRateSuSp
        {
            h     (1e13 0);
        }
    }
}
Raza Javed is offline   Reply With Quote

Old   August 12, 2019, 11:35
Default
  #13
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Feel free to ask. If i can i'll try to help you
There is a simpler solution. Set the volumeMode to absolute. So you can simply write 10.
https://openfoam.com/documentation/guides/latest/api/classFoam_1_1fv_1_1SemiImplicitSource.html#details

:
Valid options for the volumeMode entry include:
  • absolute: values are given as <quantity>
  • specific: values are given as <quantity>/m3
simrego is offline   Reply With Quote

Old   August 12, 2019, 11:37
Default
  #14
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
But to answer your question. in specific mode you just have to divide 10 W with the volume. So 1e13 seems correct. But I suggest you to let the solver calculate these thing so you'll have less sources for the mistakes.
simrego is offline   Reply With Quote

Old   August 13, 2019, 05:25
Default
  #15
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Originally Posted by simrego View Post
But to answer your question. in specific mode you just have to divide 10 W with the volume. So 1e13 seems correct. But I suggest you to let the solver calculate these thing so you'll have less sources for the mistakes.

Thank you. I did and now the solver is running.


Please correct me where I am wrong.


So, till here the solver is running with a heater inside air, and we put p_rgh and p equals to 1 bar.


Now, I need to change this air to vacuum, so I must decrease the pressure. I cannot put zero for p because then the solver stops.


So can I put p_rgh equals to zero, and p equals to very very small value for vacuum?


And in the U sub-dictionary, do I need to put some value for the velocity also?


Thank you
Raza Javed is offline   Reply With Quote

Old   August 13, 2019, 06:11
Default
  #16
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
I don't think if you can set zero pressure with this solver. I think this is not suitable for that. You can use small pressure, but with 0 I think it will blow up. But you can give it a try.
If you need a different pressure, just set it in the fvSolution file, and correct the p_rgh and p field to the same pressure (Again in the p_rgh and p files you just giving initial values, they shouldn't affect the solution.)
And if you decrease the pressure, you have to correct the material properties of the air to that pressure and temperature. Since the properties of air are depends on the pressure and temperature.
You can leave U as it is. You will have some air motion. Or you can set a "frozenFlow yes;" flag in the "air/fvSolution/SIMPLE", and you will solve only the energy equation, thus the velocity and pressure field will be the initialized value during the solution, so if you set 0 velocity, you will have only radiation, and conduction through the air.
simrego is offline   Reply With Quote

Old   August 13, 2019, 06:32
Default
  #17
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
I don't think if you can set zero pressure with this solver. I think this is not suitable for that. You can use small pressure, but with 0 I think it will blow up. But you can give it a try.

I put everything zero like below:


Code:
p_rgh
{
    internalField   uniform 0;

    boundaryField
    {

        defaultFaces
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }

        ".*"
        {
            type            fixedFluxPressure;
            value           uniform 0;
        }
    }
}

p
{
    internalField   uniform 0;

    boundaryField
    {
        ".*"
        {
            type            calculated;
            value           uniform 0;
        }
    }
}

and I got the following error:


Code:
Time = 0.1


Solving for fluid region vacuum
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#4  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#5  Foam::fluidThermo::nu() const at ??:?
#6  Foam::laminar<Foam::ThermalDiffusivity<Foam::CompressibleTurbulenceModel<Foam::fluidThermo> > >::nuEff() const at ??:?
#7  Foam::linearViscousStress<Foam::ThermalDiffusivity<Foam::CompressibleTurbulenceModel<Foam::fluidThermo> > >::divDevRhoReff(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const at ??:?
#8  ? at ??:?
#9  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#10  ? at ??:?
Floating point exception (core dumped)

Quote:
If you need a different pressure, just set it in the fvSolution file, and correct the p_rgh and p field to the same pressure (Again in the p_rgh and p files you just giving initial values, they shouldn't affect the solution.)

where in fvSolution I can put pressure? at pRefValue?

In the fvSolution file, I will put p or p_rgh ?




Quote:
And if you decrease the pressure, you have to correct the material properties of the air to that pressure and temperature. Since the properties of air are depends on the pressure and temperature.

You mean to say that I need to change the values mentioned below with the new small pressure I will put?


Code:
thermoType
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

mixture
{
    specie
    {
        nMoles          1;
        molWeight       28.9;
    }
    thermodynamics
    {
        Cp              1000;
        Hf              0;
    }
    transport
    {
        mu              1.8e-05;
        Pr              0.7;
    }
}
Raza Javed is offline   Reply With Quote

Old   August 13, 2019, 06:46
Default
  #18
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Yes this error is a figFpe, you have a division with 0 somewhere. Probably because of that 0 pressure.


Sorry, yes. Only the pRefValue have to be modified. You don't have to put anything else in the fvSolution, only modify the pRefvalue.


Yes you have to modify them. I think Pr=0.7 is only valid for air on atmospheric pressure and ~300 K. Also check the viscosity. But if you use frozenFlow maybe the viscosity is redundant.
simrego is offline   Reply With Quote

Old   August 13, 2019, 06:55
Default
  #19
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Sorry, yes. Only the pRefValue have to be modified. You don't have to put anything else in the fvSolution, only modify the pRefvalue.

Ok. for example: if I put pRefValue=2.5, then I have to change p and p_rgh in changeDictionaryDict to 2.5 also?
Raza Javed is offline   Reply With Quote

Old   August 13, 2019, 07:21
Default
  #20
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 6
Raza Javed is on a distinguished road
Quote:
Yes you have to modify them. I think Pr=0.7 is only valid for air on atmospheric pressure and ~300 K

I have checked about the Pr value for small pressure, but couldn't find it. and Pr is also not directly dependent on pressure,

Is there anyway to find Pr for different pressures?
Raza Javed is offline   Reply With Quote

Reply

Tags
openfoam, radiation, vacuum

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 16:54
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 04:19
An odd ERROR mdakbari Fluent UDF and Scheme Programming 7 April 4, 2016 05:30
OpenFoam volume conditions vmsandip2011 OpenFOAM Running, Solving & CFD 5 February 24, 2012 11:32
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 13:24


All times are GMT -4. The time now is 06:59.