CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

magneticFoam problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2019, 19:56
Default magneticFoam problem
  #1
New Member
 
Luis Lencina
Join Date: May 2010
Posts: 12
Rep Power: 16
LUIS1717 is on a distinguished road
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:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in /lib64/libc.so.6
#3 Foam:ICPreconditioner::calcReciprocalD(Foam::Fie ld<double>&, Foam::lduMatrix const&) at ??:?
#4 Foam:ICPreconditioner:ICPreconditioner(Foam::l duMatrix::solver const&, Foam::dictionary const&) at ??:?
#5 Foam::lduMatrix:reconditioner::addsymMatrixConst ructorToTable<Foam:ICPreconditioner>::New(Foam:: lduMatrix::solver const&, Foam::dictionary const&) at ??:?
#6 Foam::lduMatrix:reconditioner::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
Attached Files
File Type: zip magSandbox.zip (6.7 KB, 0 views)
File Type: zip magneticFoam.zip (10.3 KB, 1 views)
LUIS1717 is offline   Reply With Quote

Old   April 28, 2019, 09:00
Default
  #2
New Member
 
Luis Lencina
Join Date: May 2010
Posts: 12
Rep Power: 16
LUIS1717 is on a distinguished road
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]);
}
}
}
LUIS1717 is offline   Reply With Quote

Reply

Tags
magneticfoam, surfacescalarfields


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 06:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


All times are GMT -4. The time now is 00:49.