30 #include "navier_stokes.h"
33 #include "meshes/triangle_mesh.h"
37 using namespace oomph;
61 template<
class ELEMENT>
70 const string& element_file_name,
71 const string& poly_file_name);
87 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
88 for (
unsigned inod=0;inod<num_nod;inod++)
90 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
102 for (
unsigned ibound=0;ibound<mesh_pt()->nboundary();ibound++)
104 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
105 for (
unsigned inod=0;inod<num_nod;inod++)
110 double y=mesh_pt()->boundary_node_pt(ibound,inod)->x(1);
111 double veloc=(y-y_min)*(y_max-y);
112 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,veloc);
117 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
120 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(1,0.0);
127 void actions_after_adapt();
145 void doc_solution(DocInfo& doc_info);
163 template<
class ELEMENT>
165 const string& node_file_name,
166 const string& element_file_name,
167 const string& poly_file_name)
170 Problem::Max_residuals=1000.0;
179 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
180 Bulk_mesh_pt->spatial_error_estimator_pt() = error_estimator_pt;
183 Problem::mesh_pt() = Bulk_mesh_pt;
195 unsigned num_bound = mesh_pt()->nboundary();
196 for(
unsigned ibound=0;ibound<num_bound;ibound++)
198 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
199 for (
unsigned inod=0;inod<num_nod;inod++)
204 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
208 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
215 unsigned n_element = mesh_pt()->nelement();
219 for(
unsigned e=0;e<n_element;e++)
222 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
230 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
238 template<
class ELEMENT>
248 unsigned num_bound = mesh_pt()->nboundary();
249 for(
unsigned ibound=0;ibound<num_bound;ibound++)
251 unsigned num_nod= mesh_pt()->nboundary_node(ibound);
252 for (
unsigned inod=0;inod<num_nod;inod++)
257 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
261 mesh_pt()->boundary_node_pt(ibound,inod)->pin(1);
268 unsigned n_element = mesh_pt()->nelement();
272 for(
unsigned e=0;e<n_element;e++)
275 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
283 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
292 template<
class ELEMENT>
303 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
305 some_file.open(filename);
306 mesh_pt()->output(some_file,npts);
310 sprintf(filename,
"%s/norm%i.dat",doc_info.directory().c_str(),
312 some_file.open(filename);
313 double norm_soln=0.0;
314 mesh_pt()->compute_norm(norm_soln);
315 some_file << sqrt(norm_soln) << std::endl;
316 cout <<
"Norm of computed solution: " << sqrt(norm_soln) << endl;
339 int main(
int argc,
char* argv[])
343 CommandLineArgs::setup(argc,argv);
349 std::string error_message =
350 "Wrong number of command line arguments.\n";
352 "Must specify the following file names \n";
354 "filename.node then filename.ele then filename.poly\n";
356 throw OomphLibError(error_message,
357 OOMPH_CURRENT_FUNCTION,
358 OOMPH_EXCEPTION_LOCATION);
363 string node_file_name(argv[1]);
364 string element_file_name(argv[2]);
365 string poly_file_name(argv[3]);
375 doc_info.set_directory(
"RESLT");
381 const unsigned max_adapt = 3;
389 problem(node_file_name, element_file_name, poly_file_name);
393 problem(node_file_name, element_file_name, poly_file_name);
396 problem.
mesh_pt()->output_boundaries(
"RESLT/boundaries.dat");
406 problem.newton_solve(max_adapt);
409 problem.newton_solve();
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
TriangleMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh.
Z2ErrorEstimator * error_estimator_pt
Error estimator.
~FlowPastBoxProblem()
Destructor (empty)
void actions_after_newton_solve()
Update the after solve (empty)
RefineableTriangleMesh< ELEMENT > * Bulk_mesh_pt
Pointer to the bulk mesh.
void actions_before_newton_solve()
Update the problem specs before solve. Re-set velocity boundary conditions just to be on the safe sid...
RefineableTriangleMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh.
FlowPastBoxProblem(const string &node_file_name, const string &element_file_name, const string &poly_file_name)
Constructor: Pass filenames for mesh.
void actions_after_adapt()
void doc_solution(DocInfo &doc_info)
Doc the solution.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
int main(int argc, char *argv[])
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
Namespace for physical parameters.
double Re
Reynolds number.
////////////////////////////////////////////////////////////////////// //////////////////////////////...