@学流体的小明 后来我看了一下运行日志发现量纲不匹配并不是动量方程的量纲不匹配,是我在定义阻尼区起点的时候没有定义量纲所以会一直报错,后来把阻尼区起点定义量纲之后就可以啦,整个代码是这样的。```
dimensionedScalar r0
(
"r0",
dimensionSet(0,0,-1,0,0,0,0),
0
);
dimensionedScalar r1
(
"r1",
dimensionSet(0,0,-1,0,0,0,0),
5
);
dimensionedScalar x1 = max(mesh.Cf().component(vector::X))-min(mesh.Cf().component(vector::X));
dimensionedScalar x0
(
"x0",
dimensionSet(0,1,0,0,0,0,0),
12
);
volScalarField R
(
"R",
max(r1*(mesh.C().component(vector::X)-x0)/(x1-x0),r0)
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
- fvm::laplacian(muf,U)
- (fvc::grad(U)&fvc::grad(muf))
+ rho*U*R
);