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

Index 512472272 out of range 0 ... 4

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 22, 2017, 16:09
Default Index 512472272 out of range 0 ... 4
  #1
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Hello everyone,

I have changed the thermophysicalModels in openfoam 4.1 and added new equations of state and thermo psi model. There is no compilation error in the new library and the solver code, however when I want to run the case I get the following error:

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
PIMPLE: iteration 1

--> FOAM FATAL ERROR:
index 512472272 out of range 0 ... 4

From function void Foam::UList<T>::checkIndex(Foam::label) const [with T = Foam::fvPatchField<double>*; Foam::label = int]
in file /home/salar/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/UListI.H at line 106.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OSspecific/POSIX/printStack.C:218
#1 Foam::error::abort() at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/error.C:249
#2 Foam::Ostream& Foam:perator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/errorManip.H:85 (discriminator 3)
#3 Foam::UList<Foam::fvPatchField<double>*>::checkInd ex(int) const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/UListI.H:110
#4 Foam::UList<Foam::fvPatchField<double>*>:perator[](int) const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/UListI.H:201
#5 Foam::UPtrList<Foam::fvPatchField<double> >:perator[](int) const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/OpenFOAM/lnInclude/UPtrListI.H:105
#6 Foam:siThermo::rho(int) const at ~/OpenFOAM/salar-4.1/NewTry/basic/psiThermo/psiThermo.C:101
#7 Foam::fluidThermo::nu(int) const at ~/OpenFOAM/salar-4.1/NewTry/basic/fluidThermo/fluidThermo.C:85
#8 Foam::TurbulenceModel<Foam::geometricOneField, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleTurbulenceModel, Foam::fluidThermo>::nu() const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/TurbulenceModels/compressible/../turbulenceModels/lnInclude/TurbulenceModel.H:164
#9 Foam::laminar<Foam::ThermalDiffusivity<Foam::Compr essibleTurbulenceModel<Foam::fluidThermo> > >::nuEff() const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/TurbulenceModels/compressible/../turbulenceModels/lnInclude/laminar.C:157 (discriminator 2)
#10 Foam::linearViscousStress<Foam::ThermalDiffusivity <Foam::CompressibleTurbulenceModel<Foam::fluidTher mo> > >::divDevRhoReff(Foam::GeometricField<Foam::Vector <double>, Foam::fvPatchField, Foam::volMesh>&) const at ~/OpenFOAM/OpenFOAM-4.1/OpenFOAM-4.1/src/TurbulenceModels/compressible/../turbulenceModels/lnInclude/linearViscousStress.C:101
#11 ? at ~/OpenFOAM/salar-4.1/Solver/PIMPLESolver/UEqn.H:4
#12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13 ? at ??:?
Aborted (core dumped)

I compiled the debug version of 4.1 and used gdb to find the source of this problem. I do not understand in which step patchi becomes 512472272 and why? Any guidance is appreciated.

Thanks,
Salar
salar is offline   Reply With Quote

Old   December 23, 2017, 14:51
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Could you at least post line 101 of ~/OpenFOAM/salar-4.1/NewTry/basic/psiThermo/psiThermo.C? It would be great to see context also (i.e. post your loop code).
alexeym is offline   Reply With Quote

Old   December 23, 2017, 15:43
Default
  #3
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

Could you at least post line 101 of ~/OpenFOAM/salar-4.1/NewTry/basic/psiThermo/psiThermo.C? It would be great to see context also (i.e. post your loop code).

Alexeym,

I have not changed the psiThermo.C file. In this file code returns the density on the patchi but since the value of the patchi is out of range (0-4) It gives error and this function is needed for fluidthermo.C line 85 to return the viscosity (nu) on the patchi. I have not changed these files at all.

line 101 of ~/OpenFOAM/salar-4.1/NewTry/basic/psiThermo/psiThermo.C

98 Foam::tmp<Foam::scalarField> Foam:siThermo::rho(const label patchi)
99 const
100 {
101 return p_.boundaryField()[patchi]*psi_.boundaryField()[patchi];
102 }

Regarding the solver it is the original rhoPimpleFoam with changed pathes in option file under Make folder to access new thermophysical models.

Regards,
Salar
salar is offline   Reply With Quote

Old   December 23, 2017, 17:03
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
OK.

Quote:
I have changed the thermophysicalModels in openfoam 4.1
Then just post what you have changed. The only two references to your home folder were in psiThermo.C and fluidThermo/fluidThermo.C, yet it seems you did not change them. Maybe you modified files in-place. Well, in this case, answer is the same: post your changes.
alexeym is offline   Reply With Quote

Old   December 26, 2017, 21:36
Default
  #5
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Quote:
Originally Posted by alexeym View Post
OK.



Then just post what you have changed. The only two references to your home folder were in psiThermo.C and fluidThermo/fluidThermo.C, yet it seems you did not change them. Maybe you modified files in-place. Well, in this case, answer is the same: post your changes.
Alexey,

There are changes in numerous files. I have uploaded My thermo libraries below. Modifications are based on the real gas EOS that is implemented in OpenFoam 2.1 and foam-extend-4.0. I am trying to implement the libraries in OpenFoam 4.1. Any help and guidance in debugging the code is appreciated.

This is the link that, the code for previous versions of OF is discussed:
Real Gas EOS

Regards,
Salar
Attached Files
File Type: zip MyThermo.zip (144.1 KB, 6 views)
salar is offline   Reply With Quote

Old   December 27, 2017, 03:42
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
OK.

You have posted code, yet it seems error happens, when you run certain case. Could you post the case also?
alexeym is offline   Reply With Quote

Old   December 27, 2017, 11:40
Default
  #7
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Quote:
Originally Posted by alexeym View Post
OK.

You have posted code, yet it seems error happens, when you run certain case. Could you post the case also?
Alexey,

Here is the solver which uses the new libraries and a test case. Yes, the solver and library codes compile without error, however index out of range error happens when running the test Case. There is something wrong in the libraries that I could not find it.

Regards,
Salar
Attached Files
File Type: zip Solver&Case.zip (24.8 KB, 4 views)
salar is offline   Reply With Quote

Old   December 28, 2017, 14:17
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I have taken a look and decided to stop after seeing several things:

1. Do not ignore compiler warnings. In case of messed up member initialisation it is not so important, while in heRealThermo.C:466 you have decided to return from forAll loop.

2. Why do you need to move around original OpenFOAM files?

3. Your test case is not runnable. First there is a problem with thermophysicalProperties (mess with curly brackets and as a result, transport sub dictionary is lost). Then

Code:
--> FOAM FATAL ERROR: 
incompatible dimensions for operation 
    [U[1 -2 -2 0 0 0 0] ] + [U[0 1 -2 0 0 0 0] ]
instead of the error you have posted (though I compiled code with OpenFOAM 5.x instead of 4.x, have to check if there is big difference in results with 4.x).

I will try to clean-up things a little bit (get rid of duplicate files, clean up the code), when I have time.

Quite often you make errors due to wrong placement of curly brackets, what editor do you use?
alexeym is offline   Reply With Quote

Old   December 28, 2017, 18:33
Default
  #9
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Hi Alexey,

Quote:
Originally Posted by alexeym View Post
Hi,

I have taken a look and decided to stop after seeing several things:

1. Do not ignore compiler warnings. In case of messed up member initialisation it is not so important, while in heRealThermo.C:466 you have decided to return from forAll loop.
I corrected the curly bracket mistake in heRealThermo.C:466. The warning is eliminated.

Quote:
Originally Posted by alexeym View Post
2. Why do you need to move around original OpenFOAM files?
In OpenFoam2.1 this code has changed the way of getting Temp. from enthalpy and it provides the density in the newton iteration procedure as well (look at realThermoI.H:75) and all the parameters like Cp, S, e, ... originally was just function of T (in OF2.1), but this library reads these parameters as a function of both T and rho.

Quote:
Originally Posted by alexeym View Post
3. Your test case is not runnable. First there is a problem with thermophysicalProperties (mess with curly brackets and as a result, transport sub dictionary is lost). Then

Code:
--> FOAM FATAL ERROR: 
incompatible dimensions for operation 
    [U[1 -2 -2 0 0 0 0] ] + [U[0 1 -2 0 0 0 0] ]
instead of the error you have posted (though I compiled code with OpenFOAM 5.x instead of 4.x, have to check if there is big difference in results with 4.x).
There was a curly bracket missing in the thermophysicalProperties as you mentioned. I still have the index out of range problem and I do not get incompatible dimensions error in OF 4.1.

Quote:
Originally Posted by alexeym View Post
I will try to clean-up things a little bit (get rid of duplicate files, clean up the code), when I have time.

Quite often you make errors due to wrong placement of curly brackets, what editor do you use?
Thank you, I am just using the default Ubuntu's text editor. Do you have better suggestion ?
salar is offline   Reply With Quote

Old   December 30, 2017, 06:44
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

With OpenFOAM 4.x I was able to reproduce the error, you have posted. And it happens during creation of nu field, though still need to figure out why.

As a side-notes:

- You have got problems with the library due to duplicate symbols.
- The first number in the error message is quite random (I have already got 5 and -2109800512), so, I guess, the error is caused by non-initialised value. And could be linked to error during library loading.
- Still do not get why you need original OpenFOAM files, which cause duplicate symbols error, in your library. "diff -r ..." shows, you have LOTS of files IDENTICAL to original OpenFOAM.

"default Ubuntu's text editor" is something vague. You configure defaults, so under GNOME it can be gedit (which can highlight matching brackets), in console it can be nano (which can match open and closing bracket), or vi (which can match and insert closing brackets automatically), or mcedit. I would suggest a editor, you can use, and that do certain routine tasks for you automatically (like closing brackets).
alexeym is offline   Reply With Quote

Old   January 3, 2018, 15:25
Default
  #11
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Hi,

Yes the numbers in Index error are quite random. I am new to programming with OF, can you please send me one of those duplicate symbols or how can I use "diff -r " to see the similarities? I am changing the definition of functions in this library.

I am using vi or gedit when I am editing a file on the cluster where there is no graphical interface.

Regards,
Salar

Last edited by salar; January 3, 2018 at 18:16.
salar is offline   Reply With Quote

Old   January 3, 2018, 21:31
Default
  #12
New Member
 
Salar
Join Date: Apr 2013
Location: USA
Posts: 9
Rep Power: 13
salar is on a distinguished road
Hi,
How can I see those duplicate symbols and how I can define them in a different way?
salar is offline   Reply With Quote

Old   January 4, 2018, 07:31
Default
  #13
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
To see duplicate symbols errors, you just run your compiled solver. You will get something like:

Code:
$ realFluidPIMPLESolver 
#0	$FOAM_LIBBIN/libOpenFOAM.so(_ZN4Foam5error14safePrintStackERSo+0x27) [0x7fc9c3fa80ed]
#1	$FOAM_USER_LIBBIN/libfluidThermophysicalModels20.so(_ZN4Foam12fvPatchFieldIdE26addpatchConstructorToTableINS_29fixedEnergyFvPatchScalarFieldEEC1ERKNS_4wordE+0xae) [0x7fc9c88896b8]
...
Duplicate entry energyJumpAMI in runtime selection table fvPatchField
#0	$FOAM_LIBBIN/libOpenFOAM.so(_ZN4Foam5error14safePrintStackERSo+0x27) [0x7fc9c3fa80ed]
#1	$FOAM_USER_LIBBIN/libfluidThermophysicalModels20.so(_ZN4Foam12fvPatchFieldIdE31adddictionaryConstructorToTableINS_31energyJumpAMIFvPatchScalarFieldEEC2ERKNS_4wordE+0xae) [0x7fc9c8897eb2]
#2	$FOAM_USER_LIBBIN/libfluidThermophysicalModels20.so(+0x98b52) [0x7fc9c8896b52]
#3	$FOAM_USER_LIBBIN/libfluidThermophysicalModels20.so(+0x98b88) [0x7fc9c8896b88]
#4	/lib64/ld-linux-x86-64.so.2(+0x10e23) [0x7fc9c8cfce23]
#5	/lib64/ld-linux-x86-64.so.2(+0xf0a) [0x7fc9c8cecf0a]
And they are caused by original source code, you decided to add to you library.

To use "diff -r ..." you just run "diff -r". "man diff" could be helpful.

As I have written, vi and gedit are quite capable of highlighting matching bracket, so you can easily see your bracketing errors.
alexeym is offline   Reply With Quote

Reply


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
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
AMI memory leak? MichiB OpenFOAM Programming & Development 14 August 1, 2015 18:18
[OpenFOAM] Paraview 3.98 - errors when saving geometry file pajot ParaView 1 September 28, 2013 10:45
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 01:27
OpenFOAM install on Ubuntu Natty 11.04 bkubicek OpenFOAM 13 May 26, 2011 05:48


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