CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

chtMultiRegionFoam: meaning of some expressions in the code

Register Blogs Community New Posts Updated Threads Search

Like Tree21Likes
  • 2 Post By wayne14
  • 10 Post By Bloerb
  • 2 Post By derekm
  • 2 Post By derekm
  • 5 Post By Bloerb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 8, 2016, 14:08
Default chtMultiRegionFoam: meaning of some expressions in the code
  #1
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Hi everybody!

I have been working for quite a while with chtMultiRegionSimpleFoam, and I know how it works. However, right now I was taking a look at the code and, although I know what it does, due to my weak knowledge on C++ I don't understand a couple of things about it... Here goes a snipet of the solveSolid.H file:
Code:
        tmp<fvScalarMatrix> hEqn
        (
            fvm::ddt(betav*rho, h)
          - (
               thermo.isotropic()
             ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
             : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)")
            )
          ==
            fvOptions(rho, h)
        );
I would like to know how betav works, because, as far as I know, it is a coeficient that takes the values 1 or 0, but I cannot understand how it is used by the solver and what its function is...

On the other hand, I would also like to understand how it is interpreted by the solver the following expression
Code:
fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
because I cannot figure out the meaning of the second laplacian in quotation marks within the first laplacian...

Many thanks in advance!

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   January 8, 2016, 21:54
Default
  #2
Member
 
Yan Wang
Join Date: May 2015
Location: Beijing
Posts: 41
Rep Power: 10
wayne14 is on a distinguished road
Quote:
Originally Posted by zfaraday View Post
Hi everybody!

I have been working for quite a while with chtMultiRegionSimpleFoam, and I know how it works. However, right now I was taking a look at the code and, although I know what it does, due to my weak knowledge on C++ I don't understand a couple of things about it... Here goes a snipet of the solveSolid.H file:
Code:
        tmp<fvScalarMatrix> hEqn
        (
            fvm::ddt(betav*rho, h)
          - (
               thermo.isotropic()
             ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
             : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)")
            )
          ==
            fvOptions(rho, h)
        );
I would like to know how betav works, because, as far as I know, it is a coeficient that takes the values 1 or 0, but I cannot understand how it is used by the solver and what its function is...

On the other hand, I would also like to understand how it is interpreted by the solver the following expression
Code:
fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
because I cannot figure out the meaning of the second laplacian in quotation marks within the first laplacian...

Many thanks in advance!

Best regards,

Alex
Hi Alex,

As far as I know, the second laplacian in quotation marks gives a name to this fvm::laplacian term, so that the following discretization scheme will be used for fvm::laplacian(betav*thermo.alpha(), h) and fvm::laplacian(betav*taniAlpha(), h).

Code:
laplacianSchemes
{
    default             none;
    laplacian(alpha,h)  Gauss linear corrected;
}
For the function of betav, I have no idea due to the lack of knowledge in heat transfer.

Regards,
Yan
K.C. and altinel like this.
wayne14 is offline   Reply With Quote

Old   January 10, 2016, 07:51
Default
  #3
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Hi Yan,

Many thanks for your explanation, that clarifies a lot!

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   January 11, 2016, 13:57
Default
  #4
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
betav is defined in the solver itself (check createSolidFields.H ) and is an additional IOobject. (a file like p U k omega etc)

Code:
// create input output object betavSolidIO
        IOobject betavSolidIO
        (
            "betavSolid",                    // name of the file
            runTime.timeName(),
            solidRegions[i],                // where is it located
            IOobject::MUST_READ,   // must be read
            IOobject::AUTO_WRITE  // is written at each timestep
        );
// check if the object file is properly defined
        if (betavSolidIO.headerOk()) 
        {
// set a poiner to each region
            betavSolid.set
            (
                i,
                new volScalarField(betavSolidIO, solidRegions[i]) 
 // creates a volScalarField with the values in the file betavSolid of the region
            );
        }
        else
// if there is no file
        {
            betavSolid.set
            (
                i,
                new volScalarField
                (
                    IOobject
                    (
                        "betavSolid",
                        runTime.timeName(),
                        solidRegions[i],
                        IOobject::NO_READ,         // do not read
                        IOobject::NO_WRITE        // don't write
                    ),
                    solidRegions[i],
                    dimensionedScalar("1", dimless, scalar(1.0))      
 // set it to 1 throughout the domain
                )
            );
        }
    }
The code tells you: If a file named betavSolid exists (headerOK) use betav supplied in the file. If not set 1. It is also dimless hence has no unit.

You can therefore add a file betavSolid into your 0/yoursolidregion/ directory and it will be read. Should look like this
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0/solid";
    object      betav;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 1; // or your value

boundaryField
{
// you could also define different values for the patches or use setFields to set it in parts of this region
    ".*"
    {
        type            zeroGradient;
        value           $internalField;
    }
}


// ************************************************************************* //
As to what it is for i am not absolutely certain. But it essentially multiplies with your laplace equation.
Code:
thermo.isotropic()
 ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)")
 : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)")
The ? : part is c++ short for if thermo.isotropic() then ... else ... and chooses the equation solved depending on the thermal conductivity (isotropic or not) alpha.
It is therefore most likely a factor to account for porosity in your solid. (In the combustion solvers betav (beta_nu) is a volume porosity) You can set any value you want not just 0 and 1. You could maybe use it to disable heat conduction in parts of your solid. I would also be interested in the mathematics behind this factor. Let me know if you can find something.
amod_kumar, zfaraday, K.C. and 7 others like this.

Last edited by Bloerb; January 12, 2016 at 16:04.
Bloerb is offline   Reply With Quote

Old   February 8, 2016, 18:08
Default
  #5
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Hi Stephan,

First of all, I'm sorry for my late response, I was busy when you provided such an interesting information and I forgot to respond.

Thanks for your detailed explanation about the meaning of betav. That really clarifies! I didn't know that a field called betavSolid could be defined in a solid region. However, I guess that when you define this field, its value will remains constant in time, right? If so, why is it written at each time step? It's quite useless, isn't it? Besides that, I agree with you on the possible meaning of betav, it makes sense that this is a factor that accounts for porosity in the solid. If someone else has any other idea about the meaning of betav, please, let us know!

Quote:
I would also be interested in the mathematics behind this factor. Let me know if you can find something.
I am also interested in getting a thorough knowledge about this factor called here "betav". Any help will be much appreciated!

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 2, 2018, 07:16
Default
  #6
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
Lost in the C++! Can you point me to the file were the values of field thermo.alpha gets assigned from stuff like Kappa, cp and T.

I'm thinking you could use betavSolid to allow for a solid with non-homogenous thermal properties

I found out what I was looking for... and betavSolid is useful.
Kummi and parthigcar like this.
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET

Last edited by derekm; April 3, 2018 at 06:01.
derekm is offline   Reply With Quote

Old   April 3, 2018, 07:41
Default
  #7
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
I 've attached a pdf that shows in picture the effect of betavSolid simulating a local change in conductivity on the heater temperature distribution in the tutorial chtMultiRegionSimpleFoam multiRegionHeaterRadiation. The case to create it is also included.
Attached Files
File Type: pdf betavSolidTests.pdf (92.9 KB, 114 views)
File Type: zip multiRegionHeaterRadiationbetavSolid.zip (38.1 KB, 33 views)
Kummi and Bobby02 like this.
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET
derekm is offline   Reply With Quote

Old   April 4, 2018, 08:19
Default
  #8
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
That is a bit complicated. In the Make/options file you should find inclusions for the thermal libraries (of fluid and solid - for the fluid those are based on turbulence etc so a bit more complicated).
Code:
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
...
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
and in the solid region itself you will find the creation of the thermo part needed for alpha, thermo.correct etc:
Code:
PtrList<solidThermo> thermos(solidRegions.size());
Which is frequently used in the code later on. Check e.g solveSolid.H. The alpha field is part of solidThermo. solidThermo however does not contain the calculation of alpha! Since solidThermo is the base class all the calculation is done in the actual model. The only choice for this is heSolidThermo. That this is the only choice you have can be checked in thermoPhysicalProperties. Simply try entering something else and look at the error message.

Here alpha is calculated for each cell and for the boundary. A small part of heSolidThermo.C and .H reads:

Code:
        alphaCells[celli] =
            volMixture_.kappa(pCells[celli], TCells[celli])
            /
            mixture_.Cpv(pCells[celli], TCells[celli]);
The volMixture part if you are interessted is defined in basicThermo. And this is basically where the rabbit hole ends.

Hence alpha=kappa/cp.

All of the files you need to look at are
basicThermo
heSolidThermo
solidThermo

Hope that helps
K.C., bikooo3878, Kummi and 2 others like this.
Bloerb is offline   Reply With Quote

Old   April 7, 2018, 11:36
Default
  #9
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
Thanks for that... its clarified a few things. The complexity of the thermo models is probably why the betavSolid field was introduced as a quicker way of making local adjustments. I had looked at making custom heSolidThermo but that would mean a custom solidThermo as well. That also means changing the chtMultiRegionSimpleFoam solver code that references that....
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET
derekm is offline   Reply With Quote

Reply


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
CFD code layout plasmaCode Main CFD Forum 3 December 12, 2015 22:10
The FOAM Documentation Project - SHUT-DOWN holger_marschall OpenFOAM 242 March 7, 2013 12:30
Open Source Vs Commercial Software MechE OpenFOAM 28 May 16, 2011 11:02
[Gmsh] Character expressions in gmsh? ericnutsch OpenFOAM Meshing & Mesh Conversion 0 January 21, 2010 23:21
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 15:56


All times are GMT -4. The time now is 08:40.