CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

find the hanging pointer ...

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 20, 2010, 12:09
Question find the hanging pointer ...
  #1
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 414
Rep Power: 10
mvoss is on a distinguished road
hi,

this is concerning the very general question about how to find a hanging pointer.
I am working on a MultiRegion-Solver, so i was starting from chtMultiRegionsFoam.

I followed the pattern in the solver
by addressing the pointers first with the appropriate size of the meshRegion with
Code:
PtrList<basicPsiThermo> thermoFluid(fluidRegions.size());
and then setting the pointerlists to the IOobjects by e.g.
Code:
 
Info<< "    Adding to KFluid\n" << endl;
                KFluid.set
                (
                    i,
                    new volScalarField
                    (
                        IOobject
                        (
                            "K",
                            runTime.timeName(),
                            fluidRegions[i],
                            IOobject::NO_READ,
                            IOobject::NO_WRITE
                        ),
                        thermoFluid[i].Cp()*thermoFluid[i].alpha()
                    )
                );
and finally use the local-"region"-variables in the normal manner.
Code:
fvScalarMatrix tEqn
        (
            -fvm::laplacian(K, T)
        );
        tEqn.relax();
        TEqnResidual = tEqn.solve().initialResidual();
Then i added the "solve"-part by including some working header-files.
The code is compiling but i am receiving an ERROR about: hanging pointer, cannot dereference .

So. How to solve this since there are plenty of pointers.
Is there a way to find the "bad" one? I just need some general advice where to search or how to look at that problem ... and maybe solving it the next time on my own.

Thanks in advance...

neewbie
mvoss is offline   Reply With Quote

Old   December 21, 2010, 06:43
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 13
l_r_mcglashan will become famous soon enough
When I had that error it was always because I got the range of a 'for' loop incorrect and I was trying to access an element in the pointer list that didn't exist. I would check the rangess of the loops you have in your program.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 3, 2011, 04:35
Default
  #3
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 414
Rep Power: 10
mvoss is on a distinguished road
hi,
thanks a lot. I did as you said and ended up in deleting EVERYTHING not necessary ... i´ve made a similar mistake by commenting over more than one line. took me a while to riddle that one out.

neewbie
mvoss is offline   Reply With Quote

Reply

Tags
multiregion, pointer

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FATAL ERROR hanging pointer cannot dereference tsencic OpenFOAM Running, Solving & CFD 3 December 12, 2013 05:18
Hanging pointer fabianpk OpenFOAM Running, Solving & CFD 8 January 28, 2011 11:29
YPlus nowhere to be find Daniel CFX 3 May 1, 2006 17:22
Can U find this Solution Report N°229 Mohamed FLUENT 5 June 19, 2003 04:28
hanging node Ludovit FLUENT 0 March 26, 2003 13:42


All times are GMT -4. The time now is 21:04.