利用codeStream设置相分数初始场
-
大家好,
我想利用codeStream设置相分数初始场,比如盐水-淡水按照线性分层变化,但是编译总出错,1-Solution.pdf ,请大家提供点其他参考资料吧!谢谢internalField #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); const fvMesh& mesh = refCast<const fvMesh>(d.db()); scalarField alpha.air(mesh.nCells(), 1.0); scalarField alpha.water(mesh.nCells(), 0.0); scalarField alpha.saltwater(mesh.nCells(), 0.0); scalar D = 0.0252; scalar ymin = -4.48*D; scalar ymax = 5.82*D; scalar alpha_min = 0; scalar alpha_max = 1; forAll(alpha.water,i) { const scalar x = mesh.C()[i][0]; const scalar y = mesh.C()[i][1]; const scalar z = mesh.C()[i][2]; if ( (y >= ymin) && (y <= ymax) ) { alpha.water[i] = alpha_min+(alpha_max-alpha_min)*(y-ymin)/(ymax-ymin)); alpha.saltwater[i] = 1.0-alpha.water[i]; alpha.air[i] = 0; } } #}; };
-
@chengan-wang 变量名不能包含dot