GithubHelp home page GithubHelp logo

pcrunch's Introduction

pCrunch

IO and Post Processing Interface for OpenFAST Results.

Authors

Jake Nunemaker, Nikhar Abbas

Installation

pCrunch is installable through pip via pip install pCrunch or conda, conda install pCrunch.

Development Setup

To set up pCrunch for development, follow these steps:

  1. Download the latest version of Miniconda for the appropriate OS. Follow the remaining steps for the appropriate OS version.
  2. From the terminal, install pip by running: conda install -c anaconda pip
  3. Next, create a new environment for the project with the following.

    conda create -n pcrunch-dev

    To activate/deactivate the environment, use the following commands.

    conda activate pcrunch-dev
    conda deactivate pcrunch-dev
  4. Clone the repository: git clone https://github.com/NREL/pCrunch.git
  5. Navigate to the top level of the repository (<path-to-pCrunch>/pCrunch/) and install pCrunch as an editable package with following commands.

    pip install -e '.[dev]'
  6. (Preferred) Install the pre-commit hooks to autoformat code, ensuring consistent code style across the repository.

    pre-commit install

Examples

For an up to date example of the core functionalities, see example.ipynb. More examples coming soon.

pcrunch's People

Contributors

dzalkind avatar evan-gaertner avatar gbarter avatar jakenunemaker avatar nikhar-abbas avatar ppozzobon avatar ptrbortolotti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pcrunch's Issues

case_matrix.yaml

Can you share the case_matrix.yaml file you used in the batch_processing.ipynb file?

error in Jupyter notebook example reading OpenFAST ascii outputs

When I try running the jupyter notebook example I get an error in the section "Interacting with output files" when it tries reading my OpenFAST ASCII output files.
The error originates in line 460 of openfast.py. I believe I was able to fix it by specifying 'latin-1' within the decode method. But am unsure how robust that fix is.

The get_DELs method in class LoadsAnalysis might have some bugs with the develop branch of pCrunch

Hey there!

I am trying to use the developed version of pCrunch.

The following error occurred while executing the example.ipynb.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\Users\YUANCH~1\AppData\Local\Temp/ipykernel_2532/3394049469.py in <module>
      8 )                                           # be trimmed to (tmin, tmax(optional))
      9 
---> 10 la.process_outputs(cores=1)                 # Once LoadsAnalysis is configured, process outputs with
     11                                             # `process_outputs`. `cores` is optional but will trigger parallel processing if configured

d:\code\OpenFAST\pCrunch\pCrunch\analysis.py in process_outputs(self, cores, **kwargs)
     96 
     97         else:
---> 98             stats, extrs, dels, damage = self._process_serial(**kwargs)
     99 
    100         summary_stats, extremes, DELs, Damage = self.post_process(

d:\code\OpenFAST\pCrunch\pCrunch\analysis.py in _process_serial(self, **kwargs)
    116         for output in self.outputs:
    117             filename, stats, extrs, dels, damage = self._process_output(
--> 118                 output, **kwargs
    119             )
    120             summary_stats[filename] = stats

d:\code\OpenFAST\pCrunch\pCrunch\analysis.py in _process_output(self, f, **kwargs)
    181             extremes = output.extremes(self._ec)
    182 
--> 183         dels, damage = self.get_DELs(output, **kwargs)
    184 
    185         return output.filename, stats, extremes, dels, damage

d:\code\OpenFAST\pCrunch\pCrunch\analysis.py in get_DELs(self, output, **kwargs)
    383                 DELs[chan], D[chan] = self._compute_del(
    384                     output[chan], output.elapsed_time,
--> 385                     fatparams.lifetime,
    386                     fatparams.load2stress, fatparams.slope,
    387                     fatparams.ult_stress, fatparams.S_intercept,

AttributeError: 'int' object has no attribute 'lifetime'

I checked the source code of the analysis.py and found that the get_DELs method in class LoadsAnalysis might have some bugs.

Do you have any suggestions to fix this issue?

Thank you

Bug in parallel processing of outputs and magnitude channels?

Dear developing team,

I am trying to use the pCrunch tools to post-process a bunch of DLCs from OpenFAST runs in Python. However, I am encountering some problems. I installed the latest release through conda, as explained in the README. Following the example.ipynb script, I set up my script as follows. Please find my questions below.

outputs = load_FAST_out(outfiles) # outfiles is a list containing 56 *.outb files

magnitude_channels = {
    "RootMc1": ["RootMxc1", "RootMyc1", "RootMzc1"]}

fatigue_channels = {
    "RootMc1": FatigueParams(lifetime=25.0, slope=10.0, ult_stress=6e8)}
  
channel_extremes = [
    "RotSpeed",
    "RotThrust",
    "RotTorq",
    "RootMc1"]

la = LoadsAnalysis(outputs,                          
                   magnitude_channels=magnitude_channels,  
                   fatigue_channels=fatigue_channels,      
                   extreme_channels=channel_extremes,      
                   trim_data=(400,) # data is trimmed to (tmin, tmax(optional))
                   )

la.process_outputs(cores=1)  
  1. My first question deals with the magnitude_channels parameter. I understand from the context that it combines the vector components of e.g. a force vector, and returns the magnitude of the force. In the example script, the moment components RootMxc1, RootMyc1 and RootMzc1 together make up the magnitude RootMc1, which is then passed to the fatigue_channels. However, when I do this, I get the following warning after running la.process_outputs(): Channel 'RootMc1' not included in DEL calculation. Also, when I call enter la.summary_stats['RootMc1'] in the console, I get a KeyError. Could you please clarify what the magnitude channel should do, and whether I misunderstand its use?

When I change the fatigue_channels to a dictionary containing the moment components instead of the magnitude, it runs as expected:

fatigue_channels = {
    "RootMxc1": FatigueParams(lifetime=25.0, slope=10.0, ult_stress=6e8),
    "RootMyc1": FatigueParams(lifetime=25.0, slope=10.0, ult_stress=6e8),
    "RootMzc1": FatigueParams(lifetime=25.0, slope=10.0, ult_stress=6e8)}
  1. The first few times I tried to run the script using multiple cores. However, it seems to hang when parallel processing is enabled. When I use serial post-processing, the script takes about 45 seconds to run and finishes successfully. Using parallel processing, however, the program still didn't return anything after half an hour. For me, currently the time it takes to perform serial processing is acceptable, but it would be handy to make use of the parallel processing capability in the future. Is this a bug that you are aware of?

  2. Lastly, I am most interested in calculating the fatigue damage. Could you please provide some guidance as to how this is done using pCrunch? The DELs seem fine, but when I enter la.damage in the console, all I get are NaNs:

image

I look forward to your help.

Best,

Issues of using the pCrunch with ROSCO_toolbox

Hi all,

I am trying to use the pCrunch for OpenFAST postprocessing. The from ROSCO_toolbox.utilities import FAST_IO is not working with the error of cannot import name 'FAST_IO' from 'ROSCO_toolbox.utilities'. I did check the source code of ROSCO_toolbox and no FAST_IO found.

For using the get_DEL, the comments are presented as below. However, the ROSCO_toolbox.FAST_IO.load_output is also confusing.

<!--StartFragment-->Parameters: ----------- fast_data: list List of dictionaries containing openfast output data (returned from ROSCO_toolbox.FAST_IO.load_output) chan_info : list, tuple tuple/list containing channel names to be analyzed and corresponding fatigue slope factor "m" ie. ('TwrBsFxt',4) binNum : int number of bins for rainflow counting method (minimum=100) t : float/int Used to control DEL frequency. Default for 1Hz is 600 seconds for 10min data<!--EndFragment-->

Do you have any suggestions. Thank you

Fatigue damage and DEL calculation

Dear Team,

I am using pCrunch to calculate fatigue damage/DEL for tension time series. I am encountering some issues in interpreting the compute_del function in analysis.py.

  1. In DEL calculation line the variable 'elapsed' is used in the denominator which is the total time of the simulation. It is my understanding that this should be the total number of cycles or elapsed time * delFrequency. Could you please clarify?

  2. In the linear Endurance curve creation, based on the example given for fatpack for generating endurance curves, to generate a curve having a given slope and y-intercept of log-log SN curve of Scin, this has to be modified as :

curve = fatpack.LinearEnduranceCurve(1) #curve.Sc = 1  
curve.m = slope  
curve.Nc = Scin

This seems to produce the correct curve. Could you please have a look?

Error loading case matrix into dataframe

Hello, I'm sure this is simple for someone better versed in Python; I tried running post_BatchRun.py on some of my results and I'm getting an error message that is difficult for me to troubleshoot:

AttributeError:
"load()" has been removed, use
yaml = YAML(typ='rt')
yaml.load(...)
and register any classes that you use, or check the tag attribute on the loaded data,
instead of file "/var/folders/_5/d3c371ds5s51tt6k66y9fnh40000gn/T/ipykernel_7706/1351518608.py", line 76
case_matrix = ry.load(f, Loader=ry.Loader)

I tried replacing that line (#76) with the suggested lines,
yaml = YAML(typ='rt')
case_matrix = yaml.load(f)
but then get an error that 'YAML' is undefined. Is this placeholder text for something else, like the 'yaml.load(...)' in the error message? Is there another package I need to import?

Thanks in advance for the help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.