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

Error while using forAllIter macro in own equation file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 27, 2015, 12:12
Default Error while using forAllIter macro in own equation file
  #1
Member
 
Anurag
Join Date: Aug 2014
Location: Germany
Posts: 57
Rep Power: 12
anuragm is on a distinguished road
I want to solve an additional set of equations in multiphaseEulerFoam for my case, so I made a new file called DQMOMEqns_New.H.

But when I compile, I get some errors:
Code:
DQMOMEqns_New.H: In function ‘int main(int, char**)’:
DQMOMEqns_New.H:42:43: error: ‘phases_’ was not declared in this scope
     forAllIter(PtrDictionary<phaseModel>, phases_, iter)
                                           ^
/home/m/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/UList.H:443:37: note: in definition of macro ‘forAllIter’
         Container::iterator iter = (container).begin();                        \
                                     ^
In file included from multiphaseEulerPbeFoam.C:91:0:
DQMOMEqns_New.H:66:60: error: ‘phi1’ was not declared in this scope
         surfaceScalarField phir[phasei](phase.phi() - phi1());
                                                            ^
DQMOMEqns_New.H:66:61: error: variable-sized object ‘phir’ may not be initialized
         surfaceScalarField phir[phasei](phase.phi() - phi1());
                                                             ^
DQMOMEqns_New.H:72:43: error: no matching function for call to ‘div(Foam::surfaceScalarField [(((sizetype)(((ssizetype)phasei) + -1)) + 1)], Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&)’
             + fvm::div(phir,weight[phasei])
                                           ^
I have attached this file with the post. I am also quoting the offending part of the code here:

Code:
    int phasei = 0;

    forAllIter(PtrDictionary<phaseModel>, phases_, iter)
    {
        phaseModel& phase = iter();
        volScalarField& alpha = phase;
    
        if (phasei == 0)
        {
            surfaceScalarField phi1 = phase.phi();
            sumAlpha = alpha;
        }

        phasei++;
    }
Am I not using this macro correctly? Or is there something else that I have overlooked?
Attached Files
File Type: h DQMOMEqns_New.H (3.7 KB, 6 views)
anuragm is offline   Reply With Quote

Old   April 29, 2015, 17:08
Default
  #2
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
instead of phases_ use fluid.phases()
kwardle is offline   Reply With Quote

Old   April 30, 2015, 13:05
Default
  #3
Member
 
Anurag
Join Date: Aug 2014
Location: Germany
Posts: 57
Rep Power: 12
anuragm is on a distinguished road
Thanks for the reply. This works, I do not get this error now.
anuragm is offline   Reply With Quote

Reply

Tags
euler-euler, eulerian, multiphase


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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
[swak4Foam] swak4Foam-groovyBC build problem zxj160 OpenFOAM Community Contributions 18 July 30, 2013 14:14
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


All times are GMT -4. The time now is 21:43.