42 #include "meshes/fish_mesh.h"
49 using namespace oomph;
66 void get_source(
const Vector<double>& x,
double& source)
84 template<
class ELEMENT>
102 fish_mesh_pt()->node_update();
109 fish_mesh_pt()->node_update();
125 return *Load_pt->value_pt(0);
132 return static_cast<ElasticallySupportedRingElement*
>(fish_mesh_pt()->
133 fish_back_pt())->y_c();
157 Mesh* Fish_back_mesh_pt;
179 template<
class ELEMENT>
181 bool fix_position,
string directory_name) : Fix_position(fix_position)
185 Doc_info.set_directory(directory_name);
192 sprintf(filename,
"%s/trace.dat",directory_name.c_str());
195 <<
"VARIABLES=\"load\",\"y<sub>circle</sub>\",\"u<sub>control</sub>\""
204 GeomObject* fish_back_pt=
new ElasticallySupportedRingElement(x_c,
y_c,r_back);
207 Fish_mesh_pt=
new MacroElementNodeUpdateRefineableFishMesh<ELEMENT>(fish_back_pt);
228 fish_mesh_pt()->spatial_error_estimator_pt()=
new Z2ErrorEstimator;
236 unsigned nnod=
fish_mesh_pt()->finite_element_pt(0)->nnode();
242 cout << std::endl <<
"Control node is located at: "
255 dynamic_cast<ElasticallySupportedRingElement*
>(
273 dynamic_cast<ElasticallySupportedRingElement*
>(
Fish_mesh_pt->fish_back_pt())->
281 for(
unsigned ibound=0;ibound<num_bound;ibound++)
283 unsigned num_nod=
fish_mesh_pt()->nboundary_node(ibound);
284 for (
unsigned inod=0;inod<num_nod;inod++)
292 for(
unsigned ibound=0;ibound<num_bound;ibound++)
295 unsigned num_nod=
fish_mesh_pt()->nboundary_node(ibound);
296 for (
unsigned inod=0;inod<num_nod;inod++)
298 fish_mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
304 for(
unsigned i=0;i<n_element;i++)
307 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(
fish_mesh_pt()->element_pt(i));
314 cout <<
"Number of equations: " << assign_eqn_numbers() << std::endl;
323 template<
class ELEMENT>
337 template<
class ELEMENT>
350 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
352 some_file.open(filename);
353 fish_mesh_pt()->output(some_file,npts);
359 <<
static_cast<ElasticallySupportedRingElement*
>(fish_mesh_pt()->
360 fish_back_pt())->load()
362 <<
static_cast<ElasticallySupportedRingElement*
>(fish_mesh_pt()->
363 fish_back_pt())->y_c()
364 <<
" " << Doc_node_pt->value(0) << std::endl;
382 template<
class ELEMENT>
387 bool fix_position=
true;
392 if (CommandLineArgs::Argc>1)
407 problem.refine_uniformly();
408 problem.refine_uniformly();
418 if (CommandLineArgs::Argc>1) nstep=1;
421 double dyc=0.6/double(nstep-1);
424 for (
unsigned istep=0;istep<nstep;istep++)
427 unsigned max_solve=2;
428 problem.newton_solve(max_solve);
445 template<
class ELEMENT>
450 bool fix_position=
false;
454 if (CommandLineArgs::Argc>1)
463 problem.refine_uniformly();
464 problem.refine_uniformly();
470 unsigned max_solve=2;
471 problem.newton_solve(max_solve);
485 int main(
int argc,
char* argv[])
489 CommandLineArgs::setup(argc,argv);
492 typedef MacroElementNodeUpdateElement<RefineableQPoissonElement<2,3> > ELEMENT;
496 demo_fish_poisson<ELEMENT>(
"RESLT");
499 demo_elastic_fish_poisson<ELEMENT>(
"RESLT_coupled");
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
DocInfo & doc_info()
Access to DocInfo object.
double & y_c()
Return value of the vertical displacement of the ring that represents the fish's back.
double & load()
Return value of the "load" on the elastically supported ring that represents the fish's back.
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 ...
virtual ~RefineableFishPoissonProblem()
Destructor.
bool Fix_position
Is the position of the fish back prescribed?
void actions_before_newton_solve()
Update the problem specs before solve: Update nodal positions.
Node * Doc_node_pt
Node at which the solution of the Poisson equation is documented.
void doc_solution()
Doc the solution.
AlgebraicRefineableFishMesh< ELEMENT > * fish_mesh_pt()
virtual ~RefineableFishPoissonProblem()
Destructor.
MacroElementNodeUpdateRefineableFishMesh< ELEMENT > * Fish_mesh_pt
Pointer to fish mesh.
void actions_after_newton_solve()
Update the problem specs after solve (empty)
void actions_before_newton_convergence_check()
Update after Newton step: Update in response to possible changes in the wall shape.
Data * Load_pt
Pointer to data item that stores the "load" on the fish back.
ofstream Trace_file
Trace file.
MacroElementNodeUpdateRefineableFishMesh< ELEMENT > * fish_mesh_pt()
Mesh * Fish_back_mesh_pt
Pointer to single-element mesh that stores the GeneralisedElement that represents the fish back.
DocInfo Doc_info
Doc info object.
AlgebraicRefineableFishMesh< ELEMENT > * Fish_mesh_pt
Pointer to fish mesh.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void get_source(const Vector< double > &x, double &source)
Const source function.
double Strength
Strength of source function: default value 1.0.
int main(int argc, char *argv[])
Driver for "elastic" fish poisson solver with adaptation. If there are any command line arguments,...
void demo_elastic_fish_poisson(const string &directory_name)
Demonstrate how to solve coupled "elastic" 2D Poisson problem in deformable fish-shaped domain with m...
void demo_fish_poisson(const string &directory_name)
///////////////////////////////////////////////////////////////////// ///////////////////////////////...