Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 5665bfb

Browse files
authored
Merge pull request #3 from rybchuk/sampling_mult
Ensure LR output freq is a multiple of HR
2 parents 9d24cf5 + e749a3b commit 5665bfb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyFAST/fastfarm/AMRWindSimulation.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ def _calc_sampling_params(self):
140140
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
141141

142142
## Sampling frequency
143-
self.output_frequency_lr = int(np.floor(self.dt_low_les/self.dt))
144143
self.output_frequency_hr = int(np.floor(self.dt_high_les/self.dt))
144+
output_frequency_lr_max = int(np.floor(self.dt_low_les/self.dt))
145+
self.output_frequency_lr = self.output_frequency_hr * np.floor(output_frequency_lr_max/self.output_frequency_hr)
145146

146147
### ~~~~~~~~~ Calculate grid resolutions ~~~~~~~~~
147148
## Low resolution domain, ds_lr (s = x/y/z)
@@ -283,6 +284,8 @@ def _check_sampling_params(self):
283284
raise ValueError(f"AMR-Wind timestep too coarse for high resolution domain! AMR-Wind timestep must be at least {self.dt_high_les} sec.")
284285
if self.dt_high_les > self.dt_low_les:
285286
raise ValueError(f"Low resolution timestep ({self.dt_low_les}) is finer than high resolution timestep ({self.dt_high_les})!")
287+
if self.output_frequency_lr % self.output_frequency_hr != 0:
288+
raise ValueError(f"Low resolution output frequency of {self.output_frequency_lr} not a multiple of the high resolution frequency {self.output_frequency_hr}!")
286289

287290
## Grid resolution checks
288291
if self.ds_low_les < self.dx0:

0 commit comments

Comments
 (0)