OpenFOAM小代码
-
-
-
李老师您好,请问输出努塞尔数代码是直接放进去吗?还是里边的部分数据需要进行修改呢 ?
-
@2019201300 这个我太久之前写的。已经忘了。但是这个代码只是提供案例。具体数值大概率需要自己改一下。直接放在controlDict下面。
-
请问这个代码怎么修改,才可以使用网格的体积,
volScalarField muc ( IOobject ( IOobject::groupName("mu", continuousPhaseName), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), rhoc*laminarTransport.nu() ); volScalarField Rep("Rep", dp/laminarTransport.nu()*mag(Up - U)); volScalarField CDRe("CDRe", 24/Rep+3.6*pow(Rep,-0.313)); scalar deltaTs = runTime.deltaTValue(); Up = Up + deltaTs*(3/4*muc/rhop/pow(dp,2.0)/mesh.V()*CDRe*(U - Up) + g);
其中的mesh.V()怎么修改才可以。
-
@疏影横斜水清浅 参考下下边这个代码吧。
coded { libs ( "libutilityFunctionObjects.so" ); enabled true; type coded; name printMinU; executeControl timeStep; executeInterval 200; writeControl timeStep; writeInterval 200; codeOptions #{ -I$(LIB_SRC)/meshTools/lnInclude #}; codeExecute #{ const volScalarField& T ( mesh().lookupObject<volScalarField>("T") ); const fvPatchList& patches = mesh().boundary(); std::ofstream file; file.open ("nus", std::ofstream::out | std::ofstream::app); forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; if (currPatch.name() == "bottomWall") { fvPatchScalarField nus = T.boundaryField()[patchi]; scalar L = 0.1; scalar Timp = 343; const volScalarField& T = mesh().lookupObject<volScalarField>("T"); scalarField Tinternal = T.internalField(); scalar sumT = gSum(Tinternal * mesh().V()); scalar V = gSum(mesh().V()); scalar avgT = sumT / V; nus = T.boundaryField()[patchi].snGrad()*L/(Timp - avgT); //nus2file << "Time: " << mesh().time().timeName() << " " << nus << nl; forAll(T.boundaryField()[patchi], facei) { //Pout << mesh().C().boundaryField()[patchi][facei].x()/0.1 // << " " << nus[facei] << nl; file << "Time: " << mesh().time().timeName() << " " << mesh().C().boundaryField()[patchi][facei].x() << " " << mesh().C().boundaryField()[patchi][facei].z() << " " << nus[facei] << std::endl; } } } file.close(); #}; }
-
@2019201300 请问,这个代码是能够将每个网格的体积存储在Vcell中吧?
volScalarField Vcell ( IOobject ( "Vcell", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("", dimVolume, 0.0) ); forAll(Vcell ,i) { Vcell[i] = mesh.V()[i]; }
-
@2019201300 我想问一下,如果我要计算整个壁面的平均努塞尔数,该怎么处理呢