Skip to content

Commit

Permalink
Merge pull request #23 from sandialabs/modelingoptions
Browse files Browse the repository at this point in the history
Modelingoptions
  • Loading branch information
kevmoor authored Nov 22, 2024
2 parents 90e61f3 + 4b34af9 commit 3ff2ca5
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
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 @@ frequencies = autoCampbellDiagram(FEAinputs,mymesh,myel,system,assembly,sections
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 @@ If FEAinputs.analysisType == "GX" and vtksavename are specified, it will output
* `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 @@ function autoCampbellDiagram(FEAinputs,mymesh,myel,system,assembly,sections;
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 @@ function autoCampbellDiagram(FEAinputs,mymesh,myel,system,assembly,sections;
# --- 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
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]
end
gravity = [a_x_n, a_y_n, a_z_n] #TODO: from FEAinputs

# number of modes
nmode = FEAinputs.numModes
Expand Down Expand Up @@ -137,21 +152,21 @@ function autoCampbellDiagram(FEAinputs,mymesh,myel,system,assembly,sections;
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
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]
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"
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,
λ_save[isaveRPM][isavemode], eigenstates_save[isaveRPM][isavemode]; sections,mode_scaling)
end
end
Expand Down Expand Up @@ -314,7 +329,7 @@ function linearAnalysisModal(feamodel,mesh,el,displ,Omega,elStorage;returnDynMa

# #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

0 comments on commit 3ff2ca5

Please sign in to comment.