interFoam修改随时间变化的重力



  • interFoam添加体积力,想通过修改重力,得到一个随时间和位置变化的重力。而在"readGravitationalAcceleration.H"里面,g的类型是 uniformDimensionedVectorField,而g与mesh.C()有关,所以编译时报错。
    把类型改为DimensionedVectorField,报错:error: ‘DimensionedVectorField’ was not declared in this scope。改为volVectorField, 报错:‘Foam::tmp<Foam::Field<double> >’ is not derived from ‘const Foam::dimensioned<Type>’ ghf = (g & mesh.Cf()) - ghRef; ghRef这一项被标红了。应该改为什么类型才好?


 

Forest
Mountains