![]() |
![]() |
![]() |
Demo: A 2-D incompressible CFD problem using quadrilateral elements
Let us present an OFELI program that solves the 2-D time dependent incompressible Navier-Stokes equations.
#include "OFELI.h" #include "Fluid.h" |
IPF data("tiff2 - 1.0",argv[1]);
Verbosity = data.getVerbose();
int save_flag = data.getSave();
int pres_flag = data.getIntPar(1);
theTimeStep = data.getTimeStep();
theFinalTime = data.getMaxTime();
|
Mesh ms(data.getMeshFile()); |
Vect<double> u(ms), bc(ms), p(ms,NODE_DOF,1);
Prescription pr(ms,data.getDataFile());
pr.get(BOUNDARY_CONDITION,bc);
u.setName("Velocity");
p.setName("Pressure");
|
IOField vf(data.getMeshFile(),data.getString("v_file"),ms,IOField::OUT);
IOField pf(data.getMeshFile(),data.getString("p_file"),ms,IOField::OUT);
|
NSP2DQ41 eq(ms,u); eq.setInput(BOUNDARY_CONDITION,bc); eq.setInput(PRESSURE_FIELD,p); |
TimeLoop {
eq.runOneTimeStep();
|
u.setTime(theTime);
p.setTime(theTime);
if (save_flag) {
v_file.put(u);
p_file.put(p);
}
}
|
<?xml version="1.0" encoding="ISO-8859-1" ?> <OFELI_File> <info> <title></title> <date></date> <author></author> </info> <Project name="cavity"> <time_step value="0.1"/> <max_time value="1.0"/> <verbose value="1"/> <output value="1"/> <mesh_file value="cavity.m"/> <parameter label="v_file" value="cavity.v"/> <parameter label="p_file" value="cavity.p"/> </Project> </OFELI_File> |
Note that only execution and time integration parameters are given. All other data were given through the class User.
![]() |
![]() |
![]() |