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

Modelingoptions #23

Merged
merged 4 commits into from
Nov 22, 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
37 changes: 26 additions & 11 deletions src/modal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
minRPM = 0.0,
maxRPM = 40.0,
NRPM = 9, # int
vtksavename = nothing,
VTKsavename = nothing,
saveModes = [1,3,5], #must be int
saveRPM = [1,3,5], #must be int
mode_scaling = 500.0,
)

Automated Campbell Diagram Generator, this function runs the model with centrifugal stiffening for the specified RPM levels.
If FEAinputs.analysisType == "GX" and vtksavename are specified, it will output paraview mode shape files at the specified save name.
If FEAinputs.analysisType == "GX" and VTKsavename are specified, it will output paraview mode shape files at the specified save name.

#Inputs
* `FEAinputs::OWENSFEA.FEAModel`: The FEA modeling options
Expand All @@ -22,7 +22,7 @@
* `minRPM::Float64`: minimum RPM to be run, e.x. 0.0
* `maxRPM::Float64`: maximum RPM to be run e.x. 40.0
* `NRPM::Int64`: number of linear discretizations of RPM e.x. 9 must be int
* `vtksavename::string`: filename (with path if desired) of the VTK outputs if GX. Set to "nothing" to not save.
* `VTKsavename::string`: filename (with path if desired) of the VTK outputs if GX. Set to "nothing" to not save.
* `saveModes::Array{Int64}`: The modes to save in the VTK outputs e.x. [1,3,5] must be int
* `saveRPM::Array{Int64}`: The RPMs to save in the VTK outputs e.x. [1,3,5] must be int
* `mode_scaling::Float64`: The mode scaling in the VTK outputs e.x. 500.0
Expand All @@ -34,7 +34,7 @@
minRPM = 0.0,
maxRPM = 40.0,
NRPM = 9, # int
vtksavename = nothing,
VTKsavename = nothing,
saveModes = [1,3,5], #must be int
saveRPM = [1,3,5], #must be int
mode_scaling = 500.0,
Expand Down Expand Up @@ -78,7 +78,22 @@
# --- Perform Analysis --- #

# gravity vector
gravity = [0, 0, -9.81] #TODO: from FEAinputs
if eltype(FEAinputs.gravityOn) == Bool && FEAinputs.gravityOn == true
a_x_n = 0.0 #accelerations in inertial frame
a_y_n = 0.0
a_z_n = -9.81 # gravity
elseif eltype(FEAinputs.gravityOn) == Bool && FEAinputs.gravityOn == false
a_x_n = 0.0 #accelerations in inertial frame
a_y_n = 0.0
a_z_n = 0.0

Check warning on line 88 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L81-L88

Added lines #L81 - L88 were not covered by tests
end

if eltype(FEAinputs.gravityOn) == Float64
a_x_n = FEAinputs.gravityOn[1] #accelerations in inertial frame
a_y_n = FEAinputs.gravityOn[2]
a_z_n = FEAinputs.gravityOn[3]

Check warning on line 94 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L91-L94

Added lines #L91 - L94 were not covered by tests
end
gravity = [a_x_n, a_y_n, a_z_n] #TODO: from FEAinputs

Check warning on line 96 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L96

Added line #L96 was not covered by tests

# number of modes
nmode = FEAinputs.numModes
Expand Down Expand Up @@ -137,21 +152,21 @@
eigenstates_save[irpm] = eigenstates
end

if !isnothing(vtksavename) #TODO: map the OWENS state into the gx state for filesaving
if !isnothing(VTKsavename) #TODO: map the OWENS state into the gx state for filesaving

Check warning on line 155 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L155

Added line #L155 was not covered by tests
state = GXBeam.AssemblyState(system, assembly; prescribed_conditions=prescribed_conditions)

try #this should error if someone on windows uses backslash '\'
lastforwardslash = findlast(x->x=='/',vtksavename)
filepath = vtksavename[1:lastforwardslash-1]
lastforwardslash = findlast(x->x=='/',VTKsavename)
filepath = VTKsavename[1:lastforwardslash-1]

Check warning on line 160 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L159-L160

Added lines #L159 - L160 were not covered by tests
if !isdir(filepath)
mkdir(filepath)
end
catch
@info "Please manually create the directory to house $vtksavename"
@info "Please manually create the directory to house $VTKsavename"

Check warning on line 165 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L165

Added line #L165 was not covered by tests
end
for isaveRPM in saveRPM
for isavemode in saveModes
GXBeam.write_vtk("$(vtksavename)_RPM$(rotSpdArrayRPM[isaveRPM])_Mode$(isavemode)", assembly, state,
GXBeam.write_vtk("$(VTKsavename)_RPM$(rotSpdArrayRPM[isaveRPM])_Mode$(isavemode)_eigenmode", assembly, state,

Check warning on line 169 in src/modal.jl

View check run for this annotation

Codecov / codecov/patch

src/modal.jl#L169

Added line #L169 was not covered by tests
λ_save[isaveRPM][isavemode], eigenstates_save[isaveRPM][isavemode]; sections,mode_scaling)
end
end
Expand Down Expand Up @@ -314,7 +329,7 @@

# #write output
if feamodel.analysisType !="FA"
freq,damp,imagCompSign,U_x_0,U_y_0,U_z_0,theta_x_0,theta_y_0,theta_z_0,U_x_90,U_y_90,U_z_90,theta_x_90,theta_y_90,theta_z_90 = ModalOutput(freq,damp,phase1,phase2,imagCompSign,feamodel.outFilename)
freq,damp,imagCompSign,U_x_0,U_y_0,U_z_0,theta_x_0,theta_y_0,theta_z_0,U_x_90,U_y_90,U_z_90,theta_x_90,theta_y_90,theta_z_90 = ModalOutput(freq,damp,phase1,phase2,imagCompSign,feamodel.dataOutputFilename)
end

return freq,damp,imagCompSign,U_x_0,U_y_0,U_z_0,theta_x_0,theta_y_0,theta_z_0,U_x_90,U_y_90,U_z_90,theta_x_90,theta_y_90,theta_z_90,eigVal,eigVec
Expand Down
10 changes: 5 additions & 5 deletions src/structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mutable struct FEAModel
gravityOn
nlOn
spinUpOn
outFilename
dataOutputFilename
RayleighAlpha
RayleighBeta
elementOrder
Expand All @@ -34,7 +34,7 @@ end
gravityOn = true,
nlOn = false,
spinUpOn = false,
outFilename = "none",
dataOutputFilename = "none",
RayleighAlpha = 0.0,
RayleighBeta = 0.0,
elementOrder = 1,
Expand Down Expand Up @@ -69,7 +69,7 @@ Model inputs for FEA analysis, struct
* `gravityOn::Bool orArray{<:float}`: vector of 3 or flag to include distributed gravity acceleration (9.81m/s) in the negative z-direction
* `nlOn::Bool`: flag for solver to calculate deflection induced stiffness changes and associated convergance to the coupled solution
* `spinUpOn::Bool`: flag to perform a static analysis (warm start) prior to performing modal analysis
* `outFilename::string`: /path/to/desired/output/filename if it doesn't exist already it is created, if exists, is overwritten
* `dataOutputFilename::string`: /path/to/desired/output/filename if it doesn't exist already it is created, if exists, is overwritten
* `RayleighAlpha::float`: Rayleigh alpha damping used in timoshenko beam damping matrix
* `RayleighBeta::float`: Rayleigh beta damping used in timoshenko beam damping matrix
* `elementOrder::int`: order of element: 1 linear, 2 quadratic
Expand Down Expand Up @@ -108,7 +108,7 @@ function FEAModel(;analysisType = "TNB",
gravityOn = true,
nlOn = false,
spinUpOn = false,
outFilename = "none",
dataOutputFilename = "none",
RayleighAlpha = 0.0,
RayleighBeta = 0.0,
elementOrder = 1,
Expand Down Expand Up @@ -162,7 +162,7 @@ function FEAModel(;analysisType = "TNB",
end

return FEAModel(analysisType,initCond,aeroElasticOn,guessFreq,airDensity,
gravityOn,nlOn,spinUpOn,outFilename,RayleighAlpha,RayleighBeta,elementOrder,joint,
gravityOn,nlOn,spinUpOn,dataOutputFilename,RayleighAlpha,RayleighBeta,elementOrder,joint,
platformTurbineConnectionNodeNumber,jointTransform,reducedDOFList,nlParams,BC,nodalTerms,numModes,AddedMass_Coeff_Ca)
end

Expand Down
2 changes: 1 addition & 1 deletion test/CantileverBeamDisplacement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ for (iload,load) in enumerate(P)
nodalTerms = OWENSFEA.applyConcentratedTerms(mesh.numNodes, 6;data = nodalinputdata)

feamodel = OWENSFEA.FEAModel(;analysisType = "TNB",
outFilename = "none",
dataOutputFilename = "none",
joint,
pBC = pBC,
nodalTerms = nodalTerms,
Expand Down
2 changes: 1 addition & 1 deletion test/CantileverBeamModal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pBC = [1 1 0
1 6 0]

feamodel = OWENSFEA.FEAModel(;analysisType = "M",
outFilename = "none",
dataOutputFilename = "none",
joint = joint,
gravityOn = false,
platformTurbineConnectionNodeNumber = 1,
Expand Down
2 changes: 1 addition & 1 deletion test/CantileverBeamRotating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function runme(islinear)
for (ii,rpm) in enumerate(RPM)

feamodel = OWENSFEA.FEAModel(;analysisType = "TNB",
outFilename = "none",
dataOutputFilename = "none",
joint,
pBC = pBC,
numNodes = mesh.numNodes,
Expand Down
2 changes: 1 addition & 1 deletion test/CantileverBeamRotatingModal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pBC = [1 1 0
# mesh.numNodes 6 0]

feamodel = OWENSFEA.FEAModel(;analysisType = "M",
outFilename = "none",
dataOutputFilename = "none",
joint = joint,
gravityOn = false,
platformTurbineConnectionNodeNumber = 1,
Expand Down
2 changes: 1 addition & 1 deletion test/UnsteadyBeam.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function runOWENS()
uHist = zeros(mesh.numNodes*numDOFPerNode,numTS+1) #put here so it keeps the last RPM solution in the scope

feamodel = OWENSFEA.FEAModel(;analysisType = "TNB",
outFilename = "none",
dataOutputFilename = "none",
joint,
pBC = pBC,
numNodes = mesh.numNodes,
Expand Down
Loading