Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
今天看到李东岳老师发的朋友圈,想起昨天学习interFoam.C的时候,发现这样的代码:
p == p_rgh + rho*gh;
请问此处“==”是否表示赋值?可以把“==” 换为“=”? 如果“==”不表示判断,是否还有别的用途?
==可以顺带把边界条件变了。=号不变边界条件。 比如alpha1 == 1 - alpha2,如果alpha2的边界条件是fixedValue=0.5,则alpha1的边界条件也是0.5
alpha1 == 1 - alpha2
@东岳 谢谢李老师,
您可以提示一下,这个“==”会更新边界条件的定义是在哪块代码可以找到的吗?
GeometricField.C在这里操作符重载掉了
GeometricField.C
@东岳 我看到的=号也变边界啊 https://github.com/OpenFOAM/OpenFOAM-dev/blob/master/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C#L1387 可以再详细谈一谈可能存在的坑吗?
https://github.com/OpenFOAM/OpenFOAM-dev/blob/master/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
这是边界场