CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   about volScalarField we used (https://www.cfd-online.com/Forums/openfoam-programming-development/132615-about-volscalarfield-we-used.html)

bieshuxuhe April 3, 2014 08:40

about volScalarField we used
 
hello !
in the volFieldsFwd.H , there is:
typedef GeometricField<scalar, fvPatchField, volMesh> volScalarField;:)

there are two "scalar" which are defined in the "scalar.H" as follows:
Code:

36 #ifndef scalar_H
37 #define scalar_H
38
39 #include "floatScalar.H"
40 #include "doubleScalar.H"
41
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44 #if defined(WM_SP)
45
46 // Define scalar as a float
47
48 namespace Foam
49 {
50 typedef floatScalar scalar;
51
52  static const scalar GREAT = floatScalarGREAT;
53  static const scalar VGREAT = floatScalarVGREAT;
54  static const scalar ROOTVGREAT = floatScalarROOTVGREAT;
55  static const scalar SMALL = floatScalarSMALL;
56  static const scalar VSMALL = floatScalarVSMALL;
57  static const scalar ROOTVSMALL = floatScalarROOTVSMALL;
58
59  scalar readScalar(Istream& is);
60 }
61
62 #elif defined(WM_DP)
63
64 // Define scalar as a double
65
66 namespace Foam
67 {
68  typedef doubleScalar scalar;
69
70  static const scalar GREAT = doubleScalarGREAT;
71  static const scalar VGREAT = doubleScalarVGREAT;
72  static const scalar ROOTVGREAT = doubleScalarROOTVGREAT;
73  static const scalar SMALL = doubleScalarSMALL;
74  static const scalar VSMALL = doubleScalarVSMALL;
75  static const scalar ROOTVSMALL = doubleScalarROOTVSMALL;
76
77  scalar readScalar(Istream& is);
78 }
79
80 #endif
81
82
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84
85 #endif
86
87 // ************************************************************************* //

I don't find any WM_SP or WM_DP is defined in the openfoam source code.:o
Then I wonder which scalar is adopted when we use volScalarField to declare "p" in the "createFields.H" ?:confused: for example :
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


the floatScalar or the doubleScalar ? :confused:could you help me ?
Thanks !

alexeym April 3, 2014 08:43

Hi,

it is passed to the compiler like:

Code:

Making dependency list for source file aFile.C
SOURCE=aFile.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unu ...

it is defined in etc/bashrc

Code:

#    WM_PRECISION_OPTION = DP | SP
export WM_PRECISION_OPTION=DP


bieshuxuhe April 3, 2014 08:45

Thank you !!!


All times are GMT -4. The time now is 14:04.