Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional gmsh integration for rectangles and boxes. #112

Merged
merged 36 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
22dc5f1
added gmsh option for boxmesh
cfrontin Dec 15, 2023
cfcc7c2
remove erroneous inclusions.
cfrontin Dec 15, 2023
76eaea0
added gmsh option for rectangular mesh.
cfrontin Dec 15, 2023
3a2143b
removed hanging debug statements...
cfrontin Dec 15, 2023
2d1b33e
turned refine back on for 2d case.
cfrontin Dec 15, 2023
1ce3b42
cleanup
cfrontin Dec 18, 2023
7dff45c
add CI
cfrontin Dec 19, 2023
3edfe9d
fix CI
cfrontin Dec 19, 2023
8aef96d
try pip install gmsh instead of conda
cfrontin Dec 19, 2023
a0ccf47
add meshio
cfrontin Dec 19, 2023
ad1d37a
meshio conda to pip
cfrontin Dec 19, 2023
577954e
added regression pyrite-standard files
cfrontin Dec 19, 2023
aedd27d
add circle and cylinder treatments, seem to be working.
cfrontin Dec 20, 2023
8258a37
touch up
cfrontin Jan 3, 2024
91d4e47
fixed dolfin-adjoint vs. dolfin mesh thingy:
cfrontin Jan 5, 2024
7b479d8
don't initialize gmsh with argv
eyoung55 Jan 18, 2024
2c3159c
demote mshr to optional dependency, in terms of imports
cfrontin Jan 22, 2024
7462ab2
updated install script and removed mshr from depenences
jefalon Jan 26, 2024
724f9e6
fix merge conflict
jefalon Jan 26, 2024
431020f
Remove mpich requirement
jefalon Jan 30, 2024
e8285b2
fix mpich to last working build
jefalon Feb 15, 2024
af9dd1c
use python script and call subprocess
eyoung55 Mar 6, 2024
f92c79a
isolate gmsh to rank-one process
cfrontin Mar 6, 2024
21c002a
Merge branch 'dev' of github.com:cfrontin/WindSE into dev
cfrontin Mar 6, 2024
d3bb641
Merge remote-tracking branch 'upstream/dev' into dev and fix small
cfrontin Mar 12, 2024
49dbc89
add mamba to conda base
jefalon Mar 12, 2024
5dfcc16
Merge branch 'dev' of https://github.com/cfrontin/WindSE into add_gmsh
jefalon Mar 12, 2024
e6d3ab9
forgot to push change to all locations
cfrontin Mar 12, 2024
48097b1
Merge branch 'dev' of github.com:cfrontin/WindSE into dev
cfrontin Mar 12, 2024
dfc1b55
Testing CI with python 3.8
jefalon Mar 20, 2024
f1b21db
tested with python 3.9
jefalon Mar 25, 2024
a03801e
7-wind_farm_2D_OM wind farm was outside of the layout bounds
jefalon Mar 26, 2024
0019e6c
removed res from options
jefalon Mar 26, 2024
a517aa3
cleaned up install script
jefalon Mar 26, 2024
cb20d31
being more exact with conda options
jefalon Mar 26, 2024
10d5719
fix channel name, spell out all options, cleaning
eyoung55 Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/CI_every_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
shell: pwsh # putting in a shell command makes for compile linking problems later
# (if you use the shell here, cannot use 'compiler' package, but mpi only seems to work with it)
run: |
conda install -n base mamba
bash ./install.sh test-environment
conda activate test-environment
conda list
Expand Down
3 changes: 1 addition & 2 deletions demo/documented/Yaml_Examples/0-wind_farm_2D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ domain:

# ########################### Circle Domain #########################
type: circle
mesh_type: mshr # squircular, elliptic, stretch
mesh_type: gmsh # squircular, elliptic, stretch
radius: 1200 # x-range of the domain | m
center: [0.0, 0.0] # y-range of the domain | m
nt: 62 # segments around circle| -
res: 50 # resolution for mshr | -
# ###################################################################


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ domain:

########################### Circle Domain #########################
type: circle
mesh_type: mshr # squircular, elliptic, stretch
mesh_type: gmsh # squircular, elliptic, stretch
radius: 1500 # x-range of the domain | m
center: [0.0, 0.0] # y-range of the domain | m
nt: 50 # segments around circle| -
Expand Down
7 changes: 3 additions & 4 deletions demo/documented/Yaml_Examples/7-wind_farm_2D_OM.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ wind_farm:
type: grid # |
grid_rows: 1 # Number of rows | -
grid_cols: 2 # Number of columns | -
ex_x: [-882, 882] # x-extent of the farm | m
ex_y: [-882, 882] # y-extent of the farm | m
ex_x: [-720, 720] # x-extent of the farm | m
ex_y: [-720, 720] # y-extent of the farm | m
jitter: 0 # Randomly perturb turbines| m
seed: 8675309 # random seed for repeats | -
##################################################################
Expand Down Expand Up @@ -57,11 +57,10 @@ domain:

########################### Circle Domain #########################
type: circle
mesh_type: mshr # squircular, elliptic, stretch
mesh_type: gmsh # squircular, elliptic, stretch
radius: 1500 # x-range of the domain | m
center: [0.0, 0.0] # y-range of the domain | m
nt: 20 # segments around circle| -
res: 10 # resolution for mshr | -
###################################################################


Expand Down
12 changes: 8 additions & 4 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ channels:
- conda-forge
- defaults
dependencies:
# - python=3.7
- python=3.9 #3.10 causes CI to hang in parallel
- mpich
# - mpich=4.1.2=hd33e60e_101
# - mpich=4.0.3
- coveralls
- dolfin-adjoint=2019.1.0
- fenics=2019.1.0=py39*_26
- fenics
- hdf5
- jsonschema
- matplotlib
- memory_profiler
- mshr
- openmdao
- pandas
- pyoptsparse
- pytest
- pytest-cov
- pytest-mpi
- pyyaml
- scipy=1.7.0
- scipy
- slepc
- sphinx<7.0.0
- pip
Expand All @@ -34,4 +36,6 @@ dependencies:
- networkx
- pulp
- fatpack
- gmsh
- meshio
- -e .
28 changes: 10 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
#!/bin/bash

### Run this to use conda in the script
source $(conda info --base)/etc/profile.d/conda.sh

# ### Create the Environment
# conda create -y --name $1
# conda activate $1
### Create some names
conda_base_path=$(conda info --base)
env_name=$1

# ### Install conda-forge dependencies
# conda install -y -c conda-forge fenics=2019.1.0=py38_9 dolfin-adjoint matplotlib scipy=1.4.1 slepc mshr hdf5 pyyaml memory_profiler pytest pytest-cov pytest-mpi coveralls pandas

# ### Install the new tsfc compiler
# pip install git+https://github.com/blechta/[email protected]
# pip install git+https://github.com/blechta/[email protected]
# pip install git+https://github.com/blechta/[email protected]
# pip install git+https://github.com/mdolab/[email protected]
# pip install singledispatch networkx pulp openmdao fatpack
### Run this to use conda in the script
source ${conda_base_path}/etc/profile.d/conda.sh

# ### Install editible version of WindSE
# pip install -e .
### Create the Environment with mamba
conda create --yes --name ${env_name} --channel conda-forge python=3.9 mamba
conda activate ${env_name}

conda env create --name ${1} --file environment.yaml
### Install dependencies from environment
mamba env update --prefix ${conda_base_path}/envs/${env_name} --file environment.yaml --prune
81 changes: 81 additions & 0 deletions tests/9-Regression/2D_Rectangle_Steady_gmsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# General options
general:
# name: 3D_Wind_Farm # Name of the output folder
output: ["mesh","initial_guess","height","turbine_force","solution"]
dolfin_adjoint: True
debug_mode: True

# Wind Farm Parameters:
wind_farm:

########################## Grid Wind Farm #########################
type: grid # |
grid_rows: 2 # Number of rows | -
grid_cols: 4 # Number of columns | -
ex_x: [-600, 600] # x-extent of the farm | m
ex_y: [-300, 300] # y-extent of the farm | m
###################################################################

turbines:
type: disk # Use actuator Disks |
HH: 90 # Hub Height | m
RD: 126.0 # Turbine Diameter | m
thickness: 20.0 # Effective Thickness | m
yaw: 0.349 # Yaw | rads
axial: 0.33 # Axial Induction | -

domain:

########################### Box Domain ############################
type: rectangle # |
x_range: [-1200, 1200] # x-range of the domain | m
y_range: [-600, 600] # y-range of the domain | m
nx: 128 # Number of x-nodes | -
ny: 64 # Number of y-nodes | -
mesh_type: gmsh
###################################################################

refine:
# warp_type: split
# warp_percent: 0.7 # percent of cells moved | -
# warp_height: 250 # move cell below this value | m
refine_custom:
1:
type: box
x_range: [-1000,1200]
y_range: [-400, 400]
# z_range: [0, 200]

turbine_num: 1 # number of turbine refinements| -
turbine_factor: 1.25 # turbine radius multiplier | -

function_space:
type: taylor_hood

boundary_conditions:
vel_profile: uniform
HH_vel: 8.0
# k: 0.4
# inflow_angle: 1.13
######## Uncomment to test out custom BCs for BoxDomain ##########
boundary_types:
inflow: ["west"]
no_stress: ["east"]
free_slip: ["north","south"]
##################################################################

problem:
type: taylor_hood
viscosity: 5
lmax: 50

solver:
# nonlinear_solver: newton
# newton_relaxation: 0.9
type: steady
save_power: true

optimization:
control_types: [layout,yaw]
layout_bounds: [[-720, 720],[-450, 450]]
gradient: True
82 changes: 82 additions & 0 deletions tests/9-Regression/3D_Box_Steady_gmsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# General options
general:
# name: 3D_Wind_Farm # Name of the output folder
output: ["mesh","initial_guess","height","turbine_force","solution"]
dolfin_adjoint: True
debug_mode: True

# Wind Farm Parameters:
wind_farm:

########################## Grid Wind Farm #########################
type: grid # |
grid_rows: 2 # Number of rows | -
grid_cols: 4 # Number of columns | -
ex_x: [-600, 600] # x-extent of the farm | m
ex_y: [-300, 300] # y-extent of the farm | m
###################################################################

turbines:
type: disk # Use actuator Disks |
HH: 90 # Hub Height | m
RD: 126.0 # Turbine Diameter | m
thickness: 20.0 # Effective Thickness | m
yaw: 0.349 # Yaw | rads
axial: 0.33 # Axial Induction | -

domain:

########################### Box Domain ############################
type: box # |
x_range: [-1200, 1200] # x-range of the domain | m
y_range: [-600, 600] # y-range of the domain | m
z_range: [0.04, 640] # z-range of the domain | m
nx: 16 # Number of x-nodes | -
ny: 8 # Number of y-nodes | -
nz: 8 # Number of z-nodes | -
mesh_type: gmsh
###################################################################

refine:
warp_type: split
warp_percent: 0.7 # percent of cells moved | -
warp_height: 250 # move cell below this value | m
refine_custom:
1:
type: box
x_range: [-1000,1200]
y_range: [-400, 400]
z_range: [0, 200]

turbine_num: 1 # number of turbine refinements| -
turbine_factor: 1.25 # turbine radius multiplier | -

function_space:
type: linear

boundary_conditions:
vel_profile: log
HH_vel: 8.0
k: 0.4
# inflow_angle: 1.13
######## Uncomment to test out custom BCs for BoxDomain ##########
boundary_types:
inflow: ["west"]
no_stress: ["east"]
free_slip: ["top","north","south"]
no_slip: ["bottom"]
##################################################################

problem:
type: stabilized
viscosity: 5
lmax: 50

solver:
type: steady
save_power: true

optimization:
control_types: [layout,yaw]
layout_bounds: [[-720, 720],[-450, 450]]
gradient: True
108 changes: 108 additions & 0 deletions tests/9-Regression/Truth_Data/2D_Rectangle_Steady_gmsh_truth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
GenericWindFarm:
min_x: -537.0
max_x: 537.0
avg_x: 0.0
min_y: -237.0
max_y: 237.0
avg_y: 0.0
min_z: 90.0
max_z: 90.0
avg_z: 90.0
min_yaw: 0.349
max_yaw: 0.349
avg_yaw: 0.349
DomainManager:
dim: 2
x_min: -1200.0
x_max: 1200.0
y_min: -600.0
y_max: 600.0
volume: 2879999.9999999944
ID_east: 1
SA_east: 1199.9999999999993
ID_north: 2
SA_north: 2399.999999999999
ID_west: 3
SA_west: 1199.9999999999998
ID_south: 4
SA_south: 2399.999999999999
FunctionSpaceManager:
velocity_dofs: 199784
pressure_dofs: 25045
total_dofs: 224829
BoundaryManager:
min_x: 8.0
max_x: 8.0
avg_x: 8.0
min_y: 0.0
max_y: 0.0
avg_y: 0.0
min_p: 0.0
max_p: 0.0
avg_p: 0.0
min_initial_values: 0.0
max_initial_values: 8.0
avg_initial_values: 3.5544169124089864
num_bc: 7
ProblemManager:
int_nu_T: 3.6195476564638705e-12
int_tf_x: -0.017779690602830505
int_tf_y: -0.006469952285041019
SolverManager:
min_x_vel: 3.1513290589444534
max_x_vel: 10.314223723630104
avg_x_vel: 7.999999999999985
min_y_vel: -1.5355717615335474
max_y_vel: 1.7312382083757618
avg_y_vel: -0.012640362247818808
OptimizationManager:
n_controls: 24
obj_value0: 0.09657585867884727
val0_x_0: -537.0
val0_y_0: -237.0
val0_x_1: -179.0
val0_y_1: -237.0
val0_x_2: 179.0
val0_y_2: -237.0
val0_x_3: 537.0
val0_y_3: -237.0
val0_x_4: -537.0
val0_y_4: 237.0
val0_x_5: -179.0
val0_y_5: 237.0
val0_x_6: 179.0
val0_y_6: 237.0
val0_x_7: 537.0
val0_y_7: 237.0
val0_yaw_0: 0.349
val0_yaw_1: 0.349
val0_yaw_2: 0.349
val0_yaw_3: 0.349
val0_yaw_4: 0.349
val0_yaw_5: 0.349
val0_yaw_6: 0.349
val0_yaw_7: 0.349
grad_x_0: -8.33214537992983e-06
grad_y_0: -2.0118478496424273e-05
grad_x_1: -5.802770168646045e-07
grad_y_1: -6.845843664967294e-07
grad_x_2: 2.423778555536142e-06
grad_y_2: 1.1422838544789697e-05
grad_x_3: 8.578153855238626e-06
grad_y_3: 1.6946275983151124e-05
grad_x_4: -1.0314760814733896e-05
grad_y_4: 2.8272220694531887e-05
grad_x_5: -8.751615197887761e-07
grad_y_5: -8.281878532430593e-06
grad_x_6: 1.6008364572576094e-06
grad_y_6: -1.2717509235006934e-05
grad_x_7: 6.279591155513218e-06
grad_y_7: -1.6236312575846403e-05
grad_yaw_0: -0.0072120688648149335
grad_yaw_1: -0.004558722084702321
grad_yaw_2: -0.004826849442760917
grad_yaw_3: -0.006876464533418879
grad_yaw_4: -0.007472719447171188
grad_yaw_5: -0.004770395674441498
grad_yaw_6: -0.004642931548333499
grad_yaw_7: -0.005883549707396079
Loading
Loading