SRF/MRF的使用问题?数值模拟中要定义旋转速度。
-
@赵一铭
这个是李东岳老师给的代码运行的错误Create time Create mesh for time = 0 SIMPLE: convergence criteria field p tolerance 0.01 field U tolerance 0.001 field "(k|epsilon)" tolerance 0.001 Reading field p --> FOAM Warning : From function Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double; Foam::label = int] in file /home/ubuntu/OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.C at line 317 Reading "/home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/p.boundaryField.INLET" from line 27 to line 28 expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0. --> FOAM Warning : From function Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double; Foam::label = int] in file /home/ubuntu/OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.C at line 317 Reading "/home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/p.boundaryField.OUTLET" from line 32 to line 33 expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0. AMI: Creating addressing and weights between 1911 source faces and 1911 target faces AMI: Patch source sum(weights) min/max/average = 0.999994, 1, 1 AMI: Patch target sum(weights) min/max/average = 0.924226, 1, 0.999254 Reading field U Using dynamicCode for patch MOVINGWALL on field U at line 80 in "/home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL" Creating new library in "dynamicCode/dummy/platforms/linux64GccDPInt32Opt/lib/libdummy_998c505417ee368105406475ef07b1aa535fae1b.so" Invoking "wmake -s libso /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/dynamicCode/dummy" wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file fixedValueFvPatchFieldTemplate.C /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL: In member function ‘virtual void Foam::dummyFixedValueFvPatchVectorField::updateCoeffs()’: /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:13: error: ‘v’ was not declared in this scope /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:31: error: unable to find numeric literal operator ‘operator""x’ /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:31: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:35: error: unable to find numeric literal operator ‘operator""y’ /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:35: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:39: error: unable to find numeric literal operator ‘operator""z’ /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:93:39: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:90:13: warning: unused variable ‘x’ [-Wunused-variable] /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:91:20: warning: unused variable ‘y’ [-Wunused-variable] /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:92:20: warning: unused variable ‘z’ [-Wunused-variable] /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL:87:22: warning: unused variable ‘U’ [-Wunused-variable] /opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/fixedValueFvPatchFieldTemplate.o' failed make: *** [Make/linux64GccDPInt32Opt/fixedValueFvPatchFieldTemplate.o] Error 1 --> FOAM FATAL IO ERROR: Failed wmake "dynamicCode/dummy/platforms/linux64GccDPInt32Opt/lib/libdummy_998c505417ee368105406475ef07b1aa535fae1b.so" file: /home/xiaolong/OpenFOAM/xiaolong-4.1/run/xuanzhuan/0/U.boundaryField.MOVINGWALL from line 80 to line 84. From function void Foam::codedBase::createLibrary(Foam::dynamicCode&, const Foam::dynamicCodeContext&) const in file db/dynamicLibrary/codedBase/codedBase.C at line 206. FOAM exiting
-
code #{ // const vector axis(1, 0, 0); const fvPatch& boundaryPatch = this->patch(); vectorField v = boundaryPatch.Cf(); forAll(boundaryPatch, faceI) { v[faceI] = vector(boundaryPatch.Cf()[faceI].x(),0,0);//修改这个 } //vectorField v(1, 1, 1); //v.replace(vector::X, 1.0); operator==(v); #};
试试这个,把速度初始化为网格边界面的x方向的值了即
(value, 0, 0)
,参考这个定义你自己的函数。