涡量如何在代码中引用?
-
各位春节好~
我想在LESdeltas中植入个方程如下:
根据maxDeltaxyz改动了如下:(会报错)
void Foam::LESModels::TestDeltaxyz::calcDelta() { const fvMesh& mesh = momentumTransportModel_.mesh(); const volVectorField& U = momentumTransportModel_.U(); label nD = mesh.nGeometricD(); const cellList& cells = mesh.cells();//get faces list const pointField& pc = mesh.points();//get point coordinates scalarField hmax(cells.size()); forAll(cells,celli) { scalar deltaMaxTmp = 0.0; const labelList& meshPoints = mesh.cellPoints()[celli]; const vector & Ux = U.internalField()[celli];//不知道这么写对不对 const vectorField& vorticity = fvc::curl(Ux);//how can i get the vorticity? const vectorField& nv = (vorticity/mag(vorticity));//normal vorticity const vector nvi = nv[celli]; forAll(meshPoints, pointi)// i { label pointI = meshPoints[pointi]; const point& rn = pc[pointI]; vector ln = nvi ^ rn; forAll(meshPoints, pointj)// j { label pointJ = meshPoints[pointj]; const point& rm = pc[pointJ]; vector lm = nvi ^ rm; scalar tmp = mag(ln - lm); if (tmp > deltaMaxTmp) { deltaMaxTmp = tmp; } } } hmax[celli] = deltaCoeff_*deltaMaxTmp; }
关于涡量的引入有什么方法吗?以及我的循环方式可行吗?
我尝试加入fvc.h文件,想通过对速度求curl,但目前仍然无法使用,怎样写才能使它正常工作呢?祝好
-
@李东岳 感谢李老师的指点!
但是现在编译遇到的报错仍和之前一样,提示我no matching function for call to curlerror:no matching function for call to “curl(const vector&)” const vectorField& vorticity = fvc::curl(Ux);//how can i get the vorticity? in file......note:candidate:template<class Type> Foam::tmp::<Foam::GeometricField<Type, Foam::fvpatchField,Foam::volMesh>> Foam::fvc::curl(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) curl ....other
速度Ux的引入是正确的吗?我该如何使其工作?
-
@李东岳 东岳老师您好,目前进展卡在速度的引入上
const volVectorField& U = momentumTransportModel_.U(); const cellList& cells = mesh.cells(); forAll(cells,celli) { const volVectorField& uCell = U[celli]; const volVectorField& vorticity = fvc::curl(uCell); ...
编译显示速度场无效初始化
error: invalid initialization of reference of type ‘const volVectorField& {aka const Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&}’ from expression of type ‘const Foam::Vector<double>’ const volVectorField& uCell = U[celli];
所以 速度 该怎么正确引入到写的代码里呢?感激不尽!