CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   multi region case - access field from another region (http://www.cfd-online.com/Forums/openfoam-programming-development/92080-multi-region-case-access-field-another-region.html)

mabinty September 1, 2011 13:59

multi region case - access field from another region
 
dear all!

i modified chtMultiRegionFoam including a radiation model in the fluid region. the radiation model, or better the BC of the radiation model, calculates a radiative wall heat flux Qr at every boundary and writes it out at the specified time steps.

now i need to access Qr from the solid region, i.e. in the forAll(solidRegions, i)-loop (see solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C line 104) .

first i tried to create a IOobject QrFluid in creatFluidFields with the MUST_READ option. but as it isn t updated in the code (and for now I don t know how to do it) it doesn t read the actual Qr field.

i also tried to use the db().lookupobject<> function which returns a reference to the object registry like:

Code:

    const volScalarField& QrFluid = UFluid[j].db().lookupObject<volScalarField>("Qr");
but without success. the code compiles but throws the error message below when executed:

Code:

--> FOAM FATAL ERROR:
hanging pointer, cannot dereference

    From function PtrList::operator[] const
    in file /opt/openfoam171/src/OpenFOAM/lnInclude/PtrListI.H at line 108.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::error::abort() in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
#3 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
#4  __libc_start_main in "/lib/libc.so.6"
#5 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
Aborted

does anybody have an idea how to access the fluid field Qr from the solid region?

i greatly appreciate your comments!
thx in advance!!
aram

mirko September 2, 2011 09:40

Quote:

Originally Posted by mabinty (Post 322538)
dear all!

i modified chtMultiRegionFoam including a radiation model in the fluid region. the radiation model, or better the BC of the radiation model, calculates a radiative wall heat flux Qr at every boundary and writes it out at the specified time steps.

now i need to access Qr from the solid region, i.e. in the forAll(solidRegions, i)-loop (see solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C line 104) .

first i tried to create a IOobject QrFluid in creatFluidFields with the MUST_READ option. but as it isn t updated in the code (and for now I don t know how to do it) it doesn t read the actual Qr field.

i also tried to use the db().lookupobject<> function which returns a reference to the object registry like:

Code:

    const volScalarField& QrFluid = UFluid[j].db().lookupObject<volScalarField>("Qr");
but without success. the code compiles but throws the error message below when executed:

Code:

--> FOAM FATAL ERROR:
hanging pointer, cannot dereference

    From function PtrList::operator[] const
    in file /opt/openfoam171/src/OpenFOAM/lnInclude/PtrListI.H at line 108.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::error::abort() in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
#3 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
#4  __libc_start_main in "/lib/libc.so.6"
#5 
 in "/home/aa/OpenFOAM/aa-1.7.1/applications/bin/linux64GccDPOpt/yazdRadBC"
Aborted

does anybody have an idea how to access the fluid field Qr from the solid region?

i greatly appreciate your comments!
thx in advance!!
aram

Funny, I am also hacking on the same solver, and had the same error yesterday. In my case, I traced the error with print statements to
Code:

        radiation.set
        (
            i,
            radiation::radiationModel::New(thermoFluid[i].T())
        );

in createFluidFields.H. It turned out that thermoFluid was not initialized. I had to prepend
Code:

        thermoFluid.set
        (
            i,
            basicRhoThermo::New(fluidRegions[i]).ptr()
        );

So, my guess is that you don't have a variable declared/initialized.

Good luck,

Mirko

mabinty September 3, 2011 10:34

hey Mirko!

thanks a lot for your reply!!

the chtMRF code where i added a radiation and combustion model actually works. i found some troubles (= numerical instability) when taking the radiative heat flux Qr for the cht-BC into account. hence, i want to try a new approach where Qr is applied as source term in the solid.

the problem i described above happens cause i havn t understood yet how to dereference the fluid field pointer lists outside of the fluid-loop. the error message comes from:

Code:

/opt/openfoam171/src/OpenFOAM/lnInclude/PtrListI.H at line 108
in the operator[] because there seems to be no element in SOMTHING[i]:

Code:

if (!ptrs_[i])
    {
        FatalErrorIn("PtrList::operator[]")
            << "hanging pointer, cannot dereference"
            << abort(FatalError);
    }

the operator<< which writes to OStream works, hence

Code:

Info<< "QrFluid: " << UFluid[j].db().lookupObject<volScalarField>("Qr")
    << endl;

shows me the Qr-volField i want.

any idea? i ll keep on digging and report!!

cheers,
aram

mirko September 6, 2011 10:25

Aram,

OF2.0 chtMultiRegionFoam includes radiation.

As for debugging, my approach is to copy the relevant solver or BC to my user directories, compile them, and then start adding print/Info statements to narrow down the cause of the error.

Mirko


All times are GMT -4. The time now is 16:34.