使用CodeFixedValue对非均匀速度场的编写
-
大家好!我最近参考杨易老师2017年关于中性风场自保持的文献中的设置和KOmegaSST模型来用CodeFixedValue对inlet的U,k,OMEGA进行了编写,大概类似于中性大气环境湍流动能的自保持。 (https://cfd-china.com/topic/6231/中性大气环境湍流动能的自保持-附有算例下载)但是我在decomposePar进行并行运算时候出现问题,看看有没有大佬能帮忙解决。下面附带我u,k,omega的代码,看看是不是代码问题还是其他的地方有问题。谢谢!
decomposePar中出现的问题time=0时候-> FOAM Warning : From const Foam::HashTable<Foam::List<int> >& Foam::polyBoundaryMesh::groupPatchIDs() const in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 510 Removed patchGroup 'symmetry' which clashes with patch 2 of the same name. --> FOAM FATAL IO ERROR: (openfoam-2012) Cannot find patchField entry for symmetry file: /home/user3/SHUKK/monixuexi/313_RANS_lianxi/0/k.boundaryField at line 25 to 64. From void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::readField(const Foam::DimensionedField<TypeR, GeoMesh>&, const Foam::dictionary&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh] in file /home/user3/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/GeometricBoundaryField.C at line 172. FOAM exiting
k
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2012 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 1; boundaryField { inlet { type codedFixedValue; value uniform 0.1; //default value name kinlet; //name of new BC type code #{ const fvPatch& boundaryPatch = this->patch(); scalarField& vf = *this; forAll(vf, i) { scalar z = boundaryPatch.Cf()[i].y(); scalar D1 = -1.515; scalar D2 = 7.463; scalar alpha = 0.25; vf[i] = sqrt(D1*pow(z, alpha) + D2); } #}; } upperwall { type symmetry; } lowerwall { type kqRWallFunction; value uniform 0.375; } outlet { type zeroGradient; } building { type kqRWallFunction; value uniform 0.375; } } // ************************************************************************* //
U
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type codedFixedValue; value uniform (0 0 0); //default value name uinlet; //name of new BC type code #{ const fvPatch& boundaryPatch = this->patch(); vectorField& vf = *this; forAll(vf, i) { scalar z = boundaryPatch.Cf()[i].y(); //scalar uStar = 0.511; //scalar z0 = 2.25e-4; //scalar kappa = 0.42; //vf[i].x() = uStar/kappa*log((z + z0)/z0); //vf[i].y() = 0.0; //vf[i].z() = 0.0; scalar ur = 11.0; scalar alpha = 0.25; scalar zr = 0.40; vf[i].x() = ur*pow(z/zr, alpha); vf[i].y() = 0.0; vf[i].z() = 0.0; } operator==(vf) #}; } outlet { type zeroGradient; } upperWall { type symmetry; } lowerWall { type noSlip; } symmetry { type symmetry; } building { type fixedValue; value uniform (0 0 0); } } // ************************************************************************* //
omega
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 -1 0 0 0 0]; internalField uniform 1; boundaryField { inlet { type codedFixedValue; value uniform 0.1; //default value name omegainlet; //name of new BC type code #{ const fvPatch& boundaryPatch = this->patch(); scalarField& vf = *this; forAll(vf, i) { scalar z = boundaryPatch.Cf()[i].y(); //scalar uStar = 0.511; //scalar z0 = 2.25e-4; //scalar kappa = 0.4; //scalar C1 = -0.17; //scalar C2 = 1.62; //scalar Cmu = 0.42; //vf[i] = uStar/(z +z0)/kappa/sqrt(Cmu); scalar ur = 11.0; scalar alpha = 0.25; scalar Cmu = 0.08; scalar zr = 0.4; scalar u = ur*pow(z/zr, alpha); vf[i] = (alpha/sqrt(Cmu))*u/z; } #}; outlet { type zeroGradient; } upperWall { type symmetry; } lowerWall { type omegaWallFunction; value $internalField; } symmetry { type symmetry; } building { type omegaWallFunction; value $internalField; } } // ********************************************************************* //
-
@SHUKK 在 使用CodeFixedValue对非均匀速度场的编写 中说:
Removed patchGroup 'symmetry' which clashes with patch 2 of the same name.
看这意思是patch名和type名重名了呀,看下面这个。。。
@SHUKK 在 使用CodeFixedValue对非均匀速度场的编写 中说:
symmetry { type symmetry; }
-
@wangfei9088 这个以前用LES我没留意到,我现在就发现是我k里面忘记加左右壁面的,我重新做一个网格看看