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

Segmentation fault, access values problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2018, 20:40
Default Segmentation fault, access values problem
  #1
New Member
 
Join Date: Aug 2011
Posts: 2
Rep Power: 0
Djordje is on a distinguished road
Dear foamers,

I have some troubles with comment parts of this code:
PHP Code:
label myinlet mesh_.boundaryMesh().findPatchID("inlet");
const 
polyPatchcPatch mesh_.boundaryMesh()[myinlet];
const 
fvPatchVectorFieldUin U().boundaryField()[myinlet];
//const fvPatchScalarField& UPhiIN = UPhi_()->boundaryField()[myinlet];
const surfaceScalarFieldmagSf mesh_.magSf();

scalar IFR 0.0;
scalar IEFzDir 0.0;
//scalar IEFPhiDir = 0.0; 
    
forAll(cPatchfacei

    
IFR += (Uin[facei].z())*magSf.boundaryField()[myinlet][facei];
    
IEFzDir += pow(Uin[facei].z(),3)*magSf.boundaryField()[myinlet][facei];
    
//IEFPhiDir += sqr(UPhiIN[facei])*(Uin[facei].z())*magSf.boundaryField()[myinlet][facei];
}   

//SwS_=IEFPhiDir/(0.001+IEFzDir); 

Info<<endl<<l_<<endl;
Info<<Ctau_<<endl;
Info<<"InFlowRate = "<<IFR<<" m^3/s"<<endl;
Info<<"InEnFluxZdir = "<<IEFzDir<<" m^5/s^3"<<endl;
Info<<"InEnFluxPhiDir = "<<IEFPhiDir<<" m^5/s^3"<<endl;
//Info<<"SwS = "<<SwS_<<endl<<endl<<endl; 
I want to calculate the swirl strenght (SwS) on inlet section. The code without comments works fine up to 200 iterations approximately, and then it breaks with next message:

PHP Code:
[0 0 0 0 0 0 00.09
Ctau 
[0 0 0 0 0 0 00.182
InFlowRate 
0.647061086243 m^3/s
InEnFluxZdir 
307.942132036 m^5/s^3
InEnFluxPhiDir 
37.1113979524 m^5/s^3
SwS 
0.12051380301


ExecutionTime 
96.61 s  ClockTime 97 s

Time 
222

smoothSolver
:  Solving for UxInitial residual 0.00173071772014, Final residual 0.000106084441356No Iterations 2
smoothSolver
:  Solving for UyInitial residual 0.00173017679547, Final residual 0.000105942528607No Iterations 2
smoothSolver
:  Solving for UzInitial residual 0.000569924142604, Final residual 3.36294823708e-05No Iterations 2
DICPCG
:  Solving for pInitial residual 0.0077950722647, Final residual 7.5300467066e-05No Iterations 158
time step continuity errors 
sum local 0.000354384134085, global = 7.11056780688e-05cumulative 5.24229577773e-05
smoothSolver
:  Solving for epsilonInitial residual 0.00130095491961, Final residual 8.68883144141e-05No Iterations 4
smoothSolver
:  Solving for kInitial residual 0.00253765686116, Final residual 0.000191029833772No Iterations 4
[HP-Z6-G4:14979] *** Process received signal ***
[
HP-Z6-G4:14979SignalSegmentation fault (11)
[
HP-Z6-G4:14979Signal code:  (-6)
[
HP-Z6-G4:14979Failing at address0x3e900003a83
[HP-Z6-G4:14979] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f895e59af20]
[
HP-Z6-G4:14979] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f895e59ae97]
[
HP-Z6-G4:14979] [ 2] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f895e59af20]
[
HP-Z6-G4:14979] [ 3] /home/djnovkovic/foam/foam-extend-4.0/lib/linux64GccDPOpt/libincompressibleRASModels.so(_ZN4Foam14incompressible9RASModels10kEpsHamNov7correctEv+0x2e62)[0x7f8962696d22]
[
HP-Z6-G4:14979] [ 4simpleFoam(+0x1caf7)[0x561b420b9af7]
[
HP-Z6-G4:14979] [ 5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f895e57db97]
[
HP-Z6-G4:14979] [ 6simpleFoam(+0x1e1ba)[0x561b420bb1ba]
[
HP-Z6-G4:14979] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 0 on node HP-Z6-G4 exited on signal 11 (Segmentation fault).
-------------------------------------------------------------------------- 
I think that I have problem with method of acces Uphi_() values on the inlet section. I have tried to use:
const fvPatchScalarField& UPhiIN = UPhi_().boundaryField()[myinlet];
but then I can't compile code and I obtain next error:
PHP Code:
error‘class Foam::tmp<Foam::GeometricField<doubleFoam::fvPatchFieldFoam::volMesh> >’ has no member named ‘boundaryField’
 
const fvPatchScalarFieldUPhiIN UPhi_().boundaryField()[myinlet]; 
What is wrong in this part of my code?
Djordje is offline   Reply With Quote

Old   December 13, 2018, 07:09
Default Solved
  #2
New Member
 
Join Date: Aug 2011
Posts: 2
Rep Power: 0
Djordje is on a distinguished road
I find solution. The problem was in Uphi_() velocitiy definition. Previously I defined it with next set of commands:
Code:
...

 X_                                               
    (
          mesh_.C().component(vector::X)
    ),

    Y_
    (
          mesh_.C().component(vector::Y)
    ),

    Z_
    (
          mesh_.C().component(vector::Z)
    ),

    r_
    (

          sqrt(sqr(X_)+sqr(Y_))+rSmall_
    ),

    SinPhi_
    (
          Y_/r_
    ),

    CosPhi_
    (
          X_/r_
    ),

...

tmp<volScalarField> kEpsHamNov::Ux_() const
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                "Ux_",
                runTime_.timeName(),
                U_.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
           U_.component(vector::X)
        )
    );
}

tmp<volScalarField> kEpsHamNov::Uy_() const
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                "Uy_",
                runTime_.timeName(),
                U_.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
           U_.component(vector::Y)
        )
    );

}

tmp<volScalarField> kEpsHamNov::UPhi_() const
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                "UPhi_",
                runTime_.timeName(),
                U_.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
           -Ux_()*SinPhi_+Uy_()*CosPhi_
        )
    );

}

...
Later I made modification and I calculate Uphi_ velocity in problematic part of code on this manner:
Code:
label myinlet = mesh_.boundaryMesh().findPatchID("inlet");
const polyPatch& cPatch = mesh_.boundaryMesh()[myinlet];
const fvPatchVectorField& Uin = U().boundaryField()[myinlet];
const fvPatchScalarField& SinIN = SinPhi_.boundaryField()[myinlet];
const fvPatchScalarField& CosIN = CosPhi_.boundaryField()[myinlet];
const surfaceScalarField& magSf = mesh_.magSf();

scalar IFR = 0.0;
scalar IEFzDir = 0.0;
scalar IEFPhiDir = 0.0;

forAll(cPatch, facei)
{
    IFR += (Uin[facei].z())*magSf.boundaryField()[myinlet][facei];
    IEFzDir += pow(Uin[facei].z(),3)*magSf.boundaryField()[myinlet][facei];
    IEFPhiDir += sqr(-Uin[facei].x()*SinIN[facei]+Uin[facei].y()*CosIN[facei])*
                 (Uin[facei].z())*magSf.boundaryField()[myinlet][facei];
}

SwS_=IEFPhiDir/(0.001+IEFzDir);

Info<<endl<<l_<<endl;
Info<<Ctau_<<endl;
Info<<"InFlowRate = "<<IFR<<" m^3/s"<<endl;
Info<<"InEnFluxZdir = "<<IEFzDir<<" m^5/s^3"<<endl;
Info<<"InEnFluxPhiDir = "<<IEFPhiDir<<" m^5/s^3"<<endl;
Info<<"SwS = "<<SwS_<<endl<<endl<<endl;
It converge fine now.

Last edited by Djordje; December 20, 2018 at 19:21.
Djordje 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
Paraview fliter problem (surface flow) (segmentation fault) maysmech OpenFOAM 1 October 6, 2011 11:01
forrtl: severe (174): SIGSEGV, segmentation fault occurred therockyy FLOW-3D 7 January 19, 2011 22:52
Debugging a segmentation fault? hansel OpenFOAM Bugs 3 July 31, 2010 13:13
ParaView segmentation fault only for multiphase gwierink OpenFOAM 9 March 25, 2010 07:23
Segmentation Fault Victor Main CFD Forum 5 April 5, 2005 08:09


All times are GMT -4. The time now is 14:52.