![]() |
![]() |
![]() |
Demo: A 3-D steady state diffusion code
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()); |
Prescription p(ms,data.getDataFile()); |
Vect<double> u(ms); Vect<double> bc(ms), bf(ms), sf(ms,BOUNDARY_SIDE_DOF,1); |
p.get(BOUNDARY_CONDITION,bc); p.get(BODY_FORCE,bf); p.get(BOUNDARY_FORCE,sf,0); |
DC3DT4 eq(ms,u); |
eq.setInput(BOUNDARY_CONDITION,bc); eq.setInput(SOURCE,bf); eq.setInput(FLUX,sf); |
eq.setTerms(DIFFUSION); eq.setSolver(CG_SOLVER,DILU_PREC); |
eq.run();
if (Verbosity>4)
cout << u;
if (save_flag)
saveField(u,"beam.pos",GMSH);
|
<?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>2</verbose>
<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.
![]() |
![]() |
![]() |