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

Conversation

MYMahfouz
Copy link

I have used the pull request #56 as a basis and updated it to include the following:

  • Windows batch files.
  • Accept .dll controllers
  • Create Mann turbulent boxes that are used in the simulation.
  • Added a floating flag to include HydroDyn and MoorDyn.

I am planning to make more changes to include:

  • Fast Farm batch files including an option for OMP.
  • Option to add intial condition according to the wind direction and wind speed.
  • Adding wave height and Tp to the case creation.

I hope this helps. Thanks for creating the library.

BR,
Youssef

Function to create a bat file for the Mann box and execute it
Adding functions to create the fstf file from Mann Box. creating functions to create and execute .bat files for TurbSim. Adding floating flag as well as Mooring files and rotating the mooring system with the wind direction. Adding the option to have a different Hydrodyn file for each turbine which is needed for floating wind turbines. There are also some other minor changes.
Changes in example 3 to reflect the added functions
I have made all turbines be on the positive side of the x-axis because for the MannBox this is necessary. I have modified TurbSim functions to follow the same.
update shifting the turbines to do the same function if the minimum x-coordinate is higher than zero
Copy link
Collaborator

@ebranlard ebranlard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing that and sharing. I've added a couple of comments that it would be great to address. Sorry for the extra work!

adding _repr_ function
added a flag for executing MannBox .bat file.
@rthedin
Copy link
Collaborator

rthedin commented Jun 22, 2023

Hi Youssef-- Thanks for re-submitting the PR. There are a lot of changes here. I will provide detailed comments, but I will also open a discussion so we can talk about your needs and how incorporate the Mann box without modifying defaults. It is imperative that the changes are backward compatible. Let's iterate more about the changes before we pull everything in. Smaller commits with meaningful commit messages (and separate PRs) make everyone's life easier. For instance, all the formatting changes (like removing the f-strings) can/should be done in a separate commit, ideally a separate PR.

changing ex3 to the former version with only adding the new changes
@MYMahfouz
Copy link
Author

MYMahfouz commented Jun 22, 2023

Hi @rthedin ,
I am sorry I wasn't really keeping track of the changes. I did my best not to do any big changes to the code that was already there.

I believe there are two major changes:

  • The way I rotate the turbines in the _rotate_wts.
  • I stopped using the symlink as it was causing some errors and I copied the Low.bts file instead. This is however not a problem using the MannBox as only one wind field is used.

I am sorry for the mess and the big changes, I am willing to help and adjust as needed. However, I cannot redo everything step by step and recommit as this will be very time consuming.
Again thanks a lot for creating this code as it is super helpful.

Just one question. I never managed to run FASTFarm with Mod_AmbWind=3, did you run it successfully?

BR,
Youssef

Copy link
Collaborator

@rthedin rthedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the amount of comments. Let's move this to a discussion and iterate how to properly integrate the Mann boxes and your workflow into the toolbox.

Comment on lines -82 to +87
nSeeds = 6,
nSeeds = 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default number of seeds follow the IEC 61400 standard. If you need to run only one seed for the Mann boxes, then you can specify nSeeds=1 without the need to change the defaults

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed I was just making it easier for myself but you are correct.

seedValues = None,
LESpath = None,
sweepWakeSteering = False,
sweepYawMisalignment = False,
refTurb_rot = 0,
verbose = 0):
verbose = 0,
floating=0):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is certainly a good option to have!

Comment on lines -99 to +107
Max simulation time given in seconds
Wind field time given in seconds
tsim: integer
Multiple of tmax to repeat the wind field
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be something that only applied to the Mann box? I'm not sure as I haven't used Mann extensively. Changing the description of tmax to "wind field time [...]` is misleading because this also the time used on FAST.Farm.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also an option in TurbSim. Your simulation time can be multiple of your windfield time, this way you do not create big windfields.

Comment on lines 149 to +152
LESpath: str or list of strings
Full path of the LES data, if driven by LES. If None, the setup will be for TurbSim inflow.
Full path of the LES data, if driven by LES.
If TurbSim, the setup will be for TurbSim inflow.
If MannBox, the setup will be for MannBox inflow.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see a need for a different option if now we have TurbSim, Mann, and LES. This needs to be changed.

Comment on lines +185 to +186
self.TurbSimbin = TurbSimbin
self.Mannbin = Mannbin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. This is useful to have.

Comment on lines -1803 to +1967
if self.mod_wake == 1: # Polar model
self.dr = self.cmax
else: # Curled; Cartesian
self.dr = round(self.D/10)
# if self.mod_wake == 1: # Polar model
# self.dr = self.cmax
# else: # Curled; Cartesian
# self.dr = round(self.D/10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to remove this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The dr should be same as DX and this is not necessarily the same as self.cmax

print(f'Calling: {sub_command}')
_ = subprocess.call(sub_command, cwd=self.path, shell=True)
time.sleep(delay) # Sometimes the same job gets submitted twice. This gets around it.


def Create_Mannbox(self, Lm, gamma):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this function. It is a really good capability to add to this case generation tool.

Comment on lines +2295 to +2306
if nx == None:
nx=re.search('Nx :(\d+)', lines[i])
if dx == None:
dx=re.search('Dx : ((?:0|[1-9]\d*)(\.\d*)?(?:[eE][+\-]?\d+))', lines[i])
if ny == None:
ny=re.search('Ny :(\d+)', lines[i])
if dy == None:
dy=re.search('Dy : ((?:0|[1-9]\d*)(\.\d*)?(?:[eE][+\-]?\d+))', lines[i])
if nz == None:
nz=re.search('Nz :(\d+)', lines[i])
if dz == None:
dz=re.search('Dz : ((?:0|[1-9]\d*)(\.\d*)?(?:[eE][+\-]?\d+))', lines[i])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex like this should come with some comments above. It is hard to tell what is being done here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reading the parameters of the MannBox as they have to be identical to the parameters in the Inflowind.dat file

Comment on lines 114 to 128
slurm_TS_high = './SampleFiles/runAllHighBox.sh'
slurm_TS_low = './SampleFiles/runAllLowBox.sh'
slurm_FF_single = './SampleFiles/runFASTFarm_cond0_case0_seed0.sh'
slurm_TS_high = '\SampleFiles/runAllHighBox.sh'
slurm_TS_low = '/runAllLowBox.sh'
slurm_FF_single = '/runFASTFarm_cond0_case0_seed0.sh'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how I left the / here for *nix systems and should have used os.path.join instead. But by changing this to the Windows convention, you break its use. This needs to be updated to a more generic approach (e.g. using os)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I agree

Comment on lines -654 to +658
self.ServoDynFile['DLL_FileName'] = f'"{self.DLLfilepath}{t+1}.so"'
self.ServoDynFile['DLL_FileName'] = f'"{self.DLLfilepath}{t+1}.dll"'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so are used in *nix and dll in Windows. We need to identify what system the user is using or not specify the extension.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I agree

@MYMahfouz
Copy link
Author

@rthedin no worries. I have replied to all the comments.

BR,
Youssef

added batch files for turbsim and mannbox
@rthedin
Copy link
Collaborator

rthedin commented Jun 23, 2023

Closing this and moving it to a discussion: #67.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants