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

Adding 2-Phase Fluid (interFoam) to chtMultiRegionFoam - issues initializing alpha

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 21, 2021, 16:39
Default Adding 2-Phase Fluid (interFoam) to chtMultiRegionFoam - issues initializing alpha
  #1
Member
 
Kellis
Join Date: Mar 2017
Posts: 39
Rep Power: 9
Kellis is on a distinguished road
Foamers,

Good afternoon. I am in the process of modifying chtMultiRegionFoam (in OF 1806) to model an incompressible, two-phase fluid. I am doing this in several steps, and have already modified the solver for incompressible flow. Now, I am nearly done adding in the code from interFoam to allow for two phases to be solved, but am experiencing issues with the createAlphaFluxes.H file. When compiling, I get the following error:

Code:
./multiRegionVoF/createAlphaFluxes.H:47:59: error: array must be initialized with a brace-enclosed initializer
   alphaPhi10HeaderList[i].typeHeaderOk<surfaceScalarField>();
The issue is arising from my attempts to initialize the alpha fields for each fluid region. I have tried several variants of code, including:

Code:
// createAlphaFluxes.H

PtrList<IOobject> alphaPhi10HeaderList(fluidRegions.size());
PtrList<bool> alphaRestartList(fluidRegions.size());
PtrList<surfaceScalarField> alphaPhi10List(fluidRegions.size());
PtrList<surfaceScalarField> talphaPhi1Corr0List(fluidRegions.size());

forAll(fluidRegions, i)
 {

    alphaPhi10HeaderList.set
    (
        i,
        new IOobject
        (
            IOobject
            (
                IOobject::groupName("alphaPhi0", alpha1l[i].group()),
                runTime.timeName(),
                fluidRegions[i],
                IOobject::READ_IF_PRESENT,
                IOobject::AUTO_WRITE
            ),
            fluidRegions[i]
        )
    );
  
   // this line trips error
     const bool alphaRestartList[i] =
        alphaPhi10HeaderList[i].typeHeaderOk<surfaceScalarField>();

   // more stuff below here
     ...
  }
As well as:

Code:
...

    alphaRestartList.set
    (
        i,
        new const bool
        (
            "alphaRestart",
            alphaPhi10HeaderList[i].typeHeaderOk<surfaceScalarField>(true)
        )
    );

 ...
To be honest, I am not sure what this line of code is doing and have no real clue how to move forward other than blind trial and error. Any help diagnosing this issue would be greatly appreciated! I have attached my solver code as it stands currently for inspection. I have created a new multiRegionVoF folder within my solver directory holding the modified code for solving for alpha.

Thanks,
Kellis
Attached Files
File Type: zip chtMultiRegionInterFoam_wip.zip (114.1 KB, 23 views)
Kellis is offline   Reply With Quote

Old   October 15, 2021, 06:17
Default
  #2
New Member
 
XinZhou
Join Date: Apr 2018
Posts: 11
Rep Power: 8
XinXin is on a distinguished road
Hi,Kellis,have you solved this problem?
XinXin is offline   Reply With Quote

Old   October 15, 2021, 10:39
Default
  #3
Member
 
Kellis
Join Date: Mar 2017
Posts: 39
Rep Power: 9
Kellis is on a distinguished road
Yes, I have had the code working for some time now. I'm not exactly sure what I changed to get past this issue, but below is the working code in the createAlphaFluxes.H file where I was having issues.

Best of luck,
Kellis

Code:
PtrList<IOobject> alphaPhi10HeaderList(fluidRegions.size());
PtrList<bool> alphaRestartList(fluidRegions.size());
PtrList<surfaceScalarField> alphaPhi10List(fluidRegions.size());

Info << "    Creating alpha fluxes\n" << endl;

forAll(fluidRegions, i)
{
    alphaPhi10HeaderList.set
    (
        i,
        new IOobject
        (
            IOobject
            (
                IOobject::groupName("alphaPhi0", alpha1l[i].group()),
                runTime.timeName(),
                fluidRegions[i],
                IOobject::READ_IF_PRESENT,
                IOobject::AUTO_WRITE
            ),
            fluidRegions[i]
        )
    );

    IOobject alphaRestartTmp = alphaPhi10HeaderList[i];

    const bool alphaRestartListTmp = alphaRestartTmp.typeHeaderOk<surfaceScalarField>(true);

    alphaRestartList.set
    (
        i,
        new bool(alphaRestartListTmp)
    );

    if (alphaRestartList[i])
    {
        Info << "Restarting alpha" << endl;
    }

    // MULES flux from previous time-step

    alphaPhi10List.set
    (
        i,
        new surfaceScalarField
        (
            "alphaPhi10Header",
            phiFluid[i]*fvc::interpolate(alpha1l[i])
        )
    );

    tmp<surfaceScalarField> talphaPhi1Corr0;

    Info << "    Done creating alpha fluxes\n" << endl;
}
Kellis is offline   Reply With Quote

Reply

Tags
alpha, cht, interfoam, vof


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
Problem with running chtMultiRegionFoam after using setSet utility Victor OpenFOAM 12 March 24, 2023 01:01
[swak4Foam] mass conservation of solid phase violated when using groovyBC with twoPhaseEulerFoam xpqiu OpenFOAM Community Contributions 8 June 17, 2015 03:08
Adding an energy source term to a phase with reactions lxlxlxt Fluent Multiphase 0 February 10, 2014 21:42
compressible two phase flow in CFX4.4 youngan CFX 0 July 2, 2003 00:32
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


All times are GMT -4. The time now is 15:51.