Skip to content

Commit ef0bf4b

Browse files
committed
first WaveBEM version with FSI up and running. Rotations are yet to be added, plus we need to add rigid motions in output files and correct hull nodes velocities in .vtu outputs. But apparently it is working
git-svn-id: svn://svn.sissa.it/openship@560 958231e9-8e66-0410-a4a0-f664109d2741
1 parent 9bf7f8a commit ef0bf4b

7 files changed

Lines changed: 1495 additions & 444 deletions

File tree

include/boat_model.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BoatModel{
4343

4444
Point<3> compute_hydrostatic_moment(const double &sink);
4545

46-
gp_Trsf set_current_position(const double &sink);
46+
gp_Trsf set_current_position(const Point<3> &translation_vect, const double &trim);
4747

4848
//private:
4949
// keel intersection with undisturbed free surface at bow
@@ -143,6 +143,11 @@ class BoatModel{
143143
// flag to determine if we have a transom stern or not
144144
bool is_transom;
145145

146+
double boat_mass;
147+
148+
Point<3> current_left_transom_tangent;
149+
150+
Point<3> current_right_transom_tangent;
146151

147152

148153
};

include/free_surface.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,14 @@ public NewtonArgument
309309
Functions::ParsedFunction<dim> initial_wave_potential;
310310
Functions::ParsedFunction<dim> initial_norm_potential_grad;
311311
Functions::ParsedFunction<dim> inflow_norm_potential_grad;
312+
Functions::ParsedFunction<1> hull_x_axis_translation;
313+
Functions::ParsedFunction<1> hull_y_axis_translation;
314+
Functions::ParsedFunction<1> hull_z_axis_translation;
315+
316+
bool is_hull_x_translation_imposed;
317+
bool is_hull_y_translation_imposed;
318+
bool is_hull_z_translation_imposed;
312319

313-
314320
std::string node_displacement_type;
315321

316322
SolverControl solver_control;
@@ -454,7 +460,12 @@ public NewtonArgument
454460
double adaptive_ref_limit;
455461

456462
TopLoc_Location restart_hull_location;
457-
463+
Point<3> restart_hull_displacement;
464+
Point<3> restart_transom_center_point;
465+
Point<3> restart_transom_left_point;
466+
Point<3> restart_transom_right_point;
467+
Point<3> restart_transom_left_tangent;
468+
Point<3> restart_transom_right_tangent;
458469

459470
};
460471

include/restart_nonlinear_problem_diff.h

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public NewtonArgument
3636
bow_stern_indices.clear();
3737
water_indices.clear();
3838
phi_indices.clear();
39+
rigid_modes_indices.clear();
40+
3941
if (!comp_dom.no_boat)
4042
for (unsigned int i=0; i<comp_dom.dh.n_dofs(); ++i)
4143
{
@@ -89,7 +91,12 @@ public NewtonArgument
8991
}
9092
}
9193
}
92-
94+
95+
// we now add the rigid modes dofs
96+
for (unsigned int d=0; d<6; ++d)
97+
{
98+
rigid_modes_indices.insert(d);
99+
}
93100

94101
free_surf_jac_x_delta.reinit(free_surf_y.size());
95102
free_surf_res.reinit(free_surf_y.size());
@@ -130,6 +137,13 @@ public NewtonArgument
130137
count++;
131138
}
132139

140+
for (std::set <unsigned int>::iterator pos = rigid_modes_indices.begin(); pos != rigid_modes_indices.end(); ++pos)
141+
{
142+
unsigned int i=*pos;
143+
indices_map[i+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs()] = count;
144+
count++;
145+
}
146+
133147

134148
//cout<<" MAP "<<endl;
135149
//for (std::map <unsigned int,unsigned int>::iterator pos = indices_map.begin(); pos != indices_map.end(); ++pos)
@@ -143,9 +157,20 @@ public NewtonArgument
143157
//cout<<water_indices.size()<<endl;
144158
//cout<<phi_indices.size()<<endl;
145159
//cout<<2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()+dphi_dn_indices.size()<<endl;
146-
jacobian_sparsity_pattern.reinit(2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size(),
147-
2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size(),
148-
30);
160+
std::vector<unsigned int> line_lengths(2*water_line_indices.size()+
161+
3*bow_stern_indices.size()+
162+
water_indices.size()+
163+
phi_indices.size()+
164+
rigid_modes_indices.size());
165+
for (unsigned int i=0; i<2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size(); ++i)
166+
line_lengths[i] = 30;
167+
for (unsigned int i=0; i<rigid_modes_indices.size(); ++i)
168+
line_lengths[i+2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()] =
169+
2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()+rigid_modes_indices.size();
170+
171+
jacobian_sparsity_pattern.reinit(2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()+rigid_modes_indices.size(),
172+
2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()+rigid_modes_indices.size(),
173+
line_lengths );
149174

150175
count = 0;
151176
for (std::set <unsigned int>::iterator pos = water_line_indices.begin(); pos != water_line_indices.end(); ++pos)
@@ -196,7 +221,15 @@ public NewtonArgument
196221
count++;
197222
}
198223

199-
224+
for (std::set <unsigned int>::iterator pos = rigid_modes_indices.begin(); pos != rigid_modes_indices.end(); ++pos)
225+
{
226+
unsigned int i=*pos;
227+
for (SparsityPattern::iterator col=free_surf_jacobian_dot.get_sparsity_pattern().begin(i+comp_dom.vector_dh.n_dofs());
228+
col!=free_surf_jacobian_dot.get_sparsity_pattern().end(i+comp_dom.vector_dh.n_dofs()); ++col)
229+
if ( indices_map.count(col->column()) )
230+
jacobian_sparsity_pattern.add(count,indices_map.find(col->column())->second);
231+
count++;
232+
}
200233
jacobian_sparsity_pattern.compress();
201234
jacobian_matrix.reinit(jacobian_sparsity_pattern);
202235

@@ -250,6 +283,7 @@ public NewtonArgument
250283
std::set<unsigned int> bow_stern_indices;
251284
std::set<unsigned int> water_indices;
252285
std::set<unsigned int> phi_indices;
286+
std::set<unsigned int> rigid_modes_indices;
253287
SparsityPattern jacobian_sparsity_pattern;
254288
SparseMatrix<double> jacobian_matrix;
255289

source/boat_model.cc

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ void BoatModel::start_iges_model(std::string igesFileName,
288288
}
289289

290290
Point<3> hs_force = compute_hydrostatic_force(0.0);
291+
boat_mass = hs_force(2)/9.81;
291292
Point<3> hs_moment = compute_hydrostatic_moment(0.0);
292293

293294
double rot_axis_x_coor = -hs_moment(1)/hs_force(2);
@@ -804,26 +805,26 @@ cout<<"UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"<<endl;
804805
return hydrostatic_force;
805806
}
806807

807-
gp_Trsf BoatModel::set_current_position(const double &sink)
808+
gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const double &trim)
808809
{
809810

810811
//here we prepare the rotation of the boat of the requested trim angle
811-
//gp_Pnt rot_center(0.0,0.0,0.0);
812-
//gp_Dir rot_dir(0.0,1.0,0.0);
813-
//gp_Ax1 rot_axis(rot_center, rot_dir);
814-
//gp_Trsf rotation;
815-
//rotation.SetRotation(rot_axis,assigned_trim);
812+
gp_Pnt rot_center(0.0,0.0,0.0);
813+
gp_Dir rot_dir(0.0,1.0,0.0);
814+
gp_Ax1 rot_axis(rot_center, rot_dir);
815+
gp_Trsf rotation;
816+
rotation.SetRotation(rot_axis,trim);
816817
//we first get the full transformation currently applied to the shape
817818
TopLoc_Location prev_L = reference_loc;
818819
gp_Trsf prev_Transf = prev_L.Transformation();
819820

820821
// here we prepare the translation of the boat of the requested sink
821822
gp_Trsf translation;
822-
gp_Vec vrt_displ(0.0,0.0,sink);
823+
gp_Vec vrt_displ(translation_vect(0),translation_vect(1),translation_vect(2));
823824
translation.SetTranslation(vrt_displ);
824825

825-
826-
gp_Trsf this_transf = translation;
826+
// the rotation and translation are combined in a single transformation
827+
gp_Trsf this_transf = translation*rotation;
827828

828829
// the rotation and translation are combined in a single transformation
829830
gp_Trsf new_Transf = this_transf*prev_Transf;
@@ -867,6 +868,27 @@ gp_Trsf BoatModel::set_current_position(const double &sink)
867868
ExcMessage("Transom edges don't possess a single intersection with horizontal plane: is transom not immersed any more?"));
868869
transomLeft = IntersectorLeft.Point(1);
869870
transomRight = IntersectorRight.Point(1);
871+
872+
double param;
873+
double u;
874+
double v;
875+
876+
IntersectorLeft.Parameters(1, u, v, param);
877+
gp_Vec current_left_transom_tangent_vec = left_transom_bspline->DN(param,1);
878+
gp_Dir current_left_transom_tangent_dir(current_left_transom_tangent_vec);
879+
current_left_transom_tangent_dir.Transform(current_loc);
880+
current_left_transom_tangent = Point<3>(current_left_transom_tangent_dir.X(),
881+
current_left_transom_tangent_dir.Y(),
882+
current_left_transom_tangent_dir.Z());
883+
884+
IntersectorRight.Parameters(1, u, v, param);
885+
gp_Vec current_right_transom_tangent_vec = right_transom_bspline->DN(param,1);
886+
gp_Dir current_right_transom_tangent_dir(current_right_transom_tangent_vec);
887+
current_right_transom_tangent_dir.Transform(current_loc);
888+
current_right_transom_tangent = Point<3>(current_right_transom_tangent_dir.X(),
889+
current_right_transom_tangent_dir.X(),
890+
current_right_transom_tangent_dir.Z());
891+
870892
transomLeft.Transform(current_loc);
871893
transomRight.Transform(current_loc);
872894
CurrentPointLeftTransom = Pnt(transomLeft);

0 commit comments

Comments
 (0)