UOprocess.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "error.H"
00028
00029 #include "UOprocess.H"
00030 #include "Kmesh.H"
00031 #include "dictionary.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 complexVector UOprocess::WeinerProcess()
00041 {
00042 return RootDeltaT*complexVector
00043 (
00044 complex(GaussGen.GaussNormal(), GaussGen.GaussNormal()),
00045 complex(GaussGen.GaussNormal(), GaussGen.GaussNormal()),
00046 complex(GaussGen.GaussNormal(), GaussGen.GaussNormal())
00047 );
00048 }
00049
00050
00051
00052
00053
00054 UOprocess::UOprocess
00055 (
00056 const Kmesh& kmesh,
00057 const scalar deltaT,
00058 const dictionary& UOdict
00059 )
00060 :
00061 GaussGen(label(0)),
00062 Mesh(kmesh),
00063 DeltaT(deltaT),
00064 RootDeltaT(sqrt(DeltaT)),
00065 UOfield(Mesh.size()),
00066
00067 Alpha(readScalar(UOdict.lookup("UOalpha"))),
00068 Sigma(readScalar(UOdict.lookup("UOsigma"))),
00069 Kupper(readScalar(UOdict.lookup("UOKupper"))),
00070 Klower(readScalar(UOdict.lookup("UOKlower"))),
00071 Scale((Kupper - Klower)*pow(scalar(Mesh.size()), 1.0/vector::dim))
00072 {
00073 const vectorField& K = Mesh;
00074
00075 scalar sqrKupper = sqr(Kupper);
00076 scalar sqrKlower = sqr(Klower) + SMALL;
00077 scalar sqrK;
00078
00079 forAll(UOfield, i)
00080 {
00081 if ((sqrK = magSqr(K[i])) < sqrKupper && sqrK > sqrKlower)
00082 {
00083 UOfield[i] = Scale*Sigma*WeinerProcess();
00084 }
00085 else
00086 {
00087 UOfield[i] = complexVector
00088 (
00089 complex(0, 0),
00090 complex(0, 0),
00091 complex(0, 0)
00092 );
00093 }
00094 }
00095 }
00096
00097
00098
00099
00100 const complexVectorField& UOprocess::newField()
00101 {
00102 const vectorField& K = Mesh;
00103
00104 label count = 0;
00105 scalar sqrKupper = sqr(Kupper);
00106 scalar sqrKlower = sqr(Klower) + SMALL;
00107 scalar sqrK;
00108
00109 forAll(UOfield, i)
00110 {
00111 if ((sqrK = magSqr(K[i])) < sqrKupper && sqrK > sqrKlower)
00112 {
00113 count++;
00114 UOfield[i] =
00115 (1.0 - Alpha*DeltaT)*UOfield[i]
00116 + Scale*Sigma*WeinerProcess();
00117 }
00118 }
00119
00120 Info<< " Number of forced K = " << count << nl;
00121
00122 return UOfield;
00123 }
00124
00125
00126
00127
00128 }
00129
00130
00131
Copyright © 2000-2009 OpenCFD Ltd