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

Adding dimensioned scalar/scalar field to chtMultiRegionSimpleFoam/chtMultiRegionFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By crubio.abujas
  • 1 Post By PositronCascade

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 7, 2020, 07:36
Default Adding dimensioned scalar/scalar field to chtMultiRegionSimpleFoam/chtMultiRegionFoam
  #1
New Member
 
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6
Lann is on a distinguished road
Hi Foamers,

I am currently trying to add electrical potential transport equations to chtMultiRegionSimpleFoam/chtMultiRegionFoam.

However, I failed to add dimensioned scalars and scalar fields to createFields.H (createSolidFields.H) in chtMultiRegionFoam. The way I did is the same as what I did for icoFoam (https://openfoamwiki.net/index.php/H...ure_to_icoFoam)
But it does not work here.

In chtMultiRegionFoam, the createFields.H (createSolidFields.H) file is more complex and it seems that the way of defining scalars is also different, which I don't understand by scanning the code lines.

Does anyone have any idea/experience on this?

Btw I installed Openfoam 5x because it's the latest version that still has chtMultiRegionSimpleFoam, while the later versions combine chtMultiRegionSimpleFoam and chtMultiRegionFoam.

Thanks in advance,

Lan
Lann is offline   Reply With Quote

Old   March 9, 2020, 08:00
Default
  #2
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
Would you share what you are trying to do exactly, your modifications and the error that you get? This way is it not possible to guess where you are having a problem.

For v6, v7, you can use chtMultiRegionFoam as well, you just define it as steady problem and it works like old chtMultiRegionSimpleFoam I guess.
PositronCascade is offline   Reply With Quote

Old   March 9, 2020, 09:45
Default
  #3
New Member
 
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6
Lann is on a distinguished road
Quote:
Originally Posted by PositronCascade View Post
Would you share what you are trying to do exactly, your modifications and the error that you get? This way is it not possible to guess where you are having a problem.

For v6, v7, you can use chtMultiRegionFoam as well, you just define it as steady problem and it works like old chtMultiRegionSimpleFoam I guess.
Hi Hasan,

Simply speaking, I'm trying to add a transport equation into chtMultiRegionFoam like fvm::laplacian(a, X) == b

My current problem is to implement the parameters / dimensioned scalars (a and b) and the scalar field (X).
In the tutorial that I listed above, it can be done by simply add the lines below into createFields.H:
HTML Code:
Info<< "Reading diffusivity a" << endl;

dimensionedScalar a
(
    transportProperties.lookup("a")
);

Info<< "Reading field fe and fH\n" << endl;

volScalarField X
(
    IOobject
    (
        "X",
        runTime.timeName(),
        solidRegions[i],
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    solidRegions[i]
);
However, it does not seem to work in chtMultiRegionFoam. If you could kindly check the createFields.H (createSolidFields.H), you would see the difference. Especially it begins with theses lines:
HTML Code:
    // Initialise solid field pointer lists
    PtrList<coordinateSystem> coordinates(solidRegions.size());
    PtrList<solidThermo> thermos(solidRegions.size());
    PtrList<radiation::radiationModel> radiations(solidRegions.size());
    PtrList<fv::options> solidHeatSources(solidRegions.size());
    PtrList<volScalarField> betavSolid(solidRegions.size());
    PtrList<volSymmTensorField> aniAlphas(solidRegions.size());
    List<bool> residualReachedSolid(solidRegions.size(), true);
    List<bool> residualControlUsedSolid(solidRegions.size(), false);
Any advice and hint may be super helpful for me.

Thanks again,
Lan

Last edited by Lann; March 10, 2020 at 05:38.
Lann is offline   Reply With Quote

Old   March 9, 2020, 10:05
Default
  #4
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 9
crubio.abujas is on a distinguished road
I've been recently trying to adapt chMultiRegionFoam as well. Using OF6 in this my case.

As far as I can understand the code, in this solver the parameters (T, p, rho, ...) are not contained in a single field but each region has its own parameters. In the fluid/createFluidFields.H file a series of PtrList are defined for the magnitudes of interes. Bellow, inside the forAll loop, these properties are read and stored in the list.

Code:
// Initialise fluid field pointer lists
PtrList<rhoReactionThermo> thermoFluid(fluidRegions.size());
PtrList<volScalarField> rhoFluid(fluidRegions.size());
PtrList<volVectorField> UFluid(fluidRegions.size());
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size());
PtrList<volScalarField> ghFluid(fluidRegions.size());
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
PtrList<compressible::turbulenceModel> turbulenceFluid(fluidRegions.size());
PtrList<CombustionModel<rhoReactionThermo>> reactionFluid(fluidRegions.size());
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
PtrList<volScalarField> KFluid(fluidRegions.size());
PtrList<volScalarField> dpdtFluid(fluidRegions.size());
PtrList<multivariateSurfaceInterpolationScheme<scalar>::fieldTable>
    fieldsFluid(fluidRegions.size());
PtrList<volScalarField> QdotFluid(fluidRegions.size());

List<scalar> initialMassFluid(fluidRegions.size());

PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
PtrList<fv::options> fluidFvOptions(fluidRegions.size());

// Populate fluid field pointer lists
forAll(fluidRegions, i)
{
    Info<< "*** Reading fluid mesh thermophysical properties for region "
        << fluidRegions[i].name() << nl << endl;

    Info<< "    Adding to thermoFluid\n" << endl;
    thermoFluid.set(i, rhoReactionThermo::New(fluidRegions[i]).ptr());
...
}
On this file all the field definition must be present. Afterwards, in the solving loop, you have to point one by one to each regions' field, solve it and pass to the next one. For that the main file calls the fluid/setRegionFluidField.H. These two files must be modified adding the fields you need to add. The equation notation may stay the same as far as the setRegionFluidField pointer names have the same name.


The same things apply to the solid fields, in case you need to modify them.



Hope it helps!
Lann likes this.
crubio.abujas is offline   Reply With Quote

Old   March 10, 2020, 03:28
Default
  #5
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
You need to define it in a such way:

Code:
betavSolid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "betavSolid",
                    runTime.timeName(),
                    solidRegions[i],
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                ),
                solidRegions[i],
                dimensionedScalar(dimless, scalar(1))
            )
        );
Firstly, you need define i, because you may have many solid regions. you need to define it like, a.set. You need to change mesh with solidRegions[i] or fluidRegions[i].
Lann likes this.
PositronCascade is offline   Reply With Quote

Old   March 10, 2020, 05:40
Default
  #6
New Member
 
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6
Lann is on a distinguished road
Thanks Carlos! I'll look into setRegionFluid/SolidField.H
Lann is offline   Reply With Quote

Reply

Tags
adding term, chtmulitregionfoam, chtmultiregionsimplefoam, solver development


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
multiRegionHeater error ordinary OpenFOAM Running, Solving & CFD 2 June 9, 2020 17:43
Adding magnetic field to rhoCentralFoam pumpkinITER OpenFOAM Programming & Development 5 April 7, 2016 12:33
chtMultiRegionSimpleFoam: strange error samiam1000 OpenFOAM Running, Solving & CFD 26 December 29, 2015 22:14
Adding Temperature field to IcoFoam yapalparvi OpenFOAM Programming & Development 14 November 19, 2015 04:57
Adding temperature field to InterFoam yapalparvi OpenFOAM Running, Solving & CFD 8 October 14, 2009 20:18


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