43 #include "meshes/fish_mesh.h" 47 using namespace oomph;
64 void get_source(
const Vector<double>& x,
double& source)
78 template<
class ELEMENT>
80 public virtual SolidMesh
95 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
96 FishMesh<ELEMENT>(back_pt,time_stepper_pt),
97 RefineableFishMesh<ELEMENT>(back_pt,time_stepper_pt)
102 set_lagrangian_nodal_coordinates();
111 double xi_nose = this->Domain_pt->xi_nose();
112 double xi_tail = this->Domain_pt->xi_tail();
113 Undeformed_domain_pt=
new FishDomain(undeformed_back_pt,xi_nose,xi_tail);
116 unsigned n_element=this->nelement();
117 for (
unsigned e=0;e<n_element;e++)
120 ELEMENT* el_pt=
dynamic_cast<ELEMENT*
>(this->element_pt(e));
125 el_pt->set_undeformed_macro_elem_pt(
126 Undeformed_domain_pt->macro_element_pt(e));
134 delete Undeformed_domain_pt;
180 template<
class ELEMENT>
197 void doc_solution(DocInfo& doc_info);
213 bool update_all_solid_nodes=
true;
214 mesh_pt()->node_update(update_all_solid_nodes);
217 mesh_pt()->set_lagrangian_nodal_coordinates();
225 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
226 mesh_pt()->element_pt());
246 template<
class ELEMENT>
257 Fish_back_pt=
new Circle(x_c,y_c,r_back);
261 GeomObject* undeformed_fish_back_pt=
new Circle(x_c,y_c,r_back);
266 undeformed_fish_back_pt);
274 unsigned nnod=mesh_pt()->finite_element_pt(0)->nnode();
277 Doc_node_pt=mesh_pt()->finite_element_pt(0)->node_pt(nnod-1);
280 cout << std::endl <<
"Control node is located at: " 281 << Doc_node_pt->x(0) <<
" " << Doc_node_pt->x(1) << std::endl << std::endl;
285 Z2ErrorEstimator* error_estimator_pt=
new Z2ErrorEstimator;
286 mesh_pt()->spatial_error_estimator_pt()=error_estimator_pt;
289 if (CommandLineArgs::Argc>1)
291 mesh_pt()->max_permitted_error()=0.05;
292 mesh_pt()->min_permitted_error()=0.005;
294 mesh_pt()->doc_adaptivity_targets(cout);
303 unsigned num_bound = mesh_pt()->nboundary();
304 for(
unsigned ibound=0;ibound<num_bound;ibound++)
306 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
307 for (
unsigned inod=0;inod<num_nod;inod++)
309 mesh_pt()->boundary_node_pt(ibound,inod)->pin(0);
315 for(
unsigned ibound=0;ibound<num_bound;ibound++)
318 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
319 for (
unsigned inod=0;inod<num_nod;inod++)
321 mesh_pt()->boundary_node_pt(ibound,inod)->set_value(0,0.0);
326 unsigned n_element = mesh_pt()->nelement();
327 for(
unsigned i=0;i<n_element;i++)
330 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
341 for(
unsigned ibound=0;ibound<num_bound;ibound++)
343 unsigned num_nod=mesh_pt()->nboundary_node(ibound);
344 for (
unsigned inod=0;inod<num_nod;inod++)
346 for (
unsigned i=0;i<2;i++)
348 mesh_pt()->boundary_node_pt(ibound,inod)->pin_position(i);
354 for(
unsigned i=0;i<n_element;i++)
357 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
360 el_pt->constitutive_law_pt() =
365 PVDEquationsBase<2>::pin_redundant_nodal_solid_pressures(
366 mesh_pt()->element_pt());
370 cout << assign_eqn_numbers() << std::endl;
379 bool update_all_solid_nodes=
true;
380 mesh_pt()->node_update(update_all_solid_nodes);
383 mesh_pt()->set_lagrangian_nodal_coordinates();
391 template<
class ELEMENT>
401 sprintf(filename,
"%s/soln%i.dat",doc_info.directory().c_str(),
403 some_file.open(filename);
404 mesh_pt()->output(some_file,npts);
411 <<
static_cast<Circle*
>(mesh_pt()->fish_back_pt())->y_c()
412 <<
" " << Doc_node_pt->value(0) << std::endl;
420 template<
class ELEMENT>
428 doc_info.set_directory(
"RESLT");
435 sprintf(filename,
"%s/trace.dat",doc_info.directory().c_str());
436 Trace_file.open(filename);
438 Trace_file <<
"VARIABLES=\"y<sub>circle</sub>\",\"u<sub>control</sub>\"" 443 for(
unsigned i=0;i<nstep;i++)
450 doc_solution(doc_info);
454 Fish_back_pt->y_c()+=0.3;
464 int main(
int argc,
char* argv[])
468 CommandLineArgs::setup(argc,argv);
482 RefineablePseudoSolidNodeUpdateElement<RefineableQPoissonElement<2,3>,
483 RefineableQPVDElement<2,3> >
ElasticFishMesh(GeomObject *back_pt, GeomObject *undeformed_back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Build underlying adaptive fish mesh and then set current Eulerian coordinates to be the ...
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
double Strength
Strength of source function: default value 1.0.
Refineable fish mesh upgraded to become a solid mesh.
void get_source(const Vector< double > &x, double &source)
Const source function.
Domain * Undeformed_domain_pt
int main(int argc, char *argv[])
virtual ~ElasticFishMesh()
Destructor: Kill "undeformed" Domain.
Namespace for const source term in Poisson equation.
double Nu
Poisson's ratio.