/ Title: Static and dynamic pipelay analysis with S-Lay method with fixed and articulated stinger
/ PLDYN test input file: SI units [m,N,sec]

/ Copyright 2021 Ibrahim Konuk
/ model number =<100>=
/ filename = pldynS3_comboeuler.pi


set_param(echo_OFF);


flow_director(to_output="pldyn8SIa_combo: S-Lay with fixed and articulated stinger");
flow_director(to_console="pldyn8SIa_combo: S-Lay with fixed and articulated stinger");


/.......................................................................................
/ first load required data from databases and execute new analysis with fixed stinger ..
/.......................................................................................


/ initial pipe profile determined:
/             deck pitch =<-5>=
/        departure angle =<-34.409>=
/        overband length =<102.657>=
/         sagband length =<1639.17>=
/  overband profile type =<circle>=
/        overband radius =<200>=
/     total model length =<2192.02>=
/            tensioner.x =<40>=
/            tensioner.y =<5>=
/            touchdown.x =<1609.41>=
/            touchdown.y =<-749.634>=

file_operation(open,FILE_NAME=pldynS3_neweuler);

EXIT(CLOSEIFERROR);

/ file_operation(close);

/.......................................................................................
/ modify model 100 for articulated stinger .............................................
/.......................................................................................

 flow_director(to_output="Static analysis with articulated stinger (Loadcase#102)");
 flow_director(to_console="Static analysis with articulated stinger (Loadcase#102)");


 MODEL_SETUP(
/-------------------------------------------
 MODEL_NAME ="TEST_MODEL",
 TITLE ="32 inch pipe 4 Sec Articulated Stinger",
/-------------------------------------------
                  MODEL_NUMBER = 100      ,
                   CASE_NUMBER = 102      ,
              OPTIMIZATION_SET = 100      );
/-------------------------------------------


 PIPELAY_MODEL(
/-------------------------------------------
 LABEL ="TEST",
/-------------------------------------------
                  MODEL_NUMBER = 100      ,
                   CASE_NUMBER = 102      ,
               ANALYSIS_METHOD = 2        ,
                 EQUIPMENT_SET = 100      ,
                     OCEAN_SET = 100      ,
                      LOAD_SET = 100      ,
                    FIXITY_SET = 0        ,
            ELEMENTS_ON_SEABED = 8       ,
                BOTTOM_TENSION = 6.0e+05  );  
/-------------------------------------------



/ release sections (all DOF ) 2,3,4 .....................................................

 STINGER_SETS(
/---------------------------------------------------------------------------------------------------------
  [SET_NUMBER,STINGER_OR,STINGER_NU,JOINT_TYPE,YAW_INITIA,ROLL_INITI,PITCH_INIT,HINGE_OFFSET,     LABEL  ],
/---------------------------------------------------------------------------------------------------------
  (       100,         1,       101,         0, 0.000e+00, 0.000e+00,   -20.000,        3.00, "SECTION#1" ),
  (       100,         2,       102,         1, 0.000e+00, 0.000e+00,   -25.000,        3.00, "SECTION#2" ),
  (       100,         3,       103,         1, 0.000e+00, 0.000e+00,   -30.000,        3.00, "SECTION#3" ),
  (       100,         4,       104,         1, 0.000e+00, 0.000e+00,   -35.000,        3.00, "SECTION#4" ) );
/----------------------------------------------------------------------------------------------------------



/ adjust the buoyancy of sections 2,3,4 .................................................


 STINGER_BUOYANCY_CLASS(
/-------------------------------------------
 LABEL ="STD",
/-------------------------------------------
                  CLASS_NUMBER = 101      ,
                TOTAL_BUOYANCY = 1.50e+05 ,
                    X_B_CENTER = 15.000   ,
                    Y_B_CENTER = -0.750   ,
                    Z_B_CENTER = 0.000    ,
                  TOTAL_WEIGHT = 0.00     ,
                    X_W_CENTER = 0.000e+00,
                    Y_W_CENTER = 0.000    ,
                    Z_W_CENTER = 0.000e+00);
/-------------------------------------------
/ Total value fields =<10>=
/ Total alpha fields =<1>=
/ Total key fields   =<1>=


 STINGER_BUOYANCY_CLASS(
/-------------------------------------------
 LABEL ="STD",
/-------------------------------------------
                  CLASS_NUMBER = 102      ,
                TOTAL_BUOYANCY = 7.50e+05 ,
                    X_B_CENTER = 15.000   ,
                    Y_B_CENTER = -0.750   ,
                    Z_B_CENTER = 0.000    ,
                  TOTAL_WEIGHT = 0.00     ,
                    X_W_CENTER = 0.000e+00,
                    Y_W_CENTER = 0.000    ,
                    Z_W_CENTER = 0.000e+00);
/-------------------------------------------
/ Total value fields =<10>=
/ Total alpha fields =<1>=
/ Total key fields   =<1>=


 STINGER_BUOYANCY_CLASS(
/-------------------------------------------
 LABEL ="STD",
/-------------------------------------------
                  CLASS_NUMBER = 103      ,
                TOTAL_BUOYANCY = -0.50e+04 ,
                    X_B_CENTER = 15.000   ,
                    Y_B_CENTER = -0.750   ,
                    Z_B_CENTER = 0.000    ,
                  TOTAL_WEIGHT = 0.00     ,
                    X_W_CENTER = 0.000e+00,
                    Y_W_CENTER = 0.000    ,
                    Z_W_CENTER = 0.000e+00);
/-------------------------------------------
/ Total value fields =<10>=
/ Total alpha fields =<1>=
/ Total key fields   =<1>=


 STINGER_BUOYANCY_CLASS(
/-------------------------------------------
 LABEL ="STD",
/-------------------------------------------
                  CLASS_NUMBER = 104      ,
                TOTAL_BUOYANCY = 2.50e+05 ,
                    X_B_CENTER = 15.000   ,
                    Y_B_CENTER = -0.750   ,
                    Z_B_CENTER = 0.000    ,
                  TOTAL_WEIGHT = 0.00     ,
                    X_W_CENTER = 0.000e+00,
                    Y_W_CENTER = 0.000    ,
                    Z_W_CENTER = 0.000e+00);
/-------------------------------------------
/ Total value fields =<10>=
/ Total alpha fields =<1>=
/ Total key fields   =<1>=


/ assemble and execute ..................................................................

set_param(echo_ON);

 MODEL_SETUP(ASSEMBLE,MODEL_NUMBER=100);
 / MODEL_SETUP(ASSEMBLE,VERBOSE,MODEL_NUMBER=100);
 MODEL_SETUP(EXECUTE,MODEL_NUMBER=100);
 / 2nd execution


 / save some of the results from the database to the OUTPUT file ........................

  set_param(echo_OFF);

NODAL_OUTPUT(SELECT,TIME_STEP=0.12);
NODAL_OUTPUT([SAVE,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,Z_COORD,DZ_COORD,FROM_SELECTED]);

FORCE_OUTPUT(SELECT,TIME_STEP=0.12);
FORCE_OUTPUT([SAVE,NODE_NUMBE,AXIAL,X_FORCE,Y_FORCE,Z_FORCE,MX_MOMENT,MY_MOMENT,MZ_MOMENT,ARC_LENGTH,FROM_SELECTED]);

STINGER_POSITION(SELECT,TIME_STEP=0.12);
STINGER_POSITION([SAVE,STINGER_OR,YAW_ANGLE,ROLL_ANGLE,TRIM_ANGLE,HINGE_X,HINGE_Y,HINGE_Z,FROM_SELECTED]);

STINGER_FORCES(SELECT,TIME_STEP=0.12);
STINGER_FORCES([SAVE,STINGER_ORD,X_FORCE,Y_FORCE,Z_FORCE,MX_MOMENT,MY_MOMENT, MZ_MOMENT,FROM_SELECTED]);

ROLLER_FORCES(SELECT,TIME_STEP=0.12);
ROLLER_FORCES([SAVE,ROLLER_ORD,  X_FORCE,Y_FORCE,Z_FORCE,CONTACT_EL,LOCATION ,FROM_SELECTED]);

flow_director(to_console="static analysis is completed. results are in OUTPUT");



/.......................................................................................
/ modify model 100 for dynamic analysis with articulated stinger .......................
/.......................................................................................


flow_director(to_output="Preparing for dynamic analysis with articulated stinger");
flow_director(to_console="Preparing for dynamic analysis with articulated stinger");


/ clean load set for conventrated force: force cannot be kept constant during dynamic analysis
 ELEMENT_DATA(delete,DISCRETE_FORCE);


 MODEL_SETUP(
/-------------------------------------------
 MODEL_NAME ="TEST_MODEL",
 TITLE ="Dynamic Analysis with Articulated Stinger",
/-------------------------------------------
                  MODEL_NUMBER = 100      ,
                   CASE_NUMBER = 103      ,
              OPTIMIZATION_SET = 100      );
/-------------------------------------------


 PIPELAY_MODEL(
/-------------------------------------------
 LABEL ="TEST",
/-------------------------------------------
                  MODEL_NUMBER = 100      ,
                   CASE_NUMBER = 103      ,
               ANALYSIS_METHOD = 3        ,
                 EQUIPMENT_SET = 100      ,
                     OCEAN_SET = 100      ,
                      LOAD_SET = 100      ,
                    FIXITY_SET = 0        ,
            ELEMENTS_ON_SEABED = 8        ,
                BOTTOM_TENSION = 6.0e+05  );  
/-------------------------------------------


/ define bottom fixity to replace tension ...............................................

PIPE_FIXITY_SETS(
/-------------------------------------------------------------
  [FIXITY_SET,FIRST_NODE, LAST_NODE,FIXITY_CLA,     LABEL  ],
/-------------------------------------------------------------
  (       100,       100,       100,       100,    "TD#Z"  ) );
/-------------------------------------------------------------

 FIXITY_CLASS(
/-----------------------------------------------------------------------------------
  [CLASS_NUMB,       DOF,FIXITY_TYP, AMPLITUDE,    PERIOD,     PHASE,     LABEL  ],
/-----------------------------------------------------------------------------------
  (       100,         1,         1,       0.0,       0.0,       0.0,  "SEABED"  ) );
/-----------------------------------------------------------------------------------


/ assemble and execute ..................................................................

set_param(echo_ON);

MODEL_SETUP(ASSEMBLE,MODEL_NUMBER=100);

MODEL_SETUP(EXECUTE,MODEL_NUMBER=100);
 / 3rd execution


 / save some of the results from database to an OUTPUT databse ..........................

 set_param(echo_OFF);

/ gives number of record produced by this run:
NODAL_OUTPUT(SELECT,CASE_NUMBER=103);

NODAL_OUTPUT(delete,FROM_SELECTED);

/ gives time series for node position for one node:
NODAL_OUTPUT(SELECT,CASE_NUMBER=103,NODE_NUMBER=500);
NODAL_OUTPUT([save,TIME_STEP,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,FROM_SELECTED]);

NODAL_OUTPUT(delete,FROM_SELECTED);

/ gives select nodal output for one time step and displays important fields:
NODAL_OUTPUT(SELECT,CASE_NUMBER=103,TIME_STEP=30.0);
NODAL_OUTPUT([save,TIME_STEP,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,FROM_SELECTED]);
NODAL_OUTPUT([SAVE,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,Z_COORD,DZ_COORD,FROM_SELECTED]);

/ gives select force output for one time step and displays important fields:
FORCE_OUTPUT(SELECT,CASE_NUMBER=103,TIME_STEP=30.0);
FORCE_OUTPUT([save,TIME_STEP,NODE_NUMBE,AXIAL,X_FORCE,Y_FORCE,MY_MOMENT,MZ_MOMENT,ARC_LENGTH,FROM_SELECTED]);

/ gives time series for stinger section position for one section:
STINGER_POSITION(SELECT,CASE_NUMBER=103,STINGER_ORDER=4);
STINGER_POSITION([save,TIME_STEP,STINGER_OR,YAW_ANGLE,TRIM_ANGLE,HINGE_X,HINGE_Y,FROM_SELECTED]);

/ gives time series for stinger section forces for all sections:
STINGER_FORCES(SELECT,CASE_NUMBER=103);
STINGER_FORCES([save,TIME_STEP,STINGER_ORD,X_FORCE,Y_FORCE,Z_FORCE,MY_MOMENT, MZ_MOMENT,FROM_SELECTED]);

/ STINGER_VELOCITIES(SELECT,CASE_NUMBER=103,TIME_STEP=30.0);
/ STINGER_VELOCITIES([DISPLAY,STINGER_ORD, YAW_ANGLE,ROLL_ANGLE,TRIM_ANGLE,HINGE_X,HINGE_Y,HINGE_Z,FROM_SELECTED]);

/ roller forces at time step 
ROLLER_FORCES(SELECT,CASE_NUMBER=103,TIME_STEP=30.0);
ROLLER_FORCES([save,ROLLER_ORD,X_FORCE,Y_FORCE,Z_FORCE,CONTACT_EL,LOCATION ,FROM_SELECTED,LABEL]);

ROLLER_FORCES(delete,FROM_SELECTED);

/ roller force time series for one roller
ROLLER_FORCES(SELECT,CASE_NUMBER=103,ROLLER_ORDER=8);
ROLLER_FORCES([SAVE,ROLLER_ORD,TIME_STEP,X_FORCE,Y_FORCE,Z_FORCE,CONTACT_EL,LOCATION ,FROM_SELECTED]);

ROLLER_FORCES(delete,FROM_SELECTED);

/ roller force time series for one roller
ROLLER_FORCES(SELECT,CASE_NUMBER=103,ROLLER_ORDER=12);
ROLLER_FORCES([SAVE,ROLLER_ORD,TIME_STEP,X_FORCE,Y_FORCE,Z_FORCE,CONTACT_EL,LOCATION ,FROM_SELECTED]);

NODAL_OUTPUT(SELECT,TIME_STEP=25.0);
NODAL_OUTPUT([SAVE,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,Z_COORD,DZ_COORD,FROM_SELECTED]);

NODAL_OUTPUT(SELECT,TIME_STEP=30.0);
NODAL_OUTPUT([SAVE,NODE_NUMBE,X_COORD,DX_COORD,Y_COORD,DY_COORD,Z_COORD,DZ_COORD,FROM_SELECTED]);


 flow_director(to_output="dynamic analysis is completed. results are in OUTPUT");
 flow_director(to_console="dynamic analysis is completed. results are in OUTPUT");
 flow_director(to_output=" *** test S1 with model 100 completed ***");
 flow_director(to_console=" *** test S1 with model 100 completed ***");


 set_param(echo_OFF);
 file_operation(close);

/........................................................................................
/........................................................................................
/- end of file

