关于更改oscillatingDisplacement实现边界运动的问题
-
在oscillatingDisplacement的基础上更改,希望实现边界运动方式是时间和空间的函数f(x,t);
void oscillatingDynamicPointPatchVectorField::updateCoeffs() { if (this->updated()) { return; } const pointPatch& p = this->patch(); const polyMesh& mesh = this->internalField().mesh()(); const Time& t = mesh.time(); scalar x = p.x(); Field<vector>::operator=(amplitude_*cos(omega_*t.value()))*sin((x-0.1)*6.28/0.1)); fixedValuePointPatchField<vector>::updateCoeffs(); }
编译后报错:
pointPatchFields/derived/oscillatingDynamic/oscillatingDynamicPointPatchVectorField.C: In member function ‘virtual void Foam::oscillatingDynamicPointPatchVectorField::updateCoeffs()’: pointPatchFields/derived/oscillatingDynamic/oscillatingDynamicPointPatchVectorField.C:112:21: error: ‘const class Foam::pointPatch’ has no member named ‘x’ scalar x = p.x(); ^ pointPatchFields/derived/oscillatingDynamic/oscillatingDynamicPointPatchVectorField.C:114:87: error: invalid operands of types ‘void’ and ‘Foam::doubleScalar {aka double}’ to binary ‘operator*’ ld<vector>::operator=(amplitude_*cos(omega_*t.value()))*sin((x-0.1)*6.28/0.1)); ^
主要是不知如何定义调用空间位置;求助各位老师同学们。谢谢
-
编译成功后,试算出现如下问题:
#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::smoothSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:? #4 Foam::fvMatrix<double>::solveSegregated(Foam::dictionary const&) at ??:? #5 Foam::fvMatrix<double>::solve(Foam::dictionary const&) at ??:? #6 Foam::fvMatrix<double>::solve() at ??:? #7 Foam::SolverPerformance<double> Foam::solve<double>(Foam::tmp<Foam::fvMatrix<double> > const&) at ??:? #8 Foam::LESModels::kEqn<Foam::IncompressibleTurbulenceModel<Foam::transportModel> >::correct() at ??:? #9 ? at ??:? #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #11 ? at ??:? 浮点数例外 (核心已转储)
应该是fvsolution里的设置有问题,但不清楚如何更改,求助
-
@东岳 老师你好
对边界运动的代码修改后,又出现了以下错误:--> FOAM FATAL ERROR: given patch field does not correspond to the meshPoints. Field size: 0 meshPoints size: 4221 From function void Foam::pointPatchField<Type>::setInInternalField(Foam::Field<Type2>&, const Foam::Field<Type2>&, const labelList&) const [with Type1 = Foam::Vector<double>; Type = Foam::Vector<double>; Foam::labelList = Foam::List<int>] in file /home/dyfluid/OpenFOAM/OpenFOAM-6/src/OpenFOAM/lnInclude/pointPatchField.C at line 283. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 void Foam::pointPatchField<Foam::Vector<double> >::setInInternalField<Foam::Vector<double> >(Foam::Field<Foam::Vector<double> >&, Foam::Field<Foam::Vector<double> > const&) const at ??:? #3 Foam::oscillatingDynamicPointPatchVectorField::updateCoeffs() at ??:? #4 Foam::displacementLaplacianFvMotionSolver::solve() at ??:? #5 Foam::motionSolver::newPoints() at ??:? #6 Foam::dynamicMotionSolverFvMesh::update() at ??:? #7 ? at ??:? #8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #9 ? at ??:? 已放弃 (核心已转储)
好像是边界位置没有对应的网格点......
-
之前的错误通过以下可以解决:
scalarField xCoord = patch().localPoints().component(vector::X);
获取边界位置点的坐标;
这次同样编译成功了,但是一试算,就出现问题了;#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::GAMGSolver::scale(Foam::Field<double>&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::Field<double> const&, unsigned char) const at ??:? #4 Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMatrix::smoother> const&, Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const at ??:? #5 Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:? #6 Foam::fvMatrix<double>::solveSegregated(Foam::dictionary const&) at ??:? #7 Foam::fvMatrix<double>::solve(Foam::dictionary const&) at ??:? #8 ? at ??:? #9 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #10 ? at ??:? 浮点数例外 (核心已转储)