Skip to content

Commit a216359

Browse files
committed
first 6dofs version that is advancing in time. tolerances in DAE solver have been invreased to 1e-2/1e-3
git-svn-id: svn://svn.sissa.it/openship@562 958231e9-8e66-0410-a4a0-f664109d2741
1 parent 4320542 commit a216359

8 files changed

Lines changed: 1480 additions & 352 deletions

include/boat_model.h

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

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

46-
gp_Trsf set_current_position(const Point<3> &translation_vect, const double &trim);
46+
gp_Trsf set_current_position(const Point<3> &translation_vect,
47+
const double &quaternion_scalar,
48+
const Point<3> &quaternion_vect);
4749

4850
//private:
4951
// keel intersection with undisturbed free surface at bow

include/free_surface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ public NewtonArgument
461461

462462
TopLoc_Location restart_hull_location;
463463
Point<3> restart_hull_displacement;
464+
Point<3> restart_hull_quat_vector;
465+
double restart_hull_quat_scalar;
464466
Point<3> restart_transom_center_point;
465467
Point<3> restart_transom_left_point;
466468
Point<3> restart_transom_right_point;

include/numerical_towing_tank.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,15 @@ double assigned_sink;
328328
// hydrostatic equilibrium position (which is assumed to be the angular
329329
// position assigned in the CAD file)
330330
double assigned_trim;
331+
332+
// hull moments of inertia
333+
double Ixx;
334+
double Ixy;
335+
double Ixz;
336+
double Iyy;
337+
double Iyz;
338+
double Izz;
339+
331340
// here we have the maximum aspect ratio allowed for the cells
332341
double max_aspect_ratio;
333342
// the next is a factor determining the inclination of the mesh longitudinal

include/restart_nonlinear_problem_diff.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public NewtonArgument
9393
}
9494

9595
// we now add the rigid modes dofs
96-
for (unsigned int d=0; d<6; ++d)
96+
for (unsigned int d=0; d<13; ++d)
9797
{
9898
rigid_modes_indices.insert(d);
9999
}
@@ -163,7 +163,7 @@ public NewtonArgument
163163
phi_indices.size()+
164164
rigid_modes_indices.size());
165165
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;
166+
line_lengths[i] = 40;
167167
for (unsigned int i=0; i<rigid_modes_indices.size(); ++i)
168168
line_lengths[i+2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()] =
169169
2*water_line_indices.size()+3*bow_stern_indices.size()+water_indices.size()+phi_indices.size()+rigid_modes_indices.size();

source/boat_model.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
#include <GeomConvert.hxx>
8585
#include <Geom_BSplineSurface.hxx>
8686
#include <BRepAdaptor_Curve.hxx>
87+
#include <gp_Quaternion.hxx>
8788

8889
#include <deal.II/grid/grid_reordering.h>
8990
#include <deal.II/grid/grid_tools.h>
@@ -805,15 +806,15 @@ cout<<"UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"<<endl;
805806
return hydrostatic_force;
806807
}
807808

808-
gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const double &trim)
809+
gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect,
810+
const double &quaternion_scalar,
811+
const Point<3> &quaternion_vect)
809812
{
810813

811-
//here we prepare the rotation of the boat of the requested trim angle
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);
814+
//here we prepare the rotation of the boat of the requested trim angle
815+
gp_Quaternion rot_quaternion(quaternion_vect(0), quaternion_vect(1), quaternion_vect(2), quaternion_scalar);
815816
gp_Trsf rotation;
816-
rotation.SetRotation(rot_axis,trim);
817+
rotation.SetRotation(rot_quaternion);
817818
//we first get the full transformation currently applied to the shape
818819
TopLoc_Location prev_L = reference_loc;
819820
gp_Trsf prev_Transf = prev_L.Transformation();
@@ -838,6 +839,14 @@ gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const
838839
keel_edge.Location(new_L);
839840
current_loc = new_L;
840841

842+
// SHOULD WE PRINT THE EULER ANGLES UP HERE? IS THE FACT WE HAVE A X AXIS
843+
// DIRECTED BOW TO STERN GOING TO CHANGE SOMETHING?
844+
double yaw_angle, pitch_angle, roll_angle;
845+
rot_quaternion.GetEulerAngles(gp_YawPitchRoll, yaw_angle, pitch_angle, roll_angle);
846+
cout<<"Current Yaw Angle: "<<yaw_angle<<endl;
847+
cout<<"Current Pitch Angle: "<<pitch_angle<<endl;
848+
cout<<"Current Roll Angle: "<<roll_angle<<endl;
849+
841850

842851
if (is_transom)
843852
{
@@ -904,7 +913,7 @@ gp_Trsf BoatModel::set_current_position(const Point<3> &translation_vect, const
904913

905914

906915

907-
return current_loc.Transformation();
916+
return this_transf;//current_loc.Transformation();
908917
}
909918

910919

0 commit comments

Comments
 (0)