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

Programming in OpenFoam.. help!

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Hisham

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2012, 14:49
Default Programming in OpenFoam.. help!
  #1
New Member
 
Adriana Vargas
Join Date: Jul 2011
Posts: 8
Rep Power: 15
adriana.nino is on a distinguished road
Good morning!


I have some problems programming in OpenFoam.. I'm trying to modify a program to resolve PBE (population balances equations), but I have a problem with createfields.H file in this part:


//- Calculating the Sauter diameter
scalar twoDivThree = 2.0/3.0;
volScalarField num(eta[0]);
volScalarField den(pow(absc[0],twoDivThree)*weight[0]);
dimensionedScalar small("small", den.dimensions(), SMALL);

volScalarField ds("ds",CC * num/(den + small));

volScalarField alpha("alpha", Vo*num);
volScalarField beta("beta",scalar(1)-alpha);

surfaceScalarField phi = fvc::interpolate(alpha)*phia +

fvc::interpolate(beta) *phib;

The program compiles well but when I try to simulate a specific case appear this error:


Reading abscissas

Reading field ABSC1
Reading field ABSC2
Reading field ABSC3
Reading field ABSC4

Constructing matrix for DQMOM

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 in "/lib/x86_64-linux-gnu/libc.so.6"
#4 std::string::append(std::string const&) in "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
#5 std::basic_string<char, std::char_traits<char>, std::allocator<char> > std:perator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at /usr/include/c++/4.6/bits/basic_string.h:2311
#6 Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam:perator*<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::tmp<Foam::GeometricField< double, Foam::fvsPatchField, Foam::surfaceMesh> > const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricScalarField.C:113
#7
at ~/Documents/OpenFoam/24_10_2012/pbeDev/fields/fields2/createFields.H:227
#8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9
in "/home/adriana/OpenFOAM/adriana-2.1.1/platforms/linux64GccDPOpt/bin/fields2"
Segmentation fault (core dumped)


I did different tests and I have found that the error is when I try to define surfacialScalarField phi. If I delete this part of the code, the case runs without problem, but I can't do it because I need to define this variable to continue with the algorithm..


some suggestions??


thanks


Adriana
adriana.nino is offline   Reply With Quote

Old   October 26, 2012, 15:23
Default
  #2
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Adriana,

A Segmentation fault or a "sigSegv" error is issued when one tries to access invalid memory. Most likely trying to access a non existing element in a field. To try to figure out what is wrong you can make output of the fields that may have caused the error to see what is wrong with them (e.g.)
Code:
Info << "Alpha Field: " << alpha << endl;
Are phia and phib just scalars or are they fields?

Best regards,
Hisham
luiscardona likes this.
Hisham is offline   Reply With Quote

Old   October 29, 2012, 12:49
Default
  #3
New Member
 
Adriana Vargas
Join Date: Jul 2011
Posts: 8
Rep Power: 15
adriana.nino is on a distinguished road
Thanks Hisham, I have checked output of the phia field and appears this error:

phia Field: dimensions [1.67997141555e-316 6.91767529931e-310 6.91767529931e-310 6.91767529931e-310 6.95321237182e-310 4.94065645841e-324 0];

internalField nonuniform 0();

boundaryField
{
#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::OSstream::write(Foam::word const&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#4 Foam:perator<<(Foam::Ostream&, Foam::word const&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5 Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricBoundaryField::writeE ntry(Foam::word const&, Foam::Ostream&) const at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:461
#6 Foam::Ostream& Foam:perator<< <double, Foam::fvsPatchField, Foam::surfaceMesh>(Foam::Ostream&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:1237
#7
at ~/Documents/OpenFoam/24_10_2012/pbeDev/fields/fields2/createFields.H:228
#8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9


I defined phia and phib as is defined in twoPhaseEulerFoam:

surfaceScalarField& phia = phasea->phi();

Any idea about that?? I'm confused!
adriana.nino is offline   Reply With Quote

Old   October 29, 2012, 12:59
Default
  #4
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi

It seems that this field is (among) the one(s) causing trouble. It is clear that it is not filled with any values or dimensions and hence the error occurs. I guess you have to post more of your code to get better ideas!

Best regards,
Hisham
Hisham is offline   Reply With Quote

Old   October 29, 2012, 13:18
Default
  #5
New Member
 
Adriana Vargas
Join Date: Jul 2011
Posts: 8
Rep Power: 15
adriana.nino is on a distinguished road
Thanks! I'm attaching the file createfields.h, I'm sure that here is the problem..

Regards,
Attached Files
File Type: h createFields.H (5.8 KB, 31 views)
adriana.nino is offline   Reply With Quote

Old   October 29, 2012, 13:54
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Maybe you should try to register the phi surfaceField as in the original solver:
Code:
00109     surfaceScalarField phi
00110     (
00111         IOobject
00112         (
00113             "phi",
00114             runTime.timeName(),
00115             mesh
00116         ),
00117         fvc::interpolate(alpha)*phia + fvc::interpolate(beta)*phib
00118     );
00119
To my eyes, this is the only difference from the original creatFields.H

Hisham
Hisham is offline   Reply With Quote

Old   October 29, 2012, 14:44
Default
  #7
New Member
 
Adriana Vargas
Join Date: Jul 2011
Posts: 8
Rep Power: 15
adriana.nino is on a distinguished road
I tried to do it but doesn't work..
adriana.nino is offline   Reply With Quote

Old   October 29, 2012, 15:38
Default
  #8
New Member
 
Adriana Vargas
Join Date: Jul 2011
Posts: 8
Rep Power: 15
adriana.nino is on a distinguished road
Hi Hisham!

you are right! I found the error, it was in "Phase Model" file.. It was by difference between version 1.6 and 2.1. I put the updated file and works perflecty!! thanks very much!!,
P.S I found the error using
Info << "Phia Field: " << phia << endl;
adriana.nino is offline   Reply With Quote

Reply

Tags
programming, surfacescalarfield


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
OpenFOAM 1.6.x, 1.7.0 and 1.7.x are not fully prepared to work with gcc-4.5.x wyldckat OpenFOAM Bugs 18 October 21, 2010 06:51
OpenFoam programming prapanj OpenFOAM 10 March 18, 2010 08:23
Programming in OpenFOAM vinu OpenFOAM 2 July 11, 2009 11:16
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 06:56
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07


All times are GMT -4. The time now is 19:17.