|
[Sponsors] |
December 12, 2018, 20:40 |
Segmentation fault, access values problem
|
#1 |
New Member
Join Date: Aug 2011
Posts: 2
Rep Power: 0 |
Dear foamers,
I have some troubles with comment parts of this code: PHP Code:
PHP Code:
const fvPatchScalarField& UPhiIN = UPhi_().boundaryField()[myinlet]; but then I can't compile code and I obtain next error: PHP Code:
|
|
December 13, 2018, 07:09 |
Solved
|
#2 |
New Member
Join Date: Aug 2011
Posts: 2
Rep Power: 0 |
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_ ) ); } ... 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; Last edited by Djordje; December 20, 2018 at 19:21. |
|
|
|
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 |