小白求助——floatingobject算例浮块突然失去浮体性质
-
@bestucan
感谢回复,我现在解决了这个问题,浮块可以实现上浮了,但是在进一步修改的时候又出现了另外的问题。在水面以上加设了一个垂向震荡物块,水下的物块不变。但是运行报错(图如下第一张)。这个错误网上有人问过,按照我的理解是此时floatingobject在水中的上浮不能进行计算了,可是为啥添加震荡物块之前没问题,之后就不行了呢?是因为一个dynamicMeshDict里不能让两个域运动起来嘛,求大佬解答。下面是报错的结果、动网格文件和模型图。
FoamFile { version 2.0; format ascii; class dictionary; object dynamicMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dynamicFvMesh dynamicMotionSolverFvMesh; motionSolverLibs (rigidBodyMeshMotion); motionSolver rigidBodyMotion; rigidBodyMotionCoeffs { report on; solver { type Newmark; } accelerationRelaxation 0.7; bodies { floatingObject { type cuboid; parent root; // Cuboid dimensions Lx 2; Ly 2; Lz 2; // Density of the cuboid rho 800; // Cuboid mass mass #eval{ $rho*$Lx*$Ly*$Lz }; L ($Lx $Ly $Lz); centreOfMass (0 0 1);// transform (1 0 0 0 1 0 0 0 1) (5 5 2); joint { type composite; joints ( { type Pxyz; } { type Rxyz; } ); } /*restraints { verticalSpring { body floatingObject; sixDoFRigidBodyMotionRestraint linearSpring; anchor (5 5 8); refAttachmentPt (5 5 4); stiffness 2; damping 0.00; restLength 3; } }*/ patches (floatingObject); innerDistance 0.05; outerDistance 5.75; } } } dynamicFvMesh dynamicMotionSolverFvMesh; motionSolverLibs ("libfvMotionSolvers.so"); motionSolver displacementLaplacian; displacementLaplacianCoeffs { diffusivity inverseDistance (Object); } 
-
@李东岳 感谢李老师回复,我零文件下的pointdisplacement代码如下,水中物体的边界类型我一开始设置为calculated,就出现了上面的报错提示,报错后我设置为了固定数值fixedvalue,就可以运行了,但与此带来的就是水中物体失去浮体性质。
dimensions [0 1 0 0 0 0 0]; internalField uniform (0 0 0); boundaryField { stationaryWalls { type fixedValue; value uniform (0 0 0); } atmosphere { type fixedValue; value uniform (0 0 0); } floatingObject { type calculated; value uniform (0 0 0); } Object { type oscillatingDisplacement; omega 6.28; amplitude (0 0 0.5); value uniform (0 0 0); } }
-
myLinearSpring.C 无法编译。
想把它整的能编译就比较麻烦了, 这不是 C++ 而是 makefile 的知识。本来就一个 makefile 的话也不算特别麻烦。 OpenFOAM 自己封装了个 wmake,把 makefile 分放到 Make 文件夹里的 file 和 option 了。
依赖的源文件和库都在那里写着。myLinearSpring.C.dep 就是编译源文件依赖的文件。要么是 myLinearSpring.C 的位置不对,要么是编译路径没配置对。
参考这个,不过这个是 makefile 不是 wmake