48 main(
int argc,
char *argv[])
50 const double D = 0.01;
59 const double deltat = 1e-3;
60 const double tend = 5.5;
62 double m0 = p0*V0/287.1/T;
63 double m1 = p1*V1/287.1/T;
73 cout <<
"inputs:" << endl;
74 std::vector<std::string> iNames =
model.inputs_names();
75 for(
int i=0; i<
model.inputs_size(); i++)
77 cout << iNames[i] << endl;
80 cout <<
"outputs:" << endl;
81 std::vector<std::string> oNames =
model.outputs_names();
82 for(
int i=0; i<
model.outputs_size(); i++)
84 cout << oNames[i] << endl;
87 cout <<
"parameters:" << endl;
88 std::vector<std::string> pNames =
model.parameters_names();
89 for(
int i=0; i<
model.parameters_size(); i++)
91 cout << pNames[i] << endl;
94 size_t Dpos =
model.inputs_argPos(
"D");
95 size_t rho0Pos =
model.inputs_argPos(
"rho0");
96 size_t p0Pos =
model.inputs_argPos(
"p0");
97 size_t p1Byp0Pos =
model.inputs_argPos(
"p1Byp0");
101 while(t + deltat < tend + 1e-10)
108 model.inputs_set(Dpos, D);
109 model.inputs_set(rho0Pos, rho0);
110 model.inputs_set(p0Pos, p0);
111 model.inputs_set(p1Byp0Pos, p1/p0);
117 double mdot =
model.outputs_get(0);
125 model.inputs_set(Dpos, D);
126 model.inputs_set(rho0Pos, rho1);
127 model.inputs_set(p0Pos, p1);
128 model.inputs_set(p1Byp0Pos, p0/p1);
134 double mdot =
model.outputs_get(0);
145 cout <<
"t = " << t <<
" rho0 = " << rho0 <<
" p0 = " << p0 <<
" p1 = " << p1 << endl;
150 return e.errorCode();
int main(int argc, char *argv[])
Reads parameters. Creates struts and walls. Saves foam morphology to a file.