请教一个openfoam边界问题:fixedprofile的使用
-
我的模拟区域是一个类似于长方体的区域,目前已知各个面的多个点的边界条件(包括速度和气压);
现在想要把边界条件导入,目前采用的是fixedprofile边界条件(按照物理量随高度变化生成txt文档),只导入速度条件时,可以正常运行,导入气压时会报错,请问这个什么原因?
(我在运行中加入了地形,但下方未给出)blcokMeshDict如下:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // backgroundMesh { xMin -27; // L = 350 xMax 6153; yMin -4; // L = 280 yMax 3716; zMin 0; zMax 600; xCells 206; yCells 124; zCells 20; } convertToMeters 1; vertices ( ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMin) ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMin) ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMin) ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMin) ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMax) ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMax) ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMax) ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMax) ); blocks ( hex (0 1 2 3 4 5 6 7) ( $!backgroundMesh/xCells $!backgroundMesh/yCells $!backgroundMesh/zCells ) simpleGrading (1 1 1) ); boundary ( inlet1 { type patch; faces ( (1 5 6 2) ); } outlet1 { type patch; faces ( (0 3 7 4) ); } inlet2 { type patch; faces ( (3 2 6 7) ); } outlet2 { type patch; faces ( (0 4 5 1) ); } ground { type wall; faces ( (0 1 2 3) ); } frontAndBack { type symmetry; faces ( (4 7 6 5) ); } ); // ************************************************************************* //
(2)p文件如下:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { inlet1 { type fixedProfile; profile tableFile; profileCoeffs { file "east_p.txt"; } direction (0 0 1); origin 0; } outlet1 { type fixedProfile; profile tableFile; profileCoeffs { file "west_p.txt"; } direction (0 0 1); origin 0; } inlet2 { type fixedProfile; profile tableFile; profileCoeffs { file "north_p.txt"; } direction (0 0 1); origin 0; } outlet2 { type fixedProfile; profile tableFile; profileCoeffs { file "south_p.txt"; } direction (0 0 1); origin 0; } wall { type zeroGradient; } #includeEtc "caseDicts/setConstraintTypes" } // ************************************************************************* //
(3)u文件如下:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Uinlet (10 0 0); dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet1 { type fixedProfile; profile tableFile; profileCoeffs { file "east_u2.txt"; } direction (0 0 1); origin 0; } outlet1 { type fixedProfile; profile tableFile; profileCoeffs { file "west_u2.txt"; } direction (0 0 1); origin 0; } inlet2 { type fixedProfile; profile tableFile; profileCoeffs { file "north_u2.txt"; } direction (0 0 1); origin 0; } outlet2 { type fixedProfile; profile tableFile; profileCoeffs { file "south_u2.txt"; } direction (0 0 1); origin 0; } wall { type noSlip; } #includeEtc "caseDicts/setConstraintTypes" } // ************************************************************************* //
(4)txt文档示例
east_p: ( (0 810.9839477279503) (30 808.0891987157489) (60 805.1645322988701) (90 802.22015) (120 799.29156) (150 796.36633) (180 793.4472) (210 790.5453) (240 787.6469) (270 784.7538) (300 781.8721) (330 778.99316) (360 776.1151) (390 773.2555) (420 770.4064) (450 767.5576) (480 764.70886) (510 761.87537) (540 759.061) (570 756.24927) (600 753.4375) )
east_u2: ( (0 (-1.660778921702502 0 0)) (30 (-2.975759076034416 0 0)) (60 (-3.839839556192187 0 0)) (90 (-4.2877254 0 0)) (120 (-4.671794 0 0)) (150 (-4.900312 0 0)) (180 (-5.0548387 0 0)) (210 (-5.13091 0 0)) (240 (-5.184279 0 0)) (270 (-5.2090316 0 0)) (300 (-5.188982 0 0)) (330 (-5.168712 0 0)) (360 (-5.14608 0 0)) (390 (-5.0816574 0 0)) (420 (-5.0173383 0 0)) (450 (-4.9538355 0 0)) (480 (-4.890333 0 0)) (510 (-4.7623835 0 0)) (540 (-4.588725 0 0)) (570 (-4.4132843 0 0)) (600 (-4.237844 0 0)) )
-
@学流体的小明 fvsolution等等都是用的windaroundbuildings这个算例自带的,感觉我的研究问题和这个算例差不多,现在也刚接触openfoam学的不太深入,就没有修改
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class dictionary; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p { solver GAMG; smoother GaussSeidel; tolerance 1e-6; relTol 0.1; } "(U|k|omega|epsilon)" { solver smoothSolver; smoother symGaussSeidel; tolerance 1e-6; relTol 0.1; } } SIMPLE { residualControl { p 1e-4; U 1e-4; "(k|omega|epsilon)" 1e-4; } nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; } potentialFlow { nNonOrthogonalCorrectors 10; } relaxationFactors { fields { p 0.3; } equations { U 0.7; "(k|omega|epsilon).*" 0.7; } } // ************************************************************************* //