Skip to content

Commit

Permalink
ADI_c: add WrVTK_DT input for skipping timesteps for VTK outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-platt committed Dec 19, 2024
1 parent 7a0fd2d commit 073a6fb
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 40 deletions.
3 changes: 3 additions & 0 deletions modules/aerodyn/python-lib/aerodyn_inflow_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(self, library_path):
# VTK
self.WrVTK = 0 # default of no vtk output
self.WrVTK_Type = 1 # default of surface meshes
self.WrVTK_DT = 0.0 # default to all
self.VTKNacDim = np.array([-2.5,-2.5,0,10,5,5], dtype="float32") # default nacelle dimension for VTK surface rendering [x0,y0,z0,Lx,Ly,Lz] (m)
self.VTKHubRad = 1.5 # default hub radius for VTK surface rendering

Expand Down Expand Up @@ -213,6 +214,7 @@ def _initialize_routines(self):
POINTER(c_int), # storeHHVel
POINTER(c_int), # WrVTK
POINTER(c_int), # WrVTK_Type
POINTER(c_double), # WrVTK_DT -- 0 or negative to do every step
POINTER(c_float), # VTKNacDim
POINTER(c_float), # VTKHubRad
POINTER(c_int), # wrOuts -- file format for writing outputs
Expand Down Expand Up @@ -398,6 +400,7 @@ def adi_init(self, AD_input_string_array, IfW_input_string_array):
byref(c_int(self.storeHHVel)), # IN: storeHHVel
byref(c_int(self.WrVTK)), # IN: WrVTK
byref(c_int(self.WrVTK_Type)), # IN: WrVTK_Type
byref(c_double(self.WrVTK_DT)), # IN: WrVTK_DT
VTKNacDim_c, # IN: VTKNacDim
byref(c_float(self.VTKHubRad)), # IN: VTKHubRad
byref(c_int(self.wrOuts)), # IN: wrOuts -- file format for writing outputs
Expand Down
11 changes: 6 additions & 5 deletions modules/aerodyn/src/AeroDyn_Driver_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ typedef ^ ^ character(25) Fmt_a
typedef ^ ^ character(1) delim - - - "column delimiter" "-"
typedef ^ ^ character(20) outFmt - - - "Format specifier" "-"
typedef ^ ^ IntKi fileFmt - - - "Output format 1=Text, 2=Binary, 3=Both" "-"
typedef ^ ^ IntKi wrVTK - - - "0= no vtk, 1=init only, 2=animation" "-"
typedef ^ ^ IntKi WrVTK - - - "0= no vtk, 1=init only, 2=animation" "-"
typedef ^ ^ IntKi WrVTK_Type - - - "Flag for VTK output type (1=surface, 2=line, 3=both)" -
typedef ^ ^ character(1024) Root - - - "Output file rootname" "-"
typedef ^ ^ character(1024) VTK_OutFileRoot - - - "Output file rootname for vtk" "-"
typedef ^ ^ character(1024) VTK_OutFileRoot - - - "Output file rootname for vtk (includes directory)" "-"
typedef ^ ^ character(ChanLen) WriteOutputHdr {:} - - "Channel headers" "-"
typedef ^ ^ character(ChanLen) WriteOutputUnt {:} - - "Channel units" "-"
typedef ^ ^ ReKi storage ::: - - "nTurbines x nChannel x nTime"
typedef ^ ^ ReKi outLine : - - "Output line to be written to disk"
typedef ^ ^ DvrVTK_SurfaceType VTK_surface : - - "Data for VTK surface visualization"
typedef ^ ^ INTEGER VTK_tWidth - - - "Width of number of files for leading zeros in file name format" -
typedef ^ ^ INTEGER n_VTKTime - - - "Number of time steps between writing VTK files" -
typedef ^ ^ IntKi VTK_tWidth - - - "Width of number of files for leading zeros in file name format" -
typedef ^ ^ IntKi n_VTKTime - - - "Number of time steps between writing VTK files" -
typedef ^ ^ DbKi VTK_DT - - - "Write VTK time step" -
typedef ^ ^ SiKi VTKHubRad - - - "Hub radius for visualization" m
typedef ^ ^ ReKi VTKNacDim 6 - - "Nacelle dimensions for visualization" m
typedef ^ ^ SiKi VTKRefPoint 3 - - "RefPoint for VTK outputs"
Expand Down Expand Up @@ -149,7 +150,7 @@ typedef ^ ^ IntKi iCase
typedef ^ ^ ReKi timeSeries :: - - "Times series inputs when AnalysisType=1, 6 columns, Time, WndSpeed, ShearExp, RotSpd, Pitch, Yaw" "-"
typedef ^ ^ IntKi iTimeSeries - - - "Stored index to optimize time interpolation" -
typedef ^ ^ character(1024) root - - - "Output file rootname" "-"
typedef ^ ^ Dvr_Outputs out - - - "data for driver output file" "-"
typedef ^ ^ Dvr_Outputs out - - - "data for driver output file" "-"
typedef ^ ^ ADI_IW_InputData IW_InitInp - - - "" -

# ..... Data to wrap the driver ..........................................................................................................
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn_Driver_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ subroutine Init_ADI_ForDriver(iCase, ADI, dvr, FED, dt, errStat, errMsg)
InitInp%IW_InitInp%FilePassingMethod = 0_IntKi ! read input file instead of passed file data
! AeroDyn
InitInp%AD%Gravity = 9.80665_ReKi
InitInp%AD%RootName = dvr%out%Root ! 'C:/Work/XFlow/'
InitInp%AD%RootName = dvr%out%Root
InitInp%AD%InputFile = dvr%AD_InputFile
InitInp%AD%MHK = dvr%MHK
InitInp%AD%defFldDens = dvr%FldDens
Expand Down
14 changes: 9 additions & 5 deletions modules/aerodyn/src/AeroDyn_Driver_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ MODULE AeroDyn_Driver_Types
character(1) :: delim !< column delimiter [-]
character(20) :: outFmt !< Format specifier [-]
INTEGER(IntKi) :: fileFmt = 0_IntKi !< Output format 1=Text, 2=Binary, 3=Both [-]
INTEGER(IntKi) :: wrVTK = 0_IntKi !< 0= no vtk, 1=init only, 2=animation [-]
INTEGER(IntKi) :: WrVTK = 0_IntKi !< 0= no vtk, 1=init only, 2=animation [-]
INTEGER(IntKi) :: WrVTK_Type = 0_IntKi !< Flag for VTK output type (1=surface, 2=line, 3=both) [-]
character(1024) :: Root !< Output file rootname [-]
character(1024) :: VTK_OutFileRoot !< Output file rootname for vtk [-]
character(1024) :: VTK_OutFileRoot !< Output file rootname for vtk (includes directory) [-]
character(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputHdr !< Channel headers [-]
character(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputUnt !< Channel units [-]
REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: storage !< nTurbines x nChannel x nTime [-]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: outLine !< Output line to be written to disk [-]
TYPE(DvrVTK_SurfaceType) , DIMENSION(:), ALLOCATABLE :: VTK_surface !< Data for VTK surface visualization [-]
INTEGER(IntKi) :: VTK_tWidth = 0_IntKi !< Width of number of files for leading zeros in file name format [-]
INTEGER(IntKi) :: n_VTKTime = 0_IntKi !< Number of time steps between writing VTK files [-]
REAL(DbKi) :: VTK_DT = 0.0_R8Ki !< Write VTK time step [-]
REAL(SiKi) :: VTKHubRad = 0.0_R4Ki !< Hub radius for visualization [m]
REAL(ReKi) , DIMENSION(1:6) :: VTKNacDim = 0.0_ReKi !< Nacelle dimensions for visualization [m]
REAL(SiKi) , DIMENSION(1:3) :: VTKRefPoint = 0.0_R4Ki !< RefPoint for VTK outputs [-]
Expand Down Expand Up @@ -346,7 +347,7 @@ subroutine AD_Dvr_CopyDvr_Outputs(SrcDvr_OutputsData, DstDvr_OutputsData, CtrlCo
DstDvr_OutputsData%delim = SrcDvr_OutputsData%delim
DstDvr_OutputsData%outFmt = SrcDvr_OutputsData%outFmt
DstDvr_OutputsData%fileFmt = SrcDvr_OutputsData%fileFmt
DstDvr_OutputsData%wrVTK = SrcDvr_OutputsData%wrVTK
DstDvr_OutputsData%WrVTK = SrcDvr_OutputsData%WrVTK
DstDvr_OutputsData%WrVTK_Type = SrcDvr_OutputsData%WrVTK_Type
DstDvr_OutputsData%Root = SrcDvr_OutputsData%Root
DstDvr_OutputsData%VTK_OutFileRoot = SrcDvr_OutputsData%VTK_OutFileRoot
Expand Down Expand Up @@ -416,6 +417,7 @@ subroutine AD_Dvr_CopyDvr_Outputs(SrcDvr_OutputsData, DstDvr_OutputsData, CtrlCo
end if
DstDvr_OutputsData%VTK_tWidth = SrcDvr_OutputsData%VTK_tWidth
DstDvr_OutputsData%n_VTKTime = SrcDvr_OutputsData%n_VTKTime
DstDvr_OutputsData%VTK_DT = SrcDvr_OutputsData%VTK_DT
DstDvr_OutputsData%VTKHubRad = SrcDvr_OutputsData%VTKHubRad
DstDvr_OutputsData%VTKNacDim = SrcDvr_OutputsData%VTKNacDim
DstDvr_OutputsData%VTKRefPoint = SrcDvr_OutputsData%VTKRefPoint
Expand Down Expand Up @@ -478,7 +480,7 @@ subroutine AD_Dvr_PackDvr_Outputs(RF, Indata)
call RegPack(RF, InData%delim)
call RegPack(RF, InData%outFmt)
call RegPack(RF, InData%fileFmt)
call RegPack(RF, InData%wrVTK)
call RegPack(RF, InData%WrVTK)
call RegPack(RF, InData%WrVTK_Type)
call RegPack(RF, InData%Root)
call RegPack(RF, InData%VTK_OutFileRoot)
Expand All @@ -497,6 +499,7 @@ subroutine AD_Dvr_PackDvr_Outputs(RF, Indata)
end if
call RegPack(RF, InData%VTK_tWidth)
call RegPack(RF, InData%n_VTKTime)
call RegPack(RF, InData%VTK_DT)
call RegPack(RF, InData%VTKHubRad)
call RegPack(RF, InData%VTKNacDim)
call RegPack(RF, InData%VTKRefPoint)
Expand All @@ -523,7 +526,7 @@ subroutine AD_Dvr_UnPackDvr_Outputs(RF, OutData)
call RegUnpack(RF, OutData%delim); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%outFmt); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%fileFmt); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%wrVTK); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%WrVTK); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%WrVTK_Type); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%Root); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTK_OutFileRoot); if (RegCheckErr(RF, RoutineName)) return
Expand All @@ -546,6 +549,7 @@ subroutine AD_Dvr_UnPackDvr_Outputs(RF, OutData)
end if
call RegUnpack(RF, OutData%VTK_tWidth); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%n_VTKTime); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTK_DT); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTKHubRad); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTKNacDim); if (RegCheckErr(RF, RoutineName)) return
call RegUnpack(RF, OutData%VTKRefPoint); if (RegCheckErr(RF, RoutineName)) return
Expand Down
Loading

0 comments on commit 073a6fb

Please sign in to comment.