26 #ifndef OOMPH_FSI_HEADER
27 #define OOMPH_FSI_HEADER
31 #include <oomph-lib-config.h>
91 std::set<std::pair<Data*, unsigned>>& paired_load_data) = 0;
101 std::set<std::pair<Data*, unsigned>>& paired_pressure_data) = 0;
234 const unsigned& ndim_fluid);
241 const double&
q()
const
517 Vector<std::set<FiniteElement*>>
const& external_elements_pt,
518 std::set<std::pair<Data*, unsigned>>& paired_iteraction_data);
523 Vector<std::set<FiniteElement*>>
const& external_elements_pt,
524 std::set<Data*>& external_geometric_data_pt);
559 namespace FSI_functions
600 template<
class FLUID_ELEMENT,
unsigned DIM_FLUID>
604 Mesh*
const& fluid_mesh_pt,
606 const unsigned& face = 0)
612 problem_pt, boundary_in_fluid_mesh, fluid_mesh_pt, solid_mesh_pt, face);
631 template<
class FLUID_ELEMENT,
unsigned DIM_FLUID>
634 const unsigned& boundary_in_fluid_mesh,
635 Mesh*
const& fluid_mesh_pt,
636 Mesh*
const& solid_mesh_pt,
637 const unsigned& face = 0)
643 problem_pt, boundary_in_fluid_mesh, fluid_mesh_pt, solid_mesh_pt, face);
664 template<
class SOLID_ELEMENT,
unsigned DIM_SOLID>
668 Mesh*
const& solid_mesh_pt,
675 problem_pt, b_solid_fsi, solid_mesh_pt, lagrange_multiplier_mesh_pt, 0);
691 template<
class SOLID_ELEMENT,
unsigned DIM_SOLID>
694 const unsigned& b_solid_fsi,
695 Mesh*
const& solid_mesh_pt,
696 Mesh*
const& lagrange_multiplier_mesh_pt)
702 problem_pt, b_solid_fsi, solid_mesh_pt, lagrange_multiplier_mesh_pt, 0);
728 std::ofstream some_file;
747 << doc_info.
number() <<
".dat";
748 some_file.open(
filename.str().c_str());
749 fluid_mesh_pt->
output(some_file, npts);
757 std::map<Data*, Node*> solid_node_pt;
758 unsigned nnod = wall_mesh_pt->
nnode();
759 for (
unsigned j = 0;
j < nnod;
j++)
771 std::map<Data*, FiniteElement*> internal_data_element_pt;
772 unsigned nelemf = fluid_mesh_pt->
nelement();
773 for (
unsigned e = 0;
e < nelemf;
e++)
776 for (
unsigned k = 0;
k < ninternal;
k++)
778 internal_data_element_pt[fluid_mesh_pt->
element_pt(
e)
787 std::set<int> procs = fluid_mesh_pt->external_halo_proc();
788 for (std::set<int>::iterator it = procs.begin(); it != procs.end(); it++)
791 unsigned n_ext_halo_f = fluid_mesh_pt->nexternal_halo_element(d);
792 for (
unsigned e = 0;
e < n_ext_halo_f;
e++)
795 fluid_mesh_pt->external_halo_element_pt(d,
e)->ninternal_data();
796 for (
unsigned k = 0;
k < ninternal;
k++)
798 internal_data_element_pt[fluid_mesh_pt
799 ->external_halo_element_pt(d,
e)
800 ->internal_data_pt(
k)] =
802 fluid_mesh_pt->external_halo_element_pt(d,
e));
811 unsigned nelem = wall_mesh_pt->
nelement();
812 for (
unsigned e = 0;
e < nelem;
e++)
818 << doc_info.
number() <<
"-" <<
e <<
".dat";
819 some_file.open(
filename.str().c_str());
828 if (!el_pt->is_halo())
833 unsigned ndim_local = el_pt->
dim();
841 std::map<FiniteElement*, bool> element_internal_data_has_been_plotted;
846 some_file <<
"ZONE I=" << nint << std::endl;
847 for (
unsigned i = 0;
i < nint;
i++)
849 for (
unsigned j = 0;
j < ndim_local;
j++)
854 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
856 some_file <<
x[
j] <<
" ";
858 some_file <<
i << std::endl;
869 unsigned n_loaded_face = 2;
872 for (
unsigned face = 0; face < n_loaded_face; face++)
874 some_file <<
"ZONE I=" << nint << std::endl;
875 for (
unsigned i = 0;
i < nint;
i++)
887 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
889 some_file <<
x[
j] <<
" ";
891 some_file <<
i << std::endl;
899 std::map<Data*, unsigned> data_count;
900 std::map<FiniteElement*, unsigned> internal_data_count;
904 unsigned nexternal_interaction_field =
905 external_interaction_field_data_pt.size();
906 for (
unsigned l = 0; l < nexternal_interaction_field; l++)
908 data_count[external_interaction_field_data_pt[l]]++;
909 if (internal_data_element_pt
910 [external_interaction_field_data_pt[l]] != 0)
913 [internal_data_element_pt
914 [external_interaction_field_data_pt[l]]]++;
922 unsigned nexternal_interaction_geom =
923 external_interaction_geometric_data_pt.size();
924 for (
unsigned l = 0; l < nexternal_interaction_geom; l++)
926 data_count[external_interaction_geometric_data_pt[l]]++;
927 if (internal_data_element_pt
928 [external_interaction_geometric_data_pt[l]] != 0)
931 [internal_data_element_pt
932 [external_interaction_geometric_data_pt[l]]]++;
939 for (std::map<Data*, unsigned>::iterator it = data_count.begin();
940 it != data_count.end();
943 Data* unique_data_pt = it->first;
947 Node* node_pt =
dynamic_cast<Node*
>(unique_data_pt);
956 if (solid_node_pt[unique_data_pt] != 0)
958 some_file <<
"TEXT ";
959 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
961 some_file <<
label[
j] << solid_node_pt[unique_data_pt]->x(
j)
965 some_file <<
"CS=GRID, HU=FRAME, H=2.5, AN=MIDCENTER, C=GREEN "
966 <<
"T=\"" << it->second <<
"\"" << std::endl;
971 else if (internal_data_element_pt[unique_data_pt] != 0)
973 if (!element_internal_data_has_been_plotted
974 [internal_data_element_pt[unique_data_pt]])
976 some_file <<
"TEXT ";
979 internal_data_element_pt[unique_data_pt];
983 double s_max = fluid_el_pt->
s_max();
984 double s_min = fluid_el_pt->
s_min();
987 for (
unsigned k = 0;
k < ndim_eulerian;
k++)
989 s_fluid[
k] = 0.5 * (s_max + s_min) + 0.1 * (s_max - s_min);
992 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
994 some_file <<
label[
j] << x_fluid[
j] <<
" ";
997 some_file <<
"CS=GRID, HU=FRAME, H=2.5, AN=MIDCENTER, C=BLUE "
998 <<
"T=\"" << it->second
1004 element_internal_data_has_been_plotted
1005 [internal_data_element_pt[unique_data_pt]] =
true;
1010 std::ostringstream error_message;
1012 <<
"Data that affects the load on an FSIWallElement\n"
1013 <<
"is neither a (fluid) Node, nor a SolidNode nor\n"
1014 <<
"internal Data in a (fluid) element\n"
1015 <<
"I don't think this should happen..." << std::endl;
1025 some_file <<
"TEXT ";
1026 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
1028 some_file <<
label[
j] << node_pt->
x(
j) <<
", ";
1030 some_file <<
"CS=GRID, HU=FRAME, H=2.5, AN=MIDCENTER, C=RED "
1031 <<
"T=\"" << it->second <<
"\"" << std::endl;
1035 #ifdef OOMPH_HAS_MPI
1050 unsigned nnode_fluid = fluid_mesh_pt->
nnode();
1051 for (
unsigned j = 0;
j < nnode_fluid;
j++)
1054 NODE* node_pt =
dynamic_cast<NODE*
>(fluid_mesh_pt->
node_pt(
j));
1056 unsigned ndim_eulerian = node_pt->
ndim();
1061 << doc_info.
number() <<
"-" << count <<
".dat";
1062 some_file.open(
filename.str().c_str());
1063 some_file <<
"ZONE" << std::endl;
1064 for (
unsigned i = 0;
i < ndim_eulerian;
i++)
1066 some_file << node_pt->x(
i) <<
" ";
1068 some_file << std::endl;
1076 std::map<Data*, unsigned> data_count;
1077 unsigned ngeom = geom_obj_pt.size();
1078 for (
unsigned i = 0;
i < ngeom;
i++)
1080 unsigned ngeom_dat = geom_obj_pt[
i]->ngeom_data();
1081 for (
unsigned k = 0;
k < ngeom_dat;
k++)
1083 data_count[geom_obj_pt[
i]->geom_data_pt(
k)]++;
1088 bool written_something =
false;
1092 for (std::map<Data*, unsigned>::iterator it = data_count.begin();
1093 it != data_count.end();
1096 Data* unique_data_pt = it->first;
1099 if (solid_node_pt[unique_data_pt] != 0)
1101 some_file <<
"TEXT ";
1102 for (
unsigned j = 0;
j < ndim_eulerian;
j++)
1104 some_file <<
label[
j] << solid_node_pt[unique_data_pt]->x(
j)
1108 some_file <<
"CS=GRID, HU=FRAME, H=2.5, AN=MIDCENTER, C=GREEN "
1109 <<
"T=\"" << unique_data_pt->
nvalue() <<
"\""
1113 written_something =
true;
1118 std::ostringstream warn_message;
1120 <<
"Info: Position of a fluid node is affected by Data that"
1121 <<
"is not a SolidNode --> Can't plot this Data. \n\n"
1122 <<
"(You may also want to check if this is exepcted or likely "
1124 <<
"indicate a bug in your code...)" << std::endl;
1126 "FSI_functions::doc_fsi()",
1136 if (written_something) count++;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void load(Archive &ar, ParticleHandler &handl)
Definition: Particles.h:21
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
Definition: oomph_utilities.h:499
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
Definition: element_with_external_element.h:56
Vector< double > & external_element_local_coord(const unsigned &interaction_index, const unsigned &ipt)
Definition: element_with_external_element.h:136
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Definition: element_with_external_element.h:107
Vector< Data * > external_interaction_field_data_pt() const
Definition: element_with_external_element.h:212
void fill_in_jacobian_from_external_interaction_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: element_with_external_element.h:345
bool Add_external_interaction_data
Boolean flag to indicate whether to include the external data.
Definition: element_with_external_element.h:508
Vector< Data * > external_interaction_geometric_data_pt() const
Definition: element_with_external_element.h:251
virtual void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)=0
void operator=(const FSIFluidElement &)=delete
Broken assignment operator.
FSIFluidElement()
Constructor.
Definition: fsi.h:66
FSIFluidElement(const FSIFluidElement &)=delete
Broken copy constructor.
virtual void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)=0
virtual void get_load(const Vector< double > &s, const Vector< double > &N, Vector< double > &load)=0
void enable_fluid_loading_on_both_sides()
Definition: fsi.cc:138
FSIWallElement(const FSIWallElement &)=delete
Broken copy constructor.
void reset_after_nodal_fd()
Definition: fsi.h:408
void reset_after_external_fd()
Definition: fsi.h:386
void setup_fsi_wall_element(const unsigned &nlagr_solid, const unsigned &ndim_fluid)
Definition: fsi.cc:121
void update_in_external_interaction_geometric_fd(const unsigned &i)
Definition: fsi.h:440
virtual ~FSIWallElement()
Empty virtual destructor for safety.
Definition: fsi.h:226
void fluid_load_vector(const unsigned &intpt, const Vector< double > &N, Vector< double > &load)
Definition: fsi.cc:162
bool only_front_is_loaded_by_fluid() const
Definition: fsi.h:269
void reset_after_external_interaction_field_fd()
Definition: fsi.h:429
void disable_shear_stress_in_jacobian()
Definition: fsi.h:303
void include_external_load_data()
Definition: fsi.h:290
bool Ignore_shear_stress_in_jacobian
Definition: fsi.h:547
void identify_all_geometric_data_for_external_interaction(Vector< std::set< FiniteElement * >> const &external_elements_pt, std::set< Data * > &external_geometric_data_pt)
Definition: fsi.cc:317
void operator=(const FSIWallElement &)=delete
Broken assignment operator.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: fsi.h:323
void update_in_external_fd(const unsigned &i)
After an external data change, update the nodal positions.
Definition: fsi.h:374
void enable_shear_stress_in_jacobian()
Definition: fsi.h:310
void exclude_external_load_data()
Definition: fsi.h:282
void reset_in_external_interaction_geometric_fd(const unsigned &i)
Definition: fsi.h:449
void reset_in_solid_position_fd(const unsigned &i)
Definition: fsi.h:471
void reset_after_internal_fd()
Definition: fsi.h:364
void identify_all_field_data_for_external_interaction(Vector< std::set< FiniteElement * >> const &external_elements_pt, std::set< std::pair< Data *, unsigned >> &paired_iteraction_data)
Definition: fsi.cc:279
void update_in_external_interaction_field_fd(const unsigned &i)
After an external field data change, update the nodal positions.
Definition: fsi.h:417
double * Q_pt
Definition: fsi.h:540
const double & q() const
Definition: fsi.h:241
static double Default_Q_Value
Definition: fsi.h:528
void reset_after_external_interaction_geometric_fd()
Definition: fsi.h:452
double *& q_pt()
Definition: fsi.h:248
void reset_in_external_interaction_field_fd(const unsigned &i)
Definition: fsi.h:426
void update_in_nodal_fd(const unsigned &i)
After a nodal data change, update the nodal positions.
Definition: fsi.h:396
void update_in_solid_position_fd(const unsigned &i)
After an internal data change, update the nodal positions.
Definition: fsi.h:462
FSIWallElement()
Definition: fsi.h:212
void update_in_internal_fd(const unsigned &i)
After an internal data change, update the nodal positions.
Definition: fsi.h:352
static bool Dont_warn_about_missing_adjacent_fluid_elements
Static flag that allows the suppression of warning messages.
Definition: fsi.h:208
void reset_after_solid_position_fd()
Definition: fsi.h:474
void node_update_adjacent_fluid_elements()
Definition: fsi.cc:230
void reset_in_internal_fd(const unsigned &i)
Definition: fsi.h:361
bool Only_front_is_loaded_by_fluid
Definition: fsi.h:535
void reset_in_nodal_fd(const unsigned &i)
Definition: fsi.h:405
void reset_in_external_fd(const unsigned &i)
Definition: fsi.h:383
void describe_local_dofs(std::ostream &out, const std::string ¤t_string) const
Definition: fsi.cc:78
Definition: elements.h:1313
virtual void fill_in_jacobian_from_nodal_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: elements.cc:3660
virtual double s_min() const
Min value of local coordinate.
Definition: elements.h:2793
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3962
unsigned dim() const
Definition: elements.h:2611
virtual double s_max() const
Max. value of local coordinate.
Definition: elements.h:2803
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
Definition: elements.h:2484
virtual void fill_in_contribution_to_residuals(Vector< double > &residuals)
Definition: elements.h:357
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
virtual void get_residuals(Vector< double > &residuals)
Definition: elements.h:980
unsigned ninternal_data() const
Return the number of internal data objects.
Definition: elements.h:823
void fill_in_jacobian_from_external_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
Definition: elements.cc:1199
void fill_in_jacobian_from_internal_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
Definition: elements.cc:1102
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
void output(std::ostream &outfile)
Output for all elements.
Definition: mesh.cc:2027
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
Definition: oomph_definitions.h:222
Definition: oomph_definitions.h:267
Definition: problem.h:151
Definition: elements.h:3561
bool Solve_for_consistent_newmark_accel_flag
Definition: elements.h:4302
virtual void fill_in_jacobian_from_solid_position_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: elements.cc:6985
void fill_in_jacobian_for_newmark_accel(DenseMatrix< double > &jacobian)
Definition: elements.cc:7227
SolidNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global SolidNode.
Definition: mesh.h:2594
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
Definition: nodes.h:1765
@ N
Definition: constructor.cpp:22
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
string filename
Definition: MergeRestartFiles.py:39
double Strouhal_for_no_slip
Definition: fsi.cc:39
void setup_solid_elements_for_displacement_bc(Problem *problem_pt, const Vector< unsigned > &b_solid_fsi, Mesh *const &solid_mesh_pt, Vector< Mesh * > &lagrange_multiplier_mesh_pt)
Definition: fsi.h:665
void apply_no_slip_on_moving_wall(Node *node_pt)
Definition: fsi.cc:48
void setup_fluid_load_info_for_solid_elements(Problem *problem_pt, Vector< unsigned > &boundary_in_fluid_mesh, Mesh *const &fluid_mesh_pt, Vector< Mesh * > &solid_mesh_pt, const unsigned &face=0)
Definition: fsi.h:601
void doc_fsi(Mesh *fluid_mesh_pt, SolidMesh *wall_mesh_pt, DocInfo &doc_info)
Definition: fsi.h:724
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
void setup_bulk_elements_adjacent_to_face_mesh(Problem *problem_pt, Vector< unsigned > &boundary_in_bulk_mesh, Mesh *const &bulk_mesh_pt, Vector< Mesh * > &face_mesh_pt, const unsigned &interaction=0)
/ Templated helper functions for multi-domain methods using locate_zeta
Definition: multi_domain.template.cc:72
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
void set(Container &c, Position position, const Value &value)
Definition: stdlist_overload.cpp:36
std::ofstream out("Result.txt")
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2