Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/floating reg test #87

Merged
merged 8 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/Unsteady.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
recent_udot_prp = repeat(udot_s_prp_n, 1, inputs.interpOrder+1)
recent_uddot_prp = repeat(uddot_s_prp_n, 1, inputs.interpOrder+1)
recent_FPtfm = repeat(FPtfm_n, 1, inputs.interpOrder+1)
recent_times = collect(range(-delta_t*inputs.interpOrder, 0.0, inputs.interpOrder+1))
recent_times = collect(LinRange(-delta_t*inputs.interpOrder, 0.0, inputs.interpOrder+1))
end

#..........................................................................
Expand Down Expand Up @@ -405,6 +405,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
if inputs.AD15On
# AD15 is in global frame, so no frame conversion???
topFexternal = aeroVals
full_aeroDOFs = aeroDOFs
else
if length(size(aeroVals))==1 || size(aeroVals)[2]==1 #i.e. the standard aero force input as a long array
# Fill in forces and dofs if they were specified not in full arrays TODO: make this more efficient
Expand All @@ -418,6 +419,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
end
else # the other aero input as a 2D array
topFexternal = frame_convert(aeroVals[i+1,:], CN2H)
full_aeroDOFs = aeroDOFs
end
end
else
Expand All @@ -443,20 +445,23 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
# println(Float64.(rbData))
if inputs.analysisType=="ROM" # evalulate structural dynamics using reduced order model
topElStrain, topDispOut, topFReaction_j = OWENSFEA.structuralDynamicsTransientROM(topModel,topMesh,topEl,topDispData1,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,top_rom,topFexternal,Int.(full_aeroDOFs),CN2H,rbData)
elseif inputs.analysisType=="GX"
elseif inputs.analysisType=="GX"
topElStrain, topDispOut, topFReaction_j,systemout = structuralDynamicsTransientGX(topModel,topMesh,topFexternal,Int.(full_aeroDOFs),system,assembly,t,Omega_j,OmegaDot_j,delta_t,numIterations,i,strainGX,curvGX)
else # evalulate structural dynamics using conventional representation
topElStrain, topDispOut, topFReaction_j = OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData1,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(full_aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
end

u_jLast = copy(u_j)
u_j = topDispOut.displ_sp1
udot_j = topDispOut.displdot_sp1
uddot_j = topDispOut.displddot_sp1

## calculate norms
uNorm = LinearAlgebra.norm(u_j-u_jLast)/LinearAlgebra.norm(u_j) #structural dynamics displacement iteration norm
aziNorm = LinearAlgebra.norm(azi_j - azi_jLast)/LinearAlgebra.norm(azi_j) #rotor azimuth iteration norm
gbNorm = LinearAlgebra.norm(gb_j - gb_jLast)/LinearAlgebra.norm(gb_j) #gearbox states iteration norm if it is off, the norm will be zero
uNorm = LinearAlgebra.norm(u_j .- u_jLast)/LinearAlgebra.norm(u_j) #structural dynamics displacement iteration norm
aziNorm = LinearAlgebra.norm(azi_j .- azi_jLast)/LinearAlgebra.norm(azi_j) #rotor azimuth iteration norm
if inputs.generatorOn
gbNorm = LinearAlgebra.norm(gb_j .- gb_jLast)/LinearAlgebra.norm(gb_j) #gearbox states iteration norm if it is off, the norm will be zero
end

numIterations = numIterations + 1

Expand Down Expand Up @@ -597,6 +602,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
end
else
topFexternal = frame_convert(aeroVals[i+1,:], CN2H)
full_aeroDOFs = aeroDOFs
end
end
end
Expand Down
72 changes: 72 additions & 0 deletions test/data/HydroDyn_CCT2_SeaState_test.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
------- SeaState Input File ----------------------------------------------------
NREL 5.0 MW offshore baseline floating platform HydroDyn input properties for the OC4 Semi-submersible.
False Echo - Echo the input file data (flag)
---------------------- ENVIRONMENTAL CONDITIONS --------------------------------
"default" WtrDens - Water density (kg/m^3)
"default" WtrDpth - Water depth (meters) relative to MSL
"default" MSL2SWL - Offset between still-water level and mean sea level (meters) [positive upward; unused when WaveMod = 6; must be zero if PotMod=1 or 2]
---------------------- SPATIAL DISCRETIZATION ---------------------------------------------------
60 X_HalfWidth – Half-width of the domain in the X direction (m) [>0, NOTE: X[nX] = nX*dX, where nX = {-NX+1,-NX+2,…,NX-1} and dX = X_HalfWidth/(NX-1)]
60 Y_HalfWidth – Half-width of the domain in the Y direction (m) [>0, NOTE: Y[nY] = nY*dY, where nY = {-NY+1,-NY+2,…,NY-1} and dY = Y_HalfWidth/(NY-1)]
30 Z_Depth – Depth of the domain the Z direction (m) relative to SWL [0 < Z_Depth <= WtrDpth+MSL2SWL; "default": Z_Depth = WtrDpth+MSL2SWL; Z[nZ] = ( COS( nZ*dthetaZ ) – 1 )*Z_Depth, where nZ = {0,1,…NZ-1} and dthetaZ = pi/( 2*(NZ-1) )]
6 NX – Number of nodes in half of the X-direction domain (-) [>=2]
6 NY – Number of nodes in half of the Y-direction domain (-) [>=2]
20 NZ – Number of nodes in the Z direction (-) [>=2]
---------------------- WAVES ---------------------------------------------------
3 WaveMod - Incident wave kinematics model {0: none=still water, 1: regular (periodic), 1P#: regular with user-specified phase, 2: JONSWAP/Pierson-Moskowitz spectrum (irregular), 3: White noise spectrum (irregular), 4: user-defined spectrum from routine UserWaveSpctrm (irregular), 5: Externally generated wave-elevation time series, 6: Externally generated full wave-kinematics time series, 7: wave frequency components [option 6 is invalid for PotMod/=0]} (switch)
0 WaveStMod - Model for stretching incident wave kinematics to instantaneous free surface {0: none=no stretching, 1: vertical stretching, 2: extrapolation stretching, 3: Wheeler stretching} (switch) [unused when WaveMod=0 or when PotMod/=0]
4600 WaveTMax - Analysis time for incident wave calculations (sec) [unused when WaveMod=0; determines WaveDOmega=2Pi/WaveTMax in the IFFT]
0.2 WaveDT - Time step for incident wave calculations (sec) [unused when WaveMod=0 or 7; 0.1<=WaveDT<=1.0 recommended; determines WaveOmegaMax=Pi/WaveDT in the IFFT]
1.2646 WaveHs - Significant wave height of incident waves (meters) [used only when WaveMod=1, 2, or 3]
10 WaveTp - Peak-spectral period of incident waves (sec) [used only when WaveMod=1 or 2]
"DEFAULT" WavePkShp - Peak-shape parameter of incident wave spectrum (-) or DEFAULT (string) [used only when WaveMod=2; use 1.0 for Pierson-Moskowitz]
0.314159 WvLowCOff - Low cut-off frequency or lower frequency limit of the wave spectrum beyond which the wave spectrum is zeroed (rad/s) [unused when WaveMod=0, 1, 6, or 7]
1.570796 WvHiCOff - High cut-off frequency or upper frequency limit of the wave spectrum beyond which the wave spectrum is zeroed (rad/s) [unused when WaveMod=0, 1, 6, or 7]
0 WaveDir - Incident wave propagation heading direction (degrees) [unused when WaveMod=0, 6 or 7]
0 WaveDirMod - Directional spreading function {0: none, 1: COS2S} (-) [only used when WaveMod=2,3, or 4]
1 WaveDirSpread - Wave direction spreading coefficient ( > 0 ) (-) [only used when WaveMod=2,3, or 4 and WaveDirMod=1]
1 WaveNDir - Number of wave directions (-) [only used when WaveMod=2,3, or 4 and WaveDirMod=1; odd number only]
0 WaveDirRange - Range of wave directions (full range: WaveDir +/- 1/2*WaveDirRange) (degrees) [only used when WaveMod=2,3,or 4 and WaveDirMod=1]
123456789 WaveSeed(1) - First random seed of incident waves [-2147483648 to 2147483647] (-) [unused when WaveMod=0, 5, or 6]
"RANLUX" WaveSeed(2) - Second random seed of incident waves [-2147483648 to 2147483647] for intrinsic pRNG, or an alternative pRNG: "RanLux" (-) [unused when WaveMod=0, 5, or 6]
FALSE WaveNDAmp - Flag for normally distributed amplitudes (flag) [only used when WaveMod=2, 3, or 4]
"unused" WvKinFile - Root name of externally generated wave data file(s) (quoted string) [used only when WaveMod=5, 6 or 7]
---------------------- 2ND-ORDER WAVES ----------------------------------------- [unused with WaveMod=0 or 6]
FALSE WvDiffQTF - Full difference-frequency 2nd-order wave kinematics (flag)
FALSE WvSumQTF - Full summation-frequency 2nd-order wave kinematics (flag)
0 WvLowCOffD - Low frequency cutoff used in the difference-frequencies (rad/s) [Only used with a difference-frequency method]
1.256637 WvHiCOffD - High frequency cutoff used in the difference-frequencies (rad/s) [Only used with a difference-frequency method]
0.618319 WvLowCOffS - Low frequency cutoff used in the summation-frequencies (rad/s) [Only used with a summation-frequency method]
3.141593 WvHiCOffS - High frequency cutoff used in the summation-frequencies (rad/s) [Only used with a summation-frequency method]
---------------------- CONSTRAINED WAVES ---------------------------------------
0 ConstWaveMod - Constrained wave model: 0=none; 1=Constrained wave with specified crest elevation, alpha; 2=Constrained wave with guaranteed peak-to-trough crest height, HCrest (flag)
1 CrestHmax - Crest height (2*alpha for ConstWaveMod=1 or HCrest for ConstWaveMod=2), must be larger than WaveHs (m) [unused when ConstWaveMod=0]
60 CrestTime - Time at which the crest appears (s) [unused when ConstWaveMod=0]
0 CrestXi - X-position of the crest (m) [unused when ConstWaveMod=0]
0 CrestYi - Y-position of the crest (m) [unused when ConstWaveMod=0]
---------------------- CURRENT ------------------------------------------------- [unused with WaveMod=6]
0 CurrMod - Current profile model {0: none=no current, 1: standard, 2: user-defined from routine UserCurrent} (switch)
0 CurrSSV0 - Sub-surface current velocity at still water level (m/s) [used only when CurrMod=1]
"DEFAULT" CurrSSDir - Sub-surface current heading direction (degrees) or DEFAULT (string) [used only when CurrMod=1]
20 CurrNSRef - Near-surface current reference depth (meters) [used only when CurrMod=1]
0 CurrNSV0 - Near-surface current velocity at still water level (m/s) [used only when CurrMod=1]
0 CurrNSDir - Near-surface current heading direction (degrees) [used only when CurrMod=1]
0 CurrDIV - Depth-independent current velocity (m/s) [used only when CurrMod=1]
0 CurrDIDir - Depth-independent current heading direction (degrees) [used only when CurrMod=1]
---------------------- MacCamy-Fuchs diffraction model -------------------------
0 MCFD - MacCamy-Fuchs member radius (ignored if radius <= 0) [must be 0 when WaveMod 0 or 6]
---------------------- OUTPUT --------------------------------------------------
False SeaStSum - Output a summary file [flag]
3 OutSwtch - Output requested channels to: [1=SeaState.out, 2=GlueCode.out, 3=both files]
"E15.7e2" OutFmt - Output format for numerical results (quoted string) [not checked for validity!]
"A15" OutSFmt - Output format for header strings (quoted string) [not checked for validity!]
1 NWaveElev - Number of points where the incident wave elevations can be computed (-) [maximum of 9 output locations]
0 WaveElevxi - List of xi-coordinates for points where the incident wave elevations can be output (meters) [NWaveElev points, separated by commas or white space; usused if NWaveElev = 0]
0 WaveElevyi - List of yi-coordinates for points where the incident wave elevations can be output (meters) [NWaveElev points, separated by commas or white space; usused if NWaveElev = 0]
0 NWaveKin - Number of points where the wave kinematics can be output (-) [maximum of 9 output locations]
14.43376, -18.4752 WaveKinxi - List of xi-coordinates for points where the wave kinematics can be output (meters) [NWaveKin points, separated by commas or white space; usused if NWaveKin = 0]
25, -6 WaveKinyi - List of yi-coordinates for points where the wave kinematics can be output (meters) [NWaveKin points, separated by commas or white space; usused if NWaveKin = 0]
-14, -17 WaveKinzi - List of zi-coordinates for points where the wave kinematics can be output (meters) [NWaveKin points, separated by commas or white space; usused if NWaveKin = 0]
---------------------- OUTPUT CHANNELS -----------------------------------------
"Wave1Elev" - Wave elevation at the platform reference point (0, 0)
END of output channels and end of file. (the word "END" must appear in the first 3 columns of this line)
Loading
Loading