• 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

50.0
/windse/objective_functions/BoxBlockage.py
1
################## HEADER DO NOT EDIT ##################
2
import os
1✔
3
import __main__
1✔
4

5
### Get the name of program importing this package ###
6
if hasattr(__main__,"__file__"):
1✔
7
    main_file = os.path.basename(__main__.__file__)
1✔
8
else:
9
    main_file = "ipython"
×
10
    
11
### This checks if we are just doing documentation ###
12
if not main_file in ["sphinx-build", "__main__.py"]:
1✔
13
    from dolfin import *
1✔
14
    from dolfin_adjoint import *
1✔
15
########################################################
16

17

18
### Additional import statements ###
19
import numpy as np
1✔
20

21
### Declare Unique name
22
name = "box_blockage"
1✔
23

24

25
### Set default keyword argument values ###
26
keyword_defaults = {
1✔
27
    "p0":   None,
28
    "p1" :  None,
29
}
30

31

32
### Define objective function
33
def objective(solver, inflow_angle = 0.0, first_call=False, **kwargs):
1✔
34
    '''
35
    This is a simple blockage metric that integrates the velocity deficit in 
36
    a plane in front of or above the farm.
37

38
    Keyword arguments:
39
        p0: the corner of the box with the smallest values
40
        p1: the corner of the box with the largest values
41
    '''
42

43
    ### Extract keyword arguments
44
    p0 = list(kwargs.pop("p0"))
×
45
    p1 = list(kwargs.pop("p1"))
×
46

47
    # ### Create measure
48
    plane_marker = Expression('((x[0] > xa && x[0] <= xb) && (x[1] > ya && x[1] <= yb) && (x[2] > za && x[2] <= zb)) ? 1 : 0 ', xa=p0[0],ya=p0[1],za=p0[2],xb=p1[0],yb=p1[1],zb=p1[2], degree=2)
×
49
    # plane_marker = Expression('x[0] < lb ? 0.0 : (x[0] > ub ? 0.0 : 1.0)', lb=-300.0, ub=300.0, degree=1)
50
    # plane_marker = Expression('x[0] < pl[0] ? 0.0 : 1.0 ', pl=p0, degree=2)
51

52
    # Save the measure (for debugging)
53
    # test = project(plane_marker,solver.problem.fs.Q)
54
    # File("test.pvd")<<test
55
    # exit()
56

57
    ### Calculate the volume
58
    dx = Measure('dx', domain=solver.problem.dom.mesh)
×
59
    V = assemble(plane_marker*dx)
×
60

61
    if V <= 1e-10:
×
62
        J = np.nan
×
63
        print("Warning: No area of integration for plane blockage, refine mesh or increase thickness.")
×
64
    else:
65
        ### Compute velocity deficit
66
        # u_ref = solver.problem.bd.bc_velocity[0]
67
        # u     = solver.problem.u_k[0]
68
        # ud    = (u - u_ref)/u_ref
69
        # ud    = u
70

71
        ### Evaluate objective ###
72
        J = assemble(plane_marker*solver.problem.u_k[0]*dx)/V
×
73
    return J
×
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

© 2026 Coveralls, Inc