34 #include "navier_stokes.h" 37 #include "meshes/triangle_mesh.h" 41 using namespace oomph;
65 template<
class ELEMENT>
74 const string& element_file_name,
75 const string& poly_file_name);
91 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
92 for (
unsigned inod=0;inod<num_nod;inod++)
94 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
106 for (
unsigned ibound=0;ibound<mesh_pt()->nboundary();ibound++)
108 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
109 for (
unsigned inod=0;inod<num_nod;inod++)
114 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
115 double veloc=(y-y_min)*(y_max-y);
116 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,veloc);
121 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
124 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
131 void actions_after_adapt();
149 void doc_solution(DocInfo& doc_info);
167 template<
class ELEMENT>
169 const string& node_file_name,
170 const string& element_file_name,
171 const string& poly_file_name)
174 Problem::Max_residuals=1000.0;
183 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
184 Bulk_mesh_pt->spatial_error_estimator_pt() = error_estimator_pt;
187 Problem::mesh_pt() = Bulk_mesh_pt;
199 unsigned num_bound = mesh_pt()->nboundary();
200 for(
unsigned ibound=0;ibound<num_bound;ibound++)
202 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
203 for (
unsigned inod=0;inod<num_nod;inod++)
208 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
212 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
219 unsigned n_element = mesh_pt()->nelement();
223 for(
unsigned e=0;e<n_element;e++)
226 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
234 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
242 template<
class ELEMENT>
252 unsigned num_bound = mesh_pt()->nboundary();
253 for(
unsigned ibound=0;ibound<num_bound;ibound++)
255 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
256 for (
unsigned inod=0;inod<num_nod;inod++)
261 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
265 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
272 unsigned n_element = mesh_pt()->nelement();
276 for(
unsigned e=0;e<n_element;e++)
279 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
287 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
296 template<
class ELEMENT>
307 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
309 some_file.open(filename);
310 mesh_pt()->output(some_file,npts);
314 sprintf(filename,
"%s/norm%i.dat",doc_info.directory().c_str(),
316 some_file.open(filename);
317 double norm_soln=0.0;
318 mesh_pt()->compute_norm(norm_soln);
319 some_file << sqrt(norm_soln) << std::endl;
320 cout <<
"Norm of computed solution: " << sqrt(norm_soln) << endl;
343 int main(
int argc,
char* argv[])
347 CommandLineArgs::setup(argc,argv);
353 std::string error_message =
354 "Wrong number of command line arguments.\n";
356 "Must specify the following file names \n";
358 "filename.node then filename.ele then filename.poly\n";
360 throw OomphLibError(error_message,
361 OOMPH_CURRENT_FUNCTION,
362 OOMPH_EXCEPTION_LOCATION);
367 string node_file_name(argv[1]);
368 string element_file_name(argv[2]);
369 string poly_file_name(argv[3]);
379 doc_info.set_directory(
"RESLT");
385 const unsigned max_adapt = 3;
393 problem(node_file_name, element_file_name, poly_file_name);
397 problem(node_file_name, element_file_name, poly_file_name);
400 problem.
mesh_pt()->output_boundaries(
"RESLT/boundaries.dat");
410 problem.newton_solve(max_adapt);
413 problem.newton_solve();
void doc_solution(DocInfo &doc_info)
Doc the solution.
int main(int argc, char *argv[])
Driver for FlowPastBox test problem.
Z2ErrorEstimator * error_estimator_pt
Error estimator.
TriangleMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh.
void actions_before_newton_solve()
Update the problem specs before solve. Re-set velocity boundary conditions just to be on the safe sid...
~FlowPastBoxProblem()
Destructor (empty)
void actions_after_newton_solve()
Update the after solve (empty)
RefineableTriangleMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh.
RefineableTriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the bulk mesh.
double Re
Reynolds number.
FlowPastBoxProblem(const string &node_file_name, const string &element_file_name, const string &poly_file_name)
Constructor: Pass filenames for mesh.
Namespace for physical parameters.
void actions_after_adapt()
Flow past a box in a channel.
Unstructured refineable Triangle Mesh.