|
[Sponsors] |
September 9, 2016, 20:25 |
Compiling a OF2.3 solver in OF 3.0.1
|
#1 |
Member
Mirage
Join Date: Jul 2012
Posts: 43
Rep Power: 13 |
Dear OF-Users and -Developers,
I am using OF.3.0.1, Ubuntu 16.04 LTS. I am trying to compile a solver, which was written using the OF 2.3. I tried to compiled the solver in OF 3.0.1, unlikely it did not work. After modifying the files "files" and "options", I succeed to remove some errors but it did not help to compile the solver. edited Files: Code:
pisoFoamT_cyclic.C EXE = $(FOAM_USER_APPBIN)/pisoFoamT_cyclic Code:
EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lincompressibleTransportModels \ -lfiniteVolume \ -lmeshTools \ -lfvOptions \ -lsampling The Error: Code:
/OpenFOAM/OpenFOAM-3.0.1/src/OSspecific/POSIX/lnInclude -fPIC -c pisoFoamT_cyclic.C -o Make/linux64GccDPInt64Opt/pisoFoamT_cyclic.o pisoFoamT_cyclic.C:66:38: fatal error: readPISOControls.H: No such file or directory Code:
#include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "turbulenceModel.H" #include "IFstream.H" //ADDED 10/20/14 #include "OFstream.H" //ADDED 10/20/14 #include "Random.H" //ADDED 10/20/14 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "readThermodynamicProperties.H" //ADDED 10/20/14 #include "readTransportProperties.H" //ADDED 10/20/14 #include "createFields.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "createGradP.H" //ADDED 10/20/14 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "calculateGradT.H" //ADDED 10/21/14 Info<< "\nStarting time loop\n" << endl; while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "readPISOControls.H" #include "CourantNo.H" #include "setDeltaT.H" // added turbulence->correct(); //CHANGED 10/29/14 // Pressure-velocity PISO corrector { // Momentum predictor fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) == //ADDED 10/20/14 flowDirection*gradP //ADDED 10/20/14 ); UEqn.relax(); if (momentumPredictor) { solve(UEqn == -fvc::grad(p)); } // --- PISO loop volScalarField rAU(1.0/UEqn.A()); //ADDED 10/20/14 for (int corr=0; corr<nCorr; corr++) { // volScalarField rAU(1.0/UEqn.A()); //CHANGED 10/20/14 volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn.H(); surfaceScalarField phiHbyA ( "phiHbyA", (fvc::interpolate(HbyA) & mesh.Sf()) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi) ); adjustPhi(phiHbyA, U, p); // Non-orthogonal pressure corrector loop for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { // Pressure corrector fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); if ( corr == nCorr-1 && nonOrth == nNonOrthCorr ) { pEqn.solve(mesh.solver("pFinal")); } else { pEqn.solve(); } if (nonOrth == nNonOrthCorr) { phi = phiHbyA - pEqn.flux(); } } #include "continuityErrs.H" U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); } #include "TEqn.H" //ADDED 10/21/14 //ADDED 10/20/14 ---------------> // Correct driving force for a constant mass flow rate // Extract the velocity in the flow direction dimensionedScalar magUbarStar = (flowDirection & U)().weightedAverage(mesh.V()); // Calculate the pressure gradient increment needed to // adjust the average flow-rate to the correct value dimensionedScalar gragPplus = (magUbar - magUbarStar)/rAU.weightedAverage(mesh.V()); U += flowDirection*rAU*gragPplus; gradP += gragPplus; Info<< "Uncorrected Ubar = " << magUbarStar.value() << tab << "pressure gradient = " << gradP.value() << endl; //ADDED 10/20/14 <--------------- } // turbulence->correct(); //CHANGED 10/29/14 runTime.write(); #include "writeGradP.H" //ADDED 10/20/14 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } // ************************************************************************* // Please let me know if you need any other informations. Any advice will be greatly appreciated, thanks in advance |
|
September 9, 2016, 21:47 |
|
#2 |
Member
Mirage
Join Date: Jul 2012
Posts: 43
Rep Power: 13 |
I just removed
readPISOControls.H from the .C file and I got a list of new errors: Code:
I/home/amine/OpenFOAM/OpenFOAM-3.0.1/src/sampling/lnInclude -IlnInclude -I. -I/home/amine/OpenFOAM/OpenFOAM-3.0.1/src/OpenFOAM/lnInclude -I/home/amine/OpenFOAM/OpenFOAM-3.0.1/src/OSspecific/POSIX/lnInclude -fPIC -c pisoFoamT_cyclic.C -o Make/linux64GccDPInt64Opt/pisoFoamT_cyclic.o In file included from pisoFoamT_cyclic.C:51:0: createFields.H: In function ‘int main(int, char**)’: createFields.H:71:13: error: ‘incompressible’ was not declared in this scope autoPtr<incompressible::turbulenceModel> turbulence ^ createFields.H:71:44: error: template argument 1 is invalid autoPtr<incompressible::turbulenceModel> turbulence ^ createFields.H:73:9: error: ‘incompressible’ is not a class or namespace incompressible::turbulenceModel::New(U, phi, laminarTransport) ^ In file included from pisoFoamT_cyclic.C:53:0: /home/amine/OpenFOAM/OpenFOAM-3.0.1/src/finiteVolume/lnInclude/readTimeControls.H:32:1: error: ‘adjustTimeStep’ was not declared in this scope adjustTimeStep = ^ /home/amine/OpenFOAM/OpenFOAM-3.0.1/src/finiteVolume/lnInclude/readTimeControls.H:35:1: error: ‘maxCo’ was not declared in this scope maxCo = ^ /home/amine/OpenFOAM/OpenFOAM-3.0.1/src/finiteVolume/lnInclude/readTimeControls.H:38:1: error: ‘maxDeltaT’ was not declared in this scope maxDeltaT = ^ pisoFoamT_cyclic.C:71:12: error: base operand of ‘->’ is not a pointer turbulence->correct(); //CHANGED 10/29/14 ^ pisoFoamT_cyclic.C:81:27: error: base operand of ‘->’ is not a pointer + turbulence->divDevReff(U) ^ pisoFoamT_cyclic.C:88:17: error: ‘momentumPredictor’ was not declared in this scope if (momentumPredictor) ^ pisoFoamT_cyclic.C:96:35: error: ‘nCorr’ was not declared in this scope for (int corr=0; corr<nCorr; corr++) ^ pisoFoamT_cyclic.C:112:46: error: ‘nNonOrthCorr’ was not declared in this scope for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) ^ In file included from pisoFoamT_cyclic.C:148:0: TEqn.H:7:16: error: base operand of ‘->’ is not a pointer + turbulence->nut()/Prt ^ TEqn.H:24:54: error: base operand of ‘->’ is not a pointer volScalarField DiffusivityScalar = turbulence->nut()/Prt; ^ /home/amine/OpenFOAM/OpenFOAM-3.0.1/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt64Opt/pisoFoamT_cyclic.o' failed make: *** [Make/linux64GccDPInt64Opt/pisoFoamT_cyclic.o] Error 1 Any advice will be greatly appreciated, thanks in advance |
|
September 28, 2016, 09:02 |
|
#3 |
New Member
DavidTran
Join Date: Aug 2016
Posts: 10
Rep Power: 9 |
Hi Mirage,
Did you solve your problem? I am facing the similar issue when I compiled a code. Could you share your experience? Best regards, |
|
September 28, 2016, 17:08 |
|
#4 | |
Member
Mirage
Join Date: Jul 2012
Posts: 43
Rep Power: 13 |
Quote:
I will post here the modification, that i did, as soon as possible |
||
September 30, 2016, 03:47 |
|
#5 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15 |
Hi
it seems that it already works in your case! Try the solver and tell us! As I can see, the file readPISOControls.H is not found. It means that in your options file, the directory where you are supposed to look for it does not have it. From OF2.3.1 to OF3.0.1 some directories were changed, so your error could be related with that. You can take a look to other solver who uses that file, and check how they call it. |
|
October 4, 2016, 12:43 |
|
#6 |
Member
Mirage
Join Date: Jul 2012
Posts: 43
Rep Power: 13 |
Hello guys,
The solver is running but I am not getting the same results with OF2.3. I am running a LES and I am not able to have output for nuSgs. Here are the lines, that i edited: Code:
In creatField.H : label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, piso.dict(), pRefCell, pRefValue); mesh.setFluxRequired(p.name()); Code:
in the .C file pisoControl piso(mesh); #include "createTimeControls.H" Code:
in the Make/options file: EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lincompressibleTransportModels \ -lfiniteVolume \ -lmeshTools \ -lsampling The slover written in OF2.3 was based on pisoFOAM. I just compared the new (OF3.1) and old pisoFOAM solvers and edit my solver. My results do not look similar, that why i am not sure, if it is correct :/ Please feel free to correct or improve my suggestions |
|
July 1, 2017, 04:26 |
|
#7 | |
Member
Vu
Join Date: Nov 2016
Posts: 42
Rep Power: 9 |
Quote:
Code:
icoScalarTransportFoam.C: In function ‘int main(int, char**)’: icoScalarTransportFoam.C:74:31: error: ‘nCorr_’ was not declared in this scope for (int corr=0; corr<nCorr_; corr++) Do you have any idea how to read the nCorrectors into icoFoam.C?? My icoScalarTransportFoam.C is like this and i'm using openfoam 4.0 Code:
#include "fvCFD.H" #include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" pisoControl piso(mesh); #include "createFields.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "CourantNo.H" #include "createPisoControl.H" // Momentum predictor fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } // --- PISO loop for (int corr=0; corr<nCorr_; corr++) { #include "TEqn.H" volScalarField rUA = 1.0/UEqn.A(); while (piso.correct()) { volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", fvc::flux(HbyA) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi) ); adjustPhi(phiHbyA, U, p); // Update the pressure BCs to ensure flux consistency constrainPressure(p, U, phiHbyA, rAU); // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(mesh.solver(p.select(piso.finalInnerIter()))); if (piso.finalNonOrthogonalIter()) { phi = phiHbyA - pEqn.flux(); } } #include "continuityErrs.H" U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); } } runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; |
||
January 10, 2018, 11:09 |
|
#8 | |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8 |
Quote:
|
||
January 10, 2018, 11:44 |
|
#9 |
Member
Vu
Join Date: Nov 2016
Posts: 42
Rep Power: 9 |
Hi Qihao,
It has been so long that I couldn't remember weather the problem had been solved or not. Anyway, what is your problem and error messages? You can include your files here so that I can give you a hand |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Floating Point Exception Error | nyox | FLUENT | 11 | November 30, 2018 12:31 |
Compiling meltFoam solver | mick223 | OpenFOAM Programming & Development | 12 | July 31, 2015 10:33 |
OF2.2.2 in Mac 10.9_error of compiling new solver | Ran Sui | OpenFOAM Programming & Development | 2 | January 25, 2014 11:00 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 20:02 |
Compiling new Solver with wmake | lin123 | OpenFOAM | 3 | April 13, 2010 14:18 |