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

Manual limiter of velocity doesn't work

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2013, 11:45
Default
  #21
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thanks.but the error persists:
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
immortality is offline   Reply With Quote

Old   March 27, 2013, 11:48
Default
  #22
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
the code is now:
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 is offline   Reply With Quote

Old   March 28, 2013, 08:22
Default
  #23
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
hi
did you find a reason for this error and not compiling?
immortality is offline   Reply With Quote

Old   March 28, 2013, 08:54
Default
  #24
Member
 
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 14
batta31 is on a distinguished road
Maybe the first error (the one at line 90) is because you are trying to subtract T and the scalar value 30, but I'm not sure about it.


The second error (line 94) it's because you are using [cellI] variable into a loop with [cellJ].

The third (line 100) it's because, probably, you can't write T.boundaryField[patchID][faceI] since, I think, T doesn't have the access class "boundaryField". Try instead

Code:
T.boundary[patchID][faceI]
as, for example, happens for the variable p in other solvers.

Hope this helps

Simone
batta31 is offline   Reply With Quote

Old   March 28, 2013, 09:24
Default
  #25
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thanks dear Simone.I changed it so:
Code:
forAll(U,cellI)
           {
            U[cellI].component(0)=min(U[cellI].component(0), sqrt(1.4*287.14*T[cellI]));
           }
           forAll(U,cellJ)
           {
            U[cellJ].component(1)=max(U[cellJ].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.boundary()[patchID][faceI]));
               U.boundaryField()[patchID][faceI].component(1)=max(U.boundaryField()[patchID][faceI].component(1),-150);
           }
but the error:
Code:
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:100:132: error: ‘Foam::T’ does not have class type
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
what's your opinion?
immortality is offline   Reply With Quote

Old   March 28, 2013, 09:43
Default
  #26
Member
 
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 14
batta31 is on a distinguished road
How have you defined T?
batta31 is offline   Reply With Quote

Old   March 28, 2013, 09:43
Default
  #27
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
it seems it has trouble with T field.I only put it:
Code:
forAll(U,cellI)
           {
            //U[cellI].component(0)=min(U[cellI].component(0), sqrt(401.996*T[cellI]));
            U[cellI].component(0)=min(U[cellI].component(0), T[cellI]);
            U[cellI].component(1)=max(U[cellI].component(1),-150);
           }
and showed this error:
Code:
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:91:69: error: invalid types ‘<unresolved overloaded function type>[Foam::label {aka int}]’ for array subscript
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
but when all is a number it works well.
immortality is offline   Reply With Quote

Old   March 28, 2013, 09:52
Default
  #28
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
it seems it has trouble with T field.I only put it:
Code:
forAll(U,cellI)
           {
            //U[cellI].component(0)=min(U[cellI].component(0), sqrt(401.996*T[cellI]));
            U[cellI].component(0)=min(U[cellI].component(0), T[cellI]);
            U[cellI].component(1)=max(U[cellI].component(1),-150);
           }
and showed this error:
Code:
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:91:69: error: invalid types ‘<unresolved overloaded function type>[Foam::label {aka int}]’ for array subscript
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
but when all is a number it works well.
immortality is offline   Reply With Quote

Old   March 28, 2013, 10:05
Default
  #29
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
it seems it has trouble with T field.I only put it:
Code:
forAll(U,cellI)
           {
            //U[cellI].component(0)=min(U[cellI].component(0), sqrt(401.996*T[cellI]));
            U[cellI].component(0)=min(U[cellI].component(0), T[cellI]);
            U[cellI].component(1)=max(U[cellI].component(1),-150);
           }
and showed this error:
Code:
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:91:69: error: invalid types ‘<unresolved overloaded function type>[Foam::label {aka int}]’ for array subscript
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
but when all is a number it works well.
immortality is offline   Reply With Quote

Old   March 28, 2013, 10:16
Default
  #30
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
oh.it wasn't sending but three of it send at a same time!
what do you mean by defining T?
OF doesn't recognize T field itself?
immortality is offline   Reply With Quote

Old   March 28, 2013, 10:24
Default
  #31
Member
 
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 14
batta31 is on a distinguished road
You are modifying a solver that was already present, right? Check in the associated createFields.H file how is T defined!

And then try to have a look to the access functions that can be used for that particular "T" field.

Cheers
Simone
batta31 is offline   Reply With Quote

Old   March 28, 2013, 10:39
Default
  #32
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
its total of creatFields.H!
its seemed that T is not defined explicitly in it.
should I add it?like rho?
where can find access functions?
Code:
    Info<< "Reading thermophysical properties\n" << endl;

    autoPtr<basicPsiThermo> pThermo
    (
        basicPsiThermo::New(mesh)
    );
    basicPsiThermo& thermo = pThermo();

    volScalarField& p = thermo.p();
    volScalarField& h = thermo.h();
    const volScalarField& psi = thermo.psi();

    volScalarField rho
    (
        IOobject
        (
            "rho",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        thermo.rho()
    );

    Info<< "Reading field U\n" << endl;
    volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

    #include "compressibleCreatePhi.H"

    dimensionedScalar rhoMax(pimple.dict().lookup("rhoMax"));
    dimensionedScalar rhoMin(pimple.dict().lookup("rhoMin"));

    Info<< "Creating turbulence model\n" << endl;
    autoPtr<compressible::turbulenceModel> turbulence
    (
        compressible::turbulenceModel::New
        (
            rho,
            U,
            phi,
            thermo
        )
    );

    Info<< "Creating field dpdt\n" << endl;
    volScalarField dpdt("dpdt", fvc::ddt(p));

    Info<< "Creating field kinetic energy K\n" << endl;
    volScalarField K("K", 0.5*magSqr(U));
immortality is offline   Reply With Quote

Old   March 28, 2013, 15:45
Default
  #33
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
I defined T as:
Code:
volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        thermo.T()
    );
in creatFields.H
is it true now?
but another question,how T is written in time folders when it is not defined directly in creatFields.H?
immortality is offline   Reply With Quote

Old   March 28, 2013, 16:28
Default
  #34
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
but the error now is:
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/openfoam220/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam220/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam220/src/finiteVolume/cfdTools -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/sampling/lnInclude -I/opt/openfoam220/src/fvOptions/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoPimpleFoamLimited.o
rhoPimpleFoamLimited.C: In function ‘int main(int, char**)’:
rhoPimpleFoamLimited.C:94:83: error: call of overloaded ‘sqrt(double)’ is ambiguous
rhoPimpleFoamLimited.C:94:83: note: candidates are:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:157:1: note: double sqrt(double)
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedScalar.H:65:19: note: Foam::dimensionedScalar Foam::sqrt(const dimensionedScalar&)
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:258:1: note: Foam::doubleScalar Foam::sqrt(Foam::doubleScalar)
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:258:1: note: Foam::floatScalar Foam::sqrt(Foam::floatScalar)
rhoPimpleFoamLimited.C:106:161: error: call of overloaded ‘sqrt(double)’ is ambiguous
rhoPimpleFoamLimited.C:106:161: note: candidates are:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:157:1: note: double sqrt(double)
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedScalar.H:65:19: note: Foam::dimensionedScalar Foam::sqrt(const dimensionedScalar&)
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:258:1: note: Foam::doubleScalar Foam::sqrt(Foam::doubleScalar)
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:258:1: note: Foam::floatScalar Foam::sqrt(Foam::floatScalar)
make: *** [Make/linux64GccDPOpt/rhoPimpleFoamLimited.o] Error 1
what do you think about this?
thank you.
immortality is offline   Reply With Quote

Old   March 29, 2013, 01:10
Default
  #35
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
what is incorrect in T now?I've defined it.
Another question is if this limiting true in aspect of CFD results?i mean does it lead to correct results with limiting?whats its influence in your opinion?
immortality is offline   Reply With Quote

Old   March 29, 2013, 08:20
Default
  #36
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
did anyone find a reason and solution of the problem?
immortality is offline   Reply With Quote

Old   March 29, 2013, 08:44
Default
  #37
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
I believe it would help if you put

Code:
Foam::
in front of your "sqrt" operation.

Kind regards,

Niels
Elham likes this.
ngj is offline   Reply With Quote

Old   March 29, 2013, 09:00
Default
  #38
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thank you very very so much dear Niels!!
it resolved.
may you tell me the reason?is the sqrt a class object?
how could i find the access functions for fields?
immortality is offline   Reply With Quote

Old   March 29, 2013, 09:04
Default
  #39
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
It is my understand that the compiler does not know, whether to use the std:: or Foam:: class definition of sqrt, since the Foam:: is probably derived from std::.

Kind regards,

Niels
immortality and oumnion like this.
ngj is offline   Reply With Quote

Old   March 30, 2013, 07:19
Default
  #40
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
i have a subsonic problem but velocity at early time steps goes higher than sonic velocity and so i've limited it to sonic values as you can see above.
I have a doubt about the effect of this work on last results.
Because running takes much time i decided to ask first.
The CFD problem is unsteady compressible if important.
immortality is offline   Reply With Quote

Reply


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
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 20:08
unable to get parabolic velocity profile with pimplefoam houkensjtu OpenFOAM 4 October 8, 2012 05:41
Emergency:UDF for a time dependent parabolic velocity zumaqiong Fluent UDF and Scheme Programming 12 March 25, 2010 13:00
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 02:44.