Output Format

Dear All,

I would like to use my MOSES results in FAST software to compute a fully coupled wind turbine analysis. 

The Data I need are damping and added mass matrix and excitation force. I have all this results in the hydrodynamic menu. However the results have not the right format in order to use it in FAST.

Is it possible to change the format of the  hydrodynamic output directly in MOSES ?

For example I need the data in the following in the file:

first file  :   PER  I J Aij  Bij       

with

PER : Period

I,J : matrix index

Aij : Added mass

Bij: Damping coeff

 

second file : 

:  PER BETA I Mod(Xi) Pha(Xi) Re(Xi) Im(Xi)

 

Xi : Exciting forces

Mod : magnitude

Pha : phase   (The phase is relative to the phase of an incident wave at the origin of the global coordinates system)

Re : Real Part

Im : Imaginary part

Best Regards,

Romain PINGUET

  • Hi again Romain,

    I've tried to enclose a macro I used for a similar analysis. Not sure if it works 100% anymore and everything is correct, but perhaps it's a start. The idea is that you export the matrices in standard format, and use the &file command to read the values back into MOSES and modify them as you wish, before you again use &file to write the modified values to your desired file format.

    Hope it helps,

    Lars Rune

    &macro mos2orc -file file filenam
    
    &if &logical(.not. %file) &then
       &cutype WARNING: You have not specified a filename, mos2orc -file xxx.txt. Default used.
       &set filenam = orcageneric.txt
    &endif
    
    &cutype WARNING: Make sure your MOSES x-axis is pointing aft.
    
    &cutype WARNING: When importing, Orcaflex units should be te and kN
    
    &dimen -save
    
    
    $************ WRITE STANDARD RESULTS TO FILES
    
    
    &dimen -dimen meters k-nts  $NB!!!!!!  CHANGE OF UNITS
    
    freq_response
       &channel output -file orcadisp.out
       fr_point 0 0 0
         report
       end
       &channel output -file dummy
    end_freq
    
    hydrodynamics
       &channel output -file orcadrift.out
       v_mdrift
         report
       end
       &channel output -file dummy
    end_hydrodynamics
    
    freq_response
       &channel output -file orcaforce.out
       exforce
         report
       end
       &channel output -file dummy
    end_freq
    
    &dimen -dimen meters m-tons  $NB!!!!!!  CHANGE OF UNITS
    freq_response
       &channel ppout -file orcamatr.out
       matrices -file
       end
       &channel ppout -file dummy
    end_freq
    
    
    &file open -type orc -name %filenam
    
    $************ VESSEL INFO FOR MANUAL INPUT
    
    &set currbod = &body(current)
    &set bodloca = &body(location %currbod)
    &set boddrft = -1*(&token(3 %bodloca))
    &set boddrft = &number(real %boddrft)
    &set bodygm  = &body(gm %currbod)
    &set bodygmt = &token(1 %bodygm)
    &set bodygml = &token(2 %bodygm)
    &set strmass = &body(a_weight %currbod)
    &set bodyvol = &number(real %strmass/1.025)
    &set strmass = &number(real %strmass)
    &set momradi = &body(radii)
    &set momradx = &token(1 %momradi)
    &set momrady = &token(2 %momradi)
    &set momradz = &token(3 %momradi)
    &set momtenx = %momradx*%momradx*%strmass 
    &set momteny = %momrady*%momrady*%strmass
    &set momtenz = %momradz*%momradz*%strmass
    &set extreme = &body(extremes %currbod)
    
    hstat
      cform %boddrft
      set_variable watplane -column 8
    end
    
    &set bodc33 = &number(real 1.025*9.807*%watplane)
    &set bodc44 = &number(real 9.807*%strmass*%bodygmt)
    &set bodc55 = &number(real 9.807*%strmass*%bodygml)
    
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Info
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc This file was automatically generated from a MOSES macro made by IOS Intermoor
    &file write orc to aid exporting diffraction results from MOSES to Orcaflex. Below are values
    &file write orc to be input in the Vessel Type form. Secondly, this file is a Generic Text File
    &file write orc which contains RAOs, QTFs and Matrices that can be imported into Orcaflex. 
    &file write orc 
    &file write orc Date, time ..................................: &info(date), &info(t_of_day)
    &file write orc Root ........................................: &info(cwd)&info(root)
    &file write orc MOSES version................................: &info(revnum)
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc General Vessel Data
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Vessel Name .................................: %currbod
    &file write orc Metacentric Height GMT, GML ..............(m): %bodygmt %bodygml
    &file write orc Waterplane Area ........................(m^2): %watplane
    &file write orc Extremes, X ..............................(m): &token(1 %extreme) &token(4 %extreme)
    &file write orc Extremes, Y ..............................(m): &token(2 %extreme) &token(5 %extreme)
    &file write orc Extremes, Z ..............................(m): &token(3 %extreme) &token(6 %extreme)
    &file write orc Location X, Y, Z .........................(m): &token(1:3 %bodloca)
    &file write orc Condition Roll, Pitch, Yaw .............(deg): &token(4:6 %bodloca)
    &file write orc Water Depth ..............................(m): &env(wat_dept)
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Vessel Type - Structure Tab
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Vessel Mass ..............................(t): %strmass
    &file write orc Vessel Moment of Inertia Tensor x,y,z (t.m^2): &number(real %momtenx) &number(real %momteny) &number(real %momtenz)
    &file write orc Centre of Gravity x,y,z ..................(m): &body(a_cg)
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Vessel Type - RAOs and QTFs Tabs
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc RAO/QTF origin x,y,z .....................(m): 0 0 0
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Vessel Type - Stiffness, Added Mass and Damping Tab
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &file write orc Reference Origin, x, y, z.................(m): 0 0 0
    &file write orc Ref. Orig. Dat. Pos., Z, Heel, Trim  (m, deg): 0 0 &number(real -1*%boddrft)
    &file write orc Displaced Volume .......................(m^3): %bodyvol
    &file write orc Centre of Buoyancy x, y, z ...............(m): &body(cb %currbod)
    &file write orc Hydrost. stiff., Heave, Roll, Pitch ..(m, kN): %bodc33 %bodc44 %bodc55
    &file write orc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    
    $************ CONVENTIONS AND UNITS
    
    &file write orc *** OrcaFlex Conventions Start ***
    &file write orc RAOResponseUnits = degrees
    &file write orc RAOWaveUnit = amplitude
    &file write orc RAOPhaseConvention = leads
    &file write orc RAOPhaseUnitsConvention = degrees
    &file write orc RAOPhaseRelativeToConvention = crest
    &file write orc SurgePositive = aft
    &file write orc SwayPositive = starboard
    &file write orc HeavePositive = up
    &file write orc RollPositiveStarboard = up
    &file write orc PitchPositiveBow = up
    &file write orc YawPositiveBow = port
    &file write orc *** OrcaFlex Conventions End ***
    &file write orc 
    &file write orc *** OrcaFlex Units Start ***
    &file write orc LengthUnits = m
    &file write orc ForceUnits = kN
    &file write orc *** OrcaFlex Units End ***
    
    $************ DISPLACEMENT RAOS
    
    &set dispdrft =    Draft
    &set disphead =    Headi
    &set dispstrt = (Rad/Sec
    &set dispstop = Page
    
    &set txtdraft =
    &set txthead =
    &set fstflag = .true.
    &file open -type in -name orcadisp.out
    &set eof = .false.
    &loop 
       &exit %eof
       &set eof = &f_read(in filestr)
       &set sub9 = &string(substr %filestr 2 9)
       &set sub5 = &string(substr %filestr 2 6)
       &if &string(match %sub9 %dispdrft) &then
          &set txtdraft = &string(n_extract "=" 1 %filestr)
       &elseif &string(match %sub9 %disphead) &then
          &set txthead = &string(n_extract "=" 1 %filestr)    
       &endif
       &if &string(match %sub9 %dispstrt) &then
          &file write orc %filestr
          &set eof = &f_read(in filestr) $skip a line
          &file write orc %filestr
          &file write orc *** OrcaFlex Displacement RAO Start ***
          &file write orc Draught "%txtdraft"
          &file write orc Direction %txthead
          &file write orc         N/A       WP           XA        XP      YA      YP      ZA      ZP        RXA     RXP     RYA     RYP       RZA     RZP
       &elseif &string(match %sub5 %dispstop) &then
          &if %fstflag &then
            &set fstflag = .false.
          &else
            &file write orc *** OrcaFlex Displacement RAO End ***
          &endif
          &file write orc %filestr      
       &elseif %eof &then
          &file write orc *** OrcaFlex Displacement RAO End ***
       &else
          &file write orc %filestr
       &endif
    &endloop
    &file close in
    
    $************ WAVE DRIFT
    
    &set drfthead = rift
    &set drftstrt = requ
    &set drftstop = Page
    
    &set txthead =
    &set fstflag = .true.
    &file open -type in -name orcadrift.out
    &set eof = .false.
    &loop 
       &exit %eof
       &set eof = &f_read(in filestr)
       $&set sub9 = &string(substr %filestr 1 9)
       &set sub4 = &string(substr %filestr 2 5)
       &if &string(match %sub4 %drfthead) &then
          &set txthead = &token(7 %filestr)    
       &endif
       &if &string(match %sub4 %drftstrt) &then
          &file write orc %filestr
          &set eof = &f_read(in filestr) $skip a line
          &file write orc %filestr
          &file write orc *** OrcaFlex QTF Start ***
          &file write orc Draught "%txtdraft"
          &file write orc Direction %txthead
          &file write orc          N/A          WP          surge        sway       heave        roll       pitch         yaw
       &elseif &string(match %sub4 %drftstop) &then
          &if %fstflag &then
            &set fstflag = .false.
          &else
            &file write orc *** OrcaFlex QTF End ***
          &endif
          &file write orc %filestr      
       &elseif %eof &then
          &file write orc *** OrcaFlex QTF End ***
       &else
          &file write orc %filestr
       &endif
    &endloop
    &file close in
    
    $************ FORCE RAO
    
    &set forcdrft = Draft
    &set forchead = Headi
    &set forcstrt = Ampl.
    &set forcstop = Page
    
    &set txtdraft =
    &set txthead =
    &set fstflag = .true.
    &file open -type in -name orcaforce.out
    &set eof = .false.
    &loop 
       &exit %eof
       &set eof = &f_read(in filestr)
       &set sub9 = &string(substr %filestr 26 30)
       &set sub5 = &string(substr %filestr 2 6)
       &if &string(match %sub9 %forcdrft) &then
          &set txtdraft = &string(n_extract "=" 1 %filestr)
       &elseif &string(match %sub9 %forchead) &then
          &set txthead = &string(n_extract "=" 1 %filestr)    
       &endif
       &if &string(match %sub9 %forcstrt) &then
          &file write orc %filestr
          &set eof = &f_read(in filestr) $skip a line
          &file write orc %filestr
          &file write orc *** OrcaFlex Load RAO Start ***
          &file write orc Draught "%txtdraft"
          &file write orc Direction %txthead
          &file write orc         N/A       WP           XA        XP      YA      YP      ZA      ZP        RXA     RXP     RYA     RYP       RZA     RZP
       &elseif &string(match %sub5 %forcstop) &then
          &if %fstflag &then
            &set fstflag = .false.
          &else
            &file write orc *** OrcaFlex Load RAO End ***
          &endif
          &file write orc %filestr      
       &elseif %eof &then
          &file write orc *** OrcaFlex Load RAO End ***
       &else
          &file write orc %filestr
       &endif
    &endloop
    &file close in
    
    
    $************ MATRICES - ADDED MASS AND DAMPING
    
    
    &set amassfac = %strmass
    &set dampfac = &number(real %amassfac*9.807)
    &set matrperi = Frequ
    &set matrmass = Added
    &set matrdamp = Dampi
    &set fstflag = .true.
    
    &set txtperi =
    
    &file open -type in -name orcamatr.out
    &set eof = .false.
    &loop 
       &exit %eof
       &set eof = &f_read(in filestr)
       &set sub5 = &string(substr %filestr 1 5)
       &if &string(match %sub5 %matrperi) &then
           &set txtperio = &token(4 %filestr)
           &if %fstflag &then
              &set fstflag = .false.
           &else
              &file write orc *** OrcaFlex Damping Matrix End  ***
           &endif
       &endif
       &if &string(match %sub5 %matrmass) &then
           &file write orc %filestr
           &file write orc *** OrcaFlex Scaling Factor Start ***
           &file write orc %amassfac
           &file write orc *** OrcaFlex Scaling Factor End ***
           &file write orc *** OrcaFlex Added Mass Matrix Start  ***       
           &file write orc Draught "%txtdraft"
           &file write orc WP %txtperio
       &elseif &string(match %sub5 %matrdamp) &then
           &file write orc *** OrcaFlex Added Mass Matrix End  ***    
           &file write orc %filestr
           &file write orc *** OrcaFlex Scaling Factor Start ***
           &file write orc %dampfac
           &file write orc *** OrcaFlex Scaling Factor End ***
           &file write orc *** OrcaFlex Damping Matrix Start  *** 
           &file write orc Draught "%txtdraft"
           &file write orc WP %txtperio 
       &elseif %eof &then
          &file write orc *** OrcaFlex Damping Matrix End  ***
       &else
          &file write orc %filestr
       &endif
    
    &endloop
    &file close in
    
    
    &file close orc
    
    
    
    &dimen -remember
    &endmacro

  • Hi Lars,

    I will have a look on the code and let you know if it works.
    It could be perfect to convert the file without using an external tool.
    Thanks a lot for your time. It is really helpfull.
    Best regards,

    Romain
  • Hi Lars

    How do we use that macros? Is it just computing macro "mos2orc" before the end of the computation (hydrodynamic computation command input file) ?

    Thank you

    Yuni
  • Hi Yuni,

    The manual describes how macros work in detail, but what works for me is to define the macro early in the command input file and then run the macro when your computations are done and the results are available in the database, i.e.:

    &dimen ...
    &device ...
    &parameter ...

    &insert mos2orc.txt

    inmodel

    hydro
    ...
    end

    freq
    ...
    end

    mos2orc

    &finish

    Regards,
    Lars Rune

    Answer Verified By: Seth Guthrie 

  • Hi Lars,

    Thank you, and it works. It's really helpfull.

    Best Regards

    Yuni