![]() |
![]() |
![]() |
This code is developed to solve 3-D steady-state (stationary) heat transfer problems. The code is very similar to previous demo codes: stdc2 and ttd2.
IPF data("std3 - 1.0",argv[1]); int output_flag = data.getOutput(); int save_flag = data.getSave(); |
Mesh ms(data.getMeshFile(),true); |
Prescription p(ms,data.getDataFile()); |
SpMatrix<double> A(ms); Vect<double> u(ms.getNbEq()), b(ms.getNbEq()); |
Vect<double> bc(ms), body_f(ms), bound_f(ms,1,SIDE_FIELD); p.get(BOUNDARY_CONDITION,bc); p.get(BODY_FORCE,body_f); p.get(BOUNDARY_FORCE,bound_f,0); |
MeshElements(ms) { DC3DT4 eq(theElement); eq.Diffusion(); eq.BodyRHS(body_f); eq.updateBC(bc); eq.ElementAssembly(A); eq.ElementAssembly(b); } |
MeshSides(ms) { DC3DT4 eq(theSide); eq.BoundaryRHS(bound_f); eq.SideAssembly(b); } |
double toler = 1.e-8; int nb_it = CG(A,Prec<double>(A,ILU_PREC),b,u,1000,toler,0); cout << "Nb. of iterations: " << nb_it << endl; |
Vect<double> v(ms); v.insertBC(ms,u,bc); |
if (save_flag) { IOField pf(data.getSaveFile(),IOField::OUT); pf.put(NodeVect<double>(ms,v,"Temperature")); } |
<?xml version="1.0" encoding="ISO-8859-1" ?> <OFELI_File> <info> <title></title> <date></date> <author></author> </info> <Project name="beam"> <mesh_file>beam.m</mesh_file> <verbose>1</verbose> <output>0</output> <save>1</save> </Project> <Prescription> <BoundaryCondition code="1">1.0</BoundaryCondition> </Prescription> </OFELI_File> |
In summary, this file looks mainly like the one in the previous example.
![]() |
![]() |
![]() |