CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   boundary condition scalarField in parallel (https://www.cfd-online.com/Forums/openfoam/81011-boundary-condition-scalarfield-parallel.html)

nlc October 13, 2010 11:01

boundary condition scalarField in parallel
 
1 Attachment(s)
I'm trins to compile my boundary condition using a scalarField It work but in parallel I get this warning:

Code:

  --> FOAM Warning :
    From function Field<Type>::Field(const word& keyword, const dictionary&, const label)
    in file /home/niko/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/Field.C at line 262
    Reading "/home/niko/OpenFOAM/niko-1.7.1/run/AEMN/testcase/ABL_kepsilonGroundShear/processor0/0/U::boundaryField::ground" from line 102 to line 105
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
Reading/calculating face flux field phi

And the const scalarField z0_ change but it is not suppose to !

To do this patch I use fixed shear stress and nut rough wall as example.

Thanks for the help !

nlc October 13, 2010 11:06

The k file in the 0 folder has the ground boundary define:

Code:

    ground
    {
      type ABLz0kWall;
      //z0      uniform 0.1;
      /**/
      #include        "include/z0Field"
      z0 nonuniform  $z0Field;
      /**/
      kappa          0.41;
      Cmu            0.09;
    }

with include/z0Field
Code:

z0Field            List<scalar>
        75(0.1 0.1 0.1 0.1 0.1
          0.1 0.1 0.1 0.1 0.1
          0.1 0.1 0.1 0.1 0.1
          0.1 0.1 0.1 0.1 0.1
              0.1 0.1 0.1 0.1 0.1
              0.1 0.1 0.1 0.1 0.1
              0.1 0.1 0.1 0.1 0.1
            0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              0.4 0.4 0.4 0.4 0.4
              );


nlc November 1, 2010 13:24

I found an error that solve part of the problem, but now I try to use rmap and automap to make it possible to use in parallel.

My error was that in the write function I did not use the right function too write z0_ so I change it for:
Code:

z0_.writeEntry("z0", os);
now z0 write correctly but it is still a problem with parallel since rmap and automap are not define.

I try to add them as it is add in turbulentHeatFluxTemperatureFvPatchScalarField but i get this error:

Code:

Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C: In member function ‘virtual void Foam::incompressible::RASModels::ABLz0epsilonWallFunction::autoMap(const Foam::fvPatchFieldMapper&)’:
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:286: error: passing ‘const Foam::scalarField’ as ‘this’ argument of ‘void Foam::Field<Type>::autoMap(const Foam::FieldMapper&) [with Type = float]’ discards qualifiers
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C: In member function ‘virtual void Foam::incompressible::RASModels::ABLz0epsilonWallFunction::rmap(const Foam::fvPatchScalarField&, const Foam::labelList&)’:
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:296: error: ‘template<class Type> class Foam::fvPatchField’ used without template parameters
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:304: error: passing ‘const Foam::scalarField’ as ‘this’ argument of ‘void Foam::Field<Type>::rmap(const Foam::UList<T>&, const Foam::unallocLabelList&) [with Type = float]’ discards qualifiers
make: *** [Make/linux64GccSPOpt/ABLz0epsilonWallFunction.o] Erreur 1

thanks for the help

nlc November 2, 2010 09:54

autoMap tryed to modify my const scalarField z0_ !!
 
apparently the too errors

Code:

Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:294: error: passing ‘const Foam::scalarField’ as ‘this’ argument of ‘void Foam::Field<Type>::autoMap(const Foam::FieldMapper&) [with Type = float]’ discards qualifiers
and
Code:

Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:313: error: passing ‘const Foam::scalarField’ as ‘this’ argument of ‘void Foam::Field<Type>::rmap(const Foam::UList<T>&, const Foam::unallocLabelList&) [with Type = float]’ discards qualifiers
are in my case related to the fact that I used a:

const scalarField z0_;

I change it for a:

scalarField z0_;

And those too error disappear. I guess it means i tried to modify the constant class z0_ with autoMap. So autoMap modify the member of the class !!! One day I'll get use to c++ error message. But now I'm still learning c++ :D !!

but still this error remains
Code:

Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C: In member function ‘virtual void Foam::incompressible::RASModels::ABLz0epsilonWallFunction::rmap(const Foam::fvPatchScalarField&, const Foam::labelList&)’:
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:304: error: ‘template<class Type> class Foam::fvPatchField’ used without template parameters

If some one can give me a cue on this error it will help me !!!
Regards

nlc November 5, 2010 19:26

Found the reason for the error :
Code:

Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C: In member function ‘virtual void Foam::incompressible::RASModels::ABLz0epsilonWallFunction::rmap(const Foam::fvPatchScalarField&, const Foam::labelList&)’:
Wall/epsilonWallFunctions/ABLz0epsilonWallFunction/ABLz0epsilonWallFunction.C:304: error: ‘template<class Type> class Foam::fvPatchField’ used without template parameters

As rmap is a virtual function and the mother of my class is a template with no rmap define I got confuse. The problem was that I was calling the rmap function without template parameters. So I had to define the parameters I used. In my case : <scalar>.

I use
Code:

fvPatchField<scalar>::rmap(ptf, addr);
instead of
Code:

fvPatchField::rmap(ptf, addr);
And the error is gone !!

works fine now tanks for reading


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