magneticFoam problem
2 Attachment(s)
Hi everyone,
I am trying to solve a magnetic problem with openfoam 1812, I download a case file that i found in the forum, and i found some problems with the code and the input. I attach both. The problem that i cannot solve is that the facezones generated by toposet program use the global index of the mesh. When i try to set the surfacescalarfield murf usign the operator[] it only contains the internal surfacemesh, so it try to write outside the vector lenght. i add this lines to createFields.H Info<<"mesh "<<mesh.faces().size()<<endl; Info<<"murf "<<murf.size()<<endl; and the output is mesh 40200 murf 19800 so the program crash when it try to set a face beyond 19800. #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in /lib64/libc.so.6 #3 Foam::DICPreconditioner::calcReciprocalD(Foam::Fie ld<double>&, Foam::lduMatrix const&) at ??:? #4 Foam::DICPreconditioner::DICPreconditioner(Foam::l duMatrix::solver const&, Foam::dictionary const&) at ??:? #5 Foam::lduMatrix::preconditioner::addsymMatrixConst ructorToTable<Foam::DICPreconditioner>::New(Foam:: lduMatrix::solver const&, Foam::dictionary const&) at ??:? #6 Foam::lduMatrix::preconditioner::New(Foam::lduMatr ix::solver const&, Foam::dictionary const&) at ??:? #7 Foam::PCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:? #8 Foam::fvMatrix<double>::solveSegregated(Foam::dict ionary const&) at ??:? #9 Foam::fvMatrix<double>::solveSegregatedOrCoupled(F oam::dictionary const&) at ??:? #10 Foam::fvMesh::solve(Foam::fvMatrix<double>&, Foam::dictionary const&) const at ??:? #11 ? at ??:? #12 __libc_start_main in /lib64/libc.so.6 #13 ? at ??:? Floating point exception (core dumped) Can anyone help me? thanks |
Well, now I understand the problem, the first nodes are always the internal faces, then there are the boundary faces. I don't know how to set the boundary nodes, but i change this and it works
forAll(magnets, i) { label magnetZonei = mesh.faceZones().findZoneID(magnets[i].name()); if (magnetZonei == -1) { FatalIOErrorInFunction(transportProperties) << "Cannot find faceZone for magnet " << magnets[i].name() << exit(FatalIOError); } const labelList& faces = mesh.faceZones()[magnetZonei]; const scalar muri = magnets[i].mur(); const scalar Mri = magnets[i].Mr().value(); const vector& orientationi = magnets[i].orientation(); const surfaceVectorField& Sf = mesh.Sf(); forAll(faces, i) { label facei = faces[i]; if(facei < murf.size()){ murf[facei] = muri; Mrf[facei] = Mri*(orientationi & Sf[facei]); } } } |
All times are GMT -4. The time now is 14:41. |