@@ -36,15 +36,18 @@ def __init__(self, wts:dict,
36
36
self .n_cell = n_cell
37
37
self .max_level = max_level
38
38
self .incflo_velocity_hh = incflo_velocity_hh
39
- self .postproc_name = postproc_name
39
+ self .postproc_name_lr = f"{ postproc_name } _lr"
40
+ self .postproc_name_hr = f"{ postproc_name } _hr"
40
41
self .buffer_lr = buffer_lr
41
42
self .buffer_hr = buffer_hr
42
43
self .ds_hr = ds_hr
43
44
self .ds_lr = ds_lr
44
45
45
46
# Placeholder variables, to be calculated by FFCaseCreation
46
- self .output_frequency = None
47
- self .sampling_labels = None
47
+ self .output_frequency_lr = None
48
+ self .output_frequency_hr = None
49
+ self .sampling_labels_lr = None
50
+ self .sampling_labels_hr = None
48
51
self .nx_lr = None
49
52
self .ny_lr = None
50
53
self .nz_lr = None
@@ -105,14 +108,18 @@ def _calc_sampling_params(self):
105
108
'''
106
109
107
110
### ~~~~~~~~~ Calculate high-level info for AMR-Wind sampling ~~~~~~~~~
108
- sampling_labels = ["Low" ]
111
+ sampling_labels_lr = ["Low" ]
112
+ self .sampling_labels_lr = sampling_labels_lr
113
+
114
+ sampling_labels_hr = []
109
115
for turbkey in self .wts :
110
116
if 'name' in self .wts [turbkey ].keys ():
111
117
wt_name = self .wts [turbkey ]['name' ]
112
118
else :
113
119
wt_name = f'T{ turbkey } '
114
- sampling_labels .append (f"High{ wt_name } _inflow0deg" )
115
- self .sampling_labels = sampling_labels
120
+ sampling_labels_hr .append (f"High{ wt_name } _inflow0deg" )
121
+
122
+ self .sampling_labels_hr = sampling_labels_hr
116
123
117
124
### ~~~~~~~~~ Calculate timestep values and AMR-Wind plane sampling frequency ~~~~~~~~~
118
125
## Low resolution domain, dt_low_les
@@ -133,7 +140,8 @@ def _calc_sampling_params(self):
133
140
self .dt_high_les = self .dt * np .floor (dt_hr_max / self .dt ) # Ensure that dt_hr is a multiple of the AMR-Wind timestep
134
141
135
142
## Sampling frequency
136
- self .output_frequency = int (self .dt_high_les / self .dt )
143
+ self .output_frequency_lr = int (np .floor (self .dt_low_les / self .dt ))
144
+ self .output_frequency_hr = int (np .floor (self .dt_high_les / self .dt ))
137
145
138
146
### ~~~~~~~~~ Calculate grid resolutions ~~~~~~~~~
139
147
## Low resolution domain, ds_lr (s = x/y/z)
@@ -373,25 +381,31 @@ def write_sampling_params(self, outdir=None):
373
381
print (f"Writing to { outfile } ..." )
374
382
with open (outfile ,"w" ) as out :
375
383
# Write high-level info for sampling
376
- sampling_labels_str = " " .join (str (item ) for item in self .sampling_labels )
384
+ sampling_labels_lr_str = " " .join (str (item ) for item in self .sampling_labels_lr )
385
+ sampling_labels_hr_str = " " .join (str (item ) for item in self .sampling_labels_hr )
377
386
out .write (f"# Sampling info generated by AMRWindSamplingCreation.py\n " )
378
- out .write (f"incflo.post_processing = { self .postproc_name } # averaging\n " )
379
- out .write (f"{ self .postproc_name } .output_format = netcdf\n " )
380
- out .write (f"{ self .postproc_name } .output_frequency = { self .output_frequency } \n " )
381
- out .write (f"{ self .postproc_name } .fields = velocity # temperature tke\n " )
382
- out .write (f"{ self .postproc_name } .labels = { sampling_labels_str } \n " )
387
+ out .write (f"incflo.post_processing = { self .postproc_name_lr } { self .postproc_name_hr } # averaging\n \n " )
388
+ out .write (f"{ self .postproc_name_lr } .output_format = netcdf\n " )
389
+ out .write (f"{ self .postproc_name_lr } .output_frequency = { self .output_frequency_lr } \n " )
390
+ out .write (f"{ self .postproc_name_lr } .fields = velocity # temperature tke\n " )
391
+ out .write (f"{ self .postproc_name_lr } .labels = { sampling_labels_lr_str } \n \n " )
392
+
393
+ out .write (f"{ self .postproc_name_hr } .output_format = netcdf\n " )
394
+ out .write (f"{ self .postproc_name_hr } .output_frequency = { self .output_frequency_hr } \n " )
395
+ out .write (f"{ self .postproc_name_hr } .fields = velocity # temperature tke\n " )
396
+ out .write (f"{ self .postproc_name_hr } .labels = { sampling_labels_hr_str } \n " )
383
397
384
398
# Write out low resolution sampling plane info
385
399
zoffsets_lr_str = " " .join (str (int (item )) for item in self .zoffsets_lr )
386
400
387
401
out .write (f"\n # Low sampling grid spacing = { self .ds_lr } m\n " )
388
- out .write (f"{ self .postproc_name } .Low.type = PlaneSampler\n " )
389
- out .write (f"{ self .postproc_name } .Low.num_points = { self .nx_lr } { self .ny_lr } \n " )
390
- out .write (f"{ self .postproc_name } .Low.origin = { self .xlow_lr :.1f} { self .ylow_lr :.1f} { self .zlow_lr :.1f} \n " ) # Round the float output
391
- out .write (f"{ self .postproc_name } .Low.axis1 = { self .xdist_lr :.1f} 0.0 0.0\n " ) # Assume: axis1 oriented parallel to AMR-Wind x-axis
392
- out .write (f"{ self .postproc_name } .Low.axis2 = 0.0 { self .ydist_lr :.1f} 0.0\n " ) # Assume: axis2 oriented parallel to AMR-Wind y-axis
393
- out .write (f"{ self .postproc_name } .Low.normal = 0.0 0.0 1.0\n " )
394
- out .write (f"{ self .postproc_name } .Low.offsets = { zoffsets_lr_str } \n " )
402
+ out .write (f"{ self .postproc_name_lr } .Low.type = PlaneSampler\n " )
403
+ out .write (f"{ self .postproc_name_lr } .Low.num_points = { self .nx_lr } { self .ny_lr } \n " )
404
+ out .write (f"{ self .postproc_name_lr } .Low.origin = { self .xlow_lr :.1f} { self .ylow_lr :.1f} { self .zlow_lr :.1f} \n " ) # Round the float output
405
+ out .write (f"{ self .postproc_name_lr } .Low.axis1 = { self .xdist_lr :.1f} 0.0 0.0\n " ) # Assume: axis1 oriented parallel to AMR-Wind x-axis
406
+ out .write (f"{ self .postproc_name_lr } .Low.axis2 = 0.0 { self .ydist_lr :.1f} 0.0\n " ) # Assume: axis2 oriented parallel to AMR-Wind y-axis
407
+ out .write (f"{ self .postproc_name_lr } .Low.normal = 0.0 0.0 1.0\n " )
408
+ out .write (f"{ self .postproc_name_lr } .Low.offsets = { zoffsets_lr_str } \n " )
395
409
396
410
# Write out high resolution sampling plane info
397
411
for turbkey in self .hr_domains :
@@ -414,10 +428,10 @@ def write_sampling_params(self, outdir=None):
414
428
zoffsets_hr_str = " " .join (str (int (item )) for item in zoffsets_hr )
415
429
416
430
out .write (f"\n # Turbine { wt_name } at (x,y) = ({ wt_x } , { wt_y } ), with D = { wt_D } , grid spacing = { self .ds_hr } m\n " )
417
- out .write (f"{ self .postproc_name } .{ sampling_name } .type = PlaneSampler\n " )
418
- out .write (f"{ self .postproc_name } .{ sampling_name } .num_points = { nx_hr } { ny_hr } \n " )
419
- out .write (f"{ self .postproc_name } .{ sampling_name } .origin = { xlow_hr :.1f} { ylow_hr :.1f} { zlow_hr :.1f} \n " ) # Round the float output
420
- out .write (f"{ self .postproc_name } .{ sampling_name } .axis1 = { xdist_hr :.1f} 0.0 0.0\n " ) # Assume: axis1 oriented parallel to AMR-Wind x-axis
421
- out .write (f"{ self .postproc_name } .{ sampling_name } .axis2 = 0.0 { ydist_hr :.1f} 0.0\n " ) # Assume: axis2 oriented parallel to AMR-Wind y-axis
422
- out .write (f"{ self .postproc_name } .{ sampling_name } .normal = 0.0 0.0 1.0\n " )
423
- out .write (f"{ self .postproc_name } .{ sampling_name } .offsets = { zoffsets_hr_str } \n " )
431
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .type = PlaneSampler\n " )
432
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .num_points = { nx_hr } { ny_hr } \n " )
433
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .origin = { xlow_hr :.1f} { ylow_hr :.1f} { zlow_hr :.1f} \n " ) # Round the float output
434
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .axis1 = { xdist_hr :.1f} 0.0 0.0\n " ) # Assume: axis1 oriented parallel to AMR-Wind x-axis
435
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .axis2 = 0.0 { ydist_hr :.1f} 0.0\n " ) # Assume: axis2 oriented parallel to AMR-Wind y-axis
436
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .normal = 0.0 0.0 1.0\n " )
437
+ out .write (f"{ self .postproc_name_hr } .{ sampling_name } .offsets = { zoffsets_hr_str } \n " )
0 commit comments