Skip to content

Commit

Permalink
Conform inputs to recent updates for test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoor committed Aug 19, 2024
1 parent 12192f8 commit c291f32
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
24 changes: 12 additions & 12 deletions src/Unsteady.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
for i_idx = 1:length(aeroDOFs)
full_aeroVals[Int(aeroDOFs[i_idx])] = aeroVals[i_idx]
end
aeroDOFs = collect(1:topMesh.numNodes*6)
full_aeroDOFs = collect(1:topMesh.numNodes*6)
for iter_i = 1:floor(Int,length(full_aeroVals)/6)
topFexternal[6*(iter_i-1)+1:6*(iter_i-1)+6] = frame_convert(full_aeroVals[6*(iter_i-1)+1:6*(iter_i-1)+6], CN2H_no_azi)
end
Expand All @@ -422,14 +422,14 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
end
else
topFexternal = zeros(numDOFPerNode)
aeroDOFs = copy(topFexternal).*0.0
full_aeroDOFs = copy(topFexternal).*0.0
end
end

if meshcontrolfunction !== nothing
# add to the loads based on the inputs, TODO: CN2H
meshforces, meshdofs, timeconverged = meshcontrolfunction(topMesh,u_j,t[i])
for idx_main in aeroDOFs
for idx_main in full_aeroDOFs
for (idx,meshdof_idx) in enumerate(meshdofs)
if idx_main == meshdof_idx
topFexternal[idx_main] += meshforces[idx]
Expand All @@ -442,11 +442,11 @@ 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.(aeroDOFs),CN2H,rbData)
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"
topElStrain, topDispOut, topFReaction_j,systemout = structuralDynamicsTransientGX(topModel,topMesh,topFexternal,Int.(aeroDOFs),system,assembly,t,Omega_j,OmegaDot_j,delta_t,numIterations,i,strainGX,curvGX)
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.(aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
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
Expand All @@ -466,7 +466,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,

# Strain stiffening, save at the end of the simulation, at the last while loop iteration, mutates elStorage
if (i==numTS-1 || timeconverged == true) && inputs.analysisType=="TNB" && topModel.nlParams.predef=="update" && (!(uNorm > TOL || platNorm > TOL || aziNorm > TOL || gbNorm > TOL) || (numIterations >= MAXITER))
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(full_aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
end

#TODO: verbosity
Expand Down Expand Up @@ -591,7 +591,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
for i_idx = 1:length(aeroDOFs)
full_aeroVals[aeroDOFs[i_idx]] = aeroVals[i_idx]
end
aeroDOFs = collect(1:topMesh.numNodes*6)
full_aeroDOFs = collect(1:topMesh.numNodes*6)
for iter_i = 1:floor(Int,length(aeroVals)/6)
topFexternal[6*(iter_i-1)+1:6*(iter_i-1)+6] = frame_convert(full_aeroVals[6*(iter_i-1)+1:6*(iter_i-1)+6], CN2H_no_azi)
end
Expand All @@ -602,11 +602,11 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
end

if inputs.analysisType=="ROM" # evalulate structural dynamics using reduced order model
topElStrain, topDispOut, topFReaction_j = OWENSFEA.structuralDynamicsTransientROM(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,top_rom,topFexternal,Int.(aeroDOFs),CN2H,rbData)
topElStrain, topDispOut, topFReaction_j = OWENSFEA.structuralDynamicsTransientROM(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,top_rom,topFexternal,Int.(full_aeroDOFs),CN2H,rbData)
elseif inputs.analysisType=="GX"
topElStrain, topDispOut, topFReaction_j,systemout = structuralDynamicsTransientGX(topModel,topMesh,topFexternal,Int.(aeroDOFs),system,assembly,t,Omega_j,OmegaDot_j,delta_t,numIterations,i,strainGX,curvGX)
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,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
topElStrain, topDispOut, topFReaction_j = OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData2,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)
Expand All @@ -620,7 +620,7 @@ function Unsteady(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,

# Strain stiffening, save at the end of the simulation, at the last while loop iteration, mutates elStorage
if (i==numTS-1 || timeconverged == true) && inputs.analysisType=="TNB" && topModel.nlParams.predef=="update" && (!(uNorm > TOL || platNorm > TOL || aziNorm > TOL || gbNorm > TOL) || (numIterations >= MAXITER))
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topDispData2,Omega_s,OmegaDot_s,t[i+1],delta_t,topElStorage,topFexternal,Int.(full_aeroDOFs),CN2H,rbData;predef = topModel.nlParams.predef)
end

## calculate norms
Expand Down
14 changes: 7 additions & 7 deletions src/Unsteady_Land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function Unsteady_Land(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
for i_idx = 1:length(aeroDOFs)
full_aeroVals[Int(aeroDOFs[i_idx])] = aeroVals[i_idx]
end
aeroDOFs = collect(1:topMesh.numNodes*6)
full_aeroDOFs = collect(1:topMesh.numNodes*6)
for iter_i = 1:floor(Int,length(full_aeroVals)/6)
topdata.topFexternal[6*(iter_i-1)+1:6*(iter_i-1)+6] = frame_convert(full_aeroVals[6*(iter_i-1)+1:6*(iter_i-1)+6], CN2H_no_azi)
end
Expand All @@ -438,14 +438,14 @@ function Unsteady_Land(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
end
else
topdata.topFexternal = zeros(numDOFPerNode)
aeroDOFs = copy(topdata.topFexternal).*0.0
full_aeroDOFs = copy(topdata.topFexternal).*0.0
end
end

if meshcontrolfunction !== nothing
# add to the loads based on the inputs, TODO: CN2H
meshforces, meshdofs, timeconverged = meshcontrolfunction(topMesh,u_j,t[i])
for idx_main in aeroDOFs
for idx_main in full_aeroDOFs
for (idx,meshdof_idx) in enumerate(meshdofs)
if idx_main == meshdof_idx
topdata.topFexternal[idx_main] += meshforces[idx]
Expand All @@ -459,11 +459,11 @@ function Unsteady_Land(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,
#------------------------------------
# println(Float64.(rbData))
if inputs.analysisType=="ROM" # evalulate structural dynamics using reduced order model
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j = OWENSFEA.structuralDynamicsTransientROM(topModel,topMesh,topEl,topdata.topDispData1,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.top_rom,topdata.topFexternal,Int.(aeroDOFs),topdata.CN2H,topdata.rbData)
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j = OWENSFEA.structuralDynamicsTransientROM(topModel,topMesh,topEl,topdata.topDispData1,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.top_rom,topdata.topFexternal,Int.(full_aeroDOFs),topdata.CN2H,topdata.rbData)
elseif inputs.analysisType=="GX"
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j,systemout = structuralDynamicsTransientGX(topModel,topMesh,topdata.topFexternal,Int.(aeroDOFs),system,assembly,t,topdata.Omega_j,topdata.OmegaDot_j,topdata.delta_t,numIterations,i,strainGX,curvGX)
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j,systemout = structuralDynamicsTransientGX(topModel,topMesh,topdata.topFexternal,Int.(full_aeroDOFs),system,assembly,t,topdata.Omega_j,topdata.OmegaDot_j,topdata.delta_t,numIterations,i,strainGX,curvGX)
else # evalulate structural dynamics using conventional representation
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j = OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topdata.topDispData1,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.topFexternal,Int.(aeroDOFs),topdata.CN2H,topdata.rbData;predef = topModel.nlParams.predef)
topdata.topElStrain, topdata.topDispOut, topdata.topFReaction_j = OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topdata.topDispData1,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.topFexternal,Int.(full_aeroDOFs),topdata.CN2H,topdata.rbData;predef = topModel.nlParams.predef)
end

u_jLast = copy(topdata.u_j)
Expand All @@ -486,7 +486,7 @@ function Unsteady_Land(inputs;topModel=nothing,topMesh=nothing,topEl=nothing,

# Strain stiffening, save at the end of the simulation, at the last while loop iteration, mutates elStorage
if (i==numTS-1 || timeconverged == true) && inputs.analysisType=="TNB" && topModel.nlParams.predef=="update" && (!(uNorm > TOL || platNorm > TOL || aziNorm > TOL || gbNorm > TOL) || (numIterations >= MAXITER))
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topdata.topDispData2,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.topFexternal,Int.(aeroDOFs),topdata.CN2H,topdata.rbData;predef = topModel.nlParams.predef)
OWENSFEA.structuralDynamicsTransient(topModel,topMesh,topEl,topdata.topDispData2,topdata.Omega_s,topdata.OmegaDot_s,t[i+1],topdata.delta_t,topElStorage,topdata.topFexternal,Int.(full_aeroDOFs),topdata.CN2H,topdata.rbData;predef = topModel.nlParams.predef)
end

if verbosity>4
Expand Down
1 change: 1 addition & 0 deletions test/Fig4_5_campbell2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mass_breakout_blds,mass_breakout_twr,system, assembly, sections = OWENS.setupOWE
R = Blade_Radius,
shapeZ,
shapeX,
shapeY=zero(shapeX),
ifw,
delta_t,
numTS,
Expand Down

0 comments on commit c291f32

Please sign in to comment.