Skip to content

Usage Guide

This guide explains how to use B3P (Blade Preprocessor) via its command-line interface (CLI) and Python API. B3P processes wind turbine blade models defined in YAML files, enabling geometry creation, meshing, and analyses.

Command-Line Interface (CLI)

B3P provides a CLI with commands for building models, running analyses, and cleaning workspaces. The general syntax is:

b3p <command> <yaml_file> [options]

Key Commands

  1. Build: Constructs the 3D blade model and meshes.
    b3p build blade.yml
    
    Subcommands:
  2. geometry: Build blade geometry only.
  3. mesh: Generate meshes.
  4. drape: Drape composite plies.
  5. mass: Calculate blade mass.
  6. apply-loads: Apply loads to the mesh. Example:

    b3p build blade.yml --no-bondline
    

  7. 2D Analysis: Generates 2D sectional meshes and runs ANBA4 analysis.

    b3p 2d blade.yml
    
    Subcommands:

  8. mesh2d: Create 2D meshes.
  9. run-anba4: Run ANBA4 analysis.
  10. clean: Remove temporary msec* files. Options:
  11. --rotz <degrees>: Rotate meshes around Z-axis.
  12. --anba-env <env>: Specify Conda environment for ANBA4. Example:

    b3p 2d blade.yml --rotz 10 --anba-env anba4-env
    

  13. CCX (CalculiX): Runs 3D finite element analysis.

    b3p ccx blade.yml
    
    Subcommands:

  14. prep: Prepare CalculiX input files.
  15. solve: Solve the FEA problem.
  16. post: Post-process results.
  17. plot: Generate 2D/3D plots. Options:
  18. --bondline: Include bondline meshes.
  19. --nproc <n>: Number of processes for solving.
  20. --wildcard <pattern>: Filter input/result files. Example:

    b3p ccx blade.yml --nproc 4 --bondline
    

  21. CCBlade: Performs aerodynamic analysis.

    b3p ccblade blade.yml
    

  22. Clean: Removes temporary files from the working directory.

    b3p clean blade.yml
    

Example Workflow

To process a blade model from start to finish:

b3p clean blade.yml
b3p build blade.yml
b3p 2d blade.yml
b3p ccx blade.yml
b3p ccblade blade.yml

Python API

B3P can be used programmatically for custom workflows. Below is an example of running a CCBlade analysis:

from b3p.ccblade_run import ccblade_run

# Run CCBlade analysis
analysis = ccblade_run("blade.yml")

# Access results
print(analysis.results)

For advanced control optimization:

from b3p.ccblade_run import ccblade_run, controloptimize

blade = ccblade_run("blade.yml")
rotor = blade._setup_rotor()
copt = controloptimize(
    rotor,
    max_tipspeed=95.0,
    rtip=blade.rtip,
    rating=15e6,
    uinf=np.array([3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]),
    workdir="./custom_output"
)
copt.control_opt_below_rated(starting_tsr=8, starting_pitch=2)
output = copt.control_opt_above_rated()

Output Files

B3P generates files in the working directory (e.g., output_portable): - Mesh Files: .vtp, .vtu for 3D geometry; .xdmf for 2D meshes. - Drape Files: material_map.json, ply_bom.csv, mass.csv for composite data. - FEA Results: .frd, .vtu for CalculiX outputs. - CCBlade Results: ccblade_output.csv, ccblade_output.png, polars.png.

Use visualization tools like Paraview to inspect .vtp, .vtu, and .xdmf files.

Troubleshooting

  • File not found: Verify YAML file paths and linked files (e.g., airfoils, materials).
  • ANBA4 errors: Ensure the anba4-env Conda environment is activated.
  • CalculiX failures: Check ccx executable path and input file syntax.

Refer to Examples for detailed workflows.