CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Error in compiling a modified solver (https://www.cfd-online.com/Forums/openfoam-solving/115219-error-compiling-modified-solver.html)

immortality March 26, 2013 08:27

Error in compiling a modified solver
 
I added some line to the rhoPimpleFoam as below:
Code:

word patchName = "left";
        label patchID = mesh.boundary().findPatchID(patchName);
        forAll(U.boundaryField()[patchID],faceI)
          {
              U.boundaryField()[patchID][faceI].component(0)=min(U[cellI].component(0), 500);
          }

but this error occurd:
Code:

ehsan@Ehsan-com:~/Desktop/rhoPimpleFoamLimited$ ./Allwmake
+ wmake
Making dependency list for source file rhoPimpleFoamLimited.C
SOURCE=rhoPimpleFoamLimited.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam211/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam211/src/finiteVolume/cfdTools -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoPimpleFoamLimited.o
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:91:69: error: ‘cellI’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
+ wmake rhoPorousMRFPimpleFoam
make: *** No rule to make target `rhoPorousMRFPimpleFoam'.  Stop.
+ wmake rhoPorousMRFLTSPimpleFoam
make: *** No rule to make target `rhoPorousMRFLTSPimpleFoam'.  Stop.
ehsan@Ehsan-com:~/Desktop/rhoPimpleFoamLimited$

whats the difficulty by cellI?how should I introduce cellI to solver?

immortality March 26, 2013 08:51

it resolved I changed it so:
Code:

U.boundaryField()[patchID][faceI].component(0)=min(U.boundaryField()[patchID][faceI].component(0), 500);

immortality March 27, 2013 10:54

what means this error now?
Code:

ehsan@Ehsan-com:~/Desktop/rhoPimpleFoamLimited$ wmake
Making dependency list for source file rhoPimpleFoamLimited.C
SOURCE=rhoPimpleFoamLimited.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam211/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam211/src/finiteVolume/cfdTools -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoPimpleFoamLimited.o
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:90:85: error: invalid types ‘<unresolved overloaded function type>[Foam::label {aka int}]’ for array subscript
rhoPimpleFoamLimited.C:94:41: error: name lookup of ‘cellI’ changed for ISO ‘for’ scoping [-fpermissive]
rhoPimpleFoamLimited.C:94:41: note: (if you use ‘-fpermissive’ G++ will accept your code)
rhoPimpleFoamLimited.C:100:132: error: ‘Foam::T’ does not have class type
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1

I changed the limiter code as below:
Code:

forAll(U,cellI)
          {
            U[cellI].component(0)=min(U[cellI].component(0), sqrt(1.4*287.14*T[cellI])-30);
          }
          forAll(U,cellJ)
          {
            U[cellJ].component(1)=max(U[cellI].component(1),-150);
          }
        word patchName = "left";
        label patchID = mesh.boundary().findPatchID(patchName);
        forAll(U.boundaryField()[patchID],faceI)
          {
              U.boundaryField()[patchID][faceI].component(0)=min(U.boundaryField()[patchID][faceI].component(0), sqrt(1.4*287.14*T.boundaryField()[patchID][faceI])-30);
              U.boundaryField()[patchID][faceI].component(1)=max(U.boundaryField()[patchID][faceI].component(1),-150);
          }


immortality March 29, 2013 00:29

I've added T in I/O dictionary in createFields.H but nothing changed.
Why T doesn't have a class as OF says?what does this mean?what can do?
All helps,opinions and hints are appreciated!


All times are GMT -4. The time now is 19:53.