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

multi region case - access field from another region

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

Like Tree4Likes
  • 1 Post By mabinty
  • 1 Post By mirko
  • 1 Post By mabinty
  • 1 Post By mirko

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 1, 2011, 14:59
Default multi region case - access field from another region
  #1
Senior Member
 
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17
mabinty is on a distinguished road
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
Bahram likes this.
mabinty is offline   Reply With Quote

Old   September 2, 2011, 10:40
Default
  #2
Senior Member
 
Mirko Vukovic
Join Date: Mar 2009
Posts: 159
Rep Power: 17
mirko is on a distinguished road
Quote:
Originally Posted by mabinty View Post
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
Bahram likes this.
mirko is offline   Reply With Quote

Old   September 3, 2011, 11:34
Default
  #3
Senior Member
 
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17
mabinty is on a distinguished road
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
Bahram likes this.
mabinty is offline   Reply With Quote

Old   September 6, 2011, 11:25
Default
  #4
Senior Member
 
Mirko Vukovic
Join Date: Mar 2009
Posts: 159
Rep Power: 17
mirko is on a distinguished road
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
Bahram likes this.
mirko is offline   Reply With Quote

Reply

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
access to field data sepp OpenFOAM Programming & Development 0 February 15, 2011 10:13
solving multi case one after another automaticly Alshroof CFX 2 July 17, 2007 21:30
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 13:24
ACCESS VIOLATION during autosaving case file Ryan FLUENT 1 April 20, 2004 11:32
Multi Block case. Constantinos Constantinou FLUENT 1 October 26, 2001 03:00


All times are GMT -4. The time now is 05:37.