如果setSet实现不了,我应该用什么去实现呢?
luca
帖子
-
大家好,我想利用setSet设置一个圆形/1/4圆的着火点,请问有前辈这样设置过吗? -
cyclicAMI,当transform为 translational的时separationVector (x y z)的坐标如何定义?这是我的周期性边界,两者在Y方向上不同,距离为8mm
-
请教在自开发AMR求解器中应用cyclic边界条件报错@田畔的风 您好,请问您有设置cyclicAMI的相关案例么,能参考下吗?
-
如何在decomposeParDict中使用preservePatches我是直接这样写的,但是感觉没有生效
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object decomposeParDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //method scotch; method simple; numberOfSubdomains 15; simpleCoeffs { preservePatches (frontwall backwall); n ( 1 15 1 ); delta 0.001; } // ***
请问大家正确的格式是什么?
-
请教在自开发AMR求解器中应用cyclic边界条件报错单核是可以运行的,但是一旦并行运算就会报错。
-
存在周期性边界如何分块@中国轰炸机飞机斯曼 您好,请问虎子哥GlobalPatchesZones如何设置?
-
请教在自开发AMR求解器中应用cyclic边界条件报错各位前辈,我在自适应(AMR)求解器中,对左侧点火端开口,前后面设置为cyclic周期性边界条件,其他面为壁面的算例进行计算时,出现如下报错:
[14] Compared coord: (0.0159 0 0.0009) at index 402 with difference to point 0.008 [14] processorPolyPatch::order : Writing faces to OBJ file procBoundary14to0throughbackwall_faces.obj [14] processorPolyPatch::order : Dumping newly found match as lines between corresponding face centres to OBJ file "/home/customer/Desktop/cyclicTest_zhu/3D-H2-initial-mpi-combustion/processor14/procBoundary14to0throughbackwall_faceCentresConnections.obj" [14] --> FOAM Serious Error : [14] From function processorPolyPatch::order(const primitivePatch&, labelList&, labelList&) const [14] in file meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C at line 1015 [14] in patch:procBoundary14to0throughbackwall : Cannot match vectors to faces on both sides of patch [14] masterCtrs[0]:(0.0001 0 0.0001) [14] ctrs[0]:(0.0001 0.008 0.0001) [14] Check your topology changes or maybe you have multiple separated (from cyclics) processor patches [14] Continuing with incorrect face ordering from now on Refined from 49761 to 50139 cells. Selected 21 split points out of a possible 4247. [0] [0] [0] --> FOAM FATAL ERROR: [0] Problem. Cannot find (13 452) or 877 (0.0001 0 0.0006) in 1((877 13)) remoteTransformI:-1 localTransformI:13 [0] [0] From function globalMeshData::findTransform(..) [0] in file meshes/polyMesh/globalMeshData/globalMeshData.C at line 848. [0] FOAM parallel run aborting [0] [0] #0 Foam::error::printStack(Foam::Ostream&) at ??:? [0] #1 Foam::error::abort() at ??:? [0] #2 Foam::globalMeshData::findTransform(Foam::List<Foam::Pair<int> > const&, Foam::Pair<int> const&, int) const at ??:? [0] #3 Foam::globalMeshData::calcGlobalEdgeSlaves() const at ??:? [0] #4 Foam::globalMeshData::globalEdgeSlavesMap() const at ??:? [0] #5 void Foam::syncTools::syncEdgeList<int, Foam::maxEqOp<int>, Foam::mapDistribute::transform>(Foam::polyMesh const&, Foam::List<int>&, Foam::maxEqOp<int> const&, int const&, Foam::mapDistribute::transform const&) at ??:? [0] #6 Foam::removeFaces::setRefinement(Foam::List<int> const&, Foam::List<int> const&, Foam::List<int> const&, Foam::polyTopoChange&) const at ??:? [0] #7 Foam::hexRef8::setUnrefinement(Foam::List<int> const&, Foam::polyTopoChange&) at ??:? [0] #8 Foam::dynamicRefineFvMesh::unrefine(Foam::List<int> const&) at ??:? [0] #9 Foam::dynamicRefineFvMesh::update() at ??:? [0] #10 ? at ??:? [0] #11 __libc_start_main in "/lib64/libc.so.6" [0] #12 ? at ??:?
模型如下
周期性边界:
我的Boundary文件是这样的:boundary ( outlet { type patch; faces ( (0 4 7 3) ); } endwall { type patch; faces ( (1 2 6 5) ); } upperwall { type wall; faces ( (4 5 6 7) ); } lowerwall { type wall; faces ( (0 3 2 1) ); } frontwall { type cyclic; faces ( (0 1 5 4) ); neighbourPatch backwall; } backwall { type cyclic; faces ( (6 2 3 7) ); neighbourPatch frontwall; } ); mergePatchPairs ( );
我目前怀疑是因为网格不断加密后,由于数据的传输出现问题导致,有没有遇到过类似问题可以一起讨论一下的。
-
网格无关性检查出现问题各位老师,我最近在对网格进行无关性检查时发现,相同的设置条件下源项的能量在小数量和中间数量网格可以向上游传递,但是在大数量网格的情况下能量无法向上游传递,网格都是以中间网格数量的网格为基础进行放缩的。请问这可能是什么原因造成的,希望各位老师指教一二
-
H2在求解器中如何表示/如何在求解器中输出H2的参数?各位前辈们好:
我在YEqn.H 中定义了所有组分的一个反应速率forAll(Y, i) { ROP_[i].field() = -(reaction->R(Y[i])()).source(); }
在求解时能正常输出:
但是当我直接定义 H2的反应速率:
ROP_[H2].field() = -(reaction->R(Y[H2])()).source();
编译的时候就报错:
/home/zhu/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/GeometricField.C:188:1: note: candidate expects 4 arguments, 1 provided In file included from AMRreactingLMFoam.C:51:0: createFields.H:287:13: error: expected unqualified-id before ‘(’ token thermo. (reaction->R(Y[1])()).source()() ^ In file included from AMRreactingLMFoam.C:153:0: YEqn.H:30:14: error: ‘H2’ was not declared in this scope ROP_[H2].field() = -(reaction->R(Y[H2])()).source(); ^ In file included from AMRreactingLMFoam.C:54:0: /home/zhu/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable] scalar maxDeltaT =
显示H2没有定义,请问各位前辈在求解器中如何表示H2?
-
如何对每一个时间步下每个网格的数据(H2的反应速率)进行累加,并输出。各位前辈好,我现在需要计算H2的反应速率,我在 createFields.H 中进行了如下定义:
PtrList<volScalarField> ROP_(Y.size()); forAll(Y, i) { const word RRname = "ROP." + Y[i].name(); ROP_.set ( i, new volScalarField ( IOobject ( RRname, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) ) ); }
随后我在 YEqn.H 中定义了ROP如何进行计算:
forAll(Y, i) { ROP_[i].field() = -(reaction->R(Y[i])()).source()/mesh.V(); }
他这样就输出了所有组分的一个反应速率,但是目前我仅仅想得到氢气的反应速率,并输出H2在每一个时间步上所有网格下数据的一个累加值,对此,我在 AMRreactingLMFoam.H 中这样写:
// ------------------------------------------------------------------------- // fileName myFile = "THRR.dat"; //OFstream myStream("THRR.dat"); std:: ofstream myStream(myFile.c_str(), ios_base::app); // ------------------------------------------------------------------------- // fileName File = "ROP.H2.dat"; //OFstream myStream("THRR.dat"); std:: ofstream Stream(File.c_str(), ios_base::app);
THRR是之前输出的总热释放率,在EEqn.H 中它是这样定义的:
// for THRR recording: THRR = 0.0; forAll(dQ, cellI) { THRR += dQ[cellI]; }
目前我遇到的主要是两个问题:
1.如何单独输出H2的反应速率,当我直接输出ROP.H2时显示H2没有定义
2.对每个时间步下所有网格的H2反应速率进行累加并输出应该如何写代码?
希望能得到大家的解答,谢谢!
-
利用codeStream设置温度边界初始场@tens问题已经解决了,非常感谢指点
-
利用codeStream设置温度边界初始场各位前辈好,我想利用codeStream设置壁面的初始温度场,但是编译之后显示出错,查找相关资料没有很好的办法,希望大家可以指点一下,谢谢
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [ 0 0 0 1 0 0 0 ]; internalField uniform 300; boundaryField { INT { type fixedValue; value uniform 300; } OUT { type zeroGradient; } LONGWALL { type zeroGradient; } WALL { type codedFixedValue; value #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict.parent().parent()); const fvMesh& mesh = refCast<const fvMesh>(d.db()); const label id = mesh.boundary().findPatchID("WALL"); const fvPatch& patch = mesh.boundary()[id]; scalarField T(patch.size(), scalar(300) ); const scalar gamma = 25e2; const scalar Tin = 300; const scalar Tout = 1400; const scalar L = 2.5e-3; forAll(T, i) { const scalar x = patch.Cf()[i][0]; const scalar y = patch.Cf()[i][1]; const scalar radial = pow(x,2)+pow(y,2); const scalar dist = sqrt(radial); if ( dist <= L ) { scalar alpha = gamma*(dist-L/2); T[i] = scalar( (Tout-Tin)/2*(exp(2.0*alpha)-1.0)/(exp(2.0*alpha)+1.0)+(Tin+Tout)/2.0 ); } else if ( dist > L ) { T[i] = scalar( Tout ); } } T.writeEntry("",os); #}; } } }
--> FOAM FATAL IO ERROR: "ill defined primitiveEntry starting at keyword 'value' on line 40 and ending at line 100" file: /home/lucas/桌面/phi0.7/0/T at line 100. From function primitiveEntry::readEntry(const dictionary&, Istream&) in file lnInclude/IOerror.C at line 132. FOAM exiting
报错信息一直显示从40到100行不正确的定义,但是我整个字典只有98行,希望大家能指点一下
-
groovyBC求助@李东岳 非常感谢东岳老师的回复,我会更改检查一下的。
-
groovyBC求助我想在圆盘壁面上利用groovyBC设置一个按照函数上升的温度分布,但是在设置完边界之后发现设置的函数并没有起作用,最后呈现的温度为300K,这是什么原因造成的啊
WALL { type groovyBC; patchType cyclic; variables ( "R=pow(pos().x,2)+pow(pos().y,2);" "r=sqrt(R);" ); valueExpression "407.142+r*16716+3.51339e+06*pow(r,2)-2.63661e+08*pow(r,3)+5.04725e+09*pow(r,4)+4.32329e+07*pow(r,5)"; value uniform 300; fractionExpression "1"; }
-
算例求助我的模型是y型通道。但是气体在刚刚通入管道之后就发散了,老师说是网格流动性有问题,可是这方面应该怎么改,下面是我的相关文件,求各位老师指点。
这是p文件和u文件以及时间步长文件/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [ 1 -1 -2 0 0 0 0 ]; internalField uniform 101325; boundaryField { fuel { type fixedValue; value uniform 101325; } air { type fixedValue; value uniform 101325; } outlet { type fixedValue; value uniform 101325; } front { type empty; } back { type empty; } lowwall { type zeroGradient; value uniform 0; } upwall { type zeroGradient; value uniform 0; } otherwall { type zeroGradient; value uniform 0; } }
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [ 0 1 -1 0 0 0 0 ]; internalField uniform ( 4 0 0 ); boundaryField { fuel { type fixedValue; value uniform ( 0.25 -0.25 0 ); } air { type fixedValue; value uniform ( 0.25 0.25 0 ); } outlet { type zeroGradient; } front { type empty; } back { type empty; } otherwall { type fixedValue; value uniform ( 0 0 0 ); } lowwall { type fixedValue; value uniform ( 0 0 0 ); } upwall { type fixedValue; value uniform ( 0 0 0 ); } }
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application MDreactingLMFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 0.05; deltaT 1e-4; writeControl adjustableRunTime; writeInterval 1e-4; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep yes; maxCo 0.1;