OpenFAST
Wind turbine multiphysics simulator
|
WAMIT2 module. More...
Data Types | |
type | w2_diffdata_type |
This type is used to hold the data for difference frequency methods. More... | |
type | w2_initdata3d_type |
This type is only used locally for holding data during the Initialization. More... | |
type | w2_initdata4d_type |
This type is only used locally for holding data during the Initialization. More... | |
type | w2_sumdata_type |
This type is used to hold the data for sum frequency method. More... | |
Functions/Subroutines | |
subroutine, public | wamit2_init (InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg) |
This routine is called at the start of the simulation to perform initialization steps. More... | |
subroutine, public | wamit2_end (u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg) |
This routine is called at the end of the simulation. More... | |
subroutine, public | wamit2_updatestates (t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg) |
Loose coupling routine for solving constraint states, integrating continuous states, and updating discrete states. More... | |
subroutine, public | wamit2_calcoutput (Time, WaveTime, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg) |
Routine for computing outputs, used in both loose and tight coupling. More... | |
subroutine, public | wamit2_calccontstatederiv (Time, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg) |
This routine is required for the FAST framework, but is not actually needed for this module. More... | |
subroutine, public | wamit2_updatediscstate (Time, n, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg) |
This routine is required for the FAST framework, but is not actually needed for this module. More... | |
subroutine, public | wamit2_calcconstrstateresidual (Time, u, p, x, xd, z, OtherState, m, z_residual, ErrStat, ErrMsg) |
This routine is required for the FAST framework, but is not actually needed for this module. More... | |
subroutine | copy_initdata4dto3d (Data4D, Data3D, ErrStat, ErrMsg) |
This subroutine copies data stored from a W2_InitData4D_Type to a W2_InitData3D_Type. More... | |
subroutine | destroy_initdata3d (Data3D) |
This subroutine destroys data stored in a W2_InitData3D_Type. | |
subroutine | destroy_initdata4d (Data4D) |
This subroutine destroys data stored in a W2_InitData4D_Type. | |
Variables | |
type(progdesc), parameter | wamit2_progdesc = ProgDesc( 'WAMIT2', '', '' ) |
This holds the name of the program, version info, and date. More... | |
real(siki), parameter, private | onepluseps = 1.0 + EPSILON(OnePlusEps) |
WAMIT2 module.
This module calculates the second order wave forces on a structure. This module is used with HydroDyn in FAST.
This software is written in the FAST modular framework.
|
private |
This subroutine copies data stored from a W2_InitData4D_Type to a W2_InitData3D_Type.
[in] | data4d | 4D data source |
[in,out] | data3d | 3D data where it will be copied to |
[out] | errstat | Error status |
[out] | errmsg | Error message |
This routine should not have been called unless the data could be copied over, which means that the 4D data is either not sparse in the dimensions of interest, or the diagonal is complete. We won't simply trust that this is true though, so we will run the array and find out if the data we now have is sparse for the load components we have or not.
Find out if the data is sparse or full. Verification that the requested component directions were found will occur in the calling routine, not here (that information was not passed in). We will check this by sweeping through all three dimensions for only the values of k that have data in them.
subroutine, public wamit2::wamit2_calcconstrstateresidual | ( | real(dbki), intent(in) | Time, |
type(wamit2_inputtype), intent(in) | u, | ||
type(wamit2_parametertype), intent(in) | p, | ||
type(wamit2_continuousstatetype), intent(in) | x, | ||
type(wamit2_discretestatetype), intent(in) | xd, | ||
type(wamit2_constraintstatetype), intent(in) | z, | ||
type(wamit2_otherstatetype), intent(in) | OtherState, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
type(wamit2_constraintstatetype), intent(out) | z_residual, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
This routine is required for the FAST framework, but is not actually needed for this module.
In the framework, this is a tight coupling routine for solving for the residual of the constraint state equations So, this routine will simply issue a warning and return.
[in] | time | Current simulation time in seconds |
[in] | u | Inputs at Time |
[in] | p | Parameters |
[in] | x | Continuous states at Time |
[in] | xd | Discrete states at Time |
[in] | z | Constraint states at Time (possibly a guess) |
[in] | otherstate | Other states at Time |
[in,out] | m | Misc/optimization variables |
[out] | z_residual | Residual of the constraint state equations using the input values described above |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
subroutine, public wamit2::wamit2_calccontstatederiv | ( | real(dbki), intent(in) | Time, |
type(wamit2_inputtype), intent(in) | u, | ||
type(wamit2_parametertype), intent(in) | p, | ||
type(wamit2_continuousstatetype), intent(in) | x, | ||
type(wamit2_discretestatetype), intent(in) | xd, | ||
type(wamit2_constraintstatetype), intent(in) | z, | ||
type(wamit2_otherstatetype), intent(in) | OtherState, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
type(wamit2_continuousstatetype), intent(out) | dxdt, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
This routine is required for the FAST framework, but is not actually needed for this module.
In the framework, this routine calculates the derivative of the continuous states. As this routine is not necessary in the WAMIT2 module, it simply issues a warning and returns.
[in] | time | Current simulation time in seconds |
[in] | u | Inputs at Time |
[in] | p | Parameters |
[in] | x | Continuous states at Time |
[in] | xd | Discrete states at Time |
[in] | z | Constraint states at Time |
[in] | otherstate | Other states at Time |
[in,out] | m | Misc/optimization variables |
[out] | dxdt | Continuous state derivatives at Time |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
subroutine, public wamit2::wamit2_calcoutput | ( | real(dbki), intent(in) | Time, |
real(siki), dimension(:), intent(in) | WaveTime, | ||
type(wamit2_inputtype), intent(in) | u, | ||
type(wamit2_parametertype), intent(in) | p, | ||
type(wamit2_continuousstatetype), intent(in) | x, | ||
type(wamit2_discretestatetype), intent(in) | xd, | ||
type(wamit2_constraintstatetype), intent(in) | z, | ||
type(wamit2_otherstatetype), intent(in) | OtherState, | ||
type(wamit2_outputtype), intent(inout) | y, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
Routine for computing outputs, used in both loose and tight coupling.
[in] | time | Current simulation time in seconds |
[in] | wavetime | Array of wave kinematic time samples, (sec) |
[in] | u | Inputs at Time |
[in] | p | Parameters |
[in] | x | Continuous states at Time |
[in] | xd | Discrete states at Time |
[in] | z | Constraint states at Time |
[in] | otherstate | Other states |
[in,out] | y | Outputs computed at Time (Input only so that mesh connectivity information does not have to be recalculated) |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
subroutine, public wamit2::wamit2_end | ( | type(wamit2_inputtype), intent(inout) | u, |
type(wamit2_parametertype), intent(inout) | p, | ||
type(wamit2_continuousstatetype), intent(inout) | x, | ||
type(wamit2_discretestatetype), intent(inout) | xd, | ||
type(wamit2_constraintstatetype), intent(inout) | z, | ||
type(wamit2_otherstatetype), intent(inout) | OtherState, | ||
type(wamit2_outputtype), intent(inout) | y, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
This routine is called at the end of the simulation.
The purpose of this routine is to destroy any data that is leftover. If we don't do this, we may leave memory tied up after the simulation ends. To destroy the data, we call several routines that are generated by the FAST registry, so any issues with the destroy routines should be addressed by the registry.exe which generates the WAMIT2_Types.f90 file.
[in,out] | u | System inputs |
[in,out] | p | Parameters |
[in,out] | x | Continuous states |
[in,out] | xd | Discrete states |
[in,out] | z | Constraint states |
[in,out] | otherstate | Other states |
[in,out] | y | System outputs |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
Place any last minute operations or calculations here. For WAMIT2, most calculations are performed during the initialization, so there are no final calculations that need to be performed.
Close files here. The only files that are opened for WAMIT2 take place during the initialization routine. They should have been closed then.
Destroy the input data:
Destroy the parameter data:
Destroy the state data:
Destroy the output data:
subroutine, public wamit2::wamit2_init | ( | type(wamit2_initinputtype), intent(in) | InitInp, |
type(wamit2_inputtype), intent(out) | u, | ||
type(wamit2_parametertype), intent(out) | p, | ||
type(wamit2_continuousstatetype), intent(out) | x, | ||
type(wamit2_discretestatetype), intent(out) | xd, | ||
type(wamit2_constraintstatetype), intent(out) | z, | ||
type(wamit2_otherstatetype), intent(out) | OtherState, | ||
type(wamit2_outputtype), intent(out) | y, | ||
type(wamit2_miscvartype), intent(out) | m, | ||
real(dbki), intent(inout) | Interval, | ||
type(wamit2_initoutputtype), intent(out) | InitOut, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
This routine is called at the start of the simulation to perform initialization steps.
The parameters that are set here are not changed during the simulation. The initial states and initial guess for the input are defined.
[in] | initinp | Input data for initialization routine |
[out] | u | An initial guess for the input; input mesh must be defined |
[out] | p | Parameters |
[out] | x | Initial continuous states |
[out] | xd | Initial discrete states |
[out] | z | Initial guess of the constraint states |
[out] | otherstate | Initial other states |
[out] | y | Initial system outputs (outputs are not calculated; only the output mesh is initialized) |
[out] | m | Initial misc/optimization variables |
[in,out] | interval | Coupling interval in seconds: don't change it from the glue code provided value. |
[out] | initout | Output for initialization routine |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
Initialize Error handling variables
Initialize the data storage
Initialize the NWTC Subroutine Library and display the information about this module.
Before attempting to do any real calculations, we first check what was passed in through InitInp to make sure it makes sense. That routine will then copy over the relevant information that should be kept in parameters (p).
InitInp will also check the flags, existence of files, and set flags accordingly.
If the MnDrift method will be used, read in the data for it.
If the NewmanApp method will be used, read in the data for it.
If the DiffQTF method will be used, read in the data for it. This can only be 4D data even though DiffQTF can hold 3D data. This was an intentional choice so that DiffQTFData could be passed to the MnDrift method (the first term of the DiffQTF method equations is the MnDrift term).
If the SumQTF method will be used, read in the data for it. This can only be 4D data (SumQTFData only holds 4D).
Check the MnDrift data: check both in case we have already copied 4D data into the 3D. Will decide later which is used.
Check the NewmanApp data: check both in case we have already copied 4D data into the 3D. Will decide later which is used.
Check the DiffQTF data: Don't check the 3D data. We may have copied 4D into it for the MnDrift term.
Check the SumQTF data
For the DiffQTF and SumQTF methods, only 4D data can be used in the calculations. Again, the entire dataset for each is passed into the respective calculation subroutine. In the case of the DiffQTFData, only the 4D data portion should be populated above. If 3D data is present in it, the subroutine will exit with a warning about a programming error. For the SumQTF method, the data can only be 4D.
For the MnDrift and NewmanApp methods, it is possible to convert 4D data where the diagonal is complete but off diagonal values are not. The data in this case will have to be ported over to a 3D storage. This will be handled in the MnDrift_InitCalc and NewmanApp_InitCalc functions.
If the MnDrift method will be used, call the subroutine to calculate the force time series
If the NewmanApp method will be used, call the subroutine to calculate the force time series
If the DiffQTF method will be used, call the subroutine to calculate the force time series Note that the MnDrift calculation is included.
If the SumQTF method will be used, call the subroutine to calculate the force time series
Copy output forces over to parameters as needed.
subroutine, public wamit2::wamit2_updatediscstate | ( | real(dbki), intent(in) | Time, |
integer(intki), intent(in) | n, | ||
type(wamit2_inputtype), intent(in) | u, | ||
type(wamit2_parametertype), intent(in) | p, | ||
type(wamit2_continuousstatetype), intent(in) | x, | ||
type(wamit2_discretestatetype), intent(inout) | xd, | ||
type(wamit2_constraintstatetype), intent(in) | z, | ||
type(wamit2_otherstatetype), intent(in) | OtherState, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
This routine is required for the FAST framework, but is not actually needed for this module.
In the framework, this routine is used to update discrete states, by So, this routine will simply issue a warning and return.
[in] | time | Current simulation time in seconds |
[in] | n | Current step of the simulation: t = n*Interval |
[in] | u | Inputs at Time |
[in] | p | Parameters |
[in] | x | Continuous states at Time |
[in,out] | xd | Input: Discrete states at Time; Output: Discrete states at Time + Interval |
[in] | z | Constraint states at Time |
[in] | otherstate | Other states at Time |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
subroutine, public wamit2::wamit2_updatestates | ( | real(dbki), intent(in) | t, |
integer(intki), intent(in) | n, | ||
type(wamit2_inputtype), dimension(:), intent(in) | Inputs, | ||
real(dbki), dimension(:), intent(in) | InputTimes, | ||
type(wamit2_parametertype), intent(in) | p, | ||
type(wamit2_continuousstatetype), intent(inout) | x, | ||
type(wamit2_discretestatetype), intent(inout) | xd, | ||
type(wamit2_constraintstatetype), intent(inout) | z, | ||
type(wamit2_otherstatetype), intent(inout) | OtherState, | ||
type(wamit2_miscvartype), intent(inout) | m, | ||
integer(intki), intent(out) | ErrStat, | ||
character(*), intent(out) | ErrMsg | ||
) |
Loose coupling routine for solving constraint states, integrating continuous states, and updating discrete states.
Continuous, constraint, and discrete states are updated to values at t + Interval.
[in] | t | Current simulation time in seconds |
[in] | n | Current step of the simulation: t = n*Interval |
[in] | inputs | Inputs at InputTimes |
[in] | inputtimes | Times in seconds associated with Inputs |
[in] | p | Parameters |
[in,out] | x | Input: Continuous states at t; Output: Continuous states at t + Interval |
[in,out] | xd | Input: Discrete states at t; Output: Discrete states at t + Interval |
[in,out] | z | Input: Constraint states at t; Output: Constraint states at t + Interval |
[in,out] | otherstate | Input: Other states at t; Output: Other states at t + Interval |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
|
private |
This holds the name of the program, version info, and date.