|
[Sponsors] |
March 10, 2014, 06:10 |
forAll loop problem!
|
#1 |
Member
Join Date: Apr 2013
Posts: 32
Rep Power: 13 |
Hi everyone,
I am trying to use iterative method in one of my solver....It looks like this but I am getting error " expected primary expression before [ token "...I have marked the line of error below...Can someone point out the problem in this code? Thanks in advance! /*..................Marking the wall cells.........*/ forAll(patches, patchi) { const fvPatch& thePatchItselfWall = patches[patchi]; if (isA<wallFvPatch>(thePatchItselfWall)) { forAll (thePatchItselfWall, iFace) { label iCell = thePatchItselfWall.faceCells()[iFace]; vector iCellCentre = mesh.cellCentres()[iCell]; //pointed located at the centre line but at same axial position vector bulkPoint(0,iCellCentre.y(),iCellCentre.z()); label bulkCell = mesh.findCell(bulkPoint); do { dimensionedScalar nsite = nref*pow(((Twall-Tsat)/delTref),1.805); //site density correlation /*.................................Heat flux areas....................*/ volScalarField A2F = min((3.141*pow(Ddep,2.0)*nsite), scalar(1.0)); //quenching heat flux area volScalarField A1F = max((scalar(1.0)-A1F), scalar(0.0001)); //convective heat flux area // calculation of site density and evaporative heat and mass flux volScalarField mev ("mev", ((3.14/6.0)*pow(Ddep,3.0)*fdep*nsite) ); /*......Quenching, convective, evaporative heat flux.....*/ volScalarField qe = mev*latHeat; //evaporative heat flux volScalarField qc = A1F*hc*(Twall-Tb); // convective heat flux volScalarField qq = A2F*hq*(Twall-Tb); //quenching heat flux volScalarField qtotal = qe+qc+qq; //total heat flux volScalarField error = mag (qwall-qtotal); }while (error[iCell]>scalar(1.0)); ///ERRROR IS COMING HERE } } } //final value of site density after using iterative method to solve wall temperature Tw dimensionedScalar nsite = nref*pow(((Twall-Tsat)/delTref),1.805); //Storing and calcluation of source term for alpha eqn volScalarField mevp ("mevp", ((3.14/6.0)*pow(Ddep,3.0)*fdep*nsite) ); if (runTime.outputTime()) //storing mevp { mevp.write(); } //source term for alpha eqn volScalarField Gammaevp ("Gammaevp", (Awall*a*mevp) ); // bubble formed at the walls due to evaporation if (runTime.outputTime()) //storing Gammaevp { Gammaevp.write(); } |
|
March 10, 2014, 06:34 |
|
#2 |
Senior Member
|
Hi,
you have to create 'error' volume field before 'do {} while' statement. |
|
March 10, 2014, 07:31 |
|
#3 |
Member
Join Date: Apr 2013
Posts: 32
Rep Power: 13 |
||
March 10, 2014, 09:17 |
|
#4 |
Senior Member
|
In fact this error has nothing to do with forAll macros. You define a variable inside a loop and then try to use this variable in exit condition from the loop. For example, this code will also fail to compile:
Code:
do { int i = call_to_some_function_returning_i(); } while(i < 10) Code:
int i = 0; do { i = call_to_some_function_returning_i(); } while(i < 10) |
|
March 11, 2014, 06:55 |
|
#5 | |
Member
Join Date: Apr 2013
Posts: 32
Rep Power: 13 |
Quote:
Thanks for the info...Actually I have already made a C++ program for the same..I am just trying to put that iterative program into the solver...So I missed out that!... Thanks a lot...Will get in touch with you if any other problem is there! |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem Importing Geometry ProE to CFX | fatb0y | CFX | 3 | January 14, 2012 20:42 |
Problem do loop using Scheme commands | kris | FLUENT | 0 | January 13, 2008 07:15 |
for loop inside a cell_loop? | MHDWill | FLUENT | 0 | September 26, 2007 22:24 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |