Skip to content

Commit

Permalink
removal of non-functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wr1 committed Oct 13, 2024
1 parent e709c3b commit 8b2e519
Show file tree
Hide file tree
Showing 12 changed files with 297 additions and 337 deletions.
9 changes: 9 additions & 0 deletions b3p/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from . import blade
import importlib.metadata

NAME = "b3p"

try:
__version__ = importlib.metadata.version(NAME)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"
22 changes: 10 additions & 12 deletions b3p/add_te_solids.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#! /usr/bin/env python
import fire
import pyvista as pv
import pandas as pd
import numpy as np
from ruamel import yaml
import os
import glob
import json
Expand Down Expand Up @@ -207,18 +205,18 @@ def add_bondline(bladedict):
)


def add_bondline_fromfile(yaml_filename):
if not os.path.exists(yaml_filename):
exit(f"File {yaml_filename} not found.")
# def add_bondline_fromfile(yaml_filename):
# if not os.path.exists(yaml_filename):
# exit(f"File {yaml_filename} not found.")

y = yaml.YAML()
d = y.load(open(yaml_filename, "r"))
add_bondline(d)
# y = yaml.YAML()
# d = y.load(open(yaml_filename, "r"))
# add_bondline(d)


def main():
fire.Fire(add_bondline_fromfile)
# def main():
# fire.Fire(add_bondline_fromfile)


if __name__ == "__main__":
main()
# if __name__ == "__main__":
# main()
5 changes: 0 additions & 5 deletions b3p/b3p_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
)
import os
import pickle

# import numpy as np
import shutil
import glob
import multiprocessing
import os

# from ruamel import yaml


class cli:
"""Fire command line interface for b3p"""
Expand Down Expand Up @@ -67,7 +63,6 @@ def mesh(self):

def __plybook(self):
"""make plybook"""
# yaml.YAML().dump(self.dct, open("gaai.yml", "w"))
build_plybook.lamplan2plies(self.dct, self.plybookname)
return self

Expand Down
12 changes: 0 additions & 12 deletions b3p/build_blade_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import os
from copy import deepcopy as dc
import fire
import b3p.blade
import b3p.loft_utils
from ruamel import yaml
import numpy as np


Expand Down Expand Up @@ -50,13 +48,3 @@ def build_blade_geometry(config, xfoil=True):
n_sections = 50
blade.to_table(np.linspace(0, 1, n_sections), "%s_sca_%i" % (wdp, n_sections))
return blade


def run_blade_geometry(yamlfile, verbose=False):
"""Build a blade geometry from a yaml file"""
config = yaml.load(open(yamlfile, "r"), Loader=yaml.CLoader)
_ = build_blade_geometry(config, verbose=verbose)


def main():
fire.Fire(run_blade_geometry)
1 change: 0 additions & 1 deletion b3p/build_plybook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from itertools import chain, zip_longest
import pickle
import json
import shutil
from numpy import array
import copy as cp

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pandas = "^2.2.1"
numpy = "^1.26.4"
scipy = "^1.13.0"
ruamel-yaml = "^0.18.6"
fire = "^0.6.0"
fire = "^0.7.0"
vtk = "^9.3.0"
pyvista = "^0.43.5"
# ccblade = {git = "https://github.com/WISDEM/CCBlade.git", branch = "master", optional=true}
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_build
98 changes: 49 additions & 49 deletions tests/test_combine.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
import pytest
from tests.test_geometry import get_yaml, build_blade
from tests.test_structure import build_structure
from tests.test_plybook import plybook

from tests.test_drape import drape
import pyvista as pv
from b3p import combine_meshes
import os

skeys = "slab_thickness_leading_edge_core,slab_thickness_shell_triax,slab_thickness_sparcap,slab_thickness_trailing_edge_core,slab_thickness_trailing_edge_ud,slab_thickness_transition_triax".split(
","
)


@pytest.fixture(scope="session")
def combine(get_yaml, drape):
prefix = get_yaml["general"]["prefix"]
wdir = get_yaml["general"]["workdir"]
pref = os.path.join(wdir, prefix)
meshes = [f"{pref}_{i}.vtu" for i in ["shell", "w0"]]

of = f"{pref}_joined.vtu"
return combine_meshes.combine_meshes(meshes, of)


def test_combine_meshes(combine):
assert combine.n_cells == 4851
assert combine.n_points == 4800


def test_combine_meshes_hasarrays(combine):
assert combine.cell_data.keys() == "Area,Length,Normals,Volume,chord_length,d_abs_dist_from_bte,d_abs_dist_from_te,d_chord,d_le,d_le_r,d_lechord,d_lechord_abs,d_miny,d_rel_dist_from_te,d_sl,d_sla,d_te,d_te_offset,d_te_r,d_w0,d_w0_r,d_w1,d_w1_r,d_w2,d_w2_r,d_w3,d_w3_r,d_w4,d_w4_r,d_x,d_y,is_web,n_plies,ply_00000000_shell_triax,ply_00000001_shell_triax,ply_00000050_transition_triax,ply_00000051_transition_triax,ply_00000052_transition_triax,ply_00000053_transition_triax,ply_00000054_transition_triax,ply_00000055_transition_triax,ply_00000056_transition_triax,ply_00000057_transition_triax,ply_00000058_transition_triax,ply_00000059_transition_triax,ply_00000060_transition_triax,ply_00000061_transition_triax,ply_00000062_transition_triax,ply_00000063_transition_triax,ply_00000064_transition_triax,ply_00000065_transition_triax,ply_00000066_transition_triax,ply_00000067_transition_triax,ply_00000068_transition_triax,ply_00000069_transition_triax,ply_00000070_transition_triax,ply_00000071_transition_triax,ply_00000072_transition_triax,ply_00000073_transition_triax,ply_00000074_transition_triax,ply_00000075_transition_triax,ply_00000076_transition_triax,ply_00000077_transition_triax,ply_00000078_transition_triax,ply_00000079_transition_triax,ply_00000080_transition_triax,ply_00000081_transition_triax,ply_00000082_transition_triax,ply_00000083_transition_triax,ply_00000084_transition_triax,ply_00000085_transition_triax,ply_00000086_transition_triax,ply_00000087_transition_triax,ply_00000088_transition_triax,ply_00000089_transition_triax,ply_00000090_transition_triax,ply_00000091_transition_triax,ply_00000092_transition_triax,ply_00000093_transition_triax,ply_00000100_sparcap,ply_00000101_sparcap,ply_00000102_sparcap,ply_00000103_sparcap,ply_00000104_sparcap,ply_00000105_sparcap,ply_00000106_sparcap,ply_00000107_sparcap,ply_00000108_sparcap,ply_00000109_sparcap,ply_00000110_sparcap,ply_00000111_sparcap,ply_00000112_sparcap,ply_00000113_sparcap,ply_00000114_sparcap,ply_00000115_sparcap,ply_00000116_sparcap,ply_00000117_sparcap,ply_00000118_sparcap,ply_00000119_sparcap,ply_00000120_sparcap,ply_00000121_sparcap,ply_00000122_sparcap,ply_00000123_sparcap,ply_00000124_sparcap,ply_00000125_sparcap,ply_00000126_sparcap,ply_00000127_sparcap,ply_00000128_sparcap,ply_00000129_sparcap,ply_00000130_sparcap,ply_00000131_sparcap,ply_00000132_sparcap,ply_00000133_sparcap,ply_00000134_sparcap,ply_00000135_sparcap,ply_00000136_sparcap,ply_00000137_sparcap,ply_00000138_sparcap,ply_00000139_sparcap,ply_00000140_sparcap,ply_00000141_sparcap,ply_00000142_sparcap,ply_00000143_sparcap,ply_00000144_sparcap,ply_00000145_sparcap,ply_00000146_sparcap,ply_00000147_sparcap,ply_00000148_sparcap,ply_00000149_sparcap,ply_00000150_sparcap,ply_00000151_sparcap,ply_00000152_sparcap,ply_00000153_sparcap,ply_00000154_sparcap,ply_00000155_sparcap,ply_00000156_sparcap,ply_00000157_sparcap,ply_00000300_trailing_edge_ud,ply_00000301_trailing_edge_ud,ply_00000302_trailing_edge_ud,ply_00000303_trailing_edge_ud,ply_00000304_trailing_edge_ud,ply_00000305_trailing_edge_ud,ply_00000306_trailing_edge_ud,ply_00000307_trailing_edge_ud,ply_00000308_trailing_edge_ud,ply_00000309_trailing_edge_ud,ply_00000310_trailing_edge_ud,ply_00000311_trailing_edge_ud,ply_00000312_trailing_edge_ud,ply_00000313_trailing_edge_ud,ply_00000314_trailing_edge_ud,ply_00000315_trailing_edge_ud,ply_00000316_trailing_edge_ud,ply_00000317_trailing_edge_ud,ply_00000318_trailing_edge_ud,ply_00000319_trailing_edge_ud,ply_00000900_trailing_edge_core,ply_00000901_trailing_edge_core,ply_00000902_trailing_edge_core,ply_00000903_trailing_edge_core,ply_00000904_trailing_edge_core,ply_00000905_trailing_edge_core,ply_00001100_leading_edge_core,ply_00001101_leading_edge_core,ply_00001102_leading_edge_core,ply_00001103_leading_edge_core,ply_00006957_transition_triax,ply_00006958_transition_triax,ply_00006959_transition_triax,ply_00006960_transition_triax,ply_00006961_transition_triax,ply_00006962_transition_triax,ply_00006963_transition_triax,ply_00006964_transition_triax,ply_00006965_transition_triax,ply_00006966_transition_triax,ply_00006967_transition_triax,ply_00006968_transition_triax,ply_00006969_transition_triax,ply_00006970_transition_triax,ply_00006971_transition_triax,ply_00006972_transition_triax,ply_00006973_transition_triax,ply_00006974_transition_triax,ply_00006975_transition_triax,ply_00006976_transition_triax,ply_00006977_transition_triax,ply_00006978_transition_triax,ply_00006979_transition_triax,ply_00006980_transition_triax,ply_00006981_transition_triax,ply_00006982_transition_triax,ply_00006983_transition_triax,ply_00006984_transition_triax,ply_00006985_transition_triax,ply_00006986_transition_triax,ply_00006987_transition_triax,ply_00006988_transition_triax,ply_00006989_transition_triax,ply_00006990_transition_triax,ply_00006991_transition_triax,ply_00006992_transition_triax,ply_00006993_transition_triax,ply_00006994_transition_triax,ply_00006995_transition_triax,ply_00006996_transition_triax,ply_00006997_transition_triax,ply_00006998_transition_triax,ply_00006999_transition_triax,ply_00007000_transition_triax,ply_00007999_shell_triax,ply_00008000_shell_triax,radius,slab_thickness_leading_edge_core,slab_thickness_shell_triax,slab_thickness_sparcap,slab_thickness_trailing_edge_core,slab_thickness_trailing_edge_ud,slab_thickness_transition_triax,thickness,web_height,x_dir,y_dir,zone_ps,zone_ss".split(
","
)


def test_combine_slabvolumes(combine):
volumes = [(combine.cell_data[k] * combine.cell_data["Area"]).sum() for k in skeys]
assert volumes == pytest.approx(
[
5624.37386,
5071.47777,
7548.256373630906,
14595.484817536844,
823.525190,
15681.79849,
]
)
# import pytest
# from tests.test_geometry import get_yaml, build_blade
# from tests.test_structure import build_structure
# from tests.test_plybook import plybook

# from tests.test_drape import drape
# import pyvista as pv
# from b3p import combine_meshes
# import os

# skeys = "slab_thickness_leading_edge_core,slab_thickness_shell_triax,slab_thickness_sparcap,slab_thickness_trailing_edge_core,slab_thickness_trailing_edge_ud,slab_thickness_transition_triax".split(
# ","
# )


# @pytest.fixture(scope="session")
# def combine(get_yaml, drape):
# prefix = get_yaml["general"]["prefix"]
# wdir = get_yaml["general"]["workdir"]
# pref = os.path.join(wdir, prefix)
# meshes = [f"{pref}_{i}.vtu" for i in ["shell", "w0"]]

# of = f"{pref}_joined.vtu"
# return combine_meshes.combine_meshes(meshes, of)


# def test_combine_meshes(combine):
# assert combine.n_cells == 4851
# assert combine.n_points == 4800


# def test_combine_meshes_hasarrays(combine):
# assert combine.cell_data.keys() == "Area,Length,Normals,Volume,chord_length,d_abs_dist_from_bte,d_abs_dist_from_te,d_chord,d_le,d_le_r,d_lechord,d_lechord_abs,d_miny,d_rel_dist_from_te,d_sl,d_sla,d_te,d_te_offset,d_te_r,d_w0,d_w0_r,d_w1,d_w1_r,d_w2,d_w2_r,d_w3,d_w3_r,d_w4,d_w4_r,d_x,d_y,is_web,n_plies,ply_00000000_shell_triax,ply_00000001_shell_triax,ply_00000050_transition_triax,ply_00000051_transition_triax,ply_00000052_transition_triax,ply_00000053_transition_triax,ply_00000054_transition_triax,ply_00000055_transition_triax,ply_00000056_transition_triax,ply_00000057_transition_triax,ply_00000058_transition_triax,ply_00000059_transition_triax,ply_00000060_transition_triax,ply_00000061_transition_triax,ply_00000062_transition_triax,ply_00000063_transition_triax,ply_00000064_transition_triax,ply_00000065_transition_triax,ply_00000066_transition_triax,ply_00000067_transition_triax,ply_00000068_transition_triax,ply_00000069_transition_triax,ply_00000070_transition_triax,ply_00000071_transition_triax,ply_00000072_transition_triax,ply_00000073_transition_triax,ply_00000074_transition_triax,ply_00000075_transition_triax,ply_00000076_transition_triax,ply_00000077_transition_triax,ply_00000078_transition_triax,ply_00000079_transition_triax,ply_00000080_transition_triax,ply_00000081_transition_triax,ply_00000082_transition_triax,ply_00000083_transition_triax,ply_00000084_transition_triax,ply_00000085_transition_triax,ply_00000086_transition_triax,ply_00000087_transition_triax,ply_00000088_transition_triax,ply_00000089_transition_triax,ply_00000090_transition_triax,ply_00000091_transition_triax,ply_00000092_transition_triax,ply_00000093_transition_triax,ply_00000100_sparcap,ply_00000101_sparcap,ply_00000102_sparcap,ply_00000103_sparcap,ply_00000104_sparcap,ply_00000105_sparcap,ply_00000106_sparcap,ply_00000107_sparcap,ply_00000108_sparcap,ply_00000109_sparcap,ply_00000110_sparcap,ply_00000111_sparcap,ply_00000112_sparcap,ply_00000113_sparcap,ply_00000114_sparcap,ply_00000115_sparcap,ply_00000116_sparcap,ply_00000117_sparcap,ply_00000118_sparcap,ply_00000119_sparcap,ply_00000120_sparcap,ply_00000121_sparcap,ply_00000122_sparcap,ply_00000123_sparcap,ply_00000124_sparcap,ply_00000125_sparcap,ply_00000126_sparcap,ply_00000127_sparcap,ply_00000128_sparcap,ply_00000129_sparcap,ply_00000130_sparcap,ply_00000131_sparcap,ply_00000132_sparcap,ply_00000133_sparcap,ply_00000134_sparcap,ply_00000135_sparcap,ply_00000136_sparcap,ply_00000137_sparcap,ply_00000138_sparcap,ply_00000139_sparcap,ply_00000140_sparcap,ply_00000141_sparcap,ply_00000142_sparcap,ply_00000143_sparcap,ply_00000144_sparcap,ply_00000145_sparcap,ply_00000146_sparcap,ply_00000147_sparcap,ply_00000148_sparcap,ply_00000149_sparcap,ply_00000150_sparcap,ply_00000151_sparcap,ply_00000152_sparcap,ply_00000153_sparcap,ply_00000154_sparcap,ply_00000155_sparcap,ply_00000156_sparcap,ply_00000157_sparcap,ply_00000300_trailing_edge_ud,ply_00000301_trailing_edge_ud,ply_00000302_trailing_edge_ud,ply_00000303_trailing_edge_ud,ply_00000304_trailing_edge_ud,ply_00000305_trailing_edge_ud,ply_00000306_trailing_edge_ud,ply_00000307_trailing_edge_ud,ply_00000308_trailing_edge_ud,ply_00000309_trailing_edge_ud,ply_00000310_trailing_edge_ud,ply_00000311_trailing_edge_ud,ply_00000312_trailing_edge_ud,ply_00000313_trailing_edge_ud,ply_00000314_trailing_edge_ud,ply_00000315_trailing_edge_ud,ply_00000316_trailing_edge_ud,ply_00000317_trailing_edge_ud,ply_00000318_trailing_edge_ud,ply_00000319_trailing_edge_ud,ply_00000900_trailing_edge_core,ply_00000901_trailing_edge_core,ply_00000902_trailing_edge_core,ply_00000903_trailing_edge_core,ply_00000904_trailing_edge_core,ply_00000905_trailing_edge_core,ply_00001100_leading_edge_core,ply_00001101_leading_edge_core,ply_00001102_leading_edge_core,ply_00001103_leading_edge_core,ply_00006957_transition_triax,ply_00006958_transition_triax,ply_00006959_transition_triax,ply_00006960_transition_triax,ply_00006961_transition_triax,ply_00006962_transition_triax,ply_00006963_transition_triax,ply_00006964_transition_triax,ply_00006965_transition_triax,ply_00006966_transition_triax,ply_00006967_transition_triax,ply_00006968_transition_triax,ply_00006969_transition_triax,ply_00006970_transition_triax,ply_00006971_transition_triax,ply_00006972_transition_triax,ply_00006973_transition_triax,ply_00006974_transition_triax,ply_00006975_transition_triax,ply_00006976_transition_triax,ply_00006977_transition_triax,ply_00006978_transition_triax,ply_00006979_transition_triax,ply_00006980_transition_triax,ply_00006981_transition_triax,ply_00006982_transition_triax,ply_00006983_transition_triax,ply_00006984_transition_triax,ply_00006985_transition_triax,ply_00006986_transition_triax,ply_00006987_transition_triax,ply_00006988_transition_triax,ply_00006989_transition_triax,ply_00006990_transition_triax,ply_00006991_transition_triax,ply_00006992_transition_triax,ply_00006993_transition_triax,ply_00006994_transition_triax,ply_00006995_transition_triax,ply_00006996_transition_triax,ply_00006997_transition_triax,ply_00006998_transition_triax,ply_00006999_transition_triax,ply_00007000_transition_triax,ply_00007999_shell_triax,ply_00008000_shell_triax,radius,slab_thickness_leading_edge_core,slab_thickness_shell_triax,slab_thickness_sparcap,slab_thickness_trailing_edge_core,slab_thickness_trailing_edge_ud,slab_thickness_transition_triax,thickness,web_height,x_dir,y_dir,zone_ps,zone_ss".split(
# ","
# )


# def test_combine_slabvolumes(combine):
# volumes = [(combine.cell_data[k] * combine.cell_data["Area"]).sum() for k in skeys]
# assert volumes == pytest.approx(
# [
# 5624.37386,
# 5071.47777,
# 7548.256373630906,
# 14595.484817536844,
# 823.525190,
# 15681.79849,
# ]
# )
Loading

0 comments on commit 8b2e519

Please sign in to comment.