41 #include "meshes/fish_mesh.h" 48 using namespace oomph;
67 source = -Strength*(1.0+x[0]*x[1]);
83 template<
class ELEMENT>
93 const bool& fix_position,
const string& directory_name,
94 const unsigned& i_case);
103 fish_mesh_pt()->node_update();
112 fish_mesh_pt()->node_update();
124 return *Load_pt->value_pt(0);
133 fish_back_pt())->y_c();
151 unsigned n_element = fish_mesh_pt()->nelement();
152 for(
unsigned i=0;i<n_element;i++)
155 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(fish_mesh_pt()->element_pt(i));
160 el_pt->evaluate_shape_derivs_by_direct_fd();
161 if (!done) std::cout <<
"\n\n [CR residuals] Direct FD" << std::endl;
164 else if ( (Case_id==1) || (Case_id==2) )
167 bool i_know_what_i_am_doing=
true;
168 el_pt->evaluate_shape_derivs_by_chain_rule(i_know_what_i_am_doing);
171 el_pt->enable_always_evaluate_dresidual_dnodal_coordinates_by_fd();
172 if (!done) std::cout <<
"\n\n [CR residuals] Chain rule and FD" 177 el_pt->disable_always_evaluate_dresidual_dnodal_coordinates_by_fd();
178 if (!done) std::cout <<
"\n\n [CR residuals] Chain rule and analytic" 183 else if ( (Case_id==3) || (Case_id==4) )
186 bool i_know_what_i_am_doing=
true;
187 el_pt->evaluate_shape_derivs_by_fastest_method(i_know_what_i_am_doing);
190 el_pt->enable_always_evaluate_dresidual_dnodal_coordinates_by_fd();
191 if (!done) std::cout <<
"\n\n [CR residuals] Fastest and FD" 196 el_pt->disable_always_evaluate_dresidual_dnodal_coordinates_by_fd();
197 if (!done) std::cout <<
"\n\n [CR residuals] Fastest and analytic" 243 template<
class ELEMENT>
245 const bool& fix_position,
const string& directory_name,
246 const unsigned& i_case) : Fix_position(fix_position), Case_id(i_case)
251 Doc_info.set_directory(directory_name);
258 sprintf(filename,
"%s/trace.dat",directory_name.c_str());
262 <<
"VARIABLES=\"load\",\"y<sub>circle</sub>\",\"u<sub>control</sub>\"" 274 Fish_mesh_pt=
new AlgebraicRefineableFishMesh<ELEMENT>(fish_back_pt);
296 fish_mesh_pt()->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
303 unsigned nnod=
fish_mesh_pt()->finite_element_pt(0)->nnode();
309 cout << std::endl <<
"Control node is located at: " 311 << std::endl << std::endl;
348 for(
unsigned ibound=0;ibound<num_bound;ibound++)
350 unsigned num_nod=
fish_mesh_pt()->nboundary_node(ibound);
351 for (
unsigned inod=0;inod<num_nod;inod++)
359 for(
unsigned ibound=0;ibound<num_bound;ibound++)
362 unsigned num_nod=
fish_mesh_pt()->nboundary_node(ibound);
363 for (
unsigned inod=0;inod<num_nod;inod++)
365 fish_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
371 for(
unsigned i=0;i<n_element;i++)
374 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
fish_mesh_pt()->element_pt(i));
384 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
393 template<
class ELEMENT>
407 template<
class ELEMENT>
422 sprintf(filename,
"%s/soln_%i_%i.dat",
Doc_info.directory().c_str(),
427 sprintf(filename,
"%s/soln%i.dat",
Doc_info.directory().c_str(),
430 some_file.open(filename);
438 fish_back_pt())->
load()
441 fish_back_pt())->
y_c()
463 template<
class ELEMENT>
468 bool fix_position=
true;
476 problem.refine_uniformly();
477 problem.refine_uniformly();
489 double dyc=0.6/double(nstep-1);
492 if (CommandLineArgs::Argc>1) nstep=1;
494 for (
unsigned istep=0;istep<nstep;istep++)
497 unsigned max_solve=2;
498 problem.newton_solve(max_solve);
514 template<
class ELEMENT>
519 for (
unsigned i_case=0;i_case<5;i_case++)
522 std::cout <<
"[CR residuals] " << std::endl;
523 std::cout <<
"[CR residuals]==================================================" 525 std::cout <<
"[CR residuals] " << std::endl;
527 bool fix_position=
false;
537 problem.refine_uniformly();
538 problem.refine_uniformly();
545 unsigned max_solve=2;
546 problem.newton_solve(max_solve);
562 int main(
int argc,
char* argv[])
565 CommandLineArgs::setup(argc,argv);
568 typedef AlgebraicElement<RefineableQPoissonElement<2,3> > ELEMENT;
571 demo_fish_poisson<ELEMENT>(
"RESLT");
574 demo_elastic_fish_poisson<ELEMENT>(
"RESLT_coupled");
void actions_after_newton_solve()
Update the problem specs after solve (empty)
void set_shape_deriv_method()
Helper fct to set method for evaluation of shape derivs.
RefineableFishPoissonProblem(const bool &fix_position, const string &directory_name, const unsigned &i_case)
Constructor: Bool flag specifies if position of fish back is prescribed or computed from the coupled ...
void demo_elastic_fish_poisson(const string &directory_name)
Node * Doc_node_pt
Node at which the solution of the Poisson equation is documented.
void demo_fish_poisson(const string &directory_name)
void actions_before_newton_convergence_check()
Update after Newton step: Update mesh in response to possible changes in the wall shape...
virtual ~RefineableFishPoissonProblem()
Destructor.
double & y_c()
Return value of the vertical displacement of the ring that represents the fish's back.
double Strength
Strength of source function: default value 1.0.
DocInfo & doc_info()
Access to DocInfo object.
void get_source(const Vector< double > &x, double &source)
Const source function.
int main(int argc, char *argv[])
AlgebraicRefineableFishMesh< ELEMENT > * fish_mesh_pt()
void actions_before_newton_solve()
Update the problem specs before solve: Update mesh.
ofstream Trace_file
Trace file.
double & load()
Return value of the "load" on the elastically supported ring.
DocInfo Doc_info
Doc info object.
bool Fix_position
Is the position of the fish back prescribed?
Data * Load_pt
Pointer to data item that stores the "load" on the fish back.
void doc_solution()
Doc the solution.
AlgebraicRefineableFishMesh< ELEMENT > * Fish_mesh_pt
Pointer to fish mesh.
Namespace for const source term in Poisson equation.
GeneralCircle "upgraded" to a GeneralisedElement: Circular ring whose position is given by The ring...