• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NREL / WindSE / 5524291866

pending completion
5524291866

push

github

web-flow
Update main (#104)

* minor change to warning text

* shift gauss cyld by RD

* fixed cyld, converted point to expression

* fixed jit problem

* added sharpness param to point blockage

* fixed u_k update for constraints

* fixed taylor test convergence

* Added check_totals option

* fixed constraint derivatives, and taylor test inputs

* ALM DEL method

* default params

* updating yaml params

* moving example to demo folder

* renaming example folder

* starting on acuator disks

* fixed inflow angle bug

* made the multiangle solver more robust

* fixing what the fix broke

* yep

* Added fatpack to the install script

* added pandas

* got dolfin actuator disks working

* gotta fix a form_compiler issue, but it seems all good up to the gradient

* got numpy disks working

* added stop_annotation to the debug, and changed how boundary HH velocity calculated

* updated some demos/test, fixed objectives

* initial commit to compare to refactored ALM output to dev

* test push upstream

* minor cleaning after verifying results match

* adding power calc and more cleanup

* getting ready for optimization test

* adding test file for collaborating on optimization

* storing before opt testing original branch

* pushing latest mpi_u_fluid deriv testing

* adding latest test updates

* cleaning up ALM block tests

* syncing print statements for jeff

* refactored imported wind farms

* added empty farm, updated demos/test/docs

* fixed alm adjoint bug, got all test running

* moved test_alm_refactor.yaml to other folder so it doesn't get picked up by pytest

* fixing conflicts before factoring out trans/rots

* wrap values e.g. self.mz as float to avoid jit error

* factoring translation/rotation out of u-fluid and alm

* consistent var names prev vs behind

* fix alm gradients

* take two

* fixing merge conflicts

* fixing mz dijitso error

* added missi... (continued)

4003 of 4003 new or added lines in 47 files covered. (100.0%)

4546 of 7192 relevant lines covered (63.21%)

0.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.1
/windse/PostprocessingManager.py
1
"""
2
The PostprocessingManager submodule contains the various classes used for 
3
creating different types of domains
4

5
"""
6

7
import __main__
1✔
8
import os
1✔
9
from pyadjoint.tape import no_annotations
1✔
10

11
### Get the name of program importing this package ###
12
if hasattr(__main__,"__file__"):
1✔
13
    main_file = os.path.basename(__main__.__file__)
1✔
14
else:
15
    main_file = "ipython"
×
16

17
### This checks if we are just doing documentation ###
18
if not main_file in ["sphinx-build", "__main__.py"]:
1✔
19
    from dolfin import *
1✔
20
    import os
1✔
21
    from sys import platform
1✔
22
    import numpy as np
1✔
23
    from pyadjoint.tape import stop_annotating
1✔
24
    import yaml
1✔
25

26
    ### Import the cumulative parameters ###
27
    from windse import windse_parameters
1✔
28

29
    ### Check if we need dolfin_adjoint ###
30
    if windse_parameters.dolfin_adjoint:
1✔
31
        from dolfin_adjoint import *
1✔
32
        
33
    ### This import improves the plotter functionality on Mac ###
34
    if platform == 'darwin':
1✔
35
        import matplotlib
1✔
36
        matplotlib.use('TKAgg')
1✔
37
    import matplotlib.pyplot as plt
1✔
38

39

40
def write_dict_to_yaml(yaml_filename, dict_to_write):
1✔
41
    # This custom representer ensures that numpy ndarray data is written 
42
    # without the extra binary/metadata notation that numpy would normally include
43
    def ndarray_representer(dumper: yaml.Dumper, array: np.ndarray) -> yaml.Node:
1✔
44
        return dumper.represent_list(array.tolist())
1✔
45

46
    yaml.add_representer(np.ndarray, ndarray_representer)
1✔
47

48
    with open(yaml_filename, "w") as fp:
1✔
49
        print(f"Writing file {yaml_filename}")
1✔
50
        yaml.dump(dict_to_write, fp, sort_keys=False)
1✔
51

52

53
def write_to_floris(data_to_write, solver):
1✔
54
    """ Write the desired outputs as a FLORIS input-file.
55

56
    This function creates a dictionary according to FLORIS formats
57
    (e.g., "farm":"layout_x": [-10, 0, 10]) and then stores that dictionary as
58
    a yaml file. This enables a FLORIS simulation to be launched using the
59
    outputs from a previously-computed WindSE solve.
60
    
61
    Args:
62
        data_to_write (list): A list of the WindSE variables that should be
63
        written into a FLORIS input file solver
64

65
        (windse.solver): A WindSE solver object
66
    """
67
    floris_dict = {}
1✔
68

69
    if "layout" in data_to_write:
1✔
70
        if "farm" not in floris_dict:
1✔
71
            floris_dict["farm"] = {}
1✔
72

73
        layout = solver.problem.farm.get_hub_locations()
1✔
74

75
        floris_dict["farm"]["layout_x"] = layout[:, 0]
1✔
76
        floris_dict["farm"]["layout_y"] = layout[:, 1]
1✔
77

78
    if "yaw" in data_to_write:
1✔
79
        if "farm" not in floris_dict:
×
80
            floris_dict["farm"] = {}
×
81

82
        yaws = solver.problem.farm.get_yaw_angles()
×
83

84
        floris_dict["farm"]["yaw"] = yaws
×
85

86
    # Generate the full path to the FLORIS file
87
    path_to_floris_file = os.path.join(solver.params.folder,
1✔
88
        solver.params["postprocessing"]["write_floris_filename"])
89

90
    # Finally, write the yaml file
91
    write_dict_to_yaml(path_to_floris_file, floris_dict)
1✔
92

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc