Skip to content

Commit

Permalink
Quentin 05/11/2024: bf convertTypesInCompute when lower and upper cas…
Browse files Browse the repository at this point in the history
…es are mixed in STR%var / str%VAR / StR%vaR
  • Loading branch information
QuentinRodier committed Nov 5, 2024
1 parent d6a1668 commit 8383a08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/convertTypesInCompute_before.F90
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ SUBROUTINE RAIN_ICE ( D, CST, PARAMI, ICEP, ICED, ELECP, ELECD, BUCONF, &
ELSE
ZRICE=PRIT(JIJ,JK)+PRST(JIJ,JK)+PRGT(JIJ,JK)
ENDIF
ZDEVIDE = CST%XCPD + CST%XCPV*PRVT(JIJ,JK) + CST%XCL*(PRCT(JIJ,JK)+PRRT(JIJ,JK)) + CST%XCI*ZRICE
ZDEVIDE = CST%XCPD + cst%XCPV*PRVT(JIJ,JK) + CST%xcl*(PRCT(JIJ,JK)+PRRT(JIJ,JK)) + CST%XCI*ZRICE
ZT(JIJ,JK) = PTHT(JIJ,JK) * PEXN(JIJ,JK)
ZZ_LSFACT(JIJ,JK)=(CST%XLSTT+(CST%XCPV-CST%XCI)*(ZT(JIJ,JK)-CST%XTT)) / ZDEVIDE
ZZ_LVFACT(JIJ,JK)=(CST%XLVTT+(CST%XCPV-CST%XCL)*(ZT(JIJ,JK)-CST%XTT)) / ZDEVIDE
Expand Down
5 changes: 3 additions & 2 deletions src/pyft/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ def convertTypesInCompute(self):
def convertOneType(component, newVarList, scope):
# 1) Build the name of the new variable
objType = scope.getParent(component, 2) # The object STR%VAR
objTypeStr = alltext(objType)
objTypeStr = alltext(objType).upper()
namedENn = objType.find('.//{*}N/{*}n')
structure = namedENn.text
variable = component.find('.//{*}ct').text
variable = component.find('.//{*}ct').text.upper()
# If the variable is an array with index selection
# such as ICED%XRTMIN(1:KRR)
arrayIndices = ''
Expand All @@ -165,6 +165,7 @@ def convertOneType(component, newVarList, scope):
for elem in objType.findall('.//{*}element'):
arrayIndices = arrayIndices + alltext(elem)
newName = variable[0] + structure + variable[1:] + arrayIndices
newName = newName.upper()

# 2) Replace the namedE>N>n by the newName and delete R-LT
# except for array with index selection (R-LT is moved)
Expand Down

0 comments on commit 8383a08

Please sign in to comment.