@@ -1047,7 +1047,8 @@ subroutine FVW_InitRegularization(x, p, m, ErrStat, ErrMsg)
10471047 write (* ,' (A,1F8.4)' ) ' RegParam (Input ) : ' ,p% WakeRegParam
10481048 endif
10491049
1050- if (p% RegDeterMethod== idRegDeterConstant) then
1050+ select case (p% RegDeterMethod)
1051+ case (idRegDeterConstant)
10511052 ! Constant reg param throughout the wake
10521053 if (p% WakeRegMethod== idRegAge) then ! NOTE: age method implies a division by rc
10531054 p% WingRegParam= max (0.01_ReKi , p% WingRegParam)
@@ -1061,7 +1062,7 @@ subroutine FVW_InitRegularization(x, p, m, ErrStat, ErrMsg)
10611062 x% W(iW)% Eps_NW(1 :3 ,:,2 ) = p% WakeRegParam ! Second age is always WakeRegParam
10621063 endif
10631064
1064- else if (p % RegDeterMethod == idRegDeterAuto) then
1065+ case ( idRegDeterAuto)
10651066 ! TODO this is beta
10661067 print * ,' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
10671068 print * ,' !!! NOTE: using optimized wake regularization parameters is still a beta feature!'
@@ -1078,14 +1079,14 @@ subroutine FVW_InitRegularization(x, p, m, ErrStat, ErrMsg)
10781079 write (* ,' (A,1F8.4)' ) ' WakeRegParam : ' , p% WakeRegParam
10791080 write (* ,' (A,1F8.4)' ) ' WingRegParam : ' , p% WingRegParam
10801081 write (* ,' (A,1F9.4)' ) ' CoreSpreadEddyVisc: ' , p% CoreSpreadEddyVisc
1081- ! Set reg param on wing and first NW
1082- ! NOTE: setting the same in all three directions for now, TODO!
1083- x% W(iW)% Eps_NW(1 :3 ,:,1 ) = p% WingRegParam ! First age is always WingRegParam (LL)
1084- if (p% nNWMax> 1 ) then
1085- x% W(iW)% Eps_NW(1 :3 ,:,2 ) = p% WakeRegParam ! Second age is always WakeRegParam
1086- endif
1082+ ! Set reg param on wing and first NW
1083+ ! NOTE: setting the same in all three directions for now, TODO!
1084+ x% W(iW)% Eps_NW(1 :3 ,:,1 ) = p% WingRegParam ! First age is always WingRegParam (LL)
1085+ if (p% nNWMax> 1 ) then
1086+ x% W(iW)% Eps_NW(1 :3 ,:,2 ) = p% WakeRegParam ! Second age is always WakeRegParam
1087+ endif
10871088
1088- else if (p % RegDeterMethod == idRegDeterChord) then
1089+ case ( idRegDeterChord)
10891090 ! Using chord to scale the reg param
10901091 do iSpan= 1 ,p% W(iW)% nSpan
10911092 x% W(iW)% Eps_NW(1 :3 , iSpan, 1 ) = p% WingRegParam * p% W(iW)% chord_CP(iSpan)
@@ -1094,7 +1095,7 @@ subroutine FVW_InitRegularization(x, p, m, ErrStat, ErrMsg)
10941095 endif
10951096 enddo
10961097
1097- else if (p % RegDeterMethod == idRegDeterSpan) then
1098+ case ( idRegDeterSpan)
10981099 ! Using dr to scale the reg param
10991100 do iSpan= 1 ,p% W(iW)% nSpan
11001101 ds = p% W(iW)% s_LL(iSpan+1 )- p% W(iW)% s_LL(iSpan)
@@ -1103,10 +1104,11 @@ subroutine FVW_InitRegularization(x, p, m, ErrStat, ErrMsg)
11031104 x% W(iW)% Eps_NW(1 :3 , iSpan, 2 ) = p% WakeRegParam * ds
11041105 endif
11051106 enddo
1106- else ! Should never happen (caught earlier)
1107+
1108+ case default ! Should never happen (caught earlier)
11071109 ErrStat = ErrID_Fatal
11081110 ErrMsg = ' Regularization determination method not implemented'
1109- endif
1111+ end select
11101112
11111113 if (iW== 1 ) then
11121114 call WrScr(' - OLAF regularization parameters (for wing 1):' )
@@ -1223,9 +1225,9 @@ subroutine SegmentsToPartWrap(Sgmt, nSeg, PartPerSegment, RegFunction, Part, all
12231225 Part% RegFunction = idRegExp ! TODO need to find a good equivalence and potentially adapt Epsilon in SegmentsToPart
12241226 endif
12251227 if (DEV_VERSION) then
1226- call find_nan_2D(Part% P , ' SegmentsToPartWrap Part%P' )
1227- call find_nan_2D(Part% Alpha, ' SegmentsToPartWrap Part%Alpha' )
1228- if (any (Part% RegParam(: )<- 9999.99_ReKi )) then
1228+ call find_nan_2D(Part% P(:, 1 :nPart) , ' SegmentsToPartWrap Part%P' )
1229+ call find_nan_2D(Part% Alpha(:, 1 :nPart) , ' SegmentsToPartWrap Part%Alpha' )
1230+ if (any (Part% RegParam(1 :nPart )<- 9999.99_ReKi )) then ! Only the active particles are filled; the preallocated tail keeps its sentinel
12291231 print * ,' Error in Segment to part conversion'
12301232 STOP
12311233 endif
@@ -1261,18 +1263,19 @@ subroutine InducedVelocitiesAll_Init(p, x, m, Sgmt, Part, Tree, Panl, ErrStat, E
12611263 Sgmt% nAct = nSeg
12621264 Sgmt% nActP = nSegP
12631265
1264- ! --- Convert to particles if needed
1265- if ((p% VelocityMethod(iVel)==idVelocityTreePart) .or. (p% VelocityMethod(iVel)==idVelocityPart)) then
1266+ select case (p% VelocityMethod(iVel))
1267+ case (idVelocityPart)
1268+ ! --- Convert segments to particles
12661269 call SegmentsToPartWrap(Sgmt, nSeg, p% PartPerSegment(iVel), p% RegFunction, Part, allocPart= allocPart)
1267- endif
1268-
1269- ! --- Grow tree if needed
1270- if (p % VelocityMethod(iVel)==idVelocityTreePart) then
1270+ case (idVelocityTreePart)
1271+ ! --- Convert segments to particles
1272+ call SegmentsToPartWrap(Sgmt, nSeg, p % PartPerSegment(iVel), p % RegFunction, Part, allocPart = allocPart)
1273+ ! --- Grow particle tree
12711274 call grow_tree_part(Tree, Part% nAct, Part% P, Part% Alpha, Part% RegFunction, Part% RegParam, 0 )
1272-
1273- elseif (p % VelocityMethod(iVel)==idVelocityTreeSeg) then
1275+ case (idVelocityTreeSeg)
1276+ ! --- Grow segment tree
12741277 call grow_tree_segment(Tree, nSeg, Sgmt% Points, Sgmt% Connct(:,1 :nSeg), Sgmt% Gamma(1 :nSeg), p% RegFunction, Sgmt% Epsilon (1 :nSeg), 0 )
1275- endif
1278+ end select
12761279
12771280 ! --- Src
12781281 Panl% p_Src = > p% SrcPnl
@@ -1298,20 +1301,26 @@ subroutine InducedVelocitiesAll_Calc(CPs, nCPs, Uind, p, Sgmt, Part, Tree, Panl,
12981301 ErrStat= ErrID_None
12991302 ErrMsg = ' '
13001303
1301- if (p% VelocityMethod(iVel)==idVelocityBasic) then
1304+ select case (p% VelocityMethod(iVel))
1305+ case (idVelocityBasic)
13021306 call ui_seg( 1 , nCPs, CPs, 1 , Sgmt% nAct, Sgmt% Points, Sgmt% Connct, Sgmt% Gamma, Sgmt% RegFunction, Sgmt% Epsilon, Uind)
13031307
1304- elseif (p % VelocityMethod(iVel)== idVelocityTreePart) then
1308+ case ( idVelocityTreePart)
13051309 ! Tree has already been grown with InducedVelocitiesAll_Init
13061310 ! call print_tree(Tree)
1307- call ui_tree_part(Tree, nCPs, CPs, p% TreeBranchFactor(iVel), Tree % DistanceDirect , Uind, ErrStat, ErrMsg)
1311+ call ui_tree_part(Tree, nCPs, CPs, p% TreeBranchFactor(iVel), 0.0_ReKi , Uind, ErrStat, ErrMsg)
13081312
1309- elseif (p % VelocityMethod(iVel)== idVelocityPart) then
1313+ case ( idVelocityPart)
13101314 call ui_part_nograd(nCPs, CPs, Part% nAct, Part% P, Part% Alpha, Part% RegFunction, Part% RegParam, Uind)
13111315
1312- elseif (p% VelocityMethod(iVel)==idVelocityTreeSeg) then
1313- call ui_tree_segment(Tree, CPs, nCPs, p% TreeBranchFactor(iVel), Tree% DistanceDirect, Uind, ErrStat, ErrMsg)
1314- endif
1316+ case (idVelocityTreeSeg)
1317+ call ui_tree_segment(Tree, CPs, nCPs, p% TreeBranchFactor(iVel), 0.0_ReKi , Uind, ErrStat, ErrMsg)
1318+
1319+ case default
1320+ ErrStat = ErrID_Fatal
1321+ ErrMsg = ' Velocity method not implemented'
1322+
1323+ end select
13151324
13161325 ! --- Src Panels
13171326 if (associated (Panl% p_Src)) then
@@ -1338,19 +1347,25 @@ subroutine InducedVelocitiesAll_End(p, Tree, Part, Panl, ErrStat, ErrMsg, deallo
13381347 ErrStat= ErrID_None
13391348 ErrMsg = ' '
13401349
1341- if (p% VelocityMethod(iVel)==idVelocityBasic) then
1350+ select case (p% VelocityMethod(iVel))
1351+ case (idVelocityBasic)
13421352 ! Nothing
13431353
1344- elseif (p % VelocityMethod(iVel)== idVelocityTreePart) then
1354+ case ( idVelocityTreePart)
13451355 if (deallocPart) deallocate (Part% P, Part% Alpha, Part% RegParam)
13461356 call cut_tree(Tree)
13471357
1348- elseif (p % VelocityMethod(iVel)== idVelocityPart) then
1358+ case ( idVelocityPart)
13491359 if (deallocPart) deallocate (Part% P, Part% Alpha, Part% RegParam)
13501360
1351- elseif (p % VelocityMethod(iVel)== idVelocityTreeSeg) then
1361+ case ( idVelocityTreeSeg)
13521362 call cut_tree(Tree) ! We do not deallocate segment
1353- endif
1363+
1364+ case default
1365+ ErrStat = ErrID_Fatal
1366+ ErrMsg = ' Velocity method not implemented'
1367+
1368+ end select
13541369
13551370 ! Src Panels (we nullify only)
13561371 nullify(Panl% p_Src)
@@ -1547,26 +1562,31 @@ subroutine LiftingLineInducedVelocities(p, x, InductionAtCP, iDepthStart, m, Err
15471562
15481563 ! --- Compute velocity on LL
15491564 ! TreeSeg is faster but introduce some noise, so we keep this open for the user to choose
1550- if (p% VelocityMethod(iVel) == idVelocityBasic) then
1565+ select case (p% VelocityMethod(iVel))
1566+ case (idVelocityBasic)
15511567 call ui_seg( 1 , nCPs, CPs, 1 , nSeg, m% Sgmt% Points, m% Sgmt% Connct, m% Sgmt% Gamma, m% Sgmt% RegFunction, m% Sgmt% Epsilon, Uind)
15521568
1553- else if (p % VelocityMethod(iVel) == idVelocityPart) then
1569+ case ( idVelocityPart)
15541570 call SegmentsToPartWrap(m% Sgmt, nSeg, p% PartPerSegment(iVel), p% RegFunction, m% Part, allocPart= .false. )
15551571 call ui_part_nograd(nCPs, CPs, m% Part% nAct, m% Part% P, m% Part% Alpha, m% Part% RegFunction, m% Part% RegParam, Uind)
15561572 ! deallocate(Part%P, Part%Alpha, Part%RegParam)
15571573
1558- else if (p % VelocityMethod(iVel) == idVelocityTreeSeg) then
1574+ case ( idVelocityTreeSeg)
15591575 call grow_tree_segment(Tree, nSeg, m% Sgmt% Points, m% Sgmt% Connct(:,1 :nSeg), m% Sgmt% Gamma(1 :nSeg), m% Sgmt% RegFunction, m% Sgmt% Epsilon (1 :nSeg), 0 )
15601576 call ui_tree_segment(Tree, CPs, nCPs, p% TreeBranchFactor(iVel), DistanceDirect, Uind, ErrStat, ErrMsg)
15611577 call cut_tree(Tree)
15621578
1563- else if (p % VelocityMethod(iVel) == idVelocityTreePart) then
1579+ case ( idVelocityTreePart)
15641580 call SegmentsToPartWrap(m% Sgmt, nSeg, p% PartPerSegment(iVel), p% RegFunction, m% Part, allocPart= .false. )
15651581 call grow_tree_part(Tree, m% Part% nAct, m% Part% P, m% Part% Alpha, m% Part% RegFunction, m% Part% RegParam, 0 )
15661582 call ui_tree_part(Tree, nCPs, CPs, p% TreeBranchFactor(iVel), DistanceDirect, Uind, ErrStat, ErrMsg)
15671583 ! deallocate(Part%P, Part%Alpha, Part%RegParam)
15681584 call cut_tree(Tree)
1569- endif
1585+
1586+ case default
1587+ ErrStat = ErrID_Fatal
1588+ ErrMsg = ' Velocity method not implemented'
1589+ end select
15701590 ! --- Src Panel contribution
15711591 if (p% SrcPnl% n> 0 ) then
15721592 call ui_quad_src_nn(CPs, m% SrcPnl% RHS, p% SrcPnl% xi, p% SrcPnl% eta, p% SrcPnl% Pcent, p% SrcPnl% R_g2p, Uind, nCPs, p% SrcPnl% n)
0 commit comments