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

Non-uniform velocity profile utility

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2015, 10:49
Default Non-uniform velocity profile utility
  #1
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Dear Foamers,

I have a utility which is able to apply non-uniform velocity profile at the inlet. I have little knowledge in C++ so I could not find the solution myself.
When I set the profile as for example "2 * c[1]", which c is the face centre of the inlet boundary, it is compiled using wmake and works. But I do not exactly know how to introduce an if-clause into the code. The p in the following code is a vector class which should be same velocity vector:
Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM 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.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Application
    icoFoam

Description
    Transient solver for incompressible, laminar flow of Newtonian fluids.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    #include "initContinuityErrs.H"
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    // Get index of patch
    label inletPatchID = mesh.boundaryMesh().findPatchID("INLET")
    // Get reference to boundary value
    const fvPatchVectorField& facecentre = mesh.C().boundaryField()[inletPatchID];
    fvPatchVectorField& inletU = U.boundaryField()[inletPatchID];
    forAll(inletU, faceI)
    {
    // get coordinate for cell centre
    //scalarField y = centre.component(vector::Y);
    //scalarField x = centre.component(vector::X);
    const vector& c = facecentre[faceI];
    //scalarField z = c.component(vector::Z);
    //vector p((1.218*4*pow((1.0-(z/0.1016)),1/7)),(1.218*3*pow(1.0-(z/0.1016),1/7)),0);
    //vector p((c[1]<0.05985 && c[1]>0.27165) ?  : 6.355,;

 vector p(2 * c[1], 0, 0);

    //double del = 0.89 * 0.0315;
    //double B = 1.0 / 7.0;
    //double ufree = 6.355;
    //if (c[1] <= (0.0315 + del))      
      //  vector p(ufree*pow((c[1] - 0.0315)/del,B), 0.0, 0.0);           
      //     else if (c[1] >= (0.3 - del))
      //  vector p(ufree*pow((0.3 - c[1])/del,B), 0.0, 0.0);
      //     else
      //vector p(ufree, 0.0, 0.0);
    // calculate inlet velocity
    inletU[faceI] = p ;
    }
    U.write();
    Info<< "ExecutionTime = "
    << runTime.elapsedCpuTime()
    << " s\n\n" << endl;
    Info<< "End\n" << endl;
    U.write();
    return 0;
}
// ************************************************************************* //
In the code above, the if-clause is commented. When I uncomment it along with the variables definition (del, B, and ufree) I encounter error messages as follows:

Code:
syavash@syavash-VPCF11DGX:~/OpenFOAM/non_uniform_bc_icoFoam$ wmake
Making dependency list for source file non_uniform_bc_icoFoam.C
SOURCE=non_uniform_bc_icoFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/non_uniform_bc_icoFoam.o
In file included from non_uniform_bc_icoFoam.C:43:0:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/initContinuityErrs.H: In function ‘int main(int, char**)’:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’ [-Wunused-variable]
 scalar cumulativeContErr = 0;
        ^
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPOpt/non_uniform_bc_icoFoam.o -L/home/syavash/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib \
         -lfiniteVolume -lOpenFOAM -ldl   -lm -o /home/syavash/OpenFOAM/syavash-2.3.1/platforms/linux64GccDPOpt/bin/non_uniform_bc_icoFoam
syavash@syavash-VPCF11DGX:~/OpenFOAM/non_uniform_bc_icoFoam$ wmake
Making dependency list for source file non_uniform_bc_icoFoam.C
SOURCE=non_uniform_bc_icoFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/non_uniform_bc_icoFoam.o
non_uniform_bc_icoFoam.C: In function ‘int main(int, char**)’:
non_uniform_bc_icoFoam.C:73:51: error: call of overloaded ‘pow(double, double&)’ is ambiguous
           vector p(ufree*pow((c[1] - 0.0315)/del,B), 0.0, 0.0);          
                                                   ^
non_uniform_bc_icoFoam.C:73:51: note: candidates are:
In file included from /usr/include/features.h:374:0,
                 from /usr/include/limits.h:25,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:168,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:34,
                 from /usr/include/c++/4.8/climits:41,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/label.H:38,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/labelList.H:47,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UPstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Pstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from non_uniform_bc_icoFoam.C:32:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: double pow(double, double)
 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
In file included from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/TimeState.H:38:0,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Time.H:47,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:6,
                 from non_uniform_bc_icoFoam.C:32:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:58:19: note: Foam::dimensionedScalar Foam::pow(const dimensionedScalar&, const dimensionedScalar&)
 dimensionedScalar pow(const dimensionedScalar&, const dimensionedScalar&);
                   ^
In file included from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/floatScalar.H:38:0,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/scalar.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/IOstream.H:49,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Ostream.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/OSstream.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/messageStream.H:220,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/error.H:51,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Pstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from non_uniform_bc_icoFoam.C:32:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(long int, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:89:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, long, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, long int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:88:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, float, long)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(int, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:87:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, int, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:86:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, float, int)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(long int, double)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:85:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, long, double)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(double, long int)
 inline double pow(const type1 s, const type2 e)   \
non_uniform_bc_icoFoam.C:75:48: error: call of overloaded ‘pow(double, double&)’ is ambiguous
           vector p(ufree*pow((0.3 - c[1])/del,B), 0.0, 0.0);
                                                ^
non_uniform_bc_icoFoam.C:75:48: note: candidates are:
In file included from /usr/include/features.h:374:0,
                 from /usr/include/limits.h:25,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:168,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:34,
                 from /usr/include/c++/4.8/climits:41,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/label.H:38,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/labelList.H:47,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UPstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Pstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from non_uniform_bc_icoFoam.C:32:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: double pow(double, double)
 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
In file included from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/TimeState.H:38:0,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Time.H:47,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:6,
                 from non_uniform_bc_icoFoam.C:32:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:58:19: note: Foam::dimensionedScalar Foam::pow(const dimensionedScalar&, const dimensionedScalar&)
 dimensionedScalar pow(const dimensionedScalar&, const dimensionedScalar&);
                   ^
In file included from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/floatScalar.H:38:0,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/scalar.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/IOstream.H:49,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Ostream.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/OSstream.H:39,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/messageStream.H:220,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/error.H:51,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UListI.H:26,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UList.H:393,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/List.H:43,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/labelList.H:48,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UPstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Pstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from non_uniform_bc_icoFoam.C:32:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(long int, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:89:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, long, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, long int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:88:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, float, long)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(int, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:87:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, int, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:86:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, float, int)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(long int, double)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:85:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, long, double)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(double, long int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:84:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, double, long)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(int, double)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:83:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, int, double)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(double, int)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:82:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, double, int)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:81:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(float, float, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(float, double)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:80:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, float, double)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(double, float)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:79:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, double, float)
 ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:72:15: note: double Foam::pow(double, double)
 inline double pow(const type1 s, const type2 e)   \
               ^
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/doubleFloat.H:78:1: note: in expansion of macro ‘MAXMINPOW’
 MAXMINPOW(double, double, double)
 ^
In file included from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/labelList.H:47:0,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/UPstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/Pstream.H:42,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from non_uniform_bc_icoFoam.C:32:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude/label.H:276:7: note: Foam::label Foam::pow(Foam::label, Foam::label)
 label pow(label a, label b);
       ^
non_uniform_bc_icoFoam.C:85:21: error: ‘p’ was not declared in this scope
     inletU[faceI] = p ;
                     ^
In file included from non_uniform_bc_icoFoam.C:43:0:
/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’ [-Wunused-variable]
 scalar cumulativeContErr = 0;
        ^
make: *** [Make/linux64GccDPOpt/non_uniform_bc_icoFoam.o] Error 1
I know that this problem originates from lack of programming skills.
Please, can any body suggest something to resolve the problem??

Thanks,
Syavash

Last edited by syavash; July 13, 2015 at 06:15.
syavash is offline   Reply With Quote

Old   July 12, 2015, 06:26
Default
  #2
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Please, I need help to overcome this issue.
Any suggestions??!

Thanks,

Syavash
syavash is offline   Reply With Quote

Old   August 18, 2015, 16:38
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: I had this on my to-do list and only now managed to take a quick look into this.
I don't know if you've solved this issue already or not, but the correct way to implement what you want to do is with an explicit boundary condition class.
You can find an example here: http://www.cfd-online.com/Forums/ope...tml#post446451 - post #10

As for the error message, I think it's because you're using "double" variable types when you should use "scalar", e.g.:
Code:
scalar del = 0.89 * 0.0315;
scalar B = 1.0 / 7.0;
scalar ufree = 6.355;
if (c[1] <= (scalar(0.0315) + del))
In addition, I see that you got an answer for a related issue, namely component assignment: http://www.cfd-online.com/Forums/ope...tml#post557666 - post #8
wyldckat is offline   Reply With Quote

Old   August 19, 2015, 05:08
Default
  #4
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: I had this on my to-do list and only now managed to take a quick look into this.
I don't know if you've solved this issue already or not, but the correct way to implement what you want to do is with an explicit boundary condition class.
You can find an example here: http://www.cfd-online.com/Forums/ope...tml#post446451 - post #10

As for the error message, I think it's because you're using "double" variable types when you should use "scalar", e.g.:
Code:
scalar del = 0.89 * 0.0315;
scalar B = 1.0 / 7.0;
scalar ufree = 6.355;
if (c[1] <= (scalar(0.0315) + del))
In addition, I see that you got an answer for a related issue, namely component assignment: http://www.cfd-online.com/Forums/ope...tml#post557666 - post #8
Thanks Bruno,
I have tried groovyBC instead and it is much better to handle.
In the thread you addressed, I had already acknowledged more about variables and classes in OF, but it issued a post-processing problem.
Begginer in OF, lots of questions 😊.
syavash 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
Inlet patch problems martyn88 OpenFOAM Running, Solving & CFD 6 April 21, 2017 19:34
Modified pimpleFoam solver to MRFPimpleFoam solver hiuluom OpenFOAM Programming & Development 12 June 14, 2015 22:22
OpenFOAM solution is diverging for stress analysis in two-pahse microstructure. Sargam05 OpenFOAM 16 April 30, 2013 17:18
Velocity profile boundary condition Tuca FLOW-3D 1 April 23, 2013 13:02
rhoSimpleFoam claco OpenFOAM 7 April 20, 2010 05:32


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