foamextend5.0求解器编译报错显示”expected unqualified-id before ‘if’“
-
#include "fvCFD.H" #include "MULES.H" #include "subCycle.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "dynamicFvMesh.H" #include "pimpleControl.H" #include "immersedBoundaryPolyPatch.H" #include "immersedBoundaryFvPatch.H" #include "emptyFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createDynamicFvMesh.H" pimpleControl pimple(mesh); # include "readGravitationalAcceleration.H" # include "initContinuityErrs.H" # include "createIbMasks.H" # include "createFields.H" # include "createControls.H" # include "correctPhi.H" # include "CourantNo.H" # include "setInitialDeltaT.H"
我在foamextend5.0环境下编写具有IBM方法的两相流求解器,是在foamextend5.0自带的求解器pimpleDyMIbFoam基础上修改的,以上是一部分主程序代码,我在foam extend5.0环境下编译这个求解器,显示如下错误,是在我上边发的代码的第33行
请问各位大佬应该这么修改呢?我确定这个报错路径下的CourantNo.H文件是没有问题的,因为这是系统路径下的文件啊,我也没有修改过,之前使用过这个文件编译其他求解器,也是没有问题的,所以现在不知道问题出在哪里了?
还请各位老师不吝赐教 -
此回复已被删除!
-
下附CourantNo.H文件内容
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | foam-extend: Open Source CFD \\ / O peration | Version: 5.0 \\ / A nd | Web: http://www.foam-extend.org \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License This file is part of foam-extend. foam-extend is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. foam-extend is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with foam-extend. If not, see <http://www.gnu.org/licenses/>. Global CourantNo Description Calculates and outputs the mean and maximum Courant Numbers. \*---------------------------------------------------------------------------*/ scalar CoNum = 0.0; scalar meanCoNum = 0.0; scalar velMag = 0.0; // HR 26.06.18: A parallel run has at least two cells and therefore at least // one internal face in the global mesh. It may be a processor boundary, but // this is captured by max(mag(phi)). // Old formulation hangs on parallel cases where one partition is degenerated // to a single cell. if (mesh.nInternalFaces() || Pstream::parRun()) { surfaceScalarField magPhi = mag(phi); surfaceScalarField SfUfbyDelta = mesh.surfaceInterpolation::deltaCoeffs()*magPhi; const scalar deltaT = runTime.deltaT().value(); CoNum = max(SfUfbyDelta/mesh.magSf()).value()*deltaT; meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())).value()*deltaT; velMag = max(magPhi/mesh.magSf()).value(); } else { // Single cell mesh: Co is still defined; use cell formulation const scalar deltaT = runTime.deltaT().value(); const scalar deltaX = Foam::cbrt(mesh.V()[0]); // recover velocity field in a more general way const volVectorField& URef = mesh.db().lookupObject<const volVectorField>("U"); velMag = mag(URef[0]); CoNum = velMag*deltaT/deltaX; meanCoNum = CoNum; } Info<< "Courant Number mean: " << meanCoNum << " max: " << CoNum << " velocity magnitude: " << velMag << endl; // ************************************************************************* //
-
第一次在这个网站上求助各位大佬,报错图片不知道怎么看不了了,不好意思![IWE)}@6(NH98E9LRH@PDEK.png