|
[Sponsors] |
September 12, 2013, 10:47 |
If-else looping issue
|
#1 |
Member
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 13 |
I want to include if-else loop in my interPhaseChangeFoam solver. This is supposed to be easy but it's taking some time now. Below is an illustration of the code.
Code:
Foam::volScalarField Foam::phaseChangeTwoPhaseMixture::Random::dotAlpha() const { const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); volScalarField x = this->x(); forAll(p, celli) { if (p[celli] <= pSat_.value()) { return volScalarField ( x/y_*(p - pSat_)*(1 - alpha1_) ); else { return volScalarField ( x*(p - pSat_)*alpha1_ ); } } } Notice that I didn't index volScalarfields p and x in the if-else statement because I noticed that indexing makes it dimensionless afterwards. It however compiles the way it is now (ofcourse not correct) but gives the warning "control reaches end of non-void function". Please how do I fix this if-else loop? Thanks in advance. Last edited by wyldckat; September 15, 2013 at 17:43. Reason: fixed broken code delimiter from [\CODE] to [/CODE] |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Strange issue while launching ANSYS workbench in CentOS 6.4 | Philip_C | ANSYS | 11 | August 29, 2013 06:44 |
CyclicAMI Issue In OpenFOAM 2.2.0 | prasant | OpenFOAM Running, Solving & CFD | 17 | March 16, 2013 02:00 |
Pressure boundary condition issue | Vijay | FLUENT | 0 | April 6, 2012 13:35 |
Meshing related issue in Flow EFD | appu | FloEFD, FloWorks & FloTHERM | 1 | May 22, 2011 08:27 |
Issue 4 of adapco-online | Sreenadh Jonnavithula | Main CFD Forum | 8 | January 5, 2001 13:40 |