Skip to content

Commit

Permalink
make line compatible with ESI and Foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanh committed Jan 25, 2021
1 parent 60523c4 commit 6366a9d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ML_RANS/Data_generation/training_data_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ def replaceZeroes(data):
data[data == 0] = min_nonzero
return data

# Change the line below, based on U file
# Foundation users set it to 20, ESI users set it to 21
LINE = 20

def read_scalar(filename):
# Read file
file = open(filename,'r')
lines_1 = file.readlines()
file.close()

num_cells_internal = int(lines_1[20].strip('\n'))
lines_1 = lines_1[22:22+num_cells_internal]
num_cells_internal = int(lines_1[LINE].strip('\n'))
lines_1 = lines_1[LINE+2:LINE+2+num_cells_internal]

for i in range(len(lines_1)):
lines_1[i] = lines_1[i].strip('\n')
Expand All @@ -30,8 +33,8 @@ def read_vector(filename): # Only x,y components
lines_1 = file.readlines()
file.close()

num_cells_internal = int(lines_1[20].strip('\n'))
lines_1 = lines_1[22:22+num_cells_internal]
num_cells_internal = int(lines_1[LINE].strip('\n'))
lines_1 = lines_1[LINE+2:LINE+2+num_cells_internal]

for i in range(len(lines_1)):
lines_1[i] = lines_1[i].strip('\n')
Expand Down

0 comments on commit 6366a9d

Please sign in to comment.