@浪迹天大 非常感谢您的帮助,我已经完美解决这个问题。
stergopilot
帖子
-
求解器中如何使用私有变量 -
求解器中如何使用私有变量@东岳 您好,我仅在createfields.h中定义这个成员函数,
inline const volScalarField& G() const { return G_; }
但是编译无法通过,出现错误
In file included from radiationFoam.C:45:0: createFields.H: In function ‘int main(int, char**)’: createFields.H:49:1: error: a function-definition is not allowed here before ‘{’ token {
此外,yourClass指的是什么?fvDOM?
-
求解器中如何使用私有变量我想在自己的求解器中使用incident radiation 'G',它在'fvDOM.H'中是一个private data
相关代码如下:
/*---------------------------------------------------------------------------*\ Class fvDOM Declaration \*---------------------------------------------------------------------------*/ class fvDOM : public radiationModel { // Private data //- Incident radiation [W/m2] volScalarField G_; ………………………………………………… //- Const access to incident radiation field inline const volScalarField& G() const;
在我的求解器中,我打算调用G来计算温度:
T=pow(G/(4*sigma),0.25);
但G是否要定义?如何进行读取?
-
overInterDyMFoam求解器报错明白了,谢谢!
-
overInterDyMFoam求解器报错top { type totalPressure; p0 uniform 0; U U; phi phi; rho none; psi none; gamma 1; value uniform 0; }
改成top
{ type totalPressure; p0 uniform 0; }
就不报错了,不知道是什么原因。
-
overInterDyMFoam求解器报错是的,我设置的水池顶部的边界条件是totalPressure,代码里也没有psi变量。
-
overInterDyMFoam求解器报错我在openfoam-v1702版本中使用求解器overInterDyMFoam模拟一个两相流问题,添加了一个温度方程,网格用ICEM和starccm+分别做了一遍,导入openfoam后,求解过程中报错。结果如下:请问是什么问题?大概从哪方面入手解决。谢谢。
Create time Create mesh for time = 0 Selecting dynamicFvMesh dynamicOversetFvMesh Selecting motion solver: multiSolidBodyMotionSolver Selecting solid-body motion function linearMotion Applying solid body motion linearMotion to 8709 points of cellZone movingZone PIMPLE: no residual control data found. Calculations will employ 2 corrector loops Reading field p_rgh Reading field U Reading/calculating face flux field phi Creating cellMask field to block out hole cells inverseDistance : detected 1 mesh regions zone:0 nCells:294994 voxels:(66 66 66) bb:(-0.500003 -0.200003 -0.600003) (2.5 0.800003 0.600003) Overset analysis : nCells : 294994 calculated : 288000 interpolated : 0 (interpolated from local:0 mixed local/remote:0 remote:0) hole : 6994 Creating interpolatedCells field Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian Reading field T Selecting turbulence model type laminar Selecting laminar stress model Stokes Reading g Reading hRef Calculating field g.h No MRF models present No finite volume options present DICPCG: Solving for pcorr, Initial residual = 1, Final residual = 5.02939e+06, No Iterations 1001 Reading/calculating face velocity Uf Courant Number mean: 0 max: 0 Starting time loop Courant Number mean: 0 max: 0 Interface Courant Number mean: 0 max: 0 deltaT = 0.0120482 Time = 0.0120482 PIMPLE: iteration 1 inverseDistance : detected 1 mesh regions zone:0 nCells:294994 voxels:(66 66 66) bb:(-0.500003 -0.200003 -0.600003) (2.5 0.800003 0.600003) Overset analysis : nCells : 294994 calculated : 288000 interpolated : 0 (interpolated from local:0 mixed local/remote:0 remote:0) hole : 6994 Execution time for mesh.update() = 3.08 s smoothSolver: Solving for alpha.water, Initial residual = 0, Final residual = 0, No Iterations 0 Phase-1 volume fraction = 1 Min(alpha.water) = 1 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 1 Min(alpha.water) = 1 Max(alpha.water) = 1 DILUPBiCG: Solving for T, Initial residual = 0.449627, Final residual = 1.05799e-09, No Iterations 4 Begin change rhok End change rhok --> FOAM FATAL ERROR: request for volScalarField none from objectRegistry region0 failed available objects of type volScalarField are 20 ( rhok alpha.water_0 interfaceProperties:K alpha.water rho rAU cellMask p_rgh interpolatedCells nu gh nu1 p rho_0 nu2 T T_0 alpha.air ((alpha.water*Cp)+(alpha.air*Cp)) div(phiHbyA) ) From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&, bool) const [with Type = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/tan/OpenFOAM/OpenFOAM-v1706/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 239. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&, bool) const at ??:? #3 ? at totalPressureFvPatchScalarField.C:? #4 Foam::totalPressureFvPatchScalarField::updateCoeffs(Foam::Field<double> const&, Foam::Field<Foam::Vector<double> > const&) at ??:? #5 Foam::fvMatrix<double>::fvMatrix(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:? #6 Foam::fv::gaussLaplacianScheme<double, Foam::SymmTensor<double> >::fvmLaplacianUncorrected(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #7 Foam::fv::gaussLaplacianScheme<double, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #8 ? at ??:? #9 ? at ??:? #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #11 ? at ??:? 已放弃 (核心已转储)
之后只用overInterDyMFoam求解,还是相同的问题 request for volScalarField none from objectRegistry region0 failed。请问是什么问题?大概从哪方面入手解决。谢谢。
-
OpenFOAM后处理计算热流我想从gradTx场获得某个面上的热流,请问openfoam中有现成工具实现吗?functionObject可以吗?目前只找到计算受力的。
-
如何用Paraview显示face label?请问paraview可以显示某个face在constant/polyMesh/faces中的face label吗?可以用其他后处理软件实现相同功能吗?我想用topoSet labelToFace提取一些面组成一个边界面。
-
overPimpleDyMFoam计算时压力正负交替出现请问使用overPimpleDyMFoam求解器计算运动物体周围流场时,压力场正负交替出现是什么问题?修改了div(phi,U)的离散格式后也没什么效果,该如何解决?谢谢。
-
OpenFOAM重叠网格好的,多谢,我试一试。
-
OpenFOAM重叠网格我想用snappyHexMesh做一个导入stl几何形体的组件网格,用blockMesh做背景网格,之后设置重叠网格算例。
但如果先用snappyHexMesh,后用blockMesh,组件网格就被背景网格覆盖了;如果先做背景网格,后做组件网格,用snappyHexMesh后两套网格合在一起,也不能进行后续求解。 -
OpenFOAM重叠网格背景网格和组件网格分别生成,重叠区域的边界设置成overset,边界处求解,中间重叠的部分插值。我对求解器内部求解过程不是很清楚。之前用blockMesh生成2个重叠的block,重叠区域的边界设置成overset,可以求解。
-
OpenFOAM重叠网格请问OpenFOAM中如何将2套网格合在一起,并且保留原来的特征,但不是像mergeMesh那样将boundary合并。我先用snappyHexMesh做了移动的网格,之后用blockMesh做背景网格,发现之前的网格被覆盖了;如果先用blockMesh做2套网格,再用snappyHexMesh,发现2套网格合并在一起。我用的版本是OpenFOAM-v1706。