diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index fd601a3d49..2a941bef2b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,3 +16,17 @@ **Test results, if applicable** + + diff --git a/.github/actions/tests-module-aerodyn/action.yml b/.github/actions/tests-module-aerodyn/action.yml index bc83c599e0..14ed3a34df 100644 --- a/.github/actions/tests-module-aerodyn/action.yml +++ b/.github/actions/tests-module-aerodyn/action.yml @@ -1,9 +1,25 @@ name: 'AeroDyn module tests' description: 'Run tests specific to the AeroDyn module' author: 'Rafael Mudafort https://github.com/rafmudaf' + + +inputs: + test-target: + description: 'Which tests to run: unit | regression | all' + default: 'all' + runs: using: "composite" steps: - - run: ctest -VV -R fvw_utest + - run: | + + if [[ ${{ inputs.test-target }} == "unit" ]] || [[ ${{ inputs.test-target }} == "all" ]]; then + ctest -VV -R fvw_utest + fi + + if [[ ${{ inputs.test-target }} == "regression" ]] || [[ ${{ inputs.test-target }} == "all" ]]; then + ctest -VV -j7 -R ad_ + fi + working-directory: ${{runner.workspace}}/build shell: bash diff --git a/.github/actions/tests-module-subdyn/action.yml b/.github/actions/tests-module-subdyn/action.yml new file mode 100644 index 0000000000..62d76630b9 --- /dev/null +++ b/.github/actions/tests-module-subdyn/action.yml @@ -0,0 +1,9 @@ +name: 'SubDyn module tests' +description: 'Run tests specific to the SubDyn module' +author: 'Rafael Mudafort https://github.com/rafmudaf' +runs: + using: "composite" + steps: + - run: ctest -VV -j7 -R SD_ + working-directory: ${{runner.workspace}}/build + shell: bash diff --git a/.github/actions/utils/increment_conda_build.py b/.github/actions/utils/increment_conda_build.py new file mode 100644 index 0000000000..52266b752d --- /dev/null +++ b/.github/actions/utils/increment_conda_build.py @@ -0,0 +1,35 @@ + +from shutil import copyfile + +# Open existing meta.yaml and another one +metayaml = open('meta.yaml') +outyaml = open('out.yaml', 'w') + +# Find the build number, increment it, and write to the new yaml +found = False +for line in metayaml: + if "number:" in line: + found = True + # For the line containing the build number, parse the number and increment + elements = [e.strip() for e in line.split(":")] + if not elements[1].isnumeric(): + raise ValueError("Build number is not parsable: {}".format(line)) + + old_build_number = int(elements[1]) + new_build_number = old_build_number + 1 + + # Write new build number to new yaml + outyaml.write(line.replace(str(old_build_number), str(new_build_number))) + else: + # Write all other lines to new yaml + outyaml.write(line) + +if not found: + raise Exception("Error incrementing the build number.") + +# Clean up +metayaml.close() +outyaml.close() + +# Replace original meta.yaml with the new one +copyfile('out.yaml', 'meta.yaml') diff --git a/.github/workflows/automated-dev-tests.yml b/.github/workflows/automated-dev-tests.yml index 1a7c6f7baa..bcad3daf93 100644 --- a/.github/workflows/automated-dev-tests.yml +++ b/.github/workflows/automated-dev-tests.yml @@ -4,16 +4,16 @@ name: 'Development Pipeline' on: push: paths-ignore: + - 'LICENSE' + - 'README.rst' - 'docs/**' - 'share/**' - 'vs-build/**' pull_request: - types: [opened, synchronize] #labeled, assigned] - paths-ignore: - - 'docs/**' - - 'share/**' - - 'vs-build/**' + types: [opened, synchronize, edited, reopened] #labeled, assigned] + # Pull request event triggers are unrelated to paths + # paths-ignore: env: FORTRAN_COMPILER: gfortran-10 @@ -25,7 +25,7 @@ env: # os: [macOS-10.14, ubuntu-18.04] jobs: - regression-test: + regression-tests-release: runs-on: ubuntu-20.04 steps: - name: Checkout @@ -59,12 +59,18 @@ jobs: working-directory: ${{runner.workspace}}/build run: cmake --build . --target install -- -j ${{env.NUM_PROCS}} + - name: Run AeroDyn tests + uses: ./.github/actions/tests-module-aerodyn + with: + test-target: regression - name: Run BeamDyn tests uses: ./.github/actions/tests-module-beamdyn with: test-target: regression - name: Run HydroDyn tests uses: ./.github/actions/tests-module-hydrodyn + - name: Run SubDyn tests + uses: ./.github/actions/tests-module-subdyn - name: Run OpenFAST tests # if: contains(github.event.head_commit.message, 'Action - Test All') || contains(github.event.pull_request.labels.*.name, 'Action - Test All') uses: ./.github/actions/tests-gluecode-openfast @@ -73,7 +79,7 @@ jobs: uses: actions/upload-artifact@v2 if: failure() with: - name: test-results + name: regression-tests-release path: | ${{runner.workspace}}/build/reg_tests/modules ${{runner.workspace}}/build/reg_tests/glue-codes/openfast @@ -84,6 +90,118 @@ jobs: !${{runner.workspace}}/build/reg_tests/glue-codes/openfast/UAE_VI !${{runner.workspace}}/build/reg_tests/glue-codes/openfast/WP_Baseline + regression-tests-debug: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@main + with: + submodules: recursive + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install numpy Bokeh==1.4 + + - name: Setup Workspace + run: cmake -E make_directory ${{runner.workspace}}/build + - name: Configure Build + working-directory: ${{runner.workspace}}/build + run: | + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install \ + -DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \ + -DCMAKE_BUILD_TYPE:STRING=Debug \ + -DBUILD_TESTING:BOOL=ON \ + -DCTEST_PLOT_ERRORS:BOOL=ON \ + ${GITHUB_WORKSPACE} + + - name: Build OpenFAST + working-directory: ${{runner.workspace}}/build + run: | + cmake --build . --target aerodyn_driver -- -j ${{env.NUM_PROCS}} + cmake --build . --target beamdyn_driver -- -j ${{env.NUM_PROCS}} + cmake --build . --target hydrodyn_driver -- -j ${{env.NUM_PROCS}} + cmake --build . --target subdyn_driver -- -j ${{env.NUM_PROCS}} + + - name: Run AeroDyn tests + uses: ./.github/actions/tests-module-aerodyn + with: + test-target: regression + - name: Run BeamDyn tests + uses: ./.github/actions/tests-module-beamdyn + with: + test-target: regression + - name: Run HydroDyn tests + uses: ./.github/actions/tests-module-hydrodyn + - name: Run SubDyn tests + uses: ./.github/actions/tests-module-subdyn + + - name: Failing test artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: regression-tests-debug + path: | + ${{runner.workspace}}/build/reg_tests/modules + + fastfarm-regression-test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@main + with: + submodules: recursive + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install numpy Bokeh==1.4 + + - name: Setup Workspace + run: cmake -E make_directory ${{runner.workspace}}/build + - name: Configure Build + working-directory: ${{runner.workspace}}/build + run: | + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install \ + -DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \ + -DOPENMP:BOOL=ON \ + -DBUILD_FASTFARM:BOOL=ON \ + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ + -DBUILD_TESTING:BOOL=ON \ + -DCTEST_PLOT_ERRORS:BOOL=ON \ + ${GITHUB_WORKSPACE} + - name: Build FAST.Farm + # if: contains(github.event.head_commit.message, 'Action - Test All') || contains(github.event.pull_request.labels.*.name, 'Action - Test All') + working-directory: ${{runner.workspace}}/build + run: | + cmake --build . --target FAST.Farm -- -j ${{env.NUM_PROCS}} + cmake --build . --target regression_tests -- -j ${{env.NUM_PROCS}} + + - name: Run FAST.Farm tests + # if: contains(github.event.head_commit.message, 'Action - Test All') || contains(github.event.pull_request.labels.*.name, 'Action - Test All') + run: | + ctest -VV -L fastfarm -j ${{env.NUM_PROCS}} + working-directory: ${{runner.workspace}}/build + shell: bash + + - name: Failing test artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: test-results + path: | + ${{runner.workspace}}/build/reg_tests/glue-codes/fastfarm + unit-test: runs-on: ubuntu-20.04 steps: @@ -111,6 +229,8 @@ jobs: uses: ./.github/actions/tests-module-nwtclibrary - name: Run AeroDyn tests uses: ./.github/actions/tests-module-aerodyn + with: + test-target: unit - name: Run BeamDyn tests uses: ./.github/actions/tests-module-beamdyn with: @@ -121,6 +241,7 @@ jobs: compile-all-single-precision: # Test if single precision compile completes. # Compiles all targets excluding tests. + # Run with the OpenFAST registry generating the types files. # Do not run the test suite. runs-on: ubuntu-20.04 @@ -139,6 +260,7 @@ jobs: -DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \ -DCMAKE_BUILD_TYPE:STRING=Debug \ -DDOUBLE_PRECISION:BOOL=OFF \ + -DGENERATE_TYPES:BOOL=ON \ ${GITHUB_WORKSPACE} - name: Build all working-directory: ${{runner.workspace}}/build @@ -146,3 +268,57 @@ jobs: - name: Test working-directory: ${{runner.workspace}}/build run: ./glue-codes/openfast/openfast -v + + cpp-interface-tests: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@main + with: + submodules: recursive + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install numpy Bokeh==1.4 + sudo apt-get update + sudo apt-get install -y libhdf5-dev libopenmpi-dev libyaml-cpp-dev + + - name: Setup Workspace + run: cmake -E make_directory ${{runner.workspace}}/build + - name: Configure Build + working-directory: ${{runner.workspace}}/build + run: | + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install \ + -DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \ + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ + -DBUILD_OPENFAST_CPP_API:BOOL=ON \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DBUILD_TESTING:BOOL=ON \ + -DCTEST_PLOT_ERRORS:BOOL=ON \ + ${GITHUB_WORKSPACE} + - name: Build OpenFAST C++ API + # if: contains(github.event.head_commit.message, 'Action - Test All') || contains(github.event.pull_request.labels.*.name, 'Action - Test All') + working-directory: ${{runner.workspace}}/build + run: | + cmake --build . --target openfastcpp -- -j ${{env.NUM_PROCS}} + cmake --build . --target regression_tests -- -j ${{env.NUM_PROCS}} + + - name: Run OpenFAST C++ API tests + working-directory: ${{runner.workspace}}/build + run: | + ctest -VV -L cpp + + - name: Failing test artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: test-results + path: | + ${{runner.workspace}}/build/reg_tests/glue-codes/openfast-cpp + !${{runner.workspace}}/build/reg_tests/glue-codes/openfast-cpp/5MW_Baseline diff --git a/.github/workflows/conda-deploy.yml b/.github/workflows/conda-deploy.yml new file mode 100644 index 0000000000..78083fc763 --- /dev/null +++ b/.github/workflows/conda-deploy.yml @@ -0,0 +1,49 @@ + +name: 'Conda Deployment Pipeline' + +on: + push: + branches: + - 'dev' + paths-ignore: + - 'LICENSE' + - 'README.rst' + - 'docs/**' + - 'share/**' + - 'vs-build/**' + +jobs: + update-dev: + if: github.repository_owner == 'OpenFAST' + runs-on: ubuntu-20.04 + steps: + # - name: Echo path + # run: | + # echo ${{runner.workspace}} # /home/runner/work/openfast + # echo $GITHUB_WORKSPACE # /home/runner/work/openfast/openfast + - name: Checkout OpenFAST/dev + uses: actions/checkout@main + with: + path: ${{runner.workspace}}/openfast + ref: dev + + - name: Checkout openfast-feedstock + uses: actions/checkout@main + with: + repository: conda-forge/openfast-feedstock + token: ${{ secrets.ACTIONS_TOKEN }} + path: ./openfast-feedstock + ref: dev + + - name: Prep the meta.yaml + run: python ${{runner.workspace}}/openfast/.github/actions/utils/increment_conda_build.py + working-directory: ./openfast-feedstock/recipe + + - name: Push Project B + run: | + cd ./openfast-feedstock + git add recipe/meta.yaml + git config user.name github-actions + git config user.email github-actions@github.com + git commit -m "Increment build number for dev label" + git push diff --git a/CMakeLists.txt b/CMakeLists.txt index e98907948c..998caa12b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,15 @@ option(USE_DLL_INTERFACE "Enable runtime loading of dynamic libraries" on) option(FPE_TRAP_ENABLED "Enable FPE trap in compiler options" off) option(ORCA_DLL_LOAD "Enable OrcaFlex Library Load" on) option(BUILD_OPENFAST_CPP_API "Enable building OpenFAST - C++ API" off) -option(OPENMP "Enable OpenMP support" off) +option(BUILD_FASTFARM "Enable building FAST.Farm" off) +option(OPENMP "Enable OpenMP support" off) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + # Configure the default install path to openfast/install + set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH "OpenFAST install directory" FORCE) +endif() +if(APPLE) + option(CMAKE_MACOSX_RPATH "Use RPATH runtime linking" on) +endif() # Precompiler/preprocessor flag configuration # Do this before configuring modules so that the flags are included @@ -60,7 +68,7 @@ if (FPE_TRAP_ENABLED) endif (FPE_TRAP_ENABLED) # Setup dependencies -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") +if (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") find_package(MKL) endif() if (MKL_FOUND) @@ -73,6 +81,9 @@ else() find_package(LAPACK REQUIRED) endif() +# Set the RPATH after configuring the install prefix +include(${CMAKE_SOURCE_DIR}/cmake/set_rpath.cmake) + ######################################################################## # Build rules for OpenFAST Registry # @@ -105,6 +116,8 @@ set(OPENFAST_MODULES icedyn icefloe map + wakedynamics + awae ) set(OPENFAST_REGISTRY_INCLUDES "" CACHE INTERNAL "Registry includes paths") @@ -150,11 +163,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenFASTConfig.cmake DESTINATION lib/cmake/OpenFAST) ######################################################################## -# Configure the default install path to openfast/install -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH - "OpenFAST install directory" FORCE) -endif() # Option configuration if(BUILD_TESTING) diff --git a/README.rst b/README.rst index 76e3affe43..aff210097c 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,8 @@ OpenFAST |actions| |nbsp| |rtfd| -.. |actions| image:: https://github.com/openfast/openfast/workflows/OpenFAST%20Build%20and%20Test/badge.svg?branch=dev - :target: https://github.com/OpenFAST/openfast/actions?query=workflow%3A%22OpenFAST+Build+and+Test%22 +.. |actions| image:: https://github.com/openfast/openfast/actions/workflows/automated-dev-tests.yml/badge.svg?branch=dev + :target: https://github.com/OpenFAST/openfast/actions/workflows/automated-dev-tests.yml?query=workflow%3A%22Development+Pipeline%22 :alt: Build Status .. |rtfd| image:: https://readthedocs.org/projects/openfast/badge/?version=dev :target: https://openfast.readthedocs.io/en/dev @@ -12,11 +12,12 @@ OpenFAST .. |nbsp| unicode:: 0xA0 :trim: -OpenFAST is a wind turbine simulation tool which builds on FAST v8. It was -created with the goal of being a community model developed and used by research -laboratories, academia, and industry. It is managed by a dedicated team at the -National Renewable Energy Lab. Our objective is to ensure that OpenFAST is -sustainable software that is well tested and well documented. If you'd like +OpenFAST is a wind turbine simulation tool which builds on FAST v8. FAST.Farm +extends the capability of OpenFAST to simulate multi-turbine wind farms. They were +created with the goal of being community models developed and used by research +laboratories, academia, and industry. They are managed by a dedicated team at the +National Renewable Energy Lab. Our objective is to ensure that OpenFAST and FAST.Farm +are sustainable software that are well tested and well documented. If you'd like to contribute, see the `Developer Documentation `_ and any open GitHub issues with the `Help Wanted `_ @@ -24,27 +25,34 @@ tag. **OpenFAST is under active development**. -FAST v8 - OpenFAST v0.1.0 -------------------------- -The transition from FAST v8 to OpenFAST v0.1.0 represents the effort to better +FAST v8 - OpenFAST +------------------ +The transition from FAST v8 to OpenFAST represents the effort to better support an open-source developer community around FAST-based aero-hydro-servo- elastic engineering models of wind-turbines and wind-plants. OpenFAST is the next generation of FAST analysis tools. More information is available in the `transition notes `_. -FAST v8 is a computer-aided engineering tool for simulating the coupled dynamic -response of wind turbines. FAST joins aerodynamics models, hydrodynamics models +FAST v8, now OpenFAST, is a physics-based engineering tool for simulating the coupled dynamic +response of wind turbines. OpenFAST joins aerodynamics models, hydrodynamics models for offshore structures, control and electrical system (servo) dynamics models, and structural (elastic) dynamics models to enable coupled nonlinear aero- -hydro-servo-elastic simulation in the time domain. The FAST tool enables the +hydro-servo-elastic simulation in the time domain. The OpenFAST tool enables the analysis of a range of wind turbine configurations, including two- or three-blade horizontal-axis rotor, pitch or stall regulation, rigid or teetering hub, upwind or downwind rotor, and lattice or tubular tower. The wind turbine can be modeled on land or offshore on fixed-bottom or floating -substructures. FAST is based on advanced engineering models derived from +substructures. OpenFAST is based on advanced engineering models derived from fundamental laws, but with appropriate simplifications and assumptions, and supplemented where applicable with computational solutions and test data. +With OpenFAST, you can run large numbers of nonlinear time-domain simulations +in approximately real time to enable standards-based loads analysis for predicting +wind system ultimate and fatigue loads. You can also linearize the underlying +nonlinear model about an operating point to understand the system response +and enable the calculation of natural frequencies, damping, and mode shapes; +the design of controllers, and analysis of aero-elastic instabilities. + The aerodynamic models use wind-inflow data and solve for the rotor-wake effects and blade-element aerodynamic loads, including dynamic stall. The hydrodynamics models simulate the regular or irregular incident waves and @@ -57,7 +65,18 @@ structural-dynamics models apply the control and electrical system reactions, apply the aerodynamic and hydrodynamic loads, adds gravitational loads, and simulate the elasticity of the rotor, drivetrain, and support structure. Coupling between all models is achieved through a modular -interface and coupler. +interface and coupler (glue code). + +FAST.Farm extends the capabilities of OpenFAST to provide physics-based +engineering simulation of multi-turbine land-based, fixed-bottom offshore, +and floating offshore wind farms. With FAST.Farm, you can simulate each wind +turbine in the farm with an OpenFAST model and capture the relevant +physics for prediction of wind farm power performance and structural loads, +including wind farm-wide ambient wind, super controller, and wake advection, +meandering, and merging. FAST.Farm maintains computational efficiency +through parallelization to enable loads analysis for predicting the ultimate +and fatigue loads of each wind turbine in the farm. + Documentation ------------- @@ -75,21 +94,22 @@ versions of the documentation: These can be toggled with the ``v: latest`` button in the lower left corner of the docs site. -Obtaining OpenFAST ------------------- -OpenFAST is hosted entirely on GitHub so you are in the `right place `_! +Obtaining OpenFAST and FAST.Farm +-------------------------------- +OpenFAST and FAST.Farm are hosted entirely on GitHub so you are in the +`right place `_! The repository is structured with two branches following the "git-flow" convention: -* ``master`` +* ``main`` * ``dev`` -The ``master`` branch is stable, well tested, and represents the most up to -date released version of OpenFAST. The latest commit on ``master`` contains -a tag with version info and brief release notes. The tag history can be +The ``main`` branch is stable, well tested, and represents the most up to +date released versions of OpenFAST and FAST.Farm. The latest commit on ``main`` +contains a tag with version info and brief release notes. The tag history can be obtained with the ``git tag`` command and viewed in more detail on `GitHub Releases `_. For general -use, the ``master`` branch is highly recommended. +use, the ``main`` branch is highly recommended. The ``dev`` branch is generally stable and tested, but not static. It contains new features, bug fixes, and documentation updates that have not been compiled @@ -112,7 +132,8 @@ Details for compiling `compiling `_, `using `_, and `developing `_ -OpenFAST on Unix-based and Windows machines are available at `readthedocs `_. +OpenFAST and FAST.Farm on Unix-based and Windows machines are available at +`readthedocs `_. Help ---- @@ -122,21 +143,21 @@ Please use `GitHub Issues `_ to: * report bugs * request code enhancements -For other questions regarding OpenFAST, please contact -`Mike Sprague `_. - Users and developers may also be interested in the NREL National Wind -Technology Center (NWTC) `phpBB Forum `_. +Technology Center (NWTC) `phpBB Forum `_, +which is still maintained and has a long history of FAST-related questions +and answers. Acknowledgments --------------- -OpenFAST is maintained and developed by researchers and software engineers at -the `National Renewable Energy Laboratory `_ (NREL), with -support from the US Department of Energy's Wind Energy Technology Office. NREL -gratefully acknowledges development contributions from the following +OpenFAST and FAST.Farm are maintained and developed by researchers and software +engineers at the `National Renewable Energy Laboratory `_ +(NREL), with support from the US Department of Energy's Wind Energy Technology +Office. NREL gratefully acknowledges development contributions from the following organizations: * Envision Energy USA, Ltd * Brigham Young University +* The University of Massachusetts * `Intel® Parallel Computing Center (IPCC) `_ diff --git a/cmake/FindMatlab.cmake b/cmake/FindMatlab.cmake index 3180b470f4..c50878ef53 100644 --- a/cmake/FindMatlab.cmake +++ b/cmake/FindMatlab.cmake @@ -233,6 +233,11 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2020b=9.9" + "R2020a=9.8" + "R2019b=9.7" + "R2019a=9.6" + "R2018b=9.5" "R2018a=9.4" "R2017b=9.3" "R2017a=9.2" @@ -1712,4 +1717,4 @@ if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) Matlab_MEXEXTENSIONS_PROG Matlab_MEX_EXTENSION ) -endif() \ No newline at end of file +endif() diff --git a/cmake/OpenfastFortranOptions.cmake b/cmake/OpenfastFortranOptions.cmake index 4822218a72..4e02fd4633 100644 --- a/cmake/OpenfastFortranOptions.cmake +++ b/cmake/OpenfastFortranOptions.cmake @@ -42,7 +42,7 @@ macro(set_fast_fortran) # Abort if we do not have gfortran or Intel Fortran Compiler. if (NOT (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" OR - ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")) + ${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")) message(FATAL_ERROR "OpenFAST requires either GFortran or Intel Fortran Compiler. Compiler detected by CMake: ${FCNAME}.") endif() @@ -54,7 +54,7 @@ macro(set_fast_fortran) elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "4.6.0") message(FATAL_ERROR "A version of GNU GFortran greater than 4.6.0 is required. GFortran version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.") endif() - elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "11") message(FATAL_ERROR "A version of Intel ifort greater than 11 is required. ifort version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.") endif() @@ -68,7 +68,7 @@ macro(set_fast_fortran) # Get OS/Compiler specific options if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") set_fast_gfortran() - elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") set_fast_intel_fortran() endif() endmacro(set_fast_fortran) @@ -120,7 +120,7 @@ macro(set_fast_gfortran) # debug flags if(CMAKE_BUILD_TYPE MATCHES Debug) - set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fcheck=all,no-array-temps -pedantic -fbacktrace " ) + set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fcheck=all,no-array-temps -pedantic -fbacktrace -finit-real=inf -finit-integer=9999." ) endif() if(CYGWIN) diff --git a/cmake/set_rpath.cmake b/cmake/set_rpath.cmake new file mode 100644 index 0000000000..0e3cb9a671 --- /dev/null +++ b/cmake/set_rpath.cmake @@ -0,0 +1,32 @@ +# +# Copyright 2021 National Renewable Energy Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# When building, don't use the install RPATH already (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +# Add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# The RPATH to be used when installing, but only if it's not a system directory +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +endif("${isSystemDir}" STREQUAL "-1") diff --git a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf index 15976008ba..bfc1297884 100644 Binary files a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf and b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf differ diff --git a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex index ecb9723e06..1e891a7c30 100644 --- a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex +++ b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex @@ -18,9 +18,10 @@ %\newtheorem{definition}{Definition} %\newtheorem{remark}{Remark} %\numberwithin{equation}{section} +\renewcommand*{\thefootnote}{\fnsymbol{footnote}} %----------------------------------------------------------- \begin{document} -\title{Algorithms in OpenFAST v2} +\title{Solve Algorithms in OpenFAST} \author{Bonnie Jonkman} %\begin{abstract} %This document is used to describe the algorithms implemented in FAST v8. @@ -85,19 +86,19 @@ \section{Input-Output Relationships} \State % SolveOption2a_Inp2BD \State $\mathit{y\_ED} \gets \Call{ED\_CalcOutput}{\mathit{p\_ED},\mathit{u\_ED},\mathit{x\_ED},\mathit{xd\_ED},\mathit{z\_ED}}$ - \State $\mathit{u\_BD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED}}$ + \State $\mathit{u\_BD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED,y\_SrvD}}$ \State % SolveOption2b_Inp2IfW \State $\mathit{y\_BD} \gets \Call{BD\_CalcOutput}{\mathit{p\_BD},\mathit{u\_BD},\mathit{x\_BD},\mathit{xd\_BD},\mathit{z\_BD}}$ - \State $\mathit{u\_AD}($no IfW$) \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED}}$ + \State $\mathit{u\_AD}($no IfW$) \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED,y\_BD}}$ \State $\mathit{u\_IfW} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED} at \mathit{u\_AD} nodes}$ \State % SolveOption2c_Inp2AD_SrvD \State $\mathit{y\_IfW} \gets \Call{IfW\_CalcOutput}{\mathit{u\_IfW} and other \mathit{IfW} data structures}$ \State $\mathit{u\_AD}($InflowWind only$) \gets \Call{TransferOutputsToInputs}{\mathit{y\_IfW}}$ - \State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED},\mathit{y\_IfW}}$ + \State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED},\mathit{y\_IfW},\mathit{y\_BD}}$ \State % main @@ -108,7 +109,7 @@ \section{Input-Output Relationships} & \mathit{x\_SrvD},\mathit{xd\_SrvD},\mathit{z\_SrvD}) \\ \end{aligned}$ \State $\mathit{u\_ED} \gets \Call{TransferOutputsToInputs}{\mathit{y\_AD},\mathit{y\_SrvD}}$ - \State $\mathit{u\_BD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_AD}}$ + \State $\mathit{u\_BD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_AD,y\_SrvD}}$ % \end SolveOption2 %%%% @@ -125,6 +126,7 @@ \section{Input-Output Relationships} \State $\mathit{u\_FEAM} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$ \State $\mathit{u\_MD} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$ \State $\mathit{u\_Orca} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$ + \State $\mathit{u\_SrvD\%PtfmStC} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$\footnote{Only if using ServoDyn Structural control with platform TMD.} % \end Transfer_ED_to_HD_SD_BD_Mooring %%%% @@ -133,7 +135,7 @@ \section{Input-Output Relationships} \State \State $\mathit{u\_IfW} \gets \Call{TransferOutputsToInputs}{\mathit{u\_AD},\mathit{y\_ED}}$ \State $\mathit{u\_AD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED}}$ - \State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED},\mathit{y\_AD}}$ + \State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED},\mathit{y\_AD},\mathit{y\_BD},\mathit{y\_SD}}$ \EndProcedure \end{algorithmic} @@ -169,8 +171,9 @@ \section{Input-Output Relationships} \State $\mathit{y\_FEAM} \gets \Call{CalcOutput}{\mathit{p\_FEAM},\mathit{u\_FEAM},\mathit{x\_FEAM},\mathit{xd\_FEAM},\mathit{z\_FEAM}}$ \State $\mathit{y\_IceF} \gets \Call{CalcOutput}{\mathit{p\_IceF},\mathit{u\_IceF},\mathit{x\_IceF},\mathit{xd\_IceF},\mathit{z\_IceF}}$ \State $\mathit{y\_IceD(:)} \gets \Call{CalcOutput}{\mathit{p\_IceD(:)},\mathit{u\_IceD(:)},\mathit{x\_IceD(:)},\mathit{xd\_IceD(:)},\mathit{z\_IceD(:)}}$ + \State $\mathit{y\_SrvD} \gets \Call{CalcOutput}{\mathit{p\_SrvD},\mathit{u\_SrvD},\mathit{x\_SrvD},\mathit{xd\_SrvD},\mathit{z\_SrvD}}$\footnote{Only if using ServoDyn Structural control with platform TMD.} \State - \State\Comment{Form $u$ vector using loads and accelerations from $\mathit{u\_HD}$, $\mathit{u\_BD}$, $\mathit{u\_SD}$, $\mathit{u\_Orca}$, $\mathit{u\_ExtPtfm}$, and platform reference input from $\mathit{u\_ED}$} + \State\Comment{Form $u$ vector using loads and accelerations from $\mathit{u\_HD}$, $\mathit{u\_BD}$, $\mathit{u\_SD}$, $\mathit{u\_Orca}$, $\mathit{u\_ExtPtfm}$, $\mathit{u\_SrvD}$\footnote{Only if using ServoDyn Structural control with platform TMD and SubDyn.} and platform reference input from $\mathit{u\_ED}$} \State \State $u \gets \Call{u\_vec}{\mathit{u\_HD},\mathit{u\_SD},\mathit{u\_ED},\mathit{u\_BD},\mathit{u\_Orca},\mathit{u\_ExtPtfm}}$ \State $k \gets 0$ @@ -194,6 +197,7 @@ \section{Input-Output Relationships} \State$\mathit{u\_IceF\_tmp} \gets \Call{TransferMeshMotions}{y\_SD}$ \State$\mathit{u\_IceD\_tmp(:)} \gets \Call{TransferMeshMotions}{y\_SD}$ \State$\mathit{u\_HD\_tmp} \gets \Call{TransferMeshMotions}{y\_ED,y\_SD}$ + \State$\mathit{u\_SrvD\_tmp} \gets \Call{TransferMeshMotions}{y\_ED,y\_SD}$\footnote{Only if using ServoDyn Structural control with platform TMD.} \State$\mathit{u\_SD\_tmp} \gets \! \begin{aligned}[t] & \Call{TransferMeshMotions}{\mathit{y\_ED}} \\ @@ -210,11 +214,19 @@ \section{Input-Output Relationships} & \mathit{y\_HD}, \mathit{u\_HD\_tmp}, \\ & \mathit{y\_SD}, \mathit{u\_SD\_tmp}, \\ & \mathit{y\_MAP}, \mathit{u\_MAP\_tmp}, \\ - & \mathit{y\_FEAM},\mathit{u\_FEAM\_tmp} ) + & \mathit{y\_FEAM},\mathit{u\_FEAM\_tmp},\\ + & \mathit{y\_SrvD},\mathit{u\_SrvD\_tmp}\footnote{Only if using ServoDyn Structural control with platform TMD.} ) % SrvD%PtfmStC only \end{aligned}$ \State - \State$\mathit{U\_Residual} \gets u - \Call{u\_vec}{\mathit{u\_HD\_tmp},\mathit{u\_SD\_tmp},\mathit{u\_ED\_tmp},\mathit{u\_BD\_tmp},\mathit{u\_Orca\_tmp},\mathit{u\_ExtPtfm\_tmp}}$ + \State$\mathit{U\_Residual} \gets u - \Call{u\_vec}{}( \! + \begin{aligned}[t] & \mathit{u\_HD\_tmp}, \\ + & \mathit{u\_SD\_tmp}, \\ + & \mathit{u\_ED\_tmp}, \\ + & \mathit{u\_BD\_tmp}, \\ + & \mathit{u\_Orca\_tmp},\\ + & \mathit{u\_ExtPtfm\_tmp}) + \end{aligned}$ \State \If{ last Jacobian was calculated at least $\mathit{DT\_UJac}$ seconds ago } @@ -255,6 +267,7 @@ \section{Input-Output Relationships} \State $\mathit{u\_FEAM} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$ \State $\mathit{u\_IceF} \gets \Call{TransferMeshMotions}{\mathit{y\_SD}}$ \State $\mathit{u\_IceD(:)} \gets \Call{TransferMeshMotions}{\mathit{y\_SD}}$ + \State $\mathit{u\_SrvD} \gets \Call{TransferMeshMotions}{\mathit{y\_ED,y\_SD}}$\footnote{Only if using ServoDyn Structural control with platform TMD.} % For SrvD%PtfmStC \EndProcedure \end{algorithmic} diff --git a/docs/OtherSupporting/OutListParameters.xlsx b/docs/OtherSupporting/OutListParameters.xlsx index 18d640a052..aeb7f5289c 100644 Binary files a/docs/OtherSupporting/OutListParameters.xlsx and b/docs/OtherSupporting/OutListParameters.xlsx differ diff --git a/docs/_static/assets_download.jpg b/docs/_static/assets_download.jpg new file mode 100644 index 0000000000..ed5e874ae0 Binary files /dev/null and b/docs/_static/assets_download.jpg differ diff --git a/docs/conf.py b/docs/conf.py index 2c72935c69..2dc8ff73f6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -115,9 +115,9 @@ def runDoxygen(sourcfile, doxyfileIn, doxyfileOut): # built documents. # # The short X.Y version. -version = u'2.6' +version = u'3.0' # The full version, including alpha/beta/rc tags. -release = u'v2.6.0' +release = u'v3.0.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/dev/build_doc.rst b/docs/source/dev/build_doc.rst index 91fcc2d982..fdffa55561 100644 --- a/docs/source/dev/build_doc.rst +++ b/docs/source/dev/build_doc.rst @@ -4,9 +4,9 @@ Developing Documentation ======================== OpenFAST documentation is hosted on `readthedocs `_. It is automatically generated -through the ``readthedocs`` build system from both the ``master`` and ``dev`` +through the ``readthedocs`` build system from both the ``main`` and ``dev`` branches whenever new commits are added. This documentation uses the -`restructured text `_ +`restructured text `_ markup language. Building this documentation locally diff --git a/docs/source/dev/types_files.rst b/docs/source/dev/types_files.rst index 61c3154e04..8e7473029b 100644 --- a/docs/source/dev/types_files.rst +++ b/docs/source/dev/types_files.rst @@ -9,7 +9,7 @@ comply with the OpenFAST Framework. The module types are generally auto-generated by an included program called *OpenFAST Registry*. The OpenFAST Registry is written in C and adapted from a similar utility used in `WRF `__. -Visit the `OpenFAST Registry README `__ +Visit the `OpenFAST Registry README `__ for more information. The OpenFAST Registry requires an input file to describe the necessary types diff --git a/docs/source/install/index.rst b/docs/source/install/index.rst index cba321cc12..bc714a11f8 100644 --- a/docs/source/install/index.rst +++ b/docs/source/install/index.rst @@ -5,27 +5,53 @@ Installing OpenFAST Guidelines and procedures for obtaining precompiled binaries or compiling OpenFAST from source code are described here. While there are multiple ways to achieve the same outcome, the OpenFAST team has developed -a comprehensive and well thought out system for compiling the source code. -Thus, the methods described here are the only officially supported and +a comprehensive and well-thought out system for installation, so the methods +described here are the only officially supported and maintained paths for obtaining an OpenFAST executable. -For Windows users only, precompiled binaries are available as described in the -:ref:`download_binaries` section. For all platforms, OpenFAST is configured -to build with with CMake and a system-appropriate build tool. Background -on CMake is given in :ref:`understanding_cmake`, and procedures for configuring -and compiling are given in :ref:`cmake_unix` and :ref:`cmake_windows`. Finally, -an alternative and more appropriate option for compiling on Windows while -doing active software development is given in :ref:`vs_windows`. +Most users of OpenFAST will not require modifying or compiling the source +code. **For the simplest installation of OpenFAST without changing the source +code,** refer to the table in the :ref:`download_binaries` section and read +the corresponding documentation for specific instructions. +For instructions on compiling, see :ref:`compile_from_source`. .. _download_binaries: Download binaries ~~~~~~~~~~~~~~~~~ +For users who intend to run OpenFAST simulations without changing the +source code, installation with precompiled binaries is recommended. +The installation procedures are specific for each supported operating +system, and the table below maps operating systems to the method for +obtaining binaries. "Release" versions are well tested and stable versions +of OpenFAST. A new release corresponds to a merge from the ``dev`` +branch of the repository to the ``main`` branch along with a version tag. +"Prerelease" versions contain the latest commits to the ``dev`` branch +and may contain unstable code but will always have the latest features. + +================== ================= ===================== ====================== + Operating System Method OpenFAST Version Docs Section +================== ================= ===================== ====================== +Linux Conda Release, Prerelease :ref:`conda_install` +macOS Conda Release, Prerelease :ref:`conda_install` +macOS Homebrew Release :ref:`brew_install` +Windows GitHub Releases Release :ref:`gh_install` +================== ================= ===================== ====================== + +.. _conda_install: + +Conda Installation +------------------ OpenFAST releases are distributed through the `Anaconda `_ -package manager via the `conda forge `_ channel for -macOS and Linux. The OpenFAST glue-code executable as well as the available -module drivers are included in the installation. The following commands -describe how to create a new environment and install OpenFAST. +package manager via the `OpenFAST Conda Forge `_ +channel for macOS and Linux. The installation includes + +- OpenFAST glue-code executable +- Available module drivers +- C++ header files + +The following commands describe how to create a new environment, install +OpenFAST, and test the installation. .. code-block:: bash @@ -36,102 +62,200 @@ describe how to create a new environment and install OpenFAST. conda install -c conda-forge openfast # Test OpenFAST + which openfast openfast -v -For Windows users, each tagged release is accompanied by precompiled binaries. -DLL's for MAP and the DISCON controllers are also included. -The following architecture and precision combinations are currently -available: + # Test the HydroDyn driver + which hydrodyn_driver + hydrodyn_driver -v + +Prereleases can be installed via conda by specifying the ``dev`` label, +as shown below. + +.. code-block:: bash -- 32 bit single precision -- 64 bit single precision -- 64 bit double precision + conda install -c conda-forge/label/dev openfast -All precompiled binaries can be found in the ``Assets`` dropdown in the -`GitHub Releases `__. -To download the latest binaries, click -`here `__. +These are always the latest commits to the ``dev`` branch +of the repository and contain the latest changes to OpenFAST, but these +builds are not as well tested as the full release versions. +.. _brew_install: + +Homebrew Installation +--------------------- +For macOS systems, OpenFAST releases are distributed through +the `Homebrew `_ package manager. The installation includes +only the OpenFAST glue-code executable. + +To install with Homebrew and test the installation, use the following +commands. + +.. code-block:: bash + + # Update Homebrew + brew update + + # Install OpenFAST + brew search openfast + brew install openfast + + # Test OpenFAST + which openfast + openfast -v + +.. _gh_install: + +GitHub Releases +--------------- +For Windows systems only, precompiled binaries are made available for each +release on the OpenFAST GitHub `Releases `_ +page. The binaries are compiled with the Intel Fortran compiler +version 2020. .. important:: - The precompiled binaries require either the Intel fortran - compiler or the Intel MKL redistributable libraries, which are not by - default included with the binaries. To configure the libraries, download the - installers from `here `__ - and run the MSI file(s) to install the libraries. If you have a - Command Prompt open, you will need to close it after installing the libraries - in order for the changes to take effect. + The precompiled binaries require either the Intel Fortran + compiler or the Intel MKL redistributable libraries, which are + not by default included with the binaries. To configure the + libraries, download the installers from the bottom of + `this page `__. + If you have a Command Prompt open, you will need to close it after + installing the libraries in order for the changes to take effect. + Admin privileges are required to install the Intel libraries. + +The OpenFAST executables can be downloaded from the "Assets" dropdown +in each Release. The two assets named "Source code" are not needed. + +.. image:: ../../_static/assets_download.jpg + :align: center + +The zipped file contains the following items: + +================================================== ============================================== + File Name Description +================================================== ============================================== +openfast_Win32.exe 32-bit single precision +openfast_x64.exe 64-bit single precision +openfast_x64_double.exe 64-bit double precision +Map_Win32.dll 32-bit MAP++ library +Map_x64.dll 64-bit MAP++ library +DISCON_DLLS/<64bit or Win32>/DISCON.dll Controller library for NREL 5MW +DISCON_DLLS/<64bit or Win32>/DISCON_ITIBarge.dll Controller library for NREL 5MW - ITI Barge +DISCON_DLLS/<64bit or Win32>/DISCON_OC3Hywind.dll Controller library for NREL 5MW - OC3 Hywind +================================================== ============================================== + +After extracting the contents, the OpenFAST executables +can be tested by opening a command prompt, moving into the directory +containing the executables, and running a simple test command: + +.. code-block:: + + cd C:\your\path\Desktop\openfast_binaries\ + openfast_x64.exe /h + +.. _compile_from_source: Compile from source ~~~~~~~~~~~~~~~~~~~ -For compiling from source code, the NREL OpenFAST team has developed an +To compile from source code, the NREL OpenFAST team has developed an approach that uses CMake to generate build files for all platforms. Currently, CMake support for Visual Studio while doing active development -is not well supported, so OpenFAST maintains a Visual Studio solution -giving Windows developers a better option for developing code, compiling +is not well supported, so OpenFAST maintains a Visual Studio Solution +giving Windows developers another option for writing code, compiling and debugging in a streamlined manner. See :ref:`vs_windows` -for more information. +for more information. If Visual Studio is not a requirement in Windows +development, CMake is adequate. Background on CMake is given in +:ref:`understanding_cmake`, and procedures for configuring and +compiling are given in :ref:`cmake_unix` and :ref:`cmake_windows`. + +Generally, the steps required to compile are: + +1. Install Dependencies (Section :numref:`dependencies`) +2. Configure the build system (Visual Studio: :numref:`vs_windows`, CMake: :numref:`understanding_cmake`) +3. Compile and test binaries (Visual Studio: :numref:`vs_windows`, CMake: :numref:`cmake_unix` and :numref:`cmake_windows` ) + +.. _dependencies: Dependencies ------------ Compiling OpenFAST from source requires additional libraries and tools that -are not distributed with the OpenFAST repository. In many cases, these tools -can be installed with a system's package manager (e.g. ``homebrew`` for macOS, -``yum`` for CentOS/Red Hat, or ``apt`` for Debian-based systems like Ubuntu). -If binaries are downloaded or compiled manually, be sure they are -installed in a standard location for your system so that the other components -of the OpenFAST build system can find the dependencies. - -Build tools -+++++++++++ - -An environment-specific build system is required and will consist of a -combination of the packages listed in the table below. +are not distributed with the OpenFAST repository. Each of the following +components are required for the minimum OpenFAST compilation. + +- C++, C, and Fortran compiler +- BLAS and LAPACK math library +- Build system + +In many cases, these tools can be installed with a system's package +manager (e.g. ``homebrew`` for macOS, ``yum`` for CentOS/Red Hat, or +``apt`` for Debian-based systems like Ubuntu). For Ubuntu and macOS, +the following commands install all required dependencies. + +============== ================================ + System Dependency Installation Command +============== ================================ + Ubuntu 20.04 ``apt install git cmake libblas-dev liblapack-dev gfortran-10 g++`` + macOS 10.15 ``brew install git cmake make openblas gcc`` +============== ================================ + +If dependencies are downloaded from vendors directly, they must be +installed in a standard location for your system so that the OpenFAST +build systems can find them. + +Compilers ++++++++++ +Compiling OpenFAST requires a C, C++, and Fortran compiler. Though many +options exist, the most common and best supported compilers are listed +below. ============================================== ==================== ================= ======= - Package Applicable systems Minimum version Link + Vendor / Compiler Applicable systems Minimum version Link ============================================== ==================== ================= ======= - CMake All 3.0 https://cmake.org - GNU Make macOS, Linux 1.8 https://www.gnu.org/software/make/ - Visual Studio Windows 2015 https://visualstudio.microsoft.com> GNU Compiler Collection (gfortran, gcc, g++) macOS, Linux 4.6.0 https://gcc.gnu.org - Intel Parallel Studio (ifort, icc) All 2013 https://software.intel.com/en-us/parallel-studio-xe/ + Intel Compilers (ifort, icc) All 2013 https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html ============================================== ==================== ================= ======= +Other compiler packages may work and can be well suited to a particular +hardware, but their mileage may vary with OpenFAST. For instance, MinGW, +CygWin, and LLVM are options for obtaining compilers on various systems. +It is highly recommended to use the latest version of one of the above. + Math libraries ++++++++++++++ - -Math libraries with the BLAS and LAPACK interfaces are also required. These can -be obtained as free, open source libraries or paid, closed source versions. -Some packages contain separate libraries for each interface while others have -the interfaces bundles into a single binary. The most common options are listed +Math libraries with the BLAS and LAPACK interfaces are also required. All major +options can be obtained as free downloads. The most common options are listed in the table below. -============ ============ =========== ============== ====== -Library Maintainer Paid/Free Open Source? Link -============ ============ =========== ============== ====== -BLAS NetLib Free Yes http://www.netlib.org/blas/ -LAPACK NetLib Free Yes http://www.netlib.org/lapack/ -BLAS/LAPACK OpenBLAS Free Yes https://www.openblas.net -MKL Intel Paid No https://software.intel.com/en-us/mkl -============ ============ =========== ============== ====== - -Dependencies for the test suite -+++++++++++++++++++++++++++++++ - -The following packages are required to run the test suite: +============ ============= ============== ====== +Library Distributor Open Source? Link +============ ============= ============== ====== +BLAS/LAPACK NetLib Yes http://www.netlib.org/blas/, http://www.netlib.org/lapack/ +BLAS/LAPACK OpenBLAS Yes https://www.openblas.net +MKL Intel No https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html +============ ============= ============== ====== -- `Python 3 `__ -- `MatPlotLib `__ - used for generating error plots +Build tools ++++++++++++ +An environment-specific build system is required and may consist of a +combination of the packages listed in the table below. -Dependencies for the C++ API -++++++++++++++++++++++++++++ +============================================== ==================== ================= ======= + Package Applicable systems Minimum version Link +============================================== ==================== ================= ======= + CMake All 3.0 https://cmake.org + GNU Make macOS, Linux 1.8 https://www.gnu.org/software/make/ + Visual Studio Windows 2015 https://visualstudio.microsoft.com> +============================================== ==================== ================= ======= -When using the C++ API, the following packages are required: +For Windows, CMake may be used to generate a Visual Studio Solution that +can then be used to compile OpenFAST. OpenFAST also contains a standalone +Visual Studio project, see :ref:`vs_windows`. -- `HDF5 `_ (provided by ``HDF5_ROOT``) -- `yaml-cpp `_ (provided by ``YAML_ROOT``) +For macOS and Linux, the recommended tools are CMake and GNU Make. CMake is +used to generate Makefiles that are inputs to the GNU Make program. Other +build tools exist for both Linux and macOS (Xcode, Ninja), but these +are not well supported by the OpenFAST system. Get the code ------------ @@ -144,7 +268,7 @@ via the command line: An archive of the source code can also be downloaded directly from these links: -- `"master" branch `__ - Stable release +- `"main" branch `__ - Stable release - `"dev" branch `__ - Latest updates .. _vs_windows: @@ -152,8 +276,8 @@ An archive of the source code can also be downloaded directly from these links: Visual Studio Solution for Windows ---------------------------------- A complete Visual Studio solution is maintained for working with the OpenFAST -on Windows systems. The procedure for configuring the system and proceding -with the build process are documentated in the following section: +on Windows systems. The procedure for configuring the system and proceeding +with the build process are documented in the following section: .. toctree:: :maxdepth: 1 @@ -191,7 +315,7 @@ changes to the settings will be updated and stored there. CMake can be executed in a few ways: -- Command line interace: ``cmake`` +- Command line interface: ``cmake`` - Command line curses interface: ``ccmake`` - Official CMake GUI @@ -253,10 +377,11 @@ The CMake options specific to OpenFAST and their default settings are: CMAKE_INSTALL_PREFIX - Install path prefix, prepended onto install directories. DOUBLE_PRECISION - Treat REAL as double precision (Default: ON) FPE_TRAP_ENABLED - Enable Floating Point Exception (FPE) trap in compiler options (Default: OFF) - GENERATE_TYPES - Use the openfast-regsitry to autogenerate types modules + GENERATE_TYPES - Use the openfast-registry to autogenerate types modules ORCA_DLL_LOAD - Enable OrcaFlex library load (Default: OFF) USE_DLL_INTERFACE - Enable runtime loading of dynamic libraries (Default: ON) - OPENMP - Enable OpenMP parallelization in FVW (Default: OFF) + OPENMP - Enable OpenMP support (Default: OFF) + BUILD_FAST_FARM - Enable FAST.Farm capabilities (Default: OFF) Additional system-specific options may exist for a given system, but those should not impact the OpenFAST configuration. As mentioned above, the @@ -300,7 +425,7 @@ Use ``Debug`` during active development to add debug symbols for use with a debugger. This build type also adds flags for generating runtime checks that would otherwise result in undefined behavior. ``MinSizeRel`` adds basic optimizations and targets a minimal size for the generated executable. The next -level, ``RelWithDebInfo``, enables vectorization and other more agressive +level, ``RelWithDebInfo``, enables vectorization and other more aggressive optimizations. It also adds debugging symbols and results in a larger executable size. Finally, use ``Release`` for best performance at the cost of increased compile time. @@ -382,16 +507,22 @@ not to the libraries themselves. CMake with Make for Linux/macOS ------------------------------- -After reading :ref:`understanding_cmake`, proceed with -configuring OpenFAST. The CMake project is well developed for Linux and -macOS systems, so the default settings should work as given. These settings -should only be changed when a custom build is required. +After installing all dependencies and reading :ref:`understanding_cmake`, +proceed with configuring OpenFAST. The CMake project is well developed for +Linux and macOS systems, so the default settings should work as given. +These settings should only be changed when a custom build is required. -The procedure for configuring CMake and compiling with GNU Make on Linux -and macOS systems is given below. +The full procedure for installing dependencies, configuring CMake and +compiling with GNU Make on Linux and macOS systems is given below. .. code-block:: bash + # For Ubuntu Linux, this installs all dependencies + apt install git cmake libblas-dev liblapack-dev gfortran-10 g++ + + # For macOS using Homebrew, this installs all dependencies + brew install git cmake make openblas gcc + # Clone the repository from GitHub using git git clone https://github.com/OpenFAST/OpenFAST.git @@ -410,12 +541,24 @@ and macOS systems is given below. make help # Choose a particular target or give no target to compile everything + make hydrodyn_driver + # or + make openfast + # or make + # Test the compiled binary, for example + ./glue-codes/openfast/openfast -v + ./modules/hydrodyn/hydrodyn_driver -v + + # Move the binaries and other run-time files to the install location + # The default is `openfast/install` + make install + .. tip:: - Compile in parallel by adding "-jN" where N is the number of parallel - processes to use + Compile in parallel by adding "-jN" to the ``make`` command where N is + the number of parallel processes to use; i.e. ``make -j4 openfast``. This will build the OpenFAST project in the ``build`` directory. Binaries are located in ``openfast/build/glue-codes/`` and ``openfast/build/modules/``. Since @@ -427,15 +570,15 @@ again. CMake with Visual Studio for Windows ------------------------------------ -After reading :ref:`understanding_cmake`, proceed with -configuring OpenFAST. The result of this configuration process will be -a Visual Studio solution which will be fully functional for compiling -any of the targets within OpenFAST. However, this method lacks support -for continued active development. Specifically, any settings that are -configured in the Visual Studio solution directly will be lost any time -CMake is executed. Therefore, this method should only be used to compile -binaries, and the procure described in :ref:`vs_windows` should be used -for active OpenFAST development on Windows. +After installing all dependencies and reading :ref:`understanding_cmake`, +proceed with configuring OpenFAST. The result of this configuration +process will be a Visual Studio solution which will be fully functional +for compiling any of the targets within OpenFAST. However, this method +lacks support for continued active development. Specifically, any settings +that are configured in the Visual Studio solution directly will be lost +any time CMake is executed. Therefore, this method should only be used to +compile binaries, and the procure described in :ref:`vs_windows` should +be used for active OpenFAST development on Windows. The procedure for configuring CMake and compiling with Visual Studio on Windows systems is given below. @@ -476,6 +619,48 @@ the structure of the file system or if the CMake configuration is changed. It is recommended that this method **not** be used for debugging or active development on Windows. Instead, see :ref:`vs_windows`. +C++ API +~~~~~~~ +When compiling the C++ API, the following additional dependencies are required: + +- `HDF5 `_ +- `yaml-cpp `_ +- `libxml++ `_ + +The C++ API is compiled only with CMake and it is possible to hint to CMake +where to find some dependencies. The following commands configure CMake and +compile the C++ interface. + +.. code-block:: bash + + # Enable compiling the C++ API + cmake .. -DBUILD_OPENFAST_CPP_API:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON + + # If CMake doesn't find HDF5, provide a hint + cmake .. -DHDF5_ROOT:STRING=/usr/lib/ + + # Compile the C++ API + make openfastcpplib + +FAST.Farm +~~~~~~~~~ +The FAST.Farm glue-code is included in the CMake project similar to the +OpenFAST glue-code. See :ref:`compile_from_source` for a full description +on installing dependencies, configuring the project, and compiling. +FAST.Farm is enabled in the CMake project with an additional flag: + +.. code-block:: bash + + # Enable compiling FAST.Farm + cmake .. -DBUILD_FASTFARM:BOOL=ON + + # Compile FAST.Farm + make FAST.Farm + +OpenMP-Fortran is an additional dependency for FAST.Farm. These libraries +can be installed with any package manager for macOS and Linux or +through the Intel oneAPI distributions. + .. _installation_appendix: Appendix diff --git a/docs/source/testing/regression_test.rst b/docs/source/testing/regression_test.rst index 8c29e5aa16..c98b3ca8ed 100644 --- a/docs/source/testing/regression_test.rst +++ b/docs/source/testing/regression_test.rst @@ -262,7 +262,7 @@ suite. .. code-block:: bash # Download the source code from GitHub - # Note: The default branch is 'master' + # Note: The default branch is 'main' git clone --recursive https://github.com/openfast/openfast.git cd openfast @@ -298,7 +298,7 @@ with CMake for use with the CTest command. .. code-block:: bash # Download the source code from GitHub - # Note: The default branch is 'master' + # Note: The default branch is 'main' git clone --recursive https://github.com/openfast/openfast.git cd openfast @@ -339,7 +339,7 @@ included Python driver. .. code-block:: bash # Download the source code from GitHub - # Note: The default branch is 'master' + # Note: The default branch is 'main' git clone --recursive https://github.com/openfast/openfast.git cd openfast diff --git a/docs/source/this_doc.rst b/docs/source/this_doc.rst index 24ff4bf367..53947475e7 100644 --- a/docs/source/this_doc.rst +++ b/docs/source/this_doc.rst @@ -6,7 +6,7 @@ This documentation OpenFAST documentation is hosted on `readthedocs `_, and is automatically generated from both the -`master `_ and +`main `_ and `dev `_ branches whenever new commits are added. Clicking on the bar on the lower left corner of the page reveals a panel (see image below) containing options to select the branch diff --git a/docs/source/user/aerodyn-aeroacoustics/02-noise-models.rst b/docs/source/user/aerodyn-aeroacoustics/02-noise-models.rst index b1b13c4696..56f7faf9e5 100644 --- a/docs/source/user/aerodyn-aeroacoustics/02-noise-models.rst +++ b/docs/source/user/aerodyn-aeroacoustics/02-noise-models.rst @@ -466,7 +466,7 @@ flatback and truncated airfoils far outboard along the blade may strengthen this noise source. When this noise source is activated, the user is asked to provide the distribution along the blade span of the blunt thickness of the trailing edge, :math:`h`, and the solid angle between the suction and pressure sides of -the airfoil, :math:`\Psi` (see :numref:`aa-sec-TEgeom`). :math:`h` and +the airfoil, :math:`\Psi` (see :numref:`aa-turb-TE`). :math:`h` and :math:`\Psi` are inputs to the equation: .. math:: @@ -519,10 +519,10 @@ OpenFAST the local airfoil-oriented reference system is used, and a rotation is applied. Given the angles :math:`\Theta_{e}` and :math:`\Phi_{e}`, at high frequency, -:math:`\overline{D}` takes the expression: +:math:`\overline{D}` for the trailing edge takes the expression: .. math:: - {\overline{D}}_{h}\left( \Theta_{e},\Phi_{e} \right) = \frac{ + {\overline{D}}_{h-TE}\left( \Theta_{e},\Phi_{e} \right) = \frac{ 2\sin^{2}\left( \frac{\Theta_{e}}{2} \right)\sin^{2}\Phi_{e}} {\left( 1 + M\cos\Theta_{e} \right) \left( 1 + \left( M - M_{c} \right) @@ -530,14 +530,26 @@ Given the angles :math:`\Theta_{e}` and :math:`\Phi_{e}`, at high frequency, :label: aa-eq:32 where :math:`M_{c}` represents the Mach number past the trailing edge -and that is here for simplicity assumed equal to 80% of free-stream M. At low -frequency, the equation becomes: +and that is here for simplicity assumed equal to 80% of free-stream M. + +For the leading edge, and therefore for the turbulent inflow noise model, +at high frequency, :math:`\overline{D}` is: + +.. math:: + {\overline{D}}_{h-LE}\left( \Theta_{e},\Phi_{e} \right) = \frac{ + 2\cos^{2}\left( \frac{\Theta_{e}}{2} \right)\sin^{2}\Phi_{e}} + {\left( 1 + M\cos\Theta_{e} \right)^{3}} + :label: aa-eq:33 + +Note that this equation was not reported in the NREL Tech Report NREL/TP-5000-75731! + +At low frequency, the equation is identical for both leading and trailing edges: .. math:: {\overline{D}}_{l}\left( \Theta_{e},\Phi_{e} \right) = \frac{\sin^{2}\left. \ \Theta_{e} \right.\ \sin^{2}\Phi_{e}} {\left( 1 + M\cos\Theta_{e} \right)^{4}}. - :label: aa-eq:33 + :label: aa-eq:34 Each model distinguishes a different value between low and high frequency. For the TI noise model, the shift between low and high @@ -565,12 +577,12 @@ The A-weight, :math:`A_{w}`, is computed as: {\left( f^{2} + {20.598997}^{2} \right)^{2} \left( f^{2} + {12194.22}^{2} \right)^{2}} \right)} {\log 10} - :label: aa-eq:34 + :label: aa-eq:35 The A-weighting is a function of frequency and is added to the values of sound pressure levels: .. math:: SPL_{A_{w}} = SPL + A_{w} - :label: aa-eq:35 + :label: aa-eq:36 diff --git a/docs/source/user/aerodyn-aeroacoustics/App-usage.rst b/docs/source/user/aerodyn-aeroacoustics/App-usage.rst index fb36ee7c22..303023e49a 100644 --- a/docs/source/user/aerodyn-aeroacoustics/App-usage.rst +++ b/docs/source/user/aerodyn-aeroacoustics/App-usage.rst @@ -62,8 +62,8 @@ models: - **TICalcTabFile** – String: name of the text file with the user-defined turbulence intensity grid; see :numref:`aa-sec-TIgrid`. -- **SurfRoughness** – Float: value of :math:`z_{0}` used to estimate - :math:`L_{t}` in the Amiet model. +- **Lturb** – Float: value of :math:`L_{turb}` used to estimate the turbulent + lengthscale used in the Amiet model. - **TBLTEMod** – Integer 0/1/2: flag to set the TBL-TE noise model; 0 turns off the model, 1 uses the Brooks-Pope-Marcolini (BPM) airfoil noise @@ -97,12 +97,7 @@ models: - **BluntMod** – Integer 0/1: flag to activate (**BluntMod=1**) the trailing-edge bluntness – vortex shedding model, see :numref:`aa-TE-vortex`. If the flag is set to 1, the trailing-edge geometry must be specified in - the file(s) listed in the field Blade Properties. - -Next, the field Blade Properties lists three file names, often but not -necessarily identical, which contain the distributed properties -describing the detailed geometry of the trailing edge. These are -described in :numref:`aa-sec-TEgeom`. + the files as described in :numref:`aa-sec-BLinputs`. The field Observer Locations contains the path to the file where the number of observers (NrObsLoc) and the respective locations are @@ -141,8 +136,8 @@ The file must be closed by an END command. .. _aa-sec-BLinputs: -Boundary Layer Inputs ---------------------- +Boundary Layer Inputs and Trailing Edge Geometry +------------------------------------------------ When the flag **BLMod** is set equal to 2, pretabulated properties of the boundary layer must be provided and are used by the turbulent boundary @@ -188,6 +183,26 @@ outputs of XFoil. Because it is usually impossible to obtain these values for the whole ranges of Reynolds numbers and angles of attack, the code is set to adopt the last available values and print to screen a warning. +When the flag **BluntMod** is set to 1, the detailed geometry of the +trailing edge must also be defined along the span. Two inputs must be +provided, namely the angle, :math:`\Psi` between the suction and +pressure sides of the profile, right before the trailing-edge point, and +the height, :math:`h`, of the trailing edge. :math:`\Psi` must be +defined in degrees, while :math:`h` is in meters. Note that the BPM +trailing-edge bluntness model is very sensitive to these two parameters, +which, however, are often not easy to determine for real blades. +:numref:`aa-fig:GeomParamTE` shows the two inputs. + +.. figure:: media/NoiseN011.png + :alt: Geometric parameters of the trailing-edge bluntness + :name: aa-fig:GeomParamTE + :width: 100.0% + + Geometric parameters :math:`\mathbf{\Psi}` and + :math:`\mathbf{h}` of the trailing-edge bluntness + +One value of :math:`\Psi` and one value of :math:`h` per file must be defined. +These values are not used if the flag **BluntMod** is set to 0. .. container:: :name: aa-tab:AF20_BL @@ -244,15 +259,17 @@ is shown here: Turbulence Grid --------------- -When the flag **TICalcMeth** is set equal to 1, the grid of incident -turbulent intensity :math:`I_{1}` must be defined by the user. This is +When the flag **TICalcMeth** is set equal to 1, the grid of turbulence +intensity of the wind :math:`TI` must be defined by the user. This is done by creating a file called **TIGrid_In.txt**, which mimics a TurbSim output file and contains a grid of turbulence intensity, which is defined as a fraction value. The file defines a grid centered at hub height and oriented with the OpenFAST global inertial frame coordinate system; see :numref:`aa-fig:ObsRefSys`. A user-defined number of lateral and vertical points equally spaced by a user-defined number of meters must be -specified. An example file for a 160 (lateral) by 180 (vertical) meters +specified. Note that an average wind speed must be defined to convert +the turbulence intensity of the wind to the incident turbulent intensity :math:`I_{1}`. +An example file for a 160 (lateral) by 180 (vertical) meters grid looks like the following: @@ -264,38 +281,5 @@ grid looks like the following: :language: none -.. _aa-sec-TEgeom: - -Trailing-Edge Geometry ----------------------- - -When the flag **BluntMod** is set to 1, the detailed geometry of the -trailing edge must be defined along the span. Two inputs must be -provided, namely the angle, :math:`\Psi,` between the suction and -pressure sides of the profile, right before the trailing-edge point, and -the height, :math:`h`, of the trailing edge. :math:`\Psi` must be -defined in degrees, while :math:`h` is in meters. Note that the BPM -trailing-edge bluntness model is very sensitive to these two parameters, -which, however, are often not easy to determine for real blades. -:numref:`aa-fig:GeomParamTE` shows the two inputs. - -.. figure:: media/NoiseN011.png - :alt: Geometric parameters of the trailing-edge bluntness - :name: aa-fig:GeomParamTE - :width: 100.0% - - Geometric parameters :math:`\mathbf{\Psi}` and - :math:`\mathbf{h}` of the trailing-edge bluntness - -The two distributions must be defined with the same spanwise resolution -of the AeroDyn15 blade file, such as: - -.. container:: - :name: aa-tab:BladeProp - - .. literalinclude:: example/BladeProp.dat - :linenos: - :language: none - .. [4] https://github.com/OpenFAST/python-toolbox diff --git a/docs/source/user/aerodyn-aeroacoustics/example/TIGrid.txt b/docs/source/user/aerodyn-aeroacoustics/example/TIGrid.txt index 2403826069..4f01c54833 100644 --- a/docs/source/user/aerodyn-aeroacoustics/example/TIGrid.txt +++ b/docs/source/user/aerodyn-aeroacoustics/example/TIGrid.txt @@ -1,3 +1,5 @@ +Average Inflow Wind Speed +8.0 Total Grid points In Y (lateral), Starts from - radius goes to + radius+ 4 Total Grid points In Z (vertical), Starts from bottom tip (hub-radius) diff --git a/docs/source/user/aerodyn-dynamicStall/examples/UA-driver-timeseries.dat b/docs/source/user/aerodyn-dynamicStall/examples/UA-driver-timeseries.dat index e2d414dda5..902354a4db 100644 --- a/docs/source/user/aerodyn-dynamicStall/examples/UA-driver-timeseries.dat +++ b/docs/source/user/aerodyn-dynamicStall/examples/UA-driver-timeseries.dat @@ -5,7 +5,7 @@ This file has 8 header lines followed by three columns of data: Time Angle of Attack VRel omega -(s) (deg) (m/s) (rad/s^2) +(s) (deg) (m/s) (rad/s) 0.0 0 10 0 0.01 0 10 0 0.02 0 10 0 diff --git a/docs/source/user/aerodyn-olaf/bibliography.bib b/docs/source/user/aerodyn-olaf/bibliography.bib index 90f791db4b..4bfe1f54ee 100644 --- a/docs/source/user/aerodyn-olaf/bibliography.bib +++ b/docs/source/user/aerodyn-olaf/bibliography.bib @@ -242,7 +242,7 @@ @misc{FAST title = {OpenFAST Documentation}, month = {November}, year = {2017}, -url = {http://openfast.readthedocs.io/en/master/} +url = {http://openfast.readthedocs.io/en/main/} } @misc{SAMWICH, diff --git a/docs/source/user/aerodyn/appendix.rst b/docs/source/user/aerodyn/appendix.rst index add85ba4c0..fd2424ebf5 100644 --- a/docs/source/user/aerodyn/appendix.rst +++ b/docs/source/user/aerodyn/appendix.rst @@ -45,7 +45,7 @@ The blade data input file contains the nodal discretization, geometry, twist, ch AeroDyn List of Output Channels ------------------------------- -This is a list of all possible output parameters for the AeroDyn module. The names are grouped by meaning, but can be ordered in the OUTPUTS section of the AeroDyn input file as you see fit. ``BαNβ``, refers to output node β of blade α, where α is a number in the range [1,3] and β is a number in the range [1,9], corresponding to entry β in the ``BlOutNd`` list. ``TwNβ`` refers to output node β of the tower and is in the range [1,9], corresponding to entry β in the ``TwOutNd`` list. +This is a list of all possible output parameters for the AeroDyn module. The names are grouped by meaning, but can be ordered in the OUTPUTS section of the AeroDyn input file as you see fit. :math:`B \alpha N \beta`, refers to output node :math:`\beta` of blade :math:`\alpha`, where :math:`\alpha` is a number in the range [1,3] and :math:`\beta` is a number in the range [1,9], corresponding to entry :math:`\beta` in the :math:`\textit{BlOutNd}` list. :math:`\textit{TwN}\beta` refers to output node :math:`\beta` of the tower and is in the range [1,9], corresponding to entry :math:`\beta` in the :math:`\textit{TwOutNd}` list. The local tower coordinate system is shown in :numref:`ad_tower_geom` and the local blade coordinate system is shown in :numref:`ad_blade_local_cs` below. Figure :numref:`ad_blade_local_cs` also shows the direction of the local angles and force components. diff --git a/docs/source/user/api_change.rst b/docs/source/user/api_change.rst index 51cf5a8b5d..7f27943b73 100644 --- a/docs/source/user/api_change.rst +++ b/docs/source/user/api_change.rst @@ -10,12 +10,40 @@ The line number corresponds to the resulting line number after all changes are i Thus, be sure to implement each in order so that subsequent line numbers are correct. -OpenFAST v2.6.0 to OpenFAST `dev` +OpenFAST v3.0.0 to OpenFAST `dev` --------------------------------- No changes. +OpenFAST v2.6.0 to OpenFAST v3.0.0 +---------------------------------- + +- ServoDyn + + - The input file parser is updated to a keyword/value pair based input. + Each entry must have a corresponding keyword with the same spelling as + expected + - The TMD submodule of ServoDyn is replaced by an updated Structural Control + module (StC) with updated capabilities and input file. + +============================================= ==== =============== ======================================================================================================================================================================================================== +Added in OpenFAST v3.0.0 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +Module Line Flag Name Example Value +============================================= ==== =============== ======================================================================================================================================================================================================== +ServoDyn 61 NumBStC 0 NumBStC - Number of blade structural controllers (integer) +ServoDyn 62 BStCfiles "unused" BStCfiles - Name of the files for blade structural controllers (quoted strings) [unused when NumBStC==0] +ServoDyn 63 NumNStC 0 NumNStC - Number of nacelle structural controllers (integer) +ServoDyn 64 NStCfiles "unused" NStCfiles - Name of the files for nacelle structural controllers (quoted strings) [unused when NumNStC==0] +ServoDyn 65 NumTStC 0 NumTStC - Number of tower structural controllers (integer) +ServoDyn 66 TStCfiles "unused" TStCfiles - Name of the files for tower structural controllers (quoted strings) [unused when NumTStC==0] +ServoDyn 67 NumSStC 0 NumSStC - Number of substructure structural controllers (integer) +ServoDyn 68 SStCfiles "unused" SStCfiles - Name of the files for substructure structural controllers (quoted strings) [unused when NumSStC==0] +============================================= ==== =============== ======================================================================================================================================================================================================== + + + OpenFAST v2.5.0 to OpenFAST v2.6.0 ---------------------------------- @@ -45,7 +73,6 @@ SubDyn na RigidSection PropSetID SubDyn na RigidSection (-) (kg/m) HydroDyn 52 NBody 1 NBody - Number of WAMIT bodies to be used (-) [>=1; only used when PotMod=1. If NBodyMod=1, the WAMIT data contains a vector of size 6*NBody x 1 and matrices of size 6*NBody x 6*NBody; if NBodyMod>1, there are NBody sets of WAMIT data each with a vector of size 6 x 1 and matrices of size 6 x 6] HydroDyn 53 NBodyMod 1 NBodyMod - Body coupling model {1: include coupling terms between each body and NBody in HydroDyn equals NBODY in WAMIT, 2: neglect coupling terms between each body and NBODY=1 with XBODY=0 in WAMIT, 3: Neglect coupling terms between each body and NBODY=1 with XBODY=/0 in WAMIT} (switch) [only used when PotMod=1] - ============================================= ==== =============== ======================================================================================================================================================================================================== ============================================= ====== =============== ====================================================================================================================================================================================================== @@ -105,23 +132,44 @@ HydroDyn 74 PtfmYF True OpenFAST v2.4.0 to OpenFAST v2.5.0 ---------------------------------- +- InflowWind + + - The input file parser is updated to a keyword/value pair based input. + Each entry must have a corresponding keyword with the same spelling as + expected. See :numref:`input_file_overview` for an overview. + - Driver code includes ability to convert between wind types + ============== ==== ================== ============================================================================================================================================================================= Added in OpenFAST v2.5.0 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Module Line Flag Name Example Value ============== ==== ================== ============================================================================================================================================================================= IfW driver 6 [separator line] ===================== File Conversion Options ================================= -IfW driver 7 WrHAWC false WrHAWC - Convert all data to HAWC2 format? (flag) -IfW driver 8 WrBladed false WrBladed - Convert all data to Bladed format? (flag) -IfW driver 9 WrVTK false WrVTK - Convert all data to VTK format? (flag) -InflowWind 7 VFlowAng 0 VFlowAng - Upflow angle (degrees) (not used for native Bladed format WindType=7) +IfW driver 7 WrHAWC false WrHAWC - Convert all data to HAWC2 format? (flag) +IfW driver 8 WrBladed false WrBladed - Convert all data to Bladed format? (flag) +IfW driver 9 WrVTK false WrVTK - Convert all data to VTK format? (flag) +InflowWind 7 VFlowAng 0 VFlowAng - Upflow angle (degrees) (not used for native Bladed format WindType=7) ============== ==== ================== ============================================================================================================================================================================= +============================ ====== ================================================ ==================================================================================== +Modified in OpenFAST v2.5.0 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +Module Line Flag Name / section Example Value +============================ ====== ================================================ ==================================================================================== +MoorDyn na added CtrlChan column in LINE PROPERTIES table .. code-block:: none + + Line LineType UnstrLen NumSegs NodeAnch NodeFair Outputs CtrlChan + (-) (-) (m) (-) (-) (-) (-) (-) + 1 main 835.35 20 1 4 - 0 +============================ ====== ================================================ ==================================================================================== + OpenFAST v2.3.0 to OpenFAST v2.4.0 ---------------------------------- +Additional nodal output channels added for :ref:`AeroDyn15`, :ref:`BeamDyn`, and :ref:`ElastoDyn`. + ============== ==== ================== ============================================================================================================================================================================= Added in OpenFAST v2.4.0 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -142,20 +190,21 @@ AeroDyn 36 OLAFInputFileName "Elliptic_OLAF.dat" OLAFInputFileName AirFoilTables 4\* BL_file "unused" BL_file - The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called. ============== ==== ================== ============================================================================================================================================================================= +============== ==== ================== ======================================================================================================================================================= ========================= Modified in OpenFAST v2.4.0 ---------------------------- - -============== ==== ================== ============================================================================================================================================================================= - Module Line Flag Name Example Value -============== ==== ================== ============================================================================================================================================================================= -AirFoilTables 40\* filtCutOff "DEFAULT" filtCutOff - Reduced frequency cut-off for low-pass filtering the AoA input to UA, as well as the 1st and 2nd derivatives (-) [default = 0.5] -============== ==== ================== ============================================================================================================================================================================= +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Module Line New Flag Name Example Value Previous Flag Name/Value +============== ==== ================== ======================================================================================================================================================= ========================= +AirFoilTables 40\* filtCutOff "DEFAULT" filtCutOff - Reduced frequency cut-off for low-pass filtering the AoA input to UA, as well as the 1st and 2nd deriv (-) [default = 0.5] [default = 20] +InflowWind 17 Filename_Uni "unused" Filename_Uni - Filename of time series data for uniform wind field. (-) Filename +InflowWind 18 RefHt_Uni 90 RefHt_Uni - Reference height for horizontal wind speed (m) RefHt +InflowWind 35 RefHt_Hawc 90 RefHt_Hawc - reference height; the height (in meters) of the vertical center of the grid (m) RefHt +InflowWind 47 PLExp_Hawc 0.2 PLExp_Hawc - Power law exponent (-) (used for PL wind profile type only) PLExp +InflowWind 49 XOffset 0 XOffset - Initial offset in +x direction (shift of wind box) InitPosition(x) +============== ==== ================== ======================================================================================================================================================= ========================= \*non-comment line count, excluding lines contained if NumCoords is not 0. -Additional nodal output channels added for :ref:`AeroDyn15`, -:ref:`BeamDyn`, and :ref:`ElastoDyn`. - OpenFAST v2.2.0 to OpenFAST v2.3.0 diff --git a/docs/source/user/fast.farm/AppendixA.rst b/docs/source/user/fast.farm/AppendixA.rst new file mode 100644 index 0000000000..5dbc8b2230 --- /dev/null +++ b/docs/source/user/fast.farm/AppendixA.rst @@ -0,0 +1,16 @@ +.. _FF:App:Input: + +FAST.Farm Primary Input File +============================ + +When a default value is available, +``DEFAULT`` may be used instead of the value. + +**Check the regression test cases for updates to this input file.** + +.. container:: + :name: Tab:FFinputfile + + .. literalinclude:: examples/FAST.Farm--input.dat + :linenos: + :language: none diff --git a/docs/source/user/fast.farm/AppendixB.rst b/docs/source/user/fast.farm/AppendixB.rst new file mode 100644 index 0000000000..cb0933548e --- /dev/null +++ b/docs/source/user/fast.farm/AppendixB.rst @@ -0,0 +1,10 @@ +.. _FF:App:Wind: + +Ambient Wind File +================= + +.. container:: + :name: Tab:AmbientWind + + .. literalinclude:: examples/AmbientWind.vtk + :language: none diff --git a/docs/source/user/fast.farm/AppendixC.rst b/docs/source/user/fast.farm/AppendixC.rst new file mode 100644 index 0000000000..18879e0c6d --- /dev/null +++ b/docs/source/user/fast.farm/AppendixC.rst @@ -0,0 +1,155 @@ +.. _FF:App:Output: + +List of Output Channels +======================= + +This is a list of all possible output parameters available within +FAST.Farm (except those that are available from OpenFAST, which are +specified within the OpenFAST input file(s) and output separately for +each turbine). The names are grouped by meaning, but can be ordered in +the OUTPUTS section of the FAST.Farm primary input file as you see fit. + +T\ :math:`\alpha` refers to turbine :math:`\alpha`, where :math:`\alpha` +is a one-digit number in the range [1,9], corresponding to row +:math:`\alpha` in the wind turbine input table. If **NumTurbines** > 9, +only values for the first 9 turbines can be output. Setting +:math:`\alpha` > **NumTurbines** yields invalid output. + +In\ :math:`\zeta` and Ot\ :math:`\zeta` refer to super-controller input +and output :math:`\zeta`, respectively, where :math:`\zeta` is a +one-digit number in the range [1,9], corresponding to element +:math:`\zeta` in the input and output arguments of the super-controller +source code. If there are more than 9 elements, only values for the +first 9 inputs and outputs can be output. Setting :math:`\zeta` greater +than the number of elements yields invalid output. + +N\ :math:`\beta` refers to radial output node :math:`\beta`, where +:math:`\beta` is a two-digit number in the range [01,20], corresponding +to entry :math:`\beta` in the **OutRadii** list, where node +:math:`\beta` is at radius **dr** :math:`\times` +**OutRadii**\ [:math:`\beta`]. Setting :math:`\beta` > **NOutRadii** +yields invalid output. + +W\ :math:`\eta` refers to wind point :math:`\eta`, where :math:`\eta` is +a one-digit number in the range [1,9], corresponding to entry +:math:`\eta`\ in the **WindVelX**, **WindVelY**, and **WindVelZ** lists. +Setting :math:`\eta` > **NWindVel** yields invalid output. Setting +**WindVelX**, **WindVelY**, and **WindVelZ** outside the low-resolution +wind domain also yields invalid output. + +:math:`\delta` refers to the X, Y, or Z coordinate axis. + +D\ :math:`\gamma` refers to downstream distance :math:`\gamma`, where +:math:`\gamma` is a one-digit number in the range [1,9], corresponding +to entry :math:`\gamma` in the **OutDist** list. Setting :math:`\gamma` +> **NOutDist** yields invalid output. The output is also invalid if +**OutDist** is a distance further downstream than the wake has been +calculated or for any distance where the wake from the turbine has +overlapped itself. + +.. container:: + :name: Tab:FF:Outputs + + .. table:: List of Available FAST.Farm Output Channels + + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | Channel Name | Units | Description | + +==============================================================+===================+=================================================+ + | *Super Controller* | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | SCGblIn\ :math:`\zeta` | (user) | Global (turbine independent) super | + | | | controller input :math:`\zeta` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | SCT\ :math:`\alpha`\ In\ :math:`\zeta` | (user) | Turbine-dependent super controller input | + | | | :math:`\zeta` for turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | SCGblOt\ :math:`\zeta` | (user) | Global (turbine independent) super | + | | | controller output :math:`\zeta` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | SCT\ :math:`\alpha`\ Ot\ :math:`\zeta` | (user) | Turbine-dependent super controller input | + | | | :math:`\zeta` for turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | *Wind Turbine and Inflow* | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | RtAxs\ :math:`\delta`\ T\ :math:`\alpha` | (-) | Orientation of the rotor centerline for turbine | + | | | :math:`\alpha` in the global coordinate system | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | RtPos\ :math:`\delta`\ T\ :math:`\alpha` | \(m\) | Position of the rotor (hub) center for turbine | + | | | :math:`\alpha` in the global coordinate system | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | RtDiamT\ :math:`\alpha` | \(m\) | Rotor diameter for turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | YawErrT\ :math:`\alpha` | (deg) | Nacelle-yaw error for turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | TIAmbT\ :math:`\alpha` | (%) | Ambient turbulence intensity of the wind at the | + | | | the rotor disk for turbine :math:`\alpha`. The | + | | | ambient turbulence intensity is based on a | + | | | spatial-average of the three vector components, | + | | | instead of just the axial component. | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | RtVAmbT\ :math:`\alpha` | (m/s) | Rotor-disk-averaged ambient wind speed (normal | + | | | to disk, not including structural motion, local | + | | | induction or wakes from upstream turbines) for | + | | | turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | RtVRelT\ :math:`\alpha` | (m/s) | Rotor-disk-averaged relative wind speed (normal | + | | | to disk, including structural motion and wakes | + | | | from upstream turbines, but not including local | + | | | induction) for turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | CtT\ :math:`\alpha`\ N\ :math:`\beta` | (-) | Azimuthally averaged thrust force coefficient | + | | | (normal to disk) for radial output node | + | | | :math:`\beta` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | *Wake (for an Individual Rotor)* | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkAxs\ :math:`\delta`\ T\ :math:`\alpha`\ D\ :math:`\gamma` | (-) | Orientation of the wake centerline for | + | | | downstream distance :math:`\gamma` of turbine | + | | | :math:`\alpha` in the global coordinate system | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkPos\ :math:`\delta`\ T\ :math:`\alpha`\ D\ :math:`\gamma` | \(m\) | Center position of the wake centerline for | + | | | downstream distance :math:`\gamma` of turbine | + | | | :math:`\alpha` in the global coordinate system | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkVel\ :math:`\delta`\ T\ :math:`\alpha`\ D\ :math:`\gamma` | (m/s) | Advection, deflection, and meandering velocity | + | | | (not including the horizontal wake-deflection | + | | | correction or low-pass time-filtering) of the | + | | | wake for downstream distance :math:`\gamma` of | + | | | turbine :math:`\alpha` in the global coordinate | + | | | system | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkDiamT\ :math:`\alpha`\ D\ :math:`\gamma` | \(m\) | Wake diameter for downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkDfVxT\ :math:`\alpha`\ N\ :math:`\beta`\ D\ :math:`\gamma` | (m/s) | Axial wake velocity deficits for radial output | + | | | node :math:`\beta` and downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | WkDfVrT\ :math:`\alpha`\ N\ :math:`\beta`\ D\ :math:`\gamma` | (m/s) | Radial wake velocity deficits for radial output | + | | | node :math:`\beta` and downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | EddVisT\ :math:`\alpha`\ N\ :math:`\beta`\ D\ :math:`\gamma` | (m\ :math:`^2`/s) | Total eddy viscosity for radial output node | + | | | :math:`\beta` and downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | EddAmbT\ :math:`\alpha`\ N\ :math:`\beta`\ D\ :math:`\gamma` | (m\ :math:`^2`/s) | Individual contribution to the eddy viscosity | + | | | from ambient turbulence for radial output node | + | | | :math:`\beta` and downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | EddShrT\ :math:`\alpha`\ N\ :math:`\beta`\ D\ :math:`\gamma` | (m\ :math:`^2`/s) | Individual contributions to the eddy viscosity | + | | | from the shear layer for radial output node | + | | | :math:`\beta` and downstream distance | + | | | :math:`\gamma` of turbine :math:`\alpha` | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | *Ambient Wind and Array Effects* | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | W\ :math:`\eta`\ VAmb\ :math:`\delta` | (m/s) | Ambient wind velocity (not including wakes) for | + | | | point :math:`\eta` in the global coordinate | + | | | system (from the low-resolution domain) | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ + | W\ :math:`\eta`\ VDis\ :math:`\delta` | (m/s) | Disturbed wind velocity (including wakes) for | + | | | point :math:`\eta` in the global coordinate | + | | | system (from the low-resolution domain) | + +--------------------------------------------------------------+-------------------+-------------------------------------------------+ diff --git a/docs/source/user/fast.farm/FFarmTheory.rst b/docs/source/user/fast.farm/FFarmTheory.rst new file mode 100644 index 0000000000..57e1a5b161 --- /dev/null +++ b/docs/source/user/fast.farm/FFarmTheory.rst @@ -0,0 +1,1815 @@ +.. _FF:Theory: + +FAST.Farm Theory +================ + +FAST.Farm is a multiphysics +engineering tool for predicting the performance and loads of wind +turbines within a wind farm. FAST.Farm uses +`OpenFAST `__ to solve the +aero-hydro-servo-elastic dynamics of each individual turbine, but +considers additional physics for wind-farm-wide ambient wind in the +atmospheric boundary layer; a wind-farm super controller; and wake +deficits, advection, deflection, meandering, and merging. FAST.Farm is +based on the principles of the DWM model -- including passive tracer +modeling of wake meandering -- but addresses many of the limitations of +previous DWM implementations. + +.. _FF:DWMPrincipals: + +Dynamic Wake Meandering Principles and Limitations Addressed +------------------------------------------------------------ + +The main idea behind the DWM model is to capture key wake features +pertinent to accurate prediction of wind farm power performance and wind +turbine loads, including the wake-deficit evolution (important for +performance) and the wake meandering and wake-added turbulence +(important for loads). Although fundamental laws of physics are applied, +appropriate simplifications have been made to minimize the computational +expense, and HFM solutions are used to inform and calibrate the +submodels. In the DWM model, the wake-flow processes are treated via the +“splitting of scales,” in which small turbulent eddies (less than two +diameters) affect wake-deficit evolution and large turbulent eddies +(greater than two diameters) affect wake meandering. + +The presence of thrust from the wind turbine rotor causes the wind speed +to decrease and the pressure to increase just upwind of the rotor. In +the near-wake region just downwind of the rotor -- illustrated in +:numref:`FF:NearWake` -- coherent vortices break down, the pressure +recovers to free stream, the wind speed decreases further, and the wake +expands radially. In the far-wake region further downwind, the wake +deficit is approximately Gaussian and recovers to free stream due to the +turbulent transfer of momentum into the wake from the ambient wind +across the wake shear layer. This flow-speed reduction and gradual +recovery to free stream is known as the wake-deficit evolution. In most +DWM implementations, the wake-deficit evolution is modeled via the thin +shear-layer approximation of the Reynolds-averaged Navier-Stokes +equations under quasi-steady-state conditions in axisymmetric +coordinates -- illustrated in :numref:`FF:WakeAdv`. The +turbulence closure is captured by using an eddy-viscosity formulation, +dependent on small turbulent eddies. This wake-deficit evolution +solution is only valid in the far wake. This far wake is most important +for wind farm analysis because wind turbines are not typically spaced +closely. However, because the wake-deficit evolution solution begins at +the rotor, a near-wake correction is applied at the inlet boundary +condition to improve the accuracy of the far-wake solution. + +.. figure:: Pictures/NearWake.png + :alt: Near-wake region. + :name: FF:NearWake + :width: 100% + :align: center + + Near-wake region. + +Wake meandering is the large-scale movement of the wake deficit +transported by large turbulent eddies. This wake-meandering process is +treated pragmatically in DWM (:cite:`ff-Larsen08_1`) by +modeling the meandering as a passive tracer, which transfers the wake +deficit transversely (horizontally and vertically) to a moving frame of +reference (MFoR) -- as illustrated in +:numref:`FF:WakeMeandering` -- based on the ambient wind +(including large turbulent eddies) spatially averaged across planes of +the wake. + +Wake-added turbulence is the additional small-scale turbulence generated +from the turbulent mixing in the wake. It is often modeled in DWM by +scaling up the background (undisturbed) turbulence. + +Several variations of DWM have been implemented, e.g., by the Technical +University of Denmark (:cite:`ff-Madsen10_1,ff-Madsen16_1`) and the University +of Massachusetts (:cite:`ff-Hao14_1,ff-Churchfield15_1,ff-Hao16_1`). Although +the exact limitations of existing DWM implementations depend on the +implementation, specific limitations that are addressed in developing FAST.Farm +are summarized in :numref:`FF:tab:DWMImprovs` and are discussed where +appropriate in the next section. + + +.. table:: Dynamic Wake Meandering Limitations Addressed by FAST.Farm + :name: FF:tab:DWMImprovs + + +----------------------------------+----------------------------------+ + | **Limitation** | **Solution/Innovation** | + +==================================+==================================+ + | - Ambient wind is solved per | - Optionally compute ambient | + | individual rotor and | wind-farm-wide from a | + | generated synthetically based | high-fidelity precursor. | + | on the Taylor’s | | + | frozen-turbulence assumption; | | + | not coherent across the wind | | + | farm or based on mesoscale | | + | conditions or local terrain. | | + +----------------------------------+----------------------------------+ + | - No treatment of a wind farm | - Optional inclusion of a wind | + | super controller. | farm super controller. | + +----------------------------------+----------------------------------+ + | - Wake advects at mean ambient | - Wake advects based on the | + | wind speed, not accelerating | local spatially averaged | + | from near wake to far wake or | ambient wind speed and wake | + | affected by local flow | deficit. | + | conditions. | | + +----------------------------------+----------------------------------+ + | - Wake deficit is not distorted | - Wake deficit solved in planes | + | by inflow skew (i.e., when | parallel to rotor disk. | + | looking downwind, the wake | | + | looks circular, not | - Wake centerline deflected | + | elliptical). | based on inflow skew. | + | | | + | - Wake centerline is not | | + | deflected by inflow skew. | | + +----------------------------------+----------------------------------+ + | - Wake deficit and centerline | - Wake deficit and centerline | + | based only on mean | updated based on | + | conditions, not updated for | low-pass-filtered inflow, | + | transients in inflow, turbine | wind turbine control, and | + | control, or wind turbine | wind turbine motion. | + | motion (the latter is | | + | especially important for | | + | floating offshore wind | | + | turbines). | | + +----------------------------------+----------------------------------+ + | - Individual wind turbine and | - Individual wind turbine and | + | wake dynamics solved | wake dynamics solved in | + | individually or serially, not | parallel on multiple cores. | + | considering two-way | | + | wake-merging interactions. | - Wake merging allowed to | + | | influence wake dynamics. | + | - Wake impingement based only | | + | on the strongest wake | - Wake deficits of downwind | + | deficit -- not considering | wind turbines dependent on | + | cumulative effects from | impingement of wakes from | + | multiple upwind wind | upwind wind turbines. | + | turbines -- and/or the wake | | + | impingement approach is | - Wake deficits superimposed in | + | treated differently below and | the axial direction based on | + | above rated wind speed (i.e., | the RSS method. | + | a discrete change). | | + | | | + | - No available method to | | + | calculate disturbed wind in | | + | zones of wake overlap. | | + +----------------------------------+----------------------------------+ + | - Wake meandering velocity | - Wake meandering velocity | + | calculated with uniform | calculated with optional | + | spatial averaging, resulting | weighted spatial averaging | + | in less meandering than | based on the jinc function to | + | expected and at improper | result in closer-to-ideal | + | frequencies. | low-pass filtering. | + | | | + | - The wakes meander laterally, | - Wakes meander both laterally | + | but not axially. | and axially. | + +----------------------------------+----------------------------------+ + + +.. _FF:TheoryBasis: + +FAST.Farm Theory Basis +---------------------- + +FAST.Farm is a nonlinear time-domain multiphysics engineering tool +composed of multiple submodels, each representing different physics +domains of the wind farm. FAST.Farm is implemented as open-source +software that follows the programming requirements of the FAST +modularization framework (:cite:`ff-Jonkman13_1`), whereby the +submodels are implemented as modules interconnected through a driver +code. The submodel hierarchy of FAST.Farm is illustrated in +:numref:`FF:FFarm`. Wake advection, deflection, and meandering; +near-wake correction; and wake-deficit increment are submodels of the +wake-dynamics (*WD*) model, implemented in a single module. Ambient wind +and wake merging are submodels of the ambient wind and array effects +(*AWAE*) model, implemented in a single module. Combined with the super +controller (*SC*) and OpenFAST (*OF*) modules, FAST.Farm has four +modules and one driver. There are multiple instances of the *OF* and +*WD* modules -- one instance for each wind turbine/rotor. Each +submodel/module is described in the subsections below. + +FAST.Farm can be compiled and run in serial or parallel mode. +Parallelization has been implemented in FAST.Farm through OpenMP, which +allows FAST.Farm to take advantage of multicore computers by dividing +computational tasks among the cores/threads within a node (but not +between nodes) to speed up a single simulation. This process is +illustrated in :numref:`FF:Parallel` for a node where the number of +threads (:math:`N_{Th}`) is greater than the number of wind turbines +(:math:`N_t`). There is one instance of the *AWAE* and *SC* modules and +:math:`N_t` instances of the *OF* and *WD* modules. The initialization, +update states, calculate output, and end calls to each module are shown. +The output calculation of *AWAE* is parallelized across all threads. +During time marching, each instance of *OF* is solved in parallel while +the ambient wind data are read by *AWAE*. + +.. figure:: Pictures/Parallelization.png + :alt: FAST.Farm parallelization process. + :name: FF:Parallel + :width: 100% + :align: center + + FAST.Farm parallelization process. + +The size of the wind farm and number of wind turbines is limited only by +the available RAM. In parallel mode, each instance of the OpenFAST +submodel can be run in parallel on separate threads. At the same time, +the ambient wind within the *AWAE* module is being read into memory on +another thread. Thus, the fastest simulations require at least one more +core than the number of wind turbines in the wind farm. Furthermore, the +output calculations within the *AWAE* module are parallelized into +separate threads. To support the modeling of large wind farms, single +simulations involving memory parallelization and parallelization between +nodes of a multinode HPC through MPI is likely required. MPI has not yet +been implemented within FAST.Farm. However, a multinode HPC can be used +to run multiple serial or parallelized simulations in parallel (in batch +mode) on separate nodes. In serial mode, multiple serial simulations can +be run in parallel (in batch mode) on separate cores and/or nodes. + +.. _FF:Driver: + +FAST.Farm Driver +~~~~~~~~~~~~~~~~ + +The FAST.Farm driver, also known as the “glue code,” is the code that +couples individual modules together and drives the overall time-domain +solution forward. Additionally, the FAST.Farm driver reads an input file +of simulation parameters, checks the validity of these parameters, +initializes the modules, writes results to a file, and releases memory +at the end of the simulation. + +To simplify the coupling algorithm in the FAST.Farm driver and ensure +computational efficiency, all module states (:math:`x^d`), inputs +(:math:`u^d`), outputs (:math:`y^d`), and functions (:math:`X^d` for +state updates and :math:`Y^d` for outputs) in FAST.Farm are expressed in +discrete time, :math:`t=n\Delta t`, where :math:`t` is time, :math:`n` +is the discrete-time-step counter, and :math:`\Delta t` is the +user-specified discrete time step (increment). Thus, the most general +form of a module in FAST.Farm is simpler than that permitted by the FAST +modularization framework (:cite:`ff-Jonkman13_1`), represented +mathematically as: [1]_ + +.. math:: + + \begin{aligned} + x^d\left[ n+1 \right]=X^d\left( x^d\left[ n \right],u^d\left[ n \right],n \right)\\ + y^d\left[ n \right]=Y^d\left( x^d\left[ n \right],u^d\left[ n \right],n \right)\end{aligned} + +The *SC*, *OF*, and *WD* modules do not have direct feedthrough of input +to output, meaning that the corresponding output functions simplify to +:math:`y^d\left[ n \right]=Y^d\left( x^d\left[ n \right],n \right)`. The +ability of the *OF* module to be written in the above form is explained +in :numref:`FF:OF`. Additionally, the *AWAE* module does not +have states, reducing the module to a feed-forward-only system and a +module form that simplifies to +:math:`y^d\left[ n \right]=Y^d\left( u^d\left[ n \right],n \right)`. For +functions in this manual, square brackets :math:`\left[\quad\right]` +denote discrete functions and round parentheses +:math:`\left(\quad\right)` denote continuous functions; the +brackets/parentheses are dropped when implied. The states, inputs, and +outputs of each of the FAST.Farm modules (*SC*, *OF*, *WD*, and *AWAE*) +are listed in :numref:`FF:tab:modules` and explained further in the +sections below. + +.. table:: Module States, Inputs, and Outputs in FAST.Farm + :name: FF:tab:modules + + +-----------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------+----------------------------------------------------------------------+ + | **Module** | **States (Discrete Time)** | **Inputs** | **Outputs** | + +=========================================+=================================================================================+=====================================================================+======================================================================+ + | *Super Controller (SC)* | - User-defined | - Global measurements | - Global controller commands | + | | | - Commands/measurements from individual turbine controllers | - Commands to individual turbine controllers | + +-----------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------+----------------------------------------------------------------------+ + | *OpenFAST (OF)* | - None in the OpenFAST wrapper, but there are many states internal to OpenFAST | - Global controller commands | - Commands/measurements from the individual turbine controller | + | | | - Commands to the individual turbine controller | - :math:`\hat{x}^\text{Disk}` | + | | | - :math:`\vec{V}_\text{Dist}^\text{High}` | - :math:`\vec{p}^\text{Hub}` | + | | | | - :math:`D^\text{Rotor}` | + | | | | - :math:`\gamma^\text{YawErr}` | + | | | | - :math:`^\text{DiskAvg}V_x^\text{Rel}` | + | | | | - :math:`^\text{AzimAvg}C_t\left(r\right)` | + +-----------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------+----------------------------------------------------------------------+ + | *Wake Dynamics (WD)* | - :math:`^\text{FiltDiskAvg}V_x^\text{Rel}` | - :math:`\hat{x}^\text{Disk}` | For :math:`0 \le n_p \le N_p-1`: | + | | - :math:`^\text{FiltAzimAvg}C_t\left(r\right)` | - :math:`\vec{p}^\text{Hub}` | | + | | | - :math:`D^\text{Rotor}` | - :math:`\hat{x}_{n_p}^\text{Plane}` | + | | For :math:`0 \le n_p \le N_p-1`: | - :math:`\gamma^\text{YawErr}` | - :math:`\vec{p}_{n_p}^\text{Plane}` | + | | | - :math:`^\text{DiskAvg}V_x^\text{Rel}` | - :math:`V_{x_{n_p}}^\text{Wake}\left(r\right)` | + | | - :math:`^\text{Filt}D_{n_p}^\text{Rotor}` | - :math:`^\text{AzimAvg}C_t\left(r\right)` | - :math:`V_{r_{n_p}}^\text{Wake}\left(r\right)` | + | | - :math:`^\text{Filt}\gamma_{n_p}^\text{YawErr}` | - :math:`\vec{V}_{n_p}^\text{Plane}` for :math:`0 \len_p \le N_p-1` | - :math:`D_{n_p}^\text{Wake}` | + | | - :math:`^\text{Filt}\vec{V}_{n_p}^\text{Plane}` | - :math:`^\text{DiskAvg}V_x^\text{Wind}` | | + | | - :math:`^\text{FiltDiskAvg}V_{x_{n_p}}^\text{Wind}` | - :math:`TI_\text{Amb}` | | + | | - :math:`^\text{Filt}TI_{\text{Amb}_{n_p}}` | | | + | | - :math:`x_{n_p}^\text{Plane}` | | | + | | - :math:`\hat{x}_{n_p}^\text{Plane}` | | | + | | - :math:`\vec{p}_{n_p}^\text{Plane}` | | | + | | - :math:`V_{x_{n_p}}^\text{Wake}\left(r\right)` | | | + | | - :math:`V_{r_{n_p}}^\text{Wake}\left(r\right)` | | | + +-----------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------+----------------------------------------------------------------------+ + | *Ambient Wind and Array Effects (AWAE)* | - None | For each turbine and :math:`0 \le n_p \le N_p-1`: | For each turbine: | + | | | | | + | | | - :math:`\hat{x}_{n_p}^\text{Plane}` | - :math:`\vec{V}_\text{Dist}^\text{High}` | + | | | - :math:`\vec{p}_{n_p}^\text{Plane}` | - :math:`\vec{V}_{n_p}^\text{Plane}` for :math:`0 \le n_p \le N_p-1` | + | | | - :math:`V_{x_{n_p}}^\text{Wake}\left(r\right)` | - :math:`^\text{DiskAvg}V_x^\text{Wind}` | + | | | - :math:`V_{r_{n_p}}^\text{Wake}\left(r\right)` | - :math:`TI_\text{Amb}` | + | | | - :math:`D_{n_p}^\text{Wake}` | | + +-----------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------+----------------------------------------------------------------------+ + + +After initialization and within each time step, the states of each +module (*SC*, *OF*, and *WD*) are updated (from time :math:`t` to time +:math:`t+\Delta t`, or equivalently, :math:`n` to :math:`n+1`); time is +incremented; and the module outputs are calculated and transferred as +inputs to other modules. Because of the form simplifications, the state +updates of each module can be solved in parallel; the output-to-input +transfer does not require a large nonlinear solve; and overall +correction steps of the solution are not needed. The lack of a +correction step is a major simplification of the coupling algorithm used +within OpenFAST (:cite:`ff-Sprague14_1,ff-Sprague15_1`). +Furthermore, the output calculations of the *SC*, *OF*, and *WD* modules +can be parallelized, followed then by the output calculation of the +*AWAE* module. [2]_ In parallel mode, parallelization has been +implemented in FAST.Farm through OpenMP. + +Because of the small timescales and sophisticated physics, the OpenFAST +submodel is the computationally slowest of the FAST.Farm modules. +Additionally, the output calculation of the *AWAE* module is the only +major calculation that cannot be solved in parallel to OpenFAST. Because +of this, the parallelized FAST.Farm solution at its fastest may execute +only slightly more slowly than stand-alone OpenFAST simulations. This +results in simulations that are computationally inexpensive enough to +run the many simulations necessary for wind turbine/farm design and +analysis. + +.. _FF:Theory:SC: + +Super Controller (SC Module) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Wind-farm-wide super controllers have the potential to achieve the +global benefit of improving overall power performance and reducing +turbine loads, based on modifying wake deficits through variations in +blade pitch or generator torque and/or redirecting (steering) wakes +through variations in nacelle yaw or tilt, as illustrated in +:numref:`FF:NacYaw`. + +.. figure:: Pictures/NacYawControl.png + :alt: Nacelle-yaw control used to redirect wakes away from downwind wind turbines. :cite:`ff-Gebraad16_1` + :name: FF:NacYaw + :width: 100% + :align: center + + Nacelle-yaw control used to redirect wakes away from downwind wind + turbines. :cite:`ff-Gebraad16_1` + +The *SC* module of FAST.Farm provides an interface to the super +controller dynamic library -- essentially identical to the super controller +available in `SOWFA `__ -- which allows the +user of FAST.Farm to implement their own wind-farm-wide control logic in +discrete time and without direct feedthrough of input to output -- perhaps +developed through the application of +`FLORIS `__. The inputs to the *SC* +module are commands or measurements from individual turbine controllers +(output from the *OF* module). [3]_ The outputs of the *SC* module are +the global controller commands and individual turbine controller +commands (inputs to the *OF* module). + +Note that at time zero, the *SC* module is called before the call to the +*OF* module and the associated individual turbine controllers. So, the +initial outputs from the super controller are sent as inputs to the +individual turbine controllers, but the initial inputs to the super +controller from the individual turbine controller outputs at time zero +are always zero. At subsequent time steps, the *OF* module and the +associated individual turbine controllers are called before the output +calculation of the *SC* module. As a result, at each time step other +than time zero, the outputs from the super controller are extrapolated +in time based on past values within *OF* before being sent as input to +the individual turbine controllers. Thus, care should be taken to ensure +that the outputs from the super controller vary smoothly over time +(without steps). See :numref:`FF:Parallel` for more information. + +.. _FF:OF: + +OpenFAST (OF Module) +~~~~~~~~~~~~~~~~~~~~ + +FAST.Farm makes use of +`OpenFAST `__ to model the +dynamics (loads and motions) of distinct turbines in the wind farm. +OpenFAST captures the environmental excitations (wind inflow; for +offshore systems, waves, current, and ice) and coupled system response +of the full system (the rotor, drivetrain, nacelle, tower, controller; +for offshore systems, the substructure and station-keeping system). +OpenFAST itself is an interconnection of various modules, each +corresponding to different physical domains of the coupled +aero-hydro-servo-elastic solution. The details of the OpenFAST solution +are outside the scope of this document, but can be found in the +hyperlink above and associated references. + +The *OF* module of FAST.Farm is a wrapper that enables the coupling of +OpenFAST to FAST.Farm -- similar to the OpenFAST wrapper available in +SOWFA, but with different inputs and outputs (described below). This +wrapper also controls subcycling of the OpenFAST state updates. The +timescales solved within OpenFAST are much smaller than those within +FAST.Farm. Therefore, for accuracy and numerical stability reasons, the +OpenFAST time step is typically much smaller than that required of +FAST.Farm, as depicted in :numref:`FF:timescales`. + +.. figure:: Pictures/timescales.png + :alt: Illustration of timescale ranges for OpenFAST (DT), the FAST.Farm high-resolution domain (DT_High), and the FAST.Farm low-resolution domain (DT_Low). + :name: FF:timescales + :width: 100% + :align: center + + Illustration of timescale ranges for OpenFAST (DT), the FAST.Farm + high-resolution domain (DT_High), and the FAST.Farm low-resolution + domain (DT_Low). + +There is one instance of the *OF* module for each wind turbine. In +parallel mode, these instances are parallelized through OpenMP. OpenFAST +itself has various modules with different inputs, outputs, states, and +parameters -- including continuous-time, discrete-time, algebraic, and +other (e.g., logical) states. However, for the purposes of coupling +OpenFAST to FAST.Farm, the *OF* module functions in discrete time and +without direct feedthrough of input to output. This is achieved by +calling the *OF* module at the rate dictated by the FAST.Farm time step, +:math:`\Delta t`, and by introducing a one-time-step (:math:`\Delta t`) +delay of the output relative to the input; this one-time-step delay is +not expected to be problematic because of the slow timescales solved +within FAST.Farm. + +At initialization, the number of wind turbines (:math:`N_t`, with +:math:`n_t` the turbine counter such that :math:`1\le n_t\le N_t`), the +corresponding OpenFAST primary input files, and turbine origins in the +global *X-Y-Z* inertial-frame coordinate system are specified by the +user. Turbine origins are defined as the intersection of the undeflected +tower centerline and the ground or, for offshore systems, mean sea +level. The global inertial-frame coordinate system is defined with *Z* +directed vertically upward (opposite gravity), *X* directed horizontally +nominally downwind (along the zero-degree wind direction), and *Y* +directed horizontally transversely. + +The global and turbine-dependent commands from the super controller +(outputs from the *SC* module) are used as inputs to the *OF* module to +enable the individual turbine controller to be guided by wind farm-level +effects; likewise, the turbine-dependent commands or measurements are +output from the *OF* module for access by the super controller (inputs +to the *SC* module). + +The *OF* module also uses the disturbed wind (ambient plus wakes of +neighboring turbines) across a high-resolution wind domain (in both time +and space) around the turbine (output from the *AWAE* module -- see +:numref:`FF:AWAE` for more information), +:math:`\vec{V}_\text{Dist}^\text{High}`, as input, to ensure that the +individual turbine loads and response calculated by OpenFAST are +accurately driven by flow through the wind farm, including wake and +array effects. Spatially, the high-resolution wind domain must be large +enough to encompass yawing of the rotor, blade deflection, and motion of +the support structure (the latter is especially important for floating +offshore wind turbines). OpenFAST uses a four-dimensional (three space +dimensions plus one time dimension) interpolation to determine the wind +local to its analysis nodes. + +The *OF* module computes several outputs needed for calculating wake +dynamics (inputs to the *WD* module). These include: + +- :math:`\hat{x}^\text{Disk}` -- the orientation of the rotor centerline + +- :math:`\vec{p}^\text{Hub}` -- the global position of the rotor center + +- :math:`D^\text{Rotor}` -- the rotor diameter + +- :math:`\gamma^\text{YawErr}` -- the nacelle-yaw error of the rotor + +- :math:`^\text{DiskAvg}V_x^\text{Rel}` -- the rotor-disk-averaged + relative wind speed (ambient plus wakes of neighboring turbines plus + turbine motion), normal to the disk + +- :math:`^\text{AzimAvg}C_t\left( r \right)` -- the azimuthally averaged + thrust-force coefficient (normal to the rotor disk), distributed + radially, where :math:`r` is the radius. + +In this manual, an over arrow (:math:`\vec{\quad}`) denotes a +three-component vector and a hat (:math:`\hat{\quad}`) denotes a +three-component unit vector. For clarity in this manual, +:math:`\left( r \right)` is used to denote radial dependence as a +continuous function, even though the radial dependence is +stored/computed on a discrete radial finite-difference grid within +FAST.Farm. Except for :math:`\gamma^\text{YawErr}` and +:math:`^\text{AzimAvg}C_t\left( r \right)`, all of the listed variables +were computed within OpenFAST before the development of FAST.Farm. +:math:`\gamma^\text{YawErr}` is defined as the angle about global *Z* +from the rotor centerline to the rotor-disk-averaged relative wind +velocity (ambient plus wakes of neighboring turbines plus turbine +motion), both projected onto the horizontal global *X-Y* plane -- see +:numref:`FF:WakeDefl` for an illustration. +:math:`^\text{AzimAvg}C_t\left( r \right)` is computed by +Equation :eq:`eq:Ct` + +.. math:: + ^\text{AzimAvg}C_t\left( r \right)= + \frac{\sum\limits_{n_b=1}^{N_b} + {\left\{ \hat{x}^\text{Disk} \right\}^T}\vec{f}_{n_b}\left( r \right)} + {\frac{1}{2}\rho 2\pi r\left( ^\text{DiskAvg}V_x^\text{Rel} \right)^2} + :label: eq:Ct + +where: + +- :math:`N_b` -- number of rotor blades, with :math:`n_b` as the blade + counter such that :math:`1\le n_b\le N_b` + +- :math:`\left\{ \quad \right\}^T` -- vector transpose + +- :math:`\rho` -- air density + +- :math:`\vec{f}_{n_b}\left( r \right)` -- aerodynamic applied loads [4]_ + distributed per unit length along a line extending radially outward + in the plane of the rotor disk for blade :math:`n_b`. + +The numerator of Equation :eq:`eq:Ct` is the aerodynamic +applied loads distributed per unit length projected normal to the rotor +disk, i.e., the radially dependent thrust force. The denominator is the +normalizing factor for the radially dependent thrust coefficient, +composed of the circumference at the given radius, :math:`2\pi r`, and +the dynamic pressure of the rotor-disk-averaged relative wind speed, +:math:`\frac{1}{2}\rho {{\left( ^\text{DiskAvg}V_x^\text{Rel} \right)}^2}`. + +.. _FF:WD: + +Wake Dynamics (WD Module) +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *WD* module of FAST.Farm calculates wake dynamics for an individual +rotor, including wake advection, deflection, and meandering; a near-wake +correction; and a wake-deficit increment. The near-wake correction +treats the near-wake (pressure-gradient zone) expansion of the wake +deficit. The wake-deficit increment shifts the quasi-steady-state +axisymmetric wake deficit nominally downwind. Each submodel is described +in the subsections below. There is one instance of the *WD* module for +each rotor. + +The wake-dynamics calculations involve many user-specified parameters +that may depend, e.g., on turbine operation or atmospheric conditions +that can be calibrated to better match experimental data or HFM, e.g., +by running `SOWFA `__ (or equivalent) as a +benchmark. Default values have been derived for each calibrated +parameter based on `SOWFA `__ +simulations (:cite:`ff-Doubrawa18_1`), but these can be +overwritten by the user of FAST.Farm. + +The wake-deficit evolution is solved in discrete time on an axisymmetric +finite-difference grid consisting of a fixed number of wake planes, +:math:`N_p` (with :math:`n_p` the wake-plane counter such that +:math:`0\le n_p\le N_p-1`), each with a fixed radial grid of nodes. +Because the wake deficit is assumed to be axisymmetric, the radial +finite-difference grid can be considered a plane. A wake plane can be +thought of as a cross section of the wake wherein the wake deficit is +calculated. + +Inputs to the *WD* module include :math:`\hat{x}^\text{Disk}`, +:math:`\vec{p}^\text{Hub}`, :math:`D^\text{Rotor}`, +:math:`\gamma^\text{YawErr}`, :math:`^\text{DiskAvg}V_x^\text{Rel}`, and +:math:`^\text{AzimAvg}C_t\left( r \right)`. Additional inputs are the +advection, deflection, and meandering velocity of the wake planes for +the rotor (:math:`\vec{V}_{n_p}^\text{Plane}`); the rotor-disk-averaged +ambient wind speed, normal to the disk +(:math:`^\text{DiskAvg}V_x^\text{Wind}`); and the ambient turbulence +intensity of the wind at the rotor (:math:`TI_\text{Amb}`) (output from +the *AWAE* module -- see :numref:`FF:AWAE` for more information). +:math:`\vec{V}_{n_p}^\text{Plane}` is computed for +:math:`0\le n_p\le N_p-1` by spatial averaging of the disturbed wind. + +The *WD* module computes several outputs needed for the calculation of +disturbed wind, to be used as input to the *AWAE* module. These outputs +include: + +- :math:`\hat{x}_{n_p}^\text{Plane}` -- the orientations of the wake + planes defined using the unit vectors normal to each plane, i.e., the + orientation of the wake-plane centerline + +- :math:`\vec{p}_{n_p}^\text{Plane}` -- the global positions of the + centers of the wake planes + +- :math:`V_{x_{n_p}}^\text{Wake}\left(r\right)` and + :math:`V_{r_{n_p}}^\text{Wake}\left(r\right)` -- the axial and radial + wake-velocity deficits, respectively, at the wake planes, distributed + radially + +- :math:`D_{n_p}^\text{Wake}` -- the wake diameters at the wake planes, + each for :math:`0\le n_p\le N_p-1`. + +Though the details are left out of this manual, during start-up -- whereby +a wake has not yet propagated through all of the wake planes -- the number +of wake planes is limited by the elapsed time to avoid having to set +inputs, outputs, and states in the *WD* and *AWAE* modules beyond where +the wake has propagated. + +.. _FF:AdvDefMean: + +Wake Advection, Deflection, and Meandering +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By simple extensions to the passive tracer solution for transverse +(horizontal and vertical) wake meandering, the wake-dynamics solution in +FAST.Farm is extended to account for wake deflection -- as illustrated in +:numref:`FF:WakeDefl` -- and wake advection -- as illustrated in +:numref:`FF:WakeAdv` -- among other physical improvements. The +following extensions are introduced: + +#. Calculating the wake plane velocities, + :math:`\vec{V}_{n_p}^\text{Plane}` for :math:`0\le n_p\le N_p-1`, by + spatially averaging the disturbed wind instead of the ambient wind + (see :numref:`FF:AWAE`) + +#. Orientating the wake planes with the rotor centerline instead of the + wind direction + +#. Low-pass filtering the local conditions at the rotor, as input to the + *WD* module, to account for transients in inflow, turbine control, + and/or turbine motion instead of considering time-averaged + conditions. + +With these extensions, the passive tracer solution enables: + +#. The wake centerline to deflect based on inflow skew. This is achieved + because in skewed inflow, the wake deficit normal to the disk + introduces a velocity component that is not parallel to the ambient + flow. + +#. The wake to accelerate from near wake to far wake because the wake + deficits are stronger in the near wake and weaken downwind. + +#. The wake-deficit evolution to change based on conditions at the rotor + because low-pass time filtered conditions are used instead of + time-averaged. + +#. The wake to meander axially in addition to transversely because local + axial winds are considered. + +#. The wake shape to be elliptical instead of circular in skewed flow + when looking downwind (the wake shape remains circular when looking + down the rotor centerline). + +For item 3, low-pass time filtering is important because the wake reacts +slowly to changes in local conditions at the rotor and because the wake +evolution is treated in a quasi-steady-state fashion. Furthermore, a +correction to the wake deflection resulting from item 1 is needed to +account for the physical combination of wake rotation and shear, which +is not modeled directly in the *WD* module. This is achieved through a +horizontally asymmetric correction to the wake deflection from item 1 +(see :numref:`FF:WakeDefl` for an illustration). This +horizontal wake-deflection correction is a simple linear correction with +slope and offset, similar to the correction implemented in the wake +model of FLORIS. It is important for accurate modeling of +nacelle-yaw-based wake-redirection (wake-steering) wind farm control. + +Mathematically, the low-pass time filter is implemented using a +recursive, single-pole filter with exponential +smoothing (:cite:`ff-Smith06_1`). The discrete-time recursion +(difference) equation for this filter +is (:cite:`ff-Jonkman09_1`): + +.. math:: + {x^d_{n_p}}\left[ n+1 \right]={x^d_{n_p}} + \left[ n \right]\alpha + +{u^d}\left[ n \right]\left( 1-\alpha \right) + \qquad \textrm{for } n_p=0 + :label: eq:disc + +where + +- :math:`x^d` -- discrete-time state storing the low-pass time-filtered + value of input :math:`u^d` + +- :math:`\alpha=e^{-2\pi \Delta t f_c}` -- low-pass time-filter parameter, + with a value between 0 (minimum filtering) and 1 (maximum filtering) + (exclusive) + +- :math:`f_c` -- user-specified cutoff (corner) frequency (the time + constant of the low-pass time filter is :math:`\frac{1}{f_c}`). + +Subscript :math:`n_p` is used to denote the state associated with +wake-plane :math:`n_p`; Equation :eq:`eq:disc` applies at the +rotor disk, where :math:`n_p=0`. + +To be consistent with the quasi-steady-state treatment of the +wake-deficit evolution (see :numref:`FF:Deficit`), the +conditions at the rotor are maintained as fixed states of a wake plane +as the plane propagates downstream + +.. math:: + x^d_{n_p}[n+1] = x^d_{n_p-1}[n] + \qquad \textrm{for } 1 \leq n_p \leq N_p-1 + :label: eq:propagation + +Equations :eq:`eq:disc` +and :eq:`eq:propagation` apply directly to the *WD* +module inputs :math:`D^\text{Rotor}`\ [5]_, +:math:`\gamma^\text{YawErr}`, :math:`^\text{DiskAvg}V_x^\text{Rel}`, and +:math:`TI_\text{Amb}`. The associated states are +:math:`^\text{Filt}D_{n_p}^\text{Rotor}`, +:math:`^\text{Filt}\gamma_{n_p}^\text{YawErr}`, +:math:`^\text{FiltDiskAvg}V_{x_{n_p}}^\text{Wind}`, and +:math:`^\text{Filt}TI_{\text{Amb}_{n_p}}` respectively (each for +:math:`0\le n_p\le N_p-1`). The *WD* module inputs +:math:`^\text{DiskAvg}V_x^\text{Rel}` and +:math:`^\text{AzimAvg}C_t\left( r \right)` are needed for the boundary +condition at the rotor, but are not otherwise needed in the wake-deficit +evolution calculation and are therefore not propagated downstream with +the wake planes. Therefore, Equation :eq:`eq:disc` applies to +these inputs but Equation :eq:`eq:propagation` does +not. The associated states are :math:`^\text{FiltDiskAvg}V_x^\text{Rel}` +and :math:`^\text{FiltAzimAvg}C_t\left( r \right)`. Likewise, only +Equation :eq:`eq:disc` is used to low-pass time filter the +*WD* module input :math:`\vec{V}_{n_p}^\text{Plane}` with state +:math:`^\text{Filt}\vec{V}_{n_p}^\text{Plane}` (for +:math:`0\le n_p\le N_p-1`). Equations :eq:`eq:disc` +and :eq:`eq:propagation` apply in a modified form to +the *WD* module inputs :math:`\hat{x}^\text{Disk}` and +:math:`\vec{p}^\text{Hub}` to derive the state associated with the +downwind distance from the rotor to each wake plane in the axisymmetric +coordinate system (:math:`x_{n_p}^\text{Plane}`), and the states and +outputs associated with the orientations of the wake planes, normal to +the planes, (:math:`\hat{x}_{n_p}^\text{Plane}`), and the global center +positions of the wake planes, (:math:`\vec{p}_{n_p}^\text{Plane}`) as +follows: + +.. math:: + \hat{x}_{n_p}^\text{Plane}\left[ n+1 \right]= + \begin{cases} + \frac{\hat{x}_{n_p}^\text{Plane}\left[ n \right]\alpha +\hat{x}^\text{Disk}\left( 1-\alpha \right)} + {\left\| \hat{x}_{n_p}^\text{Plane}\left[ n \right]\alpha +\hat{x}^\text{Disk}\left( 1-\alpha \right) \right\|_2} + &\qquad\textrm{for}~n_p=0 \\ + \\ + \hat{x}_{n_p-1}^\text{Plane}\left[ n \right] + &\qquad\textrm{for}~1\le n_p\le N_p-1 \\ + \end{cases} + :label: eq:6.6 + + +.. math:: + x_{n_p}^\text{Plane}\left[ n+1 \right]= + \begin{cases} + 0 &\qquad\textrm{for}~n_p=0 \\ + \\ + x_{n_p-1}^\text{Plane}\left[ n \right]+|d\hat{x}_{n_p-1}| + &\qquad\textrm{for}~1\le n_p\le N_p-1 \\ + \end{cases} + :label: eq:6.7 + + +.. math:: + \vec{p}_{n_p}^\text{Plane}\left[ n+1 \right]= + \begin{cases} + \begin{aligned}[l] + &\vec{p}_{n_p}^\text{Plane}\left[ n \right]\alpha + \left\{ \vec{p}^\text{Hub}\left[ n \right]\right. \\ + &\qquad + \left.\left( C_\text{HWkDfl}^\text{O}+C_\text{HWkDfl}^\text{OY}~^\text{Filt}\gamma _{n_p}^\text{YawErr}\left[ n+1 \right] \right)\widehat{XY_{n_p}} \right\}\left( 1-\alpha \right) + \end{aligned} + & \textrm{for}~ n_p=0 \\ + \\ + \begin{aligned}[l] + &\vec{p}_{n_p-1}^\text{Plane}\left[ n \right] + \hat{x}_{n_p-1}^\text{Plane}\left[ n \right]\ d\hat{x}_{n_p-1} \\ + &\qquad +\left[ I-\hat{x}_{n_p-1}^\text{Plane}\left[ n \right]{{\left\{ \hat{x}_{n_p-1}^\text{Plane}\left[ n \right] \right\}}^T} \right]\vec{V}_{n_p-1}^\text{Plane}\Delta t \\ + &\qquad +\left( \left( C_\text{HWkDfl}^\text{x}+C_\text{HWkDfl}^\text{xY}\ ^\text{Filt}\gamma _{n_p-1}^\text{YawErr}\left[ n \right] \right)d\hat{x}_{n_p-1} \right)\widehat{XY_{n_p-1}} + \end{aligned} + & \textrm{for}~ 1\le n_p\le N_p-1 \\ + \end{cases} + :label: eq:6.8 + +where: + +.. math:: + d\hat{x}_{n_p-1}=\left\{ \hat{x}_{n_p-1}^\text{Plane}\left[ n \right] \right\}^T\ ^\text{Filt}\vec{V}_{n_p-1}^\text{Plane}\left[ n+1 \right]\Delta t + :label: eq:6.9 + +.. math:: + \widehat{XY_{n_p}}=\left\{ \frac{\left( \left\{ \hat{x}_{n_p}^\text{Plane}\left[ n+1 \right] \right\}^T\hat{X} \right)\hat{Y}-\left( \left\{ \hat{x}_{n_p}^\text{Plane}\left[ n+1 \right] \right\}^T\hat{Y} \right)\hat{X}}{\left\| \left( \left\{ \hat{x}_{n_p}^\text{Plane}\left[ n+1 \right] \right\}^T\hat{X} \right)\hat{X}+\left( \left\{ \hat{x}_{n_p}^\text{Plane}\left[ n+1 \right] \right\}^T\hat{Y} \right)\hat{Y} \right\|_2} \right\} + :label: eq:6.10 + +Equation :eq:`eq:6.6` differs from +Equations :eq:`eq:disc` +and :eq:`eq:propagation` in that after applying +Equation :eq:`eq:disc` to low-pass time-filter input +:math:`\hat{x}^\text{Disk}`, the state is renormalized to ensure that +the vector remains unit length; Equation :eq:`eq:6.6` ensures +that the wake-plane orientation is maintained as the planes propagate +nominally downwind. Equation :eq:`eq:6.7` expresses that each +wake plane propagates downwind in the axisymmetric coordinate system by +a distance equal to that traveled by the low-pass time-filtered +wake-plane velocity projected along the plane orientation over the time +step; [6]_ the initial wake plane (:math:`n_p=0`) is always at the rotor +disk. Equation :eq:`eq:6.8` expresses the global center +positions of the wake plane following the passive tracer concept, +similar to Equation :eq:`eq:6.7`, but considering the full +three-component movement of the wake plane, including deflection and +meandering. The last term on the right-hand side of +Equation :eq:`eq:6.8` for each wake plane is the horizontal +wake-deflection correction, where: + +- :math:`C_{HWkDfl}^\text{O}` -- user-specified parameter defining the + horizontal offset at the rotor + +- :math:`C_{HWkDfl}^\text{OY}` -- user-specified parameter defining the + horizontal offset at the rotor scaled with nacelle-yaw error + +- :math:`C_{HWkDfl}^\text{x}` -- user-specified parameter defining the + horizontal offset scaled with downstream distance + +- :math:`C_{HWkDfl}^\text{xY}` -- user-specified parameter defining the + horizontal offset scaled with downstream distance and nacelle-yaw + error + +- :math:`\hat{X}`, :math:`\hat{Y}`, and :math:`\hat{Z}` -- unit vectors + parallel to the inertial-frame coordinates *X*, *Y* and, *Z* + respectively + +- :math:`\widehat{XY_{np}}` -- three-component unit vector in the + horizontal global *X-Y* plane orthogonal to + :math:`\hat{x}^\text{Plane}_{n_p}\left[ n+1 \right]` + +- :math:`C_\text{HWkDfl}^\text{O}+C_\text{HWkDfl}^\text{OY} \ ^\text{Filt}\gamma _{n_p}^\text{YawErr}\left[ n+1 \right]` -- offset + at the rotor + +- :math:`C_\text{HWkDfl}^\text{x}+C_\text{HWkDfl}^\text{xY} \ ^\text{Filt}\gamma _{n_p}^\text{YawErr}\left[ n+1 \right]` -- slope + +- :math:`d\hat{x}_{n_p-1}` -- nominally downwind increment of the wake + plane (from Equation :eq:`eq:6.7`) + +- *I* -- three-by-three identity matrix + +- :math:`\left[ I-\hat{x}_{n_p-1}^\text{Plane}\left[ n \right]\left\{ \hat{x}_{n_p-1}^\text{Plane}\left[ n \right] \right\}^T \right]` -- used + to calculate the transverse component of + :math:`V^\text{Plane}_{n_p-1}` normal to + :math:`\hat{x}^\text{Plane}_{n_p-1}\left[ n\right]`. + +It is noted that the advection, deflection, and meandering velocity of +the wake planes, :math:`\vec{V}^\text{Plane}_{n_p-1}`, is low-pass time +filtered in the axial direction, but not in the transverse direction. +Low-pass time filtering in the axial direction is useful for minimizing +how often wake planes get close to or pass each other while they travel +axially; this filtering is not needed transversely because an +appropriate transverse meandering velocity is achieved through spatially +averaging the disturbed wind (see :numref:`FF:AWAE`). + +The consistent output equation corresponding to the low-pass time filter +of Equation :eq:`eq:disc` is +:math:`y^d\left[ n \right]={x^d}\left[ n \right]\alpha +{u^d}\left[ n \right]\left( 1-\alpha \right)`, +i.e., :math:`{Y^d(\quad)}=X^d(\quad)`, or equivalently, +:math:`y^d\left[ n \right]=x^d\left[ n+1 \right]` (:cite:`ff-Jonkman09_1`). +However, the output is delayed by one time step (:math:`\Delta t`) to +avoid having direct feedthrough of input to output within the *WD* +module, yielding :math:`y^d\left[ n \right]=x^d\left[ n \right]`. This +one-time-step delay is applied to all outputs of the *WD* module and is +not expected to be problematic because of the slow timescales solved +within FAST.Farm. + +.. _FF:SNearWake: + +Near-Wake Correction +^^^^^^^^^^^^^^^^^^^^ + +The near-wake correction submodel of the *WD* module computes the axial +and radial wake-velocity deficits at the rotor disk as an inlet boundary +condition for the wake-deficit evolution described in +:numref:`FF:Deficit`. To improve the accuracy of the far-wake +solution, the near-wake correction accounts for the drop in wind speed +and radial expansion of the wake in the pressure-gradient zone behind +the rotor that is not otherwise accounted for in the solution for the +wake-deficit evolution. For clarity, the equations in this section are +expressed using continuous variables, but within FAST.Farm the equations +are solved discretely on an axisymmetric finite-difference grid. + +The near-wake correction is computed differently for low thrust +conditions (:math:`C_T<\frac{24}{25}`), momentum theory is valid, and +high thrust conditions (:math:`1.1`__. The wake-merging +submodule identifies zones of overlap between all wakes across the wind +farm and merges their wake deficits. Both submodels are described in the +subsections below. + +The calculations in the *AWAE* module make use of wake volumes, which +are volumes formed by a (possibly curved) cylinder starting at a wake +plane and extending to the next adjacent wake plane along a line +connecting the centers of the two wake planes. If the adjacent wake +planes (top and bottom of the cylinder) are not parallel, e.g., for +transient simulations involving variations in nacelle-yaw angle, the +centerline will be curved instead of straight. +:numref:`FF:FFarmDomains` illustrates some of the +concepts that will be detailed in the subsections below. The +calculations in the *AWAE* module also require looping through all wind +data points, turbines, and wake planes; these loops have been sped up in +the parallel mode of FAST.Farm by implementation of OpenMP +parallelization. + +The *AWAE* module does not have states, reducing the module to a +feed-forward-only system whereby the module outputs are computed +directly from the module inputs (with direct feedthrough of input to +output). The *AWAE* module uses as input +:math:`\hat{x}_{n_p}^\text{Plane}`, :math:`\vec{p}_{n_p}^\text{Plane}`, +:math:`V_{x_{n_p}}^\text{Wake}\left(r\right)`, +:math:`V_{r_{n_p}}^\text{Wake}\left(r\right)`, and +:math:`D_{n_p}^\text{Wake}` (each for :math:`0\le n_p\le N_p-1`) as +computed by the wake-dynamics model for each individual wind turbine +(output by the *WD* module). The *AWAE* module computes output +:math:`\vec{V}_\text{Dist}^\text{High}` needed for the calculation of +OpenFAST for each individual wind turbine (input to the *OF* module) as +well as outputs for :math:`\vec{V}_{n_p}^\text{Plane}` for +:math:`0\le n_p\le N_p-1`, :math:`^\text{DiskAvg}V_x^\text{Wind}`, and +:math:`TI_\text{Amb}` needed for the calculation of wake dynamics for +each individual wind turbine (input to the *WD* module). + +.. _FF:AmbWind: + +Ambient Wind +^^^^^^^^^^^^ + +The ambient wind data used by FAST.Farm can be generated in one of two +ways. The use of the *InflowWind* module in +`OpenFAST `__ enables the use of +simple ambient wind, e.g., uniform wind, discrete wind events, or +synthetically generated turbulent wind data. Synthetically generated +turbulence can be from, e.g., +TurbSim or the Mann model, in which +the wind is propagated through the wind farm using Taylor’s +frozen-turbulence assumption. This method is most applicable to small +wind farms or a subset of wind turbines within a larger wind farm. +FAST.Farm can also use ambient wind generated by a high-fidelity +precursor LES simulation of the entire wind farm (without wind turbines +present), such as the ABLSolver preprocessor of +`SOWFA `__. This atmospheric precursor +simulation captures more physics than synthetic turbulence -- as +illustrated in :numref:`FF:ABLSolver` -- including atmospheric +stability, wind-farm-wide turbulent length scales, and complex terrain +effects. It is more computationally expensive than using the ambient +wind modeling options of *InflowWind*, but it is much less +computationally expensive than a `SOWFA `__ +simulation with multiple wind turbines present. + +FAST.Farm requires ambient wind to be available in two different +resolutions. Because wind will be spatially averaged across wake planes +within the *AWAE* module, FAST.Farm needs a low-resolution wind domain +(in both space and time) throughout the wind farm. The spatial +resolution of the low-resolution domain -- consisting of a structured 3D +grid of wind data points -- should be sufficient so that the spatial +averaging is accurate, e.g., on the order of tens of meters for +utility-scale wind turbines. The time step of the low-resolution domain +dictates that of the FAST.Farm driver (:math:`\Delta t`) and all +FAST.Farm modules. It should therefore be consistent with the timescales +of wake dynamics, e.g., on the order of seconds and smaller for higher +mean wind speeds. Note that OpenFAST is subcycled within the *OF* module +with a smaller time step. For accurate load calculation by OpenFAST, +FAST.Farm also needs high-resolution wind domains (in both space and +time) around each wind turbine and encompassing any turbine +displacement. The spatial and time resolution of each high-resolution +domain should be sufficient for accurate aerodynamic load calculations, +e.g., on the order of the blade chord length and fractions of a +second (:cite:`ff-Shaler19_1`). The high-resolution domains +overlap portions of the low-resolution domain. For simplicity of and to +minimize computational expense within FAST.Farm, the time step of the +high-resolution domain must be an integer divisor of the low-resolution +domain time step. + +When using ambient wind generated by a high-fidelity precursor +simulation, the *AWAE* module reads in the three-component wind-velocity +data across the high- and low-resolution +domains -- :math:`\vec{V}_\text{Amb}^\text{High}` for each turbine and +:math:`\vec{V}_\text{Amb}^\text{Low}`, respectively -- that were computed +by the high-fidelity solver within each time step. These values are +stored in files for use in a given driver time step. The wind data +files, including spatial discretizations, must be in VTK format and are +specified by users of FAST.Farm at initialization. When using the +*InflowWind* inflow option, the ambient wind across the high- and +low-resolution domains are computed by calling the *InflowWind* module. +In this case, the spatial discretizations of these domains are specified +directly within the FAST.Farm primary input file. These wind data from +the combined low- and high-resolution domains within a given driver time +step represent the largest memory requirement of FAST.Farm. + +After the ambient wind is processed at a given time step, the ambient +wind submodel computes as output the rotor-disk-averaged ambient wind +speed, normal to the disk,\ :math:`^\text{DiskAvg}V_x^\text{Wind}`, for +each turbine using Equation :eq:`eq:VxWind`. + +.. math:: + ^\text{DiskAvg}V_x^\text{Wind}=\left. \left( \left\{ \hat{x}_{n_p}^\text{Plane} \right\}^T\left\{ \frac{1}{N_{n_p}^\text{Polar}}\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}{\vec{V}_{\text{Amb}_{n^\text{Polar}}}^\text{Low}} \right\} \right) \right|_{n_p=0} + :label: eq:VxWind + +In Equation :eq:`eq:VxWind`, :math:`N_{n_p}^\text{Polar}` is the +number of points in a polar grid on wake plane :math:`n_p` of the given +wind turbine, :math:`n^\text{Polar}` is the point counter such that +:math:`1\le n^\text{Polar}\le N_{n_p}^\text{Polar}` for wake plane +:math:`n_p`, and the equation is evaluated for the wake plane at the +rotor disk (:math:`n_p=0`). The polar grid on wake plane :math:`n_p` has +a uniform radial and azimuthal discretization equal to the average +*X-Y-Z* spatial discretization of the low-resolution domain (independent +from the radial finite-difference grid used within the *WD* module) and +a diameter of :math:`C_\text{Meander}D_{n_p}^\text{Wake}`; +:math:`C_\text{Meander}` is discussed further in +:numref:`FF:WMerging` below. Subscript :math:`n^\text{Polar}` +is appended to :math:`\vec{V}_\text{Amb}^\text{Low}` in +Equation :eq:`eq:VxWind` to identify wind data that have been +trilinearly interpolated from the low-resolution domain to the polar +grid on the wake plane. Intuitively, Equation :eq:`eq:VxWind` +states that the rotor-disk-averaged ambient wind speed, normal to the +disk, for each turbine is calculated as the uniform spatial average of +the ambient wind velocity on the wake plane at the rotor disk projected +along the low-pass time-filtered rotor centerline. + +The ambient wind submodel of the *AWAE* module also calculates as output +the ambient turbulence intensity around each rotor, +:math:`TI_\text{Amb}`, using Equation :eq:`eq:TI`: + +.. math:: + TI_\text{Amb}=\left. \left( + \frac{\sqrt{\frac{1}{3N_{n_p}^\text{Polar}}\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}\left\| \vec{V}_{\text{Amb}_{n^\text{Polar}}}^\text{Low}- + \left\{ \frac{1}{N_{n_p}^\text{Polar}}\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}{\vec{V}_{\text{Amb}_{n^\text{Polar}}}^\text{Low}} \right\} \right\|_2^2}} + {\left\| \left\{ \frac{1}{N_{n_p}^\text{Polar}}\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}{\vec{V}_{\text{Amb}_{n^\text{Polar}}}^\text{Low}} \right\} \right\|_2} + \right) \right|_{n_p=0} + :label: eq:TI + +The bracketed term in Equation :eq:`eq:TI` is the same as in +Equation :eq:`eq:VxWind`, representing the uniform spatial +average of the ambient wind velocity on the wake plane at the rotor +disk. In contrast to the common definition of turbulence intensity used +in the wind industry, which consists of a time-averaged quantity of the +axial wind component, the turbulence intensity calculated in the ambient +wind submodel of the *AWAE* module is based on a uniform spatial average +of the three vector components. Not using time averaging ensures that +only ambient wind at the current time step needs to be processed, which +decreases memory requirements. Moreover, any time variation in the +spatial average is moderated by the low-pass time filter in the *WD* +module. Using spatial averaging and the three vector components allows +for atmospheric shear, wind veer, and other ambient wind characteristics +to influence the eddy viscosity and wake-deficit evolution in the *WD* +module. The incorporation of wake-added turbulence is left for future +work. Note that Equation :eq:`eq:TI` uses the eight wind data +points from the low-resolution domain surrounding each point in the +polar grid rather than interpolation. This is because calculating wind +data in the polar grid on the wake plane via trilinear interpolation +from the low-resolution domain would smooth out spatial variations and +artificially reduce the calculated turbulence intensity. + +.. _FF:WMerging: + +Wake Merging +^^^^^^^^^^^^ + +In previous implementations of DWM, the wind turbine and wake dynamics +were solved individually or serially, not considering two-way +wake-merging interactions. Additionally, there was no method available +to calculate the disturbed wind in zones of wake overlap. Wake merging +is illustrated by the `SOWFA `__ simulation +of :numref:`FF:WakeMerg`. In FAST.Farm, the wake-merging +submodel of the *AWAE* module identifies zones of wake overlap between +all wakes across the wind farm by finding wake volumes that overlap in +space. Wake deficits are superimposed in the axial direction based on +the RSS method (:cite:`ff-Katic86_1`); transverse components +(radial wake deficits) are superimposed by vector sum. In Katic̀ et +al. (:cite:`ff-Katic86_1`), the RSS method is applied to wakes +with axial deficits that are uniform across the wake diameter and radial +deficits are not considered. In contrast, the RSS method in FAST.Farm is +applied locally at a given wind data point. The RSS method assumes that +the local kinetic energy of the axial deficit in a merged wake equals +the sum of the local energies of the axial deficits for each wake at the +given wind data point. The RSS method only applies to an array of +scalars, which works well for axial deficits because overlapping wakes +likely have similar axial directions. This means, however, that only the +magnitude of the vector is important in the superposition. A vector sum +is applied to the transverse components (radial wake deficits) because +any given radial direction is dependent on the azimuth angle in the +axisymmetric coordinate system. + +The disturbed (ambient plus wakes) wind velocities across the high- and +low-resolution domains -- :math:`\vec{V}_\text{Dist}^\text{High}` for each +turbine and :math:`\vec{V}_\text{Dist}^\text{Low}`, respectively -- are +computed using Equations :eq:`eq:VDistHigh` +and :eq:`eq:VDistLow`, respectively. + +.. math:: + \begin{split} + & \vec{V}_\text{Dist}^\text{High}=\vec{V}_\text{Amb}^\text{High} \\ + & \quad \quad \,-\left\{ + \sqrt{\sum\limits_{n^\text{Wake}=1}^{N^\text{Wake}}{ + \begin{cases} + {{\left( \left\{ \bar{\hat{x}}^{Plane} \right\}^T + \left\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+ + V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane} \right\} \right)}^2} + & \textrm{for}~\left( n_{t_{n^\text{Wake}}}\ne n_t \right) \\ + \\ + 0 & \textrm{otherwise}\\ + \end{cases} + }} + \right\}\bar{\hat{x}}^\text{Plane} \\ + & \quad \quad \,+\sum\limits_{n^\text{Wake}=1}^{N^\text{Wake}}{ + \begin{cases} + \left[ I-\bar{\hat{x}}^\text{Plane}\left\{ \bar{\hat{x}}^\text{Plane} \right\}^T \right] + \left\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+ + V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane} \right\} + & \textrm{for}~\left( {n_{t_{n^\text{Wake}}}}\ne n_t \right) \\ + \\ + \vec{0} & \textrm{otherwise} \\ + \end{cases} + } \\ + \end{split} + :label: eq:VDistHigh + +.. math:: + \begin{split} + & \vec{V}_\text{Dist}^\text{Low}=\vec{V}_\text{Amb}^\text{Low} \\ + & \quad \quad \,-\left\{ + \sqrt{\sum\limits_{n^\text{Wake}=1}^{N^\text{Wake}}{ + {\left( {{\left\{ + \bar{\hat{x}}^\text{Plane} \right\}}^T} + \left\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+ + V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane} + \right\} + \right)}^2}} + \right\}\bar{\hat{x}}^\text{Plane} \\ + & \quad \quad +\sum\limits_{n^\text{Wake}=1}^{N^\text{Wake}} + \left[ I-\bar{\hat{x}}^\text{Plane}\left\{ \bar{\hat{x}}^\text{Plane} \right\}^T \right] + \left\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+ + V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane} + \right\} \\ + \end{split} + :label: eq:VDistLow + +Here, :math:`(n_{t_{n^\text{Wake}}}\ne n_t)` signifies that wake +:math:`n^\text{Wake}` is not associated with the given turbine +:math:`n_t`. The first, second, and third terms on the right-hand side +of Equations :eq:`eq:VDistHigh` and :eq:`eq:VDistLow` +represent the ambient wind velocity, the RSS superposition of the axial +wake-velocity deficits, and the vector sum of the transverse +wake-velocity deficits, respectively. Although many mathematical details +are outside the scope of this document, the nomenclature of +Equations :eq:`eq:VDistHigh` and :eq:`eq:VDistLow` is +as follows: + +- :math:`N^\text{Wake}` -- number of wake volumes overlapping a given wind + data point in the wind domain + +- :math:`n^\text{Wake}` -- wake counter such that + :math:`1\le n^\text{Wake}\le N^\text{Wake}` which, when used as a + subscript, is used to identify the specific point in a wake plane in + place of :math:`\left( r \right)` and subscript :math:`n_p` + +- :math:`V_{x_{n^\text{Wake}}}^\text{Wake}` -- axial wake-velocity deficit + associated with where the given wind data point lies within the + specific wake volume and corresponding wake plane + +- :math:`V_{r_{n^\text{Wake}}}^\text{Wake}` -- radial wake-velocity + deficit associated with where the given wind data point lies within + the specific wake volume and corresponding wake plane + +- :math:`\hat{x}_{n^\text{Wake}}^\text{Plane}` -- axial orientation + associated with where the given wind data point lies within the + specific wake volume and corresponding wake plane + +- :math:`\hat{r}_{n^\text{Wake}}^\text{Plane}` -- radial unit vector + associated with where the given wind data point lies within the + specific wake volume and corresponding wake plane + +- :math:`\overline{\hat{x}}^\text{Plane}` -- weighted-average axial + orientation associated with a given point in the wind spatial domain + +- :math:`\{ \overline{\hat{x}}^\text{Plane}\}^T` -- projects + :math:`\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane}\}` + along :math:`\hat{r}_{n^\text{Wake}}^\text{Plane}` + +- :math:`\left[I-\hat{x}_{n^\text{Wake}}^\text{Plane}\{ \overline{\hat{x}}^\text{Plane}\}^T\right]` -- calculates + the transverse component of + :math:`\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane}\}` + normal to :math:`\overline{\hat{x}}^\text{Plane}`. + +Wake volumes are found by looping through all points, turbines, and wake +planes and spatially determining if the given point resides in a wake +volume that has a diameter equal to the radial extent of the wake +planes. Wake volume :math:`n_p` (for :math:`0\le n_p\le N_p-2`) starts +at wake plane :math:`n_p` and extends to wake plane :math:`n_p+1`. Wake +volumes have a centerline determined by +:math:`\vec{p}_{n_p}^\text{Plane}`, :math:`\hat{x}_{n_p}^\text{Plane}`, +:math:`\vec{p}_{n_p+1}^\text{Plane}`, and +:math:`\hat{x}_{n_p+1}^\text{Plane}` -- this centerline is curved if +:math:`\hat{x}_{n_p}^\text{Plane}` and +:math:`\hat{x}_{n_p+1}^\text{Plane}` are not parallel. The calculations +of :math:`V_{x_{n^\text{Wake}}}^\text{Wake}` and +:math:`V_{r_{n^\text{Wake}}}^\text{Wake}` involve bilinear interpolation +of the wake deficits in the axial and radial directions. The axial +interpolation is complicated when the adjacent wake planes are not +parallel. The vector quantity +:math:`\{ V_{x_{n^\text{Wake}}}^\text{Wake}\hat{x}_{n^\text{Wake}}^\text{Plane}+V_{r_{n^\text{Wake}}}^\text{Wake}\hat{r}_{n^\text{Wake}}^\text{Plane}\}` +represents the total wake-velocity deficit associated with where the +given wind data point lies within the specific wake volume and +corresponding wake plane. Because each wake plane may have a unique +orientation, what constitutes “axial” and “radial” in the superposition +at a given wind data point is determined by weighted-averaging the +orientations of each wake volume overlapping that point (weighted by the +magnitude of each axial wake deficit). A similar equation is used to +calculate the distributed wind velocities across the high-resolution +domain (:math:`\vec{V}_\text{Dist}^\text{High}`) for each turbine, which +is needed to calculate the disturbed wind inflow to a turbine. Note that +for the high-resolution domain, a turbine is prevented from interacting +with its own wake. + +Once the distributed wind velocities across the low-resolution domain +have been found, the wake merging submodel of the *AWAE* module computes +as output the advection, deflection, and meandering velocity of each +wake plane, :math:`\vec{V}_{n_p}^\text{Plane}` for +:math:`0\le n_p\le N_p-1`, for each turbine as the weighted spatial +average of the disturbed wind velocity across the wake plane, using +Equation :eq:`eq:VnpPlane`. + +.. math:: + \vec{V}_{n_p}^\text{Plane}= + \frac{\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}w_{n^\text{Polar}}\vec{V}_{\text{Dist}_{n^\text{Polar}}}^\text{Low}} + {\sum\limits_{n^\text{Polar}=1}^{N_{n_p}^\text{Polar}}{w_{n^\text{Polar}}}} + :label: eq:VnpPlane + +The polar grid on wake plane :math:`n_p` has a uniform radial and +azimuthal discretization equal to the average *X-Y-Z* spatial +discretization of the low-resolution domain (independent from the radial +finite-difference grid used within the *WD* module) and a local diameter +described below. Subscript :math:`n^\text{Polar}` is appended to +:math:`\vec{V}_\text{Dist}^\text{Low}` in +Equation :eq:`eq:VnpPlane` to identify wind data that have been +trilinearly interpolated from the low-resolution domain to the polar +grid on the wake plane. Unlike Equation :eq:`eq:VxWind`, +Equation :eq:`eq:VnpPlane` includes a spatial weighting factor, +:math:`w_{n^\text{Polar}}`, dependent on the radial distance of point +:math:`n^\text{Polar}` from the center of the wake plane (discussed +below). FAST.Farm will issue a warning if the center of any wake plane +has left the boundaries of the low-resolution domain and set the +meandering velocity of each wake plane, +:math:`\vec{V}_{n_p}^\text{Plane}`, to zero for any wake plane that has +entirely left the boundaries of the low-resolution domain. +Qualitatively, Equation :eq:`eq:VnpPlane` states that the +advection, deflection, and meandering velocity of each wake plane for +each turbine is calculated as the weighted spatial average of the +disturbed wind velocity on the wake plane. Larsen et +al. (:cite:`ff-Larsen08_1`) proposed a uniform spatial average +where all points within a circle of diameter +:math:`2D_{n_p}^\text{Wake}` are given equal weight. However, the +Fourier transform of the circular function in a polar spatial domain +results in a *jinc* function in the polar wave-number domain, [11]_ +implying a gentle roll-off of energy below the cutoff wave number and +pockets of energy at distinct wave numbers above the cutoff wave number. +Experience with FAST.Farm development has shown that this approach +results in less overall wake meandering and at improper frequencies. As +such, three weighted spatial averaging methods have been implemented in +FAST.Farm, as defined in Equation :eq:`eq:wn`. + +.. math:: + w_{n^\text{Polar}}= + \begin{cases} + 1 & \textrm{for}~\textit{method 1-uniform}\\ + \\ + jinc\left( \frac{r_{n^\text{Polar}}}{C_\text{Meander}D^\text{Wake}} \right) + & \textrm{for}~\textit{method 2-truncated jinc}\\ + \\ + jinc\left( \frac{r_{n^\text{Polar}}}{C_\text{Meander}D^\text{Wake}} \right)jinc\left( \frac{r_{n^\text{Polar}}}{2C_\text{Meander}D^\text{Wake}} \right) + & \textrm{for}~\textit{method 3-windowed jinc}\\ + \end{cases} + :label: eq:wn + +The first method is a spatial average with a uniform weighting with a +local polar-grid diameter of :math:`C_\text{Meander}D_{n_p}^\text{Wake}` +at wake plane :math:`n_p`, resulting in a cutoff wave number of +:math:`\frac{1}{C_\text{Meander}D^\text{Wake}}`. The second and third +methods weight each point in the spatial average by a form of the *jinc* +function dependent on the radius of the point from the wake centerline, +:math:`r_{n^\text{Polar}}`, normalized by +:math:`C_\text{Meander}D^\text{Wake}`. This results in a more ideal +low-pass filter with a sharper cutoff of energy in the polar wave-number +domain with a cutoff wave number of +:math:`\frac{1}{C_\text{Meander}D^\text{Wake}}`. However, because the +*jinc* function decays slowly with increasing argument, the *jinc* +function must be windowed to be applied in practice. The second method +truncates the *jinc* function at its first zero crossing, corresponding +to a local polar-grid diameter of +:math:`1.21967C_\text{Meander}D_{n_p}^\text{Wake}` at wake plane +:math:`n_p`. The third method windows the *jinc* function by multiplying +it with a *jinc* function of half the argument (the polar-domain +equivalent of a one-dimensional Lanczos/sinc window), which tapers the +weighting to zero at its second zero crossing (the weighting is positive +below the first zero crossing and negative past the first zero crossing +until it tapers to zero). This corresponds to a local polar-grid +diameter of :math:`2.23313C_\text{Meander}D_{n_p}^\text{Wake}` at wake +plane :math:`n_p`. These weighted spatial averaging methods improve the +overall level and frequency content of the wake meandering at the +expense of a bit heavier computations due to the larger polar-grid +diameters (i.e., the truncated *jinc* method has roughly :math:`50\%` +more points within the polar grid than the uniform method, and the +windowed *jinc* method has roughly five times more points than the +uniform method). A value of :math:`C_\text{Meander}=2`, resulting in a +polar-grid diameter of :math:`2D^\text{Wake}` and cutoff wave number of +:math:`\frac{1}{2D^\text{Wake}}`, follows the characteristic dimension +important to transverse wake meandering proposed by Larsen et +al. (:cite:`ff-Larsen08_1`) :math:`C_\text{Meander}` is +included in all methods to enable the user of FAST.Farm to better match +the meandering to known solutions. Note that the lower the value of +:math:`C_\text{Meander}`, the more the wake will meander. + +.. [1] + :math:`x^d` and :math:`X^d` are identical to what is described + in :cite:`ff-Jonkman13_1`. :math:`u^d`, :math:`y^d`, and + :math:`Y^d` are identical to :math:`u`, :math:`y`, and :math:`Y` + from :cite:`ff-Jonkman13_1`, but are only evaluated in + discrete time, :math:`t=n\Delta t`, and so, are marked here with + superscript :math:`^d`. + +.. [2] + Not all of these possible parallel tasks have been implemented within + FAST.Farm because profiling did not show adequate computational + speedup. However, to minimize the computational expense of the output + calculation of the *AWAE* module, the ambient wind data files are + read in parallel to the state updates of the *SC*, *OF*, and *WD* + modules. See the introduction to :numref:`FF:TheoryBasis` for + more information. + +.. [3] + The *SC* module also has as input a placeholder for future global + (e.g., wind) measurements (output from the *AWAE* module) in addition + to commands or measurements from the individual turbine controllers. + But the global inputs are currently null. + +.. [4] + Derived using the Line2-to-Line2 mesh-mapping algorithm of + FAST (:cite:`ff-Sprague14_1,ff-Sprague15_1`) to transfer the + aerodynamic applied loads distributed per unit length along the + deflected/curved blade as calculated within FAST. + +.. [5] + Variations in the rotor diameter, :math:`D^\text{Rotor}`, are + possible as a result of blade deflection. These variations are likely + small, but this variable is treated the same as other inputs for + consistency. + +.. [6] + The absolute value is added because, as far as wake evolution is + concerned, if a wake plane travels opposite of its original + propagation direction (e.g., due to a localized wind gust), the total + downwind distance traveled is used rather than the instantaneous + downwind distance from the rotor. + +.. [7] + A value of :math:`C_\text{NearWake}=2` is expected from first + principles, but can be calibrated by the user of FAST.Farm to better + match the far wake to known solutions. + +.. [8] + The incremental mass flow is given by: + + .. math:: d\dot{m} = 2\pi r dr \rho\ ^\text{FiltDiskAvg}V^\text{Rel}_x (1-a(r)) = 2\pi r^\text{Plane} dr^\text{Plane} \rho\ ^\text{FiltDiskAvg}V^\text{Rel}_x (1-C_\text{NearWake} a(r)) + + Following from this, + :math:`r^\text{Plane} dr^\text{Plane} = \frac{1-a\left( r\right)}{1-C_\text{NearWake} a\left( r\right)}r dr`, + which can then be integrated along the radius. + +.. [9] + Subscript :math:`n_r` has been used here in place of + :math:`\left( r\right)` + +.. [10] + Note that the radial wake-velocity deficit at the centerline of the + axisymmetric coordinate system (:math:`n_r=0`) is always zero + (:math:`V_{r_{n_p}}^\text{Wake}\left( r \right)|_{r=0}=0)`. + +.. [11] + In this context, the *jinc* function is defined as + :math:`jinc(r)=\frac{J_1(2\pi r)}{r}` (with the limiting value at the + origin of :math:`jinc(0) = \pi)`, where :math:`J_1(r)` is the Bessel + function of the first kind and order one. The *jinc* function is + normalized such that + :math:`\int\limits_{0}^{\infty }{jinc\left( r \right)2\pi rdr}=1`. + The *jinc* function is the polar-equivalent of the one-dimensional + sinc function defined as + :math:`\text{sinc} \left( x \right)=\frac{\sin \left( \pi x \right)}{\pi x}` + (with the limiting value at the origin of :math:`\text{sinc}(0)=1`, + which is the Fourier transform of a rectangular function, i.e., an + ideal low-pass filter, and normalized such that + :math:`\int\limits_{-\infty }^{\infty }{\text{sinc}\left( x \right)dx}=1`. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/source/user/fast.farm/FutureWork.rst b/docs/source/user/fast.farm/FutureWork.rst new file mode 100644 index 0000000000..a10e05534a --- /dev/null +++ b/docs/source/user/fast.farm/FutureWork.rst @@ -0,0 +1,119 @@ +.. _FF:FutureWork: + +Future Work +=========== + +This list contains features that could be implemented in future +releases: + +- Develop more efficient methods of generating/processing ambient wind + from a high-fidelity precursor simulation, including: + + - Propagate 2D planes of ambient wind data using Taylor’s frozen + turbulence hypothesis as an alternative to 3D volumes + + - Allow for nonuniform grids in Turbsim + + - Use Dynamic Mode Decomposition to compress the file size of the + low-resolution domains + + - Implement Gabor mode enrichment to replace the high-resolution + domains + + - Develop a more efficient ABLSolver based on a simple rectangular + (rather than a generally unstructured) grid. + +- Improve the eddy-viscosity formulation with additional physics. + +- Pursue additional wake-modeling approaches, including: + + - Introduce simpler wake-deficit models, e.g., the Gaussian wake + model by Bastankhah and Porté-Agel and the super-Gaussian model by + Blondel and Cathelain + + - Introduce simpler wake-deflection models, e.g., the model by + Jiménez or the model by Qian and Ishihara + + - Apply a free-vortex method for the near wake + + - Incorporate a kidney-shaped wake under skewed-flow conditions, + e.g., by incorporating opposing vortices from the skew-induced + horseshoe vortex + + - Deform the base-wake deficit (introduce asymmetry) as a result of + background turbulence (in addition to wake meandering) + + - Incorporate wake-added turbulence + + - Improve the treatment of complex terrain (beyond specifying + ambient wind data as NaN in VTK format) + + - Include wakes from the nacelle and support structure + + - Reflect wakes off of the ground. + +- Address deep-array effects for large wind farms and account for flow + speedup around the edges of the wind farm – i.e., account for the + wind-farm blockage effect – e.g., by mimicking the wind farm-induced + boundary layer with surface roughness in the LES ambient wind + precursor. + +- Implement a model to mimic the measurements taken from a LIDAR and + other remote sensing technologies. + +- Incorporate MPI to support the modeling of large wind farms by taking + advantage of memory parallelization and parallelization between nodes + of an HPC. + +- Allow for a more general module form, e.g.: + + - Support continuous states + + - Support direct feedthrough of input to output + + - Support full-system linearization. + +- Support an interface to Simulink for super and individual wind + turbine controllers. + +- Implement checkpoint-restart capability. + +- Enable binary wind data input and output formats and binary + time-series results output format. + +- Add ability to output disturbed wind in VTK format on 2D slices that + need not be parallel to the *X-Y, Y-Z* and/or *X-Z* planes of the + global inertial-frame coordinate system. + +- Rename the ambient wind data input files in VTK format following the + naming convention used for the FAST.Farm-generated visualization + output files in VTK format (with leading zeros and without the *t*). + +- Support super controller-, inflow-, and wake-related output channels + for more than the first 9 wind turbines in the wind farm. + +- Interface FAST.Farm to the Wind-Plant Integrated System Design & + Engineering Model + (`WISDEM `__\ :math:`^\text{TM}`) for + systems-engineering applications (multidisciplinary design, analysis, + and optimization; uncertainty quantification; and so on). + +- Develop a wrapper for stand-alone + AeroDyn – the aerodynamics module + of OpenFAST (or an equivalent BEM tool) – as an alternative to + OpenFAST to support advanced performance-only wind-farm analysis that + is much more computationally efficient than FAST.Farm analysis using + OpenFAST. + +- Address unique offshore wind energy challenges, e.g.: + + - Ensure consistent waves across an offshore wind farm + + - Support the air-water interface + + - Consider shared mooring and anchoring arrangements (for floating + offshore wind farms). + +- Adopt the capability to support undersea marine turbine arrays (which + may require supporting direct feedthrough of input to output to + handle the added-mass effects). diff --git a/docs/source/user/fast.farm/InputFiles.rst b/docs/source/user/fast.farm/InputFiles.rst new file mode 100644 index 0000000000..8b353e282d --- /dev/null +++ b/docs/source/user/fast.farm/InputFiles.rst @@ -0,0 +1,915 @@ +.. _FF:Input: + +Input Files +=========== + +The primary FAST.Farm input file defines ambient wind, the wind turbine +layout within the wind farm, the wake axisymmetric finite-difference +grid, calibrated parameters for wake dynamics, visualization output, +output file specifications, and auxiliary parameters. Ambient wind data +optionally generated from the high-fidelity precursor atmospheric +simulation are stored in separate files referenced in the primary +FAST.Farm input file. Properties for each wind turbine in the wind farm +are stored in the standard OpenFAST input files, referenced by their +primary OpenFAST input file (one for each wind turbine) in the primary +FAST.Farm input file. + +No lines should be added or removed from the input files, except in +tables where the number of rows is specified. + +Units +----- + +FAST.Farm uses the SI system (kg, m, s, N). + +.. _FF:sec:FFarminputfile: + +FAST.Farm Primary Input File +---------------------------- + +The FAST.Farm primary input file is organized into several functional +sections: + +- Simulation Control + +- Super Controller + +- Ambient Wind + +- Wind Turbines + +- Wake Dynamics + +- Visualization + +- Output. + +Each section corresponds to an aspect of the FAST.Farm model -- see the +subsections below. A sample FAST.Farm primary input file is given in +:numref:`FF:APP:Input`. Where there is a one-to-one equivalency between an input +parameter and a variable in the FAST.Farm theory documented in +:numref:`FF:Theory`, the variable in +:numref:`FF:Theory` is shown in parentheses after the input +parameter in the subsections below. + +The input file begins with two lines of header information that is for +your use, but is not used by the software. + +Simulation Control +~~~~~~~~~~~~~~~~~~ + +**Echo** [flag] specifies if you wish to have FAST.Farm echo the +contents of the FAST.Farm primary input file (useful for debugging +errors in the input file). If **Echo** = TRUE, an echo file will be +generated. The echo file has the naming convention of +<*RootName*>\ *.ech*, where <*RootName*> is the name of the FAST.Farm +primary input file, excluding its file extension. + +**AbortLevel** [quoted string] indicating what error level should cause +an abort. Options are: “WARNING,” “SEVERE,” or “FATAL.” **AbortLevel** +in FAST.Farm is used the same way as the level set in stand-alone +OpenFAST, but the **AbortLevel** set in FAST.Farm will override the +levels set in the OpenFAST primary input file of each wind turbine in +the wind farm. Setting FAST.Farm to abort on fatal errors is typical, +but see the FAST v8 ReadMe document for additional guidance. + +**TMax** [sec] is the total length of the simulation to be run. The +first output is calculated at :math:`t=0`; the last output is calculated +at :math:`t` = **TMax**. The **TMax** set in FAST.Farm will override the +simulation length set in the OpenFAST primary input file of each wind +turbine in the wind farm. + +**UseSC** [flag] indicates if the wind-farm-wide super controller is to +be used. If **UseSC** = TRUE, the super controller will be called. If +**UseSC** = FALSE, the super controller will not be called, but each +wind turbine may still have an individual controller specified in the +OpenFAST module *ServoDyn*. + +**Mod_AmbWind** [switch] indicates the ambient wind source. There are +three options: 1) use ambient wind data generated by a high-fidelity +precursor simulation in VTK format **[Mod_AmbWind=1]**, 2) use ambient +wind data as defined by the FAST.Farm interface to the *InflowWind* +module, with one instance of *InflowWind* **[Mod_AmbWind=2]**, or 3) use +ambient wind data as defined by the FAST.Farm interface to the +*InflowWind* module, with multiple instances of *InflowWind* +**[Mod_AmbWind=3]**. The distinct Ambient Wind subsections below pertain +to each option. + +Super Controller +~~~~~~~~~~~~~~~~ + +**SC_FileName** [quoted string] sets the name and location of the +dynamic library containing the super controller code. It is only used +when **UseSC** = TRUE. The dynamic library should be compiled as a +*.dll* file in Windows or a *.so* file in Linux or Mac OS. **The file +name must be in quotations** and can contain an absolute or a relative +path. The super controller is used in conjunction with individual wind +turbine controllers defined in the style of the DISCON dynamic library +of the DNV GL’s Bladed wind turbine software package, with minor +modification. See :numref:`FF:sec:SupCon` for more information. + +.. _FF:Input:VTK: + +Ambient Wind: Precursor in Visualization Toolkit Format +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The input parameters in this section are only used when **Mod_AmbWind** += 1, indicating the use of ambient wind generated by a high-fidelity +precursor simulation. In this case, the ambient wind, including their +spatial discretization, must be stored in VTK format -- as described in +:numref:`FF:AmbWindVTK` -- and is used directly without modification +by FAST.Farm. + +**DT_Low-VTK** [sec] (:math:`t`) sets the time step of the +low-resolution ambient wind data files and calculation, as well as the +global (driver/glue-code) time step of FAST.Farm. **DT_Low-VTK** is the +same as **DT_Low** in this documentation. The modules of FAST.Farm are +called every **DT_Low** seconds, although OpenFAST and its modules may +use a time step that is an integer multiple smaller than or equal to +**DT_Low**. + +**DT_High-VTK** [sec] sets the time step of the high-resolution ambient +wind data files and calculation and **must be an integer multiple +smaller than or equal to DT_Low**. **DT_High-VTK** is the same as +**DT_High** in this documentation. It is essential that **DT_Low** and +**DT_High** are small enough to ensure solution accuracy and match the +time resolution used when generating the ambient wind data from the +high-fidelity precursor simulation. **DT_Low** should be consistent with +the timescales of wake dynamics, e.g., on the order of seconds and +smaller for higher mean wind speeds. **DT_High** should be sufficient +for accurate aerodynamic load calculations, e.g., on the order of +fractions of a second. Further guidance on choosing appropriate time +steps is given in :numref:`FF:ModGuidance`. + +**WindFilePath** [quoted string] specifies the path to the directory +where the low- and high-resolution ambient wind data files are stored. +The path can be specified relative to the location of the FAST.Farm +primary input file or with an absolute path. It is recommended to use +quotes around the path. If there are spaces in the file or path names, +these quotes are required. **FAST.Farm requires that the ambient wind +data files be stored in specific subdirectories of the directory +specified by WindFilePath and with specific filenames.** The +low-resolution ambient wind data files must be named +*Amb.t.vtk* and stored in a subdirectory named +*Low*. In the file names, ** is an integer +(without leading zeros) between *0* (at :math:`t=0`) and *N-1*, where +:math:`N=FLOOR\left( \frac{TMax}{DT_\text{Low}} \right)+1` is the number +of low-resolution time steps. The high-resolution ambient wind data +files must be named *Amb.t.vtk*, where +** is an integer (without leading zeros) +between 0 (at :math:`t=0`) and +:math:`\frac{DT_\text{Low}}{DT\_High}\left( N-1 \right)`. The files must +be stored in a subdirectory named *HighT*, where +** is an integer (without leading zeros) between 1 and +the total number of wind turbines (**NumTurbines**). Subdirectory +*HighT* must contain the high-resolution ambient wind +data corresponding to wind turbine **, specified in the +Wind Turbines section of the FAST.Farm primary input file -- see +:numref:`FF:Input:WT`. The VTK format of each ambient wind data +file -- for both the low-resolution and high-resolution domains -- is +identical, as described in :numref:`FF:AmbWindVTK`. + +**ChkWndFiles** [flag] specifies if FAST.Farm should check the ambient +wind data files for consistency before running the simulation +(preventing a possible crash later). As this check is time intensive, it +is recommended that **ChkWndFiles** be set to FALSE (to disable the +check) if the ambient wind data have previously been checked, such as in +a prior simulation. If set to TRUE, FAST.Farm will check to ensure that: + +- The number of low-resolution ambient wind data files is sufficient to + run the entire simulation (up to :math:`t =`\ **TMax**). If more + files are in the subdirectory, only the first *N* will be used. + +- The number of high-resolution ambient wind data files is sufficient + to run the entire simulation (up to :math:`t =`\ **TMax**) for all + wind turbines. If there are more subdirectories, only the first + **NumTurbines** will be used. If more files are in each subdirectory, + only the first + :math:`\frac{DT_\text{Low}}{DT\_High}\left( N-1 \right)+1` will be + used. + +- The spatial resolution (number of grid points, origin, and spacing) + of each low-resolution ambient wind data file is the same. + +- The spatial resolution (number of grid points, origin, and spacing) + of each high-resolution ambient wind data file is the same for a + given wind turbine. + +- The number of grid points in each high-resolution domain is the same + for all wind turbines in the wind farm. + +Ambient Wind: InflowWind Module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The input parameters in this section are only used when **Mod_AmbWind** += 2 or 3, indicating the use of ambient wind through one or multiple +instances of the *InflowWInd* module. In this case, the ambient wind +specified within *InflowWInd* is interpolated to the low- and +high-resolution domains for use within FAST.Farm. + +**DT_Low** [sec] (:math:`\Delta t`) sets the time step of the +low-resolution ambient wind calculation, as well as the global +(driver/glue-code) time step of FAST.Farm. The modules of FAST.Farm are +called every **DT_Low** seconds, although OpenFAST and its modules may +choose to use a time step that is an integer multiple smaller than or +equal to **DT_Low**. + +**DT_High** [sec] sets the time step of the high-resolution ambient wind +data calculation and must be an integer multiple smaller than or equal +to **DT_Low**. It is essential that **DT_Low** and **DT_High** are small +enough to ensure solution accuracy. **DT_Low** should be consistent with +the timescales of wake dynamics, e.g., on the order of seconds and +smaller for higher mean wind speeds. **DT_High** should be sufficient +for accurate aerodynamic load calculations, e.g., on the order of +fractions of a second. Further guidance on choosing appropriate time +steps is given in :numref:`FF:ModGuidance`. + +The next nine input parameters set the spatial discretization of the +low-resolution ambient wind domain. The low-resolution domain is stored +as a structured 3D grid of wind data points (representing the corners of +3D cells) in the global *X-Y-Z* inertial-frame coordinate system, as +illustrated generically in :numref:`FF:StrucDomains`. + +.. figure:: Pictures/StrucDomains.png + :alt: Structured 3D grid for the low- or high-resolution domains. + :name: FF:StrucDomains + :width: 100% + :align: center + + Structured 3D grid for the low- or high-resolution domains. + +**NX_Low**, **NY_Low**, and **NZ_Low** [integer] set the number of wind +data points in each direction. + +**X0_Low**, **Y0_Low**, and **Z0_Low** [m] set the origin of the grid +(lowest-most *X-Y-Z* coordinate). + +**dX_Low**, **dY_Low**, and **dZ_Low** [m] set the spatial +discretization in each direction. + +The total low-resolution domain size has dimensions +(**NX_Low**-1)\ **dX_Low** :math:`\times` (**NY_Low**-1)\ **dY_Low** +:math:`\times` (**NZ_Low**-1)\ **dZ_Low**. The low-resolution domain +should extend throughout the wind farm wherever turbines and wakes may +potentially reside with a resolution sufficient so that the spatial +averaging is accurate, e.g., on the order of tens of meters for +utility-scale wind turbines. Further guidance on choosing appropriate +spatial discretization is given in +:numref:`FF:ModGuidance`. + +Like the low-resolution domain, each high-resolution domain is stored as +a structured 3D grid of wind data points in the global *X-Y-Z* +inertial-frame coordinate system -- as illustrated generically in +:numref:`FF:StrucDomains`. + +**NX_High**, **NY_High**, and **NZ_High** [integer] set the number of +wind data points in each direction. These values are the same for each +wind turbine and so only need to be set once. + +The origin and spatial discretization for the high-resolution wind +domain for each turbine are specified in the Wind Turbines section of +the FAST.Farm primary input file below. + +**InflowFile** [quoted string] specifies the name of the primary input +file for the *InflowWind* module, which can be specified relative to the +location of the FAST.Farm primary input file or specified with an +absolute path. It is recommended to use quotes around the file name. If +there are spaces in the file or path names, these quotes are required. +See :numref:`FF:AmbWindIfW` for information on the contents of +this file. + +.. _FF:Input:WT: + +Wind Turbines +~~~~~~~~~~~~~ + +**NumTurbines** [integer] (:math:`N_t`) is the number of wind turbines +in the wind farm and determines the number of rows in the subsequent +table (after two table header lines). + +For each wind turbine: + +- **WT_X**, **WT_Y**, and **WT_Z** [m] specify the origin in the global + *X-Y-Z* inertial-frame coordinate system. The origin is defined as + the intersection of the undeflected tower centerline and the ground + or, for offshore systems, mean sea level. + +- **WT_FASTInFile** [quoted string] specifies the name of the OpenFAST + primary input file associated with each turbine. Each wind turbine is + numbered within FAST.Farm as an integer (:math:`n_t`) between 1 and + **NumTurbines** corresponding to the row in the table. The OpenFAST + primary input file name can be specified relative to the location of + the FAST.Farm primary input file or with an absolute path. It is + recommended to use quotes around the file name. Identical wind + turbines can use the same OpenFAST primary input file, except if the + corresponding OpenFAST model makes use of a Bladed-style controller + in DLL format or, for offshore wind turbines, if different wave + conditions are required for each turbine. If a Bladed-style DLL + controller is being used, distinct Bladed-style controller DLLs must + be used (each with a unique name). This requires the need for + distinct *ServoDyn* primary input files, referencing the appropriate + DLL name, and distinct OpenFAST primary input files, each referencing + the appropriate *ServoDyn* primary input file name. If different wave + conditions are required for each turbine, the distinct wave + conditions (e.g., based on unique random wave seeds) for each wind + turbine must be set in the *HydroDyn* primary input file and distinct + OpenFAST primary input files must be used, each referencing the + appropriate *HydroDyn* primary input file name. See + :numref:`FF:Input:OFInput` for information on the contents of + the OpenFAST input files. + +- When **Mod_AmbWind** = 2 or 3, the Wind Turbines table has six + additional columns to complete the spatial discretization of the + high-resolution wind domain for each wind turbine: + + - **X0_High**, **Y0_High**, and **Z0_High** [m] set the origin of + the grid. + + - **dX_High**, **dY_High**, **dZ_High** [m] set spatial + discretization in each direction. + +The total high-resolution domain size has dimensions +(**NX_High**-1)\ **dX_High** :math:`\times` (**NY_High**-1)\ **dY_High** +:math:`\times` (**NZ_High**-1)\ **dZ_High**. Each high-resolution domain +must extend around the corresponding wind turbine, encompassing any +turbine displacement. The domains should have a resolution sufficient +for accurate aerodynamic load calculations, e.g., on the order of the +blade chord length. The high-resolution domains will occupy the same +space as portions of the low-resolution domain, requiring domains +overlap. + +Wake Dynamics +~~~~~~~~~~~~~ + +With FAST.Farm, each wake plane is treated as a radial finite-difference +grid, as shown in :numref:`FF:RadialFD`. + +.. figure:: Pictures/RadialFD.png + :alt: Radial finite-difference grid. For clarity of the illustration, the number and size of the wake planes are shown smaller than they should be. + :name: FF:RadialFD + :width: 100% + :align: center + + Radial finite-difference grid. For clarity of the illustration, the + number and size of the wake planes are shown smaller than they should + be. + +These planes are defined by the following parameters: + +- **dr** [m] sets the radial increment. To ensure the wake deficits are + accurately computed by FAST.Farm, **dr** should be set so that + FAST.Farm sufficiently resolves the wake deficit within each plane. + +- **NumRadii** [integer] (:math:`N_r`) sets the number of radii. To + ensure the wake deficits are accurately computed by FAST.Farm, + **NumRadii** should be set so that the diameter of each wake plane, + 2(**NumRadii**-1)\ **dr**, is large relative to the rotor diameter. + +- **NumPlanes** [integer] (:math:`N_p`) sets the number of wake planes. + To ensure the wake deficits are accurately captured by FAST.Farm, + **NumPlanes** should be set so that the wake planes propagate a + sufficient distance downstream, preferably until the wake deficit + decays away. + +The next :math:`20` inputs are user-specified calibration parameters and +options that influence the wake-dynamics calculations. The parameters +may depend, e.g., on turbine operation or atmospheric conditions that +can be calibrated to better match experimental data or by using an HFM +benchmark. Default values have been derived for each calibrated +parameter based on `SOWFA `__ simulations +( :cite:`ff-Doubrawa18_1`), but these can be overwritten by the +user. + +**f_c** [Hz] (:math:`f_c`) is the cutoff (corner) frequency of the +low-pass time filter for the wake advection, deflection, and meandering +model and must be greater than zero. If the DEFAULT keyword is specified +in place of a numerical value, **f_c** is set to :math:`0.0007`. + +**C_HWkDfl_O** [m] (:math:`C_{HWkDfl}^{O}`) is the calibrated parameter +for the wake deflection correction defining the horizontal offset at the +rotor. If the DEFAULT keyword is specified in place of a numerical +value, **C_HWkDfl_O** is set to :math:`0.0`. + +**C_HWkDfl_OY** [m/deg] (:math:`C_{HWkDfl}^{OY}`) is the calibrated +parameter for the wake deflection correction defining the horizontal +offset at the rotor scaled with yaw error. If the DEFAULT keyword is +specified in place of a numerical value, **C_HWkDfl_OY** is set to +:math:`0.3`. + +**C_HWkDfl_x** [-] (:math:`C_{HWkDfl}^{x}`) is the calibrated parameter +for the wake deflection correction defining the horizontal offset scaled +with downstream distance. If the DEFAULT keyword is specified in place +of a numerical value, **C_HWkDfl_x** is set to :math:`0.0`. + +**C_HWkDfl_xY** [1/deg] (:math:`C_{HWkDfl}^{xY}`) is the calibrated +parameter for the wake deflection correction defining the horizontal +offset scaled with downstream distance and yaw error. If the DEFAULT +keyword is specified in place of a numerical value, **C_HWkDfl_xY** is +set to :math:`-0.004`. + +**C_NearWake** (:math:`C_{NearWake}`) [-] is the calibrated parameter +for the near-wake correction and must be greater than one. If the +DEFAULT keyword is specified in place of a numerical value, +**C_NearWake** is set to :math:`1.8`. + +**k_vAmb** [-] (:math:`k_{\nu Amb}`) is the calibrated parameter for the +ambient turbulence influence in the eddy viscosity and must be greater +than zero. If the DEFAULT keyword is specified in place of a numerical +value, **k_vAmb** is set to :math:`0.05`. + +**k_vShr** [-] (:math:`k_{\nu Shr}`) is the calibrated parameter for the +wake shear layer influence in the eddy viscosity and must be greater +than zero. If the DEFAULT keyword is specified in place of a numerical +value, **k_vShr** is set to :math:`0.016`. + +**C_vAmb_DMin** [-] (:math:`C_{\nu Amb}^{DMin}`) is a calibrated +parameter in the eddy viscosity filter function for ambient turbulence. +It defines the transitional diameter fraction between the minimum and +exponential regions and must be greater than or equal to zero. If the +DEFAULT keyword is specified in place of a numerical value, +**C_vAmb_DMin** is set to :math:`0.0`. + +**C_vAmb_DMax** [-] (:math:`C_{\nu Amb}^{DMax}`) is a calibrated +parameter in the eddy viscosity filter function for ambient turbulence. +It defines the transitional diameter fraction between the exponential +and maximum regions and must be greater than **C_vAmb_DMin**. If the +DEFAULT keyword is specified in place of a numerical value, +**C_vAmb_DMax** is set to :math:`1.0`. + +**C_vAmb_FMin** [-] (:math:`C_{\nu Amb}^{FMin}`) is a calibrated +parameter in the eddy viscosity filter function for ambient turbulence. +It defines the value in the minimum region and must be between zero and +one (inclusive). If the DEFAULT keyword is specified in place of a +numerical value, **C_vAmb_FMin** is set to :math:`1.0`. + +**C_vAmb_Exp** [-] (:math:`C_{\nu Amb}^{Exp}`) is a calibrated parameter +in the eddy viscosity filter function for ambient turbulence. It defines +the exponent in the exponential region and must be greater than zero. If +the DEFAULT keyword is specified in place of a numerical value, +**C_vAmb_Exp** is set to :math:`0.01`. + +**C_vShr_DMin** [-] (:math:`C_{\nu Shr}^{DMin}`) is a calibrated +parameter in the eddy viscosity filter function for the wake shear +layer. It defines the transitional diameter fraction between the minimum +and exponential regions and must be greater than or equal to zero. If +the DEFAULT keyword is specified in place of a numerical value, +**C_vShr_DMin** is set to :math:`3.0`. + +**C_vShr_DMax** [-] (:math:`C_{\nu Shr}^{DMax}`) is a calibrated +parameter in the eddy viscosity filter function for the wake shear +layer. It defines the transitional diameter fraction between the +exponential and maximum regions and must be greater than +**C_vShr_DMin**. If the DEFAULT keyword is specified in place of a +numerical value, **C_vShr_DMax** is set to :math:`25.0`. + +**C_vShr_FMin** [-] (:math:`C_{\nu Shr}^{FMin}`) is a calibrated +parameter in the eddy viscosity filter function for the wake shear +layer. It defines the value in the minimum region and must be between +zero and one (inclusive). If the DEFAULT keyword is specified in place +of a numerical value, **C_vShr_FMin** is set to :math:`0.2`. + +**C_vShr_Exp** [-] (:math:`C_{\nu Shr}^{Exp}`) is a calibrated parameter +in the eddy viscosity filter function for the wake shear layer. It +defines the exponent in the exponential region and must be greater than +zero. If the DEFAULT keyword is specified in place of a numerical value, +**C_vShr_Exp** is set to :math:`0.1`. + +**Mod_WakeDiam** [switch] specifies the wake diameter calculation model +(method). There are four options: 1) use the rotor diameter +[**Mod_WakeDiam=1**]; 2) use a velocity-based method +[**Mod_WakeDiam=2**]; 3) use a mass-flux based method +[**Mod_WakeDiam=3**]; or 4) use a momentum-flux based method +[**Mod_WakeDiam=4**]. If the DEFAULT keyword is specified in place of a +numerical value, **Mod_WakeDiam** is set to :math:`1`. + +**C_WakeDiam** [-] (:math:`C_{WakeDiam}`) is the calibrated parameter +for the wake diameter calculation and must be greater than zero and less +than :math:`0.99`. It is unused when **Mod_WakeDiam=1**. If the DEFAULT +keyword is specified in place of a numerical value, **C_WakeDiam** is +set to :math:`0.95`. + +**Mod_Meander** [switch] specifies the spatial filter model (method) for +wake meandering. There are three options: 1) use a uniform spatial +average [**Mod_Meander=1**]; 2) use a truncated *jinc* +[**Mod_Meander=2**]; or 3) use a windowed *jinc* [**Mod_Meander=3**]. If +the DEFAULT keyword is specified in place of a numerical value, +**Mod_Meander** is set to :math:`3`. + +**C_Meander** [-] (:math:`C_{Meander}`) is the calibrated parameter for +the wake meandering and must be greater than or equal to one. If the +DEFAULT keyword is specified in place of a numerical value, +**C_Meander** is set to :math:`1.9`. + +Visualize +~~~~~~~~~ + +**WrDisWind** [flag] specifies whether full 3D low- and high-resolution +disturbed wind data output files will be generated. These files show the +ambient wind and wake interactions across the wind farm for +visualization and are generated if **WrDisWind**\ =TRUE. The VTK data +format and spatial resolutions (number of grid points, origin, and +spacing) of these output files match those of the corresponding low- and +high-resolution ambient wind data used by the FAST.Farm simulation. The +VTK files are written to a directory named *vtk_ff* where the FAST.Farm +primary file is stored. The naming conventions of these output files are +*.Low.Dis..vtk* and +*.HighT\ \ *.Dis..vtk* for +the low- and high-resolution disturbed wind data files, respectively, +where ** is the name of the FAST.Farm primary input file, +excluding its file extension, where ** and +** are as specified in +:numref:`FF:Input:VTK`, but include leading zeros. + +For visualization, FAST.Farm can also output low-resolution disturbed +(including wakes) wind data output files that are two-dimensional (2D) +slices of the full low-resolution domain, specified by the following 7 +inputs. Up to nine 2D slices parallel to the *X-Y*, *Y-Z*, and/or *X-Z* +planes can be output. + +- **NOutDisWindXY** [integer] specifies the number of 2D slices + parallel to the *X-Y* plane where low-resolution disturbed wind data + output files are output (:math:`0` to :math:`9`). + +- **OutDisWindZ** [m] is a list **NOutDisWindXY** values long of the + *Z* coordinates of each plane that will be output. These values are + in the **global inertial-frame coordinate system**, separated by any + combination of commas, semicolons, spaces, and/or tabs. + +- **NOutDisWindYZ** [integer] specifies the number of 2D slices + parallel to the *Y-Z* plane where low-resolution disturbed wind data + output files are output (:math:`0` to :math:`9`). + +- **OutDisWindX** [m] is a list **NOutDisWindYZ** values long of the + *X* coordinates of each plane that will be output. These values are + in the **global inertial-frame coordinate system**, separated by any + combination of commas, semicolons, spaces, and/or tabs. + +- **NOutDisWindXZ** [integer] specifies the number of 2D slices + parallel to the *X-Z* plane where low-resolution disturbed wind data + output files are output (:math:`0` to :math:`9`). + +- **OutDisWindY** [m] is a list **NOutDisWindXZ** values long of the + *Y* coordinates of each plane that will be output. These values are + in the **global inertial-frame coordinate system**, separated by any + combination of commas, semicolons, spaces, and/or tabs. + +The VTK files are written to a directory named *vtk_ff* where the FAST.Farm +primary file is stored. The naming conventions of these output files are +*.Low.DisXY..vtk*, +*.Low.DisYZ..vtk*, and +*.Low.DisXZ..vtk* for the *X-Y*, +*Y-Z*, and *X-Z* slices, respectively, where ** is an integer +between :math:`1` and :math:`9` corresponding to which slice is output. +** and ** are as defined in :numref:`FF:Input:VTK`, +but include leading zeros. + +**WrDisDT** [sec] specifies the time step (inverse of the frame rate) of +all disturbed wind data output files and must be an integer multiple +larger than or equal to **DT_Low**. This input is unused when +**WrDisWind** = FALSE and when **NOutDisWindXY**, **NOutDisWindYZ**, and +**NOutDisWindXZ** are set to zero. If the DEFAULT keyword is specified +in place of a numerical value, **WrDisDT** is set to **DT_Low**. Note +that the full high-resolution disturbed wind data output files are not +output at a frame rate of 1/**DT_High**, but are only output every +**WrDisDT** seconds. + +Visualizing the ambient wind and wake interactions can be useful for +interpreting results and debugging problems. However, FAST.Farm will +generate :math:`n+1` files per output option when **WrDisWind** = TRUE +and/or when **NOutDisWindXY**, **NOutDisWindYZ**, and/or +**NOutDisWindXZ** are set greater than zero. This file generation will +slow down FAST.Farm and take up a lot of disk space, especially when +generating full low- and high-resolution disturbed wind data files. +Therefore, disabling visualization is recommended when running many +FAST.Farm simulations. See :numref:`FF:Output:Vis` for +visualization output file details. + +Output +~~~~~~ + +**SumPrint** [flag] specifies if a summary file is generated. The file +is generated if **SumPrint**\ =TRUE, with the name <*RootName*>\ *.sum*, +where <*RootName*> is as defined above. See +:numref:`FF:Output:Sum` for summary file details. + +**ChkptTime** [sec] specifies how frequently checkpoint files are +written for a potential restart, but **is currently unused by +FAST.Farm.** + +**TStart** [sec] specifies the simulation time at which FAST.Farm will +begin writing data in the time-series results output file. Note that +output files may not be generated at **TStart** seconds if **TStart** is +not an integer multiple of **DT_Low**. + +**OutFileFmt** [switch] specifies which type of time-series results +output file will be generated. Three options are available, and are the +same as those in OpenFAST: 1) generates an ASCII text file +[**OutFileFmt=1**]; 2) generates a binary file [**OutFileFmt=2**]; or 3) +generates both ASCII text and binary files [**OutFileFmt=3**]. +**However, FAST.Farm currently only supports text-based output files. +Therefore, OutFileFmt must be set to 1**. + +**TabDelim** [flag] specifies how columns in the ASCII text output +time-series results are delimited. If **TabDelim** = TRUE, the columns +are tab-delimited. Otherwise, the columns are delimited with spaces. +**TabDelim** is not used when **OutFileFmt** = 2. + +**OutFmt** [string] specifies the ASCII text-based output file channel +format (excluding the time channel). Values printed in the time-series +results output file should result in a field that is 10 characters long; +“ES10.3E2” is a common setting for **OutFmt**. The time channel is +printed using the “F10.4” format. **OutFmt** is not used when +**OutFileFmt** = 2. See :numref:`FF:Output:Time` for +details on time-series results files. + +FAST.Farm can output wake-related quantities for up to 9 individual +turbines, not considering the effects of wake merging, at up to 20 +radial nodes and up to 9 downstream distances. These outputs are +specified with the 4 following inputs: + +- **NOutRadii** [integer] specifies the number of radial nodes to be + outputted (0 to 20). + +- **OutRadii** [integer] specifies the node numbers between 0 (at the + wake center) and **NumRadii**-1 (at the outer extent of the radial + finite-difference grid). Values are a list of length **NOutRadii**, + separated by any combination of commas, semicolons, spaces, and/or + tabs. + +- **NOutDist** [integer] specifies the number of downstream distances + that output is requested for (0 to 9). + +- **OutDist** [m] specifies the downstream distances (not wake-plane + numbers) and each must be greater or equal to zero. Values are a list + of length **NOutDist**, separated by any combination of commas, + semicolons, spaces, and/or tabs. The downstream distances are + measured normal to the wake planes and **an OutDist of zero + corresponds to the rotor plane**. Wake output quantities are linearly + interpolated between wake planes. Only wake-related quantities for + the first 9 turbines can be output and all wakes have the same output + radial node numbers and downstream distances. The outputs specified + in the **OutList** section determine which quantities are actually + output at these output radial node numbers and downstream distances. + + +FAST.Farm can also output ambient wind velocities (not including wakes) +and disturbed wind velocities (including wakes) at up to nine points +(positions) in the low-resolution wind domain, defined with the +following inputs: + +- **NWindVel** [integer] specifies the number of points where wind will + be output (0 to 9). + +- **WindVelX**, **WindVelY**, and **WindVelZ** [m] specifies *X*, *Y*, + *Z* and coordinates, respectively, in the **global inertial-frame + coordinate system**. Values are lists of length **NWindVel** + separated by any combination of commas, semicolons, spaces, and/or + tabs. The outputs specified in the **OutList** section determine + which wind velocities are actually output at these points. + +- **OutList** [quoted strings] controls output quantities generated by + FAST.Farm. Enter one or more lines containing quoted strings that in + turn contain one or more output parameter names. Separate output + parameter names by any combination of commas, semicolons, spaces, + and/or tabs. If you prefix a parameter name with a minus sign, “-”; + underscore, “\_”; or the characters “m” or “M”, FAST.Farm will + multiply the value for that channel by :math:`-1` before writing the + data. The output columns are written in the order they are listed in + the input file. FAST.Farm allows for the use of multiple lines so + that lists can be broken into meaningful groups and so the lines can + be shorter. Comments may be entered after the closing quote on any of + the lines. Entering a line with the string “END” at the beginning of + the line or at the beginning of a quoted string found at the + beginning of the line will cause FAST.Farm to quit scanning for more + lines of channel names. Wake-related output quantities are generated + for the requested output radial node numbers and downstream distances + through the **OutRadii** and **OutDist** lists above. Ambient and + disturbed wind velocities are generated for the requested points + through the **WindVelX**, **WindVelY**, and **WindVelZ** lists above. + If FAST.Farm encounters an unknown/invalid channel name, it warns the + users but will remove the suspect channel from the output file. + Please refer to :numref:`FF:APP:Output` for a complete list of possible output + parameters. + +.. _FF:AmbWindVTK: + +Ambient Wind Precursor Files in Visualization Toolkit Format +------------------------------------------------------------ + +When using ambient wind generated by a high-fidelity precursor +simulation with **Mod_AmbWind** = 1, ambient wind data files for both +the low- and high-resolution domains must be pre-generated. Each of +these ambient wind data files must follow the `simple legacy serial VTK +file +format `__. +A sample VTK-formatted file is given in :numref:`FF:APP:Wind`. + +FAST.Farm requires that the ambient wind data files be stored in +specific subdirectories of the directory specified by **WindFilePath** +and with specific file names. The low-resolution ambient wind data files +must be stored in a subdirectory named *Low* and be named +*Amb.t.vtk*, where ** is +as specified in :numref:`FF:Input:VTK`. The high-resolution +ambient wind data files must be stored in a subdirectory named +*HighT* and be named +*Amb.t.vtk*, where ** and +** are as specified in +:numref:`FF:Input:VTK`. Subdirectory *HighT* +should contain the high-resolution ambient wind data corresponding to +wind turbine *n*\ :sub:`t` specified in the Wind Turbines section of +the FAST.Farm primary input file -- see :numref:`FF:Input:WT`. + +Each VTK-formatted input file begins with a file version and identifier, +but is not checked by FAST.Farm. The second line is the header +information that is for identifying specific cases, but is not used by +FAST.Farm. The third line must include the single word ASCII, +designating the file format currently supported by FAST.Farm. + +The fourth line must contain the words *DATASET STRUCTURED_POINTS*, +designating the data set structure currently supported by FAST.Farm. The +next three lines set the spatial discretization of the domain. Each +domain is stored as a structured 3D grid of wind data points +(representing the corners of 3D cells) in the global *X-Y-Z* +inertial-frame coordinate system -- as illustrated generically in +:numref:`FF:StrucDomains`. The number of wind data points in each +direction are set by DIMENSIONS followed by three integers separated by +white space representing **NX**, **NY**, and **NZ**; the origin of the +grid (lowest-most *X-Y-Z* coordinate) is set by ORIGIN followed by three +floating real numbers separated by white space representing **X0**, +**Y0**, and **Z0**; and the spatial discretization in each direction are +set by SPACING followed by three floating real numbers separated by +white space representing **dX**, **dY**, and **dZ**. The total domain +size has dimensions (**NX**-1)\ **dX** :math:`\times` (**NY**-1)\ **dY** +:math:`\times` (**NZ**-1)\ **dZ**. + +The eighth line must contain the word *POINT_DATA* followed by an +integer number specifying the number of wind data points, i.e., **NX** +:math:`\times` **NY** :math:`\times` **NZ**. The ninth line must contain +the word *VECTORS* followed by the data name (not used by FAST.Farm) and +*FLOAT*, which defines the format of the data stored on the grid. +Alternatively, the ninth line must contain the word *FIELD* followed by +the data name (not used by FAST.Farm) and 1 and the tenth line must +contain the array name (not used by FAST.Farm) followed by 3, the number +of wind data points, i.e., **NX** :math:`\times` **NY** :math:`\times` +**NZ**, and *FLOAT*. The remaining **NX** :math:`\times` **NY** +:math:`\times` **NZ** lines of the file contain the *X-Y-Z* components +of the ambient wind velocity at each wind data point stored as three +floating real numbers separated by white space. The first data point +corresponds to the *ORIGIN* and the remaining points involve looping +through *X*, then *Y*, and then *Z*. For a ground or wave surface that +is not flat and level -- e.g., complex terrain or time-varying sea-surface +elevation for offshore systems -- the wind velocity components at a given +wind data point should be written as NaN (not a number) [1]_ if that +point is below the surface (not exposed to the atmosphere). + +.. _FF:AmbWindIfW: + +Ambient Wind with InflowWind Module Input Files +----------------------------------------------- + +When using ambient wind through the interface to the *InflowWind* module +with **Mod_AmbWind** = 2 or 3, the ambient wind is specified within +standard *InflowWind* input files described in the OpenFAST +documentation. The name of the primary *InflowWind* input file is +specified by input parameter **InflowFile** in FAST.Farm. Please note +that **InflowFile** is independent of the *InflowWind* primary input +file used by the OpenFAST model of each wind turbine. + +The *InflowWind* primary input file is processed the same when running +FAST.Farm simulations as it would when running simulations in +stand-alone OpenFAST. The only difference is that input parameter +**OutList** in the *InflowWind* primary input file is ignored and +replaced with equivalent output settings in FAST.Farm. All wind file +type options and their associated input options are supported by +FAST.Farm. Wind file type options are specified with input parameter +**WindType** in the *InflowWind* primary input file. The available input +options include steady wind, uniform time-varying wind, e.g., discrete +gusts, and, full-field turbulent wind (in TurbSim, Bladed, and HAWC +formats). + +The wind data specified within *InflowWind* must encompass the entire +low- and high-resolution domains defined within FAST.Farm for the entire +simulation. This is because the ambient wind data specified within +*InflowWind* will be interpolated to low- and high-resolution domains +for use within FAST.Farm. To ensure this when using full-field turbulent +wind data in *InflowWind*, it is recommend that: + +- The full-field wind data files be generated periodically so that the + wind domain in *InflowWind* effectively extends forever along the + wind propagation direction. + +- The input parameter **PropagationDir** in the *InflowWind* primary + input file be set to :math:`0`, :math:`\pm90`, or :math:`180` degrees + so that the wind propagates along the :math:`\pm X` or :math:`\pm Y` + axes of the FAST.Farm inertial-frame coordinate system (the exact + direction should depend on the orientation of the wind turbines and + farm). + +When using full-field turbulent wind data in *InflowWind*, it is +recommended that the 2D grid where the full-field turbulent wind data +are defined be coincident with either the *Y-Z* grid of the +high-resolution domain when **PropogationDir** = :math:`0` or +:math:`180` degrees or the *X-Z* grid of the high-resolution domain when +**PropogationDir** = :math:`\pm90` degrees for each wind turbine. This +is done to avoid doubly interpolating the wind data (once by FAST.Farm +when generating the high-resolution domain and once by OpenFAST when +accessing high-resolution wind at turbine analysis nodes). + +When using ambient wind through multiple instances of the *InflowWind* +module, i.e, when **Mod_AmbWind** = 3, only one *InflowWind* input file +is specified. However, multiple wind data files are used, each with a +different name. Specifically, the file name in the *InflowWind* input +file in this case specifically refers only to the directory path of the +wind files. The wind file root names are required to be *Low* for the +low-resolution domain and *HighT* for the +high-resolution domain associated with turbine :math:`n_\text{t}`.  [2]_ +Setting **Mod_AmbWind** to 2 or 3 has no influence when steady inflow is +used (**WindType** = 1). When using full-field turbulent wind data in +*InflowWind* with **Mod_AmbWind** = 3, it is required that: + +- The full-field wind data files be generated periodically. This + effectively extends the wind domain forever along the wind + propagation direction. + +- The input parameter **PropagationDir** in the *InflowWind* input file + be set to :math:`0` degrees so that the wind propagates along the *X* + axis of the FAST.Farm inertial-frame coordinate system. + +- The wind data files associated with the high-resolution ambient wind + be spatially and temporally synchronized with the low-resolution wind + data file. The spatial synchronization must be based on the global + *X-Y-Z* offsets of each turbine origin relative to the origin of the + inertial frame coordinate system. + +.. _FF:Input:OFInput: + +OpenFAST Input Files +-------------------- + +In addition to the FAST.Farm-specific input files, the OpenFAST model of +each wind turbine also requires input files. + +**WT_FASTInFile** [quoted string] specifies the OpenFAST primary input +file for each wind turbine, including path. This is required in addition +to the FAST.Farm-specific input files. The OpenFAST primary file, in +turn, identifies several module-level input files. These OpenFAST input +files are described in the OpenFAST documentation. Identical wind +turbines can use the same OpenFAST primary input file, except if the +corresponding OpenFAST model makes use of a Bladed-style controller in +DLL format or, for offshore wind turbines, if different wave conditions +are required for each turbine. If a Bladed-style DLL controller is being +used, distinct Bladed-style controller DLLs must be used (each with a +unique name). This requires the need for distinct *ServoDyn* primary +input files, referencing the appropriate DLL name, and distinct OpenFAST +primary input files, each referencing the appropriate *ServoDyn* primary +input file name. If different wave conditions are required for each +turbine, the distinct wave conditions (e.g., based on unique random wave +seeds) for each wind turbine must be set in the *HydroDyn* primary input +file and distinct OpenFAST primary input files must be used, each +referencing the appropriate *HydroDyn* primary input file name. + +**Please note that the following input parameters in OpenFAST are +interpreted differently when running FAST.Farm simulations than when +running simulations in stand-alone OpenFAST.** + +**AbortLevel** in the OpenFAST primary input file is ignored and +replaced with the equivalent input set in the FAST.Farm primary input. + +**TMax** in the OpenFAST primary input file is ignored and replaced with +the equivalent input set in the FAST.Farm primary input. + +**CompInflow** in the OpenFAST primary input file must be set to 1 (to +use the *InflowWind* module). + +**CompAero** in the OpenFAST primary input file must be set to 2 (to use +the *AeroDyn v15* module). + +**WindType** and its associated input parameters in the OpenFAST +*InflowWind* module primary input file are ignored and replaced with the +disturbed wind (including wakes) computed across the high-resolution +domain for each wind turbine. + +**PropogationDir** in the OpenFAST *InflowWind* module primary input +file is ignored. + +**PCMode**, **VSContrl**, **HSSBRMode**, and **YCMode** in the OpenFAST +*ServoDyn* module primary input file must not be set to 4 because the +Simulink/Labview interface is not currently supported by FAST.Farm. + +All input parameters across the various OpenFAST input files pertaining +to the wind turbine geometry defined relative to the origin of the +OpenFAST inertial-frame coordinate system remain unchanged. Turbine +origins are defined as the intersection of the undeflected tower +centerline and the ground or, for offshore systems, mean sea level. +Note, however, this origin ((:math:`0`,\ :math:`0`,\ :math:`0`) in the +OpenFAST inertial-frame coordinate system) is located at +(**WT_X**,\ **WT_Y**,\ **WT_Z**) in the FAST.Farm global *X-Y-Z* +inertial-frame coordinate system. + +.. [1] + FAST.Farm will treat such wind data points as outside the domain, and + so, not used in any calculations. + +.. [2] + When HAWC format is used (**WindType** = 5), :math:`\_u`, + :math:`\_v`, :math:`\_w` must be appended to the file names. diff --git a/docs/source/user/fast.farm/Introduction.rst b/docs/source/user/fast.farm/Introduction.rst new file mode 100644 index 0000000000..59ecb57bf9 --- /dev/null +++ b/docs/source/user/fast.farm/Introduction.rst @@ -0,0 +1,433 @@ +.. _FF:Intro: + +Introduction +============ + +FAST.Farm is a midfidelity +multiphysics engineering tool for predicting the power performance and +structural loads of wind turbines within a wind farm. FAST.Farm uses +`OpenFAST `__ to solve the +aero-hydro-servo-elastic dynamics of each individual turbine, but +considers additional physics for wind farm-wide ambient wind in the +atmospheric boundary layer; a wind-farm super controller; and wake +deficits, advection, deflection, meandering, and merging. FAST.Farm is +based on some of the principles of the dynamic wake meandering (DWM) +model -- including passive tracer modeling of wake meandering -- but addresses +many of the limitations of previous DWM implementations. FAST.Farm +maintains low computational cost to support the often highly iterative +and probabilistic design process. Applications of FAST.Farm include +reducing wind farm underperformance and loads uncertainty, developing +wind farm controls to enhance operation, optimizing wind farm siting and +topology, and innovating the design of wind turbines for the wind-farm +environment. The existing implementation of FAST.Farm also forms a solid +foundation for further development of wind farm dynamics modeling as +wind farm physics knowledge grows from future computations and +experiments. + +The main idea behind the DWM model is to capture key wake features +pertinent to accurate prediction of wind farm power performance and wind +turbine loads, including the wake-deficit evolution (important for +performance) and the wake meandering and wake-added turbulence +(important for loads). The wake-deficit evolution and wake meandering +are illustrated in :numref:`FF:WakeMeandering`. + +.. figure:: Pictures/AxiWake-WakeMeandering.png + :alt: Axisymmetric wake deficit and meandering evolution. + :name: FF:WakeMeandering + :width: 100% + :align: center + + Axisymmetric wake deficit (left) and meandering (right) evolution. + + + +Although fundamental laws of physics are applied, appropriate +simplifications have been made to minimize the computational expense, +and high-fidelity modeling (HFM) solutions, e.g., using the Simulator +fOr Wind Farm Applications (`SOWFA `__), +have been used to inform and calibrate the submodels. In the DWM model, +the wake-flow processes are treated via the “splitting of scales,” in +which small turbulent eddies (less than two diameters) affect +wake-deficit evolution and large turbulent eddies (greater than two +diameters) affect wake meandering. + +FAST.Farm is a nonlinear time-domain multiphysics engineering tool +composed of multiple submodels, each representing different physics +domains of the wind farm. FAST.Farm is implemented as open-source +software that follows the programming requirements of the FAST +modularization framework, +whereby the submodels are implemented as modules interconnected through +a driver code. The submodel hierarchy of FAST.Farm is illustrated in +:numref:`FF:FFarm`. + +.. figure:: Pictures/FFarmHierarchy.png + :alt: FAST.Farm submodel hierarchy. + :name: FF:FFarm + :width: 100% + :align: center + + FAST.Farm submodel hierarchy. + +Wake advection, deflection, and meandering; near-wake correction; and +wake-deficit increment are submodels of the wake-dynamics (*WD*) model, +implemented in a single module. Ambient wind and wake merging are +submodels of the ambient wind and array effects (*AWAE*) model, +implemented in a single module. Combined with the super controller +(*SC*) and OpenFAST (*OF*) modules, FAST.Farm has four modules and one +driver. There are multiple instances of the *OF* and *WD* modules -- one +instance for each wind turbine/rotor. + +FAST.Farm Driver +---------------- + +The FAST.Farm driver, also known as the “glue code,” is the code that +couples individual modules together and drives the overall time-domain +solution forward. Additionally, the FAST.Farm driver reads an input file +of simulation parameters, checks the validity of these parameters, +initializes the modules, writes results to a file, and releases memory +at the end of the simulation. + +Super Controller Module +----------------------- + +The *SC* module of FAST.Farm -- essentially identical to the super +controller available in `SOWFA `__ allows +wind-farm-wide control logic to be implemented by the user, including +sending and receiving commands from the individual turbine controllers +in OpenFAST. The logic of such a super controller could be developed +through the application of the National Renewable Energy Laboratory +(NREL) code FLOw Redirection and Induction in Steady state +(`FLORIS `__). + +OpenFAST Module +--------------- + +The *OF* module of FAST.Farm is a wrapper that enables the coupling of +`OpenFAST `__ to FAST.Farm. +OpenFAST models the dynamics (loads and motions) of distinct turbines in +the wind farm, capturing the environmental excitations (wind inflow and, +for offshore systems, waves, current, and ice) and coupled system +response of the full system (the rotor, drivetrain, nacelle, tower, +controller, and, for offshore systems, the substructure and +station-keeping system). OpenFAST itself is an interconnection of +various modules, each corresponding to different physical domains of the +coupled aero-hydro-servo-elastic solution. There is one instance of the +*OF* module for each wind turbine, which, in parallel mode, are +parallelized through open multiprocessing (OpenMP). At initialization, +the number of wind turbines, associated OpenFAST primary input file(s), +and turbine origin(s) in the global *X-Y-Z* inertial-frame coordinate +system are specified by the user of FAST.Farm. Turbine origins are +defined as the intersection of the undeflected tower centerline and the +ground or, for offshore systems, the mean sea level. The global +inertial-frame coordinate system is defined with *Z* directed vertically +upward (opposite gravity), *X* directed horizontally nominally downwind +(along the zero-degree wind direction), and *Y* directed horizontally +transversely. This coordinate system is not tied to specific compass +directions. Among other time-dependent inputs from FAST.Farm, OpenFAST +uses the disturbed wind (ambient plus wakes) across a high-resolution +wind domain (in both time and space) around the turbine as input. This +high-resolution domain ensures that the individual turbine loads and +responses calculated by OpenFAST are accurately driven by flow through +the wind farm, including wake and array effects. + +Wake Dynamics Module +-------------------- + +The *WD* module of FAST.Farm calculates wake dynamics for an individual +rotor, including wake advection, deflection, and meandering; a near-wake +correction; and a wake-deficit increment. The near-wake correction +treats the near-wake (pressure-gradient zone) correction of the wake +deficit. The wake-deficit increment shifts the quasi-steady-state +axisymmetric wake deficit nominally downwind. There is one instance of +the *WD* module for each rotor. The wake-dynamics calculations involve +many user-specified parameters that may depend, e.g., on turbine +operation or atmospheric conditions and can be calibrated to better +match experimental data or by using an HFM solution as a benchmark. +Default values have been derived for each calibrated parameter based on +`SOWFA `__ simulations, but these can be +overwritten by the user. + +The wake-deficit evolution is solved in discrete time on an axisymmetric +finite-difference grid consisting of a fixed number of wake planes, each +with a fixed radial grid of nodes. The radial finite-difference grid can +be considered a plane because the wake deficit is assumed to be +axisymmetric. A wake plane can be thought of as a cross section of the +wake wherein the wake deficit is calculated. + +.. figure:: Pictures/WakeDefl.png + :alt: Wake deflection resulting from inflow skew, including a horizontal wake-deflection correction. The lower dashed line represents the rotor centerline, the upper dashed line represents the wind direction, and the solid blue line represents the horizontal wake-deflection correction (offset from the rotor centerline). + :name: FF:WakeDefl + :width: 55% + :align: center + + Wake deflection resulting from inflow skew, including a horizontal wake-deflection correction. The lower dashed line represents the rotor centerline, the upper dashed line represents the wind direction, and the solid blue line represents the horizontal wake-deflection correction (offset from the rotor centerline). + +.. figure:: Pictures/WakeAdv.png + :alt: Wake advection for a single turbine resulting from a step change in yaw angle. + :name: FF:WakeAdv + :width: 55% + :align: center + + Wake advection for a single turbine resulting from a step change in yaw angle. + +By simple extensions to the passive tracer solution for transverse +(horizontal and vertical) wake meandering, the wake-dynamics solution in +FAST.Farm is extended to account for wake deflection, as illustrated in +:numref:`FF:WakeDefl`, and wake advection, as illustrated in +:numref:`FF:WakeAdv`, among other physical improvements such as: + +#. Calculating the wake-plane velocities by spatially averaging the + disturbed wind instead of the ambient wind (in the AWAE module) + +#. Orientating the wake planes with the rotor centerline instead of the + wind direction + +#. Low-pass time filtering the local conditions at the rotor, as input + to the wake dynamics module, to account for transients in inflow, + turbine control, and/or turbine motion instead of considering + time-averaged conditions. + +With these extensions, the passive tracer solution enables: + +#. The wake centerline to deflect based on inflow skew, because in + skewed inflow, the wake deficit normal to the disk introduces a + velocity component that is not parallel to the ambient flow + +#. The wake to accelerate from near wake to far wake, because the wake + deficits are stronger in the near wake and weaken downwind + +#. The wake-deficit evolution to change based on conditions at the + rotor, because low-pass time filtering conditions are used instead of + time-averaging + +#. The wake to meander axially in addition to transversely, because + local axial winds are considered + +#. The wake shape to be elliptical instead of circular in skewed flow + when looking downwind (the wake shape remains circular when looking + down the rotor centerline). + +From item 1 above, a horizontally asymmetric correction to the wake +deflection is accounted for, i.e., a correction to the wake deflection +resulting from the wake-plane velocity, which physically results from +the combination of wake rotation and shear not modeled directly in the +*WD* module (see :numref:`FF:WakeDefl` for an illustration). This +horizontal wake deflection correction is a simple linear correction +(with a slope and offset), similar to the correction implemented in the +wake model of `FLORIS `__. Such a +correction is important for accurate modeling of nacelle-yaw-based +wake-redirection (wake-steering) wind farm control. + +From item 3, low-pass time filtering is important because the wake +reacts slowly to changes in local conditions at the rotor and because +the wake evolution is treated in a quasi-steady-state fashion. + +The near-wake correction submodel of the *WD* module computes the +wake-velocity deficits at the rotor disk, as an inlet boundary condition +for the wake-deficit evolution. To improve the accuracy of the far-wake +solution, the near-wake correction accounts for the drop-in wind speed +and radial expansion of the wake in the pressure-gradient zone behind +the rotor that is not otherwise accounted for in the solution for the +wake-deficit evolution. + +As with most DWM implementations, the *WD* module of FAST.Farm models +the wake-deficit evolution via the thin shear-layer approximation of the +Reynolds-averaged Navier-Stokes equations under quasi-steady-state +conditions in axisymmetric coordinates, with turbulence closure captured +by using an eddy-viscosity formulation. The thin shear-layer +approximation drops the pressure term and assumes that the velocity +gradients are much bigger in the radial direction than in the axial +direction. + +Ambient Wind and Array Effects Module +------------------------------------- + +The *AWAE* module of FAST.Farm processes ambient wind and wake +interactions across the wind farm, including the ambient wind submodel, +which processes ambient wind across the wind farm and the wake-merging +submodel, which identifies zones of overlap between all wakes across the +wind farm and merges their wake deficits. The calculations in the *AWAE* +module make use of wake volumes, which are volumes formed by a (possibly +curved) cylinder starting at a wake plane and extending to the next +adjacent wake plane along a line connecting the centers of the two wake +planes. If the adjacent wake planes (top and bottom of the cylinder) are +not parallel, e.g., for transient simulations involving variations in +nacelle-yaw angle, the centerline will be curved. +:numref:`FF:FFarmDomains` illustrates some of the concepts. + +.. figure:: Pictures/Domains.png + :alt: Wake planes, wake volumes, and zones of wake overlap for a two-turbine wind farm, with the upwind turbine yawed. + :name: FF:FFarmDomains + :width: 100% + :align: center + + Wake planes, wake volumes, and zones of wake overlap for a + two-turbine wind farm, with the upwind turbine yawed. The yellow + points represent the low-resolution wind domain and the green points + represent the high-resolution wind domains around each turbine. The + blue points and arrows represent the centers and orientations of the + wake planes, respectively, with the wake planes identified by the + blue lines normal to their orientations. The gray dashed lines + represent the mean trajectory of the wake and the blue curves + represent the instantaneous [meandered] trajectories. The wake + volumes associated with the upwind turbine are represented by the + upward hatch patterns, the wake volumes associated with the downwind + turbine are represented by the downward hatch patterns, and the zones + of wake overlap are represented by the crosshatch patterns. (For + clarity of the illustration, the instantaneous (meandered) wake + trajectory is shown as a smooth curve, but will be modeled as + piece-wise linear between wake planes when adjacent wake planes are + parallel. The wake planes and volumes are illustrated with a diameter + equal to twice the wake diameter, but the local diameter depends on + the calculation. As illustrated, a wake plane or volume may extend + beyond the boundaries of the low-resolution domain of ambient wind + data.) + +The calculations in the *AWAE* module also require looping through all +wind data points, turbines, and wake planes; these loops have been sped +up in the parallel mode of FAST.Farm by implementation of open +multiprocessing (OpenMP) parallelization. + +Ambient wind may come from either a high-fidelity precursor simulation +or an interface to the *InflowWind* module in OpenFAST. The use of the +*InflowWind* module enables the use of simple ambient wind, e.g., +uniform wind, discrete wind events, or synthetically generated turbulent +wind data. Synthetically generated turbulence can be generated from, +e.g., TurbSim or the Mann model, in +which the wind is propagated through the wind farm using Taylor’s +frozen-turbulence assumption. This method is most applicable to small +wind farms or a subset of wind turbines within a larger wind farm. +FAST.Farm can also use ambient wind generated by a high-fidelity +precursor large-eddy simulation (LES) of the entire wind farm (without +wind turbines present), such as the atmospheric boundary layer solver +(ABLSolver) preprocessor of `SOWFA `__. +This atmospheric precursor simulation captures more physics than +synthetic turbulence -- as illustrated in +:numref:`FF:ABLSolver` -- including atmospheric stability, +wind-farm-wide turbulent length scales, and complex terrain effects. + +.. figure:: Pictures/ABLSolver.png + :alt: Example flow generated by ABLSolver. + :name: FF:ABLSolver + :width: 70% + :align: center + + Example flow generated by ABLSolver. + +This method is more computationally expensive than using the ambient +wind modeling options of InflowWind, but it is much less computationally +expensive than a SOWFA simulation with wind turbines present. FAST.Farm +requires ambient wind to be available in two different resolutions in +both space and time. Because wind will be spatially averaged across wake +planes within the *AWAE* module, FAST.Farm needs a low-resolution wind +domain throughout the wind farm wherever turbines may potentially +reside. For accurate load calculation by OpenFAST, FAST.Farm also needs +high-resolution wind domains around each wind turbine (encompassing any +turbine displacement). The high-resolution domains will occupy the same +space as portions of the low-resolution domain, requiring domain +overlap. + +When using ambient wind generated by a high-fidelity precursor +simulation, the *AWAE* module reads in the three-component wind-velocity +data across the high- and low-resolution domains that were computed by +the high-fidelity solver within each time step. These values are stored +in files for use in a given driver time step. The wind data files, +including spatial discretizations, must be in Visualization Toolkit +(VTK) format and are specified by users of FAST.Farm at initialization. +`Visualization Toolkit `__ is an open-source, +freely available software system for three-dimensional (3D) computer +graphics, image processing, and visualization. When using the +*InflowWind* inflow option, the ambient wind across the high- and +low-resolution domains are computed by calling the *InflowWind* module. +In this case, the spatial discretizations are specified directly within +the FAST.Farm primary input file. These wind data from the combined low- +and high-resolution domains within a given driver time step represent +the largest memory requirement of FAST.Farm. + +In previous implementations of DWM, the wind turbine and wake dynamics +were solved individually or serially, not considering two-way +wake-merging interactions. Additionally, there was no method available +to calculate the disturbed wind in zones of wake overlap. Wake merging +is illustrated by the FAST.Farm simulation of +:numref:`FF:WakeMerg`. + +.. figure:: Pictures/FFarm_Merging.png + :alt: Wake merging for closely spaced rotors. + :name: FF:WakeMerg + :width: 70% + :align: center + + Wake merging for closely spaced rotors. + +In FAST.Farm, the wake-merging submodel of the *AWAE* module identifies +zones of wake overlap between all wakes across the wind farm by finding +wake volumes that overlap in space. Wake deficits are superimposed in +the axial direction based on the root-sum-squared (RSS) method. +Transverse components (radial wake deficits) are superimposed by vector +sum. The RSS method assumes that the local kinetic energy of the axial +deficit in a merged wake equals the sum of the local energies of the +axial deficits for each wake at the given wind data point. The RSS +method only applies to an array of scalars. This method works well for +axial deficits because overlapping wakes likely have similar axial +directions; therefore, only the magnitude of the vector is important in +the superposition. A vector sum is applied to the transverse components +(radial wake deficits) because any given radial direction is dependent +on the azimuth angle in the axisymmetric coordinate system. + +To visualize the ambient wind and wake interactions across the wind +farm, FAST.Farm includes visualization capability through the generation +of output files in VTK format. +`OpenFAST `__ can further generate +VTK-formatted output files for visualizing the wind turbine based on +either surface or stick-figure geometry. The VTK files generated by +FAST.Farm and OpenFAST can be read with standard open-source +visualization packages such as `ParaView `__ +or `VisIt `__. + +FAST.Farm Parallelization +------------------------- + +FAST.Farm can be compiled and run in serial or parallel mode. +Parallelization has been implemented in FAST.Farm through OpenMP, which +allows FAST.Farm to take advantage of multicore computers by dividing +computational tasks among the cores/threads within a node (but not +between nodes) to speed up a single simulation. The size of the wind +farm and number of wind turbines is limited only by the available +random-access memory (RAM). In parallel mode, each instance of the +OpenFAST submodel can be run in parallel on separate threads at the same +time the ambient wind within the *AWAE* module is being read in another +thread. Thus, the fastest simulations require at least one more core +than the number of wind turbines in the wind farm. Furthermore, the +output calculations within the *AWAE* module are parallelized into +separate threads. Because of the small timescales involved and +sophisticated physics, the *OF* submodel is the computationally slowest +FAST.Farm module. The output calculation of the *AWAE* module is the +only major calculation that cannot be solved in parallel to OpenFAST; +therefore, at best, the parallelized FAST.Farm solution may execute only +slightly more slowly than stand-alone OpenFAST +simulations -- computationally inexpensive enough to run the many +simulations necessary for wind turbine/farm design and analysis. + +To support the modeling of large wind farms, single simulations +involving memory parallelization and parallelization between nodes of a +multinode high-performance computer (HPC) through a message-passing +interface (MPI) is likely required. MPI has not yet been implemented +within FAST.Farm. + +Organization of the Guide +------------------------- + +The remainder of this documentation is structured as follows: +:numref:`FF:Running` details how to obtain the FAST.Farm +software archive and how to run FAST.Farm. :numref:`FF:Input` +describes the FAST.Farm input files. :numref:`FF:Output` +discusses the output files generated by FAST.Farm. +:numref:`FF:ModGuidance` provides modeling guidance when +using FAST.Farm. The FAST.Farm theory is covered in +:numref:`FF:Theory`. :numref:`FF:FutureWork` +outlines future work, and the bibliography provides background and other +information sources. Example FAST.Farm primary input and ambient wind +data files are shown in :numref:`FF:App:Input` +and :numref:`FF:App:Wind`. A summary of available output channels +is found in :numref:`FF:App:Output`. + diff --git a/docs/source/user/fast.farm/ModelGuidance.rst b/docs/source/user/fast.farm/ModelGuidance.rst new file mode 100644 index 0000000000..24e0fd36cd --- /dev/null +++ b/docs/source/user/fast.farm/ModelGuidance.rst @@ -0,0 +1,1108 @@ +.. _FF:ModGuidance: + +Modeling Guidance +================= + +This chapter includes modeling guidance for setting up and running a +FAST.Farm simulation. This includes guidance on inflow wind generation; +low- and high-resolution grid discretization; parameter selection; super +controller use; and solutions for commonly encountered errors. + +.. _FF:sec:setup: + +FAST.Farm Setup Overview +------------------------ + +This section includes a high-level overview of how to set up ambient +inflow and FAST.Farm simulations in particular, the information needed +to calculate various parameters, as shown in +:numref:`FF:FFarmSetup`. + +.. figure:: Pictures/FFarmFlowChart.png + :alt: Information flowchart for setting up inflow generation and FAST.Farm simulations. Here, *S*\ =\ *X*, *Y*, or *Z*. + :name: FF:FFarmSetup + :width: 100% + :align: center + + Information flowchart for setting up inflow generation and FAST.Farm + simulations. Here, *S* = *X*, *Y*, or *Z*. + +Note that this schematic only includes information relevant to FAST.Farm +simulations. Typically, additional inflow information is required to +generate inflow and the OpenFAST models. The specific equations that +should be used to compute the input parameters are discussed in +:numref:`FF:sec:paramselect`. It is highly recommended that the +Python notebooks provided in the FAST.Farm `tools repository +`__ be +used when setting up new inflow or a FAST.Farm case. Improperly setting these +parameters can lead to common errors and/or excessive interpolation, which +should be avoided. Note that this chapter assumes a wind direction of +:math:`0^\circ`\ -- i.e., ambient wind that propagates along the *+X* axis of +the global inertial frame coordinate system. + +When generating a FAST.Farm simulation setup and corresponding inflow, planning +is important. Improper planning could results in FAST.Farm errors and/or needing +to regenerate the inflow. Values that should be known *a priori* are: + + - wind turbine rotor diameter (:math:`D^\text{Rotor}`); + - wind turbine hub height; + - maximum turbine chord length (:math:`c_\text{max}`); + - maximum turbine natural frequency (:math:`f_\text{max}`); + - *X*, *Y*, and *Z* locations of all turbines in the wind farm; + - desired mean inflow hub-height wind velocity; and + - mean inflow wind direction. + +The values that must be computed using this information are: + + - inflow and FAST.Farm domain size (height, width, and length); + - FAST.Farm high- and low-resolution domain origin locations (**S0_High** and + **S0_Low**, where *S* = *X*, *Y*, or *Z*); + - high- and low-resolution temporal discretization values (**DT_High** and + **DT_Low**); + - high- and low-resolution spatial discretization values (**DS_High** and **DS_Low**); + - number of grid points in the high- and low-resolution domains (**NS_High** and **NS_Low**); + - actual mean inflow hub-height wind velocity (:math:`V_\text{hub}`); + - additional wake dynamics properties (**dr**, **NumRadii**, and + **NumPlanes**). + +With this information, inflow generation can begin. Though not required, it is +recommended to complete inflow generation before setting up the FAST.Farm +simulation. This is because the realized spatial discretization values and/or +mean hub height velocity can differ from what is desired. Having the correct +values of these parameters leads to less interpolation of the wind data in +FAST.Farm simulations, which would otherwise reduce the ambient turbulence. + +When setting up the inflow generation, the recommended spatial and +temporal discretizations should be used, as discussed in +:numref:`FF:sec:DiscRecs`. If using: + + - **Mod\_AmbWind** = 1, a high-fidelity must be generated and all + discretization values can be specified as the exact desired value. + - **Mod\_AmbWind** = 2, a single synthetic inflow (TurbSim or Mann) must be + generated using the high-resolution discretization values recommended + herein. + - **Mod\_AmbWind** = 3, multiple synthetic inflows must be generated. In + this case, the recommended high-resolution discretizations should be used + for all high-resolution inflows generated. For the low-resolution inflow + generation, the recommended high-resolution temporal discretization and + low-resolution spatial discretization should be used. + +If using synthetic inflow (TurbSim or Mann), the inflow streamwise spatial +discretization, **DX_Inflow**, is not specified by the user, but is instead +based on Taylor's frozen-turbulence assumption. Because the streamwise +discretization of the FAST.Farm domain should be based on the inflow streamwise +discretization, the user should compute this value using the inflow time step +(**DT_High**) and the advection speed of the synthetic wind data, +:math:`V_\text{Advect}`. The :math:`V_\text{Advect}` may differ from the actual +wind speed at hub height, :math:`V_\text{Hub}`, as discussed in +:numref:`FF:sec:Synthetic`, and should be computed directly from the generated +synthetic inflow. Therefore, the exact resulting **DX_Inflow** will not be +known until after the inflow has been generated. Additionally, **DX_Inflow** +will likely be much smaller than the desired values of **DX_Low** and +**DX_High**. + +When setting up the FAST.Farm simulation itself, many of the values that were +used for inflow generation will be used again here to specify the FAST.Farm +domain. Note that this domain specification in FAST.Farm is only needed when +using synthetic turbulence inflow. The origin of the low-resolution domain +(**X0_Low**, **Y0_Low**, and **Z0_Low**) should be determined based on: + + - the minimum turbine *X*- and *Y*-locations; + - turbine yaw misalignment; + - inflow wind direction; and + - the expected range of wake meandering. + +Specifically, **X0_Low** must accommodate all turbine +locations as well as allow enough room to analyze the undisturbed inflow +upstream of the wind farm, if desired. **Y0_Low** must accommodate all +turbine locations as well as the horizontal wake meandering. When using +TurbSim, which cannot generate wind at ground level, **Z0_Low** should +be close to but above ground level. + +The FAST.Farm domain width and height are then computed using: + + - the turbine locations; + - the calculated **Y0_Low** and **Z0_Low** values; + - the horizontal and vertical meandering distance requirements; + - turbine yaw misalignment; and + - the inflow wind direction. + +The domain length should be based on the streamwise extent of the wind farm and, +if desired, allow enough room to analyze the waked outflow downstream of the +wind farm. + +The low-resolution domain in FAST.Farm (**DY_Low** and **DZ_Low**) and number of +grid points (**NY_Low** and **NZ_Low**) can then be computed using: + + - the domain width and height; + - the lateral and vertical spacing of the generated inflow; and + - DY_Inflow and DZ_Inflow. + +The low-resolution temporal discretization (**DT_Low**) +should be computed using: + + - the turbine diameter; + - inflow hub-height velocity; and + - the inflow temporal discretization. + +The streamwise spacing and number of grid points (**DX_Low** and **NX_Low**) +should also be based on **DT_Low** and the mean wind speed. + + +The final domain parameters to calculate are the +locations of the high-resolution domains (**X0_High**, **Y0_High**, and +**Z0_High**) and the number of grid points required to make up the +domains (**NX_High**, **NY_High**, and **NZ_High**). These quantities +should be determined from: + + - **DS_High** values; + - turbine locations; and + - the size of the high-resolution domains. + + +The **DS_High** values should be selected based on recommended high-resolution +domain discretization criteria, discussed in :numref:`FF:sec:DiscRecs`. + + +Additional wake dynamics quantities are needed when specifying the FAST.Farm +input file, as discussed further in :numref:`FF:wake-dynamics-parameters`. +It is recommended to base **dr** on :math:`c_\text{max}`; +**NumRadii** on wake diameter and **dr**; and **NumPlanes** on **DT_Low**, +inflow hub-height velocity, and the distance between turbine locations. + +A sample turbine layout and domain locations are shown in +:numref:`FF:FFarmLayout`. + +.. figure:: Pictures/FFarmLayout.png + :alt: Schematic of example 9-turbine wind farm layout, including low- and high-resolution domains and turbine locations. + :name: FF:FFarmLayout + :width: 100% + :align: center + + Schematic of example 9-turbine wind farm layout, including low- and + high-resolution domains and turbine locations. + +Inflow Wind Generation +---------------------- + +This section includes guidelines by which turbulent inflow should be +generated for use with FAST.Farm. + +High-Fidelity Precursor Ambient Inflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are many different methods by which high-fidelity precursor +ambient inflow can be generated. This section focuses on generating such +inflow using +`SOWFA `__. + +When using SOWFA to generate FAST.Farm precursor inflow, the *ABLSolver* +preprocessor is used. It is important to note the baseline high-fidelity +solution is not directly used as inflow for FAST.Farm, but is instead +sampled within a specified domain and discretization. This sampling is +done through SOWFA and specified in a SOWFA input file. The inflow data +are written out in 3D volume VTK-formatted files, as described in +:numref:`FF:AmbWindVTK`. These are large ASCII-formatted +files; as such, decreasing the precision to, e.g., 3 digits is +recommended. The domain size and low-resolution domain discretization +used for SOWFA simulations is much larger than what is required for +FAST.Farm simulations. Therefore, sampling files must be set up to +generate boundary conditions for use with FAST.Farm, based on FAST.Farm +discretization suggestions detailed in :numref:`FF:sec:DiscRecs`. +Two sampling files are needed: one for the low-resolution sampling for +the farm-scale domain and one for the high-resolution sampling for the +turbine-scale domains. Each sampling file defines the spatial and +temporal discretization that will be used in the FAST.Farm simulations. +The low-resolution domain file defines a single low-resolution domain +that will be used for the FAST.Farm simulations; the high-resolution +domain file defines each high-resolution domain that will be used for +the FAST.Farm simulations. Thus, it is important to know exactly where +all turbines will be located in the FAST.Farm simulation before +generating the inflow. Note that this FAST.Farm sampling step can be +computationally expensive. Therefore, it is recommended that users make +sure all inputs are correct before executing SOWFA, including turbine +locations and discretization levels. + +An example Python notebook is provided in the FAST.Farm `tools repository +`__ to +assist in setting up these files for a given FAST.Farm simulation. + +Complex Terrain +~~~~~~~~~~~~~~~ + +Complex terrain, or a time-varying sea-surface elevation for offshore +systems, can be modeled in FAST.Farm by providing ambient inflow data +that are terrain following, e.g., by modeling the surface boundary +condition in an LES precursor. The VTK format used by FAST.Farm is +spatially uniform. To accommodate complex terrain or waves with a +uniform grid, the wind speed for points below the terrain surface should +be set to NaN. Any NaN value will be trapped by FAST.Farm and marked as +outside of the domain, and so, unused by calculations within the AWAE +module. When the ambient wind inflow is terrain following, the wakes +will naturally follow the terrain as well, even though FAST.Farm does +not include any explicit models for complex terrain, flow recirculation +or separation, or local pressure gradients. + +If using a SOWFA inflow precursor, the complex terrain is accounted for +in the SOWFA inflow precursor generation, and so, no modification to the +*vtk* files is required to account for complex terrain when sampling for +a FAST.Farm simulation. + +.. _FF:sec:Synthetic: + +Synthetic Turbulence Ambient Inflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Synthetically generated turbulent inflow can be used in FAST.Farm to +accurately predict turbine response and wake dynamics across different +atmospheric conditions. There are several ways to achieve this; any +method can be used as long as it produces an output file in a format +supported by *InflowWind*. Modeling guidance for TurbSim and the Mann +model are discussed next. + +TurbSim +^^^^^^^ + +When using the NREL tool `TurbSim +v2 `__, +different options are available to drive the synthetic turbulence +towards specific desired outcomes, e.g.; + +#. standard or user-defined time-averaged wind profile (shear, veer); + +#. standard or user-defined velocity spectra in three directions (along + the wind, u, and transverse, v and w); + +#. standard or user-defined spatial point-to-point coherence; and + +#. standard or user-defined component-to-component correlations + (Reynolds stresses). + +Additionally, TurbSim v2 allows the user to generate turbulent wind that +is consistent with user-defined three-component wind time series at one +or more points (i.e., constrained wind). These options can be used +separately or in some combination (though user-defined spectra and +user-defined time series can not be used together). When defined +appropriately, all these methods can result in good statistical +comparison of turbine response and wake dynamics between FAST.Farm +results and a reference data set, e.g., compared with an LES precursor +or physically measured inflow. However, attention must be paid when +generating these inflows to ensure atmospheric conditions are modeled +properly. + +In particular, TurbSim generates wind velocities transversely throughout +the domain using u-, v-, and w-spatial-coherence models based on a +selection of coherence model equations and their associated parameters. +These models and parameters can either be specified explicitly or left +as *default* values in TurbSim. When the IEC spatial-coherence model is +selected, spatial coherence is computed using +Eq. :eq:`eq:IECCoh` (:cite:`ff-TurbSim_1`). + +.. math:: + Coh_{i,j_K}(f)=exp\left(-a_K\sqrt{\left(\frac{fr}{V_\text{Advect}}\right)^2+(rb_K)^2}~\right) + :label: eq:IECCoh + +where :math:`V_\text{Advect}` is the average wind speed at the hub height +specified in TurbSim, which is also the advection speed in *InflowWind*; +:math:`Coh_{i,j_K}` is the spatial coherence between points :math:`i` +and :math:`j` for the velocity components :math:`K=u,v,w`; :math:`r` is +the distance between points :math:`i` and :math:`j`; :math:`a_K` is the +coherence decrement parameter; and :math:`b_K` is the coherence offset +parameter. It was discovered in :cite:`ff-Shaler19_1` that the +use of the IEC coherence model with default coherence parameters +together with the IEC Kaimal spectra results in negligible wake +meandering. This is because the default v- and w-coherence parameters in +TurbSim are set such that :math:`a_K` are very large numbers and +:math:`b_K=0`, effectively resulting in no coherence +(:math:`Coh_{i,j_K}(f)=0`) (:cite:`ff-TurbSim_1`).  [1]_ This +lack of meandering is nonphysical and will have a nonphysical impact on +the response of downstream turbines. Instead of using the default +values, the v- and w-coherence parameters were specified +in :cite:`ff-Shaler19_1` to identically equal the u-coherence +parameters specified in the IEC standard, such that: +:math:`SCMod2=SCMod3=IEC`; :math:`a_K=12.0` and :math:`b_K=0.00035273` +m\ :math:`^{-1}`; and +:math:`CohExp=0.0`. (:cite:`ff-TurbSim_1`). Properly setting +spatial coherence parameters for the transverse wind velocity components +is necessary to accurately predict wake meandering. It is also important +to note that, in TurbSim, the :math:`a_K` and :math:`b_K` values must be +specified within quotation marks (e.g., ``"12.0 0.00035273"``) or, at +present, the values are set to :math:`0`. + +When using TurbSim to generate the full-field turbulent wind data for +FAST.Farm, one often wants the TurbSim grid to extend well above the hub +height to capture vertical wake meandering due to the :math:`w` +component of turbulence. Because TurbSim requires that +**HubHt**\ :math:`> 0.5*`\ **GridHeight**, it is often necessary to +specify an artificially high **HubHt** in TurbSim. To properly set the +**HubHt** parameter, the following equation is suggested: + +.. math:: + \textbf{HubHt} = z_\text{bot}+\textbf{GridHeight}-0.5D_\text{grid} + +where :math:`z_\text{bot}` is the desired bottom vertical location of +the grid (just above ground level) and +:math:`D_\text{grid}=MIN\left( \textbf{GridWidth}, \textbf{GridHeight}\right)`. +Note that the **HubHt** parameter is used by TurbSim as the reference +height for the wind speed used (:math:`V_\text{Advect}`) to define the +wind-speed standard deviations and spatial coherence in the IEC turbulence +models, as well as the advection speed (in *InflowWind*) for all models. Thus, +the resulting wind-speed standard deviations and spatial coherence in the IEC +turbulence models will not be what is expected without explicit consideration of +the difference in wind speeds between the **HubHt** used by TurbSim and the +actual turbine hub height. The advection speed (in *InflowWind*) will likely +also be faster than it would be when the actual hub height speed is used. A +separate reference height (**RefHt**) is specified in TurbSim, which is the +height at which, e.g., the reference wind speed is enforced. This value is also +used to properly set the power law velocity profile. Future work is needed to +`decouple the HubHt parameter from the TurbSim grid generation +`__. + +It is generally recommended that the full-field wind data files be +generated periodically. This effectively extends the wind domain forever +along the wind propagation direction. + +When using ambient wind through multiple instances of the *InflowWind* +module, i.e, when **Mod_AmbWind** = 3, only one *InflowWind* input file +is specified. However, multiple wind data files are used, each with a +different name. Specifically, the file name in the *InflowWind* input +file in this case refers only to the directory path of the wind files. +The wind file root names are required to be *Low* for the low-resolution +domain and *HighT* for the high-resolution domain +associated with turbine :math:`n_\text{t}`.  [2]_ When steady inflow in +*InflowWind* is used (**WindType** = 1), setting **Mod_AmbWind** to 2 or +3 produces identical results. When using full-field turbulent wind data +in *InflowWind* with **Mod_AmbWind** = 3, it is required that: + +- The full-field wind data files be generated periodically. This + effectively extends the wind domain forever along the wind + propagation direction. + +- The input parameter **PropagationDir** in the *InflowWind* input file + be set to :math:`0` degrees so that the wind propagates along the *X* + axis of the FAST.Farm inertial-frame coordinate system. + +- The wind data files associated with the high-resolution ambient wind + be spatially and temporally synchronized with the low-resolution wind + data file. The spatial synchronization must be based on the global + *X-Y-Z* offsets of each turbine origin relative to the origin of the + inertial frame coordinate system. For each wind turbine, the velocity + time series at the turbine location should be extracted from the + low-resolution TurbSim domain. To account for turbine downstream + distance, each time series should then be offset in time based on the + freestream velocity and turbine location. This time series should + then be used to generate the high-resolution TurbSim inflow for each + turbine. The TurbSim user’s manual contains details on how to + generate a TurbSim inflow using a specified time + series :cite:`ff-TurbSim_1`. + +Mann Model +^^^^^^^^^^ + +When generating stochastic turbulence with the Mann model, :math:`11` +user-defined inputs are required: **prefix**, **alpha_epsilon**, **L**, +**gamma**, **seed**, **nx**, **ny**, **nz**, **dx**, **dy**, and **dz**. +The parameters that should be selected in conjunction with FAST.Farm +parameters are discussed here. + +**dx**, **dy**, and **dz** -- These parameters should be selected based on +the high-resolution spatial discretization recommendations discussed +below in :numref:`FF:sec:DiscRecs`. + +**nx** -- This value is required to be a power of :math:`2`. To ensure no +repetition of the turbulence box for the duration of the simulation, the +following equation is recommended: + +.. only:: html + + .. math:: + \textbf{nx} = 2^{CEILING\big[log_2 + \left(\frac{V_\text{Advect}\textbf{T_Max}} + {\textbf{dx}}\right)\big]} + + +.. only:: not html + + .. math:: + \textbf{nx} = 2^{CEILING\big[log_2 + \left(\frac{V_\text{Advect}\textbf{T\_Max}} + {\textbf{dx}}\right)\big]} + + +where :math:`V_\text{Advect}` is the advection speed of the Mann box and +:math:`CEILING\big[x\big]` rounds :math:`x` to the next highest integer. This +equation ensures that the turbulence box will not repeat during the simulation +and also that the power of two criteria is satisfied. + +**ny** and **nz** -- These values are also required to be powers of +:math:`2`. With this requirement in mind, these values should be +selected to ensure the entire desired domain width (*Y*) and height +(*Z*) are captured, as discussed below in +:numref:`FF:sec:lowres`. + +The *InflowWind* input file has a specific section for using a Mann turbulence +box. This section requires the input of **nx**, **ny**, **nz**, **dx**, **dy**, +**dz**, **RefHt**, and **URef**. These values should be specified exactly as +those used to generate the inflow. Note that **dx**, **dy**, and **dz** +specified in *InflowWind* should be the same as **dX_High**, **dY_High**, and +**dZ_High** in FAST.Farm, respectively. **RefHt** should be defined as follows: + +.. math:: + \textbf{RefHt} = 0.5\textbf{dz}(\textbf{nz} - 1)+z_\text{bot} + +where **URef** is the mean wind speed at the reference height, and dictates the +advection speed of the Mann box, identified here as :math:`V_\text{Advect}`. + +When using a Mann box, it is important to know that **the x-axis +direction is opposite the convention used by InflowWind. Although the +interpretation in InflowWind (including OpenFAST and FAST.Farm) is +consistent with how Mann boxes are used in other aeroelastic software, +the interpretation is nonphysical**. If desired, the user can adjust the +FAST.Farm source code to read the x-axis in reverse. Correcting this +error universally across all aeroelastic software that use Mann boxes is +needed `future +work `__. + +.. _FF:sec:DiscRecs: + +Low- and High-Resolution Domain Discretization +---------------------------------------------- + +Spatial and temporal discretization can affect wake meandering, turbine +structural response, and resulting wake and load calculations. This +section summarizes recommendations for discretization values in terms of +geometry and wind speed that will ensure a converged solution, while +maximizing computational efficiency. For details on how these +recommendations were formed, see :cite:`ff-Shaler19_2`. Though +developed for FAST.Farm use, these guidelines are likely applicable to +any DWM-type model or aeroelastic analysis. + +Low-Resolution Domain +~~~~~~~~~~~~~~~~~~~~~ + +The low-resolution domain in FAST.Farm is primarily responsible for wake +meandering and merging. As such, convergence was assessed by comparing +trends in standard deviation of horizontal and vertical meandering wake +center positions for the wakes behind each turbine at various distances +downstream. It was found that the mean horizontal and vertical wake +trajectories have negligible dependence of **DT_Low** or **DS_Low**. The +following equation can be used to ensure convergence of wake meandering +in the low-resolution domain: + +.. only:: html + + .. math:: + \textbf{DT_Low} \le + \frac{C_\text{Meander}D^\text{Wake}}{10V_\text{Hub}} + + +.. only:: not html + + .. math:: + \textbf{DT\_Low} \le + \frac{C_\text{Meander}D^\text{Wake}}{10V_\text{Hub}} + + +This equation is based on the low-pass cutoff frequency for wake +meandering +:math:`\left(\frac{V_\text{Hub}}{C_\text{Meander}D^\text{Wake}}\right)` +from :cite:`ff-Larsen08_1` (in which +:math:`C_\text{Meander}=2`, but :math:`C_\text{Meander}` defaults to +:math:`1.9` in FAST.Farm) and effectively specifies that the highest +frequency of wake meandering should be resolved by at least :math:`10` +time steps. Note that :math:`D^\text{Wake}` can be approximated as +:math:`D^\text{Rotor}` in this calculation. + +Spatial discretization convergence was assessed in the same manner as +temporal discretization. Minimal sensitivity to spatial discretization +was found for the low-resolution domain in the range of spatial +discretizations considered. Nonetheless, the following equation is +recommended for identifying the maximum suggested **DS_Low**, where +:math:`S` refers to :math:`X`, :math:`Y`, or :math:`Z` and the +denominator has the units [m/s]: + +.. only:: html + + .. math:: + \textbf{DS_Low} \le + \frac{C_\text{Meander}D^\text{Wake}V_\text{Hub}}{150 m/s} + = \frac{\textbf{DT_Low}V_\text{Hub}^2}{15 m/s} + + +.. only:: not html + + .. math:: + \textbf{DS\_Low} \le + \frac{C_\text{Meander}D^\text{Wake}V_\text{Hub}}{150 m/s} + = \frac{\textbf{DT\_Low}V_\text{Hub}^2}{15 m/s} + + +For all synthetic turbulence methods, it is recommended that +**DX_Low**\ :math:`= V_\text{Advect}`\ **DT_Low** to avoid interpolating in +X-direction. Note the use of the advection speed, :math:`V_\text{Advect}`, to +calculate **DX_Low**, rather than the actual hub-height wind speed, +:math:`V_\text{Hub}`. Additionally, **X0_Low** should be an integer multiple of +**DX_Low**. + +High-Resolution Domain +~~~~~~~~~~~~~~~~~~~~~~ + +The high-resolution wind domain in FAST.Farm is primarily responsible +for ambient and waked inflow local to a turbine. As such, convergence +was assessed by comparing trends in mean and standard deviation of +turbine structural motions and loads for each turbine. + +.. only:: html + + Required discretization levels vary depending on the quantity of + interest. Thus, it is important to decide what structural components + will be considered when selecting a high-resolution discretization + level. Most notably, tower-base moments are the most sensitive to + **DT_High**, whereas generator power and blade deflections and moments + show little dependence on this value. To capture the full structural + response, **DT_High** should be selected based on the highest + frequencies influencing the structural excitation, including rotational + sampling of turbulence and response, i.e., natural frequencies, of the + pertinent structural components, :math:`f_\text{max}` (in Hz), as in + Equation :eq:`eq:dtHigh:a`, where the factor of :math:`2` is taken + from the Nyquist sampling theorem. This is a frequently used rule of + thumb in wind turbine aeroelastic analysis under excitation from + turbulent inflow. + + + .. math:: + \textbf{DT_High} \le \frac{1}{2f_\text{max}} + :label: eq:dtHigh:a + + The required **DS_High** approximately corresponds to the maximum blade + chord length of the turbine, :math:`c_\text{max}`, as in + Equation :eq:`eq:dsHigh:a`. Selecting a **DS_High** equivalent to + this value has long been a rule-of-thumb in wind turbine aeroelastic + analysis under excitation from turbulent inflow. + + .. math:: + \textbf{DS_High} \le c_\text{max} + :label: eq:dsHigh:a + + +.. only:: not html + + Required discretization levels vary depending on the quantity of + interest. Thus, it is important to decide what structural components + will be considered when selecting a high-resolution discretization + level. Most notably, tower-base moments are the most sensitive to + **DT_High**, whereas generator power and blade deflections and moments + show little dependence on this value. To capture the full structural + response, **DT_High** should be selected based on the highest + frequencies influencing the structural excitation, including rotational + sampling of turbulence and response, i.e., natural frequencies, of the + pertinent structural components, :math:`f_\text{max}` (in Hz), as in + Equation :eq:`eq:dtHigh:b`, where the factor of :math:`2` is taken + from the Nyquist sampling theorem. This is a frequently used rule of + thumb in wind turbine aeroelastic analysis under excitation from + turbulent inflow. + + .. math:: + \textbf{DT\_High} \le \frac{1}{2f_\text{max}} + :label: eq:dtHigh:b + + The required **DS_High** approximately corresponds to the maximum blade + chord length of the turbine, :math:`c_\text{max}`, as in + Equation :eq:`eq:dsHigh:b`. Selecting a **DS_High** equivalent to + this value has long been a rule-of-thumb in wind turbine aeroelastic + analysis under excitation from turbulent inflow. + + .. math:: + \textbf{DS\_High} \le c_\text{max} + :label: eq:dsHigh:b + + +.. _FF:sec:paramselect: + +Parameter Selection +------------------- + +Setting up a FAST.Farm simulation can involve specifying a large number +of parameters, especially if the *InflowWind* module is used for the +ambient wind. This section summarizes best practices for selecting some +of these parameters. References are made to desired versus realized +values. The discrepancies between these values are discussed in +:numref:`FF:sec:setup`. + +InflowWind Domain Parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Care must be taken when setting up a FAST.Farm simulation using the *InflowWind* +ambient wind inflow option. It is highly recommended that the distributed +`Python notebooks +`__ be +used when setting up a new case. Improperly setting these parameters can lead to +common errors and/or excessive interpolation, which should be avoided. The +methods and rules of thumb that are used in those Python notebooks are also +discussed here. + +.. _FF:sec:lowres: + +Low-Resolution Domain +^^^^^^^^^^^^^^^^^^^^^ + +**NX_Low**, **NY_Low**, **NZ_Low** -- These quantities should be based on +**DS_Low** and the desired domain size (*Sdist_Low*), where *S*\ =\ *X*, +*Y* or *Z*. This integer quantity should be computed as: + +.. only:: html + + .. math:: + \textbf{NS_Low} = CEILING\left( + \frac{{Sdist\_Low}}{\textbf{DS_Low}}\right)+1 + + +.. only:: not html + + .. math:: + \textbf{NS\_Low} = CEILING\left( + \frac{{Sdist\_Low}}{\textbf{DS\_Low}}\right)+1 + + +**X0_Low** -- This quantity must be less than the *X* location of the +furthest upstream turbine. It is recommended to set this value further +upstream to allow for analysis of the ambient inflow. If using a Mann +box, this value should be 0. + +**Y0_Low** -- This quantity must be less than the lowest *Y* location of +any turbine (**WT_Y_**). Additional clearance is required to +accommodate wake meandering, wake deflection, and spatial averaging used +in the *AWAE* module. This value may be computed as: + +.. only:: html + + .. math:: + \textbf{Y0_Low} \le \textbf{WT_Y_min}-3D^\text{Rotor} + + +.. only:: not html + + .. math:: + \textbf{Y0\_Low} \le \textbf{WT\_Y\_min}-3D^\text{Rotor} + + +Additional clearance should be allowed for appreciable wake meandering +and/or yaw. For **Mod_AmbWind** = 2, the synthetic inflow data are +centered around Y=0. Because of this, **Y0_Low** should equal +-*Ydist_Low*/2. This is the same for the low-resolution domain with +**Mod_AmbWind** = 3. + +**Z0_Low** -- It is recommended that this value be set close to but above +ground level. When using TurbSim, this value can not be at or below +ground level because TurbSim cannot generate wind at these locations. + +**DX_Low**, **DY_Low**, **DZ_Low** -- Desired spatial values are not +discussed here, as they are covered in detail in +:numref:`FF:sec:DiscRecs`. However, the actual quantities used +might differ from the desired values when using synthetic inflow, as +discussed in :numref:`FF:sec:Synthetic`. To determine the actual +quantity, the following equation is suggested when using synthetic +inflow: + +.. only:: html + + .. math:: + \textbf{DS_Low} = FLOOR\left( \frac{{DS\_Low\_Desired}} + {\textbf{DS_High}} \right)*\textbf{DS_High} + + +.. only:: not html + + .. math:: + \textbf{DS\_Low} = FLOOR\left( \frac{{DS\_Low\_Desired}} + {\textbf{DS\_High}} \right)*\textbf{DS\_High} + + +Use of this equation is the best way to ensure that **DS_Low** will be a +multiple integer of **DS_High**, reducing interpolation smoothing. + +.. _FF:high-resolution-domain-1: + +High-Resolution Domain +^^^^^^^^^^^^^^^^^^^^^^ + +*Xdist_High*, *Ydist_High*, *Zdist_High* -- Though not direct inputs, these +lengths, widths, and heights of the high-resolution domains should be +selected based on the size and location of the turbines. The following +values are recommended: + +.. only:: html + + .. math:: + \textbf{Xdist_High} = \textbf{Ydist_High} + = \textbf{Zdist_High} \ge 1.1 D^\text{Rotor} + + +.. only:: nohtml + + .. math:: + \textbf{Xdist\_High} = \textbf{Ydist\_High} + = \textbf{Zdist\_High} \ge 1.1 D^\text{Rotor} + + +If tower aerodynamic loads are desired, the high-resolution domain +should span the entire tower and rotor: + +.. only:: html + + .. math:: + \textbf{Zdist_High} = \textbf{HubHt} + + \frac{1.1\ D^\text{Rotor}}{2} + + +.. only:: not html + + .. math:: + \textbf{Zdist\_High} = \textbf{HubHt} + + \frac{1.1\ D^\text{Rotor}}{2} + + +These parameters might need to be increased to account for large +structural motion, such as for floating offshore wind applications. + +**NX_High**, **NY_High**, **NZ_High** -- These quantities should be based +on **DS_High** and the desired domain size (*Sdist_High*), where +*S*\ =\ *X*, *Y*, or *Z*. This integer quantity should be computed as: + +.. only:: html + + .. math:: + \textbf{NS_High} = \text{CEILING}\left( + \frac{{Sdist\_High}}{\textbf{DS_High}}\right)+1 + + +.. only:: nohtml + + .. math:: + \textbf{NS\_High} = \text{CEILING}\left( + \frac{\textbf{Sdist\_High}}{\textbf{DS\_High}}\right)+1 + + +**X0_High**, **Y0_High**, **Z0_High** -- These quantities are set for each +turbine. They should be based on turbine location and set so that the +turbine is contained inside the high-resolution domain. It is +recommended that **X0_High** and **Y0_High** are set approximately +:math:`1.1D^\text{Rotor}/2` lower than the turbine location. For the +high-resolution domains with **Mod_AmbWind** = 3, the synthetic inflow +data are centered around each turbine, based on **WT_X/Y/Z**. + +**DX_High**, **DY_High**, **DZ_High** -- Desired spatial values are not +discussed here, as they are covered in detail in +:numref:`FF:sec:DiscRecs`. + +.. _FF:wake-dynamics-parameters: + + +Wake Dynamics Parameters +~~~~~~~~~~~~~~~~~~~~~~~~ + +Wake dynamics parameters define the axisymmetric finite-difference grid +used for each wake plane. These planes are defined by the following +parameters: + +- **dr** -- This value should be set so that FAST.Farm sufficiently + resolves the wake deficit within each plane. The following value is + suggested: + + .. math:: + \textbf{dr} \le c_\text{max} + +- **NumRadii** -- To ensure the wake deficits are accurately computed by + FAST.Farm, **NumRadii** should be set so that the diameter of each + wake plane, 2(**NumRadii**\ -1)\ **dr**, is large relative to the rotor + diameter. The following value is suggested: + + .. math:: + \textbf{NumRadii} \ge \frac{3D^{Rotor}}{2\ \textbf{dr}}+1 + +- **NumPlanes** -- To ensure the wake deficits are accurately captured by + FAST.Farm, **NumPlanes** should be set so that the wake planes + propagate a sufficient distance downstream, preferably until the wake + deficit decays away (:math:`x_\text{dist}`), with typical values + between :math:`10-20\times D^{Rotor}`. The following value is + suggested: + + .. only:: html + + .. math:: + \textbf{NumPlanes} \ge \frac{x_\text{dist}} + {\textbf{DT_Low}\overline{V}} + + + .. only:: not html + + .. math:: + \textbf{NumPlanes} \ge \frac{x_\text{dist}} + {\textbf{DT\_Low}\overline{V}} + + + where :math:`\overline{V}` is the average convection speed of the + wake, which can be approximated as + + .. math:: + \overline{V} = V_\text{Hub}\left( 1-\frac{\overline{a}}{2}\right) + + where :math:`\overline{a}` is the time- and spatial-temporal-average + of the axial induction at the rotor disk. :math:`\overline{a}` is + expected to be around :math:`1/3` below rated wind speed (for optimal + aerodynamic efficiency) and decreases above rated wind speed to near + zero before the cut-out wind speed. + + + +.. only:: html + + Note that because new wake planes are added each time step as the + simulation begins, increasing **NumPlanes** will also increase the + initial transient time of the simulation. The start-up transient time is + estimated by Equation :eq:`eq:startup:a`. + + .. math:: + t_\text{startup}=\textbf{DT_Low}(\textbf{NumPlanes}-2) + :label: eq:startup:a + + +.. only:: not html + + Note that because new wake planes are added each time step as the + simulation begins, increasing **NumPlanes** will also increase the + initial transient time of the simulation. The start-up transient time is + estimated by Equation :eq:`eq:startup:b`. + + .. math:: + t_\text{startup}=\textbf{DT\_Low}(\textbf{NumPlanes}-2) + :label: eq:startup:b + + +- **Mod_WakeDiam** -- A value of **1** is recommended. For further details + on the options for this parameter, see Equation :eq:`eq:DWake`. + +- **Mod_Meander** -- A value of **3** is recommended. For further details + on the options for this parameter, see Equation :eq:`eq:wn`. + +The remaining :math:`20` inputs are user-specified calibration +parameters and options that influence the wake-dynamics calculations. +The parameters may depend, e.g., on turbine operation or atmospheric +conditions that can be calibrated to better match experimental data or +by using an HFM benchmark. Default values have been derived for each +calibrated parameter based on `SOWFA `__ +simulations for the NREL 5MW turbine +( :cite:`ff-Doubrawa18_1`), but these can be overwritten by the +user. + +.. _FF:sec:SupCon: + +Super Controller +---------------- + +When **UseSC** is set to TRUE, the super controller is enabled. The +super controller code must be compiled as a dynamic library file -- a +*.dll* file in Windows or a *.so* file in Linux or Mac OS. This super +controller dynamic library is essentially identical to the super +controller available in `SOWFA `__. The +super controller is used in conjunction with individual wind turbine +controllers defined in the style of the DISCON dynamic library of the +DNV GL’s Bladed wind turbine software package, with minor modification. + +The inputs to the super controller are commands or measurements from +individual turbine controllers. [3]_ The outputs of super controller +module are the global controller commands and individual turbine +controller commands. + +The super controller dynamic library must be compiled with five +procedures, whose arguments are outlined in :numref:`FF:tab:SC_DLL`. + + +.. table:: Arguments for Each Procedure of the Super Controller Dynamic Library + :name: FF:tab:SC_DLL + + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + | **Procedure** | **Inputs** | **Outputs** | **Comments** | + +=====================+===================================================+===================================================+=============================================================+ + | ``sc_init`` | - ``nTurbines`` | - ``nInpGlobal`` | - Set numbers of inputs, outputs, states, and parameters | + | | | - ``NumCtrl2SC`` | - ``nInpGlobal`` must currently be set to zero in FAST.Farm | + | | | - ``NumParamGlobal`` | | + | | | - ``NumParamTurbine`` | | + | | | - ``NumStatesGlobal`` | | + | | | - ``NumStatesTurbine`` | | + | | | - ``NumSC2CtrlGlob`` | | + | | | - ``NumSC2Ctrl`` | | + | | | - ``errStat`` | | + | | | - ``errMsg`` | | + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + | ``sc_getinitData`` | - ``nTurbines`` | - ``ParamGlobal(1:NumParamGlobal)`` | - Set parameters | + | | - ``NumParamGlobal`` | - ``ParamTurbine(1:NumParamTurbine*nTurbines)`` | - Initialize states at time zero | + | | - ``Num ParamTurbine`` | - ``from_SCglob(1:NumSC2CtrlGlob)`` | - Initial outputs are not currently used by FAST.Farm | + | | - ``NumSC2CtrlGlob`` | - ``from_SC(1:NumSC2Ctrl*nTurbines)`` | | + | | - ``NumSC2Ctrl`` | - ``from_SCglob(1:NumSC2CtrlGlob)`` | | + | | - ``NumStatesGlobal`` | - ``from_SC(1:NumSC2Ctrl*nTurbines)`` | | + | | - ``NumStatesTurbine`` | - ``StatesGlob(1:NumStatesGlobal)`` | | + | | | - ``StatesTurbine(1:NumStatesTurbine*nTurbines)`` | | + | | | - ``errStat`` | | + | | | - ``errMsg`` | | + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + | ``sc_calcOutputs`` | - ``nTurbines`` | - ``from_SCglob(1:NumSC2CtrlGlob)`` | - Calculate outputs at the current time step | + | | - ``NumParamGlobal`` | - ``from_SC(1:NumSC2Ctrl*nTurbines)`` | - ``nInpGlobal`` is currently zero in FAST.Farm | + | | - ``ParamGlobal(1:NumParamGlobal)`` | - ``errStat`` | - ``to_SCglob`` is currently null in FAST.Farm | + | | - ``NumParamTurbine`` | - ``errMsg`` | | + | | - ``ParamTurbine(1:NumParamTurbine*nTurbines)`` | | | + | | - ``nInpGlobal`` | | | + | | - ``to_SCglob(1:nInpGlobal)`` | | | + | | - ``NumCtrl2SC`` | | | + | | - ``to_ SC(1:NumCtrl2SC*nTurbines)`` | | | + | | - ``NumStatesGlobal`` | | | + | | - ``StatesGlob(1:NumStatesGlobal)`` | | | + | | - ``NumStatesTurbine`` | | | + | | - ``StatesTurbine(1:NumStatesTurbine*nTurbines)`` | | | + | | - ``NumSC2CtrlGlob`` | | | + | | - ``NumSC2Ctrl`` | | | + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + | ``sc_updateStates`` | - ``nTurbines`` | - ``StatesGlob(1:NumStatesGlobal)`` | - Update states from one time step to the next | + | | - ``NumParamGlobal`` | - ``StatesTurbine(1:NumStatesTurbine*nTurbines)`` | - ``nInpGlobal`` Is currently zero in FAST.Farm | + | | - ``ParamGlobal(1:NumParamGlobal)`` | - ``errStat`` | - ``to_SCglob`` Is currently null in FAST.Farm | + | | - ``NumParamTurbine`` | - ``errMsg`` | | + | | - ``ParamTurbine(1:NumParamTurbine*nTurbines)`` | | | + | | - ``nInpGlobal`` | | | + | | - ``to_SCglob(1:nInpGlobal)`` | | | + | | - ``NumCtrl2SC`` | | | + | | - ``to_SC(1:NumCtrl2SC*nTurbines)`` | | | + | | - ``NumStatesGlobal`` | | | + | | - ``NumStatesTurbine`` | | | + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + | ``sc_end`` | | - ``errStat`` | - Release memory | + | | | - ``errMsg`` | - Close files | + +---------------------+---------------------------------------------------+---------------------------------------------------+-------------------------------------------------------------+ + + +To interact with the super controller, the individual turbine +controllers within each instance of OpenFAST must also be compiled as a +dynamic library. The single procedure, ``DISCON``, is unchanged from the +standard ``DISCON`` interface for the Bladed wind turbine software +package, as defined by DNV GL, but with three extra arguments, as +outlined in :numref:`FF:tab:DISCON`. + +.. table:: Arguments of the ``DISCON`` Procedure for Individual Turbine Controller Dynamic Library, Updated for the Super Controller + :name: FF:tab:DISCON + + +---------------+--------------------------------------+---------------------------+--------------------------------+ + | **Procedure** | **Inputs** | **Outputs** | **Comments** | + +===============+======================================+===========================+================================+ + | ``DISCON`` | - ``avrSWAP(*)`` | - ``avrSWAP(*)`` | - New inputs: ``from_SCglob`` | + | | - ``from_SCglob(1:NumSC2CtrlGlob)`` | - ``to_SC(1:NumCtrl2SC)`` | and ``from_SC`` | + | | - ``from_SC(1:NumSC2Ctrl)`` | - ``aviFAIL`` | - New output: ``to_SC`` | + | | - ``accInFILE`` | - ``avcMSG`` | | + | | - ``avcOUTNAME`` | | | + +---------------+--------------------------------------+---------------------------+--------------------------------+ + + +Note that at time zero, the super controller output calculation +(``sc_calcOutputs``) is called before the call to the individual turbine +controllers (``DISCON``). So, the initial outputs from the super +controller (``from_SC``, ``from_SCglob``) are sent as inputs to the +individual turbine controllers, but the initial inputs to the super +controller from the individual turbine controller outputs (``to_SC``) at +time zero are always zero. At subsequent time steps, the individual +turbine controllers (``DISCON``) are called before the output +calculation of the super controller (``sc_calcOutputs``). As a result, +at each time step other than time zero, the outputs from the super +controller (``from_SC``, ``from_SCglob``) are extrapolated in time based +on past values within *OF* before being sent as input to the individual +turbine controllers. Thus, care should be taken to ensure that the +outputs from the super controller (``from_SC``, ``from_SCglob``) vary +smoothly over time (without steps). See +Figure :numref:`FF:Parallel` for more information. + +Commonly Encountered Errors +--------------------------- + +This section covers errors that have been commonly encountered by users +during the development, verification, and use of FAST.Farm. Submit any +additional errors or questions to the `NWTC +forum `__. + +InflowWind Errors +~~~~~~~~~~~~~~~~~ + +*InflowWind* errors tend to be related to improperly setting the high- +or low-resolution domain sizes. Two such common errors are detailed +here. + +Turbine Leaving the Domain +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following error is commonly encountered: + +:: + + T::FAST_Solution0:CalcOutputs_And_SolveForInputs: + SolveOption2:InflowWind_CalcOutput:CalcOutput:IfW_4Dext_CalcOutput + [position=(-1.8753, 0, 32.183) in wind-file coordinates]:Interp4D:Outside + the grid bounds. + +This error occurs when a turbine leaves the specified high-resolution +domain. This typically happens through improper domain specification or +large blade deflections/structural motions. Note that coordinates in +this error are in the local frame of reference of the turbine and are +case dependent. + +If the cause is improper domain specification, the error will trigger in +the initialization stage of the simulation (*=FARM_InitialCO:FWrap_t0*). In this case, a review of the primary +FAST.Farm input file is suggested. In particular, the values of +**NX_High**, **NY_High**, **NZ_High**, **X0_High**, **Y0_High**, +**Z0_High**, **dX_High**, **dY_High**, and **dZ_High**, as these +parameters define the size and location of the high-resolution domain. +Note that the error specifies which turbine (T<*n*\ :math:`_t`\>) the +error has occurred for, which will aid in debugging where the error is. + +If the cause is large blade deflection or structural motion, the error +will trigger at some point during the simulation (*=FARM_UpdateStates:FWrap_t0*). In this case, increasing the overall +size of the high-resolution domain could alleviate this problem. +However, the user should first confirm that such large +deflections/motions are expected and realistic and not due to a turbine +modeling error. + +Undefined Location +^^^^^^^^^^^^^^^^^^ + +The following error is commonly encountered: + +:: + + Farm_Initialize:InflowWind_CalcOutput:CalcOutput:IfW_TSFFWind_CalcOutput + [position=(5, 565, 5) in wind-file coordinates]: FF wind array boundaries + violated: Grid too small in Y direction. Y=565; Y boundaries = + [-555, 555] + +This error occurs when FAST.Farm tries to access a point in the +low-resolution domain that is not contained in the ambient wind file. +Note that coordinates in this error are in the global frame of reference +and are case dependent. For this error, a review of the primary +FAST.Farm input file is suggested. In particular, the values of +**NX_Low**, **NY_Low**, **NZ_Low**, **X0_Low**, **Y0_Low**, **Z0_Low**, +**dX_Low**, **dY_Low**, and **dZ_Low**, as these parameters define the +size and location of the low-resolution domain. The error specifies +along which axis the error has occurred, aiding in debugging. + +.. [1] + TurbSim effectively neglects the spatial v- and w-coherence in the + default IEC case because these are not prescribed by the IEC design + standards. + +.. [2] + When HAWC format is used (**WindType** = 5), `_u`, + `_v`, `_w` must be appended to the file names. + +.. [3] + The super controller also has as input a placeholder for future + global (e.g., wind) measurements in addition to commands or + measurements from the individual turbine controllers. But the global + inputs are currently null. + + diff --git a/docs/source/user/fast.farm/Nomenclature.rst b/docs/source/user/fast.farm/Nomenclature.rst new file mode 100644 index 0000000000..abd6d94be3 --- /dev/null +++ b/docs/source/user/fast.farm/Nomenclature.rst @@ -0,0 +1,292 @@ +.. _FF:Nomenclature: + +Nomenclature +============ + +.. container:: + :name: Tab:FF:Nomenclature + + .. table:: List of Available FAST.Farm Output Channels + + ================= ================== + |eqs_ABLSolver| |txt_ABLSolver| + |eqs_AWAE| |txt_AWAE| + |eqs_ar| |txt_ar| + |eqs_ak| |txt_ak| + |eqs_BEM| |txt_BEM| + |eqs_bK| |txt_bK| + |eqs_cOWk| |txt_cOWk| + |eqs_cmax| |txt_cmax| + |eqs_cmeander| |txt_cmeander| + |eqs_cnearwake| |txt_cnearwake| + |eqs_cWakeDiam| |txt_cWakeDiam| + |eqs_cDMaxAmb| |txt_cDMaxAmb| + |eqs_CDMaxShr| |txt_CDMaxShr| + |eqs_Ctr| |txt_Ctr| + |eqs_Cohij| |txt_Cohij| + |eqs_DLL| |txt_DLL| + |eqs_DWM| |txt_DWM| + |eqs_DGrid| |txt_DGrid| + |eqs_DRotor| |txt_DRotor| + |eqs_DnpWake| |txt_DnpWake| + |eqs_FLORIS| |txt_FLORIS| + |eqs_f| |txt_f| + |eqs_fc| |txt_fc| + |eqs_fnbr| |txt_fnbr| + |eqs_fmax| |txt_fmax| + |eqs_FAmb| |txt_FAmb| + |eqs_FShr| |txt_FShr| + |eqs_HFM| |txt_HFM| + |eqs_HPC| |txt_HPC| + |eqs_I| |txt_I| + |eqs_K| |txt_K| + |eqs_kAmb| |txt_kAmb| + |eqs_kShr| |txt_kShr| + |eqs_LES| |txt_LES| + |eqs_MFoR| |txt_MFoR| + |eqs_MPI| |txt_MPI| + |eqs_NaN| |txt_NaN| + |eqs_NREL| |txt_NREL| + |eqs_N| |txt_N| + |eqs_Nb| |txt_Nb| + |eqs_Nnp| |txt_Nnp| + |eqs_NWake| |txt_NWake| + |eqs_NP| |txt_NP| + |eqs_Nr| |txt_Nr| + |eqs_Nt| |txt_Nt| + |eqs_OF| |txt_OF| + |eqs_OpenMP| |txt_OpenMP| + |eqs_pHub| |txt_pHub| + |eqs_pPlane| |txt_pPlane| + |eqs_RAM| |txt_RAM| + |eqs_RSS| |txt_RSS| + |eqs_r| |txt_r| + |eqs_rPlane| |txt_rPlane| + |eqs_S| |txt_S| + |eqs_SC| |txt_SC| + |eqs_SOWFA| |txt_SOWFA| + |eqs_t| |txt_t| + |eqs_TIAmb| |txt_TIAmb| + |eqs_ud| |txt_ud| + |eqs_Vadvect| |txt_Vadvect| + |eqs_VAmbHigh| |txt_VAmbHigh| + |eqs_VAmbLow| |txt_VAmbLow| + |eqs_VDistHigh| |txt_VDistHigh| + |eqs_VDistLow| |txt_VDistLow| + |eqs_VHub| |txt_VHub| + |eqs_Vnp| |txt_Vnp| + |eqs_Vr| |txt_Vr| + |eqs_Vrnp| |txt_Vrnp| + |eqs_VTK| |txt_VTK| + |eqs_VxRel| |txt_VxRel| + |eqs_Vx| |txt_Vx| + |eqs_VxnpWake| |txt_VxnpWake| + |eqs_DiskAvgVx| |txt_DiskAvgVx| + |eqs_wnWind| |txt_wnWind| + |eqs_WD| |txt_WD| + |eqs_WISDEM| |txt_WISDEM| + |eqs_xxnp| |txt_xxnp| + |eqs_XYZ| |txt_XYZ| + |eqs_hatXYZ| |txt_hatXYZ| + |eqs_xd| |txt_xd| + |eqs_Xd| |txt_Xd| + |eqs_hatxDisk| |txt_hatxDisk| + |eqs_hatxnpPlane| |txt_hatxnpPlane| + |eqs_yd| |txt_yd| + |eqs_Yd| |txt_Yd| + |eqs_zbot| |txt_zbot| + |eqs_alpha| |txt_alpha| + |eqs_DeltaT| |txt_DeltaT| + |eqs_YawErr| |txt_YawErr| + |eqs_nuT| |txt_nuT| + |eqs_rho| |txt_rho| + |eqs_TwoD| |txt_TwoD| + |eqs_ThreeD| |txt_ThreeD| + ================= ================== + +.. |eqs_ABLSolver| replace:: ABLSolver +.. |txt_ABLSolver| replace:: atmospheric boundary layer solver +.. |eqs_AWAE| replace:: AWAE +.. |txt_AWAE| replace:: ambient wind and array effects (module) +.. |eqs_ar| replace:: :math:`a(r)` +.. |txt_ar| replace:: axial induction factor, distributed radially +.. |eqs_ak| replace:: :math:`a_K` +.. |txt_ak| replace:: coherence decrement parameter +.. |eqs_BEM| replace:: BEM +.. |txt_BEM| replace:: blade-element momentum +.. |eqs_bK| replace:: :math:`b_K` +.. |txt_bK| replace:: coherence offset parameter +.. |eqs_cOWk| replace:: :math:`C^\text{O}_\text{HWkDfl}`, :math:`C^\text{OY}_\text{HWkDfl}`, :math:`C^\text{x}_\text{HWkDfl}`, and :math:`C^\text{xY}_\text{HWkDfl}` +.. |txt_cOWk| replace:: calibrated parameters in the horizontal wake-deflection correction +.. |eqs_cmax| replace:: :math:`c_\text{max}` +.. |txt_cmax| replace:: maximum blade chord length +.. |eqs_cmeander| replace:: :math:`C_\text{Meander}` +.. |txt_cmeander| replace:: calibrated parameter for wake meandering +.. |eqs_cnearwake| replace:: :math:`C_\text{NearWake}` +.. |txt_cnearwake| replace:: calibrated parameter in the near-wake correction +.. |eqs_cWakeDiam| replace:: :math:`C_\text{WakeDiam}` +.. |txt_cWakeDiam| replace:: calibrated parameter in the wake-diameter calculation +.. |eqs_cDMaxAmb| replace:: :math:`C^\text{DMax}_{\nu \text{Amb}}`, :math:`C^\text{DMin}_{\nu \text{Amb}}`, :math:`C^\text{Exp}_{\nu Amb}`, and :math:`C^\text{FMin}_{\nu Amb}` +.. |txt_cDMaxAmb| replace:: calibrated parameters in the eddy-viscosity filter function for ambient turbulence +.. |eqs_CDMaxShr| replace:: :math:`C^\text{DMax}_{\nu \text{Shr}}`, :math:`C^\text{DMin}_{\nu \text{Shr}}`, :math:`C^\text{Exp}_{\nu \text{Shr}}`, and :math:`C^\text{FMin}_{\nu \text{Shr}}` +.. |txt_CDMaxShr| replace:: calibrated parameters in the eddy-viscosity filter function for the wake shear layer +.. |eqs_Ctr| replace:: :math:`^\text{AzimAvg}C_t(r)` and :math:`^\text{FiltAzimAvg}C_t(r)` +.. |txt_Ctr| replace:: azimuthally averaged thrust-force coefficient (normal to a rotor disk), distributed radially, and its low-pass time-filtered value +.. |eqs_Cohij| replace:: :math:`Coh_{i,j}` +.. |txt_Cohij| replace:: magnitude of partial coherence between points :math:`i` and :math:`j` +.. |eqs_DLL| replace:: DLL +.. |txt_DLL| replace:: dynamic-link library +.. |eqs_DWM| replace:: DWM +.. |txt_DWM| replace:: dynamic wake meandering +.. |eqs_DGrid| replace:: :math:`D_\text{Grid}` +.. |txt_DGrid| replace:: Assumed rotor diameter when generating TurbSim inflow +.. |eqs_DRotor| replace:: :math:`D^\text{Rotor}` and :math:`^\text{Filt}D_{n_p}^\text{Rotor}` +.. |txt_DRotor| replace:: rotor diameter and its low-pass time-filtered value at wake plane :math:`n_p` +.. |eqs_DnpWake| replace:: :math:`D_{n_p}^\text{Wake}` +.. |txt_DnpWake| replace:: wake diameter at wake plane :math:`n_p` +.. |eqs_FLORIS| replace:: FLORIS +.. |txt_FLORIS| replace:: FLOw Redirection and Induction in Steady state +.. |eqs_f| replace:: :math:`f` +.. |txt_f| replace:: frequency +.. |eqs_fc| replace:: :math:`f_c` +.. |txt_fc| replace:: cutoff (corner) frequency of the low-pass time filter +.. |eqs_fnbr| replace:: :math:`\vec{f}_{n_b}(r)` +.. |txt_fnbr| replace:: aerodynamic applied loads distributed radially per unit length for blade :math:`n_b` +.. |eqs_fmax| replace:: :math:`f_\text{max}` +.. |txt_fmax| replace:: maximum excitation frequency +.. |eqs_FAmb| replace:: :math:`F_{\nu \text{Amb}}(x)` +.. |txt_FAmb| replace:: eddy-viscosity filter function associated with ambient turbulence +.. |eqs_FShr| replace:: :math:`F_{\nu \text{Shr}}(x)` +.. |txt_FShr| replace:: eddy-viscosity filter function associated with the wake shear layer +.. |eqs_HFM| replace:: HFM +.. |txt_HFM| replace:: high-fidelity modeling +.. |eqs_HPC| replace:: HPC +.. |txt_HPC| replace:: high-performance computer +.. |eqs_I| replace:: :math:`I` +.. |txt_I| replace:: three-by-three identify matrix +.. |eqs_K| replace:: :math:`K` +.. |txt_K| replace:: velocity components :math:`u`, :math:`v`, and :math:`w` +.. |eqs_kAmb| replace:: :math:`k_{\nu \text{Amb}}` +.. |txt_kAmb| replace:: calibrated parameter for the influence of ambient turbulence in the eddy viscosity +.. |eqs_kShr| replace:: :math:`k_{\nu \text{Shr}}` +.. |txt_kShr| replace:: calibrated parameter for the influence of the wake shear layer in the eddy viscosity +.. |eqs_LES| replace:: LES +.. |txt_LES| replace:: large-eddy simulation +.. |eqs_MFoR| replace:: MFoR +.. |txt_MFoR| replace:: moving frame of reference +.. |eqs_MPI| replace:: MPI +.. |txt_MPI| replace:: message-passing interface +.. |eqs_NaN| replace:: NaN +.. |txt_NaN| replace:: not a number +.. |eqs_NREL| replace:: NREL +.. |txt_NREL| replace:: National Renewable Energy Laboratory +.. |eqs_N| replace:: :math:`N` and :math:`n` +.. |txt_N| replace:: number of discrete-time steps and discrete-time-step counter +.. |eqs_Nb| replace:: :math:`N_b` and :math:`n_b` +.. |txt_Nb| replace:: number of rotor blades and blade counter +.. |eqs_Nnp| replace:: :math:`N_{n_p}^\text{Polar}` and :math:`n^\text{Polar}` +.. |txt_Nnp| replace:: number of points in the polar grid of wake plane :math:`n_p` and point counter +.. |eqs_NWake| replace:: :math:`N^\text{Wake}` and :math:`n^\text{Wake}` +.. |txt_NWake| replace:: number of wakes overlapping a given wind data point in the wind domain and wake counter +.. |eqs_NP| replace:: :math:`N_P` and :math:`n_P` +.. |txt_NP| replace:: number of wake planes and wake-plane counter +.. |eqs_Nr| replace:: :math:`N_r` and :math:`n_r` +.. |txt_Nr| replace:: number of radial nodes and radii counter +.. |eqs_Nt| replace:: :math:`N_t` and :math:`n_t` +.. |txt_Nt| replace:: number of wind turbines and turbine counter +.. |eqs_OF| replace:: OF +.. |txt_OF| replace:: OpenFAST (module) +.. |eqs_OpenMP| replace:: OpenMP +.. |txt_OpenMP| replace:: open multiprocessing +.. |eqs_pHub| replace:: :math:`\vec{p}^\text{Hub}` +.. |txt_pHub| replace:: global position of a rotor center +.. |eqs_pPlane| replace:: :math:`\vec{p}^\text{Plane}_{n_p}` +.. |txt_pPlane| replace:: global position of the center of wake plane :math:`n_p` +.. |eqs_RAM| replace:: RAM +.. |txt_RAM| replace:: random-access memory +.. |eqs_RSS| replace:: RSS +.. |txt_RSS| replace:: root-sum-squared +.. |eqs_r| replace:: :math:`r` and :math:`r^\text{Plane}` +.. |txt_r| replace:: radius in the axisymmetric coordinate system +.. |eqs_rPlane| replace:: :math:`\hat{r}^\text{Plane}` +.. |txt_rPlane| replace:: radial unit vector in the axisymmetric coordinate system +.. |eqs_S| replace:: :math:`S` +.. |txt_S| replace:: global :math:`X`-, :math:`Y`-, and :math:`Z`-coordinate +.. |eqs_SC| replace:: SC +.. |txt_SC| replace:: super controller (module) +.. |eqs_SOWFA| replace:: SOWFA +.. |txt_SOWFA| replace:: Simulator fOr Wind Farm Applications +.. |eqs_t| replace:: :math:`t` +.. |txt_t| replace:: simulation time +.. |eqs_TIAmb| replace:: :math:`TI_\text{Amb}` and :math:`^\text{Filt}TI_{\text{Amb}_{n_p}}` +.. |txt_TIAmb| replace:: ambient turbulence intensity of the wind at a rotor and its low-pass time-filtered value for wake plane :math:`n_p` +.. |eqs_ud| replace:: :math:`u^d` +.. |txt_ud| replace:: discrete-time inputs +.. |eqs_Vadvect| replace:: :math:`V_\text{Advect}` +.. |txt_Vadvect| replace:: advection speed of the synthetic wind data +.. |eqs_VAmbHigh| replace:: :math:`\vec{V}_\text{Amb}^\text{High}` +.. |txt_VAmbHigh| replace:: ambient wind across a high-resolution wind domain around a turbine +.. |eqs_VAmbLow| replace:: :math:`\vec{V}_\text{Amb}^\text{Low}` +.. |txt_VAmbLow| replace:: ambient wind across a low-resolution wind domain throughout the wind farm +.. |eqs_VDistHigh| replace:: :math:`\vec{V}_\text{Dist}^\text{High}` +.. |txt_VDistHigh| replace:: disturbed wind across a high-resolution wind domain around a turbine +.. |eqs_VDistLow| replace:: :math:`\vec{V}_\text{Dist}^\text{Low}` +.. |txt_VDistLow| replace:: disturbed wind across a low-resolution wind domain throughout the wind farm +.. |eqs_VHub| replace:: :math:`V_\text{Hub}` +.. |txt_VHub| replace:: mean hub-height wind speed +.. |eqs_Vnp| replace:: :math:`\vec{V}_{n_p}^\text{Plane}` and :math:`^\text{Filt}\vec{V}_{n_p}^\text{Plane}` +.. |txt_Vnp| replace:: advection, deflection, and meandering velocity and its low-pass time-filtered value of wake plane :math:`n_p` +.. |eqs_Vr| replace:: :math:`V_r` +.. |txt_Vr| replace:: radial velocity in the axisymmetric coordinate system +.. |eqs_Vrnp| replace:: :math:`V_{r_{n_p}}^\text{Wake}(r)` +.. |txt_Vrnp| replace:: radial wake-velocity deficit at wake plane :math:`n_p`, distributed radially +.. |eqs_VTK| replace:: VTK +.. |txt_VTK| replace:: Visualization Toolkit +.. |eqs_VxRel| replace:: :math:`^\text{DiskAvg}V_x^\text{Rel}` and :math:`^\text{FiltDiskAvg}V_x^\text{Rel}` +.. |txt_VxRel| replace:: rotor-disk-averaged relative wind speed (ambient plus wakes of neighboring turbines plus turbine motion), normal to the disk, and its low-pass time-filtered value +.. |eqs_Vx| replace:: :math:`V_x` +.. |txt_Vx| replace:: axial velocity in the axisymmetric coordinate system +.. |eqs_VxnpWake| replace:: :math:`V_{x_{n_p}}^\text{Wake}(r)` +.. |txt_VxnpWake| replace:: axial wake-velocity deficit at wake plane :math:`n_p`, distributed radially +.. |eqs_DiskAvgVx| replace:: :math:`^\text{DiskAvg}V_x^\text{Wind}` and :math:`^\text{FiltDiskAvg}V_{x_{n_p}}^\text{Wind}` +.. |txt_DiskAvgVx| replace:: rotor-disk-averaged ambient wind speed, normal to the disk, and its low-pass time-filtered value at wake plane :math:`n_p` +.. |eqs_wnWind| replace:: :math:`w_{n^\text{Wind}}` +.. |txt_wnWind| replace:: weighting in the spatial averaging for wind data point :math:`n^\text{Wind}` +.. |eqs_WD| replace:: WD +.. |txt_WD| replace:: wake dynamics (module) +.. |eqs_WISDEM| replace:: WISDEM +.. |txt_WISDEM| replace:: Wind-Plant Integrated System Design & Engineering Model +.. |eqs_xxnp| replace:: :math:`x` and :math:`x_{n_p}^\text{Plane}` +.. |txt_xxnp| replace:: downwind distance from a rotor to wake plane :math:`n_p` in the axisymmetric coordinate system +.. |eqs_XYZ| replace:: :math:`X`, :math:`Y`, and :math:`Z` +.. |txt_XYZ| replace:: inertial-frame coordinates, with Z directed vertically upward, opposite gravity, X directed horizontally nominally downwind (along the zero-degree wind direction), and Y directed horizontally transversely +.. |eqs_hatXYZ| replace:: :math:`\hat{X}`, :math:`\hat{Y}`, and :math:`\hat{Z}` +.. |txt_hatXYZ| replace:: unit vectors of the inertial-frame coordinate system, parallel to the X, Y, and X coordinates +.. |eqs_xd| replace:: :math:`x^d` +.. |txt_xd| replace:: discrete-time states +.. |eqs_Xd| replace:: :math:`X^d(\quad)` +.. |txt_Xd| replace:: discrete-time state functions +.. |eqs_hatxDisk| replace:: :math:`\hat{x}^\text{Disk}` +.. |txt_hatxDisk| replace:: orientation of a rotor centerline +.. |eqs_hatxnpPlane| replace:: :math:`\hat{x}_{n_p}^\text{Plane}` +.. |txt_hatxnpPlane| replace:: orientation of wake plane :math:`n_p` +.. |eqs_yd| replace:: :math:`y^d` +.. |txt_yd| replace:: discrete-time outputs +.. |eqs_Yd| replace:: :math:`Y^d(\quad)` +.. |txt_Yd| replace:: discrete-time output functions +.. |eqs_zbot| replace:: :math:`z_\text{bot}` +.. |txt_zbot| replace:: bottom vertical location of synthetic turbulence inflow grid +.. |eqs_alpha| replace:: :math:`\alpha` +.. |txt_alpha| replace:: low-pass time-filter parameter +.. |eqs_DeltaT| replace:: :math:`\Delta t` +.. |txt_DeltaT| replace:: discrete time step (increment) +.. |eqs_YawErr| replace:: :math:`\gamma^\text{YawErr}` and :math:`^\text{Filt}\gamma_{n_p}^\text{YawErr}` +.. |txt_YawErr| replace:: nacelle-yaw error of a rotor and its low-pass time-filtered value at wake plane :math:`n_p` +.. |eqs_nuT| replace:: :math:`\nu_T` +.. |txt_nuT| replace:: eddy viscosity +.. |eqs_rho| replace:: :math:`\rho` +.. |txt_rho| replace:: air density +.. |eqs_TwoD| replace:: 2D +.. |txt_TwoD| replace:: two dimensional +.. |eqs_ThreeD| replace:: 3D +.. |txt_ThreeD| replace:: three dimensional diff --git a/docs/source/user/fast.farm/OutputFiles.rst b/docs/source/user/fast.farm/OutputFiles.rst new file mode 100644 index 0000000000..0673bf2fda --- /dev/null +++ b/docs/source/user/fast.farm/OutputFiles.rst @@ -0,0 +1,118 @@ +.. _FF:Output: + +Output Files +============ + +FAST.Farm produces five types of output files: an echo file, a summary +file, visualization output files, a time-series results file, and +OpenFAST-related files. The following sections detail the purpose and +contents of these files. + +Echo File +--------- + +If **Echo** = TRUE in the FAST.Farm primary input file, the contents of +the file will be echoed to a file with the naming convention +<*RootName.ech*, where <*RootName*> is as defined in +:numref:`FF:AmbWindVTK`. The echo file is helpful for +debugging the primary input file. The contents of an echo file will be +truncated if FAST.Farm encounters an error while parsing the primary +input file. The error usually corresponds to the line after the last +successfully echoed line. + +.. _FF:Output:Sum: + +Summary File +------------ + +If **SumPrint** = TRUE in the FAST.Farm primary input file, FAST.Farm +will generate a summary file with the naming convention of +<*RootName.sum*>. This file summarizes key information about the wind +farm model, including the wind turbine locations and OpenFAST primary +input files; wake dynamics finite-difference grid and parameters; time +steps of the various model components; and the name units and order of +the outputs that have been selected. + +.. _FF:Output:Vis: + +Visualization Output Files +-------------------------- + +If **WrDisWind** = TRUE in the FAST.Farm primary input file, FAST.Farm +will generate full 3D low- and high-resolution disturbed wind data +output files, i.e., the ambient wind and wake interactions across the +wind farm for visualization. The VTK data format and spatial resolutions +(number of grid points, origin, and spacing) of these output files +matches those of the corresponding low- and high-resolution ambient wind +data used by the FAST.Farm simulation. The VTK files are written to a +directory named *vtk_ff* where the FAST.Farm primary file is stored. The +naming conventions of these output files are +*.Low.Dis..vtk* and +*.HighT.Dis..vtk* for +the low- and high-resolution disturbed wind data files, respectively, +where **, **, and +*.Low.DisXY..vtk*, + *.Low.DisYZ..vtk*, + and +- *.Low.DisXZ..vtk* + for the *X-Y*, *Y-Z*, and *X-Z* slices, respectively, where + ** is as defined in + :numref:`FF:AmbWindVTK`, but with leading zeros. + +The time step (inverse of the frame rate) of all disturbed wind data +files is set by input parameter **WrDisDT** in the FAST.Farm primary +input file. Note that the full high-resolution disturbed wind data +output files are not output at a frame rate of :math:`1/`\ **DT_High**, +but are only output every **WrDisDT** seconds. + +Each visualization output file follows the same VTK format used for the +ambient wind data files for the high-fidelity precursor simulations. See +:numref:`FF:AmbWindIfW` for details on the file format. + +Visualizing the ambient wind and wake interactions can be useful for +interpreting results and debugging problems. However, FAST.Farm will +generate many files per output option when **WrDisWind** = TRUE and/or +when **NOutDisWindXY**, **NOutDisWindYZ**, and/or **NOutDisWindXZ** are +set greater than zero. This file generation will slow down FAST.Farm and +take up a lot of disk space, especially when generating full low- and +high-resolution disturbed wind data files. Therefore, disabling +visualization is recommended when running many FAST.Farm simulations. + +.. _FF:Output:Time: + +Time-Series Results File +------------------------ + +The FAST.Farm time-series results are written to an ASCII text-based +file with the naming convention <*RootName.out*. The results are in +table format, where each column is a data channel with the first column +always being the simulation time; each row corresponds to a simulation +output time step. The data channels are specified in the **OutList** +section of the *OUTPUT* section of the FAST.Farm primary input file. The +column format of the FAST.Farm-generated file is specified using the +**OutFmt** parameter of the FAST.Farm primary input file. + +OpenFAST Output Files +--------------------- + +In addition to the FAST.Farm-generated output files, the OpenFAST model +of each wind turbine may also generate output files. The various output +files that OpenFAST may generate (at both the driver/glue code and +module levels, as specified within the OpenFAST input files) are +described in the OpenFAST documentation and include summary (*.sum*) +files, time-series results (ASCI *.out* or binary *.outb*) files, +visualization (*.vtk*) files, etc. FAST.Farm simulations will generate +these same files, but with the the path/rootname changed to *.T*. diff --git a/docs/source/user/fast.farm/Pictures/ABLSolver.pdf b/docs/source/user/fast.farm/Pictures/ABLSolver.pdf new file mode 100644 index 0000000000..db743d1696 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/ABLSolver.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/ABLSolver.png b/docs/source/user/fast.farm/Pictures/ABLSolver.png new file mode 100644 index 0000000000..bab68ad777 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/ABLSolver.png differ diff --git a/docs/source/user/fast.farm/Pictures/AxiWake-WakeMeandering.png b/docs/source/user/fast.farm/Pictures/AxiWake-WakeMeandering.png new file mode 100644 index 0000000000..dd2fd53bf1 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/AxiWake-WakeMeandering.png differ diff --git a/docs/source/user/fast.farm/Pictures/AxiWake.pdf b/docs/source/user/fast.farm/Pictures/AxiWake.pdf new file mode 100644 index 0000000000..2c93e852c0 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/AxiWake.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/AxiWake.png b/docs/source/user/fast.farm/Pictures/AxiWake.png new file mode 100644 index 0000000000..2d99b05fed Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/AxiWake.png differ diff --git a/docs/source/user/fast.farm/Pictures/Domains.png b/docs/source/user/fast.farm/Pictures/Domains.png new file mode 100644 index 0000000000..c3cc3fe2d0 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/Domains.png differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmFlowChart.pdf b/docs/source/user/fast.farm/Pictures/FFarmFlowChart.pdf new file mode 100644 index 0000000000..eb48b414d5 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmFlowChart.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmFlowChart.png b/docs/source/user/fast.farm/Pictures/FFarmFlowChart.png new file mode 100644 index 0000000000..68da6b706e Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmFlowChart.png differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmHierarchy.pdf b/docs/source/user/fast.farm/Pictures/FFarmHierarchy.pdf new file mode 100644 index 0000000000..c8c260976c Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmHierarchy.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmHierarchy.png b/docs/source/user/fast.farm/Pictures/FFarmHierarchy.png new file mode 100644 index 0000000000..734f49d52a Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmHierarchy.png differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmLayout.pdf b/docs/source/user/fast.farm/Pictures/FFarmLayout.pdf new file mode 100644 index 0000000000..b996076b13 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmLayout.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmLayout.png b/docs/source/user/fast.farm/Pictures/FFarmLayout.png new file mode 100644 index 0000000000..988a0d83c1 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmLayout.png differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.pdf b/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.pdf new file mode 100644 index 0000000000..8fefea2058 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.png b/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.png new file mode 100644 index 0000000000..fc0133dde7 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarmLayout_Full.png differ diff --git a/docs/source/user/fast.farm/Pictures/FFarm_Merging.pdf b/docs/source/user/fast.farm/Pictures/FFarm_Merging.pdf new file mode 100644 index 0000000000..2453581b5d Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarm_Merging.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/FFarm_Merging.png b/docs/source/user/fast.farm/Pictures/FFarm_Merging.png new file mode 100644 index 0000000000..14179ec67a Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/FFarm_Merging.png differ diff --git a/docs/source/user/fast.farm/Pictures/NacYawControl.pdf b/docs/source/user/fast.farm/Pictures/NacYawControl.pdf new file mode 100644 index 0000000000..3518113199 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/NacYawControl.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/NacYawControl.png b/docs/source/user/fast.farm/Pictures/NacYawControl.png new file mode 100644 index 0000000000..34631994b1 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/NacYawControl.png differ diff --git a/docs/source/user/fast.farm/Pictures/NearWake.pdf b/docs/source/user/fast.farm/Pictures/NearWake.pdf new file mode 100644 index 0000000000..7633d4dd30 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/NearWake.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/NearWake.png b/docs/source/user/fast.farm/Pictures/NearWake.png new file mode 100644 index 0000000000..0845d5f850 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/NearWake.png differ diff --git a/docs/source/user/fast.farm/Pictures/Parallelization.png b/docs/source/user/fast.farm/Pictures/Parallelization.png new file mode 100644 index 0000000000..f3b4e927d3 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/Parallelization.png differ diff --git a/docs/source/user/fast.farm/Pictures/RadialFD.pdf b/docs/source/user/fast.farm/Pictures/RadialFD.pdf new file mode 100644 index 0000000000..bbd0476f62 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/RadialFD.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/RadialFD.png b/docs/source/user/fast.farm/Pictures/RadialFD.png new file mode 100644 index 0000000000..5ecd763457 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/RadialFD.png differ diff --git a/docs/source/user/fast.farm/Pictures/StrucDomains.pdf b/docs/source/user/fast.farm/Pictures/StrucDomains.pdf new file mode 100644 index 0000000000..d633f20e0f Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/StrucDomains.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/StrucDomains.png b/docs/source/user/fast.farm/Pictures/StrucDomains.png new file mode 100644 index 0000000000..284552d15e Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/StrucDomains.png differ diff --git a/docs/source/user/fast.farm/Pictures/TS_FileIO.png b/docs/source/user/fast.farm/Pictures/TS_FileIO.png new file mode 100644 index 0000000000..22da6a2a9f Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/TS_FileIO.png differ diff --git a/docs/source/user/fast.farm/Pictures/WakeAdv.png b/docs/source/user/fast.farm/Pictures/WakeAdv.png new file mode 100644 index 0000000000..19cf020bf4 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeAdv.png differ diff --git a/docs/source/user/fast.farm/Pictures/WakeDefl.png b/docs/source/user/fast.farm/Pictures/WakeDefl.png new file mode 100644 index 0000000000..bc19671912 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeDefl.png differ diff --git a/docs/source/user/fast.farm/Pictures/WakeMeandering.pdf b/docs/source/user/fast.farm/Pictures/WakeMeandering.pdf new file mode 100644 index 0000000000..4792209f49 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeMeandering.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/WakeMeandering.png b/docs/source/user/fast.farm/Pictures/WakeMeandering.png new file mode 100644 index 0000000000..d0648f52b9 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeMeandering.png differ diff --git a/docs/source/user/fast.farm/Pictures/WakeMerge.pdf b/docs/source/user/fast.farm/Pictures/WakeMerge.pdf new file mode 100644 index 0000000000..10f6acf4e6 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeMerge.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/WakeMerge.png b/docs/source/user/fast.farm/Pictures/WakeMerge.png new file mode 100644 index 0000000000..e8e549e8cc Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/WakeMerge.png differ diff --git a/docs/source/user/fast.farm/Pictures/Zbot.png b/docs/source/user/fast.farm/Pictures/Zbot.png new file mode 100644 index 0000000000..c2c271f294 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/Zbot.png differ diff --git a/docs/source/user/fast.farm/Pictures/timescales.pdf b/docs/source/user/fast.farm/Pictures/timescales.pdf new file mode 100644 index 0000000000..7d8377e1a8 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/timescales.pdf differ diff --git a/docs/source/user/fast.farm/Pictures/timescales.png b/docs/source/user/fast.farm/Pictures/timescales.png new file mode 100644 index 0000000000..7e3ec2f3f2 Binary files /dev/null and b/docs/source/user/fast.farm/Pictures/timescales.png differ diff --git a/docs/source/user/fast.farm/RunningFFarm.rst b/docs/source/user/fast.farm/RunningFFarm.rst new file mode 100644 index 0000000000..bdae0343e8 --- /dev/null +++ b/docs/source/user/fast.farm/RunningFFarm.rst @@ -0,0 +1,16 @@ +.. _FF:Running: + +Running FAST.Farm +================= + +As FAST.Farm is a module of OpenFAST, the process of downloading, compiling, +and running FAST.Farm is the same as that for OpenFAST. Such instructions are +available in the :ref:`installation` documentation. + +.. note:: + To improve the speed of OpenFAST compiled with FAST.Farm enabled, the user + may wish to compile in single precision with `OpenMP`. To do so, add the + `-DDOUBLE_PRECISION:BOOL=OFF -DOPENMP=ON` options with CMake. + +.. note:: + Checkpoint-restart capability has not yet been implemented within FAST.Farm. diff --git a/docs/source/user/fast.farm/bibliography.bib b/docs/source/user/fast.farm/bibliography.bib new file mode 100644 index 0000000000..57ee36c2ef --- /dev/null +++ b/docs/source/user/fast.farm/bibliography.bib @@ -0,0 +1,364 @@ +@article{Larsen08_1, + title= {Wake Meander: A Pragmatic Approach}, + author= {G. C. Larsen and et al.}, + journal= {Wind Energy}, + volume= {11}, + pages= {337-95}, + year= {2008}, + publisher={John Wiley \& Sons, Ltd.}, + doi = {http://onlinelibrary.wiley.com/doi/10.1002/we.267/epdf} +} + +@article{Larsen13_1, + title= {Validation of the Dynamic Wake Meander Model for Loads and Power Production in the Egmond aan Zee Wind Farm}, + author= {T. J. Larsen and et al.}, + journal= {Wind Energy}, + volume= {16}, + number= {4}, + pages= {605-624}, + year= {2013}, + publisher={John Wiley \& Sons, Ltd.}, + doi = {http://onlinelibrary.wiley.com/doi/10.1002/we.1563/epdf} +} + +@article{Martinez21_1, + title= {Wind Turbine Wakes: High-Thrust Coefficient}, + author= {L. A. Martinez-Tossas}, + journal= {Wind Energy}, + year= {2021}, + publisher={John Wiley \& Sons, Ltd.}, + note = {Publication pending} +} + +@article{Gebraad16_1, + title= {Wind Plant Power Optimization Through Yaw Control Using a Parametric Model for Wake Effects – a CFD Simulation Study}, + author= {P. M. O. Gebraad and et al.}, + journal= {Wind Energy}, + volume= {19}, + number= {1}, + pages= {95-114}, + year= {2016}, + publisher={John Wiley \& Sons, Ltd.}, + doi = {http://onlinelibrary.wiley.com/doi/10.1002/we.1822/epdf} +} + +@article{Quon18_1, + title= {Comparison of Wake Characterization Methods for Large-Eddy Simulations of a Rotor in Stratified Flow}, + author= {E. Quon and et al.}, + journal= {Computers & Fluids}, + year= {2018} +} + +@article{Martinez17_1, + title= {Optimal Smoothing Length Scale for Actuator Line Models of Wind Turbine Blades Based on Gaussian Body Force Distribution}, + author= {L. A. Martinez-Tossas and et al.}, + journal= {Wind Energy}, + volume= {20}, + pages= {1083-1096}, + year= {2017}, + publisher={John Wiley \& Sons, Ltd.}, + doi = {http://onlinelibrary.wiley.com/doi/10.1002/we.2081/epdf} +} + +@phdthesis{Keck13_1, + Author = {R.-E. Keck and et al.}, + Title = {A Consistent Turbulence Formulation for the Dynamic Wake Meandering Model in the Atmospheric Boundary Layer}, + School = {DTU}, + Address = {Denmark}, + Type = {Phd thesis}, + Year = {2013}} + +@phdthesis{Hao16_1, + Author = {Y. Hao}, + Title = {Wind Farm Wake Modeling and Analysis of Wake Impacts in a Wind Farm}, + School = {University of Massachusetts}, + Address = {Amherst, Massachusetts}, + Type = {Phd thesis}, + Year = {2016}} + +@article{Ainslie88_1, + title= {Calculating the Flowfield in the Wake of Wind Turbines}, + author= {J. F. Ainslie}, + journal= {Journal of Wind Engineering and Industrial Aerodynamics}, + volume= {27}, + pages= {213-224}, + year= {1988}, + publisher={Elsevier}, + doi = {https://doi.org/10.1016/0167-6105(88)90037-2} +} + +@article{Crank96_1, + title= {A Practical Method for Numerical Evaluation of Solutions of Partial Differencial Equations of the Heat-Conduction Type}, + author= {J. Crank and P. Nicolson}, + journal= {Advances in Computaional Mathematics}, + volume= {6}, + pages= {207-226}, + year= {1996} +} + +@techreport{Thomas49_1, + title= {Elliptic Problems in Linear Difference Equations Over a Network}, + author= {L. H. Thomas}, + institution={Watson Science Computer Laboratory}, + address= {New York, NY}, + year= {1949} +} + +@article{Madsen10_1, + title= {Calibration and Validation of the Dynamic Wake Meandering Model for Implementation in an Aeroelastic Code}, + author= {H. A. Madsen and et al.}, + journal= {Journal of Solar Energy Engineering}, + volume= {132}, + number = {4}, + month = {November}, + year= {2010}, + publisher={ASME}, + doi = {https://doi.org/10.1115/1.4002555} +} + +@article{Shaler19_2, + title= {Effects of Inflow Spatiotemporal Discretization on Wake Meandering and Turbine Structural Response Using FAST.Farm}, + author= {K. Shaler and et al.}, + journal= {Journal of Physics: Conference Series}, + Volume = {1256}, + month= {May}, + year= {2019}, + doi = {10.1088/1742-6596/1256/1/012023} +} + +@article{Quon19_1, + title= {Comparison of Wake Characterization Methods for Large-Eddy Simulations of a Rotor in Stratified Flow}, + author= {E. Quon and et al.}, + journal= {Computers \& Fluids}, + year= {2019 (Forthcoming)} +} + +@inproceedings{Jonkman18_1, + title= {Validation of FAST.Farm Against Large-Eddy Simulations}, + author= {J. Jonkman and et al.}, + series= {TORQUE 2018}, + date = {20-22}, + month = {June}, + year= {2018}, + publisher={EAWE}, + booktitle={}, + address= {Milano, Italy} +} + +@inproceedings{Doubrawa18_1, + title= {Optimization-Based Calibration of FAST.Farm Parameters Against SOWFA}, + author= {P. Doubrawa and et al.}, + series= {36th Wind Energy Symposium}, + date = {8-13}, + month = {January}, + year= {2018}, + booktitle={}, + publisher={AIAA}, + address= {Kissimmee, FL}, + doi = {https://arc.aiaa.org/doi/pdf/10.2514/6.2018-0512} +} + +@inproceedings{Madsen16_1, + title= {Wake Flow Characteristics at High Wind Speed.}, + author= {H. A. Madsen and et al.}, + series= {34th Wind Energy Symposium}, + year= {2016}, + publisher={AIAA}, + booktitle={}, + address= {San Diego, CA}, + doi = {http://dx.doi.org/10.2514/6.2016-1522.} +} + +@misc{SOWFA, + title = {SOWFA}, + howpublished = {\url{https://nwtc.nrel.gov/SOWFA}}, + note = {Accessed: 2019-10-05} +} + +@inproceedings{Jonkman13_1, + title= {The New Modularization Framework for the FAST wind Turbine CAE Tool}, + author= {J. Jonkman}, + series= {51st AIAA Aerospace Sciences Meeting}, + year= {2013}, + booktitle={}, + publisher={AIAA}, + address= {Dallas, TX} +} + +@inproceedings{Sprague15_1, + title= {FAST Modular Wind Turbine CAE Tool: Nonmatching Spatial and Temporal Meshes}, + author= {M. A. Sprague and et al.}, + series= {50th AIAA Aerospace Sciences Meeting}, + date = {13-17}, + month = {January}, + year= {2014}, + publisher={AIAA}, + booktitle={}, + address= {National Harbor, MD}, + DOI= {http://arc.aiaa.org/doi/pdf/10.2514/6.2014-0520} +} + +@inproceedings{Sprague14_1, + title= {FAST Modular Framework for Wind Turbine Simulation: New Algorithms and Numerical Examples}, + author= {M. A. Sprague and et al.}, + series= {51th AIAA Aerospace Sciences Meeting}, + year= {2015}, + publisher={AIAA}, + booktitle={}, + address= {Kissimmee, FL}, + DOI= {http://arc.aiaa.org/doi/pdf/10.2514/6.2014-0520} +} +@inproceedings{Shaler19_1, + title= {FAST.Farm Response of Varying Wind Inflow Techniques}, + author= {K. Shaler and et al.}, + series= {37th Wind Energy Symposium}, + year= {2019}, + publisher={AIAA}, + booktitle={}, + address= {San Diego, CA}, + doi = {https://arc.aiaa.org/doi/pdf/10.2514/6.2019-2086} +} + +@inproceedings{Jonkman17_1, + title= {Development of FAST.Farm: A New MultiPhysics Engineering Tool for Wind-Farm Design and Analysis}, + author= {J. Jonkman and et al.}, + series= {35th Wind Energy Symposium}, + date = {9-13}, + month = {January}, + year= {2017}, + publisher={AIAA}, + booktitle={}, + address= {Grapevine, TX}, + doi = {http://arc.aiaa.org/doi/pdf/10.2514/6.2017-0454} +} + +@inproceedings{Katic86_1, + title= {A Simple Model for Cluster Efficiency}, + author= {I. Kati\`{c} and et al.}, + series= {European Wind Energy Association Conference and Exhibition}, + year= {1986}, + booktitle={}, + address= {Rome, Italy} +} + +@inproceedings{Churchfield15_1, + title= {A Comparison of the Dynamic Wake Meandering Model, Large-Eddy Simulations, and Field Data at the Egmond aan Zee Offshore Wind Plant}, + author= {M. J. Churchfield and et al.}, + series= {33rd Wind Energy Symposium}, + year={2015}, + publisher={AIAA}, + booktitle={}, + address= {Kissimmee, FL}, + doi = {http://dx.doi.org/10.2514/6.2015-0724} +} + +@inproceedings{Hao14_1, + title= {Implementing the Dynamic Wake Meandering Model in the NWTC Design Codes}, + author= {Y. Hao and et al.}, + series= {32nd Wind Energy Symposium}, + date = {13-17}, + month = {January}, + year= {2014}, + publisher={AIAA}, + booktitle={}, + address= {National Harbor, MD}, + doi = {http://dx.doi.org/10.2514/6.2014-1089} +} + +@inproceedings{Churchfield12_1, + title= {A Large-Eddy Simulation of Wind-Plant Aerodynamics}, + author= {M. J. Churchfield and et al.}, + series= {50th AIAA Aerospace Sciences Meeting}, + date = {9-12}, + month = {January}, + year= {2012}, + publisher={AIAA}, + booktitle={}, + address= {Nashville, TN}, + doi = {http://dx.doi.org/10.2514/6.2012-537} +} + + +@techreport{Jonkman09_1, + title= {Definition of a 5-MW Reference Wind Turbine for Offshore System Development}, + author= {J. Jonkman and et al.}, + number= {NREL/TP-500-38060}, + institution={National Renewable Energy Laboratory}, + address= {Golden, CO}, + month= {February}, + year= {2009} +} + +@techreport{Buhl05_1, + title= {A New Empirical Relationship Between Thrust Coefficient and Induction Factor for the Turbulent Windmill State}, + author= {M. L. Buhl, Jr.}, + number= {NREL/TP-500-36834}, + institution={National Renewable Energy Laboratory}, + address= {Golden, CO}, + month= {August}, + year= {2005} +} + +@techreport{TurbSim_1, + title= {TurbSim User's Guide v2.00.00}, + author= {B. Jonkman}, + number= {NREL/TP-xxxx-xxxxx}, + institution={National Renewable Energy Laboratory}, + address= {Golden, CO}, + month= {October}, + year= {2014} +} + +@techreport{IEC_1, + title= {Wind Turbines - Part 1: Design Requirements}, + author= {IEC 61400-1}, + number= {3rd edition}, + institution={International Electrotechnical Commission}, + address= {Geneva, Switzerland}, + month= {March}, + year= {2006} +} + +@techreport{Simms01_1, + title= {NREL Unsteady Aerodynamics Experiment in the NASA-Ames Wind Tunnel: A Comparison of Predictions to Measurements}, + author= {D. Simms and et al.}, + number= {NREL/TP-500-29494}, + institution={National Renewable Energy Laboratory}, + address= {Golden, CO}, + month= {June}, + year= {2001} +} + +@techreport{Jonkman18_2, + title= {FAST.Farm User's Guide and Theory Manual}, + author= {J. M. Jonkman}, + number= {NREL/TP-xxxx-xxxxx}, + institution={National Renewable Energy Laboratory}, + address= {Golden, CO}, + month= {Unpublished}, + year= {2018} +} + +@misc{FAST, +title = {OpenFAST Documentation}, +month = {November}, +year = {2017}, +url = {http://openfast.readthedocs.io/en/master/} +} + +@misc{SAMWICH, + author = {E. Quon}, + title = {SAMWICH Wake-Tracking Toolbox}, + publisher = {GitHub}, + journal = {GitHub repository}, + howpublished = {\url{https://github.com/ewquon/waketracking}}, + year= {2017} +} + +@book{Smith06_1, + author = {S. W. Smith}, + title = {The Scientist and Engineer's Guide to Digital Signal Processing}, + year = {2006}, + publisher= {Californial Technical Publishing}, + isbn={978-0966017632} +} diff --git a/docs/source/user/fast.farm/examples/AmbientWind.vtk b/docs/source/user/fast.farm/examples/AmbientWind.vtk new file mode 100644 index 0000000000..ea2440211a --- /dev/null +++ b/docs/source/user/fast.farm/examples/AmbientWind.vtk @@ -0,0 +1,42 @@ +# vtk DataFile Version 3.0 +Amb.coarse +ASCII +DATASET STRUCTURED_POINTS +DIMENSIONS 300 300 35 +ORIGIN 5 5 5 +SPACING 10 10 10 +POINT_DATA 3150000 +VECTORS Amb FLOAT + 4.852 0.217 -0.009 + 5.092 0.213 -0.077 + 5.248 0.418 -0.060 + 5.280 0.794 -0.045 + 5.125 0.993 -0.046 + 5.067 0.799 -0.118 + 5.272 0.481 -0.242 + 5.624 0.410 -0.312 + 5.724 0.531 -0.266 + 5.267 0.430 -0.167 + 4.597 0.055 -0.109 + 4.204 -0.322 -0.069 + 4.248 -0.441 -0.055 + 4.569 -0.159 -0.171 + 4.793 0.259 -0.423 + 4.658 0.431 -0.647 + 4.287 0.395 -0.572 + 3.955 0.355 -0.208 + 3.849 0.252 0.233 + 3.938 0.099 0.534 +... +[3,149,970 lines removed] +... +10.576 -0.273 0.244 +10.910 -0.287 -0.051 +11.207 -0.241 -0.349 +11.393 -0.172 -0.524 +11.513 -0.139 -0.528 +11.581 -0.210 -0.411 +11.647 -0.315 -0.219 +11.516 -0.348 -0.039 +11.514 -0.252 0.185 +10.977 0.058 0.245 diff --git a/docs/source/user/fast.farm/examples/FAST.Farm--input.dat b/docs/source/user/fast.farm/examples/FAST.Farm--input.dat new file mode 100644 index 0000000000..35a5462439 --- /dev/null +++ b/docs/source/user/fast.farm/examples/FAST.Farm--input.dat @@ -0,0 +1,102 @@ +FAST.Farm v1.00.* INPUT FILE +Sample FAST.Farm input file +--- SIMULATION CONTROL --- +False Echo Echo input data to .ech? (flag) +FATAL AbortLevel Error level when simulation should abort (string) {"WARNING", "SEVERE", "FATAL"} +2000.0 TMax Total run time (s) [>=0.0] +False UseSC Use a super controller? (flag) +1 Mod_AmbWind Ambient wind model (-) (switch) {1: high-fidelity precursor in VTK format, 2: one InflowWind module, 3: multiple instances of InflowWind module} +--- SUPER CONTROLLER --- [used only for UseSC=True] +"SC_DLL.dll" SC_FileName Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms (quoted string) +--- AMBIENT WIND: PRECURSOR IN VTK FORMAT --- [used only for Mod_AmbWind=1] +2.0 DT_Low-VTK Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0] +0.5 DT_High-VTK Time step for high-resolution wind data input files (s) [>0.0] "/AmbWind/steady" WindFilePath Path name to wind data files from precursor (string) +False ChkWndFiles Check all the ambient wind files for data consistency (flag) +--- AMBIENT WIND: INFLOWWIND MODULE --- [used only for Mod_AmbWind=2 or 3] +2.0 DT_Low Time step for low-resolution wind data interpolation; will be used as the global FAST.Farm time step (s) [>0.0] +0.5 DT_High Time step for high-resolution wind data interpolation (s) [>0.0] +300 NX_Low Number of low-resolution spatial nodes in X direction for wind data interpolation (-) [>=2] +300 NY_Low Number of low-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2] +35 NZ_Low Number of low-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2] +5.0 X0_Low Origin of low-resolution spatial nodes in X direction for wind data interpolation (m) +5.0 Y0_Low Origin of low-resolution spatial nodes in Y direction for wind data interpolation (m) +5.0 Z0_Low Origin of low-resolution spatial nodes in Z direction for wind data interpolation (m) +10.0 dX_Low Spacing of low-resolution spatial nodes in X direction for wind data interpolation (m) [>0.0] +10.0 dY_Low Spacing of low-resolution spatial nodes in Y direction for wind data interpolation (m) [>0.0] +10.0 dZ_Low Spacing of low-resolution spatial nodes in Z direction for wind data interpolation (m) [>0.0] +16 NX_High Number of high-resolution spatial nodes in X direction for wind data interpolation (-) [>=2] +16 NY_High Number of high-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2] +17 NZ_High Number of high-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2] +"InflowWind.dat" InflowFile Name of file containing InflowWind module input parameters (quoted string) +--- WIND TURBINES --- +1 NumTurbines Number of wind turbines (-) [>=1] [last 6 columns below used only for Mod_AmbWind=2 or 3] +WT_X WT_Y WT_Z WT_FASTInFile X0_High Y0_High Z0_High dX_High dY_High dZ_High +(m) (m) (m) (string) (m) (m) (m) (m) (m) (m) +605.0 1500.0 0.0 "/FAST/Test18.fst" 525.0 1425.0 5.0 10.0 10.0 10.0 +--- WAKE DYNAMICS --- +5.0 dr Radial increment of radial finite-difference grid (m) [>0.0] +40 NumRadii Number of radii in the radial finite-difference grid (-) [>=2] +140 NumPlanes Number of wake planes (-) [>=2] +DEFAULT f_c Cutoff (corner) frequency of the low-pass time-filter for the wake advection, deflection, and meandering model (Hz) [>0.0] or DEFAULT [=0.0007] +DEFAULT C_HWkDfl_O Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor (m) or DEFAULT [=0.0] +DEFAULT C_HWkDfl_OY Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error (m/deg) or DEFAULT [=0.3] +DEFAULT C_HWkDfl_x Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance (-) or DEFAULT [=0.0] +DEFAULT C_HWkDfl_xY Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error (1/deg) or DEFAULT [=-0.004] +DEFAULT C_NearWake Calibrated parameter for the near-wake correction (-) [>1. and <2.5] or DEFAULT [=1.8] +DEFAULT k_vAmb Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-) [>=0.0] or DEFAULT [=0.05] +DEFAULT k_vShr Calibrated parameter for the influence of the shear layer in the eddy viscosity (-) [>=0.0] or DEFAULT [=0.016] +DEFAULT C_vAmb_DMin Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [=0.0] +DEFAULT C_vAmb_DMax Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vAmb_DMin] or DEFAULT [=1.0] +DEFAULT C_vAmb_FMin Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [=1.0] +DEFAULT C_vAmb_Exp Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [=0.01] +DEFAULT C_vShr_DMin Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [=3.0] +DEFAULT C_vShr_DMax Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vShr_DMin] or DEFAULT [=25.0] +DEFAULT C_vShr_FMin Calibrated parameter in the eddy viscosity filter function for the shear layer defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [=0.2] +DEFAULT C_vShr_Exp Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [=0.1] +DEFAULT Mod_WakeDiam Wake diameter calculation model (-) (switch) {1: rotor diameter, 2: velocity based, 3: mass-flux based, 4: momentum-flux based} or DEFAULT [=1] +DEFAULT C_WakeDiam Calibrated parameter for wake diameter calculation (-) [>0.0 and <0.99] or DEFAULT [=0.95] [unused for Mod_WakeDiam=1] +DEFAULT Mod_Meander Spatial filter model for wake meandering (-) (switch) {1: uniform, 2: truncated jinc, 3: windowed jinc} or DEFAULT [=3] +DEFAULT C_Meander Calibrated parameter for wake meandering (-) [>=1.0] or DEFAULT [=1.9] +--- VISUALIZATION --- +False WrDisWind Write low- and high-resolution disturbed wind data to .Low.Dis.t.vtk etc. (flag) +1 NOutDisWindXY Number of XY planes for output of disturbed wind data across the low-resolution domain to .Low.DisXY.t.vtk (-) [0 to 9] +90.0 OutDisWindZ Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXY] [unused for NOutDisWindXY=0] +2 NOutDisWindYZ Number of YZ planes for output of disturbed wind data across the low-resolution domain to /Low.DisYZ.t.vtk (-) [0 to 9] +600.0,978.0 OutDisWindX X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindYZ] [unused for NOutDisWindYZ=0] +1 NOutDisWindXZ Number of XZ planes for output of disturbed wind data across the low-resolution domain to /Low.DisXZ.t.vtk (-) [0 to 9] +1500.0 OutDisWindY Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXZ] [unused for NOutDisWindXZ=0] +4.0 WrDisDT Time step for disturbed wind visualization output (s) [>0.0] or DEFAULT [=DT_Low or DT_Low-VTK] [unused for WrDisWind=False and NOutDisWindXY=NOutDisWindYZ=NOutDisWindXZ=0] +--- OUTPUT --- +True SumPrint Print summary data to .sum? (flag) +99999.9 ChkptTime Amount of time between creating checkpoint files for potential restart (s) [>0.0] +200.0 TStart Time to begin tabular output (s) [>=0.0] +1 OutFileFmt Format for tabular (time-marching) output file (-) (switch) {1: text file [.out], 2: binary file [.outb], 3: both} +True TabDelim Use tab delimiters in text tabular output file? (flag) {uses spaces if False} +"ES10.3E2" OutFmt Format used for text tabular output, excluding the time channel. Resulting field should be 10 characters. (quoted string) +3 NOutRadii Number of radial nodes for wake output for an individual rotor (-) [0 to 20] +0, 15, 39 OutRadii List of radial nodes for wake output for an individual rotor (-) +2 NOutDist Number of downstream distances for wake output for an individual rotor (-) [1 to NOutRadii] [unused for NOutRadii=0] rotor (-) [0 to 9] +0.0, 378.0 OutDist List of downstream distances for wake output for an individual rotor (m) [1 to NOutDist] [unused for NOutDist =0] +1 NWindVel Number of points for wind output (-) [0 to 9] +600.0 WindVelX List of coordinates in the X direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0] +1500.0 WindVelY List of coordinates in the Y direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0] +90.0 WindVelZ List of coordinates in the Z direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0] +OutList The next line(s) contains a list of output parameters. (quoted string) +"RtAxsXT1, RtAxsYT1, RtAxsZT1" +"RtPosXT1, RtPosYT1, RtPosZT1" +"YawErrT1" +"TIAmbT1" +"CtT1N01, CtT1N02, CtT1N03, CtT1N04, CtT1N05" +"WkAxsXT1D1, WkAxsXT1D2, WkAxsXT1D3" +"WkAxsYT1D1, WkAxsYT1D2, WkAxsYT1D3" +"WkAxsZT1D1, WkAxsZT1D2, WkAxsZT1D3" +"WkPosXT1D1, WkPosXT1D2, WkPosXT1D3" +"WkPosYT1D1, WkPosYT1D2, WkPosYT1D3" +"WkPosZT1D1, WkPosZT1D2, WkPosZT1D3" +"WkDfVxT1N01D1, WkDfVxT1N02D1, WkDfVxT1N03D1, WkDfVxT1N04D1, WkDfVxT1N05D1" +"WkDfVxT1N01D2, WkDfVxT1N02D2, WkDfVxT1N03D2, WkDfVxT1N04D2, WkDfVxT1N05D2" +"WkDfVxT1N01D3, WkDfVxT1N02D3, WkDfVxT1N03D3, WkDfVxT1N04D3, WkDfVxT1N05D3" +"WkDfVrT1N01D1, WkDfVrT1N02D1, WkDfVrT1N03D1, WkDfVrT1N04D1, WkDfVrT1N05D1" +"WkDfVrT1N01D2, WkDfVrT1N02D2, WkDfVrT1N03D2, WkDfVrT1N04D2, WkDfVrT1N05D2" +"WkDfVrT1N01D3, WkDfVrT1N02D3, WkDfVrT1N03D3, WkDfVrT1N04D3, WkDfVrT1N05D3" +END of input file (the word "END" must appear in the first 3 columns of this last OutList line) diff --git a/docs/source/user/fast.farm/index.rst b/docs/source/user/fast.farm/index.rst new file mode 100644 index 0000000000..66773d2b1c --- /dev/null +++ b/docs/source/user/fast.farm/index.rst @@ -0,0 +1,35 @@ +.. _FAST.Farm: + +FAST.Farm User’s Guide and Theory Manual +======================================== + +.. only:: html + + This document offers a quick reference guide for the FAST.Farm driver for + OpenFAST. + + The documentation here was derived from the FAST.Farm User's Guide and Theory Manual by Jason + Jonkman and Kelsey Shaler. +.. + Update this link and uncomment when published: + (`https://www.nrel.gov/docs/fy20osti/75959.pdf + `_) + + +.. toctree:: + :maxdepth: 2 + + Nomenclature.rst + Introduction.rst + RunningFFarm.rst + InputFiles.rst + OutputFiles.rst + ModelGuidance.rst + FFarmTheory.rst + FutureWork.rst + zrefs.rst + AppendixA.rst + AppendixB.rst + AppendixC.rst + +.. Acknowledgments.rst diff --git a/docs/source/user/fast.farm/zrefs.rst b/docs/source/user/fast.farm/zrefs.rst new file mode 100644 index 0000000000..0e9d72b737 --- /dev/null +++ b/docs/source/user/fast.farm/zrefs.rst @@ -0,0 +1,10 @@ +.. only:: html + + References + ---------- + +.. bibliography:: bibliography.bib + :labelprefix: ff- + :keyprefix: ff- + + diff --git a/docs/source/user/index.rst b/docs/source/user/index.rst index 79ccef984a..09c6b4304a 100644 --- a/docs/source/user/index.rst +++ b/docs/source/user/index.rst @@ -13,6 +13,7 @@ Details on the transition from FAST v8 to OpenFAST may be found in :numref:`fast :maxdepth: 1 api_change.rst + input_file_overview.rst aerodyn/index.rst aerodyn-olaf/index.rst aerodyn-aeroacoustics/index.rst @@ -20,6 +21,9 @@ Details on the transition from FAST v8 to OpenFAST may be found in :numref:`fast subdyn/index.rst elastodyn/index.rst inflowwind/index.rst + servodyn/index.rst + servodyn-stc/StC_index.rst fast_to_openfast.rst cppapi/index.rst + fast.farm/index.rst diff --git a/docs/source/user/input_file_overview.rst b/docs/source/user/input_file_overview.rst new file mode 100644 index 0000000000..1f0b3b02be --- /dev/null +++ b/docs/source/user/input_file_overview.rst @@ -0,0 +1,146 @@ +.. _input_file_overview: + + +Overview of input file formats +============================== + +OpenFAST uses two primary input file formats: *value column* where the first +value on the line is read, and *key+value* where a value and keyword pair are +read. Both formats are line number based where a specific input is expected on a +specific line, with some exceptions. + +.. _sec_value_column: + +Value column input files +------------------------ + +Only the first column in a *value column* based input file is read. This is the +historical format used by OpenFAST and it's predecessors (the keyword was often +referenced in the source code and documentation, but OpenFAST did not process +the keyword or description). Everything after the +first value read is simply ignored by the code. This allowed the user to keep +old values while modifying things. So for example, and input line like + +:: + + 2 20 TMax - Total run time (s) + +would be read as `2` and the `20` and everything after it ignored. + +This format and associated parsing methodology is somewhat limited in informing +the user of errors in parsing, and limited the ability to pass entire inpute +files as text strings from another code (such as a Python driver code). + + +.. _sec_format_key_value: + +Key + Value input files +----------------------- + +The first two columns are read in *key + value* input files. One of these two +columns must contain the **exact** keyword, and the other must contain the value +that corresponds to it. For example, an input line + +:: + + 20 TMax - Total run time (s) + +is equivalent to + +:: + + TMax 20 - Total run time (s) + +One additional feature of this input file format is the ability to add an +arbitrary number of comment lines wherever the user wishes. Any line starting +with `!`, `#`, or `%` will be treated as a comment line and ignored. For +example, + + +:: + + ! This is a comment line that will be skipped + % and this is also a comment line that will be skipped + # as is this comment line + 20 TMax - Total run time (s) + ! the first two columns in the above line will be read as the value + key + +The parser for this format of input file also tracks which lines were comments, +and which lines contained the value and key pair. If a keyname is not found the +parser will return an error with information about which line it was reading +from. + + +Modules using Key + Value Format +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following modules use the *key + value* format input files (all other +modules use the *value column* format): + +============== ========================================================== + Module Input file +============== ========================================================== +AeroDyn Main AD15 input file +AeroDyn Airfoil files +InflowWind Main IfW input file +InflowWind Uniform wind input file +InflowWind Bladed wind summary file +ServoDyn Main ServoDyn input file +ServoDyn Structural control submodule input file +ServoDyn Structural control sumbodule prescribed force input file +SubDyn SubDyn SSI matrix input files +============== ========================================================== + +Note that key + value format and value column input files can be identical +if the value is stated before the key. + +Reasons for change +~~~~~~~~~~~~~~~~~~ + +The main reason for the change in the input file parsing was to allow for the +passing of a complete input file in memory from a wrapper code into OpenFAST or +a module. For example, when including the AeroDyn module into a Python code, +the input file can be passed in directly in memory without writing to disk +first. This helps reduce the IO overhead in optimization loops where the module +might be called many times sequentially with very small changes to the input +file. *NOTE: this is still a work in progress, so not all modules can be linked +this way yet*. + +To accomplish this, the file parser written by Marshall Buhl for parsing airfoil +tables in AeroDyn 15 in FAST8 was used. This parser included the more robust +*key + value* input format. + + + +.. _sec_troubleshoot_input_file: + +Troubleshooting input files +--------------------------- + +When troubleshooting an input file error, try the following procedure: + +1. An error message containing a line number and variable name, the file format + being parsed is a *key + value* format. Check that the key is spelled + exactly as the input file. See :numref:`sec_format_key_value` below. +2. An error message containing only the variable name but no line number is a + *value column* input file format. See :numref:`sec_value_column` below. +3. Turn on `echo` option in the input file and check the resulting `.ech` for + which line the file parsing stopped at. This may help isolate where the input + file parsing failed when no line number is given in the error message. +4. Compare the problematic input file with an input file of the same type from + the regression test suite distributed with OpenFAST. See section + :numref:`testing` for details on the regression tests, or check the + repository at `r-test `__ . + + +.. + Input file type by module + ------------------------- + ============== ====================== ===================== + Module Input file Type + ============== ====================== ===================== + OpenFAST Main .fst input file Value column + OpenFAST Matlab mode shape Value column + OpenFAST Mode shape Value column + OpenFAST Checkpoint file Binary + ============== ====================== ===================== diff --git a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat new file mode 100644 index 0000000000..cd42f824f3 --- /dev/null +++ b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat @@ -0,0 +1,94 @@ +------- STRUCTURAL CONTROL (StC) INPUT FILE ---------------------------- +Input file for tuned mass damper, module by Matt Lackner, Meghan Glade, and Semyung Park (UMass) +---------------------- SIMULATION CONTROL -------------------------------------- +True Echo - Echo input data to .ech (flag) +---------------------- StC DEGREES OF FREEDOM ---------------------------------- + 2 StC_DOF_MODE - DOF mode (switch) {0: No StC or TLCD DOF; 1: StC_X_DOF, StC_Y_DOF, and/or StC_Z_DOF (three independent StC DOFs); 2: StC_XY_DOF (Omni-Directional StC); 3: TLCD; 4: Prescribed force/moment time series} +true StC_X_DOF - DOF on or off for StC X (flag) [Used only when StC_DOF_MODE=1] +true StC_Y_DOF - DOF on or off for StC Y (flag) [Used only when StC_DOF_MODE=1] +FALSE StC_Z_DOF - DOF on or off for StC Z (flag) [Used only when StC_DOF_MODE=1] +---------------------- StC LOCATION ------------------------------------------- [relative to the reference origin of component attached to] + 0 StC_P_X - At rest X position of StC (m) + 0 StC_P_Y - At rest Y position of StC (m) + 75 StC_P_Z - At rest Z position of StC (m) +---------------------- StC INITIAL CONDITIONS --------------------------------- [used only when StC_DOF_MODE=1 or 2] + 1 StC_X_DSP - StC X initial displacement (m) [relative to at rest position] + 1 StC_Y_DSP - StC Y initial displacement (m) [relative to at rest position] + 0 StC_Z_DSP - StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC CONFIGURATION -------------------------------------- [used only when StC_DOF_MODE=1 or 2] + 10 StC_X_PSP - Positive stop position (maximum X mass displacement) (m) + -10 StC_X_NSP - Negative stop position (minimum X mass displacement) (m) + 10 StC_Y_PSP - Positive stop position (maximum Y mass displacement) (m) + -10 StC_Y_NSP - Negative stop position (minimum Y mass displacement) (m) + 10 StC_Z_PSP - Positive stop position (maximum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + -10 StC_Z_NSP - Negative stop position (minimum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC MASS, STIFFNESS, & DAMPING ------------------------- [used only when StC_DOF_MODE=1 or 2] + 20000 StC_X_M - StC X mass (kg) [must equal StC_Y_M for StC_DOF_MODE = 2] + 20000 StC_Y_M - StC Y mass (kg) [must equal StC_X_M for StC_DOF_MODE = 2] + 0 StC_Z_M - StC Z mass (kg) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 20000 StC_XY_M - StC XY mass (kg) [used only when StC_DOF_MODE=2] + 28000 StC_X_K - StC X stiffness (N/m) + 28000 StC_Y_K - StC Y stiffness (N/m) + 0 StC_Z_K - StC Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 2800 StC_X_C - StC X damping (N/(m/s)) + 2800 StC_Y_C - StC Y damping (N/(m/s)) + 0 StC_Z_C - StC Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 15000 StC_X_KS - Stop spring X stiffness (N/m) + 15000 StC_Y_KS - Stop spring Y stiffness (N/m) + 0 StC_Z_KS - Stop spring Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 10000 StC_X_CS - Stop spring X damping (N/(m/s)) + 10000 StC_Y_CS - Stop spring Y damping (N/(m/s)) + 0 StC_Z_CS - Stop spring Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC USER-DEFINED SPRING FORCES ------------------------- [used only when StC_DOF_MODE=1 or 2] +False Use_F_TBL - Use spring force from user-defined table (flag) + 17 NKInpSt - Number of spring force input stations +---------------------- StC SPRING FORCES TABLE -------------------------------- [used only when StC_DOF_MODE=1 or 2] + X F_X Y F_Y Z F_Z + (m) (N) (m) (N) (m) (N) +-6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 +-5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 +-4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 +-4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 +-3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 +-3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 +-2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 +-2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 + 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 + 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 + 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 + 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 + 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 + 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 + 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 + 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 + 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 +---------------------- StructCtrl CONTROL -------------------------------------------- [used only when StC_DOF_MODE=1 or 2] + 0 StC_CMODE - Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + 1 StC_SA_MODE - Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} (-) + 0 StC_X_C_HIGH - StC X high damping for ground hook control + 0 StC_X_C_LOW - StC X low damping for ground hook control + 0 StC_Y_C_HIGH - StC Y high damping for ground hook control + 0 StC_Y_C_LOW - StC Y low damping for ground hook control + 0 StC_Z_C_HIGH - StC Z high damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 0 StC_Z_C_LOW - StC Z low damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 0 StC_X_C_BRAKE - StC X high damping for braking the StC (Don't use it now. should be zero) + 0 StC_Y_C_BRAKE - StC Y high damping for braking the StC (Don't use it now. should be zero) + 0 StC_Z_C_BRAKE - StC Z high damping for braking the StC (Don't use it now. should be zero) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- TLCD --------------------------------------------------- [used only when StC_DOF_MODE=3] + 7.9325 L_X - X TLCD total length (m) + 6.5929 B_X - X TLCD horizontal length (m) + 2.0217 area_X - X TLCD cross-sectional area of vertical column (m^2) + 0.913 area_ratio_X - X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + 2.5265 headLossCoeff_X - X TLCD head loss coeff (-) + 1000 rho_X - X TLCD liquid density (kg/m^3) + 3.5767 L_Y - Y TLCD total length (m) + 2.1788 B_Y - Y TLCD horizontal length (m) + 1.2252 area_Y - Y TLCD cross-sectional area of vertical column (m^2) + 2.7232 area_ratio_Y - Y TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + 0.6433 headLossCoeff_Y - Y TLCD head loss coeff (-) + 1000 rho_Y - Y TLCD liquid density (kg/m^3) +---------------------- PRESCRIBED TIME SERIES --------------------------------- [used only when StC_DOF_MODE=4] + 0 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local} +"TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ) +------------------------------------------------------------------------------- + diff --git a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat new file mode 100644 index 0000000000..cd42f824f3 --- /dev/null +++ b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat @@ -0,0 +1,94 @@ +------- STRUCTURAL CONTROL (StC) INPUT FILE ---------------------------- +Input file for tuned mass damper, module by Matt Lackner, Meghan Glade, and Semyung Park (UMass) +---------------------- SIMULATION CONTROL -------------------------------------- +True Echo - Echo input data to .ech (flag) +---------------------- StC DEGREES OF FREEDOM ---------------------------------- + 2 StC_DOF_MODE - DOF mode (switch) {0: No StC or TLCD DOF; 1: StC_X_DOF, StC_Y_DOF, and/or StC_Z_DOF (three independent StC DOFs); 2: StC_XY_DOF (Omni-Directional StC); 3: TLCD; 4: Prescribed force/moment time series} +true StC_X_DOF - DOF on or off for StC X (flag) [Used only when StC_DOF_MODE=1] +true StC_Y_DOF - DOF on or off for StC Y (flag) [Used only when StC_DOF_MODE=1] +FALSE StC_Z_DOF - DOF on or off for StC Z (flag) [Used only when StC_DOF_MODE=1] +---------------------- StC LOCATION ------------------------------------------- [relative to the reference origin of component attached to] + 0 StC_P_X - At rest X position of StC (m) + 0 StC_P_Y - At rest Y position of StC (m) + 75 StC_P_Z - At rest Z position of StC (m) +---------------------- StC INITIAL CONDITIONS --------------------------------- [used only when StC_DOF_MODE=1 or 2] + 1 StC_X_DSP - StC X initial displacement (m) [relative to at rest position] + 1 StC_Y_DSP - StC Y initial displacement (m) [relative to at rest position] + 0 StC_Z_DSP - StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC CONFIGURATION -------------------------------------- [used only when StC_DOF_MODE=1 or 2] + 10 StC_X_PSP - Positive stop position (maximum X mass displacement) (m) + -10 StC_X_NSP - Negative stop position (minimum X mass displacement) (m) + 10 StC_Y_PSP - Positive stop position (maximum Y mass displacement) (m) + -10 StC_Y_NSP - Negative stop position (minimum Y mass displacement) (m) + 10 StC_Z_PSP - Positive stop position (maximum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + -10 StC_Z_NSP - Negative stop position (minimum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC MASS, STIFFNESS, & DAMPING ------------------------- [used only when StC_DOF_MODE=1 or 2] + 20000 StC_X_M - StC X mass (kg) [must equal StC_Y_M for StC_DOF_MODE = 2] + 20000 StC_Y_M - StC Y mass (kg) [must equal StC_X_M for StC_DOF_MODE = 2] + 0 StC_Z_M - StC Z mass (kg) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 20000 StC_XY_M - StC XY mass (kg) [used only when StC_DOF_MODE=2] + 28000 StC_X_K - StC X stiffness (N/m) + 28000 StC_Y_K - StC Y stiffness (N/m) + 0 StC_Z_K - StC Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 2800 StC_X_C - StC X damping (N/(m/s)) + 2800 StC_Y_C - StC Y damping (N/(m/s)) + 0 StC_Z_C - StC Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 15000 StC_X_KS - Stop spring X stiffness (N/m) + 15000 StC_Y_KS - Stop spring Y stiffness (N/m) + 0 StC_Z_KS - Stop spring Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 10000 StC_X_CS - Stop spring X damping (N/(m/s)) + 10000 StC_Y_CS - Stop spring Y damping (N/(m/s)) + 0 StC_Z_CS - Stop spring Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- StC USER-DEFINED SPRING FORCES ------------------------- [used only when StC_DOF_MODE=1 or 2] +False Use_F_TBL - Use spring force from user-defined table (flag) + 17 NKInpSt - Number of spring force input stations +---------------------- StC SPRING FORCES TABLE -------------------------------- [used only when StC_DOF_MODE=1 or 2] + X F_X Y F_Y Z F_Z + (m) (N) (m) (N) (m) (N) +-6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 +-5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 +-4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 +-4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 +-3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 +-3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 +-2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 +-2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 + 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 + 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 + 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 + 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 + 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 + 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 + 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 + 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 + 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 +---------------------- StructCtrl CONTROL -------------------------------------------- [used only when StC_DOF_MODE=1 or 2] + 0 StC_CMODE - Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + 1 StC_SA_MODE - Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} (-) + 0 StC_X_C_HIGH - StC X high damping for ground hook control + 0 StC_X_C_LOW - StC X low damping for ground hook control + 0 StC_Y_C_HIGH - StC Y high damping for ground hook control + 0 StC_Y_C_LOW - StC Y low damping for ground hook control + 0 StC_Z_C_HIGH - StC Z high damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 0 StC_Z_C_LOW - StC Z low damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + 0 StC_X_C_BRAKE - StC X high damping for braking the StC (Don't use it now. should be zero) + 0 StC_Y_C_BRAKE - StC Y high damping for braking the StC (Don't use it now. should be zero) + 0 StC_Z_C_BRAKE - StC Z high damping for braking the StC (Don't use it now. should be zero) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +---------------------- TLCD --------------------------------------------------- [used only when StC_DOF_MODE=3] + 7.9325 L_X - X TLCD total length (m) + 6.5929 B_X - X TLCD horizontal length (m) + 2.0217 area_X - X TLCD cross-sectional area of vertical column (m^2) + 0.913 area_ratio_X - X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + 2.5265 headLossCoeff_X - X TLCD head loss coeff (-) + 1000 rho_X - X TLCD liquid density (kg/m^3) + 3.5767 L_Y - Y TLCD total length (m) + 2.1788 B_Y - Y TLCD horizontal length (m) + 1.2252 area_Y - Y TLCD cross-sectional area of vertical column (m^2) + 2.7232 area_ratio_Y - Y TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + 0.6433 headLossCoeff_Y - Y TLCD head loss coeff (-) + 1000 rho_Y - Y TLCD liquid density (kg/m^3) +---------------------- PRESCRIBED TIME SERIES --------------------------------- [used only when StC_DOF_MODE=4] + 0 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local} +"TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ) +------------------------------------------------------------------------------- + diff --git a/docs/source/user/servodyn-stc/ExampleFiles/PrescribedForce.txt b/docs/source/user/servodyn-stc/ExampleFiles/PrescribedForce.txt new file mode 100644 index 0000000000..92bbb23b6a --- /dev/null +++ b/docs/source/user/servodyn-stc/ExampleFiles/PrescribedForce.txt @@ -0,0 +1,15 @@ +# This is an input file for the tower top force time-series in the TMD module of ServoDyn +# +# it has an arbitrary number of header lines denoted with #!% characters +! Another comment line +# +# Time, Fx, Fy, Fz, Mx, My, Mz +# (s) (N) (N) (N) (N-m) (N-m) (N-m) +0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0 1.0e5 0.0 0.0 0.0 0.0 0.0 # Start ramp -- this is a comment +40.0 1.0e5 0.0 0.0 0.0 0.0 0.0 +# 40.0001 0.0 0.0 0.0 0.0 0.0 0.0 # This is a commented line +90. 0.0 0.0 0.0 0.0 0.0 0.0 + + + diff --git a/docs/source/user/servodyn-stc/ExampleFiles/SpringForce.txt b/docs/source/user/servodyn-stc/ExampleFiles/SpringForce.txt new file mode 100644 index 0000000000..23ef5956f5 --- /dev/null +++ b/docs/source/user/servodyn-stc/ExampleFiles/SpringForce.txt @@ -0,0 +1,19 @@ + X F_X Y F_Y Z F_Z + (m) (N) (m) (N) (m) (N) +-6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 +-5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 +-4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 +-4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 +-3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 +-3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 +-2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 +-2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 + 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 + 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 + 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 + 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 + 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 + 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 + 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 + 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 + 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 diff --git a/docs/source/user/servodyn-stc/Schematics/TLCD_Diagram.png b/docs/source/user/servodyn-stc/Schematics/TLCD_Diagram.png new file mode 100644 index 0000000000..49239ea2d2 Binary files /dev/null and b/docs/source/user/servodyn-stc/Schematics/TLCD_Diagram.png differ diff --git a/docs/source/user/servodyn-stc/StC_Refs.bib b/docs/source/user/servodyn-stc/StC_Refs.bib new file mode 100644 index 0000000000..f557e4b9d1 --- /dev/null +++ b/docs/source/user/servodyn-stc/StC_Refs.bib @@ -0,0 +1,66 @@ +@inproceedings{namik_active_2013, + title = {Active structural control with actuator dynamics on a floating wind turbine}, + url = {http://arc.aiaa.org/doi/pdf/10.2514/6.2013-455}, + booktitle = {Proceedings of the 51st {AIAA} {Aerospace} {Sciences} {Meeting}}, + author = {Namik, Hazim and Rotea, M. A. and Lackner, Matthew}, + year = {2013}, + pages = {7--10}, +} +%% urldate = {2015-03-31}, + +@article{lackner_passive_2011, + title = {Passive structural control of offshore wind turbines}, + volume = {14}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/we.426/full}, + number = {3}, + journal = {Wind energy}, + author = {Lackner, Matthew A. and Rotea, Mario A.}, + year = {2011}, + pages = {373--388}, +} +%% urldate = {2015-03-31}, + +@article{stewart_optimization_2013, + title = {Optimization of a passive tuned mass damper for reducing loads in offshore wind turbines}, + volume = {21}, + number = {4}, + journal = {IEEE Transactions on Control Systems Technology}, + author = {Stewart, G. and Lackner, M. A.}, + year = {2013}, + pages = {1090--1104} +} + +@article{stewart_impact_2014, + title = {The impact of passive tuned mass dampers and wind–wave misalignment on offshore wind turbine loads}, + volume = {73}, + url = {http://www.sciencedirect.com/science/article/pii/S0141029614002673}, + journal = {Engineering Structures}, + author = {Stewart, Gordon M. and Lackner, Matthew A.}, + year = {2014}, + pages = {54--61}, +} +%% urldate = {2015-03-31}, + +@article{stewart_effect_2011, + title = {The effect of actuator dynamics on active structural control of offshore wind turbines}, + volume = {33}, + url = {http://www.sciencedirect.com/science/article/pii/S0141029611000915}, + number = {5}, + journal = {Engineering Structures}, + author = {Stewart, Gordon M. and Lackner, Matthew A.}, + year = {2011}, + pages = {1807--1816}, +} +%% urldate = {2015-03-31}, + +@article{lackner_structural_2011, + title = {Structural control of floating wind turbines}, + volume = {21}, + url = {http://www.sciencedirect.com/science/article/pii/S0957415810002072}, + number = {4}, + journal = {Mechatronics}, + author = {Lackner, Matthew A. and Rotea, Mario A.}, + year = {2011}, + pages = {704--719}, +} +%% urldate = {2015-03-31}, diff --git a/docs/source/user/servodyn-stc/StC_TLCD_Theory.rst b/docs/source/user/servodyn-stc/StC_TLCD_Theory.rst new file mode 100644 index 0000000000..276291c85f --- /dev/null +++ b/docs/source/user/servodyn-stc/StC_TLCD_Theory.rst @@ -0,0 +1,887 @@ +.. _TLCD_Theory: + +TLCD: Derivations of Equation of Motion +======================================= + +.. _TLCDfig: + +.. figure:: Schematics/TLCD_Diagram.png + :alt: TLCD schematic + :width: 100% + :align: center + + Schematic of TLCD design. + +Definitions: +------------ + +.. container:: + :name: tab:TLCDdefs + + .. table:: TLCD Definitions + + +-----------------+-------------------+ + | Variable | Description | + +=================+===================+ + | |O_eq| | |O_desc| | + +-----------------+-------------------+ + | |P_eq| | |P_desc| | + +-----------------+-------------------+ + | |W_R_eq| | |W_R_desc| | + +-----------------+-------------------+ + | |W_L_eq| | |W_L_desc| | + +-----------------+-------------------+ + | |G_eq| | |G_desc| | + +-----------------+-------------------+ + | |N_eq| | |N_desc| | + +-----------------+-------------------+ + | |w_eq| | |w_desc| | + +-----------------+-------------------+ + | |g_eq| | |g_desc| | + +-----------------+-------------------+ + +.. |O_eq| replace:: :math:`O` +.. |O_desc| replace:: origin point of global inertial reference frame, located at center of base of resting turbine +.. |P_eq| replace:: :math:`P` +.. |P_desc| replace:: origin point of local reference frame (_e.g._ fixed to nacelle), in the center of the horizontal liquid column +.. |W_R_eq| replace:: :math:`W_R` +.. |W_R_desc| replace:: point attached to the top center of the right liquid column (moving) +.. |W_L_eq| replace:: :math:`W_L`` +.. |W_L_desc| replace:: point attached to the top center of the left liquid column (moving) +.. |G_eq| replace:: :math:`i` +.. |G_desc| replace:: axis orientation of inertial reference frame (global) +.. |N_eq| replace:: :math:`l` +.. |N_desc| replace:: axis orientation of local reference frame +.. |w_eq| replace:: :math:`w` +.. |w_desc| replace:: position of the liquid water column as defined in Figure :numref:`TLCDfig` +.. |g_eq| replace:: :math:`g` +.. |g_desc| replace:: gravity vector in the inertial reference frame (global) + + +Right Vertical Liquid Column +---------------------------- + +Starting with the right vertical column, we define the following vector +expressions: + +.. container:: + :name: tab:TLCD_r_vectors + + +--------------------+-----------------------+ + | Variable | Description | + +====================+=======================+ + | |iVecR_O2P_eq| | |iVecR_O2P_desc| | + +--------------------+-----------------------+ + | |lVecR_P2Wr_eq| | |lVecR_P2Wr_desc| | + +--------------------+-----------------------+ + | |iVecW_l_eq| | |iVecW_l_desc| | + +--------------------+-----------------------+ + | |iVecR_O2Wr_eq| | |iVecR_O2Wr_desc| | + +--------------------+-----------------------+ + +.. |iVecR_O2P_eq| replace:: :math:`\vec{r}_{i}^{O \rightarrow P} = \left[ \begin{array}{c} x \\ y \\ z \end{array} \right]_{i} ^{O \rightarrow P}` +.. |iVecR_O2P_desc| replace:: position vector from point :math:`O` to point :math:`P` in inertial coordinate system +.. |lVecR_P2Wr_eq| replace:: :math:`\vec{r}_{l}^{P \rightarrow W_R} = \left[ \begin{array}{c} x \\ y \\ z \end{array} \right]_{l} ^{P \rightarrow W_R}` +.. |lVecR_P2Wr_desc| replace:: position vector from point :math:`P` to point :math:`W_R` in local coordinate system +.. |iVecW_l_eq| replace:: :math:`\vec{\omega}_{i}^{l} = \left[ \begin{array}{c} \theta \\ \phi \\ \psi \end{array} \right]_{i} ^{l}` +.. |iVecW_l_desc| replace:: angular velicity frame :math:`l` with respect to inertial reference frame :math:`i` +.. |iVecR_O2Wr_eq| replace:: :math:`\vec{r}_{i}^{O \rightarrow W_R} = \vec{r}_{i}^{O \rightarrow P} + \vec{r}_{l}^{P \rightarrow W_R} = \left[ \begin{array}{c} x \\ y \\ z \end{array} \right]_{i} ^{O \rightarrow W_R}` +.. |iVecR_O2Wr_desc| replace:: position vector from point :math:`P` to point :math:`W_R` in local coordinate system + +Taking the derivative of the last expression for :math:`\vec{r}_{i}^{O +\rightarrow W_R}` yields the velocity of point :math:`W_R` in the global +reference frame: + +.. math:: + + \dot{\vec{r}}_{i}^{W_R} + = \dot{\vec{r}}_{i}^{P} + + \dot{\vec{r}}_{l}^{W_R} + + \vec{\omega}_{i}^{l} \times \vec{r}_{l}^{P \rightarrow W_R}. + + +Repeating this step once more yields its acceleration: + +.. math:: + + \ddot{\vec{r}}_{i}^{W_R} + = \dot{\vec{r}}_{i}^{P} + + \ddot{\vec{r}}_{l}^{W_R} + + 2 \vec{\omega}_{i}^{l} \times \dot{\vec{r}}_{l}^{W_R} + + \vec{\alpha}_{i}^{l} \times \vec{r}_{i}^{P \rightarrow W_R} + + \vec{\omega}_{i}^{l} \times \left( \vec{\omega}_{i}^{l} \times \vec{r}_{l}^{P \rightarrow W_R}\right) + + +Following Newton’s Second Law, the left part of this expression can be +replaced with a force balance: + +.. math:: + + \ddot{\vec{r}}_{i}^{W_R} + = \frac{1}{m_R} + \left[\begin{array}{c} + \sum{F_x}\\ + \sum{F_y}\\ + \sum{F_z} + \end{array}\right] ^ {W_R} + = \frac{1}{m_R} + \left[\begin{array}{c} + F_x^{W_R/S} + m_R g_{x} \\ + F_y^{W_R/S} + m_R g_{y} \\ + m_R g_{z} + \end{array}\right] ^ {W_R} + +where :math:`g` is the gravity vector in the inertial frame. The vector +describing the position of the right hand column in the local reference frame +(:math:`i`) can be written as: + +.. math:: + + \vec{r}_{l}^{P \rightarrow W_R} + = \left[ \begin{array}{c} + B/2 \\ + 0 \\ + \frac{L-B}{2} + w + \end{array}\right]_{l} ^{P \rightarrow W_R}. + +Movement of the liquid in the vertical columns is restricted to the +z-direction in reference frame N, thus the expression for the +acceleration of the right liquid column becomes: + +.. math:: + + \frac{1}{m_R} + \left[\begin{array}{c} + F_x^{W_R/S} + m_R g_{x} \\ + F_y^{W_R/S} + m_R g_{y} \\ + m_R g_{z} + \end{array}\right] ^{W_R} + & = \quad\left[\begin{array}{c} + \ddot{x} \\ + \ddot{y} \\ + \ddot{z} + \end{array}\right]_{i}^{P} + + \left[\begin{array}{c} + 0 \\ + 0 \\ + \ddot{\omega} + \end{array}\right]_{l}^{W_R} \\ + & \quad + + 2\left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + 0 \\ + 0 \\ + \dot{\omega} + \end{array}\right]_{l}^{W_R} \\ + & \quad + + \left[\begin{array}{c} + \ddot{\theta} \\ + \ddot{\phi} \\ + \ddot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + B/2 \\ + 0 \\ + \frac{L-B}{2} + w + \end{array}\right]_{l}^{P \rightarrow W_R} \\ + & \quad + + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times\left( + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + B/2 \\ + 0 \\ + \frac{L-B}{2} + w + \end{array}\right]_{l}^{P \rightarrow W_R} + \right) + + + +Computing all cross-products yields three distinct expressions in the x, +y, and z dimensions: + +.. math:: + x: & \quad + \frac{1}{m_R} \left( F_x^{W_R/S} + m_R g_{x} \right) + &=& + \ddot{x}_{i}^{P} + + 2\dot{\phi}\dot{w} + + \ddot{\phi} \left(\frac{L-B}{2} + w \right) + - \dot{\phi}^2 \frac{B}{2} + - \dot{\psi}^2 \frac{B}{2} + + \dot{\psi}\dot{\theta} \left(\frac{L-B}{2} + w \right) \\ + y: & \quad + \frac{1}{m_R} \left( F_y^{W_R/S} + m_R g_{y} \right) + &=& + \ddot{y}_{i}^{P} + - 2\dot{\theta}\dot{w} + + \ddot{\psi} \frac{B}{2} + - \ddot{\theta} \left(\frac{L-B}{2} + w \right) + + \dot{\psi}\dot{\phi} \left(\frac{L-B}{2} + w \right) + + \dot{\theta}\dot{\phi}\frac{B}{2} \\ + z: & \quad + g_z + &=& + \ddot{z}_{i}^{P} + + \ddot{w} + - \ddot{\phi} \frac{B}{2} + + \dot{\theta}\dot{\psi} \frac{B}{2} + - \dot{\theta}^2 \left(\frac{L-B}{2} + w \right) + - \dot{\phi}^2 \left(\frac{L-B}{2} + w \right) \\ + + + + + +Left Vertical Liquid Column +--------------------------- + +Following the same methodology as above the equations describing the +movement of the left vertical liquid column can be determined. + +Similarly, the acceleration of the left liquid column can be replaced by +a force balance: + +.. math:: + + \ddot{\vec{r}}_{i}^{W_L} + = \frac{1}{m_L} + \left[\begin{array}{c} + \sum{F_x}\\ + \sum{F_y}\\ + \sum{F_z} + \end{array}\right] ^ {W_L} + = \frac{1}{m_L} + \left[\begin{array}{c} + F_x^{W_L/S} + m_L g_{x} \\ + F_y^{W_L/S} + m_L g_{y} \\ + m_L g_{z} + \end{array}\right] ^ {W_L} + +where :math:`g` is the gravity vector in the inertial frame. The vector +describing the position of the left hand column in the local reference frame +(:math:`i`) can be written as: + +.. math:: + + \vec{r}_{l}^{P \rightarrow W_L} + = \left[ \begin{array}{c} + -B/2 \\ + 0 \\ + \frac{L-B}{2} - w + \end{array}\right]_{l} ^{P \rightarrow W_L}. + +The final equation for the acceleration of the left liquid column +becomes: + +.. math:: + + \frac{1}{m_L} + \left[\begin{array}{c} + F_x^{W_L/S} + m_L g_{x} \\ + F_y^{W_L/S} + m_L g_{y} \\ + m_L g_{z} + \end{array}\right] ^{W_L} + & = \quad\left[\begin{array}{c} + \ddot{x} \\ + \ddot{y} \\ + \ddot{z} + \end{array}\right]_{i}^{P} + + \left[\begin{array}{c} + 0 \\ + 0 \\ + - \ddot{w} + \end{array}\right]_{l}^{W_L} \\ + & \quad + + 2\left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + 0 \\ + 0 \\ + - \dot{w} + \end{array}\right]_{l}^{W_L} \\ + & \quad + + \left[\begin{array}{c} + \ddot{\theta} \\ + \ddot{\phi} \\ + \ddot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + -B/2 \\ + 0 \\ + \frac{L-B}{2} - w + \end{array}\right]_{l}^{P \rightarrow W_L} \\ + & \quad + + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times\left( + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + -B/2 \\ + 0 \\ + \frac{L-B}{2} - w + \end{array}\right]_{l}^{P \rightarrow W_L} + \right) + + + +The x, y, and z equations then become: + +.. math:: + x: & \quad + \frac{1}{m_L} \left( F_x^{W_L/S} + m_L g_{x} \right) + &=& + \ddot{x}_{i}^{P} + - 2\dot{\phi}\dot{w} + + \ddot{\phi} \left(\frac{L-B}{2} - w \right) + + \dot{\phi}^2 \frac{B}{2} + + \dot{\psi}^2 \frac{B}{2} + + \dot{\psi}\dot{\theta} \left(\frac{L-B}{2} - w \right) \\ + y: & \quad + \frac{1}{m_L} \left( F_y^{W_L/S} + m_L g_{y} \right) + &=& + \ddot{y}_{i}^{P} + + 2\dot{\theta}\dot{w} + - \ddot{\psi} \frac{B}{2} + - \ddot{\theta} \left(\frac{L-B}{2} - w \right) + + \dot{\psi}\dot{\phi} \left(\frac{L-B}{2} - w \right) + - \dot{\theta}\dot{\phi}\frac{B}{2} \\ + z: & \quad + g_z + &=& + \ddot{z}_{i}^{P} + - \ddot{w} + + \ddot{\phi} \frac{B}{2} + - \dot{\theta}\dot{\psi} \frac{B}{2} + - \dot{\theta}^2 \left(\frac{L-B}{2} - w \right) + - \dot{\phi}^2 \left(\frac{L-B}{2} - w \right) \\ + + + +Horizontal Liquid Column +------------------------ + +As the movement of the liquid in the horizontal column (:math:`H`) is restricted to +the x-dimension in local reference frame, :math:`l`, the position vector can be +expressed as: + +.. math:: + + \vec{r}_{l}^{P \rightarrow W_H} + = \left[ \begin{array}{c} + w \\ + 0 \\ + 0 + \end{array}\right]_{l} ^{P \rightarrow W_H}. + + +Furthermore, the force balance on the horizontal liquid column is... + +.. math:: + + \ddot{\vec{r}}_{i}^{W_H} + = \frac{1}{m_H} + \left[\begin{array}{c} + \sum{F_x}\\ + \sum{F_y}\\ + \sum{F_z} + \end{array}\right] ^ {W_H} + = \frac{1}{m_H} + \left[\begin{array}{c} + m_H g_{x} - \frac{1}{2} \rho A \xi \left|\dot{w}\right| \dot{w} \\ + F_y^{W_H/S} + m_H g_{y} \\ + F_z^{W_H/S} + m_H g_{z} + \end{array}\right] ^ {W_H} + + +where the :math:`\rho` term represents the damping force applied to the liquid as +it passes through the restricted orifice, and :math:`g` is the gravity vector in +the inertial frame. + +The final expression for the acceleration of the water through +the horizontal column becomes: + +.. math:: + + \frac{1}{m_H} + \left[\begin{array}{c} + m_H g_{x} - \frac{1}{2} \rho A \xi \left|\dot{w}\right| \dot{w} \\ + F_y^{W_H/S} + m_H g_{y} \\ + F_z^{W_H/S} + m_H g_{z} + \end{array}\right] ^ {W_H} + & = \quad\left[\begin{array}{c} + \ddot{x} \\ + \ddot{y} \\ + \ddot{z} + \end{array}\right]_{i}^{P} + + \left[\begin{array}{c} + \ddot{w} \\ + 0 \\ + 0 + \end{array}\right]_{l}^{W_H} \\ + & \quad + + 2\left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + \dot{w} \\ + 0 \\ + 0 + \end{array}\right]_{l}^{W_H} \\ + & \quad + + \left[\begin{array}{c} + \ddot{\theta} \\ + \ddot{\phi} \\ + \ddot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + w \\ + 0 \\ + 0 + \end{array}\right]_{l}^{P \rightarrow W_H} \\ + & \quad + + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times\left( + \left[\begin{array}{c} + \dot{\theta} \\ + \dot{\phi} \\ + \dot{\psi} + \end{array}\right]_{i}^{l} + \times + \left[\begin{array}{c} + w \\ + 0 \\ + 0 + \end{array}\right]_{l}^{P \rightarrow W_H} + \right) + + +The x, y, and z equations thus become: + +.. math:: + + x: & \quad + g_{x} - \frac{1}{m_H} \left( \frac{1}{2} \rho A \xi \left|\dot{w}\right| \dot{w} \right) + &=& + \ddot{x}_{i}^{P} + \ddot{w} - \dot{\phi}^2 w - \dot{\psi}^2 w \\ + y: & \quad + \frac{1}{m_H} \left( F_y^{W_H/S} + m_H g_{y} \right) + &=& + \ddot{y}_{i}^{P} + 2 \dot{\psi} \dot{w} + \ddot{\psi} w + \dot{\theta} \dot{\phi} w \\ + z: & \quad + \frac{1}{m_H} \left( F_z^{W_H/S} + m_H g_{z} \right) + &=& + \ddot{z}_{i}^{P} - \dot{\phi}\dot{w} -\ddot{\phi} w + \dot{\theta} \dot{\psi} w \\ + + +Recalling that the displacement of the liquid in the horizontal column, +:math:`w` is zero, as the center of mass of the liquid in the horizontal +column always remains at point :math:`l` even as liquid accelerates through +the pipe. Consequently, removing the :math:`w` terms from these equations +gives the expressions: + +.. math:: + + x: & \quad + g_{x} - \frac{1}{m_H} \left( \frac{1}{2} \rho A \xi \left|\dot{w}\right| \dot{w} \right) + &=& + \ddot{x}_{i}^{P} + \ddot{w} \\ + y: & \quad + \frac{1}{m_H} \left( F_y^{W_H/S} + m_H g_{y} \right) + &=& + \ddot{x}_{i}^{P} + 2 \dot{\psi} \dot{w} \\ + z: & \quad + \frac{1}{m_H} \left( F_z^{W_H/S} + m_H g_{z} \right) + &=& + \ddot{z}_{i}^{P} - \dot{\phi}\dot{w} \\ + + +Now that the accelerations of the three liquid columns have been +determined individually, we can extract the inertial forces and derive a +singular equation to describe the acceleration of the liquid in the +column. + +The inertial forces are then written as: + +.. math:: + + F_{x}^{W_{R}/S} + & = m_{R} \left( + \ddot{x}_{i}^{P} + + 2 \dot{\phi} \dot{w} + + \ddot{\phi} \left( \frac{L-B}{2} + w \right) + - \dot{\phi}^2 \frac{B}{2} + - \dot{\psi}^2 \frac{B}{2} + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} + w \right) + - g_{x} \right)\\ + F_{y}^{W_{R}/S} + & = m_{R} \left( + \ddot{y}_{i}^{P} + - 2 \dot{\theta} \dot{w} + + \ddot{\psi} \frac{B}{2} + - \ddot{\theta} \left( \frac{L-B}{2} + w \right) + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} + w \right) + + \dot{\theta}\dot{\phi} \frac{B}{2} + - g_{y} \right)\\ + F_{x}^{W_{L}/S} + & = m_{L} \left( + \ddot{x}_{i}^{P} + - 2\dot{\phi}\dot{w} + + \ddot{\phi} \left( \frac{L-B}{2} - w \right) + + \dot{\phi}^2 \frac{B}{2} + + \dot{\psi}^2 \frac{B}{2} + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} - w \right) + - g_{x} \right)\\ + F_{y}^{W_{L}/S} + & = m_{L} \left( + \ddot{y}_{i}^{P} + + 2 \dot{\theta} \dot{w} + - \ddot{\psi} \frac{B}{2} + - \ddot{\theta} \left( \frac{L-B}{2} - w \right) + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} - w \right) + - \dot{\theta}\dot{\phi} \frac{B}{2} + - g_{y} \right)\\ + F_{y}^{W_{H}/S} + & = m_{H} \left( + \ddot{y}_{i}^{P} + + 2\dot{\psi}\dot{w} + - g_{y} \right)\\ + F_{z}^{W_{H}/S} + & = m_{H} \left( + \ddot{z}_{i}^{P} + - \dot{\phi}\dot{w} + - g_{z} \right) + + + +Equation for :math:`\ddot{w}` from right liquid column (z-dimension): + +.. math:: + + \ddot{w} = + - \ddot{z}_{i}^{P} + + \ddot{\phi} \frac{B}{2} + - \dot{\theta}{\psi} \frac{B}{2} + + \dot{\theta}^2 \left( \frac{L-B}{2} + w \right) + + \dot{\phi}^2 \left( \frac{L-B}{2} + w \right) + + g_{z} + + +Equation for :math:`\ddot{w}` from left liquid column (z-dimension): + +.. math:: + + \ddot{w} = + \ddot{z}_{i}^{P} + + \ddot{\phi} \frac{B}{2} + - \dot{\theta}{\psi} \frac{B}{2} + - \dot{\theta}^2 \left( \frac{L-B}{2} - w \right) + - \dot{\phi}^2 \left( \frac{L-B}{2} - w \right) + - g_{z} + +Equation for :math:`\ddot{w}` from horizontal liquid column +(x-dimension): + +.. math:: + + \ddot{w} = + - \ddot{x}_{i}^{P} + + g_{x} + - \frac{1}{m_H} \left( \frac{1}{2} \rho A \xi \left|\dot{w}\right| \dot{w} \right) + + + +From Newton’s Second Law, we know that the acceleration of the +total liquid mass can be described accordingly: + +.. math:: + + m_{T} \ddot{w} = + m_{R}\left( \ddot{w} \right) + m_{L}\left( \ddot{w} \right) + m_{H}\left( \ddot{w} \right) + + +Where + +.. math:: + + m_{T} &= \rho A L \\ + m_{R} &= \rho A \left( \frac{L-B}{2} + w \right) \\ + m_{R} &= \rho A \left( \frac{L-B}{2} - w \right) \\ + m_{H} &= \rho A B + +Combining the above equations gives us the expression: + +.. math:: + + \rho A L \ddot{w} + & = \rho A \left( \frac{L-B}{2} + w \right) + \left[ - \ddot{z}_{i}^{P} + + \ddot{\phi} \frac{B}{2} + - \dot{\theta} \dot{\psi} \frac{B}{2} \right.\\ + & \qquad\qquad\qquad\qquad\qquad \left. + + \dot{\theta}^2 \left( \frac{L-B}{2} + w \right) + + \dot{\phi}^2 \left( \frac{L-B}{2} + w \right) + + g_{z} \right]\\ + & \quad + \rho A B \left( + - \ddot{x}_{i}^{P} + + g_{x} + - \frac{1}{m_{H}} \left( + \frac{1}{2} \rho A \xi \left|\dot{w}\right|\dot{w} + \right) + \right) + + +Finally, simplifying this expression gives us the final equation, +describing the movement of the liquid through the TLCD: + +.. math:: + + \rho A L \ddot{w} + & = - 2\rho A w \ddot{z}_{i}^{P} + + \rho A B \ddot{\phi} \left( \frac{L-B}{2} \right) + - \rho A B \dot{\theta}\dot{\psi} \left( \frac{L-B}{2} \right)\\ + & \qquad \qquad + + 2\rho A w \dot{\theta}^2 \left( L - B \right) + + 2\rho A w \dot{\phi}^2 \left( L - B \right)\\ + & \qquad \qquad + + 2\rho A w g_{z} + - \rho A B \ddot{x}_{i}^{P} + + \rho A B g_{x}\\ + & \qquad \qquad + - \frac{1}{2} \rho A B \xi \left|\dot{w}\right|\dot{w} + + + +Orthogonal TLCD +--------------- + +Following the same methodology as above in the side-side orientation (as +opposed to fore-aft) yields the following equations for the front, back, +and horizontal orthogonal columns: + +Back Vertical Orthogonal Liquid Column +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. math:: + + x: & \quad + \frac{1}{m_B} \left( F_x^{W_B/S} + m_B g_{x} \right) + &=& + \ddot{x}_{i}^{P} + + 2\dot{\phi}\dot{w_o} + + \ddot{\phi} \left(\frac{L-B}{2} + w_o \right) + + \dot{\psi}^2 \frac{B}{2} + - \dot{\phi}\dot{\theta} \frac{B}{2} + + \dot{\psi}\dot{\theta} \left(\frac{L-B}{2} + w_o \right) \\ + y: & \quad + \frac{1}{m_B} \left( F_y^{W_B/S} + m_B g_{y} \right) + &=& + \ddot{y}_{i}^{P} + - 2\dot{\theta}\dot{w_o} + - \ddot{\theta} \left(\frac{L-B}{2} + w_o \right) + + \dot{\psi}\dot{\phi} \left(\frac{L-B}{2} + w_o \right) + + \dot{\psi}^2 \frac{B}{2} + + \dot{\theta}^2 \frac{B}{2} \\ + z: & \quad + g_z + &=& + \ddot{z}_{i}^{P} + + \ddot{w_o} + - \ddot{\theta} \frac{B}{2} + - \dot{\theta}^2 \left(\frac{L-B}{2} + w_o \right) + - \dot{\phi}^2 \left(\frac{L-B}{2} + w_o \right) + - \dot{\phi}\dot{\psi} \frac{B}{2} + + + +Front Vertical Orthogonal Liquid Column +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. math:: + + x: & \quad + \frac{1}{m_F} \left( F_x^{W_F/S} + m_F g_{x} \right) + &=& + \ddot{x}_{i}^{P} + - 2\dot{\phi}\dot{w_o} + + \ddot{\phi} \left(\frac{L-B}{2} - w_o \right) + - \dot{\psi}^2 \frac{B}{2} + + \dot{\phi}\dot{\theta} \frac{B}{2} + + \dot{\psi}\dot{\theta} \left(\frac{L-B}{2} - w_o \right) \\ + y: & \quad + \frac{1}{m_F} \left( F_y^{W_F/S} + m_F g_{y} \right) + &=& + \ddot{y}_{i}^{P} + + 2\dot{\theta}\dot{w_o} + - \ddot{\theta} \left(\frac{L-B}{2} - w_o \right) + + \dot{\psi}\dot{\phi} \left(\frac{L-B}{2} - w_o \right) + - \dot{\psi}^2 \frac{B}{2} + - \dot{\theta}^2 \frac{B}{2} \\ + z: & \quad + g_z + &=& + \ddot{z}_{i}^{P} + - \ddot{w_o} + + \ddot{\theta} \frac{B}{2} + - \dot{\theta}^2 \left(\frac{L-B}{2} - w_o \right) + - \dot{\phi}^2 \left(\frac{L-B}{2} - w_o \right) + + \dot{\phi}\dot{\psi} \frac{B}{2} + + + +Horizontal Orthogonal Liquid Column +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. math:: + + x: & \quad + \frac{1}{m_H} \left( F_x^{W_H/S} + m_H g_{x} \right) + &=& + \ddot{x}_{i}^{P} - 2 \dot{\psi}\dot{w_o} \\ + y: & \quad + \frac{1}{m_H} \left( m_H g_{y} - \frac{1}{2} \rho A \xi \left|\dot{w_o}\right| \dot{w_o} \right) + &=& + \ddot{y}_{i}^{P} + \ddot{w_o} \\ + z: & \quad + \frac{1}{m_H} \left( F_z^{W_H/S} + m_H g_{z} \right) + &=& + \ddot{z}_{i}^{P} + 2 \dot{\theta}\dot{w_o} + + +Extracting the inertial forces from these equations leaves us with: + +.. math:: + + F_{x}^{W_{B}/S} + & = m_{B} \left( + \ddot{x}_{i}^{P} + + 2 \dot{\phi} \dot{w_o} + + \ddot{\phi} \left( \frac{L-B}{2} + w_o \right) + + \ddot{\psi} \frac{B}{2} + - \dot{\phi}\dot{\theta} \frac{B}{2} + + \dot{\psi}\dot{\theta} \left( \frac{L-B}{2} + w_o \right) + - g_{x} \right)\\ + F_{y}^{W_{B}/S} + & = m_{B} \left( + \ddot{y}_{i}^{P} + - 2\dot{\theta} \dot{w_o} + - \ddot{\theta} \left( \frac{L-B}{2} + w_o \right) + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} + w_o \right) + + \dot{\psi}^2 \frac{B}{2} + + \dot{\theta}^2 \frac{B}{2} + - g_{y} \right)\\ + F_{x}^{W_{F}/S} + & = m_{F} \left( + \ddot{x}_{i}^{P} + - 2\dot{\phi}\dot{w_o} + + \ddot{\phi} \left( \frac{L-B}{2} - w_o \right) + - \ddot{\psi} \frac{B}{2} + + \dot{\phi}\dot{\theta} \frac{B}{2} + + \dot{\psi}\dot{\theta} \left( \frac{L-B}{2} - w_o \right) + - g_{x} \right)\\ + F_{y}^{W_{F}/S} + & = m_{F} \left( + \ddot{y}_{i}^{P} + + 2 \dot{\theta} \dot{w_o} + - \ddot{\theta} \left( \frac{L-B}{2} - w_o \right) + + \dot{\psi}\dot{\phi} \left( \frac{L-B}{2} - w_o \right) + - \dot{\psi}^2 \frac{B}{2} + - \dot{\theta}^2 \frac{B}{2} + - g_{y} \right)\\ + F_{x}^{W_{H}/S} + & = m_{H} \left( + \ddot{x}_{i}^{P} + - 2\dot{\psi}\dot{w_o} + - g_{x} \right)\\ + F_{z}^{W_{H}/S} + & = m_{H} \left( + \ddot{z}_{i}^{P} + + 2\dot{\theta}\dot{w_o} + - g_{z} \right) +.. there might be a descrepency with the 2 in the last term. Doesn't match the + other case. + + +The remaining equations, when combined, yield the final equation: + +.. math:: + + \rho A L \ddot{w} + & = \rho A \left( \frac{L-B}{2} + w_o \right) + \left[ - \ddot{z}_{i}^{P} + + \ddot{\theta} \frac{B}{2} + + \dot{\theta}^2 \left( \frac{L-B}{2} + w_o \right) \right.\\ + & \qquad\qquad\qquad\qquad\qquad \left. + + \dot{\phi}^2 \left( \frac{L-B}{2} + w_o \right) + + \dot{\phi}\dot{\psi} \frac{B}{2} + + g_{z} \right]\\ + & + \rho A \left( \frac{L-B}{2} - w_o \right) + \left[ \ddot{z}_{i}^{P} + + \ddot{\theta} \frac{B}{2} + - \dot{\theta}^2 \left( \frac{L-B}{2} - w_o \right) \right.\\ + & \qquad\qquad\qquad\qquad\qquad \left. + - \dot{\phi}^2 \left( \frac{L-B}{2} - w_o \right) + + \dot{\phi}\dot{\psi} \frac{B}{2} + - g_{z} \right]\\ + & \quad + \rho A B \left( + - \ddot{y}_{i}^{P} + + g_{y} \right) + - \frac{1}{2} \rho A \xi \left|\dot{w_o}\right|\dot{w_o} + +Which can be simplified to become: + +.. math:: + + \rho A L \ddot{w_o} + & = - 2\rho A w_o \ddot{z}_{i}^{P} + + \rho A B \ddot{\theta} \left( \frac{L-B}{2} \right) + - \rho A B \dot{\phi}\dot{\psi} \left( \frac{L-B}{2} \right)\\ + & \qquad \qquad + + 2\rho A w_o \dot{\theta}^2 \left( L - B \right) + + 2\rho A w_o \dot{\phi}^2 \left( L - B \right) \\ + & \qquad \qquad + + 2\rho A w_o g_{z} + - \rho A B \ddot{y}_{i}^{P} + + \rho A B g_{y}\\ + & \qquad \qquad + - \frac{1}{2} \rho A B \xi \left|\dot{w_o}\right|\dot{w_o} + + diff --git a/docs/source/user/servodyn-stc/StC_Theory.rst b/docs/source/user/servodyn-stc/StC_Theory.rst new file mode 100644 index 0000000000..5a09ad6356 --- /dev/null +++ b/docs/source/user/servodyn-stc/StC_Theory.rst @@ -0,0 +1,849 @@ +.. _StC-Theory: + +========================================================== +Theory Manual for the Tuned Mass Damper Module in OpenFAST +========================================================== + +:Author: William La Cava & Matthew A. Lackner + Department of Mechanical and Industrial Engineering + University of Massachusetts Amherst + Amherst, MA 01003 + ``wlacava@umass.edu``, ``lackner@ecs.umass.edu`` + +This document was edited by Jason M. Jonkman of NREL +to include an independent vertically oriented TMD in OpenFAST. +``jason.jonkman@nrel.gov`` + + +This manual describes updated functionality in OpenFAST that simulates +the addition of tuned mass dampers (TMDs) for structural control. The +dampers can be added to the blades, nacelle, tower, or substructure. For +application studies of these systems, refer to +:cite:`stc-lackner_passive_2011,stc-lackner_structural_2011,stc-namik_active_2013,stc-stewart_effect_2011,stc-stewart_impact_2014,stc-stewart_optimization_2013`. +The TMDs are three independent, 1 DOF, linear mass spring damping +elements that act in the local :math:`x`, :math:`y`, and :math:`z` +coordinate systems of each component. The other functionality of the +structural control (StC) module, including an omnidirectional TMD and +TLCD are not documented herein. We first present the theoretical +background and then describe the code changes. + +Theoretical Background +====================== + +Definitions +----------- + +.. container:: + :name: tab:defs + + .. table:: Definitions + + +-----------------+--------------------+ + | Variable | Description | + +=================+====================+ + | |O_eq| | |O_desc| | + +-----------------+--------------------+ + | |P_eq| | |P_desc| | + +-----------------+--------------------+ + | |TMD_eq| | |TMD_desc| | + +-----------------+--------------------+ + | |G_eq| | |G_desc| | + +-----------------+--------------------+ + | |N_eq| | |N_desc| | + +-----------------+--------------------+ + | |TMD_OG_eq| | |TMD_OG_desc| | + +-----------------+--------------------+ + | |TMD_PN_eq| | |TMD_PN_desc| | + +-----------------+--------------------+ + | |TMD_X_eq| | |TMD_X_desc| | + +-----------------+--------------------+ + | |TMD_Y_eq| | |TMD_Y_desc| | + +-----------------+--------------------+ + | |TMD_Z_eq| | |TMD_Z_desc| | + +-----------------+--------------------+ + | |P_OG_eq| | |P_OG_desc| | + +-----------------+--------------------+ + | |R_OG_eq| | |R_OG_desc| | + +-----------------+--------------------+ + | |R_GN_eq| | |R_GN_desc| | + +-----------------+--------------------+ + | |Omega_NON_eq| | |Omega_NON_desc| | + +-----------------+--------------------+ + | |OmegaD_NON_eq| | |OmegaD_NON_desc| | + +-----------------+--------------------+ + | |a_GOG_eq| | |a_GOG_desc| | + +-----------------+--------------------+ + | |a_GON_eq| | |a_GON_desc| | + +-----------------+--------------------+ + +.. |O_eq| replace:: :math:`O` +.. |O_desc| replace:: origin point of global inertial reference frame +.. |P_eq| replace:: :math:`P` +.. |P_desc| replace:: origin point of non-inertial reference frame fixed to component (blade, nacelle, tower, substructure) where TMDs are at rest +.. |TMD_eq| replace:: :math:`TMD` +.. |TMD_desc| replace:: location point of a TMD +.. |G_eq| replace:: :math:`G` +.. |G_desc| replace:: axis orientation of global reference frame +.. |N_eq| replace:: :math:`N` +.. |N_desc| replace:: axis orientation of local component reference frame with unit vectors :math:`\hat{\imath}, \hat{\jmath}, \hat{k}` +.. |TMD_OG_eq| replace:: :math:`\vec{r}_{_{_{TMD/O_G}}} = \left[ \begin{array}{c} x \\ y\\ z \end{array} \right]_{_{TMD/O_G}}` +.. |TMD_OG_desc| replace:: position of a TMD with respect to (w.r.t.) :math:`O` with orientation :math:`G` +.. |TMD_PN_eq| replace:: :math:`\vec{r}_{_{_{TMD/P_N}}} = \left[ \begin{array}{c} x \\ y\\ z \end{array} \right]_{_{TMD/P_N}}` +.. |TMD_PN_desc| replace:: position of a TMD w.r.t. :math:`P_N` +.. |TMD_X_eq| replace:: :math:`\vec{r}_{_{_{TMD_X}}}` +.. |TMD_X_desc| replace:: position vector for :math:`TMD_X` +.. |TMD_Y_eq| replace:: :math:`\vec{r}_{_{_{TMD_Y}}}` +.. |TMD_Y_desc| replace:: position vector for :math:`TMD_Y` +.. |TMD_Z_eq| replace:: :math:`\vec{r}_{_{_{TMD_Z}}}` +.. |TMD_Z_desc| replace:: position vector for :math:`TMD_Z` +.. |P_OG_eq| replace:: :math:`\vec{r}_{_{P/O_G}} =\left[ \begin{array}{c} x \\ y\\ z \end{array} \right]_{_{P/O_G}}` +.. |P_OG_desc| replace:: position vector of component w.r.t. :math:`O_G` +.. |R_OG_eq| replace:: :math:`R_{_{N/G}}` +.. |R_OG_desc| replace:: 3 x 3 rotation matrix transforming orientation :math:`G` to :math:`N` +.. |R_GN_eq| replace:: :math:`R_{_{G/N}} = R_{_{N/G}}^T` +.. |R_GN_desc| replace:: transformation from :math:`N` to :math:`G` +.. |Omega_NON_eq| replace:: :math:`\vec{\omega}_{_{N/O_N}} = \dot{\left[ \begin{array}{c} \theta \\ \phi \\ \psi \end{array} \right]}_{_{N/O_N}}` +.. |Omega_NON_desc| replace:: angular velocity of component in orientation :math:`N`; defined likewise for :math:`G` +.. |OmegaD_NON_eq| replace:: :math:`\dot{\vec{\omega}}_{_{N/O_N}} = \vec{\alpha}_{_{N/O_N}}` +.. |OmegaD_NON_desc| replace:: angular acceleration of component +.. |a_GOG_eq| replace:: :math:`\vec{a}_{G/O_G} = \left[ \begin{array}{c}0 \\ 0\\ -g \end{array} \right]_{/O_G}` +.. |a_GOG_desc| replace:: gravitational acceleration in global coordinates +.. |a_GON_eq| replace:: :math:`\vec{a}_{G/O_N} = R_{_{N/G}} \vec{a}_{G/O_G} = \left[ \begin{array}{c}a_{_{G_X}} \\ a_{_{G_Y}}\\ a_{_{G_Z}} \end{array} \right]_{/O_N}` +.. |a_GON_desc| replace:: gravity w.r.t. :math:`O_N` + + +Equations of motion +------------------- + +The position vectors of the TMDs in the two reference frames :math:`O` +and :math:`P` are related by + +.. math:: \vec{r}_{_{TMD/O_G}} = \vec{r}_{_{P/O_G}} + \vec{r}_{_{TMD/P_G}} + +Expressed in orientation :math:`N`, + +.. math:: \vec{r}_{_{TMD/O_N}} = \vec{r}_{_{P/O_N}} + \vec{r}_{_{TMD/P_N}} + +.. math:: \Rightarrow \vec{r}_{_{TMD/P_N}} = \vec{r}_{_{TMD/O_N}} - \vec{r}_{_{P/O_N}} + +Differentiating, [1]_ + +.. math:: + \dot{\vec{r}}_{_{TMD/P_N}}= \dot{\vec{r}}_{_{TMD/O_N}} + - \dot{\vec{r}}_{_{P/O_N}} + - \vec{\omega}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}} + +differentiating again gives the acceleration of the TMD w.r.t. :math:`P` +(the nacelle position), oriented with :math:`N`: + +.. math:: + \begin{array}{cc} + \ddot{\vec{r}}_{_{TMD/P_N}} = + & \ddot{\vec{r}}_{_{TMD/O_N}} + - \ddot{\vec{r}}_{_{P/O_N}} - \vec{\omega}_{_{N/O_N}} + \times (\vec{\omega}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}}) \\[1.1em] + &- \vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}} + - 2 \vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD/P_N}} + \end{array} + :label: accel + +The right-hand side contains the following terms: + +.. container:: + :name: tab: + + .. table:: RHS terms + + +--------------------+-----------------------+ + | |Rddot_TMD_ON_eq| | |Rddot_TMD_ON_desc| | + +--------------------+-----------------------+ + | |Rddot_P_ON_eq| | |Rddot_P_ON_desc| | + +--------------------+-----------------------+ + | |Omega_N_ON_eq| | |Omega_N_ON_desc| | + +--------------------+-----------------------+ + | |CentripAcc_eq| | |CentripAcc_desc| | + +--------------------+-----------------------+ + | |TangentAcc_eq| | |TangentAcc_desc| | + +--------------------+-----------------------+ + | |Coriolus_eq| | |Coriolus_desc| | + +--------------------+-----------------------+ + +.. |Rddot_TMD_ON_eq| replace:: :math:`\ddot{\vec{r}}_{_{TMD/O_N}}` +.. |Rddot_TMD_ON_desc| replace:: acceleration of the TMD in the *inertial* frame :math:`O_N` +.. |Rddot_P_ON_eq| replace:: :math:`\ddot{\vec{r}}_{_{P/O_N}} = R_{_{N/G}} \ddot{\vec{r}}_{_{P/O_G}}` +.. |Rddot_P_ON_desc| replace:: acceleration of the Nacelle origin :math:`P` w.r.t. :math:`O_N` +.. |Omega_N_ON_eq| replace:: :math:`\vec{\omega}_{_{N/O_N}} = R_{_{N/G}} \vec{\omega}_{_{N/O_G}}` +.. |Omega_N_ON_desc| replace:: angular velocity of nacelle w.r.t. :math:`O_N` +.. |CentripAcc_eq| replace:: :math:`\vec{\omega}_{_{N/O_N}} \times (\vec{\omega}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}})` +.. |CentripAcc_desc| replace:: Centripetal acceleration +.. |TangentAcc_eq| replace:: :math:`\vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}}` +.. |TangentAcc_desc| replace:: Tangential acceleration +.. |Coriolus_eq| replace:: :math:`2\vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD/P_N}}` +.. |Coriolus_desc| replace:: Coriolis acceleration + + +The acceleration in the inertial frame +:math:`\ddot{\vec{r}}_{_{TMD/O_N}}` can be replaced with a force balance + +.. math:: + \begin{aligned} + \ddot{\vec{r}}_{_{TMD/O_N}} = \left[ + \begin{array}{c} \ddot{x} \\ + \ddot{y} \\ + \ddot{z} + \end{array} + \right]_{_{TMD/O_N}} = \frac{1}{m} \left[ + \begin{array}{c} + \sum{F_X} \\ + \sum{F_Y} \\ + \sum{F_Z} + \end{array} + \right]_{_{TMD/O_N}} = \frac{1}{m} \vec{F}_{_{TMD/O_N}} + \end{aligned} + +Substituting the force balance into Equation :eq:`accel` gives +the general equation of motion for a TMD: + +.. math:: + \begin{array}{cc} + \ddot{\vec{r}}_{_{TMD/P_N}} = & \frac{1}{m} \vec{F}_{_{TMD/O_N}} + - \ddot{\vec{r}}_{_{P/O_N}} + - \vec{\omega}_{_{N/O_N}} \times (\vec{\omega}_{_{N/O_N}} + \times \vec{r}_{_{TMD/P_N}}) \\[1.1em] + & - \vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD/P_N}} + - 2 \vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD/P_N}} + \end{array} + :label: EOM + +We will now solve the equations of motion for :math:`TMD_X`, +:math:`TMD_Y`, and :math:`TMD_Z`. + +TMD_X : +~~~~~~~ + +The external forces :math:`\vec{F}_{_{TMD_X/O_N}}` are given by + +.. math:: + \vec{F}_{_{TMD_X/O_N}} = \left[ + \begin{array}{c} + - c_x \dot{x}_{_{TMD_X/P_N}} + - k_x x_{_{TMD_X/P_N}} + + m_x a_{_{G_X/O_N}} + + F_{ext_x} + + F_{StopFrc_{X}} \\ + F_{Y_{_{TMD_X/O_N}}} + + m_x a_{_{G_Y/O_N}} \\ + F_{Z_{_{TMD_X/O_N}}} + + m_x a_{_{G_Z/O_N}} + \end{array} + \right] + +:math:`TMD_X` is fixed to frame :math:`N` in the :math:`y` and :math:`z` +directions so that + +.. math:: + {r}_{_{TMD_X/P_N}} = \left[ + \begin{array}{c} + x_{_{TMD_X/P_N}} \\ + 0 \\ + 0 + \end{array} + \right] + +The other components of Eqn. :eq:`EOM` are: + +.. math:: + \vec{\omega}_{_{N/O_N}} \times (\vec{\omega}_{_{N/O_N}} \times \vec{r}_{_{TMD_X/P_N}}) + = x_{_{TMD_X/P_N}} \left[ + \begin{array}{c} + - (\dot{\phi}_{_{N/O_N}}^2 + \dot{\psi}_{_{N/O_N}}^2) \\ + \dot{\theta}_{_{N/O_N}}\dot{\phi}_{_{N/O_N}} \\ + \dot{\theta}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}} + \end{array} + \right] + +.. math:: + 2\vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD_X/P_N}} + = \dot{x}_{_{TMD_X/P_N}} \left[ + \begin{array}{c} 0 \\ + 2\dot{\psi}_{_{N/O_N}} \\ + -2\dot{\phi}_{_{N/O_N}} + \end{array} + \right] + +.. math:: \vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD_X/P_N}} = x_{_{TMD_X/P_N}} \left[ \begin{array}{c} 0 \\ \ddot{\psi}_{_{N/O_N}} \\ -\ddot{\phi}_{_{N/O_N}}\end{array} \right] + +Therefore :math:`\ddot{x}_{_{TMD_X/P_N}}` is governed by the equations + +.. math:: + \begin{aligned} + \ddot{x}_{_{TMD_X/P_N}} =& (\dot{\phi}_{_{N/O_N}}^2 + + \dot{\psi}_{_{N/O_N}}^2-\frac{k_x}{m_x}) x_{_{TMD_X/P_N}} + - (\frac{c_x}{m_x}) \dot{x}_{_{TMD_X/P_N}} + -\ddot{x}_{_{P/O_N}}+a_{_{G_X/O_N}} \\ + &+ \frac{1}{m_x} ( F_{ext_X} + F_{StopFrc_{X}}) + \end{aligned} + :label: EOM_Xx + +The forces :math:`F_{Y_{_{TMD_X/O_N}}}` and :math:`F_{Z_{_{TMD_X/O_N}}}` +are solved noting +:math:`\ddot{y}_{_{TMD_X/P_N}} = \ddot{z}_{_{TMD_X/P_N}} = 0`: + +.. math:: + F_{Y_{_{TMD_X/O_N}}} = m_x \left( - a_{_{G_Y/O_N}} +\ddot{y}_{_{P/O_N}} + + (\ddot{\psi}_{_{N/O_N}} + + \dot{\theta}_{_{N/O_N}}\dot{\phi}_{_{N/O_N}} ) x_{_{TMD_X/P_N}} + + 2\dot{\psi}_{_{N/O_N}} \dot{x}_{_{TMD_X/P_N}} \right) + :label: EOM_Xy + +.. math:: + F_{Z_{_{TMD_X/O_N}}} = m_x \left( - a_{_{G_Z/O_N}} +\ddot{z}_{_{P/O_N}} + - (\ddot{\phi}_{_{N/O_N}} + - \dot{\theta}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}} ) x_{_{TMD_X/P_N}} + - 2\dot{\phi}_{_{N/O_N}} \dot{x}_{_{TMD_X/P_N}} \right) + :label: EOM_Xz + +TMD_Y: +~~~~~~ + +The external forces :math:`\vec{F}_{_{TMD_Y/P_N}}` on :math:`TMD_Y` are +given by + +.. math:: + \vec{F}_{_{TMD_Y/P_N}} = \left[ + \begin{array}{c} + F_{X_{_{TMD_Y/O_N}}} + m_y a_{_{G_X/O_N}}\\ + - c_y \dot{y}_{_{TMD_Y/P_N}} - k_y y_{_{TMD_Y/P_N}} + + m_y a_{_{G_Y/O_N}} + F_{ext_y} + F_{StopFrc_{Y}} \\ + F_{Z_{_{TMD_Y/O_N}}}+ m_y a_{_{G_Z/O_N}} + \end{array} + \right] + +:math:`TMD_Y` is fixed to frame :math:`N` in the :math:`x` and :math:`z` +directions so that + +.. math:: + {r}_{_{TMDYX/P_N}} = \left[ + \begin{array}{c} + 0 \\ + y_{_{TMD_Y/P_N}} \\ + 0 + \end{array} + \right] + +The other components of Eqn. :eq:`EOM` are: + +.. math:: + \vec{\omega}_{_{N/O_N}} \times (\vec{\omega}_{_{N/O_N}} + \times \vec{r}_{_{TMD_Y/P_N}}) + = y_{_{TMD_Y/P_N}} + \left[ + \begin{array}{c} + \dot{\theta}_{_{N/O_N}}\dot{\phi}_{_{N/O_N}} \\ + -(\dot{\theta}_{_{N/O_N}}^2 + \dot{\psi}_{_{N/O_N}}^2) \\ + \dot{\phi}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}} + \end{array} + \right] + +.. math:: + 2\vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD_Y/P_N}} + = \dot{y}_{_{TMD_Y/P_N}} \left[ + \begin{array}{c} + - 2 \dot{\psi}_{_{N/O_N}} \\ + 0 \\ + 2 \dot{\theta}_{_{N/O_N}} + \end{array} + \right] + +.. math:: + \vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD_Y/P_N}} + = y_{_{TMD_Y/P_N}} \left[ + \begin{array}{c} + - \ddot{\psi}_{_{N/O_N}} \\ + 0 \\ + \ddot{\theta}_{_{N/O_N}} + \end{array} + \right] + +Therefore :math:`\ddot{y}_{_{TMD_Y/P_N}}` is governed by the equations + +.. math:: + \begin{aligned} + \ddot{y}_{_{TMD_Y/P_N}} + = & (\dot{\theta}_{_{N/O_N}}^2 + + \dot{\psi}_{_{N/O_N}}^2-\frac{k_y}{m_y}) y_{_{TMD_Y/P_N}} + - (\frac{c_y}{m_y}) \dot{y}_{_{TMD_Y/P_N}} + -\ddot{y}_{_{P/O_N}} + a_{_{G_Y/O_N}}\\ + &+ \frac{1}{m_y} (F_{ext_Y} + F_{StopFrc_{Y}}) + \end{aligned} + :label: EOM_Yy + +The forces :math:`F_{X_{_{TMD_Y/O_N}}}` and :math:`F_{Z_{_{TMD_Y/O_N}}}` +are solved noting +:math:`\ddot{x}_{_{TMD_Y/P_N}} = \ddot{z}_{_{TMD_Y/P_N}} = 0`: + +.. math:: + F_{X_{_{TMD_Y/O_N}}} = m_y \left( - a_{_{G_X/O_N}} + \ddot{x}_{_{P/O_N}} + - (\ddot{\psi}_{_{N/O_N}} + - \dot{\theta}_{_{N/O_N}}\dot{\phi}_{_{N/O_N}}) y_{_{TMD_Y/P_N}} + - 2\dot{\psi}_{_{N/O_N}} \dot{y}_{_{TMD_Y/P_N}} \right) + :label: EOM_Yx + +.. math:: + F_{Z_{_{TMD_Y/O_N}}} = m_y \left( - a_{_{G_Z/O_N}} + \ddot{z}_{_{P/O_N}} + + (\ddot{\theta}_{_{N/O_N}} + + \dot{\phi}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}}) y_{_{TMD_Y/P_N}} + + 2\dot{\theta}_{_{N/O_N}} \dot{y}_{_{TMD_Y/P_N}} \right) + :label: EOM_Yz + + +TMD_Z : +~~~~~~~ + +The external forces :math:`\vec{F}_{_{TMD_Z/O_N}}` are given by + +.. math:: + \vec{F}_{_{TMD_Z/O_N}} = \left[ + \begin{array}{c} + F_{X_{_{TMD_Z/O_N}}} + m_z a_{_{G_X/O_N}} \\ + F_{Y_{_{TMD_Z/O_N}}} + m_z a_{_{G_Y/O_N}} \\ + - c_z \dot{z}_{_{TMD_Z/P_N}} - k_z z_{_{TMD_Z/P_N}} + + m_z a_{_{G_Z/O_N}} + F_{ext_z} + F_{StopFrc_{Z}} + \end{array} + \right] + + +:math:`TMD_Z` is fixed to frame :math:`N` in the :math:`x` and :math:`y` +directions so that + +.. math:: + {r}_{_{TMD_Z/P_N}} = \left[ + \begin{array}{c} + 0 \\ + 0 \\ + z_{_{TMD_Z/P_N}} + \end{array} + \right] + +The other components of Eqn. :eq:`EOM` are: + +.. math:: + \vec{\omega}_{_{N/O_N}} \times (\vec{\omega}_{_{N/O_N}} \times \vec{r}_{_{TMD_Z/P_N}}) + = z_{_{TMD_Z/P_N}} \left[ + \begin{array}{c} + \dot{\theta}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}} \\ + \dot{\phi}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}} \\ + -(\dot{\theta}_{_{N/O_N}}^2 + \dot{\phi}_{_{N/O_N}}^2) + \end{array} + \right] + +.. math:: + 2\vec{\omega}_{_{N/O_N}} \times \dot{\vec{r}}_{_{TMD_Z/P_N}} + = \dot{z}_{_{TMD_Z/P_N}} \left[ + \begin{array}{c} + 2\dot{\phi}_{_{N/O_N}} \\ + -2\dot{\theta}_{_{N/O_N}} \\ + 0 + \end{array} + \right] + +.. math:: + \vec{\alpha}_{_{N/O_N}} \times \vec{r}_{_{TMD_Z/P_N}} + = z_{_{TMD_Z/P_N}} \left[ + \begin{array}{c} + \ddot{\phi}_{_{N/O_N}} \\ + -\ddot{\theta}_{_{N/O_N}} \\ + 0 + \end{array} + \right] + +Therefore :math:`\ddot{z}_{_{TMD_Z/P_N}}` is governed by the equations + +.. math:: + \begin{aligned} + \ddot{z}_{_{TMD_Z/P_N}} + = & (\dot{\theta}_{_{N/O_N}}^2 + + \dot{\phi}_{_{N/O_N}}^2-\frac{k_z}{m_z}) z_{_{TMD_Z/P_N}} + - (\frac{c_z}{m_z}) \dot{z}_{_{TMD_Z/P_N}} + -\ddot{z}_{_{P/O_N}} + a_{_{G_Z/O_N}}\\ + &+ \frac{1}{m_z} (F_{ext_Z} + F_{StopFrc_{Z}}) + \end{aligned} + :label: EOM_Zz + + + +The forces :math:`F_{X_{_{TMD_Z/O_N}}}` and :math:`F_{Z_{_{TMD_Z/O_N}}}` +are solved noting +:math:`\ddot{x}_{_{TMD_Z/P_N}} = \ddot{y}_{_{TMD_Z/P_N}} = 0`: + +.. math:: + F_{X_{_{TMD_Z/O_N}}} = m_z \left( - a_{_{G_X/O_N}} + \ddot{x}_{_{P/O_N}} + + (\ddot{\phi}_{_{N/O_N}} + + \dot{\theta}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}}) z_{_{TMD_Z/P_N}} + + 2\dot{\phi}_{_{N/O_N}} \dot{z}_{_{TMD_Z/P_N}} \right) + :label: EOM_Zx + +.. math:: + F_{Y_{_{TMD_Z/O_N}}} = m_z \left( - a_{_{G_Y/O_N}} + \ddot{y}_{_{P/O_N}} + - (\ddot{\theta}_{_{N/O_N}} + - \dot{\phi}_{_{N/O_N}}\dot{\psi}_{_{N/O_N}}) z_{_{TMD_Z/P_N}} + - 2\dot{\theta}_{_{N/O_N}} \dot{z}_{_{TMD_Z/P_N}} \right) + :label: EOM_Zy + + +State Equations +--------------- + +Inputs: +~~~~~~~ + +The inputs are the component linear acceleration and angular position, +velocity and acceleration: + +.. math:: + \vec{u} = \left[ + \begin{array}{c} + \ddot{\vec{r}}_{_{P/O_G}} \\ + \vec{R}_{_{N/G}} \\ + \vec{\omega}_{_{N/O_G}} \\ + \vec{\alpha}_{_{N/O_G}} + \end{array} + \right] + \Rightarrow \left[ + \begin{array}{c} + \ddot{\vec{r}}_{_{P/O_N}} \\ + \vec{\omega}_{_{N/O_N}} \\ + \vec{\alpha}_{_{N/O_N}} + \end{array} + \right] + = \left[ + \begin{array}{c} + \vec{R}_{_{N/G}} \ddot{\vec{r}}_{_{P/O_G}} \\ + \vec{R}_{_{N/G}} \vec{\omega}_{_{N/O_G}} \\ + \vec{R}_{_{N/G}} \vec{\alpha}_{_{N/O_G} + }\end{array} + \right] + +States: +~~~~~~~ + +The states are the position and velocity of the TMDs along their +respective DOFs in the component reference frame: + +.. math:: + \vec{R}_{_{TMD/P_N}} = \left[ + \begin{array}{c} + x \\ + \dot{x} \\ + y \\ + \dot{y} \\ + z \\ + \dot{z} + \end{array} + \right]_{_{TMD/P_N}} + = \left[ + \begin{array}{c} + {x}_{_{TMD_X/P_N}} \\ + \dot{x}_{_{TMD_X/P_N}} \\ + {y}_{_{TMD_Y/P_N}} \\ + \dot{y}_{_{TMD_Y/P_N}} \\ + {z}_{_{TMD_Z/P_N}} \\ + \dot{z}_{_{TMD_Z/P_N}} + \end{array} + \right] + +The equations of motion can be re-written as a system of non-linear +first-order equations of the form + +.. math:: + \dot{\vec{R}}_{_{TMD}} = A \vec{R}_{_{TMD}} + B + +\ where + +.. math:: + A(\vec{u}) = \left[ + \begin{array}{cccccc} + 0& 1 &0&0&0&0 \\ + (\dot{\phi}_{_{P/O_N}}^2 + \dot{\psi}_{_{P/O_N}}^2-\frac{k_x}{m_x}) & - (\frac{c_x}{m_x}) &0&0&0&0 \\ + 0&0&0& 1 &0&0 \\ + 0&0& (\dot{\theta}_{_{P/O_N}}^2 + \dot{\psi}_{_{P/O_N}}^2-\frac{k_y}{m_y}) & - (\frac{c_y}{m_y}) &0&0 \\ + 0&0&0&0&0& 1 \\ + 0&0&0&0& (\dot{\theta}_{_{P/O_N}}^2 + \dot{\phi}_{_{P/O_N}}^2-\frac{k_z}{m_z}) & - (\frac{c_z}{m_z}) \\ + \end{array} \right] + +and + +.. math:: + B(\vec{u}) = \left[ + \begin{array}{c} + 0 \\ + -\ddot{x}_{_{P/O_N}}+a_{_{G_X/O_N}} + \frac{1}{m_x} ( F_{ext_X} + F_{StopFrc_{X}}) \\ + 0 \\ + -\ddot{y}_{_{P/O_N}}+a_{_{G_Y/O_N}} + \frac{1}{m_y} (F_{ext_Y}+ F_{StopFrc_{Y}}) \\ + 0 \\ + -\ddot{z}_{_{P/O_N}}+a_{_{G_Z/O_N}} + \frac{1}{m_z} (F_{ext_Z}+ F_{StopFrc_{Z}}) + \end{array} + \right] + +The inputs are coupled to the state variables, resulting in A and B as +:math:`f(\vec{u})`. + +Outputs +------- + +The output vector :math:`\vec{Y}` is + +.. math:: + \vec{Y} = \left[ + \begin{array}{c} + \vec{F}_{_{P_G}} \\ + \vec{M}_{_{P_G}} + \end{array} + \right] + +The output includes reaction forces corresponding to +:math:`F_{Y_{_{TMD_X/O_N}}}`, :math:`F_{Z_{_{TMD_X/O_N}}}`, +:math:`F_{X_{_{TMD_Y/O_N}}}`, :math:`F_{Z_{_{TMD_Y/O_N}}}`, +:math:`F_{X_{_{TMD_Z/O_N}}}`, and :math:`F_{Y_{_{TMD_Z/O_N}}}` from Eqns. +:eq:`EOM_Xy`, :eq:`EOM_Xz`, :eq:`EOM_Yx`, :eq:`EOM_Yz`, :eq:`EOM_Zx`, and +:eq:`EOM_Zy`. The resulting forces :math:`\vec{F}_{_{P_G}}` and moments +:math:`\vec{M}_{_{P_G}}` acting on the component are + +.. math:: + \begin{aligned} + \vec{F}_{_{P_G}} = R^T_{_{N/G}} & \left[ + \begin{array}{c} + k_x {x}_{_{TMD/P_N}} + c_x \dot{x}_{_{TMD/P_N}} - F_{StopFrc_{X}} - F_{ext_x} - F_{X_{_{TMD_Y/O_N}}} - F_{X_{_{TMD_Z/O_N}}} \\ + k_y {y}_{_{TMD/P_N}} + c_y \dot{y}_{_{TMD/P_N}} - F_{StopFrc_{Y}} - F_{ext_y} - F_{Y_{_{TMD_X/O_N}}} - F_{Y_{_{TMD_Z/O_N}}} \\ + k_z {z}_{_{TMD/P_N}} + c_z \dot{z}_{_{TMD/P_N}} - F_{StopFrc_{Z}} - F_{ext_z} - F_{Z_{_{TMD_X/O_N}}} - F_{Z_{_{TMD_Y/O_N}}} + \end{array} + \right] + \end{aligned} + +and + +.. math:: + \vec{M}_{_{P_G}} = R^T_{_{N/G}} \left[ + \begin{array}{c} + M_{_X} \\ + M_{_Y} \\ + M_{_Z} + \end{array} + \right]_{_{N/N}} = R^T_{_{N/G}} \left[ + \begin{array}{c} + -(F_{Z_{_{TMD_Y/O_N}}}) y_{_{TMD/P_N}} + (F_{Y_{_{TMD_Z/O_N}}} ) z_{_{TMD/P_N}} \\ + (F_{Z_{_{TMD_X/O_N}}}) x_{_{TMD/P_N}} - (F_{X_{_{TMD_Z/O_N}}} ) z_{_{TMD/P_N}} \\ + -(F_{Y_{_{TMD_X/O_N}}}) x_{_{TMD/P_N}} + ( F_{X_{_{TMD_Y/O_N}}}) y_{_{TMD/P_N}} + \end{array} + \right] + +Stop Forces +~~~~~~~~~~~ + +The extra forces :math:`F_{StopFrc_{X}}`, :math:`F_{StopFrc_{Y}}`, and +:math:`F_{StopFrc_{Z}}` are added to output forces in the case that the +movement of TMD_X, TMD_Y, or TMD_Z exceeds the maximum track length for +the mass. Otherwise, they equal zero. The track length has limits on the +positive and negative ends in the TMD direction (X_PSP and X_NSP, Y_PSP +and Y_NSP, and Z_PSP and Z_NSP). If we define a general maximum and +minimum displacements as :math:`x_{max}` and :math:`x_{min}`, +respectively, the stop forces have the form + +.. math:: + F_{StopFrc} = -\left\{ + \begin{array}{lr} + \begin{aligned} + k_S \Delta x & \quad : ( x > x_{max} \wedge \dot{x}<=0) \vee ( x < x_{min} \wedge \dot{x}>=0)\\ + k_S \Delta x + c_S \dot{x} & \quad : ( x > x_{max} \wedge \dot{x}>0) \vee ( x < x_{min} \wedge \dot{x}<0)\\ + 0 & \quad : \text{otherwise} + \end{aligned} + \end{array} + \right. + +where :math:`\Delta x` is the distance the mass has traveled beyond the +stop position and :math:`k_S` and :math:`c_S` are large stiffness and +damping constants. + +Code Modifications +================== + +The Structural Control (StC) function is a submodule linked into ServoDyn. In +addition to references in ServoDyn.f90 and ServoDyn.txt, new files that contain +the StC module are listed below. + +New Files +--------- + +- StrucCtrl.f90 : the structural control module + +- StrucCtrl.txt : registry file include files, inputs, states, parameters, + and outputs shown in Tables `1 <#tbl2>`__ and `2 <#tbl1>`__ + +- StrucCtrl_Types.f90: automatically generated + +Variables +--------- + +.. container:: + :name: tbl2 + + .. table:: Summary of field definitions in the StC registry. Note that state vector :math:`\vec{tmd_x}` corresponds to :math:`\vec{R}_{_{TMD/P_N}}`, and that the outputs :math:`\vec{F}_{_{P_G}}` and :math:`\vec{M}_{_{P_G}}` are contained in the MeshType object (y.Mesh). :math:`X_{DSP}`, :math:`Y_{DSP}`, and :math:`Z_{DSP}` are initial displacements of the TMDs. + + +----------------------+------------------------------------------------------------------------------+ + + DataType + Variable name + + +======================+==============================================================================+ + | **InitInput** | | + +----------------------+------------------------------------------------------------------------------+ + | | InputFile | + +----------------------+------------------------------------------------------------------------------+ + | | Gravity | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\vec{r}_{_{N/O_G}}` | + +----------------------+------------------------------------------------------------------------------+ + | **Input u** | | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\ddot{\vec{r}}_{_{P/O_G}}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\vec{R}_{_{N/O_G}}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\vec{\omega}_{_{N/O_G}}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\vec{\alpha}_{_{N/O_G}}` | + +----------------------+------------------------------------------------------------------------------+ + | **Parameter p** | | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`m_x` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`c_x` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`k_x` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`m_y` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`c_y` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`k_y` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`m_z` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`c_z` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`k_z` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`K_S = \left[ k_{SX}\hspace{1em}k_{SY}\hspace{1em}k_{SZ}\right]` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`C_S = \left[c_{SX}\hspace{1em}c_{SY}\hspace{1em}c_{SZ}\right]` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`P_{SP}=\left[X_{PSP}\hspace{1em}Y_{PSP}\hspace{1em}Z_{PSP}\right]` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`P_{SP}=\left[X_{NSP}\hspace{1em}Y_{NSP}\hspace{1em}Z_{NSP}\right]` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`F{ext}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`Gravity` | + +----------------------+------------------------------------------------------------------------------+ + | | TMDX_DOF | + +----------------------+------------------------------------------------------------------------------+ + | | TMDY_DOF | + +----------------------+------------------------------------------------------------------------------+ + | | TMDZ_DOF | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`X_{DSP}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`Y_{DSP}` | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`Z_{DSP}` | + +----------------------+------------------------------------------------------------------------------+ + | **State x** | | + +----------------------+------------------------------------------------------------------------------+ + | | :math:`\vec{tmd_x}` | + +----------------------+------------------------------------------------------------------------------+ + | **Output y** | | + +----------------------+------------------------------------------------------------------------------+ + | | Mesh | + +----------------------+------------------------------------------------------------------------------+ + + +The input, parameter, state and output definitions are summarized in +Table `1 <#tbl2>`__. The inputs from file are listed in Table +`2 <#tbl1>`__. + +.. container:: + :name: tbl1 + + .. table:: Data read in from TMDInputFile. + + +------------+------------+------------------------------------------------------+ + | Field Name | Field Type | Description | + +============+============+======================================================+ + | TMD_CMODE | int | Control Mode (1:passive, 2:active) | + +------------+------------+------------------------------------------------------+ + | TMD_X_DOF | logical | DOF on or off | + +------------+------------+------------------------------------------------------+ + | TMD_Y_DOF | logical | DOF on or off | + +------------+------------+------------------------------------------------------+ + | TMD_Z_DOF | logical | DOF on or off | + +------------+------------+------------------------------------------------------+ + | TMD_X_DSP | real | TMD_X initial displacement | + +------------+------------+------------------------------------------------------+ + | TMD_Y_DSP | real | TMD_Y initial displacement | + +------------+------------+------------------------------------------------------+ + | TMD_Z_DSP | real | TMD_Z initial displacement | + +------------+------------+------------------------------------------------------+ + | TMD_X_M | real | TMD mass | + +------------+------------+------------------------------------------------------+ + | TMD_X_K | real | TMD stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_X_C | real | TMD damping | + +------------+------------+------------------------------------------------------+ + | TMD_Y_M | real | TMD mass | + +------------+------------+------------------------------------------------------+ + | TMD_Y_K | real | TMD stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_Y_C | real | TMD damping | + +------------+------------+------------------------------------------------------+ + | TMD_Z_M | real | TMD mass | + +------------+------------+------------------------------------------------------+ + | TMD_Z_K | real | TMD stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_Z_C | real | TMD damping | + +------------+------------+------------------------------------------------------+ + | TMD_X_PSP | real | positive stop position (maximum X mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_X_NSP | real | negative stop position (minimum X mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_X_K_SX | real | stop spring stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_X_C_SX | real | stop spring damping | + +------------+------------+------------------------------------------------------+ + | TMD_Y_PSP | real | positive stop position (maximum Y mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_Y_NSP | real | negative stop position (minimum Y mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_Y_K_S | real | stop spring stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_Y_C_S | real | stop spring damping | + +------------+------------+------------------------------------------------------+ + | TMD_Z_PSP | real | positive stop position (maximum Z mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_Z_NSP | real | negative stop position (minimum Z mass displacement) | + +------------+------------+------------------------------------------------------+ + | TMD_Z_K_S | real | stop spring stiffness | + +------------+------------+------------------------------------------------------+ + | TMD_Z_C_S | real | stop spring damping | + +------------+------------+------------------------------------------------------+ + | TMD_P_X | real | x origin of P in nacelle coordinate system | + +------------+------------+------------------------------------------------------+ + | TMD_P_Y | real | y origin of P in nacelle coordinate system | + +------------+------------+------------------------------------------------------+ + | TMD_P_Z | real | z origin of P in nacelle coordinate system | + +------------+------------+------------------------------------------------------+ + +Acknowledgements +================ + +The authors would like to thank Dr. Jason Jonkman for reviewing this +manual. + +.. [1] + Note that :math:`( R a ) \times ( Rb ) = R( a \times b )`. diff --git a/docs/source/user/servodyn-stc/StC_index.rst b/docs/source/user/servodyn-stc/StC_index.rst new file mode 100644 index 0000000000..e370016fc5 --- /dev/null +++ b/docs/source/user/servodyn-stc/StC_index.rst @@ -0,0 +1,28 @@ +.. _StC: + +Structural Control (SrvD) +========================= + +.. only:: html + + The Structural Control module within ServoDyn is used to simulate tuned mass + dampers and tuned liquid column dampers. This module also provides an option + for applying a force time series load at the location of the Structural + Control node. + + The location of the StC node is given in the main ServoDyn input file (see + :numref:`SrvD-Stc-inputs` and :numref:`StC-Locations`). These may be mounted + at the nacelle, tower, blade, or platform. Multiple StC's may be placed at + each location, each with it's own input file. Output channels from the StC + module are handled by ServoDyn (see :numref:`SrvD-Outputs` for details). + + + +.. toctree:: + :maxdepth: 2 + + StC_input.rst + StC_Theory.rst + StC_TLCD_Theory.rst + zrefs.rst + diff --git a/docs/source/user/servodyn-stc/StC_input.rst b/docs/source/user/servodyn-stc/StC_input.rst new file mode 100644 index 0000000000..447df7ee19 --- /dev/null +++ b/docs/source/user/servodyn-stc/StC_input.rst @@ -0,0 +1,438 @@ +.. _StC-Input: + +Input Files +=========== + +The user configures each StC instance with a separate input file. This input +file defines the location of the StC relative to its mounting location, and +defines the properties. It can also be used with an external forces file to +apply a timeseries load at the location (primarily used for diagnostic +purposes). + + +Units +----- + +Structural Control uses the SI system (kg, m, s, N). Angles are assumed to be in +radians unless otherwise specified. + + +.. raw:: html + +
+ + + +.. _StC-Locations: + +Structural Control Locations +---------------------------- + +The Structural Control input file defines the location and properties of the StC +instance. The location is relative to the type of StC given in the main +ServoDyn input file (see :numref:`SrvD-StC-Inputs`). The four location types +are Nacelle, Tower, Blade, and Platform. + +The mapping information for the StC will be given in the main OpenFAST summary +file. + + +Nacelle StC +~~~~~~~~~~~ + +This StC mounting location is attached relative to the nacelle reference point. +It will track with all nacelle motions (including motions due to yaw, tower +flex, and platform motions). + + +Tower StC +~~~~~~~~~ + +This StC mounting location is attached to the tower mesh at the height specified +above the tower base. This StC attachment will move with the line mesh at that +height. For example, an StC mounted at 85 m on a 90 m tower will move with the +mesh line corresponding to the 85 m height position on the tower center line. + + +Blade StC +~~~~~~~~~ + +This StC mounting location is attached to the blade structural center at the +specified distance from the blade root along the z-axis of the blade (IEC +blade coordinate system). This location will follow all blade deformations and +motions (including blade twist when used with BeamDyn). This option is +available with both the BeamDyn and ElastoDyn blade representations. + +When this option is used, identical StCs will be attached at each of the blades. +The response if each blade mounted StC is tracked separately and is available in +the output channels given in the ServoDyn tab of the +:download:`OutListParameters.xlsx <../../../OtherSupporting/OutListParameters.xlsx>`. + + +Platform StC +~~~~~~~~~~~~ + +This StC mounting location is located relative to the platform reference point. +When a rigid body platform is modeled (such as a rigid semi-submersible), it is +attached to the platform reference point. When a flexible floating body is +modeled, the StC is attached to the SubDyn mesh. + + +.. raw:: html + +
+ +.. _StC-Input-File: + +Structural Control Input File +----------------------------- + +The input file may have an arbitrary number of commented header lines, and +commented lines at any location in the input file. +:download:`(Example Structural Control input file for tuned mass damper on +tower for NREL 5 MW TLP) `: + +Simulation Control +~~~~~~~~~~~~~~~~~~ + +**Echo** [flag] + + Echo input data to .ech + + +StC Degrees of Freedom +---------------------- + +**StC_DOF_MODE** [switch] + + DOF mode {0: No StC or TLCD DOF; 1: StC_X_DOF, StC_Y_DOF, and/or StC_Z_DOF + (three independent StC DOFs); 2: StC_XY_DOF (Omni-Directional StC); 3: TLCD; + 4: Prescribed force/moment time series} + + +**StC_X_DOF** [flag] + + DOF on or off for StC X *[Used only when* **StC_DOF_MODE==1** *]* + +**StC_Y_DOF** [flag] + + DOF on or off for StC Y *[Used only when* **StC_DOF_MODE==1** *]* + +**StC_Z_DOF** [flag] + + DOF on or off for StC Z *[Used only when* **StC_DOF_MODE==1** *]* + + +StC Location +------------ + +The location of the StC is relative to the component it is attached to. This is +specified in the main ServoDyn input file. See description above. + +**StC_P_X** [m] + + At rest X position of StC + +**StC_P_Y** [m] + + At rest Y position of StC + +**StC_P_Z** [m] + + At rest Z position of StC + + +StC Initial Conditions +---------------------- + +*used only when* **StC_DOF_MODE==1 or 2** + +**StC_X_DSP** [m] + + StC X initial displacement *[relative to at rest position]* + +**StC_Y_DSP** [m] + + StC Y initial displacement *[relative to at rest position]* + +**StC_Z_DSP** [m] + + StC Z initial displacement *[relative to at rest position; used only when* + **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* + + +StC Configuration +----------------- + +*used only when* **StC_DOF_MODE==1 or 2** + +**StC_X_PSP** [m] + + Positive stop position -- maximum X mass displacement + +**StC_X_NSP** [m] + + Negative stop position -- minimum X mass displacement + +**StC_Y_PSP** [m] + + Positive stop position -- maximum Y mass displacement + +**StC_Y_NSP** [m] + + Negative stop position -- minimum Y mass displacement + +**StC_Z_PSP** [m] + + Positive stop position -- maximum Z mass displacement *[used only when* + **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* + +**StC_Z_NSP** [m] + + Negative stop position -- minimum Z mass displacement *[used only when* + **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* + +StC Mass, Stiffness, & Damping +------------------------------ + +*used only when* **StC_DOF_MODE==1 or 2** + +**StC_X_M** [kg] + + StC X mass *[used only when* **StC_DOF_MODE==1** *and* **StC_X_DOF==TRUE** + *]* + +**StC_Y_M** [kg] + + StC Y mass *[used only when* **StC_DOF_MODE==1** *and* **StC_Y_DOF==TRUE** + *]* + +**StC_Z_M** [kg] + + StC Z mass *[used only when* **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** + *]* + +**StC_XY_M** [kg] + + StC XY mass *[used only when* **StC_DOF_MODE==2** *]* + +**StC_X_K** [N/m] + + StC X stiffness + +**StC_Y_K** [N/m] + + StC Y stiffness + +**StC_Z_K** [N/m] + + StC Z stiffness *[used only when* **StC_DOF_MODE==1** *and* + **StC_Z_DOF==TRUE** *]* + +**StC_X_C** [N/(m/s)] + + StC X damping + +**StC_Y_C** [N/(m/s)] + + StC Y damping + +**StC_Z_C** [N/(m/s)] + + StC Z damping *[used only when* **StC_DOF_MODE==1** *and* + **StC_Z_DOF==TRUE** *]* + +**StC_X_KS** [N/m] + + Stop spring X stiffness + +**StC_Y_KS** [N/m] + + Stop spring Y stiffness + +**StC_Z_KS** [N/m] + + Stop spring Z stiffness *[used only when* **StC_DOF_MODE==1** *and + StC_Z_DOF==TRUE]* + +**StC_X_CS** [N/(m/s)] + + Stop spring X damping + +**StC_Y_CS** [N/(m/s)] + + Stop spring Y damping + +**StC_Z_CS** [N/(m/s)] + + Stop spring Z damping *[used only when* **StC_DOF_MODE==1** *and* + **StC_Z_DOF==TRUE** *]* + + +StC User-Defined Spring Forces +------------------------------ + +*used only when* **StC_DOF_MODE==1 or 2** + +**Use_F_TBL** [flag] + + Use spring force from user-defined table + +**NKInpSt** [-] + + Number of spring force input stations + +The table is expected to contain 6 columns for displacements and equvalent +sprint forces: **X**, **F_X**, **Y**, **F_Y**, **Z**, and **F_Z**. +Displacements are in meters (m) and forces in Newtons (N). + +Example spring forces table: + +.. container:: + :name: Tab:SpringForce + + .. literalinclude:: ExampleFiles/SpringForce.txt + :language: none + + +StructCtrl Control +------------------ +*used only when* **StC_DOF_MODE==1 or 2** + +**StC_CMODE** [switch] + + Control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + +**StC_SA_MODE** [-] + + Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse + velocity-based ground hook control; 3: displacement-based ground hook control + 4: Phase difference Algorithm with Friction Force 5: Phase difference + Algorithm with Damping Force} + +**StC_X_C_HIGH** [-] + + StC X high damping for ground hook control + +**StC_X_C_LOW** [-] + + StC X low damping for ground hook control + +**StC_Y_C_HIGH** [-] + + StC Y high damping for ground hook control + +**StC_Y_C_LOW** [-] + + StC Y low damping for ground hook control + +**StC_Z_C_HIGH** [-] + + StC Z high damping for ground hook control *[used only when* + **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* + +**StC_Z_C_LOW** [-] + + StC Z low damping for ground hook control *[used only when* + **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* + +**StC_X_C_BRAKE** [-] + + StC X high damping for braking the StC *[currently unused. set to zero]* + +**StC_Y_C_BRAKE** [-] + + StC Y high damping for braking the StC *[currently unused. set to zero]* + +**StC_Z_C_BRAKE** [-] + + StC Z high damping for braking the StC *[used only when* **StC_DOF_MODE==1** + *and* **StC_Z_DOF==TRUE** *]* *[currently unused. set to zero]* + + + +TLCD -- Tuned Liquid Column Damper +---------------------------------- + +*used only when* **StC_DOF_MODE==3** + +**L_X** [m] + + X TLCD total length + +**B_X** [m] + + X TLCD horizontal length + +**area_X** [m^2] + + X TLCD cross-sectional area of vertical column + +**area_ratio_X** [-] + + X TLCD cross-sectional area ratio *[vertical column area divided by + horizontal column area]* + +**headLossCoeff_X** [-] + + X TLCD head loss coeff + +**rho_X** [kg/m^3] + + X TLCD liquid density + +**L_Y** [m] + + Y TLCD total length + +**B_Y** [m] + + Y TLCD horizontal length + +**area_Y** [m^2] + + Y TLCD cross-sectional area of vertical column + +**area_ratio_Y** [-] + + Y TLCD cross-sectional area ratio *[vertical column area divided by + horizontal column area]* + +**headLossCoeff_Y** [-] + + Y TLCD head loss coeff + +**rho_Y** [kg/m^3] + + Y TLCD liquid density + +Prescribed Time Series +---------------------- + +A prescribed time series of forces and moments may be applied in place of the +StC damper. The force and moment may be applied either in a global coordinate +frame, or in a local (following) coordinate frame. This feature is *used only +when* **StC_DOF_MODE==4**. + +**PrescribedForcesCoord** [switch] + + Prescribed forces are in global or local coordinates {1: global; 2: local} + +**PrescribedForcesFile** [-] + + Filename for the prescribed forces. The format expected is 7 columns: time, + FX, FY, FZ, MX, MY, MZ. Values will be interpolated from the file between + the given timestep and value sets. The input file may have an arbitrary + number of commented header lines, and commented lines at any location in the + input file. + +Example prescribed time series file :download:`(example prescribed force +timeseries) `: + +.. container:: + :name: Tab:PrescribedForce + + .. literalinclude:: ExampleFiles/PrescribedForce.txt + :language: none + + diff --git a/docs/source/user/servodyn-stc/zrefs.rst b/docs/source/user/servodyn-stc/zrefs.rst new file mode 100644 index 0000000000..abdf77f3f4 --- /dev/null +++ b/docs/source/user/servodyn-stc/zrefs.rst @@ -0,0 +1,10 @@ +.. only:: html + + References + ---------- + +.. bibliography:: StC_Refs.bib + :labelprefix: stc- + :keyprefix: stc- + + diff --git a/docs/source/user/servodyn/index.rst b/docs/source/user/servodyn/index.rst new file mode 100644 index 0000000000..670e16701a --- /dev/null +++ b/docs/source/user/servodyn/index.rst @@ -0,0 +1,24 @@ +.. _srvd: + +ServoDyn Users Guide +==================== + +.. only:: html + + This document offers a quick reference guide for the ServoDyn software + program. It is intended to be used by the general user in combination + with other OpenFAST manuals. The manual will be updated as new releases are + issued and as needed to provide further information on advancements or + modifications to the software. + + The Structural control sub-module of ServoDyn is documented in + :numref:`StC`. + + **The documentation here is incomplete.** + + +.. toctree:: + :maxdepth: 2 + + input.rst + diff --git a/docs/source/user/servodyn/input.rst b/docs/source/user/servodyn/input.rst new file mode 100644 index 0000000000..428c08ed0d --- /dev/null +++ b/docs/source/user/servodyn/input.rst @@ -0,0 +1,485 @@ +.. _SrvD-Input: + +Input Files +=========== + +The user configures the servodynamics model parameters via a primary ServoDyn +input file, as well as separate input files for Structural control, and a +controller DLL. *This information is incomplete and will be documented here +at a later date.* + + +Units +----- + +ServoDyn uses the SI system (kg, m, s, N). Angles are assumed to be in +radians unless otherwise specified. + +ServoDyn Primary Input File +---------------------------- + +The primary ServoDyn input file defines the modeling options for the controller. +This includes some DLL options, and Structural control options (typically a +tuned mass damper system). + + +Simulation Control +~~~~~~~~~~~~~~~~~~ + +**Echo** [flag] + + Echo input data to .ech + +**DT** [sec] + + Communication interval for controllers (or "default") + + +Pitch Control +~~~~~~~~~~~~~ + +**PCMode** [switch] + + Pitch control mode {0: none, 3: user-defined from routine PitchCntrl, 4: + user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} + +**TPCOn** [sec] + + Time to enable active pitch control *[unused when* **PCMode==0** *]* + +**TPitManS(1)** [sec] + + Time to start override pitch maneuver for blade 1 and end standard pitch + control + +**TPitManS(2)** [sec] + + Time to start override pitch maneuver for blade 2 and end standard pitch + control + +**TPitManS(3)** [sec] + + Time to start override pitch maneuver for blade 3 and end standard pitch + control *[unused for 2 blades]* + +**PitManRat(1)** [deg/s] + + Pitch rate at which override pitch maneuver heads toward final pitch angle + for blade 1 + +**PitManRat(2)** [deg/s] + + Pitch rate at which override pitch maneuver heads toward final pitch angle + for blade 2 + +**PitManRat(3)** [deg/s] + + Pitch rate at which override pitch maneuver heads toward final pitch angle + for blade 3 *[unused for 2 blades]* + +**BlPitchF(1)** [deg] + + Blade 1 final pitch for pitch maneuvers + +**BlPitchF(2)** [deg] + + Blade 2 final pitch for pitch maneuvers + +**BlPitchF(3)** [deg] + + Blade 3 final pitch for pitch maneuvers *[unused for 2 blades]* + + +Generator and Torque Control +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**VSContrl** [switch] + + Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from + routine UserVSCont, 4: user-defined from Simulink/Labview, 5: user-defined from + Bladed-style DLL} + +**GenModel** [switch] + + Generator model {1: simple, 2: Thevenin, 3: user-defined from routine + UserGen} *[used only when* **VSContrl==0** *]* + +**GenEff** [\%] + + Generator efficiency *[ignored by the Thevenin and user-defined generator + models]* + +**GenTiStr** [flag] + + Method to start the generator {T: timed using TimGenOn, F: generator speed + using SpdGenOn} + +**GenTiStp** [Flag] + + Method to stop the generator {T: timed using TimGenOf, F: when generator + power = 0} + +**SpdGenOn** [rpm] + + Generator speed to turn on the generator for a startup (HSS speed) *[used + only when* **GenTiStri==False** *]* + +**TimGenOn** [sec] + + Time to turn on the generator for a startup *[used only when* + **GenTiStr==True** *]* + +**TimGenOf** [sec] + + Time to turn off the generator *[used only when* **GenTiStp==True** *]* + + +Simple Variable-speed Torque Control +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**VS_RtGnSp** [rpm] + + Rated generator speed for simple variable-speed generator control (HSS side) + *[used only when* **VSContrl==1** *]* + +**VS_RtTq** [N-m] + + Rated generator torque/constant generator torque in Region 3 for simple + variable-speed generator control (HSS side) *[used only when* **VSContrl==1** + *]* + +**VS_Rgn2K** [N-m/rpm^2] + + Generator torque constant in Region 2 for simple variable-speed generator + control (HSS side) *[used only when* **VSContrl==1** *]* + +**VS_SlPc** [\%] + + Rated generator slip percentage in Region 2 1/2 for simple variable-speed + generator control *[used only when* **VSContrl==1** *]* + + +Simple Induction Generator +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**SIG_SlPc** [\%] + + Rated generator slip percentage *[used only when* **VSContrl==0** *and* + **GenModel==1** *]* + +**SIG_SySp** [rpm] + + Synchronous (zero-torque) generator speed *[used only when* **VSContrl==0** + *and* **GenModel==1** *]* + +**SIG_RtTq** [N-m] + + Rated torque *[used only when* **VSContrl==0** *and* **GenModel==1** *]* + +**SIG_PORt** [-] + + Pull-out ratio (Tpullout/Trated) *[used only when* **VSContrl==0** *and* + **GenModel==1** *]* + + +Thevenin-Equivalent Induction Generator +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**TEC_Freq** [Hz] + + Line frequency [50 or 60] *[used only when* **VSContrl==0** *and* + **GenModel==2** *]* + +**TEC_NPol** [-] + + Number of poles [even integer > 0] *[used only when* **VSContrl==0** *and* + **GenModel==2** *]* + +**TEC_SRes** [ohms] + + Stator resistance *[used only when* **VSContrl==0** *and* **GenModel==2** *]* + +**TEC_RRes** [ohms] + + Rotor resistance *[used only when* **VSContrl==0** *and* **GenModel==2** *]* + +**TEC_VLL** [volts] + + Line-to-line RMS voltage *[used only when* **VSContrl==0** *and* + **GenModel==2** *]* + +**TEC_SLR** [ohms] + + Stator leakage reactance *[used only when* **VSContrl==0** *and* + **GenModel==2** *]* + +**TEC_RLR** [ohms] + + Rotor leakage reactance *[used only when* **VSContrl==0** *and* + **GenModel==2** *]* + +**TEC_MR** [ohms] + + Magnetizing reactance *[used only when* **VSContrl==0** *and* **GenModel==2** + *]* + + +High-speed Shaft Brake +~~~~~~~~~~~~~~~~~~~~~~ + +**HSSBrMode** [switch] + + HSS brake model {0: none, 1: simple, 3: user-defined from routine UserHSSBr, + 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} + +**THSSBrDp** [sec] + + Time to initiate deployment of the HSS brake + +**HSSBrDT** [sec] + + Time for HSS-brake to reach full deployment once initiated *[used only when* + **HSSBrMode==1** *]* + +**HSSBrTqF** [N-m] + + Fully deployed HSS-brake torque + + +Nacelle-yaw Control +~~~~~~~~~~~~~~~~~~~ + +**YCMode** [switch] + + Yaw control mode {0: none, 3: user-defined from routine UserYawCont, 4: + user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} + +**TYCOn** [sec] + + Time to enable active yaw control *[unused when* **YCMode==0** *]* + +**YawNeut** [deg] + + Neutral yaw position--yaw spring force is zero at this yaw + +**YawSpr** [N-m/rad] + + Nacelle-yaw spring constant + +**YawDamp** [N-m/(rad/s)] + + Nacelle-yaw damping constant + +**TYawManS** [sec] + + Time to start override yaw maneuver and end standard yaw control + +**YawManRat** [deg/s] + + Yaw maneuver rate (in absolute value) + +**NacYawF** [deg] + + Final yaw angle for override yaw maneuvers + + +.. _SrvD-StC-inputs: + +Structural Control +~~~~~~~~~~~~~~~~~~ + +See :numref:`StC-Locations` for descriptions of the mounting locations for each +of the following options. + +**NumBStC** [integer] + + Number of blade structural controllers + +**BStCfiles** [-] + + Name of the files for blade structural controllers (quoted strings on one + line) *[unused when* **NumBStC==0** *]* + +**NumNStC** [integer] + + Number of nacelle structural controllers + +**NStCfiles** [-] + + Name of the files for nacelle structural controllers (quoted strings on one + line) *[unused when* **NumNStC==0** *]* + +**NumTStC** [integer] + + Number of tower structural controllers + +**TStCfiles** [-] + + Names of the file for tower structural control damping (quoted strings on one + line) *[unused when* **NumTStC==0** *]* + +**NumSStC** [integer] + + Number of substructure structural controllers + +**SStCfiles** [-] + + Name of the files for substructure structural controllers (quoted strings on one + line) *[unused when* **NumSStC==0** *]* + + +Bladed Controller Interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**DLL_FileName** [-] + + Name/location of the dynamic library {.dll [Windows] or .so [Linux]} in the + Bladed-DLL format *[used only with Bladed Interface]* + +**DLL_InFile** [-] + + Name of input file sent to the DLL *[used only with Bladed Interface]* + +**DLL_ProcName** [-] + + Name of procedure in DLL to be called *[case sensitive; used only with DLL + Interface]* + +**DLL_DT** [sec] + + Communication interval for dynamic library (or "default") *[used only with + Bladed Interface]* + +**DLL_Ramp** [flag] + + Whether a linear ramp should be used between DLL_DT time steps [introduces + time shift when true] *[used only with Bladed Interface]* + +**BPCutoff** [Hz] + + Cutoff frequency for low-pass filter on blade pitch from DLL *[used only with + Bladed Interface]* + +**NacYaw_North** [deg] + + Reference yaw angle of the nacelle when the upwind end points due North + *[used only with Bladed Interface]* + +**Ptch_Cntrl** [switch] + + Record 28: Use individual pitch control {0: collective pitch; 1: individual + pitch control} *[used only with Bladed Interface]* + +**Ptch_SetPnt** [deg] + + Record 5: Below-rated pitch angle set-point *[used only with Bladed + Interface]* + +**Ptch_Min** [deg] + + Record 6: Minimum pitch angle *[used only with Bladed Interface]* + +**Ptch_Max** [deg] + + Record 7: Maximum pitch angle *[used only with Bladed Interface]* + +**PtchRate_Min** [deg/s] + + Record 8: Minimum pitch rate (most negative value allowed) *[used only with + Bladed Interface]* + +**PtchRate_Max** [deg/s] + + Record 9: Maximum pitch rate *[used only with Bladed Interface]* + +**Gain_OM** [N-m/(rad/s)^2] + + Record 16: Optimal mode gain *[used only with Bladed Interface]* + +**GenSpd_MinOM** [rpm] + + Record 17: Minimum generator speed *[used only with Bladed Interface]* + +**GenSpd_MaxOM** [rpm] + + Record 18: Optimal mode maximum speed *[used only with Bladed Interface]* + +**GenSpd_Dem** [rpm] + + Record 19: Demanded generator speed above rated *[used only with Bladed + Interface]* + +**GenTrq_Dem** [N-m] + + Record 22: Demanded generator torque above rated *[used only with Bladed + Interface]* + +**GenPwr_Dem** [W] + + Record 13: Demanded power *[used only with Bladed Interface]* + + +Bladed Interface Torque-Speed Look-up table +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**DLL_NumTrq** [-] + + Record 26: No. of points in torque-speed + look-up table {0 = none and use the optimal mode parameters; nonzero = ignore + the optimal mode PARAMETERs by setting Record 16 to 0.0} *[used only with Bladed + Interface]* + The following 2 column table format is expected: + + +------------+------------+ + | GenSpd_TLU | GenTrq_TLU | + | (rpm) | (N-m) | + +------------+------------+ + + +.. _SrvD-Outputs: + +Output +~~~~~~ + +**SumPrint** [flag] + + Print summary data to .sum *(currently unused)* + +**OutFile** [-] + + Switch to determine where output will be placed: {1: in module output file + only; 2: in glue code output file only; 3: both} *(currently unused)* + +**TabDelim** [flag] + + Use tab delimiters in text tabular output file? *(currently unused)* + +**OutFmt** [-] + + Format used for text tabular output (except time). Resulting field should be + 10 characters. (quoted string) *(currently unused)* + +**TStart** [sec] + + Time to begin tabular output *(currently unused)* + +**OutList** section controls output quantities generated by +ServoDyn. Enter one or more lines containing quoted strings that in turn +contain one or more output parameter names. Separate output parameter +names by any combination of commas, semicolons, spaces, and/or tabs. If +you prefix a parameter name with a minus sign, “-”, underscore, “_”, or +the characters “m” or “M”, ServooDyn will multiply the value for that +channel by –1 before writing the data. The parameters are written in the +order they are listed in the input file. ServoDyn allows you to use +multiple lines so that you can break your list into meaningful groups +and so the lines can be shorter. You may enter comments after the +closing quote on any of the lines. Entering a line with the string “END” +at the beginning of the line or at the beginning of a quoted string +found at the beginning of the line will cause ServoDyn to quit scanning +for more lines of channel names. If ServoDyn encounters an +unknown/invalid channel name, it warns the users but will remove the +suspect channel from the output file. Please refer to the ServoDyn tab in the +Excel file :download:`OutListParameters.xlsx <../../../OtherSupporting/OutListParameters.xlsx>` +for a complete list of possible output parameters. + + diff --git a/glue-codes/CMakeLists.txt b/glue-codes/CMakeLists.txt index 9c1f8e3b5a..79a1a66df2 100644 --- a/glue-codes/CMakeLists.txt +++ b/glue-codes/CMakeLists.txt @@ -4,3 +4,7 @@ add_subdirectory(openfast) if(BUILD_OPENFAST_CPP_API) add_subdirectory(openfast-cpp) endif() + +if(BUILD_FASTFARM) + add_subdirectory(fast-farm) +endif() diff --git a/glue-codes/fast-farm/CMakeLists.txt b/glue-codes/fast-farm/CMakeLists.txt new file mode 100644 index 0000000000..2c2e31b758 --- /dev/null +++ b/glue-codes/fast-farm/CMakeLists.txt @@ -0,0 +1,56 @@ +# +# Copyright 2016 National Renewable Energy Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +if (GENERATE_TYPES) + generate_f90_types(src/FASTWrapper_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/FASTWrapper_Types.f90 -noextrap) + generate_f90_types(src/FAST_Farm_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/FAST_Farm_Types.f90 -noextrap) +endif() + +FIND_PACKAGE( OpenMP ) +if (NOT ${OPENMP_Fortran_FOUND} ) + message(FATAL_ERROR "CMake could not find the OpenMP Fortran libraries.") +endif() + +if(OPENMP_FOUND) + set(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} ${OpenMP_FORTRAN_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") +endif() + +add_executable(FAST.Farm + src/FAST_Farm_IO.f90 + src/FAST_Farm_Subs.f90 + src/FASTWrapper.f90 + src/FAST_Farm.f90 + src/FAST_Farm_Types.f90 + src/FASTWrapper_Types.f90) + +target_link_libraries(FAST.Farm openfast_postlib openfast_prelib nwtclibs scfastlib sctypeslib awaelib wdlib) +set_property(TARGET FAST.Farm PROPERTY LINKER_LANGUAGE Fortran) + +string(TOUPPER ${CMAKE_Fortran_COMPILER_ID} _compiler_id) +string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type) +if (${_compiler_id} STREQUAL "GNU" AND ${_build_type} STREQUAL "RELEASE") + # With variable tracking enabled, the compile step frequently aborts on large modules and + # restarts with this option off. Disabling in Release mode avoids this problem when compiling with + # full optimizations, but leaves it enabled for RelWithDebInfo which adds both -O2 and -g flags. + # https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html + set_source_files_properties(src/FAST_Farm_Types.f90 src/FASTWrapper_Types.f90 PROPERTIES COMPILE_FLAGS "-fno-var-tracking -fno-var-tracking-assignments") +endif() + +install(TARGETS FAST.Farm + RUNTIME DESTINATION bin) diff --git a/glue-codes/fast-farm/src/FASTWrapper.f90 b/glue-codes/fast-farm/src/FASTWrapper.f90 new file mode 100644 index 0000000000..ad3c27558f --- /dev/null +++ b/glue-codes/fast-farm/src/FASTWrapper.f90 @@ -0,0 +1,670 @@ +!********************************************************************************************************************************** +!> ## FASTWrapper +!! The FASTWrapper and FASTWrapper_Types modules make up a template for creating user-defined calculations in the FAST Modularization +!! Framework. FASTWrappers_Types will be auto-generated by the FAST registry program, based on the variables specified in the +!! FASTWrapper_Registry.txt file. +!! +! .................................................................................................................................. +!! ## LICENSING +!! Copyright (C) 2012-2013, 2015-2016 National Renewable Energy Laboratory +!! +!! This file is part of FASTWrapper. +!! +!! Licensed under the Apache License, Version 2.0 (the "License"); +!! you may not use this file except in compliance with the License. +!! You may obtain a copy of the License at +!! +!! http://www.apache.org/licenses/LICENSE-2.0 +!! +!! Unless required by applicable law or agreed to in writing, software +!! distributed under the License is distributed on an "AS IS" BASIS, +!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +!! See the License for the specific language governing permissions and +!! limitations under the License. +!********************************************************************************************************************************** +MODULE FASTWrapper + + USE FASTWrapper_Types + USE NWTC_Library + USE FAST_Subs + + + IMPLICIT NONE + + PRIVATE + + TYPE(ProgDesc), PARAMETER :: FWrap_Ver = ProgDesc( 'FASTWrapper', 'v1.00.00', '7-Feb-2017' ) !< module date/version information + + REAL(DbKi), PARAMETER :: t_initial = 0.0_DbKi ! Initial time + + ! ..... Public Subroutines ................................................................................................... + + PUBLIC :: FWrap_Init ! Initialization routine + PUBLIC :: FWrap_End ! Ending routine (includes clean up) + + PUBLIC :: FWrap_t0 ! call to compute outputs at t0 [and initialize some more variables] + PUBLIC :: FWrap_Increment ! call to update states to n+1 and compute outputs at n+1 + + +CONTAINS +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the start of the simulation to perform initialization steps. +!! The parameters are set here and not changed during the simulation. +!! The initial states and initial guess for the input are defined. +SUBROUTINE FWrap_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(FWrap_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine + TYPE(FWrap_InputType), INTENT( OUT) :: u !< An initial guess for the input; input mesh must be defined + TYPE(FWrap_ParameterType), INTENT( OUT) :: p !< Parameters + TYPE(FWrap_ContinuousStateType), INTENT( OUT) :: x !< Initial continuous states + TYPE(FWrap_DiscreteStateType), INTENT( OUT) :: xd !< Initial discrete states + TYPE(FWrap_ConstraintStateType), INTENT( OUT) :: z !< Initial guess of the constraint states + TYPE(FWrap_OtherStateType), INTENT( OUT) :: OtherState !< Initial other states (logical, etc) + TYPE(FWrap_OutputType), INTENT( OUT) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + TYPE(FWrap_MiscVarType), INTENT( OUT) :: m !< Misc variables for optimization (not copied in glue code) + REAL(DbKi), INTENT(IN ) :: Interval !< Coupling interval in seconds: the rate that + !! (1) Wrap_UpdateStates() is called in loose coupling & + !! (2) Wrap_UpdateDiscState() is called in tight coupling. + !! Input is the suggested time from the glue code; + !! Output is the actual coupling interval that will be used + !! by the glue code. + TYPE(FWrap_InitOutputType), INTENT( OUT) :: InitOut !< Output for initialization routine + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables + TYPE(FAST_ExternInitType) :: ExternInitData + INTEGER(IntKi) :: j,k,nb + + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_Init' + + + ! Initialize variables + + ErrStat = ErrID_None + ErrMsg = '' + + + ! Initialize the NWTC Subroutine Library + + !call NWTC_Init( ) + + ! Display the module information + + if (InitInp%TurbNum == 1) call DispNVD( FWrap_Ver ) + InitOut%Ver = FWrap_Ver + + + ! Define initial system states here: + + x%Dummy = 0.0_ReKi + xd%Dummy = 0.0_ReKi + z%Dummy = 0.0_ReKi + OtherState%Dummy = 0.0_ReKi + + + ! Define initial guess for the system inputs here: + + + !................. + ! Initialize an instance of FAST + !................ + + !.... Lidar data (unused) .... + ExternInitData%Tmax = InitInp%TMax + ExternInitData%SensorType = SensorType_None + ExternInitData%LidRadialVel = .false. + + !.... supercontroller .... + if ( InitInp%UseSC ) then + ExternInitData%NumSC2Ctrl = InitInp%NumSC2Ctrl ! "number of controller inputs [from supercontroller]" + ExternInitData%NumCtrl2SC = InitInp%NumCtrl2SC ! "number of controller outputs [to supercontroller]" + ExternInitData%NumSC2CtrlGlob = InitInp%NumSC2CtrlGlob ! "number of global controller inputs [from supercontroller]" + call AllocAry(ExternInitData%fromSCGlob, InitInp%NumSC2CtrlGlob, 'ExternInitData%InitScOutputsGlob (global inputs to turbine controller from supercontroller)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(ExternInitData%fromSC, InitInp%NumSC2Ctrl, ' ExternInitData%InitScOutputsTurbine (turbine-related inputs for turbine controller from supercontroller)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ExternInitData%fromSCGlob = InitInp%fromSCGlob + ExternInitData%fromSC = InitInp%fromSC + call AllocAry(u%fromSCglob, InitInp%NumSC2CtrlGlob, 'u%fromSCglob (global inputs to turbine controller from supercontroller)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(u%fromSC, InitInp%NumSC2Ctrl, 'u%fromSC (turbine-related inputs for turbine controller from supercontroller)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + else + + ExternInitData%NumSC2Ctrl = 0 ! "number of controller inputs [from supercontroller]" + ExternInitData%NumCtrl2SC = 0 ! "number of controller outputs [to supercontroller]" + ExternInitData%NumSC2CtrlGlob = 0 ! "number of global controller inputs [from supercontroller]" + + end if + !.... multi-turbine options .... + ExternInitData%TurbineID = InitInp%TurbNum + ExternInitData%TurbinePos = InitInp%p_ref_Turbine + + ExternInitData%FarmIntegration = .true. + ExternInitData%RootName = InitInp%RootName + + !.... 4D-wind data .... + ExternInitData%windGrid_n(1) = InitInp%nX_high + ExternInitData%windGrid_n(2) = InitInp%nY_high + ExternInitData%windGrid_n(3) = InitInp%nZ_high + ExternInitData%windGrid_n(4) = InitInp%n_high_low + + ExternInitData%windGrid_delta(1) = InitInp%dX_high + ExternInitData%windGrid_delta(2) = InitInp%dY_high + ExternInitData%windGrid_delta(3) = InitInp%dZ_high + ExternInitData%windGrid_delta(4) = InitInp%dt_high + + ExternInitData%windGrid_pZero = InitInp%p_ref_high - InitInp%p_ref_Turbine + + + CALL FAST_InitializeAll_T( t_initial, InitInp%TurbNum, m%Turbine, ErrStat2, ErrMsg2, InitInp%FASTInFile, ExternInitData ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + if (ErrStat >= AbortErrLev) then + call cleanup() + return + end if + + + !................. + ! Check that we've set up FAST properly: + !................. + if (m%Turbine%p_FAST%CompAero /= MODULE_AD) then + call SetErrStat(ErrID_Fatal,"AeroDyn (v15) must be used in each instance of FAST for FAST.Farm.",ErrStat,ErrMsg,RoutineName) + call cleanup() + return + end if + + ! move the misc var to the input variable... + if (m%Turbine%p_FAST%CompInflow /= MODULE_IfW) then + call SetErrStat(ErrID_Fatal,"InflowWind must be used in each instance of FAST for FAST.Farm.",ErrStat,ErrMsg,RoutineName) + call cleanup() + return + end if + + call move_alloc(m%Turbine%IfW%m%FDext%V, u%Vdist_High) + + + !................. + ! Define parameters here: + !................. + + call FWrap_SetParameters(InitInp, p, m%Turbine%p_FAST%dt, Interval, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + if (ErrStat >= AbortErrLev) then + call cleanup() + return + end if + + !................. + ! Set outputs (allocate arrays and set miscVar meshes for computing other outputs): + !................. + + call AllocAry(y%AzimAvg_Ct, p%nr, 'y%AzimAvg_Ct (azimuth-averaged ct)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + if ( InitInp%UseSC ) then + call AllocAry(y%toSC, InitInp%NumCtrl2SC, 'y%toSC (turbine controller outputs to Super Controller)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + end if + + nb = size(m%Turbine%AD%y%rotors(1)%BladeLoad) + Allocate( m%ADRotorDisk(nb), m%TempDisp(nb), m%TempLoads(nb), m%AD_L2L(nb), STAT=ErrStat2 ) + if (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal,"Error allocating space for ADRotorDisk meshes.",ErrStat,ErrMsg,RoutineName) + call cleanup() + return + end if + + do k=1,nb + + call meshCopy( SrcMesh = m%Turbine%AD%y%rotors(1)%BladeLoad(k) & + , DestMesh = m%TempDisp(k) & + , CtrlCode = MESH_COUSIN & ! Like a sibling, except using new memory for position/refOrientation and elements + , Orientation = .TRUE. & ! set automatically to identity + , TranslationDisp = .TRUE. & ! set automatically to 0 + , ErrStat = ErrStat2 & + , ErrMess = ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + call meshCopy( SrcMesh = m%TempDisp(k) & + , DestMesh = m%TempLoads(k) & + , CtrlCode = MESH_SIBLING & + , Force = .true. & + , Moment = .true. & + , ErrStat = ErrStat2 & + , ErrMess = ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + + call MeshCreate ( BlankMesh = m%ADRotorDisk(k) & + ,IOS = COMPONENT_OUTPUT & + ,Nnodes = p%nr & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Force = .true. & + ,Moment = .true. & + ,TranslationDisp = .true. & ! only for loads transfer + ,Orientation = .true. & ! only for loads transfer + ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + if (errStat >= AbortErrLev) exit + + ! set node initial position/orientation + ! shortcut for + ! call MeshPositionNode(m%ADRotorDisk(k), j, [0,0,r(j)], errStat2, errMsg2) + m%ADRotorDisk(k)%Position(3,:) = p%r ! this will get overwritten later, but we check that we have no zero-length elements in MeshCommit() + m%ADRotorDisk(k)%TranslationDisp = 0.0_R8Ki ! this happens by default, anyway.... + + ! create line2 elements + do j=1,p%nr-1 + call MeshConstructElement( m%ADRotorDisk(k), ELEMENT_LINE2, errStat2, errMsg2, p1=j, p2=j+1 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + end do !j + + call MeshCommit(m%ADRotorDisk(k), errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat >= AbortErrLev) exit + + call MeshMapCreate(m%TempLoads(k), m%ADRotorDisk(k), m%AD_L2L(k), ErrStat2, ErrMsg2) ! this is going to transfer the motions as well as the loads, which is overkill + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + end do + + !................ + ! also need to set the WrOutput channels... + !................ + + + call cleanup() + +contains + subroutine cleanup() + + call FAST_DestroyExternInitType(ExternInitData,ErrStat2,ErrMsg2) ! this doesn't actually do anything unless we add allocatable data later + + end subroutine cleanup + +END SUBROUTINE FWrap_Init +!---------------------------------------------------------------------------------------------------------------------------------- +! this routine sets the parameters for the FAST Wrapper module. It does not set p%n_FAST_low because we need to initialize FAST first. +subroutine FWrap_SetParameters(InitInp, p, dt_FAST, InitInp_dt_low, ErrStat, ErrMsg) + TYPE(FWrap_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine + TYPE(FWrap_ParameterType), INTENT(INOUT) :: p !< Parameters + REAL(DbKi), INTENT(IN ) :: dt_FAST !< time step for FAST + REAL(DbKi), INTENT(IN ) :: InitInp_dt_low !< time step for FAST.Farm + + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables + TYPE(FAST_ExternInitType) :: ExternInitData + + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_Init' + + + p%p_ref_Turbine = InitInp%p_ref_Turbine + p%nr = InitInp%nr + + call AllocAry(p%r, p%nr, 'p%r (radial discretization)', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + if (ErrStat>=AbortErrLev) return + + do i=0,p%nr-1 + p%r(i+1) = i*InitInp%dr + end do + + + ! p%n_FAST_low has to be set AFTER we initialize FAST, because we need to know what the FAST time step is going to be. + IF ( EqualRealNos( dt_FAST, InitInp_dt_low ) ) THEN + p%n_FAST_low = 1 + ELSE + IF ( dt_FAST > InitInp_dt_low ) THEN + ErrStat = ErrID_Fatal + ErrMsg = "The FAST time step ("//TRIM(Num2LStr(dt_FAST))// & + " s) cannot be larger than FAST.Farm time step ("//TRIM(Num2LStr(InitInp_dt_low))//" s)." + ELSE + ! calculate the number of subcycles: + p%n_FAST_low = NINT( InitInp_dt_low / dt_FAST ) + + ! let's make sure the FAST DT is an exact integer divisor of the global (FAST.Farm) time step: + IF ( .NOT. EqualRealNos( InitInp_dt_low, dt_FAST * p%n_FAST_low ) ) THEN + ErrStat = ErrID_Fatal + ErrMsg = "The FASTWrapper module time step ("//TRIM(Num2LStr(dt_FAST))// & + " s) must be an integer divisor of the FAST.Farm time step ("//TRIM(Num2LStr(InitInp_dt_low))//" s)." + END IF + + END IF + END IF + + + +end subroutine FWrap_SetParameters +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the end of the simulation. +SUBROUTINE FWrap_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(FWrap_InputType), INTENT(INOUT) :: u !< System inputs + TYPE(FWrap_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(FWrap_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states + TYPE(FWrap_DiscreteStateType), INTENT(INOUT) :: xd !< Discrete states + TYPE(FWrap_ConstraintStateType), INTENT(INOUT) :: z !< Constraint states + TYPE(FWrap_OtherStateType), INTENT(INOUT) :: OtherState !< Other states + TYPE(FWrap_OutputType), INTENT(INOUT) :: y !< System outputs + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_End' + + ! Initialize ErrStat + + ErrStat = ErrID_None + ErrMsg = '' + + + !! Place any last minute operations or calculations here: + + CALL ExitThisProgram_T( m%Turbine, ErrID_None, .false. ) + + !! Close files here (but because of checkpoint-restart capability, it is not recommended to have files open during the simulation): + + + !! Destroy the input data: + + call FWrap_DestroyInput( u, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + + !! Destroy the parameter data: + + call FWrap_DestroyParam( p, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + !! Destroy the state data: + + call FWrap_DestroyContState( x, ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call FWrap_DestroyDiscState( xd, ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call FWrap_DestroyConstrState( z, ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call FWrap_DestroyOtherState( OtherState, ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + + !! Destroy the output data: + + call FWrap_DestroyOutput( y, ErrStat2, ErrMsg2 ); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + + !! Destroy the misc data: + + call FWrap_DestroyMisc( m, ErrStat2, ErrMsg2 ); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + +END SUBROUTINE FWrap_End +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine updates states and outputs to n+1 based on inputs and states at n (this has an inherent time-step delay on outputs). +!! The routine uses subcycles because FAST typically has a smaller time step than FAST.Farm. +SUBROUTINE FWrap_Increment( t, n, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + INTEGER(IntKi), INTENT(IN ) :: n !< Current step of the simulation: t = n*Interval + TYPE(FWrap_InputType), INTENT(INOUT) :: u !< Inputs at t (not changed, but possibly copied) + TYPE(FWrap_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(FWrap_ContinuousStateType), INTENT(INOUT) :: x !< Input: Continuous states at t; + !! Output: Continuous states at t + Interval + TYPE(FWrap_DiscreteStateType), INTENT(INOUT) :: xd !< Input: Discrete states at t; + !! Output: Discrete states at t + Interval + TYPE(FWrap_ConstraintStateType), INTENT(INOUT) :: z !< Input: Constraint states at t; + !! Output: Constraint states at t + Interval + TYPE(FWrap_OtherStateType), INTENT(INOUT) :: OtherState !< Other states: Other states at t; + !! Output: Other states at t + Interval + TYPE(FWrap_OutputType), INTENT(INOUT) :: y !< Outputs computed at t + Interval (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! Local variables + INTEGER(IntKi) :: n_ss ! sub-cycle loop + INTEGER(IntKi) :: n_FAST ! n for this FAST instance + + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_Increment' + + + ! Initialize variables + + ErrStat = ErrID_None ! no error has occurred + ErrMsg = '' + + !IF ( n > m%Turbine%p_FAST%n_TMax_m1 - p%n_FAST_low ) THEN !finish + ! + ! call setErrStat(ErrID_Fatal,"programming error: FAST.Farm has exceeded FAST's TMax",ErrStat,ErrMsg,RoutineName) + ! return + ! + !ELSE + ! + ! set the inputs needed for FAST + call FWrap_SetInputs(u, m, t) + + ! call FAST p%n_FAST_low times: + do n_ss = 1, p%n_FAST_low + n_FAST = n*p%n_FAST_low + n_ss - 1 + + CALL FAST_Solution_T( t_initial, n_FAST, m%Turbine, ErrStat2, ErrMsg2 ) + call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + if (ErrStat >= AbortErrLev) return + + end do ! n_ss + + call FWrap_CalcOutput(p, u, y, m, ErrStat2, ErrMsg2) + call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + !END IF + + +END SUBROUTINE FWrap_Increment +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine calculates outputs at n=0 based on inputs at n=0. +SUBROUTINE FWrap_t0( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(FWrap_InputType), INTENT(INOUT) :: u !< Inputs at t + TYPE(FWrap_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(FWrap_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at t + TYPE(FWrap_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(FWrap_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t + TYPE(FWrap_OtherStateType), INTENT(IN ) :: OtherState !< Other states at t + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) + TYPE(FWrap_OutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_t0' + + ! Initialize ErrStat + + ErrStat = ErrID_None + ErrMsg = '' + + + ! set the inputs needed for FAST: + call FWrap_SetInputs(u, m, 0.0_DbKi) + + ! compute the FAST t0 solution: + call FAST_Solution0_T(m%Turbine, ErrStat2, ErrMsg2 ) + call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + ! set the outputs for FAST.Farm: + call FWrap_CalcOutput(p, u, y, m, ErrStat2, ErrMsg2) + call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + +END SUBROUTINE FWrap_t0 +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine sets the FASTWrapper outputs based on what this instance of FAST computed. +SUBROUTINE FWrap_CalcOutput(p, u, y, m, ErrStat, ErrMsg) + + TYPE(FWrap_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(FWrap_InputType), INTENT(INOUT) :: u !< Inputs at t + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) + TYPE(FWrap_OutputType), INTENT(INOUT) :: y !< Outputs + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! Local variables + REAL(ReKi) :: vx ! velocity in x direction + REAL(ReKi) :: vy ! velocity in y direction + REAL(ReKi) :: num ! numerator + REAL(ReKi) :: denom ! denominator + REAL(ReKi) :: p0(3) ! hub location (in FAST with 0,0,0 as turbine reference) + REAL(R8Ki) :: theta(3) + REAL(R8Ki) :: orientation(3,3) + + INTEGER(IntKi) :: j, k ! loop counters + + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CalcOutput' + + integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt + + ! Initialize ErrStat + + ErrStat = ErrID_None + ErrMsg = '' + + ! put this back! + call move_alloc(m%Turbine%IfW%m%FDext%V, u%Vdist_High) + + + ! Turbine-dependent commands to the super controller: + if (m%Turbine%p_FAST%UseSC) then + y%toSC = m%Turbine%SC_DX%u%toSC + end if + + + ! ....... outputs from AeroDyn v15 ............ + + ! note that anything that uses m%Turbine%AD%Input(1) assumes we have not updated these inputs after calling AD_CalcOutput in FAST. + + ! Orientation of rotor centerline, normal to disk: + y%xHat_Disk = m%Turbine%AD%Input(1)%rotors(1)%HubMotion%Orientation(1,:,1) !actually also x_hat_disk and x_hat_hub + + + ! Nacelle-yaw error i.e. the angle about positive Z^ from the rotor centerline to the rotor-disk-averaged relative wind + ! velocity (ambients + deficits + motion), both projected onto the horizontal plane, rad + + ! if the orientation of the rotor centerline or rotor-disk-averaged relative wind speed is directed vertically upward or downward (+/-Z^) + ! the nacelle-yaw error is undefined + if ( EqualRealNos(m%Turbine%AD%m%rotors(1)%V_DiskAvg(1), 0.0_ReKi) .and. EqualRealNos(m%Turbine%AD%m%rotors(1)%V_DiskAvg(2), 0.0_ReKi) ) then + call SetErrStat(ErrID_Fatal,"Nacelle-yaw error is undefined because the rotor-disk-averaged relative wind speed "// & + "is directed vertically", ErrStat,ErrMsg,RoutineName) + elseif ( EqualRealNos(y%xHat_Disk(1), 0.0_ReKi) .and. EqualRealNos(y%xHat_Disk(2), 0.0_ReKi) ) then + call SetErrStat(ErrID_Fatal,"Nacelle-yaw error is undefined because the rotor centerline "// & + "is directed vertically", ErrStat,ErrMsg,RoutineName) + else + vy = m%Turbine%AD%m%rotors(1)%V_DiskAvg(2) * y%xHat_Disk(1) - m%Turbine%AD%m%rotors(1)%V_DiskAvg(1) * y%xHat_Disk(2) + vx = m%Turbine%AD%m%rotors(1)%V_DiskAvg(1) * y%xHat_Disk(1) + m%Turbine%AD%m%rotors(1)%V_DiskAvg(2) * y%xHat_Disk(2) + + y%YawErr = atan2(vy, vx) + end if + + + ! Center position of hub, m + p0 = m%Turbine%AD%Input(1)%rotors(1)%HubMotion%Position(:,1) + m%Turbine%AD%Input(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + y%p_hub = p%p_ref_Turbine + p0 + + ! Rotor diameter, m + y%D_rotor = 2.0_ReKi * maxval(m%Turbine%AD%m%rotors(1)%BEMT_u(indx)%rLocal) ! BEMT_u(indx) is calculated on inputs that were passed INTO AD_CalcOutput; Input(1) is calculated from values passed out of ED_CalcOutput AFTER AD_CalcOutput + + if ( y%D_rotor > p%r(p%nr) ) then + call SetErrStat(ErrID_Fatal,"The radius of the wake planes is not large relative to the rotor diameter.", ErrStat,ErrMsg,RoutineName) + end if + + ! Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk, m/s + y%DiskAvg_Vx_Rel = m%Turbine%AD%m%rotors(1)%V_dot_x + + ! Azimuthally averaged thrust force coefficient (normal to disk), distributed radially + theta = 0.0_ReKi + do k=1,size(m%ADRotorDisk) + + m%TempDisp(k)%RefOrientation = m%Turbine%AD%Input(1)%rotors(1)%BladeMotion(k)%Orientation + m%TempDisp(k)%Position = m%Turbine%AD%Input(1)%rotors(1)%BladeMotion(k)%Position + m%Turbine%AD%Input(1)%rotors(1)%BladeMotion(k)%TranslationDisp + !m%TempDisp(k)%TranslationDisp = 0.0_R8Ki + m%TempLoads(k)%Force = m%Turbine%AD%y%rotors(1)%BladeLoad(k)%Force + m%TempLoads(k)%Moment = m%Turbine%AD%y%rotors(1)%BladeLoad(k)%Moment + + theta(1) = m%Turbine%AD%m%rotors(1)%hub_theta_x_root(k) + orientation = EulerConstruct( theta ) + m%ADRotorDisk(k)%RefOrientation(:,:,1) = matmul(orientation, m%Turbine%AD%Input(1)%rotors(1)%HubMotion%Orientation(:,:,1) ) + do j=1,p%nr + m%ADRotorDisk(k)%RefOrientation(:,:,j) = m%ADRotorDisk(k)%RefOrientation(:,:,1) + m%ADRotorDisk(k)%Position(:,j) = p0 + p%r(j)*m%ADRotorDisk(k)%RefOrientation(3,:,1) + end do + !m%ADRotorDisk(k)%TranslationDisp = 0.0_ReKi + m%ADRotorDisk(k)%RemapFlag = .true. + + call transfer_line2_to_line2(m%TempLoads(k), m%ADRotorDisk(k), m%AD_L2L(k), ErrStat2, ErrMsg2, m%TempDisp(k), m%ADRotorDisk(k)) + call setErrStat(ErrStat2,ErrMsg2,ErrStat2,ErrMsg,RoutineName) + if (ErrStat >= AbortErrLev) return + end do + + if (EqualRealNos(y%DiskAvg_Vx_Rel,0.0_ReKi)) then + y%AzimAvg_Ct = 0.0_ReKi + else + y%AzimAvg_Ct(1) = 0.0_ReKi + + do j=2,p%nr + + num = 0.0_ReKi + do k=1,size(m%ADRotorDisk) + num = num + dot_product( y%xHat_Disk, m%ADRotorDisk(k)%Force(:,j) ) + end do + + denom = m%Turbine%AD%p%rotors(1)%AirDens * pi * p%r(j) * y%DiskAvg_Vx_Rel**2 + + y%AzimAvg_Ct(j) = num / denom + end do + + end if + +END SUBROUTINE FWrap_CalcOutput +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine sets the inputs needed before calling an instance of FAST +SUBROUTINE FWrap_SetInputs(u, m, t) + + TYPE(FWrap_InputType), INTENT(INOUT) :: u !< Inputs at t + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) + REAL(DbKi), INTENT(IN ) :: t !< current simulation time + + ! set the 4d-wind-inflow input array (a bit of a hack [simplification] so that we don't have large amounts of data copied in multiple data structures): + call move_alloc(u%Vdist_High, m%Turbine%IfW%m%FDext%V) + m%Turbine%IfW%m%FDext%TgridStart = t + + ! do something with the inputs from the super-controller: + if ( m%Turbine%p_FAST%UseSC ) then + + if ( associated(m%Turbine%SC_DX%y%fromSCglob) ) then + m%Turbine%SC_DX%y%fromSCglob = u%fromSCglob ! Yes, we set the inputs of FWrap to the 'outputs' of the SC_DX object, GJH + end if + + if ( associated(m%Turbine%SC_DX%y%fromSC) ) then + m%Turbine%SC_DX%y%fromSC = u%fromSC ! Yes, we set the inputs of FWrap to the 'outputs' of the SC_DX object, GJH + end if + + end if + +END SUBROUTINE FWrap_SetInputs +!---------------------------------------------------------------------------------------------------------------------------------- +END MODULE FASTWrapper +!********************************************************************************************************************************** diff --git a/glue-codes/fast-farm/src/FASTWrapper_Registry.txt b/glue-codes/fast-farm/src/FASTWrapper_Registry.txt new file mode 100644 index 0000000000..7cf5303c5e --- /dev/null +++ b/glue-codes/fast-farm/src/FASTWrapper_Registry.txt @@ -0,0 +1,97 @@ +################################################################################################################################### +# Registry for FAST.Farm's FASTWrapper module in the FAST Modularization Framework +# This Registry file is used to create MODULE FASTWrapper_Types, which contains all of the user-defined types needed in FASTWrapper. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# +# Entries are of the form +# keyword +# +# Use ^ as a shortcut for the value from the previous line. +# See NWTC Programmer's Handbook at https://nwtc.nrel.gov/FAST-Developers for further information on the format/contents of this file. +################################################################################################################################### + +# ...... Include files (definitions from NWTC Library) ............................................................................ +include Registry_NWTC_Library.txt +usefrom FAST_Registry.txt + +# ..... Initialization data ....................................................................................................... +# Define inputs that the initialization routine may need here: +# e.g., the name of the input file, the file root name, etc. +typedef FASTWrapper/FWrap InitInputType IntKi nr - - - "Number of radii in the radial finite-difference grid" - +typedef ^ InitInputType CHARACTER(1024) FASTInFile - - - "Filename of primary FAST input file of this turbine" - +typedef ^ InitInputType ReKi dr - - - "Radial increment of radial finite-difference grid" m +typedef ^ InitInputType DbKi tmax - - - "Simulation length" s +typedef ^ InitInputType ReKi p_ref_Turbine {3} - - "Undisplaced global coordinates of this turbine" m +typedef ^ InitInputType IntKi n_high_low - - - "Number of high-resolution time steps per low-resolution time step" - +typedef ^ InitInputType DbKi dt_high - - - "High-resolution time step" s +typedef ^ InitInputType ReKi p_ref_high {3} - - "Position of the origin of the high-resolution spatial domain for this turbine" m +typedef ^ InitInputType IntKi nX_high - - - "Number of high-resolution spatial nodes in X direction" - +typedef ^ InitInputType IntKi nY_high - - - "Number of high-resolution spatial nodes in Y direction" - +typedef ^ InitInputType IntKi nZ_high - - - "Number of high-resolution spatial nodes in Z direction" - +typedef ^ InitInputType ReKi dX_high - - - "X-component of the spatial increment of the high-resolution spatial domain for this turbine" m +typedef ^ InitInputType ReKi dY_high - - - "Y-component of the spatial increment of the high-resolution spatial domain for this turbine" m +typedef ^ InitInputType ReKi dZ_high - - - "Z-component of the spatial increment of the high-resolution spatial domain for this turbine" m +typedef ^ InitInputType IntKi TurbNum - - - "Turbine ID number (start with 1; end with number of turbines)" - +typedef ^ InitInputType CHARACTER(1024) RootName - - - "The root name derived from the primary FAST.Farm input file [For output reporting in this module we need to have Rootname include the turbine number]" - +typedef ^ InitInputType IntKi NumSC2Ctrl - - - "Number of turbine-specific controller inputs [from supercontroller]" - +typedef ^ InitInputType IntKi NumSC2CtrlGlob - - - "Number of global controller inputs [from supercontroller]" - +typedef ^ InitInputType IntKi NumCtrl2SC - - - "Number of turbine-specific controller outputs [to supercontroller]" - +typedef ^ InitInputType Logical UseSC - - - "Use the SuperController? (flag)" - +typedef ^ InitInputType SiKi fromSCGlob {:} - - "Global outputs from SuperController" - +typedef ^ InitInputType SiKi fromSC {:} - - "Turbine-specific outputs from SuperController" - + +# Define outputs from the initialization routine here: +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" - +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - + + +# ..... States .................................................................................................................... +# Define continuous (differentiable) states here: +typedef ^ ContinuousStateType ReKi dummy - - - "Remove this variable if you have continuous states" - + +# Define discrete (nondifferentiable) states here: +typedef ^ DiscreteStateType ReKi dummy - - - "Remove this variable if you have continuous states" - + +# Define constraint states here: +typedef ^ ConstraintStateType ReKi dummy - - - "Remove this variable if you have constraint states" - + +# Define any other states, including integer or logical states here: +typedef ^ OtherStateType IntKi dummy - - - "Remove this variable if you have other states" - + + +# ..... Misc/Optimization variables................................................................................................. +# Define any data that are used only for efficiency purposes (these variables are not associated with time): +# e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc. +typedef ^ MiscVarType FAST_TurbineType Turbine - - - "Data for this FAST instance" - +typedef ^ MiscVarType MeshType TempDisp {:} - - "temp displacement mesh (for AzimAvg_Ct)" - +typedef ^ MiscVarType MeshType TempLoads {:} - - "temp loads mesh (for AzimAvg_Ct)" - +typedef ^ MiscVarType MeshType ADRotorDisk {:} - - "Mesh that does not deflect with the blade (for AzimAvg_Ct)" - +typedef ^ MiscVarType MeshMapType AD_L2L {:} - - "Map AD loads from deflected mesh to rotor-disk plane" + + +# ..... Parameters ................................................................................................................ +# Define parameters here: +# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: +typedef ^ ParameterType IntKi nr - - - "Number of radii in the radial finite-difference grid" - +typedef ^ ParameterType ReKi r {:} - - "Discretization of radial finite-difference grid" m +typedef ^ ParameterType IntKi n_FAST_low - - - "Number of FAST time steps per low-resolution time step" - +typedef ^ ParameterType ReKi p_ref_Turbine {3} - - "Undisplaced global position of this turbine" m + + +# ..... Inputs .................................................................................................................... +# Define inputs that are contained on the mesh here: +typedef ^ InputType SiKi fromSCglob {:} - - "Global (turbine-independent) commands from the super controller" "(various units)" +typedef ^ InputType SiKi fromSC {:} - - "Turbine-dependent commands from the super controller from the super controller" "(various units)" +typedef ^ InputType SiKi Vdist_High {:}{:}{:}{:}{:} - - "UVW components of disturbed wind [nx^high, ny^high, nz^high, n^high/low] (ambient + deficits) across the high-resolution domain around the turbine for each high-resolution time step within a low-resolution time step" "(m/s)" + +# ..... Outputs ................................................................................................................... +# Define outputs that are contained on the mesh here: +typedef ^ OutputType SiKi toSC {:} - - "Turbine-dependent commands to the super controller" "(various units)" +typedef ^ OutputType ReKi xHat_Disk {3} - - "Orientation of rotor centerline, normal to disk" "-" +typedef ^ OutputType ReKi YawErr - - - "Nacelle-yaw error i.e. the angle about positive Z^ from the rotor centerline to the rotor-disk-averaged relative wind velocity (ambients + deficits + motion), both projected onto the horizontal plane" "rad" +typedef ^ OutputType ReKi p_hub {3} - - "Center position of hub" "m" +typedef ^ OutputType ReKi D_rotor - - - "Rotor diameter" "m" +typedef ^ OutputType ReKi DiskAvg_Vx_Rel - - - "Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk" "m/s" +typedef ^ OutputType ReKi AzimAvg_Ct {:} - - "Azimuthally averaged thrust force coefficient (normal to disk), distributed radially" "-" + diff --git a/glue-codes/fast-farm/src/FASTWrapper_Types.f90 b/glue-codes/fast-farm/src/FASTWrapper_Types.f90 new file mode 100644 index 0000000000..646bbbb856 --- /dev/null +++ b/glue-codes/fast-farm/src/FASTWrapper_Types.f90 @@ -0,0 +1,2834 @@ +!STARTOFREGISTRYGENERATEDFILE 'FASTWrapper_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! FASTWrapper_Types +!................................................................................................................................. +! This file is part of FASTWrapper. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in FASTWrapper. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE FASTWrapper_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE ElastoDyn_Types +USE BeamDyn_Types +USE StrucCtrl_Types +USE ServoDyn_Types +USE IfW_UniformWind_Types +USE IfW_FFWind_Base_Types +USE IfW_TSFFWind_Types +USE IfW_BladedFFWind_Types +USE IfW_HAWCWind_Types +USE IfW_UserWind_Types +USE IfW_4Dext_Types +USE Lidar_Types +USE InflowWind_Types +USE DWM_Types +USE AeroDyn14_Types +USE AirfoilInfo_Types +USE UnsteadyAero_Types +USE DBEMT_Types +USE BEMT_Types +USE FVW_Types +USE AeroAcoustics_Types +USE AeroDyn_Types +USE SubDyn_Types +USE Current_Types +USE Waves_Types +USE Waves2_Types +USE Conv_Radiation_Types +USE SS_Radiation_Types +USE SS_Excitation_Types +USE WAMIT_Types +USE WAMIT2_Types +USE Morison_Types +USE HydroDyn_Types +USE IceFloe_Types +USE OpenFOAM_Types +USE SCDataEx_Types +USE IceDyn_Types +USE FEAMooring_Types +USE MAP_Fortran_Types +USE MAP_Types +USE MoorDyn_Types +USE OrcaFlexInterface_Types +USE ExtPtfm_MCKF_Types +USE FAST_Types +USE NWTC_Library +IMPLICIT NONE +! ========= FWrap_InitInputType ======= + TYPE, PUBLIC :: FWrap_InitInputType + INTEGER(IntKi) :: nr !< Number of radii in the radial finite-difference grid [-] + CHARACTER(1024) :: FASTInFile !< Filename of primary FAST input file of this turbine [-] + REAL(ReKi) :: dr !< Radial increment of radial finite-difference grid [m] + REAL(DbKi) :: tmax !< Simulation length [s] + REAL(ReKi) , DIMENSION(1:3) :: p_ref_Turbine !< Undisplaced global coordinates of this turbine [m] + INTEGER(IntKi) :: n_high_low !< Number of high-resolution time steps per low-resolution time step [-] + REAL(DbKi) :: dt_high !< High-resolution time step [s] + REAL(ReKi) , DIMENSION(1:3) :: p_ref_high !< Position of the origin of the high-resolution spatial domain for this turbine [m] + INTEGER(IntKi) :: nX_high !< Number of high-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_high !< Number of high-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_high !< Number of high-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: dX_high !< X-component of the spatial increment of the high-resolution spatial domain for this turbine [m] + REAL(ReKi) :: dY_high !< Y-component of the spatial increment of the high-resolution spatial domain for this turbine [m] + REAL(ReKi) :: dZ_high !< Z-component of the spatial increment of the high-resolution spatial domain for this turbine [m] + INTEGER(IntKi) :: TurbNum !< Turbine ID number (start with 1; end with number of turbines) [-] + CHARACTER(1024) :: RootName !< The root name derived from the primary FAST.Farm input file [For output reporting in this module we need to have Rootname include the turbine number] [-] + INTEGER(IntKi) :: NumSC2Ctrl !< Number of turbine-specific controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< Number of global controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumCtrl2SC !< Number of turbine-specific controller outputs [to supercontroller] [-] + LOGICAL :: UseSC !< Use the SuperController? (flag) [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSCGlob !< Global outputs from SuperController [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< Turbine-specific outputs from SuperController [-] + END TYPE FWrap_InitInputType +! ======================= +! ========= FWrap_InitOutputType ======= + TYPE, PUBLIC :: FWrap_InitOutputType + TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] + END TYPE FWrap_InitOutputType +! ======================= +! ========= FWrap_ContinuousStateType ======= + TYPE, PUBLIC :: FWrap_ContinuousStateType + REAL(ReKi) :: dummy !< Remove this variable if you have continuous states [-] + END TYPE FWrap_ContinuousStateType +! ======================= +! ========= FWrap_DiscreteStateType ======= + TYPE, PUBLIC :: FWrap_DiscreteStateType + REAL(ReKi) :: dummy !< Remove this variable if you have continuous states [-] + END TYPE FWrap_DiscreteStateType +! ======================= +! ========= FWrap_ConstraintStateType ======= + TYPE, PUBLIC :: FWrap_ConstraintStateType + REAL(ReKi) :: dummy !< Remove this variable if you have constraint states [-] + END TYPE FWrap_ConstraintStateType +! ======================= +! ========= FWrap_OtherStateType ======= + TYPE, PUBLIC :: FWrap_OtherStateType + INTEGER(IntKi) :: dummy !< Remove this variable if you have other states [-] + END TYPE FWrap_OtherStateType +! ======================= +! ========= FWrap_MiscVarType ======= + TYPE, PUBLIC :: FWrap_MiscVarType + TYPE(FAST_TurbineType) :: Turbine !< Data for this FAST instance [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: TempDisp !< temp displacement mesh (for AzimAvg_Ct) [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: TempLoads !< temp loads mesh (for AzimAvg_Ct) [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: ADRotorDisk !< Mesh that does not deflect with the blade (for AzimAvg_Ct) [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: AD_L2L !< Map AD loads from deflected mesh to rotor-disk plane [-] + END TYPE FWrap_MiscVarType +! ======================= +! ========= FWrap_ParameterType ======= + TYPE, PUBLIC :: FWrap_ParameterType + INTEGER(IntKi) :: nr !< Number of radii in the radial finite-difference grid [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: r !< Discretization of radial finite-difference grid [m] + INTEGER(IntKi) :: n_FAST_low !< Number of FAST time steps per low-resolution time step [-] + REAL(ReKi) , DIMENSION(1:3) :: p_ref_Turbine !< Undisplaced global position of this turbine [m] + END TYPE FWrap_ParameterType +! ======================= +! ========= FWrap_InputType ======= + TYPE, PUBLIC :: FWrap_InputType + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSCglob !< Global (turbine-independent) commands from the super controller [(various units)] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< Turbine-dependent commands from the super controller from the super controller [(various units)] + REAL(SiKi) , DIMENSION(:,:,:,:,:), ALLOCATABLE :: Vdist_High !< UVW components of disturbed wind [nx^high, ny^high, nz^high, n^high/low] (ambient + deficits) across the high-resolution domain around the turbine for each high-resolution time step within a low-resolution time step [(m/s)] + END TYPE FWrap_InputType +! ======================= +! ========= FWrap_OutputType ======= + TYPE, PUBLIC :: FWrap_OutputType + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< Turbine-dependent commands to the super controller [(various units)] + REAL(ReKi) , DIMENSION(1:3) :: xHat_Disk !< Orientation of rotor centerline, normal to disk [-] + REAL(ReKi) :: YawErr !< Nacelle-yaw error i.e. the angle about positive Z^ from the rotor centerline to the rotor-disk-averaged relative wind velocity (ambients + deficits + motion), both projected onto the horizontal plane [rad] + REAL(ReKi) , DIMENSION(1:3) :: p_hub !< Center position of hub [m] + REAL(ReKi) :: D_rotor !< Rotor diameter [m] + REAL(ReKi) :: DiskAvg_Vx_Rel !< Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: AzimAvg_Ct !< Azimuthally averaged thrust force coefficient (normal to disk), distributed radially [-] + END TYPE FWrap_OutputType +! ======================= +CONTAINS + SUBROUTINE FWrap_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(FWrap_InitInputType), INTENT(INOUT) :: DstInitInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInitInputData%nr = SrcInitInputData%nr + DstInitInputData%FASTInFile = SrcInitInputData%FASTInFile + DstInitInputData%dr = SrcInitInputData%dr + DstInitInputData%tmax = SrcInitInputData%tmax + DstInitInputData%p_ref_Turbine = SrcInitInputData%p_ref_Turbine + DstInitInputData%n_high_low = SrcInitInputData%n_high_low + DstInitInputData%dt_high = SrcInitInputData%dt_high + DstInitInputData%p_ref_high = SrcInitInputData%p_ref_high + DstInitInputData%nX_high = SrcInitInputData%nX_high + DstInitInputData%nY_high = SrcInitInputData%nY_high + DstInitInputData%nZ_high = SrcInitInputData%nZ_high + DstInitInputData%dX_high = SrcInitInputData%dX_high + DstInitInputData%dY_high = SrcInitInputData%dY_high + DstInitInputData%dZ_high = SrcInitInputData%dZ_high + DstInitInputData%TurbNum = SrcInitInputData%TurbNum + DstInitInputData%RootName = SrcInitInputData%RootName + DstInitInputData%NumSC2Ctrl = SrcInitInputData%NumSC2Ctrl + DstInitInputData%NumSC2CtrlGlob = SrcInitInputData%NumSC2CtrlGlob + DstInitInputData%NumCtrl2SC = SrcInitInputData%NumCtrl2SC + DstInitInputData%UseSC = SrcInitInputData%UseSC +IF (ALLOCATED(SrcInitInputData%fromSCGlob)) THEN + i1_l = LBOUND(SrcInitInputData%fromSCGlob,1) + i1_u = UBOUND(SrcInitInputData%fromSCGlob,1) + IF (.NOT. ALLOCATED(DstInitInputData%fromSCGlob)) THEN + ALLOCATE(DstInitInputData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%fromSCGlob = SrcInitInputData%fromSCGlob +ENDIF +IF (ALLOCATED(SrcInitInputData%fromSC)) THEN + i1_l = LBOUND(SrcInitInputData%fromSC,1) + i1_u = UBOUND(SrcInitInputData%fromSC,1) + IF (.NOT. ALLOCATED(DstInitInputData%fromSC)) THEN + ALLOCATE(DstInitInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%fromSC = SrcInitInputData%fromSC +ENDIF + END SUBROUTINE FWrap_CopyInitInput + + SUBROUTINE FWrap_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(FWrap_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InitInputData%fromSCGlob)) THEN + DEALLOCATE(InitInputData%fromSCGlob) +ENDIF +IF (ALLOCATED(InitInputData%fromSC)) THEN + DEALLOCATE(InitInputData%fromSC) +ENDIF + END SUBROUTINE FWrap_DestroyInitInput + + SUBROUTINE FWrap_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! nr + Int_BufSz = Int_BufSz + 1*LEN(InData%FASTInFile) ! FASTInFile + Re_BufSz = Re_BufSz + 1 ! dr + Db_BufSz = Db_BufSz + 1 ! tmax + Re_BufSz = Re_BufSz + SIZE(InData%p_ref_Turbine) ! p_ref_Turbine + Int_BufSz = Int_BufSz + 1 ! n_high_low + Db_BufSz = Db_BufSz + 1 ! dt_high + Re_BufSz = Re_BufSz + SIZE(InData%p_ref_high) ! p_ref_high + Int_BufSz = Int_BufSz + 1 ! nX_high + Int_BufSz = Int_BufSz + 1 ! nY_high + Int_BufSz = Int_BufSz + 1 ! nZ_high + Re_BufSz = Re_BufSz + 1 ! dX_high + Re_BufSz = Re_BufSz + 1 ! dY_high + Re_BufSz = Re_BufSz + 1 ! dZ_high + Int_BufSz = Int_BufSz + 1 ! TurbNum + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob + Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + Int_BufSz = Int_BufSz + 1 ! UseSC + Int_BufSz = Int_BufSz + 1 ! fromSCGlob allocated yes/no + IF ( ALLOCATED(InData%fromSCGlob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCGlob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCGlob) ! fromSCGlob + END IF + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = InData%nr + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%FASTInFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%FASTInFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + ReKiBuf(Re_Xferred) = InData%dr + Re_Xferred = Re_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%tmax + Db_Xferred = Db_Xferred + 1 + DO i1 = LBOUND(InData%p_ref_Turbine,1), UBOUND(InData%p_ref_Turbine,1) + ReKiBuf(Re_Xferred) = InData%p_ref_Turbine(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%n_high_low + Int_Xferred = Int_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%dt_high + Db_Xferred = Db_Xferred + 1 + DO i1 = LBOUND(InData%p_ref_high,1), UBOUND(InData%p_ref_high,1) + ReKiBuf(Re_Xferred) = InData%p_ref_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%nX_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_high + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dX_high + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dY_high + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dZ_high + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TurbNum + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumCtrl2SC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseSC, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%fromSCGlob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCGlob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCGlob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCGlob,1), UBOUND(InData%fromSCGlob,1) + ReKiBuf(Re_Xferred) = InData%fromSCGlob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE FWrap_PackInitInput + + SUBROUTINE FWrap_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%nr = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%FASTInFile) + OutData%FASTInFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%dr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%tmax = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + i1_l = LBOUND(OutData%p_ref_Turbine,1) + i1_u = UBOUND(OutData%p_ref_Turbine,1) + DO i1 = LBOUND(OutData%p_ref_Turbine,1), UBOUND(OutData%p_ref_Turbine,1) + OutData%p_ref_Turbine(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%n_high_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dt_high = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + i1_l = LBOUND(OutData%p_ref_high,1) + i1_u = UBOUND(OutData%p_ref_high,1) + DO i1 = LBOUND(OutData%p_ref_high,1), UBOUND(OutData%p_ref_high,1) + OutData%p_ref_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%nX_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dX_high = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dY_high = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dZ_high = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%TurbNum = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%UseSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseSC) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCGlob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCGlob)) DEALLOCATE(OutData%fromSCGlob) + ALLOCATE(OutData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCGlob,1), UBOUND(OutData%fromSCGlob,1) + OutData%fromSCGlob(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE FWrap_UnPackInitInput + + SUBROUTINE FWrap_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(FWrap_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE FWrap_CopyInitOutput + + SUBROUTINE FWrap_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(FWrap_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) + END SUBROUTINE FWrap_DestroyInitOutput + + SUBROUTINE FWrap_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE FWrap_PackInitOutput + + SUBROUTINE FWrap_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE FWrap_UnPackInitOutput + + SUBROUTINE FWrap_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(FWrap_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstContStateData%dummy = SrcContStateData%dummy + END SUBROUTINE FWrap_CopyContState + + SUBROUTINE FWrap_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(FWrap_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE FWrap_DestroyContState + + SUBROUTINE FWrap_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! dummy + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_PackContState + + SUBROUTINE FWrap_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dummy = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_UnPackContState + + SUBROUTINE FWrap_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(FWrap_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstDiscStateData%dummy = SrcDiscStateData%dummy + END SUBROUTINE FWrap_CopyDiscState + + SUBROUTINE FWrap_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(FWrap_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE FWrap_DestroyDiscState + + SUBROUTINE FWrap_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! dummy + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_PackDiscState + + SUBROUTINE FWrap_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dummy = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_UnPackDiscState + + SUBROUTINE FWrap_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(FWrap_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstConstrStateData%dummy = SrcConstrStateData%dummy + END SUBROUTINE FWrap_CopyConstrState + + SUBROUTINE FWrap_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(FWrap_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE FWrap_DestroyConstrState + + SUBROUTINE FWrap_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_ConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackConstrState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! dummy + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_PackConstrState + + SUBROUTINE FWrap_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_ConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackConstrState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dummy = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE FWrap_UnPackConstrState + + SUBROUTINE FWrap_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(FWrap_OtherStateType), INTENT(INOUT) :: DstOtherStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyOtherState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstOtherStateData%dummy = SrcOtherStateData%dummy + END SUBROUTINE FWrap_CopyOtherState + + SUBROUTINE FWrap_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(FWrap_OtherStateType), INTENT(INOUT) :: OtherStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyOtherState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE FWrap_DestroyOtherState + + SUBROUTINE FWrap_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_OtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackOtherState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! dummy + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = InData%dummy + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE FWrap_PackOtherState + + SUBROUTINE FWrap_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_OtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackOtherState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dummy = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE FWrap_UnPackOtherState + + SUBROUTINE FWrap_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: SrcMiscData + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL FAST_Copyturbinetype( SrcMiscData%Turbine, DstMiscData%Turbine, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcMiscData%TempDisp)) THEN + i1_l = LBOUND(SrcMiscData%TempDisp,1) + i1_u = UBOUND(SrcMiscData%TempDisp,1) + IF (.NOT. ALLOCATED(DstMiscData%TempDisp)) THEN + ALLOCATE(DstMiscData%TempDisp(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TempDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%TempDisp,1), UBOUND(SrcMiscData%TempDisp,1) + CALL MeshCopy( SrcMiscData%TempDisp(i1), DstMiscData%TempDisp(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%TempLoads)) THEN + i1_l = LBOUND(SrcMiscData%TempLoads,1) + i1_u = UBOUND(SrcMiscData%TempLoads,1) + IF (.NOT. ALLOCATED(DstMiscData%TempLoads)) THEN + ALLOCATE(DstMiscData%TempLoads(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TempLoads.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%TempLoads,1), UBOUND(SrcMiscData%TempLoads,1) + CALL MeshCopy( SrcMiscData%TempLoads(i1), DstMiscData%TempLoads(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%ADRotorDisk)) THEN + i1_l = LBOUND(SrcMiscData%ADRotorDisk,1) + i1_u = UBOUND(SrcMiscData%ADRotorDisk,1) + IF (.NOT. ALLOCATED(DstMiscData%ADRotorDisk)) THEN + ALLOCATE(DstMiscData%ADRotorDisk(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%ADRotorDisk.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%ADRotorDisk,1), UBOUND(SrcMiscData%ADRotorDisk,1) + CALL MeshCopy( SrcMiscData%ADRotorDisk(i1), DstMiscData%ADRotorDisk(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%AD_L2L)) THEN + i1_l = LBOUND(SrcMiscData%AD_L2L,1) + i1_u = UBOUND(SrcMiscData%AD_L2L,1) + IF (.NOT. ALLOCATED(DstMiscData%AD_L2L)) THEN + ALLOCATE(DstMiscData%AD_L2L(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%AD_L2L.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%AD_L2L,1), UBOUND(SrcMiscData%AD_L2L,1) + CALL NWTC_Library_Copymeshmaptype( SrcMiscData%AD_L2L(i1), DstMiscData%AD_L2L(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE FWrap_CopyMisc + + SUBROUTINE FWrap_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL FAST_Destroyturbinetype( MiscData%Turbine, ErrStat, ErrMsg ) +IF (ALLOCATED(MiscData%TempDisp)) THEN +DO i1 = LBOUND(MiscData%TempDisp,1), UBOUND(MiscData%TempDisp,1) + CALL MeshDestroy( MiscData%TempDisp(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%TempDisp) +ENDIF +IF (ALLOCATED(MiscData%TempLoads)) THEN +DO i1 = LBOUND(MiscData%TempLoads,1), UBOUND(MiscData%TempLoads,1) + CALL MeshDestroy( MiscData%TempLoads(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%TempLoads) +ENDIF +IF (ALLOCATED(MiscData%ADRotorDisk)) THEN +DO i1 = LBOUND(MiscData%ADRotorDisk,1), UBOUND(MiscData%ADRotorDisk,1) + CALL MeshDestroy( MiscData%ADRotorDisk(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%ADRotorDisk) +ENDIF +IF (ALLOCATED(MiscData%AD_L2L)) THEN +DO i1 = LBOUND(MiscData%AD_L2L,1), UBOUND(MiscData%AD_L2L,1) + CALL NWTC_Library_Destroymeshmaptype( MiscData%AD_L2L(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%AD_L2L) +ENDIF + END SUBROUTINE FWrap_DestroyMisc + + SUBROUTINE FWrap_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Turbine: size of buffers for each call to pack subtype + CALL FAST_Packturbinetype( Re_Buf, Db_Buf, Int_Buf, InData%Turbine, ErrStat2, ErrMsg2, .TRUE. ) ! Turbine + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Turbine + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Turbine + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Turbine + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! TempDisp allocated yes/no + IF ( ALLOCATED(InData%TempDisp) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TempDisp upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TempDisp,1), UBOUND(InData%TempDisp,1) + Int_BufSz = Int_BufSz + 3 ! TempDisp: size of buffers for each call to pack subtype + CALL MeshPack( InData%TempDisp(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TempDisp + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! TempDisp + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! TempDisp + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! TempDisp + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TempLoads allocated yes/no + IF ( ALLOCATED(InData%TempLoads) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TempLoads upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TempLoads,1), UBOUND(InData%TempLoads,1) + Int_BufSz = Int_BufSz + 3 ! TempLoads: size of buffers for each call to pack subtype + CALL MeshPack( InData%TempLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TempLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! TempLoads + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! TempLoads + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! TempLoads + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! ADRotorDisk allocated yes/no + IF ( ALLOCATED(InData%ADRotorDisk) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ADRotorDisk upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ADRotorDisk,1), UBOUND(InData%ADRotorDisk,1) + Int_BufSz = Int_BufSz + 3 ! ADRotorDisk: size of buffers for each call to pack subtype + CALL MeshPack( InData%ADRotorDisk(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! ADRotorDisk + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ADRotorDisk + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ADRotorDisk + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ADRotorDisk + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! AD_L2L allocated yes/no + IF ( ALLOCATED(InData%AD_L2L) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AD_L2L upper/lower bounds for each dimension + DO i1 = LBOUND(InData%AD_L2L,1), UBOUND(InData%AD_L2L,1) + Int_BufSz = Int_BufSz + 3 ! AD_L2L: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L2L(i1), ErrStat2, ErrMsg2, .TRUE. ) ! AD_L2L + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AD_L2L + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AD_L2L + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AD_L2L + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL FAST_Packturbinetype( Re_Buf, Db_Buf, Int_Buf, InData%Turbine, ErrStat2, ErrMsg2, OnlySize ) ! Turbine + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%TempDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TempDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TempDisp,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TempDisp,1), UBOUND(InData%TempDisp,1) + CALL MeshPack( InData%TempDisp(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TempDisp + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TempLoads) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TempLoads,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TempLoads,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TempLoads,1), UBOUND(InData%TempLoads,1) + CALL MeshPack( InData%TempLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TempLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%ADRotorDisk) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ADRotorDisk,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ADRotorDisk,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ADRotorDisk,1), UBOUND(InData%ADRotorDisk,1) + CALL MeshPack( InData%ADRotorDisk(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! ADRotorDisk + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%AD_L2L) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AD_L2L,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AD_L2L,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AD_L2L,1), UBOUND(InData%AD_L2L,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L2L(i1), ErrStat2, ErrMsg2, OnlySize ) ! AD_L2L + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE FWrap_PackMisc + + SUBROUTINE FWrap_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FAST_Unpackturbinetype( Re_Buf, Db_Buf, Int_Buf, OutData%Turbine, ErrStat2, ErrMsg2 ) ! Turbine + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TempDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TempDisp)) DEALLOCATE(OutData%TempDisp) + ALLOCATE(OutData%TempDisp(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TempDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TempDisp,1), UBOUND(OutData%TempDisp,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%TempDisp(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TempDisp + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TempLoads not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TempLoads)) DEALLOCATE(OutData%TempLoads) + ALLOCATE(OutData%TempLoads(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TempLoads.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TempLoads,1), UBOUND(OutData%TempLoads,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%TempLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TempLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ADRotorDisk not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ADRotorDisk)) DEALLOCATE(OutData%ADRotorDisk) + ALLOCATE(OutData%ADRotorDisk(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ADRotorDisk.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ADRotorDisk,1), UBOUND(OutData%ADRotorDisk,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%ADRotorDisk(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! ADRotorDisk + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AD_L2L not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AD_L2L)) DEALLOCATE(OutData%AD_L2L) + ALLOCATE(OutData%AD_L2L(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AD_L2L.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AD_L2L,1), UBOUND(OutData%AD_L2L,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_L2L(i1), ErrStat2, ErrMsg2 ) ! AD_L2L + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE FWrap_UnPackMisc + + SUBROUTINE FWrap_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_ParameterType), INTENT(IN) :: SrcParamData + TYPE(FWrap_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%nr = SrcParamData%nr +IF (ALLOCATED(SrcParamData%r)) THEN + i1_l = LBOUND(SrcParamData%r,1) + i1_u = UBOUND(SrcParamData%r,1) + IF (.NOT. ALLOCATED(DstParamData%r)) THEN + ALLOCATE(DstParamData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%r = SrcParamData%r +ENDIF + DstParamData%n_FAST_low = SrcParamData%n_FAST_low + DstParamData%p_ref_Turbine = SrcParamData%p_ref_Turbine + END SUBROUTINE FWrap_CopyParam + + SUBROUTINE FWrap_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(FWrap_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%r)) THEN + DEALLOCATE(ParamData%r) +ENDIF + END SUBROUTINE FWrap_DestroyParam + + SUBROUTINE FWrap_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! nr + Int_BufSz = Int_BufSz + 1 ! r allocated yes/no + IF ( ALLOCATED(InData%r) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! r upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r) ! r + END IF + Int_BufSz = Int_BufSz + 1 ! n_FAST_low + Re_BufSz = Re_BufSz + SIZE(InData%p_ref_Turbine) ! p_ref_Turbine + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = InData%nr + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%r) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%r,1), UBOUND(InData%r,1) + ReKiBuf(Re_Xferred) = InData%r(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%n_FAST_low + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%p_ref_Turbine,1), UBOUND(InData%p_ref_Turbine,1) + ReKiBuf(Re_Xferred) = InData%p_ref_Turbine(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END SUBROUTINE FWrap_PackParam + + SUBROUTINE FWrap_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%nr = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r)) DEALLOCATE(OutData%r) + ALLOCATE(OutData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%r,1), UBOUND(OutData%r,1) + OutData%r(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%n_FAST_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%p_ref_Turbine,1) + i1_u = UBOUND(OutData%p_ref_Turbine,1) + DO i1 = LBOUND(OutData%p_ref_Turbine,1), UBOUND(OutData%p_ref_Turbine,1) + OutData%p_ref_Turbine(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END SUBROUTINE FWrap_UnPackParam + + SUBROUTINE FWrap_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_InputType), INTENT(IN) :: SrcInputData + TYPE(FWrap_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInputData%fromSCglob)) THEN + i1_l = LBOUND(SrcInputData%fromSCglob,1) + i1_u = UBOUND(SrcInputData%fromSCglob,1) + IF (.NOT. ALLOCATED(DstInputData%fromSCglob)) THEN + ALLOCATE(DstInputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%fromSCglob = SrcInputData%fromSCglob +ENDIF +IF (ALLOCATED(SrcInputData%fromSC)) THEN + i1_l = LBOUND(SrcInputData%fromSC,1) + i1_u = UBOUND(SrcInputData%fromSC,1) + IF (.NOT. ALLOCATED(DstInputData%fromSC)) THEN + ALLOCATE(DstInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%fromSC = SrcInputData%fromSC +ENDIF +IF (ALLOCATED(SrcInputData%Vdist_High)) THEN + i1_l = LBOUND(SrcInputData%Vdist_High,1) + i1_u = UBOUND(SrcInputData%Vdist_High,1) + i2_l = LBOUND(SrcInputData%Vdist_High,2) + i2_u = UBOUND(SrcInputData%Vdist_High,2) + i3_l = LBOUND(SrcInputData%Vdist_High,3) + i3_u = UBOUND(SrcInputData%Vdist_High,3) + i4_l = LBOUND(SrcInputData%Vdist_High,4) + i4_u = UBOUND(SrcInputData%Vdist_High,4) + i5_l = LBOUND(SrcInputData%Vdist_High,5) + i5_u = UBOUND(SrcInputData%Vdist_High,5) + IF (.NOT. ALLOCATED(DstInputData%Vdist_High)) THEN + ALLOCATE(DstInputData%Vdist_High(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u,i5_l:i5_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Vdist_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%Vdist_High = SrcInputData%Vdist_High +ENDIF + END SUBROUTINE FWrap_CopyInput + + SUBROUTINE FWrap_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(FWrap_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputData%fromSCglob)) THEN + DEALLOCATE(InputData%fromSCglob) +ENDIF +IF (ALLOCATED(InputData%fromSC)) THEN + DEALLOCATE(InputData%fromSC) +ENDIF +IF (ALLOCATED(InputData%Vdist_High)) THEN + DEALLOCATE(InputData%Vdist_High) +ENDIF + END SUBROUTINE FWrap_DestroyInput + + SUBROUTINE FWrap_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no + IF ( ALLOCATED(InData%fromSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob + END IF + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF + Int_BufSz = Int_BufSz + 1 ! Vdist_High allocated yes/no + IF ( ALLOCATED(InData%Vdist_High) ) THEN + Int_BufSz = Int_BufSz + 2*5 ! Vdist_High upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vdist_High) ! Vdist_High + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%fromSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) + ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vdist_High) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,4) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,5) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,5) + Int_Xferred = Int_Xferred + 2 + + DO i5 = LBOUND(InData%Vdist_High,5), UBOUND(InData%Vdist_High,5) + DO i4 = LBOUND(InData%Vdist_High,4), UBOUND(InData%Vdist_High,4) + DO i3 = LBOUND(InData%Vdist_High,3), UBOUND(InData%Vdist_High,3) + DO i2 = LBOUND(InData%Vdist_High,2), UBOUND(InData%Vdist_High,2) + DO i1 = LBOUND(InData%Vdist_High,1), UBOUND(InData%Vdist_High,1) + ReKiBuf(Re_Xferred) = InData%Vdist_High(i1,i2,i3,i4,i5) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END DO + END IF + END SUBROUTINE FWrap_PackInput + + SUBROUTINE FWrap_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) + ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) + OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vdist_High not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i5_l = IntKiBuf( Int_Xferred ) + i5_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vdist_High)) DEALLOCATE(OutData%Vdist_High) + ALLOCATE(OutData%Vdist_High(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u,i5_l:i5_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vdist_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i5 = LBOUND(OutData%Vdist_High,5), UBOUND(OutData%Vdist_High,5) + DO i4 = LBOUND(OutData%Vdist_High,4), UBOUND(OutData%Vdist_High,4) + DO i3 = LBOUND(OutData%Vdist_High,3), UBOUND(OutData%Vdist_High,3) + DO i2 = LBOUND(OutData%Vdist_High,2), UBOUND(OutData%Vdist_High,2) + DO i1 = LBOUND(OutData%Vdist_High,1), UBOUND(OutData%Vdist_High,1) + OutData%Vdist_High(i1,i2,i3,i4,i5) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END DO + END IF + END SUBROUTINE FWrap_UnPackInput + + SUBROUTINE FWrap_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FWrap_OutputType), INTENT(IN) :: SrcOutputData + TYPE(FWrap_OutputType), INTENT(INOUT) :: DstOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_CopyOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOutputData%toSC)) THEN + i1_l = LBOUND(SrcOutputData%toSC,1) + i1_u = UBOUND(SrcOutputData%toSC,1) + IF (.NOT. ALLOCATED(DstOutputData%toSC)) THEN + ALLOCATE(DstOutputData%toSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%toSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%toSC = SrcOutputData%toSC +ENDIF + DstOutputData%xHat_Disk = SrcOutputData%xHat_Disk + DstOutputData%YawErr = SrcOutputData%YawErr + DstOutputData%p_hub = SrcOutputData%p_hub + DstOutputData%D_rotor = SrcOutputData%D_rotor + DstOutputData%DiskAvg_Vx_Rel = SrcOutputData%DiskAvg_Vx_Rel +IF (ALLOCATED(SrcOutputData%AzimAvg_Ct)) THEN + i1_l = LBOUND(SrcOutputData%AzimAvg_Ct,1) + i1_u = UBOUND(SrcOutputData%AzimAvg_Ct,1) + IF (.NOT. ALLOCATED(DstOutputData%AzimAvg_Ct)) THEN + ALLOCATE(DstOutputData%AzimAvg_Ct(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%AzimAvg_Ct.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%AzimAvg_Ct = SrcOutputData%AzimAvg_Ct +ENDIF + END SUBROUTINE FWrap_CopyOutput + + SUBROUTINE FWrap_DestroyOutput( OutputData, ErrStat, ErrMsg ) + TYPE(FWrap_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_DestroyOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OutputData%toSC)) THEN + DEALLOCATE(OutputData%toSC) +ENDIF +IF (ALLOCATED(OutputData%AzimAvg_Ct)) THEN + DEALLOCATE(OutputData%AzimAvg_Ct) +ENDIF + END SUBROUTINE FWrap_DestroyOutput + + SUBROUTINE FWrap_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FWrap_OutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_PackOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no + IF ( ALLOCATED(InData%toSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC + END IF + Re_BufSz = Re_BufSz + SIZE(InData%xHat_Disk) ! xHat_Disk + Re_BufSz = Re_BufSz + 1 ! YawErr + Re_BufSz = Re_BufSz + SIZE(InData%p_hub) ! p_hub + Re_BufSz = Re_BufSz + 1 ! D_rotor + Re_BufSz = Re_BufSz + 1 ! DiskAvg_Vx_Rel + Int_BufSz = Int_BufSz + 1 ! AzimAvg_Ct allocated yes/no + IF ( ALLOCATED(InData%AzimAvg_Ct) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AzimAvg_Ct upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AzimAvg_Ct) ! AzimAvg_Ct + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%toSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%toSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%toSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%toSC,1), UBOUND(InData%toSC,1) + ReKiBuf(Re_Xferred) = InData%toSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + DO i1 = LBOUND(InData%xHat_Disk,1), UBOUND(InData%xHat_Disk,1) + ReKiBuf(Re_Xferred) = InData%xHat_Disk(i1) + Re_Xferred = Re_Xferred + 1 + END DO + ReKiBuf(Re_Xferred) = InData%YawErr + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%p_hub,1), UBOUND(InData%p_hub,1) + ReKiBuf(Re_Xferred) = InData%p_hub(i1) + Re_Xferred = Re_Xferred + 1 + END DO + ReKiBuf(Re_Xferred) = InData%D_rotor + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%DiskAvg_Vx_Rel + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%AzimAvg_Ct) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AzimAvg_Ct,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AzimAvg_Ct,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AzimAvg_Ct,1), UBOUND(InData%AzimAvg_Ct,1) + ReKiBuf(Re_Xferred) = InData%AzimAvg_Ct(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE FWrap_PackOutput + + SUBROUTINE FWrap_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FWrap_OutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FWrap_UnPackOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%toSC)) DEALLOCATE(OutData%toSC) + ALLOCATE(OutData%toSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%toSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%toSC,1), UBOUND(OutData%toSC,1) + OutData%toSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + i1_l = LBOUND(OutData%xHat_Disk,1) + i1_u = UBOUND(OutData%xHat_Disk,1) + DO i1 = LBOUND(OutData%xHat_Disk,1), UBOUND(OutData%xHat_Disk,1) + OutData%xHat_Disk(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%YawErr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%p_hub,1) + i1_u = UBOUND(OutData%p_hub,1) + DO i1 = LBOUND(OutData%p_hub,1), UBOUND(OutData%p_hub,1) + OutData%p_hub(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%D_rotor = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%DiskAvg_Vx_Rel = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AzimAvg_Ct not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AzimAvg_Ct)) DEALLOCATE(OutData%AzimAvg_Ct) + ALLOCATE(OutData%AzimAvg_Ct(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AzimAvg_Ct.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AzimAvg_Ct,1), UBOUND(OutData%AzimAvg_Ct,1) + OutData%AzimAvg_Ct(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE FWrap_UnPackOutput + +END MODULE FASTWrapper_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/glue-codes/fast-farm/src/FAST_Farm.f90 b/glue-codes/fast-farm/src/FAST_Farm.f90 new file mode 100644 index 0000000000..bbc9ad94bd --- /dev/null +++ b/glue-codes/fast-farm/src/FAST_Farm.f90 @@ -0,0 +1,202 @@ +!********************************************************************************************************************************** +!> ## FAST_Farm +!! The FAST_Farm, FAST_Farm_Subs, and FAST_Farm_Types modules make up a driver for the multi-turbine FAST.Farm code. +!! FAST_Farms_Types will be auto-generated by the FAST registry program, based on the variables specified in the +!! FAST_Farm_Registry.txt file. +!! +! .................................................................................................................................. +!! ## LICENSING +!! Copyright (C) 2017 Bonnie Jonkman, independent contributor +!! Copyright (C) 2017 National Renewable Energy Laboratory +!! +!! This file is part of FAST_Farm. +!! +!! Licensed under the Apache License, Version 2.0 (the "License"); +!! you may not use this file except in compliance with the License. +!! You may obtain a copy of the License at +!! +!! http://www.apache.org/licenses/LICENSE-2.0 +!! +!! Unless required by applicable law or agreed to in writing, software +!! distributed under the License is distributed on an "AS IS" BASIS, +!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +!! See the License for the specific language governing permissions and +!! limitations under the License. +!********************************************************************************************************************************** +PROGRAM FAST_Farm + + USE FAST_Farm_Subs + + IMPLICIT NONE + + ! Local parameters: + + ! Other/Misc variables +INTEGER(IntKi) :: i_turb ! current turbine number +INTEGER(IntKi) :: n_t_global ! simulation time step, loop counter for global simulation +INTEGER(IntKi) :: ErrStat ! Error status +CHARACTER(ErrMsgLen) :: ErrMsg ! Error message +real(dbki) :: t ! current time + + ! data for restart: +CHARACTER(1024) :: InputFileName ! Rootname of the checkpoint file +CHARACTER(1024) :: CheckpointRoot ! Rootname of the checkpoint file +CHARACTER(20) :: FlagArg ! flag argument from command line +INTEGER(IntKi) :: Restart_step ! step to start on (for restart) + + ! data for SimStatus/RunTimes: +REAL(DbKi) :: PrevSimTime !< Previous time message was written to screen (s > 0) +REAL(ReKi) :: PrevClockTime !< Previous clock time in seconds past midnight +INTEGER :: SimStrtTime (8) !< An array containing the elements of the start time (after initialization). +INTEGER :: ProgStrtTime (8) !< An array containing the elements of the program start time (before initialization). +REAL(ReKi) :: SimStrtCPU !< User CPU time for simulation (without intialization) +REAL(ReKi) :: ProgStrtCPU !< User CPU time for program (with intialization) + +! these should probably go in the FAST.Farm registry: +type(All_FastFarm_Data) :: farm + +!FAST.Farm Driver +! Initialization +! Initial Calculate Output +! Time Increment: +! Update States +! Calculate Output +! End + + + ! Init NWTC_Library, display copyright and version information: + CALL NWTC_Init() ! open console for writing + ProgName = Farm_Ver%Name + + CALL DATE_AND_TIME ( Values=ProgStrtTime ) ! Let's time the whole simulation + CALL CPU_TIME ( ProgStrtCPU ) ! Initial time (this zeros the start time when used as a MATLAB function) + + farm%p%NumTurbines = 0 + t = 0 + + InputFileName = "" ! make sure we don't think this is a "default" inputFileName if not specified on command line + CALL CheckArgs( InputFileName, ErrStat=ErrStat, Flag=FlagArg ) + + if (ErrStat/=0) then + call ProgAbort('', TrapErrors=.FALSE., TimeWait=3._ReKi ) + else if ( len( trim(FlagArg) ) > 0 ) then ! Any other flag (-v,-h) end normally + call NormStop() + endif + + CALL FAST_ProgStart( Farm_Ver ) ! put this after CheckArgs because CheckArgs assumes we haven't called this routine, yet. + + IF ( TRIM(FlagArg) == 'RESTART' ) THEN ! Restart from checkpoint file + CheckpointRoot = InputFileName + ! CALL FAST_RestoreFromCheckpoint_Tary(t_initial, Restart_step, Turbine, CheckpointRoot, ErrStat, ErrMsg ) + ! CALL CheckError( ErrStat, ErrMsg, 'during restore from checkpoint' ) + ! + ELSE + Restart_step = 0 + + !............................................................................................................................... + ! Initialization + !............................................................................................................................... + + call Farm_Initialize( farm, InputFileName, ErrStat, ErrMsg ) + CALL CheckError( ErrStat, ErrMsg, 'during driver initialization' ) + + !............................................................................................................................... + ! Initial Calculate Output + !............................................................................................................................... + + CALL SimStatus_FirstTime( PrevSimTime, PrevClockTime, SimStrtTime, SimStrtCPU, t, farm%p%TMax ) + + call FARM_InitialCO(farm, ErrStat, ErrMsg) + CALL CheckError( ErrStat, ErrMsg, 'during initial calculate output' ) + + END IF + + + + !............................................................................................................................... + ! Time Increment: + !............................................................................................................................... + + DO n_t_global = Restart_step, farm%p%n_TMax - 2 + + ! ! write checkpoint file if requested + ! IF (mod(n_t_global, Turbine(1)%p_FAST%n_ChkptTime) == 0 .AND. Restart_step /= n_t_global) then + ! CheckpointRoot = TRIM(Turbine(1)%p_FAST%OutFileRoot)//'.'//TRIM(Num2LStr(n_t_global)) + ! + ! CALL FAST_CreateCheckpoint_Tary(t_initial, n_t_global, Turbine, CheckpointRoot, ErrStat, ErrMsg) + ! IF(ErrStat >= AbortErrLev .and. AbortErrLev >= ErrID_Severe) THEN + ! ErrStat = MIN(ErrStat,ErrID_Severe) ! We don't need to stop simulation execution on this error + ! ErrMsg = TRIM(ErrMsg)//Newline//'WARNING: Checkpoint file could not be generated. Simulation continuing.' + ! END IF + ! CALL CheckError( ErrStat, ErrMsg ) + ! END IF + ! + ! + ! this takes data from n_t_global and gets values at n_t_global + 1 + t = n_t_global*farm%p%DT_low + + + CALL FARM_UpdateStates(t, n_t_global, farm, ErrStat, ErrMsg) + + CALL CheckError( ErrStat, ErrMsg ) + + t = (n_t_global+1)*farm%p%DT_low + + + CALL FARM_CalcOutput(t, farm, ErrStat, ErrMsg) + + CALL CheckError( ErrStat, ErrMsg ) + + CALL SimStatus( PrevSimTime, PrevClockTime, t, farm%p%TMax ) + + END DO ! n_t_global + + + !............................................................................................................................... + ! End: + !............................................................................................................................... + + call FARM_End(farm, ErrStat, ErrMsg) + + CALL RunTimes( ProgStrtTime, ProgStrtCPU, SimStrtTime, SimStrtCPU, t ) + call NormStop() + +CONTAINS + !............................................................................................................................... + SUBROUTINE CheckError(ErrID,Msg,ErrLocMsg) + ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev + !............................................................................................................................... + + ! Passed arguments + INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) + CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) + CHARACTER(*), INTENT(IN), OPTIONAL :: ErrLocMsg ! an optional message describing the location of the error + + CHARACTER(1024) :: SimMsg + + INTEGER(IntKi) :: ErrStat2 ! Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message + + + IF ( ErrID /= ErrID_None ) THEN + CALL WrScr( NewLine//TRIM(Msg)//NewLine ) + IF ( ErrID >= AbortErrLev ) THEN + + IF (PRESENT(ErrLocMsg)) THEN + SimMsg = ErrLocMsg + ELSE + ! make sure farm%FWrap() is allocated! + SimMsg = 'at simulation time '//TRIM(Num2LStr(farm%FWrap(1)%m%Turbine%m_FAST%t_global))//' of '//TRIM(Num2LStr(farm%FWrap(1)%m%Turbine%p_FAST%TMax))//' seconds' + END IF + + call FARM_End(farm, ErrStat2, ErrMsg2) + call ProgAbort('', TrapErrors=.FALSE., TimeWait=3._ReKi ) + + END IF + + END IF + + + END SUBROUTINE CheckError +END PROGRAM FAST_Farm +!********************************************************************************************************************************** diff --git a/glue-codes/fast-farm/src/FAST_Farm_IO.f90 b/glue-codes/fast-farm/src/FAST_Farm_IO.f90 new file mode 100644 index 0000000000..0b43a73043 --- /dev/null +++ b/glue-codes/fast-farm/src/FAST_Farm_IO.f90 @@ -0,0 +1,15125 @@ +module FAST_Farm_IO + +USE NWTC_Library +USE FAST_Farm_Types + +IMPLICIT NONE + ! The maximum number of output channels which can be output by the code. +INTEGER(IntKi), PARAMETER :: Farm_MaxOutPts = 9423 +TYPE(ProgDesc), PARAMETER :: Farm_Ver = ProgDesc( 'FAST.Farm', 'v0.01.02a-jmj', '04-Jul-2017' ) !< module date/version information +! =================================================================================================== +! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" +! using the parameters listed in the "OutListParameters3.xlsx" Excel file. Any changes to these +! lines should be modified in the Matlab script and/or Excel worksheet as necessary. +! =================================================================================================== +! This code was generated by Write_ChckOutLst.m at 13-Mar-2017 10:34:09. + + + ! Parameters related to output length (number of characters allowed in the output data headers): + + INTEGER(IntKi), PARAMETER :: Farm_OutStrLenM1 = ChanLen - 1 + + + ! Indices for computing output channels: + ! NOTES: + ! (1) These parameters are in the order stored in "OutListParameters.xlsx" + ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter + + ! Time: + + INTEGER(IntKi), PARAMETER :: Farm_Time_Indx = 0 + + + ! Global Super Controller Input: + + INTEGER(IntKi), PARAMETER :: SCGblIn1 = 1 + INTEGER(IntKi), PARAMETER :: SCGblIn2 = 2 + INTEGER(IntKi), PARAMETER :: SCGblIn3 = 3 + INTEGER(IntKi), PARAMETER :: SCGblIn4 = 4 + INTEGER(IntKi), PARAMETER :: SCGblIn5 = 5 + INTEGER(IntKi), PARAMETER :: SCGblIn6 = 6 + INTEGER(IntKi), PARAMETER :: SCGblIn7 = 7 + INTEGER(IntKi), PARAMETER :: SCGblIn8 = 8 + INTEGER(IntKi), PARAMETER :: SCGblIn9 = 9 + + + ! Turbine-dependent Super Controller Input: + + INTEGER(IntKi), PARAMETER :: SCT1In1 = 10 + INTEGER(IntKi), PARAMETER :: SCT1In2 = 11 + INTEGER(IntKi), PARAMETER :: SCT1In3 = 12 + INTEGER(IntKi), PARAMETER :: SCT1In4 = 13 + INTEGER(IntKi), PARAMETER :: SCT1In5 = 14 + INTEGER(IntKi), PARAMETER :: SCT1In6 = 15 + INTEGER(IntKi), PARAMETER :: SCT1In7 = 16 + INTEGER(IntKi), PARAMETER :: SCT1In8 = 17 + INTEGER(IntKi), PARAMETER :: SCT1In9 = 18 + INTEGER(IntKi), PARAMETER :: SCT2In1 = 19 + INTEGER(IntKi), PARAMETER :: SCT2In2 = 20 + INTEGER(IntKi), PARAMETER :: SCT2In3 = 21 + INTEGER(IntKi), PARAMETER :: SCT2In4 = 22 + INTEGER(IntKi), PARAMETER :: SCT2In5 = 23 + INTEGER(IntKi), PARAMETER :: SCT2In6 = 24 + INTEGER(IntKi), PARAMETER :: SCT2In7 = 25 + INTEGER(IntKi), PARAMETER :: SCT2In8 = 26 + INTEGER(IntKi), PARAMETER :: SCT2In9 = 27 + INTEGER(IntKi), PARAMETER :: SCT3In1 = 28 + INTEGER(IntKi), PARAMETER :: SCT3In2 = 29 + INTEGER(IntKi), PARAMETER :: SCT3In3 = 30 + INTEGER(IntKi), PARAMETER :: SCT3In4 = 31 + INTEGER(IntKi), PARAMETER :: SCT3In5 = 32 + INTEGER(IntKi), PARAMETER :: SCT3In6 = 33 + INTEGER(IntKi), PARAMETER :: SCT3In7 = 34 + INTEGER(IntKi), PARAMETER :: SCT3In8 = 35 + INTEGER(IntKi), PARAMETER :: SCT3In9 = 36 + INTEGER(IntKi), PARAMETER :: SCT4In1 = 37 + INTEGER(IntKi), PARAMETER :: SCT4In2 = 38 + INTEGER(IntKi), PARAMETER :: SCT4In3 = 39 + INTEGER(IntKi), PARAMETER :: SCT4In4 = 40 + INTEGER(IntKi), PARAMETER :: SCT4In5 = 41 + INTEGER(IntKi), PARAMETER :: SCT4In6 = 42 + INTEGER(IntKi), PARAMETER :: SCT4In7 = 43 + INTEGER(IntKi), PARAMETER :: SCT4In8 = 44 + INTEGER(IntKi), PARAMETER :: SCT4In9 = 45 + INTEGER(IntKi), PARAMETER :: SCT5In1 = 46 + INTEGER(IntKi), PARAMETER :: SCT5In2 = 47 + INTEGER(IntKi), PARAMETER :: SCT5In3 = 48 + INTEGER(IntKi), PARAMETER :: SCT5In4 = 49 + INTEGER(IntKi), PARAMETER :: SCT5In5 = 50 + INTEGER(IntKi), PARAMETER :: SCT5In6 = 51 + INTEGER(IntKi), PARAMETER :: SCT5In7 = 52 + INTEGER(IntKi), PARAMETER :: SCT5In8 = 53 + INTEGER(IntKi), PARAMETER :: SCT5In9 = 54 + INTEGER(IntKi), PARAMETER :: SCT6In1 = 55 + INTEGER(IntKi), PARAMETER :: SCT6In2 = 56 + INTEGER(IntKi), PARAMETER :: SCT6In3 = 57 + INTEGER(IntKi), PARAMETER :: SCT6In4 = 58 + INTEGER(IntKi), PARAMETER :: SCT6In5 = 59 + INTEGER(IntKi), PARAMETER :: SCT6In6 = 60 + INTEGER(IntKi), PARAMETER :: SCT6In7 = 61 + INTEGER(IntKi), PARAMETER :: SCT6In8 = 62 + INTEGER(IntKi), PARAMETER :: SCT6In9 = 63 + INTEGER(IntKi), PARAMETER :: SCT7In1 = 64 + INTEGER(IntKi), PARAMETER :: SCT7In2 = 65 + INTEGER(IntKi), PARAMETER :: SCT7In3 = 66 + INTEGER(IntKi), PARAMETER :: SCT7In4 = 67 + INTEGER(IntKi), PARAMETER :: SCT7In5 = 68 + INTEGER(IntKi), PARAMETER :: SCT7In6 = 69 + INTEGER(IntKi), PARAMETER :: SCT7In7 = 70 + INTEGER(IntKi), PARAMETER :: SCT7In8 = 71 + INTEGER(IntKi), PARAMETER :: SCT7In9 = 72 + INTEGER(IntKi), PARAMETER :: SCT8In1 = 73 + INTEGER(IntKi), PARAMETER :: SCT8In2 = 74 + INTEGER(IntKi), PARAMETER :: SCT8In3 = 75 + INTEGER(IntKi), PARAMETER :: SCT8In4 = 76 + INTEGER(IntKi), PARAMETER :: SCT8In5 = 77 + INTEGER(IntKi), PARAMETER :: SCT8In6 = 78 + INTEGER(IntKi), PARAMETER :: SCT8In7 = 79 + INTEGER(IntKi), PARAMETER :: SCT8In8 = 80 + INTEGER(IntKi), PARAMETER :: SCT8In9 = 81 + INTEGER(IntKi), PARAMETER :: SCT9In1 = 82 + INTEGER(IntKi), PARAMETER :: SCT9In2 = 83 + INTEGER(IntKi), PARAMETER :: SCT9In3 = 84 + INTEGER(IntKi), PARAMETER :: SCT9In4 = 85 + INTEGER(IntKi), PARAMETER :: SCT9In5 = 86 + INTEGER(IntKi), PARAMETER :: SCT9In6 = 87 + INTEGER(IntKi), PARAMETER :: SCT9In7 = 88 + INTEGER(IntKi), PARAMETER :: SCT9In8 = 89 + INTEGER(IntKi), PARAMETER :: SCT9In9 = 90 + + + ! Global Super Controller Output: + + INTEGER(IntKi), PARAMETER :: SCGblOt1 = 91 + INTEGER(IntKi), PARAMETER :: SCGblOt2 = 92 + INTEGER(IntKi), PARAMETER :: SCGblOt3 = 93 + INTEGER(IntKi), PARAMETER :: SCGblOt4 = 94 + INTEGER(IntKi), PARAMETER :: SCGblOt5 = 95 + INTEGER(IntKi), PARAMETER :: SCGblOt6 = 96 + INTEGER(IntKi), PARAMETER :: SCGblOt7 = 97 + INTEGER(IntKi), PARAMETER :: SCGblOt8 = 98 + INTEGER(IntKi), PARAMETER :: SCGblOt9 = 99 + + + ! Turbine-dependent Super Controller Output: + + INTEGER(IntKi), PARAMETER :: SCT1Ot1 = 100 + INTEGER(IntKi), PARAMETER :: SCT1Ot2 = 101 + INTEGER(IntKi), PARAMETER :: SCT1Ot3 = 102 + INTEGER(IntKi), PARAMETER :: SCT1Ot4 = 103 + INTEGER(IntKi), PARAMETER :: SCT1Ot5 = 104 + INTEGER(IntKi), PARAMETER :: SCT1Ot6 = 105 + INTEGER(IntKi), PARAMETER :: SCT1Ot7 = 106 + INTEGER(IntKi), PARAMETER :: SCT1Ot8 = 107 + INTEGER(IntKi), PARAMETER :: SCT1Ot9 = 108 + INTEGER(IntKi), PARAMETER :: SCT2Ot1 = 109 + INTEGER(IntKi), PARAMETER :: SCT2Ot2 = 110 + INTEGER(IntKi), PARAMETER :: SCT2Ot3 = 111 + INTEGER(IntKi), PARAMETER :: SCT2Ot4 = 112 + INTEGER(IntKi), PARAMETER :: SCT2Ot5 = 113 + INTEGER(IntKi), PARAMETER :: SCT2Ot6 = 114 + INTEGER(IntKi), PARAMETER :: SCT2Ot7 = 115 + INTEGER(IntKi), PARAMETER :: SCT2Ot8 = 116 + INTEGER(IntKi), PARAMETER :: SCT2Ot9 = 117 + INTEGER(IntKi), PARAMETER :: SCT3Ot1 = 118 + INTEGER(IntKi), PARAMETER :: SCT3Ot2 = 119 + INTEGER(IntKi), PARAMETER :: SCT3Ot3 = 120 + INTEGER(IntKi), PARAMETER :: SCT3Ot4 = 121 + INTEGER(IntKi), PARAMETER :: SCT3Ot5 = 122 + INTEGER(IntKi), PARAMETER :: SCT3Ot6 = 123 + INTEGER(IntKi), PARAMETER :: SCT3Ot7 = 124 + INTEGER(IntKi), PARAMETER :: SCT3Ot8 = 125 + INTEGER(IntKi), PARAMETER :: SCT3Ot9 = 126 + INTEGER(IntKi), PARAMETER :: SCT4Ot1 = 127 + INTEGER(IntKi), PARAMETER :: SCT4Ot2 = 128 + INTEGER(IntKi), PARAMETER :: SCT4Ot3 = 129 + INTEGER(IntKi), PARAMETER :: SCT4Ot4 = 130 + INTEGER(IntKi), PARAMETER :: SCT4Ot5 = 131 + INTEGER(IntKi), PARAMETER :: SCT4Ot6 = 132 + INTEGER(IntKi), PARAMETER :: SCT4Ot7 = 133 + INTEGER(IntKi), PARAMETER :: SCT4Ot8 = 134 + INTEGER(IntKi), PARAMETER :: SCT4Ot9 = 135 + INTEGER(IntKi), PARAMETER :: SCT5Ot1 = 136 + INTEGER(IntKi), PARAMETER :: SCT5Ot2 = 137 + INTEGER(IntKi), PARAMETER :: SCT5Ot3 = 138 + INTEGER(IntKi), PARAMETER :: SCT5Ot4 = 139 + INTEGER(IntKi), PARAMETER :: SCT5Ot5 = 140 + INTEGER(IntKi), PARAMETER :: SCT5Ot6 = 141 + INTEGER(IntKi), PARAMETER :: SCT5Ot7 = 142 + INTEGER(IntKi), PARAMETER :: SCT5Ot8 = 143 + INTEGER(IntKi), PARAMETER :: SCT5Ot9 = 144 + INTEGER(IntKi), PARAMETER :: SCT6Ot1 = 145 + INTEGER(IntKi), PARAMETER :: SCT6Ot2 = 146 + INTEGER(IntKi), PARAMETER :: SCT6Ot3 = 147 + INTEGER(IntKi), PARAMETER :: SCT6Ot4 = 148 + INTEGER(IntKi), PARAMETER :: SCT6Ot5 = 149 + INTEGER(IntKi), PARAMETER :: SCT6Ot6 = 150 + INTEGER(IntKi), PARAMETER :: SCT6Ot7 = 151 + INTEGER(IntKi), PARAMETER :: SCT6Ot8 = 152 + INTEGER(IntKi), PARAMETER :: SCT6Ot9 = 153 + INTEGER(IntKi), PARAMETER :: SCT7Ot1 = 154 + INTEGER(IntKi), PARAMETER :: SCT7Ot2 = 155 + INTEGER(IntKi), PARAMETER :: SCT7Ot3 = 156 + INTEGER(IntKi), PARAMETER :: SCT7Ot4 = 157 + INTEGER(IntKi), PARAMETER :: SCT7Ot5 = 158 + INTEGER(IntKi), PARAMETER :: SCT7Ot6 = 159 + INTEGER(IntKi), PARAMETER :: SCT7Ot7 = 160 + INTEGER(IntKi), PARAMETER :: SCT7Ot8 = 161 + INTEGER(IntKi), PARAMETER :: SCT7Ot9 = 162 + INTEGER(IntKi), PARAMETER :: SCT8Ot1 = 163 + INTEGER(IntKi), PARAMETER :: SCT8Ot2 = 164 + INTEGER(IntKi), PARAMETER :: SCT8Ot3 = 165 + INTEGER(IntKi), PARAMETER :: SCT8Ot4 = 166 + INTEGER(IntKi), PARAMETER :: SCT8Ot5 = 167 + INTEGER(IntKi), PARAMETER :: SCT8Ot6 = 168 + INTEGER(IntKi), PARAMETER :: SCT8Ot7 = 169 + INTEGER(IntKi), PARAMETER :: SCT8Ot8 = 170 + INTEGER(IntKi), PARAMETER :: SCT8Ot9 = 171 + INTEGER(IntKi), PARAMETER :: SCT9Ot1 = 172 + INTEGER(IntKi), PARAMETER :: SCT9Ot2 = 173 + INTEGER(IntKi), PARAMETER :: SCT9Ot3 = 174 + INTEGER(IntKi), PARAMETER :: SCT9Ot4 = 175 + INTEGER(IntKi), PARAMETER :: SCT9Ot5 = 176 + INTEGER(IntKi), PARAMETER :: SCT9Ot6 = 177 + INTEGER(IntKi), PARAMETER :: SCT9Ot7 = 178 + INTEGER(IntKi), PARAMETER :: SCT9Ot8 = 179 + INTEGER(IntKi), PARAMETER :: SCT9Ot9 = 180 + + + ! Rotor Centerline Orientation: + + INTEGER(IntKi), PARAMETER :: RtAxsXT1 = 181 + INTEGER(IntKi), PARAMETER :: RtAxsXT2 = 182 + INTEGER(IntKi), PARAMETER :: RtAxsXT3 = 183 + INTEGER(IntKi), PARAMETER :: RtAxsXT4 = 184 + INTEGER(IntKi), PARAMETER :: RtAxsXT5 = 185 + INTEGER(IntKi), PARAMETER :: RtAxsXT6 = 186 + INTEGER(IntKi), PARAMETER :: RtAxsXT7 = 187 + INTEGER(IntKi), PARAMETER :: RtAxsXT8 = 188 + INTEGER(IntKi), PARAMETER :: RtAxsXT9 = 189 + INTEGER(IntKi), PARAMETER :: RtAxsYT1 = 190 + INTEGER(IntKi), PARAMETER :: RtAxsYT2 = 191 + INTEGER(IntKi), PARAMETER :: RtAxsYT3 = 192 + INTEGER(IntKi), PARAMETER :: RtAxsYT4 = 193 + INTEGER(IntKi), PARAMETER :: RtAxsYT5 = 194 + INTEGER(IntKi), PARAMETER :: RtAxsYT6 = 195 + INTEGER(IntKi), PARAMETER :: RtAxsYT7 = 196 + INTEGER(IntKi), PARAMETER :: RtAxsYT8 = 197 + INTEGER(IntKi), PARAMETER :: RtAxsYT9 = 198 + INTEGER(IntKi), PARAMETER :: RtAxsZT1 = 199 + INTEGER(IntKi), PARAMETER :: RtAxsZT2 = 200 + INTEGER(IntKi), PARAMETER :: RtAxsZT3 = 201 + INTEGER(IntKi), PARAMETER :: RtAxsZT4 = 202 + INTEGER(IntKi), PARAMETER :: RtAxsZT5 = 203 + INTEGER(IntKi), PARAMETER :: RtAxsZT6 = 204 + INTEGER(IntKi), PARAMETER :: RtAxsZT7 = 205 + INTEGER(IntKi), PARAMETER :: RtAxsZT8 = 206 + INTEGER(IntKi), PARAMETER :: RtAxsZT9 = 207 + + + ! Position of the Rotor (Hub) Center: + + INTEGER(IntKi), PARAMETER :: RtPosXT1 = 208 + INTEGER(IntKi), PARAMETER :: RtPosXT2 = 209 + INTEGER(IntKi), PARAMETER :: RtPosXT3 = 210 + INTEGER(IntKi), PARAMETER :: RtPosXT4 = 211 + INTEGER(IntKi), PARAMETER :: RtPosXT5 = 212 + INTEGER(IntKi), PARAMETER :: RtPosXT6 = 213 + INTEGER(IntKi), PARAMETER :: RtPosXT7 = 214 + INTEGER(IntKi), PARAMETER :: RtPosXT8 = 215 + INTEGER(IntKi), PARAMETER :: RtPosXT9 = 216 + INTEGER(IntKi), PARAMETER :: RtPosYT1 = 217 + INTEGER(IntKi), PARAMETER :: RtPosYT2 = 218 + INTEGER(IntKi), PARAMETER :: RtPosYT3 = 219 + INTEGER(IntKi), PARAMETER :: RtPosYT4 = 220 + INTEGER(IntKi), PARAMETER :: RtPosYT5 = 221 + INTEGER(IntKi), PARAMETER :: RtPosYT6 = 222 + INTEGER(IntKi), PARAMETER :: RtPosYT7 = 223 + INTEGER(IntKi), PARAMETER :: RtPosYT8 = 224 + INTEGER(IntKi), PARAMETER :: RtPosYT9 = 225 + INTEGER(IntKi), PARAMETER :: RtPosZT1 = 226 + INTEGER(IntKi), PARAMETER :: RtPosZT2 = 227 + INTEGER(IntKi), PARAMETER :: RtPosZT3 = 228 + INTEGER(IntKi), PARAMETER :: RtPosZT4 = 229 + INTEGER(IntKi), PARAMETER :: RtPosZT5 = 230 + INTEGER(IntKi), PARAMETER :: RtPosZT6 = 231 + INTEGER(IntKi), PARAMETER :: RtPosZT7 = 232 + INTEGER(IntKi), PARAMETER :: RtPosZT8 = 233 + INTEGER(IntKi), PARAMETER :: RtPosZT9 = 234 + + + ! Rotor Diamete: + + INTEGER(IntKi), PARAMETER :: RtDiamT1 = 235 + INTEGER(IntKi), PARAMETER :: RtDiamT2 = 236 + INTEGER(IntKi), PARAMETER :: RtDiamT3 = 237 + INTEGER(IntKi), PARAMETER :: RtDiamT4 = 238 + INTEGER(IntKi), PARAMETER :: RtDiamT5 = 239 + INTEGER(IntKi), PARAMETER :: RtDiamT6 = 240 + INTEGER(IntKi), PARAMETER :: RtDiamT7 = 241 + INTEGER(IntKi), PARAMETER :: RtDiamT8 = 242 + INTEGER(IntKi), PARAMETER :: RtDiamT9 = 243 + + + ! Nacelle-Yaw Error: + + INTEGER(IntKi), PARAMETER :: YawErrT1 = 244 + INTEGER(IntKi), PARAMETER :: YawErrT2 = 245 + INTEGER(IntKi), PARAMETER :: YawErrT3 = 246 + INTEGER(IntKi), PARAMETER :: YawErrT4 = 247 + INTEGER(IntKi), PARAMETER :: YawErrT5 = 248 + INTEGER(IntKi), PARAMETER :: YawErrT6 = 249 + INTEGER(IntKi), PARAMETER :: YawErrT7 = 250 + INTEGER(IntKi), PARAMETER :: YawErrT8 = 251 + INTEGER(IntKi), PARAMETER :: YawErrT9 = 252 + + + ! Ambient Turbulence Intensity of the Wind at the Rotor Disk: + + INTEGER(IntKi), PARAMETER :: TIAmbT1 = 253 + INTEGER(IntKi), PARAMETER :: TIAmbT2 = 254 + INTEGER(IntKi), PARAMETER :: TIAmbT3 = 255 + INTEGER(IntKi), PARAMETER :: TIAmbT4 = 256 + INTEGER(IntKi), PARAMETER :: TIAmbT5 = 257 + INTEGER(IntKi), PARAMETER :: TIAmbT6 = 258 + INTEGER(IntKi), PARAMETER :: TIAmbT7 = 259 + INTEGER(IntKi), PARAMETER :: TIAmbT8 = 260 + INTEGER(IntKi), PARAMETER :: TIAmbT9 = 261 + + + ! Rotor-Disk-Averaged Ambient Wind Speed: + + INTEGER(IntKi), PARAMETER :: RtVAmbT1 = 262 + INTEGER(IntKi), PARAMETER :: RtVAmbT2 = 263 + INTEGER(IntKi), PARAMETER :: RtVAmbT3 = 264 + INTEGER(IntKi), PARAMETER :: RtVAmbT4 = 265 + INTEGER(IntKi), PARAMETER :: RtVAmbT5 = 266 + INTEGER(IntKi), PARAMETER :: RtVAmbT6 = 267 + INTEGER(IntKi), PARAMETER :: RtVAmbT7 = 268 + INTEGER(IntKi), PARAMETER :: RtVAmbT8 = 269 + INTEGER(IntKi), PARAMETER :: RtVAmbT9 = 270 + + + ! Rotor-Disk-Averaged Relative Wind Speed: + + INTEGER(IntKi), PARAMETER :: RtVRelT1 = 271 + INTEGER(IntKi), PARAMETER :: RtVRelT2 = 272 + INTEGER(IntKi), PARAMETER :: RtVRelT3 = 273 + INTEGER(IntKi), PARAMETER :: RtVRelT4 = 274 + INTEGER(IntKi), PARAMETER :: RtVRelT5 = 275 + INTEGER(IntKi), PARAMETER :: RtVRelT6 = 276 + INTEGER(IntKi), PARAMETER :: RtVRelT7 = 277 + INTEGER(IntKi), PARAMETER :: RtVRelT8 = 278 + INTEGER(IntKi), PARAMETER :: RtVRelT9 = 279 + + + ! Azimuthally Averaged Thrust Force Coefficient: + + INTEGER(IntKi), PARAMETER :: CtT1N01 = 280 + INTEGER(IntKi), PARAMETER :: CtT1N02 = 281 + INTEGER(IntKi), PARAMETER :: CtT1N03 = 282 + INTEGER(IntKi), PARAMETER :: CtT1N04 = 283 + INTEGER(IntKi), PARAMETER :: CtT1N05 = 284 + INTEGER(IntKi), PARAMETER :: CtT1N06 = 285 + INTEGER(IntKi), PARAMETER :: CtT1N07 = 286 + INTEGER(IntKi), PARAMETER :: CtT1N08 = 287 + INTEGER(IntKi), PARAMETER :: CtT1N09 = 288 + INTEGER(IntKi), PARAMETER :: CtT1N10 = 289 + INTEGER(IntKi), PARAMETER :: CtT1N11 = 290 + INTEGER(IntKi), PARAMETER :: CtT1N12 = 291 + INTEGER(IntKi), PARAMETER :: CtT1N13 = 292 + INTEGER(IntKi), PARAMETER :: CtT1N14 = 293 + INTEGER(IntKi), PARAMETER :: CtT1N15 = 294 + INTEGER(IntKi), PARAMETER :: CtT1N16 = 295 + INTEGER(IntKi), PARAMETER :: CtT1N17 = 296 + INTEGER(IntKi), PARAMETER :: CtT1N18 = 297 + INTEGER(IntKi), PARAMETER :: CtT1N19 = 298 + INTEGER(IntKi), PARAMETER :: CtT1N20 = 299 + INTEGER(IntKi), PARAMETER :: CtT2N01 = 300 + INTEGER(IntKi), PARAMETER :: CtT2N02 = 301 + INTEGER(IntKi), PARAMETER :: CtT2N03 = 302 + INTEGER(IntKi), PARAMETER :: CtT2N04 = 303 + INTEGER(IntKi), PARAMETER :: CtT2N05 = 304 + INTEGER(IntKi), PARAMETER :: CtT2N06 = 305 + INTEGER(IntKi), PARAMETER :: CtT2N07 = 306 + INTEGER(IntKi), PARAMETER :: CtT2N08 = 307 + INTEGER(IntKi), PARAMETER :: CtT2N09 = 308 + INTEGER(IntKi), PARAMETER :: CtT2N10 = 309 + INTEGER(IntKi), PARAMETER :: CtT2N11 = 310 + INTEGER(IntKi), PARAMETER :: CtT2N12 = 311 + INTEGER(IntKi), PARAMETER :: CtT2N13 = 312 + INTEGER(IntKi), PARAMETER :: CtT2N14 = 313 + INTEGER(IntKi), PARAMETER :: CtT2N15 = 314 + INTEGER(IntKi), PARAMETER :: CtT2N16 = 315 + INTEGER(IntKi), PARAMETER :: CtT2N17 = 316 + INTEGER(IntKi), PARAMETER :: CtT2N18 = 317 + INTEGER(IntKi), PARAMETER :: CtT2N19 = 318 + INTEGER(IntKi), PARAMETER :: CtT2N20 = 319 + INTEGER(IntKi), PARAMETER :: CtT3N01 = 320 + INTEGER(IntKi), PARAMETER :: CtT3N02 = 321 + INTEGER(IntKi), PARAMETER :: CtT3N03 = 322 + INTEGER(IntKi), PARAMETER :: CtT3N04 = 323 + INTEGER(IntKi), PARAMETER :: CtT3N05 = 324 + INTEGER(IntKi), PARAMETER :: CtT3N06 = 325 + INTEGER(IntKi), PARAMETER :: CtT3N07 = 326 + INTEGER(IntKi), PARAMETER :: CtT3N08 = 327 + INTEGER(IntKi), PARAMETER :: CtT3N09 = 328 + INTEGER(IntKi), PARAMETER :: CtT3N10 = 329 + INTEGER(IntKi), PARAMETER :: CtT3N11 = 330 + INTEGER(IntKi), PARAMETER :: CtT3N12 = 331 + INTEGER(IntKi), PARAMETER :: CtT3N13 = 332 + INTEGER(IntKi), PARAMETER :: CtT3N14 = 333 + INTEGER(IntKi), PARAMETER :: CtT3N15 = 334 + INTEGER(IntKi), PARAMETER :: CtT3N16 = 335 + INTEGER(IntKi), PARAMETER :: CtT3N17 = 336 + INTEGER(IntKi), PARAMETER :: CtT3N18 = 337 + INTEGER(IntKi), PARAMETER :: CtT3N19 = 338 + INTEGER(IntKi), PARAMETER :: CtT3N20 = 339 + INTEGER(IntKi), PARAMETER :: CtT4N01 = 340 + INTEGER(IntKi), PARAMETER :: CtT4N02 = 341 + INTEGER(IntKi), PARAMETER :: CtT4N03 = 342 + INTEGER(IntKi), PARAMETER :: CtT4N04 = 343 + INTEGER(IntKi), PARAMETER :: CtT4N05 = 344 + INTEGER(IntKi), PARAMETER :: CtT4N06 = 345 + INTEGER(IntKi), PARAMETER :: CtT4N07 = 346 + INTEGER(IntKi), PARAMETER :: CtT4N08 = 347 + INTEGER(IntKi), PARAMETER :: CtT4N09 = 348 + INTEGER(IntKi), PARAMETER :: CtT4N10 = 349 + INTEGER(IntKi), PARAMETER :: CtT4N11 = 350 + INTEGER(IntKi), PARAMETER :: CtT4N12 = 351 + INTEGER(IntKi), PARAMETER :: CtT4N13 = 352 + INTEGER(IntKi), PARAMETER :: CtT4N14 = 353 + INTEGER(IntKi), PARAMETER :: CtT4N15 = 354 + INTEGER(IntKi), PARAMETER :: CtT4N16 = 355 + INTEGER(IntKi), PARAMETER :: CtT4N17 = 356 + INTEGER(IntKi), PARAMETER :: CtT4N18 = 357 + INTEGER(IntKi), PARAMETER :: CtT4N19 = 358 + INTEGER(IntKi), PARAMETER :: CtT4N20 = 359 + INTEGER(IntKi), PARAMETER :: CtT5N01 = 360 + INTEGER(IntKi), PARAMETER :: CtT5N02 = 361 + INTEGER(IntKi), PARAMETER :: CtT5N03 = 362 + INTEGER(IntKi), PARAMETER :: CtT5N04 = 363 + INTEGER(IntKi), PARAMETER :: CtT5N05 = 364 + INTEGER(IntKi), PARAMETER :: CtT5N06 = 365 + INTEGER(IntKi), PARAMETER :: CtT5N07 = 366 + INTEGER(IntKi), PARAMETER :: CtT5N08 = 367 + INTEGER(IntKi), PARAMETER :: CtT5N09 = 368 + INTEGER(IntKi), PARAMETER :: CtT5N10 = 369 + INTEGER(IntKi), PARAMETER :: CtT5N11 = 370 + INTEGER(IntKi), PARAMETER :: CtT5N12 = 371 + INTEGER(IntKi), PARAMETER :: CtT5N13 = 372 + INTEGER(IntKi), PARAMETER :: CtT5N14 = 373 + INTEGER(IntKi), PARAMETER :: CtT5N15 = 374 + INTEGER(IntKi), PARAMETER :: CtT5N16 = 375 + INTEGER(IntKi), PARAMETER :: CtT5N17 = 376 + INTEGER(IntKi), PARAMETER :: CtT5N18 = 377 + INTEGER(IntKi), PARAMETER :: CtT5N19 = 378 + INTEGER(IntKi), PARAMETER :: CtT5N20 = 379 + INTEGER(IntKi), PARAMETER :: CtT6N01 = 380 + INTEGER(IntKi), PARAMETER :: CtT6N02 = 381 + INTEGER(IntKi), PARAMETER :: CtT6N03 = 382 + INTEGER(IntKi), PARAMETER :: CtT6N04 = 383 + INTEGER(IntKi), PARAMETER :: CtT6N05 = 384 + INTEGER(IntKi), PARAMETER :: CtT6N06 = 385 + INTEGER(IntKi), PARAMETER :: CtT6N07 = 386 + INTEGER(IntKi), PARAMETER :: CtT6N08 = 387 + INTEGER(IntKi), PARAMETER :: CtT6N09 = 388 + INTEGER(IntKi), PARAMETER :: CtT6N10 = 389 + INTEGER(IntKi), PARAMETER :: CtT6N11 = 390 + INTEGER(IntKi), PARAMETER :: CtT6N12 = 391 + INTEGER(IntKi), PARAMETER :: CtT6N13 = 392 + INTEGER(IntKi), PARAMETER :: CtT6N14 = 393 + INTEGER(IntKi), PARAMETER :: CtT6N15 = 394 + INTEGER(IntKi), PARAMETER :: CtT6N16 = 395 + INTEGER(IntKi), PARAMETER :: CtT6N17 = 396 + INTEGER(IntKi), PARAMETER :: CtT6N18 = 397 + INTEGER(IntKi), PARAMETER :: CtT6N19 = 398 + INTEGER(IntKi), PARAMETER :: CtT6N20 = 399 + INTEGER(IntKi), PARAMETER :: CtT7N01 = 400 + INTEGER(IntKi), PARAMETER :: CtT7N02 = 401 + INTEGER(IntKi), PARAMETER :: CtT7N03 = 402 + INTEGER(IntKi), PARAMETER :: CtT7N04 = 403 + INTEGER(IntKi), PARAMETER :: CtT7N05 = 404 + INTEGER(IntKi), PARAMETER :: CtT7N06 = 405 + INTEGER(IntKi), PARAMETER :: CtT7N07 = 406 + INTEGER(IntKi), PARAMETER :: CtT7N08 = 407 + INTEGER(IntKi), PARAMETER :: CtT7N09 = 408 + INTEGER(IntKi), PARAMETER :: CtT7N10 = 409 + INTEGER(IntKi), PARAMETER :: CtT7N11 = 410 + INTEGER(IntKi), PARAMETER :: CtT7N12 = 411 + INTEGER(IntKi), PARAMETER :: CtT7N13 = 412 + INTEGER(IntKi), PARAMETER :: CtT7N14 = 413 + INTEGER(IntKi), PARAMETER :: CtT7N15 = 414 + INTEGER(IntKi), PARAMETER :: CtT7N16 = 415 + INTEGER(IntKi), PARAMETER :: CtT7N17 = 416 + INTEGER(IntKi), PARAMETER :: CtT7N18 = 417 + INTEGER(IntKi), PARAMETER :: CtT7N19 = 418 + INTEGER(IntKi), PARAMETER :: CtT7N20 = 419 + INTEGER(IntKi), PARAMETER :: CtT8N01 = 420 + INTEGER(IntKi), PARAMETER :: CtT8N02 = 421 + INTEGER(IntKi), PARAMETER :: CtT8N03 = 422 + INTEGER(IntKi), PARAMETER :: CtT8N04 = 423 + INTEGER(IntKi), PARAMETER :: CtT8N05 = 424 + INTEGER(IntKi), PARAMETER :: CtT8N06 = 425 + INTEGER(IntKi), PARAMETER :: CtT8N07 = 426 + INTEGER(IntKi), PARAMETER :: CtT8N08 = 427 + INTEGER(IntKi), PARAMETER :: CtT8N09 = 428 + INTEGER(IntKi), PARAMETER :: CtT8N10 = 429 + INTEGER(IntKi), PARAMETER :: CtT8N11 = 430 + INTEGER(IntKi), PARAMETER :: CtT8N12 = 431 + INTEGER(IntKi), PARAMETER :: CtT8N13 = 432 + INTEGER(IntKi), PARAMETER :: CtT8N14 = 433 + INTEGER(IntKi), PARAMETER :: CtT8N15 = 434 + INTEGER(IntKi), PARAMETER :: CtT8N16 = 435 + INTEGER(IntKi), PARAMETER :: CtT8N17 = 436 + INTEGER(IntKi), PARAMETER :: CtT8N18 = 437 + INTEGER(IntKi), PARAMETER :: CtT8N19 = 438 + INTEGER(IntKi), PARAMETER :: CtT8N20 = 439 + INTEGER(IntKi), PARAMETER :: CtT9N01 = 440 + INTEGER(IntKi), PARAMETER :: CtT9N02 = 441 + INTEGER(IntKi), PARAMETER :: CtT9N03 = 442 + INTEGER(IntKi), PARAMETER :: CtT9N04 = 443 + INTEGER(IntKi), PARAMETER :: CtT9N05 = 444 + INTEGER(IntKi), PARAMETER :: CtT9N06 = 445 + INTEGER(IntKi), PARAMETER :: CtT9N07 = 446 + INTEGER(IntKi), PARAMETER :: CtT9N08 = 447 + INTEGER(IntKi), PARAMETER :: CtT9N09 = 448 + INTEGER(IntKi), PARAMETER :: CtT9N10 = 449 + INTEGER(IntKi), PARAMETER :: CtT9N11 = 450 + INTEGER(IntKi), PARAMETER :: CtT9N12 = 451 + INTEGER(IntKi), PARAMETER :: CtT9N13 = 452 + INTEGER(IntKi), PARAMETER :: CtT9N14 = 453 + INTEGER(IntKi), PARAMETER :: CtT9N15 = 454 + INTEGER(IntKi), PARAMETER :: CtT9N16 = 455 + INTEGER(IntKi), PARAMETER :: CtT9N17 = 456 + INTEGER(IntKi), PARAMETER :: CtT9N18 = 457 + INTEGER(IntKi), PARAMETER :: CtT9N19 = 458 + INTEGER(IntKi), PARAMETER :: CtT9N20 = 459 + + + ! Wake Centerline Orientation: + + INTEGER(IntKi), PARAMETER :: WkAxsXT1D1 = 460 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D2 = 461 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D3 = 462 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D4 = 463 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D5 = 464 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D6 = 465 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D7 = 466 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D8 = 467 + INTEGER(IntKi), PARAMETER :: WkAxsXT1D9 = 468 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D1 = 469 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D2 = 470 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D3 = 471 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D4 = 472 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D5 = 473 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D6 = 474 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D7 = 475 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D8 = 476 + INTEGER(IntKi), PARAMETER :: WkAxsXT2D9 = 477 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D1 = 478 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D2 = 479 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D3 = 480 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D4 = 481 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D5 = 482 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D6 = 483 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D7 = 484 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D8 = 485 + INTEGER(IntKi), PARAMETER :: WkAxsXT3D9 = 486 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D1 = 487 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D2 = 488 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D3 = 489 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D4 = 490 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D5 = 491 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D6 = 492 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D7 = 493 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D8 = 494 + INTEGER(IntKi), PARAMETER :: WkAxsXT4D9 = 495 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D1 = 496 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D2 = 497 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D3 = 498 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D4 = 499 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D5 = 500 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D6 = 501 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D7 = 502 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D8 = 503 + INTEGER(IntKi), PARAMETER :: WkAxsXT5D9 = 504 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D1 = 505 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D2 = 506 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D3 = 507 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D4 = 508 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D5 = 509 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D6 = 510 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D7 = 511 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D8 = 512 + INTEGER(IntKi), PARAMETER :: WkAxsXT6D9 = 513 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D1 = 514 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D2 = 515 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D3 = 516 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D4 = 517 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D5 = 518 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D6 = 519 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D7 = 520 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D8 = 521 + INTEGER(IntKi), PARAMETER :: WkAxsXT7D9 = 522 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D1 = 523 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D2 = 524 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D3 = 525 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D4 = 526 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D5 = 527 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D6 = 528 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D7 = 529 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D8 = 530 + INTEGER(IntKi), PARAMETER :: WkAxsXT8D9 = 531 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D1 = 532 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D2 = 533 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D3 = 534 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D4 = 535 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D5 = 536 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D6 = 537 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D7 = 538 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D8 = 539 + INTEGER(IntKi), PARAMETER :: WkAxsXT9D9 = 540 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D1 = 541 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D2 = 542 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D3 = 543 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D4 = 544 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D5 = 545 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D6 = 546 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D7 = 547 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D8 = 548 + INTEGER(IntKi), PARAMETER :: WkAxsYT1D9 = 549 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D1 = 550 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D2 = 551 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D3 = 552 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D4 = 553 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D5 = 554 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D6 = 555 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D7 = 556 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D8 = 557 + INTEGER(IntKi), PARAMETER :: WkAxsYT2D9 = 558 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D1 = 559 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D2 = 560 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D3 = 561 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D4 = 562 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D5 = 563 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D6 = 564 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D7 = 565 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D8 = 566 + INTEGER(IntKi), PARAMETER :: WkAxsYT3D9 = 567 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D1 = 568 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D2 = 569 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D3 = 570 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D4 = 571 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D5 = 572 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D6 = 573 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D7 = 574 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D8 = 575 + INTEGER(IntKi), PARAMETER :: WkAxsYT4D9 = 576 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D1 = 577 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D2 = 578 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D3 = 579 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D4 = 580 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D5 = 581 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D6 = 582 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D7 = 583 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D8 = 584 + INTEGER(IntKi), PARAMETER :: WkAxsYT5D9 = 585 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D1 = 586 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D2 = 587 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D3 = 588 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D4 = 589 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D5 = 590 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D6 = 591 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D7 = 592 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D8 = 593 + INTEGER(IntKi), PARAMETER :: WkAxsYT6D9 = 594 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D1 = 595 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D2 = 596 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D3 = 597 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D4 = 598 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D5 = 599 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D6 = 600 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D7 = 601 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D8 = 602 + INTEGER(IntKi), PARAMETER :: WkAxsYT7D9 = 603 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D1 = 604 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D2 = 605 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D3 = 606 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D4 = 607 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D5 = 608 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D6 = 609 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D7 = 610 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D8 = 611 + INTEGER(IntKi), PARAMETER :: WkAxsYT8D9 = 612 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D1 = 613 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D2 = 614 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D3 = 615 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D4 = 616 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D5 = 617 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D6 = 618 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D7 = 619 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D8 = 620 + INTEGER(IntKi), PARAMETER :: WkAxsYT9D9 = 621 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D1 = 622 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D2 = 623 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D3 = 624 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D4 = 625 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D5 = 626 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D6 = 627 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D7 = 628 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D8 = 629 + INTEGER(IntKi), PARAMETER :: WkAxsZT1D9 = 630 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D1 = 631 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D2 = 632 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D3 = 633 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D4 = 634 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D5 = 635 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D6 = 636 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D7 = 637 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D8 = 638 + INTEGER(IntKi), PARAMETER :: WkAxsZT2D9 = 639 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D1 = 640 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D2 = 641 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D3 = 642 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D4 = 643 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D5 = 644 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D6 = 645 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D7 = 646 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D8 = 647 + INTEGER(IntKi), PARAMETER :: WkAxsZT3D9 = 648 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D1 = 649 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D2 = 650 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D3 = 651 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D4 = 652 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D5 = 653 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D6 = 654 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D7 = 655 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D8 = 656 + INTEGER(IntKi), PARAMETER :: WkAxsZT4D9 = 657 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D1 = 658 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D2 = 659 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D3 = 660 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D4 = 661 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D5 = 662 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D6 = 663 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D7 = 664 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D8 = 665 + INTEGER(IntKi), PARAMETER :: WkAxsZT5D9 = 666 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D1 = 667 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D2 = 668 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D3 = 669 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D4 = 670 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D5 = 671 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D6 = 672 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D7 = 673 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D8 = 674 + INTEGER(IntKi), PARAMETER :: WkAxsZT6D9 = 675 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D1 = 676 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D2 = 677 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D3 = 678 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D4 = 679 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D5 = 680 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D6 = 681 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D7 = 682 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D8 = 683 + INTEGER(IntKi), PARAMETER :: WkAxsZT7D9 = 684 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D1 = 685 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D2 = 686 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D3 = 687 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D4 = 688 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D5 = 689 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D6 = 690 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D7 = 691 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D8 = 692 + INTEGER(IntKi), PARAMETER :: WkAxsZT8D9 = 693 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D1 = 694 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D2 = 695 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D3 = 696 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D4 = 697 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D5 = 698 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D6 = 699 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D7 = 700 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D8 = 701 + INTEGER(IntKi), PARAMETER :: WkAxsZT9D9 = 702 + + + ! Center Position of Wake Centerline: + + INTEGER(IntKi), PARAMETER :: WkPosXT1D1 = 703 + INTEGER(IntKi), PARAMETER :: WkPosXT1D2 = 704 + INTEGER(IntKi), PARAMETER :: WkPosXT1D3 = 705 + INTEGER(IntKi), PARAMETER :: WkPosXT1D4 = 706 + INTEGER(IntKi), PARAMETER :: WkPosXT1D5 = 707 + INTEGER(IntKi), PARAMETER :: WkPosXT1D6 = 708 + INTEGER(IntKi), PARAMETER :: WkPosXT1D7 = 709 + INTEGER(IntKi), PARAMETER :: WkPosXT1D8 = 710 + INTEGER(IntKi), PARAMETER :: WkPosXT1D9 = 711 + INTEGER(IntKi), PARAMETER :: WkPosXT2D1 = 712 + INTEGER(IntKi), PARAMETER :: WkPosXT2D2 = 713 + INTEGER(IntKi), PARAMETER :: WkPosXT2D3 = 714 + INTEGER(IntKi), PARAMETER :: WkPosXT2D4 = 715 + INTEGER(IntKi), PARAMETER :: WkPosXT2D5 = 716 + INTEGER(IntKi), PARAMETER :: WkPosXT2D6 = 717 + INTEGER(IntKi), PARAMETER :: WkPosXT2D7 = 718 + INTEGER(IntKi), PARAMETER :: WkPosXT2D8 = 719 + INTEGER(IntKi), PARAMETER :: WkPosXT2D9 = 720 + INTEGER(IntKi), PARAMETER :: WkPosXT3D1 = 721 + INTEGER(IntKi), PARAMETER :: WkPosXT3D2 = 722 + INTEGER(IntKi), PARAMETER :: WkPosXT3D3 = 723 + INTEGER(IntKi), PARAMETER :: WkPosXT3D4 = 724 + INTEGER(IntKi), PARAMETER :: WkPosXT3D5 = 725 + INTEGER(IntKi), PARAMETER :: WkPosXT3D6 = 726 + INTEGER(IntKi), PARAMETER :: WkPosXT3D7 = 727 + INTEGER(IntKi), PARAMETER :: WkPosXT3D8 = 728 + INTEGER(IntKi), PARAMETER :: WkPosXT3D9 = 729 + INTEGER(IntKi), PARAMETER :: WkPosXT4D1 = 730 + INTEGER(IntKi), PARAMETER :: WkPosXT4D2 = 731 + INTEGER(IntKi), PARAMETER :: WkPosXT4D3 = 732 + INTEGER(IntKi), PARAMETER :: WkPosXT4D4 = 733 + INTEGER(IntKi), PARAMETER :: WkPosXT4D5 = 734 + INTEGER(IntKi), PARAMETER :: WkPosXT4D6 = 735 + INTEGER(IntKi), PARAMETER :: WkPosXT4D7 = 736 + INTEGER(IntKi), PARAMETER :: WkPosXT4D8 = 737 + INTEGER(IntKi), PARAMETER :: WkPosXT4D9 = 738 + INTEGER(IntKi), PARAMETER :: WkPosXT5D1 = 739 + INTEGER(IntKi), PARAMETER :: WkPosXT5D2 = 740 + INTEGER(IntKi), PARAMETER :: WkPosXT5D3 = 741 + INTEGER(IntKi), PARAMETER :: WkPosXT5D4 = 742 + INTEGER(IntKi), PARAMETER :: WkPosXT5D5 = 743 + INTEGER(IntKi), PARAMETER :: WkPosXT5D6 = 744 + INTEGER(IntKi), PARAMETER :: WkPosXT5D7 = 745 + INTEGER(IntKi), PARAMETER :: WkPosXT5D8 = 746 + INTEGER(IntKi), PARAMETER :: WkPosXT5D9 = 747 + INTEGER(IntKi), PARAMETER :: WkPosXT6D1 = 748 + INTEGER(IntKi), PARAMETER :: WkPosXT6D2 = 749 + INTEGER(IntKi), PARAMETER :: WkPosXT6D3 = 750 + INTEGER(IntKi), PARAMETER :: WkPosXT6D4 = 751 + INTEGER(IntKi), PARAMETER :: WkPosXT6D5 = 752 + INTEGER(IntKi), PARAMETER :: WkPosXT6D6 = 753 + INTEGER(IntKi), PARAMETER :: WkPosXT6D7 = 754 + INTEGER(IntKi), PARAMETER :: WkPosXT6D8 = 755 + INTEGER(IntKi), PARAMETER :: WkPosXT6D9 = 756 + INTEGER(IntKi), PARAMETER :: WkPosXT7D1 = 757 + INTEGER(IntKi), PARAMETER :: WkPosXT7D2 = 758 + INTEGER(IntKi), PARAMETER :: WkPosXT7D3 = 759 + INTEGER(IntKi), PARAMETER :: WkPosXT7D4 = 760 + INTEGER(IntKi), PARAMETER :: WkPosXT7D5 = 761 + INTEGER(IntKi), PARAMETER :: WkPosXT7D6 = 762 + INTEGER(IntKi), PARAMETER :: WkPosXT7D7 = 763 + INTEGER(IntKi), PARAMETER :: WkPosXT7D8 = 764 + INTEGER(IntKi), PARAMETER :: WkPosXT7D9 = 765 + INTEGER(IntKi), PARAMETER :: WkPosXT8D1 = 766 + INTEGER(IntKi), PARAMETER :: WkPosXT8D2 = 767 + INTEGER(IntKi), PARAMETER :: WkPosXT8D3 = 768 + INTEGER(IntKi), PARAMETER :: WkPosXT8D4 = 769 + INTEGER(IntKi), PARAMETER :: WkPosXT8D5 = 770 + INTEGER(IntKi), PARAMETER :: WkPosXT8D6 = 771 + INTEGER(IntKi), PARAMETER :: WkPosXT8D7 = 772 + INTEGER(IntKi), PARAMETER :: WkPosXT8D8 = 773 + INTEGER(IntKi), PARAMETER :: WkPosXT8D9 = 774 + INTEGER(IntKi), PARAMETER :: WkPosXT9D1 = 775 + INTEGER(IntKi), PARAMETER :: WkPosXT9D2 = 776 + INTEGER(IntKi), PARAMETER :: WkPosXT9D3 = 777 + INTEGER(IntKi), PARAMETER :: WkPosXT9D4 = 778 + INTEGER(IntKi), PARAMETER :: WkPosXT9D5 = 779 + INTEGER(IntKi), PARAMETER :: WkPosXT9D6 = 780 + INTEGER(IntKi), PARAMETER :: WkPosXT9D7 = 781 + INTEGER(IntKi), PARAMETER :: WkPosXT9D8 = 782 + INTEGER(IntKi), PARAMETER :: WkPosXT9D9 = 783 + INTEGER(IntKi), PARAMETER :: WkPosYT1D1 = 784 + INTEGER(IntKi), PARAMETER :: WkPosYT1D2 = 785 + INTEGER(IntKi), PARAMETER :: WkPosYT1D3 = 786 + INTEGER(IntKi), PARAMETER :: WkPosYT1D4 = 787 + INTEGER(IntKi), PARAMETER :: WkPosYT1D5 = 788 + INTEGER(IntKi), PARAMETER :: WkPosYT1D6 = 789 + INTEGER(IntKi), PARAMETER :: WkPosYT1D7 = 790 + INTEGER(IntKi), PARAMETER :: WkPosYT1D8 = 791 + INTEGER(IntKi), PARAMETER :: WkPosYT1D9 = 792 + INTEGER(IntKi), PARAMETER :: WkPosYT2D1 = 793 + INTEGER(IntKi), PARAMETER :: WkPosYT2D2 = 794 + INTEGER(IntKi), PARAMETER :: WkPosYT2D3 = 795 + INTEGER(IntKi), PARAMETER :: WkPosYT2D4 = 796 + INTEGER(IntKi), PARAMETER :: WkPosYT2D5 = 797 + INTEGER(IntKi), PARAMETER :: WkPosYT2D6 = 798 + INTEGER(IntKi), PARAMETER :: WkPosYT2D7 = 799 + INTEGER(IntKi), PARAMETER :: WkPosYT2D8 = 800 + INTEGER(IntKi), PARAMETER :: WkPosYT2D9 = 801 + INTEGER(IntKi), PARAMETER :: WkPosYT3D1 = 802 + INTEGER(IntKi), PARAMETER :: WkPosYT3D2 = 803 + INTEGER(IntKi), PARAMETER :: WkPosYT3D3 = 804 + INTEGER(IntKi), PARAMETER :: WkPosYT3D4 = 805 + INTEGER(IntKi), PARAMETER :: WkPosYT3D5 = 806 + INTEGER(IntKi), PARAMETER :: WkPosYT3D6 = 807 + INTEGER(IntKi), PARAMETER :: WkPosYT3D7 = 808 + INTEGER(IntKi), PARAMETER :: WkPosYT3D8 = 809 + INTEGER(IntKi), PARAMETER :: WkPosYT3D9 = 810 + INTEGER(IntKi), PARAMETER :: WkPosYT4D1 = 811 + INTEGER(IntKi), PARAMETER :: WkPosYT4D2 = 812 + INTEGER(IntKi), PARAMETER :: WkPosYT4D3 = 813 + INTEGER(IntKi), PARAMETER :: WkPosYT4D4 = 814 + INTEGER(IntKi), PARAMETER :: WkPosYT4D5 = 815 + INTEGER(IntKi), PARAMETER :: WkPosYT4D6 = 816 + INTEGER(IntKi), PARAMETER :: WkPosYT4D7 = 817 + INTEGER(IntKi), PARAMETER :: WkPosYT4D8 = 818 + INTEGER(IntKi), PARAMETER :: WkPosYT4D9 = 819 + INTEGER(IntKi), PARAMETER :: WkPosYT5D1 = 820 + INTEGER(IntKi), PARAMETER :: WkPosYT5D2 = 821 + INTEGER(IntKi), PARAMETER :: WkPosYT5D3 = 822 + INTEGER(IntKi), PARAMETER :: WkPosYT5D4 = 823 + INTEGER(IntKi), PARAMETER :: WkPosYT5D5 = 824 + INTEGER(IntKi), PARAMETER :: WkPosYT5D6 = 825 + INTEGER(IntKi), PARAMETER :: WkPosYT5D7 = 826 + INTEGER(IntKi), PARAMETER :: WkPosYT5D8 = 827 + INTEGER(IntKi), PARAMETER :: WkPosYT5D9 = 828 + INTEGER(IntKi), PARAMETER :: WkPosYT6D1 = 829 + INTEGER(IntKi), PARAMETER :: WkPosYT6D2 = 830 + INTEGER(IntKi), PARAMETER :: WkPosYT6D3 = 831 + INTEGER(IntKi), PARAMETER :: WkPosYT6D4 = 832 + INTEGER(IntKi), PARAMETER :: WkPosYT6D5 = 833 + INTEGER(IntKi), PARAMETER :: WkPosYT6D6 = 834 + INTEGER(IntKi), PARAMETER :: WkPosYT6D7 = 835 + INTEGER(IntKi), PARAMETER :: WkPosYT6D8 = 836 + INTEGER(IntKi), PARAMETER :: WkPosYT6D9 = 837 + INTEGER(IntKi), PARAMETER :: WkPosYT7D1 = 838 + INTEGER(IntKi), PARAMETER :: WkPosYT7D2 = 839 + INTEGER(IntKi), PARAMETER :: WkPosYT7D3 = 840 + INTEGER(IntKi), PARAMETER :: WkPosYT7D4 = 841 + INTEGER(IntKi), PARAMETER :: WkPosYT7D5 = 842 + INTEGER(IntKi), PARAMETER :: WkPosYT7D6 = 843 + INTEGER(IntKi), PARAMETER :: WkPosYT7D7 = 844 + INTEGER(IntKi), PARAMETER :: WkPosYT7D8 = 845 + INTEGER(IntKi), PARAMETER :: WkPosYT7D9 = 846 + INTEGER(IntKi), PARAMETER :: WkPosYT8D1 = 847 + INTEGER(IntKi), PARAMETER :: WkPosYT8D2 = 848 + INTEGER(IntKi), PARAMETER :: WkPosYT8D3 = 849 + INTEGER(IntKi), PARAMETER :: WkPosYT8D4 = 850 + INTEGER(IntKi), PARAMETER :: WkPosYT8D5 = 851 + INTEGER(IntKi), PARAMETER :: WkPosYT8D6 = 852 + INTEGER(IntKi), PARAMETER :: WkPosYT8D7 = 853 + INTEGER(IntKi), PARAMETER :: WkPosYT8D8 = 854 + INTEGER(IntKi), PARAMETER :: WkPosYT8D9 = 855 + INTEGER(IntKi), PARAMETER :: WkPosYT9D1 = 856 + INTEGER(IntKi), PARAMETER :: WkPosYT9D2 = 857 + INTEGER(IntKi), PARAMETER :: WkPosYT9D3 = 858 + INTEGER(IntKi), PARAMETER :: WkPosYT9D4 = 859 + INTEGER(IntKi), PARAMETER :: WkPosYT9D5 = 860 + INTEGER(IntKi), PARAMETER :: WkPosYT9D6 = 861 + INTEGER(IntKi), PARAMETER :: WkPosYT9D7 = 862 + INTEGER(IntKi), PARAMETER :: WkPosYT9D8 = 863 + INTEGER(IntKi), PARAMETER :: WkPosYT9D9 = 864 + INTEGER(IntKi), PARAMETER :: WkPosZT1D1 = 865 + INTEGER(IntKi), PARAMETER :: WkPosZT1D2 = 866 + INTEGER(IntKi), PARAMETER :: WkPosZT1D3 = 867 + INTEGER(IntKi), PARAMETER :: WkPosZT1D4 = 868 + INTEGER(IntKi), PARAMETER :: WkPosZT1D5 = 869 + INTEGER(IntKi), PARAMETER :: WkPosZT1D6 = 870 + INTEGER(IntKi), PARAMETER :: WkPosZT1D7 = 871 + INTEGER(IntKi), PARAMETER :: WkPosZT1D8 = 872 + INTEGER(IntKi), PARAMETER :: WkPosZT1D9 = 873 + INTEGER(IntKi), PARAMETER :: WkPosZT2D1 = 874 + INTEGER(IntKi), PARAMETER :: WkPosZT2D2 = 875 + INTEGER(IntKi), PARAMETER :: WkPosZT2D3 = 876 + INTEGER(IntKi), PARAMETER :: WkPosZT2D4 = 877 + INTEGER(IntKi), PARAMETER :: WkPosZT2D5 = 878 + INTEGER(IntKi), PARAMETER :: WkPosZT2D6 = 879 + INTEGER(IntKi), PARAMETER :: WkPosZT2D7 = 880 + INTEGER(IntKi), PARAMETER :: WkPosZT2D8 = 881 + INTEGER(IntKi), PARAMETER :: WkPosZT2D9 = 882 + INTEGER(IntKi), PARAMETER :: WkPosZT3D1 = 883 + INTEGER(IntKi), PARAMETER :: WkPosZT3D2 = 884 + INTEGER(IntKi), PARAMETER :: WkPosZT3D3 = 885 + INTEGER(IntKi), PARAMETER :: WkPosZT3D4 = 886 + INTEGER(IntKi), PARAMETER :: WkPosZT3D5 = 887 + INTEGER(IntKi), PARAMETER :: WkPosZT3D6 = 888 + INTEGER(IntKi), PARAMETER :: WkPosZT3D7 = 889 + INTEGER(IntKi), PARAMETER :: WkPosZT3D8 = 890 + INTEGER(IntKi), PARAMETER :: WkPosZT3D9 = 891 + INTEGER(IntKi), PARAMETER :: WkPosZT4D1 = 892 + INTEGER(IntKi), PARAMETER :: WkPosZT4D2 = 893 + INTEGER(IntKi), PARAMETER :: WkPosZT4D3 = 894 + INTEGER(IntKi), PARAMETER :: WkPosZT4D4 = 895 + INTEGER(IntKi), PARAMETER :: WkPosZT4D5 = 896 + INTEGER(IntKi), PARAMETER :: WkPosZT4D6 = 897 + INTEGER(IntKi), PARAMETER :: WkPosZT4D7 = 898 + INTEGER(IntKi), PARAMETER :: WkPosZT4D8 = 899 + INTEGER(IntKi), PARAMETER :: WkPosZT4D9 = 900 + INTEGER(IntKi), PARAMETER :: WkPosZT5D1 = 901 + INTEGER(IntKi), PARAMETER :: WkPosZT5D2 = 902 + INTEGER(IntKi), PARAMETER :: WkPosZT5D3 = 903 + INTEGER(IntKi), PARAMETER :: WkPosZT5D4 = 904 + INTEGER(IntKi), PARAMETER :: WkPosZT5D5 = 905 + INTEGER(IntKi), PARAMETER :: WkPosZT5D6 = 906 + INTEGER(IntKi), PARAMETER :: WkPosZT5D7 = 907 + INTEGER(IntKi), PARAMETER :: WkPosZT5D8 = 908 + INTEGER(IntKi), PARAMETER :: WkPosZT5D9 = 909 + INTEGER(IntKi), PARAMETER :: WkPosZT6D1 = 910 + INTEGER(IntKi), PARAMETER :: WkPosZT6D2 = 911 + INTEGER(IntKi), PARAMETER :: WkPosZT6D3 = 912 + INTEGER(IntKi), PARAMETER :: WkPosZT6D4 = 913 + INTEGER(IntKi), PARAMETER :: WkPosZT6D5 = 914 + INTEGER(IntKi), PARAMETER :: WkPosZT6D6 = 915 + INTEGER(IntKi), PARAMETER :: WkPosZT6D7 = 916 + INTEGER(IntKi), PARAMETER :: WkPosZT6D8 = 917 + INTEGER(IntKi), PARAMETER :: WkPosZT6D9 = 918 + INTEGER(IntKi), PARAMETER :: WkPosZT7D1 = 919 + INTEGER(IntKi), PARAMETER :: WkPosZT7D2 = 920 + INTEGER(IntKi), PARAMETER :: WkPosZT7D3 = 921 + INTEGER(IntKi), PARAMETER :: WkPosZT7D4 = 922 + INTEGER(IntKi), PARAMETER :: WkPosZT7D5 = 923 + INTEGER(IntKi), PARAMETER :: WkPosZT7D6 = 924 + INTEGER(IntKi), PARAMETER :: WkPosZT7D7 = 925 + INTEGER(IntKi), PARAMETER :: WkPosZT7D8 = 926 + INTEGER(IntKi), PARAMETER :: WkPosZT7D9 = 927 + INTEGER(IntKi), PARAMETER :: WkPosZT8D1 = 928 + INTEGER(IntKi), PARAMETER :: WkPosZT8D2 = 929 + INTEGER(IntKi), PARAMETER :: WkPosZT8D3 = 930 + INTEGER(IntKi), PARAMETER :: WkPosZT8D4 = 931 + INTEGER(IntKi), PARAMETER :: WkPosZT8D5 = 932 + INTEGER(IntKi), PARAMETER :: WkPosZT8D6 = 933 + INTEGER(IntKi), PARAMETER :: WkPosZT8D7 = 934 + INTEGER(IntKi), PARAMETER :: WkPosZT8D8 = 935 + INTEGER(IntKi), PARAMETER :: WkPosZT8D9 = 936 + INTEGER(IntKi), PARAMETER :: WkPosZT9D1 = 937 + INTEGER(IntKi), PARAMETER :: WkPosZT9D2 = 938 + INTEGER(IntKi), PARAMETER :: WkPosZT9D3 = 939 + INTEGER(IntKi), PARAMETER :: WkPosZT9D4 = 940 + INTEGER(IntKi), PARAMETER :: WkPosZT9D5 = 941 + INTEGER(IntKi), PARAMETER :: WkPosZT9D6 = 942 + INTEGER(IntKi), PARAMETER :: WkPosZT9D7 = 943 + INTEGER(IntKi), PARAMETER :: WkPosZT9D8 = 944 + INTEGER(IntKi), PARAMETER :: WkPosZT9D9 = 945 + + + ! Advection: Deflection: and Meandering Velocity: + + INTEGER(IntKi), PARAMETER :: WkVelXT1D1 = 946 + INTEGER(IntKi), PARAMETER :: WkVelXT1D2 = 947 + INTEGER(IntKi), PARAMETER :: WkVelXT1D3 = 948 + INTEGER(IntKi), PARAMETER :: WkVelXT1D4 = 949 + INTEGER(IntKi), PARAMETER :: WkVelXT1D5 = 950 + INTEGER(IntKi), PARAMETER :: WkVelXT1D6 = 951 + INTEGER(IntKi), PARAMETER :: WkVelXT1D7 = 952 + INTEGER(IntKi), PARAMETER :: WkVelXT1D8 = 953 + INTEGER(IntKi), PARAMETER :: WkVelXT1D9 = 954 + INTEGER(IntKi), PARAMETER :: WkVelXT2D1 = 955 + INTEGER(IntKi), PARAMETER :: WkVelXT2D2 = 956 + INTEGER(IntKi), PARAMETER :: WkVelXT2D3 = 957 + INTEGER(IntKi), PARAMETER :: WkVelXT2D4 = 958 + INTEGER(IntKi), PARAMETER :: WkVelXT2D5 = 959 + INTEGER(IntKi), PARAMETER :: WkVelXT2D6 = 960 + INTEGER(IntKi), PARAMETER :: WkVelXT2D7 = 961 + INTEGER(IntKi), PARAMETER :: WkVelXT2D8 = 962 + INTEGER(IntKi), PARAMETER :: WkVelXT2D9 = 963 + INTEGER(IntKi), PARAMETER :: WkVelXT3D1 = 964 + INTEGER(IntKi), PARAMETER :: WkVelXT3D2 = 965 + INTEGER(IntKi), PARAMETER :: WkVelXT3D3 = 966 + INTEGER(IntKi), PARAMETER :: WkVelXT3D4 = 967 + INTEGER(IntKi), PARAMETER :: WkVelXT3D5 = 968 + INTEGER(IntKi), PARAMETER :: WkVelXT3D6 = 969 + INTEGER(IntKi), PARAMETER :: WkVelXT3D7 = 970 + INTEGER(IntKi), PARAMETER :: WkVelXT3D8 = 971 + INTEGER(IntKi), PARAMETER :: WkVelXT3D9 = 972 + INTEGER(IntKi), PARAMETER :: WkVelXT4D1 = 973 + INTEGER(IntKi), PARAMETER :: WkVelXT4D2 = 974 + INTEGER(IntKi), PARAMETER :: WkVelXT4D3 = 975 + INTEGER(IntKi), PARAMETER :: WkVelXT4D4 = 976 + INTEGER(IntKi), PARAMETER :: WkVelXT4D5 = 977 + INTEGER(IntKi), PARAMETER :: WkVelXT4D6 = 978 + INTEGER(IntKi), PARAMETER :: WkVelXT4D7 = 979 + INTEGER(IntKi), PARAMETER :: WkVelXT4D8 = 980 + INTEGER(IntKi), PARAMETER :: WkVelXT4D9 = 981 + INTEGER(IntKi), PARAMETER :: WkVelXT5D1 = 982 + INTEGER(IntKi), PARAMETER :: WkVelXT5D2 = 983 + INTEGER(IntKi), PARAMETER :: WkVelXT5D3 = 984 + INTEGER(IntKi), PARAMETER :: WkVelXT5D4 = 985 + INTEGER(IntKi), PARAMETER :: WkVelXT5D5 = 986 + INTEGER(IntKi), PARAMETER :: WkVelXT5D6 = 987 + INTEGER(IntKi), PARAMETER :: WkVelXT5D7 = 988 + INTEGER(IntKi), PARAMETER :: WkVelXT5D8 = 989 + INTEGER(IntKi), PARAMETER :: WkVelXT5D9 = 990 + INTEGER(IntKi), PARAMETER :: WkVelXT6D1 = 991 + INTEGER(IntKi), PARAMETER :: WkVelXT6D2 = 992 + INTEGER(IntKi), PARAMETER :: WkVelXT6D3 = 993 + INTEGER(IntKi), PARAMETER :: WkVelXT6D4 = 994 + INTEGER(IntKi), PARAMETER :: WkVelXT6D5 = 995 + INTEGER(IntKi), PARAMETER :: WkVelXT6D6 = 996 + INTEGER(IntKi), PARAMETER :: WkVelXT6D7 = 997 + INTEGER(IntKi), PARAMETER :: WkVelXT6D8 = 998 + INTEGER(IntKi), PARAMETER :: WkVelXT6D9 = 999 + INTEGER(IntKi), PARAMETER :: WkVelXT7D1 = 1000 + INTEGER(IntKi), PARAMETER :: WkVelXT7D2 = 1001 + INTEGER(IntKi), PARAMETER :: WkVelXT7D3 = 1002 + INTEGER(IntKi), PARAMETER :: WkVelXT7D4 = 1003 + INTEGER(IntKi), PARAMETER :: WkVelXT7D5 = 1004 + INTEGER(IntKi), PARAMETER :: WkVelXT7D6 = 1005 + INTEGER(IntKi), PARAMETER :: WkVelXT7D7 = 1006 + INTEGER(IntKi), PARAMETER :: WkVelXT7D8 = 1007 + INTEGER(IntKi), PARAMETER :: WkVelXT7D9 = 1008 + INTEGER(IntKi), PARAMETER :: WkVelXT8D1 = 1009 + INTEGER(IntKi), PARAMETER :: WkVelXT8D2 = 1010 + INTEGER(IntKi), PARAMETER :: WkVelXT8D3 = 1011 + INTEGER(IntKi), PARAMETER :: WkVelXT8D4 = 1012 + INTEGER(IntKi), PARAMETER :: WkVelXT8D5 = 1013 + INTEGER(IntKi), PARAMETER :: WkVelXT8D6 = 1014 + INTEGER(IntKi), PARAMETER :: WkVelXT8D7 = 1015 + INTEGER(IntKi), PARAMETER :: WkVelXT8D8 = 1016 + INTEGER(IntKi), PARAMETER :: WkVelXT8D9 = 1017 + INTEGER(IntKi), PARAMETER :: WkVelXT9D1 = 1018 + INTEGER(IntKi), PARAMETER :: WkVelXT9D2 = 1019 + INTEGER(IntKi), PARAMETER :: WkVelXT9D3 = 1020 + INTEGER(IntKi), PARAMETER :: WkVelXT9D4 = 1021 + INTEGER(IntKi), PARAMETER :: WkVelXT9D5 = 1022 + INTEGER(IntKi), PARAMETER :: WkVelXT9D6 = 1023 + INTEGER(IntKi), PARAMETER :: WkVelXT9D7 = 1024 + INTEGER(IntKi), PARAMETER :: WkVelXT9D8 = 1025 + INTEGER(IntKi), PARAMETER :: WkVelXT9D9 = 1026 + INTEGER(IntKi), PARAMETER :: WkVelYT1D1 = 1027 + INTEGER(IntKi), PARAMETER :: WkVelYT1D2 = 1028 + INTEGER(IntKi), PARAMETER :: WkVelYT1D3 = 1029 + INTEGER(IntKi), PARAMETER :: WkVelYT1D4 = 1030 + INTEGER(IntKi), PARAMETER :: WkVelYT1D5 = 1031 + INTEGER(IntKi), PARAMETER :: WkVelYT1D6 = 1032 + INTEGER(IntKi), PARAMETER :: WkVelYT1D7 = 1033 + INTEGER(IntKi), PARAMETER :: WkVelYT1D8 = 1034 + INTEGER(IntKi), PARAMETER :: WkVelYT1D9 = 1035 + INTEGER(IntKi), PARAMETER :: WkVelYT2D1 = 1036 + INTEGER(IntKi), PARAMETER :: WkVelYT2D2 = 1037 + INTEGER(IntKi), PARAMETER :: WkVelYT2D3 = 1038 + INTEGER(IntKi), PARAMETER :: WkVelYT2D4 = 1039 + INTEGER(IntKi), PARAMETER :: WkVelYT2D5 = 1040 + INTEGER(IntKi), PARAMETER :: WkVelYT2D6 = 1041 + INTEGER(IntKi), PARAMETER :: WkVelYT2D7 = 1042 + INTEGER(IntKi), PARAMETER :: WkVelYT2D8 = 1043 + INTEGER(IntKi), PARAMETER :: WkVelYT2D9 = 1044 + INTEGER(IntKi), PARAMETER :: WkVelYT3D1 = 1045 + INTEGER(IntKi), PARAMETER :: WkVelYT3D2 = 1046 + INTEGER(IntKi), PARAMETER :: WkVelYT3D3 = 1047 + INTEGER(IntKi), PARAMETER :: WkVelYT3D4 = 1048 + INTEGER(IntKi), PARAMETER :: WkVelYT3D5 = 1049 + INTEGER(IntKi), PARAMETER :: WkVelYT3D6 = 1050 + INTEGER(IntKi), PARAMETER :: WkVelYT3D7 = 1051 + INTEGER(IntKi), PARAMETER :: WkVelYT3D8 = 1052 + INTEGER(IntKi), PARAMETER :: WkVelYT3D9 = 1053 + INTEGER(IntKi), PARAMETER :: WkVelYT4D1 = 1054 + INTEGER(IntKi), PARAMETER :: WkVelYT4D2 = 1055 + INTEGER(IntKi), PARAMETER :: WkVelYT4D3 = 1056 + INTEGER(IntKi), PARAMETER :: WkVelYT4D4 = 1057 + INTEGER(IntKi), PARAMETER :: WkVelYT4D5 = 1058 + INTEGER(IntKi), PARAMETER :: WkVelYT4D6 = 1059 + INTEGER(IntKi), PARAMETER :: WkVelYT4D7 = 1060 + INTEGER(IntKi), PARAMETER :: WkVelYT4D8 = 1061 + INTEGER(IntKi), PARAMETER :: WkVelYT4D9 = 1062 + INTEGER(IntKi), PARAMETER :: WkVelYT5D1 = 1063 + INTEGER(IntKi), PARAMETER :: WkVelYT5D2 = 1064 + INTEGER(IntKi), PARAMETER :: WkVelYT5D3 = 1065 + INTEGER(IntKi), PARAMETER :: WkVelYT5D4 = 1066 + INTEGER(IntKi), PARAMETER :: WkVelYT5D5 = 1067 + INTEGER(IntKi), PARAMETER :: WkVelYT5D6 = 1068 + INTEGER(IntKi), PARAMETER :: WkVelYT5D7 = 1069 + INTEGER(IntKi), PARAMETER :: WkVelYT5D8 = 1070 + INTEGER(IntKi), PARAMETER :: WkVelYT5D9 = 1071 + INTEGER(IntKi), PARAMETER :: WkVelYT6D1 = 1072 + INTEGER(IntKi), PARAMETER :: WkVelYT6D2 = 1073 + INTEGER(IntKi), PARAMETER :: WkVelYT6D3 = 1074 + INTEGER(IntKi), PARAMETER :: WkVelYT6D4 = 1075 + INTEGER(IntKi), PARAMETER :: WkVelYT6D5 = 1076 + INTEGER(IntKi), PARAMETER :: WkVelYT6D6 = 1077 + INTEGER(IntKi), PARAMETER :: WkVelYT6D7 = 1078 + INTEGER(IntKi), PARAMETER :: WkVelYT6D8 = 1079 + INTEGER(IntKi), PARAMETER :: WkVelYT6D9 = 1080 + INTEGER(IntKi), PARAMETER :: WkVelYT7D1 = 1081 + INTEGER(IntKi), PARAMETER :: WkVelYT7D2 = 1082 + INTEGER(IntKi), PARAMETER :: WkVelYT7D3 = 1083 + INTEGER(IntKi), PARAMETER :: WkVelYT7D4 = 1084 + INTEGER(IntKi), PARAMETER :: WkVelYT7D5 = 1085 + INTEGER(IntKi), PARAMETER :: WkVelYT7D6 = 1086 + INTEGER(IntKi), PARAMETER :: WkVelYT7D7 = 1087 + INTEGER(IntKi), PARAMETER :: WkVelYT7D8 = 1088 + INTEGER(IntKi), PARAMETER :: WkVelYT7D9 = 1089 + INTEGER(IntKi), PARAMETER :: WkVelYT8D1 = 1090 + INTEGER(IntKi), PARAMETER :: WkVelYT8D2 = 1091 + INTEGER(IntKi), PARAMETER :: WkVelYT8D3 = 1092 + INTEGER(IntKi), PARAMETER :: WkVelYT8D4 = 1093 + INTEGER(IntKi), PARAMETER :: WkVelYT8D5 = 1094 + INTEGER(IntKi), PARAMETER :: WkVelYT8D6 = 1095 + INTEGER(IntKi), PARAMETER :: WkVelYT8D7 = 1096 + INTEGER(IntKi), PARAMETER :: WkVelYT8D8 = 1097 + INTEGER(IntKi), PARAMETER :: WkVelYT8D9 = 1098 + INTEGER(IntKi), PARAMETER :: WkVelYT9D1 = 1099 + INTEGER(IntKi), PARAMETER :: WkVelYT9D2 = 1100 + INTEGER(IntKi), PARAMETER :: WkVelYT9D3 = 1101 + INTEGER(IntKi), PARAMETER :: WkVelYT9D4 = 1102 + INTEGER(IntKi), PARAMETER :: WkVelYT9D5 = 1103 + INTEGER(IntKi), PARAMETER :: WkVelYT9D6 = 1104 + INTEGER(IntKi), PARAMETER :: WkVelYT9D7 = 1105 + INTEGER(IntKi), PARAMETER :: WkVelYT9D8 = 1106 + INTEGER(IntKi), PARAMETER :: WkVelYT9D9 = 1107 + INTEGER(IntKi), PARAMETER :: WkVelZT1D1 = 1108 + INTEGER(IntKi), PARAMETER :: WkVelZT1D2 = 1109 + INTEGER(IntKi), PARAMETER :: WkVelZT1D3 = 1110 + INTEGER(IntKi), PARAMETER :: WkVelZT1D4 = 1111 + INTEGER(IntKi), PARAMETER :: WkVelZT1D5 = 1112 + INTEGER(IntKi), PARAMETER :: WkVelZT1D6 = 1113 + INTEGER(IntKi), PARAMETER :: WkVelZT1D7 = 1114 + INTEGER(IntKi), PARAMETER :: WkVelZT1D8 = 1115 + INTEGER(IntKi), PARAMETER :: WkVelZT1D9 = 1116 + INTEGER(IntKi), PARAMETER :: WkVelZT2D1 = 1117 + INTEGER(IntKi), PARAMETER :: WkVelZT2D2 = 1118 + INTEGER(IntKi), PARAMETER :: WkVelZT2D3 = 1119 + INTEGER(IntKi), PARAMETER :: WkVelZT2D4 = 1120 + INTEGER(IntKi), PARAMETER :: WkVelZT2D5 = 1121 + INTEGER(IntKi), PARAMETER :: WkVelZT2D6 = 1122 + INTEGER(IntKi), PARAMETER :: WkVelZT2D7 = 1123 + INTEGER(IntKi), PARAMETER :: WkVelZT2D8 = 1124 + INTEGER(IntKi), PARAMETER :: WkVelZT2D9 = 1125 + INTEGER(IntKi), PARAMETER :: WkVelZT3D1 = 1126 + INTEGER(IntKi), PARAMETER :: WkVelZT3D2 = 1127 + INTEGER(IntKi), PARAMETER :: WkVelZT3D3 = 1128 + INTEGER(IntKi), PARAMETER :: WkVelZT3D4 = 1129 + INTEGER(IntKi), PARAMETER :: WkVelZT3D5 = 1130 + INTEGER(IntKi), PARAMETER :: WkVelZT3D6 = 1131 + INTEGER(IntKi), PARAMETER :: WkVelZT3D7 = 1132 + INTEGER(IntKi), PARAMETER :: WkVelZT3D8 = 1133 + INTEGER(IntKi), PARAMETER :: WkVelZT3D9 = 1134 + INTEGER(IntKi), PARAMETER :: WkVelZT4D1 = 1135 + INTEGER(IntKi), PARAMETER :: WkVelZT4D2 = 1136 + INTEGER(IntKi), PARAMETER :: WkVelZT4D3 = 1137 + INTEGER(IntKi), PARAMETER :: WkVelZT4D4 = 1138 + INTEGER(IntKi), PARAMETER :: WkVelZT4D5 = 1139 + INTEGER(IntKi), PARAMETER :: WkVelZT4D6 = 1140 + INTEGER(IntKi), PARAMETER :: WkVelZT4D7 = 1141 + INTEGER(IntKi), PARAMETER :: WkVelZT4D8 = 1142 + INTEGER(IntKi), PARAMETER :: WkVelZT4D9 = 1143 + INTEGER(IntKi), PARAMETER :: WkVelZT5D1 = 1144 + INTEGER(IntKi), PARAMETER :: WkVelZT5D2 = 1145 + INTEGER(IntKi), PARAMETER :: WkVelZT5D3 = 1146 + INTEGER(IntKi), PARAMETER :: WkVelZT5D4 = 1147 + INTEGER(IntKi), PARAMETER :: WkVelZT5D5 = 1148 + INTEGER(IntKi), PARAMETER :: WkVelZT5D6 = 1149 + INTEGER(IntKi), PARAMETER :: WkVelZT5D7 = 1150 + INTEGER(IntKi), PARAMETER :: WkVelZT5D8 = 1151 + INTEGER(IntKi), PARAMETER :: WkVelZT5D9 = 1152 + INTEGER(IntKi), PARAMETER :: WkVelZT6D1 = 1153 + INTEGER(IntKi), PARAMETER :: WkVelZT6D2 = 1154 + INTEGER(IntKi), PARAMETER :: WkVelZT6D3 = 1155 + INTEGER(IntKi), PARAMETER :: WkVelZT6D4 = 1156 + INTEGER(IntKi), PARAMETER :: WkVelZT6D5 = 1157 + INTEGER(IntKi), PARAMETER :: WkVelZT6D6 = 1158 + INTEGER(IntKi), PARAMETER :: WkVelZT6D7 = 1159 + INTEGER(IntKi), PARAMETER :: WkVelZT6D8 = 1160 + INTEGER(IntKi), PARAMETER :: WkVelZT6D9 = 1161 + INTEGER(IntKi), PARAMETER :: WkVelZT7D1 = 1162 + INTEGER(IntKi), PARAMETER :: WkVelZT7D2 = 1163 + INTEGER(IntKi), PARAMETER :: WkVelZT7D3 = 1164 + INTEGER(IntKi), PARAMETER :: WkVelZT7D4 = 1165 + INTEGER(IntKi), PARAMETER :: WkVelZT7D5 = 1166 + INTEGER(IntKi), PARAMETER :: WkVelZT7D6 = 1167 + INTEGER(IntKi), PARAMETER :: WkVelZT7D7 = 1168 + INTEGER(IntKi), PARAMETER :: WkVelZT7D8 = 1169 + INTEGER(IntKi), PARAMETER :: WkVelZT7D9 = 1170 + INTEGER(IntKi), PARAMETER :: WkVelZT8D1 = 1171 + INTEGER(IntKi), PARAMETER :: WkVelZT8D2 = 1172 + INTEGER(IntKi), PARAMETER :: WkVelZT8D3 = 1173 + INTEGER(IntKi), PARAMETER :: WkVelZT8D4 = 1174 + INTEGER(IntKi), PARAMETER :: WkVelZT8D5 = 1175 + INTEGER(IntKi), PARAMETER :: WkVelZT8D6 = 1176 + INTEGER(IntKi), PARAMETER :: WkVelZT8D7 = 1177 + INTEGER(IntKi), PARAMETER :: WkVelZT8D8 = 1178 + INTEGER(IntKi), PARAMETER :: WkVelZT8D9 = 1179 + INTEGER(IntKi), PARAMETER :: WkVelZT9D1 = 1180 + INTEGER(IntKi), PARAMETER :: WkVelZT9D2 = 1181 + INTEGER(IntKi), PARAMETER :: WkVelZT9D3 = 1182 + INTEGER(IntKi), PARAMETER :: WkVelZT9D4 = 1183 + INTEGER(IntKi), PARAMETER :: WkVelZT9D5 = 1184 + INTEGER(IntKi), PARAMETER :: WkVelZT9D6 = 1185 + INTEGER(IntKi), PARAMETER :: WkVelZT9D7 = 1186 + INTEGER(IntKi), PARAMETER :: WkVelZT9D8 = 1187 + INTEGER(IntKi), PARAMETER :: WkVelZT9D9 = 1188 + + + ! Wake Diameter: + + INTEGER(IntKi), PARAMETER :: WkDiamT1D1 = 1189 + INTEGER(IntKi), PARAMETER :: WkDiamT1D2 = 1190 + INTEGER(IntKi), PARAMETER :: WkDiamT1D3 = 1191 + INTEGER(IntKi), PARAMETER :: WkDiamT1D4 = 1192 + INTEGER(IntKi), PARAMETER :: WkDiamT1D5 = 1193 + INTEGER(IntKi), PARAMETER :: WkDiamT1D6 = 1194 + INTEGER(IntKi), PARAMETER :: WkDiamT1D7 = 1195 + INTEGER(IntKi), PARAMETER :: WkDiamT1D8 = 1196 + INTEGER(IntKi), PARAMETER :: WkDiamT1D9 = 1197 + INTEGER(IntKi), PARAMETER :: WkDiamT2D1 = 1198 + INTEGER(IntKi), PARAMETER :: WkDiamT2D2 = 1199 + INTEGER(IntKi), PARAMETER :: WkDiamT2D3 = 1200 + INTEGER(IntKi), PARAMETER :: WkDiamT2D4 = 1201 + INTEGER(IntKi), PARAMETER :: WkDiamT2D5 = 1202 + INTEGER(IntKi), PARAMETER :: WkDiamT2D6 = 1203 + INTEGER(IntKi), PARAMETER :: WkDiamT2D7 = 1204 + INTEGER(IntKi), PARAMETER :: WkDiamT2D8 = 1205 + INTEGER(IntKi), PARAMETER :: WkDiamT2D9 = 1206 + INTEGER(IntKi), PARAMETER :: WkDiamT3D1 = 1207 + INTEGER(IntKi), PARAMETER :: WkDiamT3D2 = 1208 + INTEGER(IntKi), PARAMETER :: WkDiamT3D3 = 1209 + INTEGER(IntKi), PARAMETER :: WkDiamT3D4 = 1210 + INTEGER(IntKi), PARAMETER :: WkDiamT3D5 = 1211 + INTEGER(IntKi), PARAMETER :: WkDiamT3D6 = 1212 + INTEGER(IntKi), PARAMETER :: WkDiamT3D7 = 1213 + INTEGER(IntKi), PARAMETER :: WkDiamT3D8 = 1214 + INTEGER(IntKi), PARAMETER :: WkDiamT3D9 = 1215 + INTEGER(IntKi), PARAMETER :: WkDiamT4D1 = 1216 + INTEGER(IntKi), PARAMETER :: WkDiamT4D2 = 1217 + INTEGER(IntKi), PARAMETER :: WkDiamT4D3 = 1218 + INTEGER(IntKi), PARAMETER :: WkDiamT4D4 = 1219 + INTEGER(IntKi), PARAMETER :: WkDiamT4D5 = 1220 + INTEGER(IntKi), PARAMETER :: WkDiamT4D6 = 1221 + INTEGER(IntKi), PARAMETER :: WkDiamT4D7 = 1222 + INTEGER(IntKi), PARAMETER :: WkDiamT4D8 = 1223 + INTEGER(IntKi), PARAMETER :: WkDiamT4D9 = 1224 + INTEGER(IntKi), PARAMETER :: WkDiamT5D1 = 1225 + INTEGER(IntKi), PARAMETER :: WkDiamT5D2 = 1226 + INTEGER(IntKi), PARAMETER :: WkDiamT5D3 = 1227 + INTEGER(IntKi), PARAMETER :: WkDiamT5D4 = 1228 + INTEGER(IntKi), PARAMETER :: WkDiamT5D5 = 1229 + INTEGER(IntKi), PARAMETER :: WkDiamT5D6 = 1230 + INTEGER(IntKi), PARAMETER :: WkDiamT5D7 = 1231 + INTEGER(IntKi), PARAMETER :: WkDiamT5D8 = 1232 + INTEGER(IntKi), PARAMETER :: WkDiamT5D9 = 1233 + INTEGER(IntKi), PARAMETER :: WkDiamT6D1 = 1234 + INTEGER(IntKi), PARAMETER :: WkDiamT6D2 = 1235 + INTEGER(IntKi), PARAMETER :: WkDiamT6D3 = 1236 + INTEGER(IntKi), PARAMETER :: WkDiamT6D4 = 1237 + INTEGER(IntKi), PARAMETER :: WkDiamT6D5 = 1238 + INTEGER(IntKi), PARAMETER :: WkDiamT6D6 = 1239 + INTEGER(IntKi), PARAMETER :: WkDiamT6D7 = 1240 + INTEGER(IntKi), PARAMETER :: WkDiamT6D8 = 1241 + INTEGER(IntKi), PARAMETER :: WkDiamT6D9 = 1242 + INTEGER(IntKi), PARAMETER :: WkDiamT7D1 = 1243 + INTEGER(IntKi), PARAMETER :: WkDiamT7D2 = 1244 + INTEGER(IntKi), PARAMETER :: WkDiamT7D3 = 1245 + INTEGER(IntKi), PARAMETER :: WkDiamT7D4 = 1246 + INTEGER(IntKi), PARAMETER :: WkDiamT7D5 = 1247 + INTEGER(IntKi), PARAMETER :: WkDiamT7D6 = 1248 + INTEGER(IntKi), PARAMETER :: WkDiamT7D7 = 1249 + INTEGER(IntKi), PARAMETER :: WkDiamT7D8 = 1250 + INTEGER(IntKi), PARAMETER :: WkDiamT7D9 = 1251 + INTEGER(IntKi), PARAMETER :: WkDiamT8D1 = 1252 + INTEGER(IntKi), PARAMETER :: WkDiamT8D2 = 1253 + INTEGER(IntKi), PARAMETER :: WkDiamT8D3 = 1254 + INTEGER(IntKi), PARAMETER :: WkDiamT8D4 = 1255 + INTEGER(IntKi), PARAMETER :: WkDiamT8D5 = 1256 + INTEGER(IntKi), PARAMETER :: WkDiamT8D6 = 1257 + INTEGER(IntKi), PARAMETER :: WkDiamT8D7 = 1258 + INTEGER(IntKi), PARAMETER :: WkDiamT8D8 = 1259 + INTEGER(IntKi), PARAMETER :: WkDiamT8D9 = 1260 + INTEGER(IntKi), PARAMETER :: WkDiamT9D1 = 1261 + INTEGER(IntKi), PARAMETER :: WkDiamT9D2 = 1262 + INTEGER(IntKi), PARAMETER :: WkDiamT9D3 = 1263 + INTEGER(IntKi), PARAMETER :: WkDiamT9D4 = 1264 + INTEGER(IntKi), PARAMETER :: WkDiamT9D5 = 1265 + INTEGER(IntKi), PARAMETER :: WkDiamT9D6 = 1266 + INTEGER(IntKi), PARAMETER :: WkDiamT9D7 = 1267 + INTEGER(IntKi), PARAMETER :: WkDiamT9D8 = 1268 + INTEGER(IntKi), PARAMETER :: WkDiamT9D9 = 1269 + + + ! Axial and Radial Wake Velocity Deficits: + + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D1 = 1270 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D2 = 1271 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D3 = 1272 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D4 = 1273 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D5 = 1274 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D6 = 1275 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D7 = 1276 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D8 = 1277 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N01D9 = 1278 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D1 = 1279 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D2 = 1280 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D3 = 1281 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D4 = 1282 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D5 = 1283 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D6 = 1284 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D7 = 1285 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D8 = 1286 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N02D9 = 1287 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D1 = 1288 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D2 = 1289 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D3 = 1290 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D4 = 1291 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D5 = 1292 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D6 = 1293 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D7 = 1294 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D8 = 1295 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N03D9 = 1296 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D1 = 1297 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D2 = 1298 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D3 = 1299 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D4 = 1300 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D5 = 1301 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D6 = 1302 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D7 = 1303 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D8 = 1304 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N04D9 = 1305 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D1 = 1306 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D2 = 1307 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D3 = 1308 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D4 = 1309 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D5 = 1310 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D6 = 1311 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D7 = 1312 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D8 = 1313 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N05D9 = 1314 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D1 = 1315 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D2 = 1316 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D3 = 1317 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D4 = 1318 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D5 = 1319 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D6 = 1320 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D7 = 1321 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D8 = 1322 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N06D9 = 1323 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D1 = 1324 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D2 = 1325 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D3 = 1326 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D4 = 1327 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D5 = 1328 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D6 = 1329 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D7 = 1330 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D8 = 1331 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N07D9 = 1332 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D1 = 1333 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D2 = 1334 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D3 = 1335 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D4 = 1336 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D5 = 1337 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D6 = 1338 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D7 = 1339 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D8 = 1340 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N08D9 = 1341 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D1 = 1342 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D2 = 1343 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D3 = 1344 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D4 = 1345 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D5 = 1346 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D6 = 1347 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D7 = 1348 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D8 = 1349 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N09D9 = 1350 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D1 = 1351 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D2 = 1352 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D3 = 1353 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D4 = 1354 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D5 = 1355 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D6 = 1356 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D7 = 1357 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D8 = 1358 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N10D9 = 1359 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D1 = 1360 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D2 = 1361 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D3 = 1362 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D4 = 1363 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D5 = 1364 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D6 = 1365 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D7 = 1366 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D8 = 1367 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N11D9 = 1368 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D1 = 1369 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D2 = 1370 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D3 = 1371 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D4 = 1372 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D5 = 1373 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D6 = 1374 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D7 = 1375 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D8 = 1376 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N12D9 = 1377 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D1 = 1378 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D2 = 1379 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D3 = 1380 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D4 = 1381 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D5 = 1382 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D6 = 1383 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D7 = 1384 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D8 = 1385 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N13D9 = 1386 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D1 = 1387 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D2 = 1388 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D3 = 1389 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D4 = 1390 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D5 = 1391 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D6 = 1392 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D7 = 1393 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D8 = 1394 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N14D9 = 1395 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D1 = 1396 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D2 = 1397 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D3 = 1398 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D4 = 1399 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D5 = 1400 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D6 = 1401 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D7 = 1402 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D8 = 1403 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N15D9 = 1404 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D1 = 1405 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D2 = 1406 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D3 = 1407 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D4 = 1408 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D5 = 1409 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D6 = 1410 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D7 = 1411 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D8 = 1412 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N16D9 = 1413 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D1 = 1414 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D2 = 1415 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D3 = 1416 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D4 = 1417 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D5 = 1418 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D6 = 1419 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D7 = 1420 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D8 = 1421 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N17D9 = 1422 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D1 = 1423 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D2 = 1424 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D3 = 1425 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D4 = 1426 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D5 = 1427 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D6 = 1428 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D7 = 1429 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D8 = 1430 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N18D9 = 1431 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D1 = 1432 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D2 = 1433 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D3 = 1434 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D4 = 1435 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D5 = 1436 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D6 = 1437 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D7 = 1438 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D8 = 1439 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N19D9 = 1440 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D1 = 1441 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D2 = 1442 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D3 = 1443 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D4 = 1444 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D5 = 1445 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D6 = 1446 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D7 = 1447 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D8 = 1448 + INTEGER(IntKi), PARAMETER :: WkDfVxT1N20D9 = 1449 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D1 = 1450 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D2 = 1451 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D3 = 1452 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D4 = 1453 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D5 = 1454 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D6 = 1455 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D7 = 1456 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D8 = 1457 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N01D9 = 1458 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D1 = 1459 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D2 = 1460 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D3 = 1461 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D4 = 1462 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D5 = 1463 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D6 = 1464 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D7 = 1465 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D8 = 1466 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N02D9 = 1467 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D1 = 1468 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D2 = 1469 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D3 = 1470 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D4 = 1471 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D5 = 1472 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D6 = 1473 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D7 = 1474 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D8 = 1475 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N03D9 = 1476 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D1 = 1477 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D2 = 1478 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D3 = 1479 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D4 = 1480 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D5 = 1481 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D6 = 1482 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D7 = 1483 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D8 = 1484 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N04D9 = 1485 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D1 = 1486 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D2 = 1487 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D3 = 1488 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D4 = 1489 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D5 = 1490 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D6 = 1491 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D7 = 1492 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D8 = 1493 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N05D9 = 1494 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D1 = 1495 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D2 = 1496 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D3 = 1497 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D4 = 1498 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D5 = 1499 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D6 = 1500 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D7 = 1501 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D8 = 1502 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N06D9 = 1503 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D1 = 1504 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D2 = 1505 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D3 = 1506 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D4 = 1507 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D5 = 1508 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D6 = 1509 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D7 = 1510 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D8 = 1511 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N07D9 = 1512 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D1 = 1513 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D2 = 1514 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D3 = 1515 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D4 = 1516 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D5 = 1517 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D6 = 1518 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D7 = 1519 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D8 = 1520 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N08D9 = 1521 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D1 = 1522 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D2 = 1523 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D3 = 1524 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D4 = 1525 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D5 = 1526 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D6 = 1527 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D7 = 1528 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D8 = 1529 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N09D9 = 1530 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D1 = 1531 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D2 = 1532 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D3 = 1533 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D4 = 1534 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D5 = 1535 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D6 = 1536 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D7 = 1537 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D8 = 1538 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N10D9 = 1539 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D1 = 1540 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D2 = 1541 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D3 = 1542 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D4 = 1543 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D5 = 1544 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D6 = 1545 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D7 = 1546 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D8 = 1547 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N11D9 = 1548 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D1 = 1549 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D2 = 1550 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D3 = 1551 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D4 = 1552 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D5 = 1553 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D6 = 1554 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D7 = 1555 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D8 = 1556 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N12D9 = 1557 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D1 = 1558 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D2 = 1559 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D3 = 1560 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D4 = 1561 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D5 = 1562 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D6 = 1563 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D7 = 1564 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D8 = 1565 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N13D9 = 1566 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D1 = 1567 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D2 = 1568 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D3 = 1569 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D4 = 1570 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D5 = 1571 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D6 = 1572 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D7 = 1573 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D8 = 1574 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N14D9 = 1575 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D1 = 1576 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D2 = 1577 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D3 = 1578 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D4 = 1579 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D5 = 1580 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D6 = 1581 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D7 = 1582 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D8 = 1583 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N15D9 = 1584 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D1 = 1585 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D2 = 1586 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D3 = 1587 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D4 = 1588 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D5 = 1589 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D6 = 1590 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D7 = 1591 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D8 = 1592 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N16D9 = 1593 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D1 = 1594 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D2 = 1595 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D3 = 1596 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D4 = 1597 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D5 = 1598 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D6 = 1599 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D7 = 1600 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D8 = 1601 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N17D9 = 1602 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D1 = 1603 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D2 = 1604 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D3 = 1605 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D4 = 1606 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D5 = 1607 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D6 = 1608 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D7 = 1609 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D8 = 1610 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N18D9 = 1611 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D1 = 1612 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D2 = 1613 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D3 = 1614 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D4 = 1615 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D5 = 1616 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D6 = 1617 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D7 = 1618 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D8 = 1619 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N19D9 = 1620 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D1 = 1621 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D2 = 1622 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D3 = 1623 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D4 = 1624 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D5 = 1625 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D6 = 1626 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D7 = 1627 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D8 = 1628 + INTEGER(IntKi), PARAMETER :: WkDfVxT2N20D9 = 1629 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D1 = 1630 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D2 = 1631 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D3 = 1632 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D4 = 1633 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D5 = 1634 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D6 = 1635 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D7 = 1636 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D8 = 1637 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N01D9 = 1638 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D1 = 1639 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D2 = 1640 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D3 = 1641 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D4 = 1642 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D5 = 1643 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D6 = 1644 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D7 = 1645 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D8 = 1646 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N02D9 = 1647 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D1 = 1648 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D2 = 1649 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D3 = 1650 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D4 = 1651 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D5 = 1652 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D6 = 1653 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D7 = 1654 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D8 = 1655 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N03D9 = 1656 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D1 = 1657 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D2 = 1658 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D3 = 1659 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D4 = 1660 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D5 = 1661 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D6 = 1662 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D7 = 1663 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D8 = 1664 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N04D9 = 1665 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D1 = 1666 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D2 = 1667 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D3 = 1668 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D4 = 1669 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D5 = 1670 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D6 = 1671 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D7 = 1672 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D8 = 1673 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N05D9 = 1674 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D1 = 1675 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D2 = 1676 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D3 = 1677 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D4 = 1678 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D5 = 1679 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D6 = 1680 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D7 = 1681 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D8 = 1682 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N06D9 = 1683 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D1 = 1684 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D2 = 1685 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D3 = 1686 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D4 = 1687 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D5 = 1688 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D6 = 1689 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D7 = 1690 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D8 = 1691 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N07D9 = 1692 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D1 = 1693 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D2 = 1694 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D3 = 1695 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D4 = 1696 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D5 = 1697 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D6 = 1698 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D7 = 1699 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D8 = 1700 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N08D9 = 1701 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D1 = 1702 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D2 = 1703 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D3 = 1704 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D4 = 1705 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D5 = 1706 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D6 = 1707 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D7 = 1708 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D8 = 1709 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N09D9 = 1710 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D1 = 1711 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D2 = 1712 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D3 = 1713 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D4 = 1714 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D5 = 1715 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D6 = 1716 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D7 = 1717 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D8 = 1718 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N10D9 = 1719 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D1 = 1720 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D2 = 1721 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D3 = 1722 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D4 = 1723 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D5 = 1724 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D6 = 1725 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D7 = 1726 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D8 = 1727 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N11D9 = 1728 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D1 = 1729 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D2 = 1730 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D3 = 1731 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D4 = 1732 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D5 = 1733 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D6 = 1734 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D7 = 1735 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D8 = 1736 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N12D9 = 1737 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D1 = 1738 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D2 = 1739 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D3 = 1740 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D4 = 1741 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D5 = 1742 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D6 = 1743 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D7 = 1744 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D8 = 1745 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N13D9 = 1746 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D1 = 1747 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D2 = 1748 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D3 = 1749 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D4 = 1750 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D5 = 1751 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D6 = 1752 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D7 = 1753 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D8 = 1754 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N14D9 = 1755 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D1 = 1756 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D2 = 1757 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D3 = 1758 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D4 = 1759 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D5 = 1760 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D6 = 1761 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D7 = 1762 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D8 = 1763 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N15D9 = 1764 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D1 = 1765 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D2 = 1766 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D3 = 1767 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D4 = 1768 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D5 = 1769 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D6 = 1770 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D7 = 1771 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D8 = 1772 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N16D9 = 1773 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D1 = 1774 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D2 = 1775 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D3 = 1776 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D4 = 1777 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D5 = 1778 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D6 = 1779 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D7 = 1780 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D8 = 1781 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N17D9 = 1782 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D1 = 1783 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D2 = 1784 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D3 = 1785 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D4 = 1786 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D5 = 1787 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D6 = 1788 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D7 = 1789 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D8 = 1790 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N18D9 = 1791 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D1 = 1792 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D2 = 1793 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D3 = 1794 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D4 = 1795 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D5 = 1796 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D6 = 1797 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D7 = 1798 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D8 = 1799 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N19D9 = 1800 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D1 = 1801 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D2 = 1802 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D3 = 1803 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D4 = 1804 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D5 = 1805 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D6 = 1806 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D7 = 1807 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D8 = 1808 + INTEGER(IntKi), PARAMETER :: WkDfVxT3N20D9 = 1809 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D1 = 1810 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D2 = 1811 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D3 = 1812 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D4 = 1813 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D5 = 1814 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D6 = 1815 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D7 = 1816 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D8 = 1817 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N01D9 = 1818 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D1 = 1819 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D2 = 1820 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D3 = 1821 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D4 = 1822 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D5 = 1823 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D6 = 1824 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D7 = 1825 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D8 = 1826 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N02D9 = 1827 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D1 = 1828 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D2 = 1829 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D3 = 1830 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D4 = 1831 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D5 = 1832 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D6 = 1833 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D7 = 1834 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D8 = 1835 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N03D9 = 1836 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D1 = 1837 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D2 = 1838 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D3 = 1839 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D4 = 1840 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D5 = 1841 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D6 = 1842 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D7 = 1843 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D8 = 1844 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N04D9 = 1845 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D1 = 1846 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D2 = 1847 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D3 = 1848 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D4 = 1849 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D5 = 1850 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D6 = 1851 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D7 = 1852 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D8 = 1853 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N05D9 = 1854 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D1 = 1855 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D2 = 1856 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D3 = 1857 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D4 = 1858 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D5 = 1859 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D6 = 1860 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D7 = 1861 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D8 = 1862 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N06D9 = 1863 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D1 = 1864 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D2 = 1865 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D3 = 1866 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D4 = 1867 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D5 = 1868 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D6 = 1869 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D7 = 1870 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D8 = 1871 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N07D9 = 1872 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D1 = 1873 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D2 = 1874 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D3 = 1875 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D4 = 1876 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D5 = 1877 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D6 = 1878 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D7 = 1879 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D8 = 1880 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N08D9 = 1881 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D1 = 1882 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D2 = 1883 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D3 = 1884 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D4 = 1885 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D5 = 1886 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D6 = 1887 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D7 = 1888 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D8 = 1889 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N09D9 = 1890 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D1 = 1891 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D2 = 1892 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D3 = 1893 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D4 = 1894 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D5 = 1895 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D6 = 1896 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D7 = 1897 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D8 = 1898 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N10D9 = 1899 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D1 = 1900 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D2 = 1901 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D3 = 1902 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D4 = 1903 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D5 = 1904 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D6 = 1905 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D7 = 1906 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D8 = 1907 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N11D9 = 1908 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D1 = 1909 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D2 = 1910 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D3 = 1911 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D4 = 1912 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D5 = 1913 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D6 = 1914 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D7 = 1915 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D8 = 1916 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N12D9 = 1917 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D1 = 1918 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D2 = 1919 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D3 = 1920 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D4 = 1921 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D5 = 1922 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D6 = 1923 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D7 = 1924 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D8 = 1925 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N13D9 = 1926 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D1 = 1927 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D2 = 1928 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D3 = 1929 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D4 = 1930 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D5 = 1931 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D6 = 1932 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D7 = 1933 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D8 = 1934 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N14D9 = 1935 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D1 = 1936 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D2 = 1937 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D3 = 1938 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D4 = 1939 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D5 = 1940 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D6 = 1941 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D7 = 1942 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D8 = 1943 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N15D9 = 1944 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D1 = 1945 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D2 = 1946 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D3 = 1947 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D4 = 1948 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D5 = 1949 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D6 = 1950 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D7 = 1951 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D8 = 1952 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N16D9 = 1953 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D1 = 1954 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D2 = 1955 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D3 = 1956 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D4 = 1957 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D5 = 1958 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D6 = 1959 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D7 = 1960 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D8 = 1961 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N17D9 = 1962 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D1 = 1963 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D2 = 1964 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D3 = 1965 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D4 = 1966 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D5 = 1967 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D6 = 1968 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D7 = 1969 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D8 = 1970 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N18D9 = 1971 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D1 = 1972 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D2 = 1973 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D3 = 1974 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D4 = 1975 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D5 = 1976 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D6 = 1977 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D7 = 1978 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D8 = 1979 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N19D9 = 1980 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D1 = 1981 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D2 = 1982 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D3 = 1983 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D4 = 1984 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D5 = 1985 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D6 = 1986 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D7 = 1987 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D8 = 1988 + INTEGER(IntKi), PARAMETER :: WkDfVxT4N20D9 = 1989 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D1 = 1990 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D2 = 1991 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D3 = 1992 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D4 = 1993 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D5 = 1994 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D6 = 1995 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D7 = 1996 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D8 = 1997 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N01D9 = 1998 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D1 = 1999 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D2 = 2000 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D3 = 2001 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D4 = 2002 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D5 = 2003 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D6 = 2004 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D7 = 2005 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D8 = 2006 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N02D9 = 2007 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D1 = 2008 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D2 = 2009 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D3 = 2010 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D4 = 2011 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D5 = 2012 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D6 = 2013 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D7 = 2014 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D8 = 2015 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N03D9 = 2016 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D1 = 2017 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D2 = 2018 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D3 = 2019 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D4 = 2020 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D5 = 2021 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D6 = 2022 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D7 = 2023 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D8 = 2024 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N04D9 = 2025 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D1 = 2026 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D2 = 2027 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D3 = 2028 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D4 = 2029 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D5 = 2030 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D6 = 2031 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D7 = 2032 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D8 = 2033 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N05D9 = 2034 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D1 = 2035 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D2 = 2036 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D3 = 2037 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D4 = 2038 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D5 = 2039 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D6 = 2040 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D7 = 2041 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D8 = 2042 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N06D9 = 2043 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D1 = 2044 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D2 = 2045 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D3 = 2046 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D4 = 2047 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D5 = 2048 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D6 = 2049 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D7 = 2050 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D8 = 2051 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N07D9 = 2052 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D1 = 2053 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D2 = 2054 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D3 = 2055 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D4 = 2056 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D5 = 2057 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D6 = 2058 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D7 = 2059 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D8 = 2060 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N08D9 = 2061 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D1 = 2062 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D2 = 2063 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D3 = 2064 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D4 = 2065 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D5 = 2066 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D6 = 2067 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D7 = 2068 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D8 = 2069 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N09D9 = 2070 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D1 = 2071 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D2 = 2072 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D3 = 2073 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D4 = 2074 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D5 = 2075 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D6 = 2076 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D7 = 2077 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D8 = 2078 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N10D9 = 2079 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D1 = 2080 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D2 = 2081 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D3 = 2082 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D4 = 2083 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D5 = 2084 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D6 = 2085 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D7 = 2086 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D8 = 2087 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N11D9 = 2088 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D1 = 2089 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D2 = 2090 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D3 = 2091 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D4 = 2092 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D5 = 2093 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D6 = 2094 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D7 = 2095 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D8 = 2096 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N12D9 = 2097 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D1 = 2098 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D2 = 2099 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D3 = 2100 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D4 = 2101 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D5 = 2102 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D6 = 2103 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D7 = 2104 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D8 = 2105 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N13D9 = 2106 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D1 = 2107 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D2 = 2108 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D3 = 2109 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D4 = 2110 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D5 = 2111 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D6 = 2112 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D7 = 2113 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D8 = 2114 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N14D9 = 2115 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D1 = 2116 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D2 = 2117 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D3 = 2118 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D4 = 2119 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D5 = 2120 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D6 = 2121 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D7 = 2122 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D8 = 2123 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N15D9 = 2124 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D1 = 2125 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D2 = 2126 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D3 = 2127 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D4 = 2128 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D5 = 2129 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D6 = 2130 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D7 = 2131 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D8 = 2132 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N16D9 = 2133 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D1 = 2134 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D2 = 2135 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D3 = 2136 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D4 = 2137 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D5 = 2138 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D6 = 2139 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D7 = 2140 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D8 = 2141 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N17D9 = 2142 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D1 = 2143 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D2 = 2144 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D3 = 2145 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D4 = 2146 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D5 = 2147 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D6 = 2148 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D7 = 2149 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D8 = 2150 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N18D9 = 2151 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D1 = 2152 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D2 = 2153 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D3 = 2154 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D4 = 2155 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D5 = 2156 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D6 = 2157 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D7 = 2158 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D8 = 2159 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N19D9 = 2160 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D1 = 2161 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D2 = 2162 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D3 = 2163 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D4 = 2164 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D5 = 2165 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D6 = 2166 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D7 = 2167 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D8 = 2168 + INTEGER(IntKi), PARAMETER :: WkDfVxT5N20D9 = 2169 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D1 = 2170 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D2 = 2171 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D3 = 2172 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D4 = 2173 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D5 = 2174 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D6 = 2175 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D7 = 2176 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D8 = 2177 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N01D9 = 2178 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D1 = 2179 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D2 = 2180 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D3 = 2181 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D4 = 2182 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D5 = 2183 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D6 = 2184 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D7 = 2185 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D8 = 2186 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N02D9 = 2187 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D1 = 2188 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D2 = 2189 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D3 = 2190 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D4 = 2191 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D5 = 2192 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D6 = 2193 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D7 = 2194 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D8 = 2195 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N03D9 = 2196 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D1 = 2197 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D2 = 2198 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D3 = 2199 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D4 = 2200 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D5 = 2201 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D6 = 2202 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D7 = 2203 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D8 = 2204 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N04D9 = 2205 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D1 = 2206 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D2 = 2207 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D3 = 2208 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D4 = 2209 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D5 = 2210 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D6 = 2211 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D7 = 2212 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D8 = 2213 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N05D9 = 2214 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D1 = 2215 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D2 = 2216 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D3 = 2217 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D4 = 2218 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D5 = 2219 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D6 = 2220 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D7 = 2221 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D8 = 2222 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N06D9 = 2223 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D1 = 2224 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D2 = 2225 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D3 = 2226 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D4 = 2227 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D5 = 2228 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D6 = 2229 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D7 = 2230 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D8 = 2231 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N07D9 = 2232 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D1 = 2233 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D2 = 2234 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D3 = 2235 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D4 = 2236 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D5 = 2237 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D6 = 2238 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D7 = 2239 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D8 = 2240 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N08D9 = 2241 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D1 = 2242 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D2 = 2243 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D3 = 2244 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D4 = 2245 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D5 = 2246 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D6 = 2247 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D7 = 2248 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D8 = 2249 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N09D9 = 2250 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D1 = 2251 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D2 = 2252 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D3 = 2253 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D4 = 2254 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D5 = 2255 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D6 = 2256 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D7 = 2257 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D8 = 2258 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N10D9 = 2259 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D1 = 2260 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D2 = 2261 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D3 = 2262 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D4 = 2263 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D5 = 2264 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D6 = 2265 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D7 = 2266 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D8 = 2267 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N11D9 = 2268 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D1 = 2269 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D2 = 2270 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D3 = 2271 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D4 = 2272 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D5 = 2273 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D6 = 2274 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D7 = 2275 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D8 = 2276 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N12D9 = 2277 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D1 = 2278 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D2 = 2279 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D3 = 2280 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D4 = 2281 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D5 = 2282 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D6 = 2283 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D7 = 2284 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D8 = 2285 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N13D9 = 2286 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D1 = 2287 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D2 = 2288 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D3 = 2289 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D4 = 2290 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D5 = 2291 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D6 = 2292 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D7 = 2293 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D8 = 2294 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N14D9 = 2295 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D1 = 2296 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D2 = 2297 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D3 = 2298 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D4 = 2299 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D5 = 2300 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D6 = 2301 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D7 = 2302 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D8 = 2303 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N15D9 = 2304 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D1 = 2305 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D2 = 2306 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D3 = 2307 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D4 = 2308 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D5 = 2309 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D6 = 2310 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D7 = 2311 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D8 = 2312 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N16D9 = 2313 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D1 = 2314 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D2 = 2315 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D3 = 2316 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D4 = 2317 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D5 = 2318 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D6 = 2319 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D7 = 2320 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D8 = 2321 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N17D9 = 2322 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D1 = 2323 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D2 = 2324 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D3 = 2325 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D4 = 2326 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D5 = 2327 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D6 = 2328 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D7 = 2329 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D8 = 2330 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N18D9 = 2331 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D1 = 2332 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D2 = 2333 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D3 = 2334 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D4 = 2335 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D5 = 2336 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D6 = 2337 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D7 = 2338 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D8 = 2339 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N19D9 = 2340 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D1 = 2341 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D2 = 2342 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D3 = 2343 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D4 = 2344 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D5 = 2345 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D6 = 2346 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D7 = 2347 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D8 = 2348 + INTEGER(IntKi), PARAMETER :: WkDfVxT6N20D9 = 2349 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D1 = 2350 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D2 = 2351 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D3 = 2352 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D4 = 2353 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D5 = 2354 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D6 = 2355 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D7 = 2356 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D8 = 2357 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N01D9 = 2358 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D1 = 2359 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D2 = 2360 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D3 = 2361 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D4 = 2362 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D5 = 2363 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D6 = 2364 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D7 = 2365 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D8 = 2366 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N02D9 = 2367 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D1 = 2368 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D2 = 2369 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D3 = 2370 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D4 = 2371 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D5 = 2372 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D6 = 2373 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D7 = 2374 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D8 = 2375 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N03D9 = 2376 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D1 = 2377 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D2 = 2378 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D3 = 2379 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D4 = 2380 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D5 = 2381 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D6 = 2382 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D7 = 2383 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D8 = 2384 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N04D9 = 2385 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D1 = 2386 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D2 = 2387 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D3 = 2388 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D4 = 2389 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D5 = 2390 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D6 = 2391 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D7 = 2392 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D8 = 2393 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N05D9 = 2394 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D1 = 2395 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D2 = 2396 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D3 = 2397 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D4 = 2398 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D5 = 2399 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D6 = 2400 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D7 = 2401 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D8 = 2402 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N06D9 = 2403 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D1 = 2404 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D2 = 2405 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D3 = 2406 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D4 = 2407 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D5 = 2408 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D6 = 2409 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D7 = 2410 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D8 = 2411 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N07D9 = 2412 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D1 = 2413 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D2 = 2414 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D3 = 2415 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D4 = 2416 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D5 = 2417 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D6 = 2418 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D7 = 2419 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D8 = 2420 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N08D9 = 2421 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D1 = 2422 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D2 = 2423 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D3 = 2424 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D4 = 2425 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D5 = 2426 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D6 = 2427 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D7 = 2428 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D8 = 2429 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N09D9 = 2430 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D1 = 2431 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D2 = 2432 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D3 = 2433 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D4 = 2434 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D5 = 2435 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D6 = 2436 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D7 = 2437 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D8 = 2438 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N10D9 = 2439 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D1 = 2440 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D2 = 2441 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D3 = 2442 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D4 = 2443 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D5 = 2444 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D6 = 2445 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D7 = 2446 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D8 = 2447 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N11D9 = 2448 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D1 = 2449 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D2 = 2450 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D3 = 2451 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D4 = 2452 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D5 = 2453 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D6 = 2454 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D7 = 2455 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D8 = 2456 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N12D9 = 2457 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D1 = 2458 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D2 = 2459 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D3 = 2460 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D4 = 2461 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D5 = 2462 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D6 = 2463 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D7 = 2464 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D8 = 2465 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N13D9 = 2466 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D1 = 2467 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D2 = 2468 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D3 = 2469 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D4 = 2470 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D5 = 2471 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D6 = 2472 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D7 = 2473 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D8 = 2474 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N14D9 = 2475 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D1 = 2476 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D2 = 2477 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D3 = 2478 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D4 = 2479 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D5 = 2480 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D6 = 2481 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D7 = 2482 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D8 = 2483 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N15D9 = 2484 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D1 = 2485 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D2 = 2486 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D3 = 2487 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D4 = 2488 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D5 = 2489 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D6 = 2490 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D7 = 2491 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D8 = 2492 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N16D9 = 2493 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D1 = 2494 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D2 = 2495 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D3 = 2496 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D4 = 2497 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D5 = 2498 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D6 = 2499 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D7 = 2500 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D8 = 2501 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N17D9 = 2502 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D1 = 2503 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D2 = 2504 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D3 = 2505 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D4 = 2506 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D5 = 2507 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D6 = 2508 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D7 = 2509 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D8 = 2510 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N18D9 = 2511 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D1 = 2512 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D2 = 2513 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D3 = 2514 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D4 = 2515 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D5 = 2516 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D6 = 2517 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D7 = 2518 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D8 = 2519 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N19D9 = 2520 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D1 = 2521 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D2 = 2522 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D3 = 2523 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D4 = 2524 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D5 = 2525 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D6 = 2526 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D7 = 2527 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D8 = 2528 + INTEGER(IntKi), PARAMETER :: WkDfVxT7N20D9 = 2529 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D1 = 2530 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D2 = 2531 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D3 = 2532 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D4 = 2533 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D5 = 2534 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D6 = 2535 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D7 = 2536 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D8 = 2537 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N01D9 = 2538 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D1 = 2539 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D2 = 2540 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D3 = 2541 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D4 = 2542 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D5 = 2543 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D6 = 2544 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D7 = 2545 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D8 = 2546 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N02D9 = 2547 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D1 = 2548 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D2 = 2549 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D3 = 2550 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D4 = 2551 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D5 = 2552 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D6 = 2553 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D7 = 2554 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D8 = 2555 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N03D9 = 2556 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D1 = 2557 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D2 = 2558 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D3 = 2559 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D4 = 2560 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D5 = 2561 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D6 = 2562 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D7 = 2563 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D8 = 2564 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N04D9 = 2565 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D1 = 2566 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D2 = 2567 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D3 = 2568 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D4 = 2569 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D5 = 2570 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D6 = 2571 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D7 = 2572 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D8 = 2573 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N05D9 = 2574 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D1 = 2575 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D2 = 2576 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D3 = 2577 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D4 = 2578 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D5 = 2579 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D6 = 2580 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D7 = 2581 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D8 = 2582 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N06D9 = 2583 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D1 = 2584 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D2 = 2585 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D3 = 2586 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D4 = 2587 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D5 = 2588 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D6 = 2589 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D7 = 2590 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D8 = 2591 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N07D9 = 2592 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D1 = 2593 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D2 = 2594 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D3 = 2595 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D4 = 2596 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D5 = 2597 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D6 = 2598 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D7 = 2599 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D8 = 2600 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N08D9 = 2601 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D1 = 2602 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D2 = 2603 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D3 = 2604 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D4 = 2605 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D5 = 2606 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D6 = 2607 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D7 = 2608 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D8 = 2609 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N09D9 = 2610 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D1 = 2611 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D2 = 2612 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D3 = 2613 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D4 = 2614 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D5 = 2615 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D6 = 2616 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D7 = 2617 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D8 = 2618 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N10D9 = 2619 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D1 = 2620 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D2 = 2621 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D3 = 2622 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D4 = 2623 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D5 = 2624 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D6 = 2625 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D7 = 2626 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D8 = 2627 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N11D9 = 2628 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D1 = 2629 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D2 = 2630 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D3 = 2631 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D4 = 2632 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D5 = 2633 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D6 = 2634 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D7 = 2635 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D8 = 2636 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N12D9 = 2637 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D1 = 2638 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D2 = 2639 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D3 = 2640 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D4 = 2641 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D5 = 2642 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D6 = 2643 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D7 = 2644 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D8 = 2645 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N13D9 = 2646 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D1 = 2647 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D2 = 2648 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D3 = 2649 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D4 = 2650 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D5 = 2651 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D6 = 2652 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D7 = 2653 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D8 = 2654 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N14D9 = 2655 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D1 = 2656 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D2 = 2657 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D3 = 2658 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D4 = 2659 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D5 = 2660 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D6 = 2661 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D7 = 2662 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D8 = 2663 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N15D9 = 2664 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D1 = 2665 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D2 = 2666 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D3 = 2667 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D4 = 2668 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D5 = 2669 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D6 = 2670 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D7 = 2671 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D8 = 2672 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N16D9 = 2673 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D1 = 2674 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D2 = 2675 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D3 = 2676 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D4 = 2677 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D5 = 2678 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D6 = 2679 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D7 = 2680 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D8 = 2681 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N17D9 = 2682 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D1 = 2683 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D2 = 2684 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D3 = 2685 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D4 = 2686 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D5 = 2687 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D6 = 2688 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D7 = 2689 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D8 = 2690 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N18D9 = 2691 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D1 = 2692 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D2 = 2693 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D3 = 2694 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D4 = 2695 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D5 = 2696 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D6 = 2697 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D7 = 2698 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D8 = 2699 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N19D9 = 2700 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D1 = 2701 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D2 = 2702 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D3 = 2703 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D4 = 2704 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D5 = 2705 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D6 = 2706 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D7 = 2707 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D8 = 2708 + INTEGER(IntKi), PARAMETER :: WkDfVxT8N20D9 = 2709 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D1 = 2710 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D2 = 2711 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D3 = 2712 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D4 = 2713 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D5 = 2714 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D6 = 2715 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D7 = 2716 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D8 = 2717 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N01D9 = 2718 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D1 = 2719 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D2 = 2720 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D3 = 2721 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D4 = 2722 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D5 = 2723 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D6 = 2724 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D7 = 2725 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D8 = 2726 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N02D9 = 2727 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D1 = 2728 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D2 = 2729 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D3 = 2730 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D4 = 2731 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D5 = 2732 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D6 = 2733 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D7 = 2734 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D8 = 2735 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N03D9 = 2736 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D1 = 2737 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D2 = 2738 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D3 = 2739 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D4 = 2740 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D5 = 2741 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D6 = 2742 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D7 = 2743 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D8 = 2744 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N04D9 = 2745 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D1 = 2746 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D2 = 2747 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D3 = 2748 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D4 = 2749 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D5 = 2750 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D6 = 2751 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D7 = 2752 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D8 = 2753 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N05D9 = 2754 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D1 = 2755 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D2 = 2756 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D3 = 2757 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D4 = 2758 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D5 = 2759 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D6 = 2760 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D7 = 2761 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D8 = 2762 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N06D9 = 2763 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D1 = 2764 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D2 = 2765 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D3 = 2766 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D4 = 2767 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D5 = 2768 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D6 = 2769 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D7 = 2770 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D8 = 2771 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N07D9 = 2772 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D1 = 2773 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D2 = 2774 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D3 = 2775 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D4 = 2776 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D5 = 2777 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D6 = 2778 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D7 = 2779 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D8 = 2780 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N08D9 = 2781 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D1 = 2782 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D2 = 2783 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D3 = 2784 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D4 = 2785 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D5 = 2786 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D6 = 2787 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D7 = 2788 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D8 = 2789 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N09D9 = 2790 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D1 = 2791 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D2 = 2792 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D3 = 2793 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D4 = 2794 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D5 = 2795 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D6 = 2796 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D7 = 2797 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D8 = 2798 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N10D9 = 2799 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D1 = 2800 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D2 = 2801 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D3 = 2802 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D4 = 2803 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D5 = 2804 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D6 = 2805 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D7 = 2806 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D8 = 2807 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N11D9 = 2808 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D1 = 2809 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D2 = 2810 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D3 = 2811 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D4 = 2812 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D5 = 2813 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D6 = 2814 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D7 = 2815 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D8 = 2816 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N12D9 = 2817 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D1 = 2818 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D2 = 2819 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D3 = 2820 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D4 = 2821 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D5 = 2822 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D6 = 2823 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D7 = 2824 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D8 = 2825 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N13D9 = 2826 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D1 = 2827 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D2 = 2828 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D3 = 2829 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D4 = 2830 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D5 = 2831 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D6 = 2832 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D7 = 2833 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D8 = 2834 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N14D9 = 2835 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D1 = 2836 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D2 = 2837 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D3 = 2838 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D4 = 2839 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D5 = 2840 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D6 = 2841 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D7 = 2842 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D8 = 2843 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N15D9 = 2844 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D1 = 2845 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D2 = 2846 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D3 = 2847 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D4 = 2848 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D5 = 2849 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D6 = 2850 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D7 = 2851 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D8 = 2852 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N16D9 = 2853 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D1 = 2854 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D2 = 2855 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D3 = 2856 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D4 = 2857 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D5 = 2858 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D6 = 2859 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D7 = 2860 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D8 = 2861 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N17D9 = 2862 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D1 = 2863 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D2 = 2864 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D3 = 2865 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D4 = 2866 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D5 = 2867 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D6 = 2868 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D7 = 2869 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D8 = 2870 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N18D9 = 2871 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D1 = 2872 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D2 = 2873 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D3 = 2874 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D4 = 2875 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D5 = 2876 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D6 = 2877 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D7 = 2878 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D8 = 2879 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N19D9 = 2880 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D1 = 2881 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D2 = 2882 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D3 = 2883 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D4 = 2884 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D5 = 2885 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D6 = 2886 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D7 = 2887 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D8 = 2888 + INTEGER(IntKi), PARAMETER :: WkDfVxT9N20D9 = 2889 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D1 = 2890 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D2 = 2891 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D3 = 2892 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D4 = 2893 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D5 = 2894 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D6 = 2895 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D7 = 2896 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D8 = 2897 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N01D9 = 2898 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D1 = 2899 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D2 = 2900 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D3 = 2901 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D4 = 2902 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D5 = 2903 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D6 = 2904 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D7 = 2905 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D8 = 2906 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N02D9 = 2907 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D1 = 2908 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D2 = 2909 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D3 = 2910 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D4 = 2911 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D5 = 2912 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D6 = 2913 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D7 = 2914 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D8 = 2915 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N03D9 = 2916 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D1 = 2917 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D2 = 2918 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D3 = 2919 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D4 = 2920 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D5 = 2921 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D6 = 2922 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D7 = 2923 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D8 = 2924 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N04D9 = 2925 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D1 = 2926 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D2 = 2927 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D3 = 2928 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D4 = 2929 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D5 = 2930 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D6 = 2931 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D7 = 2932 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D8 = 2933 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N05D9 = 2934 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D1 = 2935 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D2 = 2936 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D3 = 2937 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D4 = 2938 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D5 = 2939 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D6 = 2940 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D7 = 2941 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D8 = 2942 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N06D9 = 2943 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D1 = 2944 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D2 = 2945 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D3 = 2946 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D4 = 2947 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D5 = 2948 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D6 = 2949 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D7 = 2950 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D8 = 2951 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N07D9 = 2952 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D1 = 2953 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D2 = 2954 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D3 = 2955 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D4 = 2956 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D5 = 2957 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D6 = 2958 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D7 = 2959 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D8 = 2960 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N08D9 = 2961 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D1 = 2962 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D2 = 2963 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D3 = 2964 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D4 = 2965 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D5 = 2966 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D6 = 2967 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D7 = 2968 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D8 = 2969 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N09D9 = 2970 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D1 = 2971 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D2 = 2972 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D3 = 2973 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D4 = 2974 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D5 = 2975 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D6 = 2976 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D7 = 2977 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D8 = 2978 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N10D9 = 2979 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D1 = 2980 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D2 = 2981 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D3 = 2982 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D4 = 2983 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D5 = 2984 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D6 = 2985 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D7 = 2986 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D8 = 2987 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N11D9 = 2988 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D1 = 2989 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D2 = 2990 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D3 = 2991 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D4 = 2992 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D5 = 2993 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D6 = 2994 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D7 = 2995 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D8 = 2996 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N12D9 = 2997 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D1 = 2998 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D2 = 2999 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D3 = 3000 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D4 = 3001 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D5 = 3002 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D6 = 3003 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D7 = 3004 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D8 = 3005 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N13D9 = 3006 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D1 = 3007 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D2 = 3008 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D3 = 3009 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D4 = 3010 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D5 = 3011 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D6 = 3012 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D7 = 3013 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D8 = 3014 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N14D9 = 3015 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D1 = 3016 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D2 = 3017 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D3 = 3018 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D4 = 3019 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D5 = 3020 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D6 = 3021 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D7 = 3022 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D8 = 3023 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N15D9 = 3024 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D1 = 3025 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D2 = 3026 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D3 = 3027 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D4 = 3028 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D5 = 3029 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D6 = 3030 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D7 = 3031 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D8 = 3032 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N16D9 = 3033 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D1 = 3034 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D2 = 3035 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D3 = 3036 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D4 = 3037 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D5 = 3038 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D6 = 3039 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D7 = 3040 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D8 = 3041 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N17D9 = 3042 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D1 = 3043 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D2 = 3044 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D3 = 3045 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D4 = 3046 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D5 = 3047 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D6 = 3048 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D7 = 3049 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D8 = 3050 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N18D9 = 3051 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D1 = 3052 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D2 = 3053 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D3 = 3054 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D4 = 3055 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D5 = 3056 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D6 = 3057 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D7 = 3058 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D8 = 3059 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N19D9 = 3060 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D1 = 3061 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D2 = 3062 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D3 = 3063 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D4 = 3064 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D5 = 3065 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D6 = 3066 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D7 = 3067 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D8 = 3068 + INTEGER(IntKi), PARAMETER :: WkDfVrT1N20D9 = 3069 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D1 = 3070 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D2 = 3071 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D3 = 3072 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D4 = 3073 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D5 = 3074 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D6 = 3075 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D7 = 3076 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D8 = 3077 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N01D9 = 3078 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D1 = 3079 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D2 = 3080 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D3 = 3081 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D4 = 3082 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D5 = 3083 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D6 = 3084 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D7 = 3085 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D8 = 3086 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N02D9 = 3087 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D1 = 3088 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D2 = 3089 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D3 = 3090 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D4 = 3091 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D5 = 3092 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D6 = 3093 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D7 = 3094 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D8 = 3095 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N03D9 = 3096 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D1 = 3097 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D2 = 3098 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D3 = 3099 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D4 = 3100 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D5 = 3101 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D6 = 3102 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D7 = 3103 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D8 = 3104 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N04D9 = 3105 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D1 = 3106 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D2 = 3107 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D3 = 3108 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D4 = 3109 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D5 = 3110 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D6 = 3111 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D7 = 3112 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D8 = 3113 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N05D9 = 3114 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D1 = 3115 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D2 = 3116 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D3 = 3117 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D4 = 3118 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D5 = 3119 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D6 = 3120 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D7 = 3121 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D8 = 3122 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N06D9 = 3123 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D1 = 3124 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D2 = 3125 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D3 = 3126 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D4 = 3127 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D5 = 3128 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D6 = 3129 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D7 = 3130 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D8 = 3131 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N07D9 = 3132 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D1 = 3133 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D2 = 3134 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D3 = 3135 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D4 = 3136 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D5 = 3137 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D6 = 3138 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D7 = 3139 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D8 = 3140 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N08D9 = 3141 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D1 = 3142 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D2 = 3143 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D3 = 3144 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D4 = 3145 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D5 = 3146 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D6 = 3147 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D7 = 3148 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D8 = 3149 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N09D9 = 3150 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D1 = 3151 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D2 = 3152 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D3 = 3153 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D4 = 3154 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D5 = 3155 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D6 = 3156 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D7 = 3157 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D8 = 3158 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N10D9 = 3159 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D1 = 3160 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D2 = 3161 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D3 = 3162 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D4 = 3163 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D5 = 3164 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D6 = 3165 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D7 = 3166 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D8 = 3167 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N11D9 = 3168 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D1 = 3169 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D2 = 3170 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D3 = 3171 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D4 = 3172 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D5 = 3173 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D6 = 3174 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D7 = 3175 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D8 = 3176 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N12D9 = 3177 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D1 = 3178 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D2 = 3179 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D3 = 3180 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D4 = 3181 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D5 = 3182 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D6 = 3183 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D7 = 3184 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D8 = 3185 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N13D9 = 3186 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D1 = 3187 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D2 = 3188 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D3 = 3189 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D4 = 3190 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D5 = 3191 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D6 = 3192 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D7 = 3193 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D8 = 3194 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N14D9 = 3195 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D1 = 3196 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D2 = 3197 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D3 = 3198 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D4 = 3199 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D5 = 3200 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D6 = 3201 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D7 = 3202 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D8 = 3203 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N15D9 = 3204 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D1 = 3205 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D2 = 3206 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D3 = 3207 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D4 = 3208 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D5 = 3209 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D6 = 3210 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D7 = 3211 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D8 = 3212 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N16D9 = 3213 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D1 = 3214 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D2 = 3215 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D3 = 3216 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D4 = 3217 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D5 = 3218 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D6 = 3219 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D7 = 3220 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D8 = 3221 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N17D9 = 3222 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D1 = 3223 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D2 = 3224 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D3 = 3225 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D4 = 3226 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D5 = 3227 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D6 = 3228 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D7 = 3229 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D8 = 3230 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N18D9 = 3231 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D1 = 3232 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D2 = 3233 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D3 = 3234 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D4 = 3235 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D5 = 3236 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D6 = 3237 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D7 = 3238 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D8 = 3239 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N19D9 = 3240 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D1 = 3241 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D2 = 3242 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D3 = 3243 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D4 = 3244 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D5 = 3245 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D6 = 3246 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D7 = 3247 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D8 = 3248 + INTEGER(IntKi), PARAMETER :: WkDfVrT2N20D9 = 3249 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D1 = 3250 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D2 = 3251 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D3 = 3252 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D4 = 3253 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D5 = 3254 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D6 = 3255 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D7 = 3256 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D8 = 3257 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N01D9 = 3258 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D1 = 3259 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D2 = 3260 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D3 = 3261 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D4 = 3262 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D5 = 3263 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D6 = 3264 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D7 = 3265 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D8 = 3266 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N02D9 = 3267 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D1 = 3268 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D2 = 3269 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D3 = 3270 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D4 = 3271 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D5 = 3272 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D6 = 3273 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D7 = 3274 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D8 = 3275 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N03D9 = 3276 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D1 = 3277 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D2 = 3278 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D3 = 3279 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D4 = 3280 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D5 = 3281 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D6 = 3282 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D7 = 3283 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D8 = 3284 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N04D9 = 3285 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D1 = 3286 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D2 = 3287 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D3 = 3288 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D4 = 3289 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D5 = 3290 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D6 = 3291 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D7 = 3292 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D8 = 3293 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N05D9 = 3294 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D1 = 3295 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D2 = 3296 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D3 = 3297 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D4 = 3298 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D5 = 3299 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D6 = 3300 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D7 = 3301 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D8 = 3302 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N06D9 = 3303 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D1 = 3304 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D2 = 3305 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D3 = 3306 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D4 = 3307 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D5 = 3308 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D6 = 3309 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D7 = 3310 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D8 = 3311 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N07D9 = 3312 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D1 = 3313 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D2 = 3314 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D3 = 3315 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D4 = 3316 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D5 = 3317 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D6 = 3318 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D7 = 3319 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D8 = 3320 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N08D9 = 3321 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D1 = 3322 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D2 = 3323 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D3 = 3324 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D4 = 3325 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D5 = 3326 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D6 = 3327 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D7 = 3328 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D8 = 3329 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N09D9 = 3330 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D1 = 3331 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D2 = 3332 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D3 = 3333 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D4 = 3334 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D5 = 3335 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D6 = 3336 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D7 = 3337 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D8 = 3338 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N10D9 = 3339 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D1 = 3340 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D2 = 3341 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D3 = 3342 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D4 = 3343 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D5 = 3344 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D6 = 3345 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D7 = 3346 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D8 = 3347 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N11D9 = 3348 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D1 = 3349 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D2 = 3350 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D3 = 3351 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D4 = 3352 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D5 = 3353 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D6 = 3354 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D7 = 3355 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D8 = 3356 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N12D9 = 3357 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D1 = 3358 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D2 = 3359 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D3 = 3360 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D4 = 3361 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D5 = 3362 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D6 = 3363 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D7 = 3364 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D8 = 3365 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N13D9 = 3366 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D1 = 3367 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D2 = 3368 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D3 = 3369 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D4 = 3370 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D5 = 3371 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D6 = 3372 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D7 = 3373 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D8 = 3374 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N14D9 = 3375 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D1 = 3376 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D2 = 3377 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D3 = 3378 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D4 = 3379 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D5 = 3380 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D6 = 3381 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D7 = 3382 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D8 = 3383 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N15D9 = 3384 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D1 = 3385 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D2 = 3386 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D3 = 3387 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D4 = 3388 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D5 = 3389 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D6 = 3390 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D7 = 3391 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D8 = 3392 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N16D9 = 3393 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D1 = 3394 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D2 = 3395 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D3 = 3396 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D4 = 3397 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D5 = 3398 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D6 = 3399 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D7 = 3400 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D8 = 3401 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N17D9 = 3402 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D1 = 3403 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D2 = 3404 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D3 = 3405 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D4 = 3406 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D5 = 3407 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D6 = 3408 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D7 = 3409 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D8 = 3410 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N18D9 = 3411 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D1 = 3412 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D2 = 3413 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D3 = 3414 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D4 = 3415 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D5 = 3416 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D6 = 3417 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D7 = 3418 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D8 = 3419 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N19D9 = 3420 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D1 = 3421 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D2 = 3422 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D3 = 3423 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D4 = 3424 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D5 = 3425 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D6 = 3426 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D7 = 3427 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D8 = 3428 + INTEGER(IntKi), PARAMETER :: WkDfVrT3N20D9 = 3429 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D1 = 3430 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D2 = 3431 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D3 = 3432 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D4 = 3433 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D5 = 3434 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D6 = 3435 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D7 = 3436 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D8 = 3437 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N01D9 = 3438 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D1 = 3439 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D2 = 3440 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D3 = 3441 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D4 = 3442 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D5 = 3443 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D6 = 3444 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D7 = 3445 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D8 = 3446 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N02D9 = 3447 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D1 = 3448 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D2 = 3449 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D3 = 3450 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D4 = 3451 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D5 = 3452 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D6 = 3453 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D7 = 3454 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D8 = 3455 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N03D9 = 3456 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D1 = 3457 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D2 = 3458 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D3 = 3459 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D4 = 3460 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D5 = 3461 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D6 = 3462 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D7 = 3463 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D8 = 3464 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N04D9 = 3465 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D1 = 3466 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D2 = 3467 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D3 = 3468 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D4 = 3469 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D5 = 3470 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D6 = 3471 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D7 = 3472 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D8 = 3473 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N05D9 = 3474 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D1 = 3475 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D2 = 3476 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D3 = 3477 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D4 = 3478 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D5 = 3479 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D6 = 3480 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D7 = 3481 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D8 = 3482 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N06D9 = 3483 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D1 = 3484 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D2 = 3485 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D3 = 3486 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D4 = 3487 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D5 = 3488 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D6 = 3489 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D7 = 3490 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D8 = 3491 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N07D9 = 3492 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D1 = 3493 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D2 = 3494 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D3 = 3495 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D4 = 3496 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D5 = 3497 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D6 = 3498 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D7 = 3499 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D8 = 3500 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N08D9 = 3501 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D1 = 3502 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D2 = 3503 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D3 = 3504 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D4 = 3505 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D5 = 3506 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D6 = 3507 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D7 = 3508 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D8 = 3509 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N09D9 = 3510 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D1 = 3511 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D2 = 3512 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D3 = 3513 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D4 = 3514 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D5 = 3515 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D6 = 3516 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D7 = 3517 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D8 = 3518 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N10D9 = 3519 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D1 = 3520 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D2 = 3521 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D3 = 3522 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D4 = 3523 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D5 = 3524 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D6 = 3525 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D7 = 3526 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D8 = 3527 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N11D9 = 3528 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D1 = 3529 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D2 = 3530 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D3 = 3531 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D4 = 3532 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D5 = 3533 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D6 = 3534 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D7 = 3535 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D8 = 3536 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N12D9 = 3537 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D1 = 3538 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D2 = 3539 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D3 = 3540 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D4 = 3541 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D5 = 3542 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D6 = 3543 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D7 = 3544 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D8 = 3545 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N13D9 = 3546 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D1 = 3547 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D2 = 3548 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D3 = 3549 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D4 = 3550 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D5 = 3551 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D6 = 3552 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D7 = 3553 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D8 = 3554 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N14D9 = 3555 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D1 = 3556 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D2 = 3557 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D3 = 3558 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D4 = 3559 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D5 = 3560 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D6 = 3561 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D7 = 3562 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D8 = 3563 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N15D9 = 3564 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D1 = 3565 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D2 = 3566 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D3 = 3567 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D4 = 3568 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D5 = 3569 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D6 = 3570 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D7 = 3571 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D8 = 3572 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N16D9 = 3573 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D1 = 3574 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D2 = 3575 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D3 = 3576 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D4 = 3577 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D5 = 3578 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D6 = 3579 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D7 = 3580 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D8 = 3581 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N17D9 = 3582 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D1 = 3583 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D2 = 3584 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D3 = 3585 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D4 = 3586 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D5 = 3587 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D6 = 3588 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D7 = 3589 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D8 = 3590 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N18D9 = 3591 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D1 = 3592 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D2 = 3593 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D3 = 3594 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D4 = 3595 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D5 = 3596 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D6 = 3597 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D7 = 3598 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D8 = 3599 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N19D9 = 3600 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D1 = 3601 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D2 = 3602 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D3 = 3603 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D4 = 3604 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D5 = 3605 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D6 = 3606 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D7 = 3607 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D8 = 3608 + INTEGER(IntKi), PARAMETER :: WkDfVrT4N20D9 = 3609 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D1 = 3610 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D2 = 3611 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D3 = 3612 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D4 = 3613 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D5 = 3614 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D6 = 3615 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D7 = 3616 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D8 = 3617 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N01D9 = 3618 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D1 = 3619 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D2 = 3620 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D3 = 3621 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D4 = 3622 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D5 = 3623 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D6 = 3624 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D7 = 3625 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D8 = 3626 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N02D9 = 3627 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D1 = 3628 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D2 = 3629 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D3 = 3630 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D4 = 3631 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D5 = 3632 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D6 = 3633 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D7 = 3634 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D8 = 3635 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N03D9 = 3636 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D1 = 3637 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D2 = 3638 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D3 = 3639 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D4 = 3640 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D5 = 3641 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D6 = 3642 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D7 = 3643 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D8 = 3644 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N04D9 = 3645 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D1 = 3646 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D2 = 3647 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D3 = 3648 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D4 = 3649 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D5 = 3650 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D6 = 3651 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D7 = 3652 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D8 = 3653 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N05D9 = 3654 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D1 = 3655 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D2 = 3656 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D3 = 3657 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D4 = 3658 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D5 = 3659 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D6 = 3660 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D7 = 3661 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D8 = 3662 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N06D9 = 3663 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D1 = 3664 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D2 = 3665 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D3 = 3666 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D4 = 3667 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D5 = 3668 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D6 = 3669 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D7 = 3670 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D8 = 3671 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N07D9 = 3672 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D1 = 3673 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D2 = 3674 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D3 = 3675 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D4 = 3676 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D5 = 3677 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D6 = 3678 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D7 = 3679 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D8 = 3680 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N08D9 = 3681 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D1 = 3682 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D2 = 3683 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D3 = 3684 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D4 = 3685 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D5 = 3686 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D6 = 3687 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D7 = 3688 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D8 = 3689 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N09D9 = 3690 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D1 = 3691 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D2 = 3692 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D3 = 3693 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D4 = 3694 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D5 = 3695 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D6 = 3696 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D7 = 3697 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D8 = 3698 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N10D9 = 3699 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D1 = 3700 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D2 = 3701 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D3 = 3702 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D4 = 3703 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D5 = 3704 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D6 = 3705 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D7 = 3706 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D8 = 3707 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N11D9 = 3708 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D1 = 3709 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D2 = 3710 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D3 = 3711 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D4 = 3712 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D5 = 3713 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D6 = 3714 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D7 = 3715 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D8 = 3716 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N12D9 = 3717 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D1 = 3718 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D2 = 3719 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D3 = 3720 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D4 = 3721 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D5 = 3722 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D6 = 3723 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D7 = 3724 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D8 = 3725 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N13D9 = 3726 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D1 = 3727 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D2 = 3728 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D3 = 3729 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D4 = 3730 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D5 = 3731 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D6 = 3732 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D7 = 3733 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D8 = 3734 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N14D9 = 3735 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D1 = 3736 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D2 = 3737 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D3 = 3738 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D4 = 3739 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D5 = 3740 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D6 = 3741 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D7 = 3742 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D8 = 3743 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N15D9 = 3744 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D1 = 3745 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D2 = 3746 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D3 = 3747 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D4 = 3748 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D5 = 3749 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D6 = 3750 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D7 = 3751 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D8 = 3752 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N16D9 = 3753 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D1 = 3754 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D2 = 3755 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D3 = 3756 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D4 = 3757 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D5 = 3758 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D6 = 3759 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D7 = 3760 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D8 = 3761 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N17D9 = 3762 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D1 = 3763 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D2 = 3764 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D3 = 3765 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D4 = 3766 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D5 = 3767 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D6 = 3768 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D7 = 3769 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D8 = 3770 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N18D9 = 3771 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D1 = 3772 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D2 = 3773 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D3 = 3774 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D4 = 3775 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D5 = 3776 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D6 = 3777 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D7 = 3778 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D8 = 3779 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N19D9 = 3780 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D1 = 3781 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D2 = 3782 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D3 = 3783 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D4 = 3784 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D5 = 3785 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D6 = 3786 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D7 = 3787 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D8 = 3788 + INTEGER(IntKi), PARAMETER :: WkDfVrT5N20D9 = 3789 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D1 = 3790 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D2 = 3791 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D3 = 3792 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D4 = 3793 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D5 = 3794 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D6 = 3795 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D7 = 3796 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D8 = 3797 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N01D9 = 3798 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D1 = 3799 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D2 = 3800 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D3 = 3801 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D4 = 3802 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D5 = 3803 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D6 = 3804 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D7 = 3805 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D8 = 3806 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N02D9 = 3807 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D1 = 3808 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D2 = 3809 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D3 = 3810 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D4 = 3811 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D5 = 3812 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D6 = 3813 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D7 = 3814 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D8 = 3815 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N03D9 = 3816 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D1 = 3817 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D2 = 3818 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D3 = 3819 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D4 = 3820 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D5 = 3821 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D6 = 3822 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D7 = 3823 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D8 = 3824 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N04D9 = 3825 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D1 = 3826 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D2 = 3827 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D3 = 3828 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D4 = 3829 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D5 = 3830 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D6 = 3831 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D7 = 3832 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D8 = 3833 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N05D9 = 3834 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D1 = 3835 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D2 = 3836 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D3 = 3837 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D4 = 3838 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D5 = 3839 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D6 = 3840 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D7 = 3841 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D8 = 3842 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N06D9 = 3843 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D1 = 3844 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D2 = 3845 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D3 = 3846 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D4 = 3847 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D5 = 3848 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D6 = 3849 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D7 = 3850 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D8 = 3851 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N07D9 = 3852 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D1 = 3853 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D2 = 3854 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D3 = 3855 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D4 = 3856 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D5 = 3857 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D6 = 3858 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D7 = 3859 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D8 = 3860 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N08D9 = 3861 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D1 = 3862 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D2 = 3863 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D3 = 3864 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D4 = 3865 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D5 = 3866 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D6 = 3867 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D7 = 3868 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D8 = 3869 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N09D9 = 3870 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D1 = 3871 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D2 = 3872 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D3 = 3873 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D4 = 3874 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D5 = 3875 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D6 = 3876 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D7 = 3877 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D8 = 3878 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N10D9 = 3879 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D1 = 3880 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D2 = 3881 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D3 = 3882 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D4 = 3883 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D5 = 3884 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D6 = 3885 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D7 = 3886 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D8 = 3887 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N11D9 = 3888 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D1 = 3889 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D2 = 3890 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D3 = 3891 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D4 = 3892 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D5 = 3893 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D6 = 3894 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D7 = 3895 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D8 = 3896 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N12D9 = 3897 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D1 = 3898 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D2 = 3899 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D3 = 3900 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D4 = 3901 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D5 = 3902 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D6 = 3903 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D7 = 3904 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D8 = 3905 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N13D9 = 3906 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D1 = 3907 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D2 = 3908 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D3 = 3909 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D4 = 3910 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D5 = 3911 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D6 = 3912 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D7 = 3913 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D8 = 3914 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N14D9 = 3915 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D1 = 3916 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D2 = 3917 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D3 = 3918 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D4 = 3919 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D5 = 3920 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D6 = 3921 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D7 = 3922 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D8 = 3923 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N15D9 = 3924 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D1 = 3925 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D2 = 3926 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D3 = 3927 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D4 = 3928 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D5 = 3929 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D6 = 3930 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D7 = 3931 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D8 = 3932 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N16D9 = 3933 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D1 = 3934 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D2 = 3935 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D3 = 3936 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D4 = 3937 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D5 = 3938 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D6 = 3939 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D7 = 3940 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D8 = 3941 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N17D9 = 3942 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D1 = 3943 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D2 = 3944 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D3 = 3945 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D4 = 3946 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D5 = 3947 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D6 = 3948 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D7 = 3949 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D8 = 3950 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N18D9 = 3951 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D1 = 3952 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D2 = 3953 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D3 = 3954 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D4 = 3955 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D5 = 3956 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D6 = 3957 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D7 = 3958 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D8 = 3959 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N19D9 = 3960 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D1 = 3961 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D2 = 3962 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D3 = 3963 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D4 = 3964 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D5 = 3965 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D6 = 3966 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D7 = 3967 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D8 = 3968 + INTEGER(IntKi), PARAMETER :: WkDfVrT6N20D9 = 3969 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D1 = 3970 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D2 = 3971 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D3 = 3972 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D4 = 3973 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D5 = 3974 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D6 = 3975 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D7 = 3976 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D8 = 3977 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N01D9 = 3978 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D1 = 3979 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D2 = 3980 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D3 = 3981 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D4 = 3982 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D5 = 3983 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D6 = 3984 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D7 = 3985 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D8 = 3986 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N02D9 = 3987 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D1 = 3988 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D2 = 3989 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D3 = 3990 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D4 = 3991 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D5 = 3992 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D6 = 3993 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D7 = 3994 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D8 = 3995 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N03D9 = 3996 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D1 = 3997 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D2 = 3998 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D3 = 3999 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D4 = 4000 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D5 = 4001 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D6 = 4002 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D7 = 4003 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D8 = 4004 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N04D9 = 4005 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D1 = 4006 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D2 = 4007 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D3 = 4008 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D4 = 4009 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D5 = 4010 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D6 = 4011 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D7 = 4012 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D8 = 4013 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N05D9 = 4014 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D1 = 4015 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D2 = 4016 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D3 = 4017 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D4 = 4018 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D5 = 4019 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D6 = 4020 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D7 = 4021 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D8 = 4022 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N06D9 = 4023 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D1 = 4024 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D2 = 4025 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D3 = 4026 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D4 = 4027 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D5 = 4028 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D6 = 4029 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D7 = 4030 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D8 = 4031 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N07D9 = 4032 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D1 = 4033 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D2 = 4034 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D3 = 4035 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D4 = 4036 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D5 = 4037 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D6 = 4038 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D7 = 4039 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D8 = 4040 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N08D9 = 4041 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D1 = 4042 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D2 = 4043 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D3 = 4044 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D4 = 4045 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D5 = 4046 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D6 = 4047 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D7 = 4048 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D8 = 4049 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N09D9 = 4050 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D1 = 4051 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D2 = 4052 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D3 = 4053 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D4 = 4054 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D5 = 4055 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D6 = 4056 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D7 = 4057 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D8 = 4058 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N10D9 = 4059 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D1 = 4060 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D2 = 4061 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D3 = 4062 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D4 = 4063 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D5 = 4064 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D6 = 4065 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D7 = 4066 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D8 = 4067 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N11D9 = 4068 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D1 = 4069 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D2 = 4070 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D3 = 4071 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D4 = 4072 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D5 = 4073 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D6 = 4074 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D7 = 4075 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D8 = 4076 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N12D9 = 4077 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D1 = 4078 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D2 = 4079 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D3 = 4080 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D4 = 4081 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D5 = 4082 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D6 = 4083 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D7 = 4084 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D8 = 4085 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N13D9 = 4086 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D1 = 4087 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D2 = 4088 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D3 = 4089 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D4 = 4090 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D5 = 4091 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D6 = 4092 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D7 = 4093 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D8 = 4094 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N14D9 = 4095 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D1 = 4096 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D2 = 4097 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D3 = 4098 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D4 = 4099 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D5 = 4100 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D6 = 4101 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D7 = 4102 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D8 = 4103 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N15D9 = 4104 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D1 = 4105 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D2 = 4106 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D3 = 4107 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D4 = 4108 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D5 = 4109 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D6 = 4110 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D7 = 4111 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D8 = 4112 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N16D9 = 4113 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D1 = 4114 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D2 = 4115 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D3 = 4116 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D4 = 4117 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D5 = 4118 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D6 = 4119 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D7 = 4120 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D8 = 4121 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N17D9 = 4122 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D1 = 4123 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D2 = 4124 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D3 = 4125 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D4 = 4126 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D5 = 4127 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D6 = 4128 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D7 = 4129 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D8 = 4130 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N18D9 = 4131 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D1 = 4132 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D2 = 4133 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D3 = 4134 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D4 = 4135 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D5 = 4136 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D6 = 4137 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D7 = 4138 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D8 = 4139 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N19D9 = 4140 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D1 = 4141 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D2 = 4142 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D3 = 4143 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D4 = 4144 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D5 = 4145 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D6 = 4146 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D7 = 4147 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D8 = 4148 + INTEGER(IntKi), PARAMETER :: WkDfVrT7N20D9 = 4149 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D1 = 4150 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D2 = 4151 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D3 = 4152 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D4 = 4153 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D5 = 4154 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D6 = 4155 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D7 = 4156 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D8 = 4157 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N01D9 = 4158 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D1 = 4159 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D2 = 4160 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D3 = 4161 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D4 = 4162 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D5 = 4163 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D6 = 4164 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D7 = 4165 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D8 = 4166 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N02D9 = 4167 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D1 = 4168 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D2 = 4169 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D3 = 4170 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D4 = 4171 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D5 = 4172 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D6 = 4173 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D7 = 4174 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D8 = 4175 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N03D9 = 4176 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D1 = 4177 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D2 = 4178 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D3 = 4179 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D4 = 4180 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D5 = 4181 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D6 = 4182 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D7 = 4183 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D8 = 4184 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N04D9 = 4185 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D1 = 4186 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D2 = 4187 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D3 = 4188 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D4 = 4189 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D5 = 4190 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D6 = 4191 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D7 = 4192 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D8 = 4193 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N05D9 = 4194 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D1 = 4195 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D2 = 4196 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D3 = 4197 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D4 = 4198 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D5 = 4199 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D6 = 4200 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D7 = 4201 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D8 = 4202 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N06D9 = 4203 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D1 = 4204 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D2 = 4205 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D3 = 4206 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D4 = 4207 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D5 = 4208 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D6 = 4209 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D7 = 4210 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D8 = 4211 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N07D9 = 4212 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D1 = 4213 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D2 = 4214 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D3 = 4215 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D4 = 4216 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D5 = 4217 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D6 = 4218 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D7 = 4219 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D8 = 4220 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N08D9 = 4221 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D1 = 4222 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D2 = 4223 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D3 = 4224 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D4 = 4225 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D5 = 4226 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D6 = 4227 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D7 = 4228 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D8 = 4229 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N09D9 = 4230 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D1 = 4231 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D2 = 4232 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D3 = 4233 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D4 = 4234 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D5 = 4235 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D6 = 4236 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D7 = 4237 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D8 = 4238 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N10D9 = 4239 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D1 = 4240 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D2 = 4241 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D3 = 4242 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D4 = 4243 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D5 = 4244 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D6 = 4245 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D7 = 4246 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D8 = 4247 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N11D9 = 4248 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D1 = 4249 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D2 = 4250 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D3 = 4251 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D4 = 4252 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D5 = 4253 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D6 = 4254 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D7 = 4255 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D8 = 4256 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N12D9 = 4257 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D1 = 4258 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D2 = 4259 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D3 = 4260 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D4 = 4261 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D5 = 4262 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D6 = 4263 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D7 = 4264 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D8 = 4265 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N13D9 = 4266 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D1 = 4267 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D2 = 4268 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D3 = 4269 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D4 = 4270 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D5 = 4271 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D6 = 4272 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D7 = 4273 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D8 = 4274 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N14D9 = 4275 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D1 = 4276 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D2 = 4277 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D3 = 4278 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D4 = 4279 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D5 = 4280 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D6 = 4281 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D7 = 4282 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D8 = 4283 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N15D9 = 4284 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D1 = 4285 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D2 = 4286 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D3 = 4287 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D4 = 4288 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D5 = 4289 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D6 = 4290 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D7 = 4291 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D8 = 4292 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N16D9 = 4293 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D1 = 4294 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D2 = 4295 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D3 = 4296 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D4 = 4297 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D5 = 4298 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D6 = 4299 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D7 = 4300 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D8 = 4301 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N17D9 = 4302 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D1 = 4303 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D2 = 4304 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D3 = 4305 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D4 = 4306 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D5 = 4307 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D6 = 4308 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D7 = 4309 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D8 = 4310 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N18D9 = 4311 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D1 = 4312 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D2 = 4313 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D3 = 4314 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D4 = 4315 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D5 = 4316 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D6 = 4317 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D7 = 4318 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D8 = 4319 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N19D9 = 4320 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D1 = 4321 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D2 = 4322 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D3 = 4323 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D4 = 4324 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D5 = 4325 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D6 = 4326 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D7 = 4327 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D8 = 4328 + INTEGER(IntKi), PARAMETER :: WkDfVrT8N20D9 = 4329 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D1 = 4330 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D2 = 4331 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D3 = 4332 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D4 = 4333 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D5 = 4334 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D6 = 4335 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D7 = 4336 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D8 = 4337 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N01D9 = 4338 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D1 = 4339 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D2 = 4340 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D3 = 4341 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D4 = 4342 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D5 = 4343 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D6 = 4344 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D7 = 4345 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D8 = 4346 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N02D9 = 4347 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D1 = 4348 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D2 = 4349 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D3 = 4350 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D4 = 4351 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D5 = 4352 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D6 = 4353 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D7 = 4354 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D8 = 4355 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N03D9 = 4356 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D1 = 4357 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D2 = 4358 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D3 = 4359 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D4 = 4360 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D5 = 4361 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D6 = 4362 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D7 = 4363 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D8 = 4364 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N04D9 = 4365 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D1 = 4366 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D2 = 4367 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D3 = 4368 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D4 = 4369 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D5 = 4370 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D6 = 4371 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D7 = 4372 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D8 = 4373 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N05D9 = 4374 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D1 = 4375 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D2 = 4376 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D3 = 4377 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D4 = 4378 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D5 = 4379 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D6 = 4380 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D7 = 4381 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D8 = 4382 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N06D9 = 4383 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D1 = 4384 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D2 = 4385 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D3 = 4386 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D4 = 4387 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D5 = 4388 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D6 = 4389 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D7 = 4390 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D8 = 4391 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N07D9 = 4392 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D1 = 4393 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D2 = 4394 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D3 = 4395 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D4 = 4396 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D5 = 4397 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D6 = 4398 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D7 = 4399 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D8 = 4400 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N08D9 = 4401 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D1 = 4402 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D2 = 4403 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D3 = 4404 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D4 = 4405 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D5 = 4406 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D6 = 4407 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D7 = 4408 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D8 = 4409 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N09D9 = 4410 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D1 = 4411 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D2 = 4412 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D3 = 4413 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D4 = 4414 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D5 = 4415 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D6 = 4416 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D7 = 4417 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D8 = 4418 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N10D9 = 4419 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D1 = 4420 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D2 = 4421 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D3 = 4422 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D4 = 4423 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D5 = 4424 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D6 = 4425 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D7 = 4426 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D8 = 4427 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N11D9 = 4428 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D1 = 4429 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D2 = 4430 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D3 = 4431 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D4 = 4432 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D5 = 4433 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D6 = 4434 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D7 = 4435 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D8 = 4436 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N12D9 = 4437 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D1 = 4438 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D2 = 4439 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D3 = 4440 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D4 = 4441 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D5 = 4442 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D6 = 4443 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D7 = 4444 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D8 = 4445 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N13D9 = 4446 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D1 = 4447 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D2 = 4448 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D3 = 4449 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D4 = 4450 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D5 = 4451 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D6 = 4452 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D7 = 4453 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D8 = 4454 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N14D9 = 4455 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D1 = 4456 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D2 = 4457 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D3 = 4458 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D4 = 4459 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D5 = 4460 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D6 = 4461 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D7 = 4462 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D8 = 4463 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N15D9 = 4464 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D1 = 4465 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D2 = 4466 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D3 = 4467 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D4 = 4468 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D5 = 4469 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D6 = 4470 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D7 = 4471 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D8 = 4472 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N16D9 = 4473 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D1 = 4474 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D2 = 4475 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D3 = 4476 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D4 = 4477 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D5 = 4478 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D6 = 4479 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D7 = 4480 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D8 = 4481 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N17D9 = 4482 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D1 = 4483 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D2 = 4484 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D3 = 4485 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D4 = 4486 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D5 = 4487 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D6 = 4488 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D7 = 4489 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D8 = 4490 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N18D9 = 4491 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D1 = 4492 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D2 = 4493 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D3 = 4494 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D4 = 4495 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D5 = 4496 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D6 = 4497 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D7 = 4498 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D8 = 4499 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N19D9 = 4500 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D1 = 4501 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D2 = 4502 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D3 = 4503 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D4 = 4504 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D5 = 4505 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D6 = 4506 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D7 = 4507 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D8 = 4508 + INTEGER(IntKi), PARAMETER :: WkDfVrT9N20D9 = 4509 + + + ! Total Eddy Viscosity and Individual Contributions: + + INTEGER(IntKi), PARAMETER :: EddVisT1N01D1 = 4510 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D2 = 4511 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D3 = 4512 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D4 = 4513 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D5 = 4514 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D6 = 4515 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D7 = 4516 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D8 = 4517 + INTEGER(IntKi), PARAMETER :: EddVisT1N01D9 = 4518 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D1 = 4519 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D2 = 4520 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D3 = 4521 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D4 = 4522 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D5 = 4523 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D6 = 4524 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D7 = 4525 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D8 = 4526 + INTEGER(IntKi), PARAMETER :: EddVisT1N02D9 = 4527 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D1 = 4528 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D2 = 4529 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D3 = 4530 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D4 = 4531 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D5 = 4532 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D6 = 4533 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D7 = 4534 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D8 = 4535 + INTEGER(IntKi), PARAMETER :: EddVisT1N03D9 = 4536 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D1 = 4537 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D2 = 4538 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D3 = 4539 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D4 = 4540 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D5 = 4541 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D6 = 4542 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D7 = 4543 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D8 = 4544 + INTEGER(IntKi), PARAMETER :: EddVisT1N04D9 = 4545 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D1 = 4546 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D2 = 4547 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D3 = 4548 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D4 = 4549 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D5 = 4550 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D6 = 4551 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D7 = 4552 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D8 = 4553 + INTEGER(IntKi), PARAMETER :: EddVisT1N05D9 = 4554 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D1 = 4555 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D2 = 4556 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D3 = 4557 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D4 = 4558 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D5 = 4559 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D6 = 4560 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D7 = 4561 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D8 = 4562 + INTEGER(IntKi), PARAMETER :: EddVisT1N06D9 = 4563 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D1 = 4564 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D2 = 4565 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D3 = 4566 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D4 = 4567 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D5 = 4568 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D6 = 4569 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D7 = 4570 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D8 = 4571 + INTEGER(IntKi), PARAMETER :: EddVisT1N07D9 = 4572 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D1 = 4573 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D2 = 4574 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D3 = 4575 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D4 = 4576 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D5 = 4577 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D6 = 4578 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D7 = 4579 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D8 = 4580 + INTEGER(IntKi), PARAMETER :: EddVisT1N08D9 = 4581 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D1 = 4582 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D2 = 4583 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D3 = 4584 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D4 = 4585 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D5 = 4586 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D6 = 4587 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D7 = 4588 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D8 = 4589 + INTEGER(IntKi), PARAMETER :: EddVisT1N09D9 = 4590 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D1 = 4591 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D2 = 4592 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D3 = 4593 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D4 = 4594 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D5 = 4595 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D6 = 4596 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D7 = 4597 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D8 = 4598 + INTEGER(IntKi), PARAMETER :: EddVisT1N10D9 = 4599 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D1 = 4600 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D2 = 4601 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D3 = 4602 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D4 = 4603 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D5 = 4604 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D6 = 4605 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D7 = 4606 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D8 = 4607 + INTEGER(IntKi), PARAMETER :: EddVisT1N11D9 = 4608 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D1 = 4609 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D2 = 4610 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D3 = 4611 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D4 = 4612 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D5 = 4613 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D6 = 4614 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D7 = 4615 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D8 = 4616 + INTEGER(IntKi), PARAMETER :: EddVisT1N12D9 = 4617 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D1 = 4618 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D2 = 4619 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D3 = 4620 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D4 = 4621 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D5 = 4622 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D6 = 4623 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D7 = 4624 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D8 = 4625 + INTEGER(IntKi), PARAMETER :: EddVisT1N13D9 = 4626 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D1 = 4627 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D2 = 4628 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D3 = 4629 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D4 = 4630 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D5 = 4631 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D6 = 4632 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D7 = 4633 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D8 = 4634 + INTEGER(IntKi), PARAMETER :: EddVisT1N14D9 = 4635 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D1 = 4636 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D2 = 4637 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D3 = 4638 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D4 = 4639 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D5 = 4640 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D6 = 4641 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D7 = 4642 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D8 = 4643 + INTEGER(IntKi), PARAMETER :: EddVisT1N15D9 = 4644 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D1 = 4645 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D2 = 4646 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D3 = 4647 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D4 = 4648 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D5 = 4649 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D6 = 4650 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D7 = 4651 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D8 = 4652 + INTEGER(IntKi), PARAMETER :: EddVisT1N16D9 = 4653 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D1 = 4654 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D2 = 4655 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D3 = 4656 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D4 = 4657 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D5 = 4658 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D6 = 4659 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D7 = 4660 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D8 = 4661 + INTEGER(IntKi), PARAMETER :: EddVisT1N17D9 = 4662 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D1 = 4663 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D2 = 4664 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D3 = 4665 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D4 = 4666 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D5 = 4667 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D6 = 4668 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D7 = 4669 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D8 = 4670 + INTEGER(IntKi), PARAMETER :: EddVisT1N18D9 = 4671 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D1 = 4672 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D2 = 4673 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D3 = 4674 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D4 = 4675 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D5 = 4676 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D6 = 4677 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D7 = 4678 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D8 = 4679 + INTEGER(IntKi), PARAMETER :: EddVisT1N19D9 = 4680 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D1 = 4681 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D2 = 4682 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D3 = 4683 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D4 = 4684 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D5 = 4685 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D6 = 4686 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D7 = 4687 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D8 = 4688 + INTEGER(IntKi), PARAMETER :: EddVisT1N20D9 = 4689 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D1 = 4690 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D2 = 4691 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D3 = 4692 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D4 = 4693 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D5 = 4694 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D6 = 4695 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D7 = 4696 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D8 = 4697 + INTEGER(IntKi), PARAMETER :: EddVisT2N01D9 = 4698 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D1 = 4699 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D2 = 4700 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D3 = 4701 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D4 = 4702 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D5 = 4703 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D6 = 4704 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D7 = 4705 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D8 = 4706 + INTEGER(IntKi), PARAMETER :: EddVisT2N02D9 = 4707 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D1 = 4708 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D2 = 4709 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D3 = 4710 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D4 = 4711 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D5 = 4712 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D6 = 4713 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D7 = 4714 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D8 = 4715 + INTEGER(IntKi), PARAMETER :: EddVisT2N03D9 = 4716 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D1 = 4717 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D2 = 4718 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D3 = 4719 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D4 = 4720 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D5 = 4721 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D6 = 4722 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D7 = 4723 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D8 = 4724 + INTEGER(IntKi), PARAMETER :: EddVisT2N04D9 = 4725 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D1 = 4726 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D2 = 4727 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D3 = 4728 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D4 = 4729 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D5 = 4730 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D6 = 4731 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D7 = 4732 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D8 = 4733 + INTEGER(IntKi), PARAMETER :: EddVisT2N05D9 = 4734 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D1 = 4735 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D2 = 4736 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D3 = 4737 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D4 = 4738 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D5 = 4739 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D6 = 4740 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D7 = 4741 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D8 = 4742 + INTEGER(IntKi), PARAMETER :: EddVisT2N06D9 = 4743 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D1 = 4744 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D2 = 4745 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D3 = 4746 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D4 = 4747 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D5 = 4748 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D6 = 4749 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D7 = 4750 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D8 = 4751 + INTEGER(IntKi), PARAMETER :: EddVisT2N07D9 = 4752 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D1 = 4753 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D2 = 4754 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D3 = 4755 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D4 = 4756 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D5 = 4757 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D6 = 4758 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D7 = 4759 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D8 = 4760 + INTEGER(IntKi), PARAMETER :: EddVisT2N08D9 = 4761 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D1 = 4762 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D2 = 4763 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D3 = 4764 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D4 = 4765 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D5 = 4766 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D6 = 4767 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D7 = 4768 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D8 = 4769 + INTEGER(IntKi), PARAMETER :: EddVisT2N09D9 = 4770 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D1 = 4771 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D2 = 4772 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D3 = 4773 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D4 = 4774 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D5 = 4775 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D6 = 4776 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D7 = 4777 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D8 = 4778 + INTEGER(IntKi), PARAMETER :: EddVisT2N10D9 = 4779 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D1 = 4780 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D2 = 4781 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D3 = 4782 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D4 = 4783 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D5 = 4784 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D6 = 4785 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D7 = 4786 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D8 = 4787 + INTEGER(IntKi), PARAMETER :: EddVisT2N11D9 = 4788 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D1 = 4789 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D2 = 4790 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D3 = 4791 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D4 = 4792 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D5 = 4793 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D6 = 4794 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D7 = 4795 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D8 = 4796 + INTEGER(IntKi), PARAMETER :: EddVisT2N12D9 = 4797 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D1 = 4798 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D2 = 4799 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D3 = 4800 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D4 = 4801 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D5 = 4802 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D6 = 4803 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D7 = 4804 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D8 = 4805 + INTEGER(IntKi), PARAMETER :: EddVisT2N13D9 = 4806 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D1 = 4807 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D2 = 4808 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D3 = 4809 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D4 = 4810 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D5 = 4811 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D6 = 4812 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D7 = 4813 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D8 = 4814 + INTEGER(IntKi), PARAMETER :: EddVisT2N14D9 = 4815 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D1 = 4816 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D2 = 4817 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D3 = 4818 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D4 = 4819 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D5 = 4820 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D6 = 4821 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D7 = 4822 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D8 = 4823 + INTEGER(IntKi), PARAMETER :: EddVisT2N15D9 = 4824 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D1 = 4825 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D2 = 4826 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D3 = 4827 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D4 = 4828 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D5 = 4829 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D6 = 4830 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D7 = 4831 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D8 = 4832 + INTEGER(IntKi), PARAMETER :: EddVisT2N16D9 = 4833 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D1 = 4834 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D2 = 4835 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D3 = 4836 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D4 = 4837 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D5 = 4838 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D6 = 4839 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D7 = 4840 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D8 = 4841 + INTEGER(IntKi), PARAMETER :: EddVisT2N17D9 = 4842 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D1 = 4843 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D2 = 4844 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D3 = 4845 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D4 = 4846 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D5 = 4847 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D6 = 4848 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D7 = 4849 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D8 = 4850 + INTEGER(IntKi), PARAMETER :: EddVisT2N18D9 = 4851 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D1 = 4852 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D2 = 4853 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D3 = 4854 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D4 = 4855 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D5 = 4856 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D6 = 4857 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D7 = 4858 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D8 = 4859 + INTEGER(IntKi), PARAMETER :: EddVisT2N19D9 = 4860 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D1 = 4861 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D2 = 4862 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D3 = 4863 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D4 = 4864 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D5 = 4865 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D6 = 4866 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D7 = 4867 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D8 = 4868 + INTEGER(IntKi), PARAMETER :: EddVisT2N20D9 = 4869 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D1 = 4870 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D2 = 4871 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D3 = 4872 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D4 = 4873 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D5 = 4874 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D6 = 4875 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D7 = 4876 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D8 = 4877 + INTEGER(IntKi), PARAMETER :: EddVisT3N01D9 = 4878 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D1 = 4879 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D2 = 4880 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D3 = 4881 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D4 = 4882 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D5 = 4883 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D6 = 4884 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D7 = 4885 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D8 = 4886 + INTEGER(IntKi), PARAMETER :: EddVisT3N02D9 = 4887 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D1 = 4888 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D2 = 4889 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D3 = 4890 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D4 = 4891 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D5 = 4892 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D6 = 4893 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D7 = 4894 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D8 = 4895 + INTEGER(IntKi), PARAMETER :: EddVisT3N03D9 = 4896 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D1 = 4897 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D2 = 4898 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D3 = 4899 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D4 = 4900 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D5 = 4901 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D6 = 4902 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D7 = 4903 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D8 = 4904 + INTEGER(IntKi), PARAMETER :: EddVisT3N04D9 = 4905 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D1 = 4906 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D2 = 4907 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D3 = 4908 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D4 = 4909 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D5 = 4910 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D6 = 4911 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D7 = 4912 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D8 = 4913 + INTEGER(IntKi), PARAMETER :: EddVisT3N05D9 = 4914 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D1 = 4915 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D2 = 4916 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D3 = 4917 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D4 = 4918 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D5 = 4919 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D6 = 4920 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D7 = 4921 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D8 = 4922 + INTEGER(IntKi), PARAMETER :: EddVisT3N06D9 = 4923 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D1 = 4924 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D2 = 4925 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D3 = 4926 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D4 = 4927 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D5 = 4928 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D6 = 4929 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D7 = 4930 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D8 = 4931 + INTEGER(IntKi), PARAMETER :: EddVisT3N07D9 = 4932 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D1 = 4933 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D2 = 4934 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D3 = 4935 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D4 = 4936 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D5 = 4937 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D6 = 4938 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D7 = 4939 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D8 = 4940 + INTEGER(IntKi), PARAMETER :: EddVisT3N08D9 = 4941 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D1 = 4942 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D2 = 4943 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D3 = 4944 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D4 = 4945 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D5 = 4946 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D6 = 4947 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D7 = 4948 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D8 = 4949 + INTEGER(IntKi), PARAMETER :: EddVisT3N09D9 = 4950 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D1 = 4951 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D2 = 4952 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D3 = 4953 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D4 = 4954 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D5 = 4955 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D6 = 4956 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D7 = 4957 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D8 = 4958 + INTEGER(IntKi), PARAMETER :: EddVisT3N10D9 = 4959 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D1 = 4960 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D2 = 4961 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D3 = 4962 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D4 = 4963 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D5 = 4964 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D6 = 4965 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D7 = 4966 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D8 = 4967 + INTEGER(IntKi), PARAMETER :: EddVisT3N11D9 = 4968 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D1 = 4969 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D2 = 4970 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D3 = 4971 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D4 = 4972 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D5 = 4973 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D6 = 4974 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D7 = 4975 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D8 = 4976 + INTEGER(IntKi), PARAMETER :: EddVisT3N12D9 = 4977 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D1 = 4978 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D2 = 4979 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D3 = 4980 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D4 = 4981 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D5 = 4982 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D6 = 4983 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D7 = 4984 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D8 = 4985 + INTEGER(IntKi), PARAMETER :: EddVisT3N13D9 = 4986 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D1 = 4987 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D2 = 4988 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D3 = 4989 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D4 = 4990 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D5 = 4991 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D6 = 4992 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D7 = 4993 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D8 = 4994 + INTEGER(IntKi), PARAMETER :: EddVisT3N14D9 = 4995 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D1 = 4996 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D2 = 4997 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D3 = 4998 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D4 = 4999 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D5 = 5000 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D6 = 5001 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D7 = 5002 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D8 = 5003 + INTEGER(IntKi), PARAMETER :: EddVisT3N15D9 = 5004 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D1 = 5005 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D2 = 5006 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D3 = 5007 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D4 = 5008 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D5 = 5009 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D6 = 5010 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D7 = 5011 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D8 = 5012 + INTEGER(IntKi), PARAMETER :: EddVisT3N16D9 = 5013 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D1 = 5014 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D2 = 5015 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D3 = 5016 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D4 = 5017 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D5 = 5018 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D6 = 5019 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D7 = 5020 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D8 = 5021 + INTEGER(IntKi), PARAMETER :: EddVisT3N17D9 = 5022 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D1 = 5023 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D2 = 5024 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D3 = 5025 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D4 = 5026 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D5 = 5027 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D6 = 5028 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D7 = 5029 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D8 = 5030 + INTEGER(IntKi), PARAMETER :: EddVisT3N18D9 = 5031 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D1 = 5032 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D2 = 5033 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D3 = 5034 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D4 = 5035 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D5 = 5036 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D6 = 5037 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D7 = 5038 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D8 = 5039 + INTEGER(IntKi), PARAMETER :: EddVisT3N19D9 = 5040 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D1 = 5041 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D2 = 5042 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D3 = 5043 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D4 = 5044 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D5 = 5045 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D6 = 5046 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D7 = 5047 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D8 = 5048 + INTEGER(IntKi), PARAMETER :: EddVisT3N20D9 = 5049 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D1 = 5050 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D2 = 5051 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D3 = 5052 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D4 = 5053 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D5 = 5054 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D6 = 5055 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D7 = 5056 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D8 = 5057 + INTEGER(IntKi), PARAMETER :: EddVisT4N01D9 = 5058 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D1 = 5059 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D2 = 5060 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D3 = 5061 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D4 = 5062 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D5 = 5063 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D6 = 5064 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D7 = 5065 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D8 = 5066 + INTEGER(IntKi), PARAMETER :: EddVisT4N02D9 = 5067 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D1 = 5068 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D2 = 5069 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D3 = 5070 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D4 = 5071 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D5 = 5072 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D6 = 5073 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D7 = 5074 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D8 = 5075 + INTEGER(IntKi), PARAMETER :: EddVisT4N03D9 = 5076 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D1 = 5077 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D2 = 5078 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D3 = 5079 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D4 = 5080 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D5 = 5081 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D6 = 5082 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D7 = 5083 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D8 = 5084 + INTEGER(IntKi), PARAMETER :: EddVisT4N04D9 = 5085 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D1 = 5086 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D2 = 5087 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D3 = 5088 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D4 = 5089 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D5 = 5090 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D6 = 5091 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D7 = 5092 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D8 = 5093 + INTEGER(IntKi), PARAMETER :: EddVisT4N05D9 = 5094 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D1 = 5095 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D2 = 5096 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D3 = 5097 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D4 = 5098 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D5 = 5099 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D6 = 5100 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D7 = 5101 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D8 = 5102 + INTEGER(IntKi), PARAMETER :: EddVisT4N06D9 = 5103 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D1 = 5104 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D2 = 5105 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D3 = 5106 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D4 = 5107 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D5 = 5108 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D6 = 5109 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D7 = 5110 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D8 = 5111 + INTEGER(IntKi), PARAMETER :: EddVisT4N07D9 = 5112 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D1 = 5113 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D2 = 5114 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D3 = 5115 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D4 = 5116 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D5 = 5117 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D6 = 5118 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D7 = 5119 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D8 = 5120 + INTEGER(IntKi), PARAMETER :: EddVisT4N08D9 = 5121 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D1 = 5122 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D2 = 5123 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D3 = 5124 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D4 = 5125 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D5 = 5126 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D6 = 5127 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D7 = 5128 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D8 = 5129 + INTEGER(IntKi), PARAMETER :: EddVisT4N09D9 = 5130 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D1 = 5131 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D2 = 5132 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D3 = 5133 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D4 = 5134 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D5 = 5135 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D6 = 5136 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D7 = 5137 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D8 = 5138 + INTEGER(IntKi), PARAMETER :: EddVisT4N10D9 = 5139 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D1 = 5140 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D2 = 5141 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D3 = 5142 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D4 = 5143 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D5 = 5144 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D6 = 5145 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D7 = 5146 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D8 = 5147 + INTEGER(IntKi), PARAMETER :: EddVisT4N11D9 = 5148 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D1 = 5149 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D2 = 5150 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D3 = 5151 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D4 = 5152 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D5 = 5153 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D6 = 5154 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D7 = 5155 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D8 = 5156 + INTEGER(IntKi), PARAMETER :: EddVisT4N12D9 = 5157 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D1 = 5158 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D2 = 5159 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D3 = 5160 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D4 = 5161 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D5 = 5162 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D6 = 5163 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D7 = 5164 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D8 = 5165 + INTEGER(IntKi), PARAMETER :: EddVisT4N13D9 = 5166 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D1 = 5167 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D2 = 5168 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D3 = 5169 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D4 = 5170 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D5 = 5171 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D6 = 5172 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D7 = 5173 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D8 = 5174 + INTEGER(IntKi), PARAMETER :: EddVisT4N14D9 = 5175 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D1 = 5176 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D2 = 5177 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D3 = 5178 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D4 = 5179 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D5 = 5180 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D6 = 5181 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D7 = 5182 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D8 = 5183 + INTEGER(IntKi), PARAMETER :: EddVisT4N15D9 = 5184 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D1 = 5185 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D2 = 5186 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D3 = 5187 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D4 = 5188 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D5 = 5189 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D6 = 5190 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D7 = 5191 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D8 = 5192 + INTEGER(IntKi), PARAMETER :: EddVisT4N16D9 = 5193 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D1 = 5194 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D2 = 5195 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D3 = 5196 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D4 = 5197 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D5 = 5198 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D6 = 5199 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D7 = 5200 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D8 = 5201 + INTEGER(IntKi), PARAMETER :: EddVisT4N17D9 = 5202 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D1 = 5203 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D2 = 5204 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D3 = 5205 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D4 = 5206 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D5 = 5207 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D6 = 5208 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D7 = 5209 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D8 = 5210 + INTEGER(IntKi), PARAMETER :: EddVisT4N18D9 = 5211 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D1 = 5212 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D2 = 5213 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D3 = 5214 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D4 = 5215 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D5 = 5216 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D6 = 5217 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D7 = 5218 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D8 = 5219 + INTEGER(IntKi), PARAMETER :: EddVisT4N19D9 = 5220 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D1 = 5221 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D2 = 5222 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D3 = 5223 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D4 = 5224 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D5 = 5225 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D6 = 5226 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D7 = 5227 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D8 = 5228 + INTEGER(IntKi), PARAMETER :: EddVisT4N20D9 = 5229 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D1 = 5230 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D2 = 5231 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D3 = 5232 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D4 = 5233 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D5 = 5234 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D6 = 5235 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D7 = 5236 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D8 = 5237 + INTEGER(IntKi), PARAMETER :: EddVisT5N01D9 = 5238 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D1 = 5239 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D2 = 5240 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D3 = 5241 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D4 = 5242 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D5 = 5243 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D6 = 5244 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D7 = 5245 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D8 = 5246 + INTEGER(IntKi), PARAMETER :: EddVisT5N02D9 = 5247 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D1 = 5248 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D2 = 5249 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D3 = 5250 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D4 = 5251 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D5 = 5252 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D6 = 5253 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D7 = 5254 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D8 = 5255 + INTEGER(IntKi), PARAMETER :: EddVisT5N03D9 = 5256 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D1 = 5257 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D2 = 5258 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D3 = 5259 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D4 = 5260 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D5 = 5261 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D6 = 5262 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D7 = 5263 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D8 = 5264 + INTEGER(IntKi), PARAMETER :: EddVisT5N04D9 = 5265 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D1 = 5266 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D2 = 5267 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D3 = 5268 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D4 = 5269 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D5 = 5270 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D6 = 5271 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D7 = 5272 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D8 = 5273 + INTEGER(IntKi), PARAMETER :: EddVisT5N05D9 = 5274 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D1 = 5275 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D2 = 5276 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D3 = 5277 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D4 = 5278 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D5 = 5279 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D6 = 5280 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D7 = 5281 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D8 = 5282 + INTEGER(IntKi), PARAMETER :: EddVisT5N06D9 = 5283 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D1 = 5284 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D2 = 5285 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D3 = 5286 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D4 = 5287 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D5 = 5288 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D6 = 5289 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D7 = 5290 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D8 = 5291 + INTEGER(IntKi), PARAMETER :: EddVisT5N07D9 = 5292 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D1 = 5293 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D2 = 5294 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D3 = 5295 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D4 = 5296 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D5 = 5297 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D6 = 5298 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D7 = 5299 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D8 = 5300 + INTEGER(IntKi), PARAMETER :: EddVisT5N08D9 = 5301 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D1 = 5302 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D2 = 5303 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D3 = 5304 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D4 = 5305 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D5 = 5306 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D6 = 5307 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D7 = 5308 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D8 = 5309 + INTEGER(IntKi), PARAMETER :: EddVisT5N09D9 = 5310 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D1 = 5311 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D2 = 5312 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D3 = 5313 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D4 = 5314 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D5 = 5315 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D6 = 5316 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D7 = 5317 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D8 = 5318 + INTEGER(IntKi), PARAMETER :: EddVisT5N10D9 = 5319 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D1 = 5320 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D2 = 5321 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D3 = 5322 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D4 = 5323 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D5 = 5324 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D6 = 5325 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D7 = 5326 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D8 = 5327 + INTEGER(IntKi), PARAMETER :: EddVisT5N11D9 = 5328 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D1 = 5329 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D2 = 5330 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D3 = 5331 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D4 = 5332 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D5 = 5333 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D6 = 5334 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D7 = 5335 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D8 = 5336 + INTEGER(IntKi), PARAMETER :: EddVisT5N12D9 = 5337 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D1 = 5338 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D2 = 5339 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D3 = 5340 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D4 = 5341 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D5 = 5342 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D6 = 5343 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D7 = 5344 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D8 = 5345 + INTEGER(IntKi), PARAMETER :: EddVisT5N13D9 = 5346 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D1 = 5347 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D2 = 5348 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D3 = 5349 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D4 = 5350 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D5 = 5351 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D6 = 5352 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D7 = 5353 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D8 = 5354 + INTEGER(IntKi), PARAMETER :: EddVisT5N14D9 = 5355 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D1 = 5356 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D2 = 5357 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D3 = 5358 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D4 = 5359 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D5 = 5360 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D6 = 5361 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D7 = 5362 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D8 = 5363 + INTEGER(IntKi), PARAMETER :: EddVisT5N15D9 = 5364 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D1 = 5365 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D2 = 5366 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D3 = 5367 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D4 = 5368 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D5 = 5369 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D6 = 5370 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D7 = 5371 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D8 = 5372 + INTEGER(IntKi), PARAMETER :: EddVisT5N16D9 = 5373 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D1 = 5374 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D2 = 5375 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D3 = 5376 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D4 = 5377 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D5 = 5378 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D6 = 5379 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D7 = 5380 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D8 = 5381 + INTEGER(IntKi), PARAMETER :: EddVisT5N17D9 = 5382 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D1 = 5383 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D2 = 5384 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D3 = 5385 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D4 = 5386 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D5 = 5387 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D6 = 5388 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D7 = 5389 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D8 = 5390 + INTEGER(IntKi), PARAMETER :: EddVisT5N18D9 = 5391 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D1 = 5392 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D2 = 5393 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D3 = 5394 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D4 = 5395 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D5 = 5396 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D6 = 5397 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D7 = 5398 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D8 = 5399 + INTEGER(IntKi), PARAMETER :: EddVisT5N19D9 = 5400 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D1 = 5401 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D2 = 5402 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D3 = 5403 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D4 = 5404 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D5 = 5405 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D6 = 5406 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D7 = 5407 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D8 = 5408 + INTEGER(IntKi), PARAMETER :: EddVisT5N20D9 = 5409 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D1 = 5410 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D2 = 5411 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D3 = 5412 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D4 = 5413 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D5 = 5414 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D6 = 5415 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D7 = 5416 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D8 = 5417 + INTEGER(IntKi), PARAMETER :: EddVisT6N01D9 = 5418 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D1 = 5419 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D2 = 5420 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D3 = 5421 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D4 = 5422 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D5 = 5423 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D6 = 5424 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D7 = 5425 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D8 = 5426 + INTEGER(IntKi), PARAMETER :: EddVisT6N02D9 = 5427 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D1 = 5428 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D2 = 5429 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D3 = 5430 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D4 = 5431 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D5 = 5432 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D6 = 5433 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D7 = 5434 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D8 = 5435 + INTEGER(IntKi), PARAMETER :: EddVisT6N03D9 = 5436 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D1 = 5437 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D2 = 5438 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D3 = 5439 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D4 = 5440 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D5 = 5441 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D6 = 5442 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D7 = 5443 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D8 = 5444 + INTEGER(IntKi), PARAMETER :: EddVisT6N04D9 = 5445 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D1 = 5446 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D2 = 5447 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D3 = 5448 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D4 = 5449 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D5 = 5450 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D6 = 5451 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D7 = 5452 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D8 = 5453 + INTEGER(IntKi), PARAMETER :: EddVisT6N05D9 = 5454 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D1 = 5455 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D2 = 5456 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D3 = 5457 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D4 = 5458 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D5 = 5459 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D6 = 5460 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D7 = 5461 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D8 = 5462 + INTEGER(IntKi), PARAMETER :: EddVisT6N06D9 = 5463 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D1 = 5464 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D2 = 5465 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D3 = 5466 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D4 = 5467 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D5 = 5468 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D6 = 5469 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D7 = 5470 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D8 = 5471 + INTEGER(IntKi), PARAMETER :: EddVisT6N07D9 = 5472 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D1 = 5473 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D2 = 5474 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D3 = 5475 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D4 = 5476 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D5 = 5477 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D6 = 5478 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D7 = 5479 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D8 = 5480 + INTEGER(IntKi), PARAMETER :: EddVisT6N08D9 = 5481 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D1 = 5482 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D2 = 5483 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D3 = 5484 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D4 = 5485 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D5 = 5486 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D6 = 5487 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D7 = 5488 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D8 = 5489 + INTEGER(IntKi), PARAMETER :: EddVisT6N09D9 = 5490 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D1 = 5491 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D2 = 5492 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D3 = 5493 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D4 = 5494 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D5 = 5495 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D6 = 5496 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D7 = 5497 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D8 = 5498 + INTEGER(IntKi), PARAMETER :: EddVisT6N10D9 = 5499 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D1 = 5500 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D2 = 5501 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D3 = 5502 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D4 = 5503 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D5 = 5504 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D6 = 5505 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D7 = 5506 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D8 = 5507 + INTEGER(IntKi), PARAMETER :: EddVisT6N11D9 = 5508 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D1 = 5509 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D2 = 5510 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D3 = 5511 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D4 = 5512 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D5 = 5513 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D6 = 5514 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D7 = 5515 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D8 = 5516 + INTEGER(IntKi), PARAMETER :: EddVisT6N12D9 = 5517 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D1 = 5518 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D2 = 5519 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D3 = 5520 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D4 = 5521 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D5 = 5522 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D6 = 5523 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D7 = 5524 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D8 = 5525 + INTEGER(IntKi), PARAMETER :: EddVisT6N13D9 = 5526 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D1 = 5527 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D2 = 5528 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D3 = 5529 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D4 = 5530 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D5 = 5531 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D6 = 5532 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D7 = 5533 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D8 = 5534 + INTEGER(IntKi), PARAMETER :: EddVisT6N14D9 = 5535 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D1 = 5536 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D2 = 5537 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D3 = 5538 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D4 = 5539 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D5 = 5540 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D6 = 5541 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D7 = 5542 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D8 = 5543 + INTEGER(IntKi), PARAMETER :: EddVisT6N15D9 = 5544 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D1 = 5545 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D2 = 5546 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D3 = 5547 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D4 = 5548 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D5 = 5549 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D6 = 5550 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D7 = 5551 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D8 = 5552 + INTEGER(IntKi), PARAMETER :: EddVisT6N16D9 = 5553 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D1 = 5554 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D2 = 5555 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D3 = 5556 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D4 = 5557 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D5 = 5558 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D6 = 5559 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D7 = 5560 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D8 = 5561 + INTEGER(IntKi), PARAMETER :: EddVisT6N17D9 = 5562 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D1 = 5563 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D2 = 5564 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D3 = 5565 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D4 = 5566 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D5 = 5567 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D6 = 5568 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D7 = 5569 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D8 = 5570 + INTEGER(IntKi), PARAMETER :: EddVisT6N18D9 = 5571 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D1 = 5572 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D2 = 5573 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D3 = 5574 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D4 = 5575 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D5 = 5576 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D6 = 5577 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D7 = 5578 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D8 = 5579 + INTEGER(IntKi), PARAMETER :: EddVisT6N19D9 = 5580 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D1 = 5581 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D2 = 5582 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D3 = 5583 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D4 = 5584 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D5 = 5585 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D6 = 5586 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D7 = 5587 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D8 = 5588 + INTEGER(IntKi), PARAMETER :: EddVisT6N20D9 = 5589 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D1 = 5590 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D2 = 5591 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D3 = 5592 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D4 = 5593 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D5 = 5594 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D6 = 5595 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D7 = 5596 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D8 = 5597 + INTEGER(IntKi), PARAMETER :: EddVisT7N01D9 = 5598 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D1 = 5599 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D2 = 5600 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D3 = 5601 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D4 = 5602 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D5 = 5603 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D6 = 5604 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D7 = 5605 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D8 = 5606 + INTEGER(IntKi), PARAMETER :: EddVisT7N02D9 = 5607 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D1 = 5608 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D2 = 5609 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D3 = 5610 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D4 = 5611 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D5 = 5612 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D6 = 5613 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D7 = 5614 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D8 = 5615 + INTEGER(IntKi), PARAMETER :: EddVisT7N03D9 = 5616 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D1 = 5617 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D2 = 5618 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D3 = 5619 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D4 = 5620 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D5 = 5621 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D6 = 5622 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D7 = 5623 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D8 = 5624 + INTEGER(IntKi), PARAMETER :: EddVisT7N04D9 = 5625 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D1 = 5626 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D2 = 5627 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D3 = 5628 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D4 = 5629 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D5 = 5630 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D6 = 5631 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D7 = 5632 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D8 = 5633 + INTEGER(IntKi), PARAMETER :: EddVisT7N05D9 = 5634 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D1 = 5635 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D2 = 5636 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D3 = 5637 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D4 = 5638 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D5 = 5639 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D6 = 5640 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D7 = 5641 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D8 = 5642 + INTEGER(IntKi), PARAMETER :: EddVisT7N06D9 = 5643 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D1 = 5644 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D2 = 5645 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D3 = 5646 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D4 = 5647 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D5 = 5648 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D6 = 5649 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D7 = 5650 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D8 = 5651 + INTEGER(IntKi), PARAMETER :: EddVisT7N07D9 = 5652 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D1 = 5653 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D2 = 5654 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D3 = 5655 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D4 = 5656 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D5 = 5657 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D6 = 5658 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D7 = 5659 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D8 = 5660 + INTEGER(IntKi), PARAMETER :: EddVisT7N08D9 = 5661 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D1 = 5662 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D2 = 5663 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D3 = 5664 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D4 = 5665 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D5 = 5666 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D6 = 5667 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D7 = 5668 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D8 = 5669 + INTEGER(IntKi), PARAMETER :: EddVisT7N09D9 = 5670 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D1 = 5671 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D2 = 5672 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D3 = 5673 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D4 = 5674 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D5 = 5675 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D6 = 5676 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D7 = 5677 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D8 = 5678 + INTEGER(IntKi), PARAMETER :: EddVisT7N10D9 = 5679 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D1 = 5680 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D2 = 5681 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D3 = 5682 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D4 = 5683 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D5 = 5684 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D6 = 5685 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D7 = 5686 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D8 = 5687 + INTEGER(IntKi), PARAMETER :: EddVisT7N11D9 = 5688 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D1 = 5689 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D2 = 5690 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D3 = 5691 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D4 = 5692 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D5 = 5693 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D6 = 5694 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D7 = 5695 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D8 = 5696 + INTEGER(IntKi), PARAMETER :: EddVisT7N12D9 = 5697 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D1 = 5698 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D2 = 5699 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D3 = 5700 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D4 = 5701 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D5 = 5702 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D6 = 5703 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D7 = 5704 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D8 = 5705 + INTEGER(IntKi), PARAMETER :: EddVisT7N13D9 = 5706 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D1 = 5707 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D2 = 5708 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D3 = 5709 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D4 = 5710 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D5 = 5711 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D6 = 5712 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D7 = 5713 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D8 = 5714 + INTEGER(IntKi), PARAMETER :: EddVisT7N14D9 = 5715 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D1 = 5716 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D2 = 5717 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D3 = 5718 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D4 = 5719 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D5 = 5720 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D6 = 5721 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D7 = 5722 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D8 = 5723 + INTEGER(IntKi), PARAMETER :: EddVisT7N15D9 = 5724 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D1 = 5725 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D2 = 5726 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D3 = 5727 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D4 = 5728 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D5 = 5729 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D6 = 5730 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D7 = 5731 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D8 = 5732 + INTEGER(IntKi), PARAMETER :: EddVisT7N16D9 = 5733 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D1 = 5734 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D2 = 5735 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D3 = 5736 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D4 = 5737 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D5 = 5738 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D6 = 5739 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D7 = 5740 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D8 = 5741 + INTEGER(IntKi), PARAMETER :: EddVisT7N17D9 = 5742 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D1 = 5743 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D2 = 5744 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D3 = 5745 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D4 = 5746 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D5 = 5747 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D6 = 5748 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D7 = 5749 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D8 = 5750 + INTEGER(IntKi), PARAMETER :: EddVisT7N18D9 = 5751 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D1 = 5752 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D2 = 5753 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D3 = 5754 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D4 = 5755 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D5 = 5756 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D6 = 5757 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D7 = 5758 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D8 = 5759 + INTEGER(IntKi), PARAMETER :: EddVisT7N19D9 = 5760 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D1 = 5761 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D2 = 5762 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D3 = 5763 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D4 = 5764 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D5 = 5765 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D6 = 5766 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D7 = 5767 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D8 = 5768 + INTEGER(IntKi), PARAMETER :: EddVisT7N20D9 = 5769 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D1 = 5770 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D2 = 5771 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D3 = 5772 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D4 = 5773 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D5 = 5774 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D6 = 5775 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D7 = 5776 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D8 = 5777 + INTEGER(IntKi), PARAMETER :: EddVisT8N01D9 = 5778 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D1 = 5779 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D2 = 5780 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D3 = 5781 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D4 = 5782 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D5 = 5783 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D6 = 5784 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D7 = 5785 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D8 = 5786 + INTEGER(IntKi), PARAMETER :: EddVisT8N02D9 = 5787 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D1 = 5788 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D2 = 5789 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D3 = 5790 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D4 = 5791 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D5 = 5792 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D6 = 5793 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D7 = 5794 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D8 = 5795 + INTEGER(IntKi), PARAMETER :: EddVisT8N03D9 = 5796 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D1 = 5797 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D2 = 5798 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D3 = 5799 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D4 = 5800 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D5 = 5801 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D6 = 5802 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D7 = 5803 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D8 = 5804 + INTEGER(IntKi), PARAMETER :: EddVisT8N04D9 = 5805 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D1 = 5806 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D2 = 5807 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D3 = 5808 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D4 = 5809 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D5 = 5810 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D6 = 5811 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D7 = 5812 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D8 = 5813 + INTEGER(IntKi), PARAMETER :: EddVisT8N05D9 = 5814 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D1 = 5815 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D2 = 5816 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D3 = 5817 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D4 = 5818 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D5 = 5819 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D6 = 5820 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D7 = 5821 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D8 = 5822 + INTEGER(IntKi), PARAMETER :: EddVisT8N06D9 = 5823 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D1 = 5824 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D2 = 5825 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D3 = 5826 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D4 = 5827 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D5 = 5828 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D6 = 5829 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D7 = 5830 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D8 = 5831 + INTEGER(IntKi), PARAMETER :: EddVisT8N07D9 = 5832 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D1 = 5833 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D2 = 5834 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D3 = 5835 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D4 = 5836 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D5 = 5837 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D6 = 5838 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D7 = 5839 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D8 = 5840 + INTEGER(IntKi), PARAMETER :: EddVisT8N08D9 = 5841 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D1 = 5842 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D2 = 5843 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D3 = 5844 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D4 = 5845 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D5 = 5846 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D6 = 5847 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D7 = 5848 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D8 = 5849 + INTEGER(IntKi), PARAMETER :: EddVisT8N09D9 = 5850 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D1 = 5851 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D2 = 5852 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D3 = 5853 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D4 = 5854 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D5 = 5855 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D6 = 5856 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D7 = 5857 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D8 = 5858 + INTEGER(IntKi), PARAMETER :: EddVisT8N10D9 = 5859 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D1 = 5860 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D2 = 5861 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D3 = 5862 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D4 = 5863 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D5 = 5864 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D6 = 5865 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D7 = 5866 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D8 = 5867 + INTEGER(IntKi), PARAMETER :: EddVisT8N11D9 = 5868 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D1 = 5869 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D2 = 5870 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D3 = 5871 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D4 = 5872 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D5 = 5873 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D6 = 5874 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D7 = 5875 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D8 = 5876 + INTEGER(IntKi), PARAMETER :: EddVisT8N12D9 = 5877 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D1 = 5878 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D2 = 5879 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D3 = 5880 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D4 = 5881 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D5 = 5882 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D6 = 5883 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D7 = 5884 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D8 = 5885 + INTEGER(IntKi), PARAMETER :: EddVisT8N13D9 = 5886 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D1 = 5887 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D2 = 5888 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D3 = 5889 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D4 = 5890 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D5 = 5891 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D6 = 5892 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D7 = 5893 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D8 = 5894 + INTEGER(IntKi), PARAMETER :: EddVisT8N14D9 = 5895 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D1 = 5896 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D2 = 5897 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D3 = 5898 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D4 = 5899 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D5 = 5900 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D6 = 5901 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D7 = 5902 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D8 = 5903 + INTEGER(IntKi), PARAMETER :: EddVisT8N15D9 = 5904 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D1 = 5905 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D2 = 5906 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D3 = 5907 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D4 = 5908 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D5 = 5909 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D6 = 5910 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D7 = 5911 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D8 = 5912 + INTEGER(IntKi), PARAMETER :: EddVisT8N16D9 = 5913 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D1 = 5914 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D2 = 5915 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D3 = 5916 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D4 = 5917 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D5 = 5918 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D6 = 5919 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D7 = 5920 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D8 = 5921 + INTEGER(IntKi), PARAMETER :: EddVisT8N17D9 = 5922 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D1 = 5923 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D2 = 5924 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D3 = 5925 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D4 = 5926 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D5 = 5927 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D6 = 5928 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D7 = 5929 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D8 = 5930 + INTEGER(IntKi), PARAMETER :: EddVisT8N18D9 = 5931 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D1 = 5932 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D2 = 5933 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D3 = 5934 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D4 = 5935 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D5 = 5936 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D6 = 5937 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D7 = 5938 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D8 = 5939 + INTEGER(IntKi), PARAMETER :: EddVisT8N19D9 = 5940 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D1 = 5941 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D2 = 5942 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D3 = 5943 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D4 = 5944 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D5 = 5945 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D6 = 5946 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D7 = 5947 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D8 = 5948 + INTEGER(IntKi), PARAMETER :: EddVisT8N20D9 = 5949 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D1 = 5950 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D2 = 5951 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D3 = 5952 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D4 = 5953 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D5 = 5954 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D6 = 5955 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D7 = 5956 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D8 = 5957 + INTEGER(IntKi), PARAMETER :: EddVisT9N01D9 = 5958 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D1 = 5959 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D2 = 5960 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D3 = 5961 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D4 = 5962 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D5 = 5963 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D6 = 5964 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D7 = 5965 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D8 = 5966 + INTEGER(IntKi), PARAMETER :: EddVisT9N02D9 = 5967 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D1 = 5968 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D2 = 5969 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D3 = 5970 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D4 = 5971 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D5 = 5972 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D6 = 5973 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D7 = 5974 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D8 = 5975 + INTEGER(IntKi), PARAMETER :: EddVisT9N03D9 = 5976 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D1 = 5977 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D2 = 5978 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D3 = 5979 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D4 = 5980 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D5 = 5981 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D6 = 5982 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D7 = 5983 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D8 = 5984 + INTEGER(IntKi), PARAMETER :: EddVisT9N04D9 = 5985 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D1 = 5986 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D2 = 5987 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D3 = 5988 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D4 = 5989 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D5 = 5990 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D6 = 5991 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D7 = 5992 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D8 = 5993 + INTEGER(IntKi), PARAMETER :: EddVisT9N05D9 = 5994 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D1 = 5995 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D2 = 5996 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D3 = 5997 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D4 = 5998 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D5 = 5999 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D6 = 6000 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D7 = 6001 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D8 = 6002 + INTEGER(IntKi), PARAMETER :: EddVisT9N06D9 = 6003 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D1 = 6004 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D2 = 6005 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D3 = 6006 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D4 = 6007 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D5 = 6008 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D6 = 6009 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D7 = 6010 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D8 = 6011 + INTEGER(IntKi), PARAMETER :: EddVisT9N07D9 = 6012 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D1 = 6013 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D2 = 6014 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D3 = 6015 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D4 = 6016 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D5 = 6017 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D6 = 6018 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D7 = 6019 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D8 = 6020 + INTEGER(IntKi), PARAMETER :: EddVisT9N08D9 = 6021 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D1 = 6022 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D2 = 6023 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D3 = 6024 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D4 = 6025 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D5 = 6026 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D6 = 6027 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D7 = 6028 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D8 = 6029 + INTEGER(IntKi), PARAMETER :: EddVisT9N09D9 = 6030 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D1 = 6031 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D2 = 6032 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D3 = 6033 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D4 = 6034 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D5 = 6035 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D6 = 6036 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D7 = 6037 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D8 = 6038 + INTEGER(IntKi), PARAMETER :: EddVisT9N10D9 = 6039 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D1 = 6040 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D2 = 6041 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D3 = 6042 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D4 = 6043 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D5 = 6044 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D6 = 6045 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D7 = 6046 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D8 = 6047 + INTEGER(IntKi), PARAMETER :: EddVisT9N11D9 = 6048 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D1 = 6049 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D2 = 6050 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D3 = 6051 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D4 = 6052 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D5 = 6053 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D6 = 6054 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D7 = 6055 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D8 = 6056 + INTEGER(IntKi), PARAMETER :: EddVisT9N12D9 = 6057 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D1 = 6058 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D2 = 6059 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D3 = 6060 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D4 = 6061 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D5 = 6062 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D6 = 6063 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D7 = 6064 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D8 = 6065 + INTEGER(IntKi), PARAMETER :: EddVisT9N13D9 = 6066 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D1 = 6067 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D2 = 6068 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D3 = 6069 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D4 = 6070 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D5 = 6071 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D6 = 6072 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D7 = 6073 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D8 = 6074 + INTEGER(IntKi), PARAMETER :: EddVisT9N14D9 = 6075 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D1 = 6076 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D2 = 6077 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D3 = 6078 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D4 = 6079 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D5 = 6080 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D6 = 6081 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D7 = 6082 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D8 = 6083 + INTEGER(IntKi), PARAMETER :: EddVisT9N15D9 = 6084 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D1 = 6085 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D2 = 6086 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D3 = 6087 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D4 = 6088 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D5 = 6089 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D6 = 6090 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D7 = 6091 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D8 = 6092 + INTEGER(IntKi), PARAMETER :: EddVisT9N16D9 = 6093 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D1 = 6094 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D2 = 6095 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D3 = 6096 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D4 = 6097 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D5 = 6098 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D6 = 6099 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D7 = 6100 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D8 = 6101 + INTEGER(IntKi), PARAMETER :: EddVisT9N17D9 = 6102 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D1 = 6103 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D2 = 6104 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D3 = 6105 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D4 = 6106 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D5 = 6107 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D6 = 6108 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D7 = 6109 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D8 = 6110 + INTEGER(IntKi), PARAMETER :: EddVisT9N18D9 = 6111 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D1 = 6112 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D2 = 6113 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D3 = 6114 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D4 = 6115 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D5 = 6116 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D6 = 6117 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D7 = 6118 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D8 = 6119 + INTEGER(IntKi), PARAMETER :: EddVisT9N19D9 = 6120 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D1 = 6121 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D2 = 6122 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D3 = 6123 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D4 = 6124 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D5 = 6125 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D6 = 6126 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D7 = 6127 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D8 = 6128 + INTEGER(IntKi), PARAMETER :: EddVisT9N20D9 = 6129 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D1 = 6130 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D2 = 6131 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D3 = 6132 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D4 = 6133 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D5 = 6134 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D6 = 6135 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D7 = 6136 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D8 = 6137 + INTEGER(IntKi), PARAMETER :: EddAmbT1N01D9 = 6138 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D1 = 6139 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D2 = 6140 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D3 = 6141 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D4 = 6142 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D5 = 6143 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D6 = 6144 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D7 = 6145 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D8 = 6146 + INTEGER(IntKi), PARAMETER :: EddAmbT1N02D9 = 6147 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D1 = 6148 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D2 = 6149 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D3 = 6150 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D4 = 6151 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D5 = 6152 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D6 = 6153 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D7 = 6154 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D8 = 6155 + INTEGER(IntKi), PARAMETER :: EddAmbT1N03D9 = 6156 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D1 = 6157 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D2 = 6158 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D3 = 6159 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D4 = 6160 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D5 = 6161 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D6 = 6162 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D7 = 6163 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D8 = 6164 + INTEGER(IntKi), PARAMETER :: EddAmbT1N04D9 = 6165 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D1 = 6166 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D2 = 6167 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D3 = 6168 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D4 = 6169 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D5 = 6170 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D6 = 6171 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D7 = 6172 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D8 = 6173 + INTEGER(IntKi), PARAMETER :: EddAmbT1N05D9 = 6174 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D1 = 6175 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D2 = 6176 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D3 = 6177 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D4 = 6178 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D5 = 6179 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D6 = 6180 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D7 = 6181 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D8 = 6182 + INTEGER(IntKi), PARAMETER :: EddAmbT1N06D9 = 6183 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D1 = 6184 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D2 = 6185 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D3 = 6186 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D4 = 6187 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D5 = 6188 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D6 = 6189 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D7 = 6190 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D8 = 6191 + INTEGER(IntKi), PARAMETER :: EddAmbT1N07D9 = 6192 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D1 = 6193 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D2 = 6194 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D3 = 6195 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D4 = 6196 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D5 = 6197 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D6 = 6198 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D7 = 6199 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D8 = 6200 + INTEGER(IntKi), PARAMETER :: EddAmbT1N08D9 = 6201 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D1 = 6202 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D2 = 6203 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D3 = 6204 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D4 = 6205 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D5 = 6206 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D6 = 6207 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D7 = 6208 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D8 = 6209 + INTEGER(IntKi), PARAMETER :: EddAmbT1N09D9 = 6210 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D1 = 6211 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D2 = 6212 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D3 = 6213 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D4 = 6214 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D5 = 6215 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D6 = 6216 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D7 = 6217 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D8 = 6218 + INTEGER(IntKi), PARAMETER :: EddAmbT1N10D9 = 6219 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D1 = 6220 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D2 = 6221 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D3 = 6222 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D4 = 6223 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D5 = 6224 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D6 = 6225 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D7 = 6226 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D8 = 6227 + INTEGER(IntKi), PARAMETER :: EddAmbT1N11D9 = 6228 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D1 = 6229 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D2 = 6230 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D3 = 6231 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D4 = 6232 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D5 = 6233 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D6 = 6234 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D7 = 6235 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D8 = 6236 + INTEGER(IntKi), PARAMETER :: EddAmbT1N12D9 = 6237 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D1 = 6238 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D2 = 6239 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D3 = 6240 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D4 = 6241 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D5 = 6242 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D6 = 6243 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D7 = 6244 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D8 = 6245 + INTEGER(IntKi), PARAMETER :: EddAmbT1N13D9 = 6246 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D1 = 6247 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D2 = 6248 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D3 = 6249 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D4 = 6250 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D5 = 6251 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D6 = 6252 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D7 = 6253 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D8 = 6254 + INTEGER(IntKi), PARAMETER :: EddAmbT1N14D9 = 6255 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D1 = 6256 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D2 = 6257 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D3 = 6258 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D4 = 6259 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D5 = 6260 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D6 = 6261 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D7 = 6262 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D8 = 6263 + INTEGER(IntKi), PARAMETER :: EddAmbT1N15D9 = 6264 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D1 = 6265 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D2 = 6266 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D3 = 6267 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D4 = 6268 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D5 = 6269 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D6 = 6270 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D7 = 6271 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D8 = 6272 + INTEGER(IntKi), PARAMETER :: EddAmbT1N16D9 = 6273 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D1 = 6274 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D2 = 6275 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D3 = 6276 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D4 = 6277 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D5 = 6278 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D6 = 6279 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D7 = 6280 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D8 = 6281 + INTEGER(IntKi), PARAMETER :: EddAmbT1N17D9 = 6282 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D1 = 6283 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D2 = 6284 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D3 = 6285 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D4 = 6286 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D5 = 6287 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D6 = 6288 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D7 = 6289 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D8 = 6290 + INTEGER(IntKi), PARAMETER :: EddAmbT1N18D9 = 6291 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D1 = 6292 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D2 = 6293 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D3 = 6294 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D4 = 6295 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D5 = 6296 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D6 = 6297 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D7 = 6298 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D8 = 6299 + INTEGER(IntKi), PARAMETER :: EddAmbT1N19D9 = 6300 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D1 = 6301 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D2 = 6302 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D3 = 6303 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D4 = 6304 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D5 = 6305 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D6 = 6306 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D7 = 6307 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D8 = 6308 + INTEGER(IntKi), PARAMETER :: EddAmbT1N20D9 = 6309 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D1 = 6310 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D2 = 6311 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D3 = 6312 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D4 = 6313 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D5 = 6314 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D6 = 6315 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D7 = 6316 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D8 = 6317 + INTEGER(IntKi), PARAMETER :: EddAmbT2N01D9 = 6318 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D1 = 6319 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D2 = 6320 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D3 = 6321 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D4 = 6322 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D5 = 6323 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D6 = 6324 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D7 = 6325 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D8 = 6326 + INTEGER(IntKi), PARAMETER :: EddAmbT2N02D9 = 6327 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D1 = 6328 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D2 = 6329 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D3 = 6330 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D4 = 6331 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D5 = 6332 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D6 = 6333 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D7 = 6334 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D8 = 6335 + INTEGER(IntKi), PARAMETER :: EddAmbT2N03D9 = 6336 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D1 = 6337 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D2 = 6338 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D3 = 6339 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D4 = 6340 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D5 = 6341 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D6 = 6342 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D7 = 6343 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D8 = 6344 + INTEGER(IntKi), PARAMETER :: EddAmbT2N04D9 = 6345 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D1 = 6346 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D2 = 6347 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D3 = 6348 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D4 = 6349 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D5 = 6350 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D6 = 6351 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D7 = 6352 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D8 = 6353 + INTEGER(IntKi), PARAMETER :: EddAmbT2N05D9 = 6354 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D1 = 6355 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D2 = 6356 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D3 = 6357 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D4 = 6358 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D5 = 6359 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D6 = 6360 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D7 = 6361 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D8 = 6362 + INTEGER(IntKi), PARAMETER :: EddAmbT2N06D9 = 6363 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D1 = 6364 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D2 = 6365 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D3 = 6366 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D4 = 6367 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D5 = 6368 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D6 = 6369 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D7 = 6370 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D8 = 6371 + INTEGER(IntKi), PARAMETER :: EddAmbT2N07D9 = 6372 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D1 = 6373 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D2 = 6374 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D3 = 6375 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D4 = 6376 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D5 = 6377 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D6 = 6378 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D7 = 6379 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D8 = 6380 + INTEGER(IntKi), PARAMETER :: EddAmbT2N08D9 = 6381 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D1 = 6382 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D2 = 6383 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D3 = 6384 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D4 = 6385 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D5 = 6386 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D6 = 6387 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D7 = 6388 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D8 = 6389 + INTEGER(IntKi), PARAMETER :: EddAmbT2N09D9 = 6390 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D1 = 6391 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D2 = 6392 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D3 = 6393 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D4 = 6394 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D5 = 6395 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D6 = 6396 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D7 = 6397 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D8 = 6398 + INTEGER(IntKi), PARAMETER :: EddAmbT2N10D9 = 6399 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D1 = 6400 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D2 = 6401 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D3 = 6402 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D4 = 6403 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D5 = 6404 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D6 = 6405 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D7 = 6406 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D8 = 6407 + INTEGER(IntKi), PARAMETER :: EddAmbT2N11D9 = 6408 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D1 = 6409 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D2 = 6410 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D3 = 6411 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D4 = 6412 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D5 = 6413 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D6 = 6414 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D7 = 6415 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D8 = 6416 + INTEGER(IntKi), PARAMETER :: EddAmbT2N12D9 = 6417 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D1 = 6418 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D2 = 6419 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D3 = 6420 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D4 = 6421 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D5 = 6422 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D6 = 6423 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D7 = 6424 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D8 = 6425 + INTEGER(IntKi), PARAMETER :: EddAmbT2N13D9 = 6426 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D1 = 6427 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D2 = 6428 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D3 = 6429 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D4 = 6430 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D5 = 6431 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D6 = 6432 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D7 = 6433 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D8 = 6434 + INTEGER(IntKi), PARAMETER :: EddAmbT2N14D9 = 6435 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D1 = 6436 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D2 = 6437 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D3 = 6438 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D4 = 6439 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D5 = 6440 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D6 = 6441 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D7 = 6442 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D8 = 6443 + INTEGER(IntKi), PARAMETER :: EddAmbT2N15D9 = 6444 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D1 = 6445 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D2 = 6446 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D3 = 6447 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D4 = 6448 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D5 = 6449 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D6 = 6450 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D7 = 6451 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D8 = 6452 + INTEGER(IntKi), PARAMETER :: EddAmbT2N16D9 = 6453 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D1 = 6454 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D2 = 6455 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D3 = 6456 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D4 = 6457 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D5 = 6458 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D6 = 6459 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D7 = 6460 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D8 = 6461 + INTEGER(IntKi), PARAMETER :: EddAmbT2N17D9 = 6462 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D1 = 6463 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D2 = 6464 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D3 = 6465 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D4 = 6466 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D5 = 6467 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D6 = 6468 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D7 = 6469 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D8 = 6470 + INTEGER(IntKi), PARAMETER :: EddAmbT2N18D9 = 6471 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D1 = 6472 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D2 = 6473 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D3 = 6474 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D4 = 6475 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D5 = 6476 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D6 = 6477 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D7 = 6478 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D8 = 6479 + INTEGER(IntKi), PARAMETER :: EddAmbT2N19D9 = 6480 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D1 = 6481 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D2 = 6482 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D3 = 6483 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D4 = 6484 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D5 = 6485 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D6 = 6486 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D7 = 6487 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D8 = 6488 + INTEGER(IntKi), PARAMETER :: EddAmbT2N20D9 = 6489 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D1 = 6490 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D2 = 6491 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D3 = 6492 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D4 = 6493 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D5 = 6494 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D6 = 6495 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D7 = 6496 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D8 = 6497 + INTEGER(IntKi), PARAMETER :: EddAmbT3N01D9 = 6498 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D1 = 6499 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D2 = 6500 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D3 = 6501 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D4 = 6502 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D5 = 6503 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D6 = 6504 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D7 = 6505 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D8 = 6506 + INTEGER(IntKi), PARAMETER :: EddAmbT3N02D9 = 6507 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D1 = 6508 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D2 = 6509 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D3 = 6510 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D4 = 6511 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D5 = 6512 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D6 = 6513 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D7 = 6514 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D8 = 6515 + INTEGER(IntKi), PARAMETER :: EddAmbT3N03D9 = 6516 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D1 = 6517 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D2 = 6518 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D3 = 6519 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D4 = 6520 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D5 = 6521 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D6 = 6522 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D7 = 6523 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D8 = 6524 + INTEGER(IntKi), PARAMETER :: EddAmbT3N04D9 = 6525 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D1 = 6526 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D2 = 6527 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D3 = 6528 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D4 = 6529 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D5 = 6530 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D6 = 6531 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D7 = 6532 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D8 = 6533 + INTEGER(IntKi), PARAMETER :: EddAmbT3N05D9 = 6534 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D1 = 6535 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D2 = 6536 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D3 = 6537 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D4 = 6538 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D5 = 6539 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D6 = 6540 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D7 = 6541 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D8 = 6542 + INTEGER(IntKi), PARAMETER :: EddAmbT3N06D9 = 6543 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D1 = 6544 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D2 = 6545 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D3 = 6546 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D4 = 6547 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D5 = 6548 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D6 = 6549 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D7 = 6550 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D8 = 6551 + INTEGER(IntKi), PARAMETER :: EddAmbT3N07D9 = 6552 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D1 = 6553 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D2 = 6554 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D3 = 6555 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D4 = 6556 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D5 = 6557 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D6 = 6558 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D7 = 6559 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D8 = 6560 + INTEGER(IntKi), PARAMETER :: EddAmbT3N08D9 = 6561 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D1 = 6562 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D2 = 6563 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D3 = 6564 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D4 = 6565 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D5 = 6566 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D6 = 6567 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D7 = 6568 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D8 = 6569 + INTEGER(IntKi), PARAMETER :: EddAmbT3N09D9 = 6570 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D1 = 6571 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D2 = 6572 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D3 = 6573 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D4 = 6574 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D5 = 6575 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D6 = 6576 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D7 = 6577 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D8 = 6578 + INTEGER(IntKi), PARAMETER :: EddAmbT3N10D9 = 6579 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D1 = 6580 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D2 = 6581 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D3 = 6582 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D4 = 6583 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D5 = 6584 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D6 = 6585 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D7 = 6586 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D8 = 6587 + INTEGER(IntKi), PARAMETER :: EddAmbT3N11D9 = 6588 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D1 = 6589 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D2 = 6590 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D3 = 6591 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D4 = 6592 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D5 = 6593 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D6 = 6594 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D7 = 6595 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D8 = 6596 + INTEGER(IntKi), PARAMETER :: EddAmbT3N12D9 = 6597 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D1 = 6598 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D2 = 6599 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D3 = 6600 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D4 = 6601 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D5 = 6602 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D6 = 6603 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D7 = 6604 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D8 = 6605 + INTEGER(IntKi), PARAMETER :: EddAmbT3N13D9 = 6606 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D1 = 6607 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D2 = 6608 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D3 = 6609 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D4 = 6610 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D5 = 6611 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D6 = 6612 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D7 = 6613 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D8 = 6614 + INTEGER(IntKi), PARAMETER :: EddAmbT3N14D9 = 6615 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D1 = 6616 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D2 = 6617 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D3 = 6618 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D4 = 6619 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D5 = 6620 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D6 = 6621 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D7 = 6622 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D8 = 6623 + INTEGER(IntKi), PARAMETER :: EddAmbT3N15D9 = 6624 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D1 = 6625 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D2 = 6626 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D3 = 6627 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D4 = 6628 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D5 = 6629 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D6 = 6630 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D7 = 6631 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D8 = 6632 + INTEGER(IntKi), PARAMETER :: EddAmbT3N16D9 = 6633 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D1 = 6634 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D2 = 6635 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D3 = 6636 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D4 = 6637 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D5 = 6638 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D6 = 6639 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D7 = 6640 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D8 = 6641 + INTEGER(IntKi), PARAMETER :: EddAmbT3N17D9 = 6642 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D1 = 6643 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D2 = 6644 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D3 = 6645 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D4 = 6646 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D5 = 6647 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D6 = 6648 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D7 = 6649 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D8 = 6650 + INTEGER(IntKi), PARAMETER :: EddAmbT3N18D9 = 6651 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D1 = 6652 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D2 = 6653 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D3 = 6654 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D4 = 6655 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D5 = 6656 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D6 = 6657 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D7 = 6658 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D8 = 6659 + INTEGER(IntKi), PARAMETER :: EddAmbT3N19D9 = 6660 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D1 = 6661 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D2 = 6662 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D3 = 6663 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D4 = 6664 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D5 = 6665 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D6 = 6666 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D7 = 6667 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D8 = 6668 + INTEGER(IntKi), PARAMETER :: EddAmbT3N20D9 = 6669 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D1 = 6670 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D2 = 6671 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D3 = 6672 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D4 = 6673 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D5 = 6674 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D6 = 6675 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D7 = 6676 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D8 = 6677 + INTEGER(IntKi), PARAMETER :: EddAmbT4N01D9 = 6678 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D1 = 6679 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D2 = 6680 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D3 = 6681 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D4 = 6682 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D5 = 6683 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D6 = 6684 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D7 = 6685 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D8 = 6686 + INTEGER(IntKi), PARAMETER :: EddAmbT4N02D9 = 6687 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D1 = 6688 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D2 = 6689 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D3 = 6690 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D4 = 6691 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D5 = 6692 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D6 = 6693 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D7 = 6694 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D8 = 6695 + INTEGER(IntKi), PARAMETER :: EddAmbT4N03D9 = 6696 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D1 = 6697 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D2 = 6698 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D3 = 6699 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D4 = 6700 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D5 = 6701 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D6 = 6702 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D7 = 6703 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D8 = 6704 + INTEGER(IntKi), PARAMETER :: EddAmbT4N04D9 = 6705 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D1 = 6706 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D2 = 6707 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D3 = 6708 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D4 = 6709 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D5 = 6710 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D6 = 6711 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D7 = 6712 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D8 = 6713 + INTEGER(IntKi), PARAMETER :: EddAmbT4N05D9 = 6714 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D1 = 6715 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D2 = 6716 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D3 = 6717 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D4 = 6718 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D5 = 6719 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D6 = 6720 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D7 = 6721 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D8 = 6722 + INTEGER(IntKi), PARAMETER :: EddAmbT4N06D9 = 6723 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D1 = 6724 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D2 = 6725 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D3 = 6726 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D4 = 6727 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D5 = 6728 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D6 = 6729 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D7 = 6730 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D8 = 6731 + INTEGER(IntKi), PARAMETER :: EddAmbT4N07D9 = 6732 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D1 = 6733 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D2 = 6734 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D3 = 6735 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D4 = 6736 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D5 = 6737 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D6 = 6738 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D7 = 6739 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D8 = 6740 + INTEGER(IntKi), PARAMETER :: EddAmbT4N08D9 = 6741 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D1 = 6742 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D2 = 6743 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D3 = 6744 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D4 = 6745 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D5 = 6746 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D6 = 6747 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D7 = 6748 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D8 = 6749 + INTEGER(IntKi), PARAMETER :: EddAmbT4N09D9 = 6750 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D1 = 6751 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D2 = 6752 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D3 = 6753 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D4 = 6754 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D5 = 6755 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D6 = 6756 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D7 = 6757 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D8 = 6758 + INTEGER(IntKi), PARAMETER :: EddAmbT4N10D9 = 6759 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D1 = 6760 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D2 = 6761 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D3 = 6762 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D4 = 6763 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D5 = 6764 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D6 = 6765 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D7 = 6766 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D8 = 6767 + INTEGER(IntKi), PARAMETER :: EddAmbT4N11D9 = 6768 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D1 = 6769 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D2 = 6770 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D3 = 6771 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D4 = 6772 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D5 = 6773 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D6 = 6774 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D7 = 6775 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D8 = 6776 + INTEGER(IntKi), PARAMETER :: EddAmbT4N12D9 = 6777 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D1 = 6778 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D2 = 6779 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D3 = 6780 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D4 = 6781 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D5 = 6782 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D6 = 6783 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D7 = 6784 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D8 = 6785 + INTEGER(IntKi), PARAMETER :: EddAmbT4N13D9 = 6786 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D1 = 6787 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D2 = 6788 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D3 = 6789 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D4 = 6790 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D5 = 6791 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D6 = 6792 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D7 = 6793 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D8 = 6794 + INTEGER(IntKi), PARAMETER :: EddAmbT4N14D9 = 6795 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D1 = 6796 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D2 = 6797 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D3 = 6798 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D4 = 6799 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D5 = 6800 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D6 = 6801 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D7 = 6802 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D8 = 6803 + INTEGER(IntKi), PARAMETER :: EddAmbT4N15D9 = 6804 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D1 = 6805 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D2 = 6806 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D3 = 6807 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D4 = 6808 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D5 = 6809 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D6 = 6810 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D7 = 6811 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D8 = 6812 + INTEGER(IntKi), PARAMETER :: EddAmbT4N16D9 = 6813 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D1 = 6814 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D2 = 6815 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D3 = 6816 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D4 = 6817 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D5 = 6818 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D6 = 6819 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D7 = 6820 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D8 = 6821 + INTEGER(IntKi), PARAMETER :: EddAmbT4N17D9 = 6822 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D1 = 6823 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D2 = 6824 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D3 = 6825 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D4 = 6826 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D5 = 6827 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D6 = 6828 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D7 = 6829 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D8 = 6830 + INTEGER(IntKi), PARAMETER :: EddAmbT4N18D9 = 6831 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D1 = 6832 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D2 = 6833 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D3 = 6834 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D4 = 6835 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D5 = 6836 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D6 = 6837 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D7 = 6838 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D8 = 6839 + INTEGER(IntKi), PARAMETER :: EddAmbT4N19D9 = 6840 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D1 = 6841 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D2 = 6842 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D3 = 6843 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D4 = 6844 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D5 = 6845 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D6 = 6846 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D7 = 6847 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D8 = 6848 + INTEGER(IntKi), PARAMETER :: EddAmbT4N20D9 = 6849 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D1 = 6850 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D2 = 6851 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D3 = 6852 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D4 = 6853 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D5 = 6854 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D6 = 6855 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D7 = 6856 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D8 = 6857 + INTEGER(IntKi), PARAMETER :: EddAmbT5N01D9 = 6858 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D1 = 6859 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D2 = 6860 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D3 = 6861 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D4 = 6862 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D5 = 6863 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D6 = 6864 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D7 = 6865 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D8 = 6866 + INTEGER(IntKi), PARAMETER :: EddAmbT5N02D9 = 6867 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D1 = 6868 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D2 = 6869 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D3 = 6870 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D4 = 6871 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D5 = 6872 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D6 = 6873 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D7 = 6874 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D8 = 6875 + INTEGER(IntKi), PARAMETER :: EddAmbT5N03D9 = 6876 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D1 = 6877 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D2 = 6878 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D3 = 6879 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D4 = 6880 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D5 = 6881 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D6 = 6882 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D7 = 6883 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D8 = 6884 + INTEGER(IntKi), PARAMETER :: EddAmbT5N04D9 = 6885 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D1 = 6886 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D2 = 6887 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D3 = 6888 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D4 = 6889 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D5 = 6890 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D6 = 6891 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D7 = 6892 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D8 = 6893 + INTEGER(IntKi), PARAMETER :: EddAmbT5N05D9 = 6894 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D1 = 6895 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D2 = 6896 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D3 = 6897 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D4 = 6898 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D5 = 6899 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D6 = 6900 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D7 = 6901 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D8 = 6902 + INTEGER(IntKi), PARAMETER :: EddAmbT5N06D9 = 6903 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D1 = 6904 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D2 = 6905 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D3 = 6906 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D4 = 6907 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D5 = 6908 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D6 = 6909 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D7 = 6910 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D8 = 6911 + INTEGER(IntKi), PARAMETER :: EddAmbT5N07D9 = 6912 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D1 = 6913 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D2 = 6914 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D3 = 6915 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D4 = 6916 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D5 = 6917 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D6 = 6918 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D7 = 6919 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D8 = 6920 + INTEGER(IntKi), PARAMETER :: EddAmbT5N08D9 = 6921 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D1 = 6922 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D2 = 6923 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D3 = 6924 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D4 = 6925 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D5 = 6926 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D6 = 6927 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D7 = 6928 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D8 = 6929 + INTEGER(IntKi), PARAMETER :: EddAmbT5N09D9 = 6930 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D1 = 6931 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D2 = 6932 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D3 = 6933 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D4 = 6934 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D5 = 6935 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D6 = 6936 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D7 = 6937 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D8 = 6938 + INTEGER(IntKi), PARAMETER :: EddAmbT5N10D9 = 6939 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D1 = 6940 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D2 = 6941 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D3 = 6942 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D4 = 6943 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D5 = 6944 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D6 = 6945 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D7 = 6946 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D8 = 6947 + INTEGER(IntKi), PARAMETER :: EddAmbT5N11D9 = 6948 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D1 = 6949 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D2 = 6950 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D3 = 6951 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D4 = 6952 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D5 = 6953 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D6 = 6954 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D7 = 6955 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D8 = 6956 + INTEGER(IntKi), PARAMETER :: EddAmbT5N12D9 = 6957 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D1 = 6958 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D2 = 6959 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D3 = 6960 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D4 = 6961 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D5 = 6962 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D6 = 6963 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D7 = 6964 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D8 = 6965 + INTEGER(IntKi), PARAMETER :: EddAmbT5N13D9 = 6966 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D1 = 6967 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D2 = 6968 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D3 = 6969 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D4 = 6970 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D5 = 6971 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D6 = 6972 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D7 = 6973 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D8 = 6974 + INTEGER(IntKi), PARAMETER :: EddAmbT5N14D9 = 6975 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D1 = 6976 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D2 = 6977 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D3 = 6978 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D4 = 6979 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D5 = 6980 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D6 = 6981 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D7 = 6982 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D8 = 6983 + INTEGER(IntKi), PARAMETER :: EddAmbT5N15D9 = 6984 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D1 = 6985 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D2 = 6986 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D3 = 6987 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D4 = 6988 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D5 = 6989 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D6 = 6990 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D7 = 6991 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D8 = 6992 + INTEGER(IntKi), PARAMETER :: EddAmbT5N16D9 = 6993 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D1 = 6994 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D2 = 6995 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D3 = 6996 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D4 = 6997 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D5 = 6998 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D6 = 6999 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D7 = 7000 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D8 = 7001 + INTEGER(IntKi), PARAMETER :: EddAmbT5N17D9 = 7002 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D1 = 7003 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D2 = 7004 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D3 = 7005 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D4 = 7006 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D5 = 7007 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D6 = 7008 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D7 = 7009 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D8 = 7010 + INTEGER(IntKi), PARAMETER :: EddAmbT5N18D9 = 7011 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D1 = 7012 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D2 = 7013 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D3 = 7014 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D4 = 7015 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D5 = 7016 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D6 = 7017 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D7 = 7018 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D8 = 7019 + INTEGER(IntKi), PARAMETER :: EddAmbT5N19D9 = 7020 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D1 = 7021 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D2 = 7022 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D3 = 7023 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D4 = 7024 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D5 = 7025 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D6 = 7026 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D7 = 7027 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D8 = 7028 + INTEGER(IntKi), PARAMETER :: EddAmbT5N20D9 = 7029 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D1 = 7030 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D2 = 7031 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D3 = 7032 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D4 = 7033 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D5 = 7034 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D6 = 7035 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D7 = 7036 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D8 = 7037 + INTEGER(IntKi), PARAMETER :: EddAmbT6N01D9 = 7038 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D1 = 7039 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D2 = 7040 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D3 = 7041 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D4 = 7042 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D5 = 7043 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D6 = 7044 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D7 = 7045 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D8 = 7046 + INTEGER(IntKi), PARAMETER :: EddAmbT6N02D9 = 7047 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D1 = 7048 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D2 = 7049 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D3 = 7050 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D4 = 7051 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D5 = 7052 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D6 = 7053 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D7 = 7054 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D8 = 7055 + INTEGER(IntKi), PARAMETER :: EddAmbT6N03D9 = 7056 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D1 = 7057 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D2 = 7058 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D3 = 7059 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D4 = 7060 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D5 = 7061 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D6 = 7062 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D7 = 7063 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D8 = 7064 + INTEGER(IntKi), PARAMETER :: EddAmbT6N04D9 = 7065 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D1 = 7066 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D2 = 7067 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D3 = 7068 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D4 = 7069 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D5 = 7070 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D6 = 7071 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D7 = 7072 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D8 = 7073 + INTEGER(IntKi), PARAMETER :: EddAmbT6N05D9 = 7074 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D1 = 7075 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D2 = 7076 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D3 = 7077 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D4 = 7078 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D5 = 7079 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D6 = 7080 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D7 = 7081 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D8 = 7082 + INTEGER(IntKi), PARAMETER :: EddAmbT6N06D9 = 7083 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D1 = 7084 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D2 = 7085 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D3 = 7086 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D4 = 7087 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D5 = 7088 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D6 = 7089 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D7 = 7090 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D8 = 7091 + INTEGER(IntKi), PARAMETER :: EddAmbT6N07D9 = 7092 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D1 = 7093 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D2 = 7094 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D3 = 7095 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D4 = 7096 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D5 = 7097 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D6 = 7098 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D7 = 7099 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D8 = 7100 + INTEGER(IntKi), PARAMETER :: EddAmbT6N08D9 = 7101 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D1 = 7102 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D2 = 7103 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D3 = 7104 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D4 = 7105 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D5 = 7106 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D6 = 7107 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D7 = 7108 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D8 = 7109 + INTEGER(IntKi), PARAMETER :: EddAmbT6N09D9 = 7110 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D1 = 7111 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D2 = 7112 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D3 = 7113 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D4 = 7114 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D5 = 7115 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D6 = 7116 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D7 = 7117 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D8 = 7118 + INTEGER(IntKi), PARAMETER :: EddAmbT6N10D9 = 7119 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D1 = 7120 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D2 = 7121 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D3 = 7122 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D4 = 7123 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D5 = 7124 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D6 = 7125 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D7 = 7126 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D8 = 7127 + INTEGER(IntKi), PARAMETER :: EddAmbT6N11D9 = 7128 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D1 = 7129 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D2 = 7130 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D3 = 7131 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D4 = 7132 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D5 = 7133 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D6 = 7134 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D7 = 7135 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D8 = 7136 + INTEGER(IntKi), PARAMETER :: EddAmbT6N12D9 = 7137 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D1 = 7138 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D2 = 7139 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D3 = 7140 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D4 = 7141 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D5 = 7142 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D6 = 7143 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D7 = 7144 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D8 = 7145 + INTEGER(IntKi), PARAMETER :: EddAmbT6N13D9 = 7146 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D1 = 7147 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D2 = 7148 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D3 = 7149 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D4 = 7150 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D5 = 7151 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D6 = 7152 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D7 = 7153 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D8 = 7154 + INTEGER(IntKi), PARAMETER :: EddAmbT6N14D9 = 7155 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D1 = 7156 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D2 = 7157 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D3 = 7158 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D4 = 7159 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D5 = 7160 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D6 = 7161 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D7 = 7162 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D8 = 7163 + INTEGER(IntKi), PARAMETER :: EddAmbT6N15D9 = 7164 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D1 = 7165 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D2 = 7166 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D3 = 7167 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D4 = 7168 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D5 = 7169 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D6 = 7170 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D7 = 7171 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D8 = 7172 + INTEGER(IntKi), PARAMETER :: EddAmbT6N16D9 = 7173 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D1 = 7174 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D2 = 7175 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D3 = 7176 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D4 = 7177 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D5 = 7178 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D6 = 7179 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D7 = 7180 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D8 = 7181 + INTEGER(IntKi), PARAMETER :: EddAmbT6N17D9 = 7182 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D1 = 7183 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D2 = 7184 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D3 = 7185 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D4 = 7186 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D5 = 7187 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D6 = 7188 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D7 = 7189 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D8 = 7190 + INTEGER(IntKi), PARAMETER :: EddAmbT6N18D9 = 7191 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D1 = 7192 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D2 = 7193 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D3 = 7194 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D4 = 7195 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D5 = 7196 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D6 = 7197 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D7 = 7198 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D8 = 7199 + INTEGER(IntKi), PARAMETER :: EddAmbT6N19D9 = 7200 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D1 = 7201 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D2 = 7202 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D3 = 7203 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D4 = 7204 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D5 = 7205 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D6 = 7206 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D7 = 7207 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D8 = 7208 + INTEGER(IntKi), PARAMETER :: EddAmbT6N20D9 = 7209 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D1 = 7210 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D2 = 7211 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D3 = 7212 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D4 = 7213 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D5 = 7214 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D6 = 7215 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D7 = 7216 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D8 = 7217 + INTEGER(IntKi), PARAMETER :: EddAmbT7N01D9 = 7218 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D1 = 7219 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D2 = 7220 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D3 = 7221 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D4 = 7222 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D5 = 7223 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D6 = 7224 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D7 = 7225 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D8 = 7226 + INTEGER(IntKi), PARAMETER :: EddAmbT7N02D9 = 7227 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D1 = 7228 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D2 = 7229 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D3 = 7230 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D4 = 7231 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D5 = 7232 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D6 = 7233 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D7 = 7234 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D8 = 7235 + INTEGER(IntKi), PARAMETER :: EddAmbT7N03D9 = 7236 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D1 = 7237 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D2 = 7238 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D3 = 7239 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D4 = 7240 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D5 = 7241 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D6 = 7242 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D7 = 7243 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D8 = 7244 + INTEGER(IntKi), PARAMETER :: EddAmbT7N04D9 = 7245 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D1 = 7246 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D2 = 7247 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D3 = 7248 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D4 = 7249 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D5 = 7250 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D6 = 7251 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D7 = 7252 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D8 = 7253 + INTEGER(IntKi), PARAMETER :: EddAmbT7N05D9 = 7254 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D1 = 7255 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D2 = 7256 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D3 = 7257 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D4 = 7258 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D5 = 7259 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D6 = 7260 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D7 = 7261 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D8 = 7262 + INTEGER(IntKi), PARAMETER :: EddAmbT7N06D9 = 7263 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D1 = 7264 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D2 = 7265 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D3 = 7266 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D4 = 7267 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D5 = 7268 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D6 = 7269 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D7 = 7270 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D8 = 7271 + INTEGER(IntKi), PARAMETER :: EddAmbT7N07D9 = 7272 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D1 = 7273 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D2 = 7274 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D3 = 7275 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D4 = 7276 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D5 = 7277 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D6 = 7278 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D7 = 7279 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D8 = 7280 + INTEGER(IntKi), PARAMETER :: EddAmbT7N08D9 = 7281 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D1 = 7282 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D2 = 7283 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D3 = 7284 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D4 = 7285 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D5 = 7286 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D6 = 7287 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D7 = 7288 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D8 = 7289 + INTEGER(IntKi), PARAMETER :: EddAmbT7N09D9 = 7290 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D1 = 7291 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D2 = 7292 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D3 = 7293 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D4 = 7294 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D5 = 7295 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D6 = 7296 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D7 = 7297 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D8 = 7298 + INTEGER(IntKi), PARAMETER :: EddAmbT7N10D9 = 7299 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D1 = 7300 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D2 = 7301 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D3 = 7302 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D4 = 7303 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D5 = 7304 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D6 = 7305 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D7 = 7306 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D8 = 7307 + INTEGER(IntKi), PARAMETER :: EddAmbT7N11D9 = 7308 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D1 = 7309 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D2 = 7310 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D3 = 7311 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D4 = 7312 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D5 = 7313 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D6 = 7314 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D7 = 7315 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D8 = 7316 + INTEGER(IntKi), PARAMETER :: EddAmbT7N12D9 = 7317 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D1 = 7318 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D2 = 7319 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D3 = 7320 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D4 = 7321 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D5 = 7322 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D6 = 7323 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D7 = 7324 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D8 = 7325 + INTEGER(IntKi), PARAMETER :: EddAmbT7N13D9 = 7326 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D1 = 7327 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D2 = 7328 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D3 = 7329 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D4 = 7330 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D5 = 7331 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D6 = 7332 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D7 = 7333 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D8 = 7334 + INTEGER(IntKi), PARAMETER :: EddAmbT7N14D9 = 7335 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D1 = 7336 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D2 = 7337 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D3 = 7338 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D4 = 7339 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D5 = 7340 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D6 = 7341 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D7 = 7342 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D8 = 7343 + INTEGER(IntKi), PARAMETER :: EddAmbT7N15D9 = 7344 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D1 = 7345 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D2 = 7346 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D3 = 7347 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D4 = 7348 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D5 = 7349 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D6 = 7350 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D7 = 7351 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D8 = 7352 + INTEGER(IntKi), PARAMETER :: EddAmbT7N16D9 = 7353 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D1 = 7354 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D2 = 7355 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D3 = 7356 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D4 = 7357 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D5 = 7358 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D6 = 7359 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D7 = 7360 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D8 = 7361 + INTEGER(IntKi), PARAMETER :: EddAmbT7N17D9 = 7362 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D1 = 7363 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D2 = 7364 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D3 = 7365 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D4 = 7366 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D5 = 7367 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D6 = 7368 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D7 = 7369 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D8 = 7370 + INTEGER(IntKi), PARAMETER :: EddAmbT7N18D9 = 7371 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D1 = 7372 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D2 = 7373 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D3 = 7374 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D4 = 7375 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D5 = 7376 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D6 = 7377 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D7 = 7378 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D8 = 7379 + INTEGER(IntKi), PARAMETER :: EddAmbT7N19D9 = 7380 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D1 = 7381 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D2 = 7382 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D3 = 7383 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D4 = 7384 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D5 = 7385 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D6 = 7386 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D7 = 7387 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D8 = 7388 + INTEGER(IntKi), PARAMETER :: EddAmbT7N20D9 = 7389 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D1 = 7390 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D2 = 7391 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D3 = 7392 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D4 = 7393 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D5 = 7394 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D6 = 7395 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D7 = 7396 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D8 = 7397 + INTEGER(IntKi), PARAMETER :: EddAmbT8N01D9 = 7398 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D1 = 7399 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D2 = 7400 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D3 = 7401 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D4 = 7402 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D5 = 7403 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D6 = 7404 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D7 = 7405 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D8 = 7406 + INTEGER(IntKi), PARAMETER :: EddAmbT8N02D9 = 7407 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D1 = 7408 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D2 = 7409 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D3 = 7410 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D4 = 7411 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D5 = 7412 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D6 = 7413 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D7 = 7414 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D8 = 7415 + INTEGER(IntKi), PARAMETER :: EddAmbT8N03D9 = 7416 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D1 = 7417 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D2 = 7418 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D3 = 7419 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D4 = 7420 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D5 = 7421 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D6 = 7422 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D7 = 7423 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D8 = 7424 + INTEGER(IntKi), PARAMETER :: EddAmbT8N04D9 = 7425 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D1 = 7426 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D2 = 7427 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D3 = 7428 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D4 = 7429 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D5 = 7430 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D6 = 7431 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D7 = 7432 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D8 = 7433 + INTEGER(IntKi), PARAMETER :: EddAmbT8N05D9 = 7434 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D1 = 7435 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D2 = 7436 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D3 = 7437 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D4 = 7438 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D5 = 7439 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D6 = 7440 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D7 = 7441 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D8 = 7442 + INTEGER(IntKi), PARAMETER :: EddAmbT8N06D9 = 7443 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D1 = 7444 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D2 = 7445 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D3 = 7446 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D4 = 7447 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D5 = 7448 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D6 = 7449 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D7 = 7450 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D8 = 7451 + INTEGER(IntKi), PARAMETER :: EddAmbT8N07D9 = 7452 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D1 = 7453 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D2 = 7454 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D3 = 7455 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D4 = 7456 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D5 = 7457 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D6 = 7458 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D7 = 7459 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D8 = 7460 + INTEGER(IntKi), PARAMETER :: EddAmbT8N08D9 = 7461 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D1 = 7462 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D2 = 7463 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D3 = 7464 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D4 = 7465 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D5 = 7466 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D6 = 7467 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D7 = 7468 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D8 = 7469 + INTEGER(IntKi), PARAMETER :: EddAmbT8N09D9 = 7470 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D1 = 7471 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D2 = 7472 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D3 = 7473 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D4 = 7474 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D5 = 7475 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D6 = 7476 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D7 = 7477 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D8 = 7478 + INTEGER(IntKi), PARAMETER :: EddAmbT8N10D9 = 7479 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D1 = 7480 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D2 = 7481 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D3 = 7482 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D4 = 7483 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D5 = 7484 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D6 = 7485 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D7 = 7486 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D8 = 7487 + INTEGER(IntKi), PARAMETER :: EddAmbT8N11D9 = 7488 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D1 = 7489 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D2 = 7490 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D3 = 7491 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D4 = 7492 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D5 = 7493 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D6 = 7494 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D7 = 7495 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D8 = 7496 + INTEGER(IntKi), PARAMETER :: EddAmbT8N12D9 = 7497 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D1 = 7498 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D2 = 7499 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D3 = 7500 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D4 = 7501 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D5 = 7502 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D6 = 7503 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D7 = 7504 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D8 = 7505 + INTEGER(IntKi), PARAMETER :: EddAmbT8N13D9 = 7506 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D1 = 7507 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D2 = 7508 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D3 = 7509 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D4 = 7510 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D5 = 7511 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D6 = 7512 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D7 = 7513 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D8 = 7514 + INTEGER(IntKi), PARAMETER :: EddAmbT8N14D9 = 7515 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D1 = 7516 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D2 = 7517 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D3 = 7518 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D4 = 7519 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D5 = 7520 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D6 = 7521 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D7 = 7522 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D8 = 7523 + INTEGER(IntKi), PARAMETER :: EddAmbT8N15D9 = 7524 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D1 = 7525 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D2 = 7526 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D3 = 7527 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D4 = 7528 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D5 = 7529 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D6 = 7530 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D7 = 7531 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D8 = 7532 + INTEGER(IntKi), PARAMETER :: EddAmbT8N16D9 = 7533 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D1 = 7534 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D2 = 7535 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D3 = 7536 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D4 = 7537 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D5 = 7538 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D6 = 7539 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D7 = 7540 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D8 = 7541 + INTEGER(IntKi), PARAMETER :: EddAmbT8N17D9 = 7542 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D1 = 7543 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D2 = 7544 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D3 = 7545 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D4 = 7546 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D5 = 7547 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D6 = 7548 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D7 = 7549 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D8 = 7550 + INTEGER(IntKi), PARAMETER :: EddAmbT8N18D9 = 7551 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D1 = 7552 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D2 = 7553 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D3 = 7554 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D4 = 7555 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D5 = 7556 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D6 = 7557 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D7 = 7558 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D8 = 7559 + INTEGER(IntKi), PARAMETER :: EddAmbT8N19D9 = 7560 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D1 = 7561 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D2 = 7562 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D3 = 7563 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D4 = 7564 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D5 = 7565 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D6 = 7566 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D7 = 7567 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D8 = 7568 + INTEGER(IntKi), PARAMETER :: EddAmbT8N20D9 = 7569 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D1 = 7570 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D2 = 7571 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D3 = 7572 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D4 = 7573 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D5 = 7574 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D6 = 7575 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D7 = 7576 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D8 = 7577 + INTEGER(IntKi), PARAMETER :: EddAmbT9N01D9 = 7578 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D1 = 7579 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D2 = 7580 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D3 = 7581 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D4 = 7582 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D5 = 7583 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D6 = 7584 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D7 = 7585 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D8 = 7586 + INTEGER(IntKi), PARAMETER :: EddAmbT9N02D9 = 7587 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D1 = 7588 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D2 = 7589 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D3 = 7590 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D4 = 7591 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D5 = 7592 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D6 = 7593 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D7 = 7594 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D8 = 7595 + INTEGER(IntKi), PARAMETER :: EddAmbT9N03D9 = 7596 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D1 = 7597 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D2 = 7598 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D3 = 7599 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D4 = 7600 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D5 = 7601 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D6 = 7602 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D7 = 7603 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D8 = 7604 + INTEGER(IntKi), PARAMETER :: EddAmbT9N04D9 = 7605 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D1 = 7606 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D2 = 7607 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D3 = 7608 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D4 = 7609 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D5 = 7610 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D6 = 7611 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D7 = 7612 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D8 = 7613 + INTEGER(IntKi), PARAMETER :: EddAmbT9N05D9 = 7614 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D1 = 7615 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D2 = 7616 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D3 = 7617 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D4 = 7618 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D5 = 7619 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D6 = 7620 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D7 = 7621 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D8 = 7622 + INTEGER(IntKi), PARAMETER :: EddAmbT9N06D9 = 7623 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D1 = 7624 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D2 = 7625 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D3 = 7626 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D4 = 7627 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D5 = 7628 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D6 = 7629 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D7 = 7630 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D8 = 7631 + INTEGER(IntKi), PARAMETER :: EddAmbT9N07D9 = 7632 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D1 = 7633 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D2 = 7634 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D3 = 7635 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D4 = 7636 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D5 = 7637 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D6 = 7638 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D7 = 7639 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D8 = 7640 + INTEGER(IntKi), PARAMETER :: EddAmbT9N08D9 = 7641 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D1 = 7642 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D2 = 7643 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D3 = 7644 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D4 = 7645 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D5 = 7646 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D6 = 7647 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D7 = 7648 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D8 = 7649 + INTEGER(IntKi), PARAMETER :: EddAmbT9N09D9 = 7650 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D1 = 7651 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D2 = 7652 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D3 = 7653 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D4 = 7654 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D5 = 7655 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D6 = 7656 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D7 = 7657 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D8 = 7658 + INTEGER(IntKi), PARAMETER :: EddAmbT9N10D9 = 7659 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D1 = 7660 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D2 = 7661 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D3 = 7662 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D4 = 7663 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D5 = 7664 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D6 = 7665 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D7 = 7666 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D8 = 7667 + INTEGER(IntKi), PARAMETER :: EddAmbT9N11D9 = 7668 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D1 = 7669 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D2 = 7670 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D3 = 7671 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D4 = 7672 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D5 = 7673 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D6 = 7674 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D7 = 7675 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D8 = 7676 + INTEGER(IntKi), PARAMETER :: EddAmbT9N12D9 = 7677 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D1 = 7678 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D2 = 7679 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D3 = 7680 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D4 = 7681 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D5 = 7682 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D6 = 7683 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D7 = 7684 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D8 = 7685 + INTEGER(IntKi), PARAMETER :: EddAmbT9N13D9 = 7686 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D1 = 7687 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D2 = 7688 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D3 = 7689 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D4 = 7690 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D5 = 7691 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D6 = 7692 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D7 = 7693 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D8 = 7694 + INTEGER(IntKi), PARAMETER :: EddAmbT9N14D9 = 7695 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D1 = 7696 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D2 = 7697 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D3 = 7698 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D4 = 7699 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D5 = 7700 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D6 = 7701 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D7 = 7702 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D8 = 7703 + INTEGER(IntKi), PARAMETER :: EddAmbT9N15D9 = 7704 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D1 = 7705 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D2 = 7706 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D3 = 7707 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D4 = 7708 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D5 = 7709 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D6 = 7710 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D7 = 7711 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D8 = 7712 + INTEGER(IntKi), PARAMETER :: EddAmbT9N16D9 = 7713 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D1 = 7714 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D2 = 7715 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D3 = 7716 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D4 = 7717 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D5 = 7718 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D6 = 7719 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D7 = 7720 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D8 = 7721 + INTEGER(IntKi), PARAMETER :: EddAmbT9N17D9 = 7722 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D1 = 7723 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D2 = 7724 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D3 = 7725 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D4 = 7726 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D5 = 7727 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D6 = 7728 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D7 = 7729 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D8 = 7730 + INTEGER(IntKi), PARAMETER :: EddAmbT9N18D9 = 7731 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D1 = 7732 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D2 = 7733 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D3 = 7734 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D4 = 7735 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D5 = 7736 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D6 = 7737 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D7 = 7738 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D8 = 7739 + INTEGER(IntKi), PARAMETER :: EddAmbT9N19D9 = 7740 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D1 = 7741 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D2 = 7742 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D3 = 7743 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D4 = 7744 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D5 = 7745 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D6 = 7746 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D7 = 7747 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D8 = 7748 + INTEGER(IntKi), PARAMETER :: EddAmbT9N20D9 = 7749 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D1 = 7750 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D2 = 7751 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D3 = 7752 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D4 = 7753 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D5 = 7754 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D6 = 7755 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D7 = 7756 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D8 = 7757 + INTEGER(IntKi), PARAMETER :: EddShrT1N01D9 = 7758 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D1 = 7759 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D2 = 7760 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D3 = 7761 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D4 = 7762 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D5 = 7763 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D6 = 7764 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D7 = 7765 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D8 = 7766 + INTEGER(IntKi), PARAMETER :: EddShrT1N02D9 = 7767 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D1 = 7768 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D2 = 7769 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D3 = 7770 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D4 = 7771 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D5 = 7772 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D6 = 7773 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D7 = 7774 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D8 = 7775 + INTEGER(IntKi), PARAMETER :: EddShrT1N03D9 = 7776 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D1 = 7777 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D2 = 7778 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D3 = 7779 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D4 = 7780 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D5 = 7781 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D6 = 7782 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D7 = 7783 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D8 = 7784 + INTEGER(IntKi), PARAMETER :: EddShrT1N04D9 = 7785 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D1 = 7786 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D2 = 7787 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D3 = 7788 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D4 = 7789 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D5 = 7790 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D6 = 7791 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D7 = 7792 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D8 = 7793 + INTEGER(IntKi), PARAMETER :: EddShrT1N05D9 = 7794 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D1 = 7795 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D2 = 7796 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D3 = 7797 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D4 = 7798 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D5 = 7799 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D6 = 7800 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D7 = 7801 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D8 = 7802 + INTEGER(IntKi), PARAMETER :: EddShrT1N06D9 = 7803 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D1 = 7804 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D2 = 7805 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D3 = 7806 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D4 = 7807 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D5 = 7808 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D6 = 7809 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D7 = 7810 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D8 = 7811 + INTEGER(IntKi), PARAMETER :: EddShrT1N07D9 = 7812 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D1 = 7813 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D2 = 7814 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D3 = 7815 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D4 = 7816 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D5 = 7817 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D6 = 7818 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D7 = 7819 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D8 = 7820 + INTEGER(IntKi), PARAMETER :: EddShrT1N08D9 = 7821 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D1 = 7822 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D2 = 7823 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D3 = 7824 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D4 = 7825 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D5 = 7826 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D6 = 7827 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D7 = 7828 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D8 = 7829 + INTEGER(IntKi), PARAMETER :: EddShrT1N09D9 = 7830 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D1 = 7831 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D2 = 7832 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D3 = 7833 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D4 = 7834 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D5 = 7835 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D6 = 7836 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D7 = 7837 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D8 = 7838 + INTEGER(IntKi), PARAMETER :: EddShrT1N10D9 = 7839 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D1 = 7840 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D2 = 7841 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D3 = 7842 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D4 = 7843 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D5 = 7844 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D6 = 7845 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D7 = 7846 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D8 = 7847 + INTEGER(IntKi), PARAMETER :: EddShrT1N11D9 = 7848 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D1 = 7849 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D2 = 7850 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D3 = 7851 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D4 = 7852 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D5 = 7853 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D6 = 7854 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D7 = 7855 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D8 = 7856 + INTEGER(IntKi), PARAMETER :: EddShrT1N12D9 = 7857 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D1 = 7858 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D2 = 7859 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D3 = 7860 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D4 = 7861 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D5 = 7862 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D6 = 7863 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D7 = 7864 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D8 = 7865 + INTEGER(IntKi), PARAMETER :: EddShrT1N13D9 = 7866 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D1 = 7867 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D2 = 7868 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D3 = 7869 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D4 = 7870 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D5 = 7871 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D6 = 7872 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D7 = 7873 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D8 = 7874 + INTEGER(IntKi), PARAMETER :: EddShrT1N14D9 = 7875 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D1 = 7876 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D2 = 7877 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D3 = 7878 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D4 = 7879 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D5 = 7880 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D6 = 7881 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D7 = 7882 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D8 = 7883 + INTEGER(IntKi), PARAMETER :: EddShrT1N15D9 = 7884 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D1 = 7885 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D2 = 7886 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D3 = 7887 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D4 = 7888 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D5 = 7889 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D6 = 7890 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D7 = 7891 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D8 = 7892 + INTEGER(IntKi), PARAMETER :: EddShrT1N16D9 = 7893 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D1 = 7894 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D2 = 7895 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D3 = 7896 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D4 = 7897 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D5 = 7898 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D6 = 7899 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D7 = 7900 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D8 = 7901 + INTEGER(IntKi), PARAMETER :: EddShrT1N17D9 = 7902 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D1 = 7903 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D2 = 7904 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D3 = 7905 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D4 = 7906 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D5 = 7907 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D6 = 7908 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D7 = 7909 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D8 = 7910 + INTEGER(IntKi), PARAMETER :: EddShrT1N18D9 = 7911 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D1 = 7912 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D2 = 7913 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D3 = 7914 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D4 = 7915 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D5 = 7916 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D6 = 7917 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D7 = 7918 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D8 = 7919 + INTEGER(IntKi), PARAMETER :: EddShrT1N19D9 = 7920 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D1 = 7921 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D2 = 7922 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D3 = 7923 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D4 = 7924 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D5 = 7925 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D6 = 7926 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D7 = 7927 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D8 = 7928 + INTEGER(IntKi), PARAMETER :: EddShrT1N20D9 = 7929 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D1 = 7930 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D2 = 7931 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D3 = 7932 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D4 = 7933 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D5 = 7934 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D6 = 7935 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D7 = 7936 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D8 = 7937 + INTEGER(IntKi), PARAMETER :: EddShrT2N01D9 = 7938 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D1 = 7939 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D2 = 7940 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D3 = 7941 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D4 = 7942 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D5 = 7943 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D6 = 7944 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D7 = 7945 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D8 = 7946 + INTEGER(IntKi), PARAMETER :: EddShrT2N02D9 = 7947 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D1 = 7948 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D2 = 7949 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D3 = 7950 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D4 = 7951 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D5 = 7952 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D6 = 7953 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D7 = 7954 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D8 = 7955 + INTEGER(IntKi), PARAMETER :: EddShrT2N03D9 = 7956 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D1 = 7957 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D2 = 7958 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D3 = 7959 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D4 = 7960 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D5 = 7961 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D6 = 7962 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D7 = 7963 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D8 = 7964 + INTEGER(IntKi), PARAMETER :: EddShrT2N04D9 = 7965 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D1 = 7966 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D2 = 7967 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D3 = 7968 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D4 = 7969 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D5 = 7970 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D6 = 7971 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D7 = 7972 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D8 = 7973 + INTEGER(IntKi), PARAMETER :: EddShrT2N05D9 = 7974 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D1 = 7975 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D2 = 7976 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D3 = 7977 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D4 = 7978 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D5 = 7979 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D6 = 7980 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D7 = 7981 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D8 = 7982 + INTEGER(IntKi), PARAMETER :: EddShrT2N06D9 = 7983 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D1 = 7984 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D2 = 7985 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D3 = 7986 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D4 = 7987 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D5 = 7988 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D6 = 7989 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D7 = 7990 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D8 = 7991 + INTEGER(IntKi), PARAMETER :: EddShrT2N07D9 = 7992 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D1 = 7993 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D2 = 7994 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D3 = 7995 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D4 = 7996 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D5 = 7997 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D6 = 7998 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D7 = 7999 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D8 = 8000 + INTEGER(IntKi), PARAMETER :: EddShrT2N08D9 = 8001 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D1 = 8002 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D2 = 8003 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D3 = 8004 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D4 = 8005 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D5 = 8006 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D6 = 8007 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D7 = 8008 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D8 = 8009 + INTEGER(IntKi), PARAMETER :: EddShrT2N09D9 = 8010 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D1 = 8011 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D2 = 8012 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D3 = 8013 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D4 = 8014 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D5 = 8015 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D6 = 8016 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D7 = 8017 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D8 = 8018 + INTEGER(IntKi), PARAMETER :: EddShrT2N10D9 = 8019 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D1 = 8020 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D2 = 8021 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D3 = 8022 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D4 = 8023 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D5 = 8024 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D6 = 8025 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D7 = 8026 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D8 = 8027 + INTEGER(IntKi), PARAMETER :: EddShrT2N11D9 = 8028 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D1 = 8029 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D2 = 8030 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D3 = 8031 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D4 = 8032 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D5 = 8033 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D6 = 8034 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D7 = 8035 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D8 = 8036 + INTEGER(IntKi), PARAMETER :: EddShrT2N12D9 = 8037 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D1 = 8038 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D2 = 8039 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D3 = 8040 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D4 = 8041 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D5 = 8042 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D6 = 8043 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D7 = 8044 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D8 = 8045 + INTEGER(IntKi), PARAMETER :: EddShrT2N13D9 = 8046 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D1 = 8047 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D2 = 8048 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D3 = 8049 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D4 = 8050 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D5 = 8051 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D6 = 8052 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D7 = 8053 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D8 = 8054 + INTEGER(IntKi), PARAMETER :: EddShrT2N14D9 = 8055 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D1 = 8056 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D2 = 8057 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D3 = 8058 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D4 = 8059 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D5 = 8060 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D6 = 8061 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D7 = 8062 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D8 = 8063 + INTEGER(IntKi), PARAMETER :: EddShrT2N15D9 = 8064 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D1 = 8065 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D2 = 8066 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D3 = 8067 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D4 = 8068 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D5 = 8069 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D6 = 8070 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D7 = 8071 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D8 = 8072 + INTEGER(IntKi), PARAMETER :: EddShrT2N16D9 = 8073 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D1 = 8074 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D2 = 8075 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D3 = 8076 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D4 = 8077 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D5 = 8078 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D6 = 8079 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D7 = 8080 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D8 = 8081 + INTEGER(IntKi), PARAMETER :: EddShrT2N17D9 = 8082 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D1 = 8083 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D2 = 8084 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D3 = 8085 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D4 = 8086 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D5 = 8087 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D6 = 8088 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D7 = 8089 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D8 = 8090 + INTEGER(IntKi), PARAMETER :: EddShrT2N18D9 = 8091 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D1 = 8092 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D2 = 8093 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D3 = 8094 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D4 = 8095 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D5 = 8096 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D6 = 8097 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D7 = 8098 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D8 = 8099 + INTEGER(IntKi), PARAMETER :: EddShrT2N19D9 = 8100 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D1 = 8101 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D2 = 8102 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D3 = 8103 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D4 = 8104 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D5 = 8105 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D6 = 8106 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D7 = 8107 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D8 = 8108 + INTEGER(IntKi), PARAMETER :: EddShrT2N20D9 = 8109 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D1 = 8110 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D2 = 8111 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D3 = 8112 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D4 = 8113 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D5 = 8114 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D6 = 8115 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D7 = 8116 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D8 = 8117 + INTEGER(IntKi), PARAMETER :: EddShrT3N01D9 = 8118 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D1 = 8119 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D2 = 8120 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D3 = 8121 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D4 = 8122 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D5 = 8123 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D6 = 8124 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D7 = 8125 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D8 = 8126 + INTEGER(IntKi), PARAMETER :: EddShrT3N02D9 = 8127 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D1 = 8128 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D2 = 8129 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D3 = 8130 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D4 = 8131 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D5 = 8132 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D6 = 8133 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D7 = 8134 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D8 = 8135 + INTEGER(IntKi), PARAMETER :: EddShrT3N03D9 = 8136 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D1 = 8137 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D2 = 8138 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D3 = 8139 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D4 = 8140 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D5 = 8141 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D6 = 8142 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D7 = 8143 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D8 = 8144 + INTEGER(IntKi), PARAMETER :: EddShrT3N04D9 = 8145 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D1 = 8146 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D2 = 8147 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D3 = 8148 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D4 = 8149 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D5 = 8150 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D6 = 8151 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D7 = 8152 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D8 = 8153 + INTEGER(IntKi), PARAMETER :: EddShrT3N05D9 = 8154 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D1 = 8155 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D2 = 8156 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D3 = 8157 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D4 = 8158 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D5 = 8159 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D6 = 8160 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D7 = 8161 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D8 = 8162 + INTEGER(IntKi), PARAMETER :: EddShrT3N06D9 = 8163 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D1 = 8164 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D2 = 8165 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D3 = 8166 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D4 = 8167 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D5 = 8168 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D6 = 8169 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D7 = 8170 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D8 = 8171 + INTEGER(IntKi), PARAMETER :: EddShrT3N07D9 = 8172 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D1 = 8173 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D2 = 8174 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D3 = 8175 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D4 = 8176 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D5 = 8177 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D6 = 8178 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D7 = 8179 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D8 = 8180 + INTEGER(IntKi), PARAMETER :: EddShrT3N08D9 = 8181 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D1 = 8182 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D2 = 8183 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D3 = 8184 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D4 = 8185 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D5 = 8186 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D6 = 8187 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D7 = 8188 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D8 = 8189 + INTEGER(IntKi), PARAMETER :: EddShrT3N09D9 = 8190 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D1 = 8191 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D2 = 8192 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D3 = 8193 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D4 = 8194 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D5 = 8195 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D6 = 8196 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D7 = 8197 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D8 = 8198 + INTEGER(IntKi), PARAMETER :: EddShrT3N10D9 = 8199 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D1 = 8200 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D2 = 8201 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D3 = 8202 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D4 = 8203 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D5 = 8204 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D6 = 8205 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D7 = 8206 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D8 = 8207 + INTEGER(IntKi), PARAMETER :: EddShrT3N11D9 = 8208 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D1 = 8209 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D2 = 8210 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D3 = 8211 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D4 = 8212 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D5 = 8213 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D6 = 8214 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D7 = 8215 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D8 = 8216 + INTEGER(IntKi), PARAMETER :: EddShrT3N12D9 = 8217 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D1 = 8218 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D2 = 8219 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D3 = 8220 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D4 = 8221 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D5 = 8222 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D6 = 8223 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D7 = 8224 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D8 = 8225 + INTEGER(IntKi), PARAMETER :: EddShrT3N13D9 = 8226 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D1 = 8227 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D2 = 8228 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D3 = 8229 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D4 = 8230 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D5 = 8231 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D6 = 8232 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D7 = 8233 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D8 = 8234 + INTEGER(IntKi), PARAMETER :: EddShrT3N14D9 = 8235 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D1 = 8236 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D2 = 8237 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D3 = 8238 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D4 = 8239 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D5 = 8240 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D6 = 8241 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D7 = 8242 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D8 = 8243 + INTEGER(IntKi), PARAMETER :: EddShrT3N15D9 = 8244 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D1 = 8245 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D2 = 8246 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D3 = 8247 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D4 = 8248 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D5 = 8249 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D6 = 8250 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D7 = 8251 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D8 = 8252 + INTEGER(IntKi), PARAMETER :: EddShrT3N16D9 = 8253 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D1 = 8254 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D2 = 8255 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D3 = 8256 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D4 = 8257 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D5 = 8258 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D6 = 8259 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D7 = 8260 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D8 = 8261 + INTEGER(IntKi), PARAMETER :: EddShrT3N17D9 = 8262 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D1 = 8263 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D2 = 8264 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D3 = 8265 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D4 = 8266 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D5 = 8267 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D6 = 8268 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D7 = 8269 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D8 = 8270 + INTEGER(IntKi), PARAMETER :: EddShrT3N18D9 = 8271 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D1 = 8272 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D2 = 8273 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D3 = 8274 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D4 = 8275 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D5 = 8276 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D6 = 8277 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D7 = 8278 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D8 = 8279 + INTEGER(IntKi), PARAMETER :: EddShrT3N19D9 = 8280 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D1 = 8281 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D2 = 8282 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D3 = 8283 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D4 = 8284 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D5 = 8285 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D6 = 8286 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D7 = 8287 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D8 = 8288 + INTEGER(IntKi), PARAMETER :: EddShrT3N20D9 = 8289 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D1 = 8290 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D2 = 8291 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D3 = 8292 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D4 = 8293 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D5 = 8294 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D6 = 8295 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D7 = 8296 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D8 = 8297 + INTEGER(IntKi), PARAMETER :: EddShrT4N01D9 = 8298 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D1 = 8299 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D2 = 8300 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D3 = 8301 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D4 = 8302 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D5 = 8303 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D6 = 8304 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D7 = 8305 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D8 = 8306 + INTEGER(IntKi), PARAMETER :: EddShrT4N02D9 = 8307 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D1 = 8308 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D2 = 8309 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D3 = 8310 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D4 = 8311 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D5 = 8312 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D6 = 8313 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D7 = 8314 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D8 = 8315 + INTEGER(IntKi), PARAMETER :: EddShrT4N03D9 = 8316 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D1 = 8317 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D2 = 8318 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D3 = 8319 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D4 = 8320 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D5 = 8321 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D6 = 8322 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D7 = 8323 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D8 = 8324 + INTEGER(IntKi), PARAMETER :: EddShrT4N04D9 = 8325 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D1 = 8326 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D2 = 8327 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D3 = 8328 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D4 = 8329 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D5 = 8330 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D6 = 8331 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D7 = 8332 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D8 = 8333 + INTEGER(IntKi), PARAMETER :: EddShrT4N05D9 = 8334 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D1 = 8335 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D2 = 8336 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D3 = 8337 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D4 = 8338 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D5 = 8339 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D6 = 8340 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D7 = 8341 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D8 = 8342 + INTEGER(IntKi), PARAMETER :: EddShrT4N06D9 = 8343 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D1 = 8344 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D2 = 8345 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D3 = 8346 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D4 = 8347 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D5 = 8348 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D6 = 8349 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D7 = 8350 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D8 = 8351 + INTEGER(IntKi), PARAMETER :: EddShrT4N07D9 = 8352 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D1 = 8353 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D2 = 8354 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D3 = 8355 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D4 = 8356 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D5 = 8357 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D6 = 8358 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D7 = 8359 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D8 = 8360 + INTEGER(IntKi), PARAMETER :: EddShrT4N08D9 = 8361 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D1 = 8362 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D2 = 8363 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D3 = 8364 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D4 = 8365 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D5 = 8366 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D6 = 8367 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D7 = 8368 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D8 = 8369 + INTEGER(IntKi), PARAMETER :: EddShrT4N09D9 = 8370 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D1 = 8371 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D2 = 8372 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D3 = 8373 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D4 = 8374 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D5 = 8375 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D6 = 8376 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D7 = 8377 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D8 = 8378 + INTEGER(IntKi), PARAMETER :: EddShrT4N10D9 = 8379 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D1 = 8380 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D2 = 8381 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D3 = 8382 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D4 = 8383 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D5 = 8384 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D6 = 8385 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D7 = 8386 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D8 = 8387 + INTEGER(IntKi), PARAMETER :: EddShrT4N11D9 = 8388 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D1 = 8389 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D2 = 8390 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D3 = 8391 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D4 = 8392 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D5 = 8393 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D6 = 8394 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D7 = 8395 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D8 = 8396 + INTEGER(IntKi), PARAMETER :: EddShrT4N12D9 = 8397 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D1 = 8398 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D2 = 8399 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D3 = 8400 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D4 = 8401 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D5 = 8402 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D6 = 8403 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D7 = 8404 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D8 = 8405 + INTEGER(IntKi), PARAMETER :: EddShrT4N13D9 = 8406 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D1 = 8407 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D2 = 8408 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D3 = 8409 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D4 = 8410 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D5 = 8411 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D6 = 8412 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D7 = 8413 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D8 = 8414 + INTEGER(IntKi), PARAMETER :: EddShrT4N14D9 = 8415 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D1 = 8416 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D2 = 8417 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D3 = 8418 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D4 = 8419 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D5 = 8420 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D6 = 8421 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D7 = 8422 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D8 = 8423 + INTEGER(IntKi), PARAMETER :: EddShrT4N15D9 = 8424 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D1 = 8425 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D2 = 8426 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D3 = 8427 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D4 = 8428 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D5 = 8429 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D6 = 8430 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D7 = 8431 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D8 = 8432 + INTEGER(IntKi), PARAMETER :: EddShrT4N16D9 = 8433 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D1 = 8434 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D2 = 8435 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D3 = 8436 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D4 = 8437 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D5 = 8438 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D6 = 8439 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D7 = 8440 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D8 = 8441 + INTEGER(IntKi), PARAMETER :: EddShrT4N17D9 = 8442 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D1 = 8443 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D2 = 8444 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D3 = 8445 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D4 = 8446 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D5 = 8447 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D6 = 8448 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D7 = 8449 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D8 = 8450 + INTEGER(IntKi), PARAMETER :: EddShrT4N18D9 = 8451 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D1 = 8452 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D2 = 8453 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D3 = 8454 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D4 = 8455 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D5 = 8456 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D6 = 8457 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D7 = 8458 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D8 = 8459 + INTEGER(IntKi), PARAMETER :: EddShrT4N19D9 = 8460 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D1 = 8461 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D2 = 8462 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D3 = 8463 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D4 = 8464 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D5 = 8465 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D6 = 8466 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D7 = 8467 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D8 = 8468 + INTEGER(IntKi), PARAMETER :: EddShrT4N20D9 = 8469 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D1 = 8470 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D2 = 8471 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D3 = 8472 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D4 = 8473 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D5 = 8474 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D6 = 8475 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D7 = 8476 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D8 = 8477 + INTEGER(IntKi), PARAMETER :: EddShrT5N01D9 = 8478 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D1 = 8479 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D2 = 8480 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D3 = 8481 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D4 = 8482 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D5 = 8483 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D6 = 8484 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D7 = 8485 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D8 = 8486 + INTEGER(IntKi), PARAMETER :: EddShrT5N02D9 = 8487 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D1 = 8488 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D2 = 8489 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D3 = 8490 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D4 = 8491 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D5 = 8492 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D6 = 8493 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D7 = 8494 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D8 = 8495 + INTEGER(IntKi), PARAMETER :: EddShrT5N03D9 = 8496 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D1 = 8497 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D2 = 8498 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D3 = 8499 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D4 = 8500 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D5 = 8501 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D6 = 8502 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D7 = 8503 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D8 = 8504 + INTEGER(IntKi), PARAMETER :: EddShrT5N04D9 = 8505 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D1 = 8506 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D2 = 8507 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D3 = 8508 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D4 = 8509 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D5 = 8510 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D6 = 8511 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D7 = 8512 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D8 = 8513 + INTEGER(IntKi), PARAMETER :: EddShrT5N05D9 = 8514 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D1 = 8515 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D2 = 8516 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D3 = 8517 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D4 = 8518 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D5 = 8519 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D6 = 8520 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D7 = 8521 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D8 = 8522 + INTEGER(IntKi), PARAMETER :: EddShrT5N06D9 = 8523 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D1 = 8524 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D2 = 8525 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D3 = 8526 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D4 = 8527 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D5 = 8528 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D6 = 8529 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D7 = 8530 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D8 = 8531 + INTEGER(IntKi), PARAMETER :: EddShrT5N07D9 = 8532 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D1 = 8533 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D2 = 8534 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D3 = 8535 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D4 = 8536 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D5 = 8537 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D6 = 8538 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D7 = 8539 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D8 = 8540 + INTEGER(IntKi), PARAMETER :: EddShrT5N08D9 = 8541 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D1 = 8542 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D2 = 8543 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D3 = 8544 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D4 = 8545 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D5 = 8546 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D6 = 8547 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D7 = 8548 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D8 = 8549 + INTEGER(IntKi), PARAMETER :: EddShrT5N09D9 = 8550 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D1 = 8551 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D2 = 8552 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D3 = 8553 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D4 = 8554 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D5 = 8555 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D6 = 8556 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D7 = 8557 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D8 = 8558 + INTEGER(IntKi), PARAMETER :: EddShrT5N10D9 = 8559 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D1 = 8560 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D2 = 8561 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D3 = 8562 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D4 = 8563 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D5 = 8564 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D6 = 8565 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D7 = 8566 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D8 = 8567 + INTEGER(IntKi), PARAMETER :: EddShrT5N11D9 = 8568 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D1 = 8569 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D2 = 8570 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D3 = 8571 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D4 = 8572 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D5 = 8573 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D6 = 8574 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D7 = 8575 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D8 = 8576 + INTEGER(IntKi), PARAMETER :: EddShrT5N12D9 = 8577 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D1 = 8578 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D2 = 8579 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D3 = 8580 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D4 = 8581 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D5 = 8582 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D6 = 8583 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D7 = 8584 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D8 = 8585 + INTEGER(IntKi), PARAMETER :: EddShrT5N13D9 = 8586 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D1 = 8587 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D2 = 8588 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D3 = 8589 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D4 = 8590 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D5 = 8591 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D6 = 8592 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D7 = 8593 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D8 = 8594 + INTEGER(IntKi), PARAMETER :: EddShrT5N14D9 = 8595 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D1 = 8596 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D2 = 8597 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D3 = 8598 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D4 = 8599 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D5 = 8600 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D6 = 8601 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D7 = 8602 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D8 = 8603 + INTEGER(IntKi), PARAMETER :: EddShrT5N15D9 = 8604 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D1 = 8605 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D2 = 8606 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D3 = 8607 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D4 = 8608 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D5 = 8609 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D6 = 8610 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D7 = 8611 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D8 = 8612 + INTEGER(IntKi), PARAMETER :: EddShrT5N16D9 = 8613 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D1 = 8614 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D2 = 8615 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D3 = 8616 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D4 = 8617 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D5 = 8618 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D6 = 8619 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D7 = 8620 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D8 = 8621 + INTEGER(IntKi), PARAMETER :: EddShrT5N17D9 = 8622 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D1 = 8623 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D2 = 8624 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D3 = 8625 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D4 = 8626 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D5 = 8627 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D6 = 8628 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D7 = 8629 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D8 = 8630 + INTEGER(IntKi), PARAMETER :: EddShrT5N18D9 = 8631 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D1 = 8632 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D2 = 8633 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D3 = 8634 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D4 = 8635 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D5 = 8636 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D6 = 8637 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D7 = 8638 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D8 = 8639 + INTEGER(IntKi), PARAMETER :: EddShrT5N19D9 = 8640 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D1 = 8641 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D2 = 8642 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D3 = 8643 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D4 = 8644 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D5 = 8645 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D6 = 8646 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D7 = 8647 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D8 = 8648 + INTEGER(IntKi), PARAMETER :: EddShrT5N20D9 = 8649 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D1 = 8650 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D2 = 8651 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D3 = 8652 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D4 = 8653 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D5 = 8654 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D6 = 8655 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D7 = 8656 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D8 = 8657 + INTEGER(IntKi), PARAMETER :: EddShrT6N01D9 = 8658 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D1 = 8659 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D2 = 8660 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D3 = 8661 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D4 = 8662 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D5 = 8663 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D6 = 8664 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D7 = 8665 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D8 = 8666 + INTEGER(IntKi), PARAMETER :: EddShrT6N02D9 = 8667 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D1 = 8668 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D2 = 8669 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D3 = 8670 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D4 = 8671 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D5 = 8672 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D6 = 8673 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D7 = 8674 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D8 = 8675 + INTEGER(IntKi), PARAMETER :: EddShrT6N03D9 = 8676 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D1 = 8677 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D2 = 8678 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D3 = 8679 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D4 = 8680 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D5 = 8681 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D6 = 8682 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D7 = 8683 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D8 = 8684 + INTEGER(IntKi), PARAMETER :: EddShrT6N04D9 = 8685 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D1 = 8686 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D2 = 8687 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D3 = 8688 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D4 = 8689 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D5 = 8690 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D6 = 8691 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D7 = 8692 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D8 = 8693 + INTEGER(IntKi), PARAMETER :: EddShrT6N05D9 = 8694 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D1 = 8695 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D2 = 8696 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D3 = 8697 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D4 = 8698 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D5 = 8699 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D6 = 8700 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D7 = 8701 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D8 = 8702 + INTEGER(IntKi), PARAMETER :: EddShrT6N06D9 = 8703 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D1 = 8704 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D2 = 8705 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D3 = 8706 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D4 = 8707 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D5 = 8708 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D6 = 8709 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D7 = 8710 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D8 = 8711 + INTEGER(IntKi), PARAMETER :: EddShrT6N07D9 = 8712 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D1 = 8713 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D2 = 8714 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D3 = 8715 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D4 = 8716 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D5 = 8717 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D6 = 8718 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D7 = 8719 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D8 = 8720 + INTEGER(IntKi), PARAMETER :: EddShrT6N08D9 = 8721 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D1 = 8722 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D2 = 8723 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D3 = 8724 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D4 = 8725 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D5 = 8726 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D6 = 8727 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D7 = 8728 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D8 = 8729 + INTEGER(IntKi), PARAMETER :: EddShrT6N09D9 = 8730 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D1 = 8731 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D2 = 8732 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D3 = 8733 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D4 = 8734 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D5 = 8735 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D6 = 8736 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D7 = 8737 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D8 = 8738 + INTEGER(IntKi), PARAMETER :: EddShrT6N10D9 = 8739 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D1 = 8740 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D2 = 8741 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D3 = 8742 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D4 = 8743 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D5 = 8744 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D6 = 8745 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D7 = 8746 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D8 = 8747 + INTEGER(IntKi), PARAMETER :: EddShrT6N11D9 = 8748 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D1 = 8749 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D2 = 8750 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D3 = 8751 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D4 = 8752 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D5 = 8753 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D6 = 8754 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D7 = 8755 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D8 = 8756 + INTEGER(IntKi), PARAMETER :: EddShrT6N12D9 = 8757 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D1 = 8758 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D2 = 8759 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D3 = 8760 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D4 = 8761 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D5 = 8762 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D6 = 8763 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D7 = 8764 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D8 = 8765 + INTEGER(IntKi), PARAMETER :: EddShrT6N13D9 = 8766 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D1 = 8767 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D2 = 8768 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D3 = 8769 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D4 = 8770 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D5 = 8771 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D6 = 8772 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D7 = 8773 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D8 = 8774 + INTEGER(IntKi), PARAMETER :: EddShrT6N14D9 = 8775 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D1 = 8776 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D2 = 8777 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D3 = 8778 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D4 = 8779 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D5 = 8780 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D6 = 8781 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D7 = 8782 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D8 = 8783 + INTEGER(IntKi), PARAMETER :: EddShrT6N15D9 = 8784 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D1 = 8785 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D2 = 8786 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D3 = 8787 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D4 = 8788 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D5 = 8789 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D6 = 8790 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D7 = 8791 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D8 = 8792 + INTEGER(IntKi), PARAMETER :: EddShrT6N16D9 = 8793 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D1 = 8794 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D2 = 8795 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D3 = 8796 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D4 = 8797 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D5 = 8798 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D6 = 8799 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D7 = 8800 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D8 = 8801 + INTEGER(IntKi), PARAMETER :: EddShrT6N17D9 = 8802 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D1 = 8803 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D2 = 8804 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D3 = 8805 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D4 = 8806 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D5 = 8807 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D6 = 8808 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D7 = 8809 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D8 = 8810 + INTEGER(IntKi), PARAMETER :: EddShrT6N18D9 = 8811 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D1 = 8812 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D2 = 8813 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D3 = 8814 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D4 = 8815 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D5 = 8816 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D6 = 8817 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D7 = 8818 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D8 = 8819 + INTEGER(IntKi), PARAMETER :: EddShrT6N19D9 = 8820 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D1 = 8821 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D2 = 8822 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D3 = 8823 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D4 = 8824 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D5 = 8825 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D6 = 8826 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D7 = 8827 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D8 = 8828 + INTEGER(IntKi), PARAMETER :: EddShrT6N20D9 = 8829 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D1 = 8830 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D2 = 8831 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D3 = 8832 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D4 = 8833 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D5 = 8834 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D6 = 8835 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D7 = 8836 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D8 = 8837 + INTEGER(IntKi), PARAMETER :: EddShrT7N01D9 = 8838 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D1 = 8839 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D2 = 8840 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D3 = 8841 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D4 = 8842 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D5 = 8843 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D6 = 8844 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D7 = 8845 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D8 = 8846 + INTEGER(IntKi), PARAMETER :: EddShrT7N02D9 = 8847 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D1 = 8848 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D2 = 8849 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D3 = 8850 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D4 = 8851 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D5 = 8852 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D6 = 8853 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D7 = 8854 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D8 = 8855 + INTEGER(IntKi), PARAMETER :: EddShrT7N03D9 = 8856 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D1 = 8857 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D2 = 8858 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D3 = 8859 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D4 = 8860 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D5 = 8861 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D6 = 8862 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D7 = 8863 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D8 = 8864 + INTEGER(IntKi), PARAMETER :: EddShrT7N04D9 = 8865 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D1 = 8866 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D2 = 8867 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D3 = 8868 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D4 = 8869 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D5 = 8870 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D6 = 8871 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D7 = 8872 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D8 = 8873 + INTEGER(IntKi), PARAMETER :: EddShrT7N05D9 = 8874 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D1 = 8875 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D2 = 8876 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D3 = 8877 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D4 = 8878 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D5 = 8879 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D6 = 8880 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D7 = 8881 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D8 = 8882 + INTEGER(IntKi), PARAMETER :: EddShrT7N06D9 = 8883 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D1 = 8884 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D2 = 8885 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D3 = 8886 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D4 = 8887 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D5 = 8888 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D6 = 8889 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D7 = 8890 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D8 = 8891 + INTEGER(IntKi), PARAMETER :: EddShrT7N07D9 = 8892 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D1 = 8893 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D2 = 8894 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D3 = 8895 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D4 = 8896 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D5 = 8897 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D6 = 8898 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D7 = 8899 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D8 = 8900 + INTEGER(IntKi), PARAMETER :: EddShrT7N08D9 = 8901 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D1 = 8902 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D2 = 8903 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D3 = 8904 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D4 = 8905 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D5 = 8906 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D6 = 8907 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D7 = 8908 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D8 = 8909 + INTEGER(IntKi), PARAMETER :: EddShrT7N09D9 = 8910 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D1 = 8911 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D2 = 8912 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D3 = 8913 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D4 = 8914 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D5 = 8915 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D6 = 8916 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D7 = 8917 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D8 = 8918 + INTEGER(IntKi), PARAMETER :: EddShrT7N10D9 = 8919 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D1 = 8920 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D2 = 8921 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D3 = 8922 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D4 = 8923 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D5 = 8924 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D6 = 8925 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D7 = 8926 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D8 = 8927 + INTEGER(IntKi), PARAMETER :: EddShrT7N11D9 = 8928 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D1 = 8929 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D2 = 8930 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D3 = 8931 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D4 = 8932 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D5 = 8933 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D6 = 8934 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D7 = 8935 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D8 = 8936 + INTEGER(IntKi), PARAMETER :: EddShrT7N12D9 = 8937 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D1 = 8938 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D2 = 8939 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D3 = 8940 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D4 = 8941 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D5 = 8942 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D6 = 8943 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D7 = 8944 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D8 = 8945 + INTEGER(IntKi), PARAMETER :: EddShrT7N13D9 = 8946 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D1 = 8947 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D2 = 8948 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D3 = 8949 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D4 = 8950 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D5 = 8951 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D6 = 8952 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D7 = 8953 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D8 = 8954 + INTEGER(IntKi), PARAMETER :: EddShrT7N14D9 = 8955 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D1 = 8956 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D2 = 8957 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D3 = 8958 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D4 = 8959 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D5 = 8960 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D6 = 8961 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D7 = 8962 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D8 = 8963 + INTEGER(IntKi), PARAMETER :: EddShrT7N15D9 = 8964 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D1 = 8965 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D2 = 8966 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D3 = 8967 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D4 = 8968 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D5 = 8969 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D6 = 8970 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D7 = 8971 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D8 = 8972 + INTEGER(IntKi), PARAMETER :: EddShrT7N16D9 = 8973 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D1 = 8974 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D2 = 8975 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D3 = 8976 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D4 = 8977 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D5 = 8978 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D6 = 8979 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D7 = 8980 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D8 = 8981 + INTEGER(IntKi), PARAMETER :: EddShrT7N17D9 = 8982 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D1 = 8983 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D2 = 8984 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D3 = 8985 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D4 = 8986 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D5 = 8987 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D6 = 8988 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D7 = 8989 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D8 = 8990 + INTEGER(IntKi), PARAMETER :: EddShrT7N18D9 = 8991 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D1 = 8992 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D2 = 8993 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D3 = 8994 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D4 = 8995 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D5 = 8996 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D6 = 8997 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D7 = 8998 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D8 = 8999 + INTEGER(IntKi), PARAMETER :: EddShrT7N19D9 = 9000 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D1 = 9001 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D2 = 9002 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D3 = 9003 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D4 = 9004 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D5 = 9005 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D6 = 9006 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D7 = 9007 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D8 = 9008 + INTEGER(IntKi), PARAMETER :: EddShrT7N20D9 = 9009 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D1 = 9010 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D2 = 9011 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D3 = 9012 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D4 = 9013 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D5 = 9014 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D6 = 9015 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D7 = 9016 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D8 = 9017 + INTEGER(IntKi), PARAMETER :: EddShrT8N01D9 = 9018 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D1 = 9019 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D2 = 9020 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D3 = 9021 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D4 = 9022 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D5 = 9023 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D6 = 9024 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D7 = 9025 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D8 = 9026 + INTEGER(IntKi), PARAMETER :: EddShrT8N02D9 = 9027 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D1 = 9028 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D2 = 9029 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D3 = 9030 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D4 = 9031 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D5 = 9032 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D6 = 9033 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D7 = 9034 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D8 = 9035 + INTEGER(IntKi), PARAMETER :: EddShrT8N03D9 = 9036 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D1 = 9037 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D2 = 9038 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D3 = 9039 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D4 = 9040 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D5 = 9041 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D6 = 9042 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D7 = 9043 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D8 = 9044 + INTEGER(IntKi), PARAMETER :: EddShrT8N04D9 = 9045 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D1 = 9046 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D2 = 9047 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D3 = 9048 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D4 = 9049 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D5 = 9050 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D6 = 9051 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D7 = 9052 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D8 = 9053 + INTEGER(IntKi), PARAMETER :: EddShrT8N05D9 = 9054 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D1 = 9055 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D2 = 9056 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D3 = 9057 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D4 = 9058 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D5 = 9059 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D6 = 9060 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D7 = 9061 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D8 = 9062 + INTEGER(IntKi), PARAMETER :: EddShrT8N06D9 = 9063 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D1 = 9064 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D2 = 9065 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D3 = 9066 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D4 = 9067 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D5 = 9068 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D6 = 9069 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D7 = 9070 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D8 = 9071 + INTEGER(IntKi), PARAMETER :: EddShrT8N07D9 = 9072 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D1 = 9073 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D2 = 9074 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D3 = 9075 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D4 = 9076 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D5 = 9077 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D6 = 9078 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D7 = 9079 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D8 = 9080 + INTEGER(IntKi), PARAMETER :: EddShrT8N08D9 = 9081 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D1 = 9082 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D2 = 9083 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D3 = 9084 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D4 = 9085 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D5 = 9086 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D6 = 9087 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D7 = 9088 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D8 = 9089 + INTEGER(IntKi), PARAMETER :: EddShrT8N09D9 = 9090 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D1 = 9091 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D2 = 9092 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D3 = 9093 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D4 = 9094 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D5 = 9095 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D6 = 9096 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D7 = 9097 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D8 = 9098 + INTEGER(IntKi), PARAMETER :: EddShrT8N10D9 = 9099 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D1 = 9100 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D2 = 9101 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D3 = 9102 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D4 = 9103 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D5 = 9104 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D6 = 9105 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D7 = 9106 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D8 = 9107 + INTEGER(IntKi), PARAMETER :: EddShrT8N11D9 = 9108 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D1 = 9109 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D2 = 9110 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D3 = 9111 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D4 = 9112 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D5 = 9113 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D6 = 9114 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D7 = 9115 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D8 = 9116 + INTEGER(IntKi), PARAMETER :: EddShrT8N12D9 = 9117 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D1 = 9118 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D2 = 9119 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D3 = 9120 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D4 = 9121 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D5 = 9122 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D6 = 9123 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D7 = 9124 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D8 = 9125 + INTEGER(IntKi), PARAMETER :: EddShrT8N13D9 = 9126 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D1 = 9127 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D2 = 9128 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D3 = 9129 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D4 = 9130 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D5 = 9131 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D6 = 9132 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D7 = 9133 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D8 = 9134 + INTEGER(IntKi), PARAMETER :: EddShrT8N14D9 = 9135 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D1 = 9136 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D2 = 9137 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D3 = 9138 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D4 = 9139 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D5 = 9140 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D6 = 9141 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D7 = 9142 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D8 = 9143 + INTEGER(IntKi), PARAMETER :: EddShrT8N15D9 = 9144 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D1 = 9145 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D2 = 9146 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D3 = 9147 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D4 = 9148 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D5 = 9149 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D6 = 9150 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D7 = 9151 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D8 = 9152 + INTEGER(IntKi), PARAMETER :: EddShrT8N16D9 = 9153 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D1 = 9154 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D2 = 9155 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D3 = 9156 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D4 = 9157 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D5 = 9158 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D6 = 9159 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D7 = 9160 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D8 = 9161 + INTEGER(IntKi), PARAMETER :: EddShrT8N17D9 = 9162 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D1 = 9163 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D2 = 9164 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D3 = 9165 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D4 = 9166 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D5 = 9167 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D6 = 9168 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D7 = 9169 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D8 = 9170 + INTEGER(IntKi), PARAMETER :: EddShrT8N18D9 = 9171 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D1 = 9172 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D2 = 9173 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D3 = 9174 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D4 = 9175 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D5 = 9176 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D6 = 9177 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D7 = 9178 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D8 = 9179 + INTEGER(IntKi), PARAMETER :: EddShrT8N19D9 = 9180 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D1 = 9181 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D2 = 9182 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D3 = 9183 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D4 = 9184 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D5 = 9185 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D6 = 9186 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D7 = 9187 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D8 = 9188 + INTEGER(IntKi), PARAMETER :: EddShrT8N20D9 = 9189 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D1 = 9190 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D2 = 9191 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D3 = 9192 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D4 = 9193 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D5 = 9194 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D6 = 9195 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D7 = 9196 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D8 = 9197 + INTEGER(IntKi), PARAMETER :: EddShrT9N01D9 = 9198 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D1 = 9199 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D2 = 9200 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D3 = 9201 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D4 = 9202 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D5 = 9203 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D6 = 9204 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D7 = 9205 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D8 = 9206 + INTEGER(IntKi), PARAMETER :: EddShrT9N02D9 = 9207 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D1 = 9208 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D2 = 9209 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D3 = 9210 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D4 = 9211 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D5 = 9212 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D6 = 9213 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D7 = 9214 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D8 = 9215 + INTEGER(IntKi), PARAMETER :: EddShrT9N03D9 = 9216 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D1 = 9217 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D2 = 9218 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D3 = 9219 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D4 = 9220 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D5 = 9221 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D6 = 9222 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D7 = 9223 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D8 = 9224 + INTEGER(IntKi), PARAMETER :: EddShrT9N04D9 = 9225 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D1 = 9226 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D2 = 9227 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D3 = 9228 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D4 = 9229 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D5 = 9230 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D6 = 9231 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D7 = 9232 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D8 = 9233 + INTEGER(IntKi), PARAMETER :: EddShrT9N05D9 = 9234 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D1 = 9235 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D2 = 9236 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D3 = 9237 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D4 = 9238 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D5 = 9239 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D6 = 9240 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D7 = 9241 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D8 = 9242 + INTEGER(IntKi), PARAMETER :: EddShrT9N06D9 = 9243 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D1 = 9244 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D2 = 9245 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D3 = 9246 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D4 = 9247 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D5 = 9248 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D6 = 9249 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D7 = 9250 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D8 = 9251 + INTEGER(IntKi), PARAMETER :: EddShrT9N07D9 = 9252 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D1 = 9253 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D2 = 9254 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D3 = 9255 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D4 = 9256 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D5 = 9257 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D6 = 9258 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D7 = 9259 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D8 = 9260 + INTEGER(IntKi), PARAMETER :: EddShrT9N08D9 = 9261 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D1 = 9262 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D2 = 9263 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D3 = 9264 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D4 = 9265 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D5 = 9266 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D6 = 9267 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D7 = 9268 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D8 = 9269 + INTEGER(IntKi), PARAMETER :: EddShrT9N09D9 = 9270 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D1 = 9271 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D2 = 9272 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D3 = 9273 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D4 = 9274 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D5 = 9275 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D6 = 9276 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D7 = 9277 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D8 = 9278 + INTEGER(IntKi), PARAMETER :: EddShrT9N10D9 = 9279 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D1 = 9280 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D2 = 9281 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D3 = 9282 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D4 = 9283 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D5 = 9284 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D6 = 9285 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D7 = 9286 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D8 = 9287 + INTEGER(IntKi), PARAMETER :: EddShrT9N11D9 = 9288 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D1 = 9289 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D2 = 9290 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D3 = 9291 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D4 = 9292 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D5 = 9293 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D6 = 9294 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D7 = 9295 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D8 = 9296 + INTEGER(IntKi), PARAMETER :: EddShrT9N12D9 = 9297 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D1 = 9298 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D2 = 9299 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D3 = 9300 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D4 = 9301 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D5 = 9302 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D6 = 9303 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D7 = 9304 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D8 = 9305 + INTEGER(IntKi), PARAMETER :: EddShrT9N13D9 = 9306 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D1 = 9307 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D2 = 9308 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D3 = 9309 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D4 = 9310 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D5 = 9311 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D6 = 9312 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D7 = 9313 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D8 = 9314 + INTEGER(IntKi), PARAMETER :: EddShrT9N14D9 = 9315 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D1 = 9316 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D2 = 9317 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D3 = 9318 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D4 = 9319 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D5 = 9320 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D6 = 9321 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D7 = 9322 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D8 = 9323 + INTEGER(IntKi), PARAMETER :: EddShrT9N15D9 = 9324 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D1 = 9325 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D2 = 9326 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D3 = 9327 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D4 = 9328 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D5 = 9329 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D6 = 9330 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D7 = 9331 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D8 = 9332 + INTEGER(IntKi), PARAMETER :: EddShrT9N16D9 = 9333 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D1 = 9334 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D2 = 9335 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D3 = 9336 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D4 = 9337 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D5 = 9338 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D6 = 9339 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D7 = 9340 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D8 = 9341 + INTEGER(IntKi), PARAMETER :: EddShrT9N17D9 = 9342 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D1 = 9343 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D2 = 9344 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D3 = 9345 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D4 = 9346 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D5 = 9347 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D6 = 9348 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D7 = 9349 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D8 = 9350 + INTEGER(IntKi), PARAMETER :: EddShrT9N18D9 = 9351 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D1 = 9352 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D2 = 9353 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D3 = 9354 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D4 = 9355 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D5 = 9356 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D6 = 9357 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D7 = 9358 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D8 = 9359 + INTEGER(IntKi), PARAMETER :: EddShrT9N19D9 = 9360 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D1 = 9361 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D2 = 9362 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D3 = 9363 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D4 = 9364 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D5 = 9365 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D6 = 9366 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D7 = 9367 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D8 = 9368 + INTEGER(IntKi), PARAMETER :: EddShrT9N20D9 = 9369 + + + ! Ambient Wind Velocity from Low-resolution Domain: + + INTEGER(IntKi), PARAMETER :: W1VAmbX = 9370 + INTEGER(IntKi), PARAMETER :: W2VAmbX = 9371 + INTEGER(IntKi), PARAMETER :: W3VAmbX = 9372 + INTEGER(IntKi), PARAMETER :: W4VAmbX = 9373 + INTEGER(IntKi), PARAMETER :: W5VAmbX = 9374 + INTEGER(IntKi), PARAMETER :: W6VAmbX = 9375 + INTEGER(IntKi), PARAMETER :: W7VAmbX = 9376 + INTEGER(IntKi), PARAMETER :: W8VAmbX = 9377 + INTEGER(IntKi), PARAMETER :: W9VAmbX = 9378 + INTEGER(IntKi), PARAMETER :: W1VAmbY = 9379 + INTEGER(IntKi), PARAMETER :: W2VAmbY = 9380 + INTEGER(IntKi), PARAMETER :: W3VAmbY = 9381 + INTEGER(IntKi), PARAMETER :: W4VAmbY = 9382 + INTEGER(IntKi), PARAMETER :: W5VAmbY = 9383 + INTEGER(IntKi), PARAMETER :: W6VAmbY = 9384 + INTEGER(IntKi), PARAMETER :: W7VAmbY = 9385 + INTEGER(IntKi), PARAMETER :: W8VAmbY = 9386 + INTEGER(IntKi), PARAMETER :: W9VAmbY = 9387 + INTEGER(IntKi), PARAMETER :: W1VAmbZ = 9388 + INTEGER(IntKi), PARAMETER :: W2VAmbZ = 9389 + INTEGER(IntKi), PARAMETER :: W3VAmbZ = 9390 + INTEGER(IntKi), PARAMETER :: W4VAmbZ = 9391 + INTEGER(IntKi), PARAMETER :: W5VAmbZ = 9392 + INTEGER(IntKi), PARAMETER :: W6VAmbZ = 9393 + INTEGER(IntKi), PARAMETER :: W7VAmbZ = 9394 + INTEGER(IntKi), PARAMETER :: W8VAmbZ = 9395 + INTEGER(IntKi), PARAMETER :: W9VAmbZ = 9396 + + + ! Disturbed Wind Velocity from Low-resolution Domain: + + INTEGER(IntKi), PARAMETER :: W1VDisX = 9397 + INTEGER(IntKi), PARAMETER :: W2VDisX = 9398 + INTEGER(IntKi), PARAMETER :: W3VDisX = 9399 + INTEGER(IntKi), PARAMETER :: W4VDisX = 9400 + INTEGER(IntKi), PARAMETER :: W5VDisX = 9401 + INTEGER(IntKi), PARAMETER :: W6VDisX = 9402 + INTEGER(IntKi), PARAMETER :: W7VDisX = 9403 + INTEGER(IntKi), PARAMETER :: W8VDisX = 9404 + INTEGER(IntKi), PARAMETER :: W9VDisX = 9405 + INTEGER(IntKi), PARAMETER :: W1VDisY = 9406 + INTEGER(IntKi), PARAMETER :: W2VDisY = 9407 + INTEGER(IntKi), PARAMETER :: W3VDisY = 9408 + INTEGER(IntKi), PARAMETER :: W4VDisY = 9409 + INTEGER(IntKi), PARAMETER :: W5VDisY = 9410 + INTEGER(IntKi), PARAMETER :: W6VDisY = 9411 + INTEGER(IntKi), PARAMETER :: W7VDisY = 9412 + INTEGER(IntKi), PARAMETER :: W8VDisY = 9413 + INTEGER(IntKi), PARAMETER :: W9VDisY = 9414 + INTEGER(IntKi), PARAMETER :: W1VDisZ = 9415 + INTEGER(IntKi), PARAMETER :: W2VDisZ = 9416 + INTEGER(IntKi), PARAMETER :: W3VDisZ = 9417 + INTEGER(IntKi), PARAMETER :: W4VDisZ = 9418 + INTEGER(IntKi), PARAMETER :: W5VDisZ = 9419 + INTEGER(IntKi), PARAMETER :: W6VDisZ = 9420 + INTEGER(IntKi), PARAMETER :: W7VDisZ = 9421 + INTEGER(IntKi), PARAMETER :: W8VDisZ = 9422 + INTEGER(IntKi), PARAMETER :: W9VDisZ = 9423 + + +!End of code generated by Matlab script +! =================================================================================================== + + INTEGER, PARAMETER :: SCGblIn(9) = (/SCGblIn1,SCGblIn2,SCGblIn3,SCGblIn4,SCGblIn5,SCGblIn6,SCGblIn7,SCGblIn8,SCGblIn9/) + INTEGER, PARAMETER :: SCGblOt(9) = (/SCGblOt1,SCGblOt2,SCGblOt3,SCGblOt4,SCGblOt5,SCGblOt6,SCGblOt7,SCGblOt8,SCGblOt9/) + INTEGER, PARAMETER :: SCTIn(9,9) = RESHAPE( & + (/SCT1In1 ,SCT1In2 ,SCT1In3 ,SCT1In4 ,SCT1In5 ,SCT1In6 ,SCT1In7 ,SCT1In8 ,SCT1In9, & + SCT2In1 ,SCT2In2 ,SCT2In3 ,SCT2In4 ,SCT2In5 ,SCT2In6 ,SCT2In7 ,SCT2In8 ,SCT2In9, & + SCT3In1 ,SCT3In2 ,SCT3In3 ,SCT3In4 ,SCT3In5 ,SCT3In6 ,SCT3In7 ,SCT3In8 ,SCT3In9, & + SCT4In1 ,SCT4In2 ,SCT4In3 ,SCT4In4 ,SCT4In5 ,SCT4In6 ,SCT4In7 ,SCT4In8 ,SCT4In9, & + SCT5In1 ,SCT5In2 ,SCT5In3 ,SCT5In4 ,SCT5In5 ,SCT5In6 ,SCT5In7 ,SCT5In8 ,SCT5In9, & + SCT6In1 ,SCT6In2 ,SCT6In3 ,SCT6In4 ,SCT6In5 ,SCT6In6 ,SCT6In7 ,SCT6In8 ,SCT6In9, & + SCT7In1 ,SCT7In2 ,SCT7In3 ,SCT7In4 ,SCT7In5 ,SCT7In6 ,SCT7In7 ,SCT7In8 ,SCT7In9, & + SCT8In1 ,SCT8In2 ,SCT8In3 ,SCT8In4 ,SCT8In5 ,SCT8In6 ,SCT8In7 ,SCT8In8 ,SCT8In9, & + SCT9In1 ,SCT9In2 ,SCT9In3 ,SCT9In4 ,SCT9In5 ,SCT9In6 ,SCT9In7 ,SCT9In8 ,SCT9In9/), (/9,9/) ) + INTEGER, PARAMETER :: SCTOt(9,9) = RESHAPE( & + (/SCT1Ot1 ,SCT1Ot2 ,SCT1Ot3 ,SCT1Ot4 ,SCT1Ot5 ,SCT1Ot6 ,SCT1Ot7 ,SCT1Ot8 ,SCT1Ot9, & + SCT2Ot1 ,SCT2Ot2 ,SCT2Ot3 ,SCT2Ot4 ,SCT2Ot5 ,SCT2Ot6 ,SCT2Ot7 ,SCT2Ot8 ,SCT2Ot9, & + SCT3Ot1 ,SCT3Ot2 ,SCT3Ot3 ,SCT3Ot4 ,SCT3Ot5 ,SCT3Ot6 ,SCT3Ot7 ,SCT3Ot8 ,SCT3Ot9, & + SCT4Ot1 ,SCT4Ot2 ,SCT4Ot3 ,SCT4Ot4 ,SCT4Ot5 ,SCT4Ot6 ,SCT4Ot7 ,SCT4Ot8 ,SCT4Ot9, & + SCT5Ot1 ,SCT5Ot2 ,SCT5Ot3 ,SCT5Ot4 ,SCT5Ot5 ,SCT5Ot6 ,SCT5Ot7 ,SCT5Ot8 ,SCT5Ot9, & + SCT6Ot1 ,SCT6Ot2 ,SCT6Ot3 ,SCT6Ot4 ,SCT6Ot5 ,SCT6Ot6 ,SCT6Ot7 ,SCT6Ot8 ,SCT6Ot9, & + SCT7Ot1 ,SCT7Ot2 ,SCT7Ot3 ,SCT7Ot4 ,SCT7Ot5 ,SCT7Ot6 ,SCT7Ot7 ,SCT7Ot8 ,SCT7Ot9, & + SCT8Ot1 ,SCT8Ot2 ,SCT8Ot3 ,SCT8Ot4 ,SCT8Ot5 ,SCT8Ot6 ,SCT8Ot7 ,SCT8Ot8 ,SCT8Ot9, & + SCT9Ot1 ,SCT9Ot2 ,SCT9Ot3 ,SCT9Ot4 ,SCT9Ot5 ,SCT9Ot6 ,SCT9Ot7 ,SCT9Ot8 ,SCT9Ot9/), (/9,9/) ) + + INTEGER, PARAMETER :: RtAxsXT(9) = (/RtAxsXT1,RtAxsXT2,RtAxsXT3,RtAxsXT4,RtAxsXT5,RtAxsXT6,RtAxsXT7,RtAxsXT8,RtAxsXT9/) + INTEGER, PARAMETER :: RtAxsYT(9) = (/RtAxsYT1,RtAxsYT2,RtAxsYT3,RtAxsYT4,RtAxsYT5,RtAxsYT6,RtAxsYT7,RtAxsYT8,RtAxsYT9/) + INTEGER, PARAMETER :: RtAxsZT(9) = (/RtAxsZT1,RtAxsZT2,RtAxsZT3,RtAxsZT4,RtAxsZT5,RtAxsZT6,RtAxsZT7,RtAxsZT8,RtAxsZT9/) + + INTEGER, PARAMETER :: RtPosXT(9) = (/RtPosXT1,RtPosXT2,RtPosXT3,RtPosXT4,RtPosXT5,RtPosXT6,RtPosXT7,RtPosXT8,RtPosXT9/) + INTEGER, PARAMETER :: RtPosYT(9) = (/RtPosYT1,RtPosYT2,RtPosYT3,RtPosYT4,RtPosYT5,RtPosYT6,RtPosYT7,RtPosYT8,RtPosYT9/) + INTEGER, PARAMETER :: RtPosZT(9) = (/RtPosZT1,RtPosZT2,RtPosZT3,RtPosZT4,RtPosZT5,RtPosZT6,RtPosZT7,RtPosZT8,RtPosZT9/) + + INTEGER, PARAMETER :: RtDiamT(9) = (/RtDiamT1,RtDiamT2,RtDiamT3,RtDiamT4,RtDiamT5,RtDiamT6,RtDiamT7,RtDiamT8,RtDiamT9/) + INTEGER, PARAMETER :: YawErrT(9) = (/YawErrT1,YawErrT2,YawErrT3,YawErrT4,YawErrT5,YawErrT6,YawErrT7,YawErrT8,YawErrT9/) + INTEGER, PARAMETER :: TIAmbT(9) = (/TIAmbT1,TIAmbT2,TIAmbT3,TIAmbT4,TIAmbT5,TIAmbT6,TIAmbT7,TIAmbT8,TIAmbT9/) + INTEGER, PARAMETER :: RtVAmbT(9) = (/RtVAmbT1,RtVAmbT2,RtVAmbT3,RtVAmbT4,RtVAmbT5,RtVAmbT6,RtVAmbT7,RtVAmbT8,RtVAmbT9/) + INTEGER, PARAMETER :: RTVRelT(9) = (/RTVRelT1,RTVRelT2,RTVRelT3,RTVRelT4,RTVRelT5,RTVRelT6,RTVRelT7,RTVRelT8,RTVRelT9/) + + INTEGER, PARAMETER :: CtTN(20,9) = RESHAPE( & + (/CtT1N01,CtT1N02,CtT1N03,CtT1N04,CtT1N05,CtT1N06,CtT1N07,CtT1N08,CtT1N09, CtT1N10, & + CtT1N11,CtT1N12,CtT1N13,CtT1N14,CtT1N15,CtT1N16,CtT1N17,CtT1N18,CtT1N19, CtT1N20, & + CtT2N01,CtT2N02,CtT2N03,CtT2N04,CtT2N05,CtT2N06,CtT2N07,CtT2N08,CtT2N09, CtT2N10, & + CtT2N11,CtT2N12,CtT2N13,CtT2N14,CtT2N15,CtT2N16,CtT2N17,CtT2N18,CtT2N19, CtT2N20, & + CtT3N01,CtT3N02,CtT3N03,CtT3N04,CtT3N05,CtT3N06,CtT3N07,CtT3N08,CtT3N09, CtT3N10, & + CtT3N11,CtT3N12,CtT3N13,CtT3N14,CtT3N15,CtT3N16,CtT3N17,CtT3N18,CtT3N19, CtT3N20, & + CtT4N01,CtT4N02,CtT4N03,CtT4N04,CtT4N05,CtT4N06,CtT4N07,CtT4N08,CtT4N09, CtT4N10, & + CtT4N11,CtT4N12,CtT4N13,CtT4N14,CtT4N15,CtT4N16,CtT4N17,CtT4N18,CtT4N19, CtT4N20, & + CtT5N01,CtT5N02,CtT5N03,CtT5N04,CtT5N05,CtT5N06,CtT5N07,CtT5N08,CtT5N09, CtT5N10, & + CtT5N11,CtT5N12,CtT5N13,CtT5N14,CtT5N15,CtT5N16,CtT5N17,CtT5N18,CtT5N19, CtT5N20, & + CtT6N01,CtT6N02,CtT6N03,CtT6N04,CtT6N05,CtT6N06,CtT6N07,CtT6N08,CtT6N09, CtT6N10, & + CtT6N11,CtT6N12,CtT6N13,CtT6N14,CtT6N15,CtT6N16,CtT6N17,CtT6N18,CtT6N19, CtT6N20, & + CtT7N01,CtT7N02,CtT7N03,CtT7N04,CtT7N05,CtT7N06,CtT7N07,CtT7N08,CtT7N09, CtT7N10, & + CtT7N11,CtT7N12,CtT7N13,CtT7N14,CtT7N15,CtT7N16,CtT7N17,CtT7N18,CtT7N19, CtT7N20, & + CtT8N01,CtT8N02,CtT8N03,CtT8N04,CtT8N05,CtT8N06,CtT8N07,CtT8N08,CtT8N09, CtT8N10, & + CtT8N11,CtT8N12,CtT8N13,CtT8N14,CtT8N15,CtT8N16,CtT8N17,CtT8N18,CtT8N19, CtT8N20, & + CtT9N01,CtT9N02,CtT9N03,CtT9N04,CtT9N05,CtT9N06,CtT9N07,CtT9N08,CtT9N09, CtT9N10, & + CtT9N11,CtT9N12,CtT9N13,CtT9N14,CtT9N15,CtT9N16,CtT9N17,CtT9N18,CtT9N19, CtT9N20/), (/20,9/) ) + + + + INTEGER, PARAMETER :: WkAxsXTD(9,9) = RESHAPE( & + (/WkAxsXT1D1,WkAxsXT1D2,WkAxsXT1D3,WkAxsXT1D4,WkAxsXT1D5,WkAxsXT1D6,WkAxsXT1D7,WkAxsXT1D8,WkAxsXT1D9, & + WkAxsXT2D1,WkAxsXT2D2,WkAxsXT2D3,WkAxsXT2D4,WkAxsXT2D5,WkAxsXT2D6,WkAxsXT2D7,WkAxsXT2D8,WkAxsXT2D9, & + WkAxsXT3D1,WkAxsXT3D2,WkAxsXT3D3,WkAxsXT3D4,WkAxsXT3D5,WkAxsXT3D6,WkAxsXT3D7,WkAxsXT3D8,WkAxsXT3D9, & + WkAxsXT4D1,WkAxsXT4D2,WkAxsXT4D3,WkAxsXT4D4,WkAxsXT4D5,WkAxsXT4D6,WkAxsXT4D7,WkAxsXT4D8,WkAxsXT4D9, & + WkAxsXT5D1,WkAxsXT5D2,WkAxsXT5D3,WkAxsXT5D4,WkAxsXT5D5,WkAxsXT5D6,WkAxsXT5D7,WkAxsXT5D8,WkAxsXT5D9, & + WkAxsXT6D1,WkAxsXT6D2,WkAxsXT6D3,WkAxsXT6D4,WkAxsXT6D5,WkAxsXT6D6,WkAxsXT6D7,WkAxsXT6D8,WkAxsXT6D9, & + WkAxsXT7D1,WkAxsXT7D2,WkAxsXT7D3,WkAxsXT7D4,WkAxsXT7D5,WkAxsXT7D6,WkAxsXT7D7,WkAxsXT7D8,WkAxsXT7D9, & + WkAxsXT8D1,WkAxsXT8D2,WkAxsXT8D3,WkAxsXT8D4,WkAxsXT8D5,WkAxsXT8D6,WkAxsXT8D7,WkAxsXT8D8,WkAxsXT8D9, & + WkAxsXT9D1,WkAxsXT9D2,WkAxsXT9D3,WkAxsXT9D4,WkAxsXT9D5,WkAxsXT9D6,WkAxsXT9D7,WkAxsXT9D8,WkAxsXT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkAxsYTD(9,9) = RESHAPE( & + (/WkAxsYT1D1,WkAxsYT1D2,WkAxsYT1D3,WkAxsYT1D4,WkAxsYT1D5,WkAxsYT1D6,WkAxsYT1D7,WkAxsYT1D8,WkAxsYT1D9, & + WkAxsYT2D1,WkAxsYT2D2,WkAxsYT2D3,WkAxsYT2D4,WkAxsYT2D5,WkAxsYT2D6,WkAxsYT2D7,WkAxsYT2D8,WkAxsYT2D9, & + WkAxsYT3D1,WkAxsYT3D2,WkAxsYT3D3,WkAxsYT3D4,WkAxsYT3D5,WkAxsYT3D6,WkAxsYT3D7,WkAxsYT3D8,WkAxsYT3D9, & + WkAxsYT4D1,WkAxsYT4D2,WkAxsYT4D3,WkAxsYT4D4,WkAxsYT4D5,WkAxsYT4D6,WkAxsYT4D7,WkAxsYT4D8,WkAxsYT4D9, & + WkAxsYT5D1,WkAxsYT5D2,WkAxsYT5D3,WkAxsYT5D4,WkAxsYT5D5,WkAxsYT5D6,WkAxsYT5D7,WkAxsYT5D8,WkAxsYT5D9, & + WkAxsYT6D1,WkAxsYT6D2,WkAxsYT6D3,WkAxsYT6D4,WkAxsYT6D5,WkAxsYT6D6,WkAxsYT6D7,WkAxsYT6D8,WkAxsYT6D9, & + WkAxsYT7D1,WkAxsYT7D2,WkAxsYT7D3,WkAxsYT7D4,WkAxsYT7D5,WkAxsYT7D6,WkAxsYT7D7,WkAxsYT7D8,WkAxsYT7D9, & + WkAxsYT8D1,WkAxsYT8D2,WkAxsYT8D3,WkAxsYT8D4,WkAxsYT8D5,WkAxsYT8D6,WkAxsYT8D7,WkAxsYT8D8,WkAxsYT8D9, & + WkAxsYT9D1,WkAxsYT9D2,WkAxsYT9D3,WkAxsYT9D4,WkAxsYT9D5,WkAxsYT9D6,WkAxsYT9D7,WkAxsYT9D8,WkAxsYT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkAxsZTD(9,9) = RESHAPE( & + (/WkAxsZT1D1,WkAxsZT1D2,WkAxsZT1D3,WkAxsZT1D4,WkAxsZT1D5,WkAxsZT1D6,WkAxsZT1D7,WkAxsZT1D8,WkAxsZT1D9, & + WkAxsZT2D1,WkAxsZT2D2,WkAxsZT2D3,WkAxsZT2D4,WkAxsZT2D5,WkAxsZT2D6,WkAxsZT2D7,WkAxsZT2D8,WkAxsZT2D9, & + WkAxsZT3D1,WkAxsZT3D2,WkAxsZT3D3,WkAxsZT3D4,WkAxsZT3D5,WkAxsZT3D6,WkAxsZT3D7,WkAxsZT3D8,WkAxsZT3D9, & + WkAxsZT4D1,WkAxsZT4D2,WkAxsZT4D3,WkAxsZT4D4,WkAxsZT4D5,WkAxsZT4D6,WkAxsZT4D7,WkAxsZT4D8,WkAxsZT4D9, & + WkAxsZT5D1,WkAxsZT5D2,WkAxsZT5D3,WkAxsZT5D4,WkAxsZT5D5,WkAxsZT5D6,WkAxsZT5D7,WkAxsZT5D8,WkAxsZT5D9, & + WkAxsZT6D1,WkAxsZT6D2,WkAxsZT6D3,WkAxsZT6D4,WkAxsZT6D5,WkAxsZT6D6,WkAxsZT6D7,WkAxsZT6D8,WkAxsZT6D9, & + WkAxsZT7D1,WkAxsZT7D2,WkAxsZT7D3,WkAxsZT7D4,WkAxsZT7D5,WkAxsZT7D6,WkAxsZT7D7,WkAxsZT7D8,WkAxsZT7D9, & + WkAxsZT8D1,WkAxsZT8D2,WkAxsZT8D3,WkAxsZT8D4,WkAxsZT8D5,WkAxsZT8D6,WkAxsZT8D7,WkAxsZT8D8,WkAxsZT8D9, & + WkAxsZT9D1,WkAxsZT9D2,WkAxsZT9D3,WkAxsZT9D4,WkAxsZT9D5,WkAxsZT9D6,WkAxsZT9D7,WkAxsZT9D8,WkAxsZT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkPosXTD(9,9) = RESHAPE( & + (/WkPosXT1D1,WkPosXT1D2,WkPosXT1D3,WkPosXT1D4,WkPosXT1D5,WkPosXT1D6,WkPosXT1D7,WkPosXT1D8,WkPosXT1D9, & + WkPosXT2D1,WkPosXT2D2,WkPosXT2D3,WkPosXT2D4,WkPosXT2D5,WkPosXT2D6,WkPosXT2D7,WkPosXT2D8,WkPosXT2D9, & + WkPosXT3D1,WkPosXT3D2,WkPosXT3D3,WkPosXT3D4,WkPosXT3D5,WkPosXT3D6,WkPosXT3D7,WkPosXT3D8,WkPosXT3D9, & + WkPosXT4D1,WkPosXT4D2,WkPosXT4D3,WkPosXT4D4,WkPosXT4D5,WkPosXT4D6,WkPosXT4D7,WkPosXT4D8,WkPosXT4D9, & + WkPosXT5D1,WkPosXT5D2,WkPosXT5D3,WkPosXT5D4,WkPosXT5D5,WkPosXT5D6,WkPosXT5D7,WkPosXT5D8,WkPosXT5D9, & + WkPosXT6D1,WkPosXT6D2,WkPosXT6D3,WkPosXT6D4,WkPosXT6D5,WkPosXT6D6,WkPosXT6D7,WkPosXT6D8,WkPosXT6D9, & + WkPosXT7D1,WkPosXT7D2,WkPosXT7D3,WkPosXT7D4,WkPosXT7D5,WkPosXT7D6,WkPosXT7D7,WkPosXT7D8,WkPosXT7D9, & + WkPosXT8D1,WkPosXT8D2,WkPosXT8D3,WkPosXT8D4,WkPosXT8D5,WkPosXT8D6,WkPosXT8D7,WkPosXT8D8,WkPosXT8D9, & + WkPosXT9D1,WkPosXT9D2,WkPosXT9D3,WkPosXT9D4,WkPosXT9D5,WkPosXT9D6,WkPosXT9D7,WkPosXT9D8,WkPosXT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkPosYTD(9,9) = RESHAPE( & + (/WkPosYT1D1,WkPosYT1D2,WkPosYT1D3,WkPosYT1D4,WkPosYT1D5,WkPosYT1D6,WkPosYT1D7,WkPosYT1D8,WkPosYT1D9, & + WkPosYT2D1,WkPosYT2D2,WkPosYT2D3,WkPosYT2D4,WkPosYT2D5,WkPosYT2D6,WkPosYT2D7,WkPosYT2D8,WkPosYT2D9, & + WkPosYT3D1,WkPosYT3D2,WkPosYT3D3,WkPosYT3D4,WkPosYT3D5,WkPosYT3D6,WkPosYT3D7,WkPosYT3D8,WkPosYT3D9, & + WkPosYT4D1,WkPosYT4D2,WkPosYT4D3,WkPosYT4D4,WkPosYT4D5,WkPosYT4D6,WkPosYT4D7,WkPosYT4D8,WkPosYT4D9, & + WkPosYT5D1,WkPosYT5D2,WkPosYT5D3,WkPosYT5D4,WkPosYT5D5,WkPosYT5D6,WkPosYT5D7,WkPosYT5D8,WkPosYT5D9, & + WkPosYT6D1,WkPosYT6D2,WkPosYT6D3,WkPosYT6D4,WkPosYT6D5,WkPosYT6D6,WkPosYT6D7,WkPosYT6D8,WkPosYT6D9, & + WkPosYT7D1,WkPosYT7D2,WkPosYT7D3,WkPosYT7D4,WkPosYT7D5,WkPosYT7D6,WkPosYT7D7,WkPosYT7D8,WkPosYT7D9, & + WkPosYT8D1,WkPosYT8D2,WkPosYT8D3,WkPosYT8D4,WkPosYT8D5,WkPosYT8D6,WkPosYT8D7,WkPosYT8D8,WkPosYT8D9, & + WkPosYT9D1,WkPosYT9D2,WkPosYT9D3,WkPosYT9D4,WkPosYT9D5,WkPosYT9D6,WkPosYT9D7,WkPosYT9D8,WkPosYT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkPosZTD(9,9) = RESHAPE( & + (/WkPosZT1D1,WkPosZT1D2,WkPosZT1D3,WkPosZT1D4,WkPosZT1D5,WkPosZT1D6,WkPosZT1D7,WkPosZT1D8,WkPosZT1D9, & + WkPosZT2D1,WkPosZT2D2,WkPosZT2D3,WkPosZT2D4,WkPosZT2D5,WkPosZT2D6,WkPosZT2D7,WkPosZT2D8,WkPosZT2D9, & + WkPosZT3D1,WkPosZT3D2,WkPosZT3D3,WkPosZT3D4,WkPosZT3D5,WkPosZT3D6,WkPosZT3D7,WkPosZT3D8,WkPosZT3D9, & + WkPosZT4D1,WkPosZT4D2,WkPosZT4D3,WkPosZT4D4,WkPosZT4D5,WkPosZT4D6,WkPosZT4D7,WkPosZT4D8,WkPosZT4D9, & + WkPosZT5D1,WkPosZT5D2,WkPosZT5D3,WkPosZT5D4,WkPosZT5D5,WkPosZT5D6,WkPosZT5D7,WkPosZT5D8,WkPosZT5D9, & + WkPosZT6D1,WkPosZT6D2,WkPosZT6D3,WkPosZT6D4,WkPosZT6D5,WkPosZT6D6,WkPosZT6D7,WkPosZT6D8,WkPosZT6D9, & + WkPosZT7D1,WkPosZT7D2,WkPosZT7D3,WkPosZT7D4,WkPosZT7D5,WkPosZT7D6,WkPosZT7D7,WkPosZT7D8,WkPosZT7D9, & + WkPosZT8D1,WkPosZT8D2,WkPosZT8D3,WkPosZT8D4,WkPosZT8D5,WkPosZT8D6,WkPosZT8D7,WkPosZT8D8,WkPosZT8D9, & + WkPosZT9D1,WkPosZT9D2,WkPosZT9D3,WkPosZT9D4,WkPosZT9D5,WkPosZT9D6,WkPosZT9D7,WkPosZT9D8,WkPosZT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkVelXTD(9,9) = RESHAPE( & + (/WkVelXT1D1,WkVelXT1D2,WkVelXT1D3,WkVelXT1D4,WkVelXT1D5,WkVelXT1D6,WkVelXT1D7,WkVelXT1D8,WkVelXT1D9, & + WkVelXT2D1,WkVelXT2D2,WkVelXT2D3,WkVelXT2D4,WkVelXT2D5,WkVelXT2D6,WkVelXT2D7,WkVelXT2D8,WkVelXT2D9, & + WkVelXT3D1,WkVelXT3D2,WkVelXT3D3,WkVelXT3D4,WkVelXT3D5,WkVelXT3D6,WkVelXT3D7,WkVelXT3D8,WkVelXT3D9, & + WkVelXT4D1,WkVelXT4D2,WkVelXT4D3,WkVelXT4D4,WkVelXT4D5,WkVelXT4D6,WkVelXT4D7,WkVelXT4D8,WkVelXT4D9, & + WkVelXT5D1,WkVelXT5D2,WkVelXT5D3,WkVelXT5D4,WkVelXT5D5,WkVelXT5D6,WkVelXT5D7,WkVelXT5D8,WkVelXT5D9, & + WkVelXT6D1,WkVelXT6D2,WkVelXT6D3,WkVelXT6D4,WkVelXT6D5,WkVelXT6D6,WkVelXT6D7,WkVelXT6D8,WkVelXT6D9, & + WkVelXT7D1,WkVelXT7D2,WkVelXT7D3,WkVelXT7D4,WkVelXT7D5,WkVelXT7D6,WkVelXT7D7,WkVelXT7D8,WkVelXT7D9, & + WkVelXT8D1,WkVelXT8D2,WkVelXT8D3,WkVelXT8D4,WkVelXT8D5,WkVelXT8D6,WkVelXT8D7,WkVelXT8D8,WkVelXT8D9, & + WkVelXT9D1,WkVelXT9D2,WkVelXT9D3,WkVelXT9D4,WkVelXT9D5,WkVelXT9D6,WkVelXT9D7,WkVelXT9D8,WkVelXT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkVelYTD(9,9) = RESHAPE( & + (/WkVelYT1D1,WkVelYT1D2,WkVelYT1D3,WkVelYT1D4,WkVelYT1D5,WkVelYT1D6,WkVelYT1D7,WkVelYT1D8,WkVelYT1D9, & + WkVelYT2D1,WkVelYT2D2,WkVelYT2D3,WkVelYT2D4,WkVelYT2D5,WkVelYT2D6,WkVelYT2D7,WkVelYT2D8,WkVelYT2D9, & + WkVelYT3D1,WkVelYT3D2,WkVelYT3D3,WkVelYT3D4,WkVelYT3D5,WkVelYT3D6,WkVelYT3D7,WkVelYT3D8,WkVelYT3D9, & + WkVelYT4D1,WkVelYT4D2,WkVelYT4D3,WkVelYT4D4,WkVelYT4D5,WkVelYT4D6,WkVelYT4D7,WkVelYT4D8,WkVelYT4D9, & + WkVelYT5D1,WkVelYT5D2,WkVelYT5D3,WkVelYT5D4,WkVelYT5D5,WkVelYT5D6,WkVelYT5D7,WkVelYT5D8,WkVelYT5D9, & + WkVelYT6D1,WkVelYT6D2,WkVelYT6D3,WkVelYT6D4,WkVelYT6D5,WkVelYT6D6,WkVelYT6D7,WkVelYT6D8,WkVelYT6D9, & + WkVelYT7D1,WkVelYT7D2,WkVelYT7D3,WkVelYT7D4,WkVelYT7D5,WkVelYT7D6,WkVelYT7D7,WkVelYT7D8,WkVelYT7D9, & + WkVelYT8D1,WkVelYT8D2,WkVelYT8D3,WkVelYT8D4,WkVelYT8D5,WkVelYT8D6,WkVelYT8D7,WkVelYT8D8,WkVelYT8D9, & + WkVelYT9D1,WkVelYT9D2,WkVelYT9D3,WkVelYT9D4,WkVelYT9D5,WkVelYT9D6,WkVelYT9D7,WkVelYT9D8,WkVelYT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkVelZTD(9,9) = RESHAPE( & + (/WkVelZT1D1,WkVelZT1D2,WkVelZT1D3,WkVelZT1D4,WkVelZT1D5,WkVelZT1D6,WkVelZT1D7,WkVelZT1D8,WkVelZT1D9, & + WkVelZT2D1,WkVelZT2D2,WkVelZT2D3,WkVelZT2D4,WkVelZT2D5,WkVelZT2D6,WkVelZT2D7,WkVelZT2D8,WkVelZT2D9, & + WkVelZT3D1,WkVelZT3D2,WkVelZT3D3,WkVelZT3D4,WkVelZT3D5,WkVelZT3D6,WkVelZT3D7,WkVelZT3D8,WkVelZT3D9, & + WkVelZT4D1,WkVelZT4D2,WkVelZT4D3,WkVelZT4D4,WkVelZT4D5,WkVelZT4D6,WkVelZT4D7,WkVelZT4D8,WkVelZT4D9, & + WkVelZT5D1,WkVelZT5D2,WkVelZT5D3,WkVelZT5D4,WkVelZT5D5,WkVelZT5D6,WkVelZT5D7,WkVelZT5D8,WkVelZT5D9, & + WkVelZT6D1,WkVelZT6D2,WkVelZT6D3,WkVelZT6D4,WkVelZT6D5,WkVelZT6D6,WkVelZT6D7,WkVelZT6D8,WkVelZT6D9, & + WkVelZT7D1,WkVelZT7D2,WkVelZT7D3,WkVelZT7D4,WkVelZT7D5,WkVelZT7D6,WkVelZT7D7,WkVelZT7D8,WkVelZT7D9, & + WkVelZT8D1,WkVelZT8D2,WkVelZT8D3,WkVelZT8D4,WkVelZT8D5,WkVelZT8D6,WkVelZT8D7,WkVelZT8D8,WkVelZT8D9, & + WkVelZT9D1,WkVelZT9D2,WkVelZT9D3,WkVelZT9D4,WkVelZT9D5,WkVelZT9D6,WkVelZT9D7,WkVelZT9D8,WkVelZT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WkDiamTD(9,9) = RESHAPE( & + (/WkDiamT1D1,WkDiamT1D2,WkDiamT1D3,WkDiamT1D4,WkDiamT1D5,WkDiamT1D6,WkDiamT1D7,WkDiamT1D8,WkDiamT1D9, & + WkDiamT2D1,WkDiamT2D2,WkDiamT2D3,WkDiamT2D4,WkDiamT2D5,WkDiamT2D6,WkDiamT2D7,WkDiamT2D8,WkDiamT2D9, & + WkDiamT3D1,WkDiamT3D2,WkDiamT3D3,WkDiamT3D4,WkDiamT3D5,WkDiamT3D6,WkDiamT3D7,WkDiamT3D8,WkDiamT3D9, & + WkDiamT4D1,WkDiamT4D2,WkDiamT4D3,WkDiamT4D4,WkDiamT4D5,WkDiamT4D6,WkDiamT4D7,WkDiamT4D8,WkDiamT4D9, & + WkDiamT5D1,WkDiamT5D2,WkDiamT5D3,WkDiamT5D4,WkDiamT5D5,WkDiamT5D6,WkDiamT5D7,WkDiamT5D8,WkDiamT5D9, & + WkDiamT6D1,WkDiamT6D2,WkDiamT6D3,WkDiamT6D4,WkDiamT6D5,WkDiamT6D6,WkDiamT6D7,WkDiamT6D8,WkDiamT6D9, & + WkDiamT7D1,WkDiamT7D2,WkDiamT7D3,WkDiamT7D4,WkDiamT7D5,WkDiamT7D6,WkDiamT7D7,WkDiamT7D8,WkDiamT7D9, & + WkDiamT8D1,WkDiamT8D2,WkDiamT8D3,WkDiamT8D4,WkDiamT8D5,WkDiamT8D6,WkDiamT8D7,WkDiamT8D8,WkDiamT8D9, & + WkDiamT9D1,WkDiamT9D2,WkDiamT9D3,WkDiamT9D4,WkDiamT9D5,WkDiamT9D6,WkDiamT9D7,WkDiamT9D8,WkDiamT9D9/), (/9,9/) ) + + INTEGER, PARAMETER :: WVAmbX(9) = (/W1VAmbX, W2VAmbX, W3VAmbX, W4VAmbX, W5VAmbX, W6VAmbX, W7VAmbX, W8VAmbX, W9VAmbX/) + INTEGER, PARAMETER :: WVAmbY(9) = (/W1VAmbY, W2VAmbY, W3VAmbY, W4VAmbY, W5VAmbY, W6VAmbY, W7VAmbY, W8VAmbY, W9VAmbY/) + INTEGER, PARAMETER :: WVAmbZ(9) = (/W1VAmbZ, W2VAmbZ, W3VAmbZ, W4VAmbZ, W5VAmbZ, W6VAmbZ, W7VAmbZ, W8VAmbZ, W9VAmbZ/) + + INTEGER, PARAMETER :: WVDisX(9) = (/W1VDisX, W2VDisX, W3VDisX, W4VDisX, W5VDisX, W6VDisX, W7VDisX, W8VDisX, W9VDisX/) + INTEGER, PARAMETER :: WVDisY(9) = (/W1VDisY, W2VDisY, W3VDisY, W4VDisY, W5VDisY, W6VDisY, W7VDisY, W8VDisY, W9VDisY/) + INTEGER, PARAMETER :: WVDisZ(9) = (/W1VDisZ, W2VDisZ, W3VDisZ, W4VDisZ, W5VDisZ, W6VDisZ, W7VDisZ, W8VDisZ, W9VDisZ/) + + INTEGER(IntKi) :: WkDfVxTND(20,9,9) + INTEGER(IntKi) :: WkDfVrTND(20,9,9) + INTEGER(IntKi) :: EddVisTND(20,9,9) + INTEGER(IntKi) :: EddAmbTND(20,9,9) + INTEGER(IntKi) :: EddShrTND(20,9,9) + public:: WkDfVxTND, WkDfVrTND, EddVisTND, EddAmbTND, EddShrTND + + + + + + + + + contains + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This function returns a string describing the glue code and some of the compilation options we're using. +FUNCTION GetVersion(ThisProgVer) + + ! Passed Variables: + + TYPE(ProgDesc), INTENT( IN ) :: ThisProgVer !< program name/date/version description + CHARACTER(1024) :: GetVersion !< String containing a description of the compiled precision. + + GetVersion = TRIM(GetNVD(ThisProgVer))//', compiled' + + + GetVersion = TRIM(GetVersion)//' as a '//TRIM(Num2LStr(BITS_IN_ADDR))//'-bit application using' + + ! determine precision + + IF ( ReKi == SiKi ) THEN ! Single precision + GetVersion = TRIM(GetVersion)//' single' + ELSEIF ( ReKi == R8Ki ) THEN ! Double precision + GetVersion = TRIM(GetVersion)// ' double' + ELSE ! Unknown precision + GetVersion = TRIM(GetVersion)//' unknown' + ENDIF + +! GetVersion = TRIM(GetVersion)//' precision with '//OS_Desc + GetVersion = TRIM(GetVersion)//' precision' + + + RETURN +END FUNCTION GetVersion + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine generates the summary file, which contains a regurgitation of the input data and interpolated flexible body data. +SUBROUTINE Farm_PrintSum( farm, WD_InputFileData, ErrStat, ErrMsg ) + + ! Passed variables + type(All_FastFarm_Data), INTENT(IN ) :: farm !< FAST.Farm data + type(WD_InputFileType), INTENT(IN ) :: WD_InputFileData !< Wake Dynamics Input File data + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message corresponding to ErrStat + + + ! Local variables. + + INTEGER(IntKi) :: I,J ! Index for the nodes. + INTEGER(IntKi) :: K ! Generic index (also for the blade number). + INTEGER(IntKi) :: UnSum ! I/O unit number for the summary output file + + CHARACTER(*), PARAMETER :: Fmt1 = "(34X,3(6X,'Blade',I2,:))" ! Format for outputting blade headings. + CHARACTER(*), PARAMETER :: Fmt2 = "(34X,3(6X,A,:))" ! Format for outputting blade headings. + CHARACTER(*), PARAMETER :: FmtDat = '(A,T35,3(:,F13.3))' ! Format for outputting mass and modal data. + CHARACTER(*), PARAMETER :: FmtDatT = '(A,T35,1(:,F13.8))' ! Format for outputting time steps. + CHARACTER(100) :: RotorType ! Text description of rotor. + CHARACTER(30) :: Fmt + CHARACTER(30) :: OutPFmt ! Format to print list of selected output channels to summary file + CHARACTER(10) :: DOFEnabled ! String to say if a DOF is enabled or disabled + CHARACTER(3) :: outStr + CHARACTER(10) :: CalWakeDiamStr + CHARACTER(100) :: strModDescr + + ! Open the summary file and give it a heading. + + CALL GetNewUnit( UnSum, ErrStat, ErrMsg ) + IF ( ErrStat /= ErrID_None ) RETURN + + CALL OpenFOutFile ( UnSum, TRIM( farm%p%OutFileRoot )//'.sum', ErrStat, ErrMsg ) + IF ( ErrStat /= ErrID_None ) RETURN + + + ! Heading: + !.......................... Module Versions ..................................................... + + + WRITE (UnSum,'(A)') 'FAST.Farm Summary File' + WRITE (UnSum,'(/A)') TRIM( farm%p%FileDescLines(1) ) + + WRITE (UnSum,'(2X,A)' ) 'compiled with' + Fmt = '(4x,A)' + WRITE (UnSum,Fmt) TRIM( GetNVD( NWTC_Ver ) ) + WRITE (UnSum,Fmt) TRIM( GetNVD( farm%p%Module_Ver( ModuleFF_SC ) ) ) + WRITE (UnSum,Fmt) TRIM( GetNVD( farm%p%Module_Ver( ModuleFF_FWrap ) ) ) + WRITE (UnSum,Fmt) TRIM( GetNVD( farm%p%Module_Ver( ModuleFF_WD ) ) ) + WRITE (UnSum,Fmt) TRIM( GetNVD( farm%p%Module_Ver( ModuleFF_AWAE ) ) ) + !WRITE (y_FAST%UnSum,Fmt) TRIM( GetNVD( ) ) + + WRITE (UnSum,'(/,A)') 'Description from the FAST.Farm input file: '//trim(farm%p%FTitle) + + WRITE (UnSum,'(/,A)') 'Ambient Wind:' + + if ( farm%AWAE%p%mod_AmbWind == 1 ) then + strModDescr = 'High-Fidelity Precursor' + elseif ( farm%AWAE%p%mod_AmbWind == 2 ) then + strModDescr = 'One InflowWind Module' + else ! farm%AWAE%p%mod_AmbWind == 3 + strModDescr = 'Multiple InflowWind Modules' + end if + + WRITE (UnSum,'(2X,A)') 'Ambient wind model: '//trim(strModDescr) + if ( farm%AWAE%p%mod_AmbWind == 1 ) then + WRITE (UnSum,'(2X,A)') 'Ambient wind input filepath: '//trim(farm%p%WindFilePath) + else + WRITE (UnSum,'(2X,A)') 'InflowWind module input file: '//trim(farm%p%WindFilePath) + end if + + !.................................. + ! Turbine information. + !.................................. + + WRITE (UnSum,'(/,A)' ) 'Wind Turbines: '//trim(Num2LStr(farm%p%NumTurbines)) + WRITE (UnSum,'(2X,A)') 'Turbine Number Output Turbine Number X Y Z OpenFAST Time Step OpenFAST SubCycles OpenFAST Input File' + WRITE (UnSum,'(2X,A)') ' (-) (-) (m) (m) (m) (S) (-) (-)' + + do I = 1,farm%p%NumTurbines + if ( I < 10 ) then + outStr = 'T'//(trim(Num2LStr(I))) + else + outStr = ' - ' + end if + + WRITE(UnSum,'(6X,I4,17X,A,8X,3(1X,F10.3),5X,F10.5,8X,I4,10X,A)') I, outStr, farm%p%WT_Position(:,I), (farm%p%DT_low/real(farm%FWrap(I)%p%n_FAST_low)), farm%FWrap(I)%p%n_FAST_low, trim(farm%p%WT_FASTInFile(I)) + + end do + + WRITE (UnSum,'(/,A)' ) 'Wake Dynamics Finite-Difference Grid: '//trim(Num2LStr(farm%WD(1)%p%NumRadii))//' Radii, '//trim(Num2LStr(farm%WD(1)%p%NumPlanes))//' Planes' + WRITE (UnSum,'(2X,A)') 'Radial Node Number Output Node Number Radius' + WRITE (UnSum,'(2X,A)') ' (-) (-) (m) ' + do I = 0, farm%WD(1)%p%NumRadii-1 + outStr = ' - ' + do J = 1, farm%p%NOutRadii + if (farm%p%OutRadii(J) == I ) then + outStr = 'N'//trim(Num2LStr(J)) + exit + end if + end do + + WRITE(UnSum,'(8X,I4,16X,A3,9X,F10.3)') I, outStr, farm%WD(1)%p%r(I) + + end do + + WRITE (UnSum,'(/,A)' ) 'Wake Dynamics Parameters' + WRITE (UnSum,'(2X,A)') 'Cut-off (corner) frequency of the low-pass time-filter for the wake advection, deflection, and meandering model (Hz): '//trim(Num2LStr(WD_InputFileData%f_c)) + WRITE (UnSum,'(4X,A)') '( low-pass time-filter parameter (-): '//trim(Num2LStr(farm%WD(1)%p%filtParam))//' )' + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor (m): '//trim(Num2LStr(farm%WD(1)%p%C_HWkDfl_O)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error (m/deg): '//trim(Num2LStr(farm%WD(1)%p%C_HWkDfl_OY/R2D)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance (-): '//trim(Num2LStr(farm%WD(1)%p%C_HWkDfl_x)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error (1/deg): '//trim(Num2LStr(farm%WD(1)%p%C_HWkDfl_xY/R2D)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter for near-wake correction (-): '//trim(Num2LStr(farm%WD(1)%p%C_NearWake)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-): '//trim(Num2LStr(farm%WD(1)%p%k_vAmb)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter for the influence of the shear layer in the eddy viscosity (-): '//trim(Num2LStr(farm%WD(1)%p%k_vShr)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-): '//trim(Num2LStr(farm%WD(1)%p%C_vAmb_DMin)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-): '//trim(Num2LStr(farm%WD(1)%p%C_vAmb_DMax)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region (-): '//trim(Num2LStr(farm%WD(1)%p%C_vAmb_FMin)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-): '//trim(Num2LStr(farm%WD(1)%p%C_vAmb_Exp)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-): '//trim(Num2LStr(farm%WD(1)%p%C_vShr_DMin)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-): '//trim(Num2LStr(farm%WD(1)%p%C_vShr_DMax)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for the shear layer defining the functional value in the minimum region (-): '//trim(Num2LStr(farm%WD(1)%p%C_vShr_FMin)) + WRITE (UnSum,'(2X,A)') 'Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-): '//trim(Num2LStr(farm%WD(1)%p%C_vShr_Exp)) + WRITE (UnSum,'(2X,A)') 'Wake diameter calculation model (-): '//trim(Num2LStr(farm%WD(1)%p%Mod_WakeDiam)) + select case ( farm%WD(1)%p%Mod_WakeDiam ) + case (WakeDiamMod_RotDiam) + WRITE (UnSum,'(4X,A)') '( rotor diameter )' + case (WakeDiamMod_Velocity) + WRITE (UnSum,'(4X,A)') '( velocity based )' + case (WakeDiamMod_MassFlux) + WRITE (UnSum,'(4X,A)') '( mass-flux based )' + case (WakeDiamMod_MtmFlux) + WRITE (UnSum,'(4X,A)') '( momentum-flux based )' + end select + if ( farm%WD(1)%p%Mod_WakeDiam > 1 ) then + CalWakeDiamStr = trim(Num2LStr(farm%WD(1)%p%C_WakeDiam)) + else + CalWakeDiamStr = '-' + end if + WRITE (UnSum,'(2X,A)') 'Calibrated parameter for wake diameter calculation (-): '//CalWakeDiamStr + WRITE (UnSum,'(2X,A)') 'Spatial filter model for wake meandering (-): '//trim(Num2LStr(farm%AWAE%p%Mod_Meander)) + select case ( farm%AWAE%p%Mod_Meander ) + case (MeanderMod_Uniform) + WRITE (UnSum,'(4X,A)') '( uniform )' + case (MeanderMod_TruncJinc) + WRITE (UnSum,'(4X,A)') '( truncated jinc )' + case (MeanderMod_WndwdJinc) + WRITE (UnSum,'(4X,A)') '( windowed jinc )' + end select +WRITE (UnSum,'(2X,A)') 'Calibrated parameter for wake meandering (-): '//trim(Num2LStr(farm%AWAE%p%C_Meander)) + + WRITE (UnSum,'(/,A)' ) 'Time Steps' + WRITE (UnSum,'(2X,A)') 'Component Time Step Subcyles' + WRITE (UnSum,'(2X,A)') ' (-) (s) (-)' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'FAST.Farm (glue code) ',farm%p%dt_low, '1' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'Super Controller ',farm%p%dt_low, '1' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'FAST Wrapper ',farm%p%dt_low, '1 (See table above for OpenFAST.)' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'Wake Dynamics ',farm%p%dt_low, '1' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'Ambient Wind and Array Effects ',farm%p%dt_low, '1' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'Low -resolution wind input ',farm%p%dt_low, '1' + WRITE (UnSum,'(2X,A,F10.4,12X,I2)') 'High-resolution wind input ',farm%p%DT_high, farm%p%n_high_low + WRITE (UnSum,'(2X,A,F10.4,12X,I2,A)') 'Wind visualization output ',farm%AWAE%p%WrDisSkp1*farm%p%dt_low, farm%AWAE%p%WrDisSkp1, '^-1' + WRITE (UnSum,'(2X,A,F10.4,13X,A)') 'FAST.Farm output files ',farm%p%dt_low, '1' + + WRITE (UnSum,'(/,A)' ) 'Requested Channels in FAST.Farm Output Files: '//trim(Num2LStr(farm%p%NumOuts+1)) + WRITE (UnSum,'(2X,A)' ) 'Number Name Units' + WRITE (UnSum,'(2X,A)' ) ' 0 Time (s)' + do I=1,farm%p%NumOuts + WRITE (UnSum,'(2X,I4,7X,A14,A14)' ) I, farm%p%OutParam(I)%Name,farm%p%OutParam(I)%Units + end do + + CLOSE(UnSum) + +RETURN +END SUBROUTINE Farm_PrintSum + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine initializes the output for the glue code, including writing the header for the primary output file. +SUBROUTINE Farm_InitOutput( farm, ErrStat, ErrMsg ) + + IMPLICIT NONE + + ! Passed variables + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message corresponding to ErrStat + + + ! Local variables. + + INTEGER(IntKi) :: I, J ! Generic index for DO loops. + INTEGER(IntKi) :: indxLast ! The index of the last value to be written to an array + INTEGER(IntKi) :: indxNext ! The index of the next value to be written to an array + INTEGER(IntKi) :: NumOuts ! number of channels to be written to the output file(s) + + +WkDfVxTND(:,:,1) = RESHAPE( & + (/WkDfVxT1N01D1,WkDfVxT1N02D1,WkDfVxT1N03D1,WkDfVxT1N04D1,WkDfVxT1N05D1,WkDfVxT1N06D1,WkDfVxT1N07D1,WkDfVxT1N08D1,WkDfVxT1N09D1,WkDfVxT1N10D1, & + WkDfVxT1N11D1,WkDfVxT1N12D1,WkDfVxT1N13D1,WkDfVxT1N14D1,WkDfVxT1N15D1,WkDfVxT1N16D1,WkDfVxT1N17D1,WkDfVxT1N18D1,WkDfVxT1N19D1,WkDfVxT1N20D1, & + WkDfVxT1N01D2,WkDfVxT1N02D2,WkDfVxT1N03D2,WkDfVxT1N04D2,WkDfVxT1N05D2,WkDfVxT1N06D2,WkDfVxT1N07D2,WkDfVxT1N08D2,WkDfVxT1N09D2,WkDfVxT1N10D2, & + WkDfVxT1N11D2,WkDfVxT1N12D2,WkDfVxT1N13D2,WkDfVxT1N14D2,WkDfVxT1N15D2,WkDfVxT1N16D2,WkDfVxT1N17D2,WkDfVxT1N18D2,WkDfVxT1N19D2,WkDfVxT1N20D2, & + WkDfVxT1N01D3,WkDfVxT1N02D3,WkDfVxT1N03D3,WkDfVxT1N04D3,WkDfVxT1N05D3,WkDfVxT1N06D3,WkDfVxT1N07D3,WkDfVxT1N08D3,WkDfVxT1N09D3,WkDfVxT1N10D3, & + WkDfVxT1N11D3,WkDfVxT1N12D3,WkDfVxT1N13D3,WkDfVxT1N14D3,WkDfVxT1N15D3,WkDfVxT1N16D3,WkDfVxT1N17D3,WkDfVxT1N18D3,WkDfVxT1N19D3,WkDfVxT1N20D3, & + WkDfVxT1N01D4,WkDfVxT1N02D4,WkDfVxT1N03D4,WkDfVxT1N04D4,WkDfVxT1N05D4,WkDfVxT1N06D4,WkDfVxT1N07D4,WkDfVxT1N08D4,WkDfVxT1N09D4,WkDfVxT1N10D4, & + WkDfVxT1N11D4,WkDfVxT1N12D4,WkDfVxT1N13D4,WkDfVxT1N14D4,WkDfVxT1N15D4,WkDfVxT1N16D4,WkDfVxT1N17D4,WkDfVxT1N18D4,WkDfVxT1N19D4,WkDfVxT1N20D4, & + WkDfVxT1N01D5,WkDfVxT1N02D5,WkDfVxT1N03D5,WkDfVxT1N04D5,WkDfVxT1N05D5,WkDfVxT1N06D5,WkDfVxT1N07D5,WkDfVxT1N08D5,WkDfVxT1N09D5,WkDfVxT1N10D5, & + WkDfVxT1N11D5,WkDfVxT1N12D5,WkDfVxT1N13D5,WkDfVxT1N14D5,WkDfVxT1N15D5,WkDfVxT1N16D5,WkDfVxT1N17D5,WkDfVxT1N18D5,WkDfVxT1N19D5,WkDfVxT1N20D5, & + WkDfVxT1N01D6,WkDfVxT1N02D6,WkDfVxT1N03D6,WkDfVxT1N04D6,WkDfVxT1N05D6,WkDfVxT1N06D6,WkDfVxT1N07D6,WkDfVxT1N08D6,WkDfVxT1N09D6,WkDfVxT1N10D6, & + WkDfVxT1N11D6,WkDfVxT1N12D6,WkDfVxT1N13D6,WkDfVxT1N14D6,WkDfVxT1N15D6,WkDfVxT1N16D6,WkDfVxT1N17D6,WkDfVxT1N18D6,WkDfVxT1N19D6,WkDfVxT1N20D6, & + WkDfVxT1N01D7,WkDfVxT1N02D7,WkDfVxT1N03D7,WkDfVxT1N04D7,WkDfVxT1N05D7,WkDfVxT1N06D7,WkDfVxT1N07D7,WkDfVxT1N08D7,WkDfVxT1N09D7,WkDfVxT1N10D7, & + WkDfVxT1N11D7,WkDfVxT1N12D7,WkDfVxT1N13D7,WkDfVxT1N14D7,WkDfVxT1N15D7,WkDfVxT1N16D7,WkDfVxT1N17D7,WkDfVxT1N18D7,WkDfVxT1N19D7,WkDfVxT1N20D7, & + WkDfVxT1N01D8,WkDfVxT1N02D8,WkDfVxT1N03D8,WkDfVxT1N04D8,WkDfVxT1N05D8,WkDfVxT1N06D8,WkDfVxT1N07D8,WkDfVxT1N08D8,WkDfVxT1N09D8,WkDfVxT1N10D8, & + WkDfVxT1N11D8,WkDfVxT1N12D8,WkDfVxT1N13D8,WkDfVxT1N14D8,WkDfVxT1N15D8,WkDfVxT1N16D8,WkDfVxT1N17D8,WkDfVxT1N18D8,WkDfVxT1N19D8,WkDfVxT1N20D8, & + WkDfVxT1N01D9,WkDfVxT1N02D9,WkDfVxT1N03D9,WkDfVxT1N04D9,WkDfVxT1N05D9,WkDfVxT1N06D9,WkDfVxT1N07D9,WkDfVxT1N08D9,WkDfVxT1N09D9,WkDfVxT1N10D9, & + WkDfVxT1N11D9,WkDfVxT1N12D9,WkDfVxT1N13D9,WkDfVxT1N14D9,WkDfVxT1N15D9,WkDfVxT1N16D9,WkDfVxT1N17D9,WkDfVxT1N18D9,WkDfVxT1N19D9,WkDfVxT1N20D9/), (/20,9/) ) + +WkDfVxTND(:,:,2) = RESHAPE( & + (/WkDfVxT2N01D1,WkDfVxT2N02D1,WkDfVxT2N03D1,WkDfVxT2N04D1,WkDfVxT2N05D1,WkDfVxT2N06D1,WkDfVxT2N07D1,WkDfVxT2N08D1,WkDfVxT2N09D1,WkDfVxT2N10D1, & + WkDfVxT2N11D1,WkDfVxT2N12D1,WkDfVxT2N13D1,WkDfVxT2N14D1,WkDfVxT2N15D1,WkDfVxT2N16D1,WkDfVxT2N17D1,WkDfVxT2N18D1,WkDfVxT2N19D1,WkDfVxT2N20D1, & + WkDfVxT2N01D2,WkDfVxT2N02D2,WkDfVxT2N03D2,WkDfVxT2N04D2,WkDfVxT2N05D2,WkDfVxT2N06D2,WkDfVxT2N07D2,WkDfVxT2N08D2,WkDfVxT2N09D2,WkDfVxT2N10D2, & + WkDfVxT2N11D2,WkDfVxT2N12D2,WkDfVxT2N13D2,WkDfVxT2N14D2,WkDfVxT2N15D2,WkDfVxT2N16D2,WkDfVxT2N17D2,WkDfVxT2N18D2,WkDfVxT2N19D2,WkDfVxT2N20D2, & + WkDfVxT2N01D3,WkDfVxT2N02D3,WkDfVxT2N03D3,WkDfVxT2N04D3,WkDfVxT2N05D3,WkDfVxT2N06D3,WkDfVxT2N07D3,WkDfVxT2N08D3,WkDfVxT2N09D3,WkDfVxT2N10D3, & + WkDfVxT2N11D3,WkDfVxT2N12D3,WkDfVxT2N13D3,WkDfVxT2N14D3,WkDfVxT2N15D3,WkDfVxT2N16D3,WkDfVxT2N17D3,WkDfVxT2N18D3,WkDfVxT2N19D3,WkDfVxT2N20D3, & + WkDfVxT2N01D4,WkDfVxT2N02D4,WkDfVxT2N03D4,WkDfVxT2N04D4,WkDfVxT2N05D4,WkDfVxT2N06D4,WkDfVxT2N07D4,WkDfVxT2N08D4,WkDfVxT2N09D4,WkDfVxT2N10D4, & + WkDfVxT2N11D4,WkDfVxT2N12D4,WkDfVxT2N13D4,WkDfVxT2N14D4,WkDfVxT2N15D4,WkDfVxT2N16D4,WkDfVxT2N17D4,WkDfVxT2N18D4,WkDfVxT2N19D4,WkDfVxT2N20D4, & + WkDfVxT2N01D5,WkDfVxT2N02D5,WkDfVxT2N03D5,WkDfVxT2N04D5,WkDfVxT2N05D5,WkDfVxT2N06D5,WkDfVxT2N07D5,WkDfVxT2N08D5,WkDfVxT2N09D5,WkDfVxT2N10D5, & + WkDfVxT2N11D5,WkDfVxT2N12D5,WkDfVxT2N13D5,WkDfVxT2N14D5,WkDfVxT2N15D5,WkDfVxT2N16D5,WkDfVxT2N17D5,WkDfVxT2N18D5,WkDfVxT2N19D5,WkDfVxT2N20D5, & + WkDfVxT2N01D6,WkDfVxT2N02D6,WkDfVxT2N03D6,WkDfVxT2N04D6,WkDfVxT2N05D6,WkDfVxT2N06D6,WkDfVxT2N07D6,WkDfVxT2N08D6,WkDfVxT2N09D6,WkDfVxT2N10D6, & + WkDfVxT2N11D6,WkDfVxT2N12D6,WkDfVxT2N13D6,WkDfVxT2N14D6,WkDfVxT2N15D6,WkDfVxT2N16D6,WkDfVxT2N17D6,WkDfVxT2N18D6,WkDfVxT2N19D6,WkDfVxT2N20D6, & + WkDfVxT2N01D7,WkDfVxT2N02D7,WkDfVxT2N03D7,WkDfVxT2N04D7,WkDfVxT2N05D7,WkDfVxT2N06D7,WkDfVxT2N07D7,WkDfVxT2N08D7,WkDfVxT2N09D7,WkDfVxT2N10D7, & + WkDfVxT2N11D7,WkDfVxT2N12D7,WkDfVxT2N13D7,WkDfVxT2N14D7,WkDfVxT2N15D7,WkDfVxT2N16D7,WkDfVxT2N17D7,WkDfVxT2N18D7,WkDfVxT2N19D7,WkDfVxT2N20D7, & + WkDfVxT2N01D8,WkDfVxT2N02D8,WkDfVxT2N03D8,WkDfVxT2N04D8,WkDfVxT2N05D8,WkDfVxT2N06D8,WkDfVxT2N07D8,WkDfVxT2N08D8,WkDfVxT2N09D8,WkDfVxT2N10D8, & + WkDfVxT2N11D8,WkDfVxT2N12D8,WkDfVxT2N13D8,WkDfVxT2N14D8,WkDfVxT2N15D8,WkDfVxT2N16D8,WkDfVxT2N17D8,WkDfVxT2N18D8,WkDfVxT2N19D8,WkDfVxT2N20D8, & + WkDfVxT2N01D9,WkDfVxT2N02D9,WkDfVxT2N03D9,WkDfVxT2N04D9,WkDfVxT2N05D9,WkDfVxT2N06D9,WkDfVxT2N07D9,WkDfVxT2N08D9,WkDfVxT2N09D9,WkDfVxT2N10D9, & + WkDfVxT2N11D9,WkDfVxT2N12D9,WkDfVxT2N13D9,WkDfVxT2N14D9,WkDfVxT2N15D9,WkDfVxT2N16D9,WkDfVxT2N17D9,WkDfVxT2N18D9,WkDfVxT2N19D9,WkDfVxT2N20D9/), (/20,9/) ) +WkDfVxTND(:,:,3) = RESHAPE( & + (/WkDfVxT3N01D1,WkDfVxT3N02D1,WkDfVxT3N03D1,WkDfVxT3N04D1,WkDfVxT3N05D1,WkDfVxT3N06D1,WkDfVxT3N07D1,WkDfVxT3N08D1,WkDfVxT3N09D1,WkDfVxT3N10D1, & + WkDfVxT3N11D1,WkDfVxT3N12D1,WkDfVxT3N13D1,WkDfVxT3N14D1,WkDfVxT3N15D1,WkDfVxT3N16D1,WkDfVxT3N17D1,WkDfVxT3N18D1,WkDfVxT3N19D1,WkDfVxT3N20D1, & + WkDfVxT3N01D2,WkDfVxT3N02D2,WkDfVxT3N03D2,WkDfVxT3N04D2,WkDfVxT3N05D2,WkDfVxT3N06D2,WkDfVxT3N07D2,WkDfVxT3N08D2,WkDfVxT3N09D2,WkDfVxT3N10D2, & + WkDfVxT3N11D2,WkDfVxT3N12D2,WkDfVxT3N13D2,WkDfVxT3N14D2,WkDfVxT3N15D2,WkDfVxT3N16D2,WkDfVxT3N17D2,WkDfVxT3N18D2,WkDfVxT3N19D2,WkDfVxT3N20D2, & + WkDfVxT3N01D3,WkDfVxT3N02D3,WkDfVxT3N03D3,WkDfVxT3N04D3,WkDfVxT3N05D3,WkDfVxT3N06D3,WkDfVxT3N07D3,WkDfVxT3N08D3,WkDfVxT3N09D3,WkDfVxT3N10D3, & + WkDfVxT3N11D3,WkDfVxT3N12D3,WkDfVxT3N13D3,WkDfVxT3N14D3,WkDfVxT3N15D3,WkDfVxT3N16D3,WkDfVxT3N17D3,WkDfVxT3N18D3,WkDfVxT3N19D3,WkDfVxT3N20D3, & + WkDfVxT3N01D4,WkDfVxT3N02D4,WkDfVxT3N03D4,WkDfVxT3N04D4,WkDfVxT3N05D4,WkDfVxT3N06D4,WkDfVxT3N07D4,WkDfVxT3N08D4,WkDfVxT3N09D4,WkDfVxT3N10D4, & + WkDfVxT3N11D4,WkDfVxT3N12D4,WkDfVxT3N13D4,WkDfVxT3N14D4,WkDfVxT3N15D4,WkDfVxT3N16D4,WkDfVxT3N17D4,WkDfVxT3N18D4,WkDfVxT3N19D4,WkDfVxT3N20D4, & + WkDfVxT3N01D5,WkDfVxT3N02D5,WkDfVxT3N03D5,WkDfVxT3N04D5,WkDfVxT3N05D5,WkDfVxT3N06D5,WkDfVxT3N07D5,WkDfVxT3N08D5,WkDfVxT3N09D5,WkDfVxT3N10D5, & + WkDfVxT3N11D5,WkDfVxT3N12D5,WkDfVxT3N13D5,WkDfVxT3N14D5,WkDfVxT3N15D5,WkDfVxT3N16D5,WkDfVxT3N17D5,WkDfVxT3N18D5,WkDfVxT3N19D5,WkDfVxT3N20D5, & + WkDfVxT3N01D6,WkDfVxT3N02D6,WkDfVxT3N03D6,WkDfVxT3N04D6,WkDfVxT3N05D6,WkDfVxT3N06D6,WkDfVxT3N07D6,WkDfVxT3N08D6,WkDfVxT3N09D6,WkDfVxT3N10D6, & + WkDfVxT3N11D6,WkDfVxT3N12D6,WkDfVxT3N13D6,WkDfVxT3N14D6,WkDfVxT3N15D6,WkDfVxT3N16D6,WkDfVxT3N17D6,WkDfVxT3N18D6,WkDfVxT3N19D6,WkDfVxT3N20D6, & + WkDfVxT3N01D7,WkDfVxT3N02D7,WkDfVxT3N03D7,WkDfVxT3N04D7,WkDfVxT3N05D7,WkDfVxT3N06D7,WkDfVxT3N07D7,WkDfVxT3N08D7,WkDfVxT3N09D7,WkDfVxT3N10D7, & + WkDfVxT3N11D7,WkDfVxT3N12D7,WkDfVxT3N13D7,WkDfVxT3N14D7,WkDfVxT3N15D7,WkDfVxT3N16D7,WkDfVxT3N17D7,WkDfVxT3N18D7,WkDfVxT3N19D7,WkDfVxT3N20D7, & + WkDfVxT3N01D8,WkDfVxT3N02D8,WkDfVxT3N03D8,WkDfVxT3N04D8,WkDfVxT3N05D8,WkDfVxT3N06D8,WkDfVxT3N07D8,WkDfVxT3N08D8,WkDfVxT3N09D8,WkDfVxT3N10D8, & + WkDfVxT3N11D8,WkDfVxT3N12D8,WkDfVxT3N13D8,WkDfVxT3N14D8,WkDfVxT3N15D8,WkDfVxT3N16D8,WkDfVxT3N17D8,WkDfVxT3N18D8,WkDfVxT3N19D8,WkDfVxT3N20D8, & + WkDfVxT3N01D9,WkDfVxT3N02D9,WkDfVxT3N03D9,WkDfVxT3N04D9,WkDfVxT3N05D9,WkDfVxT3N06D9,WkDfVxT3N07D9,WkDfVxT3N08D9,WkDfVxT3N09D9,WkDfVxT3N10D9, & + WkDfVxT3N11D9,WkDfVxT3N12D9,WkDfVxT3N13D9,WkDfVxT3N14D9,WkDfVxT3N15D9,WkDfVxT3N16D9,WkDfVxT3N17D9,WkDfVxT3N18D9,WkDfVxT3N19D9,WkDfVxT3N20D9/), (/20,9/) ) +WkDfVxTND(:,:,4) = RESHAPE( & + (/WkDfVxT4N01D1,WkDfVxT4N02D1,WkDfVxT4N03D1,WkDfVxT4N04D1,WkDfVxT4N05D1,WkDfVxT4N06D1,WkDfVxT4N07D1,WkDfVxT4N08D1,WkDfVxT4N09D1,WkDfVxT4N10D1, & + WkDfVxT4N11D1,WkDfVxT4N12D1,WkDfVxT4N13D1,WkDfVxT4N14D1,WkDfVxT4N15D1,WkDfVxT4N16D1,WkDfVxT4N17D1,WkDfVxT4N18D1,WkDfVxT4N19D1,WkDfVxT4N20D1, & + WkDfVxT4N01D2,WkDfVxT4N02D2,WkDfVxT4N03D2,WkDfVxT4N04D2,WkDfVxT4N05D2,WkDfVxT4N06D2,WkDfVxT4N07D2,WkDfVxT4N08D2,WkDfVxT4N09D2,WkDfVxT4N10D2, & + WkDfVxT4N11D2,WkDfVxT4N12D2,WkDfVxT4N13D2,WkDfVxT4N14D2,WkDfVxT4N15D2,WkDfVxT4N16D2,WkDfVxT4N17D2,WkDfVxT4N18D2,WkDfVxT4N19D2,WkDfVxT4N20D2, & + WkDfVxT4N01D3,WkDfVxT4N02D3,WkDfVxT4N03D3,WkDfVxT4N04D3,WkDfVxT4N05D3,WkDfVxT4N06D3,WkDfVxT4N07D3,WkDfVxT4N08D3,WkDfVxT4N09D3,WkDfVxT4N10D3, & + WkDfVxT4N11D3,WkDfVxT4N12D3,WkDfVxT4N13D3,WkDfVxT4N14D3,WkDfVxT4N15D3,WkDfVxT4N16D3,WkDfVxT4N17D3,WkDfVxT4N18D3,WkDfVxT4N19D3,WkDfVxT4N20D3, & + WkDfVxT4N01D4,WkDfVxT4N02D4,WkDfVxT4N03D4,WkDfVxT4N04D4,WkDfVxT4N05D4,WkDfVxT4N06D4,WkDfVxT4N07D4,WkDfVxT4N08D4,WkDfVxT4N09D4,WkDfVxT4N10D4, & + WkDfVxT4N11D4,WkDfVxT4N12D4,WkDfVxT4N13D4,WkDfVxT4N14D4,WkDfVxT4N15D4,WkDfVxT4N16D4,WkDfVxT4N17D4,WkDfVxT4N18D4,WkDfVxT4N19D4,WkDfVxT4N20D4, & + WkDfVxT4N01D5,WkDfVxT4N02D5,WkDfVxT4N03D5,WkDfVxT4N04D5,WkDfVxT4N05D5,WkDfVxT4N06D5,WkDfVxT4N07D5,WkDfVxT4N08D5,WkDfVxT4N09D5,WkDfVxT4N10D5, & + WkDfVxT4N11D5,WkDfVxT4N12D5,WkDfVxT4N13D5,WkDfVxT4N14D5,WkDfVxT4N15D5,WkDfVxT4N16D5,WkDfVxT4N17D5,WkDfVxT4N18D5,WkDfVxT4N19D5,WkDfVxT4N20D5, & + WkDfVxT4N01D6,WkDfVxT4N02D6,WkDfVxT4N03D6,WkDfVxT4N04D6,WkDfVxT4N05D6,WkDfVxT4N06D6,WkDfVxT4N07D6,WkDfVxT4N08D6,WkDfVxT4N09D6,WkDfVxT4N10D6, & + WkDfVxT4N11D6,WkDfVxT4N12D6,WkDfVxT4N13D6,WkDfVxT4N14D6,WkDfVxT4N15D6,WkDfVxT4N16D6,WkDfVxT4N17D6,WkDfVxT4N18D6,WkDfVxT4N19D6,WkDfVxT4N20D6, & + WkDfVxT4N01D7,WkDfVxT4N02D7,WkDfVxT4N03D7,WkDfVxT4N04D7,WkDfVxT4N05D7,WkDfVxT4N06D7,WkDfVxT4N07D7,WkDfVxT4N08D7,WkDfVxT4N09D7,WkDfVxT4N10D7, & + WkDfVxT4N11D7,WkDfVxT4N12D7,WkDfVxT4N13D7,WkDfVxT4N14D7,WkDfVxT4N15D7,WkDfVxT4N16D7,WkDfVxT4N17D7,WkDfVxT4N18D7,WkDfVxT4N19D7,WkDfVxT4N20D7, & + WkDfVxT4N01D8,WkDfVxT4N02D8,WkDfVxT4N03D8,WkDfVxT4N04D8,WkDfVxT4N05D8,WkDfVxT4N06D8,WkDfVxT4N07D8,WkDfVxT4N08D8,WkDfVxT4N09D8,WkDfVxT4N10D8, & + WkDfVxT4N11D8,WkDfVxT4N12D8,WkDfVxT4N13D8,WkDfVxT4N14D8,WkDfVxT4N15D8,WkDfVxT4N16D8,WkDfVxT4N17D8,WkDfVxT4N18D8,WkDfVxT4N19D8,WkDfVxT4N20D8, & + WkDfVxT4N01D9,WkDfVxT4N02D9,WkDfVxT4N03D9,WkDfVxT4N04D9,WkDfVxT4N05D9,WkDfVxT4N06D9,WkDfVxT4N07D9,WkDfVxT4N08D9,WkDfVxT4N09D9,WkDfVxT4N10D9, & + WkDfVxT4N11D9,WkDfVxT4N12D9,WkDfVxT4N13D9,WkDfVxT4N14D9,WkDfVxT4N15D9,WkDfVxT4N16D9,WkDfVxT4N17D9,WkDfVxT4N18D9,WkDfVxT4N19D9,WkDfVxT4N20D9/), (/20,9/) ) + +WkDfVxTND(:,:,5) = RESHAPE( & + (/WkDfVxT5N01D1,WkDfVxT5N02D1,WkDfVxT5N03D1,WkDfVxT5N04D1,WkDfVxT5N05D1,WkDfVxT5N06D1,WkDfVxT5N07D1,WkDfVxT5N08D1,WkDfVxT5N09D1,WkDfVxT5N10D1, & + WkDfVxT5N11D1,WkDfVxT5N12D1,WkDfVxT5N13D1,WkDfVxT5N14D1,WkDfVxT5N15D1,WkDfVxT5N16D1,WkDfVxT5N17D1,WkDfVxT5N18D1,WkDfVxT5N19D1,WkDfVxT5N20D1, & + WkDfVxT5N01D2,WkDfVxT5N02D2,WkDfVxT5N03D2,WkDfVxT5N04D2,WkDfVxT5N05D2,WkDfVxT5N06D2,WkDfVxT5N07D2,WkDfVxT5N08D2,WkDfVxT5N09D2,WkDfVxT5N10D2, & + WkDfVxT5N11D2,WkDfVxT5N12D2,WkDfVxT5N13D2,WkDfVxT5N14D2,WkDfVxT5N15D2,WkDfVxT5N16D2,WkDfVxT5N17D2,WkDfVxT5N18D2,WkDfVxT5N19D2,WkDfVxT5N20D2, & + WkDfVxT5N01D3,WkDfVxT5N02D3,WkDfVxT5N03D3,WkDfVxT5N04D3,WkDfVxT5N05D3,WkDfVxT5N06D3,WkDfVxT5N07D3,WkDfVxT5N08D3,WkDfVxT5N09D3,WkDfVxT5N10D3, & + WkDfVxT5N11D3,WkDfVxT5N12D3,WkDfVxT5N13D3,WkDfVxT5N14D3,WkDfVxT5N15D3,WkDfVxT5N16D3,WkDfVxT5N17D3,WkDfVxT5N18D3,WkDfVxT5N19D3,WkDfVxT5N20D3, & + WkDfVxT5N01D4,WkDfVxT5N02D4,WkDfVxT5N03D4,WkDfVxT5N04D4,WkDfVxT5N05D4,WkDfVxT5N06D4,WkDfVxT5N07D4,WkDfVxT5N08D4,WkDfVxT5N09D4,WkDfVxT5N10D4, & + WkDfVxT5N11D4,WkDfVxT5N12D4,WkDfVxT5N13D4,WkDfVxT5N14D4,WkDfVxT5N15D4,WkDfVxT5N16D4,WkDfVxT5N17D4,WkDfVxT5N18D4,WkDfVxT5N19D4,WkDfVxT5N20D4, & + WkDfVxT5N01D5,WkDfVxT5N02D5,WkDfVxT5N03D5,WkDfVxT5N04D5,WkDfVxT5N05D5,WkDfVxT5N06D5,WkDfVxT5N07D5,WkDfVxT5N08D5,WkDfVxT5N09D5,WkDfVxT5N10D5, & + WkDfVxT5N11D5,WkDfVxT5N12D5,WkDfVxT5N13D5,WkDfVxT5N14D5,WkDfVxT5N15D5,WkDfVxT5N16D5,WkDfVxT5N17D5,WkDfVxT5N18D5,WkDfVxT5N19D5,WkDfVxT5N20D5, & + WkDfVxT5N01D6,WkDfVxT5N02D6,WkDfVxT5N03D6,WkDfVxT5N04D6,WkDfVxT5N05D6,WkDfVxT5N06D6,WkDfVxT5N07D6,WkDfVxT5N08D6,WkDfVxT5N09D6,WkDfVxT5N10D6, & + WkDfVxT5N11D6,WkDfVxT5N12D6,WkDfVxT5N13D6,WkDfVxT5N14D6,WkDfVxT5N15D6,WkDfVxT5N16D6,WkDfVxT5N17D6,WkDfVxT5N18D6,WkDfVxT5N19D6,WkDfVxT5N20D6, & + WkDfVxT5N01D7,WkDfVxT5N02D7,WkDfVxT5N03D7,WkDfVxT5N04D7,WkDfVxT5N05D7,WkDfVxT5N06D7,WkDfVxT5N07D7,WkDfVxT5N08D7,WkDfVxT5N09D7,WkDfVxT5N10D7, & + WkDfVxT5N11D7,WkDfVxT5N12D7,WkDfVxT5N13D7,WkDfVxT5N14D7,WkDfVxT5N15D7,WkDfVxT5N16D7,WkDfVxT5N17D7,WkDfVxT5N18D7,WkDfVxT5N19D7,WkDfVxT5N20D7, & + WkDfVxT5N01D8,WkDfVxT5N02D8,WkDfVxT5N03D8,WkDfVxT5N04D8,WkDfVxT5N05D8,WkDfVxT5N06D8,WkDfVxT5N07D8,WkDfVxT5N08D8,WkDfVxT5N09D8,WkDfVxT5N10D8, & + WkDfVxT5N11D8,WkDfVxT5N12D8,WkDfVxT5N13D8,WkDfVxT5N14D8,WkDfVxT5N15D8,WkDfVxT5N16D8,WkDfVxT5N17D8,WkDfVxT5N18D8,WkDfVxT5N19D8,WkDfVxT5N20D8, & + WkDfVxT5N01D9,WkDfVxT5N02D9,WkDfVxT5N03D9,WkDfVxT5N04D9,WkDfVxT5N05D9,WkDfVxT5N06D9,WkDfVxT5N07D9,WkDfVxT5N08D9,WkDfVxT5N09D9,WkDfVxT5N10D9, & + WkDfVxT5N11D9,WkDfVxT5N12D9,WkDfVxT5N13D9,WkDfVxT5N14D9,WkDfVxT5N15D9,WkDfVxT5N16D9,WkDfVxT5N17D9,WkDfVxT5N18D9,WkDfVxT5N19D9,WkDfVxT5N20D9/), (/20,9/) ) +WkDfVxTND(:,:,6) = RESHAPE( & + (/WkDfVxT6N01D1,WkDfVxT6N02D1,WkDfVxT6N03D1,WkDfVxT6N04D1,WkDfVxT6N05D1,WkDfVxT6N06D1,WkDfVxT6N07D1,WkDfVxT6N08D1,WkDfVxT6N09D1,WkDfVxT6N10D1, & + WkDfVxT6N11D1,WkDfVxT6N12D1,WkDfVxT6N13D1,WkDfVxT6N14D1,WkDfVxT6N15D1,WkDfVxT6N16D1,WkDfVxT6N17D1,WkDfVxT6N18D1,WkDfVxT6N19D1,WkDfVxT6N20D1, & + WkDfVxT6N01D2,WkDfVxT6N02D2,WkDfVxT6N03D2,WkDfVxT6N04D2,WkDfVxT6N05D2,WkDfVxT6N06D2,WkDfVxT6N07D2,WkDfVxT6N08D2,WkDfVxT6N09D2,WkDfVxT6N10D2, & + WkDfVxT6N11D2,WkDfVxT6N12D2,WkDfVxT6N13D2,WkDfVxT6N14D2,WkDfVxT6N15D2,WkDfVxT6N16D2,WkDfVxT6N17D2,WkDfVxT6N18D2,WkDfVxT6N19D2,WkDfVxT6N20D2, & + WkDfVxT6N01D3,WkDfVxT6N02D3,WkDfVxT6N03D3,WkDfVxT6N04D3,WkDfVxT6N05D3,WkDfVxT6N06D3,WkDfVxT6N07D3,WkDfVxT6N08D3,WkDfVxT6N09D3,WkDfVxT6N10D3, & + WkDfVxT6N11D3,WkDfVxT6N12D3,WkDfVxT6N13D3,WkDfVxT6N14D3,WkDfVxT6N15D3,WkDfVxT6N16D3,WkDfVxT6N17D3,WkDfVxT6N18D3,WkDfVxT6N19D3,WkDfVxT6N20D3, & + WkDfVxT6N01D4,WkDfVxT6N02D4,WkDfVxT6N03D4,WkDfVxT6N04D4,WkDfVxT6N05D4,WkDfVxT6N06D4,WkDfVxT6N07D4,WkDfVxT6N08D4,WkDfVxT6N09D4,WkDfVxT6N10D4, & + WkDfVxT6N11D4,WkDfVxT6N12D4,WkDfVxT6N13D4,WkDfVxT6N14D4,WkDfVxT6N15D4,WkDfVxT6N16D4,WkDfVxT6N17D4,WkDfVxT6N18D4,WkDfVxT6N19D4,WkDfVxT6N20D4, & + WkDfVxT6N01D5,WkDfVxT6N02D5,WkDfVxT6N03D5,WkDfVxT6N04D5,WkDfVxT6N05D5,WkDfVxT6N06D5,WkDfVxT6N07D5,WkDfVxT6N08D5,WkDfVxT6N09D5,WkDfVxT6N10D5, & + WkDfVxT6N11D5,WkDfVxT6N12D5,WkDfVxT6N13D5,WkDfVxT6N14D5,WkDfVxT6N15D5,WkDfVxT6N16D5,WkDfVxT6N17D5,WkDfVxT6N18D5,WkDfVxT6N19D5,WkDfVxT6N20D5, & + WkDfVxT6N01D6,WkDfVxT6N02D6,WkDfVxT6N03D6,WkDfVxT6N04D6,WkDfVxT6N05D6,WkDfVxT6N06D6,WkDfVxT6N07D6,WkDfVxT6N08D6,WkDfVxT6N09D6,WkDfVxT6N10D6, & + WkDfVxT6N11D6,WkDfVxT6N12D6,WkDfVxT6N13D6,WkDfVxT6N14D6,WkDfVxT6N15D6,WkDfVxT6N16D6,WkDfVxT6N17D6,WkDfVxT6N18D6,WkDfVxT6N19D6,WkDfVxT6N20D6, & + WkDfVxT6N01D7,WkDfVxT6N02D7,WkDfVxT6N03D7,WkDfVxT6N04D7,WkDfVxT6N05D7,WkDfVxT6N06D7,WkDfVxT6N07D7,WkDfVxT6N08D7,WkDfVxT6N09D7,WkDfVxT6N10D7, & + WkDfVxT6N11D7,WkDfVxT6N12D7,WkDfVxT6N13D7,WkDfVxT6N14D7,WkDfVxT6N15D7,WkDfVxT6N16D7,WkDfVxT6N17D7,WkDfVxT6N18D7,WkDfVxT6N19D7,WkDfVxT6N20D7, & + WkDfVxT6N01D8,WkDfVxT6N02D8,WkDfVxT6N03D8,WkDfVxT6N04D8,WkDfVxT6N05D8,WkDfVxT6N06D8,WkDfVxT6N07D8,WkDfVxT6N08D8,WkDfVxT6N09D8,WkDfVxT6N10D8, & + WkDfVxT6N11D8,WkDfVxT6N12D8,WkDfVxT6N13D8,WkDfVxT6N14D8,WkDfVxT6N15D8,WkDfVxT6N16D8,WkDfVxT6N17D8,WkDfVxT6N18D8,WkDfVxT6N19D8,WkDfVxT6N20D8, & + WkDfVxT6N01D9,WkDfVxT6N02D9,WkDfVxT6N03D9,WkDfVxT6N04D9,WkDfVxT6N05D9,WkDfVxT6N06D9,WkDfVxT6N07D9,WkDfVxT6N08D9,WkDfVxT6N09D9,WkDfVxT6N10D9, & + WkDfVxT6N11D9,WkDfVxT6N12D9,WkDfVxT6N13D9,WkDfVxT6N14D9,WkDfVxT6N15D9,WkDfVxT6N16D9,WkDfVxT6N17D9,WkDfVxT6N18D9,WkDfVxT6N19D9,WkDfVxT6N20D9/), (/20,9/) ) +WkDfVxTND(:,:,7) = RESHAPE( & + (/WkDfVxT7N01D1,WkDfVxT7N02D1,WkDfVxT7N03D1,WkDfVxT7N04D1,WkDfVxT7N05D1,WkDfVxT7N06D1,WkDfVxT7N07D1,WkDfVxT7N08D1,WkDfVxT7N09D1,WkDfVxT7N10D1, & + WkDfVxT7N11D1,WkDfVxT7N12D1,WkDfVxT7N13D1,WkDfVxT7N14D1,WkDfVxT7N15D1,WkDfVxT7N16D1,WkDfVxT7N17D1,WkDfVxT7N18D1,WkDfVxT7N19D1,WkDfVxT7N20D1, & + WkDfVxT7N01D2,WkDfVxT7N02D2,WkDfVxT7N03D2,WkDfVxT7N04D2,WkDfVxT7N05D2,WkDfVxT7N06D2,WkDfVxT7N07D2,WkDfVxT7N08D2,WkDfVxT7N09D2,WkDfVxT7N10D2, & + WkDfVxT7N11D2,WkDfVxT7N12D2,WkDfVxT7N13D2,WkDfVxT7N14D2,WkDfVxT7N15D2,WkDfVxT7N16D2,WkDfVxT7N17D2,WkDfVxT7N18D2,WkDfVxT7N19D2,WkDfVxT7N20D2, & + WkDfVxT7N01D3,WkDfVxT7N02D3,WkDfVxT7N03D3,WkDfVxT7N04D3,WkDfVxT7N05D3,WkDfVxT7N06D3,WkDfVxT7N07D3,WkDfVxT7N08D3,WkDfVxT7N09D3,WkDfVxT7N10D3, & + WkDfVxT7N11D3,WkDfVxT7N12D3,WkDfVxT7N13D3,WkDfVxT7N14D3,WkDfVxT7N15D3,WkDfVxT7N16D3,WkDfVxT7N17D3,WkDfVxT7N18D3,WkDfVxT7N19D3,WkDfVxT7N20D3, & + WkDfVxT7N01D4,WkDfVxT7N02D4,WkDfVxT7N03D4,WkDfVxT7N04D4,WkDfVxT7N05D4,WkDfVxT7N06D4,WkDfVxT7N07D4,WkDfVxT7N08D4,WkDfVxT7N09D4,WkDfVxT7N10D4, & + WkDfVxT7N11D4,WkDfVxT7N12D4,WkDfVxT7N13D4,WkDfVxT7N14D4,WkDfVxT7N15D4,WkDfVxT7N16D4,WkDfVxT7N17D4,WkDfVxT7N18D4,WkDfVxT7N19D4,WkDfVxT7N20D4, & + WkDfVxT7N01D5,WkDfVxT7N02D5,WkDfVxT7N03D5,WkDfVxT7N04D5,WkDfVxT7N05D5,WkDfVxT7N06D5,WkDfVxT7N07D5,WkDfVxT7N08D5,WkDfVxT7N09D5,WkDfVxT7N10D5, & + WkDfVxT7N11D5,WkDfVxT7N12D5,WkDfVxT7N13D5,WkDfVxT7N14D5,WkDfVxT7N15D5,WkDfVxT7N16D5,WkDfVxT7N17D5,WkDfVxT7N18D5,WkDfVxT7N19D5,WkDfVxT7N20D5, & + WkDfVxT7N01D6,WkDfVxT7N02D6,WkDfVxT7N03D6,WkDfVxT7N04D6,WkDfVxT7N05D6,WkDfVxT7N06D6,WkDfVxT7N07D6,WkDfVxT7N08D6,WkDfVxT7N09D6,WkDfVxT7N10D6, & + WkDfVxT7N11D6,WkDfVxT7N12D6,WkDfVxT7N13D6,WkDfVxT7N14D6,WkDfVxT7N15D6,WkDfVxT7N16D6,WkDfVxT7N17D6,WkDfVxT7N18D6,WkDfVxT7N19D6,WkDfVxT7N20D6, & + WkDfVxT7N01D7,WkDfVxT7N02D7,WkDfVxT7N03D7,WkDfVxT7N04D7,WkDfVxT7N05D7,WkDfVxT7N06D7,WkDfVxT7N07D7,WkDfVxT7N08D7,WkDfVxT7N09D7,WkDfVxT7N10D7, & + WkDfVxT7N11D7,WkDfVxT7N12D7,WkDfVxT7N13D7,WkDfVxT7N14D7,WkDfVxT7N15D7,WkDfVxT7N16D7,WkDfVxT7N17D7,WkDfVxT7N18D7,WkDfVxT7N19D7,WkDfVxT7N20D7, & + WkDfVxT7N01D8,WkDfVxT7N02D8,WkDfVxT7N03D8,WkDfVxT7N04D8,WkDfVxT7N05D8,WkDfVxT7N06D8,WkDfVxT7N07D8,WkDfVxT7N08D8,WkDfVxT7N09D8,WkDfVxT7N10D8, & + WkDfVxT7N11D8,WkDfVxT7N12D8,WkDfVxT7N13D8,WkDfVxT7N14D8,WkDfVxT7N15D8,WkDfVxT7N16D8,WkDfVxT7N17D8,WkDfVxT7N18D8,WkDfVxT7N19D8,WkDfVxT7N20D8, & + WkDfVxT7N01D9,WkDfVxT7N02D9,WkDfVxT7N03D9,WkDfVxT7N04D9,WkDfVxT7N05D9,WkDfVxT7N06D9,WkDfVxT7N07D9,WkDfVxT7N08D9,WkDfVxT7N09D9,WkDfVxT7N10D9, & + WkDfVxT7N11D9,WkDfVxT7N12D9,WkDfVxT7N13D9,WkDfVxT7N14D9,WkDfVxT7N15D9,WkDfVxT7N16D9,WkDfVxT7N17D9,WkDfVxT7N18D9,WkDfVxT7N19D9,WkDfVxT7N20D9/), (/20,9/) ) +WkDfVxTND(:,:,8) = RESHAPE( & + (/WkDfVxT8N01D1,WkDfVxT8N02D1,WkDfVxT8N03D1,WkDfVxT8N04D1,WkDfVxT8N05D1,WkDfVxT8N06D1,WkDfVxT8N07D1,WkDfVxT8N08D1,WkDfVxT8N09D1,WkDfVxT8N10D1, & + WkDfVxT8N11D1,WkDfVxT8N12D1,WkDfVxT8N13D1,WkDfVxT8N14D1,WkDfVxT8N15D1,WkDfVxT8N16D1,WkDfVxT8N17D1,WkDfVxT8N18D1,WkDfVxT8N19D1,WkDfVxT8N20D1, & + WkDfVxT8N01D2,WkDfVxT8N02D2,WkDfVxT8N03D2,WkDfVxT8N04D2,WkDfVxT8N05D2,WkDfVxT8N06D2,WkDfVxT8N07D2,WkDfVxT8N08D2,WkDfVxT8N09D2,WkDfVxT8N10D2, & + WkDfVxT8N11D2,WkDfVxT8N12D2,WkDfVxT8N13D2,WkDfVxT8N14D2,WkDfVxT8N15D2,WkDfVxT8N16D2,WkDfVxT8N17D2,WkDfVxT8N18D2,WkDfVxT8N19D2,WkDfVxT8N20D2, & + WkDfVxT8N01D3,WkDfVxT8N02D3,WkDfVxT8N03D3,WkDfVxT8N04D3,WkDfVxT8N05D3,WkDfVxT8N06D3,WkDfVxT8N07D3,WkDfVxT8N08D3,WkDfVxT8N09D3,WkDfVxT8N10D3, & + WkDfVxT8N11D3,WkDfVxT8N12D3,WkDfVxT8N13D3,WkDfVxT8N14D3,WkDfVxT8N15D3,WkDfVxT8N16D3,WkDfVxT8N17D3,WkDfVxT8N18D3,WkDfVxT8N19D3,WkDfVxT8N20D3, & + WkDfVxT8N01D4,WkDfVxT8N02D4,WkDfVxT8N03D4,WkDfVxT8N04D4,WkDfVxT8N05D4,WkDfVxT8N06D4,WkDfVxT8N07D4,WkDfVxT8N08D4,WkDfVxT8N09D4,WkDfVxT8N10D4, & + WkDfVxT8N11D4,WkDfVxT8N12D4,WkDfVxT8N13D4,WkDfVxT8N14D4,WkDfVxT8N15D4,WkDfVxT8N16D4,WkDfVxT8N17D4,WkDfVxT8N18D4,WkDfVxT8N19D4,WkDfVxT8N20D4, & + WkDfVxT8N01D5,WkDfVxT8N02D5,WkDfVxT8N03D5,WkDfVxT8N04D5,WkDfVxT8N05D5,WkDfVxT8N06D5,WkDfVxT8N07D5,WkDfVxT8N08D5,WkDfVxT8N09D5,WkDfVxT8N10D5, & + WkDfVxT8N11D5,WkDfVxT8N12D5,WkDfVxT8N13D5,WkDfVxT8N14D5,WkDfVxT8N15D5,WkDfVxT8N16D5,WkDfVxT8N17D5,WkDfVxT8N18D5,WkDfVxT8N19D5,WkDfVxT8N20D5, & + WkDfVxT8N01D6,WkDfVxT8N02D6,WkDfVxT8N03D6,WkDfVxT8N04D6,WkDfVxT8N05D6,WkDfVxT8N06D6,WkDfVxT8N07D6,WkDfVxT8N08D6,WkDfVxT8N09D6,WkDfVxT8N10D6, & + WkDfVxT8N11D6,WkDfVxT8N12D6,WkDfVxT8N13D6,WkDfVxT8N14D6,WkDfVxT8N15D6,WkDfVxT8N16D6,WkDfVxT8N17D6,WkDfVxT8N18D6,WkDfVxT8N19D6,WkDfVxT8N20D6, & + WkDfVxT8N01D7,WkDfVxT8N02D7,WkDfVxT8N03D7,WkDfVxT8N04D7,WkDfVxT8N05D7,WkDfVxT8N06D7,WkDfVxT8N07D7,WkDfVxT8N08D7,WkDfVxT8N09D7,WkDfVxT8N10D7, & + WkDfVxT8N11D7,WkDfVxT8N12D7,WkDfVxT8N13D7,WkDfVxT8N14D7,WkDfVxT8N15D7,WkDfVxT8N16D7,WkDfVxT8N17D7,WkDfVxT8N18D7,WkDfVxT8N19D7,WkDfVxT8N20D7, & + WkDfVxT8N01D8,WkDfVxT8N02D8,WkDfVxT8N03D8,WkDfVxT8N04D8,WkDfVxT8N05D8,WkDfVxT8N06D8,WkDfVxT8N07D8,WkDfVxT8N08D8,WkDfVxT8N09D8,WkDfVxT8N10D8, & + WkDfVxT8N11D8,WkDfVxT8N12D8,WkDfVxT8N13D8,WkDfVxT8N14D8,WkDfVxT8N15D8,WkDfVxT8N16D8,WkDfVxT8N17D8,WkDfVxT8N18D8,WkDfVxT8N19D8,WkDfVxT8N20D8, & + WkDfVxT8N01D9,WkDfVxT8N02D9,WkDfVxT8N03D9,WkDfVxT8N04D9,WkDfVxT8N05D9,WkDfVxT8N06D9,WkDfVxT8N07D9,WkDfVxT8N08D9,WkDfVxT8N09D9,WkDfVxT8N10D9, & + WkDfVxT8N11D9,WkDfVxT8N12D9,WkDfVxT8N13D9,WkDfVxT8N14D9,WkDfVxT8N15D9,WkDfVxT8N16D9,WkDfVxT8N17D9,WkDfVxT8N18D9,WkDfVxT8N19D9,WkDfVxT8N20D9/), (/20,9/) ) + +WkDfVxTND(:,:,9) = RESHAPE( & + (/WkDfVxT9N01D1,WkDfVxT9N02D1,WkDfVxT9N03D1,WkDfVxT9N04D1,WkDfVxT9N05D1,WkDfVxT9N06D1,WkDfVxT9N07D1,WkDfVxT9N08D1,WkDfVxT9N09D1,WkDfVxT9N10D1, & + WkDfVxT9N11D1,WkDfVxT9N12D1,WkDfVxT9N13D1,WkDfVxT9N14D1,WkDfVxT9N15D1,WkDfVxT9N16D1,WkDfVxT9N17D1,WkDfVxT9N18D1,WkDfVxT9N19D1,WkDfVxT9N20D1, & + WkDfVxT9N01D2,WkDfVxT9N02D2,WkDfVxT9N03D2,WkDfVxT9N04D2,WkDfVxT9N05D2,WkDfVxT9N06D2,WkDfVxT9N07D2,WkDfVxT9N08D2,WkDfVxT9N09D2,WkDfVxT9N10D2, & + WkDfVxT9N11D2,WkDfVxT9N12D2,WkDfVxT9N13D2,WkDfVxT9N14D2,WkDfVxT9N15D2,WkDfVxT9N16D2,WkDfVxT9N17D2,WkDfVxT9N18D2,WkDfVxT9N19D2,WkDfVxT9N20D2, & + WkDfVxT9N01D3,WkDfVxT9N02D3,WkDfVxT9N03D3,WkDfVxT9N04D3,WkDfVxT9N05D3,WkDfVxT9N06D3,WkDfVxT9N07D3,WkDfVxT9N08D3,WkDfVxT9N09D3,WkDfVxT9N10D3, & + WkDfVxT9N11D3,WkDfVxT9N12D3,WkDfVxT9N13D3,WkDfVxT9N14D3,WkDfVxT9N15D3,WkDfVxT9N16D3,WkDfVxT9N17D3,WkDfVxT9N18D3,WkDfVxT9N19D3,WkDfVxT9N20D3, & + WkDfVxT9N01D4,WkDfVxT9N02D4,WkDfVxT9N03D4,WkDfVxT9N04D4,WkDfVxT9N05D4,WkDfVxT9N06D4,WkDfVxT9N07D4,WkDfVxT9N08D4,WkDfVxT9N09D4,WkDfVxT9N10D4, & + WkDfVxT9N11D4,WkDfVxT9N12D4,WkDfVxT9N13D4,WkDfVxT9N14D4,WkDfVxT9N15D4,WkDfVxT9N16D4,WkDfVxT9N17D4,WkDfVxT9N18D4,WkDfVxT9N19D4,WkDfVxT9N20D4, & + WkDfVxT9N01D5,WkDfVxT9N02D5,WkDfVxT9N03D5,WkDfVxT9N04D5,WkDfVxT9N05D5,WkDfVxT9N06D5,WkDfVxT9N07D5,WkDfVxT9N08D5,WkDfVxT9N09D5,WkDfVxT9N10D5, & + WkDfVxT9N11D5,WkDfVxT9N12D5,WkDfVxT9N13D5,WkDfVxT9N14D5,WkDfVxT9N15D5,WkDfVxT9N16D5,WkDfVxT9N17D5,WkDfVxT9N18D5,WkDfVxT9N19D5,WkDfVxT9N20D5, & + WkDfVxT9N01D6,WkDfVxT9N02D6,WkDfVxT9N03D6,WkDfVxT9N04D6,WkDfVxT9N05D6,WkDfVxT9N06D6,WkDfVxT9N07D6,WkDfVxT9N08D6,WkDfVxT9N09D6,WkDfVxT9N10D6, & + WkDfVxT9N11D6,WkDfVxT9N12D6,WkDfVxT9N13D6,WkDfVxT9N14D6,WkDfVxT9N15D6,WkDfVxT9N16D6,WkDfVxT9N17D6,WkDfVxT9N18D6,WkDfVxT9N19D6,WkDfVxT9N20D6, & + WkDfVxT9N01D7,WkDfVxT9N02D7,WkDfVxT9N03D7,WkDfVxT9N04D7,WkDfVxT9N05D7,WkDfVxT9N06D7,WkDfVxT9N07D7,WkDfVxT9N08D7,WkDfVxT9N09D7,WkDfVxT9N10D7, & + WkDfVxT9N11D7,WkDfVxT9N12D7,WkDfVxT9N13D7,WkDfVxT9N14D7,WkDfVxT9N15D7,WkDfVxT9N16D7,WkDfVxT9N17D7,WkDfVxT9N18D7,WkDfVxT9N19D7,WkDfVxT9N20D7, & + WkDfVxT9N01D8,WkDfVxT9N02D8,WkDfVxT9N03D8,WkDfVxT9N04D8,WkDfVxT9N05D8,WkDfVxT9N06D8,WkDfVxT9N07D8,WkDfVxT9N08D8,WkDfVxT9N09D8,WkDfVxT9N10D8, & + WkDfVxT9N11D8,WkDfVxT9N12D8,WkDfVxT9N13D8,WkDfVxT9N14D8,WkDfVxT9N15D8,WkDfVxT9N16D8,WkDfVxT9N17D8,WkDfVxT9N18D8,WkDfVxT9N19D8,WkDfVxT9N20D8, & + WkDfVxT9N01D9,WkDfVxT9N02D9,WkDfVxT9N03D9,WkDfVxT9N04D9,WkDfVxT9N05D9,WkDfVxT9N06D9,WkDfVxT9N07D9,WkDfVxT9N08D9,WkDfVxT9N09D9,WkDfVxT9N10D9, & + WkDfVxT9N11D9,WkDfVxT9N12D9,WkDfVxT9N13D9,WkDfVxT9N14D9,WkDfVxT9N15D9,WkDfVxT9N16D9,WkDfVxT9N17D9,WkDfVxT9N18D9,WkDfVxT9N19D9,WkDfVxT9N20D9/), (/20,9/) ) + + +WkDfVrTND(:,:,1) = RESHAPE( & + (/WkDfVrT1N01D1,WkDfVrT1N02D1,WkDfVrT1N03D1,WkDfVrT1N04D1,WkDfVrT1N05D1,WkDfVrT1N06D1,WkDfVrT1N07D1,WkDfVrT1N08D1,WkDfVrT1N09D1,WkDfVrT1N10D1, & + WkDfVrT1N11D1,WkDfVrT1N12D1,WkDfVrT1N13D1,WkDfVrT1N14D1,WkDfVrT1N15D1,WkDfVrT1N16D1,WkDfVrT1N17D1,WkDfVrT1N18D1,WkDfVrT1N19D1,WkDfVrT1N20D1, & + WkDfVrT1N01D2,WkDfVrT1N02D2,WkDfVrT1N03D2,WkDfVrT1N04D2,WkDfVrT1N05D2,WkDfVrT1N06D2,WkDfVrT1N07D2,WkDfVrT1N08D2,WkDfVrT1N09D2,WkDfVrT1N10D2, & + WkDfVrT1N11D2,WkDfVrT1N12D2,WkDfVrT1N13D2,WkDfVrT1N14D2,WkDfVrT1N15D2,WkDfVrT1N16D2,WkDfVrT1N17D2,WkDfVrT1N18D2,WkDfVrT1N19D2,WkDfVrT1N20D2, & + WkDfVrT1N01D3,WkDfVrT1N02D3,WkDfVrT1N03D3,WkDfVrT1N04D3,WkDfVrT1N05D3,WkDfVrT1N06D3,WkDfVrT1N07D3,WkDfVrT1N08D3,WkDfVrT1N09D3,WkDfVrT1N10D3, & + WkDfVrT1N11D3,WkDfVrT1N12D3,WkDfVrT1N13D3,WkDfVrT1N14D3,WkDfVrT1N15D3,WkDfVrT1N16D3,WkDfVrT1N17D3,WkDfVrT1N18D3,WkDfVrT1N19D3,WkDfVrT1N20D3, & + WkDfVrT1N01D4,WkDfVrT1N02D4,WkDfVrT1N03D4,WkDfVrT1N04D4,WkDfVrT1N05D4,WkDfVrT1N06D4,WkDfVrT1N07D4,WkDfVrT1N08D4,WkDfVrT1N09D4,WkDfVrT1N10D4, & + WkDfVrT1N11D4,WkDfVrT1N12D4,WkDfVrT1N13D4,WkDfVrT1N14D4,WkDfVrT1N15D4,WkDfVrT1N16D4,WkDfVrT1N17D4,WkDfVrT1N18D4,WkDfVrT1N19D4,WkDfVrT1N20D4, & + WkDfVrT1N01D5,WkDfVrT1N02D5,WkDfVrT1N03D5,WkDfVrT1N04D5,WkDfVrT1N05D5,WkDfVrT1N06D5,WkDfVrT1N07D5,WkDfVrT1N08D5,WkDfVrT1N09D5,WkDfVrT1N10D5, & + WkDfVrT1N11D5,WkDfVrT1N12D5,WkDfVrT1N13D5,WkDfVrT1N14D5,WkDfVrT1N15D5,WkDfVrT1N16D5,WkDfVrT1N17D5,WkDfVrT1N18D5,WkDfVrT1N19D5,WkDfVrT1N20D5, & + WkDfVrT1N01D6,WkDfVrT1N02D6,WkDfVrT1N03D6,WkDfVrT1N04D6,WkDfVrT1N05D6,WkDfVrT1N06D6,WkDfVrT1N07D6,WkDfVrT1N08D6,WkDfVrT1N09D6,WkDfVrT1N10D6, & + WkDfVrT1N11D6,WkDfVrT1N12D6,WkDfVrT1N13D6,WkDfVrT1N14D6,WkDfVrT1N15D6,WkDfVrT1N16D6,WkDfVrT1N17D6,WkDfVrT1N18D6,WkDfVrT1N19D6,WkDfVrT1N20D6, & + WkDfVrT1N01D7,WkDfVrT1N02D7,WkDfVrT1N03D7,WkDfVrT1N04D7,WkDfVrT1N05D7,WkDfVrT1N06D7,WkDfVrT1N07D7,WkDfVrT1N08D7,WkDfVrT1N09D7,WkDfVrT1N10D7, & + WkDfVrT1N11D7,WkDfVrT1N12D7,WkDfVrT1N13D7,WkDfVrT1N14D7,WkDfVrT1N15D7,WkDfVrT1N16D7,WkDfVrT1N17D7,WkDfVrT1N18D7,WkDfVrT1N19D7,WkDfVrT1N20D7, & + WkDfVrT1N01D8,WkDfVrT1N02D8,WkDfVrT1N03D8,WkDfVrT1N04D8,WkDfVrT1N05D8,WkDfVrT1N06D8,WkDfVrT1N07D8,WkDfVrT1N08D8,WkDfVrT1N09D8,WkDfVrT1N10D8, & + WkDfVrT1N11D8,WkDfVrT1N12D8,WkDfVrT1N13D8,WkDfVrT1N14D8,WkDfVrT1N15D8,WkDfVrT1N16D8,WkDfVrT1N17D8,WkDfVrT1N18D8,WkDfVrT1N19D8,WkDfVrT1N20D8, & + WkDfVrT1N01D9,WkDfVrT1N02D9,WkDfVrT1N03D9,WkDfVrT1N04D9,WkDfVrT1N05D9,WkDfVrT1N06D9,WkDfVrT1N07D9,WkDfVrT1N08D9,WkDfVrT1N09D9,WkDfVrT1N10D9, & + WkDfVrT1N11D9,WkDfVrT1N12D9,WkDfVrT1N13D9,WkDfVrT1N14D9,WkDfVrT1N15D9,WkDfVrT1N16D9,WkDfVrT1N17D9,WkDfVrT1N18D9,WkDfVrT1N19D9,WkDfVrT1N20D9/), (/20,9/) ) +WkDfVrTND(:,:,2) = RESHAPE( & + (/WkDfVrT2N01D1,WkDfVrT2N02D1,WkDfVrT2N03D1,WkDfVrT2N04D1,WkDfVrT2N05D1,WkDfVrT2N06D1,WkDfVrT2N07D1,WkDfVrT2N08D1,WkDfVrT2N09D1,WkDfVrT2N10D1, & + WkDfVrT2N11D1,WkDfVrT2N12D1,WkDfVrT2N13D1,WkDfVrT2N14D1,WkDfVrT2N15D1,WkDfVrT2N16D1,WkDfVrT2N17D1,WkDfVrT2N18D1,WkDfVrT2N19D1,WkDfVrT2N20D1, & + WkDfVrT2N01D2,WkDfVrT2N02D2,WkDfVrT2N03D2,WkDfVrT2N04D2,WkDfVrT2N05D2,WkDfVrT2N06D2,WkDfVrT2N07D2,WkDfVrT2N08D2,WkDfVrT2N09D2,WkDfVrT2N10D2, & + WkDfVrT2N11D2,WkDfVrT2N12D2,WkDfVrT2N13D2,WkDfVrT2N14D2,WkDfVrT2N15D2,WkDfVrT2N16D2,WkDfVrT2N17D2,WkDfVrT2N18D2,WkDfVrT2N19D2,WkDfVrT2N20D2, & + WkDfVrT2N01D3,WkDfVrT2N02D3,WkDfVrT2N03D3,WkDfVrT2N04D3,WkDfVrT2N05D3,WkDfVrT2N06D3,WkDfVrT2N07D3,WkDfVrT2N08D3,WkDfVrT2N09D3,WkDfVrT2N10D3, & + WkDfVrT2N11D3,WkDfVrT2N12D3,WkDfVrT2N13D3,WkDfVrT2N14D3,WkDfVrT2N15D3,WkDfVrT2N16D3,WkDfVrT2N17D3,WkDfVrT2N18D3,WkDfVrT2N19D3,WkDfVrT2N20D3, & + WkDfVrT2N01D4,WkDfVrT2N02D4,WkDfVrT2N03D4,WkDfVrT2N04D4,WkDfVrT2N05D4,WkDfVrT2N06D4,WkDfVrT2N07D4,WkDfVrT2N08D4,WkDfVrT2N09D4,WkDfVrT2N10D4, & + WkDfVrT2N11D4,WkDfVrT2N12D4,WkDfVrT2N13D4,WkDfVrT2N14D4,WkDfVrT2N15D4,WkDfVrT2N16D4,WkDfVrT2N17D4,WkDfVrT2N18D4,WkDfVrT2N19D4,WkDfVrT2N20D4, & + WkDfVrT2N01D5,WkDfVrT2N02D5,WkDfVrT2N03D5,WkDfVrT2N04D5,WkDfVrT2N05D5,WkDfVrT2N06D5,WkDfVrT2N07D5,WkDfVrT2N08D5,WkDfVrT2N09D5,WkDfVrT2N10D5, & + WkDfVrT2N11D5,WkDfVrT2N12D5,WkDfVrT2N13D5,WkDfVrT2N14D5,WkDfVrT2N15D5,WkDfVrT2N16D5,WkDfVrT2N17D5,WkDfVrT2N18D5,WkDfVrT2N19D5,WkDfVrT2N20D5, & + WkDfVrT2N01D6,WkDfVrT2N02D6,WkDfVrT2N03D6,WkDfVrT2N04D6,WkDfVrT2N05D6,WkDfVrT2N06D6,WkDfVrT2N07D6,WkDfVrT2N08D6,WkDfVrT2N09D6,WkDfVrT2N10D6, & + WkDfVrT2N11D6,WkDfVrT2N12D6,WkDfVrT2N13D6,WkDfVrT2N14D6,WkDfVrT2N15D6,WkDfVrT2N16D6,WkDfVrT2N17D6,WkDfVrT2N18D6,WkDfVrT2N19D6,WkDfVrT2N20D6, & + WkDfVrT2N01D7,WkDfVrT2N02D7,WkDfVrT2N03D7,WkDfVrT2N04D7,WkDfVrT2N05D7,WkDfVrT2N06D7,WkDfVrT2N07D7,WkDfVrT2N08D7,WkDfVrT2N09D7,WkDfVrT2N10D7, & + WkDfVrT2N11D7,WkDfVrT2N12D7,WkDfVrT2N13D7,WkDfVrT2N14D7,WkDfVrT2N15D7,WkDfVrT2N16D7,WkDfVrT2N17D7,WkDfVrT2N18D7,WkDfVrT2N19D7,WkDfVrT2N20D7, & + WkDfVrT2N01D8,WkDfVrT2N02D8,WkDfVrT2N03D8,WkDfVrT2N04D8,WkDfVrT2N05D8,WkDfVrT2N06D8,WkDfVrT2N07D8,WkDfVrT2N08D8,WkDfVrT2N09D8,WkDfVrT2N10D8, & + WkDfVrT2N11D8,WkDfVrT2N12D8,WkDfVrT2N13D8,WkDfVrT2N14D8,WkDfVrT2N15D8,WkDfVrT2N16D8,WkDfVrT2N17D8,WkDfVrT2N18D8,WkDfVrT2N19D8,WkDfVrT2N20D8, & + WkDfVrT2N01D9,WkDfVrT2N02D9,WkDfVrT2N03D9,WkDfVrT2N04D9,WkDfVrT2N05D9,WkDfVrT2N06D9,WkDfVrT2N07D9,WkDfVrT2N08D9,WkDfVrT2N09D9,WkDfVrT2N10D9, & + WkDfVrT2N11D9,WkDfVrT2N12D9,WkDfVrT2N13D9,WkDfVrT2N14D9,WkDfVrT2N15D9,WkDfVrT2N16D9,WkDfVrT2N17D9,WkDfVrT2N18D9,WkDfVrT2N19D9,WkDfVrT2N20D9/), (/20,9/) ) +WkDfVrTND(:,:,3) = RESHAPE( & + (/WkDfVrT3N01D1,WkDfVrT3N02D1,WkDfVrT3N03D1,WkDfVrT3N04D1,WkDfVrT3N05D1,WkDfVrT3N06D1,WkDfVrT3N07D1,WkDfVrT3N08D1,WkDfVrT3N09D1,WkDfVrT3N10D1, & + WkDfVrT3N11D1,WkDfVrT3N12D1,WkDfVrT3N13D1,WkDfVrT3N14D1,WkDfVrT3N15D1,WkDfVrT3N16D1,WkDfVrT3N17D1,WkDfVrT3N18D1,WkDfVrT3N19D1,WkDfVrT3N20D1, & + WkDfVrT3N01D2,WkDfVrT3N02D2,WkDfVrT3N03D2,WkDfVrT3N04D2,WkDfVrT3N05D2,WkDfVrT3N06D2,WkDfVrT3N07D2,WkDfVrT3N08D2,WkDfVrT3N09D2,WkDfVrT3N10D2, & + WkDfVrT3N11D2,WkDfVrT3N12D2,WkDfVrT3N13D2,WkDfVrT3N14D2,WkDfVrT3N15D2,WkDfVrT3N16D2,WkDfVrT3N17D2,WkDfVrT3N18D2,WkDfVrT3N19D2,WkDfVrT3N20D2, & + WkDfVrT3N01D3,WkDfVrT3N02D3,WkDfVrT3N03D3,WkDfVrT3N04D3,WkDfVrT3N05D3,WkDfVrT3N06D3,WkDfVrT3N07D3,WkDfVrT3N08D3,WkDfVrT3N09D3,WkDfVrT3N10D3, & + WkDfVrT3N11D3,WkDfVrT3N12D3,WkDfVrT3N13D3,WkDfVrT3N14D3,WkDfVrT3N15D3,WkDfVrT3N16D3,WkDfVrT3N17D3,WkDfVrT3N18D3,WkDfVrT3N19D3,WkDfVrT3N20D3, & + WkDfVrT3N01D4,WkDfVrT3N02D4,WkDfVrT3N03D4,WkDfVrT3N04D4,WkDfVrT3N05D4,WkDfVrT3N06D4,WkDfVrT3N07D4,WkDfVrT3N08D4,WkDfVrT3N09D4,WkDfVrT3N10D4, & + WkDfVrT3N11D4,WkDfVrT3N12D4,WkDfVrT3N13D4,WkDfVrT3N14D4,WkDfVrT3N15D4,WkDfVrT3N16D4,WkDfVrT3N17D4,WkDfVrT3N18D4,WkDfVrT3N19D4,WkDfVrT3N20D4, & + WkDfVrT3N01D5,WkDfVrT3N02D5,WkDfVrT3N03D5,WkDfVrT3N04D5,WkDfVrT3N05D5,WkDfVrT3N06D5,WkDfVrT3N07D5,WkDfVrT3N08D5,WkDfVrT3N09D5,WkDfVrT3N10D5, & + WkDfVrT3N11D5,WkDfVrT3N12D5,WkDfVrT3N13D5,WkDfVrT3N14D5,WkDfVrT3N15D5,WkDfVrT3N16D5,WkDfVrT3N17D5,WkDfVrT3N18D5,WkDfVrT3N19D5,WkDfVrT3N20D5, & + WkDfVrT3N01D6,WkDfVrT3N02D6,WkDfVrT3N03D6,WkDfVrT3N04D6,WkDfVrT3N05D6,WkDfVrT3N06D6,WkDfVrT3N07D6,WkDfVrT3N08D6,WkDfVrT3N09D6,WkDfVrT3N10D6, & + WkDfVrT3N11D6,WkDfVrT3N12D6,WkDfVrT3N13D6,WkDfVrT3N14D6,WkDfVrT3N15D6,WkDfVrT3N16D6,WkDfVrT3N17D6,WkDfVrT3N18D6,WkDfVrT3N19D6,WkDfVrT3N20D6, & + WkDfVrT3N01D7,WkDfVrT3N02D7,WkDfVrT3N03D7,WkDfVrT3N04D7,WkDfVrT3N05D7,WkDfVrT3N06D7,WkDfVrT3N07D7,WkDfVrT3N08D7,WkDfVrT3N09D7,WkDfVrT3N10D7, & + WkDfVrT3N11D7,WkDfVrT3N12D7,WkDfVrT3N13D7,WkDfVrT3N14D7,WkDfVrT3N15D7,WkDfVrT3N16D7,WkDfVrT3N17D7,WkDfVrT3N18D7,WkDfVrT3N19D7,WkDfVrT3N20D7, & + WkDfVrT3N01D8,WkDfVrT3N02D8,WkDfVrT3N03D8,WkDfVrT3N04D8,WkDfVrT3N05D8,WkDfVrT3N06D8,WkDfVrT3N07D8,WkDfVrT3N08D8,WkDfVrT3N09D8,WkDfVrT3N10D8, & + WkDfVrT3N11D8,WkDfVrT3N12D8,WkDfVrT3N13D8,WkDfVrT3N14D8,WkDfVrT3N15D8,WkDfVrT3N16D8,WkDfVrT3N17D8,WkDfVrT3N18D8,WkDfVrT3N19D8,WkDfVrT3N20D8, & + WkDfVrT3N01D9,WkDfVrT3N02D9,WkDfVrT3N03D9,WkDfVrT3N04D9,WkDfVrT3N05D9,WkDfVrT3N06D9,WkDfVrT3N07D9,WkDfVrT3N08D9,WkDfVrT3N09D9,WkDfVrT3N10D9, & + WkDfVrT3N11D9,WkDfVrT3N12D9,WkDfVrT3N13D9,WkDfVrT3N14D9,WkDfVrT3N15D9,WkDfVrT3N16D9,WkDfVrT3N17D9,WkDfVrT3N18D9,WkDfVrT3N19D9,WkDfVrT3N20D9/), (/20,9/) ) +WkDfVrTND(:,:,4) = RESHAPE( & + (/WkDfVrT4N01D1,WkDfVrT4N02D1,WkDfVrT4N03D1,WkDfVrT4N04D1,WkDfVrT4N05D1,WkDfVrT4N06D1,WkDfVrT4N07D1,WkDfVrT4N08D1,WkDfVrT4N09D1,WkDfVrT4N10D1, & + WkDfVrT4N11D1,WkDfVrT4N12D1,WkDfVrT4N13D1,WkDfVrT4N14D1,WkDfVrT4N15D1,WkDfVrT4N16D1,WkDfVrT4N17D1,WkDfVrT4N18D1,WkDfVrT4N19D1,WkDfVrT4N20D1, & + WkDfVrT4N01D2,WkDfVrT4N02D2,WkDfVrT4N03D2,WkDfVrT4N04D2,WkDfVrT4N05D2,WkDfVrT4N06D2,WkDfVrT4N07D2,WkDfVrT4N08D2,WkDfVrT4N09D2,WkDfVrT4N10D2, & + WkDfVrT4N11D2,WkDfVrT4N12D2,WkDfVrT4N13D2,WkDfVrT4N14D2,WkDfVrT4N15D2,WkDfVrT4N16D2,WkDfVrT4N17D2,WkDfVrT4N18D2,WkDfVrT4N19D2,WkDfVrT4N20D2, & + WkDfVrT4N01D3,WkDfVrT4N02D3,WkDfVrT4N03D3,WkDfVrT4N04D3,WkDfVrT4N05D3,WkDfVrT4N06D3,WkDfVrT4N07D3,WkDfVrT4N08D3,WkDfVrT4N09D3,WkDfVrT4N10D3, & + WkDfVrT4N11D3,WkDfVrT4N12D3,WkDfVrT4N13D3,WkDfVrT4N14D3,WkDfVrT4N15D3,WkDfVrT4N16D3,WkDfVrT4N17D3,WkDfVrT4N18D3,WkDfVrT4N19D3,WkDfVrT4N20D3, & + WkDfVrT4N01D4,WkDfVrT4N02D4,WkDfVrT4N03D4,WkDfVrT4N04D4,WkDfVrT4N05D4,WkDfVrT4N06D4,WkDfVrT4N07D4,WkDfVrT4N08D4,WkDfVrT4N09D4,WkDfVrT4N10D4, & + WkDfVrT4N11D4,WkDfVrT4N12D4,WkDfVrT4N13D4,WkDfVrT4N14D4,WkDfVrT4N15D4,WkDfVrT4N16D4,WkDfVrT4N17D4,WkDfVrT4N18D4,WkDfVrT4N19D4,WkDfVrT4N20D4, & + WkDfVrT4N01D5,WkDfVrT4N02D5,WkDfVrT4N03D5,WkDfVrT4N04D5,WkDfVrT4N05D5,WkDfVrT4N06D5,WkDfVrT4N07D5,WkDfVrT4N08D5,WkDfVrT4N09D5,WkDfVrT4N10D5, & + WkDfVrT4N11D5,WkDfVrT4N12D5,WkDfVrT4N13D5,WkDfVrT4N14D5,WkDfVrT4N15D5,WkDfVrT4N16D5,WkDfVrT4N17D5,WkDfVrT4N18D5,WkDfVrT4N19D5,WkDfVrT4N20D5, & + WkDfVrT4N01D6,WkDfVrT4N02D6,WkDfVrT4N03D6,WkDfVrT4N04D6,WkDfVrT4N05D6,WkDfVrT4N06D6,WkDfVrT4N07D6,WkDfVrT4N08D6,WkDfVrT4N09D6,WkDfVrT4N10D6, & + WkDfVrT4N11D6,WkDfVrT4N12D6,WkDfVrT4N13D6,WkDfVrT4N14D6,WkDfVrT4N15D6,WkDfVrT4N16D6,WkDfVrT4N17D6,WkDfVrT4N18D6,WkDfVrT4N19D6,WkDfVrT4N20D6, & + WkDfVrT4N01D7,WkDfVrT4N02D7,WkDfVrT4N03D7,WkDfVrT4N04D7,WkDfVrT4N05D7,WkDfVrT4N06D7,WkDfVrT4N07D7,WkDfVrT4N08D7,WkDfVrT4N09D7,WkDfVrT4N10D7, & + WkDfVrT4N11D7,WkDfVrT4N12D7,WkDfVrT4N13D7,WkDfVrT4N14D7,WkDfVrT4N15D7,WkDfVrT4N16D7,WkDfVrT4N17D7,WkDfVrT4N18D7,WkDfVrT4N19D7,WkDfVrT4N20D7, & + WkDfVrT4N01D8,WkDfVrT4N02D8,WkDfVrT4N03D8,WkDfVrT4N04D8,WkDfVrT4N05D8,WkDfVrT4N06D8,WkDfVrT4N07D8,WkDfVrT4N08D8,WkDfVrT4N09D8,WkDfVrT4N10D8, & + WkDfVrT4N11D8,WkDfVrT4N12D8,WkDfVrT4N13D8,WkDfVrT4N14D8,WkDfVrT4N15D8,WkDfVrT4N16D8,WkDfVrT4N17D8,WkDfVrT4N18D8,WkDfVrT4N19D8,WkDfVrT4N20D8, & + WkDfVrT4N01D9,WkDfVrT4N02D9,WkDfVrT4N03D9,WkDfVrT4N04D9,WkDfVrT4N05D9,WkDfVrT4N06D9,WkDfVrT4N07D9,WkDfVrT4N08D9,WkDfVrT4N09D9,WkDfVrT4N10D9, & + WkDfVrT4N11D9,WkDfVrT4N12D9,WkDfVrT4N13D9,WkDfVrT4N14D9,WkDfVrT4N15D9,WkDfVrT4N16D9,WkDfVrT4N17D9,WkDfVrT4N18D9,WkDfVrT4N19D9,WkDfVrT4N20D9/), (/20,9/) ) + +WkDfVrTND(:,:,5) = RESHAPE( & + (/WkDfVrT5N01D1,WkDfVrT5N02D1,WkDfVrT5N03D1,WkDfVrT5N04D1,WkDfVrT5N05D1,WkDfVrT5N06D1,WkDfVrT5N07D1,WkDfVrT5N08D1,WkDfVrT5N09D1,WkDfVrT5N10D1, & + WkDfVrT5N11D1,WkDfVrT5N12D1,WkDfVrT5N13D1,WkDfVrT5N14D1,WkDfVrT5N15D1,WkDfVrT5N16D1,WkDfVrT5N17D1,WkDfVrT5N18D1,WkDfVrT5N19D1,WkDfVrT5N20D1, & + WkDfVrT5N01D2,WkDfVrT5N02D2,WkDfVrT5N03D2,WkDfVrT5N04D2,WkDfVrT5N05D2,WkDfVrT5N06D2,WkDfVrT5N07D2,WkDfVrT5N08D2,WkDfVrT5N09D2,WkDfVrT5N10D2, & + WkDfVrT5N11D2,WkDfVrT5N12D2,WkDfVrT5N13D2,WkDfVrT5N14D2,WkDfVrT5N15D2,WkDfVrT5N16D2,WkDfVrT5N17D2,WkDfVrT5N18D2,WkDfVrT5N19D2,WkDfVrT5N20D2, & + WkDfVrT5N01D3,WkDfVrT5N02D3,WkDfVrT5N03D3,WkDfVrT5N04D3,WkDfVrT5N05D3,WkDfVrT5N06D3,WkDfVrT5N07D3,WkDfVrT5N08D3,WkDfVrT5N09D3,WkDfVrT5N10D3, & + WkDfVrT5N11D3,WkDfVrT5N12D3,WkDfVrT5N13D3,WkDfVrT5N14D3,WkDfVrT5N15D3,WkDfVrT5N16D3,WkDfVrT5N17D3,WkDfVrT5N18D3,WkDfVrT5N19D3,WkDfVrT5N20D3, & + WkDfVrT5N01D4,WkDfVrT5N02D4,WkDfVrT5N03D4,WkDfVrT5N04D4,WkDfVrT5N05D4,WkDfVrT5N06D4,WkDfVrT5N07D4,WkDfVrT5N08D4,WkDfVrT5N09D4,WkDfVrT5N10D4, & + WkDfVrT5N11D4,WkDfVrT5N12D4,WkDfVrT5N13D4,WkDfVrT5N14D4,WkDfVrT5N15D4,WkDfVrT5N16D4,WkDfVrT5N17D4,WkDfVrT5N18D4,WkDfVrT5N19D4,WkDfVrT5N20D4, & + WkDfVrT5N01D5,WkDfVrT5N02D5,WkDfVrT5N03D5,WkDfVrT5N04D5,WkDfVrT5N05D5,WkDfVrT5N06D5,WkDfVrT5N07D5,WkDfVrT5N08D5,WkDfVrT5N09D5,WkDfVrT5N10D5, & + WkDfVrT5N11D5,WkDfVrT5N12D5,WkDfVrT5N13D5,WkDfVrT5N14D5,WkDfVrT5N15D5,WkDfVrT5N16D5,WkDfVrT5N17D5,WkDfVrT5N18D5,WkDfVrT5N19D5,WkDfVrT5N20D5, & + WkDfVrT5N01D6,WkDfVrT5N02D6,WkDfVrT5N03D6,WkDfVrT5N04D6,WkDfVrT5N05D6,WkDfVrT5N06D6,WkDfVrT5N07D6,WkDfVrT5N08D6,WkDfVrT5N09D6,WkDfVrT5N10D6, & + WkDfVrT5N11D6,WkDfVrT5N12D6,WkDfVrT5N13D6,WkDfVrT5N14D6,WkDfVrT5N15D6,WkDfVrT5N16D6,WkDfVrT5N17D6,WkDfVrT5N18D6,WkDfVrT5N19D6,WkDfVrT5N20D6, & + WkDfVrT5N01D7,WkDfVrT5N02D7,WkDfVrT5N03D7,WkDfVrT5N04D7,WkDfVrT5N05D7,WkDfVrT5N06D7,WkDfVrT5N07D7,WkDfVrT5N08D7,WkDfVrT5N09D7,WkDfVrT5N10D7, & + WkDfVrT5N11D7,WkDfVrT5N12D7,WkDfVrT5N13D7,WkDfVrT5N14D7,WkDfVrT5N15D7,WkDfVrT5N16D7,WkDfVrT5N17D7,WkDfVrT5N18D7,WkDfVrT5N19D7,WkDfVrT5N20D7, & + WkDfVrT5N01D8,WkDfVrT5N02D8,WkDfVrT5N03D8,WkDfVrT5N04D8,WkDfVrT5N05D8,WkDfVrT5N06D8,WkDfVrT5N07D8,WkDfVrT5N08D8,WkDfVrT5N09D8,WkDfVrT5N10D8, & + WkDfVrT5N11D8,WkDfVrT5N12D8,WkDfVrT5N13D8,WkDfVrT5N14D8,WkDfVrT5N15D8,WkDfVrT5N16D8,WkDfVrT5N17D8,WkDfVrT5N18D8,WkDfVrT5N19D8,WkDfVrT5N20D8, & + WkDfVrT5N01D9,WkDfVrT5N02D9,WkDfVrT5N03D9,WkDfVrT5N04D9,WkDfVrT5N05D9,WkDfVrT5N06D9,WkDfVrT5N07D9,WkDfVrT5N08D9,WkDfVrT5N09D9,WkDfVrT5N10D9, & + WkDfVrT5N11D9,WkDfVrT5N12D9,WkDfVrT5N13D9,WkDfVrT5N14D9,WkDfVrT5N15D9,WkDfVrT5N16D9,WkDfVrT5N17D9,WkDfVrT5N18D9,WkDfVrT5N19D9,WkDfVrT5N20D9/), (/20,9/) ) +WkDfVrTND(:,:,6) = RESHAPE( & + (/WkDfVrT6N01D1,WkDfVrT6N02D1,WkDfVrT6N03D1,WkDfVrT6N04D1,WkDfVrT6N05D1,WkDfVrT6N06D1,WkDfVrT6N07D1,WkDfVrT6N08D1,WkDfVrT6N09D1,WkDfVrT6N10D1, & + WkDfVrT6N11D1,WkDfVrT6N12D1,WkDfVrT6N13D1,WkDfVrT6N14D1,WkDfVrT6N15D1,WkDfVrT6N16D1,WkDfVrT6N17D1,WkDfVrT6N18D1,WkDfVrT6N19D1,WkDfVrT6N20D1, & + WkDfVrT6N01D2,WkDfVrT6N02D2,WkDfVrT6N03D2,WkDfVrT6N04D2,WkDfVrT6N05D2,WkDfVrT6N06D2,WkDfVrT6N07D2,WkDfVrT6N08D2,WkDfVrT6N09D2,WkDfVrT6N10D2, & + WkDfVrT6N11D2,WkDfVrT6N12D2,WkDfVrT6N13D2,WkDfVrT6N14D2,WkDfVrT6N15D2,WkDfVrT6N16D2,WkDfVrT6N17D2,WkDfVrT6N18D2,WkDfVrT6N19D2,WkDfVrT6N20D2, & + WkDfVrT6N01D3,WkDfVrT6N02D3,WkDfVrT6N03D3,WkDfVrT6N04D3,WkDfVrT6N05D3,WkDfVrT6N06D3,WkDfVrT6N07D3,WkDfVrT6N08D3,WkDfVrT6N09D3,WkDfVrT6N10D3, & + WkDfVrT6N11D3,WkDfVrT6N12D3,WkDfVrT6N13D3,WkDfVrT6N14D3,WkDfVrT6N15D3,WkDfVrT6N16D3,WkDfVrT6N17D3,WkDfVrT6N18D3,WkDfVrT6N19D3,WkDfVrT6N20D3, & + WkDfVrT6N01D4,WkDfVrT6N02D4,WkDfVrT6N03D4,WkDfVrT6N04D4,WkDfVrT6N05D4,WkDfVrT6N06D4,WkDfVrT6N07D4,WkDfVrT6N08D4,WkDfVrT6N09D4,WkDfVrT6N10D4, & + WkDfVrT6N11D4,WkDfVrT6N12D4,WkDfVrT6N13D4,WkDfVrT6N14D4,WkDfVrT6N15D4,WkDfVrT6N16D4,WkDfVrT6N17D4,WkDfVrT6N18D4,WkDfVrT6N19D4,WkDfVrT6N20D4, & + WkDfVrT6N01D5,WkDfVrT6N02D5,WkDfVrT6N03D5,WkDfVrT6N04D5,WkDfVrT6N05D5,WkDfVrT6N06D5,WkDfVrT6N07D5,WkDfVrT6N08D5,WkDfVrT6N09D5,WkDfVrT6N10D5, & + WkDfVrT6N11D5,WkDfVrT6N12D5,WkDfVrT6N13D5,WkDfVrT6N14D5,WkDfVrT6N15D5,WkDfVrT6N16D5,WkDfVrT6N17D5,WkDfVrT6N18D5,WkDfVrT6N19D5,WkDfVrT6N20D5, & + WkDfVrT6N01D6,WkDfVrT6N02D6,WkDfVrT6N03D6,WkDfVrT6N04D6,WkDfVrT6N05D6,WkDfVrT6N06D6,WkDfVrT6N07D6,WkDfVrT6N08D6,WkDfVrT6N09D6,WkDfVrT6N10D6, & + WkDfVrT6N11D6,WkDfVrT6N12D6,WkDfVrT6N13D6,WkDfVrT6N14D6,WkDfVrT6N15D6,WkDfVrT6N16D6,WkDfVrT6N17D6,WkDfVrT6N18D6,WkDfVrT6N19D6,WkDfVrT6N20D6, & + WkDfVrT6N01D7,WkDfVrT6N02D7,WkDfVrT6N03D7,WkDfVrT6N04D7,WkDfVrT6N05D7,WkDfVrT6N06D7,WkDfVrT6N07D7,WkDfVrT6N08D7,WkDfVrT6N09D7,WkDfVrT6N10D7, & + WkDfVrT6N11D7,WkDfVrT6N12D7,WkDfVrT6N13D7,WkDfVrT6N14D7,WkDfVrT6N15D7,WkDfVrT6N16D7,WkDfVrT6N17D7,WkDfVrT6N18D7,WkDfVrT6N19D7,WkDfVrT6N20D7, & + WkDfVrT6N01D8,WkDfVrT6N02D8,WkDfVrT6N03D8,WkDfVrT6N04D8,WkDfVrT6N05D8,WkDfVrT6N06D8,WkDfVrT6N07D8,WkDfVrT6N08D8,WkDfVrT6N09D8,WkDfVrT6N10D8, & + WkDfVrT6N11D8,WkDfVrT6N12D8,WkDfVrT6N13D8,WkDfVrT6N14D8,WkDfVrT6N15D8,WkDfVrT6N16D8,WkDfVrT6N17D8,WkDfVrT6N18D8,WkDfVrT6N19D8,WkDfVrT6N20D8, & + WkDfVrT6N01D9,WkDfVrT6N02D9,WkDfVrT6N03D9,WkDfVrT6N04D9,WkDfVrT6N05D9,WkDfVrT6N06D9,WkDfVrT6N07D9,WkDfVrT6N08D9,WkDfVrT6N09D9,WkDfVrT6N10D9, & + WkDfVrT6N11D9,WkDfVrT6N12D9,WkDfVrT6N13D9,WkDfVrT6N14D9,WkDfVrT6N15D9,WkDfVrT6N16D9,WkDfVrT6N17D9,WkDfVrT6N18D9,WkDfVrT6N19D9,WkDfVrT6N20D9/), (/20,9/) ) +WkDfVrTND(:,:,7) = RESHAPE( & + (/WkDfVrT7N01D1,WkDfVrT7N02D1,WkDfVrT7N03D1,WkDfVrT7N04D1,WkDfVrT7N05D1,WkDfVrT7N06D1,WkDfVrT7N07D1,WkDfVrT7N08D1,WkDfVrT7N09D1,WkDfVrT7N10D1, & + WkDfVrT7N11D1,WkDfVrT7N12D1,WkDfVrT7N13D1,WkDfVrT7N14D1,WkDfVrT7N15D1,WkDfVrT7N16D1,WkDfVrT7N17D1,WkDfVrT7N18D1,WkDfVrT7N19D1,WkDfVrT7N20D1, & + WkDfVrT7N01D2,WkDfVrT7N02D2,WkDfVrT7N03D2,WkDfVrT7N04D2,WkDfVrT7N05D2,WkDfVrT7N06D2,WkDfVrT7N07D2,WkDfVrT7N08D2,WkDfVrT7N09D2,WkDfVrT7N10D2, & + WkDfVrT7N11D2,WkDfVrT7N12D2,WkDfVrT7N13D2,WkDfVrT7N14D2,WkDfVrT7N15D2,WkDfVrT7N16D2,WkDfVrT7N17D2,WkDfVrT7N18D2,WkDfVrT7N19D2,WkDfVrT7N20D2, & + WkDfVrT7N01D3,WkDfVrT7N02D3,WkDfVrT7N03D3,WkDfVrT7N04D3,WkDfVrT7N05D3,WkDfVrT7N06D3,WkDfVrT7N07D3,WkDfVrT7N08D3,WkDfVrT7N09D3,WkDfVrT7N10D3, & + WkDfVrT7N11D3,WkDfVrT7N12D3,WkDfVrT7N13D3,WkDfVrT7N14D3,WkDfVrT7N15D3,WkDfVrT7N16D3,WkDfVrT7N17D3,WkDfVrT7N18D3,WkDfVrT7N19D3,WkDfVrT7N20D3, & + WkDfVrT7N01D4,WkDfVrT7N02D4,WkDfVrT7N03D4,WkDfVrT7N04D4,WkDfVrT7N05D4,WkDfVrT7N06D4,WkDfVrT7N07D4,WkDfVrT7N08D4,WkDfVrT7N09D4,WkDfVrT7N10D4, & + WkDfVrT7N11D4,WkDfVrT7N12D4,WkDfVrT7N13D4,WkDfVrT7N14D4,WkDfVrT7N15D4,WkDfVrT7N16D4,WkDfVrT7N17D4,WkDfVrT7N18D4,WkDfVrT7N19D4,WkDfVrT7N20D4, & + WkDfVrT7N01D5,WkDfVrT7N02D5,WkDfVrT7N03D5,WkDfVrT7N04D5,WkDfVrT7N05D5,WkDfVrT7N06D5,WkDfVrT7N07D5,WkDfVrT7N08D5,WkDfVrT7N09D5,WkDfVrT7N10D5, & + WkDfVrT7N11D5,WkDfVrT7N12D5,WkDfVrT7N13D5,WkDfVrT7N14D5,WkDfVrT7N15D5,WkDfVrT7N16D5,WkDfVrT7N17D5,WkDfVrT7N18D5,WkDfVrT7N19D5,WkDfVrT7N20D5, & + WkDfVrT7N01D6,WkDfVrT7N02D6,WkDfVrT7N03D6,WkDfVrT7N04D6,WkDfVrT7N05D6,WkDfVrT7N06D6,WkDfVrT7N07D6,WkDfVrT7N08D6,WkDfVrT7N09D6,WkDfVrT7N10D6, & + WkDfVrT7N11D6,WkDfVrT7N12D6,WkDfVrT7N13D6,WkDfVrT7N14D6,WkDfVrT7N15D6,WkDfVrT7N16D6,WkDfVrT7N17D6,WkDfVrT7N18D6,WkDfVrT7N19D6,WkDfVrT7N20D6, & + WkDfVrT7N01D7,WkDfVrT7N02D7,WkDfVrT7N03D7,WkDfVrT7N04D7,WkDfVrT7N05D7,WkDfVrT7N06D7,WkDfVrT7N07D7,WkDfVrT7N08D7,WkDfVrT7N09D7,WkDfVrT7N10D7, & + WkDfVrT7N11D7,WkDfVrT7N12D7,WkDfVrT7N13D7,WkDfVrT7N14D7,WkDfVrT7N15D7,WkDfVrT7N16D7,WkDfVrT7N17D7,WkDfVrT7N18D7,WkDfVrT7N19D7,WkDfVrT7N20D7, & + WkDfVrT7N01D8,WkDfVrT7N02D8,WkDfVrT7N03D8,WkDfVrT7N04D8,WkDfVrT7N05D8,WkDfVrT7N06D8,WkDfVrT7N07D8,WkDfVrT7N08D8,WkDfVrT7N09D8,WkDfVrT7N10D8, & + WkDfVrT7N11D8,WkDfVrT7N12D8,WkDfVrT7N13D8,WkDfVrT7N14D8,WkDfVrT7N15D8,WkDfVrT7N16D8,WkDfVrT7N17D8,WkDfVrT7N18D8,WkDfVrT7N19D8,WkDfVrT7N20D8, & + WkDfVrT7N01D9,WkDfVrT7N02D9,WkDfVrT7N03D9,WkDfVrT7N04D9,WkDfVrT7N05D9,WkDfVrT7N06D9,WkDfVrT7N07D9,WkDfVrT7N08D9,WkDfVrT7N09D9,WkDfVrT7N10D9, & + WkDfVrT7N11D9,WkDfVrT7N12D9,WkDfVrT7N13D9,WkDfVrT7N14D9,WkDfVrT7N15D9,WkDfVrT7N16D9,WkDfVrT7N17D9,WkDfVrT7N18D9,WkDfVrT7N19D9,WkDfVrT7N20D9/), (/20,9/) ) +WkDfVrTND(:,:,8) = RESHAPE( & + (/WkDfVrT8N01D1,WkDfVrT8N02D1,WkDfVrT8N03D1,WkDfVrT8N04D1,WkDfVrT8N05D1,WkDfVrT8N06D1,WkDfVrT8N07D1,WkDfVrT8N08D1,WkDfVrT8N09D1,WkDfVrT8N10D1, & + WkDfVrT8N11D1,WkDfVrT8N12D1,WkDfVrT8N13D1,WkDfVrT8N14D1,WkDfVrT8N15D1,WkDfVrT8N16D1,WkDfVrT8N17D1,WkDfVrT8N18D1,WkDfVrT8N19D1,WkDfVrT8N20D1, & + WkDfVrT8N01D2,WkDfVrT8N02D2,WkDfVrT8N03D2,WkDfVrT8N04D2,WkDfVrT8N05D2,WkDfVrT8N06D2,WkDfVrT8N07D2,WkDfVrT8N08D2,WkDfVrT8N09D2,WkDfVrT8N10D2, & + WkDfVrT8N11D2,WkDfVrT8N12D2,WkDfVrT8N13D2,WkDfVrT8N14D2,WkDfVrT8N15D2,WkDfVrT8N16D2,WkDfVrT8N17D2,WkDfVrT8N18D2,WkDfVrT8N19D2,WkDfVrT8N20D2, & + WkDfVrT8N01D3,WkDfVrT8N02D3,WkDfVrT8N03D3,WkDfVrT8N04D3,WkDfVrT8N05D3,WkDfVrT8N06D3,WkDfVrT8N07D3,WkDfVrT8N08D3,WkDfVrT8N09D3,WkDfVrT8N10D3, & + WkDfVrT8N11D3,WkDfVrT8N12D3,WkDfVrT8N13D3,WkDfVrT8N14D3,WkDfVrT8N15D3,WkDfVrT8N16D3,WkDfVrT8N17D3,WkDfVrT8N18D3,WkDfVrT8N19D3,WkDfVrT8N20D3, & + WkDfVrT8N01D4,WkDfVrT8N02D4,WkDfVrT8N03D4,WkDfVrT8N04D4,WkDfVrT8N05D4,WkDfVrT8N06D4,WkDfVrT8N07D4,WkDfVrT8N08D4,WkDfVrT8N09D4,WkDfVrT8N10D4, & + WkDfVrT8N11D4,WkDfVrT8N12D4,WkDfVrT8N13D4,WkDfVrT8N14D4,WkDfVrT8N15D4,WkDfVrT8N16D4,WkDfVrT8N17D4,WkDfVrT8N18D4,WkDfVrT8N19D4,WkDfVrT8N20D4, & + WkDfVrT8N01D5,WkDfVrT8N02D5,WkDfVrT8N03D5,WkDfVrT8N04D5,WkDfVrT8N05D5,WkDfVrT8N06D5,WkDfVrT8N07D5,WkDfVrT8N08D5,WkDfVrT8N09D5,WkDfVrT8N10D5, & + WkDfVrT8N11D5,WkDfVrT8N12D5,WkDfVrT8N13D5,WkDfVrT8N14D5,WkDfVrT8N15D5,WkDfVrT8N16D5,WkDfVrT8N17D5,WkDfVrT8N18D5,WkDfVrT8N19D5,WkDfVrT8N20D5, & + WkDfVrT8N01D6,WkDfVrT8N02D6,WkDfVrT8N03D6,WkDfVrT8N04D6,WkDfVrT8N05D6,WkDfVrT8N06D6,WkDfVrT8N07D6,WkDfVrT8N08D6,WkDfVrT8N09D6,WkDfVrT8N10D6, & + WkDfVrT8N11D6,WkDfVrT8N12D6,WkDfVrT8N13D6,WkDfVrT8N14D6,WkDfVrT8N15D6,WkDfVrT8N16D6,WkDfVrT8N17D6,WkDfVrT8N18D6,WkDfVrT8N19D6,WkDfVrT8N20D6, & + WkDfVrT8N01D7,WkDfVrT8N02D7,WkDfVrT8N03D7,WkDfVrT8N04D7,WkDfVrT8N05D7,WkDfVrT8N06D7,WkDfVrT8N07D7,WkDfVrT8N08D7,WkDfVrT8N09D7,WkDfVrT8N10D7, & + WkDfVrT8N11D7,WkDfVrT8N12D7,WkDfVrT8N13D7,WkDfVrT8N14D7,WkDfVrT8N15D7,WkDfVrT8N16D7,WkDfVrT8N17D7,WkDfVrT8N18D7,WkDfVrT8N19D7,WkDfVrT8N20D7, & + WkDfVrT8N01D8,WkDfVrT8N02D8,WkDfVrT8N03D8,WkDfVrT8N04D8,WkDfVrT8N05D8,WkDfVrT8N06D8,WkDfVrT8N07D8,WkDfVrT8N08D8,WkDfVrT8N09D8,WkDfVrT8N10D8, & + WkDfVrT8N11D8,WkDfVrT8N12D8,WkDfVrT8N13D8,WkDfVrT8N14D8,WkDfVrT8N15D8,WkDfVrT8N16D8,WkDfVrT8N17D8,WkDfVrT8N18D8,WkDfVrT8N19D8,WkDfVrT8N20D8, & + WkDfVrT8N01D9,WkDfVrT8N02D9,WkDfVrT8N03D9,WkDfVrT8N04D9,WkDfVrT8N05D9,WkDfVrT8N06D9,WkDfVrT8N07D9,WkDfVrT8N08D9,WkDfVrT8N09D9,WkDfVrT8N10D9, & + WkDfVrT8N11D9,WkDfVrT8N12D9,WkDfVrT8N13D9,WkDfVrT8N14D9,WkDfVrT8N15D9,WkDfVrT8N16D9,WkDfVrT8N17D9,WkDfVrT8N18D9,WkDfVrT8N19D9,WkDfVrT8N20D9/), (/20,9/) ) +WkDfVrTND(:,:,9) = RESHAPE( & + (/WkDfVrT9N01D1,WkDfVrT9N02D1,WkDfVrT9N03D1,WkDfVrT9N04D1,WkDfVrT9N05D1,WkDfVrT9N06D1,WkDfVrT9N07D1,WkDfVrT9N08D1,WkDfVrT9N09D1,WkDfVrT9N10D1, & + WkDfVrT9N11D1,WkDfVrT9N12D1,WkDfVrT9N13D1,WkDfVrT9N14D1,WkDfVrT9N15D1,WkDfVrT9N16D1,WkDfVrT9N17D1,WkDfVrT9N18D1,WkDfVrT9N19D1,WkDfVrT9N20D1, & + WkDfVrT9N01D2,WkDfVrT9N02D2,WkDfVrT9N03D2,WkDfVrT9N04D2,WkDfVrT9N05D2,WkDfVrT9N06D2,WkDfVrT9N07D2,WkDfVrT9N08D2,WkDfVrT9N09D2,WkDfVrT9N10D2, & + WkDfVrT9N11D2,WkDfVrT9N12D2,WkDfVrT9N13D2,WkDfVrT9N14D2,WkDfVrT9N15D2,WkDfVrT9N16D2,WkDfVrT9N17D2,WkDfVrT9N18D2,WkDfVrT9N19D2,WkDfVrT9N20D2, & + WkDfVrT9N01D3,WkDfVrT9N02D3,WkDfVrT9N03D3,WkDfVrT9N04D3,WkDfVrT9N05D3,WkDfVrT9N06D3,WkDfVrT9N07D3,WkDfVrT9N08D3,WkDfVrT9N09D3,WkDfVrT9N10D3, & + WkDfVrT9N11D3,WkDfVrT9N12D3,WkDfVrT9N13D3,WkDfVrT9N14D3,WkDfVrT9N15D3,WkDfVrT9N16D3,WkDfVrT9N17D3,WkDfVrT9N18D3,WkDfVrT9N19D3,WkDfVrT9N20D3, & + WkDfVrT9N01D4,WkDfVrT9N02D4,WkDfVrT9N03D4,WkDfVrT9N04D4,WkDfVrT9N05D4,WkDfVrT9N06D4,WkDfVrT9N07D4,WkDfVrT9N08D4,WkDfVrT9N09D4,WkDfVrT9N10D4, & + WkDfVrT9N11D4,WkDfVrT9N12D4,WkDfVrT9N13D4,WkDfVrT9N14D4,WkDfVrT9N15D4,WkDfVrT9N16D4,WkDfVrT9N17D4,WkDfVrT9N18D4,WkDfVrT9N19D4,WkDfVrT9N20D4, & + WkDfVrT9N01D5,WkDfVrT9N02D5,WkDfVrT9N03D5,WkDfVrT9N04D5,WkDfVrT9N05D5,WkDfVrT9N06D5,WkDfVrT9N07D5,WkDfVrT9N08D5,WkDfVrT9N09D5,WkDfVrT9N10D5, & + WkDfVrT9N11D5,WkDfVrT9N12D5,WkDfVrT9N13D5,WkDfVrT9N14D5,WkDfVrT9N15D5,WkDfVrT9N16D5,WkDfVrT9N17D5,WkDfVrT9N18D5,WkDfVrT9N19D5,WkDfVrT9N20D5, & + WkDfVrT9N01D6,WkDfVrT9N02D6,WkDfVrT9N03D6,WkDfVrT9N04D6,WkDfVrT9N05D6,WkDfVrT9N06D6,WkDfVrT9N07D6,WkDfVrT9N08D6,WkDfVrT9N09D6,WkDfVrT9N10D6, & + WkDfVrT9N11D6,WkDfVrT9N12D6,WkDfVrT9N13D6,WkDfVrT9N14D6,WkDfVrT9N15D6,WkDfVrT9N16D6,WkDfVrT9N17D6,WkDfVrT9N18D6,WkDfVrT9N19D6,WkDfVrT9N20D6, & + WkDfVrT9N01D7,WkDfVrT9N02D7,WkDfVrT9N03D7,WkDfVrT9N04D7,WkDfVrT9N05D7,WkDfVrT9N06D7,WkDfVrT9N07D7,WkDfVrT9N08D7,WkDfVrT9N09D7,WkDfVrT9N10D7, & + WkDfVrT9N11D7,WkDfVrT9N12D7,WkDfVrT9N13D7,WkDfVrT9N14D7,WkDfVrT9N15D7,WkDfVrT9N16D7,WkDfVrT9N17D7,WkDfVrT9N18D7,WkDfVrT9N19D7,WkDfVrT9N20D7, & + WkDfVrT9N01D8,WkDfVrT9N02D8,WkDfVrT9N03D8,WkDfVrT9N04D8,WkDfVrT9N05D8,WkDfVrT9N06D8,WkDfVrT9N07D8,WkDfVrT9N08D8,WkDfVrT9N09D8,WkDfVrT9N10D8, & + WkDfVrT9N11D8,WkDfVrT9N12D8,WkDfVrT9N13D8,WkDfVrT9N14D8,WkDfVrT9N15D8,WkDfVrT9N16D8,WkDfVrT9N17D8,WkDfVrT9N18D8,WkDfVrT9N19D8,WkDfVrT9N20D8, & + WkDfVrT9N01D9,WkDfVrT9N02D9,WkDfVrT9N03D9,WkDfVrT9N04D9,WkDfVrT9N05D9,WkDfVrT9N06D9,WkDfVrT9N07D9,WkDfVrT9N08D9,WkDfVrT9N09D9,WkDfVrT9N10D9, & + WkDfVrT9N11D9,WkDfVrT9N12D9,WkDfVrT9N13D9,WkDfVrT9N14D9,WkDfVrT9N15D9,WkDfVrT9N16D9,WkDfVrT9N17D9,WkDfVrT9N18D9,WkDfVrT9N19D9,WkDfVrT9N20D9/), (/20,9/) ) + +EddVisTND(:,:,1) = RESHAPE( & + (/EddVisT1N01D1,EddVisT1N02D1,EddVisT1N03D1,EddVisT1N04D1,EddVisT1N05D1,EddVisT1N06D1,EddVisT1N07D1,EddVisT1N08D1,EddVisT1N09D1,EddVisT1N10D1, & + EddVisT1N11D1,EddVisT1N12D1,EddVisT1N13D1,EddVisT1N14D1,EddVisT1N15D1,EddVisT1N16D1,EddVisT1N17D1,EddVisT1N18D1,EddVisT1N19D1,EddVisT1N20D1, & + EddVisT1N01D2,EddVisT1N02D2,EddVisT1N03D2,EddVisT1N04D2,EddVisT1N05D2,EddVisT1N06D2,EddVisT1N07D2,EddVisT1N08D2,EddVisT1N09D2,EddVisT1N10D2, & + EddVisT1N11D2,EddVisT1N12D2,EddVisT1N13D2,EddVisT1N14D2,EddVisT1N15D2,EddVisT1N16D2,EddVisT1N17D2,EddVisT1N18D2,EddVisT1N19D2,EddVisT1N20D2, & + EddVisT1N01D3,EddVisT1N02D3,EddVisT1N03D3,EddVisT1N04D3,EddVisT1N05D3,EddVisT1N06D3,EddVisT1N07D3,EddVisT1N08D3,EddVisT1N09D3,EddVisT1N10D3, & + EddVisT1N11D3,EddVisT1N12D3,EddVisT1N13D3,EddVisT1N14D3,EddVisT1N15D3,EddVisT1N16D3,EddVisT1N17D3,EddVisT1N18D3,EddVisT1N19D3,EddVisT1N20D3, & + EddVisT1N01D4,EddVisT1N02D4,EddVisT1N03D4,EddVisT1N04D4,EddVisT1N05D4,EddVisT1N06D4,EddVisT1N07D4,EddVisT1N08D4,EddVisT1N09D4,EddVisT1N10D4, & + EddVisT1N11D4,EddVisT1N12D4,EddVisT1N13D4,EddVisT1N14D4,EddVisT1N15D4,EddVisT1N16D4,EddVisT1N17D4,EddVisT1N18D4,EddVisT1N19D4,EddVisT1N20D4, & + EddVisT1N01D5,EddVisT1N02D5,EddVisT1N03D5,EddVisT1N04D5,EddVisT1N05D5,EddVisT1N06D5,EddVisT1N07D5,EddVisT1N08D5,EddVisT1N09D5,EddVisT1N10D5, & + EddVisT1N11D5,EddVisT1N12D5,EddVisT1N13D5,EddVisT1N14D5,EddVisT1N15D5,EddVisT1N16D5,EddVisT1N17D5,EddVisT1N18D5,EddVisT1N19D5,EddVisT1N20D5, & + EddVisT1N01D6,EddVisT1N02D6,EddVisT1N03D6,EddVisT1N04D6,EddVisT1N05D6,EddVisT1N06D6,EddVisT1N07D6,EddVisT1N08D6,EddVisT1N09D6,EddVisT1N10D6, & + EddVisT1N11D6,EddVisT1N12D6,EddVisT1N13D6,EddVisT1N14D6,EddVisT1N15D6,EddVisT1N16D6,EddVisT1N17D6,EddVisT1N18D6,EddVisT1N19D6,EddVisT1N20D6, & + EddVisT1N01D7,EddVisT1N02D7,EddVisT1N03D7,EddVisT1N04D7,EddVisT1N05D7,EddVisT1N06D7,EddVisT1N07D7,EddVisT1N08D7,EddVisT1N09D7,EddVisT1N10D7, & + EddVisT1N11D7,EddVisT1N12D7,EddVisT1N13D7,EddVisT1N14D7,EddVisT1N15D7,EddVisT1N16D7,EddVisT1N17D7,EddVisT1N18D7,EddVisT1N19D7,EddVisT1N20D7, & + EddVisT1N01D8,EddVisT1N02D8,EddVisT1N03D8,EddVisT1N04D8,EddVisT1N05D8,EddVisT1N06D8,EddVisT1N07D8,EddVisT1N08D8,EddVisT1N09D8,EddVisT1N10D8, & + EddVisT1N11D8,EddVisT1N12D8,EddVisT1N13D8,EddVisT1N14D8,EddVisT1N15D8,EddVisT1N16D8,EddVisT1N17D8,EddVisT1N18D8,EddVisT1N19D8,EddVisT1N20D8, & + EddVisT1N01D9,EddVisT1N02D9,EddVisT1N03D9,EddVisT1N04D9,EddVisT1N05D9,EddVisT1N06D9,EddVisT1N07D9,EddVisT1N08D9,EddVisT1N09D9,EddVisT1N10D9, & + EddVisT1N11D9,EddVisT1N12D9,EddVisT1N13D9,EddVisT1N14D9,EddVisT1N15D9,EddVisT1N16D9,EddVisT1N17D9,EddVisT1N18D9,EddVisT1N19D9,EddVisT1N20D9/), (/20,9/) ) +EddVisTND(:,:,2) = RESHAPE( & + (/EddVisT2N01D1,EddVisT2N02D1,EddVisT2N03D1,EddVisT2N04D1,EddVisT2N05D1,EddVisT2N06D1,EddVisT2N07D1,EddVisT2N08D1,EddVisT2N09D1,EddVisT2N10D1, & + EddVisT2N11D1,EddVisT2N12D1,EddVisT2N13D1,EddVisT2N14D1,EddVisT2N15D1,EddVisT2N16D1,EddVisT2N17D1,EddVisT2N18D1,EddVisT2N19D1,EddVisT2N20D1, & + EddVisT2N01D2,EddVisT2N02D2,EddVisT2N03D2,EddVisT2N04D2,EddVisT2N05D2,EddVisT2N06D2,EddVisT2N07D2,EddVisT2N08D2,EddVisT2N09D2,EddVisT2N10D2, & + EddVisT2N11D2,EddVisT2N12D2,EddVisT2N13D2,EddVisT2N14D2,EddVisT2N15D2,EddVisT2N16D2,EddVisT2N17D2,EddVisT2N18D2,EddVisT2N19D2,EddVisT2N20D2, & + EddVisT2N01D3,EddVisT2N02D3,EddVisT2N03D3,EddVisT2N04D3,EddVisT2N05D3,EddVisT2N06D3,EddVisT2N07D3,EddVisT2N08D3,EddVisT2N09D3,EddVisT2N10D3, & + EddVisT2N11D3,EddVisT2N12D3,EddVisT2N13D3,EddVisT2N14D3,EddVisT2N15D3,EddVisT2N16D3,EddVisT2N17D3,EddVisT2N18D3,EddVisT2N19D3,EddVisT2N20D3, & + EddVisT2N01D4,EddVisT2N02D4,EddVisT2N03D4,EddVisT2N04D4,EddVisT2N05D4,EddVisT2N06D4,EddVisT2N07D4,EddVisT2N08D4,EddVisT2N09D4,EddVisT2N10D4, & + EddVisT2N11D4,EddVisT2N12D4,EddVisT2N13D4,EddVisT2N14D4,EddVisT2N15D4,EddVisT2N16D4,EddVisT2N17D4,EddVisT2N18D4,EddVisT2N19D4,EddVisT2N20D4, & + EddVisT2N01D5,EddVisT2N02D5,EddVisT2N03D5,EddVisT2N04D5,EddVisT2N05D5,EddVisT2N06D5,EddVisT2N07D5,EddVisT2N08D5,EddVisT2N09D5,EddVisT2N10D5, & + EddVisT2N11D5,EddVisT2N12D5,EddVisT2N13D5,EddVisT2N14D5,EddVisT2N15D5,EddVisT2N16D5,EddVisT2N17D5,EddVisT2N18D5,EddVisT2N19D5,EddVisT2N20D5, & + EddVisT2N01D6,EddVisT2N02D6,EddVisT2N03D6,EddVisT2N04D6,EddVisT2N05D6,EddVisT2N06D6,EddVisT2N07D6,EddVisT2N08D6,EddVisT2N09D6,EddVisT2N10D6, & + EddVisT2N11D6,EddVisT2N12D6,EddVisT2N13D6,EddVisT2N14D6,EddVisT2N15D6,EddVisT2N16D6,EddVisT2N17D6,EddVisT2N18D6,EddVisT2N19D6,EddVisT2N20D6, & + EddVisT2N01D7,EddVisT2N02D7,EddVisT2N03D7,EddVisT2N04D7,EddVisT2N05D7,EddVisT2N06D7,EddVisT2N07D7,EddVisT2N08D7,EddVisT2N09D7,EddVisT2N10D7, & + EddVisT2N11D7,EddVisT2N12D7,EddVisT2N13D7,EddVisT2N14D7,EddVisT2N15D7,EddVisT2N16D7,EddVisT2N17D7,EddVisT2N18D7,EddVisT2N19D7,EddVisT2N20D7, & + EddVisT2N01D8,EddVisT2N02D8,EddVisT2N03D8,EddVisT2N04D8,EddVisT2N05D8,EddVisT2N06D8,EddVisT2N07D8,EddVisT2N08D8,EddVisT2N09D8,EddVisT2N10D8, & + EddVisT2N11D8,EddVisT2N12D8,EddVisT2N13D8,EddVisT2N14D8,EddVisT2N15D8,EddVisT2N16D8,EddVisT2N17D8,EddVisT2N18D8,EddVisT2N19D8,EddVisT2N20D8, & + EddVisT2N01D9,EddVisT2N02D9,EddVisT2N03D9,EddVisT2N04D9,EddVisT2N05D9,EddVisT2N06D9,EddVisT2N07D9,EddVisT2N08D9,EddVisT2N09D9,EddVisT2N10D9, & + EddVisT2N11D9,EddVisT2N12D9,EddVisT2N13D9,EddVisT2N14D9,EddVisT2N15D9,EddVisT2N16D9,EddVisT2N17D9,EddVisT2N18D9,EddVisT2N19D9,EddVisT2N20D9/), (/20,9/) ) +EddVisTND(:,:,3) = RESHAPE( & + (/EddVisT3N01D1,EddVisT3N02D1,EddVisT3N03D1,EddVisT3N04D1,EddVisT3N05D1,EddVisT3N06D1,EddVisT3N07D1,EddVisT3N08D1,EddVisT3N09D1,EddVisT3N10D1, & + EddVisT3N11D1,EddVisT3N12D1,EddVisT3N13D1,EddVisT3N14D1,EddVisT3N15D1,EddVisT3N16D1,EddVisT3N17D1,EddVisT3N18D1,EddVisT3N19D1,EddVisT3N20D1, & + EddVisT3N01D2,EddVisT3N02D2,EddVisT3N03D2,EddVisT3N04D2,EddVisT3N05D2,EddVisT3N06D2,EddVisT3N07D2,EddVisT3N08D2,EddVisT3N09D2,EddVisT3N10D2, & + EddVisT3N11D2,EddVisT3N12D2,EddVisT3N13D2,EddVisT3N14D2,EddVisT3N15D2,EddVisT3N16D2,EddVisT3N17D2,EddVisT3N18D2,EddVisT3N19D2,EddVisT3N20D2, & + EddVisT3N01D3,EddVisT3N02D3,EddVisT3N03D3,EddVisT3N04D3,EddVisT3N05D3,EddVisT3N06D3,EddVisT3N07D3,EddVisT3N08D3,EddVisT3N09D3,EddVisT3N10D3, & + EddVisT3N11D3,EddVisT3N12D3,EddVisT3N13D3,EddVisT3N14D3,EddVisT3N15D3,EddVisT3N16D3,EddVisT3N17D3,EddVisT3N18D3,EddVisT3N19D3,EddVisT3N20D3, & + EddVisT3N01D4,EddVisT3N02D4,EddVisT3N03D4,EddVisT3N04D4,EddVisT3N05D4,EddVisT3N06D4,EddVisT3N07D4,EddVisT3N08D4,EddVisT3N09D4,EddVisT3N10D4, & + EddVisT3N11D4,EddVisT3N12D4,EddVisT3N13D4,EddVisT3N14D4,EddVisT3N15D4,EddVisT3N16D4,EddVisT3N17D4,EddVisT3N18D4,EddVisT3N19D4,EddVisT3N20D4, & + EddVisT3N01D5,EddVisT3N02D5,EddVisT3N03D5,EddVisT3N04D5,EddVisT3N05D5,EddVisT3N06D5,EddVisT3N07D5,EddVisT3N08D5,EddVisT3N09D5,EddVisT3N10D5, & + EddVisT3N11D5,EddVisT3N12D5,EddVisT3N13D5,EddVisT3N14D5,EddVisT3N15D5,EddVisT3N16D5,EddVisT3N17D5,EddVisT3N18D5,EddVisT3N19D5,EddVisT3N20D5, & + EddVisT3N01D6,EddVisT3N02D6,EddVisT3N03D6,EddVisT3N04D6,EddVisT3N05D6,EddVisT3N06D6,EddVisT3N07D6,EddVisT3N08D6,EddVisT3N09D6,EddVisT3N10D6, & + EddVisT3N11D6,EddVisT3N12D6,EddVisT3N13D6,EddVisT3N14D6,EddVisT3N15D6,EddVisT3N16D6,EddVisT3N17D6,EddVisT3N18D6,EddVisT3N19D6,EddVisT3N20D6, & + EddVisT3N01D7,EddVisT3N02D7,EddVisT3N03D7,EddVisT3N04D7,EddVisT3N05D7,EddVisT3N06D7,EddVisT3N07D7,EddVisT3N08D7,EddVisT3N09D7,EddVisT3N10D7, & + EddVisT3N11D7,EddVisT3N12D7,EddVisT3N13D7,EddVisT3N14D7,EddVisT3N15D7,EddVisT3N16D7,EddVisT3N17D7,EddVisT3N18D7,EddVisT3N19D7,EddVisT3N20D7, & + EddVisT3N01D8,EddVisT3N02D8,EddVisT3N03D8,EddVisT3N04D8,EddVisT3N05D8,EddVisT3N06D8,EddVisT3N07D8,EddVisT3N08D8,EddVisT3N09D8,EddVisT3N10D8, & + EddVisT3N11D8,EddVisT3N12D8,EddVisT3N13D8,EddVisT3N14D8,EddVisT3N15D8,EddVisT3N16D8,EddVisT3N17D8,EddVisT3N18D8,EddVisT3N19D8,EddVisT3N20D8, & + EddVisT3N01D9,EddVisT3N02D9,EddVisT3N03D9,EddVisT3N04D9,EddVisT3N05D9,EddVisT3N06D9,EddVisT3N07D9,EddVisT3N08D9,EddVisT3N09D9,EddVisT3N10D9, & + EddVisT3N11D9,EddVisT3N12D9,EddVisT3N13D9,EddVisT3N14D9,EddVisT3N15D9,EddVisT3N16D9,EddVisT3N17D9,EddVisT3N18D9,EddVisT3N19D9,EddVisT3N20D9/), (/20,9/) ) +EddVisTND(:,:,4) = RESHAPE( & + (/EddVisT4N01D1,EddVisT4N02D1,EddVisT4N03D1,EddVisT4N04D1,EddVisT4N05D1,EddVisT4N06D1,EddVisT4N07D1,EddVisT4N08D1,EddVisT4N09D1,EddVisT4N10D1, & + EddVisT4N11D1,EddVisT4N12D1,EddVisT4N13D1,EddVisT4N14D1,EddVisT4N15D1,EddVisT4N16D1,EddVisT4N17D1,EddVisT4N18D1,EddVisT4N19D1,EddVisT4N20D1, & + EddVisT4N01D2,EddVisT4N02D2,EddVisT4N03D2,EddVisT4N04D2,EddVisT4N05D2,EddVisT4N06D2,EddVisT4N07D2,EddVisT4N08D2,EddVisT4N09D2,EddVisT4N10D2, & + EddVisT4N11D2,EddVisT4N12D2,EddVisT4N13D2,EddVisT4N14D2,EddVisT4N15D2,EddVisT4N16D2,EddVisT4N17D2,EddVisT4N18D2,EddVisT4N19D2,EddVisT4N20D2, & + EddVisT4N01D3,EddVisT4N02D3,EddVisT4N03D3,EddVisT4N04D3,EddVisT4N05D3,EddVisT4N06D3,EddVisT4N07D3,EddVisT4N08D3,EddVisT4N09D3,EddVisT4N10D3, & + EddVisT4N11D3,EddVisT4N12D3,EddVisT4N13D3,EddVisT4N14D3,EddVisT4N15D3,EddVisT4N16D3,EddVisT4N17D3,EddVisT4N18D3,EddVisT4N19D3,EddVisT4N20D3, & + EddVisT4N01D4,EddVisT4N02D4,EddVisT4N03D4,EddVisT4N04D4,EddVisT4N05D4,EddVisT4N06D4,EddVisT4N07D4,EddVisT4N08D4,EddVisT4N09D4,EddVisT4N10D4, & + EddVisT4N11D4,EddVisT4N12D4,EddVisT4N13D4,EddVisT4N14D4,EddVisT4N15D4,EddVisT4N16D4,EddVisT4N17D4,EddVisT4N18D4,EddVisT4N19D4,EddVisT4N20D4, & + EddVisT4N01D5,EddVisT4N02D5,EddVisT4N03D5,EddVisT4N04D5,EddVisT4N05D5,EddVisT4N06D5,EddVisT4N07D5,EddVisT4N08D5,EddVisT4N09D5,EddVisT4N10D5, & + EddVisT4N11D5,EddVisT4N12D5,EddVisT4N13D5,EddVisT4N14D5,EddVisT4N15D5,EddVisT4N16D5,EddVisT4N17D5,EddVisT4N18D5,EddVisT4N19D5,EddVisT4N20D5, & + EddVisT4N01D6,EddVisT4N02D6,EddVisT4N03D6,EddVisT4N04D6,EddVisT4N05D6,EddVisT4N06D6,EddVisT4N07D6,EddVisT4N08D6,EddVisT4N09D6,EddVisT4N10D6, & + EddVisT4N11D6,EddVisT4N12D6,EddVisT4N13D6,EddVisT4N14D6,EddVisT4N15D6,EddVisT4N16D6,EddVisT4N17D6,EddVisT4N18D6,EddVisT4N19D6,EddVisT4N20D6, & + EddVisT4N01D7,EddVisT4N02D7,EddVisT4N03D7,EddVisT4N04D7,EddVisT4N05D7,EddVisT4N06D7,EddVisT4N07D7,EddVisT4N08D7,EddVisT4N09D7,EddVisT4N10D7, & + EddVisT4N11D7,EddVisT4N12D7,EddVisT4N13D7,EddVisT4N14D7,EddVisT4N15D7,EddVisT4N16D7,EddVisT4N17D7,EddVisT4N18D7,EddVisT4N19D7,EddVisT4N20D7, & + EddVisT4N01D8,EddVisT4N02D8,EddVisT4N03D8,EddVisT4N04D8,EddVisT4N05D8,EddVisT4N06D8,EddVisT4N07D8,EddVisT4N08D8,EddVisT4N09D8,EddVisT4N10D8, & + EddVisT4N11D8,EddVisT4N12D8,EddVisT4N13D8,EddVisT4N14D8,EddVisT4N15D8,EddVisT4N16D8,EddVisT4N17D8,EddVisT4N18D8,EddVisT4N19D8,EddVisT4N20D8, & + EddVisT4N01D9,EddVisT4N02D9,EddVisT4N03D9,EddVisT4N04D9,EddVisT4N05D9,EddVisT4N06D9,EddVisT4N07D9,EddVisT4N08D9,EddVisT4N09D9,EddVisT4N10D9, & + EddVisT4N11D9,EddVisT4N12D9,EddVisT4N13D9,EddVisT4N14D9,EddVisT4N15D9,EddVisT4N16D9,EddVisT4N17D9,EddVisT4N18D9,EddVisT4N19D9,EddVisT4N20D9/), (/20,9/) ) + +EddVisTND(:,:,5) = RESHAPE( & + (/EddVisT5N01D1,EddVisT5N02D1,EddVisT5N03D1,EddVisT5N04D1,EddVisT5N05D1,EddVisT5N06D1,EddVisT5N07D1,EddVisT5N08D1,EddVisT5N09D1,EddVisT5N10D1, & + EddVisT5N11D1,EddVisT5N12D1,EddVisT5N13D1,EddVisT5N14D1,EddVisT5N15D1,EddVisT5N16D1,EddVisT5N17D1,EddVisT5N18D1,EddVisT5N19D1,EddVisT5N20D1, & + EddVisT5N01D2,EddVisT5N02D2,EddVisT5N03D2,EddVisT5N04D2,EddVisT5N05D2,EddVisT5N06D2,EddVisT5N07D2,EddVisT5N08D2,EddVisT5N09D2,EddVisT5N10D2, & + EddVisT5N11D2,EddVisT5N12D2,EddVisT5N13D2,EddVisT5N14D2,EddVisT5N15D2,EddVisT5N16D2,EddVisT5N17D2,EddVisT5N18D2,EddVisT5N19D2,EddVisT5N20D2, & + EddVisT5N01D3,EddVisT5N02D3,EddVisT5N03D3,EddVisT5N04D3,EddVisT5N05D3,EddVisT5N06D3,EddVisT5N07D3,EddVisT5N08D3,EddVisT5N09D3,EddVisT5N10D3, & + EddVisT5N11D3,EddVisT5N12D3,EddVisT5N13D3,EddVisT5N14D3,EddVisT5N15D3,EddVisT5N16D3,EddVisT5N17D3,EddVisT5N18D3,EddVisT5N19D3,EddVisT5N20D3, & + EddVisT5N01D4,EddVisT5N02D4,EddVisT5N03D4,EddVisT5N04D4,EddVisT5N05D4,EddVisT5N06D4,EddVisT5N07D4,EddVisT5N08D4,EddVisT5N09D4,EddVisT5N10D4, & + EddVisT5N11D4,EddVisT5N12D4,EddVisT5N13D4,EddVisT5N14D4,EddVisT5N15D4,EddVisT5N16D4,EddVisT5N17D4,EddVisT5N18D4,EddVisT5N19D4,EddVisT5N20D4, & + EddVisT5N01D5,EddVisT5N02D5,EddVisT5N03D5,EddVisT5N04D5,EddVisT5N05D5,EddVisT5N06D5,EddVisT5N07D5,EddVisT5N08D5,EddVisT5N09D5,EddVisT5N10D5, & + EddVisT5N11D5,EddVisT5N12D5,EddVisT5N13D5,EddVisT5N14D5,EddVisT5N15D5,EddVisT5N16D5,EddVisT5N17D5,EddVisT5N18D5,EddVisT5N19D5,EddVisT5N20D5, & + EddVisT5N01D6,EddVisT5N02D6,EddVisT5N03D6,EddVisT5N04D6,EddVisT5N05D6,EddVisT5N06D6,EddVisT5N07D6,EddVisT5N08D6,EddVisT5N09D6,EddVisT5N10D6, & + EddVisT5N11D6,EddVisT5N12D6,EddVisT5N13D6,EddVisT5N14D6,EddVisT5N15D6,EddVisT5N16D6,EddVisT5N17D6,EddVisT5N18D6,EddVisT5N19D6,EddVisT5N20D6, & + EddVisT5N01D7,EddVisT5N02D7,EddVisT5N03D7,EddVisT5N04D7,EddVisT5N05D7,EddVisT5N06D7,EddVisT5N07D7,EddVisT5N08D7,EddVisT5N09D7,EddVisT5N10D7, & + EddVisT5N11D7,EddVisT5N12D7,EddVisT5N13D7,EddVisT5N14D7,EddVisT5N15D7,EddVisT5N16D7,EddVisT5N17D7,EddVisT5N18D7,EddVisT5N19D7,EddVisT5N20D7, & + EddVisT5N01D8,EddVisT5N02D8,EddVisT5N03D8,EddVisT5N04D8,EddVisT5N05D8,EddVisT5N06D8,EddVisT5N07D8,EddVisT5N08D8,EddVisT5N09D8,EddVisT5N10D8, & + EddVisT5N11D8,EddVisT5N12D8,EddVisT5N13D8,EddVisT5N14D8,EddVisT5N15D8,EddVisT5N16D8,EddVisT5N17D8,EddVisT5N18D8,EddVisT5N19D8,EddVisT5N20D8, & + EddVisT5N01D9,EddVisT5N02D9,EddVisT5N03D9,EddVisT5N04D9,EddVisT5N05D9,EddVisT5N06D9,EddVisT5N07D9,EddVisT5N08D9,EddVisT5N09D9,EddVisT5N10D9, & + EddVisT5N11D9,EddVisT5N12D9,EddVisT5N13D9,EddVisT5N14D9,EddVisT5N15D9,EddVisT5N16D9,EddVisT5N17D9,EddVisT5N18D9,EddVisT5N19D9,EddVisT5N20D9/), (/20,9/) ) +EddVisTND(:,:,6) = RESHAPE( & + (/EddVisT6N01D1,EddVisT6N02D1,EddVisT6N03D1,EddVisT6N04D1,EddVisT6N05D1,EddVisT6N06D1,EddVisT6N07D1,EddVisT6N08D1,EddVisT6N09D1,EddVisT6N10D1, & + EddVisT6N11D1,EddVisT6N12D1,EddVisT6N13D1,EddVisT6N14D1,EddVisT6N15D1,EddVisT6N16D1,EddVisT6N17D1,EddVisT6N18D1,EddVisT6N19D1,EddVisT6N20D1, & + EddVisT6N01D2,EddVisT6N02D2,EddVisT6N03D2,EddVisT6N04D2,EddVisT6N05D2,EddVisT6N06D2,EddVisT6N07D2,EddVisT6N08D2,EddVisT6N09D2,EddVisT6N10D2, & + EddVisT6N11D2,EddVisT6N12D2,EddVisT6N13D2,EddVisT6N14D2,EddVisT6N15D2,EddVisT6N16D2,EddVisT6N17D2,EddVisT6N18D2,EddVisT6N19D2,EddVisT6N20D2, & + EddVisT6N01D3,EddVisT6N02D3,EddVisT6N03D3,EddVisT6N04D3,EddVisT6N05D3,EddVisT6N06D3,EddVisT6N07D3,EddVisT6N08D3,EddVisT6N09D3,EddVisT6N10D3, & + EddVisT6N11D3,EddVisT6N12D3,EddVisT6N13D3,EddVisT6N14D3,EddVisT6N15D3,EddVisT6N16D3,EddVisT6N17D3,EddVisT6N18D3,EddVisT6N19D3,EddVisT6N20D3, & + EddVisT6N01D4,EddVisT6N02D4,EddVisT6N03D4,EddVisT6N04D4,EddVisT6N05D4,EddVisT6N06D4,EddVisT6N07D4,EddVisT6N08D4,EddVisT6N09D4,EddVisT6N10D4, & + EddVisT6N11D4,EddVisT6N12D4,EddVisT6N13D4,EddVisT6N14D4,EddVisT6N15D4,EddVisT6N16D4,EddVisT6N17D4,EddVisT6N18D4,EddVisT6N19D4,EddVisT6N20D4, & + EddVisT6N01D5,EddVisT6N02D5,EddVisT6N03D5,EddVisT6N04D5,EddVisT6N05D5,EddVisT6N06D5,EddVisT6N07D5,EddVisT6N08D5,EddVisT6N09D5,EddVisT6N10D5, & + EddVisT6N11D5,EddVisT6N12D5,EddVisT6N13D5,EddVisT6N14D5,EddVisT6N15D5,EddVisT6N16D5,EddVisT6N17D5,EddVisT6N18D5,EddVisT6N19D5,EddVisT6N20D5, & + EddVisT6N01D6,EddVisT6N02D6,EddVisT6N03D6,EddVisT6N04D6,EddVisT6N05D6,EddVisT6N06D6,EddVisT6N07D6,EddVisT6N08D6,EddVisT6N09D6,EddVisT6N10D6, & + EddVisT6N11D6,EddVisT6N12D6,EddVisT6N13D6,EddVisT6N14D6,EddVisT6N15D6,EddVisT6N16D6,EddVisT6N17D6,EddVisT6N18D6,EddVisT6N19D6,EddVisT6N20D6, & + EddVisT6N01D7,EddVisT6N02D7,EddVisT6N03D7,EddVisT6N04D7,EddVisT6N05D7,EddVisT6N06D7,EddVisT6N07D7,EddVisT6N08D7,EddVisT6N09D7,EddVisT6N10D7, & + EddVisT6N11D7,EddVisT6N12D7,EddVisT6N13D7,EddVisT6N14D7,EddVisT6N15D7,EddVisT6N16D7,EddVisT6N17D7,EddVisT6N18D7,EddVisT6N19D7,EddVisT6N20D7, & + EddVisT6N01D8,EddVisT6N02D8,EddVisT6N03D8,EddVisT6N04D8,EddVisT6N05D8,EddVisT6N06D8,EddVisT6N07D8,EddVisT6N08D8,EddVisT6N09D8,EddVisT6N10D8, & + EddVisT6N11D8,EddVisT6N12D8,EddVisT6N13D8,EddVisT6N14D8,EddVisT6N15D8,EddVisT6N16D8,EddVisT6N17D8,EddVisT6N18D8,EddVisT6N19D8,EddVisT6N20D8, & + EddVisT6N01D9,EddVisT6N02D9,EddVisT6N03D9,EddVisT6N04D9,EddVisT6N05D9,EddVisT6N06D9,EddVisT6N07D9,EddVisT6N08D9,EddVisT6N09D9,EddVisT6N10D9, & + EddVisT6N11D9,EddVisT6N12D9,EddVisT6N13D9,EddVisT6N14D9,EddVisT6N15D9,EddVisT6N16D9,EddVisT6N17D9,EddVisT6N18D9,EddVisT6N19D9,EddVisT6N20D9/), (/20,9/) ) +EddVisTND(:,:,7) = RESHAPE( & + (/EddVisT7N01D1,EddVisT7N02D1,EddVisT7N03D1,EddVisT7N04D1,EddVisT7N05D1,EddVisT7N06D1,EddVisT7N07D1,EddVisT7N08D1,EddVisT7N09D1,EddVisT7N10D1, & + EddVisT7N11D1,EddVisT7N12D1,EddVisT7N13D1,EddVisT7N14D1,EddVisT7N15D1,EddVisT7N16D1,EddVisT7N17D1,EddVisT7N18D1,EddVisT7N19D1,EddVisT7N20D1, & + EddVisT7N01D2,EddVisT7N02D2,EddVisT7N03D2,EddVisT7N04D2,EddVisT7N05D2,EddVisT7N06D2,EddVisT7N07D2,EddVisT7N08D2,EddVisT7N09D2,EddVisT7N10D2, & + EddVisT7N11D2,EddVisT7N12D2,EddVisT7N13D2,EddVisT7N14D2,EddVisT7N15D2,EddVisT7N16D2,EddVisT7N17D2,EddVisT7N18D2,EddVisT7N19D2,EddVisT7N20D2, & + EddVisT7N01D3,EddVisT7N02D3,EddVisT7N03D3,EddVisT7N04D3,EddVisT7N05D3,EddVisT7N06D3,EddVisT7N07D3,EddVisT7N08D3,EddVisT7N09D3,EddVisT7N10D3, & + EddVisT7N11D3,EddVisT7N12D3,EddVisT7N13D3,EddVisT7N14D3,EddVisT7N15D3,EddVisT7N16D3,EddVisT7N17D3,EddVisT7N18D3,EddVisT7N19D3,EddVisT7N20D3, & + EddVisT7N01D4,EddVisT7N02D4,EddVisT7N03D4,EddVisT7N04D4,EddVisT7N05D4,EddVisT7N06D4,EddVisT7N07D4,EddVisT7N08D4,EddVisT7N09D4,EddVisT7N10D4, & + EddVisT7N11D4,EddVisT7N12D4,EddVisT7N13D4,EddVisT7N14D4,EddVisT7N15D4,EddVisT7N16D4,EddVisT7N17D4,EddVisT7N18D4,EddVisT7N19D4,EddVisT7N20D4, & + EddVisT7N01D5,EddVisT7N02D5,EddVisT7N03D5,EddVisT7N04D5,EddVisT7N05D5,EddVisT7N06D5,EddVisT7N07D5,EddVisT7N08D5,EddVisT7N09D5,EddVisT7N10D5, & + EddVisT7N11D5,EddVisT7N12D5,EddVisT7N13D5,EddVisT7N14D5,EddVisT7N15D5,EddVisT7N16D5,EddVisT7N17D5,EddVisT7N18D5,EddVisT7N19D5,EddVisT7N20D5, & + EddVisT7N01D6,EddVisT7N02D6,EddVisT7N03D6,EddVisT7N04D6,EddVisT7N05D6,EddVisT7N06D6,EddVisT7N07D6,EddVisT7N08D6,EddVisT7N09D6,EddVisT7N10D6, & + EddVisT7N11D6,EddVisT7N12D6,EddVisT7N13D6,EddVisT7N14D6,EddVisT7N15D6,EddVisT7N16D6,EddVisT7N17D6,EddVisT7N18D6,EddVisT7N19D6,EddVisT7N20D6, & + EddVisT7N01D7,EddVisT7N02D7,EddVisT7N03D7,EddVisT7N04D7,EddVisT7N05D7,EddVisT7N06D7,EddVisT7N07D7,EddVisT7N08D7,EddVisT7N09D7,EddVisT7N10D7, & + EddVisT7N11D7,EddVisT7N12D7,EddVisT7N13D7,EddVisT7N14D7,EddVisT7N15D7,EddVisT7N16D7,EddVisT7N17D7,EddVisT7N18D7,EddVisT7N19D7,EddVisT7N20D7, & + EddVisT7N01D8,EddVisT7N02D8,EddVisT7N03D8,EddVisT7N04D8,EddVisT7N05D8,EddVisT7N06D8,EddVisT7N07D8,EddVisT7N08D8,EddVisT7N09D8,EddVisT7N10D8, & + EddVisT7N11D8,EddVisT7N12D8,EddVisT7N13D8,EddVisT7N14D8,EddVisT7N15D8,EddVisT7N16D8,EddVisT7N17D8,EddVisT7N18D8,EddVisT7N19D8,EddVisT7N20D8, & + EddVisT7N01D9,EddVisT7N02D9,EddVisT7N03D9,EddVisT7N04D9,EddVisT7N05D9,EddVisT7N06D9,EddVisT7N07D9,EddVisT7N08D9,EddVisT7N09D9,EddVisT7N10D9, & + EddVisT7N11D9,EddVisT7N12D9,EddVisT7N13D9,EddVisT7N14D9,EddVisT7N15D9,EddVisT7N16D9,EddVisT7N17D9,EddVisT7N18D9,EddVisT7N19D9,EddVisT7N20D9/), (/20,9/) ) +EddVisTND(:,:,8) = RESHAPE( & + (/EddVisT8N01D1,EddVisT8N02D1,EddVisT8N03D1,EddVisT8N04D1,EddVisT8N05D1,EddVisT8N06D1,EddVisT8N07D1,EddVisT8N08D1,EddVisT8N09D1,EddVisT8N10D1, & + EddVisT8N11D1,EddVisT8N12D1,EddVisT8N13D1,EddVisT8N14D1,EddVisT8N15D1,EddVisT8N16D1,EddVisT8N17D1,EddVisT8N18D1,EddVisT8N19D1,EddVisT8N20D1, & + EddVisT8N01D2,EddVisT8N02D2,EddVisT8N03D2,EddVisT8N04D2,EddVisT8N05D2,EddVisT8N06D2,EddVisT8N07D2,EddVisT8N08D2,EddVisT8N09D2,EddVisT8N10D2, & + EddVisT8N11D2,EddVisT8N12D2,EddVisT8N13D2,EddVisT8N14D2,EddVisT8N15D2,EddVisT8N16D2,EddVisT8N17D2,EddVisT8N18D2,EddVisT8N19D2,EddVisT8N20D2, & + EddVisT8N01D3,EddVisT8N02D3,EddVisT8N03D3,EddVisT8N04D3,EddVisT8N05D3,EddVisT8N06D3,EddVisT8N07D3,EddVisT8N08D3,EddVisT8N09D3,EddVisT8N10D3, & + EddVisT8N11D3,EddVisT8N12D3,EddVisT8N13D3,EddVisT8N14D3,EddVisT8N15D3,EddVisT8N16D3,EddVisT8N17D3,EddVisT8N18D3,EddVisT8N19D3,EddVisT8N20D3, & + EddVisT8N01D4,EddVisT8N02D4,EddVisT8N03D4,EddVisT8N04D4,EddVisT8N05D4,EddVisT8N06D4,EddVisT8N07D4,EddVisT8N08D4,EddVisT8N09D4,EddVisT8N10D4, & + EddVisT8N11D4,EddVisT8N12D4,EddVisT8N13D4,EddVisT8N14D4,EddVisT8N15D4,EddVisT8N16D4,EddVisT8N17D4,EddVisT8N18D4,EddVisT8N19D4,EddVisT8N20D4, & + EddVisT8N01D5,EddVisT8N02D5,EddVisT8N03D5,EddVisT8N04D5,EddVisT8N05D5,EddVisT8N06D5,EddVisT8N07D5,EddVisT8N08D5,EddVisT8N09D5,EddVisT8N10D5, & + EddVisT8N11D5,EddVisT8N12D5,EddVisT8N13D5,EddVisT8N14D5,EddVisT8N15D5,EddVisT8N16D5,EddVisT8N17D5,EddVisT8N18D5,EddVisT8N19D5,EddVisT8N20D5, & + EddVisT8N01D6,EddVisT8N02D6,EddVisT8N03D6,EddVisT8N04D6,EddVisT8N05D6,EddVisT8N06D6,EddVisT8N07D6,EddVisT8N08D6,EddVisT8N09D6,EddVisT8N10D6, & + EddVisT8N11D6,EddVisT8N12D6,EddVisT8N13D6,EddVisT8N14D6,EddVisT8N15D6,EddVisT8N16D6,EddVisT8N17D6,EddVisT8N18D6,EddVisT8N19D6,EddVisT8N20D6, & + EddVisT8N01D7,EddVisT8N02D7,EddVisT8N03D7,EddVisT8N04D7,EddVisT8N05D7,EddVisT8N06D7,EddVisT8N07D7,EddVisT8N08D7,EddVisT8N09D7,EddVisT8N10D7, & + EddVisT8N11D7,EddVisT8N12D7,EddVisT8N13D7,EddVisT8N14D7,EddVisT8N15D7,EddVisT8N16D7,EddVisT8N17D7,EddVisT8N18D7,EddVisT8N19D7,EddVisT8N20D7, & + EddVisT8N01D8,EddVisT8N02D8,EddVisT8N03D8,EddVisT8N04D8,EddVisT8N05D8,EddVisT8N06D8,EddVisT8N07D8,EddVisT8N08D8,EddVisT8N09D8,EddVisT8N10D8, & + EddVisT8N11D8,EddVisT8N12D8,EddVisT8N13D8,EddVisT8N14D8,EddVisT8N15D8,EddVisT8N16D8,EddVisT8N17D8,EddVisT8N18D8,EddVisT8N19D8,EddVisT8N20D8, & + EddVisT8N01D9,EddVisT8N02D9,EddVisT8N03D9,EddVisT8N04D9,EddVisT8N05D9,EddVisT8N06D9,EddVisT8N07D9,EddVisT8N08D9,EddVisT8N09D9,EddVisT8N10D9, & + EddVisT8N11D9,EddVisT8N12D9,EddVisT8N13D9,EddVisT8N14D9,EddVisT8N15D9,EddVisT8N16D9,EddVisT8N17D9,EddVisT8N18D9,EddVisT8N19D9,EddVisT8N20D9/), (/20,9/) ) +EddVisTND(:,:,9) = RESHAPE( & + (/EddVisT9N01D1,EddVisT9N02D1,EddVisT9N03D1,EddVisT9N04D1,EddVisT9N05D1,EddVisT9N06D1,EddVisT9N07D1,EddVisT9N08D1,EddVisT9N09D1,EddVisT9N10D1, & + EddVisT9N11D1,EddVisT9N12D1,EddVisT9N13D1,EddVisT9N14D1,EddVisT9N15D1,EddVisT9N16D1,EddVisT9N17D1,EddVisT9N18D1,EddVisT9N19D1,EddVisT9N20D1, & + EddVisT9N01D2,EddVisT9N02D2,EddVisT9N03D2,EddVisT9N04D2,EddVisT9N05D2,EddVisT9N06D2,EddVisT9N07D2,EddVisT9N08D2,EddVisT9N09D2,EddVisT9N10D2, & + EddVisT9N11D2,EddVisT9N12D2,EddVisT9N13D2,EddVisT9N14D2,EddVisT9N15D2,EddVisT9N16D2,EddVisT9N17D2,EddVisT9N18D2,EddVisT9N19D2,EddVisT9N20D2, & + EddVisT9N01D3,EddVisT9N02D3,EddVisT9N03D3,EddVisT9N04D3,EddVisT9N05D3,EddVisT9N06D3,EddVisT9N07D3,EddVisT9N08D3,EddVisT9N09D3,EddVisT9N10D3, & + EddVisT9N11D3,EddVisT9N12D3,EddVisT9N13D3,EddVisT9N14D3,EddVisT9N15D3,EddVisT9N16D3,EddVisT9N17D3,EddVisT9N18D3,EddVisT9N19D3,EddVisT9N20D3, & + EddVisT9N01D4,EddVisT9N02D4,EddVisT9N03D4,EddVisT9N04D4,EddVisT9N05D4,EddVisT9N06D4,EddVisT9N07D4,EddVisT9N08D4,EddVisT9N09D4,EddVisT9N10D4, & + EddVisT9N11D4,EddVisT9N12D4,EddVisT9N13D4,EddVisT9N14D4,EddVisT9N15D4,EddVisT9N16D4,EddVisT9N17D4,EddVisT9N18D4,EddVisT9N19D4,EddVisT9N20D4, & + EddVisT9N01D5,EddVisT9N02D5,EddVisT9N03D5,EddVisT9N04D5,EddVisT9N05D5,EddVisT9N06D5,EddVisT9N07D5,EddVisT9N08D5,EddVisT9N09D5,EddVisT9N10D5, & + EddVisT9N11D5,EddVisT9N12D5,EddVisT9N13D5,EddVisT9N14D5,EddVisT9N15D5,EddVisT9N16D5,EddVisT9N17D5,EddVisT9N18D5,EddVisT9N19D5,EddVisT9N20D5, & + EddVisT9N01D6,EddVisT9N02D6,EddVisT9N03D6,EddVisT9N04D6,EddVisT9N05D6,EddVisT9N06D6,EddVisT9N07D6,EddVisT9N08D6,EddVisT9N09D6,EddVisT9N10D6, & + EddVisT9N11D6,EddVisT9N12D6,EddVisT9N13D6,EddVisT9N14D6,EddVisT9N15D6,EddVisT9N16D6,EddVisT9N17D6,EddVisT9N18D6,EddVisT9N19D6,EddVisT9N20D6, & + EddVisT9N01D7,EddVisT9N02D7,EddVisT9N03D7,EddVisT9N04D7,EddVisT9N05D7,EddVisT9N06D7,EddVisT9N07D7,EddVisT9N08D7,EddVisT9N09D7,EddVisT9N10D7, & + EddVisT9N11D7,EddVisT9N12D7,EddVisT9N13D7,EddVisT9N14D7,EddVisT9N15D7,EddVisT9N16D7,EddVisT9N17D7,EddVisT9N18D7,EddVisT9N19D7,EddVisT9N20D7, & + EddVisT9N01D8,EddVisT9N02D8,EddVisT9N03D8,EddVisT9N04D8,EddVisT9N05D8,EddVisT9N06D8,EddVisT9N07D8,EddVisT9N08D8,EddVisT9N09D8,EddVisT9N10D8, & + EddVisT9N11D8,EddVisT9N12D8,EddVisT9N13D8,EddVisT9N14D8,EddVisT9N15D8,EddVisT9N16D8,EddVisT9N17D8,EddVisT9N18D8,EddVisT9N19D8,EddVisT9N20D8, & + EddVisT9N01D9,EddVisT9N02D9,EddVisT9N03D9,EddVisT9N04D9,EddVisT9N05D9,EddVisT9N06D9,EddVisT9N07D9,EddVisT9N08D9,EddVisT9N09D9,EddVisT9N10D9, & + EddVisT9N11D9,EddVisT9N12D9,EddVisT9N13D9,EddVisT9N14D9,EddVisT9N15D9,EddVisT9N16D9,EddVisT9N17D9,EddVisT9N18D9,EddVisT9N19D9,EddVisT9N20D9/), (/20,9/) ) + + +EddAmbTND(:,:,1) = RESHAPE( & + (/EddAmbT1N01D1,EddAmbT1N02D1,EddAmbT1N03D1,EddAmbT1N04D1,EddAmbT1N05D1,EddAmbT1N06D1,EddAmbT1N07D1,EddAmbT1N08D1,EddAmbT1N09D1,EddAmbT1N10D1, & + EddAmbT1N11D1,EddAmbT1N12D1,EddAmbT1N13D1,EddAmbT1N14D1,EddAmbT1N15D1,EddAmbT1N16D1,EddAmbT1N17D1,EddAmbT1N18D1,EddAmbT1N19D1,EddAmbT1N20D1, & + EddAmbT1N01D2,EddAmbT1N02D2,EddAmbT1N03D2,EddAmbT1N04D2,EddAmbT1N05D2,EddAmbT1N06D2,EddAmbT1N07D2,EddAmbT1N08D2,EddAmbT1N09D2,EddAmbT1N10D2, & + EddAmbT1N11D2,EddAmbT1N12D2,EddAmbT1N13D2,EddAmbT1N14D2,EddAmbT1N15D2,EddAmbT1N16D2,EddAmbT1N17D2,EddAmbT1N18D2,EddAmbT1N19D2,EddAmbT1N20D2, & + EddAmbT1N01D3,EddAmbT1N02D3,EddAmbT1N03D3,EddAmbT1N04D3,EddAmbT1N05D3,EddAmbT1N06D3,EddAmbT1N07D3,EddAmbT1N08D3,EddAmbT1N09D3,EddAmbT1N10D3, & + EddAmbT1N11D3,EddAmbT1N12D3,EddAmbT1N13D3,EddAmbT1N14D3,EddAmbT1N15D3,EddAmbT1N16D3,EddAmbT1N17D3,EddAmbT1N18D3,EddAmbT1N19D3,EddAmbT1N20D3, & + EddAmbT1N01D4,EddAmbT1N02D4,EddAmbT1N03D4,EddAmbT1N04D4,EddAmbT1N05D4,EddAmbT1N06D4,EddAmbT1N07D4,EddAmbT1N08D4,EddAmbT1N09D4,EddAmbT1N10D4, & + EddAmbT1N11D4,EddAmbT1N12D4,EddAmbT1N13D4,EddAmbT1N14D4,EddAmbT1N15D4,EddAmbT1N16D4,EddAmbT1N17D4,EddAmbT1N18D4,EddAmbT1N19D4,EddAmbT1N20D4, & + EddAmbT1N01D5,EddAmbT1N02D5,EddAmbT1N03D5,EddAmbT1N04D5,EddAmbT1N05D5,EddAmbT1N06D5,EddAmbT1N07D5,EddAmbT1N08D5,EddAmbT1N09D5,EddAmbT1N10D5, & + EddAmbT1N11D5,EddAmbT1N12D5,EddAmbT1N13D5,EddAmbT1N14D5,EddAmbT1N15D5,EddAmbT1N16D5,EddAmbT1N17D5,EddAmbT1N18D5,EddAmbT1N19D5,EddAmbT1N20D5, & + EddAmbT1N01D6,EddAmbT1N02D6,EddAmbT1N03D6,EddAmbT1N04D6,EddAmbT1N05D6,EddAmbT1N06D6,EddAmbT1N07D6,EddAmbT1N08D6,EddAmbT1N09D6,EddAmbT1N10D6, & + EddAmbT1N11D6,EddAmbT1N12D6,EddAmbT1N13D6,EddAmbT1N14D6,EddAmbT1N15D6,EddAmbT1N16D6,EddAmbT1N17D6,EddAmbT1N18D6,EddAmbT1N19D6,EddAmbT1N20D6, & + EddAmbT1N01D7,EddAmbT1N02D7,EddAmbT1N03D7,EddAmbT1N04D7,EddAmbT1N05D7,EddAmbT1N06D7,EddAmbT1N07D7,EddAmbT1N08D7,EddAmbT1N09D7,EddAmbT1N10D7, & + EddAmbT1N11D7,EddAmbT1N12D7,EddAmbT1N13D7,EddAmbT1N14D7,EddAmbT1N15D7,EddAmbT1N16D7,EddAmbT1N17D7,EddAmbT1N18D7,EddAmbT1N19D7,EddAmbT1N20D7, & + EddAmbT1N01D8,EddAmbT1N02D8,EddAmbT1N03D8,EddAmbT1N04D8,EddAmbT1N05D8,EddAmbT1N06D8,EddAmbT1N07D8,EddAmbT1N08D8,EddAmbT1N09D8,EddAmbT1N10D8, & + EddAmbT1N11D8,EddAmbT1N12D8,EddAmbT1N13D8,EddAmbT1N14D8,EddAmbT1N15D8,EddAmbT1N16D8,EddAmbT1N17D8,EddAmbT1N18D8,EddAmbT1N19D8,EddAmbT1N20D8, & + EddAmbT1N01D9,EddAmbT1N02D9,EddAmbT1N03D9,EddAmbT1N04D9,EddAmbT1N05D9,EddAmbT1N06D9,EddAmbT1N07D9,EddAmbT1N08D9,EddAmbT1N09D9,EddAmbT1N10D9, & + EddAmbT1N11D9,EddAmbT1N12D9,EddAmbT1N13D9,EddAmbT1N14D9,EddAmbT1N15D9,EddAmbT1N16D9,EddAmbT1N17D9,EddAmbT1N18D9,EddAmbT1N19D9,EddAmbT1N20D9/), (/20,9/) ) +EddAmbTND(:,:,2) = RESHAPE( & + (/EddAmbT2N01D1,EddAmbT2N02D1,EddAmbT2N03D1,EddAmbT2N04D1,EddAmbT2N05D1,EddAmbT2N06D1,EddAmbT2N07D1,EddAmbT2N08D1,EddAmbT2N09D1,EddAmbT2N10D1, & + EddAmbT2N11D1,EddAmbT2N12D1,EddAmbT2N13D1,EddAmbT2N14D1,EddAmbT2N15D1,EddAmbT2N16D1,EddAmbT2N17D1,EddAmbT2N18D1,EddAmbT2N19D1,EddAmbT2N20D1, & + EddAmbT2N01D2,EddAmbT2N02D2,EddAmbT2N03D2,EddAmbT2N04D2,EddAmbT2N05D2,EddAmbT2N06D2,EddAmbT2N07D2,EddAmbT2N08D2,EddAmbT2N09D2,EddAmbT2N10D2, & + EddAmbT2N11D2,EddAmbT2N12D2,EddAmbT2N13D2,EddAmbT2N14D2,EddAmbT2N15D2,EddAmbT2N16D2,EddAmbT2N17D2,EddAmbT2N18D2,EddAmbT2N19D2,EddAmbT2N20D2, & + EddAmbT2N01D3,EddAmbT2N02D3,EddAmbT2N03D3,EddAmbT2N04D3,EddAmbT2N05D3,EddAmbT2N06D3,EddAmbT2N07D3,EddAmbT2N08D3,EddAmbT2N09D3,EddAmbT2N10D3, & + EddAmbT2N11D3,EddAmbT2N12D3,EddAmbT2N13D3,EddAmbT2N14D3,EddAmbT2N15D3,EddAmbT2N16D3,EddAmbT2N17D3,EddAmbT2N18D3,EddAmbT2N19D3,EddAmbT2N20D3, & + EddAmbT2N01D4,EddAmbT2N02D4,EddAmbT2N03D4,EddAmbT2N04D4,EddAmbT2N05D4,EddAmbT2N06D4,EddAmbT2N07D4,EddAmbT2N08D4,EddAmbT2N09D4,EddAmbT2N10D4, & + EddAmbT2N11D4,EddAmbT2N12D4,EddAmbT2N13D4,EddAmbT2N14D4,EddAmbT2N15D4,EddAmbT2N16D4,EddAmbT2N17D4,EddAmbT2N18D4,EddAmbT2N19D4,EddAmbT2N20D4, & + EddAmbT2N01D5,EddAmbT2N02D5,EddAmbT2N03D5,EddAmbT2N04D5,EddAmbT2N05D5,EddAmbT2N06D5,EddAmbT2N07D5,EddAmbT2N08D5,EddAmbT2N09D5,EddAmbT2N10D5, & + EddAmbT2N11D5,EddAmbT2N12D5,EddAmbT2N13D5,EddAmbT2N14D5,EddAmbT2N15D5,EddAmbT2N16D5,EddAmbT2N17D5,EddAmbT2N18D5,EddAmbT2N19D5,EddAmbT2N20D5, & + EddAmbT2N01D6,EddAmbT2N02D6,EddAmbT2N03D6,EddAmbT2N04D6,EddAmbT2N05D6,EddAmbT2N06D6,EddAmbT2N07D6,EddAmbT2N08D6,EddAmbT2N09D6,EddAmbT2N10D6, & + EddAmbT2N11D6,EddAmbT2N12D6,EddAmbT2N13D6,EddAmbT2N14D6,EddAmbT2N15D6,EddAmbT2N16D6,EddAmbT2N17D6,EddAmbT2N18D6,EddAmbT2N19D6,EddAmbT2N20D6, & + EddAmbT2N01D7,EddAmbT2N02D7,EddAmbT2N03D7,EddAmbT2N04D7,EddAmbT2N05D7,EddAmbT2N06D7,EddAmbT2N07D7,EddAmbT2N08D7,EddAmbT2N09D7,EddAmbT2N10D7, & + EddAmbT2N11D7,EddAmbT2N12D7,EddAmbT2N13D7,EddAmbT2N14D7,EddAmbT2N15D7,EddAmbT2N16D7,EddAmbT2N17D7,EddAmbT2N18D7,EddAmbT2N19D7,EddAmbT2N20D7, & + EddAmbT2N01D8,EddAmbT2N02D8,EddAmbT2N03D8,EddAmbT2N04D8,EddAmbT2N05D8,EddAmbT2N06D8,EddAmbT2N07D8,EddAmbT2N08D8,EddAmbT2N09D8,EddAmbT2N10D8, & + EddAmbT2N11D8,EddAmbT2N12D8,EddAmbT2N13D8,EddAmbT2N14D8,EddAmbT2N15D8,EddAmbT2N16D8,EddAmbT2N17D8,EddAmbT2N18D8,EddAmbT2N19D8,EddAmbT2N20D8, & + EddAmbT2N01D9,EddAmbT2N02D9,EddAmbT2N03D9,EddAmbT2N04D9,EddAmbT2N05D9,EddAmbT2N06D9,EddAmbT2N07D9,EddAmbT2N08D9,EddAmbT2N09D9,EddAmbT2N10D9, & + EddAmbT2N11D9,EddAmbT2N12D9,EddAmbT2N13D9,EddAmbT2N14D9,EddAmbT2N15D9,EddAmbT2N16D9,EddAmbT2N17D9,EddAmbT2N18D9,EddAmbT2N19D9,EddAmbT2N20D9/), (/20,9/) ) +EddAmbTND(:,:,3) = RESHAPE( & + (/EddAmbT3N01D1,EddAmbT3N02D1,EddAmbT3N03D1,EddAmbT3N04D1,EddAmbT3N05D1,EddAmbT3N06D1,EddAmbT3N07D1,EddAmbT3N08D1,EddAmbT3N09D1,EddAmbT3N10D1, & + EddAmbT3N11D1,EddAmbT3N12D1,EddAmbT3N13D1,EddAmbT3N14D1,EddAmbT3N15D1,EddAmbT3N16D1,EddAmbT3N17D1,EddAmbT3N18D1,EddAmbT3N19D1,EddAmbT3N20D1, & + EddAmbT3N01D2,EddAmbT3N02D2,EddAmbT3N03D2,EddAmbT3N04D2,EddAmbT3N05D2,EddAmbT3N06D2,EddAmbT3N07D2,EddAmbT3N08D2,EddAmbT3N09D2,EddAmbT3N10D2, & + EddAmbT3N11D2,EddAmbT3N12D2,EddAmbT3N13D2,EddAmbT3N14D2,EddAmbT3N15D2,EddAmbT3N16D2,EddAmbT3N17D2,EddAmbT3N18D2,EddAmbT3N19D2,EddAmbT3N20D2, & + EddAmbT3N01D3,EddAmbT3N02D3,EddAmbT3N03D3,EddAmbT3N04D3,EddAmbT3N05D3,EddAmbT3N06D3,EddAmbT3N07D3,EddAmbT3N08D3,EddAmbT3N09D3,EddAmbT3N10D3, & + EddAmbT3N11D3,EddAmbT3N12D3,EddAmbT3N13D3,EddAmbT3N14D3,EddAmbT3N15D3,EddAmbT3N16D3,EddAmbT3N17D3,EddAmbT3N18D3,EddAmbT3N19D3,EddAmbT3N20D3, & + EddAmbT3N01D4,EddAmbT3N02D4,EddAmbT3N03D4,EddAmbT3N04D4,EddAmbT3N05D4,EddAmbT3N06D4,EddAmbT3N07D4,EddAmbT3N08D4,EddAmbT3N09D4,EddAmbT3N10D4, & + EddAmbT3N11D4,EddAmbT3N12D4,EddAmbT3N13D4,EddAmbT3N14D4,EddAmbT3N15D4,EddAmbT3N16D4,EddAmbT3N17D4,EddAmbT3N18D4,EddAmbT3N19D4,EddAmbT3N20D4, & + EddAmbT3N01D5,EddAmbT3N02D5,EddAmbT3N03D5,EddAmbT3N04D5,EddAmbT3N05D5,EddAmbT3N06D5,EddAmbT3N07D5,EddAmbT3N08D5,EddAmbT3N09D5,EddAmbT3N10D5, & + EddAmbT3N11D5,EddAmbT3N12D5,EddAmbT3N13D5,EddAmbT3N14D5,EddAmbT3N15D5,EddAmbT3N16D5,EddAmbT3N17D5,EddAmbT3N18D5,EddAmbT3N19D5,EddAmbT3N20D5, & + EddAmbT3N01D6,EddAmbT3N02D6,EddAmbT3N03D6,EddAmbT3N04D6,EddAmbT3N05D6,EddAmbT3N06D6,EddAmbT3N07D6,EddAmbT3N08D6,EddAmbT3N09D6,EddAmbT3N10D6, & + EddAmbT3N11D6,EddAmbT3N12D6,EddAmbT3N13D6,EddAmbT3N14D6,EddAmbT3N15D6,EddAmbT3N16D6,EddAmbT3N17D6,EddAmbT3N18D6,EddAmbT3N19D6,EddAmbT3N20D6, & + EddAmbT3N01D7,EddAmbT3N02D7,EddAmbT3N03D7,EddAmbT3N04D7,EddAmbT3N05D7,EddAmbT3N06D7,EddAmbT3N07D7,EddAmbT3N08D7,EddAmbT3N09D7,EddAmbT3N10D7, & + EddAmbT3N11D7,EddAmbT3N12D7,EddAmbT3N13D7,EddAmbT3N14D7,EddAmbT3N15D7,EddAmbT3N16D7,EddAmbT3N17D7,EddAmbT3N18D7,EddAmbT3N19D7,EddAmbT3N20D7, & + EddAmbT3N01D8,EddAmbT3N02D8,EddAmbT3N03D8,EddAmbT3N04D8,EddAmbT3N05D8,EddAmbT3N06D8,EddAmbT3N07D8,EddAmbT3N08D8,EddAmbT3N09D8,EddAmbT3N10D8, & + EddAmbT3N11D8,EddAmbT3N12D8,EddAmbT3N13D8,EddAmbT3N14D8,EddAmbT3N15D8,EddAmbT3N16D8,EddAmbT3N17D8,EddAmbT3N18D8,EddAmbT3N19D8,EddAmbT3N20D8, & + EddAmbT3N01D9,EddAmbT3N02D9,EddAmbT3N03D9,EddAmbT3N04D9,EddAmbT3N05D9,EddAmbT3N06D9,EddAmbT3N07D9,EddAmbT3N08D9,EddAmbT3N09D9,EddAmbT3N10D9, & + EddAmbT3N11D9,EddAmbT3N12D9,EddAmbT3N13D9,EddAmbT3N14D9,EddAmbT3N15D9,EddAmbT3N16D9,EddAmbT3N17D9,EddAmbT3N18D9,EddAmbT3N19D9,EddAmbT3N20D9/), (/20,9/) ) +EddAmbTND(:,:,4) = RESHAPE( & + (/EddAmbT4N01D1,EddAmbT4N02D1,EddAmbT4N03D1,EddAmbT4N04D1,EddAmbT4N05D1,EddAmbT4N06D1,EddAmbT4N07D1,EddAmbT4N08D1,EddAmbT4N09D1,EddAmbT4N10D1, & + EddAmbT4N11D1,EddAmbT4N12D1,EddAmbT4N13D1,EddAmbT4N14D1,EddAmbT4N15D1,EddAmbT4N16D1,EddAmbT4N17D1,EddAmbT4N18D1,EddAmbT4N19D1,EddAmbT4N20D1, & + EddAmbT4N01D2,EddAmbT4N02D2,EddAmbT4N03D2,EddAmbT4N04D2,EddAmbT4N05D2,EddAmbT4N06D2,EddAmbT4N07D2,EddAmbT4N08D2,EddAmbT4N09D2,EddAmbT4N10D2, & + EddAmbT4N11D2,EddAmbT4N12D2,EddAmbT4N13D2,EddAmbT4N14D2,EddAmbT4N15D2,EddAmbT4N16D2,EddAmbT4N17D2,EddAmbT4N18D2,EddAmbT4N19D2,EddAmbT4N20D2, & + EddAmbT4N01D3,EddAmbT4N02D3,EddAmbT4N03D3,EddAmbT4N04D3,EddAmbT4N05D3,EddAmbT4N06D3,EddAmbT4N07D3,EddAmbT4N08D3,EddAmbT4N09D3,EddAmbT4N10D3, & + EddAmbT4N11D3,EddAmbT4N12D3,EddAmbT4N13D3,EddAmbT4N14D3,EddAmbT4N15D3,EddAmbT4N16D3,EddAmbT4N17D3,EddAmbT4N18D3,EddAmbT4N19D3,EddAmbT4N20D3, & + EddAmbT4N01D4,EddAmbT4N02D4,EddAmbT4N03D4,EddAmbT4N04D4,EddAmbT4N05D4,EddAmbT4N06D4,EddAmbT4N07D4,EddAmbT4N08D4,EddAmbT4N09D4,EddAmbT4N10D4, & + EddAmbT4N11D4,EddAmbT4N12D4,EddAmbT4N13D4,EddAmbT4N14D4,EddAmbT4N15D4,EddAmbT4N16D4,EddAmbT4N17D4,EddAmbT4N18D4,EddAmbT4N19D4,EddAmbT4N20D4, & + EddAmbT4N01D5,EddAmbT4N02D5,EddAmbT4N03D5,EddAmbT4N04D5,EddAmbT4N05D5,EddAmbT4N06D5,EddAmbT4N07D5,EddAmbT4N08D5,EddAmbT4N09D5,EddAmbT4N10D5, & + EddAmbT4N11D5,EddAmbT4N12D5,EddAmbT4N13D5,EddAmbT4N14D5,EddAmbT4N15D5,EddAmbT4N16D5,EddAmbT4N17D5,EddAmbT4N18D5,EddAmbT4N19D5,EddAmbT4N20D5, & + EddAmbT4N01D6,EddAmbT4N02D6,EddAmbT4N03D6,EddAmbT4N04D6,EddAmbT4N05D6,EddAmbT4N06D6,EddAmbT4N07D6,EddAmbT4N08D6,EddAmbT4N09D6,EddAmbT4N10D6, & + EddAmbT4N11D6,EddAmbT4N12D6,EddAmbT4N13D6,EddAmbT4N14D6,EddAmbT4N15D6,EddAmbT4N16D6,EddAmbT4N17D6,EddAmbT4N18D6,EddAmbT4N19D6,EddAmbT4N20D6, & + EddAmbT4N01D7,EddAmbT4N02D7,EddAmbT4N03D7,EddAmbT4N04D7,EddAmbT4N05D7,EddAmbT4N06D7,EddAmbT4N07D7,EddAmbT4N08D7,EddAmbT4N09D7,EddAmbT4N10D7, & + EddAmbT4N11D7,EddAmbT4N12D7,EddAmbT4N13D7,EddAmbT4N14D7,EddAmbT4N15D7,EddAmbT4N16D7,EddAmbT4N17D7,EddAmbT4N18D7,EddAmbT4N19D7,EddAmbT4N20D7, & + EddAmbT4N01D8,EddAmbT4N02D8,EddAmbT4N03D8,EddAmbT4N04D8,EddAmbT4N05D8,EddAmbT4N06D8,EddAmbT4N07D8,EddAmbT4N08D8,EddAmbT4N09D8,EddAmbT4N10D8, & + EddAmbT4N11D8,EddAmbT4N12D8,EddAmbT4N13D8,EddAmbT4N14D8,EddAmbT4N15D8,EddAmbT4N16D8,EddAmbT4N17D8,EddAmbT4N18D8,EddAmbT4N19D8,EddAmbT4N20D8, & + EddAmbT4N01D9,EddAmbT4N02D9,EddAmbT4N03D9,EddAmbT4N04D9,EddAmbT4N05D9,EddAmbT4N06D9,EddAmbT4N07D9,EddAmbT4N08D9,EddAmbT4N09D9,EddAmbT4N10D9, & + EddAmbT4N11D9,EddAmbT4N12D9,EddAmbT4N13D9,EddAmbT4N14D9,EddAmbT4N15D9,EddAmbT4N16D9,EddAmbT4N17D9,EddAmbT4N18D9,EddAmbT4N19D9,EddAmbT4N20D9/), (/20,9/) ) + +EddAmbTND(:,:,5) = RESHAPE( & + (/EddAmbT5N01D1,EddAmbT5N02D1,EddAmbT5N03D1,EddAmbT5N04D1,EddAmbT5N05D1,EddAmbT5N06D1,EddAmbT5N07D1,EddAmbT5N08D1,EddAmbT5N09D1,EddAmbT5N10D1, & + EddAmbT5N11D1,EddAmbT5N12D1,EddAmbT5N13D1,EddAmbT5N14D1,EddAmbT5N15D1,EddAmbT5N16D1,EddAmbT5N17D1,EddAmbT5N18D1,EddAmbT5N19D1,EddAmbT5N20D1, & + EddAmbT5N01D2,EddAmbT5N02D2,EddAmbT5N03D2,EddAmbT5N04D2,EddAmbT5N05D2,EddAmbT5N06D2,EddAmbT5N07D2,EddAmbT5N08D2,EddAmbT5N09D2,EddAmbT5N10D2, & + EddAmbT5N11D2,EddAmbT5N12D2,EddAmbT5N13D2,EddAmbT5N14D2,EddAmbT5N15D2,EddAmbT5N16D2,EddAmbT5N17D2,EddAmbT5N18D2,EddAmbT5N19D2,EddAmbT5N20D2, & + EddAmbT5N01D3,EddAmbT5N02D3,EddAmbT5N03D3,EddAmbT5N04D3,EddAmbT5N05D3,EddAmbT5N06D3,EddAmbT5N07D3,EddAmbT5N08D3,EddAmbT5N09D3,EddAmbT5N10D3, & + EddAmbT5N11D3,EddAmbT5N12D3,EddAmbT5N13D3,EddAmbT5N14D3,EddAmbT5N15D3,EddAmbT5N16D3,EddAmbT5N17D3,EddAmbT5N18D3,EddAmbT5N19D3,EddAmbT5N20D3, & + EddAmbT5N01D4,EddAmbT5N02D4,EddAmbT5N03D4,EddAmbT5N04D4,EddAmbT5N05D4,EddAmbT5N06D4,EddAmbT5N07D4,EddAmbT5N08D4,EddAmbT5N09D4,EddAmbT5N10D4, & + EddAmbT5N11D4,EddAmbT5N12D4,EddAmbT5N13D4,EddAmbT5N14D4,EddAmbT5N15D4,EddAmbT5N16D4,EddAmbT5N17D4,EddAmbT5N18D4,EddAmbT5N19D4,EddAmbT5N20D4, & + EddAmbT5N01D5,EddAmbT5N02D5,EddAmbT5N03D5,EddAmbT5N04D5,EddAmbT5N05D5,EddAmbT5N06D5,EddAmbT5N07D5,EddAmbT5N08D5,EddAmbT5N09D5,EddAmbT5N10D5, & + EddAmbT5N11D5,EddAmbT5N12D5,EddAmbT5N13D5,EddAmbT5N14D5,EddAmbT5N15D5,EddAmbT5N16D5,EddAmbT5N17D5,EddAmbT5N18D5,EddAmbT5N19D5,EddAmbT5N20D5, & + EddAmbT5N01D6,EddAmbT5N02D6,EddAmbT5N03D6,EddAmbT5N04D6,EddAmbT5N05D6,EddAmbT5N06D6,EddAmbT5N07D6,EddAmbT5N08D6,EddAmbT5N09D6,EddAmbT5N10D6, & + EddAmbT5N11D6,EddAmbT5N12D6,EddAmbT5N13D6,EddAmbT5N14D6,EddAmbT5N15D6,EddAmbT5N16D6,EddAmbT5N17D6,EddAmbT5N18D6,EddAmbT5N19D6,EddAmbT5N20D6, & + EddAmbT5N01D7,EddAmbT5N02D7,EddAmbT5N03D7,EddAmbT5N04D7,EddAmbT5N05D7,EddAmbT5N06D7,EddAmbT5N07D7,EddAmbT5N08D7,EddAmbT5N09D7,EddAmbT5N10D7, & + EddAmbT5N11D7,EddAmbT5N12D7,EddAmbT5N13D7,EddAmbT5N14D7,EddAmbT5N15D7,EddAmbT5N16D7,EddAmbT5N17D7,EddAmbT5N18D7,EddAmbT5N19D7,EddAmbT5N20D7, & + EddAmbT5N01D8,EddAmbT5N02D8,EddAmbT5N03D8,EddAmbT5N04D8,EddAmbT5N05D8,EddAmbT5N06D8,EddAmbT5N07D8,EddAmbT5N08D8,EddAmbT5N09D8,EddAmbT5N10D8, & + EddAmbT5N11D8,EddAmbT5N12D8,EddAmbT5N13D8,EddAmbT5N14D8,EddAmbT5N15D8,EddAmbT5N16D8,EddAmbT5N17D8,EddAmbT5N18D8,EddAmbT5N19D8,EddAmbT5N20D8, & + EddAmbT5N01D9,EddAmbT5N02D9,EddAmbT5N03D9,EddAmbT5N04D9,EddAmbT5N05D9,EddAmbT5N06D9,EddAmbT5N07D9,EddAmbT5N08D9,EddAmbT5N09D9,EddAmbT5N10D9, & + EddAmbT5N11D9,EddAmbT5N12D9,EddAmbT5N13D9,EddAmbT5N14D9,EddAmbT5N15D9,EddAmbT5N16D9,EddAmbT5N17D9,EddAmbT5N18D9,EddAmbT5N19D9,EddAmbT5N20D9/), (/20,9/) ) +EddAmbTND(:,:,6) = RESHAPE( & + (/EddAmbT6N01D1,EddAmbT6N02D1,EddAmbT6N03D1,EddAmbT6N04D1,EddAmbT6N05D1,EddAmbT6N06D1,EddAmbT6N07D1,EddAmbT6N08D1,EddAmbT6N09D1,EddAmbT6N10D1, & + EddAmbT6N11D1,EddAmbT6N12D1,EddAmbT6N13D1,EddAmbT6N14D1,EddAmbT6N15D1,EddAmbT6N16D1,EddAmbT6N17D1,EddAmbT6N18D1,EddAmbT6N19D1,EddAmbT6N20D1, & + EddAmbT6N01D2,EddAmbT6N02D2,EddAmbT6N03D2,EddAmbT6N04D2,EddAmbT6N05D2,EddAmbT6N06D2,EddAmbT6N07D2,EddAmbT6N08D2,EddAmbT6N09D2,EddAmbT6N10D2, & + EddAmbT6N11D2,EddAmbT6N12D2,EddAmbT6N13D2,EddAmbT6N14D2,EddAmbT6N15D2,EddAmbT6N16D2,EddAmbT6N17D2,EddAmbT6N18D2,EddAmbT6N19D2,EddAmbT6N20D2, & + EddAmbT6N01D3,EddAmbT6N02D3,EddAmbT6N03D3,EddAmbT6N04D3,EddAmbT6N05D3,EddAmbT6N06D3,EddAmbT6N07D3,EddAmbT6N08D3,EddAmbT6N09D3,EddAmbT6N10D3, & + EddAmbT6N11D3,EddAmbT6N12D3,EddAmbT6N13D3,EddAmbT6N14D3,EddAmbT6N15D3,EddAmbT6N16D3,EddAmbT6N17D3,EddAmbT6N18D3,EddAmbT6N19D3,EddAmbT6N20D3, & + EddAmbT6N01D4,EddAmbT6N02D4,EddAmbT6N03D4,EddAmbT6N04D4,EddAmbT6N05D4,EddAmbT6N06D4,EddAmbT6N07D4,EddAmbT6N08D4,EddAmbT6N09D4,EddAmbT6N10D4, & + EddAmbT6N11D4,EddAmbT6N12D4,EddAmbT6N13D4,EddAmbT6N14D4,EddAmbT6N15D4,EddAmbT6N16D4,EddAmbT6N17D4,EddAmbT6N18D4,EddAmbT6N19D4,EddAmbT6N20D4, & + EddAmbT6N01D5,EddAmbT6N02D5,EddAmbT6N03D5,EddAmbT6N04D5,EddAmbT6N05D5,EddAmbT6N06D5,EddAmbT6N07D5,EddAmbT6N08D5,EddAmbT6N09D5,EddAmbT6N10D5, & + EddAmbT6N11D5,EddAmbT6N12D5,EddAmbT6N13D5,EddAmbT6N14D5,EddAmbT6N15D5,EddAmbT6N16D5,EddAmbT6N17D5,EddAmbT6N18D5,EddAmbT6N19D5,EddAmbT6N20D5, & + EddAmbT6N01D6,EddAmbT6N02D6,EddAmbT6N03D6,EddAmbT6N04D6,EddAmbT6N05D6,EddAmbT6N06D6,EddAmbT6N07D6,EddAmbT6N08D6,EddAmbT6N09D6,EddAmbT6N10D6, & + EddAmbT6N11D6,EddAmbT6N12D6,EddAmbT6N13D6,EddAmbT6N14D6,EddAmbT6N15D6,EddAmbT6N16D6,EddAmbT6N17D6,EddAmbT6N18D6,EddAmbT6N19D6,EddAmbT6N20D6, & + EddAmbT6N01D7,EddAmbT6N02D7,EddAmbT6N03D7,EddAmbT6N04D7,EddAmbT6N05D7,EddAmbT6N06D7,EddAmbT6N07D7,EddAmbT6N08D7,EddAmbT6N09D7,EddAmbT6N10D7, & + EddAmbT6N11D7,EddAmbT6N12D7,EddAmbT6N13D7,EddAmbT6N14D7,EddAmbT6N15D7,EddAmbT6N16D7,EddAmbT6N17D7,EddAmbT6N18D7,EddAmbT6N19D7,EddAmbT6N20D7, & + EddAmbT6N01D8,EddAmbT6N02D8,EddAmbT6N03D8,EddAmbT6N04D8,EddAmbT6N05D8,EddAmbT6N06D8,EddAmbT6N07D8,EddAmbT6N08D8,EddAmbT6N09D8,EddAmbT6N10D8, & + EddAmbT6N11D8,EddAmbT6N12D8,EddAmbT6N13D8,EddAmbT6N14D8,EddAmbT6N15D8,EddAmbT6N16D8,EddAmbT6N17D8,EddAmbT6N18D8,EddAmbT6N19D8,EddAmbT6N20D8, & + EddAmbT6N01D9,EddAmbT6N02D9,EddAmbT6N03D9,EddAmbT6N04D9,EddAmbT6N05D9,EddAmbT6N06D9,EddAmbT6N07D9,EddAmbT6N08D9,EddAmbT6N09D9,EddAmbT6N10D9, & + EddAmbT6N11D9,EddAmbT6N12D9,EddAmbT6N13D9,EddAmbT6N14D9,EddAmbT6N15D9,EddAmbT6N16D9,EddAmbT6N17D9,EddAmbT6N18D9,EddAmbT6N19D9,EddAmbT6N20D9/), (/20,9/) ) +EddAmbTND(:,:,7) = RESHAPE( & + (/EddAmbT7N01D1,EddAmbT7N02D1,EddAmbT7N03D1,EddAmbT7N04D1,EddAmbT7N05D1,EddAmbT7N06D1,EddAmbT7N07D1,EddAmbT7N08D1,EddAmbT7N09D1,EddAmbT7N10D1, & + EddAmbT7N11D1,EddAmbT7N12D1,EddAmbT7N13D1,EddAmbT7N14D1,EddAmbT7N15D1,EddAmbT7N16D1,EddAmbT7N17D1,EddAmbT7N18D1,EddAmbT7N19D1,EddAmbT7N20D1, & + EddAmbT7N01D2,EddAmbT7N02D2,EddAmbT7N03D2,EddAmbT7N04D2,EddAmbT7N05D2,EddAmbT7N06D2,EddAmbT7N07D2,EddAmbT7N08D2,EddAmbT7N09D2,EddAmbT7N10D2, & + EddAmbT7N11D2,EddAmbT7N12D2,EddAmbT7N13D2,EddAmbT7N14D2,EddAmbT7N15D2,EddAmbT7N16D2,EddAmbT7N17D2,EddAmbT7N18D2,EddAmbT7N19D2,EddAmbT7N20D2, & + EddAmbT7N01D3,EddAmbT7N02D3,EddAmbT7N03D3,EddAmbT7N04D3,EddAmbT7N05D3,EddAmbT7N06D3,EddAmbT7N07D3,EddAmbT7N08D3,EddAmbT7N09D3,EddAmbT7N10D3, & + EddAmbT7N11D3,EddAmbT7N12D3,EddAmbT7N13D3,EddAmbT7N14D3,EddAmbT7N15D3,EddAmbT7N16D3,EddAmbT7N17D3,EddAmbT7N18D3,EddAmbT7N19D3,EddAmbT7N20D3, & + EddAmbT7N01D4,EddAmbT7N02D4,EddAmbT7N03D4,EddAmbT7N04D4,EddAmbT7N05D4,EddAmbT7N06D4,EddAmbT7N07D4,EddAmbT7N08D4,EddAmbT7N09D4,EddAmbT7N10D4, & + EddAmbT7N11D4,EddAmbT7N12D4,EddAmbT7N13D4,EddAmbT7N14D4,EddAmbT7N15D4,EddAmbT7N16D4,EddAmbT7N17D4,EddAmbT7N18D4,EddAmbT7N19D4,EddAmbT7N20D4, & + EddAmbT7N01D5,EddAmbT7N02D5,EddAmbT7N03D5,EddAmbT7N04D5,EddAmbT7N05D5,EddAmbT7N06D5,EddAmbT7N07D5,EddAmbT7N08D5,EddAmbT7N09D5,EddAmbT7N10D5, & + EddAmbT7N11D5,EddAmbT7N12D5,EddAmbT7N13D5,EddAmbT7N14D5,EddAmbT7N15D5,EddAmbT7N16D5,EddAmbT7N17D5,EddAmbT7N18D5,EddAmbT7N19D5,EddAmbT7N20D5, & + EddAmbT7N01D6,EddAmbT7N02D6,EddAmbT7N03D6,EddAmbT7N04D6,EddAmbT7N05D6,EddAmbT7N06D6,EddAmbT7N07D6,EddAmbT7N08D6,EddAmbT7N09D6,EddAmbT7N10D6, & + EddAmbT7N11D6,EddAmbT7N12D6,EddAmbT7N13D6,EddAmbT7N14D6,EddAmbT7N15D6,EddAmbT7N16D6,EddAmbT7N17D6,EddAmbT7N18D6,EddAmbT7N19D6,EddAmbT7N20D6, & + EddAmbT7N01D7,EddAmbT7N02D7,EddAmbT7N03D7,EddAmbT7N04D7,EddAmbT7N05D7,EddAmbT7N06D7,EddAmbT7N07D7,EddAmbT7N08D7,EddAmbT7N09D7,EddAmbT7N10D7, & + EddAmbT7N11D7,EddAmbT7N12D7,EddAmbT7N13D7,EddAmbT7N14D7,EddAmbT7N15D7,EddAmbT7N16D7,EddAmbT7N17D7,EddAmbT7N18D7,EddAmbT7N19D7,EddAmbT7N20D7, & + EddAmbT7N01D8,EddAmbT7N02D8,EddAmbT7N03D8,EddAmbT7N04D8,EddAmbT7N05D8,EddAmbT7N06D8,EddAmbT7N07D8,EddAmbT7N08D8,EddAmbT7N09D8,EddAmbT7N10D8, & + EddAmbT7N11D8,EddAmbT7N12D8,EddAmbT7N13D8,EddAmbT7N14D8,EddAmbT7N15D8,EddAmbT7N16D8,EddAmbT7N17D8,EddAmbT7N18D8,EddAmbT7N19D8,EddAmbT7N20D8, & + EddAmbT7N01D9,EddAmbT7N02D9,EddAmbT7N03D9,EddAmbT7N04D9,EddAmbT7N05D9,EddAmbT7N06D9,EddAmbT7N07D9,EddAmbT7N08D9,EddAmbT7N09D9,EddAmbT7N10D9, & + EddAmbT7N11D9,EddAmbT7N12D9,EddAmbT7N13D9,EddAmbT7N14D9,EddAmbT7N15D9,EddAmbT7N16D9,EddAmbT7N17D9,EddAmbT7N18D9,EddAmbT7N19D9,EddAmbT7N20D9/), (/20,9/) ) +EddAmbTND(:,:,8) = RESHAPE( & + (/EddAmbT8N01D1,EddAmbT8N02D1,EddAmbT8N03D1,EddAmbT8N04D1,EddAmbT8N05D1,EddAmbT8N06D1,EddAmbT8N07D1,EddAmbT8N08D1,EddAmbT8N09D1,EddAmbT8N10D1, & + EddAmbT8N11D1,EddAmbT8N12D1,EddAmbT8N13D1,EddAmbT8N14D1,EddAmbT8N15D1,EddAmbT8N16D1,EddAmbT8N17D1,EddAmbT8N18D1,EddAmbT8N19D1,EddAmbT8N20D1, & + EddAmbT8N01D2,EddAmbT8N02D2,EddAmbT8N03D2,EddAmbT8N04D2,EddAmbT8N05D2,EddAmbT8N06D2,EddAmbT8N07D2,EddAmbT8N08D2,EddAmbT8N09D2,EddAmbT8N10D2, & + EddAmbT8N11D2,EddAmbT8N12D2,EddAmbT8N13D2,EddAmbT8N14D2,EddAmbT8N15D2,EddAmbT8N16D2,EddAmbT8N17D2,EddAmbT8N18D2,EddAmbT8N19D2,EddAmbT8N20D2, & + EddAmbT8N01D3,EddAmbT8N02D3,EddAmbT8N03D3,EddAmbT8N04D3,EddAmbT8N05D3,EddAmbT8N06D3,EddAmbT8N07D3,EddAmbT8N08D3,EddAmbT8N09D3,EddAmbT8N10D3, & + EddAmbT8N11D3,EddAmbT8N12D3,EddAmbT8N13D3,EddAmbT8N14D3,EddAmbT8N15D3,EddAmbT8N16D3,EddAmbT8N17D3,EddAmbT8N18D3,EddAmbT8N19D3,EddAmbT8N20D3, & + EddAmbT8N01D4,EddAmbT8N02D4,EddAmbT8N03D4,EddAmbT8N04D4,EddAmbT8N05D4,EddAmbT8N06D4,EddAmbT8N07D4,EddAmbT8N08D4,EddAmbT8N09D4,EddAmbT8N10D4, & + EddAmbT8N11D4,EddAmbT8N12D4,EddAmbT8N13D4,EddAmbT8N14D4,EddAmbT8N15D4,EddAmbT8N16D4,EddAmbT8N17D4,EddAmbT8N18D4,EddAmbT8N19D4,EddAmbT8N20D4, & + EddAmbT8N01D5,EddAmbT8N02D5,EddAmbT8N03D5,EddAmbT8N04D5,EddAmbT8N05D5,EddAmbT8N06D5,EddAmbT8N07D5,EddAmbT8N08D5,EddAmbT8N09D5,EddAmbT8N10D5, & + EddAmbT8N11D5,EddAmbT8N12D5,EddAmbT8N13D5,EddAmbT8N14D5,EddAmbT8N15D5,EddAmbT8N16D5,EddAmbT8N17D5,EddAmbT8N18D5,EddAmbT8N19D5,EddAmbT8N20D5, & + EddAmbT8N01D6,EddAmbT8N02D6,EddAmbT8N03D6,EddAmbT8N04D6,EddAmbT8N05D6,EddAmbT8N06D6,EddAmbT8N07D6,EddAmbT8N08D6,EddAmbT8N09D6,EddAmbT8N10D6, & + EddAmbT8N11D6,EddAmbT8N12D6,EddAmbT8N13D6,EddAmbT8N14D6,EddAmbT8N15D6,EddAmbT8N16D6,EddAmbT8N17D6,EddAmbT8N18D6,EddAmbT8N19D6,EddAmbT8N20D6, & + EddAmbT8N01D7,EddAmbT8N02D7,EddAmbT8N03D7,EddAmbT8N04D7,EddAmbT8N05D7,EddAmbT8N06D7,EddAmbT8N07D7,EddAmbT8N08D7,EddAmbT8N09D7,EddAmbT8N10D7, & + EddAmbT8N11D7,EddAmbT8N12D7,EddAmbT8N13D7,EddAmbT8N14D7,EddAmbT8N15D7,EddAmbT8N16D7,EddAmbT8N17D7,EddAmbT8N18D7,EddAmbT8N19D7,EddAmbT8N20D7, & + EddAmbT8N01D8,EddAmbT8N02D8,EddAmbT8N03D8,EddAmbT8N04D8,EddAmbT8N05D8,EddAmbT8N06D8,EddAmbT8N07D8,EddAmbT8N08D8,EddAmbT8N09D8,EddAmbT8N10D8, & + EddAmbT8N11D8,EddAmbT8N12D8,EddAmbT8N13D8,EddAmbT8N14D8,EddAmbT8N15D8,EddAmbT8N16D8,EddAmbT8N17D8,EddAmbT8N18D8,EddAmbT8N19D8,EddAmbT8N20D8, & + EddAmbT8N01D9,EddAmbT8N02D9,EddAmbT8N03D9,EddAmbT8N04D9,EddAmbT8N05D9,EddAmbT8N06D9,EddAmbT8N07D9,EddAmbT8N08D9,EddAmbT8N09D9,EddAmbT8N10D9, & + EddAmbT8N11D9,EddAmbT8N12D9,EddAmbT8N13D9,EddAmbT8N14D9,EddAmbT8N15D9,EddAmbT8N16D9,EddAmbT8N17D9,EddAmbT8N18D9,EddAmbT8N19D9,EddAmbT8N20D9/), (/20,9/) ) +EddAmbTND(:,:,9) = RESHAPE( & + (/EddAmbT9N01D1,EddAmbT9N02D1,EddAmbT9N03D1,EddAmbT9N04D1,EddAmbT9N05D1,EddAmbT9N06D1,EddAmbT9N07D1,EddAmbT9N08D1,EddAmbT9N09D1,EddAmbT9N10D1, & + EddAmbT9N11D1,EddAmbT9N12D1,EddAmbT9N13D1,EddAmbT9N14D1,EddAmbT9N15D1,EddAmbT9N16D1,EddAmbT9N17D1,EddAmbT9N18D1,EddAmbT9N19D1,EddAmbT9N20D1, & + EddAmbT9N01D2,EddAmbT9N02D2,EddAmbT9N03D2,EddAmbT9N04D2,EddAmbT9N05D2,EddAmbT9N06D2,EddAmbT9N07D2,EddAmbT9N08D2,EddAmbT9N09D2,EddAmbT9N10D2, & + EddAmbT9N11D2,EddAmbT9N12D2,EddAmbT9N13D2,EddAmbT9N14D2,EddAmbT9N15D2,EddAmbT9N16D2,EddAmbT9N17D2,EddAmbT9N18D2,EddAmbT9N19D2,EddAmbT9N20D2, & + EddAmbT9N01D3,EddAmbT9N02D3,EddAmbT9N03D3,EddAmbT9N04D3,EddAmbT9N05D3,EddAmbT9N06D3,EddAmbT9N07D3,EddAmbT9N08D3,EddAmbT9N09D3,EddAmbT9N10D3, & + EddAmbT9N11D3,EddAmbT9N12D3,EddAmbT9N13D3,EddAmbT9N14D3,EddAmbT9N15D3,EddAmbT9N16D3,EddAmbT9N17D3,EddAmbT9N18D3,EddAmbT9N19D3,EddAmbT9N20D3, & + EddAmbT9N01D4,EddAmbT9N02D4,EddAmbT9N03D4,EddAmbT9N04D4,EddAmbT9N05D4,EddAmbT9N06D4,EddAmbT9N07D4,EddAmbT9N08D4,EddAmbT9N09D4,EddAmbT9N10D4, & + EddAmbT9N11D4,EddAmbT9N12D4,EddAmbT9N13D4,EddAmbT9N14D4,EddAmbT9N15D4,EddAmbT9N16D4,EddAmbT9N17D4,EddAmbT9N18D4,EddAmbT9N19D4,EddAmbT9N20D4, & + EddAmbT9N01D5,EddAmbT9N02D5,EddAmbT9N03D5,EddAmbT9N04D5,EddAmbT9N05D5,EddAmbT9N06D5,EddAmbT9N07D5,EddAmbT9N08D5,EddAmbT9N09D5,EddAmbT9N10D5, & + EddAmbT9N11D5,EddAmbT9N12D5,EddAmbT9N13D5,EddAmbT9N14D5,EddAmbT9N15D5,EddAmbT9N16D5,EddAmbT9N17D5,EddAmbT9N18D5,EddAmbT9N19D5,EddAmbT9N20D5, & + EddAmbT9N01D6,EddAmbT9N02D6,EddAmbT9N03D6,EddAmbT9N04D6,EddAmbT9N05D6,EddAmbT9N06D6,EddAmbT9N07D6,EddAmbT9N08D6,EddAmbT9N09D6,EddAmbT9N10D6, & + EddAmbT9N11D6,EddAmbT9N12D6,EddAmbT9N13D6,EddAmbT9N14D6,EddAmbT9N15D6,EddAmbT9N16D6,EddAmbT9N17D6,EddAmbT9N18D6,EddAmbT9N19D6,EddAmbT9N20D6, & + EddAmbT9N01D7,EddAmbT9N02D7,EddAmbT9N03D7,EddAmbT9N04D7,EddAmbT9N05D7,EddAmbT9N06D7,EddAmbT9N07D7,EddAmbT9N08D7,EddAmbT9N09D7,EddAmbT9N10D7, & + EddAmbT9N11D7,EddAmbT9N12D7,EddAmbT9N13D7,EddAmbT9N14D7,EddAmbT9N15D7,EddAmbT9N16D7,EddAmbT9N17D7,EddAmbT9N18D7,EddAmbT9N19D7,EddAmbT9N20D7, & + EddAmbT9N01D8,EddAmbT9N02D8,EddAmbT9N03D8,EddAmbT9N04D8,EddAmbT9N05D8,EddAmbT9N06D8,EddAmbT9N07D8,EddAmbT9N08D8,EddAmbT9N09D8,EddAmbT9N10D8, & + EddAmbT9N11D8,EddAmbT9N12D8,EddAmbT9N13D8,EddAmbT9N14D8,EddAmbT9N15D8,EddAmbT9N16D8,EddAmbT9N17D8,EddAmbT9N18D8,EddAmbT9N19D8,EddAmbT9N20D8, & + EddAmbT9N01D9,EddAmbT9N02D9,EddAmbT9N03D9,EddAmbT9N04D9,EddAmbT9N05D9,EddAmbT9N06D9,EddAmbT9N07D9,EddAmbT9N08D9,EddAmbT9N09D9,EddAmbT9N10D9, & + EddAmbT9N11D9,EddAmbT9N12D9,EddAmbT9N13D9,EddAmbT9N14D9,EddAmbT9N15D9,EddAmbT9N16D9,EddAmbT9N17D9,EddAmbT9N18D9,EddAmbT9N19D9,EddAmbT9N20D9/), (/20,9/) ) + + +EddShrTND(:,:,1) = RESHAPE( & + (/EddShrT1N01D1,EddShrT1N02D1,EddShrT1N03D1,EddShrT1N04D1,EddShrT1N05D1,EddShrT1N06D1,EddShrT1N07D1,EddShrT1N08D1,EddShrT1N09D1,EddShrT1N10D1, & + EddShrT1N11D1,EddShrT1N12D1,EddShrT1N13D1,EddShrT1N14D1,EddShrT1N15D1,EddShrT1N16D1,EddShrT1N17D1,EddShrT1N18D1,EddShrT1N19D1,EddShrT1N20D1, & + EddShrT1N01D2,EddShrT1N02D2,EddShrT1N03D2,EddShrT1N04D2,EddShrT1N05D2,EddShrT1N06D2,EddShrT1N07D2,EddShrT1N08D2,EddShrT1N09D2,EddShrT1N10D2, & + EddShrT1N11D2,EddShrT1N12D2,EddShrT1N13D2,EddShrT1N14D2,EddShrT1N15D2,EddShrT1N16D2,EddShrT1N17D2,EddShrT1N18D2,EddShrT1N19D2,EddShrT1N20D2, & + EddShrT1N01D3,EddShrT1N02D3,EddShrT1N03D3,EddShrT1N04D3,EddShrT1N05D3,EddShrT1N06D3,EddShrT1N07D3,EddShrT1N08D3,EddShrT1N09D3,EddShrT1N10D3, & + EddShrT1N11D3,EddShrT1N12D3,EddShrT1N13D3,EddShrT1N14D3,EddShrT1N15D3,EddShrT1N16D3,EddShrT1N17D3,EddShrT1N18D3,EddShrT1N19D3,EddShrT1N20D3, & + EddShrT1N01D4,EddShrT1N02D4,EddShrT1N03D4,EddShrT1N04D4,EddShrT1N05D4,EddShrT1N06D4,EddShrT1N07D4,EddShrT1N08D4,EddShrT1N09D4,EddShrT1N10D4, & + EddShrT1N11D4,EddShrT1N12D4,EddShrT1N13D4,EddShrT1N14D4,EddShrT1N15D4,EddShrT1N16D4,EddShrT1N17D4,EddShrT1N18D4,EddShrT1N19D4,EddShrT1N20D4, & + EddShrT1N01D5,EddShrT1N02D5,EddShrT1N03D5,EddShrT1N04D5,EddShrT1N05D5,EddShrT1N06D5,EddShrT1N07D5,EddShrT1N08D5,EddShrT1N09D5,EddShrT1N10D5, & + EddShrT1N11D5,EddShrT1N12D5,EddShrT1N13D5,EddShrT1N14D5,EddShrT1N15D5,EddShrT1N16D5,EddShrT1N17D5,EddShrT1N18D5,EddShrT1N19D5,EddShrT1N20D5, & + EddShrT1N01D6,EddShrT1N02D6,EddShrT1N03D6,EddShrT1N04D6,EddShrT1N05D6,EddShrT1N06D6,EddShrT1N07D6,EddShrT1N08D6,EddShrT1N09D6,EddShrT1N10D6, & + EddShrT1N11D6,EddShrT1N12D6,EddShrT1N13D6,EddShrT1N14D6,EddShrT1N15D6,EddShrT1N16D6,EddShrT1N17D6,EddShrT1N18D6,EddShrT1N19D6,EddShrT1N20D6, & + EddShrT1N01D7,EddShrT1N02D7,EddShrT1N03D7,EddShrT1N04D7,EddShrT1N05D7,EddShrT1N06D7,EddShrT1N07D7,EddShrT1N08D7,EddShrT1N09D7,EddShrT1N10D7, & + EddShrT1N11D7,EddShrT1N12D7,EddShrT1N13D7,EddShrT1N14D7,EddShrT1N15D7,EddShrT1N16D7,EddShrT1N17D7,EddShrT1N18D7,EddShrT1N19D7,EddShrT1N20D7, & + EddShrT1N01D8,EddShrT1N02D8,EddShrT1N03D8,EddShrT1N04D8,EddShrT1N05D8,EddShrT1N06D8,EddShrT1N07D8,EddShrT1N08D8,EddShrT1N09D8,EddShrT1N10D8, & + EddShrT1N11D8,EddShrT1N12D8,EddShrT1N13D8,EddShrT1N14D8,EddShrT1N15D8,EddShrT1N16D8,EddShrT1N17D8,EddShrT1N18D8,EddShrT1N19D8,EddShrT1N20D8, & + EddShrT1N01D9,EddShrT1N02D9,EddShrT1N03D9,EddShrT1N04D9,EddShrT1N05D9,EddShrT1N06D9,EddShrT1N07D9,EddShrT1N08D9,EddShrT1N09D9,EddShrT1N10D9, & + EddShrT1N11D9,EddShrT1N12D9,EddShrT1N13D9,EddShrT1N14D9,EddShrT1N15D9,EddShrT1N16D9,EddShrT1N17D9,EddShrT1N18D9,EddShrT1N19D9,EddShrT1N20D9/), (/20,9/) ) +EddShrTND(:,:,2) = RESHAPE( & + (/EddShrT2N01D1,EddShrT2N02D1,EddShrT2N03D1,EddShrT2N04D1,EddShrT2N05D1,EddShrT2N06D1,EddShrT2N07D1,EddShrT2N08D1,EddShrT2N09D1,EddShrT2N10D1, & + EddShrT2N11D1,EddShrT2N12D1,EddShrT2N13D1,EddShrT2N14D1,EddShrT2N15D1,EddShrT2N16D1,EddShrT2N17D1,EddShrT2N18D1,EddShrT2N19D1,EddShrT2N20D1, & + EddShrT2N01D2,EddShrT2N02D2,EddShrT2N03D2,EddShrT2N04D2,EddShrT2N05D2,EddShrT2N06D2,EddShrT2N07D2,EddShrT2N08D2,EddShrT2N09D2,EddShrT2N10D2, & + EddShrT2N11D2,EddShrT2N12D2,EddShrT2N13D2,EddShrT2N14D2,EddShrT2N15D2,EddShrT2N16D2,EddShrT2N17D2,EddShrT2N18D2,EddShrT2N19D2,EddShrT2N20D2, & + EddShrT2N01D3,EddShrT2N02D3,EddShrT2N03D3,EddShrT2N04D3,EddShrT2N05D3,EddShrT2N06D3,EddShrT2N07D3,EddShrT2N08D3,EddShrT2N09D3,EddShrT2N10D3, & + EddShrT2N11D3,EddShrT2N12D3,EddShrT2N13D3,EddShrT2N14D3,EddShrT2N15D3,EddShrT2N16D3,EddShrT2N17D3,EddShrT2N18D3,EddShrT2N19D3,EddShrT2N20D3, & + EddShrT2N01D4,EddShrT2N02D4,EddShrT2N03D4,EddShrT2N04D4,EddShrT2N05D4,EddShrT2N06D4,EddShrT2N07D4,EddShrT2N08D4,EddShrT2N09D4,EddShrT2N10D4, & + EddShrT2N11D4,EddShrT2N12D4,EddShrT2N13D4,EddShrT2N14D4,EddShrT2N15D4,EddShrT2N16D4,EddShrT2N17D4,EddShrT2N18D4,EddShrT2N19D4,EddShrT2N20D4, & + EddShrT2N01D5,EddShrT2N02D5,EddShrT2N03D5,EddShrT2N04D5,EddShrT2N05D5,EddShrT2N06D5,EddShrT2N07D5,EddShrT2N08D5,EddShrT2N09D5,EddShrT2N10D5, & + EddShrT2N11D5,EddShrT2N12D5,EddShrT2N13D5,EddShrT2N14D5,EddShrT2N15D5,EddShrT2N16D5,EddShrT2N17D5,EddShrT2N18D5,EddShrT2N19D5,EddShrT2N20D5, & + EddShrT2N01D6,EddShrT2N02D6,EddShrT2N03D6,EddShrT2N04D6,EddShrT2N05D6,EddShrT2N06D6,EddShrT2N07D6,EddShrT2N08D6,EddShrT2N09D6,EddShrT2N10D6, & + EddShrT2N11D6,EddShrT2N12D6,EddShrT2N13D6,EddShrT2N14D6,EddShrT2N15D6,EddShrT2N16D6,EddShrT2N17D6,EddShrT2N18D6,EddShrT2N19D6,EddShrT2N20D6, & + EddShrT2N01D7,EddShrT2N02D7,EddShrT2N03D7,EddShrT2N04D7,EddShrT2N05D7,EddShrT2N06D7,EddShrT2N07D7,EddShrT2N08D7,EddShrT2N09D7,EddShrT2N10D7, & + EddShrT2N11D7,EddShrT2N12D7,EddShrT2N13D7,EddShrT2N14D7,EddShrT2N15D7,EddShrT2N16D7,EddShrT2N17D7,EddShrT2N18D7,EddShrT2N19D7,EddShrT2N20D7, & + EddShrT2N01D8,EddShrT2N02D8,EddShrT2N03D8,EddShrT2N04D8,EddShrT2N05D8,EddShrT2N06D8,EddShrT2N07D8,EddShrT2N08D8,EddShrT2N09D8,EddShrT2N10D8, & + EddShrT2N11D8,EddShrT2N12D8,EddShrT2N13D8,EddShrT2N14D8,EddShrT2N15D8,EddShrT2N16D8,EddShrT2N17D8,EddShrT2N18D8,EddShrT2N19D8,EddShrT2N20D8, & + EddShrT2N01D9,EddShrT2N02D9,EddShrT2N03D9,EddShrT2N04D9,EddShrT2N05D9,EddShrT2N06D9,EddShrT2N07D9,EddShrT2N08D9,EddShrT2N09D9,EddShrT2N10D9, & + EddShrT2N11D9,EddShrT2N12D9,EddShrT2N13D9,EddShrT2N14D9,EddShrT2N15D9,EddShrT2N16D9,EddShrT2N17D9,EddShrT2N18D9,EddShrT2N19D9,EddShrT2N20D9/), (/20,9/) ) +EddShrTND(:,:,3) = RESHAPE( & + (/EddShrT3N01D1,EddShrT3N02D1,EddShrT3N03D1,EddShrT3N04D1,EddShrT3N05D1,EddShrT3N06D1,EddShrT3N07D1,EddShrT3N08D1,EddShrT3N09D1,EddShrT3N10D1, & + EddShrT3N11D1,EddShrT3N12D1,EddShrT3N13D1,EddShrT3N14D1,EddShrT3N15D1,EddShrT3N16D1,EddShrT3N17D1,EddShrT3N18D1,EddShrT3N19D1,EddShrT3N20D1, & + EddShrT3N01D2,EddShrT3N02D2,EddShrT3N03D2,EddShrT3N04D2,EddShrT3N05D2,EddShrT3N06D2,EddShrT3N07D2,EddShrT3N08D2,EddShrT3N09D2,EddShrT3N10D2, & + EddShrT3N11D2,EddShrT3N12D2,EddShrT3N13D2,EddShrT3N14D2,EddShrT3N15D2,EddShrT3N16D2,EddShrT3N17D2,EddShrT3N18D2,EddShrT3N19D2,EddShrT3N20D2, & + EddShrT3N01D3,EddShrT3N02D3,EddShrT3N03D3,EddShrT3N04D3,EddShrT3N05D3,EddShrT3N06D3,EddShrT3N07D3,EddShrT3N08D3,EddShrT3N09D3,EddShrT3N10D3, & + EddShrT3N11D3,EddShrT3N12D3,EddShrT3N13D3,EddShrT3N14D3,EddShrT3N15D3,EddShrT3N16D3,EddShrT3N17D3,EddShrT3N18D3,EddShrT3N19D3,EddShrT3N20D3, & + EddShrT3N01D4,EddShrT3N02D4,EddShrT3N03D4,EddShrT3N04D4,EddShrT3N05D4,EddShrT3N06D4,EddShrT3N07D4,EddShrT3N08D4,EddShrT3N09D4,EddShrT3N10D4, & + EddShrT3N11D4,EddShrT3N12D4,EddShrT3N13D4,EddShrT3N14D4,EddShrT3N15D4,EddShrT3N16D4,EddShrT3N17D4,EddShrT3N18D4,EddShrT3N19D4,EddShrT3N20D4, & + EddShrT3N01D5,EddShrT3N02D5,EddShrT3N03D5,EddShrT3N04D5,EddShrT3N05D5,EddShrT3N06D5,EddShrT3N07D5,EddShrT3N08D5,EddShrT3N09D5,EddShrT3N10D5, & + EddShrT3N11D5,EddShrT3N12D5,EddShrT3N13D5,EddShrT3N14D5,EddShrT3N15D5,EddShrT3N16D5,EddShrT3N17D5,EddShrT3N18D5,EddShrT3N19D5,EddShrT3N20D5, & + EddShrT3N01D6,EddShrT3N02D6,EddShrT3N03D6,EddShrT3N04D6,EddShrT3N05D6,EddShrT3N06D6,EddShrT3N07D6,EddShrT3N08D6,EddShrT3N09D6,EddShrT3N10D6, & + EddShrT3N11D6,EddShrT3N12D6,EddShrT3N13D6,EddShrT3N14D6,EddShrT3N15D6,EddShrT3N16D6,EddShrT3N17D6,EddShrT3N18D6,EddShrT3N19D6,EddShrT3N20D6, & + EddShrT3N01D7,EddShrT3N02D7,EddShrT3N03D7,EddShrT3N04D7,EddShrT3N05D7,EddShrT3N06D7,EddShrT3N07D7,EddShrT3N08D7,EddShrT3N09D7,EddShrT3N10D7, & + EddShrT3N11D7,EddShrT3N12D7,EddShrT3N13D7,EddShrT3N14D7,EddShrT3N15D7,EddShrT3N16D7,EddShrT3N17D7,EddShrT3N18D7,EddShrT3N19D7,EddShrT3N20D7, & + EddShrT3N01D8,EddShrT3N02D8,EddShrT3N03D8,EddShrT3N04D8,EddShrT3N05D8,EddShrT3N06D8,EddShrT3N07D8,EddShrT3N08D8,EddShrT3N09D8,EddShrT3N10D8, & + EddShrT3N11D8,EddShrT3N12D8,EddShrT3N13D8,EddShrT3N14D8,EddShrT3N15D8,EddShrT3N16D8,EddShrT3N17D8,EddShrT3N18D8,EddShrT3N19D8,EddShrT3N20D8, & + EddShrT3N01D9,EddShrT3N02D9,EddShrT3N03D9,EddShrT3N04D9,EddShrT3N05D9,EddShrT3N06D9,EddShrT3N07D9,EddShrT3N08D9,EddShrT3N09D9,EddShrT3N10D9, & + EddShrT3N11D9,EddShrT3N12D9,EddShrT3N13D9,EddShrT3N14D9,EddShrT3N15D9,EddShrT3N16D9,EddShrT3N17D9,EddShrT3N18D9,EddShrT3N19D9,EddShrT3N20D9/), (/20,9/) ) +EddShrTND(:,:,4) = RESHAPE( & + (/EddShrT4N01D1,EddShrT4N02D1,EddShrT4N03D1,EddShrT4N04D1,EddShrT4N05D1,EddShrT4N06D1,EddShrT4N07D1,EddShrT4N08D1,EddShrT4N09D1,EddShrT4N10D1, & + EddShrT4N11D1,EddShrT4N12D1,EddShrT4N13D1,EddShrT4N14D1,EddShrT4N15D1,EddShrT4N16D1,EddShrT4N17D1,EddShrT4N18D1,EddShrT4N19D1,EddShrT4N20D1, & + EddShrT4N01D2,EddShrT4N02D2,EddShrT4N03D2,EddShrT4N04D2,EddShrT4N05D2,EddShrT4N06D2,EddShrT4N07D2,EddShrT4N08D2,EddShrT4N09D2,EddShrT4N10D2, & + EddShrT4N11D2,EddShrT4N12D2,EddShrT4N13D2,EddShrT4N14D2,EddShrT4N15D2,EddShrT4N16D2,EddShrT4N17D2,EddShrT4N18D2,EddShrT4N19D2,EddShrT4N20D2, & + EddShrT4N01D3,EddShrT4N02D3,EddShrT4N03D3,EddShrT4N04D3,EddShrT4N05D3,EddShrT4N06D3,EddShrT4N07D3,EddShrT4N08D3,EddShrT4N09D3,EddShrT4N10D3, & + EddShrT4N11D3,EddShrT4N12D3,EddShrT4N13D3,EddShrT4N14D3,EddShrT4N15D3,EddShrT4N16D3,EddShrT4N17D3,EddShrT4N18D3,EddShrT4N19D3,EddShrT4N20D3, & + EddShrT4N01D4,EddShrT4N02D4,EddShrT4N03D4,EddShrT4N04D4,EddShrT4N05D4,EddShrT4N06D4,EddShrT4N07D4,EddShrT4N08D4,EddShrT4N09D4,EddShrT4N10D4, & + EddShrT4N11D4,EddShrT4N12D4,EddShrT4N13D4,EddShrT4N14D4,EddShrT4N15D4,EddShrT4N16D4,EddShrT4N17D4,EddShrT4N18D4,EddShrT4N19D4,EddShrT4N20D4, & + EddShrT4N01D5,EddShrT4N02D5,EddShrT4N03D5,EddShrT4N04D5,EddShrT4N05D5,EddShrT4N06D5,EddShrT4N07D5,EddShrT4N08D5,EddShrT4N09D5,EddShrT4N10D5, & + EddShrT4N11D5,EddShrT4N12D5,EddShrT4N13D5,EddShrT4N14D5,EddShrT4N15D5,EddShrT4N16D5,EddShrT4N17D5,EddShrT4N18D5,EddShrT4N19D5,EddShrT4N20D5, & + EddShrT4N01D6,EddShrT4N02D6,EddShrT4N03D6,EddShrT4N04D6,EddShrT4N05D6,EddShrT4N06D6,EddShrT4N07D6,EddShrT4N08D6,EddShrT4N09D6,EddShrT4N10D6, & + EddShrT4N11D6,EddShrT4N12D6,EddShrT4N13D6,EddShrT4N14D6,EddShrT4N15D6,EddShrT4N16D6,EddShrT4N17D6,EddShrT4N18D6,EddShrT4N19D6,EddShrT4N20D6, & + EddShrT4N01D7,EddShrT4N02D7,EddShrT4N03D7,EddShrT4N04D7,EddShrT4N05D7,EddShrT4N06D7,EddShrT4N07D7,EddShrT4N08D7,EddShrT4N09D7,EddShrT4N10D7, & + EddShrT4N11D7,EddShrT4N12D7,EddShrT4N13D7,EddShrT4N14D7,EddShrT4N15D7,EddShrT4N16D7,EddShrT4N17D7,EddShrT4N18D7,EddShrT4N19D7,EddShrT4N20D7, & + EddShrT4N01D8,EddShrT4N02D8,EddShrT4N03D8,EddShrT4N04D8,EddShrT4N05D8,EddShrT4N06D8,EddShrT4N07D8,EddShrT4N08D8,EddShrT4N09D8,EddShrT4N10D8, & + EddShrT4N11D8,EddShrT4N12D8,EddShrT4N13D8,EddShrT4N14D8,EddShrT4N15D8,EddShrT4N16D8,EddShrT4N17D8,EddShrT4N18D8,EddShrT4N19D8,EddShrT4N20D8, & + EddShrT4N01D9,EddShrT4N02D9,EddShrT4N03D9,EddShrT4N04D9,EddShrT4N05D9,EddShrT4N06D9,EddShrT4N07D9,EddShrT4N08D9,EddShrT4N09D9,EddShrT4N10D9, & + EddShrT4N11D9,EddShrT4N12D9,EddShrT4N13D9,EddShrT4N14D9,EddShrT4N15D9,EddShrT4N16D9,EddShrT4N17D9,EddShrT4N18D9,EddShrT4N19D9,EddShrT4N20D9/), (/20,9/) ) + +EddShrTND(:,:,5) = RESHAPE( & + (/EddShrT5N01D1,EddShrT5N02D1,EddShrT5N03D1,EddShrT5N04D1,EddShrT5N05D1,EddShrT5N06D1,EddShrT5N07D1,EddShrT5N08D1,EddShrT5N09D1,EddShrT5N10D1, & + EddShrT5N11D1,EddShrT5N12D1,EddShrT5N13D1,EddShrT5N14D1,EddShrT5N15D1,EddShrT5N16D1,EddShrT5N17D1,EddShrT5N18D1,EddShrT5N19D1,EddShrT5N20D1, & + EddShrT5N01D2,EddShrT5N02D2,EddShrT5N03D2,EddShrT5N04D2,EddShrT5N05D2,EddShrT5N06D2,EddShrT5N07D2,EddShrT5N08D2,EddShrT5N09D2,EddShrT5N10D2, & + EddShrT5N11D2,EddShrT5N12D2,EddShrT5N13D2,EddShrT5N14D2,EddShrT5N15D2,EddShrT5N16D2,EddShrT5N17D2,EddShrT5N18D2,EddShrT5N19D2,EddShrT5N20D2, & + EddShrT5N01D3,EddShrT5N02D3,EddShrT5N03D3,EddShrT5N04D3,EddShrT5N05D3,EddShrT5N06D3,EddShrT5N07D3,EddShrT5N08D3,EddShrT5N09D3,EddShrT5N10D3, & + EddShrT5N11D3,EddShrT5N12D3,EddShrT5N13D3,EddShrT5N14D3,EddShrT5N15D3,EddShrT5N16D3,EddShrT5N17D3,EddShrT5N18D3,EddShrT5N19D3,EddShrT5N20D3, & + EddShrT5N01D4,EddShrT5N02D4,EddShrT5N03D4,EddShrT5N04D4,EddShrT5N05D4,EddShrT5N06D4,EddShrT5N07D4,EddShrT5N08D4,EddShrT5N09D4,EddShrT5N10D4, & + EddShrT5N11D4,EddShrT5N12D4,EddShrT5N13D4,EddShrT5N14D4,EddShrT5N15D4,EddShrT5N16D4,EddShrT5N17D4,EddShrT5N18D4,EddShrT5N19D4,EddShrT5N20D4, & + EddShrT5N01D5,EddShrT5N02D5,EddShrT5N03D5,EddShrT5N04D5,EddShrT5N05D5,EddShrT5N06D5,EddShrT5N07D5,EddShrT5N08D5,EddShrT5N09D5,EddShrT5N10D5, & + EddShrT5N11D5,EddShrT5N12D5,EddShrT5N13D5,EddShrT5N14D5,EddShrT5N15D5,EddShrT5N16D5,EddShrT5N17D5,EddShrT5N18D5,EddShrT5N19D5,EddShrT5N20D5, & + EddShrT5N01D6,EddShrT5N02D6,EddShrT5N03D6,EddShrT5N04D6,EddShrT5N05D6,EddShrT5N06D6,EddShrT5N07D6,EddShrT5N08D6,EddShrT5N09D6,EddShrT5N10D6, & + EddShrT5N11D6,EddShrT5N12D6,EddShrT5N13D6,EddShrT5N14D6,EddShrT5N15D6,EddShrT5N16D6,EddShrT5N17D6,EddShrT5N18D6,EddShrT5N19D6,EddShrT5N20D6, & + EddShrT5N01D7,EddShrT5N02D7,EddShrT5N03D7,EddShrT5N04D7,EddShrT5N05D7,EddShrT5N06D7,EddShrT5N07D7,EddShrT5N08D7,EddShrT5N09D7,EddShrT5N10D7, & + EddShrT5N11D7,EddShrT5N12D7,EddShrT5N13D7,EddShrT5N14D7,EddShrT5N15D7,EddShrT5N16D7,EddShrT5N17D7,EddShrT5N18D7,EddShrT5N19D7,EddShrT5N20D7, & + EddShrT5N01D8,EddShrT5N02D8,EddShrT5N03D8,EddShrT5N04D8,EddShrT5N05D8,EddShrT5N06D8,EddShrT5N07D8,EddShrT5N08D8,EddShrT5N09D8,EddShrT5N10D8, & + EddShrT5N11D8,EddShrT5N12D8,EddShrT5N13D8,EddShrT5N14D8,EddShrT5N15D8,EddShrT5N16D8,EddShrT5N17D8,EddShrT5N18D8,EddShrT5N19D8,EddShrT5N20D8, & + EddShrT5N01D9,EddShrT5N02D9,EddShrT5N03D9,EddShrT5N04D9,EddShrT5N05D9,EddShrT5N06D9,EddShrT5N07D9,EddShrT5N08D9,EddShrT5N09D9,EddShrT5N10D9, & + EddShrT5N11D9,EddShrT5N12D9,EddShrT5N13D9,EddShrT5N14D9,EddShrT5N15D9,EddShrT5N16D9,EddShrT5N17D9,EddShrT5N18D9,EddShrT5N19D9,EddShrT5N20D9/), (/20,9/) ) +EddShrTND(:,:,6) = RESHAPE( & + (/EddShrT6N01D1,EddShrT6N02D1,EddShrT6N03D1,EddShrT6N04D1,EddShrT6N05D1,EddShrT6N06D1,EddShrT6N07D1,EddShrT6N08D1,EddShrT6N09D1,EddShrT6N10D1, & + EddShrT6N11D1,EddShrT6N12D1,EddShrT6N13D1,EddShrT6N14D1,EddShrT6N15D1,EddShrT6N16D1,EddShrT6N17D1,EddShrT6N18D1,EddShrT6N19D1,EddShrT6N20D1, & + EddShrT6N01D2,EddShrT6N02D2,EddShrT6N03D2,EddShrT6N04D2,EddShrT6N05D2,EddShrT6N06D2,EddShrT6N07D2,EddShrT6N08D2,EddShrT6N09D2,EddShrT6N10D2, & + EddShrT6N11D2,EddShrT6N12D2,EddShrT6N13D2,EddShrT6N14D2,EddShrT6N15D2,EddShrT6N16D2,EddShrT6N17D2,EddShrT6N18D2,EddShrT6N19D2,EddShrT6N20D2, & + EddShrT6N01D3,EddShrT6N02D3,EddShrT6N03D3,EddShrT6N04D3,EddShrT6N05D3,EddShrT6N06D3,EddShrT6N07D3,EddShrT6N08D3,EddShrT6N09D3,EddShrT6N10D3, & + EddShrT6N11D3,EddShrT6N12D3,EddShrT6N13D3,EddShrT6N14D3,EddShrT6N15D3,EddShrT6N16D3,EddShrT6N17D3,EddShrT6N18D3,EddShrT6N19D3,EddShrT6N20D3, & + EddShrT6N01D4,EddShrT6N02D4,EddShrT6N03D4,EddShrT6N04D4,EddShrT6N05D4,EddShrT6N06D4,EddShrT6N07D4,EddShrT6N08D4,EddShrT6N09D4,EddShrT6N10D4, & + EddShrT6N11D4,EddShrT6N12D4,EddShrT6N13D4,EddShrT6N14D4,EddShrT6N15D4,EddShrT6N16D4,EddShrT6N17D4,EddShrT6N18D4,EddShrT6N19D4,EddShrT6N20D4, & + EddShrT6N01D5,EddShrT6N02D5,EddShrT6N03D5,EddShrT6N04D5,EddShrT6N05D5,EddShrT6N06D5,EddShrT6N07D5,EddShrT6N08D5,EddShrT6N09D5,EddShrT6N10D5, & + EddShrT6N11D5,EddShrT6N12D5,EddShrT6N13D5,EddShrT6N14D5,EddShrT6N15D5,EddShrT6N16D5,EddShrT6N17D5,EddShrT6N18D5,EddShrT6N19D5,EddShrT6N20D5, & + EddShrT6N01D6,EddShrT6N02D6,EddShrT6N03D6,EddShrT6N04D6,EddShrT6N05D6,EddShrT6N06D6,EddShrT6N07D6,EddShrT6N08D6,EddShrT6N09D6,EddShrT6N10D6, & + EddShrT6N11D6,EddShrT6N12D6,EddShrT6N13D6,EddShrT6N14D6,EddShrT6N15D6,EddShrT6N16D6,EddShrT6N17D6,EddShrT6N18D6,EddShrT6N19D6,EddShrT6N20D6, & + EddShrT6N01D7,EddShrT6N02D7,EddShrT6N03D7,EddShrT6N04D7,EddShrT6N05D7,EddShrT6N06D7,EddShrT6N07D7,EddShrT6N08D7,EddShrT6N09D7,EddShrT6N10D7, & + EddShrT6N11D7,EddShrT6N12D7,EddShrT6N13D7,EddShrT6N14D7,EddShrT6N15D7,EddShrT6N16D7,EddShrT6N17D7,EddShrT6N18D7,EddShrT6N19D7,EddShrT6N20D7, & + EddShrT6N01D8,EddShrT6N02D8,EddShrT6N03D8,EddShrT6N04D8,EddShrT6N05D8,EddShrT6N06D8,EddShrT6N07D8,EddShrT6N08D8,EddShrT6N09D8,EddShrT6N10D8, & + EddShrT6N11D8,EddShrT6N12D8,EddShrT6N13D8,EddShrT6N14D8,EddShrT6N15D8,EddShrT6N16D8,EddShrT6N17D8,EddShrT6N18D8,EddShrT6N19D8,EddShrT6N20D8, & + EddShrT6N01D9,EddShrT6N02D9,EddShrT6N03D9,EddShrT6N04D9,EddShrT6N05D9,EddShrT6N06D9,EddShrT6N07D9,EddShrT6N08D9,EddShrT6N09D9,EddShrT6N10D9, & + EddShrT6N11D9,EddShrT6N12D9,EddShrT6N13D9,EddShrT6N14D9,EddShrT6N15D9,EddShrT6N16D9,EddShrT6N17D9,EddShrT6N18D9,EddShrT6N19D9,EddShrT6N20D9/), (/20,9/) ) +EddShrTND(:,:,7) = RESHAPE( & + (/EddShrT7N01D1,EddShrT7N02D1,EddShrT7N03D1,EddShrT7N04D1,EddShrT7N05D1,EddShrT7N06D1,EddShrT7N07D1,EddShrT7N08D1,EddShrT7N09D1,EddShrT7N10D1, & + EddShrT7N11D1,EddShrT7N12D1,EddShrT7N13D1,EddShrT7N14D1,EddShrT7N15D1,EddShrT7N16D1,EddShrT7N17D1,EddShrT7N18D1,EddShrT7N19D1,EddShrT7N20D1, & + EddShrT7N01D2,EddShrT7N02D2,EddShrT7N03D2,EddShrT7N04D2,EddShrT7N05D2,EddShrT7N06D2,EddShrT7N07D2,EddShrT7N08D2,EddShrT7N09D2,EddShrT7N10D2, & + EddShrT7N11D2,EddShrT7N12D2,EddShrT7N13D2,EddShrT7N14D2,EddShrT7N15D2,EddShrT7N16D2,EddShrT7N17D2,EddShrT7N18D2,EddShrT7N19D2,EddShrT7N20D2, & + EddShrT7N01D3,EddShrT7N02D3,EddShrT7N03D3,EddShrT7N04D3,EddShrT7N05D3,EddShrT7N06D3,EddShrT7N07D3,EddShrT7N08D3,EddShrT7N09D3,EddShrT7N10D3, & + EddShrT7N11D3,EddShrT7N12D3,EddShrT7N13D3,EddShrT7N14D3,EddShrT7N15D3,EddShrT7N16D3,EddShrT7N17D3,EddShrT7N18D3,EddShrT7N19D3,EddShrT7N20D3, & + EddShrT7N01D4,EddShrT7N02D4,EddShrT7N03D4,EddShrT7N04D4,EddShrT7N05D4,EddShrT7N06D4,EddShrT7N07D4,EddShrT7N08D4,EddShrT7N09D4,EddShrT7N10D4, & + EddShrT7N11D4,EddShrT7N12D4,EddShrT7N13D4,EddShrT7N14D4,EddShrT7N15D4,EddShrT7N16D4,EddShrT7N17D4,EddShrT7N18D4,EddShrT7N19D4,EddShrT7N20D4, & + EddShrT7N01D5,EddShrT7N02D5,EddShrT7N03D5,EddShrT7N04D5,EddShrT7N05D5,EddShrT7N06D5,EddShrT7N07D5,EddShrT7N08D5,EddShrT7N09D5,EddShrT7N10D5, & + EddShrT7N11D5,EddShrT7N12D5,EddShrT7N13D5,EddShrT7N14D5,EddShrT7N15D5,EddShrT7N16D5,EddShrT7N17D5,EddShrT7N18D5,EddShrT7N19D5,EddShrT7N20D5, & + EddShrT7N01D6,EddShrT7N02D6,EddShrT7N03D6,EddShrT7N04D6,EddShrT7N05D6,EddShrT7N06D6,EddShrT7N07D6,EddShrT7N08D6,EddShrT7N09D6,EddShrT7N10D6, & + EddShrT7N11D6,EddShrT7N12D6,EddShrT7N13D6,EddShrT7N14D6,EddShrT7N15D6,EddShrT7N16D6,EddShrT7N17D6,EddShrT7N18D6,EddShrT7N19D6,EddShrT7N20D6, & + EddShrT7N01D7,EddShrT7N02D7,EddShrT7N03D7,EddShrT7N04D7,EddShrT7N05D7,EddShrT7N06D7,EddShrT7N07D7,EddShrT7N08D7,EddShrT7N09D7,EddShrT7N10D7, & + EddShrT7N11D7,EddShrT7N12D7,EddShrT7N13D7,EddShrT7N14D7,EddShrT7N15D7,EddShrT7N16D7,EddShrT7N17D7,EddShrT7N18D7,EddShrT7N19D7,EddShrT7N20D7, & + EddShrT7N01D8,EddShrT7N02D8,EddShrT7N03D8,EddShrT7N04D8,EddShrT7N05D8,EddShrT7N06D8,EddShrT7N07D8,EddShrT7N08D8,EddShrT7N09D8,EddShrT7N10D8, & + EddShrT7N11D8,EddShrT7N12D8,EddShrT7N13D8,EddShrT7N14D8,EddShrT7N15D8,EddShrT7N16D8,EddShrT7N17D8,EddShrT7N18D8,EddShrT7N19D8,EddShrT7N20D8, & + EddShrT7N01D9,EddShrT7N02D9,EddShrT7N03D9,EddShrT7N04D9,EddShrT7N05D9,EddShrT7N06D9,EddShrT7N07D9,EddShrT7N08D9,EddShrT7N09D9,EddShrT7N10D9, & + EddShrT7N11D9,EddShrT7N12D9,EddShrT7N13D9,EddShrT7N14D9,EddShrT7N15D9,EddShrT7N16D9,EddShrT7N17D9,EddShrT7N18D9,EddShrT7N19D9,EddShrT7N20D9/), (/20,9/) ) +EddShrTND(:,:,8) = RESHAPE( & + (/EddShrT8N01D1,EddShrT8N02D1,EddShrT8N03D1,EddShrT8N04D1,EddShrT8N05D1,EddShrT8N06D1,EddShrT8N07D1,EddShrT8N08D1,EddShrT8N09D1,EddShrT8N10D1, & + EddShrT8N11D1,EddShrT8N12D1,EddShrT8N13D1,EddShrT8N14D1,EddShrT8N15D1,EddShrT8N16D1,EddShrT8N17D1,EddShrT8N18D1,EddShrT8N19D1,EddShrT8N20D1, & + EddShrT8N01D2,EddShrT8N02D2,EddShrT8N03D2,EddShrT8N04D2,EddShrT8N05D2,EddShrT8N06D2,EddShrT8N07D2,EddShrT8N08D2,EddShrT8N09D2,EddShrT8N10D2, & + EddShrT8N11D2,EddShrT8N12D2,EddShrT8N13D2,EddShrT8N14D2,EddShrT8N15D2,EddShrT8N16D2,EddShrT8N17D2,EddShrT8N18D2,EddShrT8N19D2,EddShrT8N20D2, & + EddShrT8N01D3,EddShrT8N02D3,EddShrT8N03D3,EddShrT8N04D3,EddShrT8N05D3,EddShrT8N06D3,EddShrT8N07D3,EddShrT8N08D3,EddShrT8N09D3,EddShrT8N10D3, & + EddShrT8N11D3,EddShrT8N12D3,EddShrT8N13D3,EddShrT8N14D3,EddShrT8N15D3,EddShrT8N16D3,EddShrT8N17D3,EddShrT8N18D3,EddShrT8N19D3,EddShrT8N20D3, & + EddShrT8N01D4,EddShrT8N02D4,EddShrT8N03D4,EddShrT8N04D4,EddShrT8N05D4,EddShrT8N06D4,EddShrT8N07D4,EddShrT8N08D4,EddShrT8N09D4,EddShrT8N10D4, & + EddShrT8N11D4,EddShrT8N12D4,EddShrT8N13D4,EddShrT8N14D4,EddShrT8N15D4,EddShrT8N16D4,EddShrT8N17D4,EddShrT8N18D4,EddShrT8N19D4,EddShrT8N20D4, & + EddShrT8N01D5,EddShrT8N02D5,EddShrT8N03D5,EddShrT8N04D5,EddShrT8N05D5,EddShrT8N06D5,EddShrT8N07D5,EddShrT8N08D5,EddShrT8N09D5,EddShrT8N10D5, & + EddShrT8N11D5,EddShrT8N12D5,EddShrT8N13D5,EddShrT8N14D5,EddShrT8N15D5,EddShrT8N16D5,EddShrT8N17D5,EddShrT8N18D5,EddShrT8N19D5,EddShrT8N20D5, & + EddShrT8N01D6,EddShrT8N02D6,EddShrT8N03D6,EddShrT8N04D6,EddShrT8N05D6,EddShrT8N06D6,EddShrT8N07D6,EddShrT8N08D6,EddShrT8N09D6,EddShrT8N10D6, & + EddShrT8N11D6,EddShrT8N12D6,EddShrT8N13D6,EddShrT8N14D6,EddShrT8N15D6,EddShrT8N16D6,EddShrT8N17D6,EddShrT8N18D6,EddShrT8N19D6,EddShrT8N20D6, & + EddShrT8N01D7,EddShrT8N02D7,EddShrT8N03D7,EddShrT8N04D7,EddShrT8N05D7,EddShrT8N06D7,EddShrT8N07D7,EddShrT8N08D7,EddShrT8N09D7,EddShrT8N10D7, & + EddShrT8N11D7,EddShrT8N12D7,EddShrT8N13D7,EddShrT8N14D7,EddShrT8N15D7,EddShrT8N16D7,EddShrT8N17D7,EddShrT8N18D7,EddShrT8N19D7,EddShrT8N20D7, & + EddShrT8N01D8,EddShrT8N02D8,EddShrT8N03D8,EddShrT8N04D8,EddShrT8N05D8,EddShrT8N06D8,EddShrT8N07D8,EddShrT8N08D8,EddShrT8N09D8,EddShrT8N10D8, & + EddShrT8N11D8,EddShrT8N12D8,EddShrT8N13D8,EddShrT8N14D8,EddShrT8N15D8,EddShrT8N16D8,EddShrT8N17D8,EddShrT8N18D8,EddShrT8N19D8,EddShrT8N20D8, & + EddShrT8N01D9,EddShrT8N02D9,EddShrT8N03D9,EddShrT8N04D9,EddShrT8N05D9,EddShrT8N06D9,EddShrT8N07D9,EddShrT8N08D9,EddShrT8N09D9,EddShrT8N10D9, & + EddShrT8N11D9,EddShrT8N12D9,EddShrT8N13D9,EddShrT8N14D9,EddShrT8N15D9,EddShrT8N16D9,EddShrT8N17D9,EddShrT8N18D9,EddShrT8N19D9,EddShrT8N20D9/), (/20,9/) ) +EddShrTND(:,:,9) = RESHAPE( & + (/EddShrT9N01D1,EddShrT9N02D1,EddShrT9N03D1,EddShrT9N04D1,EddShrT9N05D1,EddShrT9N06D1,EddShrT9N07D1,EddShrT9N08D1,EddShrT9N09D1,EddShrT9N10D1, & + EddShrT9N11D1,EddShrT9N12D1,EddShrT9N13D1,EddShrT9N14D1,EddShrT9N15D1,EddShrT9N16D1,EddShrT9N17D1,EddShrT9N18D1,EddShrT9N19D1,EddShrT9N20D1, & + EddShrT9N01D2,EddShrT9N02D2,EddShrT9N03D2,EddShrT9N04D2,EddShrT9N05D2,EddShrT9N06D2,EddShrT9N07D2,EddShrT9N08D2,EddShrT9N09D2,EddShrT9N10D2, & + EddShrT9N11D2,EddShrT9N12D2,EddShrT9N13D2,EddShrT9N14D2,EddShrT9N15D2,EddShrT9N16D2,EddShrT9N17D2,EddShrT9N18D2,EddShrT9N19D2,EddShrT9N20D2, & + EddShrT9N01D3,EddShrT9N02D3,EddShrT9N03D3,EddShrT9N04D3,EddShrT9N05D3,EddShrT9N06D3,EddShrT9N07D3,EddShrT9N08D3,EddShrT9N09D3,EddShrT9N10D3, & + EddShrT9N11D3,EddShrT9N12D3,EddShrT9N13D3,EddShrT9N14D3,EddShrT9N15D3,EddShrT9N16D3,EddShrT9N17D3,EddShrT9N18D3,EddShrT9N19D3,EddShrT9N20D3, & + EddShrT9N01D4,EddShrT9N02D4,EddShrT9N03D4,EddShrT9N04D4,EddShrT9N05D4,EddShrT9N06D4,EddShrT9N07D4,EddShrT9N08D4,EddShrT9N09D4,EddShrT9N10D4, & + EddShrT9N11D4,EddShrT9N12D4,EddShrT9N13D4,EddShrT9N14D4,EddShrT9N15D4,EddShrT9N16D4,EddShrT9N17D4,EddShrT9N18D4,EddShrT9N19D4,EddShrT9N20D4, & + EddShrT9N01D5,EddShrT9N02D5,EddShrT9N03D5,EddShrT9N04D5,EddShrT9N05D5,EddShrT9N06D5,EddShrT9N07D5,EddShrT9N08D5,EddShrT9N09D5,EddShrT9N10D5, & + EddShrT9N11D5,EddShrT9N12D5,EddShrT9N13D5,EddShrT9N14D5,EddShrT9N15D5,EddShrT9N16D5,EddShrT9N17D5,EddShrT9N18D5,EddShrT9N19D5,EddShrT9N20D5, & + EddShrT9N01D6,EddShrT9N02D6,EddShrT9N03D6,EddShrT9N04D6,EddShrT9N05D6,EddShrT9N06D6,EddShrT9N07D6,EddShrT9N08D6,EddShrT9N09D6,EddShrT9N10D6, & + EddShrT9N11D6,EddShrT9N12D6,EddShrT9N13D6,EddShrT9N14D6,EddShrT9N15D6,EddShrT9N16D6,EddShrT9N17D6,EddShrT9N18D6,EddShrT9N19D6,EddShrT9N20D6, & + EddShrT9N01D7,EddShrT9N02D7,EddShrT9N03D7,EddShrT9N04D7,EddShrT9N05D7,EddShrT9N06D7,EddShrT9N07D7,EddShrT9N08D7,EddShrT9N09D7,EddShrT9N10D7, & + EddShrT9N11D7,EddShrT9N12D7,EddShrT9N13D7,EddShrT9N14D7,EddShrT9N15D7,EddShrT9N16D7,EddShrT9N17D7,EddShrT9N18D7,EddShrT9N19D7,EddShrT9N20D7, & + EddShrT9N01D8,EddShrT9N02D8,EddShrT9N03D8,EddShrT9N04D8,EddShrT9N05D8,EddShrT9N06D8,EddShrT9N07D8,EddShrT9N08D8,EddShrT9N09D8,EddShrT9N10D8, & + EddShrT9N11D8,EddShrT9N12D8,EddShrT9N13D8,EddShrT9N14D8,EddShrT9N15D8,EddShrT9N16D8,EddShrT9N17D8,EddShrT9N18D8,EddShrT9N19D8,EddShrT9N20D8, & + EddShrT9N01D9,EddShrT9N02D9,EddShrT9N03D9,EddShrT9N04D9,EddShrT9N05D9,EddShrT9N06D9,EddShrT9N07D9,EddShrT9N08D9,EddShrT9N09D9,EddShrT9N10D9, & + EddShrT9N11D9,EddShrT9N12D9,EddShrT9N13D9,EddShrT9N14D9,EddShrT9N15D9,EddShrT9N16D9,EddShrT9N17D9,EddShrT9N18D9,EddShrT9N19D9,EddShrT9N20D9/), (/20,9/) ) + + + if ( (farm%p%NumOuts == 0) ) then ! .or. .not. ( (farm%p%WrTxtOutFile) .or. (farm%p%WrBinOutFile) ) ) then + return + end if + + ALLOCATE ( farm%m%AllOuts(0:Farm_MaxOutPts) , STAT=ErrStat ) + IF ( ErrStat /= 0 ) THEN + ErrStat = ErrID_Fatal + ErrMsg = ' Error allocating memory for the Fast.Farm AllOuts array.' + RETURN + ENDIF + + + farm%m%AllOuts = 0.0_ReKi +#ifdef _OPENMP + farm%p%FileDescLines(1) = 'Predictions were generated on '//CurDate()//' at '//CurTime()//' using '//TRIM(GetVersion(Farm_Ver))//' and with OpenMP' +#else + farm%p%FileDescLines(1) = 'Predictions were generated on '//CurDate()//' at '//CurTime()//' using '//TRIM(GetVersion(Farm_Ver)) +#endif + + farm%p%FileDescLines(2) = 'linked with ' //' '//TRIM(GetNVD(NWTC_Ver )) ! we'll get the rest of the linked modules in the section below + farm%p%FileDescLines(3) = 'Description from the FAST.Farm input file: '//TRIM(farm%p%FTitle) + + !...................................................... + ! Open the text output file and print the headers + !...................................................... + + ! IF (farm%p%WrTxtOutFile) THEN + + CALL GetNewUnit( farm%p%UnOu, ErrStat, ErrMsg ) + IF ( ErrStat >= AbortErrLev ) RETURN + + CALL OpenFOutFile ( farm%p%UnOu, TRIM(farm%p%OutFileRoot)//'.out', ErrStat, ErrMsg ) + IF ( ErrStat >= AbortErrLev ) RETURN + + ! Add some file information: + + WRITE (farm%p%UnOu,'(/,A)') TRIM( farm%p%FileDescLines(1) ) + WRITE (farm%p%UnOu,'(1X,A)') TRIM( farm%p%FileDescLines(2) ) + WRITE (farm%p%UnOu,'()' ) !print a blank line + WRITE (farm%p%UnOu,'(A)' ) TRIM( farm%p%FileDescLines(3) ) + WRITE (farm%p%UnOu,'()' ) !print a blank line + + + !...................................................... + ! Write the names of the output parameters on one line: + !...................................................... + + CALL WrFileNR ( farm%p%UnOu, farm%p%OutParam(0)%Name ) + + DO I=1,farm%p%NumOuts + CALL WrFileNR ( farm%p%UnOu, farm%p%Delim//farm%p%OutParam(I)%Name ) + ENDDO ! I +!============================================================ +! DEBUG OUTPUTS HERE +! +! DO I = 0,farm%WD(1)%p%NumPlanes-1 ! Loop through all selected output channels +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') 'PPLANEX'//trim(num2lstr(I)) +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') 'PPLANEY'//trim(num2lstr(I)) +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') 'PPLANEZ'//trim(num2lstr(I)) +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) 'XPLANE'//trim(num2lstr(I)) +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) 'VPLANEX'//trim(num2lstr(I)) +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) 'VPLANEY'//trim(num2lstr(I)) +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) 'VPLANEZ'//trim(num2lstr(I)) +! +! ENDDO ! I - All selected output channels +! +! +! END DEBUG OUTPUTS +!============================================================ + WRITE (farm%p%UnOu,'()') + + !...................................................... + ! Write the units of the output parameters on one line: + !...................................................... + + CALL WrFileNR ( farm%p%UnOu, farm%p%OutParam(0)%Units ) + + DO I=1,farm%p%NumOuts + WRITE (farm%p%UnOu,'(A14)',ADVANCE='NO') farm%p%Delim//farm%p%OutParam(I)%Units + !CALL WrFileNR ( farm%p%UnOu, farm%p%Delim//farm%p%OutParam(I)%Units ) + ENDDO ! I + +!============================================================ +! DEBUG OUTPUTS HERE +! +! DO I = 0,farm%WD(1)%p%NumPlanes-1 ! Loop through all selected output channels +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') ' (m) ' +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') ' (m) ' +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO') ' (m) ' +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) ' (m) ' +! +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) ' (m/s) ' +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) ' (m/s) ' +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) ' (m/s) ' +! +! IF ( I < farm%WD(1)%p%NumPlanes-1 ) THEN +! WRITE( farm%p%UnOu,'(A14)',ADVANCE='NO' ) ' (-) ' +! END IF +! +! ENDDO ! I - All selected output channels +! +! +! END DEBUG OUTPUTS +!============================================================ + + WRITE (farm%p%UnOu,'()') + + ! END IF + + ! TODO: Add binary + !...................................................... + ! Allocate data for binary output file + !...................................................... + !IF (farm%p%WrBinOutFile) THEN + ! + ! ! calculate the size of the array of outputs we need to store + ! farm%p%NOutSteps = CEILING ( (farm%p%TMax - farm%p%TStart) / farm%p%DT_low ) + 1 + ! + ! CALL AllocAry( farm%m%AllOutData, farm%p%NumOuts-1, farm%p%NOutSteps, 'AllOutData', ErrStat, ErrMsg ) + ! IF ( ErrStat >= AbortErrLev ) RETURN + ! + ! ! IF ( OutputFileFmtID == FileFmtID_WithoutTime ) THEN + ! + ! CALL AllocAry( farm%m%TimeData, 2_IntKi, 'TimeData', ErrStat, ErrMsg ) + ! IF ( ErrStat >= AbortErrLev ) RETURN + ! + ! farm%m%TimeData(1) = 0.0_DbKi ! This is the first output time, which we will set later + ! farm%m%TimeData(2) = farm%p%DT_low ! This is the (constant) time between subsequent writes to the output file + ! + ! !ELSE ! we store the entire time array + ! ! + ! ! CALL AllocAry( farm%m%TimeData, farm%p%NOutSteps, 'TimeData', ErrStat, ErrMsg ) + ! ! IF ( ErrStat >= AbortErrLev ) RETURN + ! ! + ! !END IF + ! + ! farm%m%n_Out = 0 !number of steps actually written to the file + ! + !END IF + + + +RETURN +END SUBROUTINE Farm_InitOutput + + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine is called at program termination. It writes any additional output files, +!! deallocates variables for FAST file I/O and closes files. +SUBROUTINE Farm_EndOutput( farm, ErrStat, ErrMsg ) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT(OUT) :: ErrMsg !< Message associated with errro status + + ! local variables + CHARACTER(1024) :: FileDesc ! The description of the run, to be written in the binary output file + + !CHARACTER(ChanLenFF):: ChannelNames(farm%p%NumOuts) + !CHARACTER(ChanLenFF):: ChannelUnits(farm%p%NumOuts) + !INTEGER(IntKi) :: I + ! Initialize some values + + ErrStat = ErrID_None + ErrMsg = '' + + !------------------------------------------------------------------------------------------------- + ! Write the binary output file if requested + !------------------------------------------------------------------------------------------------- + ! TODO: The ChannelNames and ChannelUnits need to be length ChanLenFF for Fast.Farm, but the WrBinFAST subroutine needs these to be ChanLen long! + !IF (farm%p%WrBinOutFile .AND. farm%m%n_Out > 0) THEN + ! + ! FileDesc = TRIM(farm%p%FileDescLines(1))//' '//TRIM(farm%p%FileDescLines(2))//'; '//TRIM(farm%p%FileDescLines(3)) + ! + ! DO I = 1,farm%p%NumOuts + ! ChannelNames(I) = farm%p%OutParam(I)%Name + ! ChannelUnits(I) = farm%p%OutParam(I)%Units + ! END DO + ! + ! CALL WrBinFAST(TRIM(farm%p%OutFileRoot)//'.outb', 2, TRIM(FileDesc), & + ! ChannelNames, ChannelUnits, farm%m%TimeData(:),farm%m%AllOutData(:,1:farm%m%n_Out), ErrStat, ErrMsg) + ! + ! IF ( ErrStat /= ErrID_None ) CALL WrScr( TRIM(GetErrStr(ErrStat))//' when writing binary output file: '//TRIM(ErrMsg) ) + ! + !END IF + + + !------------------------------------------------------------------------------------------------- + ! Close the text tabular output file and summary file (if opened) + !------------------------------------------------------------------------------------------------- + IF (farm%p%UnOu > 0) THEN ! I/O unit number for the tabular output file + CLOSE( farm%p%UnOu ) + farm%p%UnOu = -1 + END IF + + !------------------------------------------------------------------------------------------------- + ! Deallocate arrays + !------------------------------------------------------------------------------------------------- + + ! Output + !IF ( ALLOCATED(y_FAST%AllOutData ) ) DEALLOCATE(y_FAST%AllOutData ) + !IF ( ALLOCATED(y_FAST%TimeData ) ) DEALLOCATE(y_FAST%TimeData ) + !IF ( ALLOCATED(y_FAST%ChannelNames ) ) DEALLOCATE(y_FAST%ChannelNames ) + !IF ( ALLOCATED(y_FAST%ChannelUnits ) ) DEALLOCATE(y_FAST%ChannelUnits ) + + +END SUBROUTINE Farm_EndOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +! ROUTINES TO OUTPUT WRITE DATA TO FILE AT EACH REQUSTED TIME STEP +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine determines if it's time to write to the output files, and calls the routine to write to the files +!! with the output data. It should be called after all the output solves for a given time have been completed. +SUBROUTINE WriteFarmOutputToFile( t_global, farm, ErrStat, ErrMsg ) +!............................................................................................................................... + REAL(DbKi), INTENT(IN ) :: t_global !< Current global time + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + + REAL(DbKi) :: OutTime ! Used to determine if output should be generated at this simulation time + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMSg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WriteOutputToFile' + CHARACTER(200) :: Frmt ! A string to hold a format specifier + CHARACTER(farm%p%TChanLen) :: TmpStr ! temporary string to print the time output as text + CHARACTER(ChanLen) :: TmpStr2 ! temporary string to print the output as text + INTEGER(IntKi) :: I, J ! loop counter + REAL(ReKi) :: OutputAry(farm%p%NumOuts) + + ErrStat = ErrID_None + ErrMsg = "" + Frmt = '"'//farm%p%Delim//'"'//farm%p%OutFmt ! format for array elements from individual modules + + ! Write time-series channel data + IF ( farm%p%NumOuts == 0 ) return + + IF ( t_global >= farm%p%TStart ) THEN + + WRITE( TmpStr, '('//trim(farm%p%OutFmt_t)//')' ) t_global + CALL WrFileNR( farm%p%UnOu, TmpStr ) + + ! Generate fast.farm output file + + + DO I = 1,farm%p%NumOuts ! Loop through all selected output channels + + OutputAry(I) = farm%p%OutParam(I)%SignM * farm%m%AllOuts( farm%p%OutParam(I)%Indx ) + ! WRITE( TmpStr2, '('//trim(Frmt)//')' ) OutputAry(I) + ! WRITE (farm%p%UnOu,'(A14)',ADVANCE='NO') TmpStr2 + + ! CALL WrFileNR( farm%p%UnOu, TmpStr2 ) + + + ENDDO ! I - All selected output channels + ! write the individual module output (convert to SiKi if necessary, so that we don't need to print so many digits in the exponent) + CALL WrNumAryFileNR ( farm%p%UnOu, REAL(OutputAry,SiKi), Frmt, ErrStat, ErrMsg ) +!============================================================ +! DEBUG OUTPUTS HERE +! +! DO I = 0,farm%WD(1)%p%NumPlanes-1 ! Loop through all selected output channels +! +! DO J = 1,3 +! WRITE( TmpStr2, '('//trim(farm%p%OutFmt)//')' ) farm%WD(1)%y%p_plane(J,I) +! CALL WrFileNR( farm%p%UnOu, TmpStr2 ) +! ENDDO +! +! WRITE( TmpStr2, '('//trim(farm%p%OutFmt)//')' ) farm%WD(1)%xd%x_plane(I) +! CALL WrFileNR( farm%p%UnOu, TmpStr2 ) +! +! DO J = 1,3 +! WRITE( TmpStr2, '('//trim(farm%p%OutFmt)//')' ) farm%AWAE%y%V_plane(J,I,1) +! CALL WrFileNR( farm%p%UnOu, TmpStr2 ) +! ENDDO +! +! ENDDO ! I - All selected output channels +! +! +! END DEBUG OUTPUTS +!============================================================ + ! write a new line (advance to the next line) + WRITE (farm%p%UnOu,'()') + + !IF (farm%p%WrBinOutFile) THEN + ! + ! ! Write data to array for binary output file + ! + ! IF ( farm%m%n_Out == farm%p%NOutSteps ) THEN + ! CALL ProgWarn( 'Not all data could be written to the binary output file.' ) + ! !this really would only happen if we have an error somewhere else, right? + ! !otherwise, we could allocate a new, larger array and move existing data + ! ELSE + ! farm%m%n_Out = farm%m%n_Out + 1 + ! + ! ! store time data + ! IF ( farm%m%n_Out == 1_IntKi ) THEN !.OR. OutputFileFmtID == FileFmtID_WithTime ) THEN + ! farm%m%TimeData(farm%m%n_Out) = t_global ! Time associated with these outputs + ! END IF + ! + ! ! store individual module data + ! farm%m%AllOutData(:, farm%m%n_Out) = OutputAry + ! + ! END IF + ! + !END IF + ENDIF +END SUBROUTINE WriteFarmOutputToFile + + + +logical function PointInAABB(x, y, z, x0, y0, z0, x1, y1, z1) + real(ReKi), intent(in) :: x,y,z,x0,y0,z0,x1,y1,z1 + + ! default to return false + PointInAABB = .false.; + !Check if the point is less than max and greater than min + if (x >= x0 .and. x <= x1 .and. y >= y0 .and. y <= y1 .and. z >= z0 .and. z <= z1) PointInAABB = .true.; + + +end function PointInAABB + +!********************************************************************************************************************************** +! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" +! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these +! lines should be modified in the Matlab script and/or Excel worksheet as necessary. +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine checks to see if any requested output channel names (stored in the OutList(:)) are invalid. It returns a +!! warning if any of the channels are not available outputs from the module. +!! It assigns the settings for OutParam(:) (i.e, the index, name, and units of the output channels, WriteOutput(:)). +!! the sign is set to 0 if the channel is invalid. +!! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. +!! +!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 27-Mar-2017 17:26:42. +SUBROUTINE Farm_SetOutParam(OutList, farm, ErrStat, ErrMsg ) +!.................................................................................................................................. + + IMPLICIT NONE + + ! Passed variables + + CHARACTER(ChanLen), INTENT(IN) :: OutList(:) !< The list out user-requested outputs + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code + CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred + + ! Local variables + + INTEGER :: ErrStat2 ! temporary (local) error status + INTEGER :: I ! Generic loop-counting index + INTEGER :: J ! Generic loop-counting index + INTEGER :: INDX ! Index for valid arrays + + LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) + LOGICAL :: InvalidOutput(0:Farm_MaxOutPts) ! This array determines if the output channel is valid for this configuration + CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) + CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam" + + CHARACTER(Farm_OutStrLenM1) :: ValidParamAry(9423) ! This lists the names of the allowed parameters, which must be sorted alphabetically + INTEGER(IntKi) :: ParamIndxAry (9423) ! This lists the index into AllOuts(:) of the allowed parameters ValidParamAry(:) CHARACTER(ChanLen), :: ParamUnitsAry(9423) ! This lists the units corresponding to the allowed parameters + CHARACTER(ChanLen) :: ParamUnitsAry(9423) ! This lists the units corresponding to the allowed parameters + + ValidParamAry(1:2040) = (/ & + "CTT1N01 ","CTT1N02 ","CTT1N03 ","CTT1N04 ","CTT1N05 ","CTT1N06 ","CTT1N07 ","CTT1N08 ", & + "CTT1N09 ","CTT1N10 ","CTT1N11 ","CTT1N12 ","CTT1N13 ","CTT1N14 ","CTT1N15 ","CTT1N16 ", & + "CTT1N17 ","CTT1N18 ","CTT1N19 ","CTT1N20 ","CTT2N01 ","CTT2N02 ","CTT2N03 ","CTT2N04 ", & + "CTT2N05 ","CTT2N06 ","CTT2N07 ","CTT2N08 ","CTT2N09 ","CTT2N10 ","CTT2N11 ","CTT2N12 ", & + "CTT2N13 ","CTT2N14 ","CTT2N15 ","CTT2N16 ","CTT2N17 ","CTT2N18 ","CTT2N19 ","CTT2N20 ", & + "CTT3N01 ","CTT3N02 ","CTT3N03 ","CTT3N04 ","CTT3N05 ","CTT3N06 ","CTT3N07 ","CTT3N08 ", & + "CTT3N09 ","CTT3N10 ","CTT3N11 ","CTT3N12 ","CTT3N13 ","CTT3N14 ","CTT3N15 ","CTT3N16 ", & + "CTT3N17 ","CTT3N18 ","CTT3N19 ","CTT3N20 ","CTT4N01 ","CTT4N02 ","CTT4N03 ","CTT4N04 ", & + "CTT4N05 ","CTT4N06 ","CTT4N07 ","CTT4N08 ","CTT4N09 ","CTT4N10 ","CTT4N11 ","CTT4N12 ", & + "CTT4N13 ","CTT4N14 ","CTT4N15 ","CTT4N16 ","CTT4N17 ","CTT4N18 ","CTT4N19 ","CTT4N20 ", & + "CTT5N01 ","CTT5N02 ","CTT5N03 ","CTT5N04 ","CTT5N05 ","CTT5N06 ","CTT5N07 ","CTT5N08 ", & + "CTT5N09 ","CTT5N10 ","CTT5N11 ","CTT5N12 ","CTT5N13 ","CTT5N14 ","CTT5N15 ","CTT5N16 ", & + "CTT5N17 ","CTT5N18 ","CTT5N19 ","CTT5N20 ","CTT6N01 ","CTT6N02 ","CTT6N03 ","CTT6N04 ", & + "CTT6N05 ","CTT6N06 ","CTT6N07 ","CTT6N08 ","CTT6N09 ","CTT6N10 ","CTT6N11 ","CTT6N12 ", & + "CTT6N13 ","CTT6N14 ","CTT6N15 ","CTT6N16 ","CTT6N17 ","CTT6N18 ","CTT6N19 ","CTT6N20 ", & + "CTT7N01 ","CTT7N02 ","CTT7N03 ","CTT7N04 ","CTT7N05 ","CTT7N06 ","CTT7N07 ","CTT7N08 ", & + "CTT7N09 ","CTT7N10 ","CTT7N11 ","CTT7N12 ","CTT7N13 ","CTT7N14 ","CTT7N15 ","CTT7N16 ", & + "CTT7N17 ","CTT7N18 ","CTT7N19 ","CTT7N20 ","CTT8N01 ","CTT8N02 ","CTT8N03 ","CTT8N04 ", & + "CTT8N05 ","CTT8N06 ","CTT8N07 ","CTT8N08 ","CTT8N09 ","CTT8N10 ","CTT8N11 ","CTT8N12 ", & + "CTT8N13 ","CTT8N14 ","CTT8N15 ","CTT8N16 ","CTT8N17 ","CTT8N18 ","CTT8N19 ","CTT8N20 ", & + "CTT9N01 ","CTT9N02 ","CTT9N03 ","CTT9N04 ","CTT9N05 ","CTT9N06 ","CTT9N07 ","CTT9N08 ", & + "CTT9N09 ","CTT9N10 ","CTT9N11 ","CTT9N12 ","CTT9N13 ","CTT9N14 ","CTT9N15 ","CTT9N16 ", & + "CTT9N17 ","CTT9N18 ","CTT9N19 ","CTT9N20 ","EDDAMBT1N01D1","EDDAMBT1N01D2","EDDAMBT1N01D3","EDDAMBT1N01D4", & + "EDDAMBT1N01D5","EDDAMBT1N01D6","EDDAMBT1N01D7","EDDAMBT1N01D8","EDDAMBT1N01D9","EDDAMBT1N02D1","EDDAMBT1N02D2","EDDAMBT1N02D3", & + "EDDAMBT1N02D4","EDDAMBT1N02D5","EDDAMBT1N02D6","EDDAMBT1N02D7","EDDAMBT1N02D8","EDDAMBT1N02D9","EDDAMBT1N03D1","EDDAMBT1N03D2", & + "EDDAMBT1N03D3","EDDAMBT1N03D4","EDDAMBT1N03D5","EDDAMBT1N03D6","EDDAMBT1N03D7","EDDAMBT1N03D8","EDDAMBT1N03D9","EDDAMBT1N04D1", & + "EDDAMBT1N04D2","EDDAMBT1N04D3","EDDAMBT1N04D4","EDDAMBT1N04D5","EDDAMBT1N04D6","EDDAMBT1N04D7","EDDAMBT1N04D8","EDDAMBT1N04D9", & + "EDDAMBT1N05D1","EDDAMBT1N05D2","EDDAMBT1N05D3","EDDAMBT1N05D4","EDDAMBT1N05D5","EDDAMBT1N05D6","EDDAMBT1N05D7","EDDAMBT1N05D8", & + "EDDAMBT1N05D9","EDDAMBT1N06D1","EDDAMBT1N06D2","EDDAMBT1N06D3","EDDAMBT1N06D4","EDDAMBT1N06D5","EDDAMBT1N06D6","EDDAMBT1N06D7", & + "EDDAMBT1N06D8","EDDAMBT1N06D9","EDDAMBT1N07D1","EDDAMBT1N07D2","EDDAMBT1N07D3","EDDAMBT1N07D4","EDDAMBT1N07D5","EDDAMBT1N07D6", & + "EDDAMBT1N07D7","EDDAMBT1N07D8","EDDAMBT1N07D9","EDDAMBT1N08D1","EDDAMBT1N08D2","EDDAMBT1N08D3","EDDAMBT1N08D4","EDDAMBT1N08D5", & + "EDDAMBT1N08D6","EDDAMBT1N08D7","EDDAMBT1N08D8","EDDAMBT1N08D9","EDDAMBT1N09D1","EDDAMBT1N09D2","EDDAMBT1N09D3","EDDAMBT1N09D4", & + "EDDAMBT1N09D5","EDDAMBT1N09D6","EDDAMBT1N09D7","EDDAMBT1N09D8","EDDAMBT1N09D9","EDDAMBT1N10D1","EDDAMBT1N10D2","EDDAMBT1N10D3", & + "EDDAMBT1N10D4","EDDAMBT1N10D5","EDDAMBT1N10D6","EDDAMBT1N10D7","EDDAMBT1N10D8","EDDAMBT1N10D9","EDDAMBT1N11D1","EDDAMBT1N11D2", & + "EDDAMBT1N11D3","EDDAMBT1N11D4","EDDAMBT1N11D5","EDDAMBT1N11D6","EDDAMBT1N11D7","EDDAMBT1N11D8","EDDAMBT1N11D9","EDDAMBT1N12D1", & + "EDDAMBT1N12D2","EDDAMBT1N12D3","EDDAMBT1N12D4","EDDAMBT1N12D5","EDDAMBT1N12D6","EDDAMBT1N12D7","EDDAMBT1N12D8","EDDAMBT1N12D9", & + "EDDAMBT1N13D1","EDDAMBT1N13D2","EDDAMBT1N13D3","EDDAMBT1N13D4","EDDAMBT1N13D5","EDDAMBT1N13D6","EDDAMBT1N13D7","EDDAMBT1N13D8", & + "EDDAMBT1N13D9","EDDAMBT1N14D1","EDDAMBT1N14D2","EDDAMBT1N14D3","EDDAMBT1N14D4","EDDAMBT1N14D5","EDDAMBT1N14D6","EDDAMBT1N14D7", & + "EDDAMBT1N14D8","EDDAMBT1N14D9","EDDAMBT1N15D1","EDDAMBT1N15D2","EDDAMBT1N15D3","EDDAMBT1N15D4","EDDAMBT1N15D5","EDDAMBT1N15D6", & + "EDDAMBT1N15D7","EDDAMBT1N15D8","EDDAMBT1N15D9","EDDAMBT1N16D1","EDDAMBT1N16D2","EDDAMBT1N16D3","EDDAMBT1N16D4","EDDAMBT1N16D5", & + "EDDAMBT1N16D6","EDDAMBT1N16D7","EDDAMBT1N16D8","EDDAMBT1N16D9","EDDAMBT1N17D1","EDDAMBT1N17D2","EDDAMBT1N17D3","EDDAMBT1N17D4", & + "EDDAMBT1N17D5","EDDAMBT1N17D6","EDDAMBT1N17D7","EDDAMBT1N17D8","EDDAMBT1N17D9","EDDAMBT1N18D1","EDDAMBT1N18D2","EDDAMBT1N18D3", & + "EDDAMBT1N18D4","EDDAMBT1N18D5","EDDAMBT1N18D6","EDDAMBT1N18D7","EDDAMBT1N18D8","EDDAMBT1N18D9","EDDAMBT1N19D1","EDDAMBT1N19D2", & + "EDDAMBT1N19D3","EDDAMBT1N19D4","EDDAMBT1N19D5","EDDAMBT1N19D6","EDDAMBT1N19D7","EDDAMBT1N19D8","EDDAMBT1N19D9","EDDAMBT1N20D1", & + "EDDAMBT1N20D2","EDDAMBT1N20D3","EDDAMBT1N20D4","EDDAMBT1N20D5","EDDAMBT1N20D6","EDDAMBT1N20D7","EDDAMBT1N20D8","EDDAMBT1N20D9", & + "EDDAMBT2N01D1","EDDAMBT2N01D2","EDDAMBT2N01D3","EDDAMBT2N01D4","EDDAMBT2N01D5","EDDAMBT2N01D6","EDDAMBT2N01D7","EDDAMBT2N01D8", & + "EDDAMBT2N01D9","EDDAMBT2N02D1","EDDAMBT2N02D2","EDDAMBT2N02D3","EDDAMBT2N02D4","EDDAMBT2N02D5","EDDAMBT2N02D6","EDDAMBT2N02D7", & + "EDDAMBT2N02D8","EDDAMBT2N02D9","EDDAMBT2N03D1","EDDAMBT2N03D2","EDDAMBT2N03D3","EDDAMBT2N03D4","EDDAMBT2N03D5","EDDAMBT2N03D6", & + "EDDAMBT2N03D7","EDDAMBT2N03D8","EDDAMBT2N03D9","EDDAMBT2N04D1","EDDAMBT2N04D2","EDDAMBT2N04D3","EDDAMBT2N04D4","EDDAMBT2N04D5", & + "EDDAMBT2N04D6","EDDAMBT2N04D7","EDDAMBT2N04D8","EDDAMBT2N04D9","EDDAMBT2N05D1","EDDAMBT2N05D2","EDDAMBT2N05D3","EDDAMBT2N05D4", & + "EDDAMBT2N05D5","EDDAMBT2N05D6","EDDAMBT2N05D7","EDDAMBT2N05D8","EDDAMBT2N05D9","EDDAMBT2N06D1","EDDAMBT2N06D2","EDDAMBT2N06D3", & + "EDDAMBT2N06D4","EDDAMBT2N06D5","EDDAMBT2N06D6","EDDAMBT2N06D7","EDDAMBT2N06D8","EDDAMBT2N06D9","EDDAMBT2N07D1","EDDAMBT2N07D2", & + "EDDAMBT2N07D3","EDDAMBT2N07D4","EDDAMBT2N07D5","EDDAMBT2N07D6","EDDAMBT2N07D7","EDDAMBT2N07D8","EDDAMBT2N07D9","EDDAMBT2N08D1", & + "EDDAMBT2N08D2","EDDAMBT2N08D3","EDDAMBT2N08D4","EDDAMBT2N08D5","EDDAMBT2N08D6","EDDAMBT2N08D7","EDDAMBT2N08D8","EDDAMBT2N08D9", & + "EDDAMBT2N09D1","EDDAMBT2N09D2","EDDAMBT2N09D3","EDDAMBT2N09D4","EDDAMBT2N09D5","EDDAMBT2N09D6","EDDAMBT2N09D7","EDDAMBT2N09D8", & + "EDDAMBT2N09D9","EDDAMBT2N10D1","EDDAMBT2N10D2","EDDAMBT2N10D3","EDDAMBT2N10D4","EDDAMBT2N10D5","EDDAMBT2N10D6","EDDAMBT2N10D7", & + "EDDAMBT2N10D8","EDDAMBT2N10D9","EDDAMBT2N11D1","EDDAMBT2N11D2","EDDAMBT2N11D3","EDDAMBT2N11D4","EDDAMBT2N11D5","EDDAMBT2N11D6", & + "EDDAMBT2N11D7","EDDAMBT2N11D8","EDDAMBT2N11D9","EDDAMBT2N12D1","EDDAMBT2N12D2","EDDAMBT2N12D3","EDDAMBT2N12D4","EDDAMBT2N12D5", & + "EDDAMBT2N12D6","EDDAMBT2N12D7","EDDAMBT2N12D8","EDDAMBT2N12D9","EDDAMBT2N13D1","EDDAMBT2N13D2","EDDAMBT2N13D3","EDDAMBT2N13D4", & + "EDDAMBT2N13D5","EDDAMBT2N13D6","EDDAMBT2N13D7","EDDAMBT2N13D8","EDDAMBT2N13D9","EDDAMBT2N14D1","EDDAMBT2N14D2","EDDAMBT2N14D3", & + "EDDAMBT2N14D4","EDDAMBT2N14D5","EDDAMBT2N14D6","EDDAMBT2N14D7","EDDAMBT2N14D8","EDDAMBT2N14D9","EDDAMBT2N15D1","EDDAMBT2N15D2", & + "EDDAMBT2N15D3","EDDAMBT2N15D4","EDDAMBT2N15D5","EDDAMBT2N15D6","EDDAMBT2N15D7","EDDAMBT2N15D8","EDDAMBT2N15D9","EDDAMBT2N16D1", & + "EDDAMBT2N16D2","EDDAMBT2N16D3","EDDAMBT2N16D4","EDDAMBT2N16D5","EDDAMBT2N16D6","EDDAMBT2N16D7","EDDAMBT2N16D8","EDDAMBT2N16D9", & + "EDDAMBT2N17D1","EDDAMBT2N17D2","EDDAMBT2N17D3","EDDAMBT2N17D4","EDDAMBT2N17D5","EDDAMBT2N17D6","EDDAMBT2N17D7","EDDAMBT2N17D8", & + "EDDAMBT2N17D9","EDDAMBT2N18D1","EDDAMBT2N18D2","EDDAMBT2N18D3","EDDAMBT2N18D4","EDDAMBT2N18D5","EDDAMBT2N18D6","EDDAMBT2N18D7", & + "EDDAMBT2N18D8","EDDAMBT2N18D9","EDDAMBT2N19D1","EDDAMBT2N19D2","EDDAMBT2N19D3","EDDAMBT2N19D4","EDDAMBT2N19D5","EDDAMBT2N19D6", & + "EDDAMBT2N19D7","EDDAMBT2N19D8","EDDAMBT2N19D9","EDDAMBT2N20D1","EDDAMBT2N20D2","EDDAMBT2N20D3","EDDAMBT2N20D4","EDDAMBT2N20D5", & + "EDDAMBT2N20D6","EDDAMBT2N20D7","EDDAMBT2N20D8","EDDAMBT2N20D9","EDDAMBT3N01D1","EDDAMBT3N01D2","EDDAMBT3N01D3","EDDAMBT3N01D4", & + "EDDAMBT3N01D5","EDDAMBT3N01D6","EDDAMBT3N01D7","EDDAMBT3N01D8","EDDAMBT3N01D9","EDDAMBT3N02D1","EDDAMBT3N02D2","EDDAMBT3N02D3", & + "EDDAMBT3N02D4","EDDAMBT3N02D5","EDDAMBT3N02D6","EDDAMBT3N02D7","EDDAMBT3N02D8","EDDAMBT3N02D9","EDDAMBT3N03D1","EDDAMBT3N03D2", & + "EDDAMBT3N03D3","EDDAMBT3N03D4","EDDAMBT3N03D5","EDDAMBT3N03D6","EDDAMBT3N03D7","EDDAMBT3N03D8","EDDAMBT3N03D9","EDDAMBT3N04D1", & + "EDDAMBT3N04D2","EDDAMBT3N04D3","EDDAMBT3N04D4","EDDAMBT3N04D5","EDDAMBT3N04D6","EDDAMBT3N04D7","EDDAMBT3N04D8","EDDAMBT3N04D9", & + "EDDAMBT3N05D1","EDDAMBT3N05D2","EDDAMBT3N05D3","EDDAMBT3N05D4","EDDAMBT3N05D5","EDDAMBT3N05D6","EDDAMBT3N05D7","EDDAMBT3N05D8", & + "EDDAMBT3N05D9","EDDAMBT3N06D1","EDDAMBT3N06D2","EDDAMBT3N06D3","EDDAMBT3N06D4","EDDAMBT3N06D5","EDDAMBT3N06D6","EDDAMBT3N06D7", & + "EDDAMBT3N06D8","EDDAMBT3N06D9","EDDAMBT3N07D1","EDDAMBT3N07D2","EDDAMBT3N07D3","EDDAMBT3N07D4","EDDAMBT3N07D5","EDDAMBT3N07D6", & + "EDDAMBT3N07D7","EDDAMBT3N07D8","EDDAMBT3N07D9","EDDAMBT3N08D1","EDDAMBT3N08D2","EDDAMBT3N08D3","EDDAMBT3N08D4","EDDAMBT3N08D5", & + "EDDAMBT3N08D6","EDDAMBT3N08D7","EDDAMBT3N08D8","EDDAMBT3N08D9","EDDAMBT3N09D1","EDDAMBT3N09D2","EDDAMBT3N09D3","EDDAMBT3N09D4", & + "EDDAMBT3N09D5","EDDAMBT3N09D6","EDDAMBT3N09D7","EDDAMBT3N09D8","EDDAMBT3N09D9","EDDAMBT3N10D1","EDDAMBT3N10D2","EDDAMBT3N10D3", & + "EDDAMBT3N10D4","EDDAMBT3N10D5","EDDAMBT3N10D6","EDDAMBT3N10D7","EDDAMBT3N10D8","EDDAMBT3N10D9","EDDAMBT3N11D1","EDDAMBT3N11D2", & + "EDDAMBT3N11D3","EDDAMBT3N11D4","EDDAMBT3N11D5","EDDAMBT3N11D6","EDDAMBT3N11D7","EDDAMBT3N11D8","EDDAMBT3N11D9","EDDAMBT3N12D1", & + "EDDAMBT3N12D2","EDDAMBT3N12D3","EDDAMBT3N12D4","EDDAMBT3N12D5","EDDAMBT3N12D6","EDDAMBT3N12D7","EDDAMBT3N12D8","EDDAMBT3N12D9", & + "EDDAMBT3N13D1","EDDAMBT3N13D2","EDDAMBT3N13D3","EDDAMBT3N13D4","EDDAMBT3N13D5","EDDAMBT3N13D6","EDDAMBT3N13D7","EDDAMBT3N13D8", & + "EDDAMBT3N13D9","EDDAMBT3N14D1","EDDAMBT3N14D2","EDDAMBT3N14D3","EDDAMBT3N14D4","EDDAMBT3N14D5","EDDAMBT3N14D6","EDDAMBT3N14D7", & + "EDDAMBT3N14D8","EDDAMBT3N14D9","EDDAMBT3N15D1","EDDAMBT3N15D2","EDDAMBT3N15D3","EDDAMBT3N15D4","EDDAMBT3N15D5","EDDAMBT3N15D6", & + "EDDAMBT3N15D7","EDDAMBT3N15D8","EDDAMBT3N15D9","EDDAMBT3N16D1","EDDAMBT3N16D2","EDDAMBT3N16D3","EDDAMBT3N16D4","EDDAMBT3N16D5", & + "EDDAMBT3N16D6","EDDAMBT3N16D7","EDDAMBT3N16D8","EDDAMBT3N16D9","EDDAMBT3N17D1","EDDAMBT3N17D2","EDDAMBT3N17D3","EDDAMBT3N17D4", & + "EDDAMBT3N17D5","EDDAMBT3N17D6","EDDAMBT3N17D7","EDDAMBT3N17D8","EDDAMBT3N17D9","EDDAMBT3N18D1","EDDAMBT3N18D2","EDDAMBT3N18D3", & + "EDDAMBT3N18D4","EDDAMBT3N18D5","EDDAMBT3N18D6","EDDAMBT3N18D7","EDDAMBT3N18D8","EDDAMBT3N18D9","EDDAMBT3N19D1","EDDAMBT3N19D2", & + "EDDAMBT3N19D3","EDDAMBT3N19D4","EDDAMBT3N19D5","EDDAMBT3N19D6","EDDAMBT3N19D7","EDDAMBT3N19D8","EDDAMBT3N19D9","EDDAMBT3N20D1", & + "EDDAMBT3N20D2","EDDAMBT3N20D3","EDDAMBT3N20D4","EDDAMBT3N20D5","EDDAMBT3N20D6","EDDAMBT3N20D7","EDDAMBT3N20D8","EDDAMBT3N20D9", & + "EDDAMBT4N01D1","EDDAMBT4N01D2","EDDAMBT4N01D3","EDDAMBT4N01D4","EDDAMBT4N01D5","EDDAMBT4N01D6","EDDAMBT4N01D7","EDDAMBT4N01D8", & + "EDDAMBT4N01D9","EDDAMBT4N02D1","EDDAMBT4N02D2","EDDAMBT4N02D3","EDDAMBT4N02D4","EDDAMBT4N02D5","EDDAMBT4N02D6","EDDAMBT4N02D7", & + "EDDAMBT4N02D8","EDDAMBT4N02D9","EDDAMBT4N03D1","EDDAMBT4N03D2","EDDAMBT4N03D3","EDDAMBT4N03D4","EDDAMBT4N03D5","EDDAMBT4N03D6", & + "EDDAMBT4N03D7","EDDAMBT4N03D8","EDDAMBT4N03D9","EDDAMBT4N04D1","EDDAMBT4N04D2","EDDAMBT4N04D3","EDDAMBT4N04D4","EDDAMBT4N04D5", & + "EDDAMBT4N04D6","EDDAMBT4N04D7","EDDAMBT4N04D8","EDDAMBT4N04D9","EDDAMBT4N05D1","EDDAMBT4N05D2","EDDAMBT4N05D3","EDDAMBT4N05D4", & + "EDDAMBT4N05D5","EDDAMBT4N05D6","EDDAMBT4N05D7","EDDAMBT4N05D8","EDDAMBT4N05D9","EDDAMBT4N06D1","EDDAMBT4N06D2","EDDAMBT4N06D3", & + "EDDAMBT4N06D4","EDDAMBT4N06D5","EDDAMBT4N06D6","EDDAMBT4N06D7","EDDAMBT4N06D8","EDDAMBT4N06D9","EDDAMBT4N07D1","EDDAMBT4N07D2", & + "EDDAMBT4N07D3","EDDAMBT4N07D4","EDDAMBT4N07D5","EDDAMBT4N07D6","EDDAMBT4N07D7","EDDAMBT4N07D8","EDDAMBT4N07D9","EDDAMBT4N08D1", & + "EDDAMBT4N08D2","EDDAMBT4N08D3","EDDAMBT4N08D4","EDDAMBT4N08D5","EDDAMBT4N08D6","EDDAMBT4N08D7","EDDAMBT4N08D8","EDDAMBT4N08D9", & + "EDDAMBT4N09D1","EDDAMBT4N09D2","EDDAMBT4N09D3","EDDAMBT4N09D4","EDDAMBT4N09D5","EDDAMBT4N09D6","EDDAMBT4N09D7","EDDAMBT4N09D8", & + "EDDAMBT4N09D9","EDDAMBT4N10D1","EDDAMBT4N10D2","EDDAMBT4N10D3","EDDAMBT4N10D4","EDDAMBT4N10D5","EDDAMBT4N10D6","EDDAMBT4N10D7", & + "EDDAMBT4N10D8","EDDAMBT4N10D9","EDDAMBT4N11D1","EDDAMBT4N11D2","EDDAMBT4N11D3","EDDAMBT4N11D4","EDDAMBT4N11D5","EDDAMBT4N11D6", & + "EDDAMBT4N11D7","EDDAMBT4N11D8","EDDAMBT4N11D9","EDDAMBT4N12D1","EDDAMBT4N12D2","EDDAMBT4N12D3","EDDAMBT4N12D4","EDDAMBT4N12D5", & + "EDDAMBT4N12D6","EDDAMBT4N12D7","EDDAMBT4N12D8","EDDAMBT4N12D9","EDDAMBT4N13D1","EDDAMBT4N13D2","EDDAMBT4N13D3","EDDAMBT4N13D4", & + "EDDAMBT4N13D5","EDDAMBT4N13D6","EDDAMBT4N13D7","EDDAMBT4N13D8","EDDAMBT4N13D9","EDDAMBT4N14D1","EDDAMBT4N14D2","EDDAMBT4N14D3", & + "EDDAMBT4N14D4","EDDAMBT4N14D5","EDDAMBT4N14D6","EDDAMBT4N14D7","EDDAMBT4N14D8","EDDAMBT4N14D9","EDDAMBT4N15D1","EDDAMBT4N15D2", & + "EDDAMBT4N15D3","EDDAMBT4N15D4","EDDAMBT4N15D5","EDDAMBT4N15D6","EDDAMBT4N15D7","EDDAMBT4N15D8","EDDAMBT4N15D9","EDDAMBT4N16D1", & + "EDDAMBT4N16D2","EDDAMBT4N16D3","EDDAMBT4N16D4","EDDAMBT4N16D5","EDDAMBT4N16D6","EDDAMBT4N16D7","EDDAMBT4N16D8","EDDAMBT4N16D9", & + "EDDAMBT4N17D1","EDDAMBT4N17D2","EDDAMBT4N17D3","EDDAMBT4N17D4","EDDAMBT4N17D5","EDDAMBT4N17D6","EDDAMBT4N17D7","EDDAMBT4N17D8", & + "EDDAMBT4N17D9","EDDAMBT4N18D1","EDDAMBT4N18D2","EDDAMBT4N18D3","EDDAMBT4N18D4","EDDAMBT4N18D5","EDDAMBT4N18D6","EDDAMBT4N18D7", & + "EDDAMBT4N18D8","EDDAMBT4N18D9","EDDAMBT4N19D1","EDDAMBT4N19D2","EDDAMBT4N19D3","EDDAMBT4N19D4","EDDAMBT4N19D5","EDDAMBT4N19D6", & + "EDDAMBT4N19D7","EDDAMBT4N19D8","EDDAMBT4N19D9","EDDAMBT4N20D1","EDDAMBT4N20D2","EDDAMBT4N20D3","EDDAMBT4N20D4","EDDAMBT4N20D5", & + "EDDAMBT4N20D6","EDDAMBT4N20D7","EDDAMBT4N20D8","EDDAMBT4N20D9","EDDAMBT5N01D1","EDDAMBT5N01D2","EDDAMBT5N01D3","EDDAMBT5N01D4", & + "EDDAMBT5N01D5","EDDAMBT5N01D6","EDDAMBT5N01D7","EDDAMBT5N01D8","EDDAMBT5N01D9","EDDAMBT5N02D1","EDDAMBT5N02D2","EDDAMBT5N02D3", & + "EDDAMBT5N02D4","EDDAMBT5N02D5","EDDAMBT5N02D6","EDDAMBT5N02D7","EDDAMBT5N02D8","EDDAMBT5N02D9","EDDAMBT5N03D1","EDDAMBT5N03D2", & + "EDDAMBT5N03D3","EDDAMBT5N03D4","EDDAMBT5N03D5","EDDAMBT5N03D6","EDDAMBT5N03D7","EDDAMBT5N03D8","EDDAMBT5N03D9","EDDAMBT5N04D1", & + "EDDAMBT5N04D2","EDDAMBT5N04D3","EDDAMBT5N04D4","EDDAMBT5N04D5","EDDAMBT5N04D6","EDDAMBT5N04D7","EDDAMBT5N04D8","EDDAMBT5N04D9", & + "EDDAMBT5N05D1","EDDAMBT5N05D2","EDDAMBT5N05D3","EDDAMBT5N05D4","EDDAMBT5N05D5","EDDAMBT5N05D6","EDDAMBT5N05D7","EDDAMBT5N05D8", & + "EDDAMBT5N05D9","EDDAMBT5N06D1","EDDAMBT5N06D2","EDDAMBT5N06D3","EDDAMBT5N06D4","EDDAMBT5N06D5","EDDAMBT5N06D6","EDDAMBT5N06D7", & + "EDDAMBT5N06D8","EDDAMBT5N06D9","EDDAMBT5N07D1","EDDAMBT5N07D2","EDDAMBT5N07D3","EDDAMBT5N07D4","EDDAMBT5N07D5","EDDAMBT5N07D6", & + "EDDAMBT5N07D7","EDDAMBT5N07D8","EDDAMBT5N07D9","EDDAMBT5N08D1","EDDAMBT5N08D2","EDDAMBT5N08D3","EDDAMBT5N08D4","EDDAMBT5N08D5", & + "EDDAMBT5N08D6","EDDAMBT5N08D7","EDDAMBT5N08D8","EDDAMBT5N08D9","EDDAMBT5N09D1","EDDAMBT5N09D2","EDDAMBT5N09D3","EDDAMBT5N09D4", & + "EDDAMBT5N09D5","EDDAMBT5N09D6","EDDAMBT5N09D7","EDDAMBT5N09D8","EDDAMBT5N09D9","EDDAMBT5N10D1","EDDAMBT5N10D2","EDDAMBT5N10D3", & + "EDDAMBT5N10D4","EDDAMBT5N10D5","EDDAMBT5N10D6","EDDAMBT5N10D7","EDDAMBT5N10D8","EDDAMBT5N10D9","EDDAMBT5N11D1","EDDAMBT5N11D2", & + "EDDAMBT5N11D3","EDDAMBT5N11D4","EDDAMBT5N11D5","EDDAMBT5N11D6","EDDAMBT5N11D7","EDDAMBT5N11D8","EDDAMBT5N11D9","EDDAMBT5N12D1", & + "EDDAMBT5N12D2","EDDAMBT5N12D3","EDDAMBT5N12D4","EDDAMBT5N12D5","EDDAMBT5N12D6","EDDAMBT5N12D7","EDDAMBT5N12D8","EDDAMBT5N12D9", & + "EDDAMBT5N13D1","EDDAMBT5N13D2","EDDAMBT5N13D3","EDDAMBT5N13D4","EDDAMBT5N13D5","EDDAMBT5N13D6","EDDAMBT5N13D7","EDDAMBT5N13D8", & + "EDDAMBT5N13D9","EDDAMBT5N14D1","EDDAMBT5N14D2","EDDAMBT5N14D3","EDDAMBT5N14D4","EDDAMBT5N14D5","EDDAMBT5N14D6","EDDAMBT5N14D7", & + "EDDAMBT5N14D8","EDDAMBT5N14D9","EDDAMBT5N15D1","EDDAMBT5N15D2","EDDAMBT5N15D3","EDDAMBT5N15D4","EDDAMBT5N15D5","EDDAMBT5N15D6", & + "EDDAMBT5N15D7","EDDAMBT5N15D8","EDDAMBT5N15D9","EDDAMBT5N16D1","EDDAMBT5N16D2","EDDAMBT5N16D3","EDDAMBT5N16D4","EDDAMBT5N16D5", & + "EDDAMBT5N16D6","EDDAMBT5N16D7","EDDAMBT5N16D8","EDDAMBT5N16D9","EDDAMBT5N17D1","EDDAMBT5N17D2","EDDAMBT5N17D3","EDDAMBT5N17D4", & + "EDDAMBT5N17D5","EDDAMBT5N17D6","EDDAMBT5N17D7","EDDAMBT5N17D8","EDDAMBT5N17D9","EDDAMBT5N18D1","EDDAMBT5N18D2","EDDAMBT5N18D3", & + "EDDAMBT5N18D4","EDDAMBT5N18D5","EDDAMBT5N18D6","EDDAMBT5N18D7","EDDAMBT5N18D8","EDDAMBT5N18D9","EDDAMBT5N19D1","EDDAMBT5N19D2", & + "EDDAMBT5N19D3","EDDAMBT5N19D4","EDDAMBT5N19D5","EDDAMBT5N19D6","EDDAMBT5N19D7","EDDAMBT5N19D8","EDDAMBT5N19D9","EDDAMBT5N20D1", & + "EDDAMBT5N20D2","EDDAMBT5N20D3","EDDAMBT5N20D4","EDDAMBT5N20D5","EDDAMBT5N20D6","EDDAMBT5N20D7","EDDAMBT5N20D8","EDDAMBT5N20D9", & + "EDDAMBT6N01D1","EDDAMBT6N01D2","EDDAMBT6N01D3","EDDAMBT6N01D4","EDDAMBT6N01D5","EDDAMBT6N01D6","EDDAMBT6N01D7","EDDAMBT6N01D8", & + "EDDAMBT6N01D9","EDDAMBT6N02D1","EDDAMBT6N02D2","EDDAMBT6N02D3","EDDAMBT6N02D4","EDDAMBT6N02D5","EDDAMBT6N02D6","EDDAMBT6N02D7", & + "EDDAMBT6N02D8","EDDAMBT6N02D9","EDDAMBT6N03D1","EDDAMBT6N03D2","EDDAMBT6N03D3","EDDAMBT6N03D4","EDDAMBT6N03D5","EDDAMBT6N03D6", & + "EDDAMBT6N03D7","EDDAMBT6N03D8","EDDAMBT6N03D9","EDDAMBT6N04D1","EDDAMBT6N04D2","EDDAMBT6N04D3","EDDAMBT6N04D4","EDDAMBT6N04D5", & + "EDDAMBT6N04D6","EDDAMBT6N04D7","EDDAMBT6N04D8","EDDAMBT6N04D9","EDDAMBT6N05D1","EDDAMBT6N05D2","EDDAMBT6N05D3","EDDAMBT6N05D4", & + "EDDAMBT6N05D5","EDDAMBT6N05D6","EDDAMBT6N05D7","EDDAMBT6N05D8","EDDAMBT6N05D9","EDDAMBT6N06D1","EDDAMBT6N06D2","EDDAMBT6N06D3", & + "EDDAMBT6N06D4","EDDAMBT6N06D5","EDDAMBT6N06D6","EDDAMBT6N06D7","EDDAMBT6N06D8","EDDAMBT6N06D9","EDDAMBT6N07D1","EDDAMBT6N07D2", & + "EDDAMBT6N07D3","EDDAMBT6N07D4","EDDAMBT6N07D5","EDDAMBT6N07D6","EDDAMBT6N07D7","EDDAMBT6N07D8","EDDAMBT6N07D9","EDDAMBT6N08D1", & + "EDDAMBT6N08D2","EDDAMBT6N08D3","EDDAMBT6N08D4","EDDAMBT6N08D5","EDDAMBT6N08D6","EDDAMBT6N08D7","EDDAMBT6N08D8","EDDAMBT6N08D9", & + "EDDAMBT6N09D1","EDDAMBT6N09D2","EDDAMBT6N09D3","EDDAMBT6N09D4","EDDAMBT6N09D5","EDDAMBT6N09D6","EDDAMBT6N09D7","EDDAMBT6N09D8", & + "EDDAMBT6N09D9","EDDAMBT6N10D1","EDDAMBT6N10D2","EDDAMBT6N10D3","EDDAMBT6N10D4","EDDAMBT6N10D5","EDDAMBT6N10D6","EDDAMBT6N10D7", & + "EDDAMBT6N10D8","EDDAMBT6N10D9","EDDAMBT6N11D1","EDDAMBT6N11D2","EDDAMBT6N11D3","EDDAMBT6N11D4","EDDAMBT6N11D5","EDDAMBT6N11D6", & + "EDDAMBT6N11D7","EDDAMBT6N11D8","EDDAMBT6N11D9","EDDAMBT6N12D1","EDDAMBT6N12D2","EDDAMBT6N12D3","EDDAMBT6N12D4","EDDAMBT6N12D5", & + "EDDAMBT6N12D6","EDDAMBT6N12D7","EDDAMBT6N12D8","EDDAMBT6N12D9","EDDAMBT6N13D1","EDDAMBT6N13D2","EDDAMBT6N13D3","EDDAMBT6N13D4", & + "EDDAMBT6N13D5","EDDAMBT6N13D6","EDDAMBT6N13D7","EDDAMBT6N13D8","EDDAMBT6N13D9","EDDAMBT6N14D1","EDDAMBT6N14D2","EDDAMBT6N14D3", & + "EDDAMBT6N14D4","EDDAMBT6N14D5","EDDAMBT6N14D6","EDDAMBT6N14D7","EDDAMBT6N14D8","EDDAMBT6N14D9","EDDAMBT6N15D1","EDDAMBT6N15D2", & + "EDDAMBT6N15D3","EDDAMBT6N15D4","EDDAMBT6N15D5","EDDAMBT6N15D6","EDDAMBT6N15D7","EDDAMBT6N15D8","EDDAMBT6N15D9","EDDAMBT6N16D1", & + "EDDAMBT6N16D2","EDDAMBT6N16D3","EDDAMBT6N16D4","EDDAMBT6N16D5","EDDAMBT6N16D6","EDDAMBT6N16D7","EDDAMBT6N16D8","EDDAMBT6N16D9", & + "EDDAMBT6N17D1","EDDAMBT6N17D2","EDDAMBT6N17D3","EDDAMBT6N17D4","EDDAMBT6N17D5","EDDAMBT6N17D6","EDDAMBT6N17D7","EDDAMBT6N17D8", & + "EDDAMBT6N17D9","EDDAMBT6N18D1","EDDAMBT6N18D2","EDDAMBT6N18D3","EDDAMBT6N18D4","EDDAMBT6N18D5","EDDAMBT6N18D6","EDDAMBT6N18D7", & + "EDDAMBT6N18D8","EDDAMBT6N18D9","EDDAMBT6N19D1","EDDAMBT6N19D2","EDDAMBT6N19D3","EDDAMBT6N19D4","EDDAMBT6N19D5","EDDAMBT6N19D6", & + "EDDAMBT6N19D7","EDDAMBT6N19D8","EDDAMBT6N19D9","EDDAMBT6N20D1","EDDAMBT6N20D2","EDDAMBT6N20D3","EDDAMBT6N20D4","EDDAMBT6N20D5", & + "EDDAMBT6N20D6","EDDAMBT6N20D7","EDDAMBT6N20D8","EDDAMBT6N20D9","EDDAMBT7N01D1","EDDAMBT7N01D2","EDDAMBT7N01D3","EDDAMBT7N01D4", & + "EDDAMBT7N01D5","EDDAMBT7N01D6","EDDAMBT7N01D7","EDDAMBT7N01D8","EDDAMBT7N01D9","EDDAMBT7N02D1","EDDAMBT7N02D2","EDDAMBT7N02D3", & + "EDDAMBT7N02D4","EDDAMBT7N02D5","EDDAMBT7N02D6","EDDAMBT7N02D7","EDDAMBT7N02D8","EDDAMBT7N02D9","EDDAMBT7N03D1","EDDAMBT7N03D2", & + "EDDAMBT7N03D3","EDDAMBT7N03D4","EDDAMBT7N03D5","EDDAMBT7N03D6","EDDAMBT7N03D7","EDDAMBT7N03D8","EDDAMBT7N03D9","EDDAMBT7N04D1", & + "EDDAMBT7N04D2","EDDAMBT7N04D3","EDDAMBT7N04D4","EDDAMBT7N04D5","EDDAMBT7N04D6","EDDAMBT7N04D7","EDDAMBT7N04D8","EDDAMBT7N04D9", & + "EDDAMBT7N05D1","EDDAMBT7N05D2","EDDAMBT7N05D3","EDDAMBT7N05D4","EDDAMBT7N05D5","EDDAMBT7N05D6","EDDAMBT7N05D7","EDDAMBT7N05D8", & + "EDDAMBT7N05D9","EDDAMBT7N06D1","EDDAMBT7N06D2","EDDAMBT7N06D3","EDDAMBT7N06D4","EDDAMBT7N06D5","EDDAMBT7N06D6","EDDAMBT7N06D7", & + "EDDAMBT7N06D8","EDDAMBT7N06D9","EDDAMBT7N07D1","EDDAMBT7N07D2","EDDAMBT7N07D3","EDDAMBT7N07D4","EDDAMBT7N07D5","EDDAMBT7N07D6", & + "EDDAMBT7N07D7","EDDAMBT7N07D8","EDDAMBT7N07D9","EDDAMBT7N08D1","EDDAMBT7N08D2","EDDAMBT7N08D3","EDDAMBT7N08D4","EDDAMBT7N08D5", & + "EDDAMBT7N08D6","EDDAMBT7N08D7","EDDAMBT7N08D8","EDDAMBT7N08D9","EDDAMBT7N09D1","EDDAMBT7N09D2","EDDAMBT7N09D3","EDDAMBT7N09D4", & + "EDDAMBT7N09D5","EDDAMBT7N09D6","EDDAMBT7N09D7","EDDAMBT7N09D8","EDDAMBT7N09D9","EDDAMBT7N10D1","EDDAMBT7N10D2","EDDAMBT7N10D3", & + "EDDAMBT7N10D4","EDDAMBT7N10D5","EDDAMBT7N10D6","EDDAMBT7N10D7","EDDAMBT7N10D8","EDDAMBT7N10D9","EDDAMBT7N11D1","EDDAMBT7N11D2", & + "EDDAMBT7N11D3","EDDAMBT7N11D4","EDDAMBT7N11D5","EDDAMBT7N11D6","EDDAMBT7N11D7","EDDAMBT7N11D8","EDDAMBT7N11D9","EDDAMBT7N12D1", & + "EDDAMBT7N12D2","EDDAMBT7N12D3","EDDAMBT7N12D4","EDDAMBT7N12D5","EDDAMBT7N12D6","EDDAMBT7N12D7","EDDAMBT7N12D8","EDDAMBT7N12D9", & + "EDDAMBT7N13D1","EDDAMBT7N13D2","EDDAMBT7N13D3","EDDAMBT7N13D4","EDDAMBT7N13D5","EDDAMBT7N13D6","EDDAMBT7N13D7","EDDAMBT7N13D8", & + "EDDAMBT7N13D9","EDDAMBT7N14D1","EDDAMBT7N14D2","EDDAMBT7N14D3","EDDAMBT7N14D4","EDDAMBT7N14D5","EDDAMBT7N14D6","EDDAMBT7N14D7", & + "EDDAMBT7N14D8","EDDAMBT7N14D9","EDDAMBT7N15D1","EDDAMBT7N15D2","EDDAMBT7N15D3","EDDAMBT7N15D4","EDDAMBT7N15D5","EDDAMBT7N15D6", & + "EDDAMBT7N15D7","EDDAMBT7N15D8","EDDAMBT7N15D9","EDDAMBT7N16D1","EDDAMBT7N16D2","EDDAMBT7N16D3","EDDAMBT7N16D4","EDDAMBT7N16D5", & + "EDDAMBT7N16D6","EDDAMBT7N16D7","EDDAMBT7N16D8","EDDAMBT7N16D9","EDDAMBT7N17D1","EDDAMBT7N17D2","EDDAMBT7N17D3","EDDAMBT7N17D4", & + "EDDAMBT7N17D5","EDDAMBT7N17D6","EDDAMBT7N17D7","EDDAMBT7N17D8","EDDAMBT7N17D9","EDDAMBT7N18D1","EDDAMBT7N18D2","EDDAMBT7N18D3", & + "EDDAMBT7N18D4","EDDAMBT7N18D5","EDDAMBT7N18D6","EDDAMBT7N18D7","EDDAMBT7N18D8","EDDAMBT7N18D9","EDDAMBT7N19D1","EDDAMBT7N19D2", & + "EDDAMBT7N19D3","EDDAMBT7N19D4","EDDAMBT7N19D5","EDDAMBT7N19D6","EDDAMBT7N19D7","EDDAMBT7N19D8","EDDAMBT7N19D9","EDDAMBT7N20D1", & + "EDDAMBT7N20D2","EDDAMBT7N20D3","EDDAMBT7N20D4","EDDAMBT7N20D5","EDDAMBT7N20D6","EDDAMBT7N20D7","EDDAMBT7N20D8","EDDAMBT7N20D9", & + "EDDAMBT8N01D1","EDDAMBT8N01D2","EDDAMBT8N01D3","EDDAMBT8N01D4","EDDAMBT8N01D5","EDDAMBT8N01D6","EDDAMBT8N01D7","EDDAMBT8N01D8", & + "EDDAMBT8N01D9","EDDAMBT8N02D1","EDDAMBT8N02D2","EDDAMBT8N02D3","EDDAMBT8N02D4","EDDAMBT8N02D5","EDDAMBT8N02D6","EDDAMBT8N02D7", & + "EDDAMBT8N02D8","EDDAMBT8N02D9","EDDAMBT8N03D1","EDDAMBT8N03D2","EDDAMBT8N03D3","EDDAMBT8N03D4","EDDAMBT8N03D5","EDDAMBT8N03D6", & + "EDDAMBT8N03D7","EDDAMBT8N03D8","EDDAMBT8N03D9","EDDAMBT8N04D1","EDDAMBT8N04D2","EDDAMBT8N04D3","EDDAMBT8N04D4","EDDAMBT8N04D5", & + "EDDAMBT8N04D6","EDDAMBT8N04D7","EDDAMBT8N04D8","EDDAMBT8N04D9","EDDAMBT8N05D1","EDDAMBT8N05D2","EDDAMBT8N05D3","EDDAMBT8N05D4", & + "EDDAMBT8N05D5","EDDAMBT8N05D6","EDDAMBT8N05D7","EDDAMBT8N05D8","EDDAMBT8N05D9","EDDAMBT8N06D1","EDDAMBT8N06D2","EDDAMBT8N06D3", & + "EDDAMBT8N06D4","EDDAMBT8N06D5","EDDAMBT8N06D6","EDDAMBT8N06D7","EDDAMBT8N06D8","EDDAMBT8N06D9","EDDAMBT8N07D1","EDDAMBT8N07D2", & + "EDDAMBT8N07D3","EDDAMBT8N07D4","EDDAMBT8N07D5","EDDAMBT8N07D6","EDDAMBT8N07D7","EDDAMBT8N07D8","EDDAMBT8N07D9","EDDAMBT8N08D1", & + "EDDAMBT8N08D2","EDDAMBT8N08D3","EDDAMBT8N08D4","EDDAMBT8N08D5","EDDAMBT8N08D6","EDDAMBT8N08D7","EDDAMBT8N08D8","EDDAMBT8N08D9", & + "EDDAMBT8N09D1","EDDAMBT8N09D2","EDDAMBT8N09D3","EDDAMBT8N09D4","EDDAMBT8N09D5","EDDAMBT8N09D6","EDDAMBT8N09D7","EDDAMBT8N09D8", & + "EDDAMBT8N09D9","EDDAMBT8N10D1","EDDAMBT8N10D2","EDDAMBT8N10D3","EDDAMBT8N10D4","EDDAMBT8N10D5","EDDAMBT8N10D6","EDDAMBT8N10D7", & + "EDDAMBT8N10D8","EDDAMBT8N10D9","EDDAMBT8N11D1","EDDAMBT8N11D2","EDDAMBT8N11D3","EDDAMBT8N11D4","EDDAMBT8N11D5","EDDAMBT8N11D6", & + "EDDAMBT8N11D7","EDDAMBT8N11D8","EDDAMBT8N11D9","EDDAMBT8N12D1","EDDAMBT8N12D2","EDDAMBT8N12D3","EDDAMBT8N12D4","EDDAMBT8N12D5", & + "EDDAMBT8N12D6","EDDAMBT8N12D7","EDDAMBT8N12D8","EDDAMBT8N12D9","EDDAMBT8N13D1","EDDAMBT8N13D2","EDDAMBT8N13D3","EDDAMBT8N13D4", & + "EDDAMBT8N13D5","EDDAMBT8N13D6","EDDAMBT8N13D7","EDDAMBT8N13D8","EDDAMBT8N13D9","EDDAMBT8N14D1","EDDAMBT8N14D2","EDDAMBT8N14D3", & + "EDDAMBT8N14D4","EDDAMBT8N14D5","EDDAMBT8N14D6","EDDAMBT8N14D7","EDDAMBT8N14D8","EDDAMBT8N14D9","EDDAMBT8N15D1","EDDAMBT8N15D2", & + "EDDAMBT8N15D3","EDDAMBT8N15D4","EDDAMBT8N15D5","EDDAMBT8N15D6","EDDAMBT8N15D7","EDDAMBT8N15D8","EDDAMBT8N15D9","EDDAMBT8N16D1", & + "EDDAMBT8N16D2","EDDAMBT8N16D3","EDDAMBT8N16D4","EDDAMBT8N16D5","EDDAMBT8N16D6","EDDAMBT8N16D7","EDDAMBT8N16D8","EDDAMBT8N16D9", & + "EDDAMBT8N17D1","EDDAMBT8N17D2","EDDAMBT8N17D3","EDDAMBT8N17D4","EDDAMBT8N17D5","EDDAMBT8N17D6","EDDAMBT8N17D7","EDDAMBT8N17D8", & + "EDDAMBT8N17D9","EDDAMBT8N18D1","EDDAMBT8N18D2","EDDAMBT8N18D3","EDDAMBT8N18D4","EDDAMBT8N18D5","EDDAMBT8N18D6","EDDAMBT8N18D7", & + "EDDAMBT8N18D8","EDDAMBT8N18D9","EDDAMBT8N19D1","EDDAMBT8N19D2","EDDAMBT8N19D3","EDDAMBT8N19D4","EDDAMBT8N19D5","EDDAMBT8N19D6", & + "EDDAMBT8N19D7","EDDAMBT8N19D8","EDDAMBT8N19D9","EDDAMBT8N20D1","EDDAMBT8N20D2","EDDAMBT8N20D3","EDDAMBT8N20D4","EDDAMBT8N20D5", & + "EDDAMBT8N20D6","EDDAMBT8N20D7","EDDAMBT8N20D8","EDDAMBT8N20D9","EDDAMBT9N01D1","EDDAMBT9N01D2","EDDAMBT9N01D3","EDDAMBT9N01D4", & + "EDDAMBT9N01D5","EDDAMBT9N01D6","EDDAMBT9N01D7","EDDAMBT9N01D8","EDDAMBT9N01D9","EDDAMBT9N02D1","EDDAMBT9N02D2","EDDAMBT9N02D3", & + "EDDAMBT9N02D4","EDDAMBT9N02D5","EDDAMBT9N02D6","EDDAMBT9N02D7","EDDAMBT9N02D8","EDDAMBT9N02D9","EDDAMBT9N03D1","EDDAMBT9N03D2", & + "EDDAMBT9N03D3","EDDAMBT9N03D4","EDDAMBT9N03D5","EDDAMBT9N03D6","EDDAMBT9N03D7","EDDAMBT9N03D8","EDDAMBT9N03D9","EDDAMBT9N04D1", & + "EDDAMBT9N04D2","EDDAMBT9N04D3","EDDAMBT9N04D4","EDDAMBT9N04D5","EDDAMBT9N04D6","EDDAMBT9N04D7","EDDAMBT9N04D8","EDDAMBT9N04D9", & + "EDDAMBT9N05D1","EDDAMBT9N05D2","EDDAMBT9N05D3","EDDAMBT9N05D4","EDDAMBT9N05D5","EDDAMBT9N05D6","EDDAMBT9N05D7","EDDAMBT9N05D8", & + "EDDAMBT9N05D9","EDDAMBT9N06D1","EDDAMBT9N06D2","EDDAMBT9N06D3","EDDAMBT9N06D4","EDDAMBT9N06D5","EDDAMBT9N06D6","EDDAMBT9N06D7", & + "EDDAMBT9N06D8","EDDAMBT9N06D9","EDDAMBT9N07D1","EDDAMBT9N07D2","EDDAMBT9N07D3","EDDAMBT9N07D4","EDDAMBT9N07D5","EDDAMBT9N07D6", & + "EDDAMBT9N07D7","EDDAMBT9N07D8","EDDAMBT9N07D9","EDDAMBT9N08D1","EDDAMBT9N08D2","EDDAMBT9N08D3","EDDAMBT9N08D4","EDDAMBT9N08D5", & + "EDDAMBT9N08D6","EDDAMBT9N08D7","EDDAMBT9N08D8","EDDAMBT9N08D9","EDDAMBT9N09D1","EDDAMBT9N09D2","EDDAMBT9N09D3","EDDAMBT9N09D4", & + "EDDAMBT9N09D5","EDDAMBT9N09D6","EDDAMBT9N09D7","EDDAMBT9N09D8","EDDAMBT9N09D9","EDDAMBT9N10D1","EDDAMBT9N10D2","EDDAMBT9N10D3", & + "EDDAMBT9N10D4","EDDAMBT9N10D5","EDDAMBT9N10D6","EDDAMBT9N10D7","EDDAMBT9N10D8","EDDAMBT9N10D9","EDDAMBT9N11D1","EDDAMBT9N11D2", & + "EDDAMBT9N11D3","EDDAMBT9N11D4","EDDAMBT9N11D5","EDDAMBT9N11D6","EDDAMBT9N11D7","EDDAMBT9N11D8","EDDAMBT9N11D9","EDDAMBT9N12D1", & + "EDDAMBT9N12D2","EDDAMBT9N12D3","EDDAMBT9N12D4","EDDAMBT9N12D5","EDDAMBT9N12D6","EDDAMBT9N12D7","EDDAMBT9N12D8","EDDAMBT9N12D9", & + "EDDAMBT9N13D1","EDDAMBT9N13D2","EDDAMBT9N13D3","EDDAMBT9N13D4","EDDAMBT9N13D5","EDDAMBT9N13D6","EDDAMBT9N13D7","EDDAMBT9N13D8", & + "EDDAMBT9N13D9","EDDAMBT9N14D1","EDDAMBT9N14D2","EDDAMBT9N14D3","EDDAMBT9N14D4","EDDAMBT9N14D5","EDDAMBT9N14D6","EDDAMBT9N14D7", & + "EDDAMBT9N14D8","EDDAMBT9N14D9","EDDAMBT9N15D1","EDDAMBT9N15D2","EDDAMBT9N15D3","EDDAMBT9N15D4","EDDAMBT9N15D5","EDDAMBT9N15D6", & + "EDDAMBT9N15D7","EDDAMBT9N15D8","EDDAMBT9N15D9","EDDAMBT9N16D1","EDDAMBT9N16D2","EDDAMBT9N16D3","EDDAMBT9N16D4","EDDAMBT9N16D5", & + "EDDAMBT9N16D6","EDDAMBT9N16D7","EDDAMBT9N16D8","EDDAMBT9N16D9","EDDAMBT9N17D1","EDDAMBT9N17D2","EDDAMBT9N17D3","EDDAMBT9N17D4", & + "EDDAMBT9N17D5","EDDAMBT9N17D6","EDDAMBT9N17D7","EDDAMBT9N17D8","EDDAMBT9N17D9","EDDAMBT9N18D1","EDDAMBT9N18D2","EDDAMBT9N18D3", & + "EDDAMBT9N18D4","EDDAMBT9N18D5","EDDAMBT9N18D6","EDDAMBT9N18D7","EDDAMBT9N18D8","EDDAMBT9N18D9","EDDAMBT9N19D1","EDDAMBT9N19D2", & + "EDDAMBT9N19D3","EDDAMBT9N19D4","EDDAMBT9N19D5","EDDAMBT9N19D6","EDDAMBT9N19D7","EDDAMBT9N19D8","EDDAMBT9N19D9","EDDAMBT9N20D1", & + "EDDAMBT9N20D2","EDDAMBT9N20D3","EDDAMBT9N20D4","EDDAMBT9N20D5","EDDAMBT9N20D6","EDDAMBT9N20D7","EDDAMBT9N20D8","EDDAMBT9N20D9", & + "EDDSHRT1N01D1","EDDSHRT1N01D2","EDDSHRT1N01D3","EDDSHRT1N01D4","EDDSHRT1N01D5","EDDSHRT1N01D6","EDDSHRT1N01D7","EDDSHRT1N01D8", & + "EDDSHRT1N01D9","EDDSHRT1N02D1","EDDSHRT1N02D2","EDDSHRT1N02D3","EDDSHRT1N02D4","EDDSHRT1N02D5","EDDSHRT1N02D6","EDDSHRT1N02D7", & + "EDDSHRT1N02D8","EDDSHRT1N02D9","EDDSHRT1N03D1","EDDSHRT1N03D2","EDDSHRT1N03D3","EDDSHRT1N03D4","EDDSHRT1N03D5","EDDSHRT1N03D6", & + "EDDSHRT1N03D7","EDDSHRT1N03D8","EDDSHRT1N03D9","EDDSHRT1N04D1","EDDSHRT1N04D2","EDDSHRT1N04D3","EDDSHRT1N04D4","EDDSHRT1N04D5", & + "EDDSHRT1N04D6","EDDSHRT1N04D7","EDDSHRT1N04D8","EDDSHRT1N04D9","EDDSHRT1N05D1","EDDSHRT1N05D2","EDDSHRT1N05D3","EDDSHRT1N05D4", & + "EDDSHRT1N05D5","EDDSHRT1N05D6","EDDSHRT1N05D7","EDDSHRT1N05D8","EDDSHRT1N05D9","EDDSHRT1N06D1","EDDSHRT1N06D2","EDDSHRT1N06D3", & + "EDDSHRT1N06D4","EDDSHRT1N06D5","EDDSHRT1N06D6","EDDSHRT1N06D7","EDDSHRT1N06D8","EDDSHRT1N06D9","EDDSHRT1N07D1","EDDSHRT1N07D2", & + "EDDSHRT1N07D3","EDDSHRT1N07D4","EDDSHRT1N07D5","EDDSHRT1N07D6","EDDSHRT1N07D7","EDDSHRT1N07D8","EDDSHRT1N07D9","EDDSHRT1N08D1", & + "EDDSHRT1N08D2","EDDSHRT1N08D3","EDDSHRT1N08D4","EDDSHRT1N08D5","EDDSHRT1N08D6","EDDSHRT1N08D7","EDDSHRT1N08D8","EDDSHRT1N08D9", & + "EDDSHRT1N09D1","EDDSHRT1N09D2","EDDSHRT1N09D3","EDDSHRT1N09D4","EDDSHRT1N09D5","EDDSHRT1N09D6","EDDSHRT1N09D7","EDDSHRT1N09D8", & + "EDDSHRT1N09D9","EDDSHRT1N10D1","EDDSHRT1N10D2","EDDSHRT1N10D3","EDDSHRT1N10D4","EDDSHRT1N10D5","EDDSHRT1N10D6","EDDSHRT1N10D7", & + "EDDSHRT1N10D8","EDDSHRT1N10D9","EDDSHRT1N11D1","EDDSHRT1N11D2","EDDSHRT1N11D3","EDDSHRT1N11D4","EDDSHRT1N11D5","EDDSHRT1N11D6", & + "EDDSHRT1N11D7","EDDSHRT1N11D8","EDDSHRT1N11D9","EDDSHRT1N12D1","EDDSHRT1N12D2","EDDSHRT1N12D3","EDDSHRT1N12D4","EDDSHRT1N12D5", & + "EDDSHRT1N12D6","EDDSHRT1N12D7","EDDSHRT1N12D8","EDDSHRT1N12D9","EDDSHRT1N13D1","EDDSHRT1N13D2","EDDSHRT1N13D3","EDDSHRT1N13D4", & + "EDDSHRT1N13D5","EDDSHRT1N13D6","EDDSHRT1N13D7","EDDSHRT1N13D8","EDDSHRT1N13D9","EDDSHRT1N14D1","EDDSHRT1N14D2","EDDSHRT1N14D3", & + "EDDSHRT1N14D4","EDDSHRT1N14D5","EDDSHRT1N14D6","EDDSHRT1N14D7","EDDSHRT1N14D8","EDDSHRT1N14D9","EDDSHRT1N15D1","EDDSHRT1N15D2", & + "EDDSHRT1N15D3","EDDSHRT1N15D4","EDDSHRT1N15D5","EDDSHRT1N15D6","EDDSHRT1N15D7","EDDSHRT1N15D8","EDDSHRT1N15D9","EDDSHRT1N16D1", & + "EDDSHRT1N16D2","EDDSHRT1N16D3","EDDSHRT1N16D4","EDDSHRT1N16D5","EDDSHRT1N16D6","EDDSHRT1N16D7","EDDSHRT1N16D8","EDDSHRT1N16D9", & + "EDDSHRT1N17D1","EDDSHRT1N17D2","EDDSHRT1N17D3","EDDSHRT1N17D4","EDDSHRT1N17D5","EDDSHRT1N17D6","EDDSHRT1N17D7","EDDSHRT1N17D8", & + "EDDSHRT1N17D9","EDDSHRT1N18D1","EDDSHRT1N18D2","EDDSHRT1N18D3","EDDSHRT1N18D4","EDDSHRT1N18D5","EDDSHRT1N18D6","EDDSHRT1N18D7", & + "EDDSHRT1N18D8","EDDSHRT1N18D9","EDDSHRT1N19D1","EDDSHRT1N19D2","EDDSHRT1N19D3","EDDSHRT1N19D4","EDDSHRT1N19D5","EDDSHRT1N19D6", & + "EDDSHRT1N19D7","EDDSHRT1N19D8","EDDSHRT1N19D9","EDDSHRT1N20D1","EDDSHRT1N20D2","EDDSHRT1N20D3","EDDSHRT1N20D4","EDDSHRT1N20D5", & + "EDDSHRT1N20D6","EDDSHRT1N20D7","EDDSHRT1N20D8","EDDSHRT1N20D9","EDDSHRT2N01D1","EDDSHRT2N01D2","EDDSHRT2N01D3","EDDSHRT2N01D4", & + "EDDSHRT2N01D5","EDDSHRT2N01D6","EDDSHRT2N01D7","EDDSHRT2N01D8","EDDSHRT2N01D9","EDDSHRT2N02D1","EDDSHRT2N02D2","EDDSHRT2N02D3", & + "EDDSHRT2N02D4","EDDSHRT2N02D5","EDDSHRT2N02D6","EDDSHRT2N02D7","EDDSHRT2N02D8","EDDSHRT2N02D9","EDDSHRT2N03D1","EDDSHRT2N03D2", & + "EDDSHRT2N03D3","EDDSHRT2N03D4","EDDSHRT2N03D5","EDDSHRT2N03D6","EDDSHRT2N03D7","EDDSHRT2N03D8","EDDSHRT2N03D9","EDDSHRT2N04D1", & + "EDDSHRT2N04D2","EDDSHRT2N04D3","EDDSHRT2N04D4","EDDSHRT2N04D5","EDDSHRT2N04D6","EDDSHRT2N04D7","EDDSHRT2N04D8","EDDSHRT2N04D9", & + "EDDSHRT2N05D1","EDDSHRT2N05D2","EDDSHRT2N05D3","EDDSHRT2N05D4","EDDSHRT2N05D5","EDDSHRT2N05D6","EDDSHRT2N05D7","EDDSHRT2N05D8", & + "EDDSHRT2N05D9","EDDSHRT2N06D1","EDDSHRT2N06D2","EDDSHRT2N06D3","EDDSHRT2N06D4","EDDSHRT2N06D5","EDDSHRT2N06D6","EDDSHRT2N06D7", & + "EDDSHRT2N06D8","EDDSHRT2N06D9","EDDSHRT2N07D1","EDDSHRT2N07D2","EDDSHRT2N07D3","EDDSHRT2N07D4","EDDSHRT2N07D5","EDDSHRT2N07D6"/) + ValidParamAry(2041:4080) = (/ & + "EDDSHRT2N07D7","EDDSHRT2N07D8","EDDSHRT2N07D9","EDDSHRT2N08D1","EDDSHRT2N08D2","EDDSHRT2N08D3","EDDSHRT2N08D4","EDDSHRT2N08D5", & + "EDDSHRT2N08D6","EDDSHRT2N08D7","EDDSHRT2N08D8","EDDSHRT2N08D9","EDDSHRT2N09D1","EDDSHRT2N09D2","EDDSHRT2N09D3","EDDSHRT2N09D4", & + "EDDSHRT2N09D5","EDDSHRT2N09D6","EDDSHRT2N09D7","EDDSHRT2N09D8","EDDSHRT2N09D9","EDDSHRT2N10D1","EDDSHRT2N10D2","EDDSHRT2N10D3", & + "EDDSHRT2N10D4","EDDSHRT2N10D5","EDDSHRT2N10D6","EDDSHRT2N10D7","EDDSHRT2N10D8","EDDSHRT2N10D9","EDDSHRT2N11D1","EDDSHRT2N11D2", & + "EDDSHRT2N11D3","EDDSHRT2N11D4","EDDSHRT2N11D5","EDDSHRT2N11D6","EDDSHRT2N11D7","EDDSHRT2N11D8","EDDSHRT2N11D9","EDDSHRT2N12D1", & + "EDDSHRT2N12D2","EDDSHRT2N12D3","EDDSHRT2N12D4","EDDSHRT2N12D5","EDDSHRT2N12D6","EDDSHRT2N12D7","EDDSHRT2N12D8","EDDSHRT2N12D9", & + "EDDSHRT2N13D1","EDDSHRT2N13D2","EDDSHRT2N13D3","EDDSHRT2N13D4","EDDSHRT2N13D5","EDDSHRT2N13D6","EDDSHRT2N13D7","EDDSHRT2N13D8", & + "EDDSHRT2N13D9","EDDSHRT2N14D1","EDDSHRT2N14D2","EDDSHRT2N14D3","EDDSHRT2N14D4","EDDSHRT2N14D5","EDDSHRT2N14D6","EDDSHRT2N14D7", & + "EDDSHRT2N14D8","EDDSHRT2N14D9","EDDSHRT2N15D1","EDDSHRT2N15D2","EDDSHRT2N15D3","EDDSHRT2N15D4","EDDSHRT2N15D5","EDDSHRT2N15D6", & + "EDDSHRT2N15D7","EDDSHRT2N15D8","EDDSHRT2N15D9","EDDSHRT2N16D1","EDDSHRT2N16D2","EDDSHRT2N16D3","EDDSHRT2N16D4","EDDSHRT2N16D5", & + "EDDSHRT2N16D6","EDDSHRT2N16D7","EDDSHRT2N16D8","EDDSHRT2N16D9","EDDSHRT2N17D1","EDDSHRT2N17D2","EDDSHRT2N17D3","EDDSHRT2N17D4", & + "EDDSHRT2N17D5","EDDSHRT2N17D6","EDDSHRT2N17D7","EDDSHRT2N17D8","EDDSHRT2N17D9","EDDSHRT2N18D1","EDDSHRT2N18D2","EDDSHRT2N18D3", & + "EDDSHRT2N18D4","EDDSHRT2N18D5","EDDSHRT2N18D6","EDDSHRT2N18D7","EDDSHRT2N18D8","EDDSHRT2N18D9","EDDSHRT2N19D1","EDDSHRT2N19D2", & + "EDDSHRT2N19D3","EDDSHRT2N19D4","EDDSHRT2N19D5","EDDSHRT2N19D6","EDDSHRT2N19D7","EDDSHRT2N19D8","EDDSHRT2N19D9","EDDSHRT2N20D1", & + "EDDSHRT2N20D2","EDDSHRT2N20D3","EDDSHRT2N20D4","EDDSHRT2N20D5","EDDSHRT2N20D6","EDDSHRT2N20D7","EDDSHRT2N20D8","EDDSHRT2N20D9", & + "EDDSHRT3N01D1","EDDSHRT3N01D2","EDDSHRT3N01D3","EDDSHRT3N01D4","EDDSHRT3N01D5","EDDSHRT3N01D6","EDDSHRT3N01D7","EDDSHRT3N01D8", & + "EDDSHRT3N01D9","EDDSHRT3N02D1","EDDSHRT3N02D2","EDDSHRT3N02D3","EDDSHRT3N02D4","EDDSHRT3N02D5","EDDSHRT3N02D6","EDDSHRT3N02D7", & + "EDDSHRT3N02D8","EDDSHRT3N02D9","EDDSHRT3N03D1","EDDSHRT3N03D2","EDDSHRT3N03D3","EDDSHRT3N03D4","EDDSHRT3N03D5","EDDSHRT3N03D6", & + "EDDSHRT3N03D7","EDDSHRT3N03D8","EDDSHRT3N03D9","EDDSHRT3N04D1","EDDSHRT3N04D2","EDDSHRT3N04D3","EDDSHRT3N04D4","EDDSHRT3N04D5", & + "EDDSHRT3N04D6","EDDSHRT3N04D7","EDDSHRT3N04D8","EDDSHRT3N04D9","EDDSHRT3N05D1","EDDSHRT3N05D2","EDDSHRT3N05D3","EDDSHRT3N05D4", & + "EDDSHRT3N05D5","EDDSHRT3N05D6","EDDSHRT3N05D7","EDDSHRT3N05D8","EDDSHRT3N05D9","EDDSHRT3N06D1","EDDSHRT3N06D2","EDDSHRT3N06D3", & + "EDDSHRT3N06D4","EDDSHRT3N06D5","EDDSHRT3N06D6","EDDSHRT3N06D7","EDDSHRT3N06D8","EDDSHRT3N06D9","EDDSHRT3N07D1","EDDSHRT3N07D2", & + "EDDSHRT3N07D3","EDDSHRT3N07D4","EDDSHRT3N07D5","EDDSHRT3N07D6","EDDSHRT3N07D7","EDDSHRT3N07D8","EDDSHRT3N07D9","EDDSHRT3N08D1", & + "EDDSHRT3N08D2","EDDSHRT3N08D3","EDDSHRT3N08D4","EDDSHRT3N08D5","EDDSHRT3N08D6","EDDSHRT3N08D7","EDDSHRT3N08D8","EDDSHRT3N08D9", & + "EDDSHRT3N09D1","EDDSHRT3N09D2","EDDSHRT3N09D3","EDDSHRT3N09D4","EDDSHRT3N09D5","EDDSHRT3N09D6","EDDSHRT3N09D7","EDDSHRT3N09D8", & + "EDDSHRT3N09D9","EDDSHRT3N10D1","EDDSHRT3N10D2","EDDSHRT3N10D3","EDDSHRT3N10D4","EDDSHRT3N10D5","EDDSHRT3N10D6","EDDSHRT3N10D7", & + "EDDSHRT3N10D8","EDDSHRT3N10D9","EDDSHRT3N11D1","EDDSHRT3N11D2","EDDSHRT3N11D3","EDDSHRT3N11D4","EDDSHRT3N11D5","EDDSHRT3N11D6", & + "EDDSHRT3N11D7","EDDSHRT3N11D8","EDDSHRT3N11D9","EDDSHRT3N12D1","EDDSHRT3N12D2","EDDSHRT3N12D3","EDDSHRT3N12D4","EDDSHRT3N12D5", & + "EDDSHRT3N12D6","EDDSHRT3N12D7","EDDSHRT3N12D8","EDDSHRT3N12D9","EDDSHRT3N13D1","EDDSHRT3N13D2","EDDSHRT3N13D3","EDDSHRT3N13D4", & + "EDDSHRT3N13D5","EDDSHRT3N13D6","EDDSHRT3N13D7","EDDSHRT3N13D8","EDDSHRT3N13D9","EDDSHRT3N14D1","EDDSHRT3N14D2","EDDSHRT3N14D3", & + "EDDSHRT3N14D4","EDDSHRT3N14D5","EDDSHRT3N14D6","EDDSHRT3N14D7","EDDSHRT3N14D8","EDDSHRT3N14D9","EDDSHRT3N15D1","EDDSHRT3N15D2", & + "EDDSHRT3N15D3","EDDSHRT3N15D4","EDDSHRT3N15D5","EDDSHRT3N15D6","EDDSHRT3N15D7","EDDSHRT3N15D8","EDDSHRT3N15D9","EDDSHRT3N16D1", & + "EDDSHRT3N16D2","EDDSHRT3N16D3","EDDSHRT3N16D4","EDDSHRT3N16D5","EDDSHRT3N16D6","EDDSHRT3N16D7","EDDSHRT3N16D8","EDDSHRT3N16D9", & + "EDDSHRT3N17D1","EDDSHRT3N17D2","EDDSHRT3N17D3","EDDSHRT3N17D4","EDDSHRT3N17D5","EDDSHRT3N17D6","EDDSHRT3N17D7","EDDSHRT3N17D8", & + "EDDSHRT3N17D9","EDDSHRT3N18D1","EDDSHRT3N18D2","EDDSHRT3N18D3","EDDSHRT3N18D4","EDDSHRT3N18D5","EDDSHRT3N18D6","EDDSHRT3N18D7", & + "EDDSHRT3N18D8","EDDSHRT3N18D9","EDDSHRT3N19D1","EDDSHRT3N19D2","EDDSHRT3N19D3","EDDSHRT3N19D4","EDDSHRT3N19D5","EDDSHRT3N19D6", & + "EDDSHRT3N19D7","EDDSHRT3N19D8","EDDSHRT3N19D9","EDDSHRT3N20D1","EDDSHRT3N20D2","EDDSHRT3N20D3","EDDSHRT3N20D4","EDDSHRT3N20D5", & + "EDDSHRT3N20D6","EDDSHRT3N20D7","EDDSHRT3N20D8","EDDSHRT3N20D9","EDDSHRT4N01D1","EDDSHRT4N01D2","EDDSHRT4N01D3","EDDSHRT4N01D4", & + "EDDSHRT4N01D5","EDDSHRT4N01D6","EDDSHRT4N01D7","EDDSHRT4N01D8","EDDSHRT4N01D9","EDDSHRT4N02D1","EDDSHRT4N02D2","EDDSHRT4N02D3", & + "EDDSHRT4N02D4","EDDSHRT4N02D5","EDDSHRT4N02D6","EDDSHRT4N02D7","EDDSHRT4N02D8","EDDSHRT4N02D9","EDDSHRT4N03D1","EDDSHRT4N03D2", & + "EDDSHRT4N03D3","EDDSHRT4N03D4","EDDSHRT4N03D5","EDDSHRT4N03D6","EDDSHRT4N03D7","EDDSHRT4N03D8","EDDSHRT4N03D9","EDDSHRT4N04D1", & + "EDDSHRT4N04D2","EDDSHRT4N04D3","EDDSHRT4N04D4","EDDSHRT4N04D5","EDDSHRT4N04D6","EDDSHRT4N04D7","EDDSHRT4N04D8","EDDSHRT4N04D9", & + "EDDSHRT4N05D1","EDDSHRT4N05D2","EDDSHRT4N05D3","EDDSHRT4N05D4","EDDSHRT4N05D5","EDDSHRT4N05D6","EDDSHRT4N05D7","EDDSHRT4N05D8", & + "EDDSHRT4N05D9","EDDSHRT4N06D1","EDDSHRT4N06D2","EDDSHRT4N06D3","EDDSHRT4N06D4","EDDSHRT4N06D5","EDDSHRT4N06D6","EDDSHRT4N06D7", & + "EDDSHRT4N06D8","EDDSHRT4N06D9","EDDSHRT4N07D1","EDDSHRT4N07D2","EDDSHRT4N07D3","EDDSHRT4N07D4","EDDSHRT4N07D5","EDDSHRT4N07D6", & + "EDDSHRT4N07D7","EDDSHRT4N07D8","EDDSHRT4N07D9","EDDSHRT4N08D1","EDDSHRT4N08D2","EDDSHRT4N08D3","EDDSHRT4N08D4","EDDSHRT4N08D5", & + "EDDSHRT4N08D6","EDDSHRT4N08D7","EDDSHRT4N08D8","EDDSHRT4N08D9","EDDSHRT4N09D1","EDDSHRT4N09D2","EDDSHRT4N09D3","EDDSHRT4N09D4", & + "EDDSHRT4N09D5","EDDSHRT4N09D6","EDDSHRT4N09D7","EDDSHRT4N09D8","EDDSHRT4N09D9","EDDSHRT4N10D1","EDDSHRT4N10D2","EDDSHRT4N10D3", & + "EDDSHRT4N10D4","EDDSHRT4N10D5","EDDSHRT4N10D6","EDDSHRT4N10D7","EDDSHRT4N10D8","EDDSHRT4N10D9","EDDSHRT4N11D1","EDDSHRT4N11D2", & + "EDDSHRT4N11D3","EDDSHRT4N11D4","EDDSHRT4N11D5","EDDSHRT4N11D6","EDDSHRT4N11D7","EDDSHRT4N11D8","EDDSHRT4N11D9","EDDSHRT4N12D1", & + "EDDSHRT4N12D2","EDDSHRT4N12D3","EDDSHRT4N12D4","EDDSHRT4N12D5","EDDSHRT4N12D6","EDDSHRT4N12D7","EDDSHRT4N12D8","EDDSHRT4N12D9", & + "EDDSHRT4N13D1","EDDSHRT4N13D2","EDDSHRT4N13D3","EDDSHRT4N13D4","EDDSHRT4N13D5","EDDSHRT4N13D6","EDDSHRT4N13D7","EDDSHRT4N13D8", & + "EDDSHRT4N13D9","EDDSHRT4N14D1","EDDSHRT4N14D2","EDDSHRT4N14D3","EDDSHRT4N14D4","EDDSHRT4N14D5","EDDSHRT4N14D6","EDDSHRT4N14D7", & + "EDDSHRT4N14D8","EDDSHRT4N14D9","EDDSHRT4N15D1","EDDSHRT4N15D2","EDDSHRT4N15D3","EDDSHRT4N15D4","EDDSHRT4N15D5","EDDSHRT4N15D6", & + "EDDSHRT4N15D7","EDDSHRT4N15D8","EDDSHRT4N15D9","EDDSHRT4N16D1","EDDSHRT4N16D2","EDDSHRT4N16D3","EDDSHRT4N16D4","EDDSHRT4N16D5", & + "EDDSHRT4N16D6","EDDSHRT4N16D7","EDDSHRT4N16D8","EDDSHRT4N16D9","EDDSHRT4N17D1","EDDSHRT4N17D2","EDDSHRT4N17D3","EDDSHRT4N17D4", & + "EDDSHRT4N17D5","EDDSHRT4N17D6","EDDSHRT4N17D7","EDDSHRT4N17D8","EDDSHRT4N17D9","EDDSHRT4N18D1","EDDSHRT4N18D2","EDDSHRT4N18D3", & + "EDDSHRT4N18D4","EDDSHRT4N18D5","EDDSHRT4N18D6","EDDSHRT4N18D7","EDDSHRT4N18D8","EDDSHRT4N18D9","EDDSHRT4N19D1","EDDSHRT4N19D2", & + "EDDSHRT4N19D3","EDDSHRT4N19D4","EDDSHRT4N19D5","EDDSHRT4N19D6","EDDSHRT4N19D7","EDDSHRT4N19D8","EDDSHRT4N19D9","EDDSHRT4N20D1", & + "EDDSHRT4N20D2","EDDSHRT4N20D3","EDDSHRT4N20D4","EDDSHRT4N20D5","EDDSHRT4N20D6","EDDSHRT4N20D7","EDDSHRT4N20D8","EDDSHRT4N20D9", & + "EDDSHRT5N01D1","EDDSHRT5N01D2","EDDSHRT5N01D3","EDDSHRT5N01D4","EDDSHRT5N01D5","EDDSHRT5N01D6","EDDSHRT5N01D7","EDDSHRT5N01D8", & + "EDDSHRT5N01D9","EDDSHRT5N02D1","EDDSHRT5N02D2","EDDSHRT5N02D3","EDDSHRT5N02D4","EDDSHRT5N02D5","EDDSHRT5N02D6","EDDSHRT5N02D7", & + "EDDSHRT5N02D8","EDDSHRT5N02D9","EDDSHRT5N03D1","EDDSHRT5N03D2","EDDSHRT5N03D3","EDDSHRT5N03D4","EDDSHRT5N03D5","EDDSHRT5N03D6", & + "EDDSHRT5N03D7","EDDSHRT5N03D8","EDDSHRT5N03D9","EDDSHRT5N04D1","EDDSHRT5N04D2","EDDSHRT5N04D3","EDDSHRT5N04D4","EDDSHRT5N04D5", & + "EDDSHRT5N04D6","EDDSHRT5N04D7","EDDSHRT5N04D8","EDDSHRT5N04D9","EDDSHRT5N05D1","EDDSHRT5N05D2","EDDSHRT5N05D3","EDDSHRT5N05D4", & + "EDDSHRT5N05D5","EDDSHRT5N05D6","EDDSHRT5N05D7","EDDSHRT5N05D8","EDDSHRT5N05D9","EDDSHRT5N06D1","EDDSHRT5N06D2","EDDSHRT5N06D3", & + "EDDSHRT5N06D4","EDDSHRT5N06D5","EDDSHRT5N06D6","EDDSHRT5N06D7","EDDSHRT5N06D8","EDDSHRT5N06D9","EDDSHRT5N07D1","EDDSHRT5N07D2", & + "EDDSHRT5N07D3","EDDSHRT5N07D4","EDDSHRT5N07D5","EDDSHRT5N07D6","EDDSHRT5N07D7","EDDSHRT5N07D8","EDDSHRT5N07D9","EDDSHRT5N08D1", & + "EDDSHRT5N08D2","EDDSHRT5N08D3","EDDSHRT5N08D4","EDDSHRT5N08D5","EDDSHRT5N08D6","EDDSHRT5N08D7","EDDSHRT5N08D8","EDDSHRT5N08D9", & + "EDDSHRT5N09D1","EDDSHRT5N09D2","EDDSHRT5N09D3","EDDSHRT5N09D4","EDDSHRT5N09D5","EDDSHRT5N09D6","EDDSHRT5N09D7","EDDSHRT5N09D8", & + "EDDSHRT5N09D9","EDDSHRT5N10D1","EDDSHRT5N10D2","EDDSHRT5N10D3","EDDSHRT5N10D4","EDDSHRT5N10D5","EDDSHRT5N10D6","EDDSHRT5N10D7", & + "EDDSHRT5N10D8","EDDSHRT5N10D9","EDDSHRT5N11D1","EDDSHRT5N11D2","EDDSHRT5N11D3","EDDSHRT5N11D4","EDDSHRT5N11D5","EDDSHRT5N11D6", & + "EDDSHRT5N11D7","EDDSHRT5N11D8","EDDSHRT5N11D9","EDDSHRT5N12D1","EDDSHRT5N12D2","EDDSHRT5N12D3","EDDSHRT5N12D4","EDDSHRT5N12D5", & + "EDDSHRT5N12D6","EDDSHRT5N12D7","EDDSHRT5N12D8","EDDSHRT5N12D9","EDDSHRT5N13D1","EDDSHRT5N13D2","EDDSHRT5N13D3","EDDSHRT5N13D4", & + "EDDSHRT5N13D5","EDDSHRT5N13D6","EDDSHRT5N13D7","EDDSHRT5N13D8","EDDSHRT5N13D9","EDDSHRT5N14D1","EDDSHRT5N14D2","EDDSHRT5N14D3", & + "EDDSHRT5N14D4","EDDSHRT5N14D5","EDDSHRT5N14D6","EDDSHRT5N14D7","EDDSHRT5N14D8","EDDSHRT5N14D9","EDDSHRT5N15D1","EDDSHRT5N15D2", & + "EDDSHRT5N15D3","EDDSHRT5N15D4","EDDSHRT5N15D5","EDDSHRT5N15D6","EDDSHRT5N15D7","EDDSHRT5N15D8","EDDSHRT5N15D9","EDDSHRT5N16D1", & + "EDDSHRT5N16D2","EDDSHRT5N16D3","EDDSHRT5N16D4","EDDSHRT5N16D5","EDDSHRT5N16D6","EDDSHRT5N16D7","EDDSHRT5N16D8","EDDSHRT5N16D9", & + "EDDSHRT5N17D1","EDDSHRT5N17D2","EDDSHRT5N17D3","EDDSHRT5N17D4","EDDSHRT5N17D5","EDDSHRT5N17D6","EDDSHRT5N17D7","EDDSHRT5N17D8", & + "EDDSHRT5N17D9","EDDSHRT5N18D1","EDDSHRT5N18D2","EDDSHRT5N18D3","EDDSHRT5N18D4","EDDSHRT5N18D5","EDDSHRT5N18D6","EDDSHRT5N18D7", & + "EDDSHRT5N18D8","EDDSHRT5N18D9","EDDSHRT5N19D1","EDDSHRT5N19D2","EDDSHRT5N19D3","EDDSHRT5N19D4","EDDSHRT5N19D5","EDDSHRT5N19D6", & + "EDDSHRT5N19D7","EDDSHRT5N19D8","EDDSHRT5N19D9","EDDSHRT5N20D1","EDDSHRT5N20D2","EDDSHRT5N20D3","EDDSHRT5N20D4","EDDSHRT5N20D5", & + "EDDSHRT5N20D6","EDDSHRT5N20D7","EDDSHRT5N20D8","EDDSHRT5N20D9","EDDSHRT6N01D1","EDDSHRT6N01D2","EDDSHRT6N01D3","EDDSHRT6N01D4", & + "EDDSHRT6N01D5","EDDSHRT6N01D6","EDDSHRT6N01D7","EDDSHRT6N01D8","EDDSHRT6N01D9","EDDSHRT6N02D1","EDDSHRT6N02D2","EDDSHRT6N02D3", & + "EDDSHRT6N02D4","EDDSHRT6N02D5","EDDSHRT6N02D6","EDDSHRT6N02D7","EDDSHRT6N02D8","EDDSHRT6N02D9","EDDSHRT6N03D1","EDDSHRT6N03D2", & + "EDDSHRT6N03D3","EDDSHRT6N03D4","EDDSHRT6N03D5","EDDSHRT6N03D6","EDDSHRT6N03D7","EDDSHRT6N03D8","EDDSHRT6N03D9","EDDSHRT6N04D1", & + "EDDSHRT6N04D2","EDDSHRT6N04D3","EDDSHRT6N04D4","EDDSHRT6N04D5","EDDSHRT6N04D6","EDDSHRT6N04D7","EDDSHRT6N04D8","EDDSHRT6N04D9", & + "EDDSHRT6N05D1","EDDSHRT6N05D2","EDDSHRT6N05D3","EDDSHRT6N05D4","EDDSHRT6N05D5","EDDSHRT6N05D6","EDDSHRT6N05D7","EDDSHRT6N05D8", & + "EDDSHRT6N05D9","EDDSHRT6N06D1","EDDSHRT6N06D2","EDDSHRT6N06D3","EDDSHRT6N06D4","EDDSHRT6N06D5","EDDSHRT6N06D6","EDDSHRT6N06D7", & + "EDDSHRT6N06D8","EDDSHRT6N06D9","EDDSHRT6N07D1","EDDSHRT6N07D2","EDDSHRT6N07D3","EDDSHRT6N07D4","EDDSHRT6N07D5","EDDSHRT6N07D6", & + "EDDSHRT6N07D7","EDDSHRT6N07D8","EDDSHRT6N07D9","EDDSHRT6N08D1","EDDSHRT6N08D2","EDDSHRT6N08D3","EDDSHRT6N08D4","EDDSHRT6N08D5", & + "EDDSHRT6N08D6","EDDSHRT6N08D7","EDDSHRT6N08D8","EDDSHRT6N08D9","EDDSHRT6N09D1","EDDSHRT6N09D2","EDDSHRT6N09D3","EDDSHRT6N09D4", & + "EDDSHRT6N09D5","EDDSHRT6N09D6","EDDSHRT6N09D7","EDDSHRT6N09D8","EDDSHRT6N09D9","EDDSHRT6N10D1","EDDSHRT6N10D2","EDDSHRT6N10D3", & + "EDDSHRT6N10D4","EDDSHRT6N10D5","EDDSHRT6N10D6","EDDSHRT6N10D7","EDDSHRT6N10D8","EDDSHRT6N10D9","EDDSHRT6N11D1","EDDSHRT6N11D2", & + "EDDSHRT6N11D3","EDDSHRT6N11D4","EDDSHRT6N11D5","EDDSHRT6N11D6","EDDSHRT6N11D7","EDDSHRT6N11D8","EDDSHRT6N11D9","EDDSHRT6N12D1", & + "EDDSHRT6N12D2","EDDSHRT6N12D3","EDDSHRT6N12D4","EDDSHRT6N12D5","EDDSHRT6N12D6","EDDSHRT6N12D7","EDDSHRT6N12D8","EDDSHRT6N12D9", & + "EDDSHRT6N13D1","EDDSHRT6N13D2","EDDSHRT6N13D3","EDDSHRT6N13D4","EDDSHRT6N13D5","EDDSHRT6N13D6","EDDSHRT6N13D7","EDDSHRT6N13D8", & + "EDDSHRT6N13D9","EDDSHRT6N14D1","EDDSHRT6N14D2","EDDSHRT6N14D3","EDDSHRT6N14D4","EDDSHRT6N14D5","EDDSHRT6N14D6","EDDSHRT6N14D7", & + "EDDSHRT6N14D8","EDDSHRT6N14D9","EDDSHRT6N15D1","EDDSHRT6N15D2","EDDSHRT6N15D3","EDDSHRT6N15D4","EDDSHRT6N15D5","EDDSHRT6N15D6", & + "EDDSHRT6N15D7","EDDSHRT6N15D8","EDDSHRT6N15D9","EDDSHRT6N16D1","EDDSHRT6N16D2","EDDSHRT6N16D3","EDDSHRT6N16D4","EDDSHRT6N16D5", & + "EDDSHRT6N16D6","EDDSHRT6N16D7","EDDSHRT6N16D8","EDDSHRT6N16D9","EDDSHRT6N17D1","EDDSHRT6N17D2","EDDSHRT6N17D3","EDDSHRT6N17D4", & + "EDDSHRT6N17D5","EDDSHRT6N17D6","EDDSHRT6N17D7","EDDSHRT6N17D8","EDDSHRT6N17D9","EDDSHRT6N18D1","EDDSHRT6N18D2","EDDSHRT6N18D3", & + "EDDSHRT6N18D4","EDDSHRT6N18D5","EDDSHRT6N18D6","EDDSHRT6N18D7","EDDSHRT6N18D8","EDDSHRT6N18D9","EDDSHRT6N19D1","EDDSHRT6N19D2", & + "EDDSHRT6N19D3","EDDSHRT6N19D4","EDDSHRT6N19D5","EDDSHRT6N19D6","EDDSHRT6N19D7","EDDSHRT6N19D8","EDDSHRT6N19D9","EDDSHRT6N20D1", & + "EDDSHRT6N20D2","EDDSHRT6N20D3","EDDSHRT6N20D4","EDDSHRT6N20D5","EDDSHRT6N20D6","EDDSHRT6N20D7","EDDSHRT6N20D8","EDDSHRT6N20D9", & + "EDDSHRT7N01D1","EDDSHRT7N01D2","EDDSHRT7N01D3","EDDSHRT7N01D4","EDDSHRT7N01D5","EDDSHRT7N01D6","EDDSHRT7N01D7","EDDSHRT7N01D8", & + "EDDSHRT7N01D9","EDDSHRT7N02D1","EDDSHRT7N02D2","EDDSHRT7N02D3","EDDSHRT7N02D4","EDDSHRT7N02D5","EDDSHRT7N02D6","EDDSHRT7N02D7", & + "EDDSHRT7N02D8","EDDSHRT7N02D9","EDDSHRT7N03D1","EDDSHRT7N03D2","EDDSHRT7N03D3","EDDSHRT7N03D4","EDDSHRT7N03D5","EDDSHRT7N03D6", & + "EDDSHRT7N03D7","EDDSHRT7N03D8","EDDSHRT7N03D9","EDDSHRT7N04D1","EDDSHRT7N04D2","EDDSHRT7N04D3","EDDSHRT7N04D4","EDDSHRT7N04D5", & + "EDDSHRT7N04D6","EDDSHRT7N04D7","EDDSHRT7N04D8","EDDSHRT7N04D9","EDDSHRT7N05D1","EDDSHRT7N05D2","EDDSHRT7N05D3","EDDSHRT7N05D4", & + "EDDSHRT7N05D5","EDDSHRT7N05D6","EDDSHRT7N05D7","EDDSHRT7N05D8","EDDSHRT7N05D9","EDDSHRT7N06D1","EDDSHRT7N06D2","EDDSHRT7N06D3", & + "EDDSHRT7N06D4","EDDSHRT7N06D5","EDDSHRT7N06D6","EDDSHRT7N06D7","EDDSHRT7N06D8","EDDSHRT7N06D9","EDDSHRT7N07D1","EDDSHRT7N07D2", & + "EDDSHRT7N07D3","EDDSHRT7N07D4","EDDSHRT7N07D5","EDDSHRT7N07D6","EDDSHRT7N07D7","EDDSHRT7N07D8","EDDSHRT7N07D9","EDDSHRT7N08D1", & + "EDDSHRT7N08D2","EDDSHRT7N08D3","EDDSHRT7N08D4","EDDSHRT7N08D5","EDDSHRT7N08D6","EDDSHRT7N08D7","EDDSHRT7N08D8","EDDSHRT7N08D9", & + "EDDSHRT7N09D1","EDDSHRT7N09D2","EDDSHRT7N09D3","EDDSHRT7N09D4","EDDSHRT7N09D5","EDDSHRT7N09D6","EDDSHRT7N09D7","EDDSHRT7N09D8", & + "EDDSHRT7N09D9","EDDSHRT7N10D1","EDDSHRT7N10D2","EDDSHRT7N10D3","EDDSHRT7N10D4","EDDSHRT7N10D5","EDDSHRT7N10D6","EDDSHRT7N10D7", & + "EDDSHRT7N10D8","EDDSHRT7N10D9","EDDSHRT7N11D1","EDDSHRT7N11D2","EDDSHRT7N11D3","EDDSHRT7N11D4","EDDSHRT7N11D5","EDDSHRT7N11D6", & + "EDDSHRT7N11D7","EDDSHRT7N11D8","EDDSHRT7N11D9","EDDSHRT7N12D1","EDDSHRT7N12D2","EDDSHRT7N12D3","EDDSHRT7N12D4","EDDSHRT7N12D5", & + "EDDSHRT7N12D6","EDDSHRT7N12D7","EDDSHRT7N12D8","EDDSHRT7N12D9","EDDSHRT7N13D1","EDDSHRT7N13D2","EDDSHRT7N13D3","EDDSHRT7N13D4", & + "EDDSHRT7N13D5","EDDSHRT7N13D6","EDDSHRT7N13D7","EDDSHRT7N13D8","EDDSHRT7N13D9","EDDSHRT7N14D1","EDDSHRT7N14D2","EDDSHRT7N14D3", & + "EDDSHRT7N14D4","EDDSHRT7N14D5","EDDSHRT7N14D6","EDDSHRT7N14D7","EDDSHRT7N14D8","EDDSHRT7N14D9","EDDSHRT7N15D1","EDDSHRT7N15D2", & + "EDDSHRT7N15D3","EDDSHRT7N15D4","EDDSHRT7N15D5","EDDSHRT7N15D6","EDDSHRT7N15D7","EDDSHRT7N15D8","EDDSHRT7N15D9","EDDSHRT7N16D1", & + "EDDSHRT7N16D2","EDDSHRT7N16D3","EDDSHRT7N16D4","EDDSHRT7N16D5","EDDSHRT7N16D6","EDDSHRT7N16D7","EDDSHRT7N16D8","EDDSHRT7N16D9", & + "EDDSHRT7N17D1","EDDSHRT7N17D2","EDDSHRT7N17D3","EDDSHRT7N17D4","EDDSHRT7N17D5","EDDSHRT7N17D6","EDDSHRT7N17D7","EDDSHRT7N17D8", & + "EDDSHRT7N17D9","EDDSHRT7N18D1","EDDSHRT7N18D2","EDDSHRT7N18D3","EDDSHRT7N18D4","EDDSHRT7N18D5","EDDSHRT7N18D6","EDDSHRT7N18D7", & + "EDDSHRT7N18D8","EDDSHRT7N18D9","EDDSHRT7N19D1","EDDSHRT7N19D2","EDDSHRT7N19D3","EDDSHRT7N19D4","EDDSHRT7N19D5","EDDSHRT7N19D6", & + "EDDSHRT7N19D7","EDDSHRT7N19D8","EDDSHRT7N19D9","EDDSHRT7N20D1","EDDSHRT7N20D2","EDDSHRT7N20D3","EDDSHRT7N20D4","EDDSHRT7N20D5", & + "EDDSHRT7N20D6","EDDSHRT7N20D7","EDDSHRT7N20D8","EDDSHRT7N20D9","EDDSHRT8N01D1","EDDSHRT8N01D2","EDDSHRT8N01D3","EDDSHRT8N01D4", & + "EDDSHRT8N01D5","EDDSHRT8N01D6","EDDSHRT8N01D7","EDDSHRT8N01D8","EDDSHRT8N01D9","EDDSHRT8N02D1","EDDSHRT8N02D2","EDDSHRT8N02D3", & + "EDDSHRT8N02D4","EDDSHRT8N02D5","EDDSHRT8N02D6","EDDSHRT8N02D7","EDDSHRT8N02D8","EDDSHRT8N02D9","EDDSHRT8N03D1","EDDSHRT8N03D2", & + "EDDSHRT8N03D3","EDDSHRT8N03D4","EDDSHRT8N03D5","EDDSHRT8N03D6","EDDSHRT8N03D7","EDDSHRT8N03D8","EDDSHRT8N03D9","EDDSHRT8N04D1", & + "EDDSHRT8N04D2","EDDSHRT8N04D3","EDDSHRT8N04D4","EDDSHRT8N04D5","EDDSHRT8N04D6","EDDSHRT8N04D7","EDDSHRT8N04D8","EDDSHRT8N04D9", & + "EDDSHRT8N05D1","EDDSHRT8N05D2","EDDSHRT8N05D3","EDDSHRT8N05D4","EDDSHRT8N05D5","EDDSHRT8N05D6","EDDSHRT8N05D7","EDDSHRT8N05D8", & + "EDDSHRT8N05D9","EDDSHRT8N06D1","EDDSHRT8N06D2","EDDSHRT8N06D3","EDDSHRT8N06D4","EDDSHRT8N06D5","EDDSHRT8N06D6","EDDSHRT8N06D7", & + "EDDSHRT8N06D8","EDDSHRT8N06D9","EDDSHRT8N07D1","EDDSHRT8N07D2","EDDSHRT8N07D3","EDDSHRT8N07D4","EDDSHRT8N07D5","EDDSHRT8N07D6", & + "EDDSHRT8N07D7","EDDSHRT8N07D8","EDDSHRT8N07D9","EDDSHRT8N08D1","EDDSHRT8N08D2","EDDSHRT8N08D3","EDDSHRT8N08D4","EDDSHRT8N08D5", & + "EDDSHRT8N08D6","EDDSHRT8N08D7","EDDSHRT8N08D8","EDDSHRT8N08D9","EDDSHRT8N09D1","EDDSHRT8N09D2","EDDSHRT8N09D3","EDDSHRT8N09D4", & + "EDDSHRT8N09D5","EDDSHRT8N09D6","EDDSHRT8N09D7","EDDSHRT8N09D8","EDDSHRT8N09D9","EDDSHRT8N10D1","EDDSHRT8N10D2","EDDSHRT8N10D3", & + "EDDSHRT8N10D4","EDDSHRT8N10D5","EDDSHRT8N10D6","EDDSHRT8N10D7","EDDSHRT8N10D8","EDDSHRT8N10D9","EDDSHRT8N11D1","EDDSHRT8N11D2", & + "EDDSHRT8N11D3","EDDSHRT8N11D4","EDDSHRT8N11D5","EDDSHRT8N11D6","EDDSHRT8N11D7","EDDSHRT8N11D8","EDDSHRT8N11D9","EDDSHRT8N12D1", & + "EDDSHRT8N12D2","EDDSHRT8N12D3","EDDSHRT8N12D4","EDDSHRT8N12D5","EDDSHRT8N12D6","EDDSHRT8N12D7","EDDSHRT8N12D8","EDDSHRT8N12D9", & + "EDDSHRT8N13D1","EDDSHRT8N13D2","EDDSHRT8N13D3","EDDSHRT8N13D4","EDDSHRT8N13D5","EDDSHRT8N13D6","EDDSHRT8N13D7","EDDSHRT8N13D8", & + "EDDSHRT8N13D9","EDDSHRT8N14D1","EDDSHRT8N14D2","EDDSHRT8N14D3","EDDSHRT8N14D4","EDDSHRT8N14D5","EDDSHRT8N14D6","EDDSHRT8N14D7", & + "EDDSHRT8N14D8","EDDSHRT8N14D9","EDDSHRT8N15D1","EDDSHRT8N15D2","EDDSHRT8N15D3","EDDSHRT8N15D4","EDDSHRT8N15D5","EDDSHRT8N15D6", & + "EDDSHRT8N15D7","EDDSHRT8N15D8","EDDSHRT8N15D9","EDDSHRT8N16D1","EDDSHRT8N16D2","EDDSHRT8N16D3","EDDSHRT8N16D4","EDDSHRT8N16D5", & + "EDDSHRT8N16D6","EDDSHRT8N16D7","EDDSHRT8N16D8","EDDSHRT8N16D9","EDDSHRT8N17D1","EDDSHRT8N17D2","EDDSHRT8N17D3","EDDSHRT8N17D4", & + "EDDSHRT8N17D5","EDDSHRT8N17D6","EDDSHRT8N17D7","EDDSHRT8N17D8","EDDSHRT8N17D9","EDDSHRT8N18D1","EDDSHRT8N18D2","EDDSHRT8N18D3", & + "EDDSHRT8N18D4","EDDSHRT8N18D5","EDDSHRT8N18D6","EDDSHRT8N18D7","EDDSHRT8N18D8","EDDSHRT8N18D9","EDDSHRT8N19D1","EDDSHRT8N19D2", & + "EDDSHRT8N19D3","EDDSHRT8N19D4","EDDSHRT8N19D5","EDDSHRT8N19D6","EDDSHRT8N19D7","EDDSHRT8N19D8","EDDSHRT8N19D9","EDDSHRT8N20D1", & + "EDDSHRT8N20D2","EDDSHRT8N20D3","EDDSHRT8N20D4","EDDSHRT8N20D5","EDDSHRT8N20D6","EDDSHRT8N20D7","EDDSHRT8N20D8","EDDSHRT8N20D9", & + "EDDSHRT9N01D1","EDDSHRT9N01D2","EDDSHRT9N01D3","EDDSHRT9N01D4","EDDSHRT9N01D5","EDDSHRT9N01D6","EDDSHRT9N01D7","EDDSHRT9N01D8", & + "EDDSHRT9N01D9","EDDSHRT9N02D1","EDDSHRT9N02D2","EDDSHRT9N02D3","EDDSHRT9N02D4","EDDSHRT9N02D5","EDDSHRT9N02D6","EDDSHRT9N02D7", & + "EDDSHRT9N02D8","EDDSHRT9N02D9","EDDSHRT9N03D1","EDDSHRT9N03D2","EDDSHRT9N03D3","EDDSHRT9N03D4","EDDSHRT9N03D5","EDDSHRT9N03D6", & + "EDDSHRT9N03D7","EDDSHRT9N03D8","EDDSHRT9N03D9","EDDSHRT9N04D1","EDDSHRT9N04D2","EDDSHRT9N04D3","EDDSHRT9N04D4","EDDSHRT9N04D5", & + "EDDSHRT9N04D6","EDDSHRT9N04D7","EDDSHRT9N04D8","EDDSHRT9N04D9","EDDSHRT9N05D1","EDDSHRT9N05D2","EDDSHRT9N05D3","EDDSHRT9N05D4", & + "EDDSHRT9N05D5","EDDSHRT9N05D6","EDDSHRT9N05D7","EDDSHRT9N05D8","EDDSHRT9N05D9","EDDSHRT9N06D1","EDDSHRT9N06D2","EDDSHRT9N06D3", & + "EDDSHRT9N06D4","EDDSHRT9N06D5","EDDSHRT9N06D6","EDDSHRT9N06D7","EDDSHRT9N06D8","EDDSHRT9N06D9","EDDSHRT9N07D1","EDDSHRT9N07D2", & + "EDDSHRT9N07D3","EDDSHRT9N07D4","EDDSHRT9N07D5","EDDSHRT9N07D6","EDDSHRT9N07D7","EDDSHRT9N07D8","EDDSHRT9N07D9","EDDSHRT9N08D1", & + "EDDSHRT9N08D2","EDDSHRT9N08D3","EDDSHRT9N08D4","EDDSHRT9N08D5","EDDSHRT9N08D6","EDDSHRT9N08D7","EDDSHRT9N08D8","EDDSHRT9N08D9", & + "EDDSHRT9N09D1","EDDSHRT9N09D2","EDDSHRT9N09D3","EDDSHRT9N09D4","EDDSHRT9N09D5","EDDSHRT9N09D6","EDDSHRT9N09D7","EDDSHRT9N09D8", & + "EDDSHRT9N09D9","EDDSHRT9N10D1","EDDSHRT9N10D2","EDDSHRT9N10D3","EDDSHRT9N10D4","EDDSHRT9N10D5","EDDSHRT9N10D6","EDDSHRT9N10D7", & + "EDDSHRT9N10D8","EDDSHRT9N10D9","EDDSHRT9N11D1","EDDSHRT9N11D2","EDDSHRT9N11D3","EDDSHRT9N11D4","EDDSHRT9N11D5","EDDSHRT9N11D6", & + "EDDSHRT9N11D7","EDDSHRT9N11D8","EDDSHRT9N11D9","EDDSHRT9N12D1","EDDSHRT9N12D2","EDDSHRT9N12D3","EDDSHRT9N12D4","EDDSHRT9N12D5", & + "EDDSHRT9N12D6","EDDSHRT9N12D7","EDDSHRT9N12D8","EDDSHRT9N12D9","EDDSHRT9N13D1","EDDSHRT9N13D2","EDDSHRT9N13D3","EDDSHRT9N13D4", & + "EDDSHRT9N13D5","EDDSHRT9N13D6","EDDSHRT9N13D7","EDDSHRT9N13D8","EDDSHRT9N13D9","EDDSHRT9N14D1","EDDSHRT9N14D2","EDDSHRT9N14D3", & + "EDDSHRT9N14D4","EDDSHRT9N14D5","EDDSHRT9N14D6","EDDSHRT9N14D7","EDDSHRT9N14D8","EDDSHRT9N14D9","EDDSHRT9N15D1","EDDSHRT9N15D2", & + "EDDSHRT9N15D3","EDDSHRT9N15D4","EDDSHRT9N15D5","EDDSHRT9N15D6","EDDSHRT9N15D7","EDDSHRT9N15D8","EDDSHRT9N15D9","EDDSHRT9N16D1", & + "EDDSHRT9N16D2","EDDSHRT9N16D3","EDDSHRT9N16D4","EDDSHRT9N16D5","EDDSHRT9N16D6","EDDSHRT9N16D7","EDDSHRT9N16D8","EDDSHRT9N16D9", & + "EDDSHRT9N17D1","EDDSHRT9N17D2","EDDSHRT9N17D3","EDDSHRT9N17D4","EDDSHRT9N17D5","EDDSHRT9N17D6","EDDSHRT9N17D7","EDDSHRT9N17D8", & + "EDDSHRT9N17D9","EDDSHRT9N18D1","EDDSHRT9N18D2","EDDSHRT9N18D3","EDDSHRT9N18D4","EDDSHRT9N18D5","EDDSHRT9N18D6","EDDSHRT9N18D7", & + "EDDSHRT9N18D8","EDDSHRT9N18D9","EDDSHRT9N19D1","EDDSHRT9N19D2","EDDSHRT9N19D3","EDDSHRT9N19D4","EDDSHRT9N19D5","EDDSHRT9N19D6", & + "EDDSHRT9N19D7","EDDSHRT9N19D8","EDDSHRT9N19D9","EDDSHRT9N20D1","EDDSHRT9N20D2","EDDSHRT9N20D3","EDDSHRT9N20D4","EDDSHRT9N20D5", & + "EDDSHRT9N20D6","EDDSHRT9N20D7","EDDSHRT9N20D8","EDDSHRT9N20D9","EDDVIST1N01D1","EDDVIST1N01D2","EDDVIST1N01D3","EDDVIST1N01D4", & + "EDDVIST1N01D5","EDDVIST1N01D6","EDDVIST1N01D7","EDDVIST1N01D8","EDDVIST1N01D9","EDDVIST1N02D1","EDDVIST1N02D2","EDDVIST1N02D3", & + "EDDVIST1N02D4","EDDVIST1N02D5","EDDVIST1N02D6","EDDVIST1N02D7","EDDVIST1N02D8","EDDVIST1N02D9","EDDVIST1N03D1","EDDVIST1N03D2", & + "EDDVIST1N03D3","EDDVIST1N03D4","EDDVIST1N03D5","EDDVIST1N03D6","EDDVIST1N03D7","EDDVIST1N03D8","EDDVIST1N03D9","EDDVIST1N04D1", & + "EDDVIST1N04D2","EDDVIST1N04D3","EDDVIST1N04D4","EDDVIST1N04D5","EDDVIST1N04D6","EDDVIST1N04D7","EDDVIST1N04D8","EDDVIST1N04D9", & + "EDDVIST1N05D1","EDDVIST1N05D2","EDDVIST1N05D3","EDDVIST1N05D4","EDDVIST1N05D5","EDDVIST1N05D6","EDDVIST1N05D7","EDDVIST1N05D8", & + "EDDVIST1N05D9","EDDVIST1N06D1","EDDVIST1N06D2","EDDVIST1N06D3","EDDVIST1N06D4","EDDVIST1N06D5","EDDVIST1N06D6","EDDVIST1N06D7", & + "EDDVIST1N06D8","EDDVIST1N06D9","EDDVIST1N07D1","EDDVIST1N07D2","EDDVIST1N07D3","EDDVIST1N07D4","EDDVIST1N07D5","EDDVIST1N07D6", & + "EDDVIST1N07D7","EDDVIST1N07D8","EDDVIST1N07D9","EDDVIST1N08D1","EDDVIST1N08D2","EDDVIST1N08D3","EDDVIST1N08D4","EDDVIST1N08D5", & + "EDDVIST1N08D6","EDDVIST1N08D7","EDDVIST1N08D8","EDDVIST1N08D9","EDDVIST1N09D1","EDDVIST1N09D2","EDDVIST1N09D3","EDDVIST1N09D4", & + "EDDVIST1N09D5","EDDVIST1N09D6","EDDVIST1N09D7","EDDVIST1N09D8","EDDVIST1N09D9","EDDVIST1N10D1","EDDVIST1N10D2","EDDVIST1N10D3", & + "EDDVIST1N10D4","EDDVIST1N10D5","EDDVIST1N10D6","EDDVIST1N10D7","EDDVIST1N10D8","EDDVIST1N10D9","EDDVIST1N11D1","EDDVIST1N11D2", & + "EDDVIST1N11D3","EDDVIST1N11D4","EDDVIST1N11D5","EDDVIST1N11D6","EDDVIST1N11D7","EDDVIST1N11D8","EDDVIST1N11D9","EDDVIST1N12D1", & + "EDDVIST1N12D2","EDDVIST1N12D3","EDDVIST1N12D4","EDDVIST1N12D5","EDDVIST1N12D6","EDDVIST1N12D7","EDDVIST1N12D8","EDDVIST1N12D9", & + "EDDVIST1N13D1","EDDVIST1N13D2","EDDVIST1N13D3","EDDVIST1N13D4","EDDVIST1N13D5","EDDVIST1N13D6","EDDVIST1N13D7","EDDVIST1N13D8", & + "EDDVIST1N13D9","EDDVIST1N14D1","EDDVIST1N14D2","EDDVIST1N14D3","EDDVIST1N14D4","EDDVIST1N14D5","EDDVIST1N14D6","EDDVIST1N14D7", & + "EDDVIST1N14D8","EDDVIST1N14D9","EDDVIST1N15D1","EDDVIST1N15D2","EDDVIST1N15D3","EDDVIST1N15D4","EDDVIST1N15D5","EDDVIST1N15D6", & + "EDDVIST1N15D7","EDDVIST1N15D8","EDDVIST1N15D9","EDDVIST1N16D1","EDDVIST1N16D2","EDDVIST1N16D3","EDDVIST1N16D4","EDDVIST1N16D5", & + "EDDVIST1N16D6","EDDVIST1N16D7","EDDVIST1N16D8","EDDVIST1N16D9","EDDVIST1N17D1","EDDVIST1N17D2","EDDVIST1N17D3","EDDVIST1N17D4", & + "EDDVIST1N17D5","EDDVIST1N17D6","EDDVIST1N17D7","EDDVIST1N17D8","EDDVIST1N17D9","EDDVIST1N18D1","EDDVIST1N18D2","EDDVIST1N18D3", & + "EDDVIST1N18D4","EDDVIST1N18D5","EDDVIST1N18D6","EDDVIST1N18D7","EDDVIST1N18D8","EDDVIST1N18D9","EDDVIST1N19D1","EDDVIST1N19D2", & + "EDDVIST1N19D3","EDDVIST1N19D4","EDDVIST1N19D5","EDDVIST1N19D6","EDDVIST1N19D7","EDDVIST1N19D8","EDDVIST1N19D9","EDDVIST1N20D1", & + "EDDVIST1N20D2","EDDVIST1N20D3","EDDVIST1N20D4","EDDVIST1N20D5","EDDVIST1N20D6","EDDVIST1N20D7","EDDVIST1N20D8","EDDVIST1N20D9", & + "EDDVIST2N01D1","EDDVIST2N01D2","EDDVIST2N01D3","EDDVIST2N01D4","EDDVIST2N01D5","EDDVIST2N01D6","EDDVIST2N01D7","EDDVIST2N01D8", & + "EDDVIST2N01D9","EDDVIST2N02D1","EDDVIST2N02D2","EDDVIST2N02D3","EDDVIST2N02D4","EDDVIST2N02D5","EDDVIST2N02D6","EDDVIST2N02D7", & + "EDDVIST2N02D8","EDDVIST2N02D9","EDDVIST2N03D1","EDDVIST2N03D2","EDDVIST2N03D3","EDDVIST2N03D4","EDDVIST2N03D5","EDDVIST2N03D6", & + "EDDVIST2N03D7","EDDVIST2N03D8","EDDVIST2N03D9","EDDVIST2N04D1","EDDVIST2N04D2","EDDVIST2N04D3","EDDVIST2N04D4","EDDVIST2N04D5", & + "EDDVIST2N04D6","EDDVIST2N04D7","EDDVIST2N04D8","EDDVIST2N04D9","EDDVIST2N05D1","EDDVIST2N05D2","EDDVIST2N05D3","EDDVIST2N05D4", & + "EDDVIST2N05D5","EDDVIST2N05D6","EDDVIST2N05D7","EDDVIST2N05D8","EDDVIST2N05D9","EDDVIST2N06D1","EDDVIST2N06D2","EDDVIST2N06D3", & + "EDDVIST2N06D4","EDDVIST2N06D5","EDDVIST2N06D6","EDDVIST2N06D7","EDDVIST2N06D8","EDDVIST2N06D9","EDDVIST2N07D1","EDDVIST2N07D2", & + "EDDVIST2N07D3","EDDVIST2N07D4","EDDVIST2N07D5","EDDVIST2N07D6","EDDVIST2N07D7","EDDVIST2N07D8","EDDVIST2N07D9","EDDVIST2N08D1", & + "EDDVIST2N08D2","EDDVIST2N08D3","EDDVIST2N08D4","EDDVIST2N08D5","EDDVIST2N08D6","EDDVIST2N08D7","EDDVIST2N08D8","EDDVIST2N08D9", & + "EDDVIST2N09D1","EDDVIST2N09D2","EDDVIST2N09D3","EDDVIST2N09D4","EDDVIST2N09D5","EDDVIST2N09D6","EDDVIST2N09D7","EDDVIST2N09D8", & + "EDDVIST2N09D9","EDDVIST2N10D1","EDDVIST2N10D2","EDDVIST2N10D3","EDDVIST2N10D4","EDDVIST2N10D5","EDDVIST2N10D6","EDDVIST2N10D7", & + "EDDVIST2N10D8","EDDVIST2N10D9","EDDVIST2N11D1","EDDVIST2N11D2","EDDVIST2N11D3","EDDVIST2N11D4","EDDVIST2N11D5","EDDVIST2N11D6", & + "EDDVIST2N11D7","EDDVIST2N11D8","EDDVIST2N11D9","EDDVIST2N12D1","EDDVIST2N12D2","EDDVIST2N12D3","EDDVIST2N12D4","EDDVIST2N12D5", & + "EDDVIST2N12D6","EDDVIST2N12D7","EDDVIST2N12D8","EDDVIST2N12D9","EDDVIST2N13D1","EDDVIST2N13D2","EDDVIST2N13D3","EDDVIST2N13D4", & + "EDDVIST2N13D5","EDDVIST2N13D6","EDDVIST2N13D7","EDDVIST2N13D8","EDDVIST2N13D9","EDDVIST2N14D1","EDDVIST2N14D2","EDDVIST2N14D3", & + "EDDVIST2N14D4","EDDVIST2N14D5","EDDVIST2N14D6","EDDVIST2N14D7","EDDVIST2N14D8","EDDVIST2N14D9","EDDVIST2N15D1","EDDVIST2N15D2", & + "EDDVIST2N15D3","EDDVIST2N15D4","EDDVIST2N15D5","EDDVIST2N15D6","EDDVIST2N15D7","EDDVIST2N15D8","EDDVIST2N15D9","EDDVIST2N16D1", & + "EDDVIST2N16D2","EDDVIST2N16D3","EDDVIST2N16D4","EDDVIST2N16D5","EDDVIST2N16D6","EDDVIST2N16D7","EDDVIST2N16D8","EDDVIST2N16D9", & + "EDDVIST2N17D1","EDDVIST2N17D2","EDDVIST2N17D3","EDDVIST2N17D4","EDDVIST2N17D5","EDDVIST2N17D6","EDDVIST2N17D7","EDDVIST2N17D8", & + "EDDVIST2N17D9","EDDVIST2N18D1","EDDVIST2N18D2","EDDVIST2N18D3","EDDVIST2N18D4","EDDVIST2N18D5","EDDVIST2N18D6","EDDVIST2N18D7", & + "EDDVIST2N18D8","EDDVIST2N18D9","EDDVIST2N19D1","EDDVIST2N19D2","EDDVIST2N19D3","EDDVIST2N19D4","EDDVIST2N19D5","EDDVIST2N19D6", & + "EDDVIST2N19D7","EDDVIST2N19D8","EDDVIST2N19D9","EDDVIST2N20D1","EDDVIST2N20D2","EDDVIST2N20D3","EDDVIST2N20D4","EDDVIST2N20D5", & + "EDDVIST2N20D6","EDDVIST2N20D7","EDDVIST2N20D8","EDDVIST2N20D9","EDDVIST3N01D1","EDDVIST3N01D2","EDDVIST3N01D3","EDDVIST3N01D4", & + "EDDVIST3N01D5","EDDVIST3N01D6","EDDVIST3N01D7","EDDVIST3N01D8","EDDVIST3N01D9","EDDVIST3N02D1","EDDVIST3N02D2","EDDVIST3N02D3", & + "EDDVIST3N02D4","EDDVIST3N02D5","EDDVIST3N02D6","EDDVIST3N02D7","EDDVIST3N02D8","EDDVIST3N02D9","EDDVIST3N03D1","EDDVIST3N03D2", & + "EDDVIST3N03D3","EDDVIST3N03D4","EDDVIST3N03D5","EDDVIST3N03D6","EDDVIST3N03D7","EDDVIST3N03D8","EDDVIST3N03D9","EDDVIST3N04D1", & + "EDDVIST3N04D2","EDDVIST3N04D3","EDDVIST3N04D4","EDDVIST3N04D5","EDDVIST3N04D6","EDDVIST3N04D7","EDDVIST3N04D8","EDDVIST3N04D9", & + "EDDVIST3N05D1","EDDVIST3N05D2","EDDVIST3N05D3","EDDVIST3N05D4","EDDVIST3N05D5","EDDVIST3N05D6","EDDVIST3N05D7","EDDVIST3N05D8", & + "EDDVIST3N05D9","EDDVIST3N06D1","EDDVIST3N06D2","EDDVIST3N06D3","EDDVIST3N06D4","EDDVIST3N06D5","EDDVIST3N06D6","EDDVIST3N06D7", & + "EDDVIST3N06D8","EDDVIST3N06D9","EDDVIST3N07D1","EDDVIST3N07D2","EDDVIST3N07D3","EDDVIST3N07D4","EDDVIST3N07D5","EDDVIST3N07D6", & + "EDDVIST3N07D7","EDDVIST3N07D8","EDDVIST3N07D9","EDDVIST3N08D1","EDDVIST3N08D2","EDDVIST3N08D3","EDDVIST3N08D4","EDDVIST3N08D5", & + "EDDVIST3N08D6","EDDVIST3N08D7","EDDVIST3N08D8","EDDVIST3N08D9","EDDVIST3N09D1","EDDVIST3N09D2","EDDVIST3N09D3","EDDVIST3N09D4", & + "EDDVIST3N09D5","EDDVIST3N09D6","EDDVIST3N09D7","EDDVIST3N09D8","EDDVIST3N09D9","EDDVIST3N10D1","EDDVIST3N10D2","EDDVIST3N10D3", & + "EDDVIST3N10D4","EDDVIST3N10D5","EDDVIST3N10D6","EDDVIST3N10D7","EDDVIST3N10D8","EDDVIST3N10D9","EDDVIST3N11D1","EDDVIST3N11D2", & + "EDDVIST3N11D3","EDDVIST3N11D4","EDDVIST3N11D5","EDDVIST3N11D6","EDDVIST3N11D7","EDDVIST3N11D8","EDDVIST3N11D9","EDDVIST3N12D1", & + "EDDVIST3N12D2","EDDVIST3N12D3","EDDVIST3N12D4","EDDVIST3N12D5","EDDVIST3N12D6","EDDVIST3N12D7","EDDVIST3N12D8","EDDVIST3N12D9", & + "EDDVIST3N13D1","EDDVIST3N13D2","EDDVIST3N13D3","EDDVIST3N13D4","EDDVIST3N13D5","EDDVIST3N13D6","EDDVIST3N13D7","EDDVIST3N13D8", & + "EDDVIST3N13D9","EDDVIST3N14D1","EDDVIST3N14D2","EDDVIST3N14D3","EDDVIST3N14D4","EDDVIST3N14D5","EDDVIST3N14D6","EDDVIST3N14D7", & + "EDDVIST3N14D8","EDDVIST3N14D9","EDDVIST3N15D1","EDDVIST3N15D2","EDDVIST3N15D3","EDDVIST3N15D4","EDDVIST3N15D5","EDDVIST3N15D6", & + "EDDVIST3N15D7","EDDVIST3N15D8","EDDVIST3N15D9","EDDVIST3N16D1","EDDVIST3N16D2","EDDVIST3N16D3","EDDVIST3N16D4","EDDVIST3N16D5", & + "EDDVIST3N16D6","EDDVIST3N16D7","EDDVIST3N16D8","EDDVIST3N16D9","EDDVIST3N17D1","EDDVIST3N17D2","EDDVIST3N17D3","EDDVIST3N17D4", & + "EDDVIST3N17D5","EDDVIST3N17D6","EDDVIST3N17D7","EDDVIST3N17D8","EDDVIST3N17D9","EDDVIST3N18D1","EDDVIST3N18D2","EDDVIST3N18D3", & + "EDDVIST3N18D4","EDDVIST3N18D5","EDDVIST3N18D6","EDDVIST3N18D7","EDDVIST3N18D8","EDDVIST3N18D9","EDDVIST3N19D1","EDDVIST3N19D2", & + "EDDVIST3N19D3","EDDVIST3N19D4","EDDVIST3N19D5","EDDVIST3N19D6","EDDVIST3N19D7","EDDVIST3N19D8","EDDVIST3N19D9","EDDVIST3N20D1", & + "EDDVIST3N20D2","EDDVIST3N20D3","EDDVIST3N20D4","EDDVIST3N20D5","EDDVIST3N20D6","EDDVIST3N20D7","EDDVIST3N20D8","EDDVIST3N20D9", & + "EDDVIST4N01D1","EDDVIST4N01D2","EDDVIST4N01D3","EDDVIST4N01D4","EDDVIST4N01D5","EDDVIST4N01D6","EDDVIST4N01D7","EDDVIST4N01D8", & + "EDDVIST4N01D9","EDDVIST4N02D1","EDDVIST4N02D2","EDDVIST4N02D3","EDDVIST4N02D4","EDDVIST4N02D5","EDDVIST4N02D6","EDDVIST4N02D7", & + "EDDVIST4N02D8","EDDVIST4N02D9","EDDVIST4N03D1","EDDVIST4N03D2","EDDVIST4N03D3","EDDVIST4N03D4","EDDVIST4N03D5","EDDVIST4N03D6", & + "EDDVIST4N03D7","EDDVIST4N03D8","EDDVIST4N03D9","EDDVIST4N04D1","EDDVIST4N04D2","EDDVIST4N04D3","EDDVIST4N04D4","EDDVIST4N04D5", & + "EDDVIST4N04D6","EDDVIST4N04D7","EDDVIST4N04D8","EDDVIST4N04D9","EDDVIST4N05D1","EDDVIST4N05D2","EDDVIST4N05D3","EDDVIST4N05D4", & + "EDDVIST4N05D5","EDDVIST4N05D6","EDDVIST4N05D7","EDDVIST4N05D8","EDDVIST4N05D9","EDDVIST4N06D1","EDDVIST4N06D2","EDDVIST4N06D3", & + "EDDVIST4N06D4","EDDVIST4N06D5","EDDVIST4N06D6","EDDVIST4N06D7","EDDVIST4N06D8","EDDVIST4N06D9","EDDVIST4N07D1","EDDVIST4N07D2", & + "EDDVIST4N07D3","EDDVIST4N07D4","EDDVIST4N07D5","EDDVIST4N07D6","EDDVIST4N07D7","EDDVIST4N07D8","EDDVIST4N07D9","EDDVIST4N08D1", & + "EDDVIST4N08D2","EDDVIST4N08D3","EDDVIST4N08D4","EDDVIST4N08D5","EDDVIST4N08D6","EDDVIST4N08D7","EDDVIST4N08D8","EDDVIST4N08D9", & + "EDDVIST4N09D1","EDDVIST4N09D2","EDDVIST4N09D3","EDDVIST4N09D4","EDDVIST4N09D5","EDDVIST4N09D6","EDDVIST4N09D7","EDDVIST4N09D8", & + "EDDVIST4N09D9","EDDVIST4N10D1","EDDVIST4N10D2","EDDVIST4N10D3","EDDVIST4N10D4","EDDVIST4N10D5","EDDVIST4N10D6","EDDVIST4N10D7", & + "EDDVIST4N10D8","EDDVIST4N10D9","EDDVIST4N11D1","EDDVIST4N11D2","EDDVIST4N11D3","EDDVIST4N11D4","EDDVIST4N11D5","EDDVIST4N11D6", & + "EDDVIST4N11D7","EDDVIST4N11D8","EDDVIST4N11D9","EDDVIST4N12D1","EDDVIST4N12D2","EDDVIST4N12D3","EDDVIST4N12D4","EDDVIST4N12D5", & + "EDDVIST4N12D6","EDDVIST4N12D7","EDDVIST4N12D8","EDDVIST4N12D9","EDDVIST4N13D1","EDDVIST4N13D2","EDDVIST4N13D3","EDDVIST4N13D4", & + "EDDVIST4N13D5","EDDVIST4N13D6","EDDVIST4N13D7","EDDVIST4N13D8","EDDVIST4N13D9","EDDVIST4N14D1","EDDVIST4N14D2","EDDVIST4N14D3"/) + ValidParamAry(4081:6120) = (/ & + "EDDVIST4N14D4","EDDVIST4N14D5","EDDVIST4N14D6","EDDVIST4N14D7","EDDVIST4N14D8","EDDVIST4N14D9","EDDVIST4N15D1","EDDVIST4N15D2", & + "EDDVIST4N15D3","EDDVIST4N15D4","EDDVIST4N15D5","EDDVIST4N15D6","EDDVIST4N15D7","EDDVIST4N15D8","EDDVIST4N15D9","EDDVIST4N16D1", & + "EDDVIST4N16D2","EDDVIST4N16D3","EDDVIST4N16D4","EDDVIST4N16D5","EDDVIST4N16D6","EDDVIST4N16D7","EDDVIST4N16D8","EDDVIST4N16D9", & + "EDDVIST4N17D1","EDDVIST4N17D2","EDDVIST4N17D3","EDDVIST4N17D4","EDDVIST4N17D5","EDDVIST4N17D6","EDDVIST4N17D7","EDDVIST4N17D8", & + "EDDVIST4N17D9","EDDVIST4N18D1","EDDVIST4N18D2","EDDVIST4N18D3","EDDVIST4N18D4","EDDVIST4N18D5","EDDVIST4N18D6","EDDVIST4N18D7", & + "EDDVIST4N18D8","EDDVIST4N18D9","EDDVIST4N19D1","EDDVIST4N19D2","EDDVIST4N19D3","EDDVIST4N19D4","EDDVIST4N19D5","EDDVIST4N19D6", & + "EDDVIST4N19D7","EDDVIST4N19D8","EDDVIST4N19D9","EDDVIST4N20D1","EDDVIST4N20D2","EDDVIST4N20D3","EDDVIST4N20D4","EDDVIST4N20D5", & + "EDDVIST4N20D6","EDDVIST4N20D7","EDDVIST4N20D8","EDDVIST4N20D9","EDDVIST5N01D1","EDDVIST5N01D2","EDDVIST5N01D3","EDDVIST5N01D4", & + "EDDVIST5N01D5","EDDVIST5N01D6","EDDVIST5N01D7","EDDVIST5N01D8","EDDVIST5N01D9","EDDVIST5N02D1","EDDVIST5N02D2","EDDVIST5N02D3", & + "EDDVIST5N02D4","EDDVIST5N02D5","EDDVIST5N02D6","EDDVIST5N02D7","EDDVIST5N02D8","EDDVIST5N02D9","EDDVIST5N03D1","EDDVIST5N03D2", & + "EDDVIST5N03D3","EDDVIST5N03D4","EDDVIST5N03D5","EDDVIST5N03D6","EDDVIST5N03D7","EDDVIST5N03D8","EDDVIST5N03D9","EDDVIST5N04D1", & + "EDDVIST5N04D2","EDDVIST5N04D3","EDDVIST5N04D4","EDDVIST5N04D5","EDDVIST5N04D6","EDDVIST5N04D7","EDDVIST5N04D8","EDDVIST5N04D9", & + "EDDVIST5N05D1","EDDVIST5N05D2","EDDVIST5N05D3","EDDVIST5N05D4","EDDVIST5N05D5","EDDVIST5N05D6","EDDVIST5N05D7","EDDVIST5N05D8", & + "EDDVIST5N05D9","EDDVIST5N06D1","EDDVIST5N06D2","EDDVIST5N06D3","EDDVIST5N06D4","EDDVIST5N06D5","EDDVIST5N06D6","EDDVIST5N06D7", & + "EDDVIST5N06D8","EDDVIST5N06D9","EDDVIST5N07D1","EDDVIST5N07D2","EDDVIST5N07D3","EDDVIST5N07D4","EDDVIST5N07D5","EDDVIST5N07D6", & + "EDDVIST5N07D7","EDDVIST5N07D8","EDDVIST5N07D9","EDDVIST5N08D1","EDDVIST5N08D2","EDDVIST5N08D3","EDDVIST5N08D4","EDDVIST5N08D5", & + "EDDVIST5N08D6","EDDVIST5N08D7","EDDVIST5N08D8","EDDVIST5N08D9","EDDVIST5N09D1","EDDVIST5N09D2","EDDVIST5N09D3","EDDVIST5N09D4", & + "EDDVIST5N09D5","EDDVIST5N09D6","EDDVIST5N09D7","EDDVIST5N09D8","EDDVIST5N09D9","EDDVIST5N10D1","EDDVIST5N10D2","EDDVIST5N10D3", & + "EDDVIST5N10D4","EDDVIST5N10D5","EDDVIST5N10D6","EDDVIST5N10D7","EDDVIST5N10D8","EDDVIST5N10D9","EDDVIST5N11D1","EDDVIST5N11D2", & + "EDDVIST5N11D3","EDDVIST5N11D4","EDDVIST5N11D5","EDDVIST5N11D6","EDDVIST5N11D7","EDDVIST5N11D8","EDDVIST5N11D9","EDDVIST5N12D1", & + "EDDVIST5N12D2","EDDVIST5N12D3","EDDVIST5N12D4","EDDVIST5N12D5","EDDVIST5N12D6","EDDVIST5N12D7","EDDVIST5N12D8","EDDVIST5N12D9", & + "EDDVIST5N13D1","EDDVIST5N13D2","EDDVIST5N13D3","EDDVIST5N13D4","EDDVIST5N13D5","EDDVIST5N13D6","EDDVIST5N13D7","EDDVIST5N13D8", & + "EDDVIST5N13D9","EDDVIST5N14D1","EDDVIST5N14D2","EDDVIST5N14D3","EDDVIST5N14D4","EDDVIST5N14D5","EDDVIST5N14D6","EDDVIST5N14D7", & + "EDDVIST5N14D8","EDDVIST5N14D9","EDDVIST5N15D1","EDDVIST5N15D2","EDDVIST5N15D3","EDDVIST5N15D4","EDDVIST5N15D5","EDDVIST5N15D6", & + "EDDVIST5N15D7","EDDVIST5N15D8","EDDVIST5N15D9","EDDVIST5N16D1","EDDVIST5N16D2","EDDVIST5N16D3","EDDVIST5N16D4","EDDVIST5N16D5", & + "EDDVIST5N16D6","EDDVIST5N16D7","EDDVIST5N16D8","EDDVIST5N16D9","EDDVIST5N17D1","EDDVIST5N17D2","EDDVIST5N17D3","EDDVIST5N17D4", & + "EDDVIST5N17D5","EDDVIST5N17D6","EDDVIST5N17D7","EDDVIST5N17D8","EDDVIST5N17D9","EDDVIST5N18D1","EDDVIST5N18D2","EDDVIST5N18D3", & + "EDDVIST5N18D4","EDDVIST5N18D5","EDDVIST5N18D6","EDDVIST5N18D7","EDDVIST5N18D8","EDDVIST5N18D9","EDDVIST5N19D1","EDDVIST5N19D2", & + "EDDVIST5N19D3","EDDVIST5N19D4","EDDVIST5N19D5","EDDVIST5N19D6","EDDVIST5N19D7","EDDVIST5N19D8","EDDVIST5N19D9","EDDVIST5N20D1", & + "EDDVIST5N20D2","EDDVIST5N20D3","EDDVIST5N20D4","EDDVIST5N20D5","EDDVIST5N20D6","EDDVIST5N20D7","EDDVIST5N20D8","EDDVIST5N20D9", & + "EDDVIST6N01D1","EDDVIST6N01D2","EDDVIST6N01D3","EDDVIST6N01D4","EDDVIST6N01D5","EDDVIST6N01D6","EDDVIST6N01D7","EDDVIST6N01D8", & + "EDDVIST6N01D9","EDDVIST6N02D1","EDDVIST6N02D2","EDDVIST6N02D3","EDDVIST6N02D4","EDDVIST6N02D5","EDDVIST6N02D6","EDDVIST6N02D7", & + "EDDVIST6N02D8","EDDVIST6N02D9","EDDVIST6N03D1","EDDVIST6N03D2","EDDVIST6N03D3","EDDVIST6N03D4","EDDVIST6N03D5","EDDVIST6N03D6", & + "EDDVIST6N03D7","EDDVIST6N03D8","EDDVIST6N03D9","EDDVIST6N04D1","EDDVIST6N04D2","EDDVIST6N04D3","EDDVIST6N04D4","EDDVIST6N04D5", & + "EDDVIST6N04D6","EDDVIST6N04D7","EDDVIST6N04D8","EDDVIST6N04D9","EDDVIST6N05D1","EDDVIST6N05D2","EDDVIST6N05D3","EDDVIST6N05D4", & + "EDDVIST6N05D5","EDDVIST6N05D6","EDDVIST6N05D7","EDDVIST6N05D8","EDDVIST6N05D9","EDDVIST6N06D1","EDDVIST6N06D2","EDDVIST6N06D3", & + "EDDVIST6N06D4","EDDVIST6N06D5","EDDVIST6N06D6","EDDVIST6N06D7","EDDVIST6N06D8","EDDVIST6N06D9","EDDVIST6N07D1","EDDVIST6N07D2", & + "EDDVIST6N07D3","EDDVIST6N07D4","EDDVIST6N07D5","EDDVIST6N07D6","EDDVIST6N07D7","EDDVIST6N07D8","EDDVIST6N07D9","EDDVIST6N08D1", & + "EDDVIST6N08D2","EDDVIST6N08D3","EDDVIST6N08D4","EDDVIST6N08D5","EDDVIST6N08D6","EDDVIST6N08D7","EDDVIST6N08D8","EDDVIST6N08D9", & + "EDDVIST6N09D1","EDDVIST6N09D2","EDDVIST6N09D3","EDDVIST6N09D4","EDDVIST6N09D5","EDDVIST6N09D6","EDDVIST6N09D7","EDDVIST6N09D8", & + "EDDVIST6N09D9","EDDVIST6N10D1","EDDVIST6N10D2","EDDVIST6N10D3","EDDVIST6N10D4","EDDVIST6N10D5","EDDVIST6N10D6","EDDVIST6N10D7", & + "EDDVIST6N10D8","EDDVIST6N10D9","EDDVIST6N11D1","EDDVIST6N11D2","EDDVIST6N11D3","EDDVIST6N11D4","EDDVIST6N11D5","EDDVIST6N11D6", & + "EDDVIST6N11D7","EDDVIST6N11D8","EDDVIST6N11D9","EDDVIST6N12D1","EDDVIST6N12D2","EDDVIST6N12D3","EDDVIST6N12D4","EDDVIST6N12D5", & + "EDDVIST6N12D6","EDDVIST6N12D7","EDDVIST6N12D8","EDDVIST6N12D9","EDDVIST6N13D1","EDDVIST6N13D2","EDDVIST6N13D3","EDDVIST6N13D4", & + "EDDVIST6N13D5","EDDVIST6N13D6","EDDVIST6N13D7","EDDVIST6N13D8","EDDVIST6N13D9","EDDVIST6N14D1","EDDVIST6N14D2","EDDVIST6N14D3", & + "EDDVIST6N14D4","EDDVIST6N14D5","EDDVIST6N14D6","EDDVIST6N14D7","EDDVIST6N14D8","EDDVIST6N14D9","EDDVIST6N15D1","EDDVIST6N15D2", & + "EDDVIST6N15D3","EDDVIST6N15D4","EDDVIST6N15D5","EDDVIST6N15D6","EDDVIST6N15D7","EDDVIST6N15D8","EDDVIST6N15D9","EDDVIST6N16D1", & + "EDDVIST6N16D2","EDDVIST6N16D3","EDDVIST6N16D4","EDDVIST6N16D5","EDDVIST6N16D6","EDDVIST6N16D7","EDDVIST6N16D8","EDDVIST6N16D9", & + "EDDVIST6N17D1","EDDVIST6N17D2","EDDVIST6N17D3","EDDVIST6N17D4","EDDVIST6N17D5","EDDVIST6N17D6","EDDVIST6N17D7","EDDVIST6N17D8", & + "EDDVIST6N17D9","EDDVIST6N18D1","EDDVIST6N18D2","EDDVIST6N18D3","EDDVIST6N18D4","EDDVIST6N18D5","EDDVIST6N18D6","EDDVIST6N18D7", & + "EDDVIST6N18D8","EDDVIST6N18D9","EDDVIST6N19D1","EDDVIST6N19D2","EDDVIST6N19D3","EDDVIST6N19D4","EDDVIST6N19D5","EDDVIST6N19D6", & + "EDDVIST6N19D7","EDDVIST6N19D8","EDDVIST6N19D9","EDDVIST6N20D1","EDDVIST6N20D2","EDDVIST6N20D3","EDDVIST6N20D4","EDDVIST6N20D5", & + "EDDVIST6N20D6","EDDVIST6N20D7","EDDVIST6N20D8","EDDVIST6N20D9","EDDVIST7N01D1","EDDVIST7N01D2","EDDVIST7N01D3","EDDVIST7N01D4", & + "EDDVIST7N01D5","EDDVIST7N01D6","EDDVIST7N01D7","EDDVIST7N01D8","EDDVIST7N01D9","EDDVIST7N02D1","EDDVIST7N02D2","EDDVIST7N02D3", & + "EDDVIST7N02D4","EDDVIST7N02D5","EDDVIST7N02D6","EDDVIST7N02D7","EDDVIST7N02D8","EDDVIST7N02D9","EDDVIST7N03D1","EDDVIST7N03D2", & + "EDDVIST7N03D3","EDDVIST7N03D4","EDDVIST7N03D5","EDDVIST7N03D6","EDDVIST7N03D7","EDDVIST7N03D8","EDDVIST7N03D9","EDDVIST7N04D1", & + "EDDVIST7N04D2","EDDVIST7N04D3","EDDVIST7N04D4","EDDVIST7N04D5","EDDVIST7N04D6","EDDVIST7N04D7","EDDVIST7N04D8","EDDVIST7N04D9", & + "EDDVIST7N05D1","EDDVIST7N05D2","EDDVIST7N05D3","EDDVIST7N05D4","EDDVIST7N05D5","EDDVIST7N05D6","EDDVIST7N05D7","EDDVIST7N05D8", & + "EDDVIST7N05D9","EDDVIST7N06D1","EDDVIST7N06D2","EDDVIST7N06D3","EDDVIST7N06D4","EDDVIST7N06D5","EDDVIST7N06D6","EDDVIST7N06D7", & + "EDDVIST7N06D8","EDDVIST7N06D9","EDDVIST7N07D1","EDDVIST7N07D2","EDDVIST7N07D3","EDDVIST7N07D4","EDDVIST7N07D5","EDDVIST7N07D6", & + "EDDVIST7N07D7","EDDVIST7N07D8","EDDVIST7N07D9","EDDVIST7N08D1","EDDVIST7N08D2","EDDVIST7N08D3","EDDVIST7N08D4","EDDVIST7N08D5", & + "EDDVIST7N08D6","EDDVIST7N08D7","EDDVIST7N08D8","EDDVIST7N08D9","EDDVIST7N09D1","EDDVIST7N09D2","EDDVIST7N09D3","EDDVIST7N09D4", & + "EDDVIST7N09D5","EDDVIST7N09D6","EDDVIST7N09D7","EDDVIST7N09D8","EDDVIST7N09D9","EDDVIST7N10D1","EDDVIST7N10D2","EDDVIST7N10D3", & + "EDDVIST7N10D4","EDDVIST7N10D5","EDDVIST7N10D6","EDDVIST7N10D7","EDDVIST7N10D8","EDDVIST7N10D9","EDDVIST7N11D1","EDDVIST7N11D2", & + "EDDVIST7N11D3","EDDVIST7N11D4","EDDVIST7N11D5","EDDVIST7N11D6","EDDVIST7N11D7","EDDVIST7N11D8","EDDVIST7N11D9","EDDVIST7N12D1", & + "EDDVIST7N12D2","EDDVIST7N12D3","EDDVIST7N12D4","EDDVIST7N12D5","EDDVIST7N12D6","EDDVIST7N12D7","EDDVIST7N12D8","EDDVIST7N12D9", & + "EDDVIST7N13D1","EDDVIST7N13D2","EDDVIST7N13D3","EDDVIST7N13D4","EDDVIST7N13D5","EDDVIST7N13D6","EDDVIST7N13D7","EDDVIST7N13D8", & + "EDDVIST7N13D9","EDDVIST7N14D1","EDDVIST7N14D2","EDDVIST7N14D3","EDDVIST7N14D4","EDDVIST7N14D5","EDDVIST7N14D6","EDDVIST7N14D7", & + "EDDVIST7N14D8","EDDVIST7N14D9","EDDVIST7N15D1","EDDVIST7N15D2","EDDVIST7N15D3","EDDVIST7N15D4","EDDVIST7N15D5","EDDVIST7N15D6", & + "EDDVIST7N15D7","EDDVIST7N15D8","EDDVIST7N15D9","EDDVIST7N16D1","EDDVIST7N16D2","EDDVIST7N16D3","EDDVIST7N16D4","EDDVIST7N16D5", & + "EDDVIST7N16D6","EDDVIST7N16D7","EDDVIST7N16D8","EDDVIST7N16D9","EDDVIST7N17D1","EDDVIST7N17D2","EDDVIST7N17D3","EDDVIST7N17D4", & + "EDDVIST7N17D5","EDDVIST7N17D6","EDDVIST7N17D7","EDDVIST7N17D8","EDDVIST7N17D9","EDDVIST7N18D1","EDDVIST7N18D2","EDDVIST7N18D3", & + "EDDVIST7N18D4","EDDVIST7N18D5","EDDVIST7N18D6","EDDVIST7N18D7","EDDVIST7N18D8","EDDVIST7N18D9","EDDVIST7N19D1","EDDVIST7N19D2", & + "EDDVIST7N19D3","EDDVIST7N19D4","EDDVIST7N19D5","EDDVIST7N19D6","EDDVIST7N19D7","EDDVIST7N19D8","EDDVIST7N19D9","EDDVIST7N20D1", & + "EDDVIST7N20D2","EDDVIST7N20D3","EDDVIST7N20D4","EDDVIST7N20D5","EDDVIST7N20D6","EDDVIST7N20D7","EDDVIST7N20D8","EDDVIST7N20D9", & + "EDDVIST8N01D1","EDDVIST8N01D2","EDDVIST8N01D3","EDDVIST8N01D4","EDDVIST8N01D5","EDDVIST8N01D6","EDDVIST8N01D7","EDDVIST8N01D8", & + "EDDVIST8N01D9","EDDVIST8N02D1","EDDVIST8N02D2","EDDVIST8N02D3","EDDVIST8N02D4","EDDVIST8N02D5","EDDVIST8N02D6","EDDVIST8N02D7", & + "EDDVIST8N02D8","EDDVIST8N02D9","EDDVIST8N03D1","EDDVIST8N03D2","EDDVIST8N03D3","EDDVIST8N03D4","EDDVIST8N03D5","EDDVIST8N03D6", & + "EDDVIST8N03D7","EDDVIST8N03D8","EDDVIST8N03D9","EDDVIST8N04D1","EDDVIST8N04D2","EDDVIST8N04D3","EDDVIST8N04D4","EDDVIST8N04D5", & + "EDDVIST8N04D6","EDDVIST8N04D7","EDDVIST8N04D8","EDDVIST8N04D9","EDDVIST8N05D1","EDDVIST8N05D2","EDDVIST8N05D3","EDDVIST8N05D4", & + "EDDVIST8N05D5","EDDVIST8N05D6","EDDVIST8N05D7","EDDVIST8N05D8","EDDVIST8N05D9","EDDVIST8N06D1","EDDVIST8N06D2","EDDVIST8N06D3", & + "EDDVIST8N06D4","EDDVIST8N06D5","EDDVIST8N06D6","EDDVIST8N06D7","EDDVIST8N06D8","EDDVIST8N06D9","EDDVIST8N07D1","EDDVIST8N07D2", & + "EDDVIST8N07D3","EDDVIST8N07D4","EDDVIST8N07D5","EDDVIST8N07D6","EDDVIST8N07D7","EDDVIST8N07D8","EDDVIST8N07D9","EDDVIST8N08D1", & + "EDDVIST8N08D2","EDDVIST8N08D3","EDDVIST8N08D4","EDDVIST8N08D5","EDDVIST8N08D6","EDDVIST8N08D7","EDDVIST8N08D8","EDDVIST8N08D9", & + "EDDVIST8N09D1","EDDVIST8N09D2","EDDVIST8N09D3","EDDVIST8N09D4","EDDVIST8N09D5","EDDVIST8N09D6","EDDVIST8N09D7","EDDVIST8N09D8", & + "EDDVIST8N09D9","EDDVIST8N10D1","EDDVIST8N10D2","EDDVIST8N10D3","EDDVIST8N10D4","EDDVIST8N10D5","EDDVIST8N10D6","EDDVIST8N10D7", & + "EDDVIST8N10D8","EDDVIST8N10D9","EDDVIST8N11D1","EDDVIST8N11D2","EDDVIST8N11D3","EDDVIST8N11D4","EDDVIST8N11D5","EDDVIST8N11D6", & + "EDDVIST8N11D7","EDDVIST8N11D8","EDDVIST8N11D9","EDDVIST8N12D1","EDDVIST8N12D2","EDDVIST8N12D3","EDDVIST8N12D4","EDDVIST8N12D5", & + "EDDVIST8N12D6","EDDVIST8N12D7","EDDVIST8N12D8","EDDVIST8N12D9","EDDVIST8N13D1","EDDVIST8N13D2","EDDVIST8N13D3","EDDVIST8N13D4", & + "EDDVIST8N13D5","EDDVIST8N13D6","EDDVIST8N13D7","EDDVIST8N13D8","EDDVIST8N13D9","EDDVIST8N14D1","EDDVIST8N14D2","EDDVIST8N14D3", & + "EDDVIST8N14D4","EDDVIST8N14D5","EDDVIST8N14D6","EDDVIST8N14D7","EDDVIST8N14D8","EDDVIST8N14D9","EDDVIST8N15D1","EDDVIST8N15D2", & + "EDDVIST8N15D3","EDDVIST8N15D4","EDDVIST8N15D5","EDDVIST8N15D6","EDDVIST8N15D7","EDDVIST8N15D8","EDDVIST8N15D9","EDDVIST8N16D1", & + "EDDVIST8N16D2","EDDVIST8N16D3","EDDVIST8N16D4","EDDVIST8N16D5","EDDVIST8N16D6","EDDVIST8N16D7","EDDVIST8N16D8","EDDVIST8N16D9", & + "EDDVIST8N17D1","EDDVIST8N17D2","EDDVIST8N17D3","EDDVIST8N17D4","EDDVIST8N17D5","EDDVIST8N17D6","EDDVIST8N17D7","EDDVIST8N17D8", & + "EDDVIST8N17D9","EDDVIST8N18D1","EDDVIST8N18D2","EDDVIST8N18D3","EDDVIST8N18D4","EDDVIST8N18D5","EDDVIST8N18D6","EDDVIST8N18D7", & + "EDDVIST8N18D8","EDDVIST8N18D9","EDDVIST8N19D1","EDDVIST8N19D2","EDDVIST8N19D3","EDDVIST8N19D4","EDDVIST8N19D5","EDDVIST8N19D6", & + "EDDVIST8N19D7","EDDVIST8N19D8","EDDVIST8N19D9","EDDVIST8N20D1","EDDVIST8N20D2","EDDVIST8N20D3","EDDVIST8N20D4","EDDVIST8N20D5", & + "EDDVIST8N20D6","EDDVIST8N20D7","EDDVIST8N20D8","EDDVIST8N20D9","EDDVIST9N01D1","EDDVIST9N01D2","EDDVIST9N01D3","EDDVIST9N01D4", & + "EDDVIST9N01D5","EDDVIST9N01D6","EDDVIST9N01D7","EDDVIST9N01D8","EDDVIST9N01D9","EDDVIST9N02D1","EDDVIST9N02D2","EDDVIST9N02D3", & + "EDDVIST9N02D4","EDDVIST9N02D5","EDDVIST9N02D6","EDDVIST9N02D7","EDDVIST9N02D8","EDDVIST9N02D9","EDDVIST9N03D1","EDDVIST9N03D2", & + "EDDVIST9N03D3","EDDVIST9N03D4","EDDVIST9N03D5","EDDVIST9N03D6","EDDVIST9N03D7","EDDVIST9N03D8","EDDVIST9N03D9","EDDVIST9N04D1", & + "EDDVIST9N04D2","EDDVIST9N04D3","EDDVIST9N04D4","EDDVIST9N04D5","EDDVIST9N04D6","EDDVIST9N04D7","EDDVIST9N04D8","EDDVIST9N04D9", & + "EDDVIST9N05D1","EDDVIST9N05D2","EDDVIST9N05D3","EDDVIST9N05D4","EDDVIST9N05D5","EDDVIST9N05D6","EDDVIST9N05D7","EDDVIST9N05D8", & + "EDDVIST9N05D9","EDDVIST9N06D1","EDDVIST9N06D2","EDDVIST9N06D3","EDDVIST9N06D4","EDDVIST9N06D5","EDDVIST9N06D6","EDDVIST9N06D7", & + "EDDVIST9N06D8","EDDVIST9N06D9","EDDVIST9N07D1","EDDVIST9N07D2","EDDVIST9N07D3","EDDVIST9N07D4","EDDVIST9N07D5","EDDVIST9N07D6", & + "EDDVIST9N07D7","EDDVIST9N07D8","EDDVIST9N07D9","EDDVIST9N08D1","EDDVIST9N08D2","EDDVIST9N08D3","EDDVIST9N08D4","EDDVIST9N08D5", & + "EDDVIST9N08D6","EDDVIST9N08D7","EDDVIST9N08D8","EDDVIST9N08D9","EDDVIST9N09D1","EDDVIST9N09D2","EDDVIST9N09D3","EDDVIST9N09D4", & + "EDDVIST9N09D5","EDDVIST9N09D6","EDDVIST9N09D7","EDDVIST9N09D8","EDDVIST9N09D9","EDDVIST9N10D1","EDDVIST9N10D2","EDDVIST9N10D3", & + "EDDVIST9N10D4","EDDVIST9N10D5","EDDVIST9N10D6","EDDVIST9N10D7","EDDVIST9N10D8","EDDVIST9N10D9","EDDVIST9N11D1","EDDVIST9N11D2", & + "EDDVIST9N11D3","EDDVIST9N11D4","EDDVIST9N11D5","EDDVIST9N11D6","EDDVIST9N11D7","EDDVIST9N11D8","EDDVIST9N11D9","EDDVIST9N12D1", & + "EDDVIST9N12D2","EDDVIST9N12D3","EDDVIST9N12D4","EDDVIST9N12D5","EDDVIST9N12D6","EDDVIST9N12D7","EDDVIST9N12D8","EDDVIST9N12D9", & + "EDDVIST9N13D1","EDDVIST9N13D2","EDDVIST9N13D3","EDDVIST9N13D4","EDDVIST9N13D5","EDDVIST9N13D6","EDDVIST9N13D7","EDDVIST9N13D8", & + "EDDVIST9N13D9","EDDVIST9N14D1","EDDVIST9N14D2","EDDVIST9N14D3","EDDVIST9N14D4","EDDVIST9N14D5","EDDVIST9N14D6","EDDVIST9N14D7", & + "EDDVIST9N14D8","EDDVIST9N14D9","EDDVIST9N15D1","EDDVIST9N15D2","EDDVIST9N15D3","EDDVIST9N15D4","EDDVIST9N15D5","EDDVIST9N15D6", & + "EDDVIST9N15D7","EDDVIST9N15D8","EDDVIST9N15D9","EDDVIST9N16D1","EDDVIST9N16D2","EDDVIST9N16D3","EDDVIST9N16D4","EDDVIST9N16D5", & + "EDDVIST9N16D6","EDDVIST9N16D7","EDDVIST9N16D8","EDDVIST9N16D9","EDDVIST9N17D1","EDDVIST9N17D2","EDDVIST9N17D3","EDDVIST9N17D4", & + "EDDVIST9N17D5","EDDVIST9N17D6","EDDVIST9N17D7","EDDVIST9N17D8","EDDVIST9N17D9","EDDVIST9N18D1","EDDVIST9N18D2","EDDVIST9N18D3", & + "EDDVIST9N18D4","EDDVIST9N18D5","EDDVIST9N18D6","EDDVIST9N18D7","EDDVIST9N18D8","EDDVIST9N18D9","EDDVIST9N19D1","EDDVIST9N19D2", & + "EDDVIST9N19D3","EDDVIST9N19D4","EDDVIST9N19D5","EDDVIST9N19D6","EDDVIST9N19D7","EDDVIST9N19D8","EDDVIST9N19D9","EDDVIST9N20D1", & + "EDDVIST9N20D2","EDDVIST9N20D3","EDDVIST9N20D4","EDDVIST9N20D5","EDDVIST9N20D6","EDDVIST9N20D7","EDDVIST9N20D8","EDDVIST9N20D9", & + "RTAXSXT1 ","RTAXSXT2 ","RTAXSXT3 ","RTAXSXT4 ","RTAXSXT5 ","RTAXSXT6 ","RTAXSXT7 ","RTAXSXT8 ", & + "RTAXSXT9 ","RTAXSYT1 ","RTAXSYT2 ","RTAXSYT3 ","RTAXSYT4 ","RTAXSYT5 ","RTAXSYT6 ","RTAXSYT7 ", & + "RTAXSYT8 ","RTAXSYT9 ","RTAXSZT1 ","RTAXSZT2 ","RTAXSZT3 ","RTAXSZT4 ","RTAXSZT5 ","RTAXSZT6 ", & + "RTAXSZT7 ","RTAXSZT8 ","RTAXSZT9 ","RTDIAMT1 ","RTDIAMT2 ","RTDIAMT3 ","RTDIAMT4 ","RTDIAMT5 ", & + "RTDIAMT6 ","RTDIAMT7 ","RTDIAMT8 ","RTDIAMT9 ","RTPOSXT1 ","RTPOSXT2 ","RTPOSXT3 ","RTPOSXT4 ", & + "RTPOSXT5 ","RTPOSXT6 ","RTPOSXT7 ","RTPOSXT8 ","RTPOSXT9 ","RTPOSYT1 ","RTPOSYT2 ","RTPOSYT3 ", & + "RTPOSYT4 ","RTPOSYT5 ","RTPOSYT6 ","RTPOSYT7 ","RTPOSYT8 ","RTPOSYT9 ","RTPOSZT1 ","RTPOSZT2 ", & + "RTPOSZT3 ","RTPOSZT4 ","RTPOSZT5 ","RTPOSZT6 ","RTPOSZT7 ","RTPOSZT8 ","RTPOSZT9 ","RTVAMBT1 ", & + "RTVAMBT2 ","RTVAMBT3 ","RTVAMBT4 ","RTVAMBT5 ","RTVAMBT6 ","RTVAMBT7 ","RTVAMBT8 ","RTVAMBT9 ", & + "RTVRELT1 ","RTVRELT2 ","RTVRELT3 ","RTVRELT4 ","RTVRELT5 ","RTVRELT6 ","RTVRELT7 ","RTVRELT8 ", & + "RTVRELT9 ","SCGBLIN1 ","SCGBLIN2 ","SCGBLIN3 ","SCGBLIN4 ","SCGBLIN5 ","SCGBLIN6 ","SCGBLIN7 ", & + "SCGBLIN8 ","SCGBLIN9 ","SCGBLOT1 ","SCGBLOT2 ","SCGBLOT3 ","SCGBLOT4 ","SCGBLOT5 ","SCGBLOT6 ", & + "SCGBLOT7 ","SCGBLOT8 ","SCGBLOT9 ","SCT1IN1 ","SCT1IN2 ","SCT1IN3 ","SCT1IN4 ","SCT1IN5 ", & + "SCT1IN6 ","SCT1IN7 ","SCT1IN8 ","SCT1IN9 ","SCT1OT1 ","SCT1OT2 ","SCT1OT3 ","SCT1OT4 ", & + "SCT1OT5 ","SCT1OT6 ","SCT1OT7 ","SCT1OT8 ","SCT1OT9 ","SCT2IN1 ","SCT2IN2 ","SCT2IN3 ", & + "SCT2IN4 ","SCT2IN5 ","SCT2IN6 ","SCT2IN7 ","SCT2IN8 ","SCT2IN9 ","SCT2OT1 ","SCT2OT2 ", & + "SCT2OT3 ","SCT2OT4 ","SCT2OT5 ","SCT2OT6 ","SCT2OT7 ","SCT2OT8 ","SCT2OT9 ","SCT3IN1 ", & + "SCT3IN2 ","SCT3IN3 ","SCT3IN4 ","SCT3IN5 ","SCT3IN6 ","SCT3IN7 ","SCT3IN8 ","SCT3IN9 ", & + "SCT3OT1 ","SCT3OT2 ","SCT3OT3 ","SCT3OT4 ","SCT3OT5 ","SCT3OT6 ","SCT3OT7 ","SCT3OT8 ", & + "SCT3OT9 ","SCT4IN1 ","SCT4IN2 ","SCT4IN3 ","SCT4IN4 ","SCT4IN5 ","SCT4IN6 ","SCT4IN7 ", & + "SCT4IN8 ","SCT4IN9 ","SCT4OT1 ","SCT4OT2 ","SCT4OT3 ","SCT4OT4 ","SCT4OT5 ","SCT4OT6 ", & + "SCT4OT7 ","SCT4OT8 ","SCT4OT9 ","SCT5IN1 ","SCT5IN2 ","SCT5IN3 ","SCT5IN4 ","SCT5IN5 ", & + "SCT5IN6 ","SCT5IN7 ","SCT5IN8 ","SCT5IN9 ","SCT5OT1 ","SCT5OT2 ","SCT5OT3 ","SCT5OT4 ", & + "SCT5OT5 ","SCT5OT6 ","SCT5OT7 ","SCT5OT8 ","SCT5OT9 ","SCT6IN1 ","SCT6IN2 ","SCT6IN3 ", & + "SCT6IN4 ","SCT6IN5 ","SCT6IN6 ","SCT6IN7 ","SCT6IN8 ","SCT6IN9 ","SCT6OT1 ","SCT6OT2 ", & + "SCT6OT3 ","SCT6OT4 ","SCT6OT5 ","SCT6OT6 ","SCT6OT7 ","SCT6OT8 ","SCT6OT9 ","SCT7IN1 ", & + "SCT7IN2 ","SCT7IN3 ","SCT7IN4 ","SCT7IN5 ","SCT7IN6 ","SCT7IN7 ","SCT7IN8 ","SCT7IN9 ", & + "SCT7OT1 ","SCT7OT2 ","SCT7OT3 ","SCT7OT4 ","SCT7OT5 ","SCT7OT6 ","SCT7OT7 ","SCT7OT8 ", & + "SCT7OT9 ","SCT8IN1 ","SCT8IN2 ","SCT8IN3 ","SCT8IN4 ","SCT8IN5 ","SCT8IN6 ","SCT8IN7 ", & + "SCT8IN8 ","SCT8IN9 ","SCT8OT1 ","SCT8OT2 ","SCT8OT3 ","SCT8OT4 ","SCT8OT5 ","SCT8OT6 ", & + "SCT8OT7 ","SCT8OT8 ","SCT8OT9 ","SCT9IN1 ","SCT9IN2 ","SCT9IN3 ","SCT9IN4 ","SCT9IN5 ", & + "SCT9IN6 ","SCT9IN7 ","SCT9IN8 ","SCT9IN9 ","SCT9OT1 ","SCT9OT2 ","SCT9OT3 ","SCT9OT4 ", & + "SCT9OT5 ","SCT9OT6 ","SCT9OT7 ","SCT9OT8 ","SCT9OT9 ","TIAMBT1 ","TIAMBT2 ","TIAMBT3 ", & + "TIAMBT4 ","TIAMBT5 ","TIAMBT6 ","TIAMBT7 ","TIAMBT8 ","TIAMBT9 ","W1VAMBX ","W1VAMBY ", & + "W1VAMBZ ","W1VDISX ","W1VDISY ","W1VDISZ ","W2VAMBX ","W2VAMBY ","W2VAMBZ ","W2VDISX ", & + "W2VDISY ","W2VDISZ ","W3VAMBX ","W3VAMBY ","W3VAMBZ ","W3VDISX ","W3VDISY ","W3VDISZ ", & + "W4VAMBX ","W4VAMBY ","W4VAMBZ ","W4VDISX ","W4VDISY ","W4VDISZ ","W5VAMBX ","W5VAMBY ", & + "W5VAMBZ ","W5VDISX ","W5VDISY ","W5VDISZ ","W6VAMBX ","W6VAMBY ","W6VAMBZ ","W6VDISX ", & + "W6VDISY ","W6VDISZ ","W7VAMBX ","W7VAMBY ","W7VAMBZ ","W7VDISX ","W7VDISY ","W7VDISZ ", & + "W8VAMBX ","W8VAMBY ","W8VAMBZ ","W8VDISX ","W8VDISY ","W8VDISZ ","W9VAMBX ","W9VAMBY ", & + "W9VAMBZ ","W9VDISX ","W9VDISY ","W9VDISZ ","WKAXSXT1D1 ","WKAXSXT1D2 ","WKAXSXT1D3 ","WKAXSXT1D4 ", & + "WKAXSXT1D5 ","WKAXSXT1D6 ","WKAXSXT1D7 ","WKAXSXT1D8 ","WKAXSXT1D9 ","WKAXSXT2D1 ","WKAXSXT2D2 ","WKAXSXT2D3 ", & + "WKAXSXT2D4 ","WKAXSXT2D5 ","WKAXSXT2D6 ","WKAXSXT2D7 ","WKAXSXT2D8 ","WKAXSXT2D9 ","WKAXSXT3D1 ","WKAXSXT3D2 ", & + "WKAXSXT3D3 ","WKAXSXT3D4 ","WKAXSXT3D5 ","WKAXSXT3D6 ","WKAXSXT3D7 ","WKAXSXT3D8 ","WKAXSXT3D9 ","WKAXSXT4D1 ", & + "WKAXSXT4D2 ","WKAXSXT4D3 ","WKAXSXT4D4 ","WKAXSXT4D5 ","WKAXSXT4D6 ","WKAXSXT4D7 ","WKAXSXT4D8 ","WKAXSXT4D9 ", & + "WKAXSXT5D1 ","WKAXSXT5D2 ","WKAXSXT5D3 ","WKAXSXT5D4 ","WKAXSXT5D5 ","WKAXSXT5D6 ","WKAXSXT5D7 ","WKAXSXT5D8 ", & + "WKAXSXT5D9 ","WKAXSXT6D1 ","WKAXSXT6D2 ","WKAXSXT6D3 ","WKAXSXT6D4 ","WKAXSXT6D5 ","WKAXSXT6D6 ","WKAXSXT6D7 ", & + "WKAXSXT6D8 ","WKAXSXT6D9 ","WKAXSXT7D1 ","WKAXSXT7D2 ","WKAXSXT7D3 ","WKAXSXT7D4 ","WKAXSXT7D5 ","WKAXSXT7D6 ", & + "WKAXSXT7D7 ","WKAXSXT7D8 ","WKAXSXT7D9 ","WKAXSXT8D1 ","WKAXSXT8D2 ","WKAXSXT8D3 ","WKAXSXT8D4 ","WKAXSXT8D5 ", & + "WKAXSXT8D6 ","WKAXSXT8D7 ","WKAXSXT8D8 ","WKAXSXT8D9 ","WKAXSXT9D1 ","WKAXSXT9D2 ","WKAXSXT9D3 ","WKAXSXT9D4 ", & + "WKAXSXT9D5 ","WKAXSXT9D6 ","WKAXSXT9D7 ","WKAXSXT9D8 ","WKAXSXT9D9 ","WKAXSYT1D1 ","WKAXSYT1D2 ","WKAXSYT1D3 ", & + "WKAXSYT1D4 ","WKAXSYT1D5 ","WKAXSYT1D6 ","WKAXSYT1D7 ","WKAXSYT1D8 ","WKAXSYT1D9 ","WKAXSYT2D1 ","WKAXSYT2D2 ", & + "WKAXSYT2D3 ","WKAXSYT2D4 ","WKAXSYT2D5 ","WKAXSYT2D6 ","WKAXSYT2D7 ","WKAXSYT2D8 ","WKAXSYT2D9 ","WKAXSYT3D1 ", & + "WKAXSYT3D2 ","WKAXSYT3D3 ","WKAXSYT3D4 ","WKAXSYT3D5 ","WKAXSYT3D6 ","WKAXSYT3D7 ","WKAXSYT3D8 ","WKAXSYT3D9 ", & + "WKAXSYT4D1 ","WKAXSYT4D2 ","WKAXSYT4D3 ","WKAXSYT4D4 ","WKAXSYT4D5 ","WKAXSYT4D6 ","WKAXSYT4D7 ","WKAXSYT4D8 ", & + "WKAXSYT4D9 ","WKAXSYT5D1 ","WKAXSYT5D2 ","WKAXSYT5D3 ","WKAXSYT5D4 ","WKAXSYT5D5 ","WKAXSYT5D6 ","WKAXSYT5D7 ", & + "WKAXSYT5D8 ","WKAXSYT5D9 ","WKAXSYT6D1 ","WKAXSYT6D2 ","WKAXSYT6D3 ","WKAXSYT6D4 ","WKAXSYT6D5 ","WKAXSYT6D6 ", & + "WKAXSYT6D7 ","WKAXSYT6D8 ","WKAXSYT6D9 ","WKAXSYT7D1 ","WKAXSYT7D2 ","WKAXSYT7D3 ","WKAXSYT7D4 ","WKAXSYT7D5 ", & + "WKAXSYT7D6 ","WKAXSYT7D7 ","WKAXSYT7D8 ","WKAXSYT7D9 ","WKAXSYT8D1 ","WKAXSYT8D2 ","WKAXSYT8D3 ","WKAXSYT8D4 ", & + "WKAXSYT8D5 ","WKAXSYT8D6 ","WKAXSYT8D7 ","WKAXSYT8D8 ","WKAXSYT8D9 ","WKAXSYT9D1 ","WKAXSYT9D2 ","WKAXSYT9D3 ", & + "WKAXSYT9D4 ","WKAXSYT9D5 ","WKAXSYT9D6 ","WKAXSYT9D7 ","WKAXSYT9D8 ","WKAXSYT9D9 ","WKAXSZT1D1 ","WKAXSZT1D2 ", & + "WKAXSZT1D3 ","WKAXSZT1D4 ","WKAXSZT1D5 ","WKAXSZT1D6 ","WKAXSZT1D7 ","WKAXSZT1D8 ","WKAXSZT1D9 ","WKAXSZT2D1 ", & + "WKAXSZT2D2 ","WKAXSZT2D3 ","WKAXSZT2D4 ","WKAXSZT2D5 ","WKAXSZT2D6 ","WKAXSZT2D7 ","WKAXSZT2D8 ","WKAXSZT2D9 ", & + "WKAXSZT3D1 ","WKAXSZT3D2 ","WKAXSZT3D3 ","WKAXSZT3D4 ","WKAXSZT3D5 ","WKAXSZT3D6 ","WKAXSZT3D7 ","WKAXSZT3D8 ", & + "WKAXSZT3D9 ","WKAXSZT4D1 ","WKAXSZT4D2 ","WKAXSZT4D3 ","WKAXSZT4D4 ","WKAXSZT4D5 ","WKAXSZT4D6 ","WKAXSZT4D7 ", & + "WKAXSZT4D8 ","WKAXSZT4D9 ","WKAXSZT5D1 ","WKAXSZT5D2 ","WKAXSZT5D3 ","WKAXSZT5D4 ","WKAXSZT5D5 ","WKAXSZT5D6 ", & + "WKAXSZT5D7 ","WKAXSZT5D8 ","WKAXSZT5D9 ","WKAXSZT6D1 ","WKAXSZT6D2 ","WKAXSZT6D3 ","WKAXSZT6D4 ","WKAXSZT6D5 ", & + "WKAXSZT6D6 ","WKAXSZT6D7 ","WKAXSZT6D8 ","WKAXSZT6D9 ","WKAXSZT7D1 ","WKAXSZT7D2 ","WKAXSZT7D3 ","WKAXSZT7D4 ", & + "WKAXSZT7D5 ","WKAXSZT7D6 ","WKAXSZT7D7 ","WKAXSZT7D8 ","WKAXSZT7D9 ","WKAXSZT8D1 ","WKAXSZT8D2 ","WKAXSZT8D3 ", & + "WKAXSZT8D4 ","WKAXSZT8D5 ","WKAXSZT8D6 ","WKAXSZT8D7 ","WKAXSZT8D8 ","WKAXSZT8D9 ","WKAXSZT9D1 ","WKAXSZT9D2 ", & + "WKAXSZT9D3 ","WKAXSZT9D4 ","WKAXSZT9D5 ","WKAXSZT9D6 ","WKAXSZT9D7 ","WKAXSZT9D8 ","WKAXSZT9D9 ","WKDFVRT1N01D1", & + "WKDFVRT1N01D2","WKDFVRT1N01D3","WKDFVRT1N01D4","WKDFVRT1N01D5","WKDFVRT1N01D6","WKDFVRT1N01D7","WKDFVRT1N01D8","WKDFVRT1N01D9", & + "WKDFVRT1N02D1","WKDFVRT1N02D2","WKDFVRT1N02D3","WKDFVRT1N02D4","WKDFVRT1N02D5","WKDFVRT1N02D6","WKDFVRT1N02D7","WKDFVRT1N02D8", & + "WKDFVRT1N02D9","WKDFVRT1N03D1","WKDFVRT1N03D2","WKDFVRT1N03D3","WKDFVRT1N03D4","WKDFVRT1N03D5","WKDFVRT1N03D6","WKDFVRT1N03D7", & + "WKDFVRT1N03D8","WKDFVRT1N03D9","WKDFVRT1N04D1","WKDFVRT1N04D2","WKDFVRT1N04D3","WKDFVRT1N04D4","WKDFVRT1N04D5","WKDFVRT1N04D6", & + "WKDFVRT1N04D7","WKDFVRT1N04D8","WKDFVRT1N04D9","WKDFVRT1N05D1","WKDFVRT1N05D2","WKDFVRT1N05D3","WKDFVRT1N05D4","WKDFVRT1N05D5", & + "WKDFVRT1N05D6","WKDFVRT1N05D7","WKDFVRT1N05D8","WKDFVRT1N05D9","WKDFVRT1N06D1","WKDFVRT1N06D2","WKDFVRT1N06D3","WKDFVRT1N06D4", & + "WKDFVRT1N06D5","WKDFVRT1N06D6","WKDFVRT1N06D7","WKDFVRT1N06D8","WKDFVRT1N06D9","WKDFVRT1N07D1","WKDFVRT1N07D2","WKDFVRT1N07D3", & + "WKDFVRT1N07D4","WKDFVRT1N07D5","WKDFVRT1N07D6","WKDFVRT1N07D7","WKDFVRT1N07D8","WKDFVRT1N07D9","WKDFVRT1N08D1","WKDFVRT1N08D2", & + "WKDFVRT1N08D3","WKDFVRT1N08D4","WKDFVRT1N08D5","WKDFVRT1N08D6","WKDFVRT1N08D7","WKDFVRT1N08D8","WKDFVRT1N08D9","WKDFVRT1N09D1", & + "WKDFVRT1N09D2","WKDFVRT1N09D3","WKDFVRT1N09D4","WKDFVRT1N09D5","WKDFVRT1N09D6","WKDFVRT1N09D7","WKDFVRT1N09D8","WKDFVRT1N09D9", & + "WKDFVRT1N10D1","WKDFVRT1N10D2","WKDFVRT1N10D3","WKDFVRT1N10D4","WKDFVRT1N10D5","WKDFVRT1N10D6","WKDFVRT1N10D7","WKDFVRT1N10D8", & + "WKDFVRT1N10D9","WKDFVRT1N11D1","WKDFVRT1N11D2","WKDFVRT1N11D3","WKDFVRT1N11D4","WKDFVRT1N11D5","WKDFVRT1N11D6","WKDFVRT1N11D7", & + "WKDFVRT1N11D8","WKDFVRT1N11D9","WKDFVRT1N12D1","WKDFVRT1N12D2","WKDFVRT1N12D3","WKDFVRT1N12D4","WKDFVRT1N12D5","WKDFVRT1N12D6", & + "WKDFVRT1N12D7","WKDFVRT1N12D8","WKDFVRT1N12D9","WKDFVRT1N13D1","WKDFVRT1N13D2","WKDFVRT1N13D3","WKDFVRT1N13D4","WKDFVRT1N13D5", & + "WKDFVRT1N13D6","WKDFVRT1N13D7","WKDFVRT1N13D8","WKDFVRT1N13D9","WKDFVRT1N14D1","WKDFVRT1N14D2","WKDFVRT1N14D3","WKDFVRT1N14D4", & + "WKDFVRT1N14D5","WKDFVRT1N14D6","WKDFVRT1N14D7","WKDFVRT1N14D8","WKDFVRT1N14D9","WKDFVRT1N15D1","WKDFVRT1N15D2","WKDFVRT1N15D3", & + "WKDFVRT1N15D4","WKDFVRT1N15D5","WKDFVRT1N15D6","WKDFVRT1N15D7","WKDFVRT1N15D8","WKDFVRT1N15D9","WKDFVRT1N16D1","WKDFVRT1N16D2", & + "WKDFVRT1N16D3","WKDFVRT1N16D4","WKDFVRT1N16D5","WKDFVRT1N16D6","WKDFVRT1N16D7","WKDFVRT1N16D8","WKDFVRT1N16D9","WKDFVRT1N17D1", & + "WKDFVRT1N17D2","WKDFVRT1N17D3","WKDFVRT1N17D4","WKDFVRT1N17D5","WKDFVRT1N17D6","WKDFVRT1N17D7","WKDFVRT1N17D8","WKDFVRT1N17D9", & + "WKDFVRT1N18D1","WKDFVRT1N18D2","WKDFVRT1N18D3","WKDFVRT1N18D4","WKDFVRT1N18D5","WKDFVRT1N18D6","WKDFVRT1N18D7","WKDFVRT1N18D8", & + "WKDFVRT1N18D9","WKDFVRT1N19D1","WKDFVRT1N19D2","WKDFVRT1N19D3","WKDFVRT1N19D4","WKDFVRT1N19D5","WKDFVRT1N19D6","WKDFVRT1N19D7", & + "WKDFVRT1N19D8","WKDFVRT1N19D9","WKDFVRT1N20D1","WKDFVRT1N20D2","WKDFVRT1N20D3","WKDFVRT1N20D4","WKDFVRT1N20D5","WKDFVRT1N20D6", & + "WKDFVRT1N20D7","WKDFVRT1N20D8","WKDFVRT1N20D9","WKDFVRT2N01D1","WKDFVRT2N01D2","WKDFVRT2N01D3","WKDFVRT2N01D4","WKDFVRT2N01D5", & + "WKDFVRT2N01D6","WKDFVRT2N01D7","WKDFVRT2N01D8","WKDFVRT2N01D9","WKDFVRT2N02D1","WKDFVRT2N02D2","WKDFVRT2N02D3","WKDFVRT2N02D4", & + "WKDFVRT2N02D5","WKDFVRT2N02D6","WKDFVRT2N02D7","WKDFVRT2N02D8","WKDFVRT2N02D9","WKDFVRT2N03D1","WKDFVRT2N03D2","WKDFVRT2N03D3", & + "WKDFVRT2N03D4","WKDFVRT2N03D5","WKDFVRT2N03D6","WKDFVRT2N03D7","WKDFVRT2N03D8","WKDFVRT2N03D9","WKDFVRT2N04D1","WKDFVRT2N04D2", & + "WKDFVRT2N04D3","WKDFVRT2N04D4","WKDFVRT2N04D5","WKDFVRT2N04D6","WKDFVRT2N04D7","WKDFVRT2N04D8","WKDFVRT2N04D9","WKDFVRT2N05D1", & + "WKDFVRT2N05D2","WKDFVRT2N05D3","WKDFVRT2N05D4","WKDFVRT2N05D5","WKDFVRT2N05D6","WKDFVRT2N05D7","WKDFVRT2N05D8","WKDFVRT2N05D9", & + "WKDFVRT2N06D1","WKDFVRT2N06D2","WKDFVRT2N06D3","WKDFVRT2N06D4","WKDFVRT2N06D5","WKDFVRT2N06D6","WKDFVRT2N06D7","WKDFVRT2N06D8", & + "WKDFVRT2N06D9","WKDFVRT2N07D1","WKDFVRT2N07D2","WKDFVRT2N07D3","WKDFVRT2N07D4","WKDFVRT2N07D5","WKDFVRT2N07D6","WKDFVRT2N07D7", & + "WKDFVRT2N07D8","WKDFVRT2N07D9","WKDFVRT2N08D1","WKDFVRT2N08D2","WKDFVRT2N08D3","WKDFVRT2N08D4","WKDFVRT2N08D5","WKDFVRT2N08D6", & + "WKDFVRT2N08D7","WKDFVRT2N08D8","WKDFVRT2N08D9","WKDFVRT2N09D1","WKDFVRT2N09D2","WKDFVRT2N09D3","WKDFVRT2N09D4","WKDFVRT2N09D5", & + "WKDFVRT2N09D6","WKDFVRT2N09D7","WKDFVRT2N09D8","WKDFVRT2N09D9","WKDFVRT2N10D1","WKDFVRT2N10D2","WKDFVRT2N10D3","WKDFVRT2N10D4", & + "WKDFVRT2N10D5","WKDFVRT2N10D6","WKDFVRT2N10D7","WKDFVRT2N10D8","WKDFVRT2N10D9","WKDFVRT2N11D1","WKDFVRT2N11D2","WKDFVRT2N11D3", & + "WKDFVRT2N11D4","WKDFVRT2N11D5","WKDFVRT2N11D6","WKDFVRT2N11D7","WKDFVRT2N11D8","WKDFVRT2N11D9","WKDFVRT2N12D1","WKDFVRT2N12D2", & + "WKDFVRT2N12D3","WKDFVRT2N12D4","WKDFVRT2N12D5","WKDFVRT2N12D6","WKDFVRT2N12D7","WKDFVRT2N12D8","WKDFVRT2N12D9","WKDFVRT2N13D1", & + "WKDFVRT2N13D2","WKDFVRT2N13D3","WKDFVRT2N13D4","WKDFVRT2N13D5","WKDFVRT2N13D6","WKDFVRT2N13D7","WKDFVRT2N13D8","WKDFVRT2N13D9", & + "WKDFVRT2N14D1","WKDFVRT2N14D2","WKDFVRT2N14D3","WKDFVRT2N14D4","WKDFVRT2N14D5","WKDFVRT2N14D6","WKDFVRT2N14D7","WKDFVRT2N14D8", & + "WKDFVRT2N14D9","WKDFVRT2N15D1","WKDFVRT2N15D2","WKDFVRT2N15D3","WKDFVRT2N15D4","WKDFVRT2N15D5","WKDFVRT2N15D6","WKDFVRT2N15D7", & + "WKDFVRT2N15D8","WKDFVRT2N15D9","WKDFVRT2N16D1","WKDFVRT2N16D2","WKDFVRT2N16D3","WKDFVRT2N16D4","WKDFVRT2N16D5","WKDFVRT2N16D6", & + "WKDFVRT2N16D7","WKDFVRT2N16D8","WKDFVRT2N16D9","WKDFVRT2N17D1","WKDFVRT2N17D2","WKDFVRT2N17D3","WKDFVRT2N17D4","WKDFVRT2N17D5", & + "WKDFVRT2N17D6","WKDFVRT2N17D7","WKDFVRT2N17D8","WKDFVRT2N17D9","WKDFVRT2N18D1","WKDFVRT2N18D2","WKDFVRT2N18D3","WKDFVRT2N18D4", & + "WKDFVRT2N18D5","WKDFVRT2N18D6","WKDFVRT2N18D7","WKDFVRT2N18D8","WKDFVRT2N18D9","WKDFVRT2N19D1","WKDFVRT2N19D2","WKDFVRT2N19D3", & + "WKDFVRT2N19D4","WKDFVRT2N19D5","WKDFVRT2N19D6","WKDFVRT2N19D7","WKDFVRT2N19D8","WKDFVRT2N19D9","WKDFVRT2N20D1","WKDFVRT2N20D2", & + "WKDFVRT2N20D3","WKDFVRT2N20D4","WKDFVRT2N20D5","WKDFVRT2N20D6","WKDFVRT2N20D7","WKDFVRT2N20D8","WKDFVRT2N20D9","WKDFVRT3N01D1", & + "WKDFVRT3N01D2","WKDFVRT3N01D3","WKDFVRT3N01D4","WKDFVRT3N01D5","WKDFVRT3N01D6","WKDFVRT3N01D7","WKDFVRT3N01D8","WKDFVRT3N01D9", & + "WKDFVRT3N02D1","WKDFVRT3N02D2","WKDFVRT3N02D3","WKDFVRT3N02D4","WKDFVRT3N02D5","WKDFVRT3N02D6","WKDFVRT3N02D7","WKDFVRT3N02D8", & + "WKDFVRT3N02D9","WKDFVRT3N03D1","WKDFVRT3N03D2","WKDFVRT3N03D3","WKDFVRT3N03D4","WKDFVRT3N03D5","WKDFVRT3N03D6","WKDFVRT3N03D7", & + "WKDFVRT3N03D8","WKDFVRT3N03D9","WKDFVRT3N04D1","WKDFVRT3N04D2","WKDFVRT3N04D3","WKDFVRT3N04D4","WKDFVRT3N04D5","WKDFVRT3N04D6", & + "WKDFVRT3N04D7","WKDFVRT3N04D8","WKDFVRT3N04D9","WKDFVRT3N05D1","WKDFVRT3N05D2","WKDFVRT3N05D3","WKDFVRT3N05D4","WKDFVRT3N05D5", & + "WKDFVRT3N05D6","WKDFVRT3N05D7","WKDFVRT3N05D8","WKDFVRT3N05D9","WKDFVRT3N06D1","WKDFVRT3N06D2","WKDFVRT3N06D3","WKDFVRT3N06D4", & + "WKDFVRT3N06D5","WKDFVRT3N06D6","WKDFVRT3N06D7","WKDFVRT3N06D8","WKDFVRT3N06D9","WKDFVRT3N07D1","WKDFVRT3N07D2","WKDFVRT3N07D3", & + "WKDFVRT3N07D4","WKDFVRT3N07D5","WKDFVRT3N07D6","WKDFVRT3N07D7","WKDFVRT3N07D8","WKDFVRT3N07D9","WKDFVRT3N08D1","WKDFVRT3N08D2", & + "WKDFVRT3N08D3","WKDFVRT3N08D4","WKDFVRT3N08D5","WKDFVRT3N08D6","WKDFVRT3N08D7","WKDFVRT3N08D8","WKDFVRT3N08D9","WKDFVRT3N09D1", & + "WKDFVRT3N09D2","WKDFVRT3N09D3","WKDFVRT3N09D4","WKDFVRT3N09D5","WKDFVRT3N09D6","WKDFVRT3N09D7","WKDFVRT3N09D8","WKDFVRT3N09D9", & + "WKDFVRT3N10D1","WKDFVRT3N10D2","WKDFVRT3N10D3","WKDFVRT3N10D4","WKDFVRT3N10D5","WKDFVRT3N10D6","WKDFVRT3N10D7","WKDFVRT3N10D8", & + "WKDFVRT3N10D9","WKDFVRT3N11D1","WKDFVRT3N11D2","WKDFVRT3N11D3","WKDFVRT3N11D4","WKDFVRT3N11D5","WKDFVRT3N11D6","WKDFVRT3N11D7", & + "WKDFVRT3N11D8","WKDFVRT3N11D9","WKDFVRT3N12D1","WKDFVRT3N12D2","WKDFVRT3N12D3","WKDFVRT3N12D4","WKDFVRT3N12D5","WKDFVRT3N12D6", & + "WKDFVRT3N12D7","WKDFVRT3N12D8","WKDFVRT3N12D9","WKDFVRT3N13D1","WKDFVRT3N13D2","WKDFVRT3N13D3","WKDFVRT3N13D4","WKDFVRT3N13D5", & + "WKDFVRT3N13D6","WKDFVRT3N13D7","WKDFVRT3N13D8","WKDFVRT3N13D9","WKDFVRT3N14D1","WKDFVRT3N14D2","WKDFVRT3N14D3","WKDFVRT3N14D4", & + "WKDFVRT3N14D5","WKDFVRT3N14D6","WKDFVRT3N14D7","WKDFVRT3N14D8","WKDFVRT3N14D9","WKDFVRT3N15D1","WKDFVRT3N15D2","WKDFVRT3N15D3", & + "WKDFVRT3N15D4","WKDFVRT3N15D5","WKDFVRT3N15D6","WKDFVRT3N15D7","WKDFVRT3N15D8","WKDFVRT3N15D9","WKDFVRT3N16D1","WKDFVRT3N16D2", & + "WKDFVRT3N16D3","WKDFVRT3N16D4","WKDFVRT3N16D5","WKDFVRT3N16D6","WKDFVRT3N16D7","WKDFVRT3N16D8","WKDFVRT3N16D9","WKDFVRT3N17D1", & + "WKDFVRT3N17D2","WKDFVRT3N17D3","WKDFVRT3N17D4","WKDFVRT3N17D5","WKDFVRT3N17D6","WKDFVRT3N17D7","WKDFVRT3N17D8","WKDFVRT3N17D9"/) + ValidParamAry(6121:8160) = (/ & + "WKDFVRT3N18D1","WKDFVRT3N18D2","WKDFVRT3N18D3","WKDFVRT3N18D4","WKDFVRT3N18D5","WKDFVRT3N18D6","WKDFVRT3N18D7","WKDFVRT3N18D8", & + "WKDFVRT3N18D9","WKDFVRT3N19D1","WKDFVRT3N19D2","WKDFVRT3N19D3","WKDFVRT3N19D4","WKDFVRT3N19D5","WKDFVRT3N19D6","WKDFVRT3N19D7", & + "WKDFVRT3N19D8","WKDFVRT3N19D9","WKDFVRT3N20D1","WKDFVRT3N20D2","WKDFVRT3N20D3","WKDFVRT3N20D4","WKDFVRT3N20D5","WKDFVRT3N20D6", & + "WKDFVRT3N20D7","WKDFVRT3N20D8","WKDFVRT3N20D9","WKDFVRT4N01D1","WKDFVRT4N01D2","WKDFVRT4N01D3","WKDFVRT4N01D4","WKDFVRT4N01D5", & + "WKDFVRT4N01D6","WKDFVRT4N01D7","WKDFVRT4N01D8","WKDFVRT4N01D9","WKDFVRT4N02D1","WKDFVRT4N02D2","WKDFVRT4N02D3","WKDFVRT4N02D4", & + "WKDFVRT4N02D5","WKDFVRT4N02D6","WKDFVRT4N02D7","WKDFVRT4N02D8","WKDFVRT4N02D9","WKDFVRT4N03D1","WKDFVRT4N03D2","WKDFVRT4N03D3", & + "WKDFVRT4N03D4","WKDFVRT4N03D5","WKDFVRT4N03D6","WKDFVRT4N03D7","WKDFVRT4N03D8","WKDFVRT4N03D9","WKDFVRT4N04D1","WKDFVRT4N04D2", & + "WKDFVRT4N04D3","WKDFVRT4N04D4","WKDFVRT4N04D5","WKDFVRT4N04D6","WKDFVRT4N04D7","WKDFVRT4N04D8","WKDFVRT4N04D9","WKDFVRT4N05D1", & + "WKDFVRT4N05D2","WKDFVRT4N05D3","WKDFVRT4N05D4","WKDFVRT4N05D5","WKDFVRT4N05D6","WKDFVRT4N05D7","WKDFVRT4N05D8","WKDFVRT4N05D9", & + "WKDFVRT4N06D1","WKDFVRT4N06D2","WKDFVRT4N06D3","WKDFVRT4N06D4","WKDFVRT4N06D5","WKDFVRT4N06D6","WKDFVRT4N06D7","WKDFVRT4N06D8", & + "WKDFVRT4N06D9","WKDFVRT4N07D1","WKDFVRT4N07D2","WKDFVRT4N07D3","WKDFVRT4N07D4","WKDFVRT4N07D5","WKDFVRT4N07D6","WKDFVRT4N07D7", & + "WKDFVRT4N07D8","WKDFVRT4N07D9","WKDFVRT4N08D1","WKDFVRT4N08D2","WKDFVRT4N08D3","WKDFVRT4N08D4","WKDFVRT4N08D5","WKDFVRT4N08D6", & + "WKDFVRT4N08D7","WKDFVRT4N08D8","WKDFVRT4N08D9","WKDFVRT4N09D1","WKDFVRT4N09D2","WKDFVRT4N09D3","WKDFVRT4N09D4","WKDFVRT4N09D5", & + "WKDFVRT4N09D6","WKDFVRT4N09D7","WKDFVRT4N09D8","WKDFVRT4N09D9","WKDFVRT4N10D1","WKDFVRT4N10D2","WKDFVRT4N10D3","WKDFVRT4N10D4", & + "WKDFVRT4N10D5","WKDFVRT4N10D6","WKDFVRT4N10D7","WKDFVRT4N10D8","WKDFVRT4N10D9","WKDFVRT4N11D1","WKDFVRT4N11D2","WKDFVRT4N11D3", & + "WKDFVRT4N11D4","WKDFVRT4N11D5","WKDFVRT4N11D6","WKDFVRT4N11D7","WKDFVRT4N11D8","WKDFVRT4N11D9","WKDFVRT4N12D1","WKDFVRT4N12D2", & + "WKDFVRT4N12D3","WKDFVRT4N12D4","WKDFVRT4N12D5","WKDFVRT4N12D6","WKDFVRT4N12D7","WKDFVRT4N12D8","WKDFVRT4N12D9","WKDFVRT4N13D1", & + "WKDFVRT4N13D2","WKDFVRT4N13D3","WKDFVRT4N13D4","WKDFVRT4N13D5","WKDFVRT4N13D6","WKDFVRT4N13D7","WKDFVRT4N13D8","WKDFVRT4N13D9", & + "WKDFVRT4N14D1","WKDFVRT4N14D2","WKDFVRT4N14D3","WKDFVRT4N14D4","WKDFVRT4N14D5","WKDFVRT4N14D6","WKDFVRT4N14D7","WKDFVRT4N14D8", & + "WKDFVRT4N14D9","WKDFVRT4N15D1","WKDFVRT4N15D2","WKDFVRT4N15D3","WKDFVRT4N15D4","WKDFVRT4N15D5","WKDFVRT4N15D6","WKDFVRT4N15D7", & + "WKDFVRT4N15D8","WKDFVRT4N15D9","WKDFVRT4N16D1","WKDFVRT4N16D2","WKDFVRT4N16D3","WKDFVRT4N16D4","WKDFVRT4N16D5","WKDFVRT4N16D6", & + "WKDFVRT4N16D7","WKDFVRT4N16D8","WKDFVRT4N16D9","WKDFVRT4N17D1","WKDFVRT4N17D2","WKDFVRT4N17D3","WKDFVRT4N17D4","WKDFVRT4N17D5", & + "WKDFVRT4N17D6","WKDFVRT4N17D7","WKDFVRT4N17D8","WKDFVRT4N17D9","WKDFVRT4N18D1","WKDFVRT4N18D2","WKDFVRT4N18D3","WKDFVRT4N18D4", & + "WKDFVRT4N18D5","WKDFVRT4N18D6","WKDFVRT4N18D7","WKDFVRT4N18D8","WKDFVRT4N18D9","WKDFVRT4N19D1","WKDFVRT4N19D2","WKDFVRT4N19D3", & + "WKDFVRT4N19D4","WKDFVRT4N19D5","WKDFVRT4N19D6","WKDFVRT4N19D7","WKDFVRT4N19D8","WKDFVRT4N19D9","WKDFVRT4N20D1","WKDFVRT4N20D2", & + "WKDFVRT4N20D3","WKDFVRT4N20D4","WKDFVRT4N20D5","WKDFVRT4N20D6","WKDFVRT4N20D7","WKDFVRT4N20D8","WKDFVRT4N20D9","WKDFVRT5N01D1", & + "WKDFVRT5N01D2","WKDFVRT5N01D3","WKDFVRT5N01D4","WKDFVRT5N01D5","WKDFVRT5N01D6","WKDFVRT5N01D7","WKDFVRT5N01D8","WKDFVRT5N01D9", & + "WKDFVRT5N02D1","WKDFVRT5N02D2","WKDFVRT5N02D3","WKDFVRT5N02D4","WKDFVRT5N02D5","WKDFVRT5N02D6","WKDFVRT5N02D7","WKDFVRT5N02D8", & + "WKDFVRT5N02D9","WKDFVRT5N03D1","WKDFVRT5N03D2","WKDFVRT5N03D3","WKDFVRT5N03D4","WKDFVRT5N03D5","WKDFVRT5N03D6","WKDFVRT5N03D7", & + "WKDFVRT5N03D8","WKDFVRT5N03D9","WKDFVRT5N04D1","WKDFVRT5N04D2","WKDFVRT5N04D3","WKDFVRT5N04D4","WKDFVRT5N04D5","WKDFVRT5N04D6", & + "WKDFVRT5N04D7","WKDFVRT5N04D8","WKDFVRT5N04D9","WKDFVRT5N05D1","WKDFVRT5N05D2","WKDFVRT5N05D3","WKDFVRT5N05D4","WKDFVRT5N05D5", & + "WKDFVRT5N05D6","WKDFVRT5N05D7","WKDFVRT5N05D8","WKDFVRT5N05D9","WKDFVRT5N06D1","WKDFVRT5N06D2","WKDFVRT5N06D3","WKDFVRT5N06D4", & + "WKDFVRT5N06D5","WKDFVRT5N06D6","WKDFVRT5N06D7","WKDFVRT5N06D8","WKDFVRT5N06D9","WKDFVRT5N07D1","WKDFVRT5N07D2","WKDFVRT5N07D3", & + "WKDFVRT5N07D4","WKDFVRT5N07D5","WKDFVRT5N07D6","WKDFVRT5N07D7","WKDFVRT5N07D8","WKDFVRT5N07D9","WKDFVRT5N08D1","WKDFVRT5N08D2", & + "WKDFVRT5N08D3","WKDFVRT5N08D4","WKDFVRT5N08D5","WKDFVRT5N08D6","WKDFVRT5N08D7","WKDFVRT5N08D8","WKDFVRT5N08D9","WKDFVRT5N09D1", & + "WKDFVRT5N09D2","WKDFVRT5N09D3","WKDFVRT5N09D4","WKDFVRT5N09D5","WKDFVRT5N09D6","WKDFVRT5N09D7","WKDFVRT5N09D8","WKDFVRT5N09D9", & + "WKDFVRT5N10D1","WKDFVRT5N10D2","WKDFVRT5N10D3","WKDFVRT5N10D4","WKDFVRT5N10D5","WKDFVRT5N10D6","WKDFVRT5N10D7","WKDFVRT5N10D8", & + "WKDFVRT5N10D9","WKDFVRT5N11D1","WKDFVRT5N11D2","WKDFVRT5N11D3","WKDFVRT5N11D4","WKDFVRT5N11D5","WKDFVRT5N11D6","WKDFVRT5N11D7", & + "WKDFVRT5N11D8","WKDFVRT5N11D9","WKDFVRT5N12D1","WKDFVRT5N12D2","WKDFVRT5N12D3","WKDFVRT5N12D4","WKDFVRT5N12D5","WKDFVRT5N12D6", & + "WKDFVRT5N12D7","WKDFVRT5N12D8","WKDFVRT5N12D9","WKDFVRT5N13D1","WKDFVRT5N13D2","WKDFVRT5N13D3","WKDFVRT5N13D4","WKDFVRT5N13D5", & + "WKDFVRT5N13D6","WKDFVRT5N13D7","WKDFVRT5N13D8","WKDFVRT5N13D9","WKDFVRT5N14D1","WKDFVRT5N14D2","WKDFVRT5N14D3","WKDFVRT5N14D4", & + "WKDFVRT5N14D5","WKDFVRT5N14D6","WKDFVRT5N14D7","WKDFVRT5N14D8","WKDFVRT5N14D9","WKDFVRT5N15D1","WKDFVRT5N15D2","WKDFVRT5N15D3", & + "WKDFVRT5N15D4","WKDFVRT5N15D5","WKDFVRT5N15D6","WKDFVRT5N15D7","WKDFVRT5N15D8","WKDFVRT5N15D9","WKDFVRT5N16D1","WKDFVRT5N16D2", & + "WKDFVRT5N16D3","WKDFVRT5N16D4","WKDFVRT5N16D5","WKDFVRT5N16D6","WKDFVRT5N16D7","WKDFVRT5N16D8","WKDFVRT5N16D9","WKDFVRT5N17D1", & + "WKDFVRT5N17D2","WKDFVRT5N17D3","WKDFVRT5N17D4","WKDFVRT5N17D5","WKDFVRT5N17D6","WKDFVRT5N17D7","WKDFVRT5N17D8","WKDFVRT5N17D9", & + "WKDFVRT5N18D1","WKDFVRT5N18D2","WKDFVRT5N18D3","WKDFVRT5N18D4","WKDFVRT5N18D5","WKDFVRT5N18D6","WKDFVRT5N18D7","WKDFVRT5N18D8", & + "WKDFVRT5N18D9","WKDFVRT5N19D1","WKDFVRT5N19D2","WKDFVRT5N19D3","WKDFVRT5N19D4","WKDFVRT5N19D5","WKDFVRT5N19D6","WKDFVRT5N19D7", & + "WKDFVRT5N19D8","WKDFVRT5N19D9","WKDFVRT5N20D1","WKDFVRT5N20D2","WKDFVRT5N20D3","WKDFVRT5N20D4","WKDFVRT5N20D5","WKDFVRT5N20D6", & + "WKDFVRT5N20D7","WKDFVRT5N20D8","WKDFVRT5N20D9","WKDFVRT6N01D1","WKDFVRT6N01D2","WKDFVRT6N01D3","WKDFVRT6N01D4","WKDFVRT6N01D5", & + "WKDFVRT6N01D6","WKDFVRT6N01D7","WKDFVRT6N01D8","WKDFVRT6N01D9","WKDFVRT6N02D1","WKDFVRT6N02D2","WKDFVRT6N02D3","WKDFVRT6N02D4", & + "WKDFVRT6N02D5","WKDFVRT6N02D6","WKDFVRT6N02D7","WKDFVRT6N02D8","WKDFVRT6N02D9","WKDFVRT6N03D1","WKDFVRT6N03D2","WKDFVRT6N03D3", & + "WKDFVRT6N03D4","WKDFVRT6N03D5","WKDFVRT6N03D6","WKDFVRT6N03D7","WKDFVRT6N03D8","WKDFVRT6N03D9","WKDFVRT6N04D1","WKDFVRT6N04D2", & + "WKDFVRT6N04D3","WKDFVRT6N04D4","WKDFVRT6N04D5","WKDFVRT6N04D6","WKDFVRT6N04D7","WKDFVRT6N04D8","WKDFVRT6N04D9","WKDFVRT6N05D1", & + "WKDFVRT6N05D2","WKDFVRT6N05D3","WKDFVRT6N05D4","WKDFVRT6N05D5","WKDFVRT6N05D6","WKDFVRT6N05D7","WKDFVRT6N05D8","WKDFVRT6N05D9", & + "WKDFVRT6N06D1","WKDFVRT6N06D2","WKDFVRT6N06D3","WKDFVRT6N06D4","WKDFVRT6N06D5","WKDFVRT6N06D6","WKDFVRT6N06D7","WKDFVRT6N06D8", & + "WKDFVRT6N06D9","WKDFVRT6N07D1","WKDFVRT6N07D2","WKDFVRT6N07D3","WKDFVRT6N07D4","WKDFVRT6N07D5","WKDFVRT6N07D6","WKDFVRT6N07D7", & + "WKDFVRT6N07D8","WKDFVRT6N07D9","WKDFVRT6N08D1","WKDFVRT6N08D2","WKDFVRT6N08D3","WKDFVRT6N08D4","WKDFVRT6N08D5","WKDFVRT6N08D6", & + "WKDFVRT6N08D7","WKDFVRT6N08D8","WKDFVRT6N08D9","WKDFVRT6N09D1","WKDFVRT6N09D2","WKDFVRT6N09D3","WKDFVRT6N09D4","WKDFVRT6N09D5", & + "WKDFVRT6N09D6","WKDFVRT6N09D7","WKDFVRT6N09D8","WKDFVRT6N09D9","WKDFVRT6N10D1","WKDFVRT6N10D2","WKDFVRT6N10D3","WKDFVRT6N10D4", & + "WKDFVRT6N10D5","WKDFVRT6N10D6","WKDFVRT6N10D7","WKDFVRT6N10D8","WKDFVRT6N10D9","WKDFVRT6N11D1","WKDFVRT6N11D2","WKDFVRT6N11D3", & + "WKDFVRT6N11D4","WKDFVRT6N11D5","WKDFVRT6N11D6","WKDFVRT6N11D7","WKDFVRT6N11D8","WKDFVRT6N11D9","WKDFVRT6N12D1","WKDFVRT6N12D2", & + "WKDFVRT6N12D3","WKDFVRT6N12D4","WKDFVRT6N12D5","WKDFVRT6N12D6","WKDFVRT6N12D7","WKDFVRT6N12D8","WKDFVRT6N12D9","WKDFVRT6N13D1", & + "WKDFVRT6N13D2","WKDFVRT6N13D3","WKDFVRT6N13D4","WKDFVRT6N13D5","WKDFVRT6N13D6","WKDFVRT6N13D7","WKDFVRT6N13D8","WKDFVRT6N13D9", & + "WKDFVRT6N14D1","WKDFVRT6N14D2","WKDFVRT6N14D3","WKDFVRT6N14D4","WKDFVRT6N14D5","WKDFVRT6N14D6","WKDFVRT6N14D7","WKDFVRT6N14D8", & + "WKDFVRT6N14D9","WKDFVRT6N15D1","WKDFVRT6N15D2","WKDFVRT6N15D3","WKDFVRT6N15D4","WKDFVRT6N15D5","WKDFVRT6N15D6","WKDFVRT6N15D7", & + "WKDFVRT6N15D8","WKDFVRT6N15D9","WKDFVRT6N16D1","WKDFVRT6N16D2","WKDFVRT6N16D3","WKDFVRT6N16D4","WKDFVRT6N16D5","WKDFVRT6N16D6", & + "WKDFVRT6N16D7","WKDFVRT6N16D8","WKDFVRT6N16D9","WKDFVRT6N17D1","WKDFVRT6N17D2","WKDFVRT6N17D3","WKDFVRT6N17D4","WKDFVRT6N17D5", & + "WKDFVRT6N17D6","WKDFVRT6N17D7","WKDFVRT6N17D8","WKDFVRT6N17D9","WKDFVRT6N18D1","WKDFVRT6N18D2","WKDFVRT6N18D3","WKDFVRT6N18D4", & + "WKDFVRT6N18D5","WKDFVRT6N18D6","WKDFVRT6N18D7","WKDFVRT6N18D8","WKDFVRT6N18D9","WKDFVRT6N19D1","WKDFVRT6N19D2","WKDFVRT6N19D3", & + "WKDFVRT6N19D4","WKDFVRT6N19D5","WKDFVRT6N19D6","WKDFVRT6N19D7","WKDFVRT6N19D8","WKDFVRT6N19D9","WKDFVRT6N20D1","WKDFVRT6N20D2", & + "WKDFVRT6N20D3","WKDFVRT6N20D4","WKDFVRT6N20D5","WKDFVRT6N20D6","WKDFVRT6N20D7","WKDFVRT6N20D8","WKDFVRT6N20D9","WKDFVRT7N01D1", & + "WKDFVRT7N01D2","WKDFVRT7N01D3","WKDFVRT7N01D4","WKDFVRT7N01D5","WKDFVRT7N01D6","WKDFVRT7N01D7","WKDFVRT7N01D8","WKDFVRT7N01D9", & + "WKDFVRT7N02D1","WKDFVRT7N02D2","WKDFVRT7N02D3","WKDFVRT7N02D4","WKDFVRT7N02D5","WKDFVRT7N02D6","WKDFVRT7N02D7","WKDFVRT7N02D8", & + "WKDFVRT7N02D9","WKDFVRT7N03D1","WKDFVRT7N03D2","WKDFVRT7N03D3","WKDFVRT7N03D4","WKDFVRT7N03D5","WKDFVRT7N03D6","WKDFVRT7N03D7", & + "WKDFVRT7N03D8","WKDFVRT7N03D9","WKDFVRT7N04D1","WKDFVRT7N04D2","WKDFVRT7N04D3","WKDFVRT7N04D4","WKDFVRT7N04D5","WKDFVRT7N04D6", & + "WKDFVRT7N04D7","WKDFVRT7N04D8","WKDFVRT7N04D9","WKDFVRT7N05D1","WKDFVRT7N05D2","WKDFVRT7N05D3","WKDFVRT7N05D4","WKDFVRT7N05D5", & + "WKDFVRT7N05D6","WKDFVRT7N05D7","WKDFVRT7N05D8","WKDFVRT7N05D9","WKDFVRT7N06D1","WKDFVRT7N06D2","WKDFVRT7N06D3","WKDFVRT7N06D4", & + "WKDFVRT7N06D5","WKDFVRT7N06D6","WKDFVRT7N06D7","WKDFVRT7N06D8","WKDFVRT7N06D9","WKDFVRT7N07D1","WKDFVRT7N07D2","WKDFVRT7N07D3", & + "WKDFVRT7N07D4","WKDFVRT7N07D5","WKDFVRT7N07D6","WKDFVRT7N07D7","WKDFVRT7N07D8","WKDFVRT7N07D9","WKDFVRT7N08D1","WKDFVRT7N08D2", & + "WKDFVRT7N08D3","WKDFVRT7N08D4","WKDFVRT7N08D5","WKDFVRT7N08D6","WKDFVRT7N08D7","WKDFVRT7N08D8","WKDFVRT7N08D9","WKDFVRT7N09D1", & + "WKDFVRT7N09D2","WKDFVRT7N09D3","WKDFVRT7N09D4","WKDFVRT7N09D5","WKDFVRT7N09D6","WKDFVRT7N09D7","WKDFVRT7N09D8","WKDFVRT7N09D9", & + "WKDFVRT7N10D1","WKDFVRT7N10D2","WKDFVRT7N10D3","WKDFVRT7N10D4","WKDFVRT7N10D5","WKDFVRT7N10D6","WKDFVRT7N10D7","WKDFVRT7N10D8", & + "WKDFVRT7N10D9","WKDFVRT7N11D1","WKDFVRT7N11D2","WKDFVRT7N11D3","WKDFVRT7N11D4","WKDFVRT7N11D5","WKDFVRT7N11D6","WKDFVRT7N11D7", & + "WKDFVRT7N11D8","WKDFVRT7N11D9","WKDFVRT7N12D1","WKDFVRT7N12D2","WKDFVRT7N12D3","WKDFVRT7N12D4","WKDFVRT7N12D5","WKDFVRT7N12D6", & + "WKDFVRT7N12D7","WKDFVRT7N12D8","WKDFVRT7N12D9","WKDFVRT7N13D1","WKDFVRT7N13D2","WKDFVRT7N13D3","WKDFVRT7N13D4","WKDFVRT7N13D5", & + "WKDFVRT7N13D6","WKDFVRT7N13D7","WKDFVRT7N13D8","WKDFVRT7N13D9","WKDFVRT7N14D1","WKDFVRT7N14D2","WKDFVRT7N14D3","WKDFVRT7N14D4", & + "WKDFVRT7N14D5","WKDFVRT7N14D6","WKDFVRT7N14D7","WKDFVRT7N14D8","WKDFVRT7N14D9","WKDFVRT7N15D1","WKDFVRT7N15D2","WKDFVRT7N15D3", & + "WKDFVRT7N15D4","WKDFVRT7N15D5","WKDFVRT7N15D6","WKDFVRT7N15D7","WKDFVRT7N15D8","WKDFVRT7N15D9","WKDFVRT7N16D1","WKDFVRT7N16D2", & + "WKDFVRT7N16D3","WKDFVRT7N16D4","WKDFVRT7N16D5","WKDFVRT7N16D6","WKDFVRT7N16D7","WKDFVRT7N16D8","WKDFVRT7N16D9","WKDFVRT7N17D1", & + "WKDFVRT7N17D2","WKDFVRT7N17D3","WKDFVRT7N17D4","WKDFVRT7N17D5","WKDFVRT7N17D6","WKDFVRT7N17D7","WKDFVRT7N17D8","WKDFVRT7N17D9", & + "WKDFVRT7N18D1","WKDFVRT7N18D2","WKDFVRT7N18D3","WKDFVRT7N18D4","WKDFVRT7N18D5","WKDFVRT7N18D6","WKDFVRT7N18D7","WKDFVRT7N18D8", & + "WKDFVRT7N18D9","WKDFVRT7N19D1","WKDFVRT7N19D2","WKDFVRT7N19D3","WKDFVRT7N19D4","WKDFVRT7N19D5","WKDFVRT7N19D6","WKDFVRT7N19D7", & + "WKDFVRT7N19D8","WKDFVRT7N19D9","WKDFVRT7N20D1","WKDFVRT7N20D2","WKDFVRT7N20D3","WKDFVRT7N20D4","WKDFVRT7N20D5","WKDFVRT7N20D6", & + "WKDFVRT7N20D7","WKDFVRT7N20D8","WKDFVRT7N20D9","WKDFVRT8N01D1","WKDFVRT8N01D2","WKDFVRT8N01D3","WKDFVRT8N01D4","WKDFVRT8N01D5", & + "WKDFVRT8N01D6","WKDFVRT8N01D7","WKDFVRT8N01D8","WKDFVRT8N01D9","WKDFVRT8N02D1","WKDFVRT8N02D2","WKDFVRT8N02D3","WKDFVRT8N02D4", & + "WKDFVRT8N02D5","WKDFVRT8N02D6","WKDFVRT8N02D7","WKDFVRT8N02D8","WKDFVRT8N02D9","WKDFVRT8N03D1","WKDFVRT8N03D2","WKDFVRT8N03D3", & + "WKDFVRT8N03D4","WKDFVRT8N03D5","WKDFVRT8N03D6","WKDFVRT8N03D7","WKDFVRT8N03D8","WKDFVRT8N03D9","WKDFVRT8N04D1","WKDFVRT8N04D2", & + "WKDFVRT8N04D3","WKDFVRT8N04D4","WKDFVRT8N04D5","WKDFVRT8N04D6","WKDFVRT8N04D7","WKDFVRT8N04D8","WKDFVRT8N04D9","WKDFVRT8N05D1", & + "WKDFVRT8N05D2","WKDFVRT8N05D3","WKDFVRT8N05D4","WKDFVRT8N05D5","WKDFVRT8N05D6","WKDFVRT8N05D7","WKDFVRT8N05D8","WKDFVRT8N05D9", & + "WKDFVRT8N06D1","WKDFVRT8N06D2","WKDFVRT8N06D3","WKDFVRT8N06D4","WKDFVRT8N06D5","WKDFVRT8N06D6","WKDFVRT8N06D7","WKDFVRT8N06D8", & + "WKDFVRT8N06D9","WKDFVRT8N07D1","WKDFVRT8N07D2","WKDFVRT8N07D3","WKDFVRT8N07D4","WKDFVRT8N07D5","WKDFVRT8N07D6","WKDFVRT8N07D7", & + "WKDFVRT8N07D8","WKDFVRT8N07D9","WKDFVRT8N08D1","WKDFVRT8N08D2","WKDFVRT8N08D3","WKDFVRT8N08D4","WKDFVRT8N08D5","WKDFVRT8N08D6", & + "WKDFVRT8N08D7","WKDFVRT8N08D8","WKDFVRT8N08D9","WKDFVRT8N09D1","WKDFVRT8N09D2","WKDFVRT8N09D3","WKDFVRT8N09D4","WKDFVRT8N09D5", & + "WKDFVRT8N09D6","WKDFVRT8N09D7","WKDFVRT8N09D8","WKDFVRT8N09D9","WKDFVRT8N10D1","WKDFVRT8N10D2","WKDFVRT8N10D3","WKDFVRT8N10D4", & + "WKDFVRT8N10D5","WKDFVRT8N10D6","WKDFVRT8N10D7","WKDFVRT8N10D8","WKDFVRT8N10D9","WKDFVRT8N11D1","WKDFVRT8N11D2","WKDFVRT8N11D3", & + "WKDFVRT8N11D4","WKDFVRT8N11D5","WKDFVRT8N11D6","WKDFVRT8N11D7","WKDFVRT8N11D8","WKDFVRT8N11D9","WKDFVRT8N12D1","WKDFVRT8N12D2", & + "WKDFVRT8N12D3","WKDFVRT8N12D4","WKDFVRT8N12D5","WKDFVRT8N12D6","WKDFVRT8N12D7","WKDFVRT8N12D8","WKDFVRT8N12D9","WKDFVRT8N13D1", & + "WKDFVRT8N13D2","WKDFVRT8N13D3","WKDFVRT8N13D4","WKDFVRT8N13D5","WKDFVRT8N13D6","WKDFVRT8N13D7","WKDFVRT8N13D8","WKDFVRT8N13D9", & + "WKDFVRT8N14D1","WKDFVRT8N14D2","WKDFVRT8N14D3","WKDFVRT8N14D4","WKDFVRT8N14D5","WKDFVRT8N14D6","WKDFVRT8N14D7","WKDFVRT8N14D8", & + "WKDFVRT8N14D9","WKDFVRT8N15D1","WKDFVRT8N15D2","WKDFVRT8N15D3","WKDFVRT8N15D4","WKDFVRT8N15D5","WKDFVRT8N15D6","WKDFVRT8N15D7", & + "WKDFVRT8N15D8","WKDFVRT8N15D9","WKDFVRT8N16D1","WKDFVRT8N16D2","WKDFVRT8N16D3","WKDFVRT8N16D4","WKDFVRT8N16D5","WKDFVRT8N16D6", & + "WKDFVRT8N16D7","WKDFVRT8N16D8","WKDFVRT8N16D9","WKDFVRT8N17D1","WKDFVRT8N17D2","WKDFVRT8N17D3","WKDFVRT8N17D4","WKDFVRT8N17D5", & + "WKDFVRT8N17D6","WKDFVRT8N17D7","WKDFVRT8N17D8","WKDFVRT8N17D9","WKDFVRT8N18D1","WKDFVRT8N18D2","WKDFVRT8N18D3","WKDFVRT8N18D4", & + "WKDFVRT8N18D5","WKDFVRT8N18D6","WKDFVRT8N18D7","WKDFVRT8N18D8","WKDFVRT8N18D9","WKDFVRT8N19D1","WKDFVRT8N19D2","WKDFVRT8N19D3", & + "WKDFVRT8N19D4","WKDFVRT8N19D5","WKDFVRT8N19D6","WKDFVRT8N19D7","WKDFVRT8N19D8","WKDFVRT8N19D9","WKDFVRT8N20D1","WKDFVRT8N20D2", & + "WKDFVRT8N20D3","WKDFVRT8N20D4","WKDFVRT8N20D5","WKDFVRT8N20D6","WKDFVRT8N20D7","WKDFVRT8N20D8","WKDFVRT8N20D9","WKDFVRT9N01D1", & + "WKDFVRT9N01D2","WKDFVRT9N01D3","WKDFVRT9N01D4","WKDFVRT9N01D5","WKDFVRT9N01D6","WKDFVRT9N01D7","WKDFVRT9N01D8","WKDFVRT9N01D9", & + "WKDFVRT9N02D1","WKDFVRT9N02D2","WKDFVRT9N02D3","WKDFVRT9N02D4","WKDFVRT9N02D5","WKDFVRT9N02D6","WKDFVRT9N02D7","WKDFVRT9N02D8", & + "WKDFVRT9N02D9","WKDFVRT9N03D1","WKDFVRT9N03D2","WKDFVRT9N03D3","WKDFVRT9N03D4","WKDFVRT9N03D5","WKDFVRT9N03D6","WKDFVRT9N03D7", & + "WKDFVRT9N03D8","WKDFVRT9N03D9","WKDFVRT9N04D1","WKDFVRT9N04D2","WKDFVRT9N04D3","WKDFVRT9N04D4","WKDFVRT9N04D5","WKDFVRT9N04D6", & + "WKDFVRT9N04D7","WKDFVRT9N04D8","WKDFVRT9N04D9","WKDFVRT9N05D1","WKDFVRT9N05D2","WKDFVRT9N05D3","WKDFVRT9N05D4","WKDFVRT9N05D5", & + "WKDFVRT9N05D6","WKDFVRT9N05D7","WKDFVRT9N05D8","WKDFVRT9N05D9","WKDFVRT9N06D1","WKDFVRT9N06D2","WKDFVRT9N06D3","WKDFVRT9N06D4", & + "WKDFVRT9N06D5","WKDFVRT9N06D6","WKDFVRT9N06D7","WKDFVRT9N06D8","WKDFVRT9N06D9","WKDFVRT9N07D1","WKDFVRT9N07D2","WKDFVRT9N07D3", & + "WKDFVRT9N07D4","WKDFVRT9N07D5","WKDFVRT9N07D6","WKDFVRT9N07D7","WKDFVRT9N07D8","WKDFVRT9N07D9","WKDFVRT9N08D1","WKDFVRT9N08D2", & + "WKDFVRT9N08D3","WKDFVRT9N08D4","WKDFVRT9N08D5","WKDFVRT9N08D6","WKDFVRT9N08D7","WKDFVRT9N08D8","WKDFVRT9N08D9","WKDFVRT9N09D1", & + "WKDFVRT9N09D2","WKDFVRT9N09D3","WKDFVRT9N09D4","WKDFVRT9N09D5","WKDFVRT9N09D6","WKDFVRT9N09D7","WKDFVRT9N09D8","WKDFVRT9N09D9", & + "WKDFVRT9N10D1","WKDFVRT9N10D2","WKDFVRT9N10D3","WKDFVRT9N10D4","WKDFVRT9N10D5","WKDFVRT9N10D6","WKDFVRT9N10D7","WKDFVRT9N10D8", & + "WKDFVRT9N10D9","WKDFVRT9N11D1","WKDFVRT9N11D2","WKDFVRT9N11D3","WKDFVRT9N11D4","WKDFVRT9N11D5","WKDFVRT9N11D6","WKDFVRT9N11D7", & + "WKDFVRT9N11D8","WKDFVRT9N11D9","WKDFVRT9N12D1","WKDFVRT9N12D2","WKDFVRT9N12D3","WKDFVRT9N12D4","WKDFVRT9N12D5","WKDFVRT9N12D6", & + "WKDFVRT9N12D7","WKDFVRT9N12D8","WKDFVRT9N12D9","WKDFVRT9N13D1","WKDFVRT9N13D2","WKDFVRT9N13D3","WKDFVRT9N13D4","WKDFVRT9N13D5", & + "WKDFVRT9N13D6","WKDFVRT9N13D7","WKDFVRT9N13D8","WKDFVRT9N13D9","WKDFVRT9N14D1","WKDFVRT9N14D2","WKDFVRT9N14D3","WKDFVRT9N14D4", & + "WKDFVRT9N14D5","WKDFVRT9N14D6","WKDFVRT9N14D7","WKDFVRT9N14D8","WKDFVRT9N14D9","WKDFVRT9N15D1","WKDFVRT9N15D2","WKDFVRT9N15D3", & + "WKDFVRT9N15D4","WKDFVRT9N15D5","WKDFVRT9N15D6","WKDFVRT9N15D7","WKDFVRT9N15D8","WKDFVRT9N15D9","WKDFVRT9N16D1","WKDFVRT9N16D2", & + "WKDFVRT9N16D3","WKDFVRT9N16D4","WKDFVRT9N16D5","WKDFVRT9N16D6","WKDFVRT9N16D7","WKDFVRT9N16D8","WKDFVRT9N16D9","WKDFVRT9N17D1", & + "WKDFVRT9N17D2","WKDFVRT9N17D3","WKDFVRT9N17D4","WKDFVRT9N17D5","WKDFVRT9N17D6","WKDFVRT9N17D7","WKDFVRT9N17D8","WKDFVRT9N17D9", & + "WKDFVRT9N18D1","WKDFVRT9N18D2","WKDFVRT9N18D3","WKDFVRT9N18D4","WKDFVRT9N18D5","WKDFVRT9N18D6","WKDFVRT9N18D7","WKDFVRT9N18D8", & + "WKDFVRT9N18D9","WKDFVRT9N19D1","WKDFVRT9N19D2","WKDFVRT9N19D3","WKDFVRT9N19D4","WKDFVRT9N19D5","WKDFVRT9N19D6","WKDFVRT9N19D7", & + "WKDFVRT9N19D8","WKDFVRT9N19D9","WKDFVRT9N20D1","WKDFVRT9N20D2","WKDFVRT9N20D3","WKDFVRT9N20D4","WKDFVRT9N20D5","WKDFVRT9N20D6", & + "WKDFVRT9N20D7","WKDFVRT9N20D8","WKDFVRT9N20D9","WKDFVXT1N01D1","WKDFVXT1N01D2","WKDFVXT1N01D3","WKDFVXT1N01D4","WKDFVXT1N01D5", & + "WKDFVXT1N01D6","WKDFVXT1N01D7","WKDFVXT1N01D8","WKDFVXT1N01D9","WKDFVXT1N02D1","WKDFVXT1N02D2","WKDFVXT1N02D3","WKDFVXT1N02D4", & + "WKDFVXT1N02D5","WKDFVXT1N02D6","WKDFVXT1N02D7","WKDFVXT1N02D8","WKDFVXT1N02D9","WKDFVXT1N03D1","WKDFVXT1N03D2","WKDFVXT1N03D3", & + "WKDFVXT1N03D4","WKDFVXT1N03D5","WKDFVXT1N03D6","WKDFVXT1N03D7","WKDFVXT1N03D8","WKDFVXT1N03D9","WKDFVXT1N04D1","WKDFVXT1N04D2", & + "WKDFVXT1N04D3","WKDFVXT1N04D4","WKDFVXT1N04D5","WKDFVXT1N04D6","WKDFVXT1N04D7","WKDFVXT1N04D8","WKDFVXT1N04D9","WKDFVXT1N05D1", & + "WKDFVXT1N05D2","WKDFVXT1N05D3","WKDFVXT1N05D4","WKDFVXT1N05D5","WKDFVXT1N05D6","WKDFVXT1N05D7","WKDFVXT1N05D8","WKDFVXT1N05D9", & + "WKDFVXT1N06D1","WKDFVXT1N06D2","WKDFVXT1N06D3","WKDFVXT1N06D4","WKDFVXT1N06D5","WKDFVXT1N06D6","WKDFVXT1N06D7","WKDFVXT1N06D8", & + "WKDFVXT1N06D9","WKDFVXT1N07D1","WKDFVXT1N07D2","WKDFVXT1N07D3","WKDFVXT1N07D4","WKDFVXT1N07D5","WKDFVXT1N07D6","WKDFVXT1N07D7", & + "WKDFVXT1N07D8","WKDFVXT1N07D9","WKDFVXT1N08D1","WKDFVXT1N08D2","WKDFVXT1N08D3","WKDFVXT1N08D4","WKDFVXT1N08D5","WKDFVXT1N08D6", & + "WKDFVXT1N08D7","WKDFVXT1N08D8","WKDFVXT1N08D9","WKDFVXT1N09D1","WKDFVXT1N09D2","WKDFVXT1N09D3","WKDFVXT1N09D4","WKDFVXT1N09D5", & + "WKDFVXT1N09D6","WKDFVXT1N09D7","WKDFVXT1N09D8","WKDFVXT1N09D9","WKDFVXT1N10D1","WKDFVXT1N10D2","WKDFVXT1N10D3","WKDFVXT1N10D4", & + "WKDFVXT1N10D5","WKDFVXT1N10D6","WKDFVXT1N10D7","WKDFVXT1N10D8","WKDFVXT1N10D9","WKDFVXT1N11D1","WKDFVXT1N11D2","WKDFVXT1N11D3", & + "WKDFVXT1N11D4","WKDFVXT1N11D5","WKDFVXT1N11D6","WKDFVXT1N11D7","WKDFVXT1N11D8","WKDFVXT1N11D9","WKDFVXT1N12D1","WKDFVXT1N12D2", & + "WKDFVXT1N12D3","WKDFVXT1N12D4","WKDFVXT1N12D5","WKDFVXT1N12D6","WKDFVXT1N12D7","WKDFVXT1N12D8","WKDFVXT1N12D9","WKDFVXT1N13D1", & + "WKDFVXT1N13D2","WKDFVXT1N13D3","WKDFVXT1N13D4","WKDFVXT1N13D5","WKDFVXT1N13D6","WKDFVXT1N13D7","WKDFVXT1N13D8","WKDFVXT1N13D9", & + "WKDFVXT1N14D1","WKDFVXT1N14D2","WKDFVXT1N14D3","WKDFVXT1N14D4","WKDFVXT1N14D5","WKDFVXT1N14D6","WKDFVXT1N14D7","WKDFVXT1N14D8", & + "WKDFVXT1N14D9","WKDFVXT1N15D1","WKDFVXT1N15D2","WKDFVXT1N15D3","WKDFVXT1N15D4","WKDFVXT1N15D5","WKDFVXT1N15D6","WKDFVXT1N15D7", & + "WKDFVXT1N15D8","WKDFVXT1N15D9","WKDFVXT1N16D1","WKDFVXT1N16D2","WKDFVXT1N16D3","WKDFVXT1N16D4","WKDFVXT1N16D5","WKDFVXT1N16D6", & + "WKDFVXT1N16D7","WKDFVXT1N16D8","WKDFVXT1N16D9","WKDFVXT1N17D1","WKDFVXT1N17D2","WKDFVXT1N17D3","WKDFVXT1N17D4","WKDFVXT1N17D5", & + "WKDFVXT1N17D6","WKDFVXT1N17D7","WKDFVXT1N17D8","WKDFVXT1N17D9","WKDFVXT1N18D1","WKDFVXT1N18D2","WKDFVXT1N18D3","WKDFVXT1N18D4", & + "WKDFVXT1N18D5","WKDFVXT1N18D6","WKDFVXT1N18D7","WKDFVXT1N18D8","WKDFVXT1N18D9","WKDFVXT1N19D1","WKDFVXT1N19D2","WKDFVXT1N19D3", & + "WKDFVXT1N19D4","WKDFVXT1N19D5","WKDFVXT1N19D6","WKDFVXT1N19D7","WKDFVXT1N19D8","WKDFVXT1N19D9","WKDFVXT1N20D1","WKDFVXT1N20D2", & + "WKDFVXT1N20D3","WKDFVXT1N20D4","WKDFVXT1N20D5","WKDFVXT1N20D6","WKDFVXT1N20D7","WKDFVXT1N20D8","WKDFVXT1N20D9","WKDFVXT2N01D1", & + "WKDFVXT2N01D2","WKDFVXT2N01D3","WKDFVXT2N01D4","WKDFVXT2N01D5","WKDFVXT2N01D6","WKDFVXT2N01D7","WKDFVXT2N01D8","WKDFVXT2N01D9", & + "WKDFVXT2N02D1","WKDFVXT2N02D2","WKDFVXT2N02D3","WKDFVXT2N02D4","WKDFVXT2N02D5","WKDFVXT2N02D6","WKDFVXT2N02D7","WKDFVXT2N02D8", & + "WKDFVXT2N02D9","WKDFVXT2N03D1","WKDFVXT2N03D2","WKDFVXT2N03D3","WKDFVXT2N03D4","WKDFVXT2N03D5","WKDFVXT2N03D6","WKDFVXT2N03D7", & + "WKDFVXT2N03D8","WKDFVXT2N03D9","WKDFVXT2N04D1","WKDFVXT2N04D2","WKDFVXT2N04D3","WKDFVXT2N04D4","WKDFVXT2N04D5","WKDFVXT2N04D6", & + "WKDFVXT2N04D7","WKDFVXT2N04D8","WKDFVXT2N04D9","WKDFVXT2N05D1","WKDFVXT2N05D2","WKDFVXT2N05D3","WKDFVXT2N05D4","WKDFVXT2N05D5", & + "WKDFVXT2N05D6","WKDFVXT2N05D7","WKDFVXT2N05D8","WKDFVXT2N05D9","WKDFVXT2N06D1","WKDFVXT2N06D2","WKDFVXT2N06D3","WKDFVXT2N06D4", & + "WKDFVXT2N06D5","WKDFVXT2N06D6","WKDFVXT2N06D7","WKDFVXT2N06D8","WKDFVXT2N06D9","WKDFVXT2N07D1","WKDFVXT2N07D2","WKDFVXT2N07D3", & + "WKDFVXT2N07D4","WKDFVXT2N07D5","WKDFVXT2N07D6","WKDFVXT2N07D7","WKDFVXT2N07D8","WKDFVXT2N07D9","WKDFVXT2N08D1","WKDFVXT2N08D2", & + "WKDFVXT2N08D3","WKDFVXT2N08D4","WKDFVXT2N08D5","WKDFVXT2N08D6","WKDFVXT2N08D7","WKDFVXT2N08D8","WKDFVXT2N08D9","WKDFVXT2N09D1", & + "WKDFVXT2N09D2","WKDFVXT2N09D3","WKDFVXT2N09D4","WKDFVXT2N09D5","WKDFVXT2N09D6","WKDFVXT2N09D7","WKDFVXT2N09D8","WKDFVXT2N09D9", & + "WKDFVXT2N10D1","WKDFVXT2N10D2","WKDFVXT2N10D3","WKDFVXT2N10D4","WKDFVXT2N10D5","WKDFVXT2N10D6","WKDFVXT2N10D7","WKDFVXT2N10D8", & + "WKDFVXT2N10D9","WKDFVXT2N11D1","WKDFVXT2N11D2","WKDFVXT2N11D3","WKDFVXT2N11D4","WKDFVXT2N11D5","WKDFVXT2N11D6","WKDFVXT2N11D7", & + "WKDFVXT2N11D8","WKDFVXT2N11D9","WKDFVXT2N12D1","WKDFVXT2N12D2","WKDFVXT2N12D3","WKDFVXT2N12D4","WKDFVXT2N12D5","WKDFVXT2N12D6", & + "WKDFVXT2N12D7","WKDFVXT2N12D8","WKDFVXT2N12D9","WKDFVXT2N13D1","WKDFVXT2N13D2","WKDFVXT2N13D3","WKDFVXT2N13D4","WKDFVXT2N13D5", & + "WKDFVXT2N13D6","WKDFVXT2N13D7","WKDFVXT2N13D8","WKDFVXT2N13D9","WKDFVXT2N14D1","WKDFVXT2N14D2","WKDFVXT2N14D3","WKDFVXT2N14D4", & + "WKDFVXT2N14D5","WKDFVXT2N14D6","WKDFVXT2N14D7","WKDFVXT2N14D8","WKDFVXT2N14D9","WKDFVXT2N15D1","WKDFVXT2N15D2","WKDFVXT2N15D3", & + "WKDFVXT2N15D4","WKDFVXT2N15D5","WKDFVXT2N15D6","WKDFVXT2N15D7","WKDFVXT2N15D8","WKDFVXT2N15D9","WKDFVXT2N16D1","WKDFVXT2N16D2", & + "WKDFVXT2N16D3","WKDFVXT2N16D4","WKDFVXT2N16D5","WKDFVXT2N16D6","WKDFVXT2N16D7","WKDFVXT2N16D8","WKDFVXT2N16D9","WKDFVXT2N17D1", & + "WKDFVXT2N17D2","WKDFVXT2N17D3","WKDFVXT2N17D4","WKDFVXT2N17D5","WKDFVXT2N17D6","WKDFVXT2N17D7","WKDFVXT2N17D8","WKDFVXT2N17D9", & + "WKDFVXT2N18D1","WKDFVXT2N18D2","WKDFVXT2N18D3","WKDFVXT2N18D4","WKDFVXT2N18D5","WKDFVXT2N18D6","WKDFVXT2N18D7","WKDFVXT2N18D8", & + "WKDFVXT2N18D9","WKDFVXT2N19D1","WKDFVXT2N19D2","WKDFVXT2N19D3","WKDFVXT2N19D4","WKDFVXT2N19D5","WKDFVXT2N19D6","WKDFVXT2N19D7", & + "WKDFVXT2N19D8","WKDFVXT2N19D9","WKDFVXT2N20D1","WKDFVXT2N20D2","WKDFVXT2N20D3","WKDFVXT2N20D4","WKDFVXT2N20D5","WKDFVXT2N20D6", & + "WKDFVXT2N20D7","WKDFVXT2N20D8","WKDFVXT2N20D9","WKDFVXT3N01D1","WKDFVXT3N01D2","WKDFVXT3N01D3","WKDFVXT3N01D4","WKDFVXT3N01D5", & + "WKDFVXT3N01D6","WKDFVXT3N01D7","WKDFVXT3N01D8","WKDFVXT3N01D9","WKDFVXT3N02D1","WKDFVXT3N02D2","WKDFVXT3N02D3","WKDFVXT3N02D4", & + "WKDFVXT3N02D5","WKDFVXT3N02D6","WKDFVXT3N02D7","WKDFVXT3N02D8","WKDFVXT3N02D9","WKDFVXT3N03D1","WKDFVXT3N03D2","WKDFVXT3N03D3", & + "WKDFVXT3N03D4","WKDFVXT3N03D5","WKDFVXT3N03D6","WKDFVXT3N03D7","WKDFVXT3N03D8","WKDFVXT3N03D9","WKDFVXT3N04D1","WKDFVXT3N04D2", & + "WKDFVXT3N04D3","WKDFVXT3N04D4","WKDFVXT3N04D5","WKDFVXT3N04D6","WKDFVXT3N04D7","WKDFVXT3N04D8","WKDFVXT3N04D9","WKDFVXT3N05D1", & + "WKDFVXT3N05D2","WKDFVXT3N05D3","WKDFVXT3N05D4","WKDFVXT3N05D5","WKDFVXT3N05D6","WKDFVXT3N05D7","WKDFVXT3N05D8","WKDFVXT3N05D9", & + "WKDFVXT3N06D1","WKDFVXT3N06D2","WKDFVXT3N06D3","WKDFVXT3N06D4","WKDFVXT3N06D5","WKDFVXT3N06D6","WKDFVXT3N06D7","WKDFVXT3N06D8", & + "WKDFVXT3N06D9","WKDFVXT3N07D1","WKDFVXT3N07D2","WKDFVXT3N07D3","WKDFVXT3N07D4","WKDFVXT3N07D5","WKDFVXT3N07D6","WKDFVXT3N07D7", & + "WKDFVXT3N07D8","WKDFVXT3N07D9","WKDFVXT3N08D1","WKDFVXT3N08D2","WKDFVXT3N08D3","WKDFVXT3N08D4","WKDFVXT3N08D5","WKDFVXT3N08D6", & + "WKDFVXT3N08D7","WKDFVXT3N08D8","WKDFVXT3N08D9","WKDFVXT3N09D1","WKDFVXT3N09D2","WKDFVXT3N09D3","WKDFVXT3N09D4","WKDFVXT3N09D5", & + "WKDFVXT3N09D6","WKDFVXT3N09D7","WKDFVXT3N09D8","WKDFVXT3N09D9","WKDFVXT3N10D1","WKDFVXT3N10D2","WKDFVXT3N10D3","WKDFVXT3N10D4", & + "WKDFVXT3N10D5","WKDFVXT3N10D6","WKDFVXT3N10D7","WKDFVXT3N10D8","WKDFVXT3N10D9","WKDFVXT3N11D1","WKDFVXT3N11D2","WKDFVXT3N11D3", & + "WKDFVXT3N11D4","WKDFVXT3N11D5","WKDFVXT3N11D6","WKDFVXT3N11D7","WKDFVXT3N11D8","WKDFVXT3N11D9","WKDFVXT3N12D1","WKDFVXT3N12D2", & + "WKDFVXT3N12D3","WKDFVXT3N12D4","WKDFVXT3N12D5","WKDFVXT3N12D6","WKDFVXT3N12D7","WKDFVXT3N12D8","WKDFVXT3N12D9","WKDFVXT3N13D1", & + "WKDFVXT3N13D2","WKDFVXT3N13D3","WKDFVXT3N13D4","WKDFVXT3N13D5","WKDFVXT3N13D6","WKDFVXT3N13D7","WKDFVXT3N13D8","WKDFVXT3N13D9", & + "WKDFVXT3N14D1","WKDFVXT3N14D2","WKDFVXT3N14D3","WKDFVXT3N14D4","WKDFVXT3N14D5","WKDFVXT3N14D6","WKDFVXT3N14D7","WKDFVXT3N14D8", & + "WKDFVXT3N14D9","WKDFVXT3N15D1","WKDFVXT3N15D2","WKDFVXT3N15D3","WKDFVXT3N15D4","WKDFVXT3N15D5","WKDFVXT3N15D6","WKDFVXT3N15D7", & + "WKDFVXT3N15D8","WKDFVXT3N15D9","WKDFVXT3N16D1","WKDFVXT3N16D2","WKDFVXT3N16D3","WKDFVXT3N16D4","WKDFVXT3N16D5","WKDFVXT3N16D6", & + "WKDFVXT3N16D7","WKDFVXT3N16D8","WKDFVXT3N16D9","WKDFVXT3N17D1","WKDFVXT3N17D2","WKDFVXT3N17D3","WKDFVXT3N17D4","WKDFVXT3N17D5", & + "WKDFVXT3N17D6","WKDFVXT3N17D7","WKDFVXT3N17D8","WKDFVXT3N17D9","WKDFVXT3N18D1","WKDFVXT3N18D2","WKDFVXT3N18D3","WKDFVXT3N18D4", & + "WKDFVXT3N18D5","WKDFVXT3N18D6","WKDFVXT3N18D7","WKDFVXT3N18D8","WKDFVXT3N18D9","WKDFVXT3N19D1","WKDFVXT3N19D2","WKDFVXT3N19D3", & + "WKDFVXT3N19D4","WKDFVXT3N19D5","WKDFVXT3N19D6","WKDFVXT3N19D7","WKDFVXT3N19D8","WKDFVXT3N19D9","WKDFVXT3N20D1","WKDFVXT3N20D2", & + "WKDFVXT3N20D3","WKDFVXT3N20D4","WKDFVXT3N20D5","WKDFVXT3N20D6","WKDFVXT3N20D7","WKDFVXT3N20D8","WKDFVXT3N20D9","WKDFVXT4N01D1", & + "WKDFVXT4N01D2","WKDFVXT4N01D3","WKDFVXT4N01D4","WKDFVXT4N01D5","WKDFVXT4N01D6","WKDFVXT4N01D7","WKDFVXT4N01D8","WKDFVXT4N01D9", & + "WKDFVXT4N02D1","WKDFVXT4N02D2","WKDFVXT4N02D3","WKDFVXT4N02D4","WKDFVXT4N02D5","WKDFVXT4N02D6","WKDFVXT4N02D7","WKDFVXT4N02D8", & + "WKDFVXT4N02D9","WKDFVXT4N03D1","WKDFVXT4N03D2","WKDFVXT4N03D3","WKDFVXT4N03D4","WKDFVXT4N03D5","WKDFVXT4N03D6","WKDFVXT4N03D7", & + "WKDFVXT4N03D8","WKDFVXT4N03D9","WKDFVXT4N04D1","WKDFVXT4N04D2","WKDFVXT4N04D3","WKDFVXT4N04D4","WKDFVXT4N04D5","WKDFVXT4N04D6", & + "WKDFVXT4N04D7","WKDFVXT4N04D8","WKDFVXT4N04D9","WKDFVXT4N05D1","WKDFVXT4N05D2","WKDFVXT4N05D3","WKDFVXT4N05D4","WKDFVXT4N05D5", & + "WKDFVXT4N05D6","WKDFVXT4N05D7","WKDFVXT4N05D8","WKDFVXT4N05D9","WKDFVXT4N06D1","WKDFVXT4N06D2","WKDFVXT4N06D3","WKDFVXT4N06D4", & + "WKDFVXT4N06D5","WKDFVXT4N06D6","WKDFVXT4N06D7","WKDFVXT4N06D8","WKDFVXT4N06D9","WKDFVXT4N07D1","WKDFVXT4N07D2","WKDFVXT4N07D3", & + "WKDFVXT4N07D4","WKDFVXT4N07D5","WKDFVXT4N07D6","WKDFVXT4N07D7","WKDFVXT4N07D8","WKDFVXT4N07D9","WKDFVXT4N08D1","WKDFVXT4N08D2", & + "WKDFVXT4N08D3","WKDFVXT4N08D4","WKDFVXT4N08D5","WKDFVXT4N08D6","WKDFVXT4N08D7","WKDFVXT4N08D8","WKDFVXT4N08D9","WKDFVXT4N09D1", & + "WKDFVXT4N09D2","WKDFVXT4N09D3","WKDFVXT4N09D4","WKDFVXT4N09D5","WKDFVXT4N09D6","WKDFVXT4N09D7","WKDFVXT4N09D8","WKDFVXT4N09D9", & + "WKDFVXT4N10D1","WKDFVXT4N10D2","WKDFVXT4N10D3","WKDFVXT4N10D4","WKDFVXT4N10D5","WKDFVXT4N10D6","WKDFVXT4N10D7","WKDFVXT4N10D8", & + "WKDFVXT4N10D9","WKDFVXT4N11D1","WKDFVXT4N11D2","WKDFVXT4N11D3","WKDFVXT4N11D4","WKDFVXT4N11D5","WKDFVXT4N11D6","WKDFVXT4N11D7", & + "WKDFVXT4N11D8","WKDFVXT4N11D9","WKDFVXT4N12D1","WKDFVXT4N12D2","WKDFVXT4N12D3","WKDFVXT4N12D4","WKDFVXT4N12D5","WKDFVXT4N12D6", & + "WKDFVXT4N12D7","WKDFVXT4N12D8","WKDFVXT4N12D9","WKDFVXT4N13D1","WKDFVXT4N13D2","WKDFVXT4N13D3","WKDFVXT4N13D4","WKDFVXT4N13D5", & + "WKDFVXT4N13D6","WKDFVXT4N13D7","WKDFVXT4N13D8","WKDFVXT4N13D9","WKDFVXT4N14D1","WKDFVXT4N14D2","WKDFVXT4N14D3","WKDFVXT4N14D4", & + "WKDFVXT4N14D5","WKDFVXT4N14D6","WKDFVXT4N14D7","WKDFVXT4N14D8","WKDFVXT4N14D9","WKDFVXT4N15D1","WKDFVXT4N15D2","WKDFVXT4N15D3", & + "WKDFVXT4N15D4","WKDFVXT4N15D5","WKDFVXT4N15D6","WKDFVXT4N15D7","WKDFVXT4N15D8","WKDFVXT4N15D9","WKDFVXT4N16D1","WKDFVXT4N16D2", & + "WKDFVXT4N16D3","WKDFVXT4N16D4","WKDFVXT4N16D5","WKDFVXT4N16D6","WKDFVXT4N16D7","WKDFVXT4N16D8","WKDFVXT4N16D9","WKDFVXT4N17D1", & + "WKDFVXT4N17D2","WKDFVXT4N17D3","WKDFVXT4N17D4","WKDFVXT4N17D5","WKDFVXT4N17D6","WKDFVXT4N17D7","WKDFVXT4N17D8","WKDFVXT4N17D9", & + "WKDFVXT4N18D1","WKDFVXT4N18D2","WKDFVXT4N18D3","WKDFVXT4N18D4","WKDFVXT4N18D5","WKDFVXT4N18D6","WKDFVXT4N18D7","WKDFVXT4N18D8", & + "WKDFVXT4N18D9","WKDFVXT4N19D1","WKDFVXT4N19D2","WKDFVXT4N19D3","WKDFVXT4N19D4","WKDFVXT4N19D5","WKDFVXT4N19D6","WKDFVXT4N19D7", & + "WKDFVXT4N19D8","WKDFVXT4N19D9","WKDFVXT4N20D1","WKDFVXT4N20D2","WKDFVXT4N20D3","WKDFVXT4N20D4","WKDFVXT4N20D5","WKDFVXT4N20D6", & + "WKDFVXT4N20D7","WKDFVXT4N20D8","WKDFVXT4N20D9","WKDFVXT5N01D1","WKDFVXT5N01D2","WKDFVXT5N01D3","WKDFVXT5N01D4","WKDFVXT5N01D5", & + "WKDFVXT5N01D6","WKDFVXT5N01D7","WKDFVXT5N01D8","WKDFVXT5N01D9","WKDFVXT5N02D1","WKDFVXT5N02D2","WKDFVXT5N02D3","WKDFVXT5N02D4", & + "WKDFVXT5N02D5","WKDFVXT5N02D6","WKDFVXT5N02D7","WKDFVXT5N02D8","WKDFVXT5N02D9","WKDFVXT5N03D1","WKDFVXT5N03D2","WKDFVXT5N03D3", & + "WKDFVXT5N03D4","WKDFVXT5N03D5","WKDFVXT5N03D6","WKDFVXT5N03D7","WKDFVXT5N03D8","WKDFVXT5N03D9","WKDFVXT5N04D1","WKDFVXT5N04D2", & + "WKDFVXT5N04D3","WKDFVXT5N04D4","WKDFVXT5N04D5","WKDFVXT5N04D6","WKDFVXT5N04D7","WKDFVXT5N04D8","WKDFVXT5N04D9","WKDFVXT5N05D1", & + "WKDFVXT5N05D2","WKDFVXT5N05D3","WKDFVXT5N05D4","WKDFVXT5N05D5","WKDFVXT5N05D6","WKDFVXT5N05D7","WKDFVXT5N05D8","WKDFVXT5N05D9", & + "WKDFVXT5N06D1","WKDFVXT5N06D2","WKDFVXT5N06D3","WKDFVXT5N06D4","WKDFVXT5N06D5","WKDFVXT5N06D6","WKDFVXT5N06D7","WKDFVXT5N06D8", & + "WKDFVXT5N06D9","WKDFVXT5N07D1","WKDFVXT5N07D2","WKDFVXT5N07D3","WKDFVXT5N07D4","WKDFVXT5N07D5","WKDFVXT5N07D6","WKDFVXT5N07D7", & + "WKDFVXT5N07D8","WKDFVXT5N07D9","WKDFVXT5N08D1","WKDFVXT5N08D2","WKDFVXT5N08D3","WKDFVXT5N08D4","WKDFVXT5N08D5","WKDFVXT5N08D6", & + "WKDFVXT5N08D7","WKDFVXT5N08D8","WKDFVXT5N08D9","WKDFVXT5N09D1","WKDFVXT5N09D2","WKDFVXT5N09D3","WKDFVXT5N09D4","WKDFVXT5N09D5", & + "WKDFVXT5N09D6","WKDFVXT5N09D7","WKDFVXT5N09D8","WKDFVXT5N09D9","WKDFVXT5N10D1","WKDFVXT5N10D2","WKDFVXT5N10D3","WKDFVXT5N10D4", & + "WKDFVXT5N10D5","WKDFVXT5N10D6","WKDFVXT5N10D7","WKDFVXT5N10D8","WKDFVXT5N10D9","WKDFVXT5N11D1","WKDFVXT5N11D2","WKDFVXT5N11D3", & + "WKDFVXT5N11D4","WKDFVXT5N11D5","WKDFVXT5N11D6","WKDFVXT5N11D7","WKDFVXT5N11D8","WKDFVXT5N11D9","WKDFVXT5N12D1","WKDFVXT5N12D2", & + "WKDFVXT5N12D3","WKDFVXT5N12D4","WKDFVXT5N12D5","WKDFVXT5N12D6","WKDFVXT5N12D7","WKDFVXT5N12D8","WKDFVXT5N12D9","WKDFVXT5N13D1", & + "WKDFVXT5N13D2","WKDFVXT5N13D3","WKDFVXT5N13D4","WKDFVXT5N13D5","WKDFVXT5N13D6","WKDFVXT5N13D7","WKDFVXT5N13D8","WKDFVXT5N13D9", & + "WKDFVXT5N14D1","WKDFVXT5N14D2","WKDFVXT5N14D3","WKDFVXT5N14D4","WKDFVXT5N14D5","WKDFVXT5N14D6","WKDFVXT5N14D7","WKDFVXT5N14D8", & + "WKDFVXT5N14D9","WKDFVXT5N15D1","WKDFVXT5N15D2","WKDFVXT5N15D3","WKDFVXT5N15D4","WKDFVXT5N15D5","WKDFVXT5N15D6","WKDFVXT5N15D7", & + "WKDFVXT5N15D8","WKDFVXT5N15D9","WKDFVXT5N16D1","WKDFVXT5N16D2","WKDFVXT5N16D3","WKDFVXT5N16D4","WKDFVXT5N16D5","WKDFVXT5N16D6", & + "WKDFVXT5N16D7","WKDFVXT5N16D8","WKDFVXT5N16D9","WKDFVXT5N17D1","WKDFVXT5N17D2","WKDFVXT5N17D3","WKDFVXT5N17D4","WKDFVXT5N17D5", & + "WKDFVXT5N17D6","WKDFVXT5N17D7","WKDFVXT5N17D8","WKDFVXT5N17D9","WKDFVXT5N18D1","WKDFVXT5N18D2","WKDFVXT5N18D3","WKDFVXT5N18D4", & + "WKDFVXT5N18D5","WKDFVXT5N18D6","WKDFVXT5N18D7","WKDFVXT5N18D8","WKDFVXT5N18D9","WKDFVXT5N19D1","WKDFVXT5N19D2","WKDFVXT5N19D3", & + "WKDFVXT5N19D4","WKDFVXT5N19D5","WKDFVXT5N19D6","WKDFVXT5N19D7","WKDFVXT5N19D8","WKDFVXT5N19D9","WKDFVXT5N20D1","WKDFVXT5N20D2", & + "WKDFVXT5N20D3","WKDFVXT5N20D4","WKDFVXT5N20D5","WKDFVXT5N20D6","WKDFVXT5N20D7","WKDFVXT5N20D8","WKDFVXT5N20D9","WKDFVXT6N01D1", & + "WKDFVXT6N01D2","WKDFVXT6N01D3","WKDFVXT6N01D4","WKDFVXT6N01D5","WKDFVXT6N01D6","WKDFVXT6N01D7","WKDFVXT6N01D8","WKDFVXT6N01D9", & + "WKDFVXT6N02D1","WKDFVXT6N02D2","WKDFVXT6N02D3","WKDFVXT6N02D4","WKDFVXT6N02D5","WKDFVXT6N02D6","WKDFVXT6N02D7","WKDFVXT6N02D8", & + "WKDFVXT6N02D9","WKDFVXT6N03D1","WKDFVXT6N03D2","WKDFVXT6N03D3","WKDFVXT6N03D4","WKDFVXT6N03D5","WKDFVXT6N03D6","WKDFVXT6N03D7", & + "WKDFVXT6N03D8","WKDFVXT6N03D9","WKDFVXT6N04D1","WKDFVXT6N04D2","WKDFVXT6N04D3","WKDFVXT6N04D4","WKDFVXT6N04D5","WKDFVXT6N04D6"/) + ValidParamAry(8161:9423) = (/ & + "WKDFVXT6N04D7","WKDFVXT6N04D8","WKDFVXT6N04D9","WKDFVXT6N05D1","WKDFVXT6N05D2","WKDFVXT6N05D3","WKDFVXT6N05D4","WKDFVXT6N05D5", & + "WKDFVXT6N05D6","WKDFVXT6N05D7","WKDFVXT6N05D8","WKDFVXT6N05D9","WKDFVXT6N06D1","WKDFVXT6N06D2","WKDFVXT6N06D3","WKDFVXT6N06D4", & + "WKDFVXT6N06D5","WKDFVXT6N06D6","WKDFVXT6N06D7","WKDFVXT6N06D8","WKDFVXT6N06D9","WKDFVXT6N07D1","WKDFVXT6N07D2","WKDFVXT6N07D3", & + "WKDFVXT6N07D4","WKDFVXT6N07D5","WKDFVXT6N07D6","WKDFVXT6N07D7","WKDFVXT6N07D8","WKDFVXT6N07D9","WKDFVXT6N08D1","WKDFVXT6N08D2", & + "WKDFVXT6N08D3","WKDFVXT6N08D4","WKDFVXT6N08D5","WKDFVXT6N08D6","WKDFVXT6N08D7","WKDFVXT6N08D8","WKDFVXT6N08D9","WKDFVXT6N09D1", & + "WKDFVXT6N09D2","WKDFVXT6N09D3","WKDFVXT6N09D4","WKDFVXT6N09D5","WKDFVXT6N09D6","WKDFVXT6N09D7","WKDFVXT6N09D8","WKDFVXT6N09D9", & + "WKDFVXT6N10D1","WKDFVXT6N10D2","WKDFVXT6N10D3","WKDFVXT6N10D4","WKDFVXT6N10D5","WKDFVXT6N10D6","WKDFVXT6N10D7","WKDFVXT6N10D8", & + "WKDFVXT6N10D9","WKDFVXT6N11D1","WKDFVXT6N11D2","WKDFVXT6N11D3","WKDFVXT6N11D4","WKDFVXT6N11D5","WKDFVXT6N11D6","WKDFVXT6N11D7", & + "WKDFVXT6N11D8","WKDFVXT6N11D9","WKDFVXT6N12D1","WKDFVXT6N12D2","WKDFVXT6N12D3","WKDFVXT6N12D4","WKDFVXT6N12D5","WKDFVXT6N12D6", & + "WKDFVXT6N12D7","WKDFVXT6N12D8","WKDFVXT6N12D9","WKDFVXT6N13D1","WKDFVXT6N13D2","WKDFVXT6N13D3","WKDFVXT6N13D4","WKDFVXT6N13D5", & + "WKDFVXT6N13D6","WKDFVXT6N13D7","WKDFVXT6N13D8","WKDFVXT6N13D9","WKDFVXT6N14D1","WKDFVXT6N14D2","WKDFVXT6N14D3","WKDFVXT6N14D4", & + "WKDFVXT6N14D5","WKDFVXT6N14D6","WKDFVXT6N14D7","WKDFVXT6N14D8","WKDFVXT6N14D9","WKDFVXT6N15D1","WKDFVXT6N15D2","WKDFVXT6N15D3", & + "WKDFVXT6N15D4","WKDFVXT6N15D5","WKDFVXT6N15D6","WKDFVXT6N15D7","WKDFVXT6N15D8","WKDFVXT6N15D9","WKDFVXT6N16D1","WKDFVXT6N16D2", & + "WKDFVXT6N16D3","WKDFVXT6N16D4","WKDFVXT6N16D5","WKDFVXT6N16D6","WKDFVXT6N16D7","WKDFVXT6N16D8","WKDFVXT6N16D9","WKDFVXT6N17D1", & + "WKDFVXT6N17D2","WKDFVXT6N17D3","WKDFVXT6N17D4","WKDFVXT6N17D5","WKDFVXT6N17D6","WKDFVXT6N17D7","WKDFVXT6N17D8","WKDFVXT6N17D9", & + "WKDFVXT6N18D1","WKDFVXT6N18D2","WKDFVXT6N18D3","WKDFVXT6N18D4","WKDFVXT6N18D5","WKDFVXT6N18D6","WKDFVXT6N18D7","WKDFVXT6N18D8", & + "WKDFVXT6N18D9","WKDFVXT6N19D1","WKDFVXT6N19D2","WKDFVXT6N19D3","WKDFVXT6N19D4","WKDFVXT6N19D5","WKDFVXT6N19D6","WKDFVXT6N19D7", & + "WKDFVXT6N19D8","WKDFVXT6N19D9","WKDFVXT6N20D1","WKDFVXT6N20D2","WKDFVXT6N20D3","WKDFVXT6N20D4","WKDFVXT6N20D5","WKDFVXT6N20D6", & + "WKDFVXT6N20D7","WKDFVXT6N20D8","WKDFVXT6N20D9","WKDFVXT7N01D1","WKDFVXT7N01D2","WKDFVXT7N01D3","WKDFVXT7N01D4","WKDFVXT7N01D5", & + "WKDFVXT7N01D6","WKDFVXT7N01D7","WKDFVXT7N01D8","WKDFVXT7N01D9","WKDFVXT7N02D1","WKDFVXT7N02D2","WKDFVXT7N02D3","WKDFVXT7N02D4", & + "WKDFVXT7N02D5","WKDFVXT7N02D6","WKDFVXT7N02D7","WKDFVXT7N02D8","WKDFVXT7N02D9","WKDFVXT7N03D1","WKDFVXT7N03D2","WKDFVXT7N03D3", & + "WKDFVXT7N03D4","WKDFVXT7N03D5","WKDFVXT7N03D6","WKDFVXT7N03D7","WKDFVXT7N03D8","WKDFVXT7N03D9","WKDFVXT7N04D1","WKDFVXT7N04D2", & + "WKDFVXT7N04D3","WKDFVXT7N04D4","WKDFVXT7N04D5","WKDFVXT7N04D6","WKDFVXT7N04D7","WKDFVXT7N04D8","WKDFVXT7N04D9","WKDFVXT7N05D1", & + "WKDFVXT7N05D2","WKDFVXT7N05D3","WKDFVXT7N05D4","WKDFVXT7N05D5","WKDFVXT7N05D6","WKDFVXT7N05D7","WKDFVXT7N05D8","WKDFVXT7N05D9", & + "WKDFVXT7N06D1","WKDFVXT7N06D2","WKDFVXT7N06D3","WKDFVXT7N06D4","WKDFVXT7N06D5","WKDFVXT7N06D6","WKDFVXT7N06D7","WKDFVXT7N06D8", & + "WKDFVXT7N06D9","WKDFVXT7N07D1","WKDFVXT7N07D2","WKDFVXT7N07D3","WKDFVXT7N07D4","WKDFVXT7N07D5","WKDFVXT7N07D6","WKDFVXT7N07D7", & + "WKDFVXT7N07D8","WKDFVXT7N07D9","WKDFVXT7N08D1","WKDFVXT7N08D2","WKDFVXT7N08D3","WKDFVXT7N08D4","WKDFVXT7N08D5","WKDFVXT7N08D6", & + "WKDFVXT7N08D7","WKDFVXT7N08D8","WKDFVXT7N08D9","WKDFVXT7N09D1","WKDFVXT7N09D2","WKDFVXT7N09D3","WKDFVXT7N09D4","WKDFVXT7N09D5", & + "WKDFVXT7N09D6","WKDFVXT7N09D7","WKDFVXT7N09D8","WKDFVXT7N09D9","WKDFVXT7N10D1","WKDFVXT7N10D2","WKDFVXT7N10D3","WKDFVXT7N10D4", & + "WKDFVXT7N10D5","WKDFVXT7N10D6","WKDFVXT7N10D7","WKDFVXT7N10D8","WKDFVXT7N10D9","WKDFVXT7N11D1","WKDFVXT7N11D2","WKDFVXT7N11D3", & + "WKDFVXT7N11D4","WKDFVXT7N11D5","WKDFVXT7N11D6","WKDFVXT7N11D7","WKDFVXT7N11D8","WKDFVXT7N11D9","WKDFVXT7N12D1","WKDFVXT7N12D2", & + "WKDFVXT7N12D3","WKDFVXT7N12D4","WKDFVXT7N12D5","WKDFVXT7N12D6","WKDFVXT7N12D7","WKDFVXT7N12D8","WKDFVXT7N12D9","WKDFVXT7N13D1", & + "WKDFVXT7N13D2","WKDFVXT7N13D3","WKDFVXT7N13D4","WKDFVXT7N13D5","WKDFVXT7N13D6","WKDFVXT7N13D7","WKDFVXT7N13D8","WKDFVXT7N13D9", & + "WKDFVXT7N14D1","WKDFVXT7N14D2","WKDFVXT7N14D3","WKDFVXT7N14D4","WKDFVXT7N14D5","WKDFVXT7N14D6","WKDFVXT7N14D7","WKDFVXT7N14D8", & + "WKDFVXT7N14D9","WKDFVXT7N15D1","WKDFVXT7N15D2","WKDFVXT7N15D3","WKDFVXT7N15D4","WKDFVXT7N15D5","WKDFVXT7N15D6","WKDFVXT7N15D7", & + "WKDFVXT7N15D8","WKDFVXT7N15D9","WKDFVXT7N16D1","WKDFVXT7N16D2","WKDFVXT7N16D3","WKDFVXT7N16D4","WKDFVXT7N16D5","WKDFVXT7N16D6", & + "WKDFVXT7N16D7","WKDFVXT7N16D8","WKDFVXT7N16D9","WKDFVXT7N17D1","WKDFVXT7N17D2","WKDFVXT7N17D3","WKDFVXT7N17D4","WKDFVXT7N17D5", & + "WKDFVXT7N17D6","WKDFVXT7N17D7","WKDFVXT7N17D8","WKDFVXT7N17D9","WKDFVXT7N18D1","WKDFVXT7N18D2","WKDFVXT7N18D3","WKDFVXT7N18D4", & + "WKDFVXT7N18D5","WKDFVXT7N18D6","WKDFVXT7N18D7","WKDFVXT7N18D8","WKDFVXT7N18D9","WKDFVXT7N19D1","WKDFVXT7N19D2","WKDFVXT7N19D3", & + "WKDFVXT7N19D4","WKDFVXT7N19D5","WKDFVXT7N19D6","WKDFVXT7N19D7","WKDFVXT7N19D8","WKDFVXT7N19D9","WKDFVXT7N20D1","WKDFVXT7N20D2", & + "WKDFVXT7N20D3","WKDFVXT7N20D4","WKDFVXT7N20D5","WKDFVXT7N20D6","WKDFVXT7N20D7","WKDFVXT7N20D8","WKDFVXT7N20D9","WKDFVXT8N01D1", & + "WKDFVXT8N01D2","WKDFVXT8N01D3","WKDFVXT8N01D4","WKDFVXT8N01D5","WKDFVXT8N01D6","WKDFVXT8N01D7","WKDFVXT8N01D8","WKDFVXT8N01D9", & + "WKDFVXT8N02D1","WKDFVXT8N02D2","WKDFVXT8N02D3","WKDFVXT8N02D4","WKDFVXT8N02D5","WKDFVXT8N02D6","WKDFVXT8N02D7","WKDFVXT8N02D8", & + "WKDFVXT8N02D9","WKDFVXT8N03D1","WKDFVXT8N03D2","WKDFVXT8N03D3","WKDFVXT8N03D4","WKDFVXT8N03D5","WKDFVXT8N03D6","WKDFVXT8N03D7", & + "WKDFVXT8N03D8","WKDFVXT8N03D9","WKDFVXT8N04D1","WKDFVXT8N04D2","WKDFVXT8N04D3","WKDFVXT8N04D4","WKDFVXT8N04D5","WKDFVXT8N04D6", & + "WKDFVXT8N04D7","WKDFVXT8N04D8","WKDFVXT8N04D9","WKDFVXT8N05D1","WKDFVXT8N05D2","WKDFVXT8N05D3","WKDFVXT8N05D4","WKDFVXT8N05D5", & + "WKDFVXT8N05D6","WKDFVXT8N05D7","WKDFVXT8N05D8","WKDFVXT8N05D9","WKDFVXT8N06D1","WKDFVXT8N06D2","WKDFVXT8N06D3","WKDFVXT8N06D4", & + "WKDFVXT8N06D5","WKDFVXT8N06D6","WKDFVXT8N06D7","WKDFVXT8N06D8","WKDFVXT8N06D9","WKDFVXT8N07D1","WKDFVXT8N07D2","WKDFVXT8N07D3", & + "WKDFVXT8N07D4","WKDFVXT8N07D5","WKDFVXT8N07D6","WKDFVXT8N07D7","WKDFVXT8N07D8","WKDFVXT8N07D9","WKDFVXT8N08D1","WKDFVXT8N08D2", & + "WKDFVXT8N08D3","WKDFVXT8N08D4","WKDFVXT8N08D5","WKDFVXT8N08D6","WKDFVXT8N08D7","WKDFVXT8N08D8","WKDFVXT8N08D9","WKDFVXT8N09D1", & + "WKDFVXT8N09D2","WKDFVXT8N09D3","WKDFVXT8N09D4","WKDFVXT8N09D5","WKDFVXT8N09D6","WKDFVXT8N09D7","WKDFVXT8N09D8","WKDFVXT8N09D9", & + "WKDFVXT8N10D1","WKDFVXT8N10D2","WKDFVXT8N10D3","WKDFVXT8N10D4","WKDFVXT8N10D5","WKDFVXT8N10D6","WKDFVXT8N10D7","WKDFVXT8N10D8", & + "WKDFVXT8N10D9","WKDFVXT8N11D1","WKDFVXT8N11D2","WKDFVXT8N11D3","WKDFVXT8N11D4","WKDFVXT8N11D5","WKDFVXT8N11D6","WKDFVXT8N11D7", & + "WKDFVXT8N11D8","WKDFVXT8N11D9","WKDFVXT8N12D1","WKDFVXT8N12D2","WKDFVXT8N12D3","WKDFVXT8N12D4","WKDFVXT8N12D5","WKDFVXT8N12D6", & + "WKDFVXT8N12D7","WKDFVXT8N12D8","WKDFVXT8N12D9","WKDFVXT8N13D1","WKDFVXT8N13D2","WKDFVXT8N13D3","WKDFVXT8N13D4","WKDFVXT8N13D5", & + "WKDFVXT8N13D6","WKDFVXT8N13D7","WKDFVXT8N13D8","WKDFVXT8N13D9","WKDFVXT8N14D1","WKDFVXT8N14D2","WKDFVXT8N14D3","WKDFVXT8N14D4", & + "WKDFVXT8N14D5","WKDFVXT8N14D6","WKDFVXT8N14D7","WKDFVXT8N14D8","WKDFVXT8N14D9","WKDFVXT8N15D1","WKDFVXT8N15D2","WKDFVXT8N15D3", & + "WKDFVXT8N15D4","WKDFVXT8N15D5","WKDFVXT8N15D6","WKDFVXT8N15D7","WKDFVXT8N15D8","WKDFVXT8N15D9","WKDFVXT8N16D1","WKDFVXT8N16D2", & + "WKDFVXT8N16D3","WKDFVXT8N16D4","WKDFVXT8N16D5","WKDFVXT8N16D6","WKDFVXT8N16D7","WKDFVXT8N16D8","WKDFVXT8N16D9","WKDFVXT8N17D1", & + "WKDFVXT8N17D2","WKDFVXT8N17D3","WKDFVXT8N17D4","WKDFVXT8N17D5","WKDFVXT8N17D6","WKDFVXT8N17D7","WKDFVXT8N17D8","WKDFVXT8N17D9", & + "WKDFVXT8N18D1","WKDFVXT8N18D2","WKDFVXT8N18D3","WKDFVXT8N18D4","WKDFVXT8N18D5","WKDFVXT8N18D6","WKDFVXT8N18D7","WKDFVXT8N18D8", & + "WKDFVXT8N18D9","WKDFVXT8N19D1","WKDFVXT8N19D2","WKDFVXT8N19D3","WKDFVXT8N19D4","WKDFVXT8N19D5","WKDFVXT8N19D6","WKDFVXT8N19D7", & + "WKDFVXT8N19D8","WKDFVXT8N19D9","WKDFVXT8N20D1","WKDFVXT8N20D2","WKDFVXT8N20D3","WKDFVXT8N20D4","WKDFVXT8N20D5","WKDFVXT8N20D6", & + "WKDFVXT8N20D7","WKDFVXT8N20D8","WKDFVXT8N20D9","WKDFVXT9N01D1","WKDFVXT9N01D2","WKDFVXT9N01D3","WKDFVXT9N01D4","WKDFVXT9N01D5", & + "WKDFVXT9N01D6","WKDFVXT9N01D7","WKDFVXT9N01D8","WKDFVXT9N01D9","WKDFVXT9N02D1","WKDFVXT9N02D2","WKDFVXT9N02D3","WKDFVXT9N02D4", & + "WKDFVXT9N02D5","WKDFVXT9N02D6","WKDFVXT9N02D7","WKDFVXT9N02D8","WKDFVXT9N02D9","WKDFVXT9N03D1","WKDFVXT9N03D2","WKDFVXT9N03D3", & + "WKDFVXT9N03D4","WKDFVXT9N03D5","WKDFVXT9N03D6","WKDFVXT9N03D7","WKDFVXT9N03D8","WKDFVXT9N03D9","WKDFVXT9N04D1","WKDFVXT9N04D2", & + "WKDFVXT9N04D3","WKDFVXT9N04D4","WKDFVXT9N04D5","WKDFVXT9N04D6","WKDFVXT9N04D7","WKDFVXT9N04D8","WKDFVXT9N04D9","WKDFVXT9N05D1", & + "WKDFVXT9N05D2","WKDFVXT9N05D3","WKDFVXT9N05D4","WKDFVXT9N05D5","WKDFVXT9N05D6","WKDFVXT9N05D7","WKDFVXT9N05D8","WKDFVXT9N05D9", & + "WKDFVXT9N06D1","WKDFVXT9N06D2","WKDFVXT9N06D3","WKDFVXT9N06D4","WKDFVXT9N06D5","WKDFVXT9N06D6","WKDFVXT9N06D7","WKDFVXT9N06D8", & + "WKDFVXT9N06D9","WKDFVXT9N07D1","WKDFVXT9N07D2","WKDFVXT9N07D3","WKDFVXT9N07D4","WKDFVXT9N07D5","WKDFVXT9N07D6","WKDFVXT9N07D7", & + "WKDFVXT9N07D8","WKDFVXT9N07D9","WKDFVXT9N08D1","WKDFVXT9N08D2","WKDFVXT9N08D3","WKDFVXT9N08D4","WKDFVXT9N08D5","WKDFVXT9N08D6", & + "WKDFVXT9N08D7","WKDFVXT9N08D8","WKDFVXT9N08D9","WKDFVXT9N09D1","WKDFVXT9N09D2","WKDFVXT9N09D3","WKDFVXT9N09D4","WKDFVXT9N09D5", & + "WKDFVXT9N09D6","WKDFVXT9N09D7","WKDFVXT9N09D8","WKDFVXT9N09D9","WKDFVXT9N10D1","WKDFVXT9N10D2","WKDFVXT9N10D3","WKDFVXT9N10D4", & + "WKDFVXT9N10D5","WKDFVXT9N10D6","WKDFVXT9N10D7","WKDFVXT9N10D8","WKDFVXT9N10D9","WKDFVXT9N11D1","WKDFVXT9N11D2","WKDFVXT9N11D3", & + "WKDFVXT9N11D4","WKDFVXT9N11D5","WKDFVXT9N11D6","WKDFVXT9N11D7","WKDFVXT9N11D8","WKDFVXT9N11D9","WKDFVXT9N12D1","WKDFVXT9N12D2", & + "WKDFVXT9N12D3","WKDFVXT9N12D4","WKDFVXT9N12D5","WKDFVXT9N12D6","WKDFVXT9N12D7","WKDFVXT9N12D8","WKDFVXT9N12D9","WKDFVXT9N13D1", & + "WKDFVXT9N13D2","WKDFVXT9N13D3","WKDFVXT9N13D4","WKDFVXT9N13D5","WKDFVXT9N13D6","WKDFVXT9N13D7","WKDFVXT9N13D8","WKDFVXT9N13D9", & + "WKDFVXT9N14D1","WKDFVXT9N14D2","WKDFVXT9N14D3","WKDFVXT9N14D4","WKDFVXT9N14D5","WKDFVXT9N14D6","WKDFVXT9N14D7","WKDFVXT9N14D8", & + "WKDFVXT9N14D9","WKDFVXT9N15D1","WKDFVXT9N15D2","WKDFVXT9N15D3","WKDFVXT9N15D4","WKDFVXT9N15D5","WKDFVXT9N15D6","WKDFVXT9N15D7", & + "WKDFVXT9N15D8","WKDFVXT9N15D9","WKDFVXT9N16D1","WKDFVXT9N16D2","WKDFVXT9N16D3","WKDFVXT9N16D4","WKDFVXT9N16D5","WKDFVXT9N16D6", & + "WKDFVXT9N16D7","WKDFVXT9N16D8","WKDFVXT9N16D9","WKDFVXT9N17D1","WKDFVXT9N17D2","WKDFVXT9N17D3","WKDFVXT9N17D4","WKDFVXT9N17D5", & + "WKDFVXT9N17D6","WKDFVXT9N17D7","WKDFVXT9N17D8","WKDFVXT9N17D9","WKDFVXT9N18D1","WKDFVXT9N18D2","WKDFVXT9N18D3","WKDFVXT9N18D4", & + "WKDFVXT9N18D5","WKDFVXT9N18D6","WKDFVXT9N18D7","WKDFVXT9N18D8","WKDFVXT9N18D9","WKDFVXT9N19D1","WKDFVXT9N19D2","WKDFVXT9N19D3", & + "WKDFVXT9N19D4","WKDFVXT9N19D5","WKDFVXT9N19D6","WKDFVXT9N19D7","WKDFVXT9N19D8","WKDFVXT9N19D9","WKDFVXT9N20D1","WKDFVXT9N20D2", & + "WKDFVXT9N20D3","WKDFVXT9N20D4","WKDFVXT9N20D5","WKDFVXT9N20D6","WKDFVXT9N20D7","WKDFVXT9N20D8","WKDFVXT9N20D9","WKDIAMT1D1 ", & + "WKDIAMT1D2 ","WKDIAMT1D3 ","WKDIAMT1D4 ","WKDIAMT1D5 ","WKDIAMT1D6 ","WKDIAMT1D7 ","WKDIAMT1D8 ","WKDIAMT1D9 ", & + "WKDIAMT2D1 ","WKDIAMT2D2 ","WKDIAMT2D3 ","WKDIAMT2D4 ","WKDIAMT2D5 ","WKDIAMT2D6 ","WKDIAMT2D7 ","WKDIAMT2D8 ", & + "WKDIAMT2D9 ","WKDIAMT3D1 ","WKDIAMT3D2 ","WKDIAMT3D3 ","WKDIAMT3D4 ","WKDIAMT3D5 ","WKDIAMT3D6 ","WKDIAMT3D7 ", & + "WKDIAMT3D8 ","WKDIAMT3D9 ","WKDIAMT4D1 ","WKDIAMT4D2 ","WKDIAMT4D3 ","WKDIAMT4D4 ","WKDIAMT4D5 ","WKDIAMT4D6 ", & + "WKDIAMT4D7 ","WKDIAMT4D8 ","WKDIAMT4D9 ","WKDIAMT5D1 ","WKDIAMT5D2 ","WKDIAMT5D3 ","WKDIAMT5D4 ","WKDIAMT5D5 ", & + "WKDIAMT5D6 ","WKDIAMT5D7 ","WKDIAMT5D8 ","WKDIAMT5D9 ","WKDIAMT6D1 ","WKDIAMT6D2 ","WKDIAMT6D3 ","WKDIAMT6D4 ", & + "WKDIAMT6D5 ","WKDIAMT6D6 ","WKDIAMT6D7 ","WKDIAMT6D8 ","WKDIAMT6D9 ","WKDIAMT7D1 ","WKDIAMT7D2 ","WKDIAMT7D3 ", & + "WKDIAMT7D4 ","WKDIAMT7D5 ","WKDIAMT7D6 ","WKDIAMT7D7 ","WKDIAMT7D8 ","WKDIAMT7D9 ","WKDIAMT8D1 ","WKDIAMT8D2 ", & + "WKDIAMT8D3 ","WKDIAMT8D4 ","WKDIAMT8D5 ","WKDIAMT8D6 ","WKDIAMT8D7 ","WKDIAMT8D8 ","WKDIAMT8D9 ","WKDIAMT9D1 ", & + "WKDIAMT9D2 ","WKDIAMT9D3 ","WKDIAMT9D4 ","WKDIAMT9D5 ","WKDIAMT9D6 ","WKDIAMT9D7 ","WKDIAMT9D8 ","WKDIAMT9D9 ", & + "WKPOSXT1D1 ","WKPOSXT1D2 ","WKPOSXT1D3 ","WKPOSXT1D4 ","WKPOSXT1D5 ","WKPOSXT1D6 ","WKPOSXT1D7 ","WKPOSXT1D8 ", & + "WKPOSXT1D9 ","WKPOSXT2D1 ","WKPOSXT2D2 ","WKPOSXT2D3 ","WKPOSXT2D4 ","WKPOSXT2D5 ","WKPOSXT2D6 ","WKPOSXT2D7 ", & + "WKPOSXT2D8 ","WKPOSXT2D9 ","WKPOSXT3D1 ","WKPOSXT3D2 ","WKPOSXT3D3 ","WKPOSXT3D4 ","WKPOSXT3D5 ","WKPOSXT3D6 ", & + "WKPOSXT3D7 ","WKPOSXT3D8 ","WKPOSXT3D9 ","WKPOSXT4D1 ","WKPOSXT4D2 ","WKPOSXT4D3 ","WKPOSXT4D4 ","WKPOSXT4D5 ", & + "WKPOSXT4D6 ","WKPOSXT4D7 ","WKPOSXT4D8 ","WKPOSXT4D9 ","WKPOSXT5D1 ","WKPOSXT5D2 ","WKPOSXT5D3 ","WKPOSXT5D4 ", & + "WKPOSXT5D5 ","WKPOSXT5D6 ","WKPOSXT5D7 ","WKPOSXT5D8 ","WKPOSXT5D9 ","WKPOSXT6D1 ","WKPOSXT6D2 ","WKPOSXT6D3 ", & + "WKPOSXT6D4 ","WKPOSXT6D5 ","WKPOSXT6D6 ","WKPOSXT6D7 ","WKPOSXT6D8 ","WKPOSXT6D9 ","WKPOSXT7D1 ","WKPOSXT7D2 ", & + "WKPOSXT7D3 ","WKPOSXT7D4 ","WKPOSXT7D5 ","WKPOSXT7D6 ","WKPOSXT7D7 ","WKPOSXT7D8 ","WKPOSXT7D9 ","WKPOSXT8D1 ", & + "WKPOSXT8D2 ","WKPOSXT8D3 ","WKPOSXT8D4 ","WKPOSXT8D5 ","WKPOSXT8D6 ","WKPOSXT8D7 ","WKPOSXT8D8 ","WKPOSXT8D9 ", & + "WKPOSXT9D1 ","WKPOSXT9D2 ","WKPOSXT9D3 ","WKPOSXT9D4 ","WKPOSXT9D5 ","WKPOSXT9D6 ","WKPOSXT9D7 ","WKPOSXT9D8 ", & + "WKPOSXT9D9 ","WKPOSYT1D1 ","WKPOSYT1D2 ","WKPOSYT1D3 ","WKPOSYT1D4 ","WKPOSYT1D5 ","WKPOSYT1D6 ","WKPOSYT1D7 ", & + "WKPOSYT1D8 ","WKPOSYT1D9 ","WKPOSYT2D1 ","WKPOSYT2D2 ","WKPOSYT2D3 ","WKPOSYT2D4 ","WKPOSYT2D5 ","WKPOSYT2D6 ", & + "WKPOSYT2D7 ","WKPOSYT2D8 ","WKPOSYT2D9 ","WKPOSYT3D1 ","WKPOSYT3D2 ","WKPOSYT3D3 ","WKPOSYT3D4 ","WKPOSYT3D5 ", & + "WKPOSYT3D6 ","WKPOSYT3D7 ","WKPOSYT3D8 ","WKPOSYT3D9 ","WKPOSYT4D1 ","WKPOSYT4D2 ","WKPOSYT4D3 ","WKPOSYT4D4 ", & + "WKPOSYT4D5 ","WKPOSYT4D6 ","WKPOSYT4D7 ","WKPOSYT4D8 ","WKPOSYT4D9 ","WKPOSYT5D1 ","WKPOSYT5D2 ","WKPOSYT5D3 ", & + "WKPOSYT5D4 ","WKPOSYT5D5 ","WKPOSYT5D6 ","WKPOSYT5D7 ","WKPOSYT5D8 ","WKPOSYT5D9 ","WKPOSYT6D1 ","WKPOSYT6D2 ", & + "WKPOSYT6D3 ","WKPOSYT6D4 ","WKPOSYT6D5 ","WKPOSYT6D6 ","WKPOSYT6D7 ","WKPOSYT6D8 ","WKPOSYT6D9 ","WKPOSYT7D1 ", & + "WKPOSYT7D2 ","WKPOSYT7D3 ","WKPOSYT7D4 ","WKPOSYT7D5 ","WKPOSYT7D6 ","WKPOSYT7D7 ","WKPOSYT7D8 ","WKPOSYT7D9 ", & + "WKPOSYT8D1 ","WKPOSYT8D2 ","WKPOSYT8D3 ","WKPOSYT8D4 ","WKPOSYT8D5 ","WKPOSYT8D6 ","WKPOSYT8D7 ","WKPOSYT8D8 ", & + "WKPOSYT8D9 ","WKPOSYT9D1 ","WKPOSYT9D2 ","WKPOSYT9D3 ","WKPOSYT9D4 ","WKPOSYT9D5 ","WKPOSYT9D6 ","WKPOSYT9D7 ", & + "WKPOSYT9D8 ","WKPOSYT9D9 ","WKPOSZT1D1 ","WKPOSZT1D2 ","WKPOSZT1D3 ","WKPOSZT1D4 ","WKPOSZT1D5 ","WKPOSZT1D6 ", & + "WKPOSZT1D7 ","WKPOSZT1D8 ","WKPOSZT1D9 ","WKPOSZT2D1 ","WKPOSZT2D2 ","WKPOSZT2D3 ","WKPOSZT2D4 ","WKPOSZT2D5 ", & + "WKPOSZT2D6 ","WKPOSZT2D7 ","WKPOSZT2D8 ","WKPOSZT2D9 ","WKPOSZT3D1 ","WKPOSZT3D2 ","WKPOSZT3D3 ","WKPOSZT3D4 ", & + "WKPOSZT3D5 ","WKPOSZT3D6 ","WKPOSZT3D7 ","WKPOSZT3D8 ","WKPOSZT3D9 ","WKPOSZT4D1 ","WKPOSZT4D2 ","WKPOSZT4D3 ", & + "WKPOSZT4D4 ","WKPOSZT4D5 ","WKPOSZT4D6 ","WKPOSZT4D7 ","WKPOSZT4D8 ","WKPOSZT4D9 ","WKPOSZT5D1 ","WKPOSZT5D2 ", & + "WKPOSZT5D3 ","WKPOSZT5D4 ","WKPOSZT5D5 ","WKPOSZT5D6 ","WKPOSZT5D7 ","WKPOSZT5D8 ","WKPOSZT5D9 ","WKPOSZT6D1 ", & + "WKPOSZT6D2 ","WKPOSZT6D3 ","WKPOSZT6D4 ","WKPOSZT6D5 ","WKPOSZT6D6 ","WKPOSZT6D7 ","WKPOSZT6D8 ","WKPOSZT6D9 ", & + "WKPOSZT7D1 ","WKPOSZT7D2 ","WKPOSZT7D3 ","WKPOSZT7D4 ","WKPOSZT7D5 ","WKPOSZT7D6 ","WKPOSZT7D7 ","WKPOSZT7D8 ", & + "WKPOSZT7D9 ","WKPOSZT8D1 ","WKPOSZT8D2 ","WKPOSZT8D3 ","WKPOSZT8D4 ","WKPOSZT8D5 ","WKPOSZT8D6 ","WKPOSZT8D7 ", & + "WKPOSZT8D8 ","WKPOSZT8D9 ","WKPOSZT9D1 ","WKPOSZT9D2 ","WKPOSZT9D3 ","WKPOSZT9D4 ","WKPOSZT9D5 ","WKPOSZT9D6 ", & + "WKPOSZT9D7 ","WKPOSZT9D8 ","WKPOSZT9D9 ","WKVELXT1D1 ","WKVELXT1D2 ","WKVELXT1D3 ","WKVELXT1D4 ","WKVELXT1D5 ", & + "WKVELXT1D6 ","WKVELXT1D7 ","WKVELXT1D8 ","WKVELXT1D9 ","WKVELXT2D1 ","WKVELXT2D2 ","WKVELXT2D3 ","WKVELXT2D4 ", & + "WKVELXT2D5 ","WKVELXT2D6 ","WKVELXT2D7 ","WKVELXT2D8 ","WKVELXT2D9 ","WKVELXT3D1 ","WKVELXT3D2 ","WKVELXT3D3 ", & + "WKVELXT3D4 ","WKVELXT3D5 ","WKVELXT3D6 ","WKVELXT3D7 ","WKVELXT3D8 ","WKVELXT3D9 ","WKVELXT4D1 ","WKVELXT4D2 ", & + "WKVELXT4D3 ","WKVELXT4D4 ","WKVELXT4D5 ","WKVELXT4D6 ","WKVELXT4D7 ","WKVELXT4D8 ","WKVELXT4D9 ","WKVELXT5D1 ", & + "WKVELXT5D2 ","WKVELXT5D3 ","WKVELXT5D4 ","WKVELXT5D5 ","WKVELXT5D6 ","WKVELXT5D7 ","WKVELXT5D8 ","WKVELXT5D9 ", & + "WKVELXT6D1 ","WKVELXT6D2 ","WKVELXT6D3 ","WKVELXT6D4 ","WKVELXT6D5 ","WKVELXT6D6 ","WKVELXT6D7 ","WKVELXT6D8 ", & + "WKVELXT6D9 ","WKVELXT7D1 ","WKVELXT7D2 ","WKVELXT7D3 ","WKVELXT7D4 ","WKVELXT7D5 ","WKVELXT7D6 ","WKVELXT7D7 ", & + "WKVELXT7D8 ","WKVELXT7D9 ","WKVELXT8D1 ","WKVELXT8D2 ","WKVELXT8D3 ","WKVELXT8D4 ","WKVELXT8D5 ","WKVELXT8D6 ", & + "WKVELXT8D7 ","WKVELXT8D8 ","WKVELXT8D9 ","WKVELXT9D1 ","WKVELXT9D2 ","WKVELXT9D3 ","WKVELXT9D4 ","WKVELXT9D5 ", & + "WKVELXT9D6 ","WKVELXT9D7 ","WKVELXT9D8 ","WKVELXT9D9 ","WKVELYT1D1 ","WKVELYT1D2 ","WKVELYT1D3 ","WKVELYT1D4 ", & + "WKVELYT1D5 ","WKVELYT1D6 ","WKVELYT1D7 ","WKVELYT1D8 ","WKVELYT1D9 ","WKVELYT2D1 ","WKVELYT2D2 ","WKVELYT2D3 ", & + "WKVELYT2D4 ","WKVELYT2D5 ","WKVELYT2D6 ","WKVELYT2D7 ","WKVELYT2D8 ","WKVELYT2D9 ","WKVELYT3D1 ","WKVELYT3D2 ", & + "WKVELYT3D3 ","WKVELYT3D4 ","WKVELYT3D5 ","WKVELYT3D6 ","WKVELYT3D7 ","WKVELYT3D8 ","WKVELYT3D9 ","WKVELYT4D1 ", & + "WKVELYT4D2 ","WKVELYT4D3 ","WKVELYT4D4 ","WKVELYT4D5 ","WKVELYT4D6 ","WKVELYT4D7 ","WKVELYT4D8 ","WKVELYT4D9 ", & + "WKVELYT5D1 ","WKVELYT5D2 ","WKVELYT5D3 ","WKVELYT5D4 ","WKVELYT5D5 ","WKVELYT5D6 ","WKVELYT5D7 ","WKVELYT5D8 ", & + "WKVELYT5D9 ","WKVELYT6D1 ","WKVELYT6D2 ","WKVELYT6D3 ","WKVELYT6D4 ","WKVELYT6D5 ","WKVELYT6D6 ","WKVELYT6D7 ", & + "WKVELYT6D8 ","WKVELYT6D9 ","WKVELYT7D1 ","WKVELYT7D2 ","WKVELYT7D3 ","WKVELYT7D4 ","WKVELYT7D5 ","WKVELYT7D6 ", & + "WKVELYT7D7 ","WKVELYT7D8 ","WKVELYT7D9 ","WKVELYT8D1 ","WKVELYT8D2 ","WKVELYT8D3 ","WKVELYT8D4 ","WKVELYT8D5 ", & + "WKVELYT8D6 ","WKVELYT8D7 ","WKVELYT8D8 ","WKVELYT8D9 ","WKVELYT9D1 ","WKVELYT9D2 ","WKVELYT9D3 ","WKVELYT9D4 ", & + "WKVELYT9D5 ","WKVELYT9D6 ","WKVELYT9D7 ","WKVELYT9D8 ","WKVELYT9D9 ","WKVELZT1D1 ","WKVELZT1D2 ","WKVELZT1D3 ", & + "WKVELZT1D4 ","WKVELZT1D5 ","WKVELZT1D6 ","WKVELZT1D7 ","WKVELZT1D8 ","WKVELZT1D9 ","WKVELZT2D1 ","WKVELZT2D2 ", & + "WKVELZT2D3 ","WKVELZT2D4 ","WKVELZT2D5 ","WKVELZT2D6 ","WKVELZT2D7 ","WKVELZT2D8 ","WKVELZT2D9 ","WKVELZT3D1 ", & + "WKVELZT3D2 ","WKVELZT3D3 ","WKVELZT3D4 ","WKVELZT3D5 ","WKVELZT3D6 ","WKVELZT3D7 ","WKVELZT3D8 ","WKVELZT3D9 ", & + "WKVELZT4D1 ","WKVELZT4D2 ","WKVELZT4D3 ","WKVELZT4D4 ","WKVELZT4D5 ","WKVELZT4D6 ","WKVELZT4D7 ","WKVELZT4D8 ", & + "WKVELZT4D9 ","WKVELZT5D1 ","WKVELZT5D2 ","WKVELZT5D3 ","WKVELZT5D4 ","WKVELZT5D5 ","WKVELZT5D6 ","WKVELZT5D7 ", & + "WKVELZT5D8 ","WKVELZT5D9 ","WKVELZT6D1 ","WKVELZT6D2 ","WKVELZT6D3 ","WKVELZT6D4 ","WKVELZT6D5 ","WKVELZT6D6 ", & + "WKVELZT6D7 ","WKVELZT6D8 ","WKVELZT6D9 ","WKVELZT7D1 ","WKVELZT7D2 ","WKVELZT7D3 ","WKVELZT7D4 ","WKVELZT7D5 ", & + "WKVELZT7D6 ","WKVELZT7D7 ","WKVELZT7D8 ","WKVELZT7D9 ","WKVELZT8D1 ","WKVELZT8D2 ","WKVELZT8D3 ","WKVELZT8D4 ", & + "WKVELZT8D5 ","WKVELZT8D6 ","WKVELZT8D7 ","WKVELZT8D8 ","WKVELZT8D9 ","WKVELZT9D1 ","WKVELZT9D2 ","WKVELZT9D3 ", & + "WKVELZT9D4 ","WKVELZT9D5 ","WKVELZT9D6 ","WKVELZT9D7 ","WKVELZT9D8 ","WKVELZT9D9 ","YAWERRT1 ","YAWERRT2 ", & + "YAWERRT3 ","YAWERRT4 ","YAWERRT5 ","YAWERRT6 ","YAWERRT7 ","YAWERRT8 ","YAWERRT9 "/) + ParamIndxAry(1:2040) = (/ & + CtT1N01 , CtT1N02 , CtT1N03 , CtT1N04 , CtT1N05 , CtT1N06 , CtT1N07 , CtT1N08 , & + CtT1N09 , CtT1N10 , CtT1N11 , CtT1N12 , CtT1N13 , CtT1N14 , CtT1N15 , CtT1N16 , & + CtT1N17 , CtT1N18 , CtT1N19 , CtT1N20 , CtT2N01 , CtT2N02 , CtT2N03 , CtT2N04 , & + CtT2N05 , CtT2N06 , CtT2N07 , CtT2N08 , CtT2N09 , CtT2N10 , CtT2N11 , CtT2N12 , & + CtT2N13 , CtT2N14 , CtT2N15 , CtT2N16 , CtT2N17 , CtT2N18 , CtT2N19 , CtT2N20 , & + CtT3N01 , CtT3N02 , CtT3N03 , CtT3N04 , CtT3N05 , CtT3N06 , CtT3N07 , CtT3N08 , & + CtT3N09 , CtT3N10 , CtT3N11 , CtT3N12 , CtT3N13 , CtT3N14 , CtT3N15 , CtT3N16 , & + CtT3N17 , CtT3N18 , CtT3N19 , CtT3N20 , CtT4N01 , CtT4N02 , CtT4N03 , CtT4N04 , & + CtT4N05 , CtT4N06 , CtT4N07 , CtT4N08 , CtT4N09 , CtT4N10 , CtT4N11 , CtT4N12 , & + CtT4N13 , CtT4N14 , CtT4N15 , CtT4N16 , CtT4N17 , CtT4N18 , CtT4N19 , CtT4N20 , & + CtT5N01 , CtT5N02 , CtT5N03 , CtT5N04 , CtT5N05 , CtT5N06 , CtT5N07 , CtT5N08 , & + CtT5N09 , CtT5N10 , CtT5N11 , CtT5N12 , CtT5N13 , CtT5N14 , CtT5N15 , CtT5N16 , & + CtT5N17 , CtT5N18 , CtT5N19 , CtT5N20 , CtT6N01 , CtT6N02 , CtT6N03 , CtT6N04 , & + CtT6N05 , CtT6N06 , CtT6N07 , CtT6N08 , CtT6N09 , CtT6N10 , CtT6N11 , CtT6N12 , & + CtT6N13 , CtT6N14 , CtT6N15 , CtT6N16 , CtT6N17 , CtT6N18 , CtT6N19 , CtT6N20 , & + CtT7N01 , CtT7N02 , CtT7N03 , CtT7N04 , CtT7N05 , CtT7N06 , CtT7N07 , CtT7N08 , & + CtT7N09 , CtT7N10 , CtT7N11 , CtT7N12 , CtT7N13 , CtT7N14 , CtT7N15 , CtT7N16 , & + CtT7N17 , CtT7N18 , CtT7N19 , CtT7N20 , CtT8N01 , CtT8N02 , CtT8N03 , CtT8N04 , & + CtT8N05 , CtT8N06 , CtT8N07 , CtT8N08 , CtT8N09 , CtT8N10 , CtT8N11 , CtT8N12 , & + CtT8N13 , CtT8N14 , CtT8N15 , CtT8N16 , CtT8N17 , CtT8N18 , CtT8N19 , CtT8N20 , & + CtT9N01 , CtT9N02 , CtT9N03 , CtT9N04 , CtT9N05 , CtT9N06 , CtT9N07 , CtT9N08 , & + CtT9N09 , CtT9N10 , CtT9N11 , CtT9N12 , CtT9N13 , CtT9N14 , CtT9N15 , CtT9N16 , & + CtT9N17 , CtT9N18 , CtT9N19 , CtT9N20 , EddAmbT1N01D1 , EddAmbT1N01D2 , EddAmbT1N01D3 , EddAmbT1N01D4 , & + EddAmbT1N01D5 , EddAmbT1N01D6 , EddAmbT1N01D7 , EddAmbT1N01D8 , EddAmbT1N01D9 , EddAmbT1N02D1 , EddAmbT1N02D2 , EddAmbT1N02D3 , & + EddAmbT1N02D4 , EddAmbT1N02D5 , EddAmbT1N02D6 , EddAmbT1N02D7 , EddAmbT1N02D8 , EddAmbT1N02D9 , EddAmbT1N03D1 , EddAmbT1N03D2 , & + EddAmbT1N03D3 , EddAmbT1N03D4 , EddAmbT1N03D5 , EddAmbT1N03D6 , EddAmbT1N03D7 , EddAmbT1N03D8 , EddAmbT1N03D9 , EddAmbT1N04D1 , & + EddAmbT1N04D2 , EddAmbT1N04D3 , EddAmbT1N04D4 , EddAmbT1N04D5 , EddAmbT1N04D6 , EddAmbT1N04D7 , EddAmbT1N04D8 , EddAmbT1N04D9 , & + EddAmbT1N05D1 , EddAmbT1N05D2 , EddAmbT1N05D3 , EddAmbT1N05D4 , EddAmbT1N05D5 , EddAmbT1N05D6 , EddAmbT1N05D7 , EddAmbT1N05D8 , & + EddAmbT1N05D9 , EddAmbT1N06D1 , EddAmbT1N06D2 , EddAmbT1N06D3 , EddAmbT1N06D4 , EddAmbT1N06D5 , EddAmbT1N06D6 , EddAmbT1N06D7 , & + EddAmbT1N06D8 , EddAmbT1N06D9 , EddAmbT1N07D1 , EddAmbT1N07D2 , EddAmbT1N07D3 , EddAmbT1N07D4 , EddAmbT1N07D5 , EddAmbT1N07D6 , & + EddAmbT1N07D7 , EddAmbT1N07D8 , EddAmbT1N07D9 , EddAmbT1N08D1 , EddAmbT1N08D2 , EddAmbT1N08D3 , EddAmbT1N08D4 , EddAmbT1N08D5 , & + EddAmbT1N08D6 , EddAmbT1N08D7 , EddAmbT1N08D8 , EddAmbT1N08D9 , EddAmbT1N09D1 , EddAmbT1N09D2 , EddAmbT1N09D3 , EddAmbT1N09D4 , & + EddAmbT1N09D5 , EddAmbT1N09D6 , EddAmbT1N09D7 , EddAmbT1N09D8 , EddAmbT1N09D9 , EddAmbT1N10D1 , EddAmbT1N10D2 , EddAmbT1N10D3 , & + EddAmbT1N10D4 , EddAmbT1N10D5 , EddAmbT1N10D6 , EddAmbT1N10D7 , EddAmbT1N10D8 , EddAmbT1N10D9 , EddAmbT1N11D1 , EddAmbT1N11D2 , & + EddAmbT1N11D3 , EddAmbT1N11D4 , EddAmbT1N11D5 , EddAmbT1N11D6 , EddAmbT1N11D7 , EddAmbT1N11D8 , EddAmbT1N11D9 , EddAmbT1N12D1 , & + EddAmbT1N12D2 , EddAmbT1N12D3 , EddAmbT1N12D4 , EddAmbT1N12D5 , EddAmbT1N12D6 , EddAmbT1N12D7 , EddAmbT1N12D8 , EddAmbT1N12D9 , & + EddAmbT1N13D1 , EddAmbT1N13D2 , EddAmbT1N13D3 , EddAmbT1N13D4 , EddAmbT1N13D5 , EddAmbT1N13D6 , EddAmbT1N13D7 , EddAmbT1N13D8 , & + EddAmbT1N13D9 , EddAmbT1N14D1 , EddAmbT1N14D2 , EddAmbT1N14D3 , EddAmbT1N14D4 , EddAmbT1N14D5 , EddAmbT1N14D6 , EddAmbT1N14D7 , & + EddAmbT1N14D8 , EddAmbT1N14D9 , EddAmbT1N15D1 , EddAmbT1N15D2 , EddAmbT1N15D3 , EddAmbT1N15D4 , EddAmbT1N15D5 , EddAmbT1N15D6 , & + EddAmbT1N15D7 , EddAmbT1N15D8 , EddAmbT1N15D9 , EddAmbT1N16D1 , EddAmbT1N16D2 , EddAmbT1N16D3 , EddAmbT1N16D4 , EddAmbT1N16D5 , & + EddAmbT1N16D6 , EddAmbT1N16D7 , EddAmbT1N16D8 , EddAmbT1N16D9 , EddAmbT1N17D1 , EddAmbT1N17D2 , EddAmbT1N17D3 , EddAmbT1N17D4 , & + EddAmbT1N17D5 , EddAmbT1N17D6 , EddAmbT1N17D7 , EddAmbT1N17D8 , EddAmbT1N17D9 , EddAmbT1N18D1 , EddAmbT1N18D2 , EddAmbT1N18D3 , & + EddAmbT1N18D4 , EddAmbT1N18D5 , EddAmbT1N18D6 , EddAmbT1N18D7 , EddAmbT1N18D8 , EddAmbT1N18D9 , EddAmbT1N19D1 , EddAmbT1N19D2 , & + EddAmbT1N19D3 , EddAmbT1N19D4 , EddAmbT1N19D5 , EddAmbT1N19D6 , EddAmbT1N19D7 , EddAmbT1N19D8 , EddAmbT1N19D9 , EddAmbT1N20D1 , & + EddAmbT1N20D2 , EddAmbT1N20D3 , EddAmbT1N20D4 , EddAmbT1N20D5 , EddAmbT1N20D6 , EddAmbT1N20D7 , EddAmbT1N20D8 , EddAmbT1N20D9 , & + EddAmbT2N01D1 , EddAmbT2N01D2 , EddAmbT2N01D3 , EddAmbT2N01D4 , EddAmbT2N01D5 , EddAmbT2N01D6 , EddAmbT2N01D7 , EddAmbT2N01D8 , & + EddAmbT2N01D9 , EddAmbT2N02D1 , EddAmbT2N02D2 , EddAmbT2N02D3 , EddAmbT2N02D4 , EddAmbT2N02D5 , EddAmbT2N02D6 , EddAmbT2N02D7 , & + EddAmbT2N02D8 , EddAmbT2N02D9 , EddAmbT2N03D1 , EddAmbT2N03D2 , EddAmbT2N03D3 , EddAmbT2N03D4 , EddAmbT2N03D5 , EddAmbT2N03D6 , & + EddAmbT2N03D7 , EddAmbT2N03D8 , EddAmbT2N03D9 , EddAmbT2N04D1 , EddAmbT2N04D2 , EddAmbT2N04D3 , EddAmbT2N04D4 , EddAmbT2N04D5 , & + EddAmbT2N04D6 , EddAmbT2N04D7 , EddAmbT2N04D8 , EddAmbT2N04D9 , EddAmbT2N05D1 , EddAmbT2N05D2 , EddAmbT2N05D3 , EddAmbT2N05D4 , & + EddAmbT2N05D5 , EddAmbT2N05D6 , EddAmbT2N05D7 , EddAmbT2N05D8 , EddAmbT2N05D9 , EddAmbT2N06D1 , EddAmbT2N06D2 , EddAmbT2N06D3 , & + EddAmbT2N06D4 , EddAmbT2N06D5 , EddAmbT2N06D6 , EddAmbT2N06D7 , EddAmbT2N06D8 , EddAmbT2N06D9 , EddAmbT2N07D1 , EddAmbT2N07D2 , & + EddAmbT2N07D3 , EddAmbT2N07D4 , EddAmbT2N07D5 , EddAmbT2N07D6 , EddAmbT2N07D7 , EddAmbT2N07D8 , EddAmbT2N07D9 , EddAmbT2N08D1 , & + EddAmbT2N08D2 , EddAmbT2N08D3 , EddAmbT2N08D4 , EddAmbT2N08D5 , EddAmbT2N08D6 , EddAmbT2N08D7 , EddAmbT2N08D8 , EddAmbT2N08D9 , & + EddAmbT2N09D1 , EddAmbT2N09D2 , EddAmbT2N09D3 , EddAmbT2N09D4 , EddAmbT2N09D5 , EddAmbT2N09D6 , EddAmbT2N09D7 , EddAmbT2N09D8 , & + EddAmbT2N09D9 , EddAmbT2N10D1 , EddAmbT2N10D2 , EddAmbT2N10D3 , EddAmbT2N10D4 , EddAmbT2N10D5 , EddAmbT2N10D6 , EddAmbT2N10D7 , & + EddAmbT2N10D8 , EddAmbT2N10D9 , EddAmbT2N11D1 , EddAmbT2N11D2 , EddAmbT2N11D3 , EddAmbT2N11D4 , EddAmbT2N11D5 , EddAmbT2N11D6 , & + EddAmbT2N11D7 , EddAmbT2N11D8 , EddAmbT2N11D9 , EddAmbT2N12D1 , EddAmbT2N12D2 , EddAmbT2N12D3 , EddAmbT2N12D4 , EddAmbT2N12D5 , & + EddAmbT2N12D6 , EddAmbT2N12D7 , EddAmbT2N12D8 , EddAmbT2N12D9 , EddAmbT2N13D1 , EddAmbT2N13D2 , EddAmbT2N13D3 , EddAmbT2N13D4 , & + EddAmbT2N13D5 , EddAmbT2N13D6 , EddAmbT2N13D7 , EddAmbT2N13D8 , EddAmbT2N13D9 , EddAmbT2N14D1 , EddAmbT2N14D2 , EddAmbT2N14D3 , & + EddAmbT2N14D4 , EddAmbT2N14D5 , EddAmbT2N14D6 , EddAmbT2N14D7 , EddAmbT2N14D8 , EddAmbT2N14D9 , EddAmbT2N15D1 , EddAmbT2N15D2 , & + EddAmbT2N15D3 , EddAmbT2N15D4 , EddAmbT2N15D5 , EddAmbT2N15D6 , EddAmbT2N15D7 , EddAmbT2N15D8 , EddAmbT2N15D9 , EddAmbT2N16D1 , & + EddAmbT2N16D2 , EddAmbT2N16D3 , EddAmbT2N16D4 , EddAmbT2N16D5 , EddAmbT2N16D6 , EddAmbT2N16D7 , EddAmbT2N16D8 , EddAmbT2N16D9 , & + EddAmbT2N17D1 , EddAmbT2N17D2 , EddAmbT2N17D3 , EddAmbT2N17D4 , EddAmbT2N17D5 , EddAmbT2N17D6 , EddAmbT2N17D7 , EddAmbT2N17D8 , & + EddAmbT2N17D9 , EddAmbT2N18D1 , EddAmbT2N18D2 , EddAmbT2N18D3 , EddAmbT2N18D4 , EddAmbT2N18D5 , EddAmbT2N18D6 , EddAmbT2N18D7 , & + EddAmbT2N18D8 , EddAmbT2N18D9 , EddAmbT2N19D1 , EddAmbT2N19D2 , EddAmbT2N19D3 , EddAmbT2N19D4 , EddAmbT2N19D5 , EddAmbT2N19D6 , & + EddAmbT2N19D7 , EddAmbT2N19D8 , EddAmbT2N19D9 , EddAmbT2N20D1 , EddAmbT2N20D2 , EddAmbT2N20D3 , EddAmbT2N20D4 , EddAmbT2N20D5 , & + EddAmbT2N20D6 , EddAmbT2N20D7 , EddAmbT2N20D8 , EddAmbT2N20D9 , EddAmbT3N01D1 , EddAmbT3N01D2 , EddAmbT3N01D3 , EddAmbT3N01D4 , & + EddAmbT3N01D5 , EddAmbT3N01D6 , EddAmbT3N01D7 , EddAmbT3N01D8 , EddAmbT3N01D9 , EddAmbT3N02D1 , EddAmbT3N02D2 , EddAmbT3N02D3 , & + EddAmbT3N02D4 , EddAmbT3N02D5 , EddAmbT3N02D6 , EddAmbT3N02D7 , EddAmbT3N02D8 , EddAmbT3N02D9 , EddAmbT3N03D1 , EddAmbT3N03D2 , & + EddAmbT3N03D3 , EddAmbT3N03D4 , EddAmbT3N03D5 , EddAmbT3N03D6 , EddAmbT3N03D7 , EddAmbT3N03D8 , EddAmbT3N03D9 , EddAmbT3N04D1 , & + EddAmbT3N04D2 , EddAmbT3N04D3 , EddAmbT3N04D4 , EddAmbT3N04D5 , EddAmbT3N04D6 , EddAmbT3N04D7 , EddAmbT3N04D8 , EddAmbT3N04D9 , & + EddAmbT3N05D1 , EddAmbT3N05D2 , EddAmbT3N05D3 , EddAmbT3N05D4 , EddAmbT3N05D5 , EddAmbT3N05D6 , EddAmbT3N05D7 , EddAmbT3N05D8 , & + EddAmbT3N05D9 , EddAmbT3N06D1 , EddAmbT3N06D2 , EddAmbT3N06D3 , EddAmbT3N06D4 , EddAmbT3N06D5 , EddAmbT3N06D6 , EddAmbT3N06D7 , & + EddAmbT3N06D8 , EddAmbT3N06D9 , EddAmbT3N07D1 , EddAmbT3N07D2 , EddAmbT3N07D3 , EddAmbT3N07D4 , EddAmbT3N07D5 , EddAmbT3N07D6 , & + EddAmbT3N07D7 , EddAmbT3N07D8 , EddAmbT3N07D9 , EddAmbT3N08D1 , EddAmbT3N08D2 , EddAmbT3N08D3 , EddAmbT3N08D4 , EddAmbT3N08D5 , & + EddAmbT3N08D6 , EddAmbT3N08D7 , EddAmbT3N08D8 , EddAmbT3N08D9 , EddAmbT3N09D1 , EddAmbT3N09D2 , EddAmbT3N09D3 , EddAmbT3N09D4 , & + EddAmbT3N09D5 , EddAmbT3N09D6 , EddAmbT3N09D7 , EddAmbT3N09D8 , EddAmbT3N09D9 , EddAmbT3N10D1 , EddAmbT3N10D2 , EddAmbT3N10D3 , & + EddAmbT3N10D4 , EddAmbT3N10D5 , EddAmbT3N10D6 , EddAmbT3N10D7 , EddAmbT3N10D8 , EddAmbT3N10D9 , EddAmbT3N11D1 , EddAmbT3N11D2 , & + EddAmbT3N11D3 , EddAmbT3N11D4 , EddAmbT3N11D5 , EddAmbT3N11D6 , EddAmbT3N11D7 , EddAmbT3N11D8 , EddAmbT3N11D9 , EddAmbT3N12D1 , & + EddAmbT3N12D2 , EddAmbT3N12D3 , EddAmbT3N12D4 , EddAmbT3N12D5 , EddAmbT3N12D6 , EddAmbT3N12D7 , EddAmbT3N12D8 , EddAmbT3N12D9 , & + EddAmbT3N13D1 , EddAmbT3N13D2 , EddAmbT3N13D3 , EddAmbT3N13D4 , EddAmbT3N13D5 , EddAmbT3N13D6 , EddAmbT3N13D7 , EddAmbT3N13D8 , & + EddAmbT3N13D9 , EddAmbT3N14D1 , EddAmbT3N14D2 , EddAmbT3N14D3 , EddAmbT3N14D4 , EddAmbT3N14D5 , EddAmbT3N14D6 , EddAmbT3N14D7 , & + EddAmbT3N14D8 , EddAmbT3N14D9 , EddAmbT3N15D1 , EddAmbT3N15D2 , EddAmbT3N15D3 , EddAmbT3N15D4 , EddAmbT3N15D5 , EddAmbT3N15D6 , & + EddAmbT3N15D7 , EddAmbT3N15D8 , EddAmbT3N15D9 , EddAmbT3N16D1 , EddAmbT3N16D2 , EddAmbT3N16D3 , EddAmbT3N16D4 , EddAmbT3N16D5 , & + EddAmbT3N16D6 , EddAmbT3N16D7 , EddAmbT3N16D8 , EddAmbT3N16D9 , EddAmbT3N17D1 , EddAmbT3N17D2 , EddAmbT3N17D3 , EddAmbT3N17D4 , & + EddAmbT3N17D5 , EddAmbT3N17D6 , EddAmbT3N17D7 , EddAmbT3N17D8 , EddAmbT3N17D9 , EddAmbT3N18D1 , EddAmbT3N18D2 , EddAmbT3N18D3 , & + EddAmbT3N18D4 , EddAmbT3N18D5 , EddAmbT3N18D6 , EddAmbT3N18D7 , EddAmbT3N18D8 , EddAmbT3N18D9 , EddAmbT3N19D1 , EddAmbT3N19D2 , & + EddAmbT3N19D3 , EddAmbT3N19D4 , EddAmbT3N19D5 , EddAmbT3N19D6 , EddAmbT3N19D7 , EddAmbT3N19D8 , EddAmbT3N19D9 , EddAmbT3N20D1 , & + EddAmbT3N20D2 , EddAmbT3N20D3 , EddAmbT3N20D4 , EddAmbT3N20D5 , EddAmbT3N20D6 , EddAmbT3N20D7 , EddAmbT3N20D8 , EddAmbT3N20D9 , & + EddAmbT4N01D1 , EddAmbT4N01D2 , EddAmbT4N01D3 , EddAmbT4N01D4 , EddAmbT4N01D5 , EddAmbT4N01D6 , EddAmbT4N01D7 , EddAmbT4N01D8 , & + EddAmbT4N01D9 , EddAmbT4N02D1 , EddAmbT4N02D2 , EddAmbT4N02D3 , EddAmbT4N02D4 , EddAmbT4N02D5 , EddAmbT4N02D6 , EddAmbT4N02D7 , & + EddAmbT4N02D8 , EddAmbT4N02D9 , EddAmbT4N03D1 , EddAmbT4N03D2 , EddAmbT4N03D3 , EddAmbT4N03D4 , EddAmbT4N03D5 , EddAmbT4N03D6 , & + EddAmbT4N03D7 , EddAmbT4N03D8 , EddAmbT4N03D9 , EddAmbT4N04D1 , EddAmbT4N04D2 , EddAmbT4N04D3 , EddAmbT4N04D4 , EddAmbT4N04D5 , & + EddAmbT4N04D6 , EddAmbT4N04D7 , EddAmbT4N04D8 , EddAmbT4N04D9 , EddAmbT4N05D1 , EddAmbT4N05D2 , EddAmbT4N05D3 , EddAmbT4N05D4 , & + EddAmbT4N05D5 , EddAmbT4N05D6 , EddAmbT4N05D7 , EddAmbT4N05D8 , EddAmbT4N05D9 , EddAmbT4N06D1 , EddAmbT4N06D2 , EddAmbT4N06D3 , & + EddAmbT4N06D4 , EddAmbT4N06D5 , EddAmbT4N06D6 , EddAmbT4N06D7 , EddAmbT4N06D8 , EddAmbT4N06D9 , EddAmbT4N07D1 , EddAmbT4N07D2 , & + EddAmbT4N07D3 , EddAmbT4N07D4 , EddAmbT4N07D5 , EddAmbT4N07D6 , EddAmbT4N07D7 , EddAmbT4N07D8 , EddAmbT4N07D9 , EddAmbT4N08D1 , & + EddAmbT4N08D2 , EddAmbT4N08D3 , EddAmbT4N08D4 , EddAmbT4N08D5 , EddAmbT4N08D6 , EddAmbT4N08D7 , EddAmbT4N08D8 , EddAmbT4N08D9 , & + EddAmbT4N09D1 , EddAmbT4N09D2 , EddAmbT4N09D3 , EddAmbT4N09D4 , EddAmbT4N09D5 , EddAmbT4N09D6 , EddAmbT4N09D7 , EddAmbT4N09D8 , & + EddAmbT4N09D9 , EddAmbT4N10D1 , EddAmbT4N10D2 , EddAmbT4N10D3 , EddAmbT4N10D4 , EddAmbT4N10D5 , EddAmbT4N10D6 , EddAmbT4N10D7 , & + EddAmbT4N10D8 , EddAmbT4N10D9 , EddAmbT4N11D1 , EddAmbT4N11D2 , EddAmbT4N11D3 , EddAmbT4N11D4 , EddAmbT4N11D5 , EddAmbT4N11D6 , & + EddAmbT4N11D7 , EddAmbT4N11D8 , EddAmbT4N11D9 , EddAmbT4N12D1 , EddAmbT4N12D2 , EddAmbT4N12D3 , EddAmbT4N12D4 , EddAmbT4N12D5 , & + EddAmbT4N12D6 , EddAmbT4N12D7 , EddAmbT4N12D8 , EddAmbT4N12D9 , EddAmbT4N13D1 , EddAmbT4N13D2 , EddAmbT4N13D3 , EddAmbT4N13D4 , & + EddAmbT4N13D5 , EddAmbT4N13D6 , EddAmbT4N13D7 , EddAmbT4N13D8 , EddAmbT4N13D9 , EddAmbT4N14D1 , EddAmbT4N14D2 , EddAmbT4N14D3 , & + EddAmbT4N14D4 , EddAmbT4N14D5 , EddAmbT4N14D6 , EddAmbT4N14D7 , EddAmbT4N14D8 , EddAmbT4N14D9 , EddAmbT4N15D1 , EddAmbT4N15D2 , & + EddAmbT4N15D3 , EddAmbT4N15D4 , EddAmbT4N15D5 , EddAmbT4N15D6 , EddAmbT4N15D7 , EddAmbT4N15D8 , EddAmbT4N15D9 , EddAmbT4N16D1 , & + EddAmbT4N16D2 , EddAmbT4N16D3 , EddAmbT4N16D4 , EddAmbT4N16D5 , EddAmbT4N16D6 , EddAmbT4N16D7 , EddAmbT4N16D8 , EddAmbT4N16D9 , & + EddAmbT4N17D1 , EddAmbT4N17D2 , EddAmbT4N17D3 , EddAmbT4N17D4 , EddAmbT4N17D5 , EddAmbT4N17D6 , EddAmbT4N17D7 , EddAmbT4N17D8 , & + EddAmbT4N17D9 , EddAmbT4N18D1 , EddAmbT4N18D2 , EddAmbT4N18D3 , EddAmbT4N18D4 , EddAmbT4N18D5 , EddAmbT4N18D6 , EddAmbT4N18D7 , & + EddAmbT4N18D8 , EddAmbT4N18D9 , EddAmbT4N19D1 , EddAmbT4N19D2 , EddAmbT4N19D3 , EddAmbT4N19D4 , EddAmbT4N19D5 , EddAmbT4N19D6 , & + EddAmbT4N19D7 , EddAmbT4N19D8 , EddAmbT4N19D9 , EddAmbT4N20D1 , EddAmbT4N20D2 , EddAmbT4N20D3 , EddAmbT4N20D4 , EddAmbT4N20D5 , & + EddAmbT4N20D6 , EddAmbT4N20D7 , EddAmbT4N20D8 , EddAmbT4N20D9 , EddAmbT5N01D1 , EddAmbT5N01D2 , EddAmbT5N01D3 , EddAmbT5N01D4 , & + EddAmbT5N01D5 , EddAmbT5N01D6 , EddAmbT5N01D7 , EddAmbT5N01D8 , EddAmbT5N01D9 , EddAmbT5N02D1 , EddAmbT5N02D2 , EddAmbT5N02D3 , & + EddAmbT5N02D4 , EddAmbT5N02D5 , EddAmbT5N02D6 , EddAmbT5N02D7 , EddAmbT5N02D8 , EddAmbT5N02D9 , EddAmbT5N03D1 , EddAmbT5N03D2 , & + EddAmbT5N03D3 , EddAmbT5N03D4 , EddAmbT5N03D5 , EddAmbT5N03D6 , EddAmbT5N03D7 , EddAmbT5N03D8 , EddAmbT5N03D9 , EddAmbT5N04D1 , & + EddAmbT5N04D2 , EddAmbT5N04D3 , EddAmbT5N04D4 , EddAmbT5N04D5 , EddAmbT5N04D6 , EddAmbT5N04D7 , EddAmbT5N04D8 , EddAmbT5N04D9 , & + EddAmbT5N05D1 , EddAmbT5N05D2 , EddAmbT5N05D3 , EddAmbT5N05D4 , EddAmbT5N05D5 , EddAmbT5N05D6 , EddAmbT5N05D7 , EddAmbT5N05D8 , & + EddAmbT5N05D9 , EddAmbT5N06D1 , EddAmbT5N06D2 , EddAmbT5N06D3 , EddAmbT5N06D4 , EddAmbT5N06D5 , EddAmbT5N06D6 , EddAmbT5N06D7 , & + EddAmbT5N06D8 , EddAmbT5N06D9 , EddAmbT5N07D1 , EddAmbT5N07D2 , EddAmbT5N07D3 , EddAmbT5N07D4 , EddAmbT5N07D5 , EddAmbT5N07D6 , & + EddAmbT5N07D7 , EddAmbT5N07D8 , EddAmbT5N07D9 , EddAmbT5N08D1 , EddAmbT5N08D2 , EddAmbT5N08D3 , EddAmbT5N08D4 , EddAmbT5N08D5 , & + EddAmbT5N08D6 , EddAmbT5N08D7 , EddAmbT5N08D8 , EddAmbT5N08D9 , EddAmbT5N09D1 , EddAmbT5N09D2 , EddAmbT5N09D3 , EddAmbT5N09D4 , & + EddAmbT5N09D5 , EddAmbT5N09D6 , EddAmbT5N09D7 , EddAmbT5N09D8 , EddAmbT5N09D9 , EddAmbT5N10D1 , EddAmbT5N10D2 , EddAmbT5N10D3 , & + EddAmbT5N10D4 , EddAmbT5N10D5 , EddAmbT5N10D6 , EddAmbT5N10D7 , EddAmbT5N10D8 , EddAmbT5N10D9 , EddAmbT5N11D1 , EddAmbT5N11D2 , & + EddAmbT5N11D3 , EddAmbT5N11D4 , EddAmbT5N11D5 , EddAmbT5N11D6 , EddAmbT5N11D7 , EddAmbT5N11D8 , EddAmbT5N11D9 , EddAmbT5N12D1 , & + EddAmbT5N12D2 , EddAmbT5N12D3 , EddAmbT5N12D4 , EddAmbT5N12D5 , EddAmbT5N12D6 , EddAmbT5N12D7 , EddAmbT5N12D8 , EddAmbT5N12D9 , & + EddAmbT5N13D1 , EddAmbT5N13D2 , EddAmbT5N13D3 , EddAmbT5N13D4 , EddAmbT5N13D5 , EddAmbT5N13D6 , EddAmbT5N13D7 , EddAmbT5N13D8 , & + EddAmbT5N13D9 , EddAmbT5N14D1 , EddAmbT5N14D2 , EddAmbT5N14D3 , EddAmbT5N14D4 , EddAmbT5N14D5 , EddAmbT5N14D6 , EddAmbT5N14D7 , & + EddAmbT5N14D8 , EddAmbT5N14D9 , EddAmbT5N15D1 , EddAmbT5N15D2 , EddAmbT5N15D3 , EddAmbT5N15D4 , EddAmbT5N15D5 , EddAmbT5N15D6 , & + EddAmbT5N15D7 , EddAmbT5N15D8 , EddAmbT5N15D9 , EddAmbT5N16D1 , EddAmbT5N16D2 , EddAmbT5N16D3 , EddAmbT5N16D4 , EddAmbT5N16D5 , & + EddAmbT5N16D6 , EddAmbT5N16D7 , EddAmbT5N16D8 , EddAmbT5N16D9 , EddAmbT5N17D1 , EddAmbT5N17D2 , EddAmbT5N17D3 , EddAmbT5N17D4 , & + EddAmbT5N17D5 , EddAmbT5N17D6 , EddAmbT5N17D7 , EddAmbT5N17D8 , EddAmbT5N17D9 , EddAmbT5N18D1 , EddAmbT5N18D2 , EddAmbT5N18D3 , & + EddAmbT5N18D4 , EddAmbT5N18D5 , EddAmbT5N18D6 , EddAmbT5N18D7 , EddAmbT5N18D8 , EddAmbT5N18D9 , EddAmbT5N19D1 , EddAmbT5N19D2 , & + EddAmbT5N19D3 , EddAmbT5N19D4 , EddAmbT5N19D5 , EddAmbT5N19D6 , EddAmbT5N19D7 , EddAmbT5N19D8 , EddAmbT5N19D9 , EddAmbT5N20D1 , & + EddAmbT5N20D2 , EddAmbT5N20D3 , EddAmbT5N20D4 , EddAmbT5N20D5 , EddAmbT5N20D6 , EddAmbT5N20D7 , EddAmbT5N20D8 , EddAmbT5N20D9 , & + EddAmbT6N01D1 , EddAmbT6N01D2 , EddAmbT6N01D3 , EddAmbT6N01D4 , EddAmbT6N01D5 , EddAmbT6N01D6 , EddAmbT6N01D7 , EddAmbT6N01D8 , & + EddAmbT6N01D9 , EddAmbT6N02D1 , EddAmbT6N02D2 , EddAmbT6N02D3 , EddAmbT6N02D4 , EddAmbT6N02D5 , EddAmbT6N02D6 , EddAmbT6N02D7 , & + EddAmbT6N02D8 , EddAmbT6N02D9 , EddAmbT6N03D1 , EddAmbT6N03D2 , EddAmbT6N03D3 , EddAmbT6N03D4 , EddAmbT6N03D5 , EddAmbT6N03D6 , & + EddAmbT6N03D7 , EddAmbT6N03D8 , EddAmbT6N03D9 , EddAmbT6N04D1 , EddAmbT6N04D2 , EddAmbT6N04D3 , EddAmbT6N04D4 , EddAmbT6N04D5 , & + EddAmbT6N04D6 , EddAmbT6N04D7 , EddAmbT6N04D8 , EddAmbT6N04D9 , EddAmbT6N05D1 , EddAmbT6N05D2 , EddAmbT6N05D3 , EddAmbT6N05D4 , & + EddAmbT6N05D5 , EddAmbT6N05D6 , EddAmbT6N05D7 , EddAmbT6N05D8 , EddAmbT6N05D9 , EddAmbT6N06D1 , EddAmbT6N06D2 , EddAmbT6N06D3 , & + EddAmbT6N06D4 , EddAmbT6N06D5 , EddAmbT6N06D6 , EddAmbT6N06D7 , EddAmbT6N06D8 , EddAmbT6N06D9 , EddAmbT6N07D1 , EddAmbT6N07D2 , & + EddAmbT6N07D3 , EddAmbT6N07D4 , EddAmbT6N07D5 , EddAmbT6N07D6 , EddAmbT6N07D7 , EddAmbT6N07D8 , EddAmbT6N07D9 , EddAmbT6N08D1 , & + EddAmbT6N08D2 , EddAmbT6N08D3 , EddAmbT6N08D4 , EddAmbT6N08D5 , EddAmbT6N08D6 , EddAmbT6N08D7 , EddAmbT6N08D8 , EddAmbT6N08D9 , & + EddAmbT6N09D1 , EddAmbT6N09D2 , EddAmbT6N09D3 , EddAmbT6N09D4 , EddAmbT6N09D5 , EddAmbT6N09D6 , EddAmbT6N09D7 , EddAmbT6N09D8 , & + EddAmbT6N09D9 , EddAmbT6N10D1 , EddAmbT6N10D2 , EddAmbT6N10D3 , EddAmbT6N10D4 , EddAmbT6N10D5 , EddAmbT6N10D6 , EddAmbT6N10D7 , & + EddAmbT6N10D8 , EddAmbT6N10D9 , EddAmbT6N11D1 , EddAmbT6N11D2 , EddAmbT6N11D3 , EddAmbT6N11D4 , EddAmbT6N11D5 , EddAmbT6N11D6 , & + EddAmbT6N11D7 , EddAmbT6N11D8 , EddAmbT6N11D9 , EddAmbT6N12D1 , EddAmbT6N12D2 , EddAmbT6N12D3 , EddAmbT6N12D4 , EddAmbT6N12D5 , & + EddAmbT6N12D6 , EddAmbT6N12D7 , EddAmbT6N12D8 , EddAmbT6N12D9 , EddAmbT6N13D1 , EddAmbT6N13D2 , EddAmbT6N13D3 , EddAmbT6N13D4 , & + EddAmbT6N13D5 , EddAmbT6N13D6 , EddAmbT6N13D7 , EddAmbT6N13D8 , EddAmbT6N13D9 , EddAmbT6N14D1 , EddAmbT6N14D2 , EddAmbT6N14D3 , & + EddAmbT6N14D4 , EddAmbT6N14D5 , EddAmbT6N14D6 , EddAmbT6N14D7 , EddAmbT6N14D8 , EddAmbT6N14D9 , EddAmbT6N15D1 , EddAmbT6N15D2 , & + EddAmbT6N15D3 , EddAmbT6N15D4 , EddAmbT6N15D5 , EddAmbT6N15D6 , EddAmbT6N15D7 , EddAmbT6N15D8 , EddAmbT6N15D9 , EddAmbT6N16D1 , & + EddAmbT6N16D2 , EddAmbT6N16D3 , EddAmbT6N16D4 , EddAmbT6N16D5 , EddAmbT6N16D6 , EddAmbT6N16D7 , EddAmbT6N16D8 , EddAmbT6N16D9 , & + EddAmbT6N17D1 , EddAmbT6N17D2 , EddAmbT6N17D3 , EddAmbT6N17D4 , EddAmbT6N17D5 , EddAmbT6N17D6 , EddAmbT6N17D7 , EddAmbT6N17D8 , & + EddAmbT6N17D9 , EddAmbT6N18D1 , EddAmbT6N18D2 , EddAmbT6N18D3 , EddAmbT6N18D4 , EddAmbT6N18D5 , EddAmbT6N18D6 , EddAmbT6N18D7 , & + EddAmbT6N18D8 , EddAmbT6N18D9 , EddAmbT6N19D1 , EddAmbT6N19D2 , EddAmbT6N19D3 , EddAmbT6N19D4 , EddAmbT6N19D5 , EddAmbT6N19D6 , & + EddAmbT6N19D7 , EddAmbT6N19D8 , EddAmbT6N19D9 , EddAmbT6N20D1 , EddAmbT6N20D2 , EddAmbT6N20D3 , EddAmbT6N20D4 , EddAmbT6N20D5 , & + EddAmbT6N20D6 , EddAmbT6N20D7 , EddAmbT6N20D8 , EddAmbT6N20D9 , EddAmbT7N01D1 , EddAmbT7N01D2 , EddAmbT7N01D3 , EddAmbT7N01D4 , & + EddAmbT7N01D5 , EddAmbT7N01D6 , EddAmbT7N01D7 , EddAmbT7N01D8 , EddAmbT7N01D9 , EddAmbT7N02D1 , EddAmbT7N02D2 , EddAmbT7N02D3 , & + EddAmbT7N02D4 , EddAmbT7N02D5 , EddAmbT7N02D6 , EddAmbT7N02D7 , EddAmbT7N02D8 , EddAmbT7N02D9 , EddAmbT7N03D1 , EddAmbT7N03D2 , & + EddAmbT7N03D3 , EddAmbT7N03D4 , EddAmbT7N03D5 , EddAmbT7N03D6 , EddAmbT7N03D7 , EddAmbT7N03D8 , EddAmbT7N03D9 , EddAmbT7N04D1 , & + EddAmbT7N04D2 , EddAmbT7N04D3 , EddAmbT7N04D4 , EddAmbT7N04D5 , EddAmbT7N04D6 , EddAmbT7N04D7 , EddAmbT7N04D8 , EddAmbT7N04D9 , & + EddAmbT7N05D1 , EddAmbT7N05D2 , EddAmbT7N05D3 , EddAmbT7N05D4 , EddAmbT7N05D5 , EddAmbT7N05D6 , EddAmbT7N05D7 , EddAmbT7N05D8 , & + EddAmbT7N05D9 , EddAmbT7N06D1 , EddAmbT7N06D2 , EddAmbT7N06D3 , EddAmbT7N06D4 , EddAmbT7N06D5 , EddAmbT7N06D6 , EddAmbT7N06D7 , & + EddAmbT7N06D8 , EddAmbT7N06D9 , EddAmbT7N07D1 , EddAmbT7N07D2 , EddAmbT7N07D3 , EddAmbT7N07D4 , EddAmbT7N07D5 , EddAmbT7N07D6 , & + EddAmbT7N07D7 , EddAmbT7N07D8 , EddAmbT7N07D9 , EddAmbT7N08D1 , EddAmbT7N08D2 , EddAmbT7N08D3 , EddAmbT7N08D4 , EddAmbT7N08D5 , & + EddAmbT7N08D6 , EddAmbT7N08D7 , EddAmbT7N08D8 , EddAmbT7N08D9 , EddAmbT7N09D1 , EddAmbT7N09D2 , EddAmbT7N09D3 , EddAmbT7N09D4 , & + EddAmbT7N09D5 , EddAmbT7N09D6 , EddAmbT7N09D7 , EddAmbT7N09D8 , EddAmbT7N09D9 , EddAmbT7N10D1 , EddAmbT7N10D2 , EddAmbT7N10D3 , & + EddAmbT7N10D4 , EddAmbT7N10D5 , EddAmbT7N10D6 , EddAmbT7N10D7 , EddAmbT7N10D8 , EddAmbT7N10D9 , EddAmbT7N11D1 , EddAmbT7N11D2 , & + EddAmbT7N11D3 , EddAmbT7N11D4 , EddAmbT7N11D5 , EddAmbT7N11D6 , EddAmbT7N11D7 , EddAmbT7N11D8 , EddAmbT7N11D9 , EddAmbT7N12D1 , & + EddAmbT7N12D2 , EddAmbT7N12D3 , EddAmbT7N12D4 , EddAmbT7N12D5 , EddAmbT7N12D6 , EddAmbT7N12D7 , EddAmbT7N12D8 , EddAmbT7N12D9 , & + EddAmbT7N13D1 , EddAmbT7N13D2 , EddAmbT7N13D3 , EddAmbT7N13D4 , EddAmbT7N13D5 , EddAmbT7N13D6 , EddAmbT7N13D7 , EddAmbT7N13D8 , & + EddAmbT7N13D9 , EddAmbT7N14D1 , EddAmbT7N14D2 , EddAmbT7N14D3 , EddAmbT7N14D4 , EddAmbT7N14D5 , EddAmbT7N14D6 , EddAmbT7N14D7 , & + EddAmbT7N14D8 , EddAmbT7N14D9 , EddAmbT7N15D1 , EddAmbT7N15D2 , EddAmbT7N15D3 , EddAmbT7N15D4 , EddAmbT7N15D5 , EddAmbT7N15D6 , & + EddAmbT7N15D7 , EddAmbT7N15D8 , EddAmbT7N15D9 , EddAmbT7N16D1 , EddAmbT7N16D2 , EddAmbT7N16D3 , EddAmbT7N16D4 , EddAmbT7N16D5 , & + EddAmbT7N16D6 , EddAmbT7N16D7 , EddAmbT7N16D8 , EddAmbT7N16D9 , EddAmbT7N17D1 , EddAmbT7N17D2 , EddAmbT7N17D3 , EddAmbT7N17D4 , & + EddAmbT7N17D5 , EddAmbT7N17D6 , EddAmbT7N17D7 , EddAmbT7N17D8 , EddAmbT7N17D9 , EddAmbT7N18D1 , EddAmbT7N18D2 , EddAmbT7N18D3 , & + EddAmbT7N18D4 , EddAmbT7N18D5 , EddAmbT7N18D6 , EddAmbT7N18D7 , EddAmbT7N18D8 , EddAmbT7N18D9 , EddAmbT7N19D1 , EddAmbT7N19D2 , & + EddAmbT7N19D3 , EddAmbT7N19D4 , EddAmbT7N19D5 , EddAmbT7N19D6 , EddAmbT7N19D7 , EddAmbT7N19D8 , EddAmbT7N19D9 , EddAmbT7N20D1 , & + EddAmbT7N20D2 , EddAmbT7N20D3 , EddAmbT7N20D4 , EddAmbT7N20D5 , EddAmbT7N20D6 , EddAmbT7N20D7 , EddAmbT7N20D8 , EddAmbT7N20D9 , & + EddAmbT8N01D1 , EddAmbT8N01D2 , EddAmbT8N01D3 , EddAmbT8N01D4 , EddAmbT8N01D5 , EddAmbT8N01D6 , EddAmbT8N01D7 , EddAmbT8N01D8 , & + EddAmbT8N01D9 , EddAmbT8N02D1 , EddAmbT8N02D2 , EddAmbT8N02D3 , EddAmbT8N02D4 , EddAmbT8N02D5 , EddAmbT8N02D6 , EddAmbT8N02D7 , & + EddAmbT8N02D8 , EddAmbT8N02D9 , EddAmbT8N03D1 , EddAmbT8N03D2 , EddAmbT8N03D3 , EddAmbT8N03D4 , EddAmbT8N03D5 , EddAmbT8N03D6 , & + EddAmbT8N03D7 , EddAmbT8N03D8 , EddAmbT8N03D9 , EddAmbT8N04D1 , EddAmbT8N04D2 , EddAmbT8N04D3 , EddAmbT8N04D4 , EddAmbT8N04D5 , & + EddAmbT8N04D6 , EddAmbT8N04D7 , EddAmbT8N04D8 , EddAmbT8N04D9 , EddAmbT8N05D1 , EddAmbT8N05D2 , EddAmbT8N05D3 , EddAmbT8N05D4 , & + EddAmbT8N05D5 , EddAmbT8N05D6 , EddAmbT8N05D7 , EddAmbT8N05D8 , EddAmbT8N05D9 , EddAmbT8N06D1 , EddAmbT8N06D2 , EddAmbT8N06D3 , & + EddAmbT8N06D4 , EddAmbT8N06D5 , EddAmbT8N06D6 , EddAmbT8N06D7 , EddAmbT8N06D8 , EddAmbT8N06D9 , EddAmbT8N07D1 , EddAmbT8N07D2 , & + EddAmbT8N07D3 , EddAmbT8N07D4 , EddAmbT8N07D5 , EddAmbT8N07D6 , EddAmbT8N07D7 , EddAmbT8N07D8 , EddAmbT8N07D9 , EddAmbT8N08D1 , & + EddAmbT8N08D2 , EddAmbT8N08D3 , EddAmbT8N08D4 , EddAmbT8N08D5 , EddAmbT8N08D6 , EddAmbT8N08D7 , EddAmbT8N08D8 , EddAmbT8N08D9 , & + EddAmbT8N09D1 , EddAmbT8N09D2 , EddAmbT8N09D3 , EddAmbT8N09D4 , EddAmbT8N09D5 , EddAmbT8N09D6 , EddAmbT8N09D7 , EddAmbT8N09D8 , & + EddAmbT8N09D9 , EddAmbT8N10D1 , EddAmbT8N10D2 , EddAmbT8N10D3 , EddAmbT8N10D4 , EddAmbT8N10D5 , EddAmbT8N10D6 , EddAmbT8N10D7 , & + EddAmbT8N10D8 , EddAmbT8N10D9 , EddAmbT8N11D1 , EddAmbT8N11D2 , EddAmbT8N11D3 , EddAmbT8N11D4 , EddAmbT8N11D5 , EddAmbT8N11D6 , & + EddAmbT8N11D7 , EddAmbT8N11D8 , EddAmbT8N11D9 , EddAmbT8N12D1 , EddAmbT8N12D2 , EddAmbT8N12D3 , EddAmbT8N12D4 , EddAmbT8N12D5 , & + EddAmbT8N12D6 , EddAmbT8N12D7 , EddAmbT8N12D8 , EddAmbT8N12D9 , EddAmbT8N13D1 , EddAmbT8N13D2 , EddAmbT8N13D3 , EddAmbT8N13D4 , & + EddAmbT8N13D5 , EddAmbT8N13D6 , EddAmbT8N13D7 , EddAmbT8N13D8 , EddAmbT8N13D9 , EddAmbT8N14D1 , EddAmbT8N14D2 , EddAmbT8N14D3 , & + EddAmbT8N14D4 , EddAmbT8N14D5 , EddAmbT8N14D6 , EddAmbT8N14D7 , EddAmbT8N14D8 , EddAmbT8N14D9 , EddAmbT8N15D1 , EddAmbT8N15D2 , & + EddAmbT8N15D3 , EddAmbT8N15D4 , EddAmbT8N15D5 , EddAmbT8N15D6 , EddAmbT8N15D7 , EddAmbT8N15D8 , EddAmbT8N15D9 , EddAmbT8N16D1 , & + EddAmbT8N16D2 , EddAmbT8N16D3 , EddAmbT8N16D4 , EddAmbT8N16D5 , EddAmbT8N16D6 , EddAmbT8N16D7 , EddAmbT8N16D8 , EddAmbT8N16D9 , & + EddAmbT8N17D1 , EddAmbT8N17D2 , EddAmbT8N17D3 , EddAmbT8N17D4 , EddAmbT8N17D5 , EddAmbT8N17D6 , EddAmbT8N17D7 , EddAmbT8N17D8 , & + EddAmbT8N17D9 , EddAmbT8N18D1 , EddAmbT8N18D2 , EddAmbT8N18D3 , EddAmbT8N18D4 , EddAmbT8N18D5 , EddAmbT8N18D6 , EddAmbT8N18D7 , & + EddAmbT8N18D8 , EddAmbT8N18D9 , EddAmbT8N19D1 , EddAmbT8N19D2 , EddAmbT8N19D3 , EddAmbT8N19D4 , EddAmbT8N19D5 , EddAmbT8N19D6 , & + EddAmbT8N19D7 , EddAmbT8N19D8 , EddAmbT8N19D9 , EddAmbT8N20D1 , EddAmbT8N20D2 , EddAmbT8N20D3 , EddAmbT8N20D4 , EddAmbT8N20D5 , & + EddAmbT8N20D6 , EddAmbT8N20D7 , EddAmbT8N20D8 , EddAmbT8N20D9 , EddAmbT9N01D1 , EddAmbT9N01D2 , EddAmbT9N01D3 , EddAmbT9N01D4 , & + EddAmbT9N01D5 , EddAmbT9N01D6 , EddAmbT9N01D7 , EddAmbT9N01D8 , EddAmbT9N01D9 , EddAmbT9N02D1 , EddAmbT9N02D2 , EddAmbT9N02D3 , & + EddAmbT9N02D4 , EddAmbT9N02D5 , EddAmbT9N02D6 , EddAmbT9N02D7 , EddAmbT9N02D8 , EddAmbT9N02D9 , EddAmbT9N03D1 , EddAmbT9N03D2 , & + EddAmbT9N03D3 , EddAmbT9N03D4 , EddAmbT9N03D5 , EddAmbT9N03D6 , EddAmbT9N03D7 , EddAmbT9N03D8 , EddAmbT9N03D9 , EddAmbT9N04D1 , & + EddAmbT9N04D2 , EddAmbT9N04D3 , EddAmbT9N04D4 , EddAmbT9N04D5 , EddAmbT9N04D6 , EddAmbT9N04D7 , EddAmbT9N04D8 , EddAmbT9N04D9 , & + EddAmbT9N05D1 , EddAmbT9N05D2 , EddAmbT9N05D3 , EddAmbT9N05D4 , EddAmbT9N05D5 , EddAmbT9N05D6 , EddAmbT9N05D7 , EddAmbT9N05D8 , & + EddAmbT9N05D9 , EddAmbT9N06D1 , EddAmbT9N06D2 , EddAmbT9N06D3 , EddAmbT9N06D4 , EddAmbT9N06D5 , EddAmbT9N06D6 , EddAmbT9N06D7 , & + EddAmbT9N06D8 , EddAmbT9N06D9 , EddAmbT9N07D1 , EddAmbT9N07D2 , EddAmbT9N07D3 , EddAmbT9N07D4 , EddAmbT9N07D5 , EddAmbT9N07D6 , & + EddAmbT9N07D7 , EddAmbT9N07D8 , EddAmbT9N07D9 , EddAmbT9N08D1 , EddAmbT9N08D2 , EddAmbT9N08D3 , EddAmbT9N08D4 , EddAmbT9N08D5 , & + EddAmbT9N08D6 , EddAmbT9N08D7 , EddAmbT9N08D8 , EddAmbT9N08D9 , EddAmbT9N09D1 , EddAmbT9N09D2 , EddAmbT9N09D3 , EddAmbT9N09D4 , & + EddAmbT9N09D5 , EddAmbT9N09D6 , EddAmbT9N09D7 , EddAmbT9N09D8 , EddAmbT9N09D9 , EddAmbT9N10D1 , EddAmbT9N10D2 , EddAmbT9N10D3 , & + EddAmbT9N10D4 , EddAmbT9N10D5 , EddAmbT9N10D6 , EddAmbT9N10D7 , EddAmbT9N10D8 , EddAmbT9N10D9 , EddAmbT9N11D1 , EddAmbT9N11D2 , & + EddAmbT9N11D3 , EddAmbT9N11D4 , EddAmbT9N11D5 , EddAmbT9N11D6 , EddAmbT9N11D7 , EddAmbT9N11D8 , EddAmbT9N11D9 , EddAmbT9N12D1 , & + EddAmbT9N12D2 , EddAmbT9N12D3 , EddAmbT9N12D4 , EddAmbT9N12D5 , EddAmbT9N12D6 , EddAmbT9N12D7 , EddAmbT9N12D8 , EddAmbT9N12D9 , & + EddAmbT9N13D1 , EddAmbT9N13D2 , EddAmbT9N13D3 , EddAmbT9N13D4 , EddAmbT9N13D5 , EddAmbT9N13D6 , EddAmbT9N13D7 , EddAmbT9N13D8 , & + EddAmbT9N13D9 , EddAmbT9N14D1 , EddAmbT9N14D2 , EddAmbT9N14D3 , EddAmbT9N14D4 , EddAmbT9N14D5 , EddAmbT9N14D6 , EddAmbT9N14D7 , & + EddAmbT9N14D8 , EddAmbT9N14D9 , EddAmbT9N15D1 , EddAmbT9N15D2 , EddAmbT9N15D3 , EddAmbT9N15D4 , EddAmbT9N15D5 , EddAmbT9N15D6 , & + EddAmbT9N15D7 , EddAmbT9N15D8 , EddAmbT9N15D9 , EddAmbT9N16D1 , EddAmbT9N16D2 , EddAmbT9N16D3 , EddAmbT9N16D4 , EddAmbT9N16D5 , & + EddAmbT9N16D6 , EddAmbT9N16D7 , EddAmbT9N16D8 , EddAmbT9N16D9 , EddAmbT9N17D1 , EddAmbT9N17D2 , EddAmbT9N17D3 , EddAmbT9N17D4 , & + EddAmbT9N17D5 , EddAmbT9N17D6 , EddAmbT9N17D7 , EddAmbT9N17D8 , EddAmbT9N17D9 , EddAmbT9N18D1 , EddAmbT9N18D2 , EddAmbT9N18D3 , & + EddAmbT9N18D4 , EddAmbT9N18D5 , EddAmbT9N18D6 , EddAmbT9N18D7 , EddAmbT9N18D8 , EddAmbT9N18D9 , EddAmbT9N19D1 , EddAmbT9N19D2 , & + EddAmbT9N19D3 , EddAmbT9N19D4 , EddAmbT9N19D5 , EddAmbT9N19D6 , EddAmbT9N19D7 , EddAmbT9N19D8 , EddAmbT9N19D9 , EddAmbT9N20D1 , & + EddAmbT9N20D2 , EddAmbT9N20D3 , EddAmbT9N20D4 , EddAmbT9N20D5 , EddAmbT9N20D6 , EddAmbT9N20D7 , EddAmbT9N20D8 , EddAmbT9N20D9 , & + EddShrT1N01D1 , EddShrT1N01D2 , EddShrT1N01D3 , EddShrT1N01D4 , EddShrT1N01D5 , EddShrT1N01D6 , EddShrT1N01D7 , EddShrT1N01D8 , & + EddShrT1N01D9 , EddShrT1N02D1 , EddShrT1N02D2 , EddShrT1N02D3 , EddShrT1N02D4 , EddShrT1N02D5 , EddShrT1N02D6 , EddShrT1N02D7 , & + EddShrT1N02D8 , EddShrT1N02D9 , EddShrT1N03D1 , EddShrT1N03D2 , EddShrT1N03D3 , EddShrT1N03D4 , EddShrT1N03D5 , EddShrT1N03D6 , & + EddShrT1N03D7 , EddShrT1N03D8 , EddShrT1N03D9 , EddShrT1N04D1 , EddShrT1N04D2 , EddShrT1N04D3 , EddShrT1N04D4 , EddShrT1N04D5 , & + EddShrT1N04D6 , EddShrT1N04D7 , EddShrT1N04D8 , EddShrT1N04D9 , EddShrT1N05D1 , EddShrT1N05D2 , EddShrT1N05D3 , EddShrT1N05D4 , & + EddShrT1N05D5 , EddShrT1N05D6 , EddShrT1N05D7 , EddShrT1N05D8 , EddShrT1N05D9 , EddShrT1N06D1 , EddShrT1N06D2 , EddShrT1N06D3 , & + EddShrT1N06D4 , EddShrT1N06D5 , EddShrT1N06D6 , EddShrT1N06D7 , EddShrT1N06D8 , EddShrT1N06D9 , EddShrT1N07D1 , EddShrT1N07D2 , & + EddShrT1N07D3 , EddShrT1N07D4 , EddShrT1N07D5 , EddShrT1N07D6 , EddShrT1N07D7 , EddShrT1N07D8 , EddShrT1N07D9 , EddShrT1N08D1 , & + EddShrT1N08D2 , EddShrT1N08D3 , EddShrT1N08D4 , EddShrT1N08D5 , EddShrT1N08D6 , EddShrT1N08D7 , EddShrT1N08D8 , EddShrT1N08D9 , & + EddShrT1N09D1 , EddShrT1N09D2 , EddShrT1N09D3 , EddShrT1N09D4 , EddShrT1N09D5 , EddShrT1N09D6 , EddShrT1N09D7 , EddShrT1N09D8 , & + EddShrT1N09D9 , EddShrT1N10D1 , EddShrT1N10D2 , EddShrT1N10D3 , EddShrT1N10D4 , EddShrT1N10D5 , EddShrT1N10D6 , EddShrT1N10D7 , & + EddShrT1N10D8 , EddShrT1N10D9 , EddShrT1N11D1 , EddShrT1N11D2 , EddShrT1N11D3 , EddShrT1N11D4 , EddShrT1N11D5 , EddShrT1N11D6 , & + EddShrT1N11D7 , EddShrT1N11D8 , EddShrT1N11D9 , EddShrT1N12D1 , EddShrT1N12D2 , EddShrT1N12D3 , EddShrT1N12D4 , EddShrT1N12D5 , & + EddShrT1N12D6 , EddShrT1N12D7 , EddShrT1N12D8 , EddShrT1N12D9 , EddShrT1N13D1 , EddShrT1N13D2 , EddShrT1N13D3 , EddShrT1N13D4 , & + EddShrT1N13D5 , EddShrT1N13D6 , EddShrT1N13D7 , EddShrT1N13D8 , EddShrT1N13D9 , EddShrT1N14D1 , EddShrT1N14D2 , EddShrT1N14D3 , & + EddShrT1N14D4 , EddShrT1N14D5 , EddShrT1N14D6 , EddShrT1N14D7 , EddShrT1N14D8 , EddShrT1N14D9 , EddShrT1N15D1 , EddShrT1N15D2 , & + EddShrT1N15D3 , EddShrT1N15D4 , EddShrT1N15D5 , EddShrT1N15D6 , EddShrT1N15D7 , EddShrT1N15D8 , EddShrT1N15D9 , EddShrT1N16D1 , & + EddShrT1N16D2 , EddShrT1N16D3 , EddShrT1N16D4 , EddShrT1N16D5 , EddShrT1N16D6 , EddShrT1N16D7 , EddShrT1N16D8 , EddShrT1N16D9 , & + EddShrT1N17D1 , EddShrT1N17D2 , EddShrT1N17D3 , EddShrT1N17D4 , EddShrT1N17D5 , EddShrT1N17D6 , EddShrT1N17D7 , EddShrT1N17D8 , & + EddShrT1N17D9 , EddShrT1N18D1 , EddShrT1N18D2 , EddShrT1N18D3 , EddShrT1N18D4 , EddShrT1N18D5 , EddShrT1N18D6 , EddShrT1N18D7 , & + EddShrT1N18D8 , EddShrT1N18D9 , EddShrT1N19D1 , EddShrT1N19D2 , EddShrT1N19D3 , EddShrT1N19D4 , EddShrT1N19D5 , EddShrT1N19D6 , & + EddShrT1N19D7 , EddShrT1N19D8 , EddShrT1N19D9 , EddShrT1N20D1 , EddShrT1N20D2 , EddShrT1N20D3 , EddShrT1N20D4 , EddShrT1N20D5 , & + EddShrT1N20D6 , EddShrT1N20D7 , EddShrT1N20D8 , EddShrT1N20D9 , EddShrT2N01D1 , EddShrT2N01D2 , EddShrT2N01D3 , EddShrT2N01D4 , & + EddShrT2N01D5 , EddShrT2N01D6 , EddShrT2N01D7 , EddShrT2N01D8 , EddShrT2N01D9 , EddShrT2N02D1 , EddShrT2N02D2 , EddShrT2N02D3 , & + EddShrT2N02D4 , EddShrT2N02D5 , EddShrT2N02D6 , EddShrT2N02D7 , EddShrT2N02D8 , EddShrT2N02D9 , EddShrT2N03D1 , EddShrT2N03D2 , & + EddShrT2N03D3 , EddShrT2N03D4 , EddShrT2N03D5 , EddShrT2N03D6 , EddShrT2N03D7 , EddShrT2N03D8 , EddShrT2N03D9 , EddShrT2N04D1 , & + EddShrT2N04D2 , EddShrT2N04D3 , EddShrT2N04D4 , EddShrT2N04D5 , EddShrT2N04D6 , EddShrT2N04D7 , EddShrT2N04D8 , EddShrT2N04D9 , & + EddShrT2N05D1 , EddShrT2N05D2 , EddShrT2N05D3 , EddShrT2N05D4 , EddShrT2N05D5 , EddShrT2N05D6 , EddShrT2N05D7 , EddShrT2N05D8 , & + EddShrT2N05D9 , EddShrT2N06D1 , EddShrT2N06D2 , EddShrT2N06D3 , EddShrT2N06D4 , EddShrT2N06D5 , EddShrT2N06D6 , EddShrT2N06D7 , & + EddShrT2N06D8 , EddShrT2N06D9 , EddShrT2N07D1 , EddShrT2N07D2 , EddShrT2N07D3 , EddShrT2N07D4 , EddShrT2N07D5 , EddShrT2N07D6 /) + ParamIndxAry(2041:4080) = (/ & + EddShrT2N07D7 , EddShrT2N07D8 , EddShrT2N07D9 , EddShrT2N08D1 , EddShrT2N08D2 , EddShrT2N08D3 , EddShrT2N08D4 , EddShrT2N08D5 , & + EddShrT2N08D6 , EddShrT2N08D7 , EddShrT2N08D8 , EddShrT2N08D9 , EddShrT2N09D1 , EddShrT2N09D2 , EddShrT2N09D3 , EddShrT2N09D4 , & + EddShrT2N09D5 , EddShrT2N09D6 , EddShrT2N09D7 , EddShrT2N09D8 , EddShrT2N09D9 , EddShrT2N10D1 , EddShrT2N10D2 , EddShrT2N10D3 , & + EddShrT2N10D4 , EddShrT2N10D5 , EddShrT2N10D6 , EddShrT2N10D7 , EddShrT2N10D8 , EddShrT2N10D9 , EddShrT2N11D1 , EddShrT2N11D2 , & + EddShrT2N11D3 , EddShrT2N11D4 , EddShrT2N11D5 , EddShrT2N11D6 , EddShrT2N11D7 , EddShrT2N11D8 , EddShrT2N11D9 , EddShrT2N12D1 , & + EddShrT2N12D2 , EddShrT2N12D3 , EddShrT2N12D4 , EddShrT2N12D5 , EddShrT2N12D6 , EddShrT2N12D7 , EddShrT2N12D8 , EddShrT2N12D9 , & + EddShrT2N13D1 , EddShrT2N13D2 , EddShrT2N13D3 , EddShrT2N13D4 , EddShrT2N13D5 , EddShrT2N13D6 , EddShrT2N13D7 , EddShrT2N13D8 , & + EddShrT2N13D9 , EddShrT2N14D1 , EddShrT2N14D2 , EddShrT2N14D3 , EddShrT2N14D4 , EddShrT2N14D5 , EddShrT2N14D6 , EddShrT2N14D7 , & + EddShrT2N14D8 , EddShrT2N14D9 , EddShrT2N15D1 , EddShrT2N15D2 , EddShrT2N15D3 , EddShrT2N15D4 , EddShrT2N15D5 , EddShrT2N15D6 , & + EddShrT2N15D7 , EddShrT2N15D8 , EddShrT2N15D9 , EddShrT2N16D1 , EddShrT2N16D2 , EddShrT2N16D3 , EddShrT2N16D4 , EddShrT2N16D5 , & + EddShrT2N16D6 , EddShrT2N16D7 , EddShrT2N16D8 , EddShrT2N16D9 , EddShrT2N17D1 , EddShrT2N17D2 , EddShrT2N17D3 , EddShrT2N17D4 , & + EddShrT2N17D5 , EddShrT2N17D6 , EddShrT2N17D7 , EddShrT2N17D8 , EddShrT2N17D9 , EddShrT2N18D1 , EddShrT2N18D2 , EddShrT2N18D3 , & + EddShrT2N18D4 , EddShrT2N18D5 , EddShrT2N18D6 , EddShrT2N18D7 , EddShrT2N18D8 , EddShrT2N18D9 , EddShrT2N19D1 , EddShrT2N19D2 , & + EddShrT2N19D3 , EddShrT2N19D4 , EddShrT2N19D5 , EddShrT2N19D6 , EddShrT2N19D7 , EddShrT2N19D8 , EddShrT2N19D9 , EddShrT2N20D1 , & + EddShrT2N20D2 , EddShrT2N20D3 , EddShrT2N20D4 , EddShrT2N20D5 , EddShrT2N20D6 , EddShrT2N20D7 , EddShrT2N20D8 , EddShrT2N20D9 , & + EddShrT3N01D1 , EddShrT3N01D2 , EddShrT3N01D3 , EddShrT3N01D4 , EddShrT3N01D5 , EddShrT3N01D6 , EddShrT3N01D7 , EddShrT3N01D8 , & + EddShrT3N01D9 , EddShrT3N02D1 , EddShrT3N02D2 , EddShrT3N02D3 , EddShrT3N02D4 , EddShrT3N02D5 , EddShrT3N02D6 , EddShrT3N02D7 , & + EddShrT3N02D8 , EddShrT3N02D9 , EddShrT3N03D1 , EddShrT3N03D2 , EddShrT3N03D3 , EddShrT3N03D4 , EddShrT3N03D5 , EddShrT3N03D6 , & + EddShrT3N03D7 , EddShrT3N03D8 , EddShrT3N03D9 , EddShrT3N04D1 , EddShrT3N04D2 , EddShrT3N04D3 , EddShrT3N04D4 , EddShrT3N04D5 , & + EddShrT3N04D6 , EddShrT3N04D7 , EddShrT3N04D8 , EddShrT3N04D9 , EddShrT3N05D1 , EddShrT3N05D2 , EddShrT3N05D3 , EddShrT3N05D4 , & + EddShrT3N05D5 , EddShrT3N05D6 , EddShrT3N05D7 , EddShrT3N05D8 , EddShrT3N05D9 , EddShrT3N06D1 , EddShrT3N06D2 , EddShrT3N06D3 , & + EddShrT3N06D4 , EddShrT3N06D5 , EddShrT3N06D6 , EddShrT3N06D7 , EddShrT3N06D8 , EddShrT3N06D9 , EddShrT3N07D1 , EddShrT3N07D2 , & + EddShrT3N07D3 , EddShrT3N07D4 , EddShrT3N07D5 , EddShrT3N07D6 , EddShrT3N07D7 , EddShrT3N07D8 , EddShrT3N07D9 , EddShrT3N08D1 , & + EddShrT3N08D2 , EddShrT3N08D3 , EddShrT3N08D4 , EddShrT3N08D5 , EddShrT3N08D6 , EddShrT3N08D7 , EddShrT3N08D8 , EddShrT3N08D9 , & + EddShrT3N09D1 , EddShrT3N09D2 , EddShrT3N09D3 , EddShrT3N09D4 , EddShrT3N09D5 , EddShrT3N09D6 , EddShrT3N09D7 , EddShrT3N09D8 , & + EddShrT3N09D9 , EddShrT3N10D1 , EddShrT3N10D2 , EddShrT3N10D3 , EddShrT3N10D4 , EddShrT3N10D5 , EddShrT3N10D6 , EddShrT3N10D7 , & + EddShrT3N10D8 , EddShrT3N10D9 , EddShrT3N11D1 , EddShrT3N11D2 , EddShrT3N11D3 , EddShrT3N11D4 , EddShrT3N11D5 , EddShrT3N11D6 , & + EddShrT3N11D7 , EddShrT3N11D8 , EddShrT3N11D9 , EddShrT3N12D1 , EddShrT3N12D2 , EddShrT3N12D3 , EddShrT3N12D4 , EddShrT3N12D5 , & + EddShrT3N12D6 , EddShrT3N12D7 , EddShrT3N12D8 , EddShrT3N12D9 , EddShrT3N13D1 , EddShrT3N13D2 , EddShrT3N13D3 , EddShrT3N13D4 , & + EddShrT3N13D5 , EddShrT3N13D6 , EddShrT3N13D7 , EddShrT3N13D8 , EddShrT3N13D9 , EddShrT3N14D1 , EddShrT3N14D2 , EddShrT3N14D3 , & + EddShrT3N14D4 , EddShrT3N14D5 , EddShrT3N14D6 , EddShrT3N14D7 , EddShrT3N14D8 , EddShrT3N14D9 , EddShrT3N15D1 , EddShrT3N15D2 , & + EddShrT3N15D3 , EddShrT3N15D4 , EddShrT3N15D5 , EddShrT3N15D6 , EddShrT3N15D7 , EddShrT3N15D8 , EddShrT3N15D9 , EddShrT3N16D1 , & + EddShrT3N16D2 , EddShrT3N16D3 , EddShrT3N16D4 , EddShrT3N16D5 , EddShrT3N16D6 , EddShrT3N16D7 , EddShrT3N16D8 , EddShrT3N16D9 , & + EddShrT3N17D1 , EddShrT3N17D2 , EddShrT3N17D3 , EddShrT3N17D4 , EddShrT3N17D5 , EddShrT3N17D6 , EddShrT3N17D7 , EddShrT3N17D8 , & + EddShrT3N17D9 , EddShrT3N18D1 , EddShrT3N18D2 , EddShrT3N18D3 , EddShrT3N18D4 , EddShrT3N18D5 , EddShrT3N18D6 , EddShrT3N18D7 , & + EddShrT3N18D8 , EddShrT3N18D9 , EddShrT3N19D1 , EddShrT3N19D2 , EddShrT3N19D3 , EddShrT3N19D4 , EddShrT3N19D5 , EddShrT3N19D6 , & + EddShrT3N19D7 , EddShrT3N19D8 , EddShrT3N19D9 , EddShrT3N20D1 , EddShrT3N20D2 , EddShrT3N20D3 , EddShrT3N20D4 , EddShrT3N20D5 , & + EddShrT3N20D6 , EddShrT3N20D7 , EddShrT3N20D8 , EddShrT3N20D9 , EddShrT4N01D1 , EddShrT4N01D2 , EddShrT4N01D3 , EddShrT4N01D4 , & + EddShrT4N01D5 , EddShrT4N01D6 , EddShrT4N01D7 , EddShrT4N01D8 , EddShrT4N01D9 , EddShrT4N02D1 , EddShrT4N02D2 , EddShrT4N02D3 , & + EddShrT4N02D4 , EddShrT4N02D5 , EddShrT4N02D6 , EddShrT4N02D7 , EddShrT4N02D8 , EddShrT4N02D9 , EddShrT4N03D1 , EddShrT4N03D2 , & + EddShrT4N03D3 , EddShrT4N03D4 , EddShrT4N03D5 , EddShrT4N03D6 , EddShrT4N03D7 , EddShrT4N03D8 , EddShrT4N03D9 , EddShrT4N04D1 , & + EddShrT4N04D2 , EddShrT4N04D3 , EddShrT4N04D4 , EddShrT4N04D5 , EddShrT4N04D6 , EddShrT4N04D7 , EddShrT4N04D8 , EddShrT4N04D9 , & + EddShrT4N05D1 , EddShrT4N05D2 , EddShrT4N05D3 , EddShrT4N05D4 , EddShrT4N05D5 , EddShrT4N05D6 , EddShrT4N05D7 , EddShrT4N05D8 , & + EddShrT4N05D9 , EddShrT4N06D1 , EddShrT4N06D2 , EddShrT4N06D3 , EddShrT4N06D4 , EddShrT4N06D5 , EddShrT4N06D6 , EddShrT4N06D7 , & + EddShrT4N06D8 , EddShrT4N06D9 , EddShrT4N07D1 , EddShrT4N07D2 , EddShrT4N07D3 , EddShrT4N07D4 , EddShrT4N07D5 , EddShrT4N07D6 , & + EddShrT4N07D7 , EddShrT4N07D8 , EddShrT4N07D9 , EddShrT4N08D1 , EddShrT4N08D2 , EddShrT4N08D3 , EddShrT4N08D4 , EddShrT4N08D5 , & + EddShrT4N08D6 , EddShrT4N08D7 , EddShrT4N08D8 , EddShrT4N08D9 , EddShrT4N09D1 , EddShrT4N09D2 , EddShrT4N09D3 , EddShrT4N09D4 , & + EddShrT4N09D5 , EddShrT4N09D6 , EddShrT4N09D7 , EddShrT4N09D8 , EddShrT4N09D9 , EddShrT4N10D1 , EddShrT4N10D2 , EddShrT4N10D3 , & + EddShrT4N10D4 , EddShrT4N10D5 , EddShrT4N10D6 , EddShrT4N10D7 , EddShrT4N10D8 , EddShrT4N10D9 , EddShrT4N11D1 , EddShrT4N11D2 , & + EddShrT4N11D3 , EddShrT4N11D4 , EddShrT4N11D5 , EddShrT4N11D6 , EddShrT4N11D7 , EddShrT4N11D8 , EddShrT4N11D9 , EddShrT4N12D1 , & + EddShrT4N12D2 , EddShrT4N12D3 , EddShrT4N12D4 , EddShrT4N12D5 , EddShrT4N12D6 , EddShrT4N12D7 , EddShrT4N12D8 , EddShrT4N12D9 , & + EddShrT4N13D1 , EddShrT4N13D2 , EddShrT4N13D3 , EddShrT4N13D4 , EddShrT4N13D5 , EddShrT4N13D6 , EddShrT4N13D7 , EddShrT4N13D8 , & + EddShrT4N13D9 , EddShrT4N14D1 , EddShrT4N14D2 , EddShrT4N14D3 , EddShrT4N14D4 , EddShrT4N14D5 , EddShrT4N14D6 , EddShrT4N14D7 , & + EddShrT4N14D8 , EddShrT4N14D9 , EddShrT4N15D1 , EddShrT4N15D2 , EddShrT4N15D3 , EddShrT4N15D4 , EddShrT4N15D5 , EddShrT4N15D6 , & + EddShrT4N15D7 , EddShrT4N15D8 , EddShrT4N15D9 , EddShrT4N16D1 , EddShrT4N16D2 , EddShrT4N16D3 , EddShrT4N16D4 , EddShrT4N16D5 , & + EddShrT4N16D6 , EddShrT4N16D7 , EddShrT4N16D8 , EddShrT4N16D9 , EddShrT4N17D1 , EddShrT4N17D2 , EddShrT4N17D3 , EddShrT4N17D4 , & + EddShrT4N17D5 , EddShrT4N17D6 , EddShrT4N17D7 , EddShrT4N17D8 , EddShrT4N17D9 , EddShrT4N18D1 , EddShrT4N18D2 , EddShrT4N18D3 , & + EddShrT4N18D4 , EddShrT4N18D5 , EddShrT4N18D6 , EddShrT4N18D7 , EddShrT4N18D8 , EddShrT4N18D9 , EddShrT4N19D1 , EddShrT4N19D2 , & + EddShrT4N19D3 , EddShrT4N19D4 , EddShrT4N19D5 , EddShrT4N19D6 , EddShrT4N19D7 , EddShrT4N19D8 , EddShrT4N19D9 , EddShrT4N20D1 , & + EddShrT4N20D2 , EddShrT4N20D3 , EddShrT4N20D4 , EddShrT4N20D5 , EddShrT4N20D6 , EddShrT4N20D7 , EddShrT4N20D8 , EddShrT4N20D9 , & + EddShrT5N01D1 , EddShrT5N01D2 , EddShrT5N01D3 , EddShrT5N01D4 , EddShrT5N01D5 , EddShrT5N01D6 , EddShrT5N01D7 , EddShrT5N01D8 , & + EddShrT5N01D9 , EddShrT5N02D1 , EddShrT5N02D2 , EddShrT5N02D3 , EddShrT5N02D4 , EddShrT5N02D5 , EddShrT5N02D6 , EddShrT5N02D7 , & + EddShrT5N02D8 , EddShrT5N02D9 , EddShrT5N03D1 , EddShrT5N03D2 , EddShrT5N03D3 , EddShrT5N03D4 , EddShrT5N03D5 , EddShrT5N03D6 , & + EddShrT5N03D7 , EddShrT5N03D8 , EddShrT5N03D9 , EddShrT5N04D1 , EddShrT5N04D2 , EddShrT5N04D3 , EddShrT5N04D4 , EddShrT5N04D5 , & + EddShrT5N04D6 , EddShrT5N04D7 , EddShrT5N04D8 , EddShrT5N04D9 , EddShrT5N05D1 , EddShrT5N05D2 , EddShrT5N05D3 , EddShrT5N05D4 , & + EddShrT5N05D5 , EddShrT5N05D6 , EddShrT5N05D7 , EddShrT5N05D8 , EddShrT5N05D9 , EddShrT5N06D1 , EddShrT5N06D2 , EddShrT5N06D3 , & + EddShrT5N06D4 , EddShrT5N06D5 , EddShrT5N06D6 , EddShrT5N06D7 , EddShrT5N06D8 , EddShrT5N06D9 , EddShrT5N07D1 , EddShrT5N07D2 , & + EddShrT5N07D3 , EddShrT5N07D4 , EddShrT5N07D5 , EddShrT5N07D6 , EddShrT5N07D7 , EddShrT5N07D8 , EddShrT5N07D9 , EddShrT5N08D1 , & + EddShrT5N08D2 , EddShrT5N08D3 , EddShrT5N08D4 , EddShrT5N08D5 , EddShrT5N08D6 , EddShrT5N08D7 , EddShrT5N08D8 , EddShrT5N08D9 , & + EddShrT5N09D1 , EddShrT5N09D2 , EddShrT5N09D3 , EddShrT5N09D4 , EddShrT5N09D5 , EddShrT5N09D6 , EddShrT5N09D7 , EddShrT5N09D8 , & + EddShrT5N09D9 , EddShrT5N10D1 , EddShrT5N10D2 , EddShrT5N10D3 , EddShrT5N10D4 , EddShrT5N10D5 , EddShrT5N10D6 , EddShrT5N10D7 , & + EddShrT5N10D8 , EddShrT5N10D9 , EddShrT5N11D1 , EddShrT5N11D2 , EddShrT5N11D3 , EddShrT5N11D4 , EddShrT5N11D5 , EddShrT5N11D6 , & + EddShrT5N11D7 , EddShrT5N11D8 , EddShrT5N11D9 , EddShrT5N12D1 , EddShrT5N12D2 , EddShrT5N12D3 , EddShrT5N12D4 , EddShrT5N12D5 , & + EddShrT5N12D6 , EddShrT5N12D7 , EddShrT5N12D8 , EddShrT5N12D9 , EddShrT5N13D1 , EddShrT5N13D2 , EddShrT5N13D3 , EddShrT5N13D4 , & + EddShrT5N13D5 , EddShrT5N13D6 , EddShrT5N13D7 , EddShrT5N13D8 , EddShrT5N13D9 , EddShrT5N14D1 , EddShrT5N14D2 , EddShrT5N14D3 , & + EddShrT5N14D4 , EddShrT5N14D5 , EddShrT5N14D6 , EddShrT5N14D7 , EddShrT5N14D8 , EddShrT5N14D9 , EddShrT5N15D1 , EddShrT5N15D2 , & + EddShrT5N15D3 , EddShrT5N15D4 , EddShrT5N15D5 , EddShrT5N15D6 , EddShrT5N15D7 , EddShrT5N15D8 , EddShrT5N15D9 , EddShrT5N16D1 , & + EddShrT5N16D2 , EddShrT5N16D3 , EddShrT5N16D4 , EddShrT5N16D5 , EddShrT5N16D6 , EddShrT5N16D7 , EddShrT5N16D8 , EddShrT5N16D9 , & + EddShrT5N17D1 , EddShrT5N17D2 , EddShrT5N17D3 , EddShrT5N17D4 , EddShrT5N17D5 , EddShrT5N17D6 , EddShrT5N17D7 , EddShrT5N17D8 , & + EddShrT5N17D9 , EddShrT5N18D1 , EddShrT5N18D2 , EddShrT5N18D3 , EddShrT5N18D4 , EddShrT5N18D5 , EddShrT5N18D6 , EddShrT5N18D7 , & + EddShrT5N18D8 , EddShrT5N18D9 , EddShrT5N19D1 , EddShrT5N19D2 , EddShrT5N19D3 , EddShrT5N19D4 , EddShrT5N19D5 , EddShrT5N19D6 , & + EddShrT5N19D7 , EddShrT5N19D8 , EddShrT5N19D9 , EddShrT5N20D1 , EddShrT5N20D2 , EddShrT5N20D3 , EddShrT5N20D4 , EddShrT5N20D5 , & + EddShrT5N20D6 , EddShrT5N20D7 , EddShrT5N20D8 , EddShrT5N20D9 , EddShrT6N01D1 , EddShrT6N01D2 , EddShrT6N01D3 , EddShrT6N01D4 , & + EddShrT6N01D5 , EddShrT6N01D6 , EddShrT6N01D7 , EddShrT6N01D8 , EddShrT6N01D9 , EddShrT6N02D1 , EddShrT6N02D2 , EddShrT6N02D3 , & + EddShrT6N02D4 , EddShrT6N02D5 , EddShrT6N02D6 , EddShrT6N02D7 , EddShrT6N02D8 , EddShrT6N02D9 , EddShrT6N03D1 , EddShrT6N03D2 , & + EddShrT6N03D3 , EddShrT6N03D4 , EddShrT6N03D5 , EddShrT6N03D6 , EddShrT6N03D7 , EddShrT6N03D8 , EddShrT6N03D9 , EddShrT6N04D1 , & + EddShrT6N04D2 , EddShrT6N04D3 , EddShrT6N04D4 , EddShrT6N04D5 , EddShrT6N04D6 , EddShrT6N04D7 , EddShrT6N04D8 , EddShrT6N04D9 , & + EddShrT6N05D1 , EddShrT6N05D2 , EddShrT6N05D3 , EddShrT6N05D4 , EddShrT6N05D5 , EddShrT6N05D6 , EddShrT6N05D7 , EddShrT6N05D8 , & + EddShrT6N05D9 , EddShrT6N06D1 , EddShrT6N06D2 , EddShrT6N06D3 , EddShrT6N06D4 , EddShrT6N06D5 , EddShrT6N06D6 , EddShrT6N06D7 , & + EddShrT6N06D8 , EddShrT6N06D9 , EddShrT6N07D1 , EddShrT6N07D2 , EddShrT6N07D3 , EddShrT6N07D4 , EddShrT6N07D5 , EddShrT6N07D6 , & + EddShrT6N07D7 , EddShrT6N07D8 , EddShrT6N07D9 , EddShrT6N08D1 , EddShrT6N08D2 , EddShrT6N08D3 , EddShrT6N08D4 , EddShrT6N08D5 , & + EddShrT6N08D6 , EddShrT6N08D7 , EddShrT6N08D8 , EddShrT6N08D9 , EddShrT6N09D1 , EddShrT6N09D2 , EddShrT6N09D3 , EddShrT6N09D4 , & + EddShrT6N09D5 , EddShrT6N09D6 , EddShrT6N09D7 , EddShrT6N09D8 , EddShrT6N09D9 , EddShrT6N10D1 , EddShrT6N10D2 , EddShrT6N10D3 , & + EddShrT6N10D4 , EddShrT6N10D5 , EddShrT6N10D6 , EddShrT6N10D7 , EddShrT6N10D8 , EddShrT6N10D9 , EddShrT6N11D1 , EddShrT6N11D2 , & + EddShrT6N11D3 , EddShrT6N11D4 , EddShrT6N11D5 , EddShrT6N11D6 , EddShrT6N11D7 , EddShrT6N11D8 , EddShrT6N11D9 , EddShrT6N12D1 , & + EddShrT6N12D2 , EddShrT6N12D3 , EddShrT6N12D4 , EddShrT6N12D5 , EddShrT6N12D6 , EddShrT6N12D7 , EddShrT6N12D8 , EddShrT6N12D9 , & + EddShrT6N13D1 , EddShrT6N13D2 , EddShrT6N13D3 , EddShrT6N13D4 , EddShrT6N13D5 , EddShrT6N13D6 , EddShrT6N13D7 , EddShrT6N13D8 , & + EddShrT6N13D9 , EddShrT6N14D1 , EddShrT6N14D2 , EddShrT6N14D3 , EddShrT6N14D4 , EddShrT6N14D5 , EddShrT6N14D6 , EddShrT6N14D7 , & + EddShrT6N14D8 , EddShrT6N14D9 , EddShrT6N15D1 , EddShrT6N15D2 , EddShrT6N15D3 , EddShrT6N15D4 , EddShrT6N15D5 , EddShrT6N15D6 , & + EddShrT6N15D7 , EddShrT6N15D8 , EddShrT6N15D9 , EddShrT6N16D1 , EddShrT6N16D2 , EddShrT6N16D3 , EddShrT6N16D4 , EddShrT6N16D5 , & + EddShrT6N16D6 , EddShrT6N16D7 , EddShrT6N16D8 , EddShrT6N16D9 , EddShrT6N17D1 , EddShrT6N17D2 , EddShrT6N17D3 , EddShrT6N17D4 , & + EddShrT6N17D5 , EddShrT6N17D6 , EddShrT6N17D7 , EddShrT6N17D8 , EddShrT6N17D9 , EddShrT6N18D1 , EddShrT6N18D2 , EddShrT6N18D3 , & + EddShrT6N18D4 , EddShrT6N18D5 , EddShrT6N18D6 , EddShrT6N18D7 , EddShrT6N18D8 , EddShrT6N18D9 , EddShrT6N19D1 , EddShrT6N19D2 , & + EddShrT6N19D3 , EddShrT6N19D4 , EddShrT6N19D5 , EddShrT6N19D6 , EddShrT6N19D7 , EddShrT6N19D8 , EddShrT6N19D9 , EddShrT6N20D1 , & + EddShrT6N20D2 , EddShrT6N20D3 , EddShrT6N20D4 , EddShrT6N20D5 , EddShrT6N20D6 , EddShrT6N20D7 , EddShrT6N20D8 , EddShrT6N20D9 , & + EddShrT7N01D1 , EddShrT7N01D2 , EddShrT7N01D3 , EddShrT7N01D4 , EddShrT7N01D5 , EddShrT7N01D6 , EddShrT7N01D7 , EddShrT7N01D8 , & + EddShrT7N01D9 , EddShrT7N02D1 , EddShrT7N02D2 , EddShrT7N02D3 , EddShrT7N02D4 , EddShrT7N02D5 , EddShrT7N02D6 , EddShrT7N02D7 , & + EddShrT7N02D8 , EddShrT7N02D9 , EddShrT7N03D1 , EddShrT7N03D2 , EddShrT7N03D3 , EddShrT7N03D4 , EddShrT7N03D5 , EddShrT7N03D6 , & + EddShrT7N03D7 , EddShrT7N03D8 , EddShrT7N03D9 , EddShrT7N04D1 , EddShrT7N04D2 , EddShrT7N04D3 , EddShrT7N04D4 , EddShrT7N04D5 , & + EddShrT7N04D6 , EddShrT7N04D7 , EddShrT7N04D8 , EddShrT7N04D9 , EddShrT7N05D1 , EddShrT7N05D2 , EddShrT7N05D3 , EddShrT7N05D4 , & + EddShrT7N05D5 , EddShrT7N05D6 , EddShrT7N05D7 , EddShrT7N05D8 , EddShrT7N05D9 , EddShrT7N06D1 , EddShrT7N06D2 , EddShrT7N06D3 , & + EddShrT7N06D4 , EddShrT7N06D5 , EddShrT7N06D6 , EddShrT7N06D7 , EddShrT7N06D8 , EddShrT7N06D9 , EddShrT7N07D1 , EddShrT7N07D2 , & + EddShrT7N07D3 , EddShrT7N07D4 , EddShrT7N07D5 , EddShrT7N07D6 , EddShrT7N07D7 , EddShrT7N07D8 , EddShrT7N07D9 , EddShrT7N08D1 , & + EddShrT7N08D2 , EddShrT7N08D3 , EddShrT7N08D4 , EddShrT7N08D5 , EddShrT7N08D6 , EddShrT7N08D7 , EddShrT7N08D8 , EddShrT7N08D9 , & + EddShrT7N09D1 , EddShrT7N09D2 , EddShrT7N09D3 , EddShrT7N09D4 , EddShrT7N09D5 , EddShrT7N09D6 , EddShrT7N09D7 , EddShrT7N09D8 , & + EddShrT7N09D9 , EddShrT7N10D1 , EddShrT7N10D2 , EddShrT7N10D3 , EddShrT7N10D4 , EddShrT7N10D5 , EddShrT7N10D6 , EddShrT7N10D7 , & + EddShrT7N10D8 , EddShrT7N10D9 , EddShrT7N11D1 , EddShrT7N11D2 , EddShrT7N11D3 , EddShrT7N11D4 , EddShrT7N11D5 , EddShrT7N11D6 , & + EddShrT7N11D7 , EddShrT7N11D8 , EddShrT7N11D9 , EddShrT7N12D1 , EddShrT7N12D2 , EddShrT7N12D3 , EddShrT7N12D4 , EddShrT7N12D5 , & + EddShrT7N12D6 , EddShrT7N12D7 , EddShrT7N12D8 , EddShrT7N12D9 , EddShrT7N13D1 , EddShrT7N13D2 , EddShrT7N13D3 , EddShrT7N13D4 , & + EddShrT7N13D5 , EddShrT7N13D6 , EddShrT7N13D7 , EddShrT7N13D8 , EddShrT7N13D9 , EddShrT7N14D1 , EddShrT7N14D2 , EddShrT7N14D3 , & + EddShrT7N14D4 , EddShrT7N14D5 , EddShrT7N14D6 , EddShrT7N14D7 , EddShrT7N14D8 , EddShrT7N14D9 , EddShrT7N15D1 , EddShrT7N15D2 , & + EddShrT7N15D3 , EddShrT7N15D4 , EddShrT7N15D5 , EddShrT7N15D6 , EddShrT7N15D7 , EddShrT7N15D8 , EddShrT7N15D9 , EddShrT7N16D1 , & + EddShrT7N16D2 , EddShrT7N16D3 , EddShrT7N16D4 , EddShrT7N16D5 , EddShrT7N16D6 , EddShrT7N16D7 , EddShrT7N16D8 , EddShrT7N16D9 , & + EddShrT7N17D1 , EddShrT7N17D2 , EddShrT7N17D3 , EddShrT7N17D4 , EddShrT7N17D5 , EddShrT7N17D6 , EddShrT7N17D7 , EddShrT7N17D8 , & + EddShrT7N17D9 , EddShrT7N18D1 , EddShrT7N18D2 , EddShrT7N18D3 , EddShrT7N18D4 , EddShrT7N18D5 , EddShrT7N18D6 , EddShrT7N18D7 , & + EddShrT7N18D8 , EddShrT7N18D9 , EddShrT7N19D1 , EddShrT7N19D2 , EddShrT7N19D3 , EddShrT7N19D4 , EddShrT7N19D5 , EddShrT7N19D6 , & + EddShrT7N19D7 , EddShrT7N19D8 , EddShrT7N19D9 , EddShrT7N20D1 , EddShrT7N20D2 , EddShrT7N20D3 , EddShrT7N20D4 , EddShrT7N20D5 , & + EddShrT7N20D6 , EddShrT7N20D7 , EddShrT7N20D8 , EddShrT7N20D9 , EddShrT8N01D1 , EddShrT8N01D2 , EddShrT8N01D3 , EddShrT8N01D4 , & + EddShrT8N01D5 , EddShrT8N01D6 , EddShrT8N01D7 , EddShrT8N01D8 , EddShrT8N01D9 , EddShrT8N02D1 , EddShrT8N02D2 , EddShrT8N02D3 , & + EddShrT8N02D4 , EddShrT8N02D5 , EddShrT8N02D6 , EddShrT8N02D7 , EddShrT8N02D8 , EddShrT8N02D9 , EddShrT8N03D1 , EddShrT8N03D2 , & + EddShrT8N03D3 , EddShrT8N03D4 , EddShrT8N03D5 , EddShrT8N03D6 , EddShrT8N03D7 , EddShrT8N03D8 , EddShrT8N03D9 , EddShrT8N04D1 , & + EddShrT8N04D2 , EddShrT8N04D3 , EddShrT8N04D4 , EddShrT8N04D5 , EddShrT8N04D6 , EddShrT8N04D7 , EddShrT8N04D8 , EddShrT8N04D9 , & + EddShrT8N05D1 , EddShrT8N05D2 , EddShrT8N05D3 , EddShrT8N05D4 , EddShrT8N05D5 , EddShrT8N05D6 , EddShrT8N05D7 , EddShrT8N05D8 , & + EddShrT8N05D9 , EddShrT8N06D1 , EddShrT8N06D2 , EddShrT8N06D3 , EddShrT8N06D4 , EddShrT8N06D5 , EddShrT8N06D6 , EddShrT8N06D7 , & + EddShrT8N06D8 , EddShrT8N06D9 , EddShrT8N07D1 , EddShrT8N07D2 , EddShrT8N07D3 , EddShrT8N07D4 , EddShrT8N07D5 , EddShrT8N07D6 , & + EddShrT8N07D7 , EddShrT8N07D8 , EddShrT8N07D9 , EddShrT8N08D1 , EddShrT8N08D2 , EddShrT8N08D3 , EddShrT8N08D4 , EddShrT8N08D5 , & + EddShrT8N08D6 , EddShrT8N08D7 , EddShrT8N08D8 , EddShrT8N08D9 , EddShrT8N09D1 , EddShrT8N09D2 , EddShrT8N09D3 , EddShrT8N09D4 , & + EddShrT8N09D5 , EddShrT8N09D6 , EddShrT8N09D7 , EddShrT8N09D8 , EddShrT8N09D9 , EddShrT8N10D1 , EddShrT8N10D2 , EddShrT8N10D3 , & + EddShrT8N10D4 , EddShrT8N10D5 , EddShrT8N10D6 , EddShrT8N10D7 , EddShrT8N10D8 , EddShrT8N10D9 , EddShrT8N11D1 , EddShrT8N11D2 , & + EddShrT8N11D3 , EddShrT8N11D4 , EddShrT8N11D5 , EddShrT8N11D6 , EddShrT8N11D7 , EddShrT8N11D8 , EddShrT8N11D9 , EddShrT8N12D1 , & + EddShrT8N12D2 , EddShrT8N12D3 , EddShrT8N12D4 , EddShrT8N12D5 , EddShrT8N12D6 , EddShrT8N12D7 , EddShrT8N12D8 , EddShrT8N12D9 , & + EddShrT8N13D1 , EddShrT8N13D2 , EddShrT8N13D3 , EddShrT8N13D4 , EddShrT8N13D5 , EddShrT8N13D6 , EddShrT8N13D7 , EddShrT8N13D8 , & + EddShrT8N13D9 , EddShrT8N14D1 , EddShrT8N14D2 , EddShrT8N14D3 , EddShrT8N14D4 , EddShrT8N14D5 , EddShrT8N14D6 , EddShrT8N14D7 , & + EddShrT8N14D8 , EddShrT8N14D9 , EddShrT8N15D1 , EddShrT8N15D2 , EddShrT8N15D3 , EddShrT8N15D4 , EddShrT8N15D5 , EddShrT8N15D6 , & + EddShrT8N15D7 , EddShrT8N15D8 , EddShrT8N15D9 , EddShrT8N16D1 , EddShrT8N16D2 , EddShrT8N16D3 , EddShrT8N16D4 , EddShrT8N16D5 , & + EddShrT8N16D6 , EddShrT8N16D7 , EddShrT8N16D8 , EddShrT8N16D9 , EddShrT8N17D1 , EddShrT8N17D2 , EddShrT8N17D3 , EddShrT8N17D4 , & + EddShrT8N17D5 , EddShrT8N17D6 , EddShrT8N17D7 , EddShrT8N17D8 , EddShrT8N17D9 , EddShrT8N18D1 , EddShrT8N18D2 , EddShrT8N18D3 , & + EddShrT8N18D4 , EddShrT8N18D5 , EddShrT8N18D6 , EddShrT8N18D7 , EddShrT8N18D8 , EddShrT8N18D9 , EddShrT8N19D1 , EddShrT8N19D2 , & + EddShrT8N19D3 , EddShrT8N19D4 , EddShrT8N19D5 , EddShrT8N19D6 , EddShrT8N19D7 , EddShrT8N19D8 , EddShrT8N19D9 , EddShrT8N20D1 , & + EddShrT8N20D2 , EddShrT8N20D3 , EddShrT8N20D4 , EddShrT8N20D5 , EddShrT8N20D6 , EddShrT8N20D7 , EddShrT8N20D8 , EddShrT8N20D9 , & + EddShrT9N01D1 , EddShrT9N01D2 , EddShrT9N01D3 , EddShrT9N01D4 , EddShrT9N01D5 , EddShrT9N01D6 , EddShrT9N01D7 , EddShrT9N01D8 , & + EddShrT9N01D9 , EddShrT9N02D1 , EddShrT9N02D2 , EddShrT9N02D3 , EddShrT9N02D4 , EddShrT9N02D5 , EddShrT9N02D6 , EddShrT9N02D7 , & + EddShrT9N02D8 , EddShrT9N02D9 , EddShrT9N03D1 , EddShrT9N03D2 , EddShrT9N03D3 , EddShrT9N03D4 , EddShrT9N03D5 , EddShrT9N03D6 , & + EddShrT9N03D7 , EddShrT9N03D8 , EddShrT9N03D9 , EddShrT9N04D1 , EddShrT9N04D2 , EddShrT9N04D3 , EddShrT9N04D4 , EddShrT9N04D5 , & + EddShrT9N04D6 , EddShrT9N04D7 , EddShrT9N04D8 , EddShrT9N04D9 , EddShrT9N05D1 , EddShrT9N05D2 , EddShrT9N05D3 , EddShrT9N05D4 , & + EddShrT9N05D5 , EddShrT9N05D6 , EddShrT9N05D7 , EddShrT9N05D8 , EddShrT9N05D9 , EddShrT9N06D1 , EddShrT9N06D2 , EddShrT9N06D3 , & + EddShrT9N06D4 , EddShrT9N06D5 , EddShrT9N06D6 , EddShrT9N06D7 , EddShrT9N06D8 , EddShrT9N06D9 , EddShrT9N07D1 , EddShrT9N07D2 , & + EddShrT9N07D3 , EddShrT9N07D4 , EddShrT9N07D5 , EddShrT9N07D6 , EddShrT9N07D7 , EddShrT9N07D8 , EddShrT9N07D9 , EddShrT9N08D1 , & + EddShrT9N08D2 , EddShrT9N08D3 , EddShrT9N08D4 , EddShrT9N08D5 , EddShrT9N08D6 , EddShrT9N08D7 , EddShrT9N08D8 , EddShrT9N08D9 , & + EddShrT9N09D1 , EddShrT9N09D2 , EddShrT9N09D3 , EddShrT9N09D4 , EddShrT9N09D5 , EddShrT9N09D6 , EddShrT9N09D7 , EddShrT9N09D8 , & + EddShrT9N09D9 , EddShrT9N10D1 , EddShrT9N10D2 , EddShrT9N10D3 , EddShrT9N10D4 , EddShrT9N10D5 , EddShrT9N10D6 , EddShrT9N10D7 , & + EddShrT9N10D8 , EddShrT9N10D9 , EddShrT9N11D1 , EddShrT9N11D2 , EddShrT9N11D3 , EddShrT9N11D4 , EddShrT9N11D5 , EddShrT9N11D6 , & + EddShrT9N11D7 , EddShrT9N11D8 , EddShrT9N11D9 , EddShrT9N12D1 , EddShrT9N12D2 , EddShrT9N12D3 , EddShrT9N12D4 , EddShrT9N12D5 , & + EddShrT9N12D6 , EddShrT9N12D7 , EddShrT9N12D8 , EddShrT9N12D9 , EddShrT9N13D1 , EddShrT9N13D2 , EddShrT9N13D3 , EddShrT9N13D4 , & + EddShrT9N13D5 , EddShrT9N13D6 , EddShrT9N13D7 , EddShrT9N13D8 , EddShrT9N13D9 , EddShrT9N14D1 , EddShrT9N14D2 , EddShrT9N14D3 , & + EddShrT9N14D4 , EddShrT9N14D5 , EddShrT9N14D6 , EddShrT9N14D7 , EddShrT9N14D8 , EddShrT9N14D9 , EddShrT9N15D1 , EddShrT9N15D2 , & + EddShrT9N15D3 , EddShrT9N15D4 , EddShrT9N15D5 , EddShrT9N15D6 , EddShrT9N15D7 , EddShrT9N15D8 , EddShrT9N15D9 , EddShrT9N16D1 , & + EddShrT9N16D2 , EddShrT9N16D3 , EddShrT9N16D4 , EddShrT9N16D5 , EddShrT9N16D6 , EddShrT9N16D7 , EddShrT9N16D8 , EddShrT9N16D9 , & + EddShrT9N17D1 , EddShrT9N17D2 , EddShrT9N17D3 , EddShrT9N17D4 , EddShrT9N17D5 , EddShrT9N17D6 , EddShrT9N17D7 , EddShrT9N17D8 , & + EddShrT9N17D9 , EddShrT9N18D1 , EddShrT9N18D2 , EddShrT9N18D3 , EddShrT9N18D4 , EddShrT9N18D5 , EddShrT9N18D6 , EddShrT9N18D7 , & + EddShrT9N18D8 , EddShrT9N18D9 , EddShrT9N19D1 , EddShrT9N19D2 , EddShrT9N19D3 , EddShrT9N19D4 , EddShrT9N19D5 , EddShrT9N19D6 , & + EddShrT9N19D7 , EddShrT9N19D8 , EddShrT9N19D9 , EddShrT9N20D1 , EddShrT9N20D2 , EddShrT9N20D3 , EddShrT9N20D4 , EddShrT9N20D5 , & + EddShrT9N20D6 , EddShrT9N20D7 , EddShrT9N20D8 , EddShrT9N20D9 , EddVisT1N01D1 , EddVisT1N01D2 , EddVisT1N01D3 , EddVisT1N01D4 , & + EddVisT1N01D5 , EddVisT1N01D6 , EddVisT1N01D7 , EddVisT1N01D8 , EddVisT1N01D9 , EddVisT1N02D1 , EddVisT1N02D2 , EddVisT1N02D3 , & + EddVisT1N02D4 , EddVisT1N02D5 , EddVisT1N02D6 , EddVisT1N02D7 , EddVisT1N02D8 , EddVisT1N02D9 , EddVisT1N03D1 , EddVisT1N03D2 , & + EddVisT1N03D3 , EddVisT1N03D4 , EddVisT1N03D5 , EddVisT1N03D6 , EddVisT1N03D7 , EddVisT1N03D8 , EddVisT1N03D9 , EddVisT1N04D1 , & + EddVisT1N04D2 , EddVisT1N04D3 , EddVisT1N04D4 , EddVisT1N04D5 , EddVisT1N04D6 , EddVisT1N04D7 , EddVisT1N04D8 , EddVisT1N04D9 , & + EddVisT1N05D1 , EddVisT1N05D2 , EddVisT1N05D3 , EddVisT1N05D4 , EddVisT1N05D5 , EddVisT1N05D6 , EddVisT1N05D7 , EddVisT1N05D8 , & + EddVisT1N05D9 , EddVisT1N06D1 , EddVisT1N06D2 , EddVisT1N06D3 , EddVisT1N06D4 , EddVisT1N06D5 , EddVisT1N06D6 , EddVisT1N06D7 , & + EddVisT1N06D8 , EddVisT1N06D9 , EddVisT1N07D1 , EddVisT1N07D2 , EddVisT1N07D3 , EddVisT1N07D4 , EddVisT1N07D5 , EddVisT1N07D6 , & + EddVisT1N07D7 , EddVisT1N07D8 , EddVisT1N07D9 , EddVisT1N08D1 , EddVisT1N08D2 , EddVisT1N08D3 , EddVisT1N08D4 , EddVisT1N08D5 , & + EddVisT1N08D6 , EddVisT1N08D7 , EddVisT1N08D8 , EddVisT1N08D9 , EddVisT1N09D1 , EddVisT1N09D2 , EddVisT1N09D3 , EddVisT1N09D4 , & + EddVisT1N09D5 , EddVisT1N09D6 , EddVisT1N09D7 , EddVisT1N09D8 , EddVisT1N09D9 , EddVisT1N10D1 , EddVisT1N10D2 , EddVisT1N10D3 , & + EddVisT1N10D4 , EddVisT1N10D5 , EddVisT1N10D6 , EddVisT1N10D7 , EddVisT1N10D8 , EddVisT1N10D9 , EddVisT1N11D1 , EddVisT1N11D2 , & + EddVisT1N11D3 , EddVisT1N11D4 , EddVisT1N11D5 , EddVisT1N11D6 , EddVisT1N11D7 , EddVisT1N11D8 , EddVisT1N11D9 , EddVisT1N12D1 , & + EddVisT1N12D2 , EddVisT1N12D3 , EddVisT1N12D4 , EddVisT1N12D5 , EddVisT1N12D6 , EddVisT1N12D7 , EddVisT1N12D8 , EddVisT1N12D9 , & + EddVisT1N13D1 , EddVisT1N13D2 , EddVisT1N13D3 , EddVisT1N13D4 , EddVisT1N13D5 , EddVisT1N13D6 , EddVisT1N13D7 , EddVisT1N13D8 , & + EddVisT1N13D9 , EddVisT1N14D1 , EddVisT1N14D2 , EddVisT1N14D3 , EddVisT1N14D4 , EddVisT1N14D5 , EddVisT1N14D6 , EddVisT1N14D7 , & + EddVisT1N14D8 , EddVisT1N14D9 , EddVisT1N15D1 , EddVisT1N15D2 , EddVisT1N15D3 , EddVisT1N15D4 , EddVisT1N15D5 , EddVisT1N15D6 , & + EddVisT1N15D7 , EddVisT1N15D8 , EddVisT1N15D9 , EddVisT1N16D1 , EddVisT1N16D2 , EddVisT1N16D3 , EddVisT1N16D4 , EddVisT1N16D5 , & + EddVisT1N16D6 , EddVisT1N16D7 , EddVisT1N16D8 , EddVisT1N16D9 , EddVisT1N17D1 , EddVisT1N17D2 , EddVisT1N17D3 , EddVisT1N17D4 , & + EddVisT1N17D5 , EddVisT1N17D6 , EddVisT1N17D7 , EddVisT1N17D8 , EddVisT1N17D9 , EddVisT1N18D1 , EddVisT1N18D2 , EddVisT1N18D3 , & + EddVisT1N18D4 , EddVisT1N18D5 , EddVisT1N18D6 , EddVisT1N18D7 , EddVisT1N18D8 , EddVisT1N18D9 , EddVisT1N19D1 , EddVisT1N19D2 , & + EddVisT1N19D3 , EddVisT1N19D4 , EddVisT1N19D5 , EddVisT1N19D6 , EddVisT1N19D7 , EddVisT1N19D8 , EddVisT1N19D9 , EddVisT1N20D1 , & + EddVisT1N20D2 , EddVisT1N20D3 , EddVisT1N20D4 , EddVisT1N20D5 , EddVisT1N20D6 , EddVisT1N20D7 , EddVisT1N20D8 , EddVisT1N20D9 , & + EddVisT2N01D1 , EddVisT2N01D2 , EddVisT2N01D3 , EddVisT2N01D4 , EddVisT2N01D5 , EddVisT2N01D6 , EddVisT2N01D7 , EddVisT2N01D8 , & + EddVisT2N01D9 , EddVisT2N02D1 , EddVisT2N02D2 , EddVisT2N02D3 , EddVisT2N02D4 , EddVisT2N02D5 , EddVisT2N02D6 , EddVisT2N02D7 , & + EddVisT2N02D8 , EddVisT2N02D9 , EddVisT2N03D1 , EddVisT2N03D2 , EddVisT2N03D3 , EddVisT2N03D4 , EddVisT2N03D5 , EddVisT2N03D6 , & + EddVisT2N03D7 , EddVisT2N03D8 , EddVisT2N03D9 , EddVisT2N04D1 , EddVisT2N04D2 , EddVisT2N04D3 , EddVisT2N04D4 , EddVisT2N04D5 , & + EddVisT2N04D6 , EddVisT2N04D7 , EddVisT2N04D8 , EddVisT2N04D9 , EddVisT2N05D1 , EddVisT2N05D2 , EddVisT2N05D3 , EddVisT2N05D4 , & + EddVisT2N05D5 , EddVisT2N05D6 , EddVisT2N05D7 , EddVisT2N05D8 , EddVisT2N05D9 , EddVisT2N06D1 , EddVisT2N06D2 , EddVisT2N06D3 , & + EddVisT2N06D4 , EddVisT2N06D5 , EddVisT2N06D6 , EddVisT2N06D7 , EddVisT2N06D8 , EddVisT2N06D9 , EddVisT2N07D1 , EddVisT2N07D2 , & + EddVisT2N07D3 , EddVisT2N07D4 , EddVisT2N07D5 , EddVisT2N07D6 , EddVisT2N07D7 , EddVisT2N07D8 , EddVisT2N07D9 , EddVisT2N08D1 , & + EddVisT2N08D2 , EddVisT2N08D3 , EddVisT2N08D4 , EddVisT2N08D5 , EddVisT2N08D6 , EddVisT2N08D7 , EddVisT2N08D8 , EddVisT2N08D9 , & + EddVisT2N09D1 , EddVisT2N09D2 , EddVisT2N09D3 , EddVisT2N09D4 , EddVisT2N09D5 , EddVisT2N09D6 , EddVisT2N09D7 , EddVisT2N09D8 , & + EddVisT2N09D9 , EddVisT2N10D1 , EddVisT2N10D2 , EddVisT2N10D3 , EddVisT2N10D4 , EddVisT2N10D5 , EddVisT2N10D6 , EddVisT2N10D7 , & + EddVisT2N10D8 , EddVisT2N10D9 , EddVisT2N11D1 , EddVisT2N11D2 , EddVisT2N11D3 , EddVisT2N11D4 , EddVisT2N11D5 , EddVisT2N11D6 , & + EddVisT2N11D7 , EddVisT2N11D8 , EddVisT2N11D9 , EddVisT2N12D1 , EddVisT2N12D2 , EddVisT2N12D3 , EddVisT2N12D4 , EddVisT2N12D5 , & + EddVisT2N12D6 , EddVisT2N12D7 , EddVisT2N12D8 , EddVisT2N12D9 , EddVisT2N13D1 , EddVisT2N13D2 , EddVisT2N13D3 , EddVisT2N13D4 , & + EddVisT2N13D5 , EddVisT2N13D6 , EddVisT2N13D7 , EddVisT2N13D8 , EddVisT2N13D9 , EddVisT2N14D1 , EddVisT2N14D2 , EddVisT2N14D3 , & + EddVisT2N14D4 , EddVisT2N14D5 , EddVisT2N14D6 , EddVisT2N14D7 , EddVisT2N14D8 , EddVisT2N14D9 , EddVisT2N15D1 , EddVisT2N15D2 , & + EddVisT2N15D3 , EddVisT2N15D4 , EddVisT2N15D5 , EddVisT2N15D6 , EddVisT2N15D7 , EddVisT2N15D8 , EddVisT2N15D9 , EddVisT2N16D1 , & + EddVisT2N16D2 , EddVisT2N16D3 , EddVisT2N16D4 , EddVisT2N16D5 , EddVisT2N16D6 , EddVisT2N16D7 , EddVisT2N16D8 , EddVisT2N16D9 , & + EddVisT2N17D1 , EddVisT2N17D2 , EddVisT2N17D3 , EddVisT2N17D4 , EddVisT2N17D5 , EddVisT2N17D6 , EddVisT2N17D7 , EddVisT2N17D8 , & + EddVisT2N17D9 , EddVisT2N18D1 , EddVisT2N18D2 , EddVisT2N18D3 , EddVisT2N18D4 , EddVisT2N18D5 , EddVisT2N18D6 , EddVisT2N18D7 , & + EddVisT2N18D8 , EddVisT2N18D9 , EddVisT2N19D1 , EddVisT2N19D2 , EddVisT2N19D3 , EddVisT2N19D4 , EddVisT2N19D5 , EddVisT2N19D6 , & + EddVisT2N19D7 , EddVisT2N19D8 , EddVisT2N19D9 , EddVisT2N20D1 , EddVisT2N20D2 , EddVisT2N20D3 , EddVisT2N20D4 , EddVisT2N20D5 , & + EddVisT2N20D6 , EddVisT2N20D7 , EddVisT2N20D8 , EddVisT2N20D9 , EddVisT3N01D1 , EddVisT3N01D2 , EddVisT3N01D3 , EddVisT3N01D4 , & + EddVisT3N01D5 , EddVisT3N01D6 , EddVisT3N01D7 , EddVisT3N01D8 , EddVisT3N01D9 , EddVisT3N02D1 , EddVisT3N02D2 , EddVisT3N02D3 , & + EddVisT3N02D4 , EddVisT3N02D5 , EddVisT3N02D6 , EddVisT3N02D7 , EddVisT3N02D8 , EddVisT3N02D9 , EddVisT3N03D1 , EddVisT3N03D2 , & + EddVisT3N03D3 , EddVisT3N03D4 , EddVisT3N03D5 , EddVisT3N03D6 , EddVisT3N03D7 , EddVisT3N03D8 , EddVisT3N03D9 , EddVisT3N04D1 , & + EddVisT3N04D2 , EddVisT3N04D3 , EddVisT3N04D4 , EddVisT3N04D5 , EddVisT3N04D6 , EddVisT3N04D7 , EddVisT3N04D8 , EddVisT3N04D9 , & + EddVisT3N05D1 , EddVisT3N05D2 , EddVisT3N05D3 , EddVisT3N05D4 , EddVisT3N05D5 , EddVisT3N05D6 , EddVisT3N05D7 , EddVisT3N05D8 , & + EddVisT3N05D9 , EddVisT3N06D1 , EddVisT3N06D2 , EddVisT3N06D3 , EddVisT3N06D4 , EddVisT3N06D5 , EddVisT3N06D6 , EddVisT3N06D7 , & + EddVisT3N06D8 , EddVisT3N06D9 , EddVisT3N07D1 , EddVisT3N07D2 , EddVisT3N07D3 , EddVisT3N07D4 , EddVisT3N07D5 , EddVisT3N07D6 , & + EddVisT3N07D7 , EddVisT3N07D8 , EddVisT3N07D9 , EddVisT3N08D1 , EddVisT3N08D2 , EddVisT3N08D3 , EddVisT3N08D4 , EddVisT3N08D5 , & + EddVisT3N08D6 , EddVisT3N08D7 , EddVisT3N08D8 , EddVisT3N08D9 , EddVisT3N09D1 , EddVisT3N09D2 , EddVisT3N09D3 , EddVisT3N09D4 , & + EddVisT3N09D5 , EddVisT3N09D6 , EddVisT3N09D7 , EddVisT3N09D8 , EddVisT3N09D9 , EddVisT3N10D1 , EddVisT3N10D2 , EddVisT3N10D3 , & + EddVisT3N10D4 , EddVisT3N10D5 , EddVisT3N10D6 , EddVisT3N10D7 , EddVisT3N10D8 , EddVisT3N10D9 , EddVisT3N11D1 , EddVisT3N11D2 , & + EddVisT3N11D3 , EddVisT3N11D4 , EddVisT3N11D5 , EddVisT3N11D6 , EddVisT3N11D7 , EddVisT3N11D8 , EddVisT3N11D9 , EddVisT3N12D1 , & + EddVisT3N12D2 , EddVisT3N12D3 , EddVisT3N12D4 , EddVisT3N12D5 , EddVisT3N12D6 , EddVisT3N12D7 , EddVisT3N12D8 , EddVisT3N12D9 , & + EddVisT3N13D1 , EddVisT3N13D2 , EddVisT3N13D3 , EddVisT3N13D4 , EddVisT3N13D5 , EddVisT3N13D6 , EddVisT3N13D7 , EddVisT3N13D8 , & + EddVisT3N13D9 , EddVisT3N14D1 , EddVisT3N14D2 , EddVisT3N14D3 , EddVisT3N14D4 , EddVisT3N14D5 , EddVisT3N14D6 , EddVisT3N14D7 , & + EddVisT3N14D8 , EddVisT3N14D9 , EddVisT3N15D1 , EddVisT3N15D2 , EddVisT3N15D3 , EddVisT3N15D4 , EddVisT3N15D5 , EddVisT3N15D6 , & + EddVisT3N15D7 , EddVisT3N15D8 , EddVisT3N15D9 , EddVisT3N16D1 , EddVisT3N16D2 , EddVisT3N16D3 , EddVisT3N16D4 , EddVisT3N16D5 , & + EddVisT3N16D6 , EddVisT3N16D7 , EddVisT3N16D8 , EddVisT3N16D9 , EddVisT3N17D1 , EddVisT3N17D2 , EddVisT3N17D3 , EddVisT3N17D4 , & + EddVisT3N17D5 , EddVisT3N17D6 , EddVisT3N17D7 , EddVisT3N17D8 , EddVisT3N17D9 , EddVisT3N18D1 , EddVisT3N18D2 , EddVisT3N18D3 , & + EddVisT3N18D4 , EddVisT3N18D5 , EddVisT3N18D6 , EddVisT3N18D7 , EddVisT3N18D8 , EddVisT3N18D9 , EddVisT3N19D1 , EddVisT3N19D2 , & + EddVisT3N19D3 , EddVisT3N19D4 , EddVisT3N19D5 , EddVisT3N19D6 , EddVisT3N19D7 , EddVisT3N19D8 , EddVisT3N19D9 , EddVisT3N20D1 , & + EddVisT3N20D2 , EddVisT3N20D3 , EddVisT3N20D4 , EddVisT3N20D5 , EddVisT3N20D6 , EddVisT3N20D7 , EddVisT3N20D8 , EddVisT3N20D9 , & + EddVisT4N01D1 , EddVisT4N01D2 , EddVisT4N01D3 , EddVisT4N01D4 , EddVisT4N01D5 , EddVisT4N01D6 , EddVisT4N01D7 , EddVisT4N01D8 , & + EddVisT4N01D9 , EddVisT4N02D1 , EddVisT4N02D2 , EddVisT4N02D3 , EddVisT4N02D4 , EddVisT4N02D5 , EddVisT4N02D6 , EddVisT4N02D7 , & + EddVisT4N02D8 , EddVisT4N02D9 , EddVisT4N03D1 , EddVisT4N03D2 , EddVisT4N03D3 , EddVisT4N03D4 , EddVisT4N03D5 , EddVisT4N03D6 , & + EddVisT4N03D7 , EddVisT4N03D8 , EddVisT4N03D9 , EddVisT4N04D1 , EddVisT4N04D2 , EddVisT4N04D3 , EddVisT4N04D4 , EddVisT4N04D5 , & + EddVisT4N04D6 , EddVisT4N04D7 , EddVisT4N04D8 , EddVisT4N04D9 , EddVisT4N05D1 , EddVisT4N05D2 , EddVisT4N05D3 , EddVisT4N05D4 , & + EddVisT4N05D5 , EddVisT4N05D6 , EddVisT4N05D7 , EddVisT4N05D8 , EddVisT4N05D9 , EddVisT4N06D1 , EddVisT4N06D2 , EddVisT4N06D3 , & + EddVisT4N06D4 , EddVisT4N06D5 , EddVisT4N06D6 , EddVisT4N06D7 , EddVisT4N06D8 , EddVisT4N06D9 , EddVisT4N07D1 , EddVisT4N07D2 , & + EddVisT4N07D3 , EddVisT4N07D4 , EddVisT4N07D5 , EddVisT4N07D6 , EddVisT4N07D7 , EddVisT4N07D8 , EddVisT4N07D9 , EddVisT4N08D1 , & + EddVisT4N08D2 , EddVisT4N08D3 , EddVisT4N08D4 , EddVisT4N08D5 , EddVisT4N08D6 , EddVisT4N08D7 , EddVisT4N08D8 , EddVisT4N08D9 , & + EddVisT4N09D1 , EddVisT4N09D2 , EddVisT4N09D3 , EddVisT4N09D4 , EddVisT4N09D5 , EddVisT4N09D6 , EddVisT4N09D7 , EddVisT4N09D8 , & + EddVisT4N09D9 , EddVisT4N10D1 , EddVisT4N10D2 , EddVisT4N10D3 , EddVisT4N10D4 , EddVisT4N10D5 , EddVisT4N10D6 , EddVisT4N10D7 , & + EddVisT4N10D8 , EddVisT4N10D9 , EddVisT4N11D1 , EddVisT4N11D2 , EddVisT4N11D3 , EddVisT4N11D4 , EddVisT4N11D5 , EddVisT4N11D6 , & + EddVisT4N11D7 , EddVisT4N11D8 , EddVisT4N11D9 , EddVisT4N12D1 , EddVisT4N12D2 , EddVisT4N12D3 , EddVisT4N12D4 , EddVisT4N12D5 , & + EddVisT4N12D6 , EddVisT4N12D7 , EddVisT4N12D8 , EddVisT4N12D9 , EddVisT4N13D1 , EddVisT4N13D2 , EddVisT4N13D3 , EddVisT4N13D4 , & + EddVisT4N13D5 , EddVisT4N13D6 , EddVisT4N13D7 , EddVisT4N13D8 , EddVisT4N13D9 , EddVisT4N14D1 , EddVisT4N14D2 , EddVisT4N14D3 /) + ParamIndxAry(4081:6120) = (/ & + EddVisT4N14D4 , EddVisT4N14D5 , EddVisT4N14D6 , EddVisT4N14D7 , EddVisT4N14D8 , EddVisT4N14D9 , EddVisT4N15D1 , EddVisT4N15D2 , & + EddVisT4N15D3 , EddVisT4N15D4 , EddVisT4N15D5 , EddVisT4N15D6 , EddVisT4N15D7 , EddVisT4N15D8 , EddVisT4N15D9 , EddVisT4N16D1 , & + EddVisT4N16D2 , EddVisT4N16D3 , EddVisT4N16D4 , EddVisT4N16D5 , EddVisT4N16D6 , EddVisT4N16D7 , EddVisT4N16D8 , EddVisT4N16D9 , & + EddVisT4N17D1 , EddVisT4N17D2 , EddVisT4N17D3 , EddVisT4N17D4 , EddVisT4N17D5 , EddVisT4N17D6 , EddVisT4N17D7 , EddVisT4N17D8 , & + EddVisT4N17D9 , EddVisT4N18D1 , EddVisT4N18D2 , EddVisT4N18D3 , EddVisT4N18D4 , EddVisT4N18D5 , EddVisT4N18D6 , EddVisT4N18D7 , & + EddVisT4N18D8 , EddVisT4N18D9 , EddVisT4N19D1 , EddVisT4N19D2 , EddVisT4N19D3 , EddVisT4N19D4 , EddVisT4N19D5 , EddVisT4N19D6 , & + EddVisT4N19D7 , EddVisT4N19D8 , EddVisT4N19D9 , EddVisT4N20D1 , EddVisT4N20D2 , EddVisT4N20D3 , EddVisT4N20D4 , EddVisT4N20D5 , & + EddVisT4N20D6 , EddVisT4N20D7 , EddVisT4N20D8 , EddVisT4N20D9 , EddVisT5N01D1 , EddVisT5N01D2 , EddVisT5N01D3 , EddVisT5N01D4 , & + EddVisT5N01D5 , EddVisT5N01D6 , EddVisT5N01D7 , EddVisT5N01D8 , EddVisT5N01D9 , EddVisT5N02D1 , EddVisT5N02D2 , EddVisT5N02D3 , & + EddVisT5N02D4 , EddVisT5N02D5 , EddVisT5N02D6 , EddVisT5N02D7 , EddVisT5N02D8 , EddVisT5N02D9 , EddVisT5N03D1 , EddVisT5N03D2 , & + EddVisT5N03D3 , EddVisT5N03D4 , EddVisT5N03D5 , EddVisT5N03D6 , EddVisT5N03D7 , EddVisT5N03D8 , EddVisT5N03D9 , EddVisT5N04D1 , & + EddVisT5N04D2 , EddVisT5N04D3 , EddVisT5N04D4 , EddVisT5N04D5 , EddVisT5N04D6 , EddVisT5N04D7 , EddVisT5N04D8 , EddVisT5N04D9 , & + EddVisT5N05D1 , EddVisT5N05D2 , EddVisT5N05D3 , EddVisT5N05D4 , EddVisT5N05D5 , EddVisT5N05D6 , EddVisT5N05D7 , EddVisT5N05D8 , & + EddVisT5N05D9 , EddVisT5N06D1 , EddVisT5N06D2 , EddVisT5N06D3 , EddVisT5N06D4 , EddVisT5N06D5 , EddVisT5N06D6 , EddVisT5N06D7 , & + EddVisT5N06D8 , EddVisT5N06D9 , EddVisT5N07D1 , EddVisT5N07D2 , EddVisT5N07D3 , EddVisT5N07D4 , EddVisT5N07D5 , EddVisT5N07D6 , & + EddVisT5N07D7 , EddVisT5N07D8 , EddVisT5N07D9 , EddVisT5N08D1 , EddVisT5N08D2 , EddVisT5N08D3 , EddVisT5N08D4 , EddVisT5N08D5 , & + EddVisT5N08D6 , EddVisT5N08D7 , EddVisT5N08D8 , EddVisT5N08D9 , EddVisT5N09D1 , EddVisT5N09D2 , EddVisT5N09D3 , EddVisT5N09D4 , & + EddVisT5N09D5 , EddVisT5N09D6 , EddVisT5N09D7 , EddVisT5N09D8 , EddVisT5N09D9 , EddVisT5N10D1 , EddVisT5N10D2 , EddVisT5N10D3 , & + EddVisT5N10D4 , EddVisT5N10D5 , EddVisT5N10D6 , EddVisT5N10D7 , EddVisT5N10D8 , EddVisT5N10D9 , EddVisT5N11D1 , EddVisT5N11D2 , & + EddVisT5N11D3 , EddVisT5N11D4 , EddVisT5N11D5 , EddVisT5N11D6 , EddVisT5N11D7 , EddVisT5N11D8 , EddVisT5N11D9 , EddVisT5N12D1 , & + EddVisT5N12D2 , EddVisT5N12D3 , EddVisT5N12D4 , EddVisT5N12D5 , EddVisT5N12D6 , EddVisT5N12D7 , EddVisT5N12D8 , EddVisT5N12D9 , & + EddVisT5N13D1 , EddVisT5N13D2 , EddVisT5N13D3 , EddVisT5N13D4 , EddVisT5N13D5 , EddVisT5N13D6 , EddVisT5N13D7 , EddVisT5N13D8 , & + EddVisT5N13D9 , EddVisT5N14D1 , EddVisT5N14D2 , EddVisT5N14D3 , EddVisT5N14D4 , EddVisT5N14D5 , EddVisT5N14D6 , EddVisT5N14D7 , & + EddVisT5N14D8 , EddVisT5N14D9 , EddVisT5N15D1 , EddVisT5N15D2 , EddVisT5N15D3 , EddVisT5N15D4 , EddVisT5N15D5 , EddVisT5N15D6 , & + EddVisT5N15D7 , EddVisT5N15D8 , EddVisT5N15D9 , EddVisT5N16D1 , EddVisT5N16D2 , EddVisT5N16D3 , EddVisT5N16D4 , EddVisT5N16D5 , & + EddVisT5N16D6 , EddVisT5N16D7 , EddVisT5N16D8 , EddVisT5N16D9 , EddVisT5N17D1 , EddVisT5N17D2 , EddVisT5N17D3 , EddVisT5N17D4 , & + EddVisT5N17D5 , EddVisT5N17D6 , EddVisT5N17D7 , EddVisT5N17D8 , EddVisT5N17D9 , EddVisT5N18D1 , EddVisT5N18D2 , EddVisT5N18D3 , & + EddVisT5N18D4 , EddVisT5N18D5 , EddVisT5N18D6 , EddVisT5N18D7 , EddVisT5N18D8 , EddVisT5N18D9 , EddVisT5N19D1 , EddVisT5N19D2 , & + EddVisT5N19D3 , EddVisT5N19D4 , EddVisT5N19D5 , EddVisT5N19D6 , EddVisT5N19D7 , EddVisT5N19D8 , EddVisT5N19D9 , EddVisT5N20D1 , & + EddVisT5N20D2 , EddVisT5N20D3 , EddVisT5N20D4 , EddVisT5N20D5 , EddVisT5N20D6 , EddVisT5N20D7 , EddVisT5N20D8 , EddVisT5N20D9 , & + EddVisT6N01D1 , EddVisT6N01D2 , EddVisT6N01D3 , EddVisT6N01D4 , EddVisT6N01D5 , EddVisT6N01D6 , EddVisT6N01D7 , EddVisT6N01D8 , & + EddVisT6N01D9 , EddVisT6N02D1 , EddVisT6N02D2 , EddVisT6N02D3 , EddVisT6N02D4 , EddVisT6N02D5 , EddVisT6N02D6 , EddVisT6N02D7 , & + EddVisT6N02D8 , EddVisT6N02D9 , EddVisT6N03D1 , EddVisT6N03D2 , EddVisT6N03D3 , EddVisT6N03D4 , EddVisT6N03D5 , EddVisT6N03D6 , & + EddVisT6N03D7 , EddVisT6N03D8 , EddVisT6N03D9 , EddVisT6N04D1 , EddVisT6N04D2 , EddVisT6N04D3 , EddVisT6N04D4 , EddVisT6N04D5 , & + EddVisT6N04D6 , EddVisT6N04D7 , EddVisT6N04D8 , EddVisT6N04D9 , EddVisT6N05D1 , EddVisT6N05D2 , EddVisT6N05D3 , EddVisT6N05D4 , & + EddVisT6N05D5 , EddVisT6N05D6 , EddVisT6N05D7 , EddVisT6N05D8 , EddVisT6N05D9 , EddVisT6N06D1 , EddVisT6N06D2 , EddVisT6N06D3 , & + EddVisT6N06D4 , EddVisT6N06D5 , EddVisT6N06D6 , EddVisT6N06D7 , EddVisT6N06D8 , EddVisT6N06D9 , EddVisT6N07D1 , EddVisT6N07D2 , & + EddVisT6N07D3 , EddVisT6N07D4 , EddVisT6N07D5 , EddVisT6N07D6 , EddVisT6N07D7 , EddVisT6N07D8 , EddVisT6N07D9 , EddVisT6N08D1 , & + EddVisT6N08D2 , EddVisT6N08D3 , EddVisT6N08D4 , EddVisT6N08D5 , EddVisT6N08D6 , EddVisT6N08D7 , EddVisT6N08D8 , EddVisT6N08D9 , & + EddVisT6N09D1 , EddVisT6N09D2 , EddVisT6N09D3 , EddVisT6N09D4 , EddVisT6N09D5 , EddVisT6N09D6 , EddVisT6N09D7 , EddVisT6N09D8 , & + EddVisT6N09D9 , EddVisT6N10D1 , EddVisT6N10D2 , EddVisT6N10D3 , EddVisT6N10D4 , EddVisT6N10D5 , EddVisT6N10D6 , EddVisT6N10D7 , & + EddVisT6N10D8 , EddVisT6N10D9 , EddVisT6N11D1 , EddVisT6N11D2 , EddVisT6N11D3 , EddVisT6N11D4 , EddVisT6N11D5 , EddVisT6N11D6 , & + EddVisT6N11D7 , EddVisT6N11D8 , EddVisT6N11D9 , EddVisT6N12D1 , EddVisT6N12D2 , EddVisT6N12D3 , EddVisT6N12D4 , EddVisT6N12D5 , & + EddVisT6N12D6 , EddVisT6N12D7 , EddVisT6N12D8 , EddVisT6N12D9 , EddVisT6N13D1 , EddVisT6N13D2 , EddVisT6N13D3 , EddVisT6N13D4 , & + EddVisT6N13D5 , EddVisT6N13D6 , EddVisT6N13D7 , EddVisT6N13D8 , EddVisT6N13D9 , EddVisT6N14D1 , EddVisT6N14D2 , EddVisT6N14D3 , & + EddVisT6N14D4 , EddVisT6N14D5 , EddVisT6N14D6 , EddVisT6N14D7 , EddVisT6N14D8 , EddVisT6N14D9 , EddVisT6N15D1 , EddVisT6N15D2 , & + EddVisT6N15D3 , EddVisT6N15D4 , EddVisT6N15D5 , EddVisT6N15D6 , EddVisT6N15D7 , EddVisT6N15D8 , EddVisT6N15D9 , EddVisT6N16D1 , & + EddVisT6N16D2 , EddVisT6N16D3 , EddVisT6N16D4 , EddVisT6N16D5 , EddVisT6N16D6 , EddVisT6N16D7 , EddVisT6N16D8 , EddVisT6N16D9 , & + EddVisT6N17D1 , EddVisT6N17D2 , EddVisT6N17D3 , EddVisT6N17D4 , EddVisT6N17D5 , EddVisT6N17D6 , EddVisT6N17D7 , EddVisT6N17D8 , & + EddVisT6N17D9 , EddVisT6N18D1 , EddVisT6N18D2 , EddVisT6N18D3 , EddVisT6N18D4 , EddVisT6N18D5 , EddVisT6N18D6 , EddVisT6N18D7 , & + EddVisT6N18D8 , EddVisT6N18D9 , EddVisT6N19D1 , EddVisT6N19D2 , EddVisT6N19D3 , EddVisT6N19D4 , EddVisT6N19D5 , EddVisT6N19D6 , & + EddVisT6N19D7 , EddVisT6N19D8 , EddVisT6N19D9 , EddVisT6N20D1 , EddVisT6N20D2 , EddVisT6N20D3 , EddVisT6N20D4 , EddVisT6N20D5 , & + EddVisT6N20D6 , EddVisT6N20D7 , EddVisT6N20D8 , EddVisT6N20D9 , EddVisT7N01D1 , EddVisT7N01D2 , EddVisT7N01D3 , EddVisT7N01D4 , & + EddVisT7N01D5 , EddVisT7N01D6 , EddVisT7N01D7 , EddVisT7N01D8 , EddVisT7N01D9 , EddVisT7N02D1 , EddVisT7N02D2 , EddVisT7N02D3 , & + EddVisT7N02D4 , EddVisT7N02D5 , EddVisT7N02D6 , EddVisT7N02D7 , EddVisT7N02D8 , EddVisT7N02D9 , EddVisT7N03D1 , EddVisT7N03D2 , & + EddVisT7N03D3 , EddVisT7N03D4 , EddVisT7N03D5 , EddVisT7N03D6 , EddVisT7N03D7 , EddVisT7N03D8 , EddVisT7N03D9 , EddVisT7N04D1 , & + EddVisT7N04D2 , EddVisT7N04D3 , EddVisT7N04D4 , EddVisT7N04D5 , EddVisT7N04D6 , EddVisT7N04D7 , EddVisT7N04D8 , EddVisT7N04D9 , & + EddVisT7N05D1 , EddVisT7N05D2 , EddVisT7N05D3 , EddVisT7N05D4 , EddVisT7N05D5 , EddVisT7N05D6 , EddVisT7N05D7 , EddVisT7N05D8 , & + EddVisT7N05D9 , EddVisT7N06D1 , EddVisT7N06D2 , EddVisT7N06D3 , EddVisT7N06D4 , EddVisT7N06D5 , EddVisT7N06D6 , EddVisT7N06D7 , & + EddVisT7N06D8 , EddVisT7N06D9 , EddVisT7N07D1 , EddVisT7N07D2 , EddVisT7N07D3 , EddVisT7N07D4 , EddVisT7N07D5 , EddVisT7N07D6 , & + EddVisT7N07D7 , EddVisT7N07D8 , EddVisT7N07D9 , EddVisT7N08D1 , EddVisT7N08D2 , EddVisT7N08D3 , EddVisT7N08D4 , EddVisT7N08D5 , & + EddVisT7N08D6 , EddVisT7N08D7 , EddVisT7N08D8 , EddVisT7N08D9 , EddVisT7N09D1 , EddVisT7N09D2 , EddVisT7N09D3 , EddVisT7N09D4 , & + EddVisT7N09D5 , EddVisT7N09D6 , EddVisT7N09D7 , EddVisT7N09D8 , EddVisT7N09D9 , EddVisT7N10D1 , EddVisT7N10D2 , EddVisT7N10D3 , & + EddVisT7N10D4 , EddVisT7N10D5 , EddVisT7N10D6 , EddVisT7N10D7 , EddVisT7N10D8 , EddVisT7N10D9 , EddVisT7N11D1 , EddVisT7N11D2 , & + EddVisT7N11D3 , EddVisT7N11D4 , EddVisT7N11D5 , EddVisT7N11D6 , EddVisT7N11D7 , EddVisT7N11D8 , EddVisT7N11D9 , EddVisT7N12D1 , & + EddVisT7N12D2 , EddVisT7N12D3 , EddVisT7N12D4 , EddVisT7N12D5 , EddVisT7N12D6 , EddVisT7N12D7 , EddVisT7N12D8 , EddVisT7N12D9 , & + EddVisT7N13D1 , EddVisT7N13D2 , EddVisT7N13D3 , EddVisT7N13D4 , EddVisT7N13D5 , EddVisT7N13D6 , EddVisT7N13D7 , EddVisT7N13D8 , & + EddVisT7N13D9 , EddVisT7N14D1 , EddVisT7N14D2 , EddVisT7N14D3 , EddVisT7N14D4 , EddVisT7N14D5 , EddVisT7N14D6 , EddVisT7N14D7 , & + EddVisT7N14D8 , EddVisT7N14D9 , EddVisT7N15D1 , EddVisT7N15D2 , EddVisT7N15D3 , EddVisT7N15D4 , EddVisT7N15D5 , EddVisT7N15D6 , & + EddVisT7N15D7 , EddVisT7N15D8 , EddVisT7N15D9 , EddVisT7N16D1 , EddVisT7N16D2 , EddVisT7N16D3 , EddVisT7N16D4 , EddVisT7N16D5 , & + EddVisT7N16D6 , EddVisT7N16D7 , EddVisT7N16D8 , EddVisT7N16D9 , EddVisT7N17D1 , EddVisT7N17D2 , EddVisT7N17D3 , EddVisT7N17D4 , & + EddVisT7N17D5 , EddVisT7N17D6 , EddVisT7N17D7 , EddVisT7N17D8 , EddVisT7N17D9 , EddVisT7N18D1 , EddVisT7N18D2 , EddVisT7N18D3 , & + EddVisT7N18D4 , EddVisT7N18D5 , EddVisT7N18D6 , EddVisT7N18D7 , EddVisT7N18D8 , EddVisT7N18D9 , EddVisT7N19D1 , EddVisT7N19D2 , & + EddVisT7N19D3 , EddVisT7N19D4 , EddVisT7N19D5 , EddVisT7N19D6 , EddVisT7N19D7 , EddVisT7N19D8 , EddVisT7N19D9 , EddVisT7N20D1 , & + EddVisT7N20D2 , EddVisT7N20D3 , EddVisT7N20D4 , EddVisT7N20D5 , EddVisT7N20D6 , EddVisT7N20D7 , EddVisT7N20D8 , EddVisT7N20D9 , & + EddVisT8N01D1 , EddVisT8N01D2 , EddVisT8N01D3 , EddVisT8N01D4 , EddVisT8N01D5 , EddVisT8N01D6 , EddVisT8N01D7 , EddVisT8N01D8 , & + EddVisT8N01D9 , EddVisT8N02D1 , EddVisT8N02D2 , EddVisT8N02D3 , EddVisT8N02D4 , EddVisT8N02D5 , EddVisT8N02D6 , EddVisT8N02D7 , & + EddVisT8N02D8 , EddVisT8N02D9 , EddVisT8N03D1 , EddVisT8N03D2 , EddVisT8N03D3 , EddVisT8N03D4 , EddVisT8N03D5 , EddVisT8N03D6 , & + EddVisT8N03D7 , EddVisT8N03D8 , EddVisT8N03D9 , EddVisT8N04D1 , EddVisT8N04D2 , EddVisT8N04D3 , EddVisT8N04D4 , EddVisT8N04D5 , & + EddVisT8N04D6 , EddVisT8N04D7 , EddVisT8N04D8 , EddVisT8N04D9 , EddVisT8N05D1 , EddVisT8N05D2 , EddVisT8N05D3 , EddVisT8N05D4 , & + EddVisT8N05D5 , EddVisT8N05D6 , EddVisT8N05D7 , EddVisT8N05D8 , EddVisT8N05D9 , EddVisT8N06D1 , EddVisT8N06D2 , EddVisT8N06D3 , & + EddVisT8N06D4 , EddVisT8N06D5 , EddVisT8N06D6 , EddVisT8N06D7 , EddVisT8N06D8 , EddVisT8N06D9 , EddVisT8N07D1 , EddVisT8N07D2 , & + EddVisT8N07D3 , EddVisT8N07D4 , EddVisT8N07D5 , EddVisT8N07D6 , EddVisT8N07D7 , EddVisT8N07D8 , EddVisT8N07D9 , EddVisT8N08D1 , & + EddVisT8N08D2 , EddVisT8N08D3 , EddVisT8N08D4 , EddVisT8N08D5 , EddVisT8N08D6 , EddVisT8N08D7 , EddVisT8N08D8 , EddVisT8N08D9 , & + EddVisT8N09D1 , EddVisT8N09D2 , EddVisT8N09D3 , EddVisT8N09D4 , EddVisT8N09D5 , EddVisT8N09D6 , EddVisT8N09D7 , EddVisT8N09D8 , & + EddVisT8N09D9 , EddVisT8N10D1 , EddVisT8N10D2 , EddVisT8N10D3 , EddVisT8N10D4 , EddVisT8N10D5 , EddVisT8N10D6 , EddVisT8N10D7 , & + EddVisT8N10D8 , EddVisT8N10D9 , EddVisT8N11D1 , EddVisT8N11D2 , EddVisT8N11D3 , EddVisT8N11D4 , EddVisT8N11D5 , EddVisT8N11D6 , & + EddVisT8N11D7 , EddVisT8N11D8 , EddVisT8N11D9 , EddVisT8N12D1 , EddVisT8N12D2 , EddVisT8N12D3 , EddVisT8N12D4 , EddVisT8N12D5 , & + EddVisT8N12D6 , EddVisT8N12D7 , EddVisT8N12D8 , EddVisT8N12D9 , EddVisT8N13D1 , EddVisT8N13D2 , EddVisT8N13D3 , EddVisT8N13D4 , & + EddVisT8N13D5 , EddVisT8N13D6 , EddVisT8N13D7 , EddVisT8N13D8 , EddVisT8N13D9 , EddVisT8N14D1 , EddVisT8N14D2 , EddVisT8N14D3 , & + EddVisT8N14D4 , EddVisT8N14D5 , EddVisT8N14D6 , EddVisT8N14D7 , EddVisT8N14D8 , EddVisT8N14D9 , EddVisT8N15D1 , EddVisT8N15D2 , & + EddVisT8N15D3 , EddVisT8N15D4 , EddVisT8N15D5 , EddVisT8N15D6 , EddVisT8N15D7 , EddVisT8N15D8 , EddVisT8N15D9 , EddVisT8N16D1 , & + EddVisT8N16D2 , EddVisT8N16D3 , EddVisT8N16D4 , EddVisT8N16D5 , EddVisT8N16D6 , EddVisT8N16D7 , EddVisT8N16D8 , EddVisT8N16D9 , & + EddVisT8N17D1 , EddVisT8N17D2 , EddVisT8N17D3 , EddVisT8N17D4 , EddVisT8N17D5 , EddVisT8N17D6 , EddVisT8N17D7 , EddVisT8N17D8 , & + EddVisT8N17D9 , EddVisT8N18D1 , EddVisT8N18D2 , EddVisT8N18D3 , EddVisT8N18D4 , EddVisT8N18D5 , EddVisT8N18D6 , EddVisT8N18D7 , & + EddVisT8N18D8 , EddVisT8N18D9 , EddVisT8N19D1 , EddVisT8N19D2 , EddVisT8N19D3 , EddVisT8N19D4 , EddVisT8N19D5 , EddVisT8N19D6 , & + EddVisT8N19D7 , EddVisT8N19D8 , EddVisT8N19D9 , EddVisT8N20D1 , EddVisT8N20D2 , EddVisT8N20D3 , EddVisT8N20D4 , EddVisT8N20D5 , & + EddVisT8N20D6 , EddVisT8N20D7 , EddVisT8N20D8 , EddVisT8N20D9 , EddVisT9N01D1 , EddVisT9N01D2 , EddVisT9N01D3 , EddVisT9N01D4 , & + EddVisT9N01D5 , EddVisT9N01D6 , EddVisT9N01D7 , EddVisT9N01D8 , EddVisT9N01D9 , EddVisT9N02D1 , EddVisT9N02D2 , EddVisT9N02D3 , & + EddVisT9N02D4 , EddVisT9N02D5 , EddVisT9N02D6 , EddVisT9N02D7 , EddVisT9N02D8 , EddVisT9N02D9 , EddVisT9N03D1 , EddVisT9N03D2 , & + EddVisT9N03D3 , EddVisT9N03D4 , EddVisT9N03D5 , EddVisT9N03D6 , EddVisT9N03D7 , EddVisT9N03D8 , EddVisT9N03D9 , EddVisT9N04D1 , & + EddVisT9N04D2 , EddVisT9N04D3 , EddVisT9N04D4 , EddVisT9N04D5 , EddVisT9N04D6 , EddVisT9N04D7 , EddVisT9N04D8 , EddVisT9N04D9 , & + EddVisT9N05D1 , EddVisT9N05D2 , EddVisT9N05D3 , EddVisT9N05D4 , EddVisT9N05D5 , EddVisT9N05D6 , EddVisT9N05D7 , EddVisT9N05D8 , & + EddVisT9N05D9 , EddVisT9N06D1 , EddVisT9N06D2 , EddVisT9N06D3 , EddVisT9N06D4 , EddVisT9N06D5 , EddVisT9N06D6 , EddVisT9N06D7 , & + EddVisT9N06D8 , EddVisT9N06D9 , EddVisT9N07D1 , EddVisT9N07D2 , EddVisT9N07D3 , EddVisT9N07D4 , EddVisT9N07D5 , EddVisT9N07D6 , & + EddVisT9N07D7 , EddVisT9N07D8 , EddVisT9N07D9 , EddVisT9N08D1 , EddVisT9N08D2 , EddVisT9N08D3 , EddVisT9N08D4 , EddVisT9N08D5 , & + EddVisT9N08D6 , EddVisT9N08D7 , EddVisT9N08D8 , EddVisT9N08D9 , EddVisT9N09D1 , EddVisT9N09D2 , EddVisT9N09D3 , EddVisT9N09D4 , & + EddVisT9N09D5 , EddVisT9N09D6 , EddVisT9N09D7 , EddVisT9N09D8 , EddVisT9N09D9 , EddVisT9N10D1 , EddVisT9N10D2 , EddVisT9N10D3 , & + EddVisT9N10D4 , EddVisT9N10D5 , EddVisT9N10D6 , EddVisT9N10D7 , EddVisT9N10D8 , EddVisT9N10D9 , EddVisT9N11D1 , EddVisT9N11D2 , & + EddVisT9N11D3 , EddVisT9N11D4 , EddVisT9N11D5 , EddVisT9N11D6 , EddVisT9N11D7 , EddVisT9N11D8 , EddVisT9N11D9 , EddVisT9N12D1 , & + EddVisT9N12D2 , EddVisT9N12D3 , EddVisT9N12D4 , EddVisT9N12D5 , EddVisT9N12D6 , EddVisT9N12D7 , EddVisT9N12D8 , EddVisT9N12D9 , & + EddVisT9N13D1 , EddVisT9N13D2 , EddVisT9N13D3 , EddVisT9N13D4 , EddVisT9N13D5 , EddVisT9N13D6 , EddVisT9N13D7 , EddVisT9N13D8 , & + EddVisT9N13D9 , EddVisT9N14D1 , EddVisT9N14D2 , EddVisT9N14D3 , EddVisT9N14D4 , EddVisT9N14D5 , EddVisT9N14D6 , EddVisT9N14D7 , & + EddVisT9N14D8 , EddVisT9N14D9 , EddVisT9N15D1 , EddVisT9N15D2 , EddVisT9N15D3 , EddVisT9N15D4 , EddVisT9N15D5 , EddVisT9N15D6 , & + EddVisT9N15D7 , EddVisT9N15D8 , EddVisT9N15D9 , EddVisT9N16D1 , EddVisT9N16D2 , EddVisT9N16D3 , EddVisT9N16D4 , EddVisT9N16D5 , & + EddVisT9N16D6 , EddVisT9N16D7 , EddVisT9N16D8 , EddVisT9N16D9 , EddVisT9N17D1 , EddVisT9N17D2 , EddVisT9N17D3 , EddVisT9N17D4 , & + EddVisT9N17D5 , EddVisT9N17D6 , EddVisT9N17D7 , EddVisT9N17D8 , EddVisT9N17D9 , EddVisT9N18D1 , EddVisT9N18D2 , EddVisT9N18D3 , & + EddVisT9N18D4 , EddVisT9N18D5 , EddVisT9N18D6 , EddVisT9N18D7 , EddVisT9N18D8 , EddVisT9N18D9 , EddVisT9N19D1 , EddVisT9N19D2 , & + EddVisT9N19D3 , EddVisT9N19D4 , EddVisT9N19D5 , EddVisT9N19D6 , EddVisT9N19D7 , EddVisT9N19D8 , EddVisT9N19D9 , EddVisT9N20D1 , & + EddVisT9N20D2 , EddVisT9N20D3 , EddVisT9N20D4 , EddVisT9N20D5 , EddVisT9N20D6 , EddVisT9N20D7 , EddVisT9N20D8 , EddVisT9N20D9 , & + RtAxsXT1 , RtAxsXT2 , RtAxsXT3 , RtAxsXT4 , RtAxsXT5 , RtAxsXT6 , RtAxsXT7 , RtAxsXT8 , & + RtAxsXT9 , RtAxsYT1 , RtAxsYT2 , RtAxsYT3 , RtAxsYT4 , RtAxsYT5 , RtAxsYT6 , RtAxsYT7 , & + RtAxsYT8 , RtAxsYT9 , RtAxsZT1 , RtAxsZT2 , RtAxsZT3 , RtAxsZT4 , RtAxsZT5 , RtAxsZT6 , & + RtAxsZT7 , RtAxsZT8 , RtAxsZT9 , RtDiamT1 , RtDiamT2 , RtDiamT3 , RtDiamT4 , RtDiamT5 , & + RtDiamT6 , RtDiamT7 , RtDiamT8 , RtDiamT9 , RtPosXT1 , RtPosXT2 , RtPosXT3 , RtPosXT4 , & + RtPosXT5 , RtPosXT6 , RtPosXT7 , RtPosXT8 , RtPosXT9 , RtPosYT1 , RtPosYT2 , RtPosYT3 , & + RtPosYT4 , RtPosYT5 , RtPosYT6 , RtPosYT7 , RtPosYT8 , RtPosYT9 , RtPosZT1 , RtPosZT2 , & + RtPosZT3 , RtPosZT4 , RtPosZT5 , RtPosZT6 , RtPosZT7 , RtPosZT8 , RtPosZT9 , RtVAmbT1 , & + RtVAmbT2 , RtVAmbT3 , RtVAmbT4 , RtVAmbT5 , RtVAmbT6 , RtVAmbT7 , RtVAmbT8 , RtVAmbT9 , & + RtVRelT1 , RtVRelT2 , RtVRelT3 , RtVRelT4 , RtVRelT5 , RtVRelT6 , RtVRelT7 , RtVRelT8 , & + RtVRelT9 , SCGblIn1 , SCGblIn2 , SCGblIn3 , SCGblIn4 , SCGblIn5 , SCGblIn6 , SCGblIn7 , & + SCGblIn8 , SCGblIn9 , SCGblOt1 , SCGblOt2 , SCGblOt3 , SCGblOt4 , SCGblOt5 , SCGblOt6 , & + SCGblOt7 , SCGblOt8 , SCGblOt9 , SCT1In1 , SCT1In2 , SCT1In3 , SCT1In4 , SCT1In5 , & + SCT1In6 , SCT1In7 , SCT1In8 , SCT1In9 , SCT1Ot1 , SCT1Ot2 , SCT1Ot3 , SCT1Ot4 , & + SCT1Ot5 , SCT1Ot6 , SCT1Ot7 , SCT1Ot8 , SCT1Ot9 , SCT2In1 , SCT2In2 , SCT2In3 , & + SCT2In4 , SCT2In5 , SCT2In6 , SCT2In7 , SCT2In8 , SCT2In9 , SCT2Ot1 , SCT2Ot2 , & + SCT2Ot3 , SCT2Ot4 , SCT2Ot5 , SCT2Ot6 , SCT2Ot7 , SCT2Ot8 , SCT2Ot9 , SCT3In1 , & + SCT3In2 , SCT3In3 , SCT3In4 , SCT3In5 , SCT3In6 , SCT3In7 , SCT3In8 , SCT3In9 , & + SCT3Ot1 , SCT3Ot2 , SCT3Ot3 , SCT3Ot4 , SCT3Ot5 , SCT3Ot6 , SCT3Ot7 , SCT3Ot8 , & + SCT3Ot9 , SCT4In1 , SCT4In2 , SCT4In3 , SCT4In4 , SCT4In5 , SCT4In6 , SCT4In7 , & + SCT4In8 , SCT4In9 , SCT4Ot1 , SCT4Ot2 , SCT4Ot3 , SCT4Ot4 , SCT4Ot5 , SCT4Ot6 , & + SCT4Ot7 , SCT4Ot8 , SCT4Ot9 , SCT5In1 , SCT5In2 , SCT5In3 , SCT5In4 , SCT5In5 , & + SCT5In6 , SCT5In7 , SCT5In8 , SCT5In9 , SCT5Ot1 , SCT5Ot2 , SCT5Ot3 , SCT5Ot4 , & + SCT5Ot5 , SCT5Ot6 , SCT5Ot7 , SCT5Ot8 , SCT5Ot9 , SCT6In1 , SCT6In2 , SCT6In3 , & + SCT6In4 , SCT6In5 , SCT6In6 , SCT6In7 , SCT6In8 , SCT6In9 , SCT6Ot1 , SCT6Ot2 , & + SCT6Ot3 , SCT6Ot4 , SCT6Ot5 , SCT6Ot6 , SCT6Ot7 , SCT6Ot8 , SCT6Ot9 , SCT7In1 , & + SCT7In2 , SCT7In3 , SCT7In4 , SCT7In5 , SCT7In6 , SCT7In7 , SCT7In8 , SCT7In9 , & + SCT7Ot1 , SCT7Ot2 , SCT7Ot3 , SCT7Ot4 , SCT7Ot5 , SCT7Ot6 , SCT7Ot7 , SCT7Ot8 , & + SCT7Ot9 , SCT8In1 , SCT8In2 , SCT8In3 , SCT8In4 , SCT8In5 , SCT8In6 , SCT8In7 , & + SCT8In8 , SCT8In9 , SCT8Ot1 , SCT8Ot2 , SCT8Ot3 , SCT8Ot4 , SCT8Ot5 , SCT8Ot6 , & + SCT8Ot7 , SCT8Ot8 , SCT8Ot9 , SCT9In1 , SCT9In2 , SCT9In3 , SCT9In4 , SCT9In5 , & + SCT9In6 , SCT9In7 , SCT9In8 , SCT9In9 , SCT9Ot1 , SCT9Ot2 , SCT9Ot3 , SCT9Ot4 , & + SCT9Ot5 , SCT9Ot6 , SCT9Ot7 , SCT9Ot8 , SCT9Ot9 , TIAmbT1 , TIAmbT2 , TIAmbT3 , & + TIAmbT4 , TIAmbT5 , TIAmbT6 , TIAmbT7 , TIAmbT8 , TIAmbT9 , W1VAmbX , W1VAmbY , & + W1VAmbZ , W1VDisX , W1VDisY , W1VDisZ , W2VAmbX , W2VAmbY , W2VAmbZ , W2VDisX , & + W2VDisY , W2VDisZ , W3VAmbX , W3VAmbY , W3VAmbZ , W3VDisX , W3VDisY , W3VDisZ , & + W4VAmbX , W4VAmbY , W4VAmbZ , W4VDisX , W4VDisY , W4VDisZ , W5VAmbX , W5VAmbY , & + W5VAmbZ , W5VDisX , W5VDisY , W5VDisZ , W6VAmbX , W6VAmbY , W6VAmbZ , W6VDisX , & + W6VDisY , W6VDisZ , W7VAmbX , W7VAmbY , W7VAmbZ , W7VDisX , W7VDisY , W7VDisZ , & + W8VAmbX , W8VAmbY , W8VAmbZ , W8VDisX , W8VDisY , W8VDisZ , W9VAmbX , W9VAmbY , & + W9VAmbZ , W9VDisX , W9VDisY , W9VDisZ , WkAxsXT1D1 , WkAxsXT1D2 , WkAxsXT1D3 , WkAxsXT1D4 , & + WkAxsXT1D5 , WkAxsXT1D6 , WkAxsXT1D7 , WkAxsXT1D8 , WkAxsXT1D9 , WkAxsXT2D1 , WkAxsXT2D2 , WkAxsXT2D3 , & + WkAxsXT2D4 , WkAxsXT2D5 , WkAxsXT2D6 , WkAxsXT2D7 , WkAxsXT2D8 , WkAxsXT2D9 , WkAxsXT3D1 , WkAxsXT3D2 , & + WkAxsXT3D3 , WkAxsXT3D4 , WkAxsXT3D5 , WkAxsXT3D6 , WkAxsXT3D7 , WkAxsXT3D8 , WkAxsXT3D9 , WkAxsXT4D1 , & + WkAxsXT4D2 , WkAxsXT4D3 , WkAxsXT4D4 , WkAxsXT4D5 , WkAxsXT4D6 , WkAxsXT4D7 , WkAxsXT4D8 , WkAxsXT4D9 , & + WkAxsXT5D1 , WkAxsXT5D2 , WkAxsXT5D3 , WkAxsXT5D4 , WkAxsXT5D5 , WkAxsXT5D6 , WkAxsXT5D7 , WkAxsXT5D8 , & + WkAxsXT5D9 , WkAxsXT6D1 , WkAxsXT6D2 , WkAxsXT6D3 , WkAxsXT6D4 , WkAxsXT6D5 , WkAxsXT6D6 , WkAxsXT6D7 , & + WkAxsXT6D8 , WkAxsXT6D9 , WkAxsXT7D1 , WkAxsXT7D2 , WkAxsXT7D3 , WkAxsXT7D4 , WkAxsXT7D5 , WkAxsXT7D6 , & + WkAxsXT7D7 , WkAxsXT7D8 , WkAxsXT7D9 , WkAxsXT8D1 , WkAxsXT8D2 , WkAxsXT8D3 , WkAxsXT8D4 , WkAxsXT8D5 , & + WkAxsXT8D6 , WkAxsXT8D7 , WkAxsXT8D8 , WkAxsXT8D9 , WkAxsXT9D1 , WkAxsXT9D2 , WkAxsXT9D3 , WkAxsXT9D4 , & + WkAxsXT9D5 , WkAxsXT9D6 , WkAxsXT9D7 , WkAxsXT9D8 , WkAxsXT9D9 , WkAxsYT1D1 , WkAxsYT1D2 , WkAxsYT1D3 , & + WkAxsYT1D4 , WkAxsYT1D5 , WkAxsYT1D6 , WkAxsYT1D7 , WkAxsYT1D8 , WkAxsYT1D9 , WkAxsYT2D1 , WkAxsYT2D2 , & + WkAxsYT2D3 , WkAxsYT2D4 , WkAxsYT2D5 , WkAxsYT2D6 , WkAxsYT2D7 , WkAxsYT2D8 , WkAxsYT2D9 , WkAxsYT3D1 , & + WkAxsYT3D2 , WkAxsYT3D3 , WkAxsYT3D4 , WkAxsYT3D5 , WkAxsYT3D6 , WkAxsYT3D7 , WkAxsYT3D8 , WkAxsYT3D9 , & + WkAxsYT4D1 , WkAxsYT4D2 , WkAxsYT4D3 , WkAxsYT4D4 , WkAxsYT4D5 , WkAxsYT4D6 , WkAxsYT4D7 , WkAxsYT4D8 , & + WkAxsYT4D9 , WkAxsYT5D1 , WkAxsYT5D2 , WkAxsYT5D3 , WkAxsYT5D4 , WkAxsYT5D5 , WkAxsYT5D6 , WkAxsYT5D7 , & + WkAxsYT5D8 , WkAxsYT5D9 , WkAxsYT6D1 , WkAxsYT6D2 , WkAxsYT6D3 , WkAxsYT6D4 , WkAxsYT6D5 , WkAxsYT6D6 , & + WkAxsYT6D7 , WkAxsYT6D8 , WkAxsYT6D9 , WkAxsYT7D1 , WkAxsYT7D2 , WkAxsYT7D3 , WkAxsYT7D4 , WkAxsYT7D5 , & + WkAxsYT7D6 , WkAxsYT7D7 , WkAxsYT7D8 , WkAxsYT7D9 , WkAxsYT8D1 , WkAxsYT8D2 , WkAxsYT8D3 , WkAxsYT8D4 , & + WkAxsYT8D5 , WkAxsYT8D6 , WkAxsYT8D7 , WkAxsYT8D8 , WkAxsYT8D9 , WkAxsYT9D1 , WkAxsYT9D2 , WkAxsYT9D3 , & + WkAxsYT9D4 , WkAxsYT9D5 , WkAxsYT9D6 , WkAxsYT9D7 , WkAxsYT9D8 , WkAxsYT9D9 , WkAxsZT1D1 , WkAxsZT1D2 , & + WkAxsZT1D3 , WkAxsZT1D4 , WkAxsZT1D5 , WkAxsZT1D6 , WkAxsZT1D7 , WkAxsZT1D8 , WkAxsZT1D9 , WkAxsZT2D1 , & + WkAxsZT2D2 , WkAxsZT2D3 , WkAxsZT2D4 , WkAxsZT2D5 , WkAxsZT2D6 , WkAxsZT2D7 , WkAxsZT2D8 , WkAxsZT2D9 , & + WkAxsZT3D1 , WkAxsZT3D2 , WkAxsZT3D3 , WkAxsZT3D4 , WkAxsZT3D5 , WkAxsZT3D6 , WkAxsZT3D7 , WkAxsZT3D8 , & + WkAxsZT3D9 , WkAxsZT4D1 , WkAxsZT4D2 , WkAxsZT4D3 , WkAxsZT4D4 , WkAxsZT4D5 , WkAxsZT4D6 , WkAxsZT4D7 , & + WkAxsZT4D8 , WkAxsZT4D9 , WkAxsZT5D1 , WkAxsZT5D2 , WkAxsZT5D3 , WkAxsZT5D4 , WkAxsZT5D5 , WkAxsZT5D6 , & + WkAxsZT5D7 , WkAxsZT5D8 , WkAxsZT5D9 , WkAxsZT6D1 , WkAxsZT6D2 , WkAxsZT6D3 , WkAxsZT6D4 , WkAxsZT6D5 , & + WkAxsZT6D6 , WkAxsZT6D7 , WkAxsZT6D8 , WkAxsZT6D9 , WkAxsZT7D1 , WkAxsZT7D2 , WkAxsZT7D3 , WkAxsZT7D4 , & + WkAxsZT7D5 , WkAxsZT7D6 , WkAxsZT7D7 , WkAxsZT7D8 , WkAxsZT7D9 , WkAxsZT8D1 , WkAxsZT8D2 , WkAxsZT8D3 , & + WkAxsZT8D4 , WkAxsZT8D5 , WkAxsZT8D6 , WkAxsZT8D7 , WkAxsZT8D8 , WkAxsZT8D9 , WkAxsZT9D1 , WkAxsZT9D2 , & + WkAxsZT9D3 , WkAxsZT9D4 , WkAxsZT9D5 , WkAxsZT9D6 , WkAxsZT9D7 , WkAxsZT9D8 , WkAxsZT9D9 , WkDfVrT1N01D1 , & + WkDfVrT1N01D2 , WkDfVrT1N01D3 , WkDfVrT1N01D4 , WkDfVrT1N01D5 , WkDfVrT1N01D6 , WkDfVrT1N01D7 , WkDfVrT1N01D8 , WkDfVrT1N01D9 , & + WkDfVrT1N02D1 , WkDfVrT1N02D2 , WkDfVrT1N02D3 , WkDfVrT1N02D4 , WkDfVrT1N02D5 , WkDfVrT1N02D6 , WkDfVrT1N02D7 , WkDfVrT1N02D8 , & + WkDfVrT1N02D9 , WkDfVrT1N03D1 , WkDfVrT1N03D2 , WkDfVrT1N03D3 , WkDfVrT1N03D4 , WkDfVrT1N03D5 , WkDfVrT1N03D6 , WkDfVrT1N03D7 , & + WkDfVrT1N03D8 , WkDfVrT1N03D9 , WkDfVrT1N04D1 , WkDfVrT1N04D2 , WkDfVrT1N04D3 , WkDfVrT1N04D4 , WkDfVrT1N04D5 , WkDfVrT1N04D6 , & + WkDfVrT1N04D7 , WkDfVrT1N04D8 , WkDfVrT1N04D9 , WkDfVrT1N05D1 , WkDfVrT1N05D2 , WkDfVrT1N05D3 , WkDfVrT1N05D4 , WkDfVrT1N05D5 , & + WkDfVrT1N05D6 , WkDfVrT1N05D7 , WkDfVrT1N05D8 , WkDfVrT1N05D9 , WkDfVrT1N06D1 , WkDfVrT1N06D2 , WkDfVrT1N06D3 , WkDfVrT1N06D4 , & + WkDfVrT1N06D5 , WkDfVrT1N06D6 , WkDfVrT1N06D7 , WkDfVrT1N06D8 , WkDfVrT1N06D9 , WkDfVrT1N07D1 , WkDfVrT1N07D2 , WkDfVrT1N07D3 , & + WkDfVrT1N07D4 , WkDfVrT1N07D5 , WkDfVrT1N07D6 , WkDfVrT1N07D7 , WkDfVrT1N07D8 , WkDfVrT1N07D9 , WkDfVrT1N08D1 , WkDfVrT1N08D2 , & + WkDfVrT1N08D3 , WkDfVrT1N08D4 , WkDfVrT1N08D5 , WkDfVrT1N08D6 , WkDfVrT1N08D7 , WkDfVrT1N08D8 , WkDfVrT1N08D9 , WkDfVrT1N09D1 , & + WkDfVrT1N09D2 , WkDfVrT1N09D3 , WkDfVrT1N09D4 , WkDfVrT1N09D5 , WkDfVrT1N09D6 , WkDfVrT1N09D7 , WkDfVrT1N09D8 , WkDfVrT1N09D9 , & + WkDfVrT1N10D1 , WkDfVrT1N10D2 , WkDfVrT1N10D3 , WkDfVrT1N10D4 , WkDfVrT1N10D5 , WkDfVrT1N10D6 , WkDfVrT1N10D7 , WkDfVrT1N10D8 , & + WkDfVrT1N10D9 , WkDfVrT1N11D1 , WkDfVrT1N11D2 , WkDfVrT1N11D3 , WkDfVrT1N11D4 , WkDfVrT1N11D5 , WkDfVrT1N11D6 , WkDfVrT1N11D7 , & + WkDfVrT1N11D8 , WkDfVrT1N11D9 , WkDfVrT1N12D1 , WkDfVrT1N12D2 , WkDfVrT1N12D3 , WkDfVrT1N12D4 , WkDfVrT1N12D5 , WkDfVrT1N12D6 , & + WkDfVrT1N12D7 , WkDfVrT1N12D8 , WkDfVrT1N12D9 , WkDfVrT1N13D1 , WkDfVrT1N13D2 , WkDfVrT1N13D3 , WkDfVrT1N13D4 , WkDfVrT1N13D5 , & + WkDfVrT1N13D6 , WkDfVrT1N13D7 , WkDfVrT1N13D8 , WkDfVrT1N13D9 , WkDfVrT1N14D1 , WkDfVrT1N14D2 , WkDfVrT1N14D3 , WkDfVrT1N14D4 , & + WkDfVrT1N14D5 , WkDfVrT1N14D6 , WkDfVrT1N14D7 , WkDfVrT1N14D8 , WkDfVrT1N14D9 , WkDfVrT1N15D1 , WkDfVrT1N15D2 , WkDfVrT1N15D3 , & + WkDfVrT1N15D4 , WkDfVrT1N15D5 , WkDfVrT1N15D6 , WkDfVrT1N15D7 , WkDfVrT1N15D8 , WkDfVrT1N15D9 , WkDfVrT1N16D1 , WkDfVrT1N16D2 , & + WkDfVrT1N16D3 , WkDfVrT1N16D4 , WkDfVrT1N16D5 , WkDfVrT1N16D6 , WkDfVrT1N16D7 , WkDfVrT1N16D8 , WkDfVrT1N16D9 , WkDfVrT1N17D1 , & + WkDfVrT1N17D2 , WkDfVrT1N17D3 , WkDfVrT1N17D4 , WkDfVrT1N17D5 , WkDfVrT1N17D6 , WkDfVrT1N17D7 , WkDfVrT1N17D8 , WkDfVrT1N17D9 , & + WkDfVrT1N18D1 , WkDfVrT1N18D2 , WkDfVrT1N18D3 , WkDfVrT1N18D4 , WkDfVrT1N18D5 , WkDfVrT1N18D6 , WkDfVrT1N18D7 , WkDfVrT1N18D8 , & + WkDfVrT1N18D9 , WkDfVrT1N19D1 , WkDfVrT1N19D2 , WkDfVrT1N19D3 , WkDfVrT1N19D4 , WkDfVrT1N19D5 , WkDfVrT1N19D6 , WkDfVrT1N19D7 , & + WkDfVrT1N19D8 , WkDfVrT1N19D9 , WkDfVrT1N20D1 , WkDfVrT1N20D2 , WkDfVrT1N20D3 , WkDfVrT1N20D4 , WkDfVrT1N20D5 , WkDfVrT1N20D6 , & + WkDfVrT1N20D7 , WkDfVrT1N20D8 , WkDfVrT1N20D9 , WkDfVrT2N01D1 , WkDfVrT2N01D2 , WkDfVrT2N01D3 , WkDfVrT2N01D4 , WkDfVrT2N01D5 , & + WkDfVrT2N01D6 , WkDfVrT2N01D7 , WkDfVrT2N01D8 , WkDfVrT2N01D9 , WkDfVrT2N02D1 , WkDfVrT2N02D2 , WkDfVrT2N02D3 , WkDfVrT2N02D4 , & + WkDfVrT2N02D5 , WkDfVrT2N02D6 , WkDfVrT2N02D7 , WkDfVrT2N02D8 , WkDfVrT2N02D9 , WkDfVrT2N03D1 , WkDfVrT2N03D2 , WkDfVrT2N03D3 , & + WkDfVrT2N03D4 , WkDfVrT2N03D5 , WkDfVrT2N03D6 , WkDfVrT2N03D7 , WkDfVrT2N03D8 , WkDfVrT2N03D9 , WkDfVrT2N04D1 , WkDfVrT2N04D2 , & + WkDfVrT2N04D3 , WkDfVrT2N04D4 , WkDfVrT2N04D5 , WkDfVrT2N04D6 , WkDfVrT2N04D7 , WkDfVrT2N04D8 , WkDfVrT2N04D9 , WkDfVrT2N05D1 , & + WkDfVrT2N05D2 , WkDfVrT2N05D3 , WkDfVrT2N05D4 , WkDfVrT2N05D5 , WkDfVrT2N05D6 , WkDfVrT2N05D7 , WkDfVrT2N05D8 , WkDfVrT2N05D9 , & + WkDfVrT2N06D1 , WkDfVrT2N06D2 , WkDfVrT2N06D3 , WkDfVrT2N06D4 , WkDfVrT2N06D5 , WkDfVrT2N06D6 , WkDfVrT2N06D7 , WkDfVrT2N06D8 , & + WkDfVrT2N06D9 , WkDfVrT2N07D1 , WkDfVrT2N07D2 , WkDfVrT2N07D3 , WkDfVrT2N07D4 , WkDfVrT2N07D5 , WkDfVrT2N07D6 , WkDfVrT2N07D7 , & + WkDfVrT2N07D8 , WkDfVrT2N07D9 , WkDfVrT2N08D1 , WkDfVrT2N08D2 , WkDfVrT2N08D3 , WkDfVrT2N08D4 , WkDfVrT2N08D5 , WkDfVrT2N08D6 , & + WkDfVrT2N08D7 , WkDfVrT2N08D8 , WkDfVrT2N08D9 , WkDfVrT2N09D1 , WkDfVrT2N09D2 , WkDfVrT2N09D3 , WkDfVrT2N09D4 , WkDfVrT2N09D5 , & + WkDfVrT2N09D6 , WkDfVrT2N09D7 , WkDfVrT2N09D8 , WkDfVrT2N09D9 , WkDfVrT2N10D1 , WkDfVrT2N10D2 , WkDfVrT2N10D3 , WkDfVrT2N10D4 , & + WkDfVrT2N10D5 , WkDfVrT2N10D6 , WkDfVrT2N10D7 , WkDfVrT2N10D8 , WkDfVrT2N10D9 , WkDfVrT2N11D1 , WkDfVrT2N11D2 , WkDfVrT2N11D3 , & + WkDfVrT2N11D4 , WkDfVrT2N11D5 , WkDfVrT2N11D6 , WkDfVrT2N11D7 , WkDfVrT2N11D8 , WkDfVrT2N11D9 , WkDfVrT2N12D1 , WkDfVrT2N12D2 , & + WkDfVrT2N12D3 , WkDfVrT2N12D4 , WkDfVrT2N12D5 , WkDfVrT2N12D6 , WkDfVrT2N12D7 , WkDfVrT2N12D8 , WkDfVrT2N12D9 , WkDfVrT2N13D1 , & + WkDfVrT2N13D2 , WkDfVrT2N13D3 , WkDfVrT2N13D4 , WkDfVrT2N13D5 , WkDfVrT2N13D6 , WkDfVrT2N13D7 , WkDfVrT2N13D8 , WkDfVrT2N13D9 , & + WkDfVrT2N14D1 , WkDfVrT2N14D2 , WkDfVrT2N14D3 , WkDfVrT2N14D4 , WkDfVrT2N14D5 , WkDfVrT2N14D6 , WkDfVrT2N14D7 , WkDfVrT2N14D8 , & + WkDfVrT2N14D9 , WkDfVrT2N15D1 , WkDfVrT2N15D2 , WkDfVrT2N15D3 , WkDfVrT2N15D4 , WkDfVrT2N15D5 , WkDfVrT2N15D6 , WkDfVrT2N15D7 , & + WkDfVrT2N15D8 , WkDfVrT2N15D9 , WkDfVrT2N16D1 , WkDfVrT2N16D2 , WkDfVrT2N16D3 , WkDfVrT2N16D4 , WkDfVrT2N16D5 , WkDfVrT2N16D6 , & + WkDfVrT2N16D7 , WkDfVrT2N16D8 , WkDfVrT2N16D9 , WkDfVrT2N17D1 , WkDfVrT2N17D2 , WkDfVrT2N17D3 , WkDfVrT2N17D4 , WkDfVrT2N17D5 , & + WkDfVrT2N17D6 , WkDfVrT2N17D7 , WkDfVrT2N17D8 , WkDfVrT2N17D9 , WkDfVrT2N18D1 , WkDfVrT2N18D2 , WkDfVrT2N18D3 , WkDfVrT2N18D4 , & + WkDfVrT2N18D5 , WkDfVrT2N18D6 , WkDfVrT2N18D7 , WkDfVrT2N18D8 , WkDfVrT2N18D9 , WkDfVrT2N19D1 , WkDfVrT2N19D2 , WkDfVrT2N19D3 , & + WkDfVrT2N19D4 , WkDfVrT2N19D5 , WkDfVrT2N19D6 , WkDfVrT2N19D7 , WkDfVrT2N19D8 , WkDfVrT2N19D9 , WkDfVrT2N20D1 , WkDfVrT2N20D2 , & + WkDfVrT2N20D3 , WkDfVrT2N20D4 , WkDfVrT2N20D5 , WkDfVrT2N20D6 , WkDfVrT2N20D7 , WkDfVrT2N20D8 , WkDfVrT2N20D9 , WkDfVrT3N01D1 , & + WkDfVrT3N01D2 , WkDfVrT3N01D3 , WkDfVrT3N01D4 , WkDfVrT3N01D5 , WkDfVrT3N01D6 , WkDfVrT3N01D7 , WkDfVrT3N01D8 , WkDfVrT3N01D9 , & + WkDfVrT3N02D1 , WkDfVrT3N02D2 , WkDfVrT3N02D3 , WkDfVrT3N02D4 , WkDfVrT3N02D5 , WkDfVrT3N02D6 , WkDfVrT3N02D7 , WkDfVrT3N02D8 , & + WkDfVrT3N02D9 , WkDfVrT3N03D1 , WkDfVrT3N03D2 , WkDfVrT3N03D3 , WkDfVrT3N03D4 , WkDfVrT3N03D5 , WkDfVrT3N03D6 , WkDfVrT3N03D7 , & + WkDfVrT3N03D8 , WkDfVrT3N03D9 , WkDfVrT3N04D1 , WkDfVrT3N04D2 , WkDfVrT3N04D3 , WkDfVrT3N04D4 , WkDfVrT3N04D5 , WkDfVrT3N04D6 , & + WkDfVrT3N04D7 , WkDfVrT3N04D8 , WkDfVrT3N04D9 , WkDfVrT3N05D1 , WkDfVrT3N05D2 , WkDfVrT3N05D3 , WkDfVrT3N05D4 , WkDfVrT3N05D5 , & + WkDfVrT3N05D6 , WkDfVrT3N05D7 , WkDfVrT3N05D8 , WkDfVrT3N05D9 , WkDfVrT3N06D1 , WkDfVrT3N06D2 , WkDfVrT3N06D3 , WkDfVrT3N06D4 , & + WkDfVrT3N06D5 , WkDfVrT3N06D6 , WkDfVrT3N06D7 , WkDfVrT3N06D8 , WkDfVrT3N06D9 , WkDfVrT3N07D1 , WkDfVrT3N07D2 , WkDfVrT3N07D3 , & + WkDfVrT3N07D4 , WkDfVrT3N07D5 , WkDfVrT3N07D6 , WkDfVrT3N07D7 , WkDfVrT3N07D8 , WkDfVrT3N07D9 , WkDfVrT3N08D1 , WkDfVrT3N08D2 , & + WkDfVrT3N08D3 , WkDfVrT3N08D4 , WkDfVrT3N08D5 , WkDfVrT3N08D6 , WkDfVrT3N08D7 , WkDfVrT3N08D8 , WkDfVrT3N08D9 , WkDfVrT3N09D1 , & + WkDfVrT3N09D2 , WkDfVrT3N09D3 , WkDfVrT3N09D4 , WkDfVrT3N09D5 , WkDfVrT3N09D6 , WkDfVrT3N09D7 , WkDfVrT3N09D8 , WkDfVrT3N09D9 , & + WkDfVrT3N10D1 , WkDfVrT3N10D2 , WkDfVrT3N10D3 , WkDfVrT3N10D4 , WkDfVrT3N10D5 , WkDfVrT3N10D6 , WkDfVrT3N10D7 , WkDfVrT3N10D8 , & + WkDfVrT3N10D9 , WkDfVrT3N11D1 , WkDfVrT3N11D2 , WkDfVrT3N11D3 , WkDfVrT3N11D4 , WkDfVrT3N11D5 , WkDfVrT3N11D6 , WkDfVrT3N11D7 , & + WkDfVrT3N11D8 , WkDfVrT3N11D9 , WkDfVrT3N12D1 , WkDfVrT3N12D2 , WkDfVrT3N12D3 , WkDfVrT3N12D4 , WkDfVrT3N12D5 , WkDfVrT3N12D6 , & + WkDfVrT3N12D7 , WkDfVrT3N12D8 , WkDfVrT3N12D9 , WkDfVrT3N13D1 , WkDfVrT3N13D2 , WkDfVrT3N13D3 , WkDfVrT3N13D4 , WkDfVrT3N13D5 , & + WkDfVrT3N13D6 , WkDfVrT3N13D7 , WkDfVrT3N13D8 , WkDfVrT3N13D9 , WkDfVrT3N14D1 , WkDfVrT3N14D2 , WkDfVrT3N14D3 , WkDfVrT3N14D4 , & + WkDfVrT3N14D5 , WkDfVrT3N14D6 , WkDfVrT3N14D7 , WkDfVrT3N14D8 , WkDfVrT3N14D9 , WkDfVrT3N15D1 , WkDfVrT3N15D2 , WkDfVrT3N15D3 , & + WkDfVrT3N15D4 , WkDfVrT3N15D5 , WkDfVrT3N15D6 , WkDfVrT3N15D7 , WkDfVrT3N15D8 , WkDfVrT3N15D9 , WkDfVrT3N16D1 , WkDfVrT3N16D2 , & + WkDfVrT3N16D3 , WkDfVrT3N16D4 , WkDfVrT3N16D5 , WkDfVrT3N16D6 , WkDfVrT3N16D7 , WkDfVrT3N16D8 , WkDfVrT3N16D9 , WkDfVrT3N17D1 , & + WkDfVrT3N17D2 , WkDfVrT3N17D3 , WkDfVrT3N17D4 , WkDfVrT3N17D5 , WkDfVrT3N17D6 , WkDfVrT3N17D7 , WkDfVrT3N17D8 , WkDfVrT3N17D9 /) + ParamIndxAry(6121:8160) = (/ & + WkDfVrT3N18D1 , WkDfVrT3N18D2 , WkDfVrT3N18D3 , WkDfVrT3N18D4 , WkDfVrT3N18D5 , WkDfVrT3N18D6 , WkDfVrT3N18D7 , WkDfVrT3N18D8 , & + WkDfVrT3N18D9 , WkDfVrT3N19D1 , WkDfVrT3N19D2 , WkDfVrT3N19D3 , WkDfVrT3N19D4 , WkDfVrT3N19D5 , WkDfVrT3N19D6 , WkDfVrT3N19D7 , & + WkDfVrT3N19D8 , WkDfVrT3N19D9 , WkDfVrT3N20D1 , WkDfVrT3N20D2 , WkDfVrT3N20D3 , WkDfVrT3N20D4 , WkDfVrT3N20D5 , WkDfVrT3N20D6 , & + WkDfVrT3N20D7 , WkDfVrT3N20D8 , WkDfVrT3N20D9 , WkDfVrT4N01D1 , WkDfVrT4N01D2 , WkDfVrT4N01D3 , WkDfVrT4N01D4 , WkDfVrT4N01D5 , & + WkDfVrT4N01D6 , WkDfVrT4N01D7 , WkDfVrT4N01D8 , WkDfVrT4N01D9 , WkDfVrT4N02D1 , WkDfVrT4N02D2 , WkDfVrT4N02D3 , WkDfVrT4N02D4 , & + WkDfVrT4N02D5 , WkDfVrT4N02D6 , WkDfVrT4N02D7 , WkDfVrT4N02D8 , WkDfVrT4N02D9 , WkDfVrT4N03D1 , WkDfVrT4N03D2 , WkDfVrT4N03D3 , & + WkDfVrT4N03D4 , WkDfVrT4N03D5 , WkDfVrT4N03D6 , WkDfVrT4N03D7 , WkDfVrT4N03D8 , WkDfVrT4N03D9 , WkDfVrT4N04D1 , WkDfVrT4N04D2 , & + WkDfVrT4N04D3 , WkDfVrT4N04D4 , WkDfVrT4N04D5 , WkDfVrT4N04D6 , WkDfVrT4N04D7 , WkDfVrT4N04D8 , WkDfVrT4N04D9 , WkDfVrT4N05D1 , & + WkDfVrT4N05D2 , WkDfVrT4N05D3 , WkDfVrT4N05D4 , WkDfVrT4N05D5 , WkDfVrT4N05D6 , WkDfVrT4N05D7 , WkDfVrT4N05D8 , WkDfVrT4N05D9 , & + WkDfVrT4N06D1 , WkDfVrT4N06D2 , WkDfVrT4N06D3 , WkDfVrT4N06D4 , WkDfVrT4N06D5 , WkDfVrT4N06D6 , WkDfVrT4N06D7 , WkDfVrT4N06D8 , & + WkDfVrT4N06D9 , WkDfVrT4N07D1 , WkDfVrT4N07D2 , WkDfVrT4N07D3 , WkDfVrT4N07D4 , WkDfVrT4N07D5 , WkDfVrT4N07D6 , WkDfVrT4N07D7 , & + WkDfVrT4N07D8 , WkDfVrT4N07D9 , WkDfVrT4N08D1 , WkDfVrT4N08D2 , WkDfVrT4N08D3 , WkDfVrT4N08D4 , WkDfVrT4N08D5 , WkDfVrT4N08D6 , & + WkDfVrT4N08D7 , WkDfVrT4N08D8 , WkDfVrT4N08D9 , WkDfVrT4N09D1 , WkDfVrT4N09D2 , WkDfVrT4N09D3 , WkDfVrT4N09D4 , WkDfVrT4N09D5 , & + WkDfVrT4N09D6 , WkDfVrT4N09D7 , WkDfVrT4N09D8 , WkDfVrT4N09D9 , WkDfVrT4N10D1 , WkDfVrT4N10D2 , WkDfVrT4N10D3 , WkDfVrT4N10D4 , & + WkDfVrT4N10D5 , WkDfVrT4N10D6 , WkDfVrT4N10D7 , WkDfVrT4N10D8 , WkDfVrT4N10D9 , WkDfVrT4N11D1 , WkDfVrT4N11D2 , WkDfVrT4N11D3 , & + WkDfVrT4N11D4 , WkDfVrT4N11D5 , WkDfVrT4N11D6 , WkDfVrT4N11D7 , WkDfVrT4N11D8 , WkDfVrT4N11D9 , WkDfVrT4N12D1 , WkDfVrT4N12D2 , & + WkDfVrT4N12D3 , WkDfVrT4N12D4 , WkDfVrT4N12D5 , WkDfVrT4N12D6 , WkDfVrT4N12D7 , WkDfVrT4N12D8 , WkDfVrT4N12D9 , WkDfVrT4N13D1 , & + WkDfVrT4N13D2 , WkDfVrT4N13D3 , WkDfVrT4N13D4 , WkDfVrT4N13D5 , WkDfVrT4N13D6 , WkDfVrT4N13D7 , WkDfVrT4N13D8 , WkDfVrT4N13D9 , & + WkDfVrT4N14D1 , WkDfVrT4N14D2 , WkDfVrT4N14D3 , WkDfVrT4N14D4 , WkDfVrT4N14D5 , WkDfVrT4N14D6 , WkDfVrT4N14D7 , WkDfVrT4N14D8 , & + WkDfVrT4N14D9 , WkDfVrT4N15D1 , WkDfVrT4N15D2 , WkDfVrT4N15D3 , WkDfVrT4N15D4 , WkDfVrT4N15D5 , WkDfVrT4N15D6 , WkDfVrT4N15D7 , & + WkDfVrT4N15D8 , WkDfVrT4N15D9 , WkDfVrT4N16D1 , WkDfVrT4N16D2 , WkDfVrT4N16D3 , WkDfVrT4N16D4 , WkDfVrT4N16D5 , WkDfVrT4N16D6 , & + WkDfVrT4N16D7 , WkDfVrT4N16D8 , WkDfVrT4N16D9 , WkDfVrT4N17D1 , WkDfVrT4N17D2 , WkDfVrT4N17D3 , WkDfVrT4N17D4 , WkDfVrT4N17D5 , & + WkDfVrT4N17D6 , WkDfVrT4N17D7 , WkDfVrT4N17D8 , WkDfVrT4N17D9 , WkDfVrT4N18D1 , WkDfVrT4N18D2 , WkDfVrT4N18D3 , WkDfVrT4N18D4 , & + WkDfVrT4N18D5 , WkDfVrT4N18D6 , WkDfVrT4N18D7 , WkDfVrT4N18D8 , WkDfVrT4N18D9 , WkDfVrT4N19D1 , WkDfVrT4N19D2 , WkDfVrT4N19D3 , & + WkDfVrT4N19D4 , WkDfVrT4N19D5 , WkDfVrT4N19D6 , WkDfVrT4N19D7 , WkDfVrT4N19D8 , WkDfVrT4N19D9 , WkDfVrT4N20D1 , WkDfVrT4N20D2 , & + WkDfVrT4N20D3 , WkDfVrT4N20D4 , WkDfVrT4N20D5 , WkDfVrT4N20D6 , WkDfVrT4N20D7 , WkDfVrT4N20D8 , WkDfVrT4N20D9 , WkDfVrT5N01D1 , & + WkDfVrT5N01D2 , WkDfVrT5N01D3 , WkDfVrT5N01D4 , WkDfVrT5N01D5 , WkDfVrT5N01D6 , WkDfVrT5N01D7 , WkDfVrT5N01D8 , WkDfVrT5N01D9 , & + WkDfVrT5N02D1 , WkDfVrT5N02D2 , WkDfVrT5N02D3 , WkDfVrT5N02D4 , WkDfVrT5N02D5 , WkDfVrT5N02D6 , WkDfVrT5N02D7 , WkDfVrT5N02D8 , & + WkDfVrT5N02D9 , WkDfVrT5N03D1 , WkDfVrT5N03D2 , WkDfVrT5N03D3 , WkDfVrT5N03D4 , WkDfVrT5N03D5 , WkDfVrT5N03D6 , WkDfVrT5N03D7 , & + WkDfVrT5N03D8 , WkDfVrT5N03D9 , WkDfVrT5N04D1 , WkDfVrT5N04D2 , WkDfVrT5N04D3 , WkDfVrT5N04D4 , WkDfVrT5N04D5 , WkDfVrT5N04D6 , & + WkDfVrT5N04D7 , WkDfVrT5N04D8 , WkDfVrT5N04D9 , WkDfVrT5N05D1 , WkDfVrT5N05D2 , WkDfVrT5N05D3 , WkDfVrT5N05D4 , WkDfVrT5N05D5 , & + WkDfVrT5N05D6 , WkDfVrT5N05D7 , WkDfVrT5N05D8 , WkDfVrT5N05D9 , WkDfVrT5N06D1 , WkDfVrT5N06D2 , WkDfVrT5N06D3 , WkDfVrT5N06D4 , & + WkDfVrT5N06D5 , WkDfVrT5N06D6 , WkDfVrT5N06D7 , WkDfVrT5N06D8 , WkDfVrT5N06D9 , WkDfVrT5N07D1 , WkDfVrT5N07D2 , WkDfVrT5N07D3 , & + WkDfVrT5N07D4 , WkDfVrT5N07D5 , WkDfVrT5N07D6 , WkDfVrT5N07D7 , WkDfVrT5N07D8 , WkDfVrT5N07D9 , WkDfVrT5N08D1 , WkDfVrT5N08D2 , & + WkDfVrT5N08D3 , WkDfVrT5N08D4 , WkDfVrT5N08D5 , WkDfVrT5N08D6 , WkDfVrT5N08D7 , WkDfVrT5N08D8 , WkDfVrT5N08D9 , WkDfVrT5N09D1 , & + WkDfVrT5N09D2 , WkDfVrT5N09D3 , WkDfVrT5N09D4 , WkDfVrT5N09D5 , WkDfVrT5N09D6 , WkDfVrT5N09D7 , WkDfVrT5N09D8 , WkDfVrT5N09D9 , & + WkDfVrT5N10D1 , WkDfVrT5N10D2 , WkDfVrT5N10D3 , WkDfVrT5N10D4 , WkDfVrT5N10D5 , WkDfVrT5N10D6 , WkDfVrT5N10D7 , WkDfVrT5N10D8 , & + WkDfVrT5N10D9 , WkDfVrT5N11D1 , WkDfVrT5N11D2 , WkDfVrT5N11D3 , WkDfVrT5N11D4 , WkDfVrT5N11D5 , WkDfVrT5N11D6 , WkDfVrT5N11D7 , & + WkDfVrT5N11D8 , WkDfVrT5N11D9 , WkDfVrT5N12D1 , WkDfVrT5N12D2 , WkDfVrT5N12D3 , WkDfVrT5N12D4 , WkDfVrT5N12D5 , WkDfVrT5N12D6 , & + WkDfVrT5N12D7 , WkDfVrT5N12D8 , WkDfVrT5N12D9 , WkDfVrT5N13D1 , WkDfVrT5N13D2 , WkDfVrT5N13D3 , WkDfVrT5N13D4 , WkDfVrT5N13D5 , & + WkDfVrT5N13D6 , WkDfVrT5N13D7 , WkDfVrT5N13D8 , WkDfVrT5N13D9 , WkDfVrT5N14D1 , WkDfVrT5N14D2 , WkDfVrT5N14D3 , WkDfVrT5N14D4 , & + WkDfVrT5N14D5 , WkDfVrT5N14D6 , WkDfVrT5N14D7 , WkDfVrT5N14D8 , WkDfVrT5N14D9 , WkDfVrT5N15D1 , WkDfVrT5N15D2 , WkDfVrT5N15D3 , & + WkDfVrT5N15D4 , WkDfVrT5N15D5 , WkDfVrT5N15D6 , WkDfVrT5N15D7 , WkDfVrT5N15D8 , WkDfVrT5N15D9 , WkDfVrT5N16D1 , WkDfVrT5N16D2 , & + WkDfVrT5N16D3 , WkDfVrT5N16D4 , WkDfVrT5N16D5 , WkDfVrT5N16D6 , WkDfVrT5N16D7 , WkDfVrT5N16D8 , WkDfVrT5N16D9 , WkDfVrT5N17D1 , & + WkDfVrT5N17D2 , WkDfVrT5N17D3 , WkDfVrT5N17D4 , WkDfVrT5N17D5 , WkDfVrT5N17D6 , WkDfVrT5N17D7 , WkDfVrT5N17D8 , WkDfVrT5N17D9 , & + WkDfVrT5N18D1 , WkDfVrT5N18D2 , WkDfVrT5N18D3 , WkDfVrT5N18D4 , WkDfVrT5N18D5 , WkDfVrT5N18D6 , WkDfVrT5N18D7 , WkDfVrT5N18D8 , & + WkDfVrT5N18D9 , WkDfVrT5N19D1 , WkDfVrT5N19D2 , WkDfVrT5N19D3 , WkDfVrT5N19D4 , WkDfVrT5N19D5 , WkDfVrT5N19D6 , WkDfVrT5N19D7 , & + WkDfVrT5N19D8 , WkDfVrT5N19D9 , WkDfVrT5N20D1 , WkDfVrT5N20D2 , WkDfVrT5N20D3 , WkDfVrT5N20D4 , WkDfVrT5N20D5 , WkDfVrT5N20D6 , & + WkDfVrT5N20D7 , WkDfVrT5N20D8 , WkDfVrT5N20D9 , WkDfVrT6N01D1 , WkDfVrT6N01D2 , WkDfVrT6N01D3 , WkDfVrT6N01D4 , WkDfVrT6N01D5 , & + WkDfVrT6N01D6 , WkDfVrT6N01D7 , WkDfVrT6N01D8 , WkDfVrT6N01D9 , WkDfVrT6N02D1 , WkDfVrT6N02D2 , WkDfVrT6N02D3 , WkDfVrT6N02D4 , & + WkDfVrT6N02D5 , WkDfVrT6N02D6 , WkDfVrT6N02D7 , WkDfVrT6N02D8 , WkDfVrT6N02D9 , WkDfVrT6N03D1 , WkDfVrT6N03D2 , WkDfVrT6N03D3 , & + WkDfVrT6N03D4 , WkDfVrT6N03D5 , WkDfVrT6N03D6 , WkDfVrT6N03D7 , WkDfVrT6N03D8 , WkDfVrT6N03D9 , WkDfVrT6N04D1 , WkDfVrT6N04D2 , & + WkDfVrT6N04D3 , WkDfVrT6N04D4 , WkDfVrT6N04D5 , WkDfVrT6N04D6 , WkDfVrT6N04D7 , WkDfVrT6N04D8 , WkDfVrT6N04D9 , WkDfVrT6N05D1 , & + WkDfVrT6N05D2 , WkDfVrT6N05D3 , WkDfVrT6N05D4 , WkDfVrT6N05D5 , WkDfVrT6N05D6 , WkDfVrT6N05D7 , WkDfVrT6N05D8 , WkDfVrT6N05D9 , & + WkDfVrT6N06D1 , WkDfVrT6N06D2 , WkDfVrT6N06D3 , WkDfVrT6N06D4 , WkDfVrT6N06D5 , WkDfVrT6N06D6 , WkDfVrT6N06D7 , WkDfVrT6N06D8 , & + WkDfVrT6N06D9 , WkDfVrT6N07D1 , WkDfVrT6N07D2 , WkDfVrT6N07D3 , WkDfVrT6N07D4 , WkDfVrT6N07D5 , WkDfVrT6N07D6 , WkDfVrT6N07D7 , & + WkDfVrT6N07D8 , WkDfVrT6N07D9 , WkDfVrT6N08D1 , WkDfVrT6N08D2 , WkDfVrT6N08D3 , WkDfVrT6N08D4 , WkDfVrT6N08D5 , WkDfVrT6N08D6 , & + WkDfVrT6N08D7 , WkDfVrT6N08D8 , WkDfVrT6N08D9 , WkDfVrT6N09D1 , WkDfVrT6N09D2 , WkDfVrT6N09D3 , WkDfVrT6N09D4 , WkDfVrT6N09D5 , & + WkDfVrT6N09D6 , WkDfVrT6N09D7 , WkDfVrT6N09D8 , WkDfVrT6N09D9 , WkDfVrT6N10D1 , WkDfVrT6N10D2 , WkDfVrT6N10D3 , WkDfVrT6N10D4 , & + WkDfVrT6N10D5 , WkDfVrT6N10D6 , WkDfVrT6N10D7 , WkDfVrT6N10D8 , WkDfVrT6N10D9 , WkDfVrT6N11D1 , WkDfVrT6N11D2 , WkDfVrT6N11D3 , & + WkDfVrT6N11D4 , WkDfVrT6N11D5 , WkDfVrT6N11D6 , WkDfVrT6N11D7 , WkDfVrT6N11D8 , WkDfVrT6N11D9 , WkDfVrT6N12D1 , WkDfVrT6N12D2 , & + WkDfVrT6N12D3 , WkDfVrT6N12D4 , WkDfVrT6N12D5 , WkDfVrT6N12D6 , WkDfVrT6N12D7 , WkDfVrT6N12D8 , WkDfVrT6N12D9 , WkDfVrT6N13D1 , & + WkDfVrT6N13D2 , WkDfVrT6N13D3 , WkDfVrT6N13D4 , WkDfVrT6N13D5 , WkDfVrT6N13D6 , WkDfVrT6N13D7 , WkDfVrT6N13D8 , WkDfVrT6N13D9 , & + WkDfVrT6N14D1 , WkDfVrT6N14D2 , WkDfVrT6N14D3 , WkDfVrT6N14D4 , WkDfVrT6N14D5 , WkDfVrT6N14D6 , WkDfVrT6N14D7 , WkDfVrT6N14D8 , & + WkDfVrT6N14D9 , WkDfVrT6N15D1 , WkDfVrT6N15D2 , WkDfVrT6N15D3 , WkDfVrT6N15D4 , WkDfVrT6N15D5 , WkDfVrT6N15D6 , WkDfVrT6N15D7 , & + WkDfVrT6N15D8 , WkDfVrT6N15D9 , WkDfVrT6N16D1 , WkDfVrT6N16D2 , WkDfVrT6N16D3 , WkDfVrT6N16D4 , WkDfVrT6N16D5 , WkDfVrT6N16D6 , & + WkDfVrT6N16D7 , WkDfVrT6N16D8 , WkDfVrT6N16D9 , WkDfVrT6N17D1 , WkDfVrT6N17D2 , WkDfVrT6N17D3 , WkDfVrT6N17D4 , WkDfVrT6N17D5 , & + WkDfVrT6N17D6 , WkDfVrT6N17D7 , WkDfVrT6N17D8 , WkDfVrT6N17D9 , WkDfVrT6N18D1 , WkDfVrT6N18D2 , WkDfVrT6N18D3 , WkDfVrT6N18D4 , & + WkDfVrT6N18D5 , WkDfVrT6N18D6 , WkDfVrT6N18D7 , WkDfVrT6N18D8 , WkDfVrT6N18D9 , WkDfVrT6N19D1 , WkDfVrT6N19D2 , WkDfVrT6N19D3 , & + WkDfVrT6N19D4 , WkDfVrT6N19D5 , WkDfVrT6N19D6 , WkDfVrT6N19D7 , WkDfVrT6N19D8 , WkDfVrT6N19D9 , WkDfVrT6N20D1 , WkDfVrT6N20D2 , & + WkDfVrT6N20D3 , WkDfVrT6N20D4 , WkDfVrT6N20D5 , WkDfVrT6N20D6 , WkDfVrT6N20D7 , WkDfVrT6N20D8 , WkDfVrT6N20D9 , WkDfVrT7N01D1 , & + WkDfVrT7N01D2 , WkDfVrT7N01D3 , WkDfVrT7N01D4 , WkDfVrT7N01D5 , WkDfVrT7N01D6 , WkDfVrT7N01D7 , WkDfVrT7N01D8 , WkDfVrT7N01D9 , & + WkDfVrT7N02D1 , WkDfVrT7N02D2 , WkDfVrT7N02D3 , WkDfVrT7N02D4 , WkDfVrT7N02D5 , WkDfVrT7N02D6 , WkDfVrT7N02D7 , WkDfVrT7N02D8 , & + WkDfVrT7N02D9 , WkDfVrT7N03D1 , WkDfVrT7N03D2 , WkDfVrT7N03D3 , WkDfVrT7N03D4 , WkDfVrT7N03D5 , WkDfVrT7N03D6 , WkDfVrT7N03D7 , & + WkDfVrT7N03D8 , WkDfVrT7N03D9 , WkDfVrT7N04D1 , WkDfVrT7N04D2 , WkDfVrT7N04D3 , WkDfVrT7N04D4 , WkDfVrT7N04D5 , WkDfVrT7N04D6 , & + WkDfVrT7N04D7 , WkDfVrT7N04D8 , WkDfVrT7N04D9 , WkDfVrT7N05D1 , WkDfVrT7N05D2 , WkDfVrT7N05D3 , WkDfVrT7N05D4 , WkDfVrT7N05D5 , & + WkDfVrT7N05D6 , WkDfVrT7N05D7 , WkDfVrT7N05D8 , WkDfVrT7N05D9 , WkDfVrT7N06D1 , WkDfVrT7N06D2 , WkDfVrT7N06D3 , WkDfVrT7N06D4 , & + WkDfVrT7N06D5 , WkDfVrT7N06D6 , WkDfVrT7N06D7 , WkDfVrT7N06D8 , WkDfVrT7N06D9 , WkDfVrT7N07D1 , WkDfVrT7N07D2 , WkDfVrT7N07D3 , & + WkDfVrT7N07D4 , WkDfVrT7N07D5 , WkDfVrT7N07D6 , WkDfVrT7N07D7 , WkDfVrT7N07D8 , WkDfVrT7N07D9 , WkDfVrT7N08D1 , WkDfVrT7N08D2 , & + WkDfVrT7N08D3 , WkDfVrT7N08D4 , WkDfVrT7N08D5 , WkDfVrT7N08D6 , WkDfVrT7N08D7 , WkDfVrT7N08D8 , WkDfVrT7N08D9 , WkDfVrT7N09D1 , & + WkDfVrT7N09D2 , WkDfVrT7N09D3 , WkDfVrT7N09D4 , WkDfVrT7N09D5 , WkDfVrT7N09D6 , WkDfVrT7N09D7 , WkDfVrT7N09D8 , WkDfVrT7N09D9 , & + WkDfVrT7N10D1 , WkDfVrT7N10D2 , WkDfVrT7N10D3 , WkDfVrT7N10D4 , WkDfVrT7N10D5 , WkDfVrT7N10D6 , WkDfVrT7N10D7 , WkDfVrT7N10D8 , & + WkDfVrT7N10D9 , WkDfVrT7N11D1 , WkDfVrT7N11D2 , WkDfVrT7N11D3 , WkDfVrT7N11D4 , WkDfVrT7N11D5 , WkDfVrT7N11D6 , WkDfVrT7N11D7 , & + WkDfVrT7N11D8 , WkDfVrT7N11D9 , WkDfVrT7N12D1 , WkDfVrT7N12D2 , WkDfVrT7N12D3 , WkDfVrT7N12D4 , WkDfVrT7N12D5 , WkDfVrT7N12D6 , & + WkDfVrT7N12D7 , WkDfVrT7N12D8 , WkDfVrT7N12D9 , WkDfVrT7N13D1 , WkDfVrT7N13D2 , WkDfVrT7N13D3 , WkDfVrT7N13D4 , WkDfVrT7N13D5 , & + WkDfVrT7N13D6 , WkDfVrT7N13D7 , WkDfVrT7N13D8 , WkDfVrT7N13D9 , WkDfVrT7N14D1 , WkDfVrT7N14D2 , WkDfVrT7N14D3 , WkDfVrT7N14D4 , & + WkDfVrT7N14D5 , WkDfVrT7N14D6 , WkDfVrT7N14D7 , WkDfVrT7N14D8 , WkDfVrT7N14D9 , WkDfVrT7N15D1 , WkDfVrT7N15D2 , WkDfVrT7N15D3 , & + WkDfVrT7N15D4 , WkDfVrT7N15D5 , WkDfVrT7N15D6 , WkDfVrT7N15D7 , WkDfVrT7N15D8 , WkDfVrT7N15D9 , WkDfVrT7N16D1 , WkDfVrT7N16D2 , & + WkDfVrT7N16D3 , WkDfVrT7N16D4 , WkDfVrT7N16D5 , WkDfVrT7N16D6 , WkDfVrT7N16D7 , WkDfVrT7N16D8 , WkDfVrT7N16D9 , WkDfVrT7N17D1 , & + WkDfVrT7N17D2 , WkDfVrT7N17D3 , WkDfVrT7N17D4 , WkDfVrT7N17D5 , WkDfVrT7N17D6 , WkDfVrT7N17D7 , WkDfVrT7N17D8 , WkDfVrT7N17D9 , & + WkDfVrT7N18D1 , WkDfVrT7N18D2 , WkDfVrT7N18D3 , WkDfVrT7N18D4 , WkDfVrT7N18D5 , WkDfVrT7N18D6 , WkDfVrT7N18D7 , WkDfVrT7N18D8 , & + WkDfVrT7N18D9 , WkDfVrT7N19D1 , WkDfVrT7N19D2 , WkDfVrT7N19D3 , WkDfVrT7N19D4 , WkDfVrT7N19D5 , WkDfVrT7N19D6 , WkDfVrT7N19D7 , & + WkDfVrT7N19D8 , WkDfVrT7N19D9 , WkDfVrT7N20D1 , WkDfVrT7N20D2 , WkDfVrT7N20D3 , WkDfVrT7N20D4 , WkDfVrT7N20D5 , WkDfVrT7N20D6 , & + WkDfVrT7N20D7 , WkDfVrT7N20D8 , WkDfVrT7N20D9 , WkDfVrT8N01D1 , WkDfVrT8N01D2 , WkDfVrT8N01D3 , WkDfVrT8N01D4 , WkDfVrT8N01D5 , & + WkDfVrT8N01D6 , WkDfVrT8N01D7 , WkDfVrT8N01D8 , WkDfVrT8N01D9 , WkDfVrT8N02D1 , WkDfVrT8N02D2 , WkDfVrT8N02D3 , WkDfVrT8N02D4 , & + WkDfVrT8N02D5 , WkDfVrT8N02D6 , WkDfVrT8N02D7 , WkDfVrT8N02D8 , WkDfVrT8N02D9 , WkDfVrT8N03D1 , WkDfVrT8N03D2 , WkDfVrT8N03D3 , & + WkDfVrT8N03D4 , WkDfVrT8N03D5 , WkDfVrT8N03D6 , WkDfVrT8N03D7 , WkDfVrT8N03D8 , WkDfVrT8N03D9 , WkDfVrT8N04D1 , WkDfVrT8N04D2 , & + WkDfVrT8N04D3 , WkDfVrT8N04D4 , WkDfVrT8N04D5 , WkDfVrT8N04D6 , WkDfVrT8N04D7 , WkDfVrT8N04D8 , WkDfVrT8N04D9 , WkDfVrT8N05D1 , & + WkDfVrT8N05D2 , WkDfVrT8N05D3 , WkDfVrT8N05D4 , WkDfVrT8N05D5 , WkDfVrT8N05D6 , WkDfVrT8N05D7 , WkDfVrT8N05D8 , WkDfVrT8N05D9 , & + WkDfVrT8N06D1 , WkDfVrT8N06D2 , WkDfVrT8N06D3 , WkDfVrT8N06D4 , WkDfVrT8N06D5 , WkDfVrT8N06D6 , WkDfVrT8N06D7 , WkDfVrT8N06D8 , & + WkDfVrT8N06D9 , WkDfVrT8N07D1 , WkDfVrT8N07D2 , WkDfVrT8N07D3 , WkDfVrT8N07D4 , WkDfVrT8N07D5 , WkDfVrT8N07D6 , WkDfVrT8N07D7 , & + WkDfVrT8N07D8 , WkDfVrT8N07D9 , WkDfVrT8N08D1 , WkDfVrT8N08D2 , WkDfVrT8N08D3 , WkDfVrT8N08D4 , WkDfVrT8N08D5 , WkDfVrT8N08D6 , & + WkDfVrT8N08D7 , WkDfVrT8N08D8 , WkDfVrT8N08D9 , WkDfVrT8N09D1 , WkDfVrT8N09D2 , WkDfVrT8N09D3 , WkDfVrT8N09D4 , WkDfVrT8N09D5 , & + WkDfVrT8N09D6 , WkDfVrT8N09D7 , WkDfVrT8N09D8 , WkDfVrT8N09D9 , WkDfVrT8N10D1 , WkDfVrT8N10D2 , WkDfVrT8N10D3 , WkDfVrT8N10D4 , & + WkDfVrT8N10D5 , WkDfVrT8N10D6 , WkDfVrT8N10D7 , WkDfVrT8N10D8 , WkDfVrT8N10D9 , WkDfVrT8N11D1 , WkDfVrT8N11D2 , WkDfVrT8N11D3 , & + WkDfVrT8N11D4 , WkDfVrT8N11D5 , WkDfVrT8N11D6 , WkDfVrT8N11D7 , WkDfVrT8N11D8 , WkDfVrT8N11D9 , WkDfVrT8N12D1 , WkDfVrT8N12D2 , & + WkDfVrT8N12D3 , WkDfVrT8N12D4 , WkDfVrT8N12D5 , WkDfVrT8N12D6 , WkDfVrT8N12D7 , WkDfVrT8N12D8 , WkDfVrT8N12D9 , WkDfVrT8N13D1 , & + WkDfVrT8N13D2 , WkDfVrT8N13D3 , WkDfVrT8N13D4 , WkDfVrT8N13D5 , WkDfVrT8N13D6 , WkDfVrT8N13D7 , WkDfVrT8N13D8 , WkDfVrT8N13D9 , & + WkDfVrT8N14D1 , WkDfVrT8N14D2 , WkDfVrT8N14D3 , WkDfVrT8N14D4 , WkDfVrT8N14D5 , WkDfVrT8N14D6 , WkDfVrT8N14D7 , WkDfVrT8N14D8 , & + WkDfVrT8N14D9 , WkDfVrT8N15D1 , WkDfVrT8N15D2 , WkDfVrT8N15D3 , WkDfVrT8N15D4 , WkDfVrT8N15D5 , WkDfVrT8N15D6 , WkDfVrT8N15D7 , & + WkDfVrT8N15D8 , WkDfVrT8N15D9 , WkDfVrT8N16D1 , WkDfVrT8N16D2 , WkDfVrT8N16D3 , WkDfVrT8N16D4 , WkDfVrT8N16D5 , WkDfVrT8N16D6 , & + WkDfVrT8N16D7 , WkDfVrT8N16D8 , WkDfVrT8N16D9 , WkDfVrT8N17D1 , WkDfVrT8N17D2 , WkDfVrT8N17D3 , WkDfVrT8N17D4 , WkDfVrT8N17D5 , & + WkDfVrT8N17D6 , WkDfVrT8N17D7 , WkDfVrT8N17D8 , WkDfVrT8N17D9 , WkDfVrT8N18D1 , WkDfVrT8N18D2 , WkDfVrT8N18D3 , WkDfVrT8N18D4 , & + WkDfVrT8N18D5 , WkDfVrT8N18D6 , WkDfVrT8N18D7 , WkDfVrT8N18D8 , WkDfVrT8N18D9 , WkDfVrT8N19D1 , WkDfVrT8N19D2 , WkDfVrT8N19D3 , & + WkDfVrT8N19D4 , WkDfVrT8N19D5 , WkDfVrT8N19D6 , WkDfVrT8N19D7 , WkDfVrT8N19D8 , WkDfVrT8N19D9 , WkDfVrT8N20D1 , WkDfVrT8N20D2 , & + WkDfVrT8N20D3 , WkDfVrT8N20D4 , WkDfVrT8N20D5 , WkDfVrT8N20D6 , WkDfVrT8N20D7 , WkDfVrT8N20D8 , WkDfVrT8N20D9 , WkDfVrT9N01D1 , & + WkDfVrT9N01D2 , WkDfVrT9N01D3 , WkDfVrT9N01D4 , WkDfVrT9N01D5 , WkDfVrT9N01D6 , WkDfVrT9N01D7 , WkDfVrT9N01D8 , WkDfVrT9N01D9 , & + WkDfVrT9N02D1 , WkDfVrT9N02D2 , WkDfVrT9N02D3 , WkDfVrT9N02D4 , WkDfVrT9N02D5 , WkDfVrT9N02D6 , WkDfVrT9N02D7 , WkDfVrT9N02D8 , & + WkDfVrT9N02D9 , WkDfVrT9N03D1 , WkDfVrT9N03D2 , WkDfVrT9N03D3 , WkDfVrT9N03D4 , WkDfVrT9N03D5 , WkDfVrT9N03D6 , WkDfVrT9N03D7 , & + WkDfVrT9N03D8 , WkDfVrT9N03D9 , WkDfVrT9N04D1 , WkDfVrT9N04D2 , WkDfVrT9N04D3 , WkDfVrT9N04D4 , WkDfVrT9N04D5 , WkDfVrT9N04D6 , & + WkDfVrT9N04D7 , WkDfVrT9N04D8 , WkDfVrT9N04D9 , WkDfVrT9N05D1 , WkDfVrT9N05D2 , WkDfVrT9N05D3 , WkDfVrT9N05D4 , WkDfVrT9N05D5 , & + WkDfVrT9N05D6 , WkDfVrT9N05D7 , WkDfVrT9N05D8 , WkDfVrT9N05D9 , WkDfVrT9N06D1 , WkDfVrT9N06D2 , WkDfVrT9N06D3 , WkDfVrT9N06D4 , & + WkDfVrT9N06D5 , WkDfVrT9N06D6 , WkDfVrT9N06D7 , WkDfVrT9N06D8 , WkDfVrT9N06D9 , WkDfVrT9N07D1 , WkDfVrT9N07D2 , WkDfVrT9N07D3 , & + WkDfVrT9N07D4 , WkDfVrT9N07D5 , WkDfVrT9N07D6 , WkDfVrT9N07D7 , WkDfVrT9N07D8 , WkDfVrT9N07D9 , WkDfVrT9N08D1 , WkDfVrT9N08D2 , & + WkDfVrT9N08D3 , WkDfVrT9N08D4 , WkDfVrT9N08D5 , WkDfVrT9N08D6 , WkDfVrT9N08D7 , WkDfVrT9N08D8 , WkDfVrT9N08D9 , WkDfVrT9N09D1 , & + WkDfVrT9N09D2 , WkDfVrT9N09D3 , WkDfVrT9N09D4 , WkDfVrT9N09D5 , WkDfVrT9N09D6 , WkDfVrT9N09D7 , WkDfVrT9N09D8 , WkDfVrT9N09D9 , & + WkDfVrT9N10D1 , WkDfVrT9N10D2 , WkDfVrT9N10D3 , WkDfVrT9N10D4 , WkDfVrT9N10D5 , WkDfVrT9N10D6 , WkDfVrT9N10D7 , WkDfVrT9N10D8 , & + WkDfVrT9N10D9 , WkDfVrT9N11D1 , WkDfVrT9N11D2 , WkDfVrT9N11D3 , WkDfVrT9N11D4 , WkDfVrT9N11D5 , WkDfVrT9N11D6 , WkDfVrT9N11D7 , & + WkDfVrT9N11D8 , WkDfVrT9N11D9 , WkDfVrT9N12D1 , WkDfVrT9N12D2 , WkDfVrT9N12D3 , WkDfVrT9N12D4 , WkDfVrT9N12D5 , WkDfVrT9N12D6 , & + WkDfVrT9N12D7 , WkDfVrT9N12D8 , WkDfVrT9N12D9 , WkDfVrT9N13D1 , WkDfVrT9N13D2 , WkDfVrT9N13D3 , WkDfVrT9N13D4 , WkDfVrT9N13D5 , & + WkDfVrT9N13D6 , WkDfVrT9N13D7 , WkDfVrT9N13D8 , WkDfVrT9N13D9 , WkDfVrT9N14D1 , WkDfVrT9N14D2 , WkDfVrT9N14D3 , WkDfVrT9N14D4 , & + WkDfVrT9N14D5 , WkDfVrT9N14D6 , WkDfVrT9N14D7 , WkDfVrT9N14D8 , WkDfVrT9N14D9 , WkDfVrT9N15D1 , WkDfVrT9N15D2 , WkDfVrT9N15D3 , & + WkDfVrT9N15D4 , WkDfVrT9N15D5 , WkDfVrT9N15D6 , WkDfVrT9N15D7 , WkDfVrT9N15D8 , WkDfVrT9N15D9 , WkDfVrT9N16D1 , WkDfVrT9N16D2 , & + WkDfVrT9N16D3 , WkDfVrT9N16D4 , WkDfVrT9N16D5 , WkDfVrT9N16D6 , WkDfVrT9N16D7 , WkDfVrT9N16D8 , WkDfVrT9N16D9 , WkDfVrT9N17D1 , & + WkDfVrT9N17D2 , WkDfVrT9N17D3 , WkDfVrT9N17D4 , WkDfVrT9N17D5 , WkDfVrT9N17D6 , WkDfVrT9N17D7 , WkDfVrT9N17D8 , WkDfVrT9N17D9 , & + WkDfVrT9N18D1 , WkDfVrT9N18D2 , WkDfVrT9N18D3 , WkDfVrT9N18D4 , WkDfVrT9N18D5 , WkDfVrT9N18D6 , WkDfVrT9N18D7 , WkDfVrT9N18D8 , & + WkDfVrT9N18D9 , WkDfVrT9N19D1 , WkDfVrT9N19D2 , WkDfVrT9N19D3 , WkDfVrT9N19D4 , WkDfVrT9N19D5 , WkDfVrT9N19D6 , WkDfVrT9N19D7 , & + WkDfVrT9N19D8 , WkDfVrT9N19D9 , WkDfVrT9N20D1 , WkDfVrT9N20D2 , WkDfVrT9N20D3 , WkDfVrT9N20D4 , WkDfVrT9N20D5 , WkDfVrT9N20D6 , & + WkDfVrT9N20D7 , WkDfVrT9N20D8 , WkDfVrT9N20D9 , WkDfVxT1N01D1 , WkDfVxT1N01D2 , WkDfVxT1N01D3 , WkDfVxT1N01D4 , WkDfVxT1N01D5 , & + WkDfVxT1N01D6 , WkDfVxT1N01D7 , WkDfVxT1N01D8 , WkDfVxT1N01D9 , WkDfVxT1N02D1 , WkDfVxT1N02D2 , WkDfVxT1N02D3 , WkDfVxT1N02D4 , & + WkDfVxT1N02D5 , WkDfVxT1N02D6 , WkDfVxT1N02D7 , WkDfVxT1N02D8 , WkDfVxT1N02D9 , WkDfVxT1N03D1 , WkDfVxT1N03D2 , WkDfVxT1N03D3 , & + WkDfVxT1N03D4 , WkDfVxT1N03D5 , WkDfVxT1N03D6 , WkDfVxT1N03D7 , WkDfVxT1N03D8 , WkDfVxT1N03D9 , WkDfVxT1N04D1 , WkDfVxT1N04D2 , & + WkDfVxT1N04D3 , WkDfVxT1N04D4 , WkDfVxT1N04D5 , WkDfVxT1N04D6 , WkDfVxT1N04D7 , WkDfVxT1N04D8 , WkDfVxT1N04D9 , WkDfVxT1N05D1 , & + WkDfVxT1N05D2 , WkDfVxT1N05D3 , WkDfVxT1N05D4 , WkDfVxT1N05D5 , WkDfVxT1N05D6 , WkDfVxT1N05D7 , WkDfVxT1N05D8 , WkDfVxT1N05D9 , & + WkDfVxT1N06D1 , WkDfVxT1N06D2 , WkDfVxT1N06D3 , WkDfVxT1N06D4 , WkDfVxT1N06D5 , WkDfVxT1N06D6 , WkDfVxT1N06D7 , WkDfVxT1N06D8 , & + WkDfVxT1N06D9 , WkDfVxT1N07D1 , WkDfVxT1N07D2 , WkDfVxT1N07D3 , WkDfVxT1N07D4 , WkDfVxT1N07D5 , WkDfVxT1N07D6 , WkDfVxT1N07D7 , & + WkDfVxT1N07D8 , WkDfVxT1N07D9 , WkDfVxT1N08D1 , WkDfVxT1N08D2 , WkDfVxT1N08D3 , WkDfVxT1N08D4 , WkDfVxT1N08D5 , WkDfVxT1N08D6 , & + WkDfVxT1N08D7 , WkDfVxT1N08D8 , WkDfVxT1N08D9 , WkDfVxT1N09D1 , WkDfVxT1N09D2 , WkDfVxT1N09D3 , WkDfVxT1N09D4 , WkDfVxT1N09D5 , & + WkDfVxT1N09D6 , WkDfVxT1N09D7 , WkDfVxT1N09D8 , WkDfVxT1N09D9 , WkDfVxT1N10D1 , WkDfVxT1N10D2 , WkDfVxT1N10D3 , WkDfVxT1N10D4 , & + WkDfVxT1N10D5 , WkDfVxT1N10D6 , WkDfVxT1N10D7 , WkDfVxT1N10D8 , WkDfVxT1N10D9 , WkDfVxT1N11D1 , WkDfVxT1N11D2 , WkDfVxT1N11D3 , & + WkDfVxT1N11D4 , WkDfVxT1N11D5 , WkDfVxT1N11D6 , WkDfVxT1N11D7 , WkDfVxT1N11D8 , WkDfVxT1N11D9 , WkDfVxT1N12D1 , WkDfVxT1N12D2 , & + WkDfVxT1N12D3 , WkDfVxT1N12D4 , WkDfVxT1N12D5 , WkDfVxT1N12D6 , WkDfVxT1N12D7 , WkDfVxT1N12D8 , WkDfVxT1N12D9 , WkDfVxT1N13D1 , & + WkDfVxT1N13D2 , WkDfVxT1N13D3 , WkDfVxT1N13D4 , WkDfVxT1N13D5 , WkDfVxT1N13D6 , WkDfVxT1N13D7 , WkDfVxT1N13D8 , WkDfVxT1N13D9 , & + WkDfVxT1N14D1 , WkDfVxT1N14D2 , WkDfVxT1N14D3 , WkDfVxT1N14D4 , WkDfVxT1N14D5 , WkDfVxT1N14D6 , WkDfVxT1N14D7 , WkDfVxT1N14D8 , & + WkDfVxT1N14D9 , WkDfVxT1N15D1 , WkDfVxT1N15D2 , WkDfVxT1N15D3 , WkDfVxT1N15D4 , WkDfVxT1N15D5 , WkDfVxT1N15D6 , WkDfVxT1N15D7 , & + WkDfVxT1N15D8 , WkDfVxT1N15D9 , WkDfVxT1N16D1 , WkDfVxT1N16D2 , WkDfVxT1N16D3 , WkDfVxT1N16D4 , WkDfVxT1N16D5 , WkDfVxT1N16D6 , & + WkDfVxT1N16D7 , WkDfVxT1N16D8 , WkDfVxT1N16D9 , WkDfVxT1N17D1 , WkDfVxT1N17D2 , WkDfVxT1N17D3 , WkDfVxT1N17D4 , WkDfVxT1N17D5 , & + WkDfVxT1N17D6 , WkDfVxT1N17D7 , WkDfVxT1N17D8 , WkDfVxT1N17D9 , WkDfVxT1N18D1 , WkDfVxT1N18D2 , WkDfVxT1N18D3 , WkDfVxT1N18D4 , & + WkDfVxT1N18D5 , WkDfVxT1N18D6 , WkDfVxT1N18D7 , WkDfVxT1N18D8 , WkDfVxT1N18D9 , WkDfVxT1N19D1 , WkDfVxT1N19D2 , WkDfVxT1N19D3 , & + WkDfVxT1N19D4 , WkDfVxT1N19D5 , WkDfVxT1N19D6 , WkDfVxT1N19D7 , WkDfVxT1N19D8 , WkDfVxT1N19D9 , WkDfVxT1N20D1 , WkDfVxT1N20D2 , & + WkDfVxT1N20D3 , WkDfVxT1N20D4 , WkDfVxT1N20D5 , WkDfVxT1N20D6 , WkDfVxT1N20D7 , WkDfVxT1N20D8 , WkDfVxT1N20D9 , WkDfVxT2N01D1 , & + WkDfVxT2N01D2 , WkDfVxT2N01D3 , WkDfVxT2N01D4 , WkDfVxT2N01D5 , WkDfVxT2N01D6 , WkDfVxT2N01D7 , WkDfVxT2N01D8 , WkDfVxT2N01D9 , & + WkDfVxT2N02D1 , WkDfVxT2N02D2 , WkDfVxT2N02D3 , WkDfVxT2N02D4 , WkDfVxT2N02D5 , WkDfVxT2N02D6 , WkDfVxT2N02D7 , WkDfVxT2N02D8 , & + WkDfVxT2N02D9 , WkDfVxT2N03D1 , WkDfVxT2N03D2 , WkDfVxT2N03D3 , WkDfVxT2N03D4 , WkDfVxT2N03D5 , WkDfVxT2N03D6 , WkDfVxT2N03D7 , & + WkDfVxT2N03D8 , WkDfVxT2N03D9 , WkDfVxT2N04D1 , WkDfVxT2N04D2 , WkDfVxT2N04D3 , WkDfVxT2N04D4 , WkDfVxT2N04D5 , WkDfVxT2N04D6 , & + WkDfVxT2N04D7 , WkDfVxT2N04D8 , WkDfVxT2N04D9 , WkDfVxT2N05D1 , WkDfVxT2N05D2 , WkDfVxT2N05D3 , WkDfVxT2N05D4 , WkDfVxT2N05D5 , & + WkDfVxT2N05D6 , WkDfVxT2N05D7 , WkDfVxT2N05D8 , WkDfVxT2N05D9 , WkDfVxT2N06D1 , WkDfVxT2N06D2 , WkDfVxT2N06D3 , WkDfVxT2N06D4 , & + WkDfVxT2N06D5 , WkDfVxT2N06D6 , WkDfVxT2N06D7 , WkDfVxT2N06D8 , WkDfVxT2N06D9 , WkDfVxT2N07D1 , WkDfVxT2N07D2 , WkDfVxT2N07D3 , & + WkDfVxT2N07D4 , WkDfVxT2N07D5 , WkDfVxT2N07D6 , WkDfVxT2N07D7 , WkDfVxT2N07D8 , WkDfVxT2N07D9 , WkDfVxT2N08D1 , WkDfVxT2N08D2 , & + WkDfVxT2N08D3 , WkDfVxT2N08D4 , WkDfVxT2N08D5 , WkDfVxT2N08D6 , WkDfVxT2N08D7 , WkDfVxT2N08D8 , WkDfVxT2N08D9 , WkDfVxT2N09D1 , & + WkDfVxT2N09D2 , WkDfVxT2N09D3 , WkDfVxT2N09D4 , WkDfVxT2N09D5 , WkDfVxT2N09D6 , WkDfVxT2N09D7 , WkDfVxT2N09D8 , WkDfVxT2N09D9 , & + WkDfVxT2N10D1 , WkDfVxT2N10D2 , WkDfVxT2N10D3 , WkDfVxT2N10D4 , WkDfVxT2N10D5 , WkDfVxT2N10D6 , WkDfVxT2N10D7 , WkDfVxT2N10D8 , & + WkDfVxT2N10D9 , WkDfVxT2N11D1 , WkDfVxT2N11D2 , WkDfVxT2N11D3 , WkDfVxT2N11D4 , WkDfVxT2N11D5 , WkDfVxT2N11D6 , WkDfVxT2N11D7 , & + WkDfVxT2N11D8 , WkDfVxT2N11D9 , WkDfVxT2N12D1 , WkDfVxT2N12D2 , WkDfVxT2N12D3 , WkDfVxT2N12D4 , WkDfVxT2N12D5 , WkDfVxT2N12D6 , & + WkDfVxT2N12D7 , WkDfVxT2N12D8 , WkDfVxT2N12D9 , WkDfVxT2N13D1 , WkDfVxT2N13D2 , WkDfVxT2N13D3 , WkDfVxT2N13D4 , WkDfVxT2N13D5 , & + WkDfVxT2N13D6 , WkDfVxT2N13D7 , WkDfVxT2N13D8 , WkDfVxT2N13D9 , WkDfVxT2N14D1 , WkDfVxT2N14D2 , WkDfVxT2N14D3 , WkDfVxT2N14D4 , & + WkDfVxT2N14D5 , WkDfVxT2N14D6 , WkDfVxT2N14D7 , WkDfVxT2N14D8 , WkDfVxT2N14D9 , WkDfVxT2N15D1 , WkDfVxT2N15D2 , WkDfVxT2N15D3 , & + WkDfVxT2N15D4 , WkDfVxT2N15D5 , WkDfVxT2N15D6 , WkDfVxT2N15D7 , WkDfVxT2N15D8 , WkDfVxT2N15D9 , WkDfVxT2N16D1 , WkDfVxT2N16D2 , & + WkDfVxT2N16D3 , WkDfVxT2N16D4 , WkDfVxT2N16D5 , WkDfVxT2N16D6 , WkDfVxT2N16D7 , WkDfVxT2N16D8 , WkDfVxT2N16D9 , WkDfVxT2N17D1 , & + WkDfVxT2N17D2 , WkDfVxT2N17D3 , WkDfVxT2N17D4 , WkDfVxT2N17D5 , WkDfVxT2N17D6 , WkDfVxT2N17D7 , WkDfVxT2N17D8 , WkDfVxT2N17D9 , & + WkDfVxT2N18D1 , WkDfVxT2N18D2 , WkDfVxT2N18D3 , WkDfVxT2N18D4 , WkDfVxT2N18D5 , WkDfVxT2N18D6 , WkDfVxT2N18D7 , WkDfVxT2N18D8 , & + WkDfVxT2N18D9 , WkDfVxT2N19D1 , WkDfVxT2N19D2 , WkDfVxT2N19D3 , WkDfVxT2N19D4 , WkDfVxT2N19D5 , WkDfVxT2N19D6 , WkDfVxT2N19D7 , & + WkDfVxT2N19D8 , WkDfVxT2N19D9 , WkDfVxT2N20D1 , WkDfVxT2N20D2 , WkDfVxT2N20D3 , WkDfVxT2N20D4 , WkDfVxT2N20D5 , WkDfVxT2N20D6 , & + WkDfVxT2N20D7 , WkDfVxT2N20D8 , WkDfVxT2N20D9 , WkDfVxT3N01D1 , WkDfVxT3N01D2 , WkDfVxT3N01D3 , WkDfVxT3N01D4 , WkDfVxT3N01D5 , & + WkDfVxT3N01D6 , WkDfVxT3N01D7 , WkDfVxT3N01D8 , WkDfVxT3N01D9 , WkDfVxT3N02D1 , WkDfVxT3N02D2 , WkDfVxT3N02D3 , WkDfVxT3N02D4 , & + WkDfVxT3N02D5 , WkDfVxT3N02D6 , WkDfVxT3N02D7 , WkDfVxT3N02D8 , WkDfVxT3N02D9 , WkDfVxT3N03D1 , WkDfVxT3N03D2 , WkDfVxT3N03D3 , & + WkDfVxT3N03D4 , WkDfVxT3N03D5 , WkDfVxT3N03D6 , WkDfVxT3N03D7 , WkDfVxT3N03D8 , WkDfVxT3N03D9 , WkDfVxT3N04D1 , WkDfVxT3N04D2 , & + WkDfVxT3N04D3 , WkDfVxT3N04D4 , WkDfVxT3N04D5 , WkDfVxT3N04D6 , WkDfVxT3N04D7 , WkDfVxT3N04D8 , WkDfVxT3N04D9 , WkDfVxT3N05D1 , & + WkDfVxT3N05D2 , WkDfVxT3N05D3 , WkDfVxT3N05D4 , WkDfVxT3N05D5 , WkDfVxT3N05D6 , WkDfVxT3N05D7 , WkDfVxT3N05D8 , WkDfVxT3N05D9 , & + WkDfVxT3N06D1 , WkDfVxT3N06D2 , WkDfVxT3N06D3 , WkDfVxT3N06D4 , WkDfVxT3N06D5 , WkDfVxT3N06D6 , WkDfVxT3N06D7 , WkDfVxT3N06D8 , & + WkDfVxT3N06D9 , WkDfVxT3N07D1 , WkDfVxT3N07D2 , WkDfVxT3N07D3 , WkDfVxT3N07D4 , WkDfVxT3N07D5 , WkDfVxT3N07D6 , WkDfVxT3N07D7 , & + WkDfVxT3N07D8 , WkDfVxT3N07D9 , WkDfVxT3N08D1 , WkDfVxT3N08D2 , WkDfVxT3N08D3 , WkDfVxT3N08D4 , WkDfVxT3N08D5 , WkDfVxT3N08D6 , & + WkDfVxT3N08D7 , WkDfVxT3N08D8 , WkDfVxT3N08D9 , WkDfVxT3N09D1 , WkDfVxT3N09D2 , WkDfVxT3N09D3 , WkDfVxT3N09D4 , WkDfVxT3N09D5 , & + WkDfVxT3N09D6 , WkDfVxT3N09D7 , WkDfVxT3N09D8 , WkDfVxT3N09D9 , WkDfVxT3N10D1 , WkDfVxT3N10D2 , WkDfVxT3N10D3 , WkDfVxT3N10D4 , & + WkDfVxT3N10D5 , WkDfVxT3N10D6 , WkDfVxT3N10D7 , WkDfVxT3N10D8 , WkDfVxT3N10D9 , WkDfVxT3N11D1 , WkDfVxT3N11D2 , WkDfVxT3N11D3 , & + WkDfVxT3N11D4 , WkDfVxT3N11D5 , WkDfVxT3N11D6 , WkDfVxT3N11D7 , WkDfVxT3N11D8 , WkDfVxT3N11D9 , WkDfVxT3N12D1 , WkDfVxT3N12D2 , & + WkDfVxT3N12D3 , WkDfVxT3N12D4 , WkDfVxT3N12D5 , WkDfVxT3N12D6 , WkDfVxT3N12D7 , WkDfVxT3N12D8 , WkDfVxT3N12D9 , WkDfVxT3N13D1 , & + WkDfVxT3N13D2 , WkDfVxT3N13D3 , WkDfVxT3N13D4 , WkDfVxT3N13D5 , WkDfVxT3N13D6 , WkDfVxT3N13D7 , WkDfVxT3N13D8 , WkDfVxT3N13D9 , & + WkDfVxT3N14D1 , WkDfVxT3N14D2 , WkDfVxT3N14D3 , WkDfVxT3N14D4 , WkDfVxT3N14D5 , WkDfVxT3N14D6 , WkDfVxT3N14D7 , WkDfVxT3N14D8 , & + WkDfVxT3N14D9 , WkDfVxT3N15D1 , WkDfVxT3N15D2 , WkDfVxT3N15D3 , WkDfVxT3N15D4 , WkDfVxT3N15D5 , WkDfVxT3N15D6 , WkDfVxT3N15D7 , & + WkDfVxT3N15D8 , WkDfVxT3N15D9 , WkDfVxT3N16D1 , WkDfVxT3N16D2 , WkDfVxT3N16D3 , WkDfVxT3N16D4 , WkDfVxT3N16D5 , WkDfVxT3N16D6 , & + WkDfVxT3N16D7 , WkDfVxT3N16D8 , WkDfVxT3N16D9 , WkDfVxT3N17D1 , WkDfVxT3N17D2 , WkDfVxT3N17D3 , WkDfVxT3N17D4 , WkDfVxT3N17D5 , & + WkDfVxT3N17D6 , WkDfVxT3N17D7 , WkDfVxT3N17D8 , WkDfVxT3N17D9 , WkDfVxT3N18D1 , WkDfVxT3N18D2 , WkDfVxT3N18D3 , WkDfVxT3N18D4 , & + WkDfVxT3N18D5 , WkDfVxT3N18D6 , WkDfVxT3N18D7 , WkDfVxT3N18D8 , WkDfVxT3N18D9 , WkDfVxT3N19D1 , WkDfVxT3N19D2 , WkDfVxT3N19D3 , & + WkDfVxT3N19D4 , WkDfVxT3N19D5 , WkDfVxT3N19D6 , WkDfVxT3N19D7 , WkDfVxT3N19D8 , WkDfVxT3N19D9 , WkDfVxT3N20D1 , WkDfVxT3N20D2 , & + WkDfVxT3N20D3 , WkDfVxT3N20D4 , WkDfVxT3N20D5 , WkDfVxT3N20D6 , WkDfVxT3N20D7 , WkDfVxT3N20D8 , WkDfVxT3N20D9 , WkDfVxT4N01D1 , & + WkDfVxT4N01D2 , WkDfVxT4N01D3 , WkDfVxT4N01D4 , WkDfVxT4N01D5 , WkDfVxT4N01D6 , WkDfVxT4N01D7 , WkDfVxT4N01D8 , WkDfVxT4N01D9 , & + WkDfVxT4N02D1 , WkDfVxT4N02D2 , WkDfVxT4N02D3 , WkDfVxT4N02D4 , WkDfVxT4N02D5 , WkDfVxT4N02D6 , WkDfVxT4N02D7 , WkDfVxT4N02D8 , & + WkDfVxT4N02D9 , WkDfVxT4N03D1 , WkDfVxT4N03D2 , WkDfVxT4N03D3 , WkDfVxT4N03D4 , WkDfVxT4N03D5 , WkDfVxT4N03D6 , WkDfVxT4N03D7 , & + WkDfVxT4N03D8 , WkDfVxT4N03D9 , WkDfVxT4N04D1 , WkDfVxT4N04D2 , WkDfVxT4N04D3 , WkDfVxT4N04D4 , WkDfVxT4N04D5 , WkDfVxT4N04D6 , & + WkDfVxT4N04D7 , WkDfVxT4N04D8 , WkDfVxT4N04D9 , WkDfVxT4N05D1 , WkDfVxT4N05D2 , WkDfVxT4N05D3 , WkDfVxT4N05D4 , WkDfVxT4N05D5 , & + WkDfVxT4N05D6 , WkDfVxT4N05D7 , WkDfVxT4N05D8 , WkDfVxT4N05D9 , WkDfVxT4N06D1 , WkDfVxT4N06D2 , WkDfVxT4N06D3 , WkDfVxT4N06D4 , & + WkDfVxT4N06D5 , WkDfVxT4N06D6 , WkDfVxT4N06D7 , WkDfVxT4N06D8 , WkDfVxT4N06D9 , WkDfVxT4N07D1 , WkDfVxT4N07D2 , WkDfVxT4N07D3 , & + WkDfVxT4N07D4 , WkDfVxT4N07D5 , WkDfVxT4N07D6 , WkDfVxT4N07D7 , WkDfVxT4N07D8 , WkDfVxT4N07D9 , WkDfVxT4N08D1 , WkDfVxT4N08D2 , & + WkDfVxT4N08D3 , WkDfVxT4N08D4 , WkDfVxT4N08D5 , WkDfVxT4N08D6 , WkDfVxT4N08D7 , WkDfVxT4N08D8 , WkDfVxT4N08D9 , WkDfVxT4N09D1 , & + WkDfVxT4N09D2 , WkDfVxT4N09D3 , WkDfVxT4N09D4 , WkDfVxT4N09D5 , WkDfVxT4N09D6 , WkDfVxT4N09D7 , WkDfVxT4N09D8 , WkDfVxT4N09D9 , & + WkDfVxT4N10D1 , WkDfVxT4N10D2 , WkDfVxT4N10D3 , WkDfVxT4N10D4 , WkDfVxT4N10D5 , WkDfVxT4N10D6 , WkDfVxT4N10D7 , WkDfVxT4N10D8 , & + WkDfVxT4N10D9 , WkDfVxT4N11D1 , WkDfVxT4N11D2 , WkDfVxT4N11D3 , WkDfVxT4N11D4 , WkDfVxT4N11D5 , WkDfVxT4N11D6 , WkDfVxT4N11D7 , & + WkDfVxT4N11D8 , WkDfVxT4N11D9 , WkDfVxT4N12D1 , WkDfVxT4N12D2 , WkDfVxT4N12D3 , WkDfVxT4N12D4 , WkDfVxT4N12D5 , WkDfVxT4N12D6 , & + WkDfVxT4N12D7 , WkDfVxT4N12D8 , WkDfVxT4N12D9 , WkDfVxT4N13D1 , WkDfVxT4N13D2 , WkDfVxT4N13D3 , WkDfVxT4N13D4 , WkDfVxT4N13D5 , & + WkDfVxT4N13D6 , WkDfVxT4N13D7 , WkDfVxT4N13D8 , WkDfVxT4N13D9 , WkDfVxT4N14D1 , WkDfVxT4N14D2 , WkDfVxT4N14D3 , WkDfVxT4N14D4 , & + WkDfVxT4N14D5 , WkDfVxT4N14D6 , WkDfVxT4N14D7 , WkDfVxT4N14D8 , WkDfVxT4N14D9 , WkDfVxT4N15D1 , WkDfVxT4N15D2 , WkDfVxT4N15D3 , & + WkDfVxT4N15D4 , WkDfVxT4N15D5 , WkDfVxT4N15D6 , WkDfVxT4N15D7 , WkDfVxT4N15D8 , WkDfVxT4N15D9 , WkDfVxT4N16D1 , WkDfVxT4N16D2 , & + WkDfVxT4N16D3 , WkDfVxT4N16D4 , WkDfVxT4N16D5 , WkDfVxT4N16D6 , WkDfVxT4N16D7 , WkDfVxT4N16D8 , WkDfVxT4N16D9 , WkDfVxT4N17D1 , & + WkDfVxT4N17D2 , WkDfVxT4N17D3 , WkDfVxT4N17D4 , WkDfVxT4N17D5 , WkDfVxT4N17D6 , WkDfVxT4N17D7 , WkDfVxT4N17D8 , WkDfVxT4N17D9 , & + WkDfVxT4N18D1 , WkDfVxT4N18D2 , WkDfVxT4N18D3 , WkDfVxT4N18D4 , WkDfVxT4N18D5 , WkDfVxT4N18D6 , WkDfVxT4N18D7 , WkDfVxT4N18D8 , & + WkDfVxT4N18D9 , WkDfVxT4N19D1 , WkDfVxT4N19D2 , WkDfVxT4N19D3 , WkDfVxT4N19D4 , WkDfVxT4N19D5 , WkDfVxT4N19D6 , WkDfVxT4N19D7 , & + WkDfVxT4N19D8 , WkDfVxT4N19D9 , WkDfVxT4N20D1 , WkDfVxT4N20D2 , WkDfVxT4N20D3 , WkDfVxT4N20D4 , WkDfVxT4N20D5 , WkDfVxT4N20D6 , & + WkDfVxT4N20D7 , WkDfVxT4N20D8 , WkDfVxT4N20D9 , WkDfVxT5N01D1 , WkDfVxT5N01D2 , WkDfVxT5N01D3 , WkDfVxT5N01D4 , WkDfVxT5N01D5 , & + WkDfVxT5N01D6 , WkDfVxT5N01D7 , WkDfVxT5N01D8 , WkDfVxT5N01D9 , WkDfVxT5N02D1 , WkDfVxT5N02D2 , WkDfVxT5N02D3 , WkDfVxT5N02D4 , & + WkDfVxT5N02D5 , WkDfVxT5N02D6 , WkDfVxT5N02D7 , WkDfVxT5N02D8 , WkDfVxT5N02D9 , WkDfVxT5N03D1 , WkDfVxT5N03D2 , WkDfVxT5N03D3 , & + WkDfVxT5N03D4 , WkDfVxT5N03D5 , WkDfVxT5N03D6 , WkDfVxT5N03D7 , WkDfVxT5N03D8 , WkDfVxT5N03D9 , WkDfVxT5N04D1 , WkDfVxT5N04D2 , & + WkDfVxT5N04D3 , WkDfVxT5N04D4 , WkDfVxT5N04D5 , WkDfVxT5N04D6 , WkDfVxT5N04D7 , WkDfVxT5N04D8 , WkDfVxT5N04D9 , WkDfVxT5N05D1 , & + WkDfVxT5N05D2 , WkDfVxT5N05D3 , WkDfVxT5N05D4 , WkDfVxT5N05D5 , WkDfVxT5N05D6 , WkDfVxT5N05D7 , WkDfVxT5N05D8 , WkDfVxT5N05D9 , & + WkDfVxT5N06D1 , WkDfVxT5N06D2 , WkDfVxT5N06D3 , WkDfVxT5N06D4 , WkDfVxT5N06D5 , WkDfVxT5N06D6 , WkDfVxT5N06D7 , WkDfVxT5N06D8 , & + WkDfVxT5N06D9 , WkDfVxT5N07D1 , WkDfVxT5N07D2 , WkDfVxT5N07D3 , WkDfVxT5N07D4 , WkDfVxT5N07D5 , WkDfVxT5N07D6 , WkDfVxT5N07D7 , & + WkDfVxT5N07D8 , WkDfVxT5N07D9 , WkDfVxT5N08D1 , WkDfVxT5N08D2 , WkDfVxT5N08D3 , WkDfVxT5N08D4 , WkDfVxT5N08D5 , WkDfVxT5N08D6 , & + WkDfVxT5N08D7 , WkDfVxT5N08D8 , WkDfVxT5N08D9 , WkDfVxT5N09D1 , WkDfVxT5N09D2 , WkDfVxT5N09D3 , WkDfVxT5N09D4 , WkDfVxT5N09D5 , & + WkDfVxT5N09D6 , WkDfVxT5N09D7 , WkDfVxT5N09D8 , WkDfVxT5N09D9 , WkDfVxT5N10D1 , WkDfVxT5N10D2 , WkDfVxT5N10D3 , WkDfVxT5N10D4 , & + WkDfVxT5N10D5 , WkDfVxT5N10D6 , WkDfVxT5N10D7 , WkDfVxT5N10D8 , WkDfVxT5N10D9 , WkDfVxT5N11D1 , WkDfVxT5N11D2 , WkDfVxT5N11D3 , & + WkDfVxT5N11D4 , WkDfVxT5N11D5 , WkDfVxT5N11D6 , WkDfVxT5N11D7 , WkDfVxT5N11D8 , WkDfVxT5N11D9 , WkDfVxT5N12D1 , WkDfVxT5N12D2 , & + WkDfVxT5N12D3 , WkDfVxT5N12D4 , WkDfVxT5N12D5 , WkDfVxT5N12D6 , WkDfVxT5N12D7 , WkDfVxT5N12D8 , WkDfVxT5N12D9 , WkDfVxT5N13D1 , & + WkDfVxT5N13D2 , WkDfVxT5N13D3 , WkDfVxT5N13D4 , WkDfVxT5N13D5 , WkDfVxT5N13D6 , WkDfVxT5N13D7 , WkDfVxT5N13D8 , WkDfVxT5N13D9 , & + WkDfVxT5N14D1 , WkDfVxT5N14D2 , WkDfVxT5N14D3 , WkDfVxT5N14D4 , WkDfVxT5N14D5 , WkDfVxT5N14D6 , WkDfVxT5N14D7 , WkDfVxT5N14D8 , & + WkDfVxT5N14D9 , WkDfVxT5N15D1 , WkDfVxT5N15D2 , WkDfVxT5N15D3 , WkDfVxT5N15D4 , WkDfVxT5N15D5 , WkDfVxT5N15D6 , WkDfVxT5N15D7 , & + WkDfVxT5N15D8 , WkDfVxT5N15D9 , WkDfVxT5N16D1 , WkDfVxT5N16D2 , WkDfVxT5N16D3 , WkDfVxT5N16D4 , WkDfVxT5N16D5 , WkDfVxT5N16D6 , & + WkDfVxT5N16D7 , WkDfVxT5N16D8 , WkDfVxT5N16D9 , WkDfVxT5N17D1 , WkDfVxT5N17D2 , WkDfVxT5N17D3 , WkDfVxT5N17D4 , WkDfVxT5N17D5 , & + WkDfVxT5N17D6 , WkDfVxT5N17D7 , WkDfVxT5N17D8 , WkDfVxT5N17D9 , WkDfVxT5N18D1 , WkDfVxT5N18D2 , WkDfVxT5N18D3 , WkDfVxT5N18D4 , & + WkDfVxT5N18D5 , WkDfVxT5N18D6 , WkDfVxT5N18D7 , WkDfVxT5N18D8 , WkDfVxT5N18D9 , WkDfVxT5N19D1 , WkDfVxT5N19D2 , WkDfVxT5N19D3 , & + WkDfVxT5N19D4 , WkDfVxT5N19D5 , WkDfVxT5N19D6 , WkDfVxT5N19D7 , WkDfVxT5N19D8 , WkDfVxT5N19D9 , WkDfVxT5N20D1 , WkDfVxT5N20D2 , & + WkDfVxT5N20D3 , WkDfVxT5N20D4 , WkDfVxT5N20D5 , WkDfVxT5N20D6 , WkDfVxT5N20D7 , WkDfVxT5N20D8 , WkDfVxT5N20D9 , WkDfVxT6N01D1 , & + WkDfVxT6N01D2 , WkDfVxT6N01D3 , WkDfVxT6N01D4 , WkDfVxT6N01D5 , WkDfVxT6N01D6 , WkDfVxT6N01D7 , WkDfVxT6N01D8 , WkDfVxT6N01D9 , & + WkDfVxT6N02D1 , WkDfVxT6N02D2 , WkDfVxT6N02D3 , WkDfVxT6N02D4 , WkDfVxT6N02D5 , WkDfVxT6N02D6 , WkDfVxT6N02D7 , WkDfVxT6N02D8 , & + WkDfVxT6N02D9 , WkDfVxT6N03D1 , WkDfVxT6N03D2 , WkDfVxT6N03D3 , WkDfVxT6N03D4 , WkDfVxT6N03D5 , WkDfVxT6N03D6 , WkDfVxT6N03D7 , & + WkDfVxT6N03D8 , WkDfVxT6N03D9 , WkDfVxT6N04D1 , WkDfVxT6N04D2 , WkDfVxT6N04D3 , WkDfVxT6N04D4 , WkDfVxT6N04D5 , WkDfVxT6N04D6 /) + ParamIndxAry(8161:9423) = (/ & + WkDfVxT6N04D7 , WkDfVxT6N04D8 , WkDfVxT6N04D9 , WkDfVxT6N05D1 , WkDfVxT6N05D2 , WkDfVxT6N05D3 , WkDfVxT6N05D4 , WkDfVxT6N05D5 , & + WkDfVxT6N05D6 , WkDfVxT6N05D7 , WkDfVxT6N05D8 , WkDfVxT6N05D9 , WkDfVxT6N06D1 , WkDfVxT6N06D2 , WkDfVxT6N06D3 , WkDfVxT6N06D4 , & + WkDfVxT6N06D5 , WkDfVxT6N06D6 , WkDfVxT6N06D7 , WkDfVxT6N06D8 , WkDfVxT6N06D9 , WkDfVxT6N07D1 , WkDfVxT6N07D2 , WkDfVxT6N07D3 , & + WkDfVxT6N07D4 , WkDfVxT6N07D5 , WkDfVxT6N07D6 , WkDfVxT6N07D7 , WkDfVxT6N07D8 , WkDfVxT6N07D9 , WkDfVxT6N08D1 , WkDfVxT6N08D2 , & + WkDfVxT6N08D3 , WkDfVxT6N08D4 , WkDfVxT6N08D5 , WkDfVxT6N08D6 , WkDfVxT6N08D7 , WkDfVxT6N08D8 , WkDfVxT6N08D9 , WkDfVxT6N09D1 , & + WkDfVxT6N09D2 , WkDfVxT6N09D3 , WkDfVxT6N09D4 , WkDfVxT6N09D5 , WkDfVxT6N09D6 , WkDfVxT6N09D7 , WkDfVxT6N09D8 , WkDfVxT6N09D9 , & + WkDfVxT6N10D1 , WkDfVxT6N10D2 , WkDfVxT6N10D3 , WkDfVxT6N10D4 , WkDfVxT6N10D5 , WkDfVxT6N10D6 , WkDfVxT6N10D7 , WkDfVxT6N10D8 , & + WkDfVxT6N10D9 , WkDfVxT6N11D1 , WkDfVxT6N11D2 , WkDfVxT6N11D3 , WkDfVxT6N11D4 , WkDfVxT6N11D5 , WkDfVxT6N11D6 , WkDfVxT6N11D7 , & + WkDfVxT6N11D8 , WkDfVxT6N11D9 , WkDfVxT6N12D1 , WkDfVxT6N12D2 , WkDfVxT6N12D3 , WkDfVxT6N12D4 , WkDfVxT6N12D5 , WkDfVxT6N12D6 , & + WkDfVxT6N12D7 , WkDfVxT6N12D8 , WkDfVxT6N12D9 , WkDfVxT6N13D1 , WkDfVxT6N13D2 , WkDfVxT6N13D3 , WkDfVxT6N13D4 , WkDfVxT6N13D5 , & + WkDfVxT6N13D6 , WkDfVxT6N13D7 , WkDfVxT6N13D8 , WkDfVxT6N13D9 , WkDfVxT6N14D1 , WkDfVxT6N14D2 , WkDfVxT6N14D3 , WkDfVxT6N14D4 , & + WkDfVxT6N14D5 , WkDfVxT6N14D6 , WkDfVxT6N14D7 , WkDfVxT6N14D8 , WkDfVxT6N14D9 , WkDfVxT6N15D1 , WkDfVxT6N15D2 , WkDfVxT6N15D3 , & + WkDfVxT6N15D4 , WkDfVxT6N15D5 , WkDfVxT6N15D6 , WkDfVxT6N15D7 , WkDfVxT6N15D8 , WkDfVxT6N15D9 , WkDfVxT6N16D1 , WkDfVxT6N16D2 , & + WkDfVxT6N16D3 , WkDfVxT6N16D4 , WkDfVxT6N16D5 , WkDfVxT6N16D6 , WkDfVxT6N16D7 , WkDfVxT6N16D8 , WkDfVxT6N16D9 , WkDfVxT6N17D1 , & + WkDfVxT6N17D2 , WkDfVxT6N17D3 , WkDfVxT6N17D4 , WkDfVxT6N17D5 , WkDfVxT6N17D6 , WkDfVxT6N17D7 , WkDfVxT6N17D8 , WkDfVxT6N17D9 , & + WkDfVxT6N18D1 , WkDfVxT6N18D2 , WkDfVxT6N18D3 , WkDfVxT6N18D4 , WkDfVxT6N18D5 , WkDfVxT6N18D6 , WkDfVxT6N18D7 , WkDfVxT6N18D8 , & + WkDfVxT6N18D9 , WkDfVxT6N19D1 , WkDfVxT6N19D2 , WkDfVxT6N19D3 , WkDfVxT6N19D4 , WkDfVxT6N19D5 , WkDfVxT6N19D6 , WkDfVxT6N19D7 , & + WkDfVxT6N19D8 , WkDfVxT6N19D9 , WkDfVxT6N20D1 , WkDfVxT6N20D2 , WkDfVxT6N20D3 , WkDfVxT6N20D4 , WkDfVxT6N20D5 , WkDfVxT6N20D6 , & + WkDfVxT6N20D7 , WkDfVxT6N20D8 , WkDfVxT6N20D9 , WkDfVxT7N01D1 , WkDfVxT7N01D2 , WkDfVxT7N01D3 , WkDfVxT7N01D4 , WkDfVxT7N01D5 , & + WkDfVxT7N01D6 , WkDfVxT7N01D7 , WkDfVxT7N01D8 , WkDfVxT7N01D9 , WkDfVxT7N02D1 , WkDfVxT7N02D2 , WkDfVxT7N02D3 , WkDfVxT7N02D4 , & + WkDfVxT7N02D5 , WkDfVxT7N02D6 , WkDfVxT7N02D7 , WkDfVxT7N02D8 , WkDfVxT7N02D9 , WkDfVxT7N03D1 , WkDfVxT7N03D2 , WkDfVxT7N03D3 , & + WkDfVxT7N03D4 , WkDfVxT7N03D5 , WkDfVxT7N03D6 , WkDfVxT7N03D7 , WkDfVxT7N03D8 , WkDfVxT7N03D9 , WkDfVxT7N04D1 , WkDfVxT7N04D2 , & + WkDfVxT7N04D3 , WkDfVxT7N04D4 , WkDfVxT7N04D5 , WkDfVxT7N04D6 , WkDfVxT7N04D7 , WkDfVxT7N04D8 , WkDfVxT7N04D9 , WkDfVxT7N05D1 , & + WkDfVxT7N05D2 , WkDfVxT7N05D3 , WkDfVxT7N05D4 , WkDfVxT7N05D5 , WkDfVxT7N05D6 , WkDfVxT7N05D7 , WkDfVxT7N05D8 , WkDfVxT7N05D9 , & + WkDfVxT7N06D1 , WkDfVxT7N06D2 , WkDfVxT7N06D3 , WkDfVxT7N06D4 , WkDfVxT7N06D5 , WkDfVxT7N06D6 , WkDfVxT7N06D7 , WkDfVxT7N06D8 , & + WkDfVxT7N06D9 , WkDfVxT7N07D1 , WkDfVxT7N07D2 , WkDfVxT7N07D3 , WkDfVxT7N07D4 , WkDfVxT7N07D5 , WkDfVxT7N07D6 , WkDfVxT7N07D7 , & + WkDfVxT7N07D8 , WkDfVxT7N07D9 , WkDfVxT7N08D1 , WkDfVxT7N08D2 , WkDfVxT7N08D3 , WkDfVxT7N08D4 , WkDfVxT7N08D5 , WkDfVxT7N08D6 , & + WkDfVxT7N08D7 , WkDfVxT7N08D8 , WkDfVxT7N08D9 , WkDfVxT7N09D1 , WkDfVxT7N09D2 , WkDfVxT7N09D3 , WkDfVxT7N09D4 , WkDfVxT7N09D5 , & + WkDfVxT7N09D6 , WkDfVxT7N09D7 , WkDfVxT7N09D8 , WkDfVxT7N09D9 , WkDfVxT7N10D1 , WkDfVxT7N10D2 , WkDfVxT7N10D3 , WkDfVxT7N10D4 , & + WkDfVxT7N10D5 , WkDfVxT7N10D6 , WkDfVxT7N10D7 , WkDfVxT7N10D8 , WkDfVxT7N10D9 , WkDfVxT7N11D1 , WkDfVxT7N11D2 , WkDfVxT7N11D3 , & + WkDfVxT7N11D4 , WkDfVxT7N11D5 , WkDfVxT7N11D6 , WkDfVxT7N11D7 , WkDfVxT7N11D8 , WkDfVxT7N11D9 , WkDfVxT7N12D1 , WkDfVxT7N12D2 , & + WkDfVxT7N12D3 , WkDfVxT7N12D4 , WkDfVxT7N12D5 , WkDfVxT7N12D6 , WkDfVxT7N12D7 , WkDfVxT7N12D8 , WkDfVxT7N12D9 , WkDfVxT7N13D1 , & + WkDfVxT7N13D2 , WkDfVxT7N13D3 , WkDfVxT7N13D4 , WkDfVxT7N13D5 , WkDfVxT7N13D6 , WkDfVxT7N13D7 , WkDfVxT7N13D8 , WkDfVxT7N13D9 , & + WkDfVxT7N14D1 , WkDfVxT7N14D2 , WkDfVxT7N14D3 , WkDfVxT7N14D4 , WkDfVxT7N14D5 , WkDfVxT7N14D6 , WkDfVxT7N14D7 , WkDfVxT7N14D8 , & + WkDfVxT7N14D9 , WkDfVxT7N15D1 , WkDfVxT7N15D2 , WkDfVxT7N15D3 , WkDfVxT7N15D4 , WkDfVxT7N15D5 , WkDfVxT7N15D6 , WkDfVxT7N15D7 , & + WkDfVxT7N15D8 , WkDfVxT7N15D9 , WkDfVxT7N16D1 , WkDfVxT7N16D2 , WkDfVxT7N16D3 , WkDfVxT7N16D4 , WkDfVxT7N16D5 , WkDfVxT7N16D6 , & + WkDfVxT7N16D7 , WkDfVxT7N16D8 , WkDfVxT7N16D9 , WkDfVxT7N17D1 , WkDfVxT7N17D2 , WkDfVxT7N17D3 , WkDfVxT7N17D4 , WkDfVxT7N17D5 , & + WkDfVxT7N17D6 , WkDfVxT7N17D7 , WkDfVxT7N17D8 , WkDfVxT7N17D9 , WkDfVxT7N18D1 , WkDfVxT7N18D2 , WkDfVxT7N18D3 , WkDfVxT7N18D4 , & + WkDfVxT7N18D5 , WkDfVxT7N18D6 , WkDfVxT7N18D7 , WkDfVxT7N18D8 , WkDfVxT7N18D9 , WkDfVxT7N19D1 , WkDfVxT7N19D2 , WkDfVxT7N19D3 , & + WkDfVxT7N19D4 , WkDfVxT7N19D5 , WkDfVxT7N19D6 , WkDfVxT7N19D7 , WkDfVxT7N19D8 , WkDfVxT7N19D9 , WkDfVxT7N20D1 , WkDfVxT7N20D2 , & + WkDfVxT7N20D3 , WkDfVxT7N20D4 , WkDfVxT7N20D5 , WkDfVxT7N20D6 , WkDfVxT7N20D7 , WkDfVxT7N20D8 , WkDfVxT7N20D9 , WkDfVxT8N01D1 , & + WkDfVxT8N01D2 , WkDfVxT8N01D3 , WkDfVxT8N01D4 , WkDfVxT8N01D5 , WkDfVxT8N01D6 , WkDfVxT8N01D7 , WkDfVxT8N01D8 , WkDfVxT8N01D9 , & + WkDfVxT8N02D1 , WkDfVxT8N02D2 , WkDfVxT8N02D3 , WkDfVxT8N02D4 , WkDfVxT8N02D5 , WkDfVxT8N02D6 , WkDfVxT8N02D7 , WkDfVxT8N02D8 , & + WkDfVxT8N02D9 , WkDfVxT8N03D1 , WkDfVxT8N03D2 , WkDfVxT8N03D3 , WkDfVxT8N03D4 , WkDfVxT8N03D5 , WkDfVxT8N03D6 , WkDfVxT8N03D7 , & + WkDfVxT8N03D8 , WkDfVxT8N03D9 , WkDfVxT8N04D1 , WkDfVxT8N04D2 , WkDfVxT8N04D3 , WkDfVxT8N04D4 , WkDfVxT8N04D5 , WkDfVxT8N04D6 , & + WkDfVxT8N04D7 , WkDfVxT8N04D8 , WkDfVxT8N04D9 , WkDfVxT8N05D1 , WkDfVxT8N05D2 , WkDfVxT8N05D3 , WkDfVxT8N05D4 , WkDfVxT8N05D5 , & + WkDfVxT8N05D6 , WkDfVxT8N05D7 , WkDfVxT8N05D8 , WkDfVxT8N05D9 , WkDfVxT8N06D1 , WkDfVxT8N06D2 , WkDfVxT8N06D3 , WkDfVxT8N06D4 , & + WkDfVxT8N06D5 , WkDfVxT8N06D6 , WkDfVxT8N06D7 , WkDfVxT8N06D8 , WkDfVxT8N06D9 , WkDfVxT8N07D1 , WkDfVxT8N07D2 , WkDfVxT8N07D3 , & + WkDfVxT8N07D4 , WkDfVxT8N07D5 , WkDfVxT8N07D6 , WkDfVxT8N07D7 , WkDfVxT8N07D8 , WkDfVxT8N07D9 , WkDfVxT8N08D1 , WkDfVxT8N08D2 , & + WkDfVxT8N08D3 , WkDfVxT8N08D4 , WkDfVxT8N08D5 , WkDfVxT8N08D6 , WkDfVxT8N08D7 , WkDfVxT8N08D8 , WkDfVxT8N08D9 , WkDfVxT8N09D1 , & + WkDfVxT8N09D2 , WkDfVxT8N09D3 , WkDfVxT8N09D4 , WkDfVxT8N09D5 , WkDfVxT8N09D6 , WkDfVxT8N09D7 , WkDfVxT8N09D8 , WkDfVxT8N09D9 , & + WkDfVxT8N10D1 , WkDfVxT8N10D2 , WkDfVxT8N10D3 , WkDfVxT8N10D4 , WkDfVxT8N10D5 , WkDfVxT8N10D6 , WkDfVxT8N10D7 , WkDfVxT8N10D8 , & + WkDfVxT8N10D9 , WkDfVxT8N11D1 , WkDfVxT8N11D2 , WkDfVxT8N11D3 , WkDfVxT8N11D4 , WkDfVxT8N11D5 , WkDfVxT8N11D6 , WkDfVxT8N11D7 , & + WkDfVxT8N11D8 , WkDfVxT8N11D9 , WkDfVxT8N12D1 , WkDfVxT8N12D2 , WkDfVxT8N12D3 , WkDfVxT8N12D4 , WkDfVxT8N12D5 , WkDfVxT8N12D6 , & + WkDfVxT8N12D7 , WkDfVxT8N12D8 , WkDfVxT8N12D9 , WkDfVxT8N13D1 , WkDfVxT8N13D2 , WkDfVxT8N13D3 , WkDfVxT8N13D4 , WkDfVxT8N13D5 , & + WkDfVxT8N13D6 , WkDfVxT8N13D7 , WkDfVxT8N13D8 , WkDfVxT8N13D9 , WkDfVxT8N14D1 , WkDfVxT8N14D2 , WkDfVxT8N14D3 , WkDfVxT8N14D4 , & + WkDfVxT8N14D5 , WkDfVxT8N14D6 , WkDfVxT8N14D7 , WkDfVxT8N14D8 , WkDfVxT8N14D9 , WkDfVxT8N15D1 , WkDfVxT8N15D2 , WkDfVxT8N15D3 , & + WkDfVxT8N15D4 , WkDfVxT8N15D5 , WkDfVxT8N15D6 , WkDfVxT8N15D7 , WkDfVxT8N15D8 , WkDfVxT8N15D9 , WkDfVxT8N16D1 , WkDfVxT8N16D2 , & + WkDfVxT8N16D3 , WkDfVxT8N16D4 , WkDfVxT8N16D5 , WkDfVxT8N16D6 , WkDfVxT8N16D7 , WkDfVxT8N16D8 , WkDfVxT8N16D9 , WkDfVxT8N17D1 , & + WkDfVxT8N17D2 , WkDfVxT8N17D3 , WkDfVxT8N17D4 , WkDfVxT8N17D5 , WkDfVxT8N17D6 , WkDfVxT8N17D7 , WkDfVxT8N17D8 , WkDfVxT8N17D9 , & + WkDfVxT8N18D1 , WkDfVxT8N18D2 , WkDfVxT8N18D3 , WkDfVxT8N18D4 , WkDfVxT8N18D5 , WkDfVxT8N18D6 , WkDfVxT8N18D7 , WkDfVxT8N18D8 , & + WkDfVxT8N18D9 , WkDfVxT8N19D1 , WkDfVxT8N19D2 , WkDfVxT8N19D3 , WkDfVxT8N19D4 , WkDfVxT8N19D5 , WkDfVxT8N19D6 , WkDfVxT8N19D7 , & + WkDfVxT8N19D8 , WkDfVxT8N19D9 , WkDfVxT8N20D1 , WkDfVxT8N20D2 , WkDfVxT8N20D3 , WkDfVxT8N20D4 , WkDfVxT8N20D5 , WkDfVxT8N20D6 , & + WkDfVxT8N20D7 , WkDfVxT8N20D8 , WkDfVxT8N20D9 , WkDfVxT9N01D1 , WkDfVxT9N01D2 , WkDfVxT9N01D3 , WkDfVxT9N01D4 , WkDfVxT9N01D5 , & + WkDfVxT9N01D6 , WkDfVxT9N01D7 , WkDfVxT9N01D8 , WkDfVxT9N01D9 , WkDfVxT9N02D1 , WkDfVxT9N02D2 , WkDfVxT9N02D3 , WkDfVxT9N02D4 , & + WkDfVxT9N02D5 , WkDfVxT9N02D6 , WkDfVxT9N02D7 , WkDfVxT9N02D8 , WkDfVxT9N02D9 , WkDfVxT9N03D1 , WkDfVxT9N03D2 , WkDfVxT9N03D3 , & + WkDfVxT9N03D4 , WkDfVxT9N03D5 , WkDfVxT9N03D6 , WkDfVxT9N03D7 , WkDfVxT9N03D8 , WkDfVxT9N03D9 , WkDfVxT9N04D1 , WkDfVxT9N04D2 , & + WkDfVxT9N04D3 , WkDfVxT9N04D4 , WkDfVxT9N04D5 , WkDfVxT9N04D6 , WkDfVxT9N04D7 , WkDfVxT9N04D8 , WkDfVxT9N04D9 , WkDfVxT9N05D1 , & + WkDfVxT9N05D2 , WkDfVxT9N05D3 , WkDfVxT9N05D4 , WkDfVxT9N05D5 , WkDfVxT9N05D6 , WkDfVxT9N05D7 , WkDfVxT9N05D8 , WkDfVxT9N05D9 , & + WkDfVxT9N06D1 , WkDfVxT9N06D2 , WkDfVxT9N06D3 , WkDfVxT9N06D4 , WkDfVxT9N06D5 , WkDfVxT9N06D6 , WkDfVxT9N06D7 , WkDfVxT9N06D8 , & + WkDfVxT9N06D9 , WkDfVxT9N07D1 , WkDfVxT9N07D2 , WkDfVxT9N07D3 , WkDfVxT9N07D4 , WkDfVxT9N07D5 , WkDfVxT9N07D6 , WkDfVxT9N07D7 , & + WkDfVxT9N07D8 , WkDfVxT9N07D9 , WkDfVxT9N08D1 , WkDfVxT9N08D2 , WkDfVxT9N08D3 , WkDfVxT9N08D4 , WkDfVxT9N08D5 , WkDfVxT9N08D6 , & + WkDfVxT9N08D7 , WkDfVxT9N08D8 , WkDfVxT9N08D9 , WkDfVxT9N09D1 , WkDfVxT9N09D2 , WkDfVxT9N09D3 , WkDfVxT9N09D4 , WkDfVxT9N09D5 , & + WkDfVxT9N09D6 , WkDfVxT9N09D7 , WkDfVxT9N09D8 , WkDfVxT9N09D9 , WkDfVxT9N10D1 , WkDfVxT9N10D2 , WkDfVxT9N10D3 , WkDfVxT9N10D4 , & + WkDfVxT9N10D5 , WkDfVxT9N10D6 , WkDfVxT9N10D7 , WkDfVxT9N10D8 , WkDfVxT9N10D9 , WkDfVxT9N11D1 , WkDfVxT9N11D2 , WkDfVxT9N11D3 , & + WkDfVxT9N11D4 , WkDfVxT9N11D5 , WkDfVxT9N11D6 , WkDfVxT9N11D7 , WkDfVxT9N11D8 , WkDfVxT9N11D9 , WkDfVxT9N12D1 , WkDfVxT9N12D2 , & + WkDfVxT9N12D3 , WkDfVxT9N12D4 , WkDfVxT9N12D5 , WkDfVxT9N12D6 , WkDfVxT9N12D7 , WkDfVxT9N12D8 , WkDfVxT9N12D9 , WkDfVxT9N13D1 , & + WkDfVxT9N13D2 , WkDfVxT9N13D3 , WkDfVxT9N13D4 , WkDfVxT9N13D5 , WkDfVxT9N13D6 , WkDfVxT9N13D7 , WkDfVxT9N13D8 , WkDfVxT9N13D9 , & + WkDfVxT9N14D1 , WkDfVxT9N14D2 , WkDfVxT9N14D3 , WkDfVxT9N14D4 , WkDfVxT9N14D5 , WkDfVxT9N14D6 , WkDfVxT9N14D7 , WkDfVxT9N14D8 , & + WkDfVxT9N14D9 , WkDfVxT9N15D1 , WkDfVxT9N15D2 , WkDfVxT9N15D3 , WkDfVxT9N15D4 , WkDfVxT9N15D5 , WkDfVxT9N15D6 , WkDfVxT9N15D7 , & + WkDfVxT9N15D8 , WkDfVxT9N15D9 , WkDfVxT9N16D1 , WkDfVxT9N16D2 , WkDfVxT9N16D3 , WkDfVxT9N16D4 , WkDfVxT9N16D5 , WkDfVxT9N16D6 , & + WkDfVxT9N16D7 , WkDfVxT9N16D8 , WkDfVxT9N16D9 , WkDfVxT9N17D1 , WkDfVxT9N17D2 , WkDfVxT9N17D3 , WkDfVxT9N17D4 , WkDfVxT9N17D5 , & + WkDfVxT9N17D6 , WkDfVxT9N17D7 , WkDfVxT9N17D8 , WkDfVxT9N17D9 , WkDfVxT9N18D1 , WkDfVxT9N18D2 , WkDfVxT9N18D3 , WkDfVxT9N18D4 , & + WkDfVxT9N18D5 , WkDfVxT9N18D6 , WkDfVxT9N18D7 , WkDfVxT9N18D8 , WkDfVxT9N18D9 , WkDfVxT9N19D1 , WkDfVxT9N19D2 , WkDfVxT9N19D3 , & + WkDfVxT9N19D4 , WkDfVxT9N19D5 , WkDfVxT9N19D6 , WkDfVxT9N19D7 , WkDfVxT9N19D8 , WkDfVxT9N19D9 , WkDfVxT9N20D1 , WkDfVxT9N20D2 , & + WkDfVxT9N20D3 , WkDfVxT9N20D4 , WkDfVxT9N20D5 , WkDfVxT9N20D6 , WkDfVxT9N20D7 , WkDfVxT9N20D8 , WkDfVxT9N20D9 , WkDiamT1D1 , & + WkDiamT1D2 , WkDiamT1D3 , WkDiamT1D4 , WkDiamT1D5 , WkDiamT1D6 , WkDiamT1D7 , WkDiamT1D8 , WkDiamT1D9 , & + WkDiamT2D1 , WkDiamT2D2 , WkDiamT2D3 , WkDiamT2D4 , WkDiamT2D5 , WkDiamT2D6 , WkDiamT2D7 , WkDiamT2D8 , & + WkDiamT2D9 , WkDiamT3D1 , WkDiamT3D2 , WkDiamT3D3 , WkDiamT3D4 , WkDiamT3D5 , WkDiamT3D6 , WkDiamT3D7 , & + WkDiamT3D8 , WkDiamT3D9 , WkDiamT4D1 , WkDiamT4D2 , WkDiamT4D3 , WkDiamT4D4 , WkDiamT4D5 , WkDiamT4D6 , & + WkDiamT4D7 , WkDiamT4D8 , WkDiamT4D9 , WkDiamT5D1 , WkDiamT5D2 , WkDiamT5D3 , WkDiamT5D4 , WkDiamT5D5 , & + WkDiamT5D6 , WkDiamT5D7 , WkDiamT5D8 , WkDiamT5D9 , WkDiamT6D1 , WkDiamT6D2 , WkDiamT6D3 , WkDiamT6D4 , & + WkDiamT6D5 , WkDiamT6D6 , WkDiamT6D7 , WkDiamT6D8 , WkDiamT6D9 , WkDiamT7D1 , WkDiamT7D2 , WkDiamT7D3 , & + WkDiamT7D4 , WkDiamT7D5 , WkDiamT7D6 , WkDiamT7D7 , WkDiamT7D8 , WkDiamT7D9 , WkDiamT8D1 , WkDiamT8D2 , & + WkDiamT8D3 , WkDiamT8D4 , WkDiamT8D5 , WkDiamT8D6 , WkDiamT8D7 , WkDiamT8D8 , WkDiamT8D9 , WkDiamT9D1 , & + WkDiamT9D2 , WkDiamT9D3 , WkDiamT9D4 , WkDiamT9D5 , WkDiamT9D6 , WkDiamT9D7 , WkDiamT9D8 , WkDiamT9D9 , & + WkPosXT1D1 , WkPosXT1D2 , WkPosXT1D3 , WkPosXT1D4 , WkPosXT1D5 , WkPosXT1D6 , WkPosXT1D7 , WkPosXT1D8 , & + WkPosXT1D9 , WkPosXT2D1 , WkPosXT2D2 , WkPosXT2D3 , WkPosXT2D4 , WkPosXT2D5 , WkPosXT2D6 , WkPosXT2D7 , & + WkPosXT2D8 , WkPosXT2D9 , WkPosXT3D1 , WkPosXT3D2 , WkPosXT3D3 , WkPosXT3D4 , WkPosXT3D5 , WkPosXT3D6 , & + WkPosXT3D7 , WkPosXT3D8 , WkPosXT3D9 , WkPosXT4D1 , WkPosXT4D2 , WkPosXT4D3 , WkPosXT4D4 , WkPosXT4D5 , & + WkPosXT4D6 , WkPosXT4D7 , WkPosXT4D8 , WkPosXT4D9 , WkPosXT5D1 , WkPosXT5D2 , WkPosXT5D3 , WkPosXT5D4 , & + WkPosXT5D5 , WkPosXT5D6 , WkPosXT5D7 , WkPosXT5D8 , WkPosXT5D9 , WkPosXT6D1 , WkPosXT6D2 , WkPosXT6D3 , & + WkPosXT6D4 , WkPosXT6D5 , WkPosXT6D6 , WkPosXT6D7 , WkPosXT6D8 , WkPosXT6D9 , WkPosXT7D1 , WkPosXT7D2 , & + WkPosXT7D3 , WkPosXT7D4 , WkPosXT7D5 , WkPosXT7D6 , WkPosXT7D7 , WkPosXT7D8 , WkPosXT7D9 , WkPosXT8D1 , & + WkPosXT8D2 , WkPosXT8D3 , WkPosXT8D4 , WkPosXT8D5 , WkPosXT8D6 , WkPosXT8D7 , WkPosXT8D8 , WkPosXT8D9 , & + WkPosXT9D1 , WkPosXT9D2 , WkPosXT9D3 , WkPosXT9D4 , WkPosXT9D5 , WkPosXT9D6 , WkPosXT9D7 , WkPosXT9D8 , & + WkPosXT9D9 , WkPosYT1D1 , WkPosYT1D2 , WkPosYT1D3 , WkPosYT1D4 , WkPosYT1D5 , WkPosYT1D6 , WkPosYT1D7 , & + WkPosYT1D8 , WkPosYT1D9 , WkPosYT2D1 , WkPosYT2D2 , WkPosYT2D3 , WkPosYT2D4 , WkPosYT2D5 , WkPosYT2D6 , & + WkPosYT2D7 , WkPosYT2D8 , WkPosYT2D9 , WkPosYT3D1 , WkPosYT3D2 , WkPosYT3D3 , WkPosYT3D4 , WkPosYT3D5 , & + WkPosYT3D6 , WkPosYT3D7 , WkPosYT3D8 , WkPosYT3D9 , WkPosYT4D1 , WkPosYT4D2 , WkPosYT4D3 , WkPosYT4D4 , & + WkPosYT4D5 , WkPosYT4D6 , WkPosYT4D7 , WkPosYT4D8 , WkPosYT4D9 , WkPosYT5D1 , WkPosYT5D2 , WkPosYT5D3 , & + WkPosYT5D4 , WkPosYT5D5 , WkPosYT5D6 , WkPosYT5D7 , WkPosYT5D8 , WkPosYT5D9 , WkPosYT6D1 , WkPosYT6D2 , & + WkPosYT6D3 , WkPosYT6D4 , WkPosYT6D5 , WkPosYT6D6 , WkPosYT6D7 , WkPosYT6D8 , WkPosYT6D9 , WkPosYT7D1 , & + WkPosYT7D2 , WkPosYT7D3 , WkPosYT7D4 , WkPosYT7D5 , WkPosYT7D6 , WkPosYT7D7 , WkPosYT7D8 , WkPosYT7D9 , & + WkPosYT8D1 , WkPosYT8D2 , WkPosYT8D3 , WkPosYT8D4 , WkPosYT8D5 , WkPosYT8D6 , WkPosYT8D7 , WkPosYT8D8 , & + WkPosYT8D9 , WkPosYT9D1 , WkPosYT9D2 , WkPosYT9D3 , WkPosYT9D4 , WkPosYT9D5 , WkPosYT9D6 , WkPosYT9D7 , & + WkPosYT9D8 , WkPosYT9D9 , WkPosZT1D1 , WkPosZT1D2 , WkPosZT1D3 , WkPosZT1D4 , WkPosZT1D5 , WkPosZT1D6 , & + WkPosZT1D7 , WkPosZT1D8 , WkPosZT1D9 , WkPosZT2D1 , WkPosZT2D2 , WkPosZT2D3 , WkPosZT2D4 , WkPosZT2D5 , & + WkPosZT2D6 , WkPosZT2D7 , WkPosZT2D8 , WkPosZT2D9 , WkPosZT3D1 , WkPosZT3D2 , WkPosZT3D3 , WkPosZT3D4 , & + WkPosZT3D5 , WkPosZT3D6 , WkPosZT3D7 , WkPosZT3D8 , WkPosZT3D9 , WkPosZT4D1 , WkPosZT4D2 , WkPosZT4D3 , & + WkPosZT4D4 , WkPosZT4D5 , WkPosZT4D6 , WkPosZT4D7 , WkPosZT4D8 , WkPosZT4D9 , WkPosZT5D1 , WkPosZT5D2 , & + WkPosZT5D3 , WkPosZT5D4 , WkPosZT5D5 , WkPosZT5D6 , WkPosZT5D7 , WkPosZT5D8 , WkPosZT5D9 , WkPosZT6D1 , & + WkPosZT6D2 , WkPosZT6D3 , WkPosZT6D4 , WkPosZT6D5 , WkPosZT6D6 , WkPosZT6D7 , WkPosZT6D8 , WkPosZT6D9 , & + WkPosZT7D1 , WkPosZT7D2 , WkPosZT7D3 , WkPosZT7D4 , WkPosZT7D5 , WkPosZT7D6 , WkPosZT7D7 , WkPosZT7D8 , & + WkPosZT7D9 , WkPosZT8D1 , WkPosZT8D2 , WkPosZT8D3 , WkPosZT8D4 , WkPosZT8D5 , WkPosZT8D6 , WkPosZT8D7 , & + WkPosZT8D8 , WkPosZT8D9 , WkPosZT9D1 , WkPosZT9D2 , WkPosZT9D3 , WkPosZT9D4 , WkPosZT9D5 , WkPosZT9D6 , & + WkPosZT9D7 , WkPosZT9D8 , WkPosZT9D9 , WkVelXT1D1 , WkVelXT1D2 , WkVelXT1D3 , WkVelXT1D4 , WkVelXT1D5 , & + WkVelXT1D6 , WkVelXT1D7 , WkVelXT1D8 , WkVelXT1D9 , WkVelXT2D1 , WkVelXT2D2 , WkVelXT2D3 , WkVelXT2D4 , & + WkVelXT2D5 , WkVelXT2D6 , WkVelXT2D7 , WkVelXT2D8 , WkVelXT2D9 , WkVelXT3D1 , WkVelXT3D2 , WkVelXT3D3 , & + WkVelXT3D4 , WkVelXT3D5 , WkVelXT3D6 , WkVelXT3D7 , WkVelXT3D8 , WkVelXT3D9 , WkVelXT4D1 , WkVelXT4D2 , & + WkVelXT4D3 , WkVelXT4D4 , WkVelXT4D5 , WkVelXT4D6 , WkVelXT4D7 , WkVelXT4D8 , WkVelXT4D9 , WkVelXT5D1 , & + WkVelXT5D2 , WkVelXT5D3 , WkVelXT5D4 , WkVelXT5D5 , WkVelXT5D6 , WkVelXT5D7 , WkVelXT5D8 , WkVelXT5D9 , & + WkVelXT6D1 , WkVelXT6D2 , WkVelXT6D3 , WkVelXT6D4 , WkVelXT6D5 , WkVelXT6D6 , WkVelXT6D7 , WkVelXT6D8 , & + WkVelXT6D9 , WkVelXT7D1 , WkVelXT7D2 , WkVelXT7D3 , WkVelXT7D4 , WkVelXT7D5 , WkVelXT7D6 , WkVelXT7D7 , & + WkVelXT7D8 , WkVelXT7D9 , WkVelXT8D1 , WkVelXT8D2 , WkVelXT8D3 , WkVelXT8D4 , WkVelXT8D5 , WkVelXT8D6 , & + WkVelXT8D7 , WkVelXT8D8 , WkVelXT8D9 , WkVelXT9D1 , WkVelXT9D2 , WkVelXT9D3 , WkVelXT9D4 , WkVelXT9D5 , & + WkVelXT9D6 , WkVelXT9D7 , WkVelXT9D8 , WkVelXT9D9 , WkVelYT1D1 , WkVelYT1D2 , WkVelYT1D3 , WkVelYT1D4 , & + WkVelYT1D5 , WkVelYT1D6 , WkVelYT1D7 , WkVelYT1D8 , WkVelYT1D9 , WkVelYT2D1 , WkVelYT2D2 , WkVelYT2D3 , & + WkVelYT2D4 , WkVelYT2D5 , WkVelYT2D6 , WkVelYT2D7 , WkVelYT2D8 , WkVelYT2D9 , WkVelYT3D1 , WkVelYT3D2 , & + WkVelYT3D3 , WkVelYT3D4 , WkVelYT3D5 , WkVelYT3D6 , WkVelYT3D7 , WkVelYT3D8 , WkVelYT3D9 , WkVelYT4D1 , & + WkVelYT4D2 , WkVelYT4D3 , WkVelYT4D4 , WkVelYT4D5 , WkVelYT4D6 , WkVelYT4D7 , WkVelYT4D8 , WkVelYT4D9 , & + WkVelYT5D1 , WkVelYT5D2 , WkVelYT5D3 , WkVelYT5D4 , WkVelYT5D5 , WkVelYT5D6 , WkVelYT5D7 , WkVelYT5D8 , & + WkVelYT5D9 , WkVelYT6D1 , WkVelYT6D2 , WkVelYT6D3 , WkVelYT6D4 , WkVelYT6D5 , WkVelYT6D6 , WkVelYT6D7 , & + WkVelYT6D8 , WkVelYT6D9 , WkVelYT7D1 , WkVelYT7D2 , WkVelYT7D3 , WkVelYT7D4 , WkVelYT7D5 , WkVelYT7D6 , & + WkVelYT7D7 , WkVelYT7D8 , WkVelYT7D9 , WkVelYT8D1 , WkVelYT8D2 , WkVelYT8D3 , WkVelYT8D4 , WkVelYT8D5 , & + WkVelYT8D6 , WkVelYT8D7 , WkVelYT8D8 , WkVelYT8D9 , WkVelYT9D1 , WkVelYT9D2 , WkVelYT9D3 , WkVelYT9D4 , & + WkVelYT9D5 , WkVelYT9D6 , WkVelYT9D7 , WkVelYT9D8 , WkVelYT9D9 , WkVelZT1D1 , WkVelZT1D2 , WkVelZT1D3 , & + WkVelZT1D4 , WkVelZT1D5 , WkVelZT1D6 , WkVelZT1D7 , WkVelZT1D8 , WkVelZT1D9 , WkVelZT2D1 , WkVelZT2D2 , & + WkVelZT2D3 , WkVelZT2D4 , WkVelZT2D5 , WkVelZT2D6 , WkVelZT2D7 , WkVelZT2D8 , WkVelZT2D9 , WkVelZT3D1 , & + WkVelZT3D2 , WkVelZT3D3 , WkVelZT3D4 , WkVelZT3D5 , WkVelZT3D6 , WkVelZT3D7 , WkVelZT3D8 , WkVelZT3D9 , & + WkVelZT4D1 , WkVelZT4D2 , WkVelZT4D3 , WkVelZT4D4 , WkVelZT4D5 , WkVelZT4D6 , WkVelZT4D7 , WkVelZT4D8 , & + WkVelZT4D9 , WkVelZT5D1 , WkVelZT5D2 , WkVelZT5D3 , WkVelZT5D4 , WkVelZT5D5 , WkVelZT5D6 , WkVelZT5D7 , & + WkVelZT5D8 , WkVelZT5D9 , WkVelZT6D1 , WkVelZT6D2 , WkVelZT6D3 , WkVelZT6D4 , WkVelZT6D5 , WkVelZT6D6 , & + WkVelZT6D7 , WkVelZT6D8 , WkVelZT6D9 , WkVelZT7D1 , WkVelZT7D2 , WkVelZT7D3 , WkVelZT7D4 , WkVelZT7D5 , & + WkVelZT7D6 , WkVelZT7D7 , WkVelZT7D8 , WkVelZT7D9 , WkVelZT8D1 , WkVelZT8D2 , WkVelZT8D3 , WkVelZT8D4 , & + WkVelZT8D5 , WkVelZT8D6 , WkVelZT8D7 , WkVelZT8D8 , WkVelZT8D9 , WkVelZT9D1 , WkVelZT9D2 , WkVelZT9D3 , & + WkVelZT9D4 , WkVelZT9D5 , WkVelZT9D6 , WkVelZT9D7 , WkVelZT9D8 , WkVelZT9D9 , YawErrT1 , YawErrT2 , & + YawErrT3 , YawErrT4 , YawErrT5 , YawErrT6 , YawErrT7 , YawErrT8 , YawErrT9 /) + ParamUnitsAry(1:2040) = (/ & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) "/) + ParamUnitsAry(2041:4080) = (/ & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) "/) + ParamUnitsAry(4081:6120) = (/ & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ","(m^2/s) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ","(user) ", & + "(user) ","(user) ","(user) ","(user) ","(user) ","(percent) ","(percent) ","(percent) ", & + "(percent) ","(percent) ","(percent) ","(percent) ","(percent) ","(percent) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) "/) + ParamUnitsAry(6121:8160) = (/ & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) "/) + ParamUnitsAry(8161:9423) = (/ & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) "/) + + + + ! Initialize values + ErrStat = ErrID_None + ErrMsg = "" + InvalidOutput = .FALSE. + +! ..... Developer must add checking for invalid inputs here: ..... + + + ! Check Output radii and make sure they are >= 0 and <= Nr-1 : NOTE: This was actually already done during the input file read. + do i = 1,farm%p%NOutRadii + if ( (farm%p%OutRadii(i) < 0) .or. (farm%p%OutRadii(i) >= farm%AWAE%p%NumRadii) ) then + + InvalidOutput( CtTN (i, :) ) = .true. + InvalidOutput( WkDfVxTND(i,:,1) ) = .true. + InvalidOutput( WkDfVrTND(i,:,1) ) = .true. + InvalidOutput( EddVisTND(i,:,1) ) = .true. + InvalidOutput( EddAmbTND(i,:,1) ) = .true. + InvalidOutput( EddShrTND(i,:,1) ) = .true. + InvalidOutput( WkDfVxTND(i,:,2) ) = .true. + InvalidOutput( WkDfVrTND(i,:,2) ) = .true. + InvalidOutput( EddVisTND(i,:,2) ) = .true. + InvalidOutput( EddAmbTND(i,:,2) ) = .true. + InvalidOutput( EddShrTND(i,:,2) ) = .true. + InvalidOutput( WkDfVxTND(i,:,3) ) = .true. + InvalidOutput( WkDfVrTND(i,:,3) ) = .true. + InvalidOutput( EddVisTND(i,:,3) ) = .true. + InvalidOutput( EddAmbTND(i,:,3) ) = .true. + InvalidOutput( EddShrTND(i,:,3) ) = .true. + InvalidOutput( WkDfVxTND(i,:,4) ) = .true. + InvalidOutput( WkDfVrTND(i,:,4) ) = .true. + InvalidOutput( EddVisTND(i,:,4) ) = .true. + InvalidOutput( EddAmbTND(i,:,4) ) = .true. + InvalidOutput( EddShrTND(i,:,4) ) = .true. + InvalidOutput( WkDfVxTND(i,:,5) ) = .true. + InvalidOutput( WkDfVrTND(i,:,5) ) = .true. + InvalidOutput( EddVisTND(i,:,5) ) = .true. + InvalidOutput( EddAmbTND(i,:,5) ) = .true. + InvalidOutput( EddShrTND(i,:,5) ) = .true. + InvalidOutput( WkDfVxTND(i,:,6) ) = .true. + InvalidOutput( WkDfVrTND(i,:,6) ) = .true. + InvalidOutput( EddVisTND(i,:,6) ) = .true. + InvalidOutput( EddAmbTND(i,:,6) ) = .true. + InvalidOutput( EddShrTND(i,:,6) ) = .true. + InvalidOutput( WkDfVxTND(i,:,7) ) = .true. + InvalidOutput( WkDfVrTND(i,:,7) ) = .true. + InvalidOutput( EddVisTND(i,:,7) ) = .true. + InvalidOutput( EddAmbTND(i,:,7) ) = .true. + InvalidOutput( EddShrTND(i,:,7) ) = .true. + InvalidOutput( WkDfVxTND(i,:,8) ) = .true. + InvalidOutput( WkDfVrTND(i,:,8) ) = .true. + InvalidOutput( EddVisTND(i,:,8) ) = .true. + InvalidOutput( EddAmbTND(i,:,8) ) = .true. + InvalidOutput( EddShrTND(i,:,8) ) = .true. + InvalidOutput( WkDfVxTND(i,:,9) ) = .true. + InvalidOutput( WkDfVrTND(i,:,9) ) = .true. + InvalidOutput( EddVisTND(i,:,9) ) = .true. + InvalidOutput( EddAmbTND(i,:,9) ) = .true. + InvalidOutput( EddShrTND(i,:,9) ) = .true. + + end if + end do + + + DO i = farm%p%NOutRadii+1,20 + + InvalidOutput( CtTN (i, :) ) = .true. + InvalidOutput( WkDfVxTND(i,:,1) ) = .true. + InvalidOutput( WkDfVrTND(i,:,1) ) = .true. + InvalidOutput( EddVisTND(i,:,1) ) = .true. + InvalidOutput( EddAmbTND(i,:,1) ) = .true. + InvalidOutput( EddShrTND(i,:,1) ) = .true. + InvalidOutput( WkDfVxTND(i,:,2) ) = .true. + InvalidOutput( WkDfVrTND(i,:,2) ) = .true. + InvalidOutput( EddVisTND(i,:,2) ) = .true. + InvalidOutput( EddAmbTND(i,:,2) ) = .true. + InvalidOutput( EddShrTND(i,:,2) ) = .true. + InvalidOutput( WkDfVxTND(i,:,3) ) = .true. + InvalidOutput( WkDfVrTND(i,:,3) ) = .true. + InvalidOutput( EddVisTND(i,:,3) ) = .true. + InvalidOutput( EddAmbTND(i,:,3) ) = .true. + InvalidOutput( EddShrTND(i,:,3) ) = .true. + InvalidOutput( WkDfVxTND(i,:,4) ) = .true. + InvalidOutput( WkDfVrTND(i,:,4) ) = .true. + InvalidOutput( EddVisTND(i,:,4) ) = .true. + InvalidOutput( EddAmbTND(i,:,4) ) = .true. + InvalidOutput( EddShrTND(i,:,4) ) = .true. + InvalidOutput( WkDfVxTND(i,:,5) ) = .true. + InvalidOutput( WkDfVrTND(i,:,5) ) = .true. + InvalidOutput( EddVisTND(i,:,5) ) = .true. + InvalidOutput( EddAmbTND(i,:,5) ) = .true. + InvalidOutput( EddShrTND(i,:,5) ) = .true. + InvalidOutput( WkDfVxTND(i,:,6) ) = .true. + InvalidOutput( WkDfVrTND(i,:,6) ) = .true. + InvalidOutput( EddVisTND(i,:,6) ) = .true. + InvalidOutput( EddAmbTND(i,:,6) ) = .true. + InvalidOutput( EddShrTND(i,:,6) ) = .true. + InvalidOutput( WkDfVxTND(i,:,7) ) = .true. + InvalidOutput( WkDfVrTND(i,:,7) ) = .true. + InvalidOutput( EddVisTND(i,:,7) ) = .true. + InvalidOutput( EddAmbTND(i,:,7) ) = .true. + InvalidOutput( EddShrTND(i,:,7) ) = .true. + InvalidOutput( WkDfVxTND(i,:,8) ) = .true. + InvalidOutput( WkDfVrTND(i,:,8) ) = .true. + InvalidOutput( EddVisTND(i,:,8) ) = .true. + InvalidOutput( EddAmbTND(i,:,8) ) = .true. + InvalidOutput( EddShrTND(i,:,8) ) = .true. + InvalidOutput( WkDfVxTND(i,:,9) ) = .true. + InvalidOutput( WkDfVrTND(i,:,9) ) = .true. + InvalidOutput( EddVisTND(i,:,9) ) = .true. + InvalidOutput( EddAmbTND(i,:,9) ) = .true. + InvalidOutput( EddShrTND(i,:,9) ) = .true. + + END DO + + DO i = farm%p%NOutDist+1,9 + + InvalidOutput( WkAxsXTD ( i,:) ) = .true. + InvalidOutput( WkAxsYTD ( i,:) ) = .true. + InvalidOutput( WkAxsZTD ( i,:) ) = .true. + InvalidOutput( WkPosXTD ( i,:) ) = .true. + InvalidOutput( WkPosYTD ( i,:) ) = .true. + InvalidOutput( WkPosZTD ( i,:) ) = .true. + InvalidOutput( WkVelXTD ( i,:) ) = .true. + InvalidOutput( WkVelYTD ( i,:) ) = .true. + InvalidOutput( WkVelZTD ( i,:) ) = .true. + InvalidOutput( WkDiamTD ( i,:) ) = .true. + InvalidOutput( WkDfVxTND(:,i,1) ) = .true. + InvalidOutput( WkDfVrTND(:,i,1) ) = .true. + InvalidOutput( EddVisTND(:,i,1) ) = .true. + InvalidOutput( EddAmbTND(:,i,1) ) = .true. + InvalidOutput( EddShrTND(:,i,1) ) = .true. + InvalidOutput( WkDfVxTND(:,i,2) ) = .true. + InvalidOutput( WkDfVrTND(:,i,2) ) = .true. + InvalidOutput( EddVisTND(:,i,2) ) = .true. + InvalidOutput( EddAmbTND(:,i,2) ) = .true. + InvalidOutput( EddShrTND(:,i,2) ) = .true. + InvalidOutput( WkDfVxTND(:,i,3) ) = .true. + InvalidOutput( WkDfVrTND(:,i,3) ) = .true. + InvalidOutput( EddVisTND(:,i,3) ) = .true. + InvalidOutput( EddAmbTND(:,i,3) ) = .true. + InvalidOutput( EddShrTND(:,i,3) ) = .true. + InvalidOutput( WkDfVxTND(:,i,4) ) = .true. + InvalidOutput( WkDfVrTND(:,i,4) ) = .true. + InvalidOutput( EddVisTND(:,i,4) ) = .true. + InvalidOutput( EddAmbTND(:,i,4) ) = .true. + InvalidOutput( EddShrTND(:,i,4) ) = .true. + InvalidOutput( WkDfVxTND(:,i,5) ) = .true. + InvalidOutput( WkDfVrTND(:,i,5) ) = .true. + InvalidOutput( EddVisTND(:,i,5) ) = .true. + InvalidOutput( EddAmbTND(:,i,5) ) = .true. + InvalidOutput( EddShrTND(:,i,5) ) = .true. + InvalidOutput( WkDfVxTND(:,i,6) ) = .true. + InvalidOutput( WkDfVrTND(:,i,6) ) = .true. + InvalidOutput( EddVisTND(:,i,6) ) = .true. + InvalidOutput( EddAmbTND(:,i,6) ) = .true. + InvalidOutput( EddShrTND(:,i,6) ) = .true. + InvalidOutput( WkDfVxTND(:,i,7) ) = .true. + InvalidOutput( WkDfVrTND(:,i,7) ) = .true. + InvalidOutput( EddVisTND(:,i,7) ) = .true. + InvalidOutput( EddAmbTND(:,i,7) ) = .true. + InvalidOutput( EddShrTND(:,i,7) ) = .true. + InvalidOutput( WkDfVxTND(:,i,8) ) = .true. + InvalidOutput( WkDfVrTND(:,i,8) ) = .true. + InvalidOutput( EddVisTND(:,i,8) ) = .true. + InvalidOutput( EddAmbTND(:,i,8) ) = .true. + InvalidOutput( EddShrTND(:,i,8) ) = .true. + InvalidOutput( WkDfVxTND(:,i,9) ) = .true. + InvalidOutput( WkDfVrTND(:,i,9) ) = .true. + InvalidOutput( EddVisTND(:,i,9) ) = .true. + InvalidOutput( EddAmbTND(:,i,9) ) = .true. + InvalidOutput( EddShrTND(:,i,9) ) = .true. + + END DO + + do i = farm%p%NOutTurb+1,9 + + InvalidOutput( SCTIn ( :,i) ) = .true. + InvalidOutput( SCTOt ( :,i) ) = .true. + InvalidOutput( RtAxsXT (i) ) = .true. + InvalidOutput( RtAxsYT (i) ) = .true. + InvalidOutput( RtAxsZT (i) ) = .true. + InvalidOutput( RtPosXT (i) ) = .true. + InvalidOutput( RtPosYT (i) ) = .true. + InvalidOutput( RtPosZT (i) ) = .true. + InvalidOutput( RtDiamT (i) ) = .true. + InvalidOutput( YawErrT (i) ) = .true. + InvalidOutput( TIAmbT (i) ) = .true. + InvalidOutput( RtVAmbT (i) ) = .true. + InvalidOutput( RtVRelT (i) ) = .true. + InvalidOutput( CtTN (:, i) ) = .true. + InvalidOutput( WkAxsXTD ( :,i) ) = .true. + InvalidOutput( WkAxsYTD ( :,i) ) = .true. + InvalidOutput( WkAxsZTD ( :,i) ) = .true. + InvalidOutput( WkPosXTD ( :,i) ) = .true. + InvalidOutput( WkPosYTD ( :,i) ) = .true. + InvalidOutput( WkPosZTD ( :,i) ) = .true. + InvalidOutput( WkVelXTD ( :,i) ) = .true. + InvalidOutput( WkVelYTD ( :,i) ) = .true. + InvalidOutput( WkVelZTD ( :,i) ) = .true. + InvalidOutput( WkDiamTD ( :,i) ) = .true. + InvalidOutput( WkDfVxTND(:,1,i) ) = .true. + InvalidOutput( WkDfVrTND(:,1,i) ) = .true. + InvalidOutput( EddVisTND(:,1,i) ) = .true. + InvalidOutput( EddAmbTND(:,1,i) ) = .true. + InvalidOutput( EddShrTND(:,1,i) ) = .true. + InvalidOutput( WkDfVxTND(:,2,i) ) = .true. + InvalidOutput( WkDfVrTND(:,2,i) ) = .true. + InvalidOutput( EddVisTND(:,2,i) ) = .true. + InvalidOutput( EddAmbTND(:,2,i) ) = .true. + InvalidOutput( EddShrTND(:,2,i) ) = .true. + InvalidOutput( WkDfVxTND(:,3,i) ) = .true. + InvalidOutput( WkDfVrTND(:,3,i) ) = .true. + InvalidOutput( EddVisTND(:,3,i) ) = .true. + InvalidOutput( EddAmbTND(:,3,i) ) = .true. + InvalidOutput( EddShrTND(:,3,i) ) = .true. + InvalidOutput( WkDfVxTND(:,4,i) ) = .true. + InvalidOutput( WkDfVrTND(:,4,i) ) = .true. + InvalidOutput( EddVisTND(:,4,i) ) = .true. + InvalidOutput( EddAmbTND(:,4,i) ) = .true. + InvalidOutput( EddShrTND(:,4,i) ) = .true. + InvalidOutput( WkDfVxTND(:,5,i) ) = .true. + InvalidOutput( WkDfVrTND(:,5,i) ) = .true. + InvalidOutput( EddVisTND(:,5,i) ) = .true. + InvalidOutput( EddAmbTND(:,5,i) ) = .true. + InvalidOutput( EddShrTND(:,5,i) ) = .true. + InvalidOutput( WkDfVxTND(:,6,i) ) = .true. + InvalidOutput( WkDfVrTND(:,6,i) ) = .true. + InvalidOutput( EddVisTND(:,6,i) ) = .true. + InvalidOutput( EddAmbTND(:,6,i) ) = .true. + InvalidOutput( EddShrTND(:,6,i) ) = .true. + InvalidOutput( WkDfVxTND(:,7,i) ) = .true. + InvalidOutput( WkDfVrTND(:,7,i) ) = .true. + InvalidOutput( EddVisTND(:,7,i) ) = .true. + InvalidOutput( EddAmbTND(:,7,i) ) = .true. + InvalidOutput( EddShrTND(:,7,i) ) = .true. + InvalidOutput( WkDfVxTND(:,8,i) ) = .true. + InvalidOutput( WkDfVrTND(:,8,i) ) = .true. + InvalidOutput( EddVisTND(:,8,i) ) = .true. + InvalidOutput( EddAmbTND(:,8,i) ) = .true. + InvalidOutput( EddShrTND(:,8,i) ) = .true. + InvalidOutput( WkDfVxTND(:,9,i) ) = .true. + InvalidOutput( WkDfVrTND(:,9,i) ) = .true. + InvalidOutput( EddVisTND(:,9,i) ) = .true. + InvalidOutput( EddAmbTND(:,9,i) ) = .true. + InvalidOutput( EddShrTND(:,9,i) ) = .true. + + end do + + do i = farm%SC%p%nInpGlobal+1,9 + InvalidOutput( SCGblIn (i ) ) = .true. + end do + + do i = farm%SC%p%NumSC2CtrlGlob+1,9 + InvalidOutput( SCGblOt (i ) ) = .true. + end do + + do i = farm%SC%p%NumCtrl2SC+1,9 + InvalidOutput( SCTIn (i,:) ) = .true. + end do + + do i = farm%SC%p%NumSC2Ctrl+1,9 + InvalidOutput( SCTOt (i,:) ) = .true. + end do + + ! Add checks for the WindVel locations based on knowledge of the wind grids and NWindVel + do i = 1, farm%p%NWindVel + if (.not. PointInAABB(farm%p%WindVelX(i), farm%p%WindVelY(i), farm%p%WindVelZ(i), farm%AWAE%p%X0_low, farm%AWAE%p%Y0_low,farm%AWAE%p%Z0_low, farm%AWAE%p%X0_low+(farm%AWAE%p%nX_low-1)*farm%AWAE%p%dX_low, farm%AWAE%p%Y0_low+(farm%AWAE%p%nY_low-1)*farm%AWAE%p%dY_low, farm%AWAE%p%Z0_low+(farm%AWAE%p%nZ_low-1)*farm%AWAE%p%dZ_low) ) then + InvalidOutput( WVAmbX (i) ) = .true. + InvalidOutput( WVAmbY (i) ) = .true. + InvalidOutput( WVAmbZ (i) ) = .true. + InvalidOutput( WVDisX (i) ) = .true. + InvalidOutput( WVDisY (i) ) = .true. + InvalidOutput( WVDisZ (i) ) = .true. + end if + end do + + do i = farm%p%NWindVel+1, 9 + InvalidOutput( WVAmbX (i) ) = .true. + InvalidOutput( WVAmbY (i) ) = .true. + InvalidOutput( WVAmbZ (i) ) = .true. + InvalidOutput( WVDisX (i) ) = .true. + InvalidOutput( WVDisY (i) ) = .true. + InvalidOutput( WVDisZ (i) ) = .true. + end do + ! +! ................. End of validity checking ................. + + + !------------------------------------------------------------------------------------------------- + ! Allocate and set index, name, and units for the output channels + ! If a selected output channel is not available in this module, set error flag. + !------------------------------------------------------------------------------------------------- + + ALLOCATE ( farm%p%OutParam(0:farm%p%NumOuts) , STAT=ErrStat2 ) + IF ( ErrStat2 /= 0_IntKi ) THEN + CALL SetErrStat( ErrID_Fatal,"Error allocating memory for the fast-farm OutParam array.", ErrStat, ErrMsg, RoutineName ) + RETURN + ENDIF + + ! Set index, name, and units for the time output channel: + + farm%p%OutParam(0)%Indx = Farm_Time_Indx + farm%p%OutParam(0)%Name = "Time" ! OutParam(0) is the time channel by default. + farm%p%OutParam(0)%Units = "(s)" + farm%p%OutParam(0)%SignM = 1 + + + ! Set index, name, and units for all of the output channels. + ! If a selected output channel is not available by this module set ErrStat = ErrID_Warn. + + DO I = 1,farm%p%NumOuts + + farm%p%OutParam(I)%Name = OutList(I) + OutListTmp = OutList(I) + + ! Reverse the sign (+/-) of the output channel if the user prefixed the + ! channel name with a "-", "_", "m", or "M" character indicating "minus". + + + + IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN + farm%p%OutParam(I)%SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a minus sign because no valid channels start with m or M) + CheckOutListAgain = .TRUE. + farm%p%OutParam(I)%SignM = -1 + OutListTmp = OutListTmp(2:) + ELSE + farm%p%OutParam(I)%SignM = 1 + END IF + + CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case + + Indx = IndexCharAry( OutListTmp(1:Farm_OutStrLenM1), ValidParamAry ) + + + ! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1) + + IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again + farm%p%OutParam(I)%SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + + Indx = IndexCharAry( OutListTmp(1:Farm_OutStrLenM1), ValidParamAry ) + END IF + + + IF ( Indx > 0 ) THEN ! we found the channel name + farm%p%OutParam(I)%Indx = ParamIndxAry(Indx) + IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings + farm%p%OutParam(I)%Units = "INVALID" + farm%p%OutParam(I)%SignM = 0 + ELSE + farm%p%OutParam(I)%Units = ParamUnitsAry(Indx) ! it's a valid output + END IF + ELSE ! this channel isn't valid + farm%p%OutParam(I)%Indx = Farm_Time_Indx ! pick any valid channel (I just picked "Time" here because it's universal) + farm%p%OutParam(I)%Units = "INVALID" + farm%p%OutParam(I)%SignM = 0 ! multiply all results by zero + + CALL SetErrStat(ErrID_Fatal, TRIM(farm%p%OutParam(I)%Name)//" is not an available output channel.",ErrStat,ErrMsg,RoutineName) + END IF + + END DO + + RETURN +END SUBROUTINE Farm_SetOutParam +!---------------------------------------------------------------------------------------------------------------------------------- +!End of code generated by Matlab script +!********************************************************************************************************************************** + + +end module FAST_Farm_IO diff --git a/glue-codes/fast-farm/src/FAST_Farm_Registry.txt b/glue-codes/fast-farm/src/FAST_Farm_Registry.txt new file mode 100644 index 0000000000..0f20a1d3fd --- /dev/null +++ b/glue-codes/fast-farm/src/FAST_Farm_Registry.txt @@ -0,0 +1,133 @@ +################################################################################################################################### +# Registry for FAST_Farm in the FAST Modularization Framework +# This Registry file is used to create MODULE FAST_Farm_Types, which contains all of the user-defined types needed in fast_farm. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# +# Entries are of the form +# keyword +# +# Use ^ as a shortcut for the value from the previous line. +# See NWTC Programmer's Handbook at https://nwtc.nrel.gov/FAST-Developers for further information on the format/contents of this file. +################################################################################################################################### + +# ...... Include files (definitions from NWTC Library) ............................................................................ +include Registry_NWTC_Library.txt +usefrom FASTWrapper_Registry.txt +usefrom WakeDynamics_Registry.txt +usefrom AWAE_Registry.txt +usefrom SuperController_Registry.txt + +param FAST_Farm/Farm - INTEGER NumFFModules - 4 - "The number of modules available in FAST.Farm" - +param ^ - INTEGER ModuleFF_None - 0 - "No module selected" - +param ^ - INTEGER ModuleFF_SC - 1 - "Super Controller" - +param ^ - INTEGER ModuleFF_FWrap - 2 - "FAST Wrapper" - +param ^ - INTEGER ModuleFF_WD - 3 - "Wake Dynamics" - +param ^ - INTEGER ModuleFF_AWAE - 4 - "Ambient Wind and Array Effects" - +# ..... Parameters ................................................................................................................ +typedef FAST_Farm/Farm ParameterType DbKi DT_low - - - "Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step" seconds +typedef ^ ParameterType DbKi DT_high - - - "High-resolution time step" seconds +typedef ^ ParameterType DbKi TMax - - - "Total run time" seconds +typedef ^ ParameterType IntKi n_high_low - - - "Number of high-resolution time steps per low-resolution time step" - +typedef ^ ParameterType IntKi NumTurbines - - - "Number of turbines in the simulation" - +typedef ^ ParameterType CHARACTER(1024) WindFilePath - - - "Path name of wind data files from ABLSolver precursor" - +typedef ^ ParameterType CHARACTER(1024) SC_FileName - - - "Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms" - +typedef ^ ParameterType LOGICAL UseSC - - - "Use a super controller?" - +typedef ^ ParameterType ReKi WT_Position {:}{:} - - "X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number" meters +typedef ^ ParameterType CHARACTER(1024) WT_FASTInFile {:} - - "Name of input file for each turbine" - +typedef ^ ParameterType CHARACTER(1024) FTitle - - - "The description line from the primary FAST.Farm input file" - +typedef ^ ParameterType CHARACTER(1024) OutFileRoot - - - "The root name derived from the primary FAST.Farm input file" - +typedef ^ ParameterType INTEGER n_ChkptTime - - - "Number of time steps between writing checkpoint files" - +typedef ^ ParameterType DbKi TStart - - - "Time to begin tabular output" s +typedef ^ ParameterType IntKi n_TMax - - - "Number of the time step of TMax (the end time of the simulation)" - +# parameters for data output to files: +typedef ^ ParameterType LOGICAL SumPrint - - - "Print summary data to file? (.sum)" - +typedef ^ ParameterType LOGICAL WrBinOutFile - - - "Write a binary output file? (.outb)" - +typedef ^ ParameterType LOGICAL WrTxtOutFile - - - "Write a text (formatted) output file? (.out)" - +typedef ^ ParameterType CHARACTER(1) Delim - - - "Delimiter between columns of text output file (.out): space or tab" - +typedef ^ ParameterType CHARACTER(20) OutFmt - - - "Format used for text tabular output (except time); resulting field should be 10 characters" - +typedef ^ ParameterType CHARACTER(20) OutFmt_t - - - "Format used for time channel in text tabular output; resulting field should be 10 characters" - +typedef ^ ParameterType IntKi FmtWidth - - - "width of the time OutFmt specifier" - +typedef ^ ParameterType IntKi TChanLen - - - "width of the time channel" - +typedef ^ ParameterType IntKi NOutTurb - - - "Number of turbines for write output [1 to 9]" +typedef ^ ParameterType IntKi NOutRadii - - - "Number of radial nodes for wake output for an individual rotor [0 to 20]" - +typedef ^ ParameterType IntKi OutRadii {:} - - "List of radial nodes for wake output for an individual rotor [1 to NOutRadii]" - +typedef ^ ParameterType IntKi NOutDist - - - "Number of downstream distances for wake output for an individual rotor [0 to 9]" - +typedef ^ ParameterType ReKi OutDist {:} - - "List of downstream distances for wake output for an individual rotor [1 to NOutDist]" meters +typedef ^ ParameterType IntKi NWindVel - - - "Number of points for wind output [0 to 9]" - +typedef ^ ParameterType ReKi WindVelX {:} - - "List of coordinates in the X direction for wind output [1 to NWindVel]" meters +typedef ^ ParameterType ReKi WindVelY {:} - - "List of coordinates in the Y direction for wind output [1 to NWindVel]" meters +typedef ^ ParameterType ReKi WindVelZ {:} - - "List of coordinates in the Z direction for wind output [1 to NWindVel]" meters +typedef ^ ParameterType OutParmType OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - +typedef ^ ParameterType IntKi NumOuts - - - "Number of user-requested outputs" - +typedef ^ ParameterType IntKi NOutSteps - - - "Maximum number of output steps" - +typedef ^ ParameterType CHARACTER(1024) FileDescLines {3} - - "File Description lines" - +typedef ^ ParameterType ProgDesc Module_Ver {NumModules} - - "Version information from all modules" + +typedef ^ ParameterType IntKi UnOu - - - "File unit for Fast.Farm output data" - +typedef ^ ParameterType ReKi dX_low - - - "The spacing of the low-resolution nodes in X direction" m +typedef ^ ParameterType ReKi dY_low - - - "The spacing of the low-resolution nodes in Y direction" m +typedef ^ ParameterType ReKi dZ_low - - - "The spacing of the low-resolution nodes in Z direction" m +typedef ^ ParameterType IntKi nX_low - - - "Number of low-resolution spatial nodes in X direction" - +typedef ^ ParameterType IntKi nY_low - - - "Number of low-resolution spatial nodes in Y direction" - +typedef ^ ParameterType IntKi nZ_low - - - "Number of low-resolution spatial nodes in Z direction" - +typedef ^ ParameterType ReKi X0_low - - - "X-component of the origin of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi Y0_low - - - "Y-component of the origin of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi Z0_low - - - "Z-component of the origin of the low-resolution spatial domain" m +# ..... FAST MiscVar data ....................................................................................................... +typedef ^ MiscVarType ReKi AllOuts {:} - - "An array holding the value of all of the calculated (not only selected) output channels" "see OutListParameters.xlsx spreadsheet" +typedef ^ ^ DbKi TimeData {:} - - "Array to contain the time output data for the binary file (first output time and a time [fixed] increment)" +typedef ^ ^ ReKi AllOutData {:}{:} - - "Array to contain all the output data (time history of all outputs); Index 1 is NumOuts, Index 2 is Time step" +typedef ^ ^ IntKi n_Out - - - "Time index into the AllOutData array" + +# ..... FASTWrapper data ....................................................................................................... +typedef ^ FASTWrapper_Data FWrap_ContinuousStateType x - - - "Continuous states" +typedef ^ ^ FWrap_DiscreteStateType xd - - - "Discrete states" +typedef ^ ^ FWrap_ConstraintStateType z - - - "Constraint states" +typedef ^ ^ FWrap_OtherStateType OtherSt - - - "Other states" +typedef ^ ^ FWrap_ParameterType p - - - "Parameters" +typedef ^ ^ FWrap_InputType u - - - "System inputs" +typedef ^ ^ FWrap_OutputType y - - - "System outputs" +typedef ^ ^ FWrap_MiscVarType m - - - "Misc/optimization variables" +typedef ^ ^ logical IsInitialized - .FALSE. - "Has FWrap_Init been called" + +# ..... WakeDynamics data ....................................................................................................... +typedef ^ WakeDynamics_Data WD_ContinuousStateType x - - - "Continuous states" +typedef ^ ^ WD_DiscreteStateType xd - - - "Discrete states" +typedef ^ ^ WD_ConstraintStateType z - - - "Constraint states" +typedef ^ ^ WD_OtherStateType OtherSt - - - "Other states" +typedef ^ ^ WD_ParameterType p - - - "Parameters" +typedef ^ ^ WD_InputType u - - - "System inputs" +typedef ^ ^ WD_OutputType y - - - "System outputs" +typedef ^ ^ WD_MiscVarType m - - - "Misc/optimization variables" +typedef ^ ^ logical IsInitialized - .FALSE. - "Has WD_Init been called" + +# ..... AWAE data ....................................................................................................... +typedef ^ AWAE_Data AWAE_ContinuousStateType x - - - "Continuous states" +typedef ^ ^ AWAE_DiscreteStateType xd - - - "Discrete states" +typedef ^ ^ AWAE_ConstraintStateType z - - - "Constraint states" +typedef ^ ^ AWAE_OtherStateType OtherSt - - - "Other states" +typedef ^ ^ AWAE_ParameterType p - - - "Parameters" +typedef ^ ^ AWAE_InputType u - - - "System inputs" +typedef ^ ^ AWAE_OutputType y - - - "System outputs" +typedef ^ ^ AWAE_MiscVarType m - - - "Misc/optimization variables" +typedef ^ ^ logical IsInitialized - .FALSE. - "Has AWAE_Init been called" +# ..... SC data ....................................................................................................... +typedef ^ SC_Data SC_ContinuousStateType x - - - "Continuous states" - +typedef ^ ^ SC_DiscreteStateType xd - - - "Discrete states" +typedef ^ ^ SC_ConstraintStateType z - - - "Constraint states" +typedef ^ ^ SC_OtherStateType OtherState - - - "Other states" +typedef ^ ^ SC_ParameterType p - - - "Parameters" +typedef ^ ^ SC_InputType uInputs - - - "System inputs" +typedef ^ ^ DbKi utimes {1} - - "Current time" s +typedef ^ ^ SC_OutputType y - - - "System outputs" +typedef ^ ^ SC_MiscVarType m - - - "Misc/optimization variables" +typedef ^ ^ logical IsInitialized - .FALSE. - "Has SC_Init been called" +# ..... All submodules' variables................................................................................................. +typedef ^ All_FastFarm_Data Farm_ParameterType p - - - "FAST.Farm parameter data" - +typedef ^ All_FastFarm_Data Farm_MiscVarType m - - - "FAST.Farm misc var data" - +typedef ^ All_FastFarm_Data FASTWrapper_Data FWrap {:} - - "FASTWrapper data (one instance per turbine)" - +typedef ^ All_FastFarm_Data WakeDynamics_Data WD {:} - - "WakeDynamics (WD) data" - +typedef ^ All_FastFarm_Data AWAE_Data AWAE - - - "Ambient Wind & Array Effects (AWAE) data" - +typedef ^ All_FastFarm_Data SC_Data SC - - - "Super Controller (SC) data" - +# ..... FAST.Farm data ................................................................................................................ +# diff --git a/glue-codes/fast-farm/src/FAST_Farm_Subs.f90 b/glue-codes/fast-farm/src/FAST_Farm_Subs.f90 new file mode 100644 index 0000000000..e1e6fdfd1a --- /dev/null +++ b/glue-codes/fast-farm/src/FAST_Farm_Subs.f90 @@ -0,0 +1,2390 @@ +!********************************************************************************************************************************** +!> ## FAST_Farm +!! The FAST_Farm, FAST_Farm_Subs, and FAST_Farm_Types modules make up a driver for the multi-turbine FAST.Farm code. +!! FAST_Farms_Types will be auto-generated by the FAST registry program, based on the variables specified in the +!! FAST_Farm_Registry.txt file. +!! +! .................................................................................................................................. +!! ## LICENSING +!! Copyright (C) 2017 Bonnie Jonkman, independent contributor +!! Copyright (C) 2017 National Renewable Energy Laboratory +!! +!! This file is part of FAST_Farm. +!! +!! Licensed under the Apache License, Version 2.0 (the "License"); +!! you may not use this file except in compliance with the License. +!! You may obtain a copy of the License at +!! +!! http://www.apache.org/licenses/LICENSE-2.0 +!! +!! Unless required by applicable law or agreed to in writing, software +!! distributed under the License is distributed on an "AS IS" BASIS, +!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +!! See the License for the specific language governing permissions and +!! limitations under the License. +!********************************************************************************************************************************** +MODULE FAST_Farm_Subs + + USE FAST_Farm_Types + USE NWTC_Library + USE WakeDynamics + USE AWAE + USE FAST_Farm_IO + USE FAST_Subs + USE FASTWrapper + USE SuperController + +#ifdef _OPENMP + USE OMP_LIB +#endif + + + IMPLICIT NONE + + + + integer, parameter :: maxOutputPoints = 9 + + CONTAINS + + + subroutine TrilinearInterpRegGrid(V, pt, dims, val) + + real(SiKi), intent(in ) :: V(:,0:,0:,0:) !< The volume data being sampled + real(ReKi), intent(in ) :: pt(3) !< The point, in grid coordinates where we want to sample the data + integer(IntKi), intent(in ) :: dims(3) !< The grid dimensions + real(ReKi), intent( out) :: val(3) !< The interpolated value of V at location, pt + + integer(IntKi) :: x0,x1,y0,y1,z0,z1, i + real(ReKi) :: xd,yd,zd,c00(3),c01(3),c10(3),c11(3),c0(3),c1(3) + REAL(ReKi) :: N(8) ! array for holding scaling factors for the interpolation algorithm + REAL(ReKi) :: u(8) ! array for holding the corner values for the interpolation algorithm across a cubic volume + real(ReKi) :: val2(3) + + x0 = min(max(floor(pt(1)),0),dims(1)-1) + x1 = x0 + 1 + if (x0 == (dims(1)-1)) x1 = x0 ! Handle case where x0 is the last index in the grid, in this case xd = 0.0, so the 2nd term in the interpolation will not contribute + xd = 2.0_ReKi * (pt(1) - REAL(x0, ReKi)) - 1.0_ReKi + + y0 = min(max(floor(pt(2)),0),dims(2)-1) + y1 = y0 + 1 + if (y0 == (dims(2)-1)) y1 = y0 ! Handle case where y0 is the last index in the grid, in this case yd = 0.0, so the 2nd term in the interpolation will not contribute + yd = 2.0_ReKi * (pt(2) - REAL(y0, ReKi)) - 1.0_ReKi + + z0 = min(max(floor(pt(3)),0),dims(3)-1) + z1 = z0 + 1 + if (z0 == (dims(3)-1)) z1 = z0 ! Handle case where z0 is the last index in the grid, in this case zd = 0.0, so the 2nd term in the interpolation will not contribute + zd = 2.0_ReKi * (pt(3) - REAL(z0, ReKi)) - 1.0_ReKi + + !------------------------------------------------------------------------------------------------- + ! Interpolate on the grid + !------------------------------------------------------------------------------------------------- + + N(1) = ( 1.0_ReKi + zd )*( 1.0_ReKi - yd )*( 1.0_ReKi - xd ) + N(2) = ( 1.0_ReKi + zd )*( 1.0_ReKi + yd )*( 1.0_ReKi - xd ) + N(3) = ( 1.0_ReKi - zd )*( 1.0_ReKi + yd )*( 1.0_ReKi - xd ) + N(4) = ( 1.0_ReKi - zd )*( 1.0_ReKi - yd )*( 1.0_ReKi - xd ) + N(5) = ( 1.0_ReKi + zd )*( 1.0_ReKi - yd )*( 1.0_ReKi + xd ) + N(6) = ( 1.0_ReKi + zd )*( 1.0_ReKi + yd )*( 1.0_ReKi + xd ) + N(7) = ( 1.0_ReKi - zd )*( 1.0_ReKi + yd )*( 1.0_ReKi + xd ) + N(8) = ( 1.0_ReKi - zd )*( 1.0_ReKi - yd )*( 1.0_ReKi + xd ) + N = N / real( size(N), ReKi ) ! normalize + + do i=1,3 + u(1) = real(V( i, x0, y0, z1 ), ReKi) + u(2) = real(V( i, x0, y1, z1 ), ReKi) + u(3) = real(V( i, x0, y1, z0 ), ReKi) + u(4) = real(V( i, x0, y0, z0 ), ReKi) + u(5) = real(V( i, x1, y0, z1 ), ReKi) + u(6) = real(V( i, x1, y1, z1 ), ReKi) + u(7) = real(V( i, x1, y1, z0 ), ReKi) + u(8) = real(V( i, x1, y0, z0 ), ReKi) + + val(i) = SUM ( N * u ) + end do + + ! + ! + !xd = pt(1) - x0 + !yd = pt(2) - y0 + !zd = pt(3) - z0 + !c00 = V(:,x0,y0,z0)*(1.0_ReKi-xd) + V(:,x1,y0,z0)*xd + !c01 = V(:,x0,y0,z1)*(1.0_ReKi-xd) + V(:,x1,y0,z1)*xd + !c10 = V(:,x0,y1,z0)*(1.0_ReKi-xd) + V(:,x1,y1,z0)*xd + !c11 = V(:,x0,y1,z1)*(1.0_ReKi-xd) + V(:,x1,y1,z1)*xd + ! + !c0 = c00*(1.0_ReKi-yd) + c10*yd + !c1 = c01*(1.0_ReKi-yd) + c11*yd + ! + !val2 = c0 *(1.0_ReKi-zd) + c1 *zd + !do i = 1,3 + ! if ( .not. EqualRealNos(val(i),val2(i)) ) then + ! write(*,*) "Different inpolated wind values: "//trim(Num2LStr(val(1)))//", "//trim(Num2LStr(val(2)))//", "//trim(Num2LStr(val(3)))//", "//trim(Num2LStr(val2(1)))//", "//trim(Num2LStr(val2(2)))//", "//trim(Num2LStr(val2(3))) + ! return + ! end if + !end do + end subroutine TrilinearInterpRegGrid + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine to call Init routine for each module. This routine sets all of the init input data for each module. The initialization algorithm is: \n +!! - Read-In Input File +!! - Check Inputs and Set Parameters +!! - In parallel: +!! 1. CALL AWAE_Init +!! 2. CALL_SC_Init +!! 3. CALL WD_Init +!! - Transfer y_AWAE_Init to u_F_Init and CALL F_Init +!! - Open Output File +!! - n=0 +!! - t=0 +SUBROUTINE Farm_Initialize( farm, InputFile, ErrStat, ErrMsg ) + + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + CHARACTER(*), INTENT(IN ) :: InputFile !< A CHARACTER string containing the name of the primary FAST.Farm input file + + + ! local variables + type(AWAE_InitInputType) :: AWAE_InitInput + type(AWAE_InitOutputType) :: AWAE_InitOutput + + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + TYPE(WD_InitInputType) :: WD_InitInput ! init-input data for WakeDynamics module + TYPE(SC_InitInputType) :: SC_InitInp ! input-file data for SC module + TYPE(SC_InitOutputType) :: SC_InitOut ! Init output for SC module + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_Initialize' + CHARACTER(ChanLen),ALLOCATABLE :: OutList(:) ! list of user-requested output channels + INTEGER(IntKi) :: i + !.......... + ErrStat = ErrID_None + ErrMsg = "" + AbortErrLev = ErrID_Fatal ! Until we read otherwise from the FAST input file, we abort only on FATAL errors + + + ! ... Open and read input files, initialize global parameters. ... + + IF (LEN_TRIM(InputFile) == 0) THEN ! no input file was specified + CALL SetErrStat( ErrID_Fatal, 'The required input file was not specified on the command line.', ErrStat, ErrMsg, RoutineName ) + + CALL NWTC_DisplaySyntax( InputFile, 'FAST.Farm.exe' ) + + RETURN + END IF + + ! Determine the root name of the primary file (will be used for output files) + CALL GetRoot( InputFile, farm%p%OutFileRoot ) + + DO i=1,NumFFModules + farm%p%Module_Ver(i)%Date = 'unknown date' + farm%p%Module_Ver(i)%Ver = 'unknown version' + END DO + farm%p%Module_Ver( ModuleFF_SC )%Name = 'Super Controller' + farm%p%Module_Ver( ModuleFF_FWrap )%Name = 'FAST Wrapper' + farm%p%Module_Ver( ModuleFF_WD )%Name = 'Wake Dynamics' + farm%p%Module_Ver( ModuleFF_AWAE )%Name = 'Ambient Wind and Array Effects' + + !............................................................................................................................... + ! step 1: read input file + !............................................................................................................................... + + call Farm_ReadPrimaryFile( InputFile, farm%p, WD_InitInput%InputFileData, AWAE_InitInput%InputFileData, SC_InitInp, OutList, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + !............................................................................................................................... + ! step 2: validate input & set parameters + !............................................................................................................................... + call Farm_ValidateInput( farm%p, WD_InitInput%InputFileData, AWAE_InitInput%InputFileData, SC_InitInp, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + + farm%p%NOutTurb = min(farm%p%NumTurbines,9) ! We only support output for the first 9 turbines, even if the farm has more than 9 + + farm%p%n_high_low = NINT( farm%p%dt_low / farm%p%dt_high ) + + ! let's make sure the FAST.Farm DT_low is an exact multiple of dt_high + ! (i'm doing this outside of Farm_ValidateInput so we know that dt_low/=0 before computing n_high_low): + IF ( .NOT. EqualRealNos( real(farm%p%DT_low,SiKi), real(farm%p%DT_high,SiKi) * farm%p%n_high_low ) ) THEN + CALL SetErrStat(ErrID_Fatal, "DT_high ("//TRIM(Num2LStr(farm%p%dt_high))//" s) must be an integer divisor of DT_low (" & + //TRIM(Num2LStr(farm%p%dt_low))//" s).", ErrStat, ErrMsg, RoutineName ) + END IF + + farm%p%TChanLen = max( 10, int(log10(farm%p%TMax))+7 ) + farm%p%OutFmt_t = 'F'//trim(num2lstr( farm%p%TChanLen ))//'.4' ! 'F10.4' + farm%p%n_TMax = FLOOR( ( farm%p%TMax / farm%p%DT_low ) ) + 1 ! We're going to go from step 0 to (n_TMax - 1) + ! [note that FAST uses the ceiling function, so it might think we're doing one more step than FAST.Farm; + ! This difference will be a problem only if FAST thinks it's doing FEWER timesteps than FAST.Farm does.] + + IF ( WD_InitInput%InputFileData%NumPlanes > farm%p%n_TMax ) THEN + WD_InitInput%InputFileData%NumPlanes = max( 2, min( WD_InitInput%InputFileData%NumPlanes, farm%p%n_TMax ) ) + call SetErrStat(ErrID_Warn, "For efficiency, NumPlanes has been reduced to the number of time steps ("//TRIM(Num2LStr(WD_InitInput%InputFileData%NumPlanes))//").", ErrStat, ErrMsg, RoutineName ) + ENDIF + + !............................................................................................................................... + ! step 3: initialize SC, AWAE, and WD (a, b, and c can be done in parallel) + !............................................................................................................................... + + !------------------- + ! a. CALL AWAE_Init + + AWAE_InitInput%InputFileData%dr = WD_InitInput%InputFileData%dr + AWAE_InitInput%InputFileData%dt_low = farm%p%dt_low + AWAE_InitInput%InputFileData%NumTurbines = farm%p%NumTurbines + AWAE_InitInput%InputFileData%NumRadii = WD_InitInput%InputFileData%NumRadii + AWAE_InitInput%InputFileData%NumPlanes = WD_InitInput%InputFileData%NumPlanes + AWAE_InitInput%InputFileData%WindFilePath = farm%p%WindFilePath + AWAE_InitInput%n_high_low = farm%p%n_high_low + AWAE_InitInput%NumDT = farm%p%n_TMax + AWAE_InitInput%OutFileRoot = farm%p%OutFileRoot + call AWAE_Init( AWAE_InitInput, farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, farm%AWAE%OtherSt, farm%AWAE%y, & + farm%AWAE%m, farm%p%DT_low, AWAE_InitOutput, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + farm%p%X0_Low = AWAE_InitOutput%X0_Low + farm%p%Y0_low = AWAE_InitOutput%Y0_low + farm%p%Z0_low = AWAE_InitOutput%Z0_low + farm%p%nX_Low = AWAE_InitOutput%nX_Low + farm%p%nY_low = AWAE_InitOutput%nY_low + farm%p%nZ_low = AWAE_InitOutput%nZ_low + farm%p%dX_low = AWAE_InitOutput%dX_low + farm%p%dY_low = AWAE_InitOutput%dY_low + farm%p%dZ_low = AWAE_InitOutput%dZ_low + farm%p%Module_Ver( ModuleFF_AWAE ) = AWAE_InitOutput%Ver + + !------------------- + ! b. CALL SC_Init + if ( farm%p%useSC ) then + SC_InitInp%nTurbines = farm%p%NumTurbines + call SC_Init(SC_InitInp, farm%SC%uInputs, farm%SC%p, farm%SC%x, farm%SC%xd, farm%SC%z, farm%SC%OtherState, & + farm%SC%y, farm%SC%m, farm%p%DT_low, SC_InitOut, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (ErrStat >= AbortErrLev) then + call Cleanup() + return + end if + farm%p%Module_Ver( ModuleFF_SC ) = SC_InitOut%Ver + else + farm%SC%p%nInpGlobal = 0 + farm%SC%p%NumParamGlobal = 0 + farm%SC%p%NumParamTurbine = 0 + farm%SC%p%NumSC2CtrlGlob = 0 + farm%SC%p%NumSC2Ctrl = 0 + farm%SC%p%NumCtrl2SC = 0 + farm%SC%p%NumStatesGlobal = 0 + farm%SC%p%NumStatesTurbine = 0 + SC_InitOut%nInpGlobal = 0 + SC_InitOut%NumSC2CtrlGlob = 0 + SC_InitOut%NumSC2Ctrl = 0 + SC_InitOut%NumCtrl2SC = 0 + allocate(farm%SC%y%fromscglob(0)) + allocate(farm%SC%y%fromsc(0)) + end if + + !------------------- + ! c. initialize WD (one instance per turbine, each can be done in parallel, too) + + call Farm_InitWD( farm, WD_InitInput, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + + !............................................................................................................................... + ! step 4: initialize FAST (each instance of FAST can also be done in parallel) + !............................................................................................................................... + + CALL Farm_InitFAST( farm, WD_InitInput%InputFileData, AWAE_InitOutput, SC_InitOut, farm%SC%y, ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + !............................................................................................................................... + ! step 5: Open output file (or set up output file handling) + !............................................................................................................................... + + ! Set parameters for output channels: + CALL Farm_SetOutParam(OutList, farm, ErrStat2, ErrMsg2 ) ! requires: p%NumOuts, sets: p%OutParam. + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + call Farm_InitOutput( farm, ErrStat, ErrMsg ) + + ! Print the summary file if requested: + IF (farm%p%SumPrint) THEN + CALL Farm_PrintSum( farm, WD_InitInput%InputFileData, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF + + !............................................................................................................................... + ! Destroy initializion data + !............................................................................................................................... + CALL Cleanup() + +CONTAINS + SUBROUTINE Cleanup() + + call WD_DestroyInitInput(WD_InitInput, ErrStat2, ErrMsg2) + call AWAE_DestroyInitInput(AWAE_InitInput, ErrStat2, ErrMsg2) + call AWAE_DestroyInitOutput(AWAE_InitOutput, ErrStat2, ErrMsg2) + + END SUBROUTINE Cleanup + +END SUBROUTINE Farm_Initialize +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine reads in the primary FAST.Farm input file, does some validation, and places the values it reads in the +!! parameter structure (p). It prints to an echo file if requested. +SUBROUTINE Farm_ReadPrimaryFile( InputFile, p, WD_InitInp, AWAE_InitInp, SC_InitInp, OutList, ErrStat, ErrMsg ) + + + ! Passed variables + TYPE(Farm_ParameterType), INTENT(INOUT) :: p !< The parameter data for the FAST (glue-code) simulation + CHARACTER(*), INTENT(IN ) :: InputFile !< Name of the file containing the primary input data + TYPE(WD_InputFileType), INTENT( OUT) :: WD_InitInp !< input-file data for WakeDynamics module + TYPE(AWAE_InputFileType), INTENT( OUT) :: AWAE_InitInp !< input-file data for AWAE module + TYPE(SC_InitInputType), INTENT( OUT) :: SC_InitInp !< input-file data for SC module + CHARACTER(ChanLen),ALLOCATABLE, INTENT( OUT) :: OutList(:) !< list of user-requested output channels + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + ! Local variables: + REAL(DbKi) :: TmpTime ! temporary variable to read SttsTime and ChkptTime before converting to #steps based on DT_low + INTEGER(IntKi) :: I ! loop counter + INTEGER(IntKi) :: UnIn ! Unit number for reading file + INTEGER(IntKi) :: UnEc ! I/O unit for echo file. If > 0, file is open for writing. + + INTEGER(IntKi) :: IOS ! Temporary Error status + INTEGER(IntKi) :: OutFileFmt ! An integer that indicates what kind of tabular output should be generated (1=text, 2=binary, 3=both) + INTEGER(IntKi) :: NLinTimes ! An integer that indicates how many times to linearize + LOGICAL :: Echo ! Determines if an echo file should be written + LOGICAL :: TabDelim ! Determines if text output should be delimited by tabs (true) or space (false) + CHARACTER(1024) :: PriPath ! Path name of the primary file + + CHARACTER(10) :: AbortLevel ! String that indicates which error level should be used to abort the program: WARNING, SEVERE, or FATAL + CHARACTER(30) :: Line ! string for default entry in input file + + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_ReadPrimaryFile' + + + ! Initialize some variables: + UnEc = -1 + Echo = .FALSE. ! Don't echo until we've read the "Echo" flag + CALL GetPath( InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. + + + ! Get an available unit number for the file. + + CALL GetNewUnit( UnIn, ErrStat, ErrMsg ) + IF ( ErrStat >= AbortErrLev ) RETURN + + + ! Open the Primary input file. + + CALL OpenFInpFile ( UnIn, InputFile, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + CALL AllocAry( OutList, Farm_MaxOutPts, "FAST.Farm's Input File's Outlist", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF ( ErrStat >= AbortErrLev ) THEN + CALL Cleanup() + RETURN + END IF + + ! Read the lines up/including to the "Echo" simulation control variable + ! If echo is FALSE, don't write these lines to the echo file. + ! If Echo is TRUE, rewind and write on the second try. + + I = 1 !set the number of times we've read the file + DO + !-------------------------- HEADER --------------------------------------------- + + CALL ReadCom( UnIn, InputFile, 'File header: FAST.Farm Version (line 1)', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + CALL ReadStr( UnIn, InputFile, p%FTitle, 'FTitle', 'File Header: File Description (line 2)', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + !---------------------- SIMULATION CONTROL -------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Simulation Control', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + ! Echo - Echo input data to .ech (flag): + CALL ReadVar( UnIn, InputFile, Echo, "Echo", "Echo input data to .ech (flag)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + IF (.NOT. Echo .OR. I > 1) EXIT !exit this loop + + ! Otherwise, open the echo file, then rewind the input file and echo everything we've read + + I = I + 1 ! make sure we do this only once (increment counter that says how many times we've read this file) + + CALL OpenEcho ( UnEc, TRIM(p%OutFileRoot)//'.ech', ErrStat2, ErrMsg2, Farm_Ver ) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + IF ( UnEc > 0 ) WRITE (UnEc,'(/,A,/)') 'Data from '//TRIM(Farm_Ver%Name)//' primary input file "'//TRIM( InputFile )//'":' + + REWIND( UnIn, IOSTAT=ErrStat2 ) + IF (ErrStat2 /= 0_IntKi ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error rewinding file "'//TRIM(InputFile)//'".',ErrStat,ErrMsg,RoutineName) + call cleanup() + RETURN + END IF + + END DO + + CALL WrScr( ' Heading of the '//TRIM(Farm_Ver%Name)//' input file: ' ) + CALL WrScr( ' '//TRIM( p%FTitle ) ) + + + ! AbortLevel - Error level when simulation should abort: + CALL ReadVar( UnIn, InputFile, AbortLevel, "AbortLevel", "Error level when simulation should abort (string)", & + ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Let's set the abort level here.... knowing that everything before this aborted only on FATAL errors! + CALL Conv2UC( AbortLevel ) !convert to upper case + SELECT CASE( TRIM(AbortLevel) ) + CASE ( "WARNING" ) + AbortErrLev = ErrID_Warn + CASE ( "SEVERE" ) + AbortErrLev = ErrID_Severe + CASE ( "FATAL" ) + AbortErrLev = ErrID_Fatal + CASE DEFAULT + CALL SetErrStat( ErrID_Fatal, 'Invalid AbortLevel specified in FAST.Farm input file. '// & + 'Valid entries are "WARNING", "SEVERE", or "FATAL".',ErrStat,ErrMsg,RoutineName) + call cleanup() + RETURN + END SELECT + + + ! TMax - Total run time (s): + CALL ReadVar( UnIn, InputFile, p%TMax, "TMax", "Total run time (s)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! UseSC - Use a super controller? (flag): + CALL ReadVar( UnIn, InputFile, p%UseSC, "UseSC", "Use a super controller? (flag)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Mod_AmbWind - Ambient wind model (-) (switch) {1: high-fidelity precursor in VTK format, 2: one InflowWind module, 3: multiple InflowWind modules}: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%Mod_AmbWind, "Mod_AmbWind", "Ambient wind model (-) (switch) {1: high-fidelity precursor in VTK format, 2: one InflowWind module, 3: multiple InflowWind modules}", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + !---------------------- SUPER CONTROLLER ------------------------------------------------------------------ + CALL ReadCom( UnIn, InputFile, 'Section Header: Super Controller', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! SC_FileName - Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms (quoated string): + CALL ReadVar( UnIn, InputFile, p%SC_FileName, "SC_FileName", "Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms (quoated string)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + IF ( PathIsRelative( p%SC_FileName ) ) p%SC_FileName = TRIM(PriPath)//TRIM(p%SC_FileName) + SC_InitInp%DLL_FileName = p%SC_FileName + + !---------------------- AMBIENT WIND: PRECURSOR IN VTK FORMAT --------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Ambient Wind: Precursor in VTK Format', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! DT_low - Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0]: + CALL ReadVar( UnIn, InputFile, p%DT_low, "DT_Low-VTK", "Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! DT_high - Time step for high-resolution wind data input files (s) [>0.0]: + CALL ReadVar( UnIn, InputFile, p%DT_high, "DT_High-VTK", "Time step for high-resolution wind data input files (s) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! WindFilePath - Path name of wind data files from ABLSolver precursor (string): + CALL ReadVar( UnIn, InputFile, p%WindFilePath, "WindFilePath", "Path name of wind data files from ABLSolver precursor (string)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + IF ( PathIsRelative( p%WindFilePath ) ) p%WindFilePath = TRIM(PriPath)//TRIM(p%WindFilePath) + + ! ChkWndFiles - Check all the ambient wind files for data consistency? (flag): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%ChkWndFiles, "ChkWndFiles", "Check all the ambient wind files for data consistency? (flag)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + !---------------------- AMBIENT WIND: INFLOWWIND MODULE --------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Ambient Wind: InflowWind Module', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! DT_low - Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%DT_low, "DT_Low", "Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step (s) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + if ( AWAE_InitInp%Mod_AmbWind > 1 ) p%DT_low = AWAE_InitInp%DT_low + + ! DT_high - Time step for high-resolution wind data input files (s) [>0.0]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%DT_high, "DT_High", "Time step for high-resolution wind data input files (s) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + if ( AWAE_InitInp%Mod_AmbWind > 1 ) p%DT_high = AWAE_InitInp%DT_high + + ! NX_Low - Number of low-resolution spatial nodes in X direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nX_Low, "nX_Low", "Number of low-resolution spatial nodes in X direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NY_Low - Number of low-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nY_Low, "nY_Low", "Number of low-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NZ_Low - Number of low-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nZ_Low, "nZ_Low", "Number of low-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! X0_Low - Origin of low-resolution spatial nodes in X direction for wind data interpolation (m): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%X0_Low, "X0_Low", "Origin of low-resolution spatial nodes in X direction for wind data interpolation (m)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Y0_Low - Origin of low-resolution spatial nodes in Y direction for wind data interpolation (m): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%Y0_Low, "Y0_Low", "Origin of low-resolution spatial nodes in Y direction for wind data interpolation (m)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Z0_Low - Origin of low-resolution spatial nodes in Z direction for wind data interpolation (m): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%Z0_Low, "Z0_Low", "Origin of low-resolution spatial nodes in Z direction for wind data interpolation (m)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! dX_Low - Spacing of low-resolution spatial nodes in X direction for wind data interpolation (m) [>0.0]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%dX_Low, "dX_Low", "Spacing of low-resolution spatial nodes in X direction for wind data interpolation (m) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! dY_Low - Spacing of low-resolution spatial nodes in Y direction for wind data interpolation (m) [>0.0]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%dY_Low, "dY_Low", "Spacing of low-resolution spatial nodes in Y direction for wind data interpolation (m) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! dZ_Low - Spacing of low-resolution spatial nodes in Z direction for wind data interpolation (m) [>0.0]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%dZ_Low, "dZ_Low", "Spacing of low-resolution spatial nodes in Z direction for wind data interpolation (m) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NX_High - Number of high-resolution spatial nodes in X direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nX_High, "nX_High", "Number of high-resolution spatial nodes in X direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NY_High - Number of high-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nY_High, "nY_High", "Number of high-resolution spatial nodes in Y direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NZ_High - Number of high-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%nZ_High, "nZ_High", "Number of high-resolution spatial nodes in Z direction for wind data interpolation (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! InflowFile - Name of file containing InflowWind module input parameters (quoted string): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%InflowFile, "InflowFile", "Name of file containing InflowWind module input parameters (quoted string)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + IF ( PathIsRelative( AWAE_InitInp%InflowFile ) ) AWAE_InitInp%InflowFile = TRIM(PriPath)//TRIM(AWAE_InitInp%InflowFile) + if ( AWAE_InitInp%Mod_AmbWind > 1 ) p%WindFilePath = AWAE_InitInp%InflowFile ! For the summary file + + !---------------------- WIND TURBINES --------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Wind Turbines', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + ! NumTurbines - Number of wind turbines (-) [>=1]: + CALL ReadVar( UnIn, InputFile, p%NumTurbines, "NumTurbines", "Number of wind turbines (-) [>=1]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + CALL ReadCom( UnIn, InputFile, 'Section Header: WT column names', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL ReadCom( UnIn, InputFile, 'Section Header: WT column units', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + call AllocAry( p%WT_Position, 3, p%NumTurbines, 'WT_Position', ErrStat2, ErrMsg2); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry( p%WT_FASTInFile, p%NumTurbines, 'WT_FASTInFile', ErrStat2, ErrMsg2); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry( AWAE_InitInp%WT_Position, 3, p%NumTurbines, 'AWAE_InitInp%WT_Position', ErrStat2, ErrMsg2); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + if ( AWAE_InitInp%Mod_AmbWind > 1 ) then + ! Using InflowWind + call AllocAry(AWAE_InitInp%X0_high, p%NumTurbines, 'AWAE_InitInp%X0_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry(AWAE_InitInp%Y0_high, p%NumTurbines, 'AWAE_InitInp%Y0_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry(AWAE_InitInp%Z0_high, p%NumTurbines, 'AWAE_InitInp%Z0_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry(AWAE_InitInp%dX_high, p%NumTurbines, 'AWAE_InitInp%dX_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry(AWAE_InitInp%dY_high, p%NumTurbines, 'AWAE_InitInp%dY_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AllocAry(AWAE_InitInp%dZ_high, p%NumTurbines, 'AWAE_InitInp%dZ_high', ErrStat2, ErrMsg2) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + end if + + ! WT_Position (WT_X, WT_Y, WT_Z) and WT_FASTInFile + do i=1,p%NumTurbines + + if ( AWAE_InitInp%Mod_AmbWind == 1 ) then + READ (UnIn, *, IOSTAT=IOS) p%WT_Position(:,i), p%WT_FASTInFile(i) + else + READ (UnIn, *, IOSTAT=IOS) p%WT_Position(:,i), p%WT_FASTInFile(i), AWAE_InitInp%X0_high(i), AWAE_InitInp%Y0_high(i), AWAE_InitInp%Z0_high(i), AWAE_InitInp%dX_high(i), AWAE_InitInp%dY_high(i), AWAE_InitInp%dZ_high(i) + end if + AWAE_InitInp%WT_Position(:,i) = p%WT_Position(:,i) + + CALL CheckIOS ( IOS, InputFile, 'Wind Turbine Columns', NumType, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + IF ( UnEc > 0 ) THEN + if ( AWAE_InitInp%Mod_AmbWind == 1 ) then + WRITE( UnEc, "(3(ES11.4e2,2X),'""',A,'""',T50,' - WT(',I5,')')" ) p%WT_Position(:,i), TRIM( p%WT_FASTInFile(i) ), I + else + WRITE( UnEc, "(3(ES11.4e2,2X),'""',A,'""',T50,6(ES11.4e2,2X),' - WT(',I5,')')" ) p%WT_Position(:,i), TRIM( p%WT_FASTInFile(i) ), AWAE_InitInp%X0_high(i), AWAE_InitInp%Y0_high(i), AWAE_InitInp%Z0_high(i), AWAE_InitInp%dX_high(i), AWAE_InitInp%dY_high(i), AWAE_InitInp%dZ_high(i), I + end if + + END IF + IF ( PathIsRelative( p%WT_FASTInFile(i) ) ) p%WT_FASTInFile(i) = TRIM(PriPath)//TRIM(p%WT_FASTInFile(i)) + + end do + + + !---------------------- WAKE DYNAMICS --------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Wake Dynamics', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + ! dr - Radial increment of radial finite-difference grid (m) [>0.0]: + CALL ReadVar( UnIn, InputFile, WD_InitInp%dr, "dr", "Radial increment of radial finite-difference grid (m) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NumRadii - Number of radii in the radial finite-difference grid (-) [>=2]: + CALL ReadVar( UnIn, InputFile, WD_InitInp%NumRadii, "NumRadii", "Number of radii in the radial finite-difference grid (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NumPlanes - Number of wake planes (-) [>=2]: + CALL ReadVar( UnIn, InputFile, WD_InitInp%NumPlanes, "NumPlanes", "Number of wake planes (-) [>=2]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! f_c - Cut-off (corner) frequency of the low-pass time-filter for the wake advection, deflection, and meandering model (Hz) [>0.0] or DEFAULT [DEFAULT=0.0007]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%f_c, "f_c", & + "Cut-off (corner) frequency of the low-pass time-filter for the wake advection, deflection, and meandering model (Hz) [>0.0] or DEFAULT [DEFAULT=0.0007]", & + 0.0007_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_HWkDfl_O - Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor (m) or DEFAULT [DEFAULT=0.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_HWkDfl_O, "C_HWkDfl_O", & + "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor (m) or DEFAULT [DEFAULT=0.0]", & + 0.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_HWkDfl_OY - Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error (m/deg) or DEFAULT [DEFAULT=0.3]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_HWkDfl_OY, "C_HWkDfl_OY", & + "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error (m/deg) or DEFAULT [DEFAULT=0.3]", & + 0.3_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + WD_InitInp%C_HWkDfl_OY = WD_InitInp%C_HWkDfl_OY/D2R !immediately convert to m/radians instead of m/degrees + + ! C_HWkDfl_x - Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance (-) or DEFAULT [DEFAULT=0.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_HWkDfl_x, "C_HWkDfl_x", & + "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance (-) or DEFAULT [DEFAULT=0.0]", & + 0.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_HWkDfl_xY - Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error (1/deg) or DEFAULT [DEFAULT=-0.004]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_HWkDfl_xY, "C_HWkDfl_xY", & + "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error (1/deg) or DEFAULT [DEFAULT=-0.004]", & + -0.004_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + WD_InitInp%C_HWkDfl_xY = WD_InitInp%C_HWkDfl_xY/D2R !immediately convert to 1/radians instead of 1/degrees + + + ! C_NearWake - Calibrated parameter for the near-wake correction (-) [>1.0] or DEFAULT [DEFAULT=1.8]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_NearWake, "C_NearWake", & + "Calibrated parameter for the near-wake correction (-) [>1.0] or DEFAULT [DEFAULT=1.8]", & + 1.8_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! k_vAmb - Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-) [>=0.0] or DEFAULT [DEFAULT=0.05 ]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%k_vAmb, "k_vAmb", & + "Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-) [>=0.0] or DEFAULT [DEFAULT=0.05]", & + 0.05_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! k_vShr - Calibrated parameter for the influence of the shear layer in the eddy viscosity (-) [>=0.0] or DEFAULT [DEFAULT=0.016]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%k_vShr, "k_vShr", & + "Calibrated parameter for the influence of the shear layer in the eddy viscosity (-) [>=0.0] or DEFAULT [DEFAULT=0.016]", & + 0.016_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vAmb_DMin - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [DEFAULT=0.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vAmb_DMin, "C_vAmb_DMin", & + "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [DEFAULT=0.0]", & + 0.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vAmb_DMax - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vAmb_DMin ] or DEFAULT [DEFAULT=1.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vAmb_DMax, "C_vAmb_DMax", & + "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vAmb_DMin ] or DEFAULT [DEFAULT=1.0]", & + 1.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vAmb_FMin - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [DEFAULT=1.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vAmb_FMin, "C_vAmb_FMin", & + "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [DEFAULT=1.0]", & + 1.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vAmb_Exp - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [DEFAULT=0.01]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vAmb_Exp, "C_vAmb_Exp", & + "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [DEFAULT=0.01]", & + 0.01_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vShr_DMin - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [DEFAULT=3.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vShr_DMin, "C_vShr_DMin", & + "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-) [>=0.0] or DEFAULT [DEFAULT=3.0]", & + 3.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vShr_DMax - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vShr_DMin] or DEFAULT [DEFAULT=25.0]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vShr_DMax, "C_vShr_DMax", & + "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-) [> C_vShr_DMin] or DEFAULT [DEFAULT=25.0]", & + 25.0_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vShr_FMin - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [DEFAULT=0.2]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vShr_FMin, "C_vShr_FMin", & + "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the value in the minimum region (-) [>=0.0 and <=1.0] or DEFAULT [DEFAULT=0.2]", & + 0.2_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_vShr_Exp - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [DEFAULT=0.1]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_vShr_Exp, "C_vShr_Exp", & + "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-) [> 0.0] or DEFAULT [DEFAULT=0.1]", & + 0.1_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Mod_WakeDiam - Wake diameter calculation model (-) (switch) {1: rotor diameter, 2: velocity-based, 3: mass-flux based, 4: momentum-flux based} or DEFAULT [DEFAULT=1]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%Mod_WakeDiam, "Mod_WakeDiam", & + "Wake diameter calculation model (-) (switch) {1: rotor diameter, 2: velocity-based, 3: mass-flux based, 4: momentum-flux based} or DEFAULT [DEFAULT=1]", & + WakeDiamMod_RotDiam, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_WakeDiam - Calibrated parameter for wake diameter calculation (-) [>0.0 and <1.0] or DEFAULT [DEFAULT=0.95] [unused for Mod_WakeDiam=1]: + CALL ReadVarWDefault( UnIn, InputFile, WD_InitInp%C_WakeDiam, "C_WakeDiam", & + "Calibrated parameter for wake diameter calculation (-) [>0.0 and <1.0] or DEFAULT [DEFAULT=0.95] [unused for Mod_WakeDiam=1]", & + 0.95_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! Mod_Meander - Spatial filter model for wake meandering (-) (switch) {1: uniform, 2: truncated jinc, 3: windowed jinc} or DEFAULT [DEFAULT=3]: + CALL ReadVarWDefault( UnIn, InputFile, AWAE_InitInp%Mod_Meander, "Mod_Meander", & + "Spatial filter model for wake meandering (-) (switch) {1: uniform, 2: truncated jinc, 3: windowed jinc} or DEFAULT [DEFAULT=3]", & + MeanderMod_WndwdJinc, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! C_Meander - Calibrated parameter for wake meandering (-) [>=1.0] or DEFAULT [DEFAULT=1.9]: + CALL ReadVarWDefault( UnIn, InputFile, AWAE_InitInp%C_Meander, "C_Meander", & + "Calibrated parameter for wake meandering (-) [>=1.0] or DEFAULT [DEFAULT=1.9]", & + 1.9_ReKi, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + !---------------------- VISUALIZATION -------------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Visualization', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! WrDisWind - Write disturbed wind data to .Low.Dis.t.vtk etc.? (flag): + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%WrDisWind, "WrDisWind", "Write disturbed wind data to .Low.Dis.t.vtk etc.? (flag)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NOutDisWindXY - Number of XY planes for output of disturbed wind data across the low-resolution domain to .Low.DisXY..t.vtk (-) [0 to 9]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%NOutDisWindXY, "NOutDisWindXY", "Number of XY planes for output of disturbed wind data across the low-resolution domain to .Low.DisXY..t.vtk (-) [0 to 9]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocAry( AWAE_InitInp%OutDisWindZ, AWAE_InitInp%NOutDisWindXY, "OutDisWindZ", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutDisWindZ - Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXY] [unused for NOutDisWindXY=0]: + CALL ReadAry( UnIn, InputFile, AWAE_InitInp%OutDisWindZ, AWAE_InitInp%NOutDisWindXY, "OutDisWindZ", "Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXY] [unused for NOutDisWindXY=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NOutDisWindYZ - Number of YZ planes for output of disturbed wind data across the low-resolution domain to .Low.DisYZ..t.vtk (-) [0 to 9]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%NOutDisWindYZ, "NOutDisWindYZ", "Number of YZ planes for output of disturbed wind data across the low-resolution domain to .Low.DisYZ..t.vtk (-) [0 to 9]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocAry( AWAE_InitInp%OutDisWindX, AWAE_InitInp%NOutDisWindYZ, "OutDisWindX", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutDisWindX - X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindYZ] [unused for NOutDisWindYZ=0]: + CALL ReadAry( UnIn, InputFile, AWAE_InitInp%OutDisWindX, AWAE_InitInp%NOutDisWindYZ, "OutDisWindX", "X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindYZ] [unused for NOutDisWindYZ=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NOutDisWindXZ - Number of XZ planes for output of disturbed wind data across the low-resolution domain to .Low/DisXZ..t.vtk (-) [0 to 9]: + CALL ReadVar( UnIn, InputFile, AWAE_InitInp%NOutDisWindXZ, "NOutDisWindXZ", "Number of XZ planes for output of disturbed wind data across the low-resolution domain to .Low/DisXZ..t.vtk (-) [0 to 9]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocAry( AWAE_InitInp%OutDisWindY, AWAE_InitInp%NOutDisWindXZ, "OutDisWindY", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutDisWindY - Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXZ] [unused for NOutDisWindXZ=0]: + CALL ReadAry( UnIn, InputFile, AWAE_InitInp%OutDisWindY, AWAE_InitInp%NOutDisWindXZ, "OutDisWindY", "Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain (m) [1 to NOutDisWindXZ] [unused for NOutDisWindXZ=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! WrDisDT -The time between vtk outputs [must be a multiple of the low resolution time step]: + CALL ReadVarWDefault( UnIn, InputFile, AWAE_InitInp%WrDisDT, "WrDisDT", & + "The time between vtk outputs [must be a multiple of the low resolution time step]", & + p%DT_low, ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + !---------------------- OUTPUT -------------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: Output', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! SumPrint - Print summary data to .sum? (flag): + CALL ReadVar( UnIn, InputFile, p%SumPrint, "SumPrint", "Print summary data to .sum? (flag)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! ChkptTime - Amount of time between creating checkpoint files for potential restart (s) [>0.0]: + CALL ReadVar( UnIn, InputFile, TmpTime, "ChkptTime", "Amount of time between creating checkpoint files for potential restart (s) [>0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + IF (TmpTime > p%TMax) THEN + p%n_ChkptTime = HUGE(p%n_ChkptTime) + ELSE + p%n_ChkptTime = NINT( TmpTime / p%DT_low ) + END IF + + + ! TStart - Time to begin tabular output (s) [>=0.0]: + CALL ReadVar( UnIn, InputFile, p%TStart, "TStart", "Time to begin tabular output (s) [>=0.0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutFileFmt - Format for tabular (time-marching) output file (switch) {1: text file [.out], 2: binary file [.outb], 3: both}: + CALL ReadVar( UnIn, InputFile, OutFileFmt, "OutFileFmt", "Format for tabular (time-marching) output file (switch) {1: text file [.out], 2: binary file [.outb], 3: both}", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + SELECT CASE (OutFileFmt) + CASE (1_IntKi) + p%WrBinOutFile = .FALSE. + p%WrTxtOutFile = .TRUE. + CASE (2_IntKi) + p%WrBinOutFile = .TRUE. + p%WrTxtOutFile = .FALSE. + CASE (3_IntKi) + p%WrBinOutFile = .TRUE. + p%WrTxtOutFile = .TRUE. + CASE DEFAULT + ! we'll check this later.... + !CALL SetErrStat( ErrID_Fatal, "FAST.Farm's OutFileFmt must be 1, 2, or 3.",ErrStat,ErrMsg,RoutineName) + !if ( ErrStat >= AbortErrLev ) then + ! call cleanup() + ! RETURN + !end if + END SELECT + + if ( OutFileFmt /= 1_IntKi ) then ! TODO: Only allow text format for now; add binary format later. + CALL SetErrStat( ErrID_Fatal, "FAST.Farm's OutFileFmt must be 1.",ErrStat,ErrMsg,RoutineName) + call cleanup() + RETURN + end if + + + ! TabDelim - Use tab delimiters in text tabular output file? (flag) {uses spaces if False}: + CALL ReadVar( UnIn, InputFile, TabDelim, "TabDelim", "Use tab delimiters in text tabular output file? (flag) {uses spaces if False}", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + IF ( TabDelim ) THEN + p%Delim = TAB + ELSE + p%Delim = ' ' + END IF + + ! OutFmt - Format used for text tabular output, excluding the time channel. Resulting field should be 10 characters. (quoted string): + CALL ReadVar( UnIn, InputFile, p%OutFmt, "OutFmt", "Format used for text tabular output, excluding the time channel. Resulting field should be 10 characters. (quoted string)", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NOutRadii - Number of radial nodes for wake output for an individual rotor (-) [0 to 20]: + CALL ReadVar( UnIn, InputFile, p%NOutRadii, "NOutRadii", "Number of radial nodes for wake output for an individual rotor (-) [0 to 20]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocary( p%OutRadii, p%NOutRadii, "OutRadii", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutRadii - List of radial nodes for wake output for an individual rotor (-) [1 to NOutRadii]: + CALL ReadAry( UnIn, InputFile, p%OutRadii, p%NOutRadii, "OutRadii", "List of radial nodes for wake output for an individual rotor (-) [1 to NOutRadii]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NOutDist - Number of downstream distances for wake output for an individual rotor (-) [0 to 9]: + CALL ReadVar( UnIn, InputFile, p%NOutDist, "NOutDist", "Number of downstream distances for wake output for an individual rotor (-) [0 to 9]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocary( p%OutDist, p%NOutDist, "OutDist", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! OutDist - List of downstream distances for wake output for an individual rotor (m) [1 to NOutDist] [unused for NOutDist=0]: + CALL ReadAry( UnIn, InputFile, p%OutDist, p%NOutDist, "OutDist", "List of downstream distances for wake output for an individual rotor (m) [1 to NOutDist] [unused for NOutDist=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! NWindVel - Number of points for wind output (-) [0 to 9]: + CALL ReadVar( UnIn, InputFile, p%NWindVel, "NWindVel", "Number of points for wind output (-) [0 to 9]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + call allocAry( p%WindVelX, p%NWindVel, "WindVelX", ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call allocAry( p%WindVelY, p%NWindVel, "WindVelY", ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call allocAry( p%WindVelZ, p%NWindVel, "WindVelZ", ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! WindVelX - List of coordinates in the X direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]: + CALL ReadAry( UnIn, InputFile, p%WindVelX, p%NWindVel, "WindVelX", "List of coordinates in the X direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! WindVelY - List of coordinates in the Y direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]: + CALL ReadAry( UnIn, InputFile, p%WindVelY, p%NWindVel, "WindVelY", "List of coordinates in the Y direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + ! WindVelZ - List of coordinates in the Z direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]: + CALL ReadAry( UnIn, InputFile, p%WindVelZ, p%NWindVel, "WindVelZ", "List of coordinates in the Z direction for wind output (m) [1 to NWindVel] [unused for NWindVel=0]", ErrStat2, ErrMsg2, UnEc) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + call cleanup() + RETURN + end if + + + !!!!!!! OutList The next line(s) contains a list of output parameters. See OutListParameters.xlsx for a listing of available output channels (quoted string) + !---------------------- OUTLIST -------------------------------------------- + CALL ReadCom( UnIn, InputFile, 'Section Header: OutList', ErrStat2, ErrMsg2, UnEc ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF ( ErrStat >= AbortErrLev ) THEN + CALL Cleanup() + RETURN + END IF + + ! OutList - List of user-requested output channels (-): + CALL ReadOutputList ( UnIn, InputFile, OutList, p%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc ) ! Routine in NWTC Subroutine Library + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF ( ErrStat >= AbortErrLev ) THEN + CALL Cleanup() + RETURN + END IF + !---------------------- END OF FILE ----------------------------------------- + + call cleanup() + RETURN + +CONTAINS + !............................................................................................................................... + subroutine cleanup() + CLOSE( UnIn ) + IF ( UnEc > 0 ) CLOSE ( UnEc ) + end subroutine cleanup + !............................................................................................................................... +END SUBROUTINE Farm_ReadPrimaryFile +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE Farm_ValidateInput( p, WD_InitInp, AWAE_InitInp, SC_InitInp, ErrStat, ErrMsg ) + ! Passed variables + TYPE(Farm_ParameterType), INTENT(INOUT) :: p !< The parameter data for the FAST (glue-code) simulation + TYPE(WD_InputFileType), INTENT(IN ) :: WD_InitInp !< input-file data for WakeDynamics module + TYPE(AWAE_InputFileType), INTENT(INOUT) :: AWAE_InitInp !< input-file data for AWAE module + TYPE(SC_InitInputType), INTENT(INOUT) :: SC_InitInp ! input-file data for SC module + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + ! Local variables: + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_ValidateInput' + INTEGER(IntKi) :: n_disDT_dt + + ErrStat = ErrID_None + ErrMsg = "" + + IF (p%DT_low <= 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'DT_low must be positive.',ErrStat,ErrMsg,RoutineName) + IF (p%DT_high <= 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'DT_high must be positive.',ErrStat,ErrMsg,RoutineName) + IF (p%TMax < 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'TMax must not be negative.',ErrStat,ErrMsg,RoutineName) + IF (p%NumTurbines < 1) CALL SetErrStat(ErrID_Fatal,'FAST.Farm requires at least 1 turbine. Set NumTurbines > 0.',ErrStat,ErrMsg,RoutineName) + + ! --- SUPER CONTROLLER --- + ! TODO : Verify that the DLL file exists + + + ! --- WAKE DYNAMICS --- + IF (WD_InitInp%dr <= 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'dr (radial increment) must be larger than 0.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%NumRadii < 2) CALL SetErrStat(ErrID_Fatal,'NumRadii (number of radii) must be at least 2.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%NumPlanes < 2) CALL SetErrStat(ErrID_Fatal,'NumPlanes (number of wake planes) must be at least 2.',ErrStat,ErrMsg,RoutineName) + + IF (WD_InitInp%f_c <= 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'f_c (cut-off [corner] frequency) must be more than 0 Hz.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_NearWake <= 1.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_NearWake parameter must be greater than 1.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%k_vAmb < 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'k_vAmb parameter must not be negative.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%k_vShr < 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'k_vShr parameter must not be negative.',ErrStat,ErrMsg,RoutineName) + + IF (WD_InitInp%C_vAmb_DMin < 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_vAmb_DMin parameter must not be negative.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vAmb_DMax <= WD_InitInp%C_vAmb_DMin) CALL SetErrStat(ErrID_Fatal,'C_vAmb_DMax parameter must be larger than C_vAmb_DMin.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vAmb_FMin < 0.0_Reki .or. WD_InitInp%C_vAmb_FMin > 1.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_vAmb_FMin parameter must be between 0 and 1 (inclusive).',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vAmb_Exp <= 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_vAmb_Exp parameter must be positive.',ErrStat,ErrMsg,RoutineName) + + IF (WD_InitInp%C_vShr_DMin < 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_vShr_DMin parameter must not be negative.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vShr_DMax <= WD_InitInp%C_vShr_DMin) CALL SetErrStat(ErrID_Fatal,'C_vShr_DMax parameter must be larger than C_vShr_DMin.',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vShr_FMin < 0.0_Reki .or. WD_InitInp%C_vShr_FMin > 1.0_ReKi) CALL SetErrStat(ErrID_Fatal,'C_vShr_FMin parameter must be between 0 and 1 (inclusive).',ErrStat,ErrMsg,RoutineName) + IF (WD_InitInp%C_vShr_Exp <= 0.0_Reki) CALL SetErrStat(ErrID_Fatal,'C_vShr_Exp parameter must be positive.',ErrStat,ErrMsg,RoutineName) + + IF (WD_InitInp%Mod_WakeDiam < WakeDiamMod_RotDiam .or. WD_InitInp%Mod_WakeDiam > WakeDiamMod_MtmFlux) THEN + call SetErrStat(ErrID_Fatal,'Wake diameter calculation model, Mod_WakeDiam, must be 1 (rotor diameter), 2 (velocity-based), 3 (mass-flux based), 4 (momentum-flux based) or DEFAULT.',ErrStat,ErrMsg,RoutineName) + END IF + + IF (WD_InitInp%Mod_WakeDiam /= WakeDiamMod_RotDiam) THEN + IF (WD_InitInp%C_WakeDiam <= 0.0_Reki .or. WD_InitInp%C_WakeDiam >= 1.0_ReKi) THEN + CALL SetErrStat(ErrID_Fatal,'C_WakeDiam parameter must be between 0 and 1 (exclusive).',ErrStat,ErrMsg,RoutineName) + END IF + END IF + + IF (AWAE_InitInp%Mod_Meander < MeanderMod_Uniform .or. AWAE_InitInp%Mod_Meander > MeanderMod_WndwdJinc) THEN + call SetErrStat(ErrID_Fatal,'Spatial filter model for wake meandering, Mod_Meander, must be 1 (uniform), 2 (truncated jinc), 3 (windowed jinc) or DEFAULT.',ErrStat,ErrMsg,RoutineName) + END IF + + IF (AWAE_InitInp%C_Meander < 1.0_Reki) THEN + CALL SetErrStat(ErrID_Fatal,'C_Meander parameter must not be less than 1.',ErrStat,ErrMsg,RoutineName) + END IF + + !--- OUTPUT --- + IF ( p%n_ChkptTime < 1_IntKi ) CALL SetErrStat( ErrID_Fatal, 'ChkptTime must be greater than 0 seconds.', ErrStat, ErrMsg, RoutineName ) + IF (p%TStart < 0.0_ReKi) CALL SetErrStat(ErrID_Fatal,'TStart must not be negative.',ErrStat,ErrMsg,RoutineName) + IF (.not. p%WrBinOutFile .and. .not. p%WrTxtOutFile) CALL SetErrStat( ErrID_Fatal, "FAST.Farm's OutFileFmt must be 1, 2, or 3.",ErrStat,ErrMsg,RoutineName) + + if (AWAE_InitInp%WrDisDT < p%DT_low) CALL SetErrStat(ErrID_Fatal,'WrDisDT must greater than or equal to dt_low.',ErrStat,ErrMsg,RoutineName) + + ! let's make sure the FAST.Farm DT_low is an exact integer divisor of AWAE_InitInp%WrDisDT + n_disDT_dt = nint( AWAE_InitInp%WrDisDT / p%DT_low ) + ! (i'm doing this outside of Farm_ValidateInput so we know that dt_low/=0 before computing n_high_low): + IF ( .NOT. EqualRealNos( real(p%DT_low,SiKi)* n_disDT_dt, real(AWAE_InitInp%WrDisDT,SiKi) ) ) THEN + CALL SetErrStat(ErrID_Fatal, "WrDisDT ("//TRIM(Num2LStr(AWAE_InitInp%WrDisDT))//" s) must be an integer multiple of dt_low ("//TRIM(Num2LStr(p%DT_low))//" s).", ErrStat, ErrMsg, RoutineName ) + END IF + AWAE_InitInp%WrDisDT = p%DT_low * n_disDT_dt + + + if (AWAE_InitInp%NOutDisWindXY < 0 .or. AWAE_InitInp%NOutDisWindXY > maxOutputPoints ) CALL SetErrStat( ErrID_Fatal, 'NOutDisWindXY must be in the range [0, 9].', ErrStat, ErrMsg, RoutineName ) + if (AWAE_InitInp%NOutDisWindYZ < 0 .or. AWAE_InitInp%NOutDisWindYZ > maxOutputPoints ) CALL SetErrStat( ErrID_Fatal, 'NOutDisWindYZ must be in the range [0, 9].', ErrStat, ErrMsg, RoutineName ) + if (AWAE_InitInp%NOutDisWindXZ < 0 .or. AWAE_InitInp%NOutDisWindXZ > maxOutputPoints ) CALL SetErrStat( ErrID_Fatal, 'NOutDisWindXZ must be in the range [0, 9].', ErrStat, ErrMsg, RoutineName ) + if (p%NOutDist < 0 .or. p%NOutDist > maxOutputPoints ) then + CALL SetErrStat( ErrID_Fatal, 'NOutDist must be in the range [0, 9].', ErrStat, ErrMsg, RoutineName ) + else + do i=1,p%NOutDist + if (p%OutDist(i) < 0.0_ReKi) then + CALL SetErrStat( ErrID_Fatal, 'OutDist values must be greater than or equal to zero.', ErrStat, ErrMsg, RoutineName ) + exit + end if + end do + end if + + if (p%NWindVel < 0 .or. p%NWindVel > maxOutputPoints ) CALL SetErrStat( ErrID_Fatal, 'NWindVel must be in the range [0, 9].', ErrStat, ErrMsg, RoutineName ) + if (p%NOutRadii < 0 .or. p%NOutRadii > 20 ) then + CALL SetErrStat( ErrID_Fatal, 'NOutRadii must be in the range [0, 20].', ErrStat, ErrMsg, RoutineName ) + else + do i=1,p%NOutRadii + if (p%OutRadii(i) > WD_InitInp%NumRadii - 1 .or. p%OutRadii(i) < 0) then + CALL SetErrStat( ErrID_Fatal, 'OutRadii must be in the range [0, NumRadii - 1].', ErrStat, ErrMsg, RoutineName ) + exit + end if + end do + end if + + + + ! Check that OutFmt is a valid format specifier and will fit over the column headings + CALL ChkRealFmtStr( p%OutFmt, 'OutFmt', p%FmtWidth, ErrStat2, ErrMsg2 ) !this sets p%FmtWidth! + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + IF ( p%FmtWidth /= ChanLen ) CALL SetErrStat( ErrID_Warn, 'OutFmt produces a column width of '// & + TRIM(Num2LStr(p%FmtWidth))//' instead of '//TRIM(Num2LStr(ChanLen))//' characters.', ErrStat, ErrMsg, RoutineName ) + + +END SUBROUTINE Farm_ValidateInput +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine initializes all instances of WakeDynamics +SUBROUTINE Farm_InitWD( farm, WD_InitInp, ErrStat, ErrMsg ) + + + ! Passed variables + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + TYPE(WD_InitInputType), INTENT(INOUT) :: WD_InitInp !< init input for WakeDynamics module; input file data already filled in + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + ! local variables + type(WD_InitOutputType) :: WD_InitOut + + INTEGER(IntKi) :: nt ! loop counter for rotor number + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_InitWD' + + ErrStat = ErrID_None + ErrMsg = "" + + ALLOCATE(farm%WD(farm%p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for Wake Dynamics data', ErrStat, ErrMsg, RoutineName ) + return + end if + + !................. + ! Initialize each instance of WD + !................ + + DO nt = 1,farm%p%NumTurbines + !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + ! initialization can be done in parallel (careful for FWrap_InitInp, though) + !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + WD_InitInp%TurbNum = nt + + ! note that WD_Init has Interval as INTENT(IN) so, we don't need to worry about overwriting farm%p%dt_low here: + call WD_Init( WD_InitInp, farm%WD(nt)%u, farm%WD(nt)%p, farm%WD(nt)%x, farm%WD(nt)%xd, farm%WD(nt)%z, & + farm%WD(nt)%OtherSt, farm%WD(nt)%y, farm%WD(nt)%m, farm%p%dt_low, WD_InitOut, ErrStat2, ErrMsg2 ) + + farm%WD(nt)%IsInitialized = .true. + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + if (ErrStat >= AbortErrLev) then + call cleanup() + return + end if + + END DO + + farm%p%Module_Ver( ModuleFF_WD ) = WD_InitOut%Ver + + call cleanup() + +contains + subroutine cleanup() + call WD_DestroyInitOutput( WD_InitOut, ErrStat2, ErrMsg2 ) + end subroutine cleanup +END SUBROUTINE Farm_InitWD +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine initializes all instances of FAST using the FASTWrapper module +SUBROUTINE Farm_InitFAST( farm, WD_InitInp, AWAE_InitOutput, SC_InitOutput, SC_y, ErrStat, ErrMsg ) + + + ! Passed variables + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + TYPE(WD_InputFileType), INTENT(IN ) :: WD_InitInp !< input-file data for WakeDynamics module + TYPE(AWAE_InitOutputType),INTENT(IN ) :: AWAE_InitOutput !< initialization output from AWAE + type(SC_InitOutputType), INTENT(INOUT) :: SC_InitOutput !< Initialization output from SC + type(SC_OutputType), INTENT(INOUT) :: SC_y !< SuperController inital outputs + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + ! local variables + type(FWrap_InitInputType) :: FWrap_InitInp + type(FWrap_InitOutputType) :: FWrap_InitOut + + INTEGER(IntKi) :: nt ! loop counter for rotor number + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_InitFAST' + + + ErrStat = ErrID_None + ErrMsg = "" + + ALLOCATE(farm%FWrap(farm%p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for FAST Wrapper data', ErrStat, ErrMsg, RoutineName ) + return + end if + + !................. + ! Initialize each instance of FAST + !................ + FWrap_InitInp%nr = WD_InitInp%NumRadii + FWrap_InitInp%dr = WD_InitInp%dr + FWrap_InitInp%tmax = farm%p%TMax + FWrap_InitInp%n_high_low = farm%p%n_high_low + 1 ! Add 1 because the FAST wrapper uses an index that starts at 1 + FWrap_InitInp%dt_high = farm%p%dt_high + + FWrap_InitInp%nX_high = AWAE_InitOutput%nX_high + FWrap_InitInp%nY_high = AWAE_InitOutput%nY_high + FWrap_InitInp%nZ_high = AWAE_InitOutput%nZ_high + FWrap_InitInp%UseSC = farm%p%UseSC + FWrap_InitInp%NumSC2Ctrl = SC_InitOutput%NumSC2Ctrl + FWrap_InitInp%NumSC2CtrlGlob= SC_InitOutput%NumSC2CtrlGlob + FWrap_InitInp%NumCtrl2SC = SC_InitOutput%NumCtrl2SC + allocate(FWrap_InitInp%fromSCglob(SC_InitOutput%NumSC2CtrlGlob)) + FWrap_InitInp%fromSCglob = SC_y%fromSCglob + + allocate(FWrap_InitInp%fromSC(SC_InitOutput%NumSC2Ctrl)) + + + DO nt = 1,farm%p%NumTurbines + !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + ! initialization can be done in parallel (careful for FWrap_InitInp, though) + !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + FWrap_InitInp%FASTInFile = farm%p%WT_FASTInFile(nt) + FWrap_InitInp%p_ref_Turbine = farm%p%WT_Position(:,nt) + FWrap_InitInp%TurbNum = nt + FWrap_InitInp%RootName = trim(farm%p%OutFileRoot)//'.T'//num2lstr(nt) + + + FWrap_InitInp%p_ref_high(1) = AWAE_InitOutput%X0_high(nt) + FWrap_InitInp%p_ref_high(2) = AWAE_InitOutput%Y0_high(nt) + FWrap_InitInp%p_ref_high(3) = AWAE_InitOutput%Z0_high(nt) + + FWrap_InitInp%dX_high = AWAE_InitOutput%dX_high(nt) + FWrap_InitInp%dY_high = AWAE_InitOutput%dY_high(nt) + FWrap_InitInp%dZ_high = AWAE_InitOutput%dZ_high(nt) + if (SC_InitOutput%NumSC2Ctrl>0) then + FWrap_InitInp%fromSC = SC_y%fromSC((nt-1)*SC_InitOutput%NumSC2Ctrl+1:nt*SC_InitOutput%NumSC2Ctrl) + end if + ! note that FWrap_Init has Interval as INTENT(IN) so, we don't need to worry about overwriting farm%p%dt_low here: + call FWrap_Init( FWrap_InitInp, farm%FWrap(nt)%u, farm%FWrap(nt)%p, farm%FWrap(nt)%x, farm%FWrap(nt)%xd, farm%FWrap(nt)%z, & + farm%FWrap(nt)%OtherSt, farm%FWrap(nt)%y, farm%FWrap(nt)%m, farm%p%dt_low, FWrap_InitOut, ErrStat2, ErrMsg2 ) + + farm%FWrap(nt)%IsInitialized = .true. + + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + if (ErrStat >= AbortErrLev) then + call cleanup() + return + end if + + END DO + + farm%p%Module_Ver( ModuleFF_FWrap ) = FWrap_InitOut%Ver + + call cleanup() + +contains + subroutine cleanup() + call FWrap_DestroyInitInput( FWrap_InitInp, ErrStat2, ErrMsg2 ) + call FWrap_DestroyInitOutput( FWrap_InitOut, ErrStat2, ErrMsg2 ) + end subroutine cleanup +END SUBROUTINE Farm_InitFAST +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine performs the initial call to calculate outputs (at t=0). +!! The Initial Calculate Output algorithm: \n +!! - In parallel: +!! 1. Set u_AWAE=0, CALL AWAE_CO, and transfer y_AWAE to u_F and u_WD +!! 2. Set u_SC=0, CALL SC_CO, and transfer y_SC to u_F +!! - CALL F_t0 +!! - Transfer y_F to u_SC and u_WD +!! - CALL WD_CO +!! - Transfer y_WD to u_AWAE +!! - CALL AWAE_CO +!! - Transfer y_AWAE to u_F and u_WD +!! - Write Output to File +subroutine FARM_InitialCO(farm, ErrStat, ErrMsg) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + INTEGER(IntKi) :: nt + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'FARM_InitialCO' + + + ErrStat = ErrID_None + ErrMsg = "" + + + + + !....................................................................................... + ! Initial calls to AWAE and SC modules (steps 1. and 2. can be done in parallel) + !....................................................................................... + + !-------------------- + ! 1a. u_AWAE=0 + farm%AWAE%u%xhat_plane = 0.0_ReKi ! Orientations of wake planes, normal to wake planes, for each turbine + farm%AWAE%u%p_plane = 0.0_ReKi ! Center positions of wake planes for each turbine + farm%AWAE%u%Vx_wake = 0.0_ReKi ! Axial wake velocity deficit at wake planes, distributed radially, for each turbine + farm%AWAE%u%Vr_wake = 0.0_ReKi ! Radial wake velocity deficit at wake planes, distributed radially, for each turbine + farm%AWAE%u%D_wake = 0.0_ReKi ! Wake diameters at wake planes for each turbine + + !-------------------- + ! 1b. CALL AWAE_CO + call AWAE_CalcOutput( 0.0_DbKi, farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, & + farm%AWAE%OtherSt, farm%AWAE%y, farm%AWAE%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + !-------------------- + ! 1c. transfer y_AWAE to u_F and u_WD + + call Transfer_AWAE_to_FAST(farm) + call Transfer_AWAE_to_WD(farm) + + if (farm%p%UseSC) then + !-------------------- + ! 2a. u_SC=0 + if ( farm%SC%p%NInpGlobal > 0 ) farm%SC%uInputs%toSCglob = 0.0_SiKi + if ( farm%SC%p%NumCtrl2SC > 0 ) farm%SC%uInputs%toSC = 0.0_SiKi + + !-------------------- + ! 2b. CALL SC_CO + + call SC_CalcOutput(0.0_DbKi, farm%SC%uInputs, farm%SC%p, farm%SC%x, farm%SC%xd, farm%SC%z, & + farm%SC%OtherState, farm%SC%y, farm%SC%m, ErrStat, ErrMsg ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + !-------------------- + ! 2c. transfer y_SC to u_F + + do nt = 1,farm%p%NumTurbines + farm%FWrap(nt)%u%fromSCglob = farm%SC%y%fromSCglob + ! SC stores all turbine-controller data in a 1D array, need to separate these out for each turbine + farm%FWrap(nt)%u%fromSC(:) = farm%SC%y%fromSC( (nt-1)*farm%SC%p%NumSC2Ctrl+1:nt*farm%SC%p%NumSC2Ctrl ) + end do + + end if ! (farm%p%UseSC) + + !....................................................................................... + ! CALL F_t0 (can be done in parallel) + !....................................................................................... + + DO nt = 1,farm%p%NumTurbines + + call FWrap_t0( farm%FWrap(nt)%u, farm%FWrap(nt)%p, farm%FWrap(nt)%x, farm%FWrap(nt)%xd, farm%FWrap(nt)%z, & + farm%FWrap(nt)%OtherSt, farm%FWrap(nt)%y, farm%FWrap(nt)%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + + END DO + if (ErrStat >= AbortErrLev) return + + !....................................................................................... + ! Transfer y_F to u_SC and u_WD (can be done in parallel) + !....................................................................................... + + !-------------------- + ! 1. Transfer y_F to u_SC + if (farm%p%UseSC) then + + farm%SC%uInputs%toSCglob = 0.0_SiKi ! We currently do not have a way to set global SC inputs from FAST.Farm + + do nt = 1,farm%p%NumTurbines + farm%SC%uInputs%toSC( (nt-1)*farm%SC%p%NumCtrl2SC+1 : nt*farm%SC%p%NumCtrl2SC ) = farm%FWrap(nt)%y%toSC(:) + end do + + end if + !-------------------- + ! 2. Transfer y_F to u_WD + + call Transfer_FAST_to_WD(farm) + + !....................................................................................... + ! CALL WD_CO (can be done in parallel) + !....................................................................................... + + DO nt = 1,farm%p%NumTurbines + + call WD_CalcOutput( 0.0_DbKi, farm%WD(nt)%u, farm%WD(nt)%p, farm%WD(nt)%x, farm%WD(nt)%xd, farm%WD(nt)%z, & + farm%WD(nt)%OtherSt, farm%WD(nt)%y, farm%WD(nt)%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + + END DO + if (ErrStat >= AbortErrLev) return + + !....................................................................................... + ! Transfer y_WD to u_AWAE + !....................................................................................... + + call Transfer_WD_to_AWAE(farm) + + !....................................................................................... + ! CALL AWAE_CO + !....................................................................................... + + call AWAE_CalcOutput( 0.0_DbKi, farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, & + farm%AWAE%OtherSt, farm%AWAE%y, farm%AWAE%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + !....................................................................................... + ! Transfer y_AWAE to u_F and u_WD + !....................................................................................... + + call Transfer_AWAE_to_FAST(farm) + call Transfer_AWAE_to_WD(farm) + + !....................................................................................... + ! Write Output to File + !....................................................................................... + + call Farm_WriteOutput(0, 0.0_DbKi, farm, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + +end subroutine FARM_InitialCO +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine updates states each time increment. +!! The update states algorithm: \n +!! - In parallel: +!! 1. call WD_US +!! 2. call SC_US +!! 3. call F_Increment +!! 4. call AWAE_UpdateStates +!! - \f$ n = n + 1 \f$ +!! - \f$ t = t + \Delta t \f$ +subroutine FARM_UpdateStates(t, n, farm, ErrStat, ErrMsg) + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + INTEGER(IntKi), INTENT(IN ) :: n !< Current step of the simulation: t = n*Interval + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + INTEGER(IntKi) :: nt + INTEGER(IntKi) :: ErrStatWD, ErrStat2 + INTEGER(IntKi), ALLOCATABLE :: ErrStatF(:) ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsgWD + CHARACTER(ErrMsgLen), ALLOCATABLE :: ErrMsgF (:) ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'FARM_UpdateStates' +! REAL(DbKi) :: tm1,tm2,tm3 + + ErrStat = ErrID_None + ErrMsg = "" + + allocate ( ErrStatF ( farm%p%NumTurbines + 1 ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for ErrStatF.', errStat, errMsg, RoutineName ) + allocate ( ErrMsgF ( farm%p%NumTurbines + 1 ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for ErrMsgF.', errStat, errMsg, RoutineName ) + if (ErrStat >= AbortErrLev) return + + !....................................................................................... + ! update module states (steps 1. and 2. and 3. and 4. can be done in parallel) + !....................................................................................... + + !-------------------- + ! 1. CALL WD_US + + DO nt = 1,farm%p%NumTurbines + + call WD_UpdateStates( t, n, farm%WD(nt)%u, farm%WD(nt)%p, farm%WD(nt)%x, farm%WD(nt)%xd, farm%WD(nt)%z, & + farm%WD(nt)%OtherSt, farm%WD(nt)%m, ErrStatWD, ErrMsgWD ) + call SetErrStat(ErrStatWD, ErrMsgWD, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':FARM_UpdateStates') + + END DO + + if (ErrStat >= AbortErrLev) return + + + !-------------------- + ! 2. CALL SC_US + if (farm%p%useSC) then + farm%SC%utimes(1) = t + call SC_UpdateStates(t, n, farm%SC%uInputs,farm%SC%utimes, farm%SC%p, farm%SC%x, farm%SC%xd, farm%SC%z, farm%SC%OtherState, farm%SC%m, errStat, errMsg ) ! implement framework interface arguments + if (errStat >= AbortErrLev) return + end if + + !-------------------- + ! 3. CALL F_Increment and 4. CALL AWAE_UpdateStates +!#ifdef _OPENMP +! tm1 = omp_get_wtime() +!#endif + !$OMP PARALLEL DO DEFAULT(Shared) Private(nt) !Private(nt,tm2,tm3) + DO nt = 1,farm%p%NumTurbines+1 + if(nt.ne.farm%p%NumTurbines+1) then +!#ifdef _OPENMP +! tm3 = omp_get_wtime() +!#endif + call FWrap_Increment( t, n, farm%FWrap(nt)%u, farm%FWrap(nt)%p, farm%FWrap(nt)%x, farm%FWrap(nt)%xd, farm%FWrap(nt)%z, & + farm%FWrap(nt)%OtherSt, farm%FWrap(nt)%y, farm%FWrap(nt)%m, ErrStatF(nt), ErrMsgF(nt) ) + +!#ifdef _OPENMP +! tm2 = omp_get_wtime() +! write(*,*) ' FWrap_Increment for turbine #'//trim(num2lstr(nt))//' using thread #'//trim(num2lstr(omp_get_thread_num()))//' taking '//trim(num2lstr(tm2-tm3))//' seconds' +!#endif + + else +!#ifdef _OPENMP +! tm3 = omp_get_wtime() +!#endif + call AWAE_UpdateStates( t, n, farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, & + farm%AWAE%OtherSt, farm%AWAE%m, errStatF(nt), errMsgF(nt) ) + +!#ifdef _OPENMP +! tm2 = omp_get_wtime() +! write(*,*) ' AWAE_UpdateStates using thread #'//trim(num2lstr(omp_get_thread_num()))//' taking '//trim(num2lstr(tm2-tm3))//' seconds' +!#endif + endif + + END DO + !$OMP END PARALLEL DO + + DO nt = 1,farm%p%NumTurbines + call SetErrStat(ErrStatF(nt), ErrMsgF(nt), ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':FARM_UpdateStates') + END DO + + call SetErrStat(ErrStatF(farm%p%NumTurbines+1), ErrMsgF(farm%p%NumTurbines+1), ErrStat, ErrMsg, 'FARM_UpdateStates') + + if (ErrStat >= AbortErrLev) return + + +!#ifdef _OPENMP +! tm2 = omp_get_wtime() +! write(*,*) 'Total Farm_US took '//trim(num2lstr(tm2-tm1))//' seconds.' +!#endif + +end subroutine FARM_UpdateStates + +subroutine Farm_WriteOutput(n, t, farm, ErrStat, ErrMsg) + INTEGER(IntKi), INTENT(IN ) :: n !< Time step increment number + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'FARM_WriteOutput' + INTEGER(IntKi) :: nt, iSC, ir, iOutDist, np, iVelPt ! Loop counters + REAL(ReKi) :: vel(3), pt(3) + REAL(ReKi) :: vec_interp(3) + REAL(ReKi) :: norm2_vec, delta, deltad + + + ErrStat = ErrID_None + ErrMsg = "" + + ! If requested write output channel data + if ( farm%p%NumOuts > 0 ) then + + + ! Define the output channel specifying the current simulation time: + farm%m%AllOuts( Farm_Time_Indx) = REAL( t, ReKi ) + + !....................................................................................... + ! Super controller Outputs - Global + !....................................................................................... + + do iSC = 1, farm%SC%p%nInpGlobal + farm%m%AllOuts(SCGblIn(iSC)) = farm%SC%uInputs%toSCglob(iSC) + end do + + do iSC = 1, farm%SC%p%NumSC2CtrlGlob + farm%m%AllOuts(SCGblOt(iSC)) = farm%SC%y%fromSCglob(iSC) + end do + + do nt = 1, farm%p%NOutTurb + + !....................................................................................... + ! Super controller Outputs - Turbine Dependent + !....................................................................................... + + do iSC = 1, farm%SC%p%NumCtrl2SC + farm%m%AllOuts(SCTIn(iSC,nt)) = farm%FWrap(nt)%y%toSC(iSC) + end do + + do iSC = 1, farm%SC%p%NumSC2Ctrl + farm%m%AllOuts(SCTOt(iSC,nt)) = farm%FWrap(nt)%u%fromSC(iSC) + end do + + !....................................................................................... + ! Wind Turbine and its Inflow + !....................................................................................... + + ! Orientation of rotor centerline, normal to disk + farm%m%AllOuts(RtAxsXT(nt)) = farm%FWrap(nt)%y%xHat_Disk(1) + farm%m%AllOuts(RtAxsYT(nt)) = farm%FWrap(nt)%y%xHat_Disk(2) + farm%m%AllOuts(RtAxsZT(nt)) = farm%FWrap(nt)%y%xHat_Disk(3) + + ! Center position of hub, m + farm%m%AllOuts(RtPosXT(nt)) = farm%FWrap(nt)%y%p_hub(1) + farm%m%AllOuts(RtPosYT(nt)) = farm%FWrap(nt)%y%p_hub(2) + farm%m%AllOuts(RtPosZT(nt)) = farm%FWrap(nt)%y%p_hub(3) + + ! Rotor diameter, m + farm%m%AllOuts(RtDiamT(nt)) = farm%FWrap(nt)%y%D_rotor + + ! Nacelle-yaw error at the wake planes, deg + farm%m%AllOuts(YawErrT(nt)) = farm%FWrap(nt)%y%YawErr*R2D + + ! Ambient turbulence intensity of the wind at the rotor disk, percent + farm%m%AllOuts(TIAmbT(nt)) = farm%AWAE%y%TI_amb(nt)*100.0_ReKi + + ! Rotor-disk-averaged ambient wind speed (normal to disk, not including structural motion, local induction or wakes from upstream turbines), m/s + farm%m%AllOuts(RtVAmbT(nt)) = farm%AWAE%y%Vx_wind_disk(nt) + + ! Rotor-disk-averaged relative wind speed (normal to disk, including structural motion and wakes from upstream turbines, but not including local induction), m/s + farm%m%AllOuts(RtVRelT(nt)) = farm%FWrap(nt)%y%DiskAvg_Vx_Rel + + ! Azimuthally averaged thrust force coefficient (normal to disk), distributed radially, - + do ir = 1, farm%p%NOutRadii + farm%m%AllOuts(CtTN(ir, nt)) = farm%FWrap(nt)%y%AzimAvg_Ct(farm%p%OutRadii(ir)+1) ! y%AzimAvg_Ct is a 1-based array but the user specifies 0-based node indices, so we need to add 1 + end do + + !....................................................................................... + ! Wake (for an Individual Rotor) + !....................................................................................... + + ! Loop over user-requested, downstream distances (OutDist), m + do iOutDist = 1, farm%p%NOutDist + + if ( farm%p%OutDist(iOutDist) >= maxval( farm%WD(nt)%y%x_plane(0:min(farm%WD(nt)%p%NumPlanes-1,n+1)) ) ) then + + farm%m%AllOuts(WkAxsXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkAxsYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkAxsZTD(iOutDist,nt)) = 0.0_ReKi + + ! Center position of the wake centerline + farm%m%AllOuts(WkPosXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkPosYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkPosZTD(iOutDist,nt)) = 0.0_ReKi + + ! Advection, deflection, and meandering + ! of the wake for downstream wake volum + farm%m%AllOuts(WkVelXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkVelYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkVelZTD(iOutDist,nt)) = 0.0_ReKi + + ! Wake diameter for downstream wake volu + farm%m%AllOuts(WkDiamTD(iOutDist,nt)) = 0.0_ReKi + + do ir = 1, farm%p%NOutRadii + + ! Axial and radial wake velocity deficits for radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(WkDfVxTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkDfVrTND(ir,iOutDist,nt)) = 0.0_ReKi + + ! Total eddy viscosity, and individual contributions to the eddy viscosity from ambient turbulence and the shear layer, + ! or radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(EddVisTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(EddAmbTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(EddShrTND(ir,iOutDist,nt)) = 0.0_ReKi + + end do + + else + + ! Find wake volume which contains the user-requested downstream location. + do np = 0, min(farm%WD(nt)%p%NumPlanes-2 , n) + + if ( ( farm%p%OutDist(iOutDist) >= farm%WD(nt)%y%x_plane(np) ) .and. ( farm%p%OutDist(iOutDist) < farm%WD(nt)%y%x_plane(np+1) ) ) then ! A wake volume has been found + + delta = ( farm%p%OutDist(iOutDist) - farm%WD(nt)%y%x_plane(np) ) / ( farm%WD(nt)%y%x_plane(np+1) - farm%WD(nt)%y%x_plane(np) ) + deltad = (1.0_ReKi-delta) + + vec_interp = delta*farm%WD(nt)%y%xhat_plane(:, np+1) + deltad*farm%WD(nt)%y%xhat_plane(:, np) + norm2_vec = TwoNorm( vec_interp ) + ! Orientation of the wake centerline for downstream wake volume, np, of turbine, nt, in the global coordinate system, - + farm%m%AllOuts(WkAxsXTD(iOutDist,nt)) = vec_interp(1)/norm2_vec + farm%m%AllOuts(WkAxsYTD(iOutDist,nt)) = vec_interp(2)/norm2_vec + farm%m%AllOuts(WkAxsZTD(iOutDist,nt)) = vec_interp(3)/norm2_vec + + if ( farm%AWAE%m%parallelFlag(np,nt) ) then + vec_interp = delta*farm%WD(nt)%y%p_plane(:, np+1) + deltad*farm%WD(nt)%y%p_plane(:, np) + else + vec_interp = delta*farm%AWAE%m%rhat_e(:,np,nt) + deltad*farm%AWAE%m%rhat_s(:,np,nt) + vec_interp = delta*farm%AWAE%m%pvec_ce(:,np,nt) + deltad*farm%AWAE%m%pvec_cs(:,np,nt) + ( delta*farm%AWAE%m%r_e(np,nt) + deltad*farm%AWAE%m%r_s(np,nt) )* vec_interp / TwoNorm(vec_interp) + end if + + ! Center position of the wake centerline for downstream wake volume, np, of turbine, nt, in the global coordinate system, m + farm%m%AllOuts(WkPosXTD(iOutDist,nt)) = vec_interp(1) + farm%m%AllOuts(WkPosYTD(iOutDist,nt)) = vec_interp(2) + farm%m%AllOuts(WkPosZTD(iOutDist,nt)) = vec_interp(3) + + ! Advection, deflection, and meandering velocity (not including the horizontal wake-deflection correction) + ! of the wake for downstream wake volume, np, of turbine, nt, in the global coordinate system, m/s + farm%m%AllOuts(WkVelXTD(iOutDist,nt)) = delta*farm%AWAE%y%V_plane(1,np+1,nt) + deltad*farm%AWAE%y%V_plane(1,np,nt) + farm%m%AllOuts(WkVelYTD(iOutDist,nt)) = delta*farm%AWAE%y%V_plane(2,np+1,nt) + deltad*farm%AWAE%y%V_plane(2,np,nt) + farm%m%AllOuts(WkVelZTD(iOutDist,nt)) = delta*farm%AWAE%y%V_plane(3,np+1,nt) + deltad*farm%AWAE%y%V_plane(3,np,nt) + + ! Wake diameter for downstream wake volume, np, of turbine, nt, m + farm%m%AllOuts(WkDiamTD(iOutDist,nt)) = delta*farm%WD(nt)%y%D_wake(np+1) + deltad*farm%WD(nt)%y%D_wake(np) !farm%AWAE%u%D_wake(np,nt) + + + do ir = 1, farm%p%NOutRadii + + ! Axial and radial wake velocity deficits for radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(WkDfVxTND(ir,iOutDist,nt)) = delta*farm%WD(nt)%y%Vx_wake(farm%p%OutRadii(ir),np+1) + deltad*farm%WD(nt)%y%Vx_wake(farm%p%OutRadii(ir),np) + farm%m%AllOuts(WkDfVrTND(ir,iOutDist,nt)) = delta*farm%WD(nt)%y%Vr_wake(farm%p%OutRadii(ir),np+1) + deltad*farm%WD(nt)%y%Vr_wake(farm%p%OutRadii(ir),np) + + ! Total eddy viscosity, and individual contributions to the eddy viscosity from ambient turbulence and the shear layer, + ! or radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(EddVisTND(ir,iOutDist,nt)) = delta*farm%WD(nt)%m%vt_tot(farm%p%OutRadii(ir),np+1) + deltad*farm%WD(nt)%m%vt_tot(farm%p%OutRadii(ir),np) + farm%m%AllOuts(EddAmbTND(ir,iOutDist,nt)) = delta*farm%WD(nt)%m%vt_amb(farm%p%OutRadii(ir),np+1) + deltad*farm%WD(nt)%m%vt_amb(farm%p%OutRadii(ir),np) + farm%m%AllOuts(EddShrTND(ir,iOutDist,nt)) = delta*farm%WD(nt)%m%vt_shr(farm%p%OutRadii(ir),np+1) + deltad*farm%WD(nt)%m%vt_shr(farm%p%OutRadii(ir),np) + + end do + + else if ( ( farm%p%OutDist(iOutDist) >= farm%WD(nt)%y%x_plane(np+1) ) .and. ( farm%p%OutDist(iOutDist) < farm%WD(nt)%y%x_plane(np) ) ) then ! Overlapping wake volumes result in invalid output + + farm%m%AllOuts(WkAxsXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkAxsYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkAxsZTD(iOutDist,nt)) = 0.0_ReKi + + ! Center position of the wake centerline + farm%m%AllOuts(WkPosXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkPosYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkPosZTD(iOutDist,nt)) = 0.0_ReKi + + ! Advection, deflection, and meandering + ! of the wake for downstream wake volum + farm%m%AllOuts(WkVelXTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkVelYTD(iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkVelZTD(iOutDist,nt)) = 0.0_ReKi + + ! Wake diameter for downstream wake volu + farm%m%AllOuts(WkDiamTD(iOutDist,nt)) = 0.0_ReKi + + do ir = 1, farm%p%NOutRadii + + ! Axial and radial wake velocity deficits for radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(WkDfVxTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(WkDfVrTND(ir,iOutDist,nt)) = 0.0_ReKi + + ! Total eddy viscosity, and individual contributions to the eddy viscosity from ambient turbulence and the shear layer, + ! or radial node, OutRadii(ir), and downstream wake volume, np, of turbine, nt, m/s + farm%m%AllOuts(EddVisTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(EddAmbTND(ir,iOutDist,nt)) = 0.0_ReKi + farm%m%AllOuts(EddShrTND(ir,iOutDist,nt)) = 0.0_ReKi + + end do + + exit + + end if + + end do + + end if + + end do + + end do + + !....................................................................................... + ! Ambient Wind and Array Effects + !....................................................................................... + + ! Loop over user-requested, velocity locations + do iVelPt = 1, farm%p%NWindVel + + ! Determine the requested pt in grid coordinates + pt = (/farm%p%WindVelX(iVelPt), farm%p%WindVelY(iVelPt),farm%p%WindVelZ(iVelPt)/) + pt(1) = (pt(1) - farm%p%X0_low)/ farm%p%dX_low + pt(2) = (pt(2) - farm%p%Y0_low)/ farm%p%dY_low + pt(3) = (pt(3) - farm%p%Z0_low)/ farm%p%dZ_low + + ! Ambient wind velocity (not including wakes) for point, pt, in global coordinates (from the low-resolution domain), m/s + call TrilinearInterpRegGrid(farm%AWAE%m%Vamb_low, pt, (/farm%p%nX_low,farm%p%nY_low,farm%p%nZ_low/), vel) + farm%m%AllOuts(WVAmbX(iVelPt)) = vel(1) + farm%m%AllOuts(WVAmbY(iVelPt)) = vel(2) + farm%m%AllOuts(WVAmbZ(iVelPt)) = vel(3) + + ! Disturbed wind velocity (including wakes) for point, pt, in global coordinates (from the low-resolution domain), m/s + call TrilinearInterpRegGrid(farm%AWAE%m%Vdist_low, pt, (/farm%p%nX_low,farm%p%nY_low,farm%p%nZ_low/), vel) + farm%m%AllOuts(WVDisX(iVelPt)) = vel(1) + farm%m%AllOuts(WVDisY(iVelPt)) = vel(2) + farm%m%AllOuts(WVDisZ(iVelPt)) = vel(3) + + + end do + + + + + call WriteFarmOutputToFile(t, farm, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + end if +end subroutine Farm_WriteOutput +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine calculates outputs at each time increment and solves for the inputs at the next step. +!! The calculate output algorithm: \n +!! - In parallel: +!! 1. call WD_CO and transfer y_WD to u_AWAE +!! 2. call SC_CO and transfer y_SC to u_F +!! 3. Transfer y_F to u_SC and u_WD +!! - CALL AWAE_CO +!! - Transfer y_AWAE to u_F and u_WD +!! - Write Output to File +subroutine FARM_CalcOutput(t, farm, ErrStat, ErrMsg) + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + INTEGER(IntKi) :: nt + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'FARM_CalcOutput' + INTEGER(IntKi) :: n ! time step increment number +! REAL(DbKi) :: tm1 + ErrStat = ErrID_None + ErrMsg = "" + + ! tm1 = omp_get_wtime() + + !....................................................................................... + ! calculate module outputs and perform some input-output solves (steps 1. and 2. and 3. can be done in parallel, + ! but be careful that step 3 doesn't modify the inputs to steps 1 or 2) + !....................................................................................... + + !-------------------- + ! 1. call WD_CO and transfer y_WD to u_AWAE + + DO nt = 1,farm%p%NumTurbines + + call WD_CalcOutput( t, farm%WD(nt)%u, farm%WD(nt)%p, farm%WD(nt)%x, farm%WD(nt)%xd, farm%WD(nt)%z, & + farm%WD(nt)%OtherSt, farm%WD(nt)%y, farm%WD(nt)%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + + END DO + if (ErrStat >= AbortErrLev) return + + call Transfer_WD_to_AWAE(farm) + + !-------------------- + ! 2. call SC_CO and transfer y_SC to u_F, at n+1 + if ( farm%p%UseSC ) then + call SC_CalcOutput(t, farm%SC%uInputs, farm%SC%p, farm%SC%x, farm%SC%xd, farm%SC%z, & + farm%SC%OtherState, farm%SC%y, farm%SC%m, ErrStat2, ErrMsg2 ) + + do nt = 1,farm%p%NumTurbines + + farm%FWrap(nt)%u%fromSCglob = farm%SC%y%fromSCglob + farm%FWrap(nt)%u%fromSC = farm%SC%y%fromSC( (nt-1)*farm%SC%p%NumSC2Ctrl + 1 : nt*farm%SC%p%NumSC2Ctrl ) + !-------------------- + ! 3a. Transfer y_F to u_SC, at n+1 + farm%SC%uInputs%toSC( (nt-1)*farm%SC%p%NumCtrl2SC + 1 : nt*farm%SC%p%NumCtrl2SC ) = farm%FWrap(nt)%y%toSC + + end do + + end if + + !-------------------- + ! 3b. Transfer y_F to u_WD + + call Transfer_FAST_to_WD(farm) + + !....................................................................................... + ! calculate AWAE outputs and perform rest of input-output solves + !....................................................................................... + + !-------------------- + ! 1. call AWAE_CO + call AWAE_CalcOutput( t, farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, & + farm%AWAE%OtherSt, farm%AWAE%y, farm%AWAE%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + !-------------------- + ! 2. Transfer y_AWAE to u_F and u_WD + call Transfer_AWAE_to_FAST(farm) + call Transfer_AWAE_to_WD(farm) + + + !....................................................................................... + ! Write Output to File + !....................................................................................... + ! NOTE: Visualization data is output via the AWAE module + n = nint(t/farm%p%DT_low) + call Farm_WriteOutput(n, t, farm, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! write(*,*) 'Total Farm_CO-serial took '//trim(num2lstr(omp_get_wtime()-tm1))//' seconds.' + +end subroutine FARM_CalcOutput +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine ends the modules used in this simulation. It does not exit the program. +!! - In parallel: +!! 1. CALL AWAE_End +!! 2. CALL WD_End +!! 3. CALL SC_End +!! 4. CALL F_End +!! - Close Output File +subroutine FARM_End(farm, ErrStat, ErrMsg) + type(All_FastFarm_Data), INTENT(INOUT) :: farm + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message + + INTEGER(IntKi) :: nt + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'FARM_End' + + + + ErrStat = ErrID_None + ErrMsg = "" + + !....................................................................................... + ! end all modules (1-4 can be done in parallel) + !....................................................................................... + + !-------------- + ! 1. end AWAE + if (farm%AWAE%IsInitialized) then + call AWAE_End( farm%AWAE%u, farm%AWAE%p, farm%AWAE%x, farm%AWAE%xd, farm%AWAE%z, & + farm%AWAE%OtherSt, farm%AWAE%y, farm%AWAE%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + end if + + + !-------------- + ! 2. end WakeDynamics + if (allocated(farm%WD)) then + + DO nt = 1,farm%p%NumTurbines + if (farm%WD(nt)%IsInitialized) then + call WD_End( farm%WD(nt)%u, farm%WD(nt)%p, farm%WD(nt)%x, farm%WD(nt)%xd, farm%WD(nt)%z, & + farm%WD(nt)%OtherSt, farm%WD(nt)%y, farm%WD(nt)%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + end if + END DO + + end if + + !-------------- + ! 3. End supercontroller + + if ( farm%p%useSC ) then + CALL SC_End(farm%SC%uInputs, farm%SC%p, farm%SC%x, farm%SC%xd, farm%SC%z, farm%SC%OtherState, & + farm%SC%y, farm%SC%m, ErrStat2, ErrMsg2) + end if + + !-------------- + ! 4. End each instance of FAST (each instance of FAST can be done in parallel, too) + if (allocated(farm%FWrap)) then + + DO nt = 1,farm%p%NumTurbines + if (farm%FWrap(nt)%IsInitialized) then + CALL FWrap_End( farm%FWrap(nt)%u, farm%FWrap(nt)%p, farm%FWrap(nt)%x, farm%FWrap(nt)%xd, farm%FWrap(nt)%z, & + farm%FWrap(nt)%OtherSt, farm%FWrap(nt)%y, farm%FWrap(nt)%m, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) + end if + END DO + + end if + + !....................................................................................... + ! close output file + !....................................................................................... + call Farm_EndOutput( farm, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'T'//trim(num2lstr(nt))//':'//RoutineName) +end subroutine FARM_End +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE Transfer_FAST_to_WD(farm) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + integer(intKi) :: nt + + DO nt = 1,farm%p%NumTurbines + farm%WD(nt)%u%xhat_disk = farm%FWrap(nt)%y%xHat_Disk ! Orientation of rotor centerline, normal to disk + farm%WD(nt)%u%p_hub = farm%FWrap(nt)%y%p_hub ! Center position of hub, m + farm%WD(nt)%u%D_rotor = farm%FWrap(nt)%y%D_rotor ! Rotor diameter, m + farm%WD(nt)%u%Vx_rel_disk = farm%FWrap(nt)%y%DiskAvg_Vx_Rel ! Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk, m/s + farm%WD(nt)%u%Ct_azavg = farm%FWrap(nt)%y%AzimAvg_Ct ! Azimuthally averaged thrust force coefficient (normal to disk), distributed radially, - + farm%WD(nt)%u%YawErr = farm%FWrap(nt)%y%YawErr ! Nacelle-yaw error at the wake planes, rad + END DO + +END SUBROUTINE Transfer_FAST_to_WD +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE Transfer_AWAE_to_WD(farm) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + integer(intKi) :: nt + + DO nt = 1,farm%p%NumTurbines + farm%WD(nt)%u%V_plane = farm%AWAE%y%V_plane(:,:,nt) ! Advection, deflection, and meandering velocity of wake planes, m/s + farm%WD(nt)%u%Vx_wind_disk = farm%AWAE%y%Vx_wind_disk(nt) ! Rotor-disk-averaged ambient wind speed, normal to planes, m/s + farm%WD(nt)%u%TI_amb = farm%AWAE%y%TI_amb(nt) ! Ambient turbulence intensity of wind at rotor disk + END DO + +END SUBROUTINE Transfer_AWAE_to_WD +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE Transfer_AWAE_to_FAST(farm) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + integer(intKi) :: nt + + DO nt = 1,farm%p%NumTurbines + ! allocated in FAST's IfW initialization as 3,x,y,z,t + farm%FWrap(nt)%u%Vdist_High = farm%AWAE%y%Vdist_High(nt)%data + END DO + +END SUBROUTINE Transfer_AWAE_to_FAST +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE Transfer_WD_to_AWAE(farm) + type(All_FastFarm_Data), INTENT(INOUT) :: farm !< FAST.Farm data + + integer(intKi) :: nt + + DO nt = 1,farm%p%NumTurbines + farm%AWAE%u%xhat_plane(:,:,nt) = farm%WD(nt)%y%xhat_plane ! Orientations of wake planes, normal to wake planes, for each turbine + farm%AWAE%u%p_plane(:,:,nt) = farm%WD(nt)%y%p_plane ! Center positions of wake planes for each turbine + farm%AWAE%u%Vx_wake(:,:,nt) = farm%WD(nt)%y%Vx_wake ! Axial wake velocity deficit at wake planes, distributed radially, for each turbine + farm%AWAE%u%Vr_wake(:,:,nt) = farm%WD(nt)%y%Vr_wake ! Radial wake velocity deficit at wake planes, distributed radially, for each turbine + farm%AWAE%u%D_wake(:,nt) = farm%WD(nt)%y%D_wake ! Wake diameters at wake planes for each turbine + END DO + +END SUBROUTINE Transfer_WD_to_AWAE +!---------------------------------------------------------------------------------------------------------------------------------- +END MODULE FAST_Farm_Subs +!********************************************************************************************************************************** diff --git a/glue-codes/fast-farm/src/FAST_Farm_Types.f90 b/glue-codes/fast-farm/src/FAST_Farm_Types.f90 new file mode 100644 index 0000000000..07302f730f --- /dev/null +++ b/glue-codes/fast-farm/src/FAST_Farm_Types.f90 @@ -0,0 +1,5662 @@ +!STARTOFREGISTRYGENERATEDFILE 'FAST_Farm_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! FAST_Farm_Types +!................................................................................................................................. +! This file is part of FAST_Farm. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in FAST_Farm. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE FAST_Farm_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE ElastoDyn_Types +USE BeamDyn_Types +USE StrucCtrl_Types +USE ServoDyn_Types +USE IfW_UniformWind_Types +USE IfW_FFWind_Base_Types +USE IfW_TSFFWind_Types +USE IfW_BladedFFWind_Types +USE IfW_HAWCWind_Types +USE IfW_UserWind_Types +USE IfW_4Dext_Types +USE Lidar_Types +USE InflowWind_Types +USE DWM_Types +USE AeroDyn14_Types +USE AirfoilInfo_Types +USE UnsteadyAero_Types +USE DBEMT_Types +USE BEMT_Types +USE FVW_Types +USE AeroAcoustics_Types +USE AeroDyn_Types +USE SubDyn_Types +USE Current_Types +USE Waves_Types +USE Waves2_Types +USE Conv_Radiation_Types +USE SS_Radiation_Types +USE SS_Excitation_Types +USE WAMIT_Types +USE WAMIT2_Types +USE Morison_Types +USE HydroDyn_Types +USE IceFloe_Types +USE OpenFOAM_Types +USE SCDataEx_Types +USE IceDyn_Types +USE FEAMooring_Types +USE MAP_Fortran_Types +USE MAP_Types +USE MoorDyn_Types +USE OrcaFlexInterface_Types +USE ExtPtfm_MCKF_Types +USE FAST_Types +USE FASTWrapper_Types +USE WakeDynamics_Types +USE AWAE_Types +USE SuperController_Types +USE NWTC_Library +IMPLICIT NONE + INTEGER(IntKi), PUBLIC, PARAMETER :: NumFFModules = 4 ! The number of modules available in FAST.Farm [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: ModuleFF_None = 0 ! No module selected [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: ModuleFF_SC = 1 ! Super Controller [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: ModuleFF_FWrap = 2 ! FAST Wrapper [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: ModuleFF_WD = 3 ! Wake Dynamics [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: ModuleFF_AWAE = 4 ! Ambient Wind and Array Effects [-] +! ========= Farm_ParameterType ======= + TYPE, PUBLIC :: Farm_ParameterType + REAL(DbKi) :: DT_low !< Time step for low-resolution wind data input files; will be used as the global FAST.Farm time step [seconds] + REAL(DbKi) :: DT_high !< High-resolution time step [seconds] + REAL(DbKi) :: TMax !< Total run time [seconds] + INTEGER(IntKi) :: n_high_low !< Number of high-resolution time steps per low-resolution time step [-] + INTEGER(IntKi) :: NumTurbines !< Number of turbines in the simulation [-] + CHARACTER(1024) :: WindFilePath !< Path name of wind data files from ABLSolver precursor [-] + CHARACTER(1024) :: SC_FileName !< Name/location of the dynamic library {.dll [Windows] or .so [Linux]} containing the Super Controller algorithms [-] + LOGICAL :: UseSC !< Use a super controller? [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WT_Position !< X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number [meters] + CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: WT_FASTInFile !< Name of input file for each turbine [-] + CHARACTER(1024) :: FTitle !< The description line from the primary FAST.Farm input file [-] + CHARACTER(1024) :: OutFileRoot !< The root name derived from the primary FAST.Farm input file [-] + INTEGER(IntKi) :: n_ChkptTime !< Number of time steps between writing checkpoint files [-] + REAL(DbKi) :: TStart !< Time to begin tabular output [s] + INTEGER(IntKi) :: n_TMax !< Number of the time step of TMax (the end time of the simulation) [-] + LOGICAL :: SumPrint !< Print summary data to file? (.sum) [-] + LOGICAL :: WrBinOutFile !< Write a binary output file? (.outb) [-] + LOGICAL :: WrTxtOutFile !< Write a text (formatted) output file? (.out) [-] + CHARACTER(1) :: Delim !< Delimiter between columns of text output file (.out): space or tab [-] + CHARACTER(20) :: OutFmt !< Format used for text tabular output (except time); resulting field should be 10 characters [-] + CHARACTER(20) :: OutFmt_t !< Format used for time channel in text tabular output; resulting field should be 10 characters [-] + INTEGER(IntKi) :: FmtWidth !< width of the time OutFmt specifier [-] + INTEGER(IntKi) :: TChanLen !< width of the time channel [-] + INTEGER(IntKi) :: NOutTurb !< Number of turbines for write output [1 to 9] [-] + INTEGER(IntKi) :: NOutRadii !< Number of radial nodes for wake output for an individual rotor [0 to 20] [-] + INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: OutRadii !< List of radial nodes for wake output for an individual rotor [1 to NOutRadii] [-] + INTEGER(IntKi) :: NOutDist !< Number of downstream distances for wake output for an individual rotor [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDist !< List of downstream distances for wake output for an individual rotor [1 to NOutDist] [meters] + INTEGER(IntKi) :: NWindVel !< Number of points for wind output [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: WindVelX !< List of coordinates in the X direction for wind output [1 to NWindVel] [meters] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: WindVelY !< List of coordinates in the Y direction for wind output [1 to NWindVel] [meters] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: WindVelZ !< List of coordinates in the Z direction for wind output [1 to NWindVel] [meters] + TYPE(OutParmType) , DIMENSION(:), ALLOCATABLE :: OutParam !< Names and units (and other characteristics) of all requested output parameters [-] + INTEGER(IntKi) :: NumOuts !< Number of user-requested outputs [-] + INTEGER(IntKi) :: NOutSteps !< Maximum number of output steps [-] + CHARACTER(1024) , DIMENSION(1:3) :: FileDescLines !< File Description lines [-] + TYPE(ProgDesc) , DIMENSION(NumModules) :: Module_Ver !< Version information from all modules [-] + INTEGER(IntKi) :: UnOu !< File unit for Fast.Farm output data [-] + REAL(ReKi) :: dX_low !< The spacing of the low-resolution nodes in X direction [m] + REAL(ReKi) :: dY_low !< The spacing of the low-resolution nodes in Y direction [m] + REAL(ReKi) :: dZ_low !< The spacing of the low-resolution nodes in Z direction [m] + INTEGER(IntKi) :: nX_low !< Number of low-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_low !< Number of low-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_low !< Number of low-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: X0_low !< X-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Y0_low !< Y-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Z0_low !< Z-component of the origin of the low-resolution spatial domain [m] + END TYPE Farm_ParameterType +! ======================= +! ========= Farm_MiscVarType ======= + TYPE, PUBLIC :: Farm_MiscVarType + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: AllOuts !< An array holding the value of all of the calculated (not only selected) output channels [see OutListParameters.xlsx spreadsheet] + REAL(DbKi) , DIMENSION(:), ALLOCATABLE :: TimeData !< Array to contain the time output data for the binary file (first output time and a time [fixed] increment) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: AllOutData !< Array to contain all the output data (time history of all outputs); Index 1 is NumOuts, Index 2 is Time step [-] + INTEGER(IntKi) :: n_Out !< Time index into the AllOutData array [-] + END TYPE Farm_MiscVarType +! ======================= +! ========= FASTWrapper_Data ======= + TYPE, PUBLIC :: FASTWrapper_Data + TYPE(FWrap_ContinuousStateType) :: x !< Continuous states [-] + TYPE(FWrap_DiscreteStateType) :: xd !< Discrete states [-] + TYPE(FWrap_ConstraintStateType) :: z !< Constraint states [-] + TYPE(FWrap_OtherStateType) :: OtherSt !< Other states [-] + TYPE(FWrap_ParameterType) :: p !< Parameters [-] + TYPE(FWrap_InputType) :: u !< System inputs [-] + TYPE(FWrap_OutputType) :: y !< System outputs [-] + TYPE(FWrap_MiscVarType) :: m !< Misc/optimization variables [-] + LOGICAL :: IsInitialized = .FALSE. !< Has FWrap_Init been called [-] + END TYPE FASTWrapper_Data +! ======================= +! ========= WakeDynamics_Data ======= + TYPE, PUBLIC :: WakeDynamics_Data + TYPE(WD_ContinuousStateType) :: x !< Continuous states [-] + TYPE(WD_DiscreteStateType) :: xd !< Discrete states [-] + TYPE(WD_ConstraintStateType) :: z !< Constraint states [-] + TYPE(WD_OtherStateType) :: OtherSt !< Other states [-] + TYPE(WD_ParameterType) :: p !< Parameters [-] + TYPE(WD_InputType) :: u !< System inputs [-] + TYPE(WD_OutputType) :: y !< System outputs [-] + TYPE(WD_MiscVarType) :: m !< Misc/optimization variables [-] + LOGICAL :: IsInitialized = .FALSE. !< Has WD_Init been called [-] + END TYPE WakeDynamics_Data +! ======================= +! ========= AWAE_Data ======= + TYPE, PUBLIC :: AWAE_Data + TYPE(AWAE_ContinuousStateType) :: x !< Continuous states [-] + TYPE(AWAE_DiscreteStateType) :: xd !< Discrete states [-] + TYPE(AWAE_ConstraintStateType) :: z !< Constraint states [-] + TYPE(AWAE_OtherStateType) :: OtherSt !< Other states [-] + TYPE(AWAE_ParameterType) :: p !< Parameters [-] + TYPE(AWAE_InputType) :: u !< System inputs [-] + TYPE(AWAE_OutputType) :: y !< System outputs [-] + TYPE(AWAE_MiscVarType) :: m !< Misc/optimization variables [-] + LOGICAL :: IsInitialized = .FALSE. !< Has AWAE_Init been called [-] + END TYPE AWAE_Data +! ======================= +! ========= SC_Data ======= + TYPE, PUBLIC :: SC_Data + TYPE(SC_ContinuousStateType) :: x !< Continuous states [-] + TYPE(SC_DiscreteStateType) :: xd !< Discrete states [-] + TYPE(SC_ConstraintStateType) :: z !< Constraint states [-] + TYPE(SC_OtherStateType) :: OtherState !< Other states [-] + TYPE(SC_ParameterType) :: p !< Parameters [-] + TYPE(SC_InputType) :: uInputs !< System inputs [-] + REAL(DbKi) , DIMENSION(1:1) :: utimes !< Current time [s] + TYPE(SC_OutputType) :: y !< System outputs [-] + TYPE(SC_MiscVarType) :: m !< Misc/optimization variables [-] + LOGICAL :: IsInitialized = .FALSE. !< Has SC_Init been called [-] + END TYPE SC_Data +! ======================= +! ========= All_FastFarm_Data ======= + TYPE, PUBLIC :: All_FastFarm_Data + TYPE(Farm_ParameterType) :: p !< FAST.Farm parameter data [-] + TYPE(Farm_MiscVarType) :: m !< FAST.Farm misc var data [-] + TYPE(FASTWrapper_Data) , DIMENSION(:), ALLOCATABLE :: FWrap !< FASTWrapper data (one instance per turbine) [-] + TYPE(WakeDynamics_Data) , DIMENSION(:), ALLOCATABLE :: WD !< WakeDynamics (WD) data [-] + TYPE(AWAE_Data) :: AWAE !< Ambient Wind & Array Effects (AWAE) data [-] + TYPE(SC_Data) :: SC !< Super Controller (SC) data [-] + END TYPE All_FastFarm_Data +! ======================= +CONTAINS + SUBROUTINE Farm_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(Farm_ParameterType), INTENT(IN) :: SrcParamData + TYPE(Farm_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%DT_low = SrcParamData%DT_low + DstParamData%DT_high = SrcParamData%DT_high + DstParamData%TMax = SrcParamData%TMax + DstParamData%n_high_low = SrcParamData%n_high_low + DstParamData%NumTurbines = SrcParamData%NumTurbines + DstParamData%WindFilePath = SrcParamData%WindFilePath + DstParamData%SC_FileName = SrcParamData%SC_FileName + DstParamData%UseSC = SrcParamData%UseSC +IF (ALLOCATED(SrcParamData%WT_Position)) THEN + i1_l = LBOUND(SrcParamData%WT_Position,1) + i1_u = UBOUND(SrcParamData%WT_Position,1) + i2_l = LBOUND(SrcParamData%WT_Position,2) + i2_u = UBOUND(SrcParamData%WT_Position,2) + IF (.NOT. ALLOCATED(DstParamData%WT_Position)) THEN + ALLOCATE(DstParamData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WT_Position = SrcParamData%WT_Position +ENDIF +IF (ALLOCATED(SrcParamData%WT_FASTInFile)) THEN + i1_l = LBOUND(SrcParamData%WT_FASTInFile,1) + i1_u = UBOUND(SrcParamData%WT_FASTInFile,1) + IF (.NOT. ALLOCATED(DstParamData%WT_FASTInFile)) THEN + ALLOCATE(DstParamData%WT_FASTInFile(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WT_FASTInFile.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WT_FASTInFile = SrcParamData%WT_FASTInFile +ENDIF + DstParamData%FTitle = SrcParamData%FTitle + DstParamData%OutFileRoot = SrcParamData%OutFileRoot + DstParamData%n_ChkptTime = SrcParamData%n_ChkptTime + DstParamData%TStart = SrcParamData%TStart + DstParamData%n_TMax = SrcParamData%n_TMax + DstParamData%SumPrint = SrcParamData%SumPrint + DstParamData%WrBinOutFile = SrcParamData%WrBinOutFile + DstParamData%WrTxtOutFile = SrcParamData%WrTxtOutFile + DstParamData%Delim = SrcParamData%Delim + DstParamData%OutFmt = SrcParamData%OutFmt + DstParamData%OutFmt_t = SrcParamData%OutFmt_t + DstParamData%FmtWidth = SrcParamData%FmtWidth + DstParamData%TChanLen = SrcParamData%TChanLen + DstParamData%NOutTurb = SrcParamData%NOutTurb + DstParamData%NOutRadii = SrcParamData%NOutRadii +IF (ALLOCATED(SrcParamData%OutRadii)) THEN + i1_l = LBOUND(SrcParamData%OutRadii,1) + i1_u = UBOUND(SrcParamData%OutRadii,1) + IF (.NOT. ALLOCATED(DstParamData%OutRadii)) THEN + ALLOCATE(DstParamData%OutRadii(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutRadii.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%OutRadii = SrcParamData%OutRadii +ENDIF + DstParamData%NOutDist = SrcParamData%NOutDist +IF (ALLOCATED(SrcParamData%OutDist)) THEN + i1_l = LBOUND(SrcParamData%OutDist,1) + i1_u = UBOUND(SrcParamData%OutDist,1) + IF (.NOT. ALLOCATED(DstParamData%OutDist)) THEN + ALLOCATE(DstParamData%OutDist(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutDist.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%OutDist = SrcParamData%OutDist +ENDIF + DstParamData%NWindVel = SrcParamData%NWindVel +IF (ALLOCATED(SrcParamData%WindVelX)) THEN + i1_l = LBOUND(SrcParamData%WindVelX,1) + i1_u = UBOUND(SrcParamData%WindVelX,1) + IF (.NOT. ALLOCATED(DstParamData%WindVelX)) THEN + ALLOCATE(DstParamData%WindVelX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WindVelX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WindVelX = SrcParamData%WindVelX +ENDIF +IF (ALLOCATED(SrcParamData%WindVelY)) THEN + i1_l = LBOUND(SrcParamData%WindVelY,1) + i1_u = UBOUND(SrcParamData%WindVelY,1) + IF (.NOT. ALLOCATED(DstParamData%WindVelY)) THEN + ALLOCATE(DstParamData%WindVelY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WindVelY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WindVelY = SrcParamData%WindVelY +ENDIF +IF (ALLOCATED(SrcParamData%WindVelZ)) THEN + i1_l = LBOUND(SrcParamData%WindVelZ,1) + i1_u = UBOUND(SrcParamData%WindVelZ,1) + IF (.NOT. ALLOCATED(DstParamData%WindVelZ)) THEN + ALLOCATE(DstParamData%WindVelZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WindVelZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WindVelZ = SrcParamData%WindVelZ +ENDIF +IF (ALLOCATED(SrcParamData%OutParam)) THEN + i1_l = LBOUND(SrcParamData%OutParam,1) + i1_u = UBOUND(SrcParamData%OutParam,1) + IF (.NOT. ALLOCATED(DstParamData%OutParam)) THEN + ALLOCATE(DstParamData%OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutParam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%OutParam,1), UBOUND(SrcParamData%OutParam,1) + CALL NWTC_Library_Copyoutparmtype( SrcParamData%OutParam(i1), DstParamData%OutParam(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + DstParamData%NumOuts = SrcParamData%NumOuts + DstParamData%NOutSteps = SrcParamData%NOutSteps + DstParamData%FileDescLines = SrcParamData%FileDescLines + DO i1 = LBOUND(SrcParamData%Module_Ver,1), UBOUND(SrcParamData%Module_Ver,1) + CALL NWTC_Library_Copyprogdesc( SrcParamData%Module_Ver(i1), DstParamData%Module_Ver(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + DstParamData%UnOu = SrcParamData%UnOu + DstParamData%dX_low = SrcParamData%dX_low + DstParamData%dY_low = SrcParamData%dY_low + DstParamData%dZ_low = SrcParamData%dZ_low + DstParamData%nX_low = SrcParamData%nX_low + DstParamData%nY_low = SrcParamData%nY_low + DstParamData%nZ_low = SrcParamData%nZ_low + DstParamData%X0_low = SrcParamData%X0_low + DstParamData%Y0_low = SrcParamData%Y0_low + DstParamData%Z0_low = SrcParamData%Z0_low + END SUBROUTINE Farm_CopyParam + + SUBROUTINE Farm_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(Farm_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%WT_Position)) THEN + DEALLOCATE(ParamData%WT_Position) +ENDIF +IF (ALLOCATED(ParamData%WT_FASTInFile)) THEN + DEALLOCATE(ParamData%WT_FASTInFile) +ENDIF +IF (ALLOCATED(ParamData%OutRadii)) THEN + DEALLOCATE(ParamData%OutRadii) +ENDIF +IF (ALLOCATED(ParamData%OutDist)) THEN + DEALLOCATE(ParamData%OutDist) +ENDIF +IF (ALLOCATED(ParamData%WindVelX)) THEN + DEALLOCATE(ParamData%WindVelX) +ENDIF +IF (ALLOCATED(ParamData%WindVelY)) THEN + DEALLOCATE(ParamData%WindVelY) +ENDIF +IF (ALLOCATED(ParamData%WindVelZ)) THEN + DEALLOCATE(ParamData%WindVelZ) +ENDIF +IF (ALLOCATED(ParamData%OutParam)) THEN +DO i1 = LBOUND(ParamData%OutParam,1), UBOUND(ParamData%OutParam,1) + CALL NWTC_Library_Destroyoutparmtype( ParamData%OutParam(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%OutParam) +ENDIF +DO i1 = LBOUND(ParamData%Module_Ver,1), UBOUND(ParamData%Module_Ver,1) + CALL NWTC_Library_Destroyprogdesc( ParamData%Module_Ver(i1), ErrStat, ErrMsg ) +ENDDO + END SUBROUTINE Farm_DestroyParam + + SUBROUTINE Farm_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(Farm_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! DT_low + Db_BufSz = Db_BufSz + 1 ! DT_high + Db_BufSz = Db_BufSz + 1 ! TMax + Int_BufSz = Int_BufSz + 1 ! n_high_low + Int_BufSz = Int_BufSz + 1 ! NumTurbines + Int_BufSz = Int_BufSz + 1*LEN(InData%WindFilePath) ! WindFilePath + Int_BufSz = Int_BufSz + 1*LEN(InData%SC_FileName) ! SC_FileName + Int_BufSz = Int_BufSz + 1 ! UseSC + Int_BufSz = Int_BufSz + 1 ! WT_Position allocated yes/no + IF ( ALLOCATED(InData%WT_Position) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! WT_Position upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WT_Position) ! WT_Position + END IF + Int_BufSz = Int_BufSz + 1 ! WT_FASTInFile allocated yes/no + IF ( ALLOCATED(InData%WT_FASTInFile) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WT_FASTInFile upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%WT_FASTInFile)*LEN(InData%WT_FASTInFile) ! WT_FASTInFile + END IF + Int_BufSz = Int_BufSz + 1*LEN(InData%FTitle) ! FTitle + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFileRoot) ! OutFileRoot + Int_BufSz = Int_BufSz + 1 ! n_ChkptTime + Db_BufSz = Db_BufSz + 1 ! TStart + Int_BufSz = Int_BufSz + 1 ! n_TMax + Int_BufSz = Int_BufSz + 1 ! SumPrint + Int_BufSz = Int_BufSz + 1 ! WrBinOutFile + Int_BufSz = Int_BufSz + 1 ! WrTxtOutFile + Int_BufSz = Int_BufSz + 1*LEN(InData%Delim) ! Delim + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFmt) ! OutFmt + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFmt_t) ! OutFmt_t + Int_BufSz = Int_BufSz + 1 ! FmtWidth + Int_BufSz = Int_BufSz + 1 ! TChanLen + Int_BufSz = Int_BufSz + 1 ! NOutTurb + Int_BufSz = Int_BufSz + 1 ! NOutRadii + Int_BufSz = Int_BufSz + 1 ! OutRadii allocated yes/no + IF ( ALLOCATED(InData%OutRadii) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutRadii upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%OutRadii) ! OutRadii + END IF + Int_BufSz = Int_BufSz + 1 ! NOutDist + Int_BufSz = Int_BufSz + 1 ! OutDist allocated yes/no + IF ( ALLOCATED(InData%OutDist) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDist upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDist) ! OutDist + END IF + Int_BufSz = Int_BufSz + 1 ! NWindVel + Int_BufSz = Int_BufSz + 1 ! WindVelX allocated yes/no + IF ( ALLOCATED(InData%WindVelX) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WindVelX upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WindVelX) ! WindVelX + END IF + Int_BufSz = Int_BufSz + 1 ! WindVelY allocated yes/no + IF ( ALLOCATED(InData%WindVelY) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WindVelY upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WindVelY) ! WindVelY + END IF + Int_BufSz = Int_BufSz + 1 ! WindVelZ allocated yes/no + IF ( ALLOCATED(InData%WindVelZ) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WindVelZ upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WindVelZ) ! WindVelZ + END IF + Int_BufSz = Int_BufSz + 1 ! OutParam allocated yes/no + IF ( ALLOCATED(InData%OutParam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutParam upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) + Int_BufSz = Int_BufSz + 3 ! OutParam: size of buffers for each call to pack subtype + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, .TRUE. ) ! OutParam + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! OutParam + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! OutParam + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! OutParam + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NumOuts + Int_BufSz = Int_BufSz + 1 ! NOutSteps + Int_BufSz = Int_BufSz + SIZE(InData%FileDescLines)*LEN(InData%FileDescLines) ! FileDescLines + DO i1 = LBOUND(InData%Module_Ver,1), UBOUND(InData%Module_Ver,1) + Int_BufSz = Int_BufSz + 3 ! Module_Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Module_Ver(i1), ErrStat2, ErrMsg2, .TRUE. ) ! Module_Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Module_Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Module_Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Module_Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + Int_BufSz = Int_BufSz + 1 ! UnOu + Re_BufSz = Re_BufSz + 1 ! dX_low + Re_BufSz = Re_BufSz + 1 ! dY_low + Re_BufSz = Re_BufSz + 1 ! dZ_low + Int_BufSz = Int_BufSz + 1 ! nX_low + Int_BufSz = Int_BufSz + 1 ! nY_low + Int_BufSz = Int_BufSz + 1 ! nZ_low + Re_BufSz = Re_BufSz + 1 ! X0_low + Re_BufSz = Re_BufSz + 1 ! Y0_low + Re_BufSz = Re_BufSz + 1 ! Z0_low + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%DT_low + Db_Xferred = Db_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%DT_high + Db_Xferred = Db_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%TMax + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%n_high_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumTurbines + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%WindFilePath) + IntKiBuf(Int_Xferred) = ICHAR(InData%WindFilePath(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%SC_FileName) + IntKiBuf(Int_Xferred) = ICHAR(InData%SC_FileName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseSC, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%WT_Position) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%WT_Position,2), UBOUND(InData%WT_Position,2) + DO i1 = LBOUND(InData%WT_Position,1), UBOUND(InData%WT_Position,1) + ReKiBuf(Re_Xferred) = InData%WT_Position(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WT_FASTInFile) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_FASTInFile,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_FASTInFile,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WT_FASTInFile,1), UBOUND(InData%WT_FASTInFile,1) + DO I = 1, LEN(InData%WT_FASTInFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%WT_FASTInFile(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + DO I = 1, LEN(InData%FTitle) + IntKiBuf(Int_Xferred) = ICHAR(InData%FTitle(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%OutFileRoot) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFileRoot(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%n_ChkptTime + Int_Xferred = Int_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%TStart + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%n_TMax + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%SumPrint, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%WrBinOutFile, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%WrTxtOutFile, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%Delim) + IntKiBuf(Int_Xferred) = ICHAR(InData%Delim(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%OutFmt) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFmt(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%OutFmt_t) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFmt_t(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%FmtWidth + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TChanLen + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NOutTurb + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NOutRadii + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutRadii) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutRadii,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutRadii,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutRadii,1), UBOUND(InData%OutRadii,1) + IntKiBuf(Int_Xferred) = InData%OutRadii(i1) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NOutDist + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDist) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDist,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDist,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDist,1), UBOUND(InData%OutDist,1) + ReKiBuf(Re_Xferred) = InData%OutDist(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NWindVel + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%WindVelX) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WindVelX,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WindVelX,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WindVelX,1), UBOUND(InData%WindVelX,1) + ReKiBuf(Re_Xferred) = InData%WindVelX(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WindVelY) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WindVelY,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WindVelY,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WindVelY,1), UBOUND(InData%WindVelY,1) + ReKiBuf(Re_Xferred) = InData%WindVelY(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WindVelZ) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WindVelZ,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WindVelZ,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WindVelZ,1), UBOUND(InData%WindVelZ,1) + ReKiBuf(Re_Xferred) = InData%WindVelZ(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%OutParam) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutParam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutParam,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutParam + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumOuts + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NOutSteps + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%FileDescLines,1), UBOUND(InData%FileDescLines,1) + DO I = 1, LEN(InData%FileDescLines) + IntKiBuf(Int_Xferred) = ICHAR(InData%FileDescLines(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + DO i1 = LBOUND(InData%Module_Ver,1), UBOUND(InData%Module_Ver,1) + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Module_Ver(i1), ErrStat2, ErrMsg2, OnlySize ) ! Module_Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + IntKiBuf(Int_Xferred) = InData%UnOu + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dX_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dY_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dZ_low + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nX_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_low + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%X0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Y0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Z0_low + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE Farm_PackParam + + SUBROUTINE Farm_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(Farm_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DT_low = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%DT_high = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%TMax = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%n_high_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumTurbines = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%WindFilePath) + OutData%WindFilePath(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%SC_FileName) + OutData%SC_FileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%UseSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseSC) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WT_Position not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WT_Position)) DEALLOCATE(OutData%WT_Position) + ALLOCATE(OutData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%WT_Position,2), UBOUND(OutData%WT_Position,2) + DO i1 = LBOUND(OutData%WT_Position,1), UBOUND(OutData%WT_Position,1) + OutData%WT_Position(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WT_FASTInFile not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WT_FASTInFile)) DEALLOCATE(OutData%WT_FASTInFile) + ALLOCATE(OutData%WT_FASTInFile(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WT_FASTInFile.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WT_FASTInFile,1), UBOUND(OutData%WT_FASTInFile,1) + DO I = 1, LEN(OutData%WT_FASTInFile) + OutData%WT_FASTInFile(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + DO I = 1, LEN(OutData%FTitle) + OutData%FTitle(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%OutFileRoot) + OutData%OutFileRoot(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%n_ChkptTime = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TStart = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%n_TMax = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%SumPrint = TRANSFER(IntKiBuf(Int_Xferred), OutData%SumPrint) + Int_Xferred = Int_Xferred + 1 + OutData%WrBinOutFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%WrBinOutFile) + Int_Xferred = Int_Xferred + 1 + OutData%WrTxtOutFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%WrTxtOutFile) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%Delim) + OutData%Delim(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%OutFmt) + OutData%OutFmt(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%OutFmt_t) + OutData%OutFmt_t(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%FmtWidth = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TChanLen = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NOutTurb = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NOutRadii = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutRadii not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutRadii)) DEALLOCATE(OutData%OutRadii) + ALLOCATE(OutData%OutRadii(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutRadii.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutRadii,1), UBOUND(OutData%OutRadii,1) + OutData%OutRadii(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + OutData%NOutDist = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDist not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDist)) DEALLOCATE(OutData%OutDist) + ALLOCATE(OutData%OutDist(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDist.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDist,1), UBOUND(OutData%OutDist,1) + OutData%OutDist(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%NWindVel = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WindVelX not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WindVelX)) DEALLOCATE(OutData%WindVelX) + ALLOCATE(OutData%WindVelX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WindVelX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WindVelX,1), UBOUND(OutData%WindVelX,1) + OutData%WindVelX(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WindVelY not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WindVelY)) DEALLOCATE(OutData%WindVelY) + ALLOCATE(OutData%WindVelY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WindVelY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WindVelY,1), UBOUND(OutData%WindVelY,1) + OutData%WindVelY(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WindVelZ not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WindVelZ)) DEALLOCATE(OutData%WindVelZ) + ALLOCATE(OutData%WindVelZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WindVelZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WindVelZ,1), UBOUND(OutData%WindVelZ,1) + OutData%WindVelZ(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutParam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutParam)) DEALLOCATE(OutData%OutParam) + ALLOCATE(OutData%OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutParam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutParam,1), UBOUND(OutData%OutParam,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackoutparmtype( Re_Buf, Db_Buf, Int_Buf, OutData%OutParam(i1), ErrStat2, ErrMsg2 ) ! OutParam + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + OutData%NumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NOutSteps = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%FileDescLines,1) + i1_u = UBOUND(OutData%FileDescLines,1) + DO i1 = LBOUND(OutData%FileDescLines,1), UBOUND(OutData%FileDescLines,1) + DO I = 1, LEN(OutData%FileDescLines) + OutData%FileDescLines(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + i1_l = LBOUND(OutData%Module_Ver,1) + i1_u = UBOUND(OutData%Module_Ver,1) + DO i1 = LBOUND(OutData%Module_Ver,1), UBOUND(OutData%Module_Ver,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Module_Ver(i1), ErrStat2, ErrMsg2 ) ! Module_Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + OutData%UnOu = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dX_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dY_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dZ_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%nX_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%X0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Y0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Z0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE Farm_UnPackParam + + SUBROUTINE Farm_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(Farm_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(Farm_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcMiscData%AllOuts)) THEN + i1_l = LBOUND(SrcMiscData%AllOuts,1) + i1_u = UBOUND(SrcMiscData%AllOuts,1) + IF (.NOT. ALLOCATED(DstMiscData%AllOuts)) THEN + ALLOCATE(DstMiscData%AllOuts(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%AllOuts.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%AllOuts = SrcMiscData%AllOuts +ENDIF +IF (ALLOCATED(SrcMiscData%TimeData)) THEN + i1_l = LBOUND(SrcMiscData%TimeData,1) + i1_u = UBOUND(SrcMiscData%TimeData,1) + IF (.NOT. ALLOCATED(DstMiscData%TimeData)) THEN + ALLOCATE(DstMiscData%TimeData(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TimeData.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%TimeData = SrcMiscData%TimeData +ENDIF +IF (ALLOCATED(SrcMiscData%AllOutData)) THEN + i1_l = LBOUND(SrcMiscData%AllOutData,1) + i1_u = UBOUND(SrcMiscData%AllOutData,1) + i2_l = LBOUND(SrcMiscData%AllOutData,2) + i2_u = UBOUND(SrcMiscData%AllOutData,2) + IF (.NOT. ALLOCATED(DstMiscData%AllOutData)) THEN + ALLOCATE(DstMiscData%AllOutData(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%AllOutData.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%AllOutData = SrcMiscData%AllOutData +ENDIF + DstMiscData%n_Out = SrcMiscData%n_Out + END SUBROUTINE Farm_CopyMisc + + SUBROUTINE Farm_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(Farm_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(MiscData%AllOuts)) THEN + DEALLOCATE(MiscData%AllOuts) +ENDIF +IF (ALLOCATED(MiscData%TimeData)) THEN + DEALLOCATE(MiscData%TimeData) +ENDIF +IF (ALLOCATED(MiscData%AllOutData)) THEN + DEALLOCATE(MiscData%AllOutData) +ENDIF + END SUBROUTINE Farm_DestroyMisc + + SUBROUTINE Farm_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(Farm_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! AllOuts allocated yes/no + IF ( ALLOCATED(InData%AllOuts) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AllOuts upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AllOuts) ! AllOuts + END IF + Int_BufSz = Int_BufSz + 1 ! TimeData allocated yes/no + IF ( ALLOCATED(InData%TimeData) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TimeData upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%TimeData) ! TimeData + END IF + Int_BufSz = Int_BufSz + 1 ! AllOutData allocated yes/no + IF ( ALLOCATED(InData%AllOutData) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! AllOutData upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AllOutData) ! AllOutData + END IF + Int_BufSz = Int_BufSz + 1 ! n_Out + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%AllOuts) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AllOuts,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AllOuts,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AllOuts,1), UBOUND(InData%AllOuts,1) + ReKiBuf(Re_Xferred) = InData%AllOuts(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TimeData) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TimeData,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TimeData,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TimeData,1), UBOUND(InData%TimeData,1) + DbKiBuf(Db_Xferred) = InData%TimeData(i1) + Db_Xferred = Db_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%AllOutData) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AllOutData,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AllOutData,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AllOutData,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AllOutData,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%AllOutData,2), UBOUND(InData%AllOutData,2) + DO i1 = LBOUND(InData%AllOutData,1), UBOUND(InData%AllOutData,1) + ReKiBuf(Re_Xferred) = InData%AllOutData(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = InData%n_Out + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_PackMisc + + SUBROUTINE Farm_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(Farm_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AllOuts not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AllOuts)) DEALLOCATE(OutData%AllOuts) + ALLOCATE(OutData%AllOuts(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AllOuts.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AllOuts,1), UBOUND(OutData%AllOuts,1) + OutData%AllOuts(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TimeData not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TimeData)) DEALLOCATE(OutData%TimeData) + ALLOCATE(OutData%TimeData(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TimeData.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TimeData,1), UBOUND(OutData%TimeData,1) + OutData%TimeData(i1) = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AllOutData not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AllOutData)) DEALLOCATE(OutData%AllOutData) + ALLOCATE(OutData%AllOutData(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AllOutData.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%AllOutData,2), UBOUND(OutData%AllOutData,2) + DO i1 = LBOUND(OutData%AllOutData,1), UBOUND(OutData%AllOutData,1) + OutData%AllOutData(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%n_Out = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_UnPackMisc + + SUBROUTINE Farm_CopyFASTWrapper_Data( SrcFASTWrapper_DataData, DstFASTWrapper_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FASTWrapper_Data), INTENT(INOUT) :: SrcFASTWrapper_DataData + TYPE(FASTWrapper_Data), INTENT(INOUT) :: DstFASTWrapper_DataData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyFASTWrapper_Data' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL FWrap_CopyContState( SrcFASTWrapper_DataData%x, DstFASTWrapper_DataData%x, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyDiscState( SrcFASTWrapper_DataData%xd, DstFASTWrapper_DataData%xd, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyConstrState( SrcFASTWrapper_DataData%z, DstFASTWrapper_DataData%z, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyOtherState( SrcFASTWrapper_DataData%OtherSt, DstFASTWrapper_DataData%OtherSt, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyParam( SrcFASTWrapper_DataData%p, DstFASTWrapper_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyInput( SrcFASTWrapper_DataData%u, DstFASTWrapper_DataData%u, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyOutput( SrcFASTWrapper_DataData%y, DstFASTWrapper_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FWrap_CopyMisc( SrcFASTWrapper_DataData%m, DstFASTWrapper_DataData%m, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstFASTWrapper_DataData%IsInitialized = SrcFASTWrapper_DataData%IsInitialized + END SUBROUTINE Farm_CopyFASTWrapper_Data + + SUBROUTINE Farm_DestroyFASTWrapper_Data( FASTWrapper_DataData, ErrStat, ErrMsg ) + TYPE(FASTWrapper_Data), INTENT(INOUT) :: FASTWrapper_DataData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyFASTWrapper_Data' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL FWrap_DestroyContState( FASTWrapper_DataData%x, ErrStat, ErrMsg ) + CALL FWrap_DestroyDiscState( FASTWrapper_DataData%xd, ErrStat, ErrMsg ) + CALL FWrap_DestroyConstrState( FASTWrapper_DataData%z, ErrStat, ErrMsg ) + CALL FWrap_DestroyOtherState( FASTWrapper_DataData%OtherSt, ErrStat, ErrMsg ) + CALL FWrap_DestroyParam( FASTWrapper_DataData%p, ErrStat, ErrMsg ) + CALL FWrap_DestroyInput( FASTWrapper_DataData%u, ErrStat, ErrMsg ) + CALL FWrap_DestroyOutput( FASTWrapper_DataData%y, ErrStat, ErrMsg ) + CALL FWrap_DestroyMisc( FASTWrapper_DataData%m, ErrStat, ErrMsg ) + END SUBROUTINE Farm_DestroyFASTWrapper_Data + + SUBROUTINE Farm_PackFASTWrapper_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FASTWrapper_Data), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackFASTWrapper_Data' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! x: size of buffers for each call to pack subtype + CALL FWrap_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, .TRUE. ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! x + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! x + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! x + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! xd: size of buffers for each call to pack subtype + CALL FWrap_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, .TRUE. ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! xd + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! xd + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! xd + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! z: size of buffers for each call to pack subtype + CALL FWrap_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, .TRUE. ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! z + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! z + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! z + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! OtherSt: size of buffers for each call to pack subtype + CALL FWrap_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, .TRUE. ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! OtherSt + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! OtherSt + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! OtherSt + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype + CALL FWrap_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! p + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! p + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! p + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! u: size of buffers for each call to pack subtype + CALL FWrap_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, .TRUE. ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! y: size of buffers for each call to pack subtype + CALL FWrap_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! m: size of buffers for each call to pack subtype + CALL FWrap_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, .TRUE. ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! m + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! m + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! m + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! IsInitialized + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL FWrap_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, OnlySize ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, OnlySize ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, OnlySize ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, OnlySize ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, OnlySize ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FWrap_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, OnlySize ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%IsInitialized, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_PackFASTWrapper_Data + + SUBROUTINE Farm_UnPackFASTWrapper_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FASTWrapper_Data), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackFASTWrapper_Data' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%x, ErrStat2, ErrMsg2 ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%xd, ErrStat2, ErrMsg2 ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%z, ErrStat2, ErrMsg2 ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%OtherSt, ErrStat2, ErrMsg2 ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u, ErrStat2, ErrMsg2 ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FWrap_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%m, ErrStat2, ErrMsg2 ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%IsInitialized = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsInitialized) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_UnPackFASTWrapper_Data + + SUBROUTINE Farm_CopyWakeDynamics_Data( SrcWakeDynamics_DataData, DstWakeDynamics_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WakeDynamics_Data), INTENT(IN) :: SrcWakeDynamics_DataData + TYPE(WakeDynamics_Data), INTENT(INOUT) :: DstWakeDynamics_DataData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyWakeDynamics_Data' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL WD_CopyContState( SrcWakeDynamics_DataData%x, DstWakeDynamics_DataData%x, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyDiscState( SrcWakeDynamics_DataData%xd, DstWakeDynamics_DataData%xd, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyConstrState( SrcWakeDynamics_DataData%z, DstWakeDynamics_DataData%z, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyOtherState( SrcWakeDynamics_DataData%OtherSt, DstWakeDynamics_DataData%OtherSt, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyParam( SrcWakeDynamics_DataData%p, DstWakeDynamics_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyInput( SrcWakeDynamics_DataData%u, DstWakeDynamics_DataData%u, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyOutput( SrcWakeDynamics_DataData%y, DstWakeDynamics_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL WD_CopyMisc( SrcWakeDynamics_DataData%m, DstWakeDynamics_DataData%m, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstWakeDynamics_DataData%IsInitialized = SrcWakeDynamics_DataData%IsInitialized + END SUBROUTINE Farm_CopyWakeDynamics_Data + + SUBROUTINE Farm_DestroyWakeDynamics_Data( WakeDynamics_DataData, ErrStat, ErrMsg ) + TYPE(WakeDynamics_Data), INTENT(INOUT) :: WakeDynamics_DataData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyWakeDynamics_Data' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL WD_DestroyContState( WakeDynamics_DataData%x, ErrStat, ErrMsg ) + CALL WD_DestroyDiscState( WakeDynamics_DataData%xd, ErrStat, ErrMsg ) + CALL WD_DestroyConstrState( WakeDynamics_DataData%z, ErrStat, ErrMsg ) + CALL WD_DestroyOtherState( WakeDynamics_DataData%OtherSt, ErrStat, ErrMsg ) + CALL WD_DestroyParam( WakeDynamics_DataData%p, ErrStat, ErrMsg ) + CALL WD_DestroyInput( WakeDynamics_DataData%u, ErrStat, ErrMsg ) + CALL WD_DestroyOutput( WakeDynamics_DataData%y, ErrStat, ErrMsg ) + CALL WD_DestroyMisc( WakeDynamics_DataData%m, ErrStat, ErrMsg ) + END SUBROUTINE Farm_DestroyWakeDynamics_Data + + SUBROUTINE Farm_PackWakeDynamics_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WakeDynamics_Data), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackWakeDynamics_Data' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! x: size of buffers for each call to pack subtype + CALL WD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, .TRUE. ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! x + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! x + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! x + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! xd: size of buffers for each call to pack subtype + CALL WD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, .TRUE. ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! xd + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! xd + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! xd + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! z: size of buffers for each call to pack subtype + CALL WD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, .TRUE. ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! z + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! z + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! z + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! OtherSt: size of buffers for each call to pack subtype + CALL WD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, .TRUE. ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! OtherSt + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! OtherSt + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! OtherSt + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype + CALL WD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! p + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! p + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! p + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! u: size of buffers for each call to pack subtype + CALL WD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, .TRUE. ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! y: size of buffers for each call to pack subtype + CALL WD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! m: size of buffers for each call to pack subtype + CALL WD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, .TRUE. ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! m + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! m + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! m + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! IsInitialized + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL WD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, OnlySize ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, OnlySize ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, OnlySize ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, OnlySize ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, OnlySize ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL WD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, OnlySize ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%IsInitialized, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_PackWakeDynamics_Data + + SUBROUTINE Farm_UnPackWakeDynamics_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WakeDynamics_Data), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackWakeDynamics_Data' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%x, ErrStat2, ErrMsg2 ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%xd, ErrStat2, ErrMsg2 ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%z, ErrStat2, ErrMsg2 ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%OtherSt, ErrStat2, ErrMsg2 ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u, ErrStat2, ErrMsg2 ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%m, ErrStat2, ErrMsg2 ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%IsInitialized = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsInitialized) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_UnPackWakeDynamics_Data + + SUBROUTINE Farm_CopyAWAE_Data( SrcAWAE_DataData, DstAWAE_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_Data), INTENT(IN) :: SrcAWAE_DataData + TYPE(AWAE_Data), INTENT(INOUT) :: DstAWAE_DataData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyAWAE_Data' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL AWAE_CopyContState( SrcAWAE_DataData%x, DstAWAE_DataData%x, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyDiscState( SrcAWAE_DataData%xd, DstAWAE_DataData%xd, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyConstrState( SrcAWAE_DataData%z, DstAWAE_DataData%z, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyOtherState( SrcAWAE_DataData%OtherSt, DstAWAE_DataData%OtherSt, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyParam( SrcAWAE_DataData%p, DstAWAE_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyInput( SrcAWAE_DataData%u, DstAWAE_DataData%u, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyOutput( SrcAWAE_DataData%y, DstAWAE_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AWAE_CopyMisc( SrcAWAE_DataData%m, DstAWAE_DataData%m, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstAWAE_DataData%IsInitialized = SrcAWAE_DataData%IsInitialized + END SUBROUTINE Farm_CopyAWAE_Data + + SUBROUTINE Farm_DestroyAWAE_Data( AWAE_DataData, ErrStat, ErrMsg ) + TYPE(AWAE_Data), INTENT(INOUT) :: AWAE_DataData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyAWAE_Data' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL AWAE_DestroyContState( AWAE_DataData%x, ErrStat, ErrMsg ) + CALL AWAE_DestroyDiscState( AWAE_DataData%xd, ErrStat, ErrMsg ) + CALL AWAE_DestroyConstrState( AWAE_DataData%z, ErrStat, ErrMsg ) + CALL AWAE_DestroyOtherState( AWAE_DataData%OtherSt, ErrStat, ErrMsg ) + CALL AWAE_DestroyParam( AWAE_DataData%p, ErrStat, ErrMsg ) + CALL AWAE_DestroyInput( AWAE_DataData%u, ErrStat, ErrMsg ) + CALL AWAE_DestroyOutput( AWAE_DataData%y, ErrStat, ErrMsg ) + CALL AWAE_DestroyMisc( AWAE_DataData%m, ErrStat, ErrMsg ) + END SUBROUTINE Farm_DestroyAWAE_Data + + SUBROUTINE Farm_PackAWAE_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_Data), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackAWAE_Data' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! x: size of buffers for each call to pack subtype + CALL AWAE_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, .TRUE. ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! x + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! x + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! x + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! xd: size of buffers for each call to pack subtype + CALL AWAE_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, .TRUE. ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! xd + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! xd + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! xd + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! z: size of buffers for each call to pack subtype + CALL AWAE_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, .TRUE. ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! z + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! z + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! z + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! OtherSt: size of buffers for each call to pack subtype + CALL AWAE_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, .TRUE. ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! OtherSt + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! OtherSt + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! OtherSt + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype + CALL AWAE_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! p + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! p + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! p + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! u: size of buffers for each call to pack subtype + CALL AWAE_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, .TRUE. ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! y: size of buffers for each call to pack subtype + CALL AWAE_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! m: size of buffers for each call to pack subtype + CALL AWAE_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, .TRUE. ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! m + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! m + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! m + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! IsInitialized + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL AWAE_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, OnlySize ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, OnlySize ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, OnlySize ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherSt, ErrStat2, ErrMsg2, OnlySize ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, OnlySize ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AWAE_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, OnlySize ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%IsInitialized, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_PackAWAE_Data + + SUBROUTINE Farm_UnPackAWAE_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_Data), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackAWAE_Data' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%x, ErrStat2, ErrMsg2 ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%xd, ErrStat2, ErrMsg2 ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%z, ErrStat2, ErrMsg2 ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%OtherSt, ErrStat2, ErrMsg2 ) ! OtherSt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u, ErrStat2, ErrMsg2 ) ! u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%m, ErrStat2, ErrMsg2 ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%IsInitialized = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsInitialized) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_UnPackAWAE_Data + + SUBROUTINE Farm_CopySC_Data( SrcSC_DataData, DstSC_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_Data), INTENT(IN) :: SrcSC_DataData + TYPE(SC_Data), INTENT(INOUT) :: DstSC_DataData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopySC_Data' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL SC_CopyContState( SrcSC_DataData%x, DstSC_DataData%x, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyDiscState( SrcSC_DataData%xd, DstSC_DataData%xd, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyConstrState( SrcSC_DataData%z, DstSC_DataData%z, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyOtherState( SrcSC_DataData%OtherState, DstSC_DataData%OtherState, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyParam( SrcSC_DataData%p, DstSC_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyInput( SrcSC_DataData%uInputs, DstSC_DataData%uInputs, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstSC_DataData%utimes = SrcSC_DataData%utimes + CALL SC_CopyOutput( SrcSC_DataData%y, DstSC_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL SC_CopyMisc( SrcSC_DataData%m, DstSC_DataData%m, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstSC_DataData%IsInitialized = SrcSC_DataData%IsInitialized + END SUBROUTINE Farm_CopySC_Data + + SUBROUTINE Farm_DestroySC_Data( SC_DataData, ErrStat, ErrMsg ) + TYPE(SC_Data), INTENT(INOUT) :: SC_DataData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroySC_Data' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL SC_DestroyContState( SC_DataData%x, ErrStat, ErrMsg ) + CALL SC_DestroyDiscState( SC_DataData%xd, ErrStat, ErrMsg ) + CALL SC_DestroyConstrState( SC_DataData%z, ErrStat, ErrMsg ) + CALL SC_DestroyOtherState( SC_DataData%OtherState, ErrStat, ErrMsg ) + CALL SC_DestroyParam( SC_DataData%p, ErrStat, ErrMsg ) + CALL SC_DestroyInput( SC_DataData%uInputs, ErrStat, ErrMsg ) + CALL SC_DestroyOutput( SC_DataData%y, ErrStat, ErrMsg ) + CALL SC_DestroyMisc( SC_DataData%m, ErrStat, ErrMsg ) + END SUBROUTINE Farm_DestroySC_Data + + SUBROUTINE Farm_PackSC_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_Data), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackSC_Data' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! x: size of buffers for each call to pack subtype + CALL SC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, .TRUE. ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! x + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! x + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! x + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! xd: size of buffers for each call to pack subtype + CALL SC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, .TRUE. ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! xd + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! xd + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! xd + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! z: size of buffers for each call to pack subtype + CALL SC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, .TRUE. ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! z + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! z + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! z + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! OtherState: size of buffers for each call to pack subtype + CALL SC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherState, ErrStat2, ErrMsg2, .TRUE. ) ! OtherState + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! OtherState + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! OtherState + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! OtherState + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype + CALL SC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! p + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! p + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! p + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! uInputs: size of buffers for each call to pack subtype + CALL SC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%uInputs, ErrStat2, ErrMsg2, .TRUE. ) ! uInputs + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! uInputs + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! uInputs + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! uInputs + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Db_BufSz = Db_BufSz + SIZE(InData%utimes) ! utimes + Int_BufSz = Int_BufSz + 3 ! y: size of buffers for each call to pack subtype + CALL SC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! m: size of buffers for each call to pack subtype + CALL SC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, .TRUE. ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! m + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! m + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! m + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! IsInitialized + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL SC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%x, ErrStat2, ErrMsg2, OnlySize ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%xd, ErrStat2, ErrMsg2, OnlySize ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%z, ErrStat2, ErrMsg2, OnlySize ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%OtherState, ErrStat2, ErrMsg2, OnlySize ) ! OtherState + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%uInputs, ErrStat2, ErrMsg2, OnlySize ) ! uInputs + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + DO i1 = LBOUND(InData%utimes,1), UBOUND(InData%utimes,1) + DbKiBuf(Db_Xferred) = InData%utimes(i1) + Db_Xferred = Db_Xferred + 1 + END DO + CALL SC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL SC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, OnlySize ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%IsInitialized, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_PackSC_Data + + SUBROUTINE Farm_UnPackSC_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_Data), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackSC_Data' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%x, ErrStat2, ErrMsg2 ) ! x + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%xd, ErrStat2, ErrMsg2 ) ! xd + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%z, ErrStat2, ErrMsg2 ) ! z + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%OtherState, ErrStat2, ErrMsg2 ) ! OtherState + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%uInputs, ErrStat2, ErrMsg2 ) ! uInputs + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + i1_l = LBOUND(OutData%utimes,1) + i1_u = UBOUND(OutData%utimes,1) + DO i1 = LBOUND(OutData%utimes,1), UBOUND(OutData%utimes,1) + OutData%utimes(i1) = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + END DO + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%m, ErrStat2, ErrMsg2 ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%IsInitialized = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsInitialized) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE Farm_UnPackSC_Data + + SUBROUTINE Farm_CopyAll_FastFarm_Data( SrcAll_FastFarm_DataData, DstAll_FastFarm_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(All_FastFarm_Data), INTENT(INOUT) :: SrcAll_FastFarm_DataData + TYPE(All_FastFarm_Data), INTENT(INOUT) :: DstAll_FastFarm_DataData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_CopyAll_FastFarm_Data' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL Farm_CopyParam( SrcAll_FastFarm_DataData%p, DstAll_FastFarm_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL Farm_CopyMisc( SrcAll_FastFarm_DataData%m, DstAll_FastFarm_DataData%m, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcAll_FastFarm_DataData%FWrap)) THEN + i1_l = LBOUND(SrcAll_FastFarm_DataData%FWrap,1) + i1_u = UBOUND(SrcAll_FastFarm_DataData%FWrap,1) + IF (.NOT. ALLOCATED(DstAll_FastFarm_DataData%FWrap)) THEN + ALLOCATE(DstAll_FastFarm_DataData%FWrap(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstAll_FastFarm_DataData%FWrap.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcAll_FastFarm_DataData%FWrap,1), UBOUND(SrcAll_FastFarm_DataData%FWrap,1) + CALL Farm_Copyfastwrapper_data( SrcAll_FastFarm_DataData%FWrap(i1), DstAll_FastFarm_DataData%FWrap(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcAll_FastFarm_DataData%WD)) THEN + i1_l = LBOUND(SrcAll_FastFarm_DataData%WD,1) + i1_u = UBOUND(SrcAll_FastFarm_DataData%WD,1) + IF (.NOT. ALLOCATED(DstAll_FastFarm_DataData%WD)) THEN + ALLOCATE(DstAll_FastFarm_DataData%WD(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstAll_FastFarm_DataData%WD.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcAll_FastFarm_DataData%WD,1), UBOUND(SrcAll_FastFarm_DataData%WD,1) + CALL Farm_Copywakedynamics_data( SrcAll_FastFarm_DataData%WD(i1), DstAll_FastFarm_DataData%WD(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL Farm_Copyawae_data( SrcAll_FastFarm_DataData%AWAE, DstAll_FastFarm_DataData%AWAE, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL Farm_Copysc_data( SrcAll_FastFarm_DataData%SC, DstAll_FastFarm_DataData%SC, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE Farm_CopyAll_FastFarm_Data + + SUBROUTINE Farm_DestroyAll_FastFarm_Data( All_FastFarm_DataData, ErrStat, ErrMsg ) + TYPE(All_FastFarm_Data), INTENT(INOUT) :: All_FastFarm_DataData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_DestroyAll_FastFarm_Data' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL Farm_DestroyParam( All_FastFarm_DataData%p, ErrStat, ErrMsg ) + CALL Farm_DestroyMisc( All_FastFarm_DataData%m, ErrStat, ErrMsg ) +IF (ALLOCATED(All_FastFarm_DataData%FWrap)) THEN +DO i1 = LBOUND(All_FastFarm_DataData%FWrap,1), UBOUND(All_FastFarm_DataData%FWrap,1) + CALL Farm_Destroyfastwrapper_data( All_FastFarm_DataData%FWrap(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(All_FastFarm_DataData%FWrap) +ENDIF +IF (ALLOCATED(All_FastFarm_DataData%WD)) THEN +DO i1 = LBOUND(All_FastFarm_DataData%WD,1), UBOUND(All_FastFarm_DataData%WD,1) + CALL Farm_Destroywakedynamics_data( All_FastFarm_DataData%WD(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(All_FastFarm_DataData%WD) +ENDIF + CALL Farm_Destroyawae_data( All_FastFarm_DataData%AWAE, ErrStat, ErrMsg ) + CALL Farm_Destroysc_data( All_FastFarm_DataData%SC, ErrStat, ErrMsg ) + END SUBROUTINE Farm_DestroyAll_FastFarm_Data + + SUBROUTINE Farm_PackAll_FastFarm_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(All_FastFarm_Data), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_PackAll_FastFarm_Data' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype + CALL Farm_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! p + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! p + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! p + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! m: size of buffers for each call to pack subtype + CALL Farm_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, .TRUE. ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! m + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! m + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! m + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! FWrap allocated yes/no + IF ( ALLOCATED(InData%FWrap) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! FWrap upper/lower bounds for each dimension + DO i1 = LBOUND(InData%FWrap,1), UBOUND(InData%FWrap,1) + Int_BufSz = Int_BufSz + 3 ! FWrap: size of buffers for each call to pack subtype + CALL Farm_Packfastwrapper_data( Re_Buf, Db_Buf, Int_Buf, InData%FWrap(i1), ErrStat2, ErrMsg2, .TRUE. ) ! FWrap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FWrap + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FWrap + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FWrap + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! WD allocated yes/no + IF ( ALLOCATED(InData%WD) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WD upper/lower bounds for each dimension + DO i1 = LBOUND(InData%WD,1), UBOUND(InData%WD,1) + Int_BufSz = Int_BufSz + 3 ! WD: size of buffers for each call to pack subtype + CALL Farm_Packwakedynamics_data( Re_Buf, Db_Buf, Int_Buf, InData%WD(i1), ErrStat2, ErrMsg2, .TRUE. ) ! WD + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! WD + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! WD + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! WD + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! AWAE: size of buffers for each call to pack subtype + CALL Farm_Packawae_data( Re_Buf, Db_Buf, Int_Buf, InData%AWAE, ErrStat2, ErrMsg2, .TRUE. ) ! AWAE + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AWAE + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AWAE + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AWAE + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! SC: size of buffers for each call to pack subtype + CALL Farm_Packsc_data( Re_Buf, Db_Buf, Int_Buf, InData%SC, ErrStat2, ErrMsg2, .TRUE. ) ! SC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL Farm_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL Farm_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%m, ErrStat2, ErrMsg2, OnlySize ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%FWrap) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%FWrap,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FWrap,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%FWrap,1), UBOUND(InData%FWrap,1) + CALL Farm_Packfastwrapper_data( Re_Buf, Db_Buf, Int_Buf, InData%FWrap(i1), ErrStat2, ErrMsg2, OnlySize ) ! FWrap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WD) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WD,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WD,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WD,1), UBOUND(InData%WD,1) + CALL Farm_Packwakedynamics_data( Re_Buf, Db_Buf, Int_Buf, InData%WD(i1), ErrStat2, ErrMsg2, OnlySize ) ! WD + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL Farm_Packawae_data( Re_Buf, Db_Buf, Int_Buf, InData%AWAE, ErrStat2, ErrMsg2, OnlySize ) ! AWAE + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL Farm_Packsc_data( Re_Buf, Db_Buf, Int_Buf, InData%SC, ErrStat2, ErrMsg2, OnlySize ) ! SC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE Farm_PackAll_FastFarm_Data + + SUBROUTINE Farm_UnPackAll_FastFarm_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(All_FastFarm_Data), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'Farm_UnPackAll_FastFarm_Data' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%m, ErrStat2, ErrMsg2 ) ! m + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! FWrap not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%FWrap)) DEALLOCATE(OutData%FWrap) + ALLOCATE(OutData%FWrap(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%FWrap.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%FWrap,1), UBOUND(OutData%FWrap,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_Unpackfastwrapper_data( Re_Buf, Db_Buf, Int_Buf, OutData%FWrap(i1), ErrStat2, ErrMsg2 ) ! FWrap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WD not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WD)) DEALLOCATE(OutData%WD) + ALLOCATE(OutData%WD(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WD.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WD,1), UBOUND(OutData%WD,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_Unpackwakedynamics_data( Re_Buf, Db_Buf, Int_Buf, OutData%WD(i1), ErrStat2, ErrMsg2 ) ! WD + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_Unpackawae_data( Re_Buf, Db_Buf, Int_Buf, OutData%AWAE, ErrStat2, ErrMsg2 ) ! AWAE + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL Farm_Unpacksc_data( Re_Buf, Db_Buf, Int_Buf, OutData%SC, ErrStat2, ErrMsg2 ) ! SC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE Farm_UnPackAll_FastFarm_Data + +END MODULE FAST_Farm_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/glue-codes/fast-farm/src/writeFARMOutputs.m b/glue-codes/fast-farm/src/writeFARMOutputs.m new file mode 100644 index 0000000000..e44a331d03 --- /dev/null +++ b/glue-codes/fast-farm/src/writeFARMOutputs.m @@ -0,0 +1,434 @@ +function writeFARMOutputs() + +fid=fopen('OutListParameters.csv','wt'); +x = {'Category','Name', 'Other Name(s)', 'Description', 'Convention', 'Units','Invalid Channel Criteria' }; +csvFun = @(str)sprintf('%s,',str); +xchar = cellfun(csvFun, x, 'UniformOutput', false); +xchar = strcat(xchar{:}); +xchar = strcat(xchar(1:end-1),'\n'); +fprintf(fid,xchar); + + +% Super Controller + + % Global (turbine-independent) super controller input +fprintf(fid,'Global Super Controller Input\n'); +for beta = 1:9 + x = {'',['SCGblIn' num2str(beta,'%1d')], ' ', ['Global (turbine-independent) super controller input ' num2str(beta,'%1d')], ' ', '(user)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Turbine-dependent super controller input ? for turbine ? +fprintf(fid,'Turbine-dependent Super Controller Input\n'); +for alpha = 1:9 + for beta = 1:9 + x = {'',['SCT' num2str(alpha,'%1d') 'In' num2str(beta,'%1d')], ' ', ['Turbine-dependent super controller input ' num2str(beta,'%1d') ' for turbine ' num2str(alpha,'%1d')], ' ', '(user)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + + % Global (turbine-independent) super controller output +fprintf(fid,'Global Super Controller Output\n'); +for beta = 1:9 + x = {'',['SCGblOt' num2str(beta,'%1d')], ' ', ['Global (turbine-independent) super controller output ' num2str(beta,'%1d')], ' ', '(user)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Turbine-dependent super controller output ? for turbine ? +fprintf(fid,'Turbine-dependent Super Controller Output\n'); +for alpha = 1:9 + for beta = 1:9 + x = {'',['SCT' num2str(alpha,'%1d') 'Ot' num2str(beta,'%1d')], ' ', ['Turbine-dependent super controller output ' num2str(beta,'%1d') ' for turbine ' num2str(alpha,'%1d')], ' ', '(user)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + +% Wind Turbine and its Inflow +fprintf(fid,'Rotor Centerline Orientation\n'); + % Orientation of the rotor centerline for turbine ? in the global coordinate system +for alpha = 1:9 + x = {'',['RtAxsXT' num2str(alpha,'%1d')], ' ', ['X-component of the rotor centerline orientation for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for alpha = 1:9 + x = {'',['RtAxsYT' num2str(alpha,'%1d')], ' ', ['Y-component of the rotor centerline orientation for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for alpha = 1:9 + x = {'',['RtAxsZT' num2str(alpha,'%1d')], ' ', ['Z-component of the rotor centerline orientation for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Position of the rotor (hub) center for turbine ? in the global coordinate system +fprintf(fid,'Position of the Rotor (Hub) Center\n'); +for alpha = 1:9 + x = {'',['RtPosXT' num2str(alpha,'%1d')], ' ', ['X-component of the position of the rotor (hub) center for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for alpha = 1:9 + x = {'',['RtPosYT' num2str(alpha,'%1d')], ' ', ['Y-component of the position of the rotor (hub) center for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for alpha = 1:9 + x = {'',['RtPosZT' num2str(alpha,'%1d')], ' ', ['Z-component of the position of the rotor (hub) center for turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Rotor diameter for turbine ? +fprintf(fid,'Rotor Diamete\n'); +for alpha = 1:9 + x = {'',['RtDiamT' num2str(alpha,'%1d')], ' ', ['Rotor diameter for turbine ' num2str(alpha,'%1d')], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + + % Nacelle-yaw error for turbine ? +fprintf(fid,'Nacelle-Yaw Error\n'); +for alpha = 1:9 + x = {'',['YawErrT' num2str(alpha,'%1d')], ' ', ['Nacelle-yaw error for turbine ' num2str(alpha,'%1d')], ' ', '(deg)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Ambient turbulence intensity of the wind at the rotor disk for turbine ? +fprintf(fid,'Ambient Turbulence Intensity of the Wind at the Rotor Disk\n'); +for alpha = 1:9 + x = {'',['TIAmbT' num2str(alpha,'%1d')], ' ', ['Ambient turbulence intensity of the wind at the rotor disk for turbine ' num2str(alpha,'%1d')], ' ', '(percent)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Rotor-disk-averaged ambient wind speed (normal to disk, not including structural motion, local induction or wakes from upstream turbines) for turbine ? +fprintf(fid,'Rotor-Disk-Averaged Ambient Wind Speed\n'); +for alpha = 1:9 + x = {'',['RtVAmbT' num2str(alpha,'%1d')], ' ', ['Rotor-disk-averaged ambient wind speed (normal to disk: not including structural motion: local induction or wakes from upstream turbines) for turbine ' num2str(alpha,'%1d')], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Rotor-disk-averaged relative wind speed (normal to disk, including structural motion and wakes from upstream turbines, but not including local induction) for turbine ? +fprintf(fid,'Rotor-Disk-Averaged Relative Wind Speed\n'); +for alpha = 1:9 + x = {'',['RtVRelT' num2str(alpha,'%1d')], ' ', ['Rotor-disk-averaged relative wind speed (normal to disk: including structural motion and wakes from upstream turbines: but not including local induction) for turbine ' num2str(alpha,'%1d')], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + % Azimuthally averaged thrust force coefficient (normal to disk) for radial node ? of turbine ? +fprintf(fid,'Azimuthally Averaged Thrust Force Coefficient\n'); +for alpha = 1:9 + for beta = 1:20 + x = {'',['CtT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d')], ' ', ['Azimuthally averaged thrust force coefficient (normal to disk) for radial node ' num2str(beta,'%02d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + +% Wake (for an Individual Rotor) + + % Orientation of the wake centerline for downstream distance ? of turbine ? in the global coordinate system +fprintf(fid,'Wake Centerline Orientation\n'); +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkAxsXT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['X-component of the wake centerline orientation for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkAxsYT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Y-component of the wake centerline orientation for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkAxsZT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Z-component of the wake centerline orientation for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(-)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + + % Center position of the wake centerline for downstream distance ? of turbine ? in the global coordinate system +fprintf(fid,'Center Position of Wake Centerline\n'); +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkPosXT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['X-component of the center position of the wake centerline for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkPosYT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Y-component of the center position of the wake centerline for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkPosZT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Z-component of the center position of the wake centerline for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + + % Advection, deflection, and meandering velocity (not including the horizontal wake-deflection correction) of the wake for downstream distance ? of turbine ? in the global coordinate system +fprintf(fid,'Advection: Deflection: and Meandering Velocity\n'); +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkVelXT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['X-component of the Advection: deflection: and meandering velocity (not including the horizontal wake-deflection correction) of the wake for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkVelYT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Y-component of the Advection: deflection: and meandering velocity (not including the horizontal wake-deflection correction) of the wake for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkVelZT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Z-component of the Advection: deflection: and meandering velocity (not including the horizontal wake-deflection correction) of the wake for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d') ' in the global coordinate system'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + + % Wake diameter for downstream distance ? of turbine ? +fprintf(fid,'Wake Diameter\n'); +for alpha = 1:9 + for gamma = 1:9 + x = {'',['WkDiamT' num2str(alpha,'%1d') 'D' num2str(gamma,'%1d')], ' ', ['Wake diameter for downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end +end + + % Axial and radial wake velocity deficits for radial node ? and downstream distance ? of turbine ? +fprintf(fid,'Axial and Radial Wake Velocity Deficits\n'); +for alpha = 1:9 + for beta = 1:20 + for gamma = 1:9 + x = {'',['WkDfVxT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d') 'D' num2str(gamma,'%1d')], ' ', ['Axial wake velocity deficits for radial node ' num2str(beta,'%02d') ' and downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +end +for alpha = 1:9 + for beta = 1:20 + for gamma = 1:9 + x = {'',['WkDfVrT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d') 'D' num2str(gamma,'%1d')], ' ', ['Radial wake velocity deficits for radial node ' num2str(beta,'%02d') ' and downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +end + + % Total eddy viscosity, and individual contributions to the eddy viscosity from ambient turbulence and the shear layer, for radial node ? and downstream distance ? of turbine ? +fprintf(fid,'Total Eddy Viscosity and Individual Contributions\n'); +for alpha = 1:9 + for beta = 1:20 + for gamma = 1:9 + x = {'',['EddVisT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d') 'D' num2str(gamma,'%1d')], ' ', ['Total eddy viscosity for radial node ' num2str(beta,'%02d') ' and downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m^2/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +end +for alpha = 1:9 + for beta = 1:20 + for gamma = 1:9 + x = {'',['EddAmbT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d') 'D' num2str(gamma,'%1d')], ' ', ['Contribution to the eddy viscosity from ambient turbulence for radial node ' num2str(beta,'%02d') ' and downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m^2/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +end +for alpha = 1:9 + for beta = 1:20 + for gamma = 1:9 + x = {'',['EddShrT' num2str(alpha,'%1d') 'N' num2str(beta,'%02d') 'D' num2str(gamma,'%1d')], ' ', ['Contribution to the eddy viscosity from the shear layer for radial node ' num2str(beta,'%02d') ' and downstream distance ' num2str(gamma,'%1d') ' of turbine ' num2str(alpha,'%1d')], ' ', '(m^2/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); + end + end +end + +% Ambient Wind and Array effects + + % Ambient wind velocity (not including wakes) for point ? in global coordinates (from the low-resolution domain) +fprintf(fid,'Ambient Wind Velocity from Low-resolution Domain\n'); +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VAmbX'], ' ', ['X-component of the ambient wind velocity (not including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VAmbY'], ' ', ['Y-component of the ambient wind velocity (not including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VAmbZ'], ' ', ['Z-component of the ambient wind velocity (not including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + + % Disturbed wind velocity (including wakes) for point ? in the global coordinate system (from the low-resolution domain) +fprintf(fid,'Disturbed Wind Velocity from Low-resolution Domain\n'); +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VDisX'], ' ', ['X-component of the disturbed wind velocity (including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VDisY'], ' ', ['Y-component of the disturbed wind velocity (including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + +for beta = 1:9 + x = {'',['W' num2str(beta,'%02d') 'VDisZ'], ' ', ['Z-component of the disturbed wind velocity (including wakes) for point ' num2str(beta,'%02d') ' in global coordinates (from the low-resolution domain)'], ' ', '(m/s)' }; + csvFun = @(str)sprintf('%s,',str); + xchar = cellfun(csvFun, x, 'UniformOutput', false); + xchar = strcat(xchar{:}); + xchar = strcat(xchar(1:end-1),'\n'); + fprintf(fid,xchar); +end + + + +fclose(fid); +end diff --git a/glue-codes/openfast-cpp/CMakeLists.txt b/glue-codes/openfast-cpp/CMakeLists.txt index c4dab07b42..ffe6b126dc 100644 --- a/glue-codes/openfast-cpp/CMakeLists.txt +++ b/glue-codes/openfast-cpp/CMakeLists.txt @@ -25,9 +25,9 @@ find_package(MPI REQUIRED) find_package(LibXml2 REQUIRED) find_package(ZLIB REQUIRED) find_package(HDF5 REQUIRED COMPONENTS C HL) -find_package(YAMLCPP REQUIRED) +find_package(yaml-cpp REQUIRED) -include_directories(${YAML_INCLUDES}) +include_directories(${YAML_CPP_INCLUDE_DIRS}) include_directories(${HDF5_INCLUDES}) include_directories(${HDF5_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDES}) @@ -38,7 +38,7 @@ include_directories(${CMAKE_BINARY_DIR}/modules/supercontroller/) include_directories(${MPI_INCLUDE_PATH}) add_library(openfastcpplib - src/OpenFAST.cpp) + src/OpenFAST.cpp src/SC.cpp) set_property(TARGET openfastcpplib PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(openfastcpplib openfastlib @@ -49,11 +49,10 @@ target_link_libraries(openfastcpplib ${MPI_LIBRARIES} ${CMAKE_DL_LIBS}) -add_executable(openfastcpp - src/FAST_Prog.cpp) - +add_executable(openfastcpp src/FAST_Prog.cpp) target_link_libraries(openfastcpp openfastcpplib openfastlib - ${MPI_LIBRARIES} ${YAML_LIBRARIES} + ${MPI_LIBRARIES} + ${YAML_CPP_LIBRARIES} ${HDF5_C_LIBRARIES} ${HDF5_HL_LIBRARIES} ${ZLIB_LIBRARIES} @@ -79,7 +78,7 @@ install(TARGETS openfastcpplib LIBRARY DESTINATION lib) install(FILES - src/OpenFAST.H src/SC.h + src/OpenFAST.H src/SC.H DESTINATION include) install(TARGETS openfastcpp diff --git a/glue-codes/openfast-cpp/src/FAST_Prog.cpp b/glue-codes/openfast-cpp/src/FAST_Prog.cpp index b7af795629..b46514c56d 100644 --- a/glue-codes/openfast-cpp/src/FAST_Prog.cpp +++ b/glue-codes/openfast-cpp/src/FAST_Prog.cpp @@ -4,146 +4,150 @@ #include inline bool checkFileExists(const std::string& name) { - struct stat buffer; - return (stat (name.c_str(), &buffer) == 0); + struct stat buffer; + return (stat (name.c_str(), &buffer) == 0); } void readTurbineData(int iTurb, fast::fastInputs & fi, YAML::Node turbNode) { - - //Read turbine data for a given turbine using the YAML node - fi.globTurbineData[iTurb].TurbID = turbNode["turb_id"].as(); - fi.globTurbineData[iTurb].FASTInputFileName = turbNode["FAST_input_filename"].as() ; - fi.globTurbineData[iTurb].FASTRestartFileName = turbNode["restart_filename"].as() ; - if (turbNode["turbine_base_pos"].IsSequence() ) { - fi.globTurbineData[iTurb].TurbineBasePos = turbNode["turbine_base_pos"].as >() ; - } - if (turbNode["turbine_hub_pos"].IsSequence() ) { - fi.globTurbineData[iTurb].TurbineHubPos = turbNode["turbine_hub_pos"].as >() ; - } - fi.globTurbineData[iTurb].numForcePtsBlade = turbNode["num_force_pts_blade"].as(); - fi.globTurbineData[iTurb].numForcePtsTwr = turbNode["num_force_pts_tower"].as(); - if (turbNode["nacelle_cd"]) {fi.globTurbineData[iTurb].nacelle_cd = turbNode["nacelle_cd"].as();} - if (turbNode["nacelle_area"]) {fi.globTurbineData[iTurb].nacelle_area = turbNode["nacelle_area"].as();} - if (turbNode["air_density"]) {fi.globTurbineData[iTurb].air_density = turbNode["air_density"].as();} + //Read turbine data for a given turbine using the YAML node + fi.globTurbineData[iTurb].TurbID = turbNode["turb_id"].as(); + fi.globTurbineData[iTurb].FASTInputFileName = turbNode["FAST_input_filename"].as(); + fi.globTurbineData[iTurb].FASTRestartFileName = turbNode["restart_filename"].as(); + if (turbNode["turbine_base_pos"].IsSequence() ) { + fi.globTurbineData[iTurb].TurbineBasePos = turbNode["turbine_base_pos"].as >(); + } + if (turbNode["turbine_hub_pos"].IsSequence() ) { + fi.globTurbineData[iTurb].TurbineHubPos = turbNode["turbine_hub_pos"].as >(); + } + fi.globTurbineData[iTurb].numForcePtsBlade = turbNode["num_force_pts_blade"].as(); + fi.globTurbineData[iTurb].numForcePtsTwr = turbNode["num_force_pts_tower"].as(); + if (turbNode["nacelle_cd"]) fi.globTurbineData[iTurb].nacelle_cd = turbNode["nacelle_cd"].as(); + if (turbNode["nacelle_area"]) fi.globTurbineData[iTurb].nacelle_area = turbNode["nacelle_area"].as(); + if (turbNode["air_density"]) fi.globTurbineData[iTurb].air_density = turbNode["air_density"].as(); } void readInputFile(fast::fastInputs & fi, std::string cInterfaceInputFile, double * tEnd) { - fi.comm = MPI_COMM_WORLD; - - // Check if the input file exists and read it - if ( checkFileExists(cInterfaceInputFile) ) { - - YAML::Node cDriverInp = YAML::LoadFile(cInterfaceInputFile); - - fi.nTurbinesGlob = cDriverInp["nTurbinesGlob"].as(); - - if (fi.nTurbinesGlob > 0) { - - if(cDriverInp["dryRun"]) { - fi.dryRun = cDriverInp["dryRun"].as(); - } - - if(cDriverInp["debug"]) { - fi.debug = cDriverInp["debug"].as(); - } - - if(cDriverInp["simStart"]) { - if (cDriverInp["simStart"].as() == "init") { - fi.simStart = fast::init; - } else if(cDriverInp["simStart"].as() == "trueRestart") { - fi.simStart = fast::trueRestart; - } else if(cDriverInp["simStart"].as() == "restartDriverInitFAST") { - fi.simStart = fast::restartDriverInitFAST; - } else { - throw std::runtime_error("simStart is not well defined in the input file"); - } - } - - fi.tStart = cDriverInp["tStart"].as(); - *tEnd = cDriverInp["tEnd"].as(); - fi.nEveryCheckPoint = cDriverInp["nEveryCheckPoint"].as(); - fi.dtFAST = cDriverInp["dtFAST"].as(); - fi.tMax = cDriverInp["tMax"].as(); // tMax is the total duration to which you want to run FAST. This should be the same or greater than the max time given in the FAST fst file. Choose this carefully as FAST writes the output file only at this point if you choose the binary file output. - - if(cDriverInp["superController"]) { - fi.scStatus = cDriverInp["superController"].as(); - fi.scLibFile = cDriverInp["scLibFile"].as(); - fi.numScInputs = cDriverInp["numScInputs"].as(); - fi.numScOutputs = cDriverInp["numScOutputs"].as(); - } - - fi.globTurbineData.resize(fi.nTurbinesGlob); - for (int iTurb=0; iTurb < fi.nTurbinesGlob; iTurb++) { - if (cDriverInp["Turbine" + std::to_string(iTurb)]) { - readTurbineData(iTurb, fi, cDriverInp["Turbine" + std::to_string(iTurb)] ); - } else { - throw std::runtime_error("Node for Turbine" + std::to_string(iTurb) + " not present in input file or I cannot read it"); - } - } - + fi.comm = MPI_COMM_WORLD; + + // Check if the input file exists and read it + if ( checkFileExists(cInterfaceInputFile) ) { + + YAML::Node cDriverInp = YAML::LoadFile(cInterfaceInputFile); + + fi.nTurbinesGlob = cDriverInp["nTurbinesGlob"].as(); + + if (fi.nTurbinesGlob > 0) { + + if(cDriverInp["dryRun"]) { + fi.dryRun = cDriverInp["dryRun"].as(); + } + + if(cDriverInp["debug"]) { + fi.debug = cDriverInp["debug"].as(); + } + + if(cDriverInp["simStart"]) { + if (cDriverInp["simStart"].as() == "init") { + fi.simStart = fast::init; + } else if(cDriverInp["simStart"].as() == "trueRestart") { + fi.simStart = fast::trueRestart; + } else if(cDriverInp["simStart"].as() == "restartDriverInitFAST") { + fi.simStart = fast::restartDriverInitFAST; + } else { + throw std::runtime_error("simStart is not well defined in the input file"); + } + } + + fi.tStart = cDriverInp["tStart"].as(); + *tEnd = cDriverInp["tEnd"].as(); + fi.nEveryCheckPoint = cDriverInp["nEveryCheckPoint"].as(); + fi.dtFAST = cDriverInp["dtFAST"].as(); + fi.tMax = cDriverInp["tMax"].as(); // tMax is the total duration to which you want to run FAST. This should be the same or greater than the max time given in the FAST fst file. Choose this carefully as FAST writes the output file only at this point if you choose the binary file output. + + if(cDriverInp["superController"]) { + fi.scStatus = cDriverInp["superController"].as(); + fi.scLibFile = cDriverInp["scLibFile"].as(); + } + + fi.globTurbineData.resize(fi.nTurbinesGlob); + for (int iTurb=0; iTurb < fi.nTurbinesGlob; iTurb++) { + if (cDriverInp["Turbine" + std::to_string(iTurb)]) { + readTurbineData(iTurb, fi, cDriverInp["Turbine" + std::to_string(iTurb)] ); + } else { + throw std::runtime_error("Node for Turbine" + std::to_string(iTurb) + " not present in input file or I cannot read it"); + } + } + + } else { + throw std::runtime_error("Number of turbines <= 0 "); + } + } else { - throw std::runtime_error("Number of turbines <= 0 "); + throw std::runtime_error("Input file " + cInterfaceInputFile + " does not exist or I cannot access it"); } - - } else { - throw std::runtime_error("Input file " + cInterfaceInputFile + " does not exist or I cannot access it"); - } - } -int main() { - int iErr; - int nProcs; - int rank; - std::vector torque (3, 0.0); - std::vector thrust (3, 0.0); - - iErr = MPI_Init(NULL, NULL); - iErr = MPI_Comm_size( MPI_COMM_WORLD, &nProcs); - iErr = MPI_Comm_rank( MPI_COMM_WORLD, &rank); - - double tEnd ; // This doesn't belong in the FAST - C++ interface - int ntEnd ; // This doesn't belong in the FAST - C++ interface - - std::string cDriverInputFile="cDriver.i"; - fast::OpenFAST FAST; - fast::fastInputs fi ; - try { - readInputFile(fi, cDriverInputFile, &tEnd); - } - catch( const std::runtime_error & ex) { - std::cerr << ex.what() << std::endl ; - std::cerr << "Program quitting now" << std::endl ; - return 1; - } - ntEnd = tEnd/fi.dtFAST; //Calculate the last time step - - FAST.setInputs(fi); - FAST.allocateTurbinesToProcsSimple(); - // Or allocate turbines to procs by calling "setTurbineProcNo(iTurbGlob, procId)" for turbine. - - FAST.init(); - if (FAST.isTimeZero()) { - FAST.solution0(); - } - - if( !FAST.isDryRun() ) { +int main(int argc, char** argv) { + if (argc != 2) { + std::cerr << "Incorrect syntax. Try: openfastcpp inputfile.yaml" << std::endl ; + return 1; + } + + int iErr; + int nProcs; + int rank; + std::vector torque (3, 0.0); + std::vector thrust (3, 0.0); + + iErr = MPI_Init(NULL, NULL); + iErr = MPI_Comm_size( MPI_COMM_WORLD, &nProcs); + iErr = MPI_Comm_rank( MPI_COMM_WORLD, &rank); + + double tEnd ; // This doesn't belong in the FAST - C++ interface + int ntEnd ; // This doesn't belong in the FAST - C++ interface + + std::string cDriverInputFile=argv[1]; + fast::OpenFAST FAST; + fast::fastInputs fi ; + try { + readInputFile(fi, cDriverInputFile, &tEnd); + } catch( const std::runtime_error & ex) { + std::cerr << ex.what() << std::endl ; + std::cerr << "Program quitting now" << std::endl ; + return 1; + } + + // Calculate the last time step + ntEnd = tEnd/fi.dtFAST; + + FAST.setInputs(fi); + FAST.allocateTurbinesToProcsSimple(); + // Or allocate turbines to procs by calling "setTurbineProcNo(iTurbGlob, procId)" for turbine. + + FAST.init(); + + if (FAST.isTimeZero()) FAST.solution0(); + + if ( FAST.isDryRun() ) { + FAST.end() ; + MPI_Finalize() ; + return 0; + } + for (int nt = FAST.get_ntStart(); nt < ntEnd; nt++) { - FAST.step(); - if (FAST.isDebug()) { - FAST.computeTorqueThrust(0,torque,thrust); - std::cout.precision(16); - std::cout << "Torque = " << torque[0] << " " << torque[1] << " " << torque[2] << std::endl ; - std::cout << "Thrust = " << thrust[0] << " " << thrust[1] << " " << thrust[2] << std::endl ; - } + FAST.step(); + if (FAST.isDebug()) { + FAST.computeTorqueThrust(0,torque,thrust); + std::cout.precision(16); + std::cout << "Torque = " << torque[0] << " " << torque[1] << " " << torque[2] << std::endl ; + std::cout << "Thrust = " << thrust[0] << " " << thrust[1] << " " << thrust[2] << std::endl ; + } } - } - FAST.end() ; - MPI_Finalize() ; + FAST.end() ; + MPI_Finalize() ; - return 0; - -} + return 0; +} diff --git a/glue-codes/openfast-cpp/src/OpenFAST.H b/glue-codes/openfast-cpp/src/OpenFAST.H index 7cd6789d5f..f823da27e5 100644 --- a/glue-codes/openfast-cpp/src/OpenFAST.H +++ b/glue-codes/openfast-cpp/src/OpenFAST.H @@ -46,33 +46,31 @@ enum simStartType { init = 0, trueRestart = 1, restartDriverInitFAST = 2, - simStartType_END + simStartType_END }; class fastInputs { - public: + public: MPI_Comm comm; - int nTurbinesGlob; + int nTurbinesGlob; bool dryRun; - bool debug; + bool debug; double tStart; simStartType simStart; - int nEveryCheckPoint; + int nEveryCheckPoint; double tMax; - double dtFAST; + double dtFAST; bool scStatus; std::string scLibFile; - int numScInputs, numScOutputs; - std::vector globTurbineData; - // Constructor + // Constructor fastInputs() ; - + // Destructor ~fastInputs() {} ; @@ -102,7 +100,7 @@ class OpenFAST { std::vector nacelle_area; std::vector air_density; double tStart; - int nt_global; + int nt_global; int ntStart; // The time step to start the FAST simulation int nEveryCheckPoint; // Check point files will be written every 'nEveryCheckPoint' time steps std::vector numBlades; // Number of blades @@ -110,10 +108,6 @@ class OpenFAST { std::vector numForcePtsTwr; std::vector numVelPtsBlade; std::vector numVelPtsTwr; - int numScOutputs; // # outputs from the supercontroller == # inputs to the controller == NumSC2Ctrl - int numScInputs; // # inputs to the supercontroller == # outputs from the controller == NumCtrl2SC - std::vector scOutputsGlob; // # outputs from the supercontroller for all turbines - std::vector scInputsGlob; // # inputs to the supercontroller for all turbines std::vector > > forceNodeVel; // Velocity at force nodes - Store temporarily to interpolate to the velocity nodes std::vector > velNodeData; // Position and velocity data at the velocity (aerodyn) nodes - (nTurbines, nTimesteps * nPoints * 6) @@ -122,26 +116,17 @@ class OpenFAST { std::vector cDriver_Input_from_FAST; std::vector cDriver_Output_to_FAST; - std::vector cDriverSC_Input_from_FAST; - std::vector cDriverSC_Output_to_FAST; - // Turbine Number is DIFFERENT from TurbID. Turbine Number simply runs from 0:n-1 locally and globally. std::map turbineMapGlobToProc; // Mapping global turbine number to processor number std::map turbineMapProcToGlob; // Mapping local to global turbine number std::map reverseTurbineMapProcToGlob; // Reverse Mapping global turbine number to local turbine number - std::set turbineSetProcs; // Set of processors containing atleast one turbine + std::set turbineSetProcs; // Set of processors containing at least one turbine std::vector turbineProcs; // Same as the turbineSetProcs, but as an integer array //Supercontroller stuff bool scStatus; - std::string scLibFile; - // Dynamic load stuff copied from 'C++ dlopen mini HOWTO' on tldp.org - void *scLibHandle ; - typedef SuperController* create_sc_t(); - create_sc_t * create_SuperController; - typedef void destroy_sc_t(SuperController *); - destroy_sc_t * destroy_SuperController; - SuperController * sc; + SuperController sc; + scInitOutData scio; int fastMPIGroupSize; MPI_Group fastMPIGroup; @@ -155,15 +140,15 @@ class OpenFAST { int ErrStat; char ErrMsg[INTERFACE_STRING_LENGTH]; // make sure this is the same size as IntfStrLen in FAST_Library.f90 - public: + public: - // Constructor + // Constructor OpenFAST() ; - + // Destructor ~OpenFAST() ; - void setInputs(const fastInputs &); + void setInputs(const fastInputs &); void init(); void solution0(); @@ -181,7 +166,7 @@ class OpenFAST { float & fx, float & fy, float & fz); - + hid_t openVelocityDataFile(bool createFile); void readVelocityData(int nTimesteps); void writeVelocityData(hid_t h5file, int iTurb, int iTimestep, OpFM_InputType_t iData, OpFM_OutputType_t oData); @@ -213,7 +198,7 @@ class OpenFAST { bool isTimeZero() { return timeZero; } int get_procNo(int iTurbGlob) { return turbineMapGlobToProc[iTurbGlob] ; } // Get processor number of a turbine with global id 'iTurbGlob' int get_localTurbNo(int iTurbGlob) { return reverseTurbineMapProcToGlob[iTurbGlob]; } - int get_nTurbinesGlob() { return nTurbinesGlob; } + int get_nTurbinesGlob() { return nTurbinesGlob; } float get_nacelleArea(int iTurbGlob) { return get_nacelleAreaLoc(get_localTurbNo(iTurbGlob)); } float get_nacelleCd(int iTurbGlob) { return get_nacelleCdLoc(get_localTurbNo(iTurbGlob)); } @@ -285,7 +270,7 @@ class OpenFAST { inline bool checkFileExists(const std::string& name); void allocateMemory(); - + float get_nacelleCdLoc(int iTurbLoc) { return nacelle_cd[iTurbLoc]; } float get_nacelleAreaLoc(int iTurbLoc) { return nacelle_area[iTurbLoc]; } float get_airDensityLoc(int iTurbLoc) { return air_density[iTurbLoc]; } @@ -298,8 +283,6 @@ class OpenFAST { int get_numForcePtsLoc(int iTurbLoc) { return 1 + numBlades[iTurbLoc]*numForcePtsBlade[iTurbLoc] + numForcePtsTwr[iTurbLoc]; } void loadSuperController(const fastInputs & fi); - void fillScInputsGlob() ; - void fillScOutputsLoc() ; void setOutputsToFAST(OpFM_InputType_t cDriver_Input_from_FAST, OpFM_OutputType_t cDriver_Output_to_FAST) ; // An example to set velocities at the Aerodyn nodes void applyVelocityData(int iPrestart, int iTurb, OpFM_OutputType_t cDriver_Output_to_FAST, std::vector & velData) ; diff --git a/glue-codes/openfast-cpp/src/OpenFAST.cpp b/glue-codes/openfast-cpp/src/OpenFAST.cpp index c2901fec4f..78dc5cbadd 100644 --- a/glue-codes/openfast-cpp/src/OpenFAST.cpp +++ b/glue-codes/openfast-cpp/src/OpenFAST.cpp @@ -17,14 +17,16 @@ nEveryCheckPoint(-1), tMax(0.0), dtFAST(0.0), scStatus(false), -scLibFile(""), -numScInputs(0), -numScOutputs(0) +scLibFile("") { //Nothing to do here } + + + + //Constructor fast::OpenFAST::OpenFAST(): nTurbinesGlob(0), @@ -35,638 +37,646 @@ timeZero(false) { } +fast::OpenFAST::~OpenFAST(){ } + inline bool fast::OpenFAST::checkFileExists(const std::string& name) { - struct stat buffer; - return (stat (name.c_str(), &buffer) == 0); + struct stat buffer; + return (stat (name.c_str(), &buffer) == 0); } void fast::OpenFAST::init() { - // Temporary buffer to pass filenames to OpenFAST fortran subroutines - char currentFileName[INTERFACE_STRING_LENGTH]; - - allocateMemory(); - - if (!dryRun) { - switch (simStart) { - - case fast::trueRestart: + // Temporary buffer to pass filenames to OpenFAST fortran subroutines + char currentFileName[INTERFACE_STRING_LENGTH]; + + allocateMemory(); + + if (!dryRun) { + switch (simStart) { + + case fast::trueRestart: + + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + /* note that this will set nt_global inside the FAST library */ + std::copy( + CheckpointFileRoot[iTurb].data(), + CheckpointFileRoot[iTurb].data() + (CheckpointFileRoot[iTurb].size() + 1), + currentFileName + ); + FAST_OpFM_Restart( + &iTurb, + currentFileName, + &AbortErrLev, + &dtFAST, + &numBlades[iTurb], + &numVelPtsBlade[iTurb], + &ntStart, + &cDriver_Input_from_FAST[iTurb], + &cDriver_Output_to_FAST[iTurb], + &sc.ip_from_FAST[iTurb], + &sc.op_to_FAST[iTurb], + &ErrStat, + ErrMsg + ); + checkError(ErrStat, ErrMsg); + nt_global = ntStart; + + int nfpts = get_numForcePtsLoc(iTurb); + forceNodeVel[iTurb].resize(nfpts); + for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; + } + + if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(false); + + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + //sc.readRestartFile(nt_global); + } + + break ; + + case fast::init: + + sc.init(scio, nTurbinesProc); + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.init_sc(scio, nTurbinesProc, turbineMapProcToGlob, fastMPIComm); + // sc.calcOutputs_n(0.0); + } + + // this calls the Init() routines of each module + + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + std::copy( + FASTInputFileName[iTurb].data(), + FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), + currentFileName + ); + FAST_OpFM_Init( + &iTurb, + &tMax, + currentFileName, + &TurbID[iTurb], + &scio.nSC2CtrlGlob, + &scio.nSC2Ctrl, + &scio.nCtrl2SC, + scio.from_SCglob.data(), + scio.from_SC[iTurb].data(), + &numForcePtsBlade[iTurb], + &numForcePtsTwr[iTurb], + TurbineBasePos[iTurb].data(), + &AbortErrLev, + &dtFAST, + &numBlades[iTurb], + &numVelPtsBlade[iTurb], + &cDriver_Input_from_FAST[iTurb], + &cDriver_Output_to_FAST[iTurb], + &sc.ip_from_FAST[iTurb], + &sc.op_to_FAST[iTurb], + &ErrStat, + ErrMsg + ); + checkError(ErrStat, ErrMsg); + + timeZero = true; + + numVelPtsTwr[iTurb] = cDriver_Output_to_FAST[iTurb].u_Len - numBlades[iTurb]*numVelPtsBlade[iTurb] - 1; + if(numVelPtsTwr[iTurb] == 0) { + numForcePtsTwr[iTurb] = 0; + std::cout << "Aerodyn doesn't want to calculate forces on the tower. All actuator points on the tower are turned off for turbine " << turbineMapProcToGlob[iTurb] << "." << std::endl ; + } + + int nfpts = get_numForcePtsLoc(iTurb); + forceNodeVel[iTurb].resize(nfpts); + for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; + + if ( isDebug() ) { + for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { + std::cout << "Node " << iNode << " Position = " << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << " " << std::endl ; + } + } + } + + if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(true); + + break ; + + case fast::restartDriverInitFAST: + + sc.init(scio, nTurbinesProc); + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.init_sc(scio, nTurbinesProc, turbineMapProcToGlob, fastMPIComm); + // sc.calcOutputs_n(0.0); + } + + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + std::copy( + FASTInputFileName[iTurb].data(), + FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), + currentFileName + ); + FAST_OpFM_Init( + &iTurb, + &tMax, + currentFileName, + &TurbID[iTurb], + &scio.nSC2CtrlGlob, + &scio.nSC2Ctrl, + &scio.nCtrl2SC, + scio.from_SCglob.data(), + scio.from_SC[iTurb].data(), + &numForcePtsBlade[iTurb], + &numForcePtsTwr[iTurb], + TurbineBasePos[iTurb].data(), + &AbortErrLev, + &dtFAST, + &numBlades[iTurb], + &numVelPtsBlade[iTurb], + &cDriver_Input_from_FAST[iTurb], + &cDriver_Output_to_FAST[iTurb], + &sc.ip_from_FAST[iTurb], + &sc.op_to_FAST[iTurb], + &ErrStat, + ErrMsg + ); + checkError(ErrStat, ErrMsg); + + timeZero = true; + + numVelPtsTwr[iTurb] = cDriver_Output_to_FAST[iTurb].u_Len - numBlades[iTurb]*numVelPtsBlade[iTurb] - 1; + + int nfpts = get_numForcePtsLoc(iTurb); + forceNodeVel[iTurb].resize(nfpts); + for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; + + if ( isDebug() ) { + for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { + std::cout << "Node " << iNode << " Position = " << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << " " << std::endl ; + } + } + } + + int nTimesteps; + + if (nTurbinesProc > 0) { + readVelocityData(ntStart); + } + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + applyVelocityData(0, iTurb, cDriver_Output_to_FAST[iTurb], velNodeData[iTurb]); + } + solution0() ; - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - /* note that this will set nt_global inside the FAST library */ - std::copy(CheckpointFileRoot[iTurb].data(), - CheckpointFileRoot[iTurb].data() + (CheckpointFileRoot[iTurb].size() + 1), - currentFileName); - FAST_OpFM_Restart( - &iTurb, currentFileName, &AbortErrLev, &dtFAST, &numBlades[iTurb], - &numVelPtsBlade[iTurb], &ntStart, &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], &cDriverSC_Input_from_FAST[iTurb], - &cDriverSC_Output_to_FAST[iTurb], &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - nt_global = ntStart; + for (int iPrestart=0 ; iPrestart < ntStart; iPrestart++) { + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + applyVelocityData(iPrestart, iTurb, cDriver_Output_to_FAST[iTurb], velNodeData[iTurb]); + } + stepNoWrite(); + } - int nfpts = get_numForcePtsLoc(iTurb); - forceNodeVel[iTurb].resize(nfpts); - for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; + if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(false); - } + break; - if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(false); + case fast::simStartType_END: - if(scStatus) { - sc->readRestartFile(nt_global); - } - - break ; - - case fast::init: - - // this calls the Init() routines of each module - - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - std::copy(FASTInputFileName[iTurb].data(), - FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), - currentFileName); - FAST_OpFM_Init(&iTurb, &tMax, currentFileName, &TurbID[iTurb], - &numScOutputs, &numScInputs, &numForcePtsBlade[iTurb], - &numForcePtsTwr[iTurb], TurbineBasePos[iTurb].data(), - &AbortErrLev, &dtFAST, &numBlades[iTurb], - &numVelPtsBlade[iTurb], &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], - &cDriverSC_Input_from_FAST[iTurb], - &cDriverSC_Output_to_FAST[iTurb], &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - - timeZero = true; - - numVelPtsTwr[iTurb] = cDriver_Output_to_FAST[iTurb].u_Len - numBlades[iTurb]*numVelPtsBlade[iTurb] - 1; - if(numVelPtsTwr[iTurb] == 0) { - numForcePtsTwr[iTurb] = 0; - std::cout << "Aerodyn doesn't want to calculate forces on the tower. All actuator points on the tower are turned off for turbine " << turbineMapProcToGlob[iTurb] << "." << std::endl ; - } - - - int nfpts = get_numForcePtsLoc(iTurb); - forceNodeVel[iTurb].resize(nfpts); - for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; - - if ( isDebug() ) { - for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { - std::cout << "Node " << iNode << " Position = " << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << " " << std::endl ; - } - } - } - - if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(true); - - break ; - - case fast::restartDriverInitFAST: - - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - std::copy(FASTInputFileName[iTurb].data(), - FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), - currentFileName); - FAST_OpFM_Init(&iTurb, &tMax, currentFileName, &TurbID[iTurb], - &numScOutputs, &numScInputs, &numForcePtsBlade[iTurb], - &numForcePtsTwr[iTurb], TurbineBasePos[iTurb].data(), - &AbortErrLev, &dtFAST, &numBlades[iTurb], - &numVelPtsBlade[iTurb], &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], - &cDriverSC_Input_from_FAST[iTurb], - &cDriverSC_Output_to_FAST[iTurb], &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - - timeZero = true; - - numVelPtsTwr[iTurb] = cDriver_Output_to_FAST[iTurb].u_Len - numBlades[iTurb]*numVelPtsBlade[iTurb] - 1; - - int nfpts = get_numForcePtsLoc(iTurb); - forceNodeVel[iTurb].resize(nfpts); - for (int k = 0; k < nfpts; k++) forceNodeVel[iTurb][k].resize(3) ; - - if ( isDebug() ) { - for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { - std::cout << "Node " << iNode << " Position = " << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << " " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << " " << std::endl ; - } - } - } - - int nTimesteps; - - if (nTurbinesProc > 0) { - readVelocityData(ntStart); - } - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - applyVelocityData(0, iTurb, cDriver_Output_to_FAST[iTurb], velNodeData[iTurb]); - } - solution0() ; - - for (int iPrestart=0 ; iPrestart < ntStart; iPrestart++) { - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - applyVelocityData(iPrestart, iTurb, cDriver_Output_to_FAST[iTurb], velNodeData[iTurb]); - } - stepNoWrite(); - } - - if (nTurbinesProc > 0) velNodeDataFile = openVelocityDataFile(false); - - break; - - case fast::simStartType_END: - - break; + break; + } } - - } } void fast::OpenFAST::solution0() { - if (!dryRun) { - // set wind speeds at initial locations - // for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); - // } - - if(scStatus) { - - sc->init(nTurbinesGlob, numScInputs, numScOutputs); - - sc->calcOutputs(scOutputsGlob); - fillScOutputsLoc(); - } + if (!dryRun) { + // set wind speeds at initial locations + // for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); + // } - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - - FAST_OpFM_Solution0(&iTurb, &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - - } + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.fastSCInputOutput(); + } - timeZero = false; + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + FAST_OpFM_Solution0(&iTurb, &ErrStat, ErrMsg); + checkError(ErrStat, ErrMsg); + } - if (scStatus) { - fillScInputsGlob(); // Update inputs to super controller - } - } + timeZero = false; + if (scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.calcOutputs_n(0.0); + // sc.fastSCInputOutput(); + } + } } void fast::OpenFAST::step() { - /* ****************************** + /* ****************************** set inputs from this code and call FAST: - ********************************* */ + ********************************* */ - if(scStatus) { - sc->calcOutputs(scOutputsGlob); - fillScOutputsLoc(); - } + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + // set wind speeds at original locations + // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); - // set wind speeds at original locations - // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); - - // this advances the states, calls CalcOutput, and solves for next inputs. Predictor-corrector loop is imbeded here: - // (note OpenFOAM could do subcycling around this step) + // this advances the states, calls CalcOutput, and solves for next inputs. Predictor-corrector loop is imbeded here: + // (note OpenFOAM could do subcycling around this step) - writeVelocityData(velNodeDataFile, iTurb, nt_global, cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); + writeVelocityData(velNodeDataFile, iTurb, nt_global, cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); - if ( isDebug() ) { + if ( isDebug() ) { - std::ofstream fastcpp_velocity_file; - fastcpp_velocity_file.open("fastcpp_velocity.csv") ; - fastcpp_velocity_file << "# x, y, z, Vx, Vy, Vz" << std::endl ; - for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { - fastcpp_velocity_file << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << ", " << cDriver_Output_to_FAST[iTurb].u[iNode] << ", " << cDriver_Output_to_FAST[iTurb].v[iNode] << ", " << cDriver_Output_to_FAST[iTurb].w[iNode] << " " << std::endl ; - } - fastcpp_velocity_file.close() ; - - } + std::ofstream fastcpp_velocity_file; + fastcpp_velocity_file.open("fastcpp_velocity.csv") ; + fastcpp_velocity_file << "# x, y, z, Vx, Vy, Vz" << std::endl ; + for (int iNode=0; iNode < get_numVelPtsLoc(iTurb); iNode++) { + fastcpp_velocity_file << cDriver_Input_from_FAST[iTurb].pxVel[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pyVel[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pzVel[iNode] << ", " << cDriver_Output_to_FAST[iTurb].u[iNode] << ", " << cDriver_Output_to_FAST[iTurb].v[iNode] << ", " << cDriver_Output_to_FAST[iTurb].w[iNode] << " " << std::endl ; + } + fastcpp_velocity_file.close() ; + } - FAST_OpFM_Step(&iTurb, &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - - // Compute the force from the nacelle only if the drag coefficient is - // greater than zero - if (nacelle_cd[iTurb]>0.) { - - calc_nacelle_force ( - - cDriver_Output_to_FAST[iTurb].u[0], - cDriver_Output_to_FAST[iTurb].v[0], - cDriver_Output_to_FAST[iTurb].w[0], - nacelle_cd[iTurb], - nacelle_area[iTurb], - air_density[iTurb], - cDriver_Input_from_FAST[iTurb].fx[0], - cDriver_Input_from_FAST[iTurb].fy[0], - cDriver_Input_from_FAST[iTurb].fz[0] - - ); - + FAST_OpFM_Step(&iTurb, &ErrStat, ErrMsg); + checkError(ErrStat, ErrMsg); + + // Compute the force from the nacelle only if the drag coefficient is + // greater than zero + if (nacelle_cd[iTurb]>0.) { + calc_nacelle_force ( + cDriver_Output_to_FAST[iTurb].u[0], + cDriver_Output_to_FAST[iTurb].v[0], + cDriver_Output_to_FAST[iTurb].w[0], + nacelle_cd[iTurb], + nacelle_area[iTurb], + air_density[iTurb], + cDriver_Input_from_FAST[iTurb].fx[0], + cDriver_Input_from_FAST[iTurb].fy[0], + cDriver_Input_from_FAST[iTurb].fz[0] + ); } - if ( isDebug() ) { - std::ofstream actuatorForcesFile; - actuatorForcesFile.open("actuator_forces.csv") ; - actuatorForcesFile << "# x, y, z, fx, fy, fz" << std::endl ; - for (int iNode=0; iNode < get_numForcePtsLoc(iTurb); iNode++) { - actuatorForcesFile << cDriver_Input_from_FAST[iTurb].pxForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pyForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pzForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fx[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fy[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fz[iNode] << " " << std::endl ; - } - actuatorForcesFile.close() ; - } - - } - - if(scStatus) { - sc->updateStates(scInputsGlob); // Go from 'n' to 'n+1' based on input at previous time step - fillScInputsGlob(); // Update inputs to super controller for 'n+1' - } + if ( isDebug() ) { + std::ofstream actuatorForcesFile; + actuatorForcesFile.open("actuator_forces.csv") ; + actuatorForcesFile << "# x, y, z, fx, fy, fz" << std::endl ; + for (int iNode=0; iNode < get_numForcePtsLoc(iTurb); iNode++) { + actuatorForcesFile << cDriver_Input_from_FAST[iTurb].pxForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pyForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pzForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fx[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fy[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fz[iNode] << " " << std::endl ; + } + actuatorForcesFile.close() ; + } + } - nt_global = nt_global + 1; - - if ( (((nt_global - ntStart) % nEveryCheckPoint) == 0 ) && (nt_global != ntStart) ) { - // Use default FAST naming convention for checkpoint file - // . - char dummyCheckPointRoot[INTERFACE_STRING_LENGTH] = " "; - // Ensure that we have a null character - dummyCheckPointRoot[1] = 0; + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.updateStates(nt_global * dtFAST); // Predict state at 'n+1' based on inputs + // sc.calcOutputs_np1( (nt_global + 1) * dtFAST); + // sc.fastSCInputOutput(); + } - if (nTurbinesProc > 0) backupVelocityDataFile(nt_global, velNodeDataFile); - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - FAST_CreateCheckpoint(&iTurb, dummyCheckPointRoot, &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); - } + nt_global = nt_global + 1; + if(scStatus) { - if (fastMPIRank == 0) { - sc->writeRestartFile(nt_global); - } + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.advanceTime(); // Advance states, inputs and outputs from 'n' to 'n+1' + } + + if ( (((nt_global - ntStart) % nEveryCheckPoint) == 0 ) && (nt_global != ntStart) ) { + // Use default FAST naming convention for checkpoint file + // . + char dummyCheckPointRoot[INTERFACE_STRING_LENGTH] = " "; + // Ensure that we have a null character + dummyCheckPointRoot[1] = 0; + + if (nTurbinesProc > 0) backupVelocityDataFile(nt_global, velNodeDataFile); + + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + FAST_CreateCheckpoint(&iTurb, dummyCheckPointRoot, &ErrStat, ErrMsg); + checkError(ErrStat, ErrMsg); + } + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // if (fastMPIRank == 0) { + // sc.writeRestartFile(nt_global); + // } + } } - } } void fast::OpenFAST::stepNoWrite() { - /* ****************************** - set inputs from this code and call FAST: - ********************************* */ - - if(scStatus) { - sc->calcOutputs(scOutputsGlob); - fillScOutputsLoc(); - } + /* ****************************** + set inputs from this code and call FAST: + ********************************* */ - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - // set wind speeds at original locations - // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); + // set wind speeds at original locations + // setOutputsToFAST(cDriver_Input_from_FAST[iTurb], cDriver_Output_to_FAST[iTurb]); - // this advances the states, calls CalcOutput, and solves for next inputs. Predictor-corrector loop is imbeded here: - // (note OpenFOAM could do subcycling around this step) - FAST_OpFM_Step(&iTurb, &ErrStat, ErrMsg); - checkError(ErrStat, ErrMsg); + // this advances the states, calls CalcOutput, and solves for next inputs. Predictor-corrector loop is imbeded here: + // (note OpenFOAM could do subcycling around this step) + FAST_OpFM_Step(&iTurb, &ErrStat, ErrMsg); + checkError(ErrStat, ErrMsg); - } + } if(scStatus) { - sc->updateStates(scInputsGlob); // Go from 'n' to 'n+1' based on input at previous time step - fillScInputsGlob(); // Update inputs to super controller for 'n+1' + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.updateStates( nt_global * dtFAST); // Predict state at 'n+1' based on inputs + // sc.calcOutputs_np1( (nt_global+1) * dtFAST); + // sc.fastSCInputOutput(); } nt_global = nt_global + 1; + + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.advanceTime(); // Advance states, inputs and outputs from 'n' to 'n+1' + } } -fast::OpenFAST::~OpenFAST(){ -} +void fast::OpenFAST::calc_nacelle_force(const float & u, const float & v, const float & w, const float & cd, const float & area, const float & rho, float & fx, float & fy, float & fz) { + // Calculate the force on the nacelle (fx,fy,fz) given the + // velocity sampled at the nacelle point (u,v,w), + // drag coefficient 'cd' and nacelle area 'area' -void fast::OpenFAST::calc_nacelle_force( - const float & u, - const float & v, - const float & w, - const float & cd, - const float & area, - const float & rho, - float & fx, - float & fy, - float & fz) { - // Calculate the force on the nacelle (fx,fy,fz) given the - // velocity sampled at the nacelle point (u,v,w), - // drag coefficient 'cd' and nacelle area 'area' - - // The velocity magnitude - float Vmag = std::sqrt(u * u + v * v + w * w); - - // Velocity correction based on Martinez-Tossas PhD Thesis 2017 - // The correction samples the velocity at the center of the - // Gaussian kernel and scales it to obtain the inflow velocity - float epsilon_d = std::sqrt(2.0 / M_PI * cd * area); - float correction = 1. / (1.0 - cd * area / - (4.0 * M_PI * epsilon_d * epsilon_d)); - - // Compute the force for each velocity component - fx = rho * 1./2. * cd * area * Vmag * u * correction * correction; - fy = rho * 1./2. * cd * area * Vmag * v * correction * correction; - fz = rho * 1./2. * cd * area * Vmag * w * correction * correction; - } + // The velocity magnitude + float Vmag = std::sqrt(u * u + v * v + w * w); -void fast::OpenFAST::setInputs(const fast::fastInputs & fi ) { + // Velocity correction based on Martinez-Tossas PhD Thesis 2017 + // The correction samples the velocity at the center of the + // Gaussian kernel and scales it to obtain the inflow velocity + float epsilon_d = std::sqrt(2.0 / M_PI * cd * area); + float correction = 1. / (1.0 - cd * area / (4.0 * M_PI * epsilon_d * epsilon_d)); + // Compute the force for each velocity component + fx = rho * 1./2. * cd * area * Vmag * u * correction * correction; + fy = rho * 1./2. * cd * area * Vmag * v * correction * correction; + fz = rho * 1./2. * cd * area * Vmag * w * correction * correction; +} + +void fast::OpenFAST::setInputs(const fast::fastInputs & fi ) { - mpiComm = fi.comm; + mpiComm = fi.comm; - MPI_Comm_rank(mpiComm, &worldMPIRank); - MPI_Comm_group(mpiComm, &worldMPIGroup); + MPI_Comm_rank(mpiComm, &worldMPIRank); + MPI_Comm_group(mpiComm, &worldMPIGroup); - nTurbinesGlob = fi.nTurbinesGlob; + nTurbinesGlob = fi.nTurbinesGlob; if (nTurbinesGlob > 0) { - - dryRun = fi.dryRun; - - debug = fi.debug; - - tStart = fi.tStart; - simStart = fi.simStart; - nEveryCheckPoint = fi.nEveryCheckPoint; - tMax = fi.tMax; - loadSuperController(fi); - dtFAST = fi.dtFAST; - - ntStart = int(tStart/dtFAST); - - if (simStart == fast::restartDriverInitFAST) { - nt_global = 0; - } else { - nt_global = ntStart; - } - - globTurbineData.resize(nTurbinesGlob); - globTurbineData = fi.globTurbineData; - } else { - throw std::runtime_error("Number of turbines < 0 "); - } - -} + dryRun = fi.dryRun; + debug = fi.debug; -void fast::OpenFAST::checkError(const int ErrStat, const char * ErrMsg){ + tStart = fi.tStart; + simStart = fi.simStart; + nEveryCheckPoint = fi.nEveryCheckPoint; + tMax = fi.tMax; + loadSuperController(fi); + dtFAST = fi.dtFAST; - if (ErrStat != ErrID_None){ + ntStart = int(tStart/dtFAST); - if (ErrStat >= AbortErrLev){ - throw std::runtime_error(ErrMsg); - } + if (simStart == fast::restartDriverInitFAST) { + nt_global = 0; + } else { + nt_global = ntStart; + } - } + globTurbineData.resize(nTurbinesGlob); + globTurbineData = fi.globTurbineData; + } else { + throw std::runtime_error("Number of turbines < 0 "); + } } -void fast::OpenFAST::setOutputsToFAST(OpFM_InputType_t cDriver_Input_from_FAST, OpFM_OutputType_t cDriver_Output_to_FAST){ +void fast::OpenFAST::checkError(const int ErrStat, const char * ErrMsg){ + if (ErrStat != ErrID_None){ + if (ErrStat >= AbortErrLev){ + throw std::runtime_error(ErrMsg); + } + } +} - // routine sets the u-v-w wind speeds used in FAST and the SuperController inputs +void fast::OpenFAST::setOutputsToFAST(OpFM_InputType_t cDriver_Input_from_FAST, OpFM_OutputType_t cDriver_Output_to_FAST){ - for (int j = 0; j < cDriver_Output_to_FAST.u_Len; j++){ - cDriver_Output_to_FAST.u[j] = (float) 10.0*pow((cDriver_Input_from_FAST.pzVel[j] / 90.0), 0.2); // 0.2 power law wind profile using reference 10 m/s at 90 meters - cDriver_Output_to_FAST.v[j] = 0.0; - cDriver_Output_to_FAST.w[j] = 0.0; - } + // routine sets the u-v-w wind speeds used in FAST and the SuperController inputs - // // call supercontroller - // for (int j = 0; j < cDriver_Output_to_FAST.SuperController_Len; j++){ - // cDriver_Output_to_FAST.SuperController[j] = (float) j; // set it somehow.... (would be set from the SuperController outputs) - // } + for (int j = 0; j < cDriver_Output_to_FAST.u_Len; j++){ + cDriver_Output_to_FAST.u[j] = (float) 10.0*pow((cDriver_Input_from_FAST.pzVel[j] / 90.0), 0.2); // 0.2 power law wind profile using reference 10 m/s at 90 meters + cDriver_Output_to_FAST.v[j] = 0.0; + cDriver_Output_to_FAST.w[j] = 0.0; + } } void fast::OpenFAST::getApproxHubPos(double* currentCoords, int iTurbGlob, int nSize) { - - assert(nSize==3); - // Get hub position of Turbine 'iTurbGlob' - for(int i =0; i rDistForce(nForcePtsBlade) ; - for(int j=0; j < nForcePtsBlade; j++) { - int iNodeForce = 1 + iBlade * nForcePtsBlade + j ; //The number of actuator force points is always the same for all blades - rDistForce[j] = std::sqrt( - (cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[0])*(cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[0]) - + (cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[0])*(cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[0]) - + (cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[0])*(cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[0]) - ); - } - - // Interpolate to the velocity nodes - int nVelPtsBlade = get_numVelPtsBladeLoc(iTurb); - for(int j=0; j < nVelPtsBlade; j++) { - int iNodeVel = 1 + iBlade * nVelPtsBlade + j ; //Assumes the same number of velocity (Aerodyn) nodes for all blades - double rDistVel = std::sqrt( - (cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[0])*(cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[0]) - + (cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[0])*(cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[0]) - + (cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[0])*(cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[0]) - ); - //Find nearest two force nodes - int jForceLower = 0; - while ( (rDistForce[jForceLower+1] < rDistVel) && ( jForceLower < (nForcePtsBlade-2)) ) { - jForceLower = jForceLower + 1; - } - int iNodeForceLower = 1 + iBlade * nForcePtsBlade + jForceLower ; - double rInterp = (rDistVel - rDistForce[jForceLower])/(rDistForce[jForceLower+1]-rDistForce[jForceLower]); - cDriver_Output_to_FAST[iTurb].u[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][0] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][0] - forceNodeVel[iTurb][iNodeForceLower][0] ); - cDriver_Output_to_FAST[iTurb].v[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][1] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][1] - forceNodeVel[iTurb][iNodeForceLower][1] ); - cDriver_Output_to_FAST[iTurb].w[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][2] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][2] - forceNodeVel[iTurb][iNodeForceLower][2] ); - } - } + // Do the blades first + int nBlades = get_numBladesLoc(iTurb); + for(int iBlade=0; iBlade < nBlades; iBlade++) { + // Create interpolating parameter - Distance from hub + int nForcePtsBlade = get_numForcePtsBladeLoc(iTurb); + std::vector rDistForce(nForcePtsBlade) ; + for(int j=0; j < nForcePtsBlade; j++) { + int iNodeForce = 1 + iBlade * nForcePtsBlade + j ; //The number of actuator force points is always the same for all blades + rDistForce[j] = std::sqrt( + (cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[0])*(cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[0]) + + (cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[0])*(cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[0]) + + (cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[0])*(cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[0]) + ); + } + + // Interpolate to the velocity nodes + int nVelPtsBlade = get_numVelPtsBladeLoc(iTurb); + for(int j=0; j < nVelPtsBlade; j++) { + int iNodeVel = 1 + iBlade * nVelPtsBlade + j ; //Assumes the same number of velocity (Aerodyn) nodes for all blades + double rDistVel = std::sqrt( + (cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[0])*(cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[0]) + + (cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[0])*(cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[0]) + + (cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[0])*(cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[0]) + ); + //Find nearest two force nodes + int jForceLower = 0; + while ( (rDistForce[jForceLower+1] < rDistVel) && ( jForceLower < (nForcePtsBlade-2)) ) { + jForceLower = jForceLower + 1; + } + int iNodeForceLower = 1 + iBlade * nForcePtsBlade + jForceLower ; + double rInterp = (rDistVel - rDistForce[jForceLower])/(rDistForce[jForceLower+1]-rDistForce[jForceLower]); + cDriver_Output_to_FAST[iTurb].u[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][0] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][0] - forceNodeVel[iTurb][iNodeForceLower][0] ); + cDriver_Output_to_FAST[iTurb].v[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][1] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][1] - forceNodeVel[iTurb][iNodeForceLower][1] ); + cDriver_Output_to_FAST[iTurb].w[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][2] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][2] - forceNodeVel[iTurb][iNodeForceLower][2] ); + } + } - // Now the tower if present and used - int nVelPtsTower = get_numVelPtsTwrLoc(iTurb); - if ( nVelPtsTower > 0 ) { - - // Create interpolating parameter - Distance from first node from ground - int nForcePtsTower = get_numForcePtsTwrLoc(iTurb); - std::vector hDistForce(nForcePtsTower) ; - int iNodeBotTowerForce = 1 + nBlades * get_numForcePtsBladeLoc(iTurb); // The number of actuator force points is always the same for all blades - for(int j=0; j < nForcePtsTower; j++) { - int iNodeForce = iNodeBotTowerForce + j ; - hDistForce[j] = std::sqrt( - (cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[iNodeBotTowerForce]) - + (cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[iNodeBotTowerForce]) - + (cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[iNodeBotTowerForce]) - ); - } - - - int iNodeBotTowerVel = 1 + nBlades * get_numVelPtsBladeLoc(iTurb); // Assumes the same number of velocity (Aerodyn) nodes for all blades - for(int j=0; j < nVelPtsTower; j++) { - int iNodeVel = iNodeBotTowerVel + j ; - double hDistVel = std::sqrt( - (cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[iNodeBotTowerVel]) - + (cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[iNodeBotTowerVel]) - + (cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[iNodeBotTowerVel]) - ); - //Find nearest two force nodes - int jForceLower = 0; - while ( (hDistForce[jForceLower+1] < hDistVel) && ( jForceLower < (nForcePtsTower-2)) ) { - jForceLower = jForceLower + 1; - } - int iNodeForceLower = iNodeBotTowerForce + jForceLower ; - double rInterp = (hDistVel - hDistForce[jForceLower])/(hDistForce[jForceLower+1]-hDistForce[jForceLower]); - cDriver_Output_to_FAST[iTurb].u[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][0] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][0] - forceNodeVel[iTurb][iNodeForceLower][0] ); - cDriver_Output_to_FAST[iTurb].v[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][1] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][1] - forceNodeVel[iTurb][iNodeForceLower][1] ); - cDriver_Output_to_FAST[iTurb].w[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][2] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][2] - forceNodeVel[iTurb][iNodeForceLower][2] ); - } - } - - } - + // Now the tower if present and used + int nVelPtsTower = get_numVelPtsTwrLoc(iTurb); + if ( nVelPtsTower > 0 ) { + + // Create interpolating parameter - Distance from first node from ground + int nForcePtsTower = get_numForcePtsTwrLoc(iTurb); + std::vector hDistForce(nForcePtsTower) ; + int iNodeBotTowerForce = 1 + nBlades * get_numForcePtsBladeLoc(iTurb); // The number of actuator force points is always the same for all blades + for(int j=0; j < nForcePtsTower; j++) { + int iNodeForce = iNodeBotTowerForce + j ; + hDistForce[j] = std::sqrt( + (cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pxForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pxForce[iNodeBotTowerForce]) + + (cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pyForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pyForce[iNodeBotTowerForce]) + + (cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[iNodeBotTowerForce])*(cDriver_Input_from_FAST[iTurb].pzForce[iNodeForce] - cDriver_Input_from_FAST[iTurb].pzForce[iNodeBotTowerForce]) + ); + } + + int iNodeBotTowerVel = 1 + nBlades * get_numVelPtsBladeLoc(iTurb); // Assumes the same number of velocity (Aerodyn) nodes for all blades + for(int j=0; j < nVelPtsTower; j++) { + int iNodeVel = iNodeBotTowerVel + j ; + double hDistVel = std::sqrt( + (cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pxVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pxVel[iNodeBotTowerVel]) + + (cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pyVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pyVel[iNodeBotTowerVel]) + + (cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[iNodeBotTowerVel])*(cDriver_Input_from_FAST[iTurb].pzVel[iNodeVel] - cDriver_Input_from_FAST[iTurb].pzVel[iNodeBotTowerVel]) + ); + //Find nearest two force nodes + int jForceLower = 0; + while ( (hDistForce[jForceLower+1] < hDistVel) && ( jForceLower < (nForcePtsTower-2)) ) { + jForceLower = jForceLower + 1; + } + int iNodeForceLower = iNodeBotTowerForce + jForceLower ; + double rInterp = (hDistVel - hDistForce[jForceLower])/(hDistForce[jForceLower+1]-hDistForce[jForceLower]); + cDriver_Output_to_FAST[iTurb].u[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][0] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][0] - forceNodeVel[iTurb][iNodeForceLower][0] ); + cDriver_Output_to_FAST[iTurb].v[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][1] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][1] - forceNodeVel[iTurb][iNodeForceLower][1] ); + cDriver_Output_to_FAST[iTurb].w[iNodeVel] = forceNodeVel[iTurb][iNodeForceLower][2] + rInterp * (forceNodeVel[iTurb][iNodeForceLower+1][2] - forceNodeVel[iTurb][iNodeForceLower][2] ); + } + } + } } void fast::OpenFAST::computeTorqueThrust(int iTurbGlob, std::vector & torque, std::vector & thrust) { @@ -684,7 +694,7 @@ void fast::OpenFAST::computeTorqueThrust(int iTurbGlob, std::vector & to for (int k=0; k < get_numBladesLoc(iTurbLoc); k++) { for (int j=0; j < numForcePtsBlade[iTurbLoc]; j++) { int iNode = 1 + numForcePtsBlade[iTurbLoc]*k + j ; - + thrust[0] = thrust[0] + cDriver_Input_from_FAST[iTurbLoc].fx[iNode] ; thrust[1] = thrust[1] + cDriver_Input_from_FAST[iTurbLoc].fy[iNode] ; thrust[2] = thrust[2] + cDriver_Input_from_FAST[iTurbLoc].fz[iNode] ; @@ -692,294 +702,270 @@ void fast::OpenFAST::computeTorqueThrust(int iTurbGlob, std::vector & to relLoc[0] = cDriver_Input_from_FAST[iTurbLoc].pxForce[iNode] - cDriver_Input_from_FAST[iTurbLoc].pxForce[0] ; relLoc[1] = cDriver_Input_from_FAST[iTurbLoc].pyForce[iNode] - cDriver_Input_from_FAST[iTurbLoc].pyForce[0]; relLoc[2] = cDriver_Input_from_FAST[iTurbLoc].pzForce[iNode] - cDriver_Input_from_FAST[iTurbLoc].pzForce[0]; - - double rDotHubShftVec = relLoc[0]*hubShftVec[0] + relLoc[1]*hubShftVec[1] + relLoc[2]*hubShftVec[2]; - for (int j=0; j < 3; j++) rPerpShft[j] = relLoc[j] - rDotHubShftVec * hubShftVec[j]; + + double rDotHubShftVec = relLoc[0]*hubShftVec[0] + relLoc[1]*hubShftVec[1] + relLoc[2]*hubShftVec[2]; + for (int j=0; j < 3; j++) rPerpShft[j] = relLoc[j] - rDotHubShftVec * hubShftVec[j]; torque[0] = torque[0] + rPerpShft[1] * cDriver_Input_from_FAST[iTurbLoc].fz[iNode] - rPerpShft[2] * cDriver_Input_from_FAST[iTurbLoc].fy[iNode] + cDriver_Input_from_FAST[iTurbLoc].momentx[iNode] ; torque[1] = torque[1] + rPerpShft[2] * cDriver_Input_from_FAST[iTurbLoc].fx[iNode] - rPerpShft[0] * cDriver_Input_from_FAST[iTurbLoc].fz[iNode] + cDriver_Input_from_FAST[iTurbLoc].momenty[iNode] ; torque[2] = torque[2] + rPerpShft[0] * cDriver_Input_from_FAST[iTurbLoc].fy[iNode] - rPerpShft[1] * cDriver_Input_from_FAST[iTurbLoc].fx[iNode] + cDriver_Input_from_FAST[iTurbLoc].momentz[iNode] ; - } } } fast::ActuatorNodeType fast::OpenFAST::getVelNodeType(int iTurbGlob, int iNode) { - // Return the type of velocity node for the given node number. The node ordering (from FAST) is - // Node 0 - Hub node - // Blade 1 nodes - // Blade 2 nodes - // Blade 3 nodes - // Tower nodes - - int iTurbLoc = get_localTurbNo(iTurbGlob); - for(int j=0; j < iTurbLoc; j++) iNode = iNode - get_numVelPtsLoc(iTurbGlob); - if (iNode) { - if ( (iNode + 1 - (get_numVelPts(iTurbLoc) - get_numVelPtsTwr(iTurbLoc)) ) > 0) { - return TOWER; - } - else { - return BLADE; + // Return the type of velocity node for the given node number. The node ordering (from FAST) is + // Node 0 - Hub node + // Blade 1 nodes + // Blade 2 nodes + // Blade 3 nodes + // Tower nodes + + int iTurbLoc = get_localTurbNo(iTurbGlob); + for(int j=0; j < iTurbLoc; j++) iNode = iNode - get_numVelPtsLoc(iTurbGlob); + if (iNode) { + if ( (iNode + 1 - (get_numVelPts(iTurbLoc) - get_numVelPtsTwr(iTurbLoc)) ) > 0 ) { + return TOWER; + } else { + return BLADE; + } + } else { + return HUB; } - } - else { - return HUB; - } - } fast::ActuatorNodeType fast::OpenFAST::getForceNodeType(int iTurbGlob, int iNode) { - // Return the type of actuator force node for the given node number. The node ordering (from FAST) is - // Node 0 - Hub node - // Blade 1 nodes - // Blade 2 nodes - // Blade 3 nodes - // Tower nodes - - int iTurbLoc = get_localTurbNo(iTurbGlob); - for(int j=0; j < iTurbLoc; j++) iNode = iNode - get_numForcePtsLoc(iTurbGlob); - if (iNode) { - if ( (iNode + 1 - (get_numForcePts(iTurbLoc) - get_numForcePtsTwr(iTurbLoc)) ) > 0) { - return TOWER; - } - else { - return BLADE; + // Return the type of actuator force node for the given node number. The node ordering (from FAST) is + // Node 0 - Hub node + // Blade 1 nodes + // Blade 2 nodes + // Blade 3 nodes + // Tower nodes + + int iTurbLoc = get_localTurbNo(iTurbGlob); + for(int j=0; j < iTurbLoc; j++) iNode = iNode - get_numForcePtsLoc(iTurbGlob); + if (iNode) { + if ( (iNode + 1 - (get_numForcePts(iTurbLoc) - get_numForcePtsTwr(iTurbLoc)) ) > 0 ) { + return TOWER; + } else { + return BLADE; + } + } else { + return HUB; } - } - else { - return HUB; - } - } void fast::OpenFAST::allocateMemory() { - - for (int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { - if (dryRun) { - if(worldMPIRank == 0) { - std::cout << "iTurb = " << iTurb << " turbineMapGlobToProc[iTurb] = " << turbineMapGlobToProc[iTurb] << std::endl ; - } - } - if(worldMPIRank == turbineMapGlobToProc[iTurb]) { - turbineMapProcToGlob[nTurbinesProc] = iTurb; - reverseTurbineMapProcToGlob[iTurb] = nTurbinesProc; - nTurbinesProc++ ; + + for (int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { + if (dryRun) { + if(worldMPIRank == 0) { + std::cout << "iTurb = " << iTurb << " turbineMapGlobToProc[iTurb] = " << turbineMapGlobToProc[iTurb] << std::endl ; + } + } + if(worldMPIRank == turbineMapGlobToProc[iTurb]) { + turbineMapProcToGlob[nTurbinesProc] = iTurb; + reverseTurbineMapProcToGlob[iTurb] = nTurbinesProc; + nTurbinesProc++ ; + } + turbineSetProcs.insert(turbineMapGlobToProc[iTurb]); } - turbineSetProcs.insert(turbineMapGlobToProc[iTurb]); - } - - int nProcsWithTurbines=0; - turbineProcs.resize(turbineSetProcs.size()); - - for (std::set::const_iterator p = turbineSetProcs.begin(); p != turbineSetProcs.end(); p++) { - turbineProcs[nProcsWithTurbines] = *p; - nProcsWithTurbines++ ; - } - - if (dryRun) { - if (nTurbinesProc > 0) { - std::ofstream turbineAllocFile; - turbineAllocFile.open("turbineAlloc." + std::to_string(worldMPIRank) + ".txt") ; - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - turbineAllocFile << "Proc " << worldMPIRank << " loc iTurb " << iTurb << " glob iTurb " << turbineMapProcToGlob[iTurb] << std::endl ; - } - turbineAllocFile.flush(); - turbineAllocFile.close() ; + + int nProcsWithTurbines=0; + turbineProcs.resize(turbineSetProcs.size()); + + for (std::set::const_iterator p = turbineSetProcs.begin(); p != turbineSetProcs.end(); p++) { + turbineProcs[nProcsWithTurbines] = *p; + nProcsWithTurbines++ ; } - - } - - // Construct a group containing all procs running atleast 1 turbine in FAST - MPI_Group_incl(worldMPIGroup, nProcsWithTurbines, &turbineProcs[0], &fastMPIGroup) ; - int fastMPIcommTag = MPI_Comm_create(mpiComm, fastMPIGroup, &fastMPIComm); - if (MPI_COMM_NULL != fastMPIComm) { - MPI_Comm_rank(fastMPIComm, &fastMPIRank); - } - - TurbID.resize(nTurbinesProc); - TurbineBasePos.resize(nTurbinesProc); - FASTInputFileName.resize(nTurbinesProc); - CheckpointFileRoot.resize(nTurbinesProc); - nacelle_cd.resize(nTurbinesProc); - nacelle_area.resize(nTurbinesProc); - air_density.resize(nTurbinesProc); - numBlades.resize(nTurbinesProc); - numForcePtsBlade.resize(nTurbinesProc); - numForcePtsTwr.resize(nTurbinesProc); - numVelPtsBlade.resize(nTurbinesProc); - numVelPtsTwr.resize(nTurbinesProc); - forceNodeVel.resize(nTurbinesProc); - - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - - TurbineBasePos[iTurb].resize(3); - - int globProc = turbineMapProcToGlob[iTurb]; - TurbID[iTurb] = globTurbineData[globProc].TurbID; - FASTInputFileName[iTurb] = globTurbineData[globProc].FASTInputFileName ; - CheckpointFileRoot[iTurb] = globTurbineData[globProc].FASTRestartFileName ; - for(int i=0;i<3;i++) { - TurbineBasePos[iTurb][i] = globTurbineData[globProc].TurbineBasePos[i]; + if (dryRun) { + if (nTurbinesProc > 0) { + std::ofstream turbineAllocFile; + turbineAllocFile.open("turbineAlloc." + std::to_string(worldMPIRank) + ".txt") ; + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + turbineAllocFile << "Proc " << worldMPIRank << " loc iTurb " << iTurb << " glob iTurb " << turbineMapProcToGlob[iTurb] << std::endl ; + } + turbineAllocFile.flush(); + turbineAllocFile.close() ; + } } - numForcePtsBlade[iTurb] = globTurbineData[globProc].numForcePtsBlade; - numForcePtsTwr[iTurb] = globTurbineData[globProc].numForcePtsTwr; - nacelle_cd[iTurb] = globTurbineData[globProc].nacelle_cd; - nacelle_area[iTurb] = globTurbineData[globProc].nacelle_area; - air_density[iTurb] = globTurbineData[globProc].air_density; - } + // Construct a group containing all procs running atleast 1 turbine in FAST + MPI_Group_incl(worldMPIGroup, nProcsWithTurbines, &turbineProcs[0], &fastMPIGroup) ; + int fastMPIcommTag = MPI_Comm_create(mpiComm, fastMPIGroup, &fastMPIComm); + if (MPI_COMM_NULL != fastMPIComm) { + MPI_Comm_rank(fastMPIComm, &fastMPIRank); + } - // Allocate memory for Turbine datastructure for all turbines - FAST_AllocateTurbines(&nTurbinesProc, &ErrStat, ErrMsg); - - // Allocate memory for OpFM Input types in FAST - cDriver_Input_from_FAST.resize(nTurbinesProc) ; - cDriver_Output_to_FAST.resize(nTurbinesProc) ; + TurbID.resize(nTurbinesProc); + TurbineBasePos.resize(nTurbinesProc); + FASTInputFileName.resize(nTurbinesProc); + CheckpointFileRoot.resize(nTurbinesProc); + nacelle_cd.resize(nTurbinesProc); + nacelle_area.resize(nTurbinesProc); + air_density.resize(nTurbinesProc); + numBlades.resize(nTurbinesProc); + numForcePtsBlade.resize(nTurbinesProc); + numForcePtsTwr.resize(nTurbinesProc); + numVelPtsBlade.resize(nTurbinesProc); + numVelPtsTwr.resize(nTurbinesProc); + forceNodeVel.resize(nTurbinesProc); - cDriverSC_Input_from_FAST.resize(nTurbinesProc) ; - cDriverSC_Output_to_FAST.resize(nTurbinesProc) ; + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + + TurbineBasePos[iTurb].resize(3); + int globProc = turbineMapProcToGlob[iTurb]; + TurbID[iTurb] = globTurbineData[globProc].TurbID; + FASTInputFileName[iTurb] = globTurbineData[globProc].FASTInputFileName ; + CheckpointFileRoot[iTurb] = globTurbineData[globProc].FASTRestartFileName ; + for(int i=0;i<3;i++) { + TurbineBasePos[iTurb][i] = globTurbineData[globProc].TurbineBasePos[i]; + } + numForcePtsBlade[iTurb] = globTurbineData[globProc].numForcePtsBlade; + numForcePtsTwr[iTurb] = globTurbineData[globProc].numForcePtsTwr; + nacelle_cd[iTurb] = globTurbineData[globProc].nacelle_cd; + nacelle_area[iTurb] = globTurbineData[globProc].nacelle_area; + air_density[iTurb] = globTurbineData[globProc].air_density; + } + + // Allocate memory for Turbine datastructure for all turbines + FAST_AllocateTurbines(&nTurbinesProc, &ErrStat, ErrMsg); + + // Allocate memory for OpFM Input types in FAST + cDriver_Input_from_FAST.resize(nTurbinesProc) ; + cDriver_Output_to_FAST.resize(nTurbinesProc) ; + + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // scio.from_SC.resize(nTurbinesProc); + } } void fast::OpenFAST::allocateTurbinesToProcsSimple() { - - // Allocate turbines to each processor - round robin fashion - int nProcs ; - MPI_Comm_size(mpiComm, &nProcs); - for(int j = 0; j < nTurbinesGlob; j++) turbineMapGlobToProc[j] = j % nProcs ; - + // Allocate turbines to each processor - round robin fashion + int nProcs ; + MPI_Comm_size(mpiComm, &nProcs); + for(int j = 0; j < nTurbinesGlob; j++) turbineMapGlobToProc[j] = j % nProcs ; } void fast::OpenFAST::end() { - // Deallocate types we allocated earlier - - if (nTurbinesProc > 0) closeVelocityDataFile(nt_global, velNodeDataFile); - - if ( !dryRun) { - bool stopTheProgram = false; - for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - FAST_End(&iTurb, &stopTheProgram); + // Deallocate types we allocated earlier + + if (nTurbinesProc > 0) closeVelocityDataFile(nt_global, velNodeDataFile); + + if ( !dryRun) { + bool stopTheProgram = false; + for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + FAST_End(&iTurb, &stopTheProgram); + } + FAST_DeallocateTurbines(&ErrStat, ErrMsg); } - FAST_DeallocateTurbines(&ErrStat, ErrMsg); - } - - MPI_Group_free(&fastMPIGroup); - if (MPI_COMM_NULL != fastMPIComm) { - MPI_Comm_free(&fastMPIComm); - } - MPI_Group_free(&worldMPIGroup); - - if(scStatus) { - - destroy_SuperController(sc) ; - - if(scLibHandle != NULL) { - // close the library - std::cout << "Closing library...\n"; - dlclose(scLibHandle); + + MPI_Group_free(&fastMPIGroup); + if (MPI_COMM_NULL != fastMPIComm) { + MPI_Comm_free(&fastMPIComm); + } + MPI_Group_free(&worldMPIGroup); + + if(scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // sc.end(); } - - } - } void fast::OpenFAST::readVelocityData(int nTimesteps) { - - int nTurbines; - - hid_t velDataFile = H5Fopen(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_RDWR, H5P_DEFAULT); - - { - hid_t attr = H5Aopen(velDataFile, "nTurbines", H5P_DEFAULT); - herr_t ret = H5Aread(attr, H5T_NATIVE_INT, &nTurbines) ; - H5Aclose(attr); - } + int nTurbines; - // Allocate memory and read the velocity data. - velNodeData.resize(nTurbines); - for (int iTurb=0; iTurb < nTurbines; iTurb++) { - int nVelPts = get_numVelPtsLoc(iTurb) ; - velNodeData[iTurb].resize(nTimesteps*nVelPts*6) ; - hid_t dset_id = H5Dopen2(velDataFile, ("/turbine" + std::to_string(iTurb)).c_str(), H5P_DEFAULT); - hid_t dspace_id = H5Dget_space(dset_id); - - hsize_t start[3]; start[1] = 0; start[2] = 0; - hsize_t count[3]; count[0] = 1; count[1] = nVelPts; count[2] = 6; - hid_t mspace_id = H5Screate_simple(3, count, NULL); + hid_t velDataFile = H5Fopen(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_RDWR, H5P_DEFAULT); - for (int iStep=0; iStep < nTimesteps; iStep++) { - start[0] = iStep; - H5Sselect_hyperslab(dspace_id, H5S_SELECT_SET, start, NULL, count, NULL); - herr_t status = H5Dread(dset_id, H5T_NATIVE_DOUBLE, mspace_id, dspace_id, H5P_DEFAULT, &velNodeData[iTurb][iStep*nVelPts*6] ); + { + hid_t attr = H5Aopen(velDataFile, "nTurbines", H5P_DEFAULT); + herr_t ret = H5Aread(attr, H5T_NATIVE_INT, &nTurbines) ; + H5Aclose(attr); } - herr_t status = H5Dclose(dset_id); + // Allocate memory and read the velocity data. + velNodeData.resize(nTurbines); + for (int iTurb=0; iTurb < nTurbines; iTurb++) { + int nVelPts = get_numVelPtsLoc(iTurb) ; + velNodeData[iTurb].resize(nTimesteps*nVelPts*6) ; + hid_t dset_id = H5Dopen2(velDataFile, ("/turbine" + std::to_string(iTurb)).c_str(), H5P_DEFAULT); + hid_t dspace_id = H5Dget_space(dset_id); + + hsize_t start[3]; start[1] = 0; start[2] = 0; + hsize_t count[3]; count[0] = 1; count[1] = nVelPts; count[2] = 6; + hid_t mspace_id = H5Screate_simple(3, count, NULL); + + for (int iStep=0; iStep < nTimesteps; iStep++) { + start[0] = iStep; + H5Sselect_hyperslab(dspace_id, H5S_SELECT_SET, start, NULL, count, NULL); + herr_t status = H5Dread(dset_id, H5T_NATIVE_DOUBLE, mspace_id, dspace_id, H5P_DEFAULT, &velNodeData[iTurb][iStep*nVelPts*6] ); + } - } - + herr_t status = H5Dclose(dset_id); + } } hid_t fast::OpenFAST::openVelocityDataFile(bool createFile) { - hid_t velDataFile; - if (createFile) { - // Open the file in create mode - velDataFile = H5Fcreate(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + hid_t velDataFile; + if (createFile) { + // Open the file in create mode + velDataFile = H5Fcreate(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + { + hsize_t dims[1]; + dims[0] = 1; + hid_t dataSpace = H5Screate_simple(1, dims, NULL); + hid_t attr = H5Acreate2(velDataFile, "nTurbines", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + herr_t status = H5Awrite(attr, H5T_NATIVE_INT, &nTurbinesProc); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(velDataFile, "nTimesteps", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + } - { - hsize_t dims[1]; - dims[0] = 1; - hid_t dataSpace = H5Screate_simple(1, dims, NULL); - hid_t attr = H5Acreate2(velDataFile, "nTurbines", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; - herr_t status = H5Awrite(attr, H5T_NATIVE_INT, &nTurbinesProc); - status = H5Aclose(attr); - status = H5Sclose(dataSpace); - - dataSpace = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(velDataFile, "nTimesteps", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; - status = H5Aclose(attr); - status = H5Sclose(dataSpace); - } + int ntMax = tMax/dtFAST ; - int ntMax = tMax/dtFAST ; + for (int iTurb = 0; iTurb < nTurbinesProc; iTurb++) { + int nVelPts = get_numVelPtsLoc(iTurb); + hsize_t dims[3]; + dims[0] = ntMax; dims[1] = nVelPts; dims[2] = 6 ; - for (int iTurb = 0; iTurb < nTurbinesProc; iTurb++) { - int nVelPts = get_numVelPtsLoc(iTurb); - hsize_t dims[3]; - dims[0] = ntMax; dims[1] = nVelPts; dims[2] = 6 ; + hsize_t chunk_dims[3]; + chunk_dims[0] = 1; chunk_dims[1] = nVelPts; chunk_dims[2] = 6; + hid_t dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + H5Pset_chunk(dcpl_id, 3, chunk_dims); - hsize_t chunk_dims[3]; - chunk_dims[0] = 1; chunk_dims[1] = nVelPts; chunk_dims[2] = 6; - hid_t dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - H5Pset_chunk(dcpl_id, 3, chunk_dims); + hid_t dataSpace = H5Screate_simple(3, dims, NULL); + hid_t dataSet = H5Dcreate(velDataFile, ("/turbine" + std::to_string(iTurb)).c_str(), H5T_NATIVE_DOUBLE, dataSpace, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); - hid_t dataSpace = H5Screate_simple(3, dims, NULL); - hid_t dataSet = H5Dcreate(velDataFile, ("/turbine" + std::to_string(iTurb)).c_str(), H5T_NATIVE_DOUBLE, dataSpace, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + herr_t status = H5Pclose(dcpl_id); + status = H5Dclose(dataSet); + status = H5Sclose(dataSpace); + } - herr_t status = H5Pclose(dcpl_id); - status = H5Dclose(dataSet); - status = H5Sclose(dataSpace); + } else { + // Open the file in append mode + velDataFile = H5Fopen(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_RDWR, H5P_DEFAULT); } - - } else { - // Open the file in append mode - velDataFile = H5Fopen(("velDatafile." + std::to_string(worldMPIRank) + ".h5").c_str(), H5F_ACC_RDWR, H5P_DEFAULT); - } - return velDataFile; + return velDataFile; } herr_t fast::OpenFAST::closeVelocityDataFile(int nt_global, hid_t velDataFile) { - - herr_t status = H5Fclose(velDataFile) ; - return status; + herr_t status = H5Fclose(velDataFile) ; + return status; } - void fast::OpenFAST::backupVelocityDataFile(int curTimeStep, hid_t & velDataFile) { closeVelocityDataFile(curTimeStep, velDataFile); @@ -996,152 +982,58 @@ void fast::OpenFAST::backupVelocityDataFile(int curTimeStep, hid_t & velDataFile void fast::OpenFAST::writeVelocityData(hid_t h5File, int iTurb, int iTimestep, OpFM_InputType_t iData, OpFM_OutputType_t oData) { - hsize_t start[3]; start[0] = iTimestep; start[1] = 0; start[2] = 0; - int nVelPts = get_numVelPtsLoc(iTurb) ; - hsize_t count[3]; count[0] = 1; count[1] = nVelPts; count[2] = 6; - - std::vector tmpVelData; - tmpVelData.resize(nVelPts * 6); - - for (int iNode=0 ; iNode < nVelPts; iNode++) { - tmpVelData[iNode*6 + 0] = iData.pxVel[iNode]; - tmpVelData[iNode*6 + 1] = iData.pyVel[iNode]; - tmpVelData[iNode*6 + 2] = iData.pzVel[iNode]; - tmpVelData[iNode*6 + 3] = oData.u[iNode]; - tmpVelData[iNode*6 + 4] = oData.v[iNode]; - tmpVelData[iNode*6 + 5] = oData.w[iNode]; - } - - hid_t dset_id = H5Dopen2(h5File, ("/turbine" + std::to_string(iTurb)).c_str(), H5P_DEFAULT); - hid_t dspace_id = H5Dget_space(dset_id); - H5Sselect_hyperslab(dspace_id, H5S_SELECT_SET, start, NULL, count, NULL); - hid_t mspace_id = H5Screate_simple(3, count, NULL); - H5Dwrite(dset_id, H5T_NATIVE_DOUBLE, mspace_id, dspace_id, H5P_DEFAULT, tmpVelData.data()); - - H5Dclose(dset_id); - H5Sclose(dspace_id); - H5Sclose(mspace_id); - - hid_t attr_id = H5Aopen_by_name(h5File, ".", "nTimesteps", H5P_DEFAULT, H5P_DEFAULT); - herr_t status = H5Awrite(attr_id, H5T_NATIVE_INT, &iTimestep); - status = H5Aclose(attr_id); - -} - -void fast::OpenFAST::applyVelocityData(int iPrestart, int iTurb, OpFM_OutputType_t cDriver_Output_to_FAST, std::vector & velData) { - - int nVelPts = get_numVelPtsLoc(iTurb); - for (int j = 0; j < nVelPts; j++){ - cDriver_Output_to_FAST.u[j] = velData[(iPrestart*nVelPts+j)*6 + 3]; - cDriver_Output_to_FAST.v[j] = velData[(iPrestart*nVelPts+j)*6 + 4]; - cDriver_Output_to_FAST.w[j] = velData[(iPrestart*nVelPts+j)*6 + 5]; - } - -} - -void fast::OpenFAST::loadSuperController(const fast::fastInputs & fi) { - - if(fi.scStatus) { - - scStatus = fi.scStatus; - scLibFile = fi.scLibFile; + hsize_t start[3]; start[0] = iTimestep; start[1] = 0; start[2] = 0; + int nVelPts = get_numVelPtsLoc(iTurb) ; + hsize_t count[3]; count[0] = 1; count[1] = nVelPts; count[2] = 6; - // open the library - scLibHandle = dlopen(scLibFile.c_str(), RTLD_LAZY); - if (!scLibHandle) { - std::cerr << "Cannot open library: " << dlerror() << '\n'; - } - - create_SuperController = (create_sc_t*) dlsym(scLibHandle, "create_sc"); - // reset errors - dlerror(); - const char *dlsym_error = dlerror(); - if (dlsym_error) { - std::cerr << "Cannot load symbol 'create_sc': " << dlsym_error << '\n'; - dlclose(scLibHandle); - } + std::vector tmpVelData; + tmpVelData.resize(nVelPts * 6); - destroy_SuperController = (destroy_sc_t*) dlsym(scLibHandle, "destroy_sc"); - // reset errors - dlerror(); - const char *dlsym_error_us = dlerror(); - if (dlsym_error_us) { - std::cerr << "Cannot load symbol 'destroy_sc': " << dlsym_error_us << '\n'; - dlclose(scLibHandle); + for (int iNode=0 ; iNode < nVelPts; iNode++) { + tmpVelData[iNode*6 + 0] = iData.pxVel[iNode]; + tmpVelData[iNode*6 + 1] = iData.pyVel[iNode]; + tmpVelData[iNode*6 + 2] = iData.pzVel[iNode]; + tmpVelData[iNode*6 + 3] = oData.u[iNode]; + tmpVelData[iNode*6 + 4] = oData.v[iNode]; + tmpVelData[iNode*6 + 5] = oData.w[iNode]; } - sc = create_SuperController() ; + hid_t dset_id = H5Dopen2(h5File, ("/turbine" + std::to_string(iTurb)).c_str(), H5P_DEFAULT); + hid_t dspace_id = H5Dget_space(dset_id); + H5Sselect_hyperslab(dspace_id, H5S_SELECT_SET, start, NULL, count, NULL); + hid_t mspace_id = H5Screate_simple(3, count, NULL); + H5Dwrite(dset_id, H5T_NATIVE_DOUBLE, mspace_id, dspace_id, H5P_DEFAULT, tmpVelData.data()); - numScInputs = fi.numScInputs; - numScOutputs = fi.numScOutputs; + H5Dclose(dset_id); + H5Sclose(dspace_id); + H5Sclose(mspace_id); - if ( (numScInputs > 0) && (numScOutputs > 0)) { - scOutputsGlob.resize(nTurbinesGlob*numScOutputs) ; - scInputsGlob.resize(nTurbinesGlob*numScInputs) ; - for (int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { - for(int iInput=0; iInput < numScInputs; iInput++) { - scInputsGlob[iTurb*numScInputs + iInput] = 0.0 ; // Initialize to zero - } - for(int iOutput=0; iOutput < numScOutputs; iOutput++) { - scOutputsGlob[iTurb*numScOutputs + iOutput] = 0.0 ; // Initialize to zero - } - } - - } else { - std::cerr << "Make sure numScInputs and numScOutputs are greater than zero" << std::endl; - } - - } else { - scStatus = false; - numScInputs = 0; - numScOutputs = 0; - } + hid_t attr_id = H5Aopen_by_name(h5File, ".", "nTimesteps", H5P_DEFAULT, H5P_DEFAULT); + herr_t status = H5Awrite(attr_id, H5T_NATIVE_INT, &iTimestep); + status = H5Aclose(attr_id); } - -void fast::OpenFAST::fillScInputsGlob() { - - // Fills the global array containing inputs to the supercontroller from all turbines - - for(int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { - for(int iInput=0; iInput < numScInputs; iInput++) { - scInputsGlob[iTurb*numScInputs + iInput] = 0.0; // Initialize to zero - } - } - - for(int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - for(int iInput=0; iInput < numScInputs; iInput++) { - scInputsGlob[turbineMapProcToGlob[iTurb]*numScInputs + iInput] = cDriverSC_Input_from_FAST[iTurb].toSC[iInput] ; +void fast::OpenFAST::applyVelocityData(int iPrestart, int iTurb, OpFM_OutputType_t cDriver_Output_to_FAST, std::vector & velData) { + int nVelPts = get_numVelPtsLoc(iTurb); + for (int j = 0; j < nVelPts; j++){ + cDriver_Output_to_FAST.u[j] = velData[(iPrestart*nVelPts+j)*6 + 3]; + cDriver_Output_to_FAST.v[j] = velData[(iPrestart*nVelPts+j)*6 + 4]; + cDriver_Output_to_FAST.w[j] = velData[(iPrestart*nVelPts+j)*6 + 5]; } - } - - if (MPI_COMM_NULL != fastMPIComm) { - MPI_Allreduce(MPI_IN_PLACE, scInputsGlob.data(), numScInputs*nTurbinesGlob, MPI_DOUBLE, MPI_SUM, fastMPIComm) ; - } - } +void fast::OpenFAST::loadSuperController(const fast::fastInputs & fi) { -void fast::OpenFAST::fillScOutputsLoc() { - - // Fills the local array containing outputs from the supercontroller to each turbine - - for(int iTurb=0; iTurb < nTurbinesProc; iTurb++) { - for(int iOutput=0; iOutput < numScOutputs; iOutput++) { - cDriverSC_Output_to_FAST[iTurb].fromSC[iOutput] = scOutputsGlob[turbineMapProcToGlob[iTurb]*numScOutputs + iOutput] ; + if(fi.scStatus) { + std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; + // scStatus = fi.scStatus; + // sc.load(fi.nTurbinesGlob, fi.scLibFile, scio); + + } else { + + scStatus = false; } - } - + } - - - - - - - - - - diff --git a/glue-codes/openfast-cpp/src/SC.cpp b/glue-codes/openfast-cpp/src/SC.cpp new file mode 100644 index 0000000000..7001648cd0 --- /dev/null +++ b/glue-codes/openfast-cpp/src/SC.cpp @@ -0,0 +1,454 @@ +#include "SC.h" + +SuperController::SuperController(): +nCtrl2SC(0), +nSC2Ctrl(0), +nInpGlobal(0), +nSC2CtrlGlob(0), +nStatesGlobal(0), +nStatesTurbine(0) +{ + +} + +SuperController::~SuperController() { + // close the library + if (sc_library_loaded) { + std::cout << "Closing SC library..." << std::endl; + dlclose(scLibHandle); + } +} + +void SuperController::load(int inNTurbinesGlob, std::string inScLibFile, scInitOutData & scio) { + + nTurbinesGlob = inNTurbinesGlob; + scLibFile = inScLibFile; + + // open the library + scLibHandle = dlopen(scLibFile.c_str(), RTLD_LAZY); + if (!scLibHandle) { + std::cerr << "Cannot open library: " << dlerror() << '\n'; + } + sc_library_loaded = true; + + sc_init = (sc_init_t*) dlsym(scLibHandle, "sc_init"); + // reset errors + const char *dlsym_error_i = dlerror(); + if (dlsym_error_i) { + std::cerr << "Cannot load symbol 'sc_init': " << dlsym_error_i << '\n'; + dlclose(scLibHandle); + } + + sc_getInitData = (sc_getInitData_t*) dlsym(scLibHandle, "sc_getInitData"); + // reset errors + const char *dlsym_error_gid = dlerror(); + if (dlsym_error_gid) { + std::cerr << "Cannot load symbol 'sc_getInitData': " << dlsym_error_gid << '\n'; + dlclose(scLibHandle); + } + + sc_updateStates = (sc_updateStates_t*) dlsym(scLibHandle, "sc_updateStates"); + // reset errors + const char *dlsym_error_us = dlerror(); + if (dlsym_error_us) { + std::cerr << "Cannot load symbol 'sc_updateStates': " << dlsym_error_us << '\n'; + dlclose(scLibHandle); + } + + sc_calcOutputs = (sc_calcOutputs_t*) dlsym(scLibHandle, "sc_calcOutputs"); + // reset errors + const char *dlsym_error_co = dlerror(); + if (dlsym_error_co) { + std::cerr << "Cannot load symbol 'sc_calcOutputs': " << dlsym_error_co << '\n'; + dlclose(scLibHandle); + } + + sc_init(&nTurbinesGlob, &nInpGlobal, &nCtrl2SC, &nParamGlobal, &nParamTurbine, &nStatesGlobal, &nStatesTurbine, &nSC2CtrlGlob, &nSC2Ctrl, &ErrStat, ErrMsg); + + if (nInpGlobal != 0) + std::cerr << "Supercontroller: nInpGlobal has to be zero. Not implemented yet." << std::endl ; + + if (nCtrl2SC < 0) + std::cerr << "Supercontroller: nCtrl2SC is less than zero." << std::endl ; + + if (nParamGlobal < 0) + std::cerr << "Supercontroller: nParamGlobal is less than zero." << std::endl ; + + if (nParamTurbine < 0) + std::cerr << "Supercontroller: nParamTurbine is less than zero." << std::endl ; + + if (nStatesGlobal < 0) + std::cerr << "Supercontroller: nStatesGlobal is less than zero" << std::endl ; + + if (nStatesTurbine < 0) + std::cerr << "Supercontroller: nStatesTurbine is less than zero" << std::endl ; + + if (nSC2CtrlGlob < 0) + std::cerr << "Supercontroller: nSC2CtrlGlob is less than zero." << std::endl ; + + if (nSC2Ctrl < 0) + std::cerr << "Supercontroller: nSC2Ctrl is less than zero." << std::endl ; + + scio.nInpGlobal = nInpGlobal; + scio.nCtrl2SC = nCtrl2SC; + scio.nSC2Ctrl = nSC2Ctrl; + scio.nSC2CtrlGlob = nSC2CtrlGlob; + +} + +void SuperController::init(scInitOutData & scio, int nTurbinesProc) { + ip_from_FAST.resize(nTurbinesProc) ; + op_to_FAST.resize(nTurbinesProc) ; + + scio.nSC2CtrlGlob = 0; + scio.nSC2Ctrl = 0; + scio.nCtrl2SC = 0; + + scio.from_SCglob.resize(nSC2CtrlGlob); + scio.from_SC.resize(nTurbinesProc); + for(int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + scio.from_SC[iTurb].resize(nSC2Ctrl); + } +} + +void SuperController::init_sc(scInitOutData & scio, int inNTurbinesProc, std::map iTurbineMapProcToGlob, MPI_Comm inFastMPIComm) { + + fastMPIComm = inFastMPIComm; + nTurbinesProc = inNTurbinesProc; + turbineMapProcToGlob = iTurbineMapProcToGlob; + + if (nTurbinesProc > 0) { + + paramGlobal.resize(nParamGlobal); + paramTurbine.resize(nTurbinesGlob*nParamTurbine); + + globStates.resize(nStatesGlobal); + globStates_np1.resize(nStatesGlobal); + + turbineStates.resize(nTurbinesGlob*nStatesTurbine); + turbineStates_np1.resize(nTurbinesGlob*nStatesTurbine); + + from_SC_nm1.resize(nTurbinesGlob*nSC2Ctrl); + from_SC_n.resize(nTurbinesGlob*nSC2Ctrl); + from_SC_np1.resize(nTurbinesGlob*nSC2Ctrl); + + to_SC_nm1.resize(nTurbinesGlob*nCtrl2SC); + to_SC_n.resize(nTurbinesGlob*nCtrl2SC); + to_SC_np1.resize(nTurbinesGlob*nCtrl2SC); + + from_SCglob_nm1.resize(nTurbinesGlob*nSC2CtrlGlob); + from_SCglob_n.resize(nTurbinesGlob*nSC2CtrlGlob); + from_SCglob_np1.resize(nTurbinesGlob*nSC2CtrlGlob); + + to_SCglob_nm1.resize(nTurbinesGlob*nInpGlobal); + to_SCglob_n.resize(nTurbinesGlob*nInpGlobal); + to_SCglob_np1.resize(nTurbinesGlob*nInpGlobal); + + sc_getInitData(&nTurbinesGlob, &nParamGlobal, &nParamTurbine, paramGlobal.data(), paramTurbine.data(), &nSC2CtrlGlob, from_SCglob_nm1.data(), &nSC2Ctrl, from_SC_nm1.data(), &nStatesGlobal, globStates.data(), &nStatesTurbine, turbineStates.data(), &ErrStat, ErrMsg); + + for(int i=0; i < nSC2CtrlGlob; i++) { + scio.from_SCglob[i] = from_SCglob_nm1[i]; + } + + for (int iTurb = 0 ; iTurb < nTurbinesProc; iTurb++) { + for(int i=0; i < nSC2Ctrl; i++) { + scio.from_SC[iTurb][i] = from_SC_nm1[turbineMapProcToGlob[iTurb]*nSC2Ctrl + i]; + } + } + + } + +} + +void SuperController::calcOutputs_n(double t) { + + if (nTurbinesProc > 0) { + sc_calcOutputs(&t, &nTurbinesGlob, &nParamGlobal, paramGlobal.data(), &nParamTurbine, paramTurbine.data(), &nInpGlobal, to_SCglob_n.data(), &nCtrl2SC, to_SC_n.data(), &nStatesGlobal, globStates.data(), &nStatesTurbine, turbineStates.data(), &nSC2CtrlGlob, from_SCglob_n.data(), &nSC2Ctrl, from_SC_n.data(), &ErrStat, ErrMsg); + } + +} + +void SuperController::calcOutputs_np1(double t) { + + if (nTurbinesProc > 0) { + sc_calcOutputs(&t, &nTurbinesGlob, &nParamGlobal, paramGlobal.data(), &nParamTurbine, paramTurbine.data(), &nInpGlobal, to_SCglob_n.data(), &nCtrl2SC, to_SC_n.data(), &nStatesGlobal, globStates_np1.data(), &nStatesTurbine, turbineStates_np1.data(), &nSC2CtrlGlob, from_SCglob_np1.data(), &nSC2Ctrl, from_SC_np1.data(), &ErrStat, ErrMsg); + } + +} + +void SuperController::updateStates(double t) { + + if (nTurbinesProc > 0) { + sc_updateStates(&t, &nTurbinesGlob, &nParamGlobal, paramGlobal.data(), &nParamTurbine, paramTurbine.data(), &nInpGlobal, to_SCglob_n.data(), &nCtrl2SC, to_SC_n.data(), &nStatesGlobal, globStates.data(), globStates_np1.data(), &nStatesTurbine, turbineStates.data(), turbineStates_np1.data(), &ErrStat, ErrMsg); + } + +} + +int SuperController::readRestartFile(int n_t_global) { + + if (nTurbinesProc > 0) { + + hid_t restartFile = H5Fopen(("sc" + std::to_string(n_t_global) + ".chkp.h5").c_str(), H5F_ACC_RDWR, H5P_DEFAULT); + + { + hid_t attr = H5Aopen(restartFile, "nTurbinesGlob", H5P_DEFAULT); + herr_t ret = H5Aread(attr, H5T_NATIVE_INT, &nTurbinesGlob) ; + H5Aclose(attr); + + attr = H5Aopen(restartFile, "nCtrl2SC", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nCtrl2SC) ; + H5Aclose(attr); + + attr = H5Aopen(restartFile, "nSC2Ctrl", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nSC2Ctrl) ; + H5Aclose(attr); + + attr = H5Aopen(restartFile, "nInpGlobal", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nInpGlobal) ; + H5Aclose(attr); + + attr = H5Aopen(restartFile, "nSC2CtrlGlob", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nSC2CtrlGlob) ; + H5Aclose(attr); + + attr = H5Aopen(restartFile, "nStatesGlobal", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nStatesGlobal) ; + H5Aclose(attr); + + globStates.resize(nStatesGlobal); + globStates_np1.resize(nStatesGlobal); + + attr = H5Aopen(restartFile, "nStatesTurbine", H5P_DEFAULT); + ret = H5Aread(attr, H5T_NATIVE_INT, &nStatesTurbine) ; + H5Aclose(attr); + + turbineStates.resize(nTurbinesGlob*nStatesTurbine); + turbineStates_np1.resize(nTurbinesGlob*nStatesTurbine); + +#ifdef DEBUG + std::cout << "nTurbinesGlob = " << nTurbinesGlob << std::endl ; + std::cout << "nCtrl2SC = " << nCtrl2SC << std::endl ; + std::cout << "nSC2Ctrl = " << nSC2Ctrl << std::endl ; + std::cout << "nInpGlobal = " << nInpGlobal << std::endl ; + std::cout << "nSC2CtrlGlob = " << nSC2CtrlGlob << std::endl ; + std::cout << "nStatesGlobal = " << nStatesGlobal << std::endl ; + std::cout << "nStatesTurbine = " << nStatesTurbine << std::endl ; +#endif + + } + + if (nStatesGlobal > 0) { + hid_t dataSet = H5Dopen2(restartFile, "/globStates", H5P_DEFAULT); + herr_t status = H5Dread(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, globStates.data()); + status = H5Dclose(dataSet); + + dataSet = H5Dopen2(restartFile, "/globStates_np1", H5P_DEFAULT); + status = H5Dread(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, globStates_np1.data()); + status = H5Dclose(dataSet); + } + + if (nStatesTurbine > 0) { + hid_t dataSet = H5Dopen2(restartFile, "turbineStates", H5P_DEFAULT); + herr_t status = H5Dread(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, turbineStates.data()); + status = H5Dclose(dataSet); + + dataSet = H5Dopen2(restartFile, "turbineStates_np1", H5P_DEFAULT); + status = H5Dread(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, turbineStates_np1.data()); + status = H5Dclose(dataSet); + } + +#ifdef DEBUG + for(int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { + for(int i=0; i < nStatesTurbine; i++) { + std::cout << "iTurb = " << iTurb << ", i = " << i << ", " ; + std::cout << turbineStates[iTurb*nStatesTurbine + i] << std::endl ; + } + } +#endif + herr_t status = H5Fclose(restartFile); + } + + return 0; +} + + +int SuperController::writeRestartFile(int n_t_global) { + + /* // HDF5 stuff to write states to restart file or read back from it */ + + if (nTurbinesProc > 0) { + + hid_t restartFile = H5Fcreate(("sc" + std::to_string(n_t_global) + ".chkp.h5").c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + { + hsize_t dims[1]; + dims[0] = 1; + hid_t dataSpace = H5Screate_simple(1, dims, NULL); + hid_t attr = H5Acreate2(restartFile, "nTurbinesGlob", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + herr_t status = H5Awrite(attr, H5T_NATIVE_INT, &nTurbinesGlob); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nCtrl2SC", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nCtrl2SC); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nSC2Ctrl", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nSC2Ctrl); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nInpGlobal", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nInpGlobal); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nSC2CtrlGlob", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nSC2CtrlGlob); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nStatesGlobal", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nStatesGlobal); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(restartFile, "nStatesTurbine", H5T_NATIVE_INT, dataSpace, H5P_DEFAULT, H5P_DEFAULT) ; + status = H5Awrite(attr, H5T_NATIVE_INT, &nStatesTurbine); + status = H5Aclose(attr); + status = H5Sclose(dataSpace); + + } + + if (nStatesGlobal > 0) { + hsize_t dims[1]; + dims[0] = nStatesGlobal; + hid_t dataSpace = H5Screate_simple(1, dims, NULL); + hid_t dataSet = H5Dcreate2(restartFile, "/globStates", H5T_NATIVE_FLOAT, dataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + herr_t status = H5Dwrite(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, globStates.data()); + + status = H5Dclose(dataSet); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(1, dims, NULL); + dataSet = H5Dcreate2(restartFile, "/globStates_np1", H5T_NATIVE_FLOAT, dataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, globStates_np1.data()); + + status = H5Dclose(dataSet); + status = H5Sclose(dataSpace); + + + } + + if (nStatesTurbine > 0) { + + hsize_t dims[2]; + dims[0] = nTurbinesGlob; + dims[1] = nStatesTurbine; + + hid_t dataSpace = H5Screate_simple(2, dims, NULL); + hid_t dataSet = H5Dcreate2(restartFile, "turbineStates", H5T_NATIVE_FLOAT, dataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + herr_t status = H5Dwrite(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, turbineStates.data()); + + status = H5Dclose(dataSet); + status = H5Sclose(dataSpace); + + dataSpace = H5Screate_simple(2, dims, NULL); + dataSet = H5Dcreate2(restartFile, "turbineStates_np1", H5T_NATIVE_FLOAT, dataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(dataSet, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, turbineStates_np1.data()); + + status = H5Dclose(dataSet); + status = H5Sclose(dataSpace); + } + + herr_t status = H5Fclose(restartFile); + } + + return 0; + +} + +void SuperController::fastSCInputOutput() { + + // Transfers + // to_SC_np1 <------ ip_from_FAST + // op_to_FAST <------- from_SC_np1, from_SCglob_np1 + + for(int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { + for(int iInput=0; iInput < nCtrl2SC; iInput++) { + to_SC_np1[iTurb*nCtrl2SC + iInput] = 0.0; // Initialize to zero + } + } + + for(int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + for(int iInput=0; iInput < nCtrl2SC; iInput++) { + to_SC_np1[turbineMapProcToGlob[iTurb]*nCtrl2SC + iInput] = ip_from_FAST[iTurb].toSC[iInput] ; + } + } + + if (MPI_COMM_NULL != fastMPIComm) { + MPI_Allreduce(MPI_IN_PLACE, to_SC_np1.data(), nCtrl2SC*nTurbinesGlob, MPI_FLOAT, MPI_SUM, fastMPIComm) ; + } + + for(int iTurb=0; iTurb < nTurbinesProc; iTurb++) { + + for(int iOutput=0; iOutput < nSC2Ctrl; iOutput++) { + op_to_FAST[iTurb].fromSC[iOutput] = from_SC_np1[turbineMapProcToGlob[iTurb]*nSC2Ctrl + iOutput] ; + } + + for(int iOutput=0; iOutput < nSC2CtrlGlob; iOutput++) { + op_to_FAST[iTurb].fromSCglob[iOutput] = from_SCglob_np1[turbineMapProcToGlob[iTurb]*nSC2Ctrl + iOutput] ; + } + + } + +} + + +void SuperController::advanceTime() { + + if (nTurbinesProc > 0) { + + for(int iTurb=0; iTurb < nTurbinesGlob; iTurb++) { + for(int iInput=0; iInput < nCtrl2SC; iInput++) { + to_SC_nm1[iTurb*nCtrl2SC + iInput] = to_SC_n[iTurb*nCtrl2SC + iInput]; + to_SC_n[iTurb*nCtrl2SC + iInput] = to_SC_np1[iTurb*nCtrl2SC + iInput]; +// to_SC_np1[iTurb*nCtrl2SC + iInput] = Predictor? + } + for(int iOutput=0; iOutput < nSC2Ctrl; iOutput++) { + from_SC_nm1[iTurb*nSC2Ctrl + iOutput] = from_SC_n[iTurb*nSC2Ctrl + iOutput]; + from_SC_n[iTurb*nSC2Ctrl + iOutput] = from_SC_np1[iTurb*nSC2Ctrl + iOutput]; + } + } + + for(int iInput=0; iInput < nInpGlobal; iInput++) { + to_SCglob_nm1[iInput] = to_SCglob_n[iInput]; + to_SCglob_n[iInput] = to_SCglob_np1[iInput]; + //to_SCglob_np1[iInput] = Predictor? + } + + for(int iOutput=0; iOutput < nSC2CtrlGlob; iOutput++) { + from_SCglob_nm1[iOutput] = from_SCglob_n[iOutput]; + from_SCglob_n[iOutput] = from_SCglob_np1[iOutput]; + //from_SCglob_np1[iOutput] = Predictor? + } + + for(int iState=0; iState #include -#include "hdf5.h" #include +#include +#include +#include "mpi.h" +#include "hdf5.h" +#include "dlfcn.h" + +class scInitOutData { + +public: + int nInpGlobal; + int nCtrl2SC; + int nSC2CtrlGlob; + int nSC2Ctrl; + std::vector from_SCglob; + std::vector> from_SC; +}; class SuperController { - private: - - int nTurbines; - int nScInputs; - int nScOutputs; +public: + + // Data structures to interface with OpenFAST per turbine + // Unfortunately have to be public + std::vector ip_from_FAST; // At time step 'n+1' + std::vector op_to_FAST; // At time step 'n' + +private: + + MPI_Comm fastMPIComm; + + int nTurbinesGlob; + int nTurbinesProc; + std::map turbineMapProcToGlob; + + int nCtrl2SC; + int nSC2Ctrl; + int nInpGlobal; + int nSC2CtrlGlob; + + int nStatesGlobal; // Global states like time + std::vector globStates; + std::vector globStates_np1; + + int nStatesTurbine; // States for each turbine + std::vector turbineStates ; + std::vector turbineStates_np1 ; + + // Time 'n-1' + std::vector from_SC_nm1; // # outputs from the supercontroller for turbines + std::vector to_SC_nm1; // # inputs to the supercontroller from turbines + std::vector from_SCglob_nm1; // # outputs from the supercontroller for glob + std::vector to_SCglob_nm1; // # inputs to the supercontroller from glob + // Time 'n' + std::vector from_SC_n; // # outputs from the supercontroller for turbines + std::vector to_SC_n; // # inputs to the supercontroller from turbines + std::vector from_SCglob_n; // # outputs from the supercontroller for glob + std::vector to_SCglob_n; // # inputs to the supercontroller from glob + // Time 'n+1' + std::vector from_SC_np1; // # outputs from the supercontroller for turbines + std::vector to_SC_np1; // # inputs to the supercontroller from turbines + std::vector from_SCglob_np1; // # outputs from the supercontroller for glob + std::vector to_SCglob_np1; // # inputs to the supercontroller from glob + + int nParamGlobal; + std::vector paramGlobal; + int nParamTurbine; + std::vector paramTurbine; + + int ErrStat; + char ErrMsg[INTERFACE_STRING_LENGTH]; // make sure this is the same size as IntfStrLen in FAST_Library.f90 + + float d2R = 0.01745329251 ; //Degrees to Radians + + //Supercontroller stuff + std::string scLibFile; + // Dynamic load stuff copied from 'C++ dlopen mini HOWTO' on tldp.org + void *scLibHandle ; + typedef void sc_init_t(int * nTurbinesGlob, int * nInpGlobal, int * nCtrl2SC, int * nParamGlobal, int * nParamTurbine, int * nStatesGlobal, int * nStatesTurbine, int * nSC2CtrlGlob, int * nSC2Ctrl, int *ErrStat, char * ErrMsg); + sc_init_t * sc_init; + bool sc_library_loaded = false; + + typedef void sc_getInitData_t(int * nTurbinesGlob, int * nParamGlobal, int * nParamTurbine, float * paramGlobal, float * paramTurbine, int * nSC2CtrlGlob, float * from_SCglob, int * nSC2Ctrl, float * from_SC, int * nStatesGlobal, float * globStates, int * nStatesTurbine, float * turbineStates, int *ErrStat, char * ErrMsg); + sc_getInitData_t * sc_getInitData; + + typedef void sc_updateStates_t(double * t, int * nTurbinesGlob, int * nParamGlobal, float * paramGlobal, int * nParamTurbine, float * paramTurbine, int * nInpGlobal, float * to_SCglob, int * nCtrl2SC, float * to_SC, int * nStatesGlobal, float * statesGlob_n, float * statesGlob_np1, int * nStatesTurbine, float * statesTurbine_n, float * statesTurbine_np1, int * ErrStat, char * ErrMsg); + sc_updateStates_t * sc_updateStates; + + typedef void sc_calcOutputs_t(double * t, int * nTurbinesGlob, int * nParamGlobal, float * paramGlobal, int * nParamTurbine, float * paramTurbine, int * nInpGlobal, float * to_SCglob, int * nCtrl2SC, float * to_SC, int * nStatesGlobal, float * statesGlob, int * nStatesTurbine, float * statesTurbine, int * nSC2CtrlGlob, float * from_SCglob, int * nSC2Ctrl, float * from_SC, int * ErrStat, char * ErrMsg); + sc_calcOutputs_t * sc_calcOutputs; + + +public: + + SuperController(); + + ~SuperController() ; - int nGlobStates; // Global states like time - double * globStates; + void init(scInitOutData & scio, int nTurbinesProc); + void init_sc(scInitOutData & scio, int inNTurbinesProc, std::map iTurbineMapProcToGlob, MPI_Comm inFastMPIComm); - int nTurbineStates; // States for each turbine - double ** turbineStates ; + void load(int inNTurbinesGlob, std::string inScLibFile, scInitOutData & scio); - double d2R = 0.01745329251 ; //Degrees to Radians + void updateStates(double t) ; //Make a prediction for states at 'n+1' based on inputs and states at 'n' - public: - - SuperController(); + void calcOutputs_n(double t) ; + void calcOutputs_np1(double t) ; - virtual ~SuperController() ; + void fastSCInputOutput() ; // Exchange input output information with OpenFAST turbines - virtual void init(int n, int numScInputs, int numScOutputs); - - virtual void calcOutputs(std::vector & scOutputsGlob) ; + void advanceTime() ; //Advance states to time step 'n+1' - virtual void updateStates(std::vector & scInputsGlob) ; + int writeRestartFile(int n_t_global); - virtual int writeRestartFile(int n_t_global); + int readRestartFile(int n_t_global); - virtual int readRestartFile(int n_t_global); + void end() {} ; }; diff --git a/glue-codes/simulink/examples/Run_OpenLoop.m b/glue-codes/simulink/examples/Run_OpenLoop.m index 2df5fb485c..aa7808de6c 100644 --- a/glue-codes/simulink/examples/Run_OpenLoop.m +++ b/glue-codes/simulink/examples/Run_OpenLoop.m @@ -6,7 +6,7 @@ % addpath(genpath('../../../install')); % cmake default install location % these variables are defined in the OpenLoop model's FAST_SFunc block: -FAST_InputFileName = '../../../reg_tests/r-test/glue-codes/openfast/5MW_Land_DLL_WTurb/5MW_Land_DLL_WTurb.fst'; +FAST_InputFileName = '../../../reg_tests/r-test/glue-codes/openfast/AOC_WSt/AOC_WSt.fst'; TMax = 60; % seconds sim('OpenLoop.mdl',[0,TMax]); diff --git a/modules/aerodyn/src/AeroAcoustics.f90 b/modules/aerodyn/src/AeroAcoustics.f90 index 429b8edd92..e463a8e34e 100644 --- a/modules/aerodyn/src/AeroAcoustics.f90 +++ b/modules/aerodyn/src/AeroAcoustics.f90 @@ -123,10 +123,10 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat / = ErrID_None INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation INTEGER(IntKi) :: simcou,coun ! simple loop counter - INTEGER(IntKi) :: I,J,whichairfoil,K + INTEGER(IntKi) :: I,J,whichairfoil,K,i1_1,i10_1,i1_2,i10_2,iLE character(*), parameter :: RoutineName = 'SetParameters' - LOGICAL :: tr,tri,exist - REAL(ReKi) :: val1,val2,f2,f4,lefttip,rightip,jumpreg + LOGICAL :: tr,tri,exist,LE_flag + REAL(ReKi) :: val1,val10,f2,f4,lefttip,rightip,jumpreg, dist1, dist10 ! Initialize variables for this routine ErrStat = ErrID_None ErrMsg = "" @@ -156,14 +156,18 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) p%KinVisc = InitInp%KinVisc p%SpdSound = InitInp%SpdSound p%HubHeight = InitInp%HubHeight - p%z0_AA = InputFileData%z0_AA + p%Lturb = InputFileData%Lturb p%dy_turb_in = InputFileData%dy_turb_in p%dz_turb_in = InputFileData%dz_turb_in p%NrObsLoc = InputFileData%NrObsLoc p%FTitle = InputFileData%FTitle - call AllocAry(p%TI_Grid_In,size(InputFileData%TI_Grid_In,1), size(InputFileData%TI_Grid_In,2), 'p%TI_Grid_In', errStat2, errMsg2); if(Failed()) return - p%TI_Grid_In=InputFileData%TI_Grid_In + IF ((InputFileData%TICalcMeth==1)) THEN + call AllocAry(p%TI_Grid_In,size(InputFileData%TI_Grid_In,1), size(InputFileData%TI_Grid_In,2), 'p%TI_Grid_In', errStat2, errMsg2); if(Failed()) return + p%TI_Grid_In=InputFileData%TI_Grid_In + ENDIF + + p%AvgV=InputFileData%AvgV ! Copy AFInfo into AA module ! TODO Allocate AFInfo and AFindx variables (DONE AND DONE) @@ -241,18 +245,19 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) call AllocAry(p%StallStart,p%NumBlNds,p%NumBlades,'p%StallStart',ErrStat2,ErrMsg2); if(Failed()) return p%StallStart(:,:) = 0.0_ReKi - do i=1,p%NumBlades - p%TEThick(:,i) = InputFileData%BladeProps(i)%TEThick(:) ! - p%TEAngle(:,i) = InputFileData%BladeProps(i)%TEAngle(:) ! + do i=1,p%NumBlades do j=1,p%NumBlNds - whichairfoil = p%BlAFID(j,i) - if(p%AFInfo(whichairfoil)%NumTabs /=1 ) then - call SetErrStat(ErrID_Fatal, 'Number of airfoil tables within airfoil file different than 1, which is not supported.', ErrStat2, ErrMsg2, RoutineName ) - if(Failed()) return - endif - p%StallStart(j,i) = p%AFInfo(whichairfoil)%Table(1)%UA_BL%alpha1*180/PI ! approximate stall angle of attack [deg] (alpha1 in [rad]) + whichairfoil = p%BlAFID(j,i) + p%TEThick(j,i) = InputFileData%BladeProps(whichairfoil)%TEThick + p%TEAngle(j,i) = InputFileData%BladeProps(whichairfoil)%TEAngle + + if(p%AFInfo(whichairfoil)%NumTabs /=1 ) then + call SetErrStat(ErrID_Fatal, 'Number of airfoil tables within airfoil file different than 1, which is not supported.', ErrStat2, ErrMsg2, RoutineName ) + if(Failed()) return + endif + p%StallStart(j,i) = p%AFInfo(whichairfoil)%Table(1)%UA_BL%alpha1*180/PI ! approximate stall angle of attack [deg] (alpha1 in [rad]) enddo - end do + enddo call AllocAry(p%BlSpn, p%NumBlNds, p%NumBlades, 'p%BlSpn' , ErrStat2, ErrMsg2); if(Failed()) return call AllocAry(p%BlChord, p%NumBlNds, p%NumBlades, 'p%BlChord', ErrStat2, ErrMsg2); if(Failed()) return @@ -340,60 +345,63 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) if(Failed()) return endif - ! If simplified guidati is on, calculate the airfoil thickness from input airfoil coordinates + ! If simplified guidati is on, calculate the airfoil thickness at 1% and at 10% chord from input airfoil coordinates IF (p%IInflow .EQ. 2) THEN - ! Calculate the Thickness @ 1% chord and @ 10% chord (normalized thickness) call AllocAry(p%AFThickGuida,2,size(p%AFInfo), 'p%AFThickGuida', errStat2, errMsg2); if(Failed()) return p%AFThickGuida=0.0_Reki DO k=1,size(p%AFInfo) ! for each airfoil interpolation - tri=.true.;tr=.true.; - do i=2,size(p%AFInfo(k)%X_Coord) - if ( (p%AFInfo(k)%X_Coord(i)+p%AFInfo(k)%Y_Coord(i)) .eq. 0) then - !print*,i - goto 174 - endif - if ( p%AFInfo(k)%X_Coord(i) .eq. 0.1) then - val1=p%AFInfo(k)%Y_Coord(i) - elseif ( (p%AFInfo(k)%X_Coord(i) .lt. 0.1) .and. (tri) ) then - val1=( abs(p%AFInfo(k)%X_Coord(i-1)-0.1)*p%AFInfo(k)%Y_Coord(i) + & - abs(p%AFInfo(k)%X_Coord(i)-0.1)*p%AFInfo(k)%Y_Coord(i-1))/ & - (abs(p%AFInfo(k)%X_Coord(i-1)-0.1)+abs(p%AFInfo(k)%X_Coord(i)-0.1)) - - tri=.false. - elseif (p%AFInfo(k)%X_Coord(i) .eq. 0.01) then - val2=p%AFInfo(k)%Y_Coord(i) - elseif ( (p%AFInfo(k)%X_Coord(i) .lt. 0.01) .and. (tr) ) then - val2=( abs(p%AFInfo(k)%X_Coord(i-1)-0.01)*p%AFInfo(k)%Y_Coord(i) + & - abs(p%AFInfo(k)%X_Coord(i)-0.01)*p%AFInfo(k)%Y_Coord(i-1))/ & - (abs(p%AFInfo(k)%X_Coord(i-1)-0.01)+abs(p%AFInfo(k)%X_Coord(i)-0.01)) - tr=.false. - endif - enddo - - 174 tri=.true.;tr=.true.; - do j=i,size(p%AFInfo(k)%X_Coord) - if ( p%AFInfo(k)%X_Coord(j) .eq. 0.1) then - val1=abs(p%AFInfo(k)%Y_Coord(j)) + abs(val1) - elseif ( (p%AFInfo(k)%X_Coord(j) .gt. 0.1) .and. (tri) ) then - val1=abs(val1)+abs((abs(p%AFInfo(k)%X_Coord(j-1)-0.1)*p%AFInfo(k)%Y_Coord(j)+ & - abs(p%AFInfo(k)%X_Coord(j)-0.1)*p%AFInfo(k)%Y_Coord(j-1))/& - (abs(p%AFInfo(k)%X_Coord(j-1)-0.1)+abs(p%AFInfo(k)%X_Coord(j)-0.1))); - tri=.false. - elseif (p%AFInfo(k)%X_Coord(j) .eq. 0.01) then - val2=abs(p%AFInfo(k)%Y_Coord(j)) + abs(val2) - elseif ( (p%AFInfo(k)%X_Coord(j) .gt. 0.01) .and. (tr) ) then - val2=abs(val2)+abs((abs(p%AFInfo(k)%X_Coord(j-1)-0.01)*p%AFInfo(k)%Y_Coord(j)+ & - abs(p%AFInfo(k)%X_Coord(j)-0.01)*p%AFInfo(k)%Y_Coord(j-1))/& - (abs(p%AFInfo(k)%X_Coord(j-1)-0.01)+abs(p%AFInfo(k)%X_Coord(j)-0.01))); - tr=.false. - endif - enddo - - p%AFThickGuida(1,k)=val2 ! 1 % chord thickness - p%AFThickGuida(2,k)=val1 ! 10 % chord thickness + + ! IF ((MIN(p%AFInfo(k)%X_Coord) < 0.) .or. (MAX(p%AFInfo(k)%X_Coord) > 0.)) THEN + ! call SetErrStat ( ErrID_Fatal,'The coordinates of airfoil '//trim(num2lstr(k))//' are mot defined between x=0 and x=1. Code stops.' ,ErrStat, ErrMsg, RoutineName ) + ! ENDIF + + ! Flip the flag when LE is found and find index + LE_flag = .False. + DO i=3,size(p%AFInfo(k)%X_Coord) + IF (LE_flag .eqv. .False.) THEN + IF (p%AFInfo(k)%X_Coord(i) - p%AFInfo(k)%X_Coord(i-1) > 0.) THEN + LE_flag = .TRUE. + iLE = i + ENDIF + ENDIF + ENDDO + + ! From LE toward TE + dist1 = ABS( p%AFInfo(k)%X_Coord(iLE) - 0.01) + dist10 = ABS( p%AFInfo(k)%X_Coord(iLE) - 0.10) + DO i=iLE+1,size(p%AFInfo(k)%X_Coord) + IF (ABS(p%AFInfo(k)%X_Coord(i) - 0.01) < dist1) THEN + i1_1 = i + dist1 = ABS(p%AFInfo(k)%X_Coord(i) - 0.01) + ENDIF + IF (ABS(p%AFInfo(k)%X_Coord(i) - 0.1) < dist10) THEN + i10_1 = i + dist10 = ABS(p%AFInfo(k)%X_Coord(i) - 0.1) + ENDIF + ENDDO + + ! From TE to LE + dist1 = 0.99 + dist10 = 0.90 + DO i=1,iLE-1 + IF (ABS(p%AFInfo(k)%X_Coord(i) - 0.01) < dist1) THEN + i1_2 = i + dist1 = ABS(p%AFInfo(k)%X_Coord(i) - 0.01) + ENDIF + IF (ABS(p%AFInfo(k)%X_Coord(i) - 0.1) < dist10) THEN + i10_2 = i + dist10 = ABS(p%AFInfo(k)%X_Coord(i) - 0.1) + ENDIF + ENDDO + + val1 = p%AFInfo(k)%Y_Coord(i1_1) - p%AFInfo(k)%Y_Coord(i1_2) + val10 = p%AFInfo(k)%Y_Coord(i10_1) - p%AFInfo(k)%Y_Coord(i10_2) + + p%AFThickGuida(1,k)=val1 ! 1 % chord thickness + p%AFThickGuida(2,k)=val10 ! 10 % chord thickness ENDDO - ENDIF ! If simplified guidati is on, calculate the airfoil thickness + ENDIF !! for turbulence intensity calculations on the fly every 5 meter the whole rotor area is divided vertically to store flow fields in each region jumpreg=7 @@ -648,7 +656,7 @@ subroutine AA_UpdateStates( t, n, m, u, p, xd, errStat, errMsg ) character(ErrMsgLen) :: ErrMsg2 ! temporary Error message character(*), parameter :: RoutineName = 'AA_UpdateStates' REAL(ReKi),DIMENSION(p%NumBlNds,p%numBlades) :: TEMPSTD ! temporary standard deviation variable - REAL(ReKi) :: tempsingle,tempmean,angletemp,abs_le_x ! temporary standard deviation variable + REAL(ReKi) :: tempsingle,tempmean,angletemp,abs_le_x,ti_vx,U1,U2 ! temporary standard deviation variable integer(intKi) :: i,j,k,rco, y0_a,y1_a,z0_a,z1_a logical :: exist REAL(ReKi) :: yi_a,zi_a,yd_a,zd_a,c00_a,c10_a @@ -720,8 +728,16 @@ subroutine AA_UpdateStates( t, n, m, u, p, xd, errStat, errMsg ) yd_a=yi_a-y0_a c00_a=(1.0_ReKi-yd_a)*p%TI_Grid_In(z0_a+1,y0_a+1)+yd_a*p%TI_Grid_In(z0_a+1,y1_a+1) c10_a=(1.0_ReKi-yd_a)*p%TI_Grid_In(z1_a+1,y0_a+1)+yd_a*p%TI_Grid_In(z1_a+1,y1_a+1) - ! 2 points - xd%TIVx(j,i)=(1.0_ReKi-zd_a)*c00_a+zd_a*c10_a + + ! This is the turbulence intensity of the wind at the location of the blade i at node j + ti_vx = (1.0_ReKi-zd_a)*c00_a+zd_a*c10_a + ! With some velocity triangles, we convert it into the incident turbulence intensity, i.e. the TI used by the Amiet model + U1 = u%Vrel(J,I) + U2 = SQRT((p%AvgV*(1.+ti_vx))**2. + U1**2. - p%AvgV**2.) + ! xd%TIVx(j,i)=(U2-U1)/U1 + xd%TIVx(j,i)=p%AvgV*ti_vx/U1 + + if (i.eq.p%NumBlades) then if (j.eq.p%NumBlNds) then endif @@ -1063,8 +1079,8 @@ SUBROUTINE CalcAeroAcousticsOutput(u,p,m,xd,y,errStat,errMsg) !--------Turbulent Boundary Layer Trailing Edge Noise----------------------------! IF ( (p%ITURB .EQ. 1) .or. (p%ITURB .EQ. 2) ) THEN CALL TBLTE(AlphaNoise,p%BlChord(J,I),UNoise,m%ChordAngleTE(K,J,I),m%SpanAngleTE(K,J,I), & - elementspan,m%rTEtoObserve(K,J,I), p, j,i,k,m%d99Var(2),m%dstarVar(1),m%dstarVar(2),p%StallStart(J,I), & - m%SPLP,m%SPLS,m%SPLALPH,m%SPLTBL,errStat2,errMsg2 ) + elementspan,m%rTEtoObserve(K,J,I), p, j,i,k,m%d99Var(2),m%dstarVar(1),m%dstarVar(2),p%StallStart(J,I), & + m%SPLP,m%SPLS,m%SPLALPH,m%SPLTBL,errStat2,errMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (p%ITURB .EQ. 2) THEN m%SPLP=0.0_ReKi;m%SPLS=0.0_ReKi;m%SPLTBL=0.0_ReKi; @@ -1078,9 +1094,9 @@ SUBROUTINE CalcAeroAcousticsOutput(u,p,m,xd,y,errStat,errMsg) !--------Blunt Trailing Edge Noise----------------------------------------------! IF ( p%IBLUNT .EQ. 1 ) THEN CALL BLUNT(AlphaNoise,p%BlChord(J,I),UNoise,m%ChordAngleTE(K,J,I),m%SpanAngleTE(K,J,I), & - elementspan,m%rTEtoObserve(K,J,I),p%TEThick(J,I),p%TEAngle(J,I), & - p, m%d99Var(2),m%dstarVar(1),m%dstarVar(2),m%SPLBLUNT,p%StallStart(J,I),errStat2,errMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + elementspan,m%rTEtoObserve(K,J,I),p%TEThick(J,I),p%TEAngle(J,I), & + p, m%d99Var(2),m%dstarVar(1),m%dstarVar(2),m%SPLBLUNT,p%StallStart(J,I),errStat2,errMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ENDIF !--------Tip Noise--------------------------------------------------------------! IF ( (p%ITIP .EQ. 1) .AND. (J .EQ. p%NumBlNds) ) THEN @@ -1317,7 +1333,7 @@ SUBROUTINE LBLVS(ALPSTAR,C,U,THETA,PHI,L,R,p,d99Var2,dstarVar1,dstarVar2,SPLLAM, CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ENDIF ! compute directivity function - CALL DIRECTH(M,THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_TE(M,THETA,PHI,DBARH,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (DBARH <= 0) THEN @@ -1445,7 +1461,7 @@ SUBROUTINE TBLTE(ALPSTAR,C,U,THETA,PHI,L,R,p,jj,ii,kk,d99Var2,dstarVar1,dstarVar LOGICAL :: SWITCH !!LOGICAL FOR COMPUTATION OF ANGLE OF ATTACK CONTRIBUTION - + ErrStat = ErrID_None ErrMsg = "" @@ -1464,7 +1480,7 @@ SUBROUTINE TBLTE(ALPSTAR,C,U,THETA,PHI,L,R,p,jj,ii,kk,d99Var2,dstarVar1,dstarVar ! Compute directivity function CALL DIRECTL(M,THETA,PHI,DBARL,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL DIRECTH(M,THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_TE(M,THETA,PHI,DBARH,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! IF (DBARH <= 0) THEN ! SPLP = 0. @@ -1618,7 +1634,7 @@ SUBROUTINE TIPNOIS(ALPHTIP,ALPRAT2,C,U ,THETA,PHI, R,p,SPLTIP, errStat, errMsg) ALPTIPP = ABS(ALPHTIP) * ALPRAT2 M = U / p%SpdSound ! MACH NUMBER ! Compute directivity function - CALL DIRECTH(M,THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_TE(M,THETA,PHI,DBARH,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (p%ROUND) THEN L = .008 * ALPTIPP * C ! Eq 63 from BPM Airfoil Self-noise and Prediction paper @@ -1682,7 +1698,6 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE REAL(ReKi) :: Directivity ! Directivity correction factor REAL(ReKi) :: Frequency_cutoff ! Cutoff frequency between REAL(ReKi) :: LFC ! low-frequency correction factor - REAL(ReKi) :: LTurb ! turbulence length scale (isotropic integral scale parameter from IEC standard (Von Karman)) REAL(ReKi) :: Mach ! local mach number REAL(ReKi) :: Sears ! Sears function REAL(ReKi) :: SPLhigh ! predicted high frequency sound pressure level @@ -1705,7 +1720,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE ! This part is recently added for height and surface roughness dependent estimation of turbulence intensity and turbulence scales !%Lturb=300*(Z/300)^(0.46+0.074*log(p%z0_aa)); !% Gives larger length scale - Lturb=25.d0*LE_Location**(0.35)*p%z0_aa**(-0.063) !% Gives smaller length scale ! Wei Jun Zhu, Modeling of Aerodynamically generated Noise From Wind Turbines + ! Lturb=25.d0*LE_Location**(0.35)*p%z0_aa**(-0.063) !% Gives smaller length scale ! Wei Jun Zhu, Modeling of Aerodynamically generated Noise From Wind Turbines ! L_Gammas=0.24+0.096*log10(p%z0_aa)+0.016*(log10(p%z0_aa))**2; !% Can be computed or just give it a value. ! Wei Jun Zhu, Modeling of Aerodynamically generated Noise From Wind Turbines !tinooisess=L_Gammas*log(30.d0/p%z0_aa)/log(LE_Location/p%z0_aa) !% F.E. 16% is 0.16 which is the correct input for SPLhIgh, no need to divide 100 ! ! Wei Jun Zhu, Modeling of Aerodynamically generated Noise From Wind Turbines tinooisess=TINoise @@ -1713,9 +1728,9 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE !tinooisess=0.1 !Ums = (tinooisess*U)**2 !Ums = (tinooisess*8)**2 - CALL DIRECTL(Mach,THETA,PHI,DBARL,errStat2,errMsg2) !yes, assume that noise is low-freq in nature because turbulence length scale is large + CALL DIRECTL(Mach,THETA,PHI,DBARL,errStat2,errMsg2) ! assume that noise is low-freq in nature because turbulence length scale is large CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL DIRECTH(Mach,THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_LE(Mach,THETA,PHI,DBARH,errStat2,errMsg2) ! Directivity for the leading edge at high frequencies CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (DBARH <= 0) THEN SPLti = 0. @@ -1729,7 +1744,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE !*********************************************** Model 1: !!! Nafnoise source code version see below Frequency_cutoff = 10*U/PI/Chord - Ke = 3.0/(4.0*LTurb) + Ke = 3.0/(4.0*p%Lturb) Beta2 = 1-Mach*Mach ALPSTAR = AlphaNoise*PI/180. @@ -1745,10 +1760,10 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE Khat = WaveNumber/Ke ! mu = Mach*WaveNumber*Chord/2.0/Beta2 - SPLhigh = 10.*LOG10(p%AirDens*p%AirDens*p%SpdSound**4*LTurb*(d/2.)/ & + SPLhigh = 10.*LOG10(p%AirDens*p%AirDens*p%SpdSound**4*p%Lturb*(d/2.)/ & (RObs*RObs)*(Mach**5)*tinooisess*tinooisess*(Khat**3)* & (1+Khat**2)**(-7./3.)*Directivity) + 78.4 ! ref a) - !!! SPLhigh = 10.*LOG10(LTurb*(d/2.)/ & + !!! SPLhigh = 10.*LOG10(p%Lturb*(d/2.)/ & !!! (RObs*RObs)*(Mach**5)*tinooisess*tinooisess*(WaveNumber**3) & !!! *(1+WaveNumber**2)**(-7./3.)*Directivity) + 181.3 @@ -1780,7 +1795,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE ! ! corresponding line: Ssq = (2.d0*pi*K/Bsq + (1.d0+2.4d0*K/Bsq)**(-1))**(-1); ! LFC = 10.d0 * Sears*Mach*WaveNumber**2*Beta2**(-1); ! ! corresponding line: LFC = 10.d0 * Ssq*Ma*K**2*Bsq**(-1); -! SPLti(I)=(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*Lturb*d)/(2*RObs*RObs) +! SPLti(I)=(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*p%Lturb*d)/(2*RObs*RObs) ! ! SPLti(I)=SPLti(I)*(Mach**3)*(MeanVnoise**2)*(tinooisess**2) ! SPLti(I)=SPLti(I)*(Mach**3)*(tinooisess**2) ! ! SPLti(I)=SPLti(I)*(Mach**3)*ufluct**2 @@ -1788,14 +1803,14 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE ! SPLti(I)=SPLti(I)*DBARH ! SPLti(I)=10*log10(SPLti(I))+58.4 ! SPLti(I) = SPLti(I) + 10.*LOG10(LFC/(1+LFC)) -! ! SPLti(I)=10.d0*log10(DBARH*p%AirDens**2*p%SpdSound**2*Lturb*d/2.0*Mach**3*tinooisess**2* & +! ! SPLti(I)=10.d0*log10(DBARH*p%AirDens**2*p%SpdSound**2*p%Lturb*d/2.0*Mach**3*tinooisess**2* & ! !WaveNumber**3*(1.d0+WaveNumber**2)**(-7.d0/3.d0)/RObs**2)+58.4d0 + 10.d0*log10(LFC/(1+LFC)) ! ! corresponding line: SPLti(i)=10.d0*log10(Di_hi_fr*Density**2*co**2*Tbscale*L/2.0*Ma ! ! & **3*Tbinten**2*K**3*(1.d0+K**2)**(-7.d0/3.d0)/Distance**2)+58.4d0 ! ! & + 10.d0*log10(LFC/(1+LFC)); ! ! !% ver2.! -! ! Kh = 8.d0*pi*p%FreqList(i)*Lturb/(3.d0*U); -! ! SPLti(i) = 10*log10(DBARH*Lturb*0.5*d*Mach**5*tinooisess**2*Kh**3*(1+Kh**2)**(-7/3)/RObs**2) +& +! ! Kh = 8.d0*pi*p%FreqList(i)*p%Lturb/(3.d0*U); +! ! SPLti(i) = 10*log10(DBARH*p%Lturb*0.5*d*Mach**5*tinooisess**2*Kh**3*(1+Kh**2)**(-7/3)/RObs**2) +& ! ! 10*log10(10**18.13) + 10*log10(DBARH*LFC/(1+LFC)); ! ! ENDDO @@ -1812,7 +1827,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE !!!! ! corresponding line: Ssq = (2.d0*pi*K/Bsq + (1.d0+2.4d0*K/Bsq)**(-1))**(-1); !!!! LFC = 10.d0 * Sears*Mach*WaveNumber**2*Beta2**(-1); !!!! ! corresponding line: LFC = 10.d0 * Ssq*Ma*K**2*Bsq**(-1); -!!!! SPLti(I)=(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*Lturb*d)/(2*RObs*RObs) +!!!! SPLti(I)=(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*p%Lturb*d)/(2*RObs*RObs) !!!! SPLti(I)=SPLti(I)*(Mach**3)*(MeanVnoise**2)*(tinooisess**2) !!!! SPLti(I)=(SPLti(I)*(WaveNumber**3)) / ((1+WaveNumber**2)**(7./3.)) !!!! SPLti(I)=SPLti(I)*DBARH @@ -1866,7 +1881,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE !!!!! ---------------------------- !! CALL DIRECTL(Mach,THETA,PHI,DBARL,errStat2,errMsg2) !yes, assume that noise is low-freq in nature because turbulence length scale is large !! CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) -!! CALL DIRECTH(Mach,THETA,PHI,DBARH,errStat2,errMsg2) +!! CALL DIRECTH_LE(Mach,THETA,PHI,DBARH,errStat2,errMsg2) !! CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) !! IF (DBARH <= 0) THEN !! SPLti = 0. @@ -1888,7 +1903,7 @@ SUBROUTINE InflowNoise(AlphaNoise,Chord,U,THETA,PHI,d,RObs,MeanVNoise,TINoise,LE !! ENDIF !! WaveNumber = PI*p%FreqList(I)*Chord/U !! Beta2 = 1-Mach*Mach -!! SPLhigh = 10.*LOG10(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*LTurb*(d/2.)/(RObs*RObs)*(Mach**3)*Ums* & +!! SPLhigh = 10.*LOG10(p%AirDens*p%AirDens*p%SpdSound*p%SpdSound*p%Lturb*(d/2.)/(RObs*RObs)*(Mach**3)*Ums* & !! (WaveNumber**3)*(1+WaveNumber**2)**(-7./3.)*Directivity) + 58.4 !! Sears = 1/(2*PI*WaveNumber/Beta2+1/(1+2.4*WaveNumber/Beta2)) !! LFC = 10*Sears*Mach*WaveNumber*WaveNumber/Beta2 @@ -1965,7 +1980,7 @@ SUBROUTINE BLUNT(ALPSTAR,C,U ,THETA,PHI,L,R,H,PSI,p,d99Var2,dstarVar1,dstarVar2, HDSTAR = H / DSTRAVG DSTARH = 1. /HDSTAR ! Compute directivity function - CALL DIRECTH(M,THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_TE(M,THETA,PHI,DBARH,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (DBARH <= 0) THEN SPLBLUNT = 0. @@ -2164,8 +2179,8 @@ SUBROUTINE THICK(C,M,RC,ALPSTAR,p,DELTAP,DSTRS,DSTRP,StallVal,errStat,errMsg) ENDIF END SUBROUTINE Thick !==================================================================================================== -!> This subroutine computes the high frequency directivity function for the input observer location -SUBROUTINE DIRECTH(M,THETA,PHI,DBAR, errStat, errMsg) +!> This subroutine computes the high frequency directivity function for the trailing edge +SUBROUTINE DIRECTH_TE(M,THETA,PHI,DBAR, errStat, errMsg) REAL(ReKi), INTENT(IN ) :: THETA ! REAL(ReKi), INTENT(IN ) :: PHI ! REAL(ReKi), INTENT(IN ) :: M ! @@ -2173,7 +2188,7 @@ SUBROUTINE DIRECTH(M,THETA,PHI,DBAR, errStat, errMsg) INTEGER(IntKi), INTENT( OUT) :: errStat ! Error status of the operation character(*), INTENT( OUT) :: errMsg ! Error message if ErrStat /= ErrID_None ! Local variables - character(*), parameter :: RoutineName = 'Directh' + character(*), parameter :: RoutineName = 'Directh_te' real(ReKi) :: MC real(ReKi) :: DEGRAD real(ReKi) :: PHIR @@ -2185,7 +2200,30 @@ SUBROUTINE DIRECTH(M,THETA,PHI,DBAR, errStat, errMsg) THETAR = THETA * DEGRAD PHIR = PHI * DEGRAD DBAR = 2.*SIN(THETAR/2.)**2.*SIN(PHIR)**2./((1.+M*COS(THETAR))* (1.+(M-MC)*COS(THETAR))**2.) ! eq B1 in BPM Airfoil Self-noise and Prediction paper -END SUBROUTINE DirectH +END SUBROUTINE DIRECTH_TE + +!==================================================================================================== +!> This subroutine computes the high frequency directivity function for the leading edge +SUBROUTINE DIRECTH_LE(M,THETA,PHI,DBAR, errStat, errMsg) + REAL(ReKi), INTENT(IN ) :: THETA ! + REAL(ReKi), INTENT(IN ) :: PHI ! + REAL(ReKi), INTENT(IN ) :: M ! + REAL(ReKi), INTENT( OUT) :: DBAR ! + INTEGER(IntKi), INTENT( OUT) :: errStat ! Error status of the operation + character(*), INTENT( OUT) :: errMsg ! Error message if ErrStat /= ErrID_None + ! Local variables + character(*), parameter :: RoutineName = 'Directh_le' + real(ReKi) :: DEGRAD + real(ReKi) :: PHIR + real(ReKi) :: THETAR + ErrStat = ErrID_None + ErrMsg = "" + DEGRAD = .017453 + THETAR = THETA * DEGRAD + PHIR = PHI * DEGRAD + DBAR = 2.*COS(THETAR/2.)**2.*SIN(PHIR)**2./(1.+M*COS(THETAR))**3. +END SUBROUTINE DIRECTH_LE + !==================================================================================================== !> This subroutine computes the high frequency directivity function for the input observer location ! Paper: @@ -2210,7 +2248,7 @@ SUBROUTINE DIRECTL(M,THETA,PHI,DBAR, errStat, errMsg) THETAR = THETA * DEGRAD PHIR = PHI * DEGRAD DBAR = (SIN(THETAR)*SIN(PHIR))**2/(1.+M*COS(THETAR))**4 ! eq B2 in BPM Airfoil Self-noise and Prediction paper -END SUBROUTINE DirectL +END SUBROUTINE DIRECTL !==================================================================================================================================! !=============================== Simplified Guidati Inflow Turbulence Noise Addition =============================================! !==================================================================================================================================! @@ -2294,7 +2332,7 @@ SUBROUTINE TBLTE_TNO(ALPSTAR,C,U,THETA,PHI,D,R,Cfall,d99all,EdgeVelAll,p,SPLP,SP Mach = U / p%SpdSound ! Directivity function - CALL DIRECTH(REAL(Mach),THETA,PHI,DBARH,errStat2,errMsg2) + CALL DIRECTH_TE(REAL(Mach),THETA,PHI,DBARH,errStat2,errMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsgn, RoutineName ) do i_omega = 1,n_freq diff --git a/modules/aerodyn/src/AeroAcoustics_IO.f90 b/modules/aerodyn/src/AeroAcoustics_IO.f90 index 76e4e02c68..1fde6bc868 100644 --- a/modules/aerodyn/src/AeroAcoustics_IO.f90 +++ b/modules/aerodyn/src/AeroAcoustics_IO.f90 @@ -76,7 +76,6 @@ SUBROUTINE ReadInputFiles( InputFileName, BL_Files, InputFileData, Default_DT, O INTEGER(IntKi) :: I INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - CHARACTER(1024) :: AABlFile(MaxBl) ! File that contains the blade information (specified in the primary input file) CHARACTER(*), PARAMETER :: RoutineName = 'ReadInputFiles' ! initialize values: ErrStat = ErrID_None @@ -85,29 +84,23 @@ SUBROUTINE ReadInputFiles( InputFileName, BL_Files, InputFileData, Default_DT, O ! Reads the module input-file data - CALL ReadPrimaryFile( InputFileName, InputFileData, AABlFile, Default_DT, OutFileRoot, UnEcho, ErrStat2, ErrMsg2 ) + CALL ReadPrimaryFile( InputFileName, InputFileData, Default_DT, OutFileRoot, UnEcho, ErrStat2, ErrMsg2 ) if(Failed()) return ! get the blade input-file data - ALLOCATE( InputFileData%BladeProps( NumBlades ), STAT = ErrStat2 ) + ALLOCATE( InputFileData%BladeProps( size(BL_Files) ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating memory for BladeProps.", ErrStat, ErrMsg, RoutineName) return END IF - do i = 1,NumBlades - CALL ReadBladeInputs ( AABlFile(i), InputFileData%BladeProps(i), UnEcho, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName//TRIM(':Blade')//TRIM(Num2LStr(I))) - if(Failed()) return - end do - - if ((InputFileData%ITURB.eq.2) .or. (InputFileData%X_BLMethod.eq.2)) then + if ((InputFileData%ITURB==2) .or. (InputFileData%X_BLMethod==2) .or. (InputFileData%IBLUNT==1)) then ! We need to read the BL tables - CALL ReadBLTables( InputFileName, BL_Files, InputFileData, InputFileData%BladeProps(1)%NumBlNds, ErrStat2, ErrMsg2 ) + CALL ReadBLTables( InputFileName, BL_Files, InputFileData, ErrStat2, ErrMsg2 ) if (Failed())return endif - IF( (InputFileData%TICalcMeth.eq.1) ) THEN + IF( (InputFileData%TICalcMeth==1) ) THEN CALL REadTICalcTables(InputFileName,InputFileData, ErrStat2, ErrMsg2); if(Failed()) return ENDIF @@ -121,11 +114,10 @@ END SUBROUTINE ReadInputFiles !---------------------------------------------------------------------------------------------------------------------------------- !> This routine reads in the primary Noise input file and places the values it reads in the InputFileData structure. ! It opens and prints to an echo file if requested. -SUBROUTINE ReadPrimaryFile( InputFile, InputFileData, AABlFile, Default_DT, OutFileRoot, UnEc, ErrStat, ErrMsg ) +SUBROUTINE ReadPrimaryFile( InputFile, InputFileData, Default_DT, OutFileRoot, UnEc, ErrStat, ErrMsg ) integer(IntKi), intent(out) :: UnEc ! I/O unit for echo file. If > 0, file is open for writing. integer(IntKi), intent(out) :: ErrStat ! Error status REAL(DbKi), INTENT(IN) :: Default_DT ! The default DT (from glue code) - character(*), intent(out) :: AABlFile(MaxBl) ! name of the files containing blade inputs character(*), intent(in) :: InputFile ! Name of the file containing the primary input data character(*), intent(out) :: ErrMsg ! Error message character(*), intent(in) :: OutFileRoot ! The rootname of the echo file, possibly opened in this routine @@ -221,7 +213,7 @@ SUBROUTINE ReadPrimaryFile( InputFile, InputFileData, AABlFile, Default_DT, Out CALL ReadVar(UnIn,InputFile,InputFileData%IInflow ,"InflowMod" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVar(UnIn,InputFile,InputFileData%TICalcMeth ,"TICalcMeth" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVAr(UnIn,InputFile,InputFileData%TICalcTabFile,"TICalcTabFile","" ,ErrStat2,ErrMsg2,UnEc); call check - CALL ReadVar(UnIn,InputFile,InputFileData%z0_AA ,"SurfRoughness","" ,ErrStat2,ErrMsg2,UnEc); call check + CALL ReadVar(UnIn,InputFile,InputFileData%Lturb ,"Lturb" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVar(UnIn,InputFile,InputFileData%ITURB ,"TurbMod" ,"" ,ErrStat2,ErrMsg2,UnEc); call check ! ITURB - TBLTE NOISE CALL ReadVar(UnIn,InputFile,InputFileData%X_BLMethod ,"BLMod" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVar(UnIn,InputFile,InputFileData%ITRIP ,"TripMod" ,"" ,ErrStat2,ErrMsg2,UnEc); call check @@ -230,12 +222,6 @@ SUBROUTINE ReadPrimaryFile( InputFile, InputFileData, AABlFile, Default_DT, Out CALL ReadVar(UnIn,InputFile,InputFileData%ROUND ,"RoundTip" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVar(UnIn,InputFile,InputFileData%ALPRAT ,"ALPRAT" ,"" ,ErrStat2,ErrMsg2,UnEc); call check CALL ReadVar(UnIn,InputFile,InputFileData%IBLUNT ,"BluntMod" ,"" ,ErrStat2,ErrMsg2,UnEc); call check - - ! AABlFile - Names of files containing distributed aerodynamic properties for each blade (see AA_BladeInputFile type): - DO I = 1,MaxBl - CALL ReadVar ( UnIn, InputFile, AABlFile(I), 'AABlFile('//TRIM(Num2Lstr(I))//')', 'Name of file containing distributed aerodynamic properties for blade '//TRIM(Num2Lstr(I)), ErrStat2, ErrMsg2, UnEc ); call check - IF ( PathIsRelative( AABlFile(I) ) ) AABlFile(I) = TRIM(PriPath)//TRIM(AABlFile(I)) - END DO ! Return on error at end of section IF ( ErrStat >= AbortErrLev ) THEN @@ -307,58 +293,6 @@ END SUBROUTINE Cleanup !............................................................................................................................... END SUBROUTINE ReadPrimaryFile !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine reads a blade input file. -SUBROUTINE ReadBladeInputs ( AABlFile, BladeKInputFileData, UnEc, ErrStat, ErrMsg ) - TYPE(AA_BladePropsType), INTENT(INOUT) :: BladeKInputFileData ! Data for Blade K stored in the module's input file - CHARACTER(*), INTENT(IN) :: AABlFile ! Name of the blade input file data - INTEGER(IntKi), INTENT(IN) :: UnEc ! I/O unit for echo file. If present and > 0, write to UnEc - INTEGER(IntKi), INTENT(OUT) :: ErrStat ! Error status - CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message - ! Local variables: - INTEGER(IntKi) :: I ! A generic DO index. - INTEGER( IntKi ) :: UnIn ! Unit number for reading file - INTEGER(IntKi) :: ErrStat2 , IOS ! Temporary Error status - CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Err msg - CHARACTER(*), PARAMETER :: RoutineName = 'ReadBladeInputs' - ErrStat = ErrID_None - ErrMsg = "" - UnIn = -1 - ! Allocate space for these variables - CALL GetNewUnit (UnIn, ErrStat2, ErrMsg2 ); if(Failed()) return - CALL OpenFInpFile (UnIn, AABlFile, ErrStat2, ErrMsg2 ); if(Failed()) return - ! -------------- HEADER ------------------------------------------------------- - ! Skip the header. - CALL ReadCom ( UnIn, AABlFile, 'unused blade file header line 1', ErrStat2, ErrMsg2, UnEc ); if(Failed()) return - CALL ReadCom ( UnIn, AABlFile, 'unused blade file header line 2', ErrStat2, ErrMsg2, UnEc ); if(Failed()) return - ! -------------- Blade properties table ------------------------------------------ - CALL ReadCom ( UnIn, AABlFile, 'Section header: Blade Properties', ErrStat2, ErrMsg2, UnEc ); if(Failed()) return - ! NumBlNds - Number of blade nodes used in the analysis (-): - CALL ReadVar( UnIn, AABlFile, BladeKInputFileData%NumBlNds, "NumBlNds", "Number of blade nodes used in the analysis (-)", ErrStat2, ErrMsg2, UnEc); if(Failed()) return - CALL ReadCom ( UnIn, AABlFile, 'Table header: names', ErrStat2, ErrMsg2, UnEc ); if(Failed()) return - CALL ReadCom ( UnIn, AABlFile, 'Table header: units', ErrStat2, ErrMsg2, UnEc ); if(Failed()) return - ! allocate space for blade inputs: - CALL AllocAry(BladeKInputFileData%TEAngle ,BladeKInputFileData%NumBlNds,'TEAngle' ,ErrStat2,ErrMsg2); if(Failed()) return - CALL AllocAry(BladeKInputFileData%TEThick ,BladeKInputFileData%NumBlNds,'TEThick' ,ErrStat2,ErrMsg2); if(Failed()) return - CALL AllocAry(BladeKInputFileData%StallStart,BladeKInputFileData%NumBlNds,'StallStart',ErrStat2,ErrMsg2); if(Failed()) return - DO I=1,BladeKInputFileData%NumBlNds - READ( UnIn, *, IOStat=IOS ) BladeKInputFileData%TEAngle(I), BladeKInputFileData%TEThick(I) - CALL CheckIOS( IOS, AABlFile, 'Blade properties row '//TRIM(Num2LStr(I)), NumType, ErrStat2, ErrMsg2); if(Failed()) return - IF (UnEc > 0) THEN - WRITE( UnEc, "(6(F9.4,1x),I9)", IOStat=IOS) BladeKInputFileData%TEAngle(I), BladeKInputFileData%TEThick(I) - END IF - END DO - ! -------------- END OF FILE -------------------------------------------- - CALL Cleanup() -CONTAINS - logical function Failed() - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - Failed = ErrStat >= AbortErrLev - if(Failed) call cleanup() - end function Failed - SUBROUTINE Cleanup() - IF (UnIn > 0) CLOSE(UnIn) - END SUBROUTINE Cleanup -END SUBROUTINE ReadBladeInputs ! ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -388,12 +322,11 @@ subroutine ReadRealMatrix(fid, FileName, Mat, VarName, nLines,nRows, iStat, Msg, -SUBROUTINE ReadBLTables( InputFile,BL_Files,InputFileData, nAirfoils, ErrStat, ErrMsg ) +SUBROUTINE ReadBLTables( InputFile, BL_Files, InputFileData, ErrStat, ErrMsg ) ! Passed variables character(*), intent(in) :: InputFile ! Name of the file containing the primary input data character(*), dimension(:), intent(in) :: BL_Files ! Name of the file containing the primary input data -type(AA_InputFile), intent(inout) :: InputFileData ! All the data in the Noise input file - integer(IntKi), intent(in) :: nAirfoils ! Number of Airfoil tables +type(AA_InputFile), intent(inout) :: InputFileData ! All the data in the Noise input file integer(IntKi), intent(out) :: ErrStat ! Error status character(*), intent(out) :: ErrMsg ! Error message ! Local variables: @@ -406,7 +339,7 @@ SUBROUTINE ReadBLTables( InputFile,BL_Files,InputFileData, nAirfoils, ErrStat, E character(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") character(*), parameter :: RoutineName = 'readbltable' - integer(IntKi) :: nRe, nAoA ! Number of Reynolds number and angle of attack listed + integer(IntKi) :: nRe, nAoA, nAirfoils ! Number of Reynolds number, angle of attack, and number of airfoils listed integer(IntKi) :: iAF , iRe, iAoA, iDummy, iBuffer ! loop counters real(DbKi),dimension(:,:),ALLOCATABLE :: Buffer integer :: iLine @@ -415,7 +348,7 @@ SUBROUTINE ReadBLTables( InputFile,BL_Files,InputFileData, nAirfoils, ErrStat, E ErrMsg = "" CALL GetPath( InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. - + nAirfoils = size(BL_Files) do iAF=1,nAirfoils FileName = trim(BL_Files(iAF)) @@ -474,6 +407,17 @@ SUBROUTINE ReadBLTables( InputFile,BL_Files,InputFileData, nAirfoils, ErrStat, E InputFileData%AoAListBL(iAoA)= Buffer(iAoA, 1) ! AoA enddo endif + + if (InputFileData%IBLUNT==1) then + call ReadCom(UnIn, FileName, 'Comment' , ErrStat2, ErrMsg2) + call ReadCom(UnIn, FileName, 'Comment' , ErrStat2, ErrMsg2) + call ReadVar(UnIn, FileName, InputFileData%BladeProps(iAF)%TEAngle, 'TEAngle', 'TE Angle',ErrStat2, ErrMsg2); if(Failed()) return + call ReadVar(UnIn, FileName, InputFileData%BladeProps(iAF)%TEThick, 'TEThick', 'TE Thick',ErrStat2, ErrMsg2); if(Failed()) return + else + InputFileData%BladeProps(iAF)%TEAngle = 0._ReKi + InputFileData%BladeProps(iAF)%TEThick = 0._ReKi + endif + if (UnIn > 0) CLOSE(UnIn) enddo @@ -520,7 +464,8 @@ SUBROUTINE ReadTICalcTables(InputFile, InputFileData, ErrStat, ErrMsg) CALL GetNewUnit( UnIn, ErrStat2, ErrMsg2); call check() CALL OpenFInpFile ( UnIn, FileName, ErrStat2, ErrMsg2 ); if(Failed()) return - + CALL ReadCom(UnIn, FileName, 'Text Line', ErrStat2, ErrMsg2); call check + CALL ReadVar(UnIn, FileName, InputFileData%AvgV, 'AvgV', 'Echo flag', ErrStat2, ErrMsg2); call check CALL ReadCom(UnIn, FileName, 'Text Line', ErrStat2, ErrMsg2); call check CALL ReadVar(UnIn, FileName, GridY, 'GridY', 'Echo flag', ErrStat2, ErrMsg2); call check CALL ReadCom(UnIn, FileName, 'Text Line', ErrStat2, ErrMsg2);call check diff --git a/modules/aerodyn/src/AeroAcoustics_Registry.txt b/modules/aerodyn/src/AeroAcoustics_Registry.txt index b5d1a865ee..ec84c4c062 100644 --- a/modules/aerodyn/src/AeroAcoustics_Registry.txt +++ b/modules/aerodyn/src/AeroAcoustics_Registry.txt @@ -20,17 +20,14 @@ usefrom AirfoilInfo_Registry.txt # ..... Input file data ........................................................................................................... # This is data defined in the Input File for this module (or could otherwise be passed in) # ..... Blade Input file data ..................................................................................................... -typedef AeroAcoustics/AA AA_BladePropsType IntKi NumBlNds - - - "Number of blade nodes used in the analysis" - -typedef ^ AA_BladePropsType ReKi TEThick {:} - - "" - -typedef ^ AA_BladePropsType ReKi StallStart {:} - - "" - -typedef ^ AA_BladePropsType ReKi TEAngle {:} - - "" - -typedef ^ AA_BladePropsType ReKi AerCent {:} - - "" - +typedef AeroAcoustics/AA AA_BladePropsType ReKi TEThick - - - "" - +typedef ^ AA_BladePropsType ReKi TEAngle - - - "" - # # ..... Initialization data ....................................................................................................... # Define inputs that the initialization routine may need here: typedef AeroAcoustics/AA InitInputType CHARACTER(1024) InputFile - - - "Name of the input file" - typedef ^ InitInputType IntKi NumBlades - - - "Number of blades on the turbine" -typedef ^ InitInputType IntKi NumBlNds - - - "Number of blades on the turbine" +typedef ^ InitInputType IntKi NumBlNds - - - "Number of blade nodes" typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - typedef ^ InitInputType ReKi BlSpn {:}{:} - - "Span at blade node" m typedef ^ InitInputType ReKi BlChord {:}{:} - - "Chord at blade node" m @@ -80,7 +77,8 @@ typedef ^ AA_InputFile CHARACTER(1024) AAoutfi typedef ^ AA_InputFile CHARACTER(1024) TICalcTabFile - - - "Name of the file containing the table for incident turbulence intensity" - typedef ^ AA_InputFile CHARACTER(1024) FTitle - - - "File Title: the 2nd line of the input file, which contains a description of its contents" - typedef ^ AA_InputFile DBKi AAStart - - - "Time after which to calculate AA" s -typedef ^ AA_InputFile ReKi z0_AA - - - "Surface roughness" - +typedef ^ AA_InputFile ReKi Lturb - - - "Turbulent lengthscale in Amiet model" - +typedef ^ AA_InputFile ReKi AvgV - - - "Average wind speed to compute incident turbulence intensity" m typedef ^ AA_InputFile ReKi ReListBL {:} - - "" typedef ^ AA_InputFile ReKi AoAListBL {:} - - "" deg typedef ^ AA_InputFile ReKi Pres_DispThick {:}{:}{:} - - "" @@ -185,7 +183,8 @@ typedef ^ ParameterType IntKi total_s typedef ^ ParameterType IntKi total_sampleTI - - - "Total FFT Sample amount for dissipation calculation" - typedef ^ ParameterType IntKi AA_Bl_Prcntge - - - "The Percentage of the Blade which the noise is calculated" % typedef ^ ParameterType IntKi startnode - - - "Corersponding node to the noise calculation percentage of the blade" - -typedef ^ ParameterType ReKi z0_aa - - - "Surface roughness" m +typedef ^ ParameterType ReKi Lturb - - - "Turbulent lengthscale in Amiet model" m +typedef ^ ParameterType ReKi AvgV - - - "Average wind speed to compute incident turbulence intensity" m typedef ^ ParameterType ReKi dz_turb_in - - - "" m typedef ^ ParameterType ReKi dy_turb_in - - - "" m typedef ^ ParameterType ReKi TI_Grid_In {:}{:} - - "" diff --git a/modules/aerodyn/src/AeroAcoustics_Types.f90 b/modules/aerodyn/src/AeroAcoustics_Types.f90 index 9ed3b64f53..21b3557bce 100644 --- a/modules/aerodyn/src/AeroAcoustics_Types.f90 +++ b/modules/aerodyn/src/AeroAcoustics_Types.f90 @@ -36,18 +36,15 @@ MODULE AeroAcoustics_Types IMPLICIT NONE ! ========= AA_BladePropsType ======= TYPE, PUBLIC :: AA_BladePropsType - INTEGER(IntKi) :: NumBlNds !< Number of blade nodes used in the analysis [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TEThick !< [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: StallStart !< [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TEAngle !< [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: AerCent !< [-] + REAL(ReKi) :: TEThick !< [-] + REAL(ReKi) :: TEAngle !< [-] END TYPE AA_BladePropsType ! ======================= ! ========= AA_InitInputType ======= TYPE, PUBLIC :: AA_InitInputType CHARACTER(1024) :: InputFile !< Name of the input file [-] INTEGER(IntKi) :: NumBlades !< Number of blades on the turbine [-] - INTEGER(IntKi) :: NumBlNds !< Number of blades on the turbine [-] + INTEGER(IntKi) :: NumBlNds !< Number of blade nodes [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BlSpn !< Span at blade node [m] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BlChord !< Chord at blade node [m] @@ -100,7 +97,8 @@ MODULE AeroAcoustics_Types CHARACTER(1024) :: TICalcTabFile !< Name of the file containing the table for incident turbulence intensity [-] CHARACTER(1024) :: FTitle !< File Title: the 2nd line of the input file, which contains a description of its contents [-] REAL(DbKi) :: AAStart !< Time after which to calculate AA [s] - REAL(ReKi) :: z0_AA !< Surface roughness [-] + REAL(ReKi) :: Lturb !< Turbulent lengthscale in Amiet model [-] + REAL(ReKi) :: AvgV !< Average wind speed to compute incident turbulence intensity [m] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: ReListBL !< [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: AoAListBL !< [deg] REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: Pres_DispThick !< [-] @@ -213,7 +211,8 @@ MODULE AeroAcoustics_Types INTEGER(IntKi) :: total_sampleTI !< Total FFT Sample amount for dissipation calculation [-] INTEGER(IntKi) :: AA_Bl_Prcntge !< The Percentage of the Blade which the noise is calculated [%] INTEGER(IntKi) :: startnode !< Corersponding node to the noise calculation percentage of the blade [-] - REAL(ReKi) :: z0_aa !< Surface roughness [m] + REAL(ReKi) :: Lturb !< Turbulent lengthscale in Amiet model [m] + REAL(ReKi) :: AvgV !< Average wind speed to compute incident turbulence intensity [m] REAL(ReKi) :: dz_turb_in !< [m] REAL(ReKi) :: dy_turb_in !< [m] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: TI_Grid_In !< [-] @@ -297,55 +296,8 @@ SUBROUTINE AA_CopyBladePropsType( SrcBladePropsTypeData, DstBladePropsTypeData, ! ErrStat = ErrID_None ErrMsg = "" - DstBladePropsTypeData%NumBlNds = SrcBladePropsTypeData%NumBlNds -IF (ALLOCATED(SrcBladePropsTypeData%TEThick)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%TEThick,1) - i1_u = UBOUND(SrcBladePropsTypeData%TEThick,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%TEThick)) THEN - ALLOCATE(DstBladePropsTypeData%TEThick(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%TEThick.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF DstBladePropsTypeData%TEThick = SrcBladePropsTypeData%TEThick -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%StallStart)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%StallStart,1) - i1_u = UBOUND(SrcBladePropsTypeData%StallStart,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%StallStart)) THEN - ALLOCATE(DstBladePropsTypeData%StallStart(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%StallStart.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%StallStart = SrcBladePropsTypeData%StallStart -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%TEAngle)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%TEAngle,1) - i1_u = UBOUND(SrcBladePropsTypeData%TEAngle,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%TEAngle)) THEN - ALLOCATE(DstBladePropsTypeData%TEAngle(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%TEAngle.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF DstBladePropsTypeData%TEAngle = SrcBladePropsTypeData%TEAngle -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%AerCent)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%AerCent,1) - i1_u = UBOUND(SrcBladePropsTypeData%AerCent,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%AerCent)) THEN - ALLOCATE(DstBladePropsTypeData%AerCent(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%AerCent.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%AerCent = SrcBladePropsTypeData%AerCent -ENDIF END SUBROUTINE AA_CopyBladePropsType SUBROUTINE AA_DestroyBladePropsType( BladePropsTypeData, ErrStat, ErrMsg ) @@ -357,18 +309,6 @@ SUBROUTINE AA_DestroyBladePropsType( BladePropsTypeData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(BladePropsTypeData%TEThick)) THEN - DEALLOCATE(BladePropsTypeData%TEThick) -ENDIF -IF (ALLOCATED(BladePropsTypeData%StallStart)) THEN - DEALLOCATE(BladePropsTypeData%StallStart) -ENDIF -IF (ALLOCATED(BladePropsTypeData%TEAngle)) THEN - DEALLOCATE(BladePropsTypeData%TEAngle) -ENDIF -IF (ALLOCATED(BladePropsTypeData%AerCent)) THEN - DEALLOCATE(BladePropsTypeData%AerCent) -ENDIF END SUBROUTINE AA_DestroyBladePropsType SUBROUTINE AA_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -406,27 +346,8 @@ SUBROUTINE AA_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, E Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! NumBlNds - Int_BufSz = Int_BufSz + 1 ! TEThick allocated yes/no - IF ( ALLOCATED(InData%TEThick) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TEThick upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TEThick) ! TEThick - END IF - Int_BufSz = Int_BufSz + 1 ! StallStart allocated yes/no - IF ( ALLOCATED(InData%StallStart) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! StallStart upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%StallStart) ! StallStart - END IF - Int_BufSz = Int_BufSz + 1 ! TEAngle allocated yes/no - IF ( ALLOCATED(InData%TEAngle) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TEAngle upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TEAngle) ! TEAngle - END IF - Int_BufSz = Int_BufSz + 1 ! AerCent allocated yes/no - IF ( ALLOCATED(InData%AerCent) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! AerCent upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%AerCent) ! AerCent - END IF + Re_BufSz = Re_BufSz + 1 ! TEThick + Re_BufSz = Re_BufSz + 1 ! TEAngle IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -454,68 +375,10 @@ SUBROUTINE AA_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, E Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = InData%NumBlNds - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%TEThick) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TEThick,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TEThick,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TEThick,1), UBOUND(InData%TEThick,1) - ReKiBuf(Re_Xferred) = InData%TEThick(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%StallStart) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%StallStart,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StallStart,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%StallStart,1), UBOUND(InData%StallStart,1) - ReKiBuf(Re_Xferred) = InData%StallStart(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TEAngle) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TEAngle,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TEAngle,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TEAngle,1), UBOUND(InData%TEAngle,1) - ReKiBuf(Re_Xferred) = InData%TEAngle(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%AerCent) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AerCent,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AerCent,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%AerCent,1), UBOUND(InData%AerCent,1) - ReKiBuf(Re_Xferred) = InData%AerCent(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF + ReKiBuf(Re_Xferred) = InData%TEThick + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%TEAngle + Re_Xferred = Re_Xferred + 1 END SUBROUTINE AA_PackBladePropsType SUBROUTINE AA_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -548,80 +411,10 @@ SUBROUTINE AA_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%NumBlNds = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TEThick not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TEThick)) DEALLOCATE(OutData%TEThick) - ALLOCATE(OutData%TEThick(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TEThick.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TEThick,1), UBOUND(OutData%TEThick,1) - OutData%TEThick(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StallStart not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%StallStart)) DEALLOCATE(OutData%StallStart) - ALLOCATE(OutData%StallStart(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StallStart.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%StallStart,1), UBOUND(OutData%StallStart,1) - OutData%StallStart(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TEAngle not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TEAngle)) DEALLOCATE(OutData%TEAngle) - ALLOCATE(OutData%TEAngle(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TEAngle.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TEAngle,1), UBOUND(OutData%TEAngle,1) - OutData%TEAngle(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AerCent not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AerCent)) DEALLOCATE(OutData%AerCent) - ALLOCATE(OutData%AerCent(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AerCent.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%AerCent,1), UBOUND(OutData%AerCent,1) - OutData%AerCent(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF + OutData%TEThick = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%TEAngle = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 END SUBROUTINE AA_UnPackBladePropsType SUBROUTINE AA_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) @@ -1924,7 +1717,8 @@ SUBROUTINE AA_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrSt DstInputFileData%TICalcTabFile = SrcInputFileData%TICalcTabFile DstInputFileData%FTitle = SrcInputFileData%FTitle DstInputFileData%AAStart = SrcInputFileData%AAStart - DstInputFileData%z0_AA = SrcInputFileData%z0_AA + DstInputFileData%Lturb = SrcInputFileData%Lturb + DstInputFileData%AvgV = SrcInputFileData%AvgV IF (ALLOCATED(SrcInputFileData%ReListBL)) THEN i1_l = LBOUND(SrcInputFileData%ReListBL,1) i1_u = UBOUND(SrcInputFileData%ReListBL,1) @@ -2255,7 +2049,8 @@ SUBROUTINE AA_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Int_BufSz = Int_BufSz + 1*LEN(InData%TICalcTabFile) ! TICalcTabFile Int_BufSz = Int_BufSz + 1*LEN(InData%FTitle) ! FTitle Db_BufSz = Db_BufSz + 1 ! AAStart - Re_BufSz = Re_BufSz + 1 ! z0_AA + Re_BufSz = Re_BufSz + 1 ! Lturb + Re_BufSz = Re_BufSz + 1 ! AvgV Int_BufSz = Int_BufSz + 1 ! ReListBL allocated yes/no IF ( ALLOCATED(InData%ReListBL) ) THEN Int_BufSz = Int_BufSz + 2*1 ! ReListBL upper/lower bounds for each dimension @@ -2485,7 +2280,9 @@ SUBROUTINE AA_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg END DO ! I DbKiBuf(Db_Xferred) = InData%AAStart Db_Xferred = Db_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%z0_AA + ReKiBuf(Re_Xferred) = InData%Lturb + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AvgV Re_Xferred = Re_Xferred + 1 IF ( .NOT. ALLOCATED(InData%ReListBL) ) THEN IntKiBuf( Int_Xferred ) = 0 @@ -2944,7 +2741,9 @@ SUBROUTINE AA_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err END DO ! I OutData%AAStart = DbKiBuf(Db_Xferred) Db_Xferred = Db_Xferred + 1 - OutData%z0_AA = ReKiBuf(Re_Xferred) + OutData%Lturb = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AvgV = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ReListBL not allocated Int_Xferred = Int_Xferred + 1 @@ -6051,7 +5850,8 @@ SUBROUTINE AA_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) DstParamData%total_sampleTI = SrcParamData%total_sampleTI DstParamData%AA_Bl_Prcntge = SrcParamData%AA_Bl_Prcntge DstParamData%startnode = SrcParamData%startnode - DstParamData%z0_aa = SrcParamData%z0_aa + DstParamData%Lturb = SrcParamData%Lturb + DstParamData%AvgV = SrcParamData%AvgV DstParamData%dz_turb_in = SrcParamData%dz_turb_in DstParamData%dy_turb_in = SrcParamData%dy_turb_in IF (ALLOCATED(SrcParamData%TI_Grid_In)) THEN @@ -6634,7 +6434,8 @@ SUBROUTINE AA_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Int_BufSz = Int_BufSz + 1 ! total_sampleTI Int_BufSz = Int_BufSz + 1 ! AA_Bl_Prcntge Int_BufSz = Int_BufSz + 1 ! startnode - Re_BufSz = Re_BufSz + 1 ! z0_aa + Re_BufSz = Re_BufSz + 1 ! Lturb + Re_BufSz = Re_BufSz + 1 ! AvgV Re_BufSz = Re_BufSz + 1 ! dz_turb_in Re_BufSz = Re_BufSz + 1 ! dy_turb_in Int_BufSz = Int_BufSz + 1 ! TI_Grid_In allocated yes/no @@ -7020,7 +6821,9 @@ SUBROUTINE AA_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%startnode Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%z0_aa + ReKiBuf(Re_Xferred) = InData%Lturb + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AvgV Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%dz_turb_in Re_Xferred = Re_Xferred + 1 @@ -7856,7 +7659,9 @@ SUBROUTINE AA_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Xferred = Int_Xferred + 1 OutData%startnode = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - OutData%z0_aa = ReKiBuf(Re_Xferred) + OutData%Lturb = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AvgV = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%dz_turb_in = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 diff --git a/modules/aerodyn/src/AeroDyn.f90 b/modules/aerodyn/src/AeroDyn.f90 index b49447d26b..f5ca0b1432 100644 --- a/modules/aerodyn/src/AeroDyn.f90 +++ b/modules/aerodyn/src/AeroDyn.f90 @@ -61,15 +61,17 @@ module AeroDyn ! states(z) PUBLIC :: AD_GetOP !< Routine to pack the operating point values (for linearization) into arrays + contains !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets the initialization output data structure, which contains data to be returned to the calling program (e.g., !! FAST or AeroDyn_Driver) -subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) +subroutine AD_SetInitOut(p, p_AD, InputFileData, InitOut, errStat, errMsg) - type(AD_InitOutputType), intent( out) :: InitOut ! output data - type(AD_InputFile), intent(in ) :: InputFileData ! input file data (for setting airfoil shape outputs) - type(AD_ParameterType), intent(in ) :: p ! Parameters + type(RotInitOutputType), intent( out) :: InitOut ! output data + type(RotInputFile), intent(in ) :: InputFileData ! input file data (for setting airfoil shape outputs) + type(RotParameterType), intent(in ) :: p ! Parameters + type(AD_ParameterType), intent(in ) :: p_AD ! Parameters integer(IntKi), intent( out) :: errStat ! Error status of the operation character(*), intent( out) :: errMsg ! Error message if ErrStat /= ErrID_None @@ -85,6 +87,7 @@ subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) integer(IntKi) :: NumCoords ! Initialize variables for this routine + errStat = ErrID_None errMsg = "" @@ -98,28 +101,27 @@ subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) if (ErrStat >= AbortErrLev) return - do i=1,p%NumOuts InitOut%WriteOutputHdr(i) = p%OutParam(i)%Name InitOut%WriteOutputUnt(i) = p%OutParam(i)%Units end do + ! Set the info in WriteOutputHdr and WriteOutputUnt - CALL AllBldNdOuts_InitOut( InitOut, p, InputFileData, ErrStat2, ErrMsg2 ) + CALL AllBldNdOuts_InitOut( InitOut, p, p_AD, InputFileData, ErrStat2, ErrMsg2 ) call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - InitOut%Ver = AD_Ver ! set visualization data: ! this check is overly restrictive, but it would be a lot of work to ensure that only the *used* airfoil ! tables have the same number of coordinates. - if ( allocated(p%AFI) ) then + if ( allocated(p_AD%AFI) ) then - if ( p%AFI(1)%NumCoords > 0 ) then - NumCoords = p%AFI(1)%NumCoords - do i=2,size(p%AFI) - if (p%AFI(i)%NumCoords /= NumCoords) then + if ( p_AD%AFI(1)%NumCoords > 0 ) then + NumCoords = p_AD%AFI(1)%NumCoords + do i=2,size(p_AD%AFI) + if (p_AD%AFI(i)%NumCoords /= NumCoords) then call SetErrStat( ErrID_Info, 'Airfoil files do not contain the same number of x-y coordinates.', ErrStat, ErrMsg, RoutineName ) NumCoords = -1 exit @@ -131,7 +133,7 @@ subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) call SetErrStat( ErrID_Info, 'Airfoil files with NumCoords > 0 must contain at least 2 coordinates.', ErrStat, ErrMsg, RoutineName ) return end if - + allocate( InitOut%BladeShape( p%numBlades ), STAT=ErrStat2 ) if (ErrStat2 /= 0) then call SetErrStat( ErrID_Info, 'Error allocationg InitOut%AD_BladeShape', ErrStat, ErrMsg, RoutineName ) @@ -147,8 +149,8 @@ subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) f = InputFileData%BladeProps(k)%BlAFID(j) do i=1,NumCoords-1 - InitOut%BladeShape(k)%AirfoilCoords(1,i,j) = InputFileData%BladeProps(k)%BlChord(j)*( p%AFI(f)%Y_Coord(i+1) - p%AFI(f)%Y_Coord(1) ) - InitOut%BladeShape(k)%AirfoilCoords(2,i,j) = InputFileData%BladeProps(k)%BlChord(j)*( p%AFI(f)%X_Coord(i+1) - p%AFI(f)%X_Coord(1) ) + InitOut%BladeShape(k)%AirfoilCoords(1,i,j) = InputFileData%BladeProps(k)%BlChord(j)*( p_AD%AFI(f)%Y_Coord(i+1) - p_AD%AFI(f)%Y_Coord(1) ) + InitOut%BladeShape(k)%AirfoilCoords(2,i,j) = InputFileData%BladeProps(k)%BlChord(j)*( p_AD%AFI(f)%X_Coord(i+1) - p_AD%AFI(f)%X_Coord(1) ) end do end do @@ -190,7 +192,6 @@ subroutine AD_SetInitOut(p, InputFileData, InitOut, errStat, errMsg) END IF end subroutine AD_SetInitOut - !---------------------------------------------------------------------------------------------------------------------------------- !> This routine is called at the start of the simulation to perform initialization steps. !! The parameters are set here and not changed during the simulation. @@ -221,6 +222,7 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut ! Local variables integer(IntKi) :: i ! loop counter + integer(IntKi) :: iR ! loop on rotors integer(IntKi) :: errStat2 ! temporary error status of the operation character(ErrMsgLen) :: errMsg2 ! temporary error message @@ -230,6 +232,8 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut character(1024) :: PriPath !< Primary path character(1024) :: EchoFileName integer(IntKi) :: UnEcho ! Unit number for the echo file + integer(IntKi) :: nRotors ! Number of rotors + integer(IntKi), allocatable, dimension(:) :: NumBlades ! Number of blades per rotor character(*), parameter :: RoutineName = 'AD_Init' @@ -249,10 +253,35 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut call DispNVD( AD_Ver ) + ! Allocate rotors data types + + nRotors = size(InitInp%rotors) + allocate(x%rotors(nRotors), xd%rotors(nRotors), z%rotors(nRotors), OtherState%rotors(nRotors), stat=errStat) + if (errStat/=0) call SetErrStat( ErrID_Fatal, 'Allocating rotor states', errStat, errMsg, RoutineName ) + allocate(u%rotors(nRotors), y%rotors(nRotors), InitOut%rotors(nRotors), InputFileData%rotors(nRotors), stat=errStat) + if (errStat/=0) call SetErrStat( ErrID_Fatal, 'Allocating rotor input/outputs', errStat, errMsg, RoutineName ) + allocate(p%rotors(nRotors), m%rotors(nRotors), stat=errStat) + if (errStat/=0) call SetErrStat( ErrID_Fatal, 'Allocating rotor params/misc', errStat, errMsg, RoutineName ) + if (errStat/=ErrID_None) then + call Cleanup() + return + end if + + + ! set a few parameters needed while reading the input file - call ValidateNumBlades( InitInp%NumBlades, ErrStat2, ErrMsg2 ) - if (Failed()) return; - p%NumBlades = InitInp%NumBlades + allocate(NumBlades(nRotors)) + do iR = 1, nRotors + call ValidateNumBlades( InitInp%rotors(iR)%NumBlades, ErrStat2, ErrMsg2 ) + if (Failed()) return; + NumBlades(iR) = InitInp%rotors(iR)%NumBlades + p%rotors(iR)%NumBlades = InitInp%rotors(iR)%NumBlades + if (size(InitInp%rotors)>1) then + p%rotors(iR)%RootName = TRIM(InitInp%RootName)//'.AD.R'//trim(num2lstr(iR)) + else + p%rotors(iR)%RootName = TRIM(InitInp%RootName)//'.AD' + endif + enddo p%RootName = TRIM(InitInp%RootName)//'.AD' CALL GetPath( InitInp%InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. @@ -268,25 +297,22 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut endif if (Failed()) return; - ! For diagnostic purposes, the following can be used to display the contents ! of the FileInfo_In data structure. ! call Print_FileInfo_Struct( CU, FileInfo_In ) ! CU is the screen -- different number on different systems. ! Parse the FileInfo_In structure of data from the inputfile into the InitInp%InputFile structure - CALL ParsePrimaryFileInfo( PriPath, InitInp%InputFile, p%RootName, p%NumBlades, interval, FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) + CALL ParsePrimaryFileInfo( PriPath, InitInp%InputFile, p%RootName, NumBlades, interval, FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) if (Failed()) return; - ! ----------------------------------------------------------------- ! Read the AeroDyn blade files, or copy from passed input !FIXME: add handling for passing of blade files and other types of files. - call ReadInputFiles( InitInp%InputFile, InputFileData, interval, p%RootName, p%NumBlades, UnEcho, ErrStat2, ErrMsg2 ) + call ReadInputFiles( InitInp%InputFile, InputFileData, interval, p%RootName, NumBlades, UnEcho, ErrStat2, ErrMsg2 ) if (Failed()) return; - ! Validate the inputs - call ValidateInputData( InitInp, InputFileData, p%NumBlades, ErrStat2, ErrMsg2 ) + call ValidateInputData( InitInp, InputFileData, NumBlades, ErrStat2, ErrMsg2 ) if (Failed()) return; !............................................................................................ @@ -294,20 +320,23 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut !............................................................................................ ! Initialize AFI module (read Airfoil tables) - call Init_AFIparams( InputFileData, p%AFI, UnEcho, p%NumBlades, ErrStat2, ErrMsg2 ) + call Init_AFIparams( InputFileData, p%AFI, UnEcho, ErrStat2, ErrMsg2 ) if (Failed()) return; ! set the rest of the parameters - call SetParameters( InitInp, InputFileData, p, ErrStat2, ErrMsg2 ) - if (Failed()) return; + do iR = 1, nRotors + call SetParameters( InitInp, InputFileData, InputFileData%rotors(iR), p%rotors(iR), p, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo !............................................................................................ ! Define and initialize inputs here !............................................................................................ - - call Init_u( u, p, InputFileData, InitInp, errStat2, errMsg2 ) - if (Failed()) return; + do iR = 1, nRotors + call Init_u( u%rotors(iR), p%rotors(iR), p, InputFileData%rotors(iR), InitInp%rotors(iR), errStat2, errMsg2 ) + if (Failed()) return; + enddo !............................................................................................ @@ -318,22 +347,25 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut ! calculated node positions from the input meshes if (p%WakeMod /= WakeMod_FVW) then - call Init_BEMTmodule( InputFileData, u, m%BEMT_u(1), p, x%BEMT, xd%BEMT, z%BEMT, & - OtherState%BEMT, m%BEMT_y, m%BEMT, ErrStat2, ErrMsg2 ) - if (Failed()) return; - - call BEMT_CopyInput( m%BEMT_u(1), m%BEMT_u(2), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - - !............................................................................................ - ! Initialize the AeroAcoustics Module if the CompAA flag is set - !............................................................................................ - if (p%CompAA) then - call Init_AAmodule( InitInp, InputFileData, u, m%AA_u, p, x%AA, xd%AA, z%AA, OtherState%AA, m%AA_y, m%AA, ErrStat2, ErrMsg2 ) + do iR = 1, nRotors + call Init_BEMTmodule( InputFileData, InputFileData%rotors(iR), u%rotors(iR), m%rotors(iR)%BEMT_u(1), p%rotors(iR), p, x%rotors(iR)%BEMT, xd%rotors(iR)%BEMT, z%rotors(iR)%BEMT, & + OtherState%rotors(iR)%BEMT, m%rotors(iR)%BEMT_y, m%rotors(iR)%BEMT, ErrStat2, ErrMsg2 ) if (Failed()) return; - end if - endif + + call BEMT_CopyInput( m%rotors(iR)%BEMT_u(1), m%rotors(iR)%BEMT_u(2), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + + !............................................................................................ + ! Initialize the AeroAcoustics Module if the CompAA flag is set + !............................................................................................ + if (p%rotors(iR)%CompAA) then + call Init_AAmodule( InitInp%rotors(iR), InputFileData, InputFileData%rotors(iR), u%rotors(iR), m%rotors(iR)%AA_u, p%rotors(iR), p, x%rotors(iR)%AA, xd%rotors(iR)%AA, z%rotors(iR)%AA, OtherState%rotors(iR)%AA, m%rotors(iR)%AA_y, m%rotors(iR)%AA, ErrStat2, ErrMsg2 ) + if (Failed()) return; + end if + enddo + + else ! if (p%WakeMod == WakeMod_FVW) then !------------------------------------------------------------------------------------------------- ! Initialize FVW module if it is used @@ -342,10 +374,10 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut ! so we can't size things exactly. This means that we either must size too big here, or we must ! resize in the FVW code at the first CalcOutput call. This is a bit problematic for efficiency ! but not a complete deal-breaker. - if (p%WakeMod == WakeMod_FVW) then + if (.not. allocated(m%FVW_u)) Allocate(m%FVW_u(3)) !size(u))) call Init_FVWmodule( InputFileData, u, m%FVW_u(1), p, x%FVW, xd%FVW, z%FVW, & - OtherState%FVW, m%FVW_y, m%FVW, ErrStat2, ErrMsg2 ) + OtherState%FVW, m, ErrStat2, ErrMsg2 ) if (Failed()) return; ! populate the rest of the FVW_u so that extrap-interp will work do i=2,3 !size(u) @@ -358,8 +390,10 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut !............................................................................................ ! Define outputs here !............................................................................................ - call Init_y(y, u, p, errStat2, errMsg2) ! do this after input meshes have been initialized - if (Failed()) return; + do iR = 1, nRotors + call Init_y(y%rotors(iR), u%rotors(iR), p%rotors(iR), errStat2, errMsg2) ! do this after input meshes have been initialized + if (Failed()) return; + enddo !............................................................................................ @@ -368,8 +402,10 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut ! many states are in the BEMT module, which were initialized in BEMT_Init() - call Init_MiscVars(m, p, u, y, errStat2, errMsg2) - if (Failed()) return; + do iR = 1, nRotors + call Init_MiscVars(m%rotors(iR), p%rotors(iR), u%rotors(iR), y%rotors(iR), errStat2, errMsg2) + if (Failed()) return; + enddo !............................................................................................ ! Initialize other states @@ -381,8 +417,11 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut !............................................................................................ ! Define initialization output here !............................................................................................ - call AD_SetInitOut(p, InputFileData, InitOut, errStat2, errMsg2) - if (Failed()) return; + InitOut%Ver = AD_Ver + do iR = 1, nRotors + call AD_SetInitOut(p%rotors(iR), p, InputFileData%rotors(iR), InitOut%rotors(iR), errStat2, errMsg2) + if (Failed()) return; + enddo ! after setting InitOut variables, we really don't need the airfoil coordinates taking up ! space in AeroDyn @@ -397,16 +436,20 @@ subroutine AD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut ! Initialize Jacobian: !............................................................................................ if (InitInp%Linearize) then - call Init_Jacobian(InputFileData, p, u, y, m, InitOut, ErrStat2, ErrMsg2) - if (Failed()) return; + do iR = 1, nRotors + call Init_Jacobian(InputFileData%rotors(iR), p%rotors(iR), p, u%rotors(iR), y%rotors(iR), m%rotors(iR), InitOut%rotors(iR), errStat2, errMsg2) + if (Failed()) return; + enddo end if !............................................................................................ ! Print the summary file if requested: !............................................................................................ if (InputFileData%SumPrint) then - call AD_PrintSum( InputFileData, p, u, y, ErrStat2, ErrMsg2 ) - if (Failed()) return; + do iR = 1, nRotors + call AD_PrintSum( InputFileData, p%rotors(iR), p, u, y, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo end if !............................................................................................ @@ -426,15 +469,17 @@ logical function Failed() if (Failed) call Cleanup() end function Failed subroutine Cleanup() + CALL AD_DestroyInputFile( InputFileData, ErrStat2, ErrMsg2 ) IF ( UnEcho > 0 ) CLOSE( UnEcho ) + end subroutine Cleanup end subroutine AD_Init !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine reinitializes BEMT and UA, assuming that we will start the simulation over again, with only the inputs being different. !! This allows us to bypass reading input files and allocating arrays because p is already set. -subroutine AD_ReInit(p, x, xd, z, OtherState, m, Interval, ErrStat, ErrMsg ) +subroutine AD_ReInit(p,x, xd, z, OtherState, m, Interval, ErrStat, ErrMsg ) type(AD_ParameterType), intent(in ) :: p !< Parameters type(AD_ContinuousStateType), intent(inout) :: x !< Initial continuous states @@ -451,6 +496,9 @@ subroutine AD_ReInit(p, x, xd, z, OtherState, m, Interval, ErrStat, ErrMsg ) integer(IntKi), intent( out) :: errStat !< Error status of the operation character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None + integer(IntKi) :: iR ! loop on rotors + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 character(*), parameter :: RoutineName = 'AD_ReInit' @@ -463,18 +511,27 @@ subroutine AD_ReInit(p, x, xd, z, OtherState, m, Interval, ErrStat, ErrMsg ) ! we could get around this by figuring out what needs to change when we modify the dt parameter... probably just some unused-parameters ! and the UA filter end if + + if (p%WakeMod /= WakeMod_FVW) then + do IR=1, size(p%rotors) + call BEMT_ReInit(p%rotors(iR)%BEMT,x%rotors(iR)%BEMT,xd%rotors(iR)%BEMT,z%rotors(iR)%BEMT,OtherState%rotors(iR)%BEMT,m%rotors(iR)%BEMT,ErrStat,ErrMsg) + + if (p%rotors(iR)%BEMT%UA_Flag) then + call UA_ReInit( p%rotors(iR)%BEMT%UA, p%AFI, p%rotors(iR)%BEMT%AFIndx, x%rotors(iR)%BEMT%UA, xd%rotors(iR)%BEMT%UA, OtherState%rotors(iR)%BEMT%UA, m%rotors(iR)%BEMT%UA, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + end if + enddo + end if - if (p%WakeMod /= WakeMod_FVW) & - call BEMT_ReInit(p%BEMT,x%BEMT,xd%BEMT,z%BEMT,OtherState%BEMT,m%BEMT,p%AFI,ErrStat,ErrMsg) end subroutine AD_ReInit !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes (allocates) the misc variables for use during the simulation. subroutine Init_MiscVars(m, p, u, y, errStat, errMsg) - type(AD_MiscVarType), intent(inout) :: m !< misc/optimization data (not defined in submodules) - type(AD_ParameterType), intent(in ) :: p !< Parameters - type(AD_InputType), intent(inout) :: u !< input for HubMotion mesh (create sibling mesh here) - type(AD_OutputType), intent(in ) :: y !< output (create mapping between output and otherstate mesh here) + type(RotMiscVarType), intent(inout) :: m !< misc/optimization data (not defined in submodules) + type(RotParameterType), intent(in ) :: p !< Parameters + type(RotInputType), intent(inout) :: u !< input for HubMotion mesh (create sibling mesh here) + type(RotOutputType), intent(in ) :: y !< output (create mapping between output and otherstate mesh here) integer(IntKi), intent( out) :: errStat !< Error status of the operation character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None @@ -554,7 +611,41 @@ subroutine Init_MiscVars(m, p, u, y, errStat, errMsg) end do if (ErrStat >= AbortErrLev) RETURN + + ! Mesh mapping data for integrating load over entire blade: + allocate( m%B_L_2_R_P(p%NumBlades), Stat = ErrStat2) + if (ErrStat2 /= 0) then + call SetErrStat( ErrID_Fatal, "Error allocating B_L_2_R_P mapping structure.", errStat, errMsg, RoutineName ) + return + end if + allocate( m%BladeRootLoad(p%NumBlades), Stat = ErrStat2) + if (ErrStat2 /= 0) then + call SetErrStat( ErrID_Fatal, "Error allocating BladeRootLoad mesh array.", errStat, errMsg, RoutineName ) + return + end if + do k=1,p%NumBlades + call MeshCopy ( SrcMesh = u%BladeRootMotion(k) & + , DestMesh = m%BladeRootLoad(k) & + , CtrlCode = MESH_SIBLING & + , IOS = COMPONENT_OUTPUT & + , force = .TRUE. & + , moment = .TRUE. & + , ErrStat = ErrStat2 & + , ErrMess = ErrMsg2 ) + + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + end do !k=blades + + if (ErrStat >= AbortErrLev) RETURN + + do k=1,p%NumBlades + CALL MeshMapCreate( y%BladeLoad(k), m%BladeRootLoad(k), m%B_L_2_R_P(k), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':B_L_2_R_P('//TRIM(Num2LStr(K))//')' ) + end do !k=blades + + if (ErrStat >= AbortErrLev) RETURN + ! if (p%NumTwrNds > 0) then m%W_Twr = 0.0_ReKi @@ -590,9 +681,9 @@ end subroutine Init_OtherStates !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes AeroDyn meshes and output array variables for use during the simulation. subroutine Init_y(y, u, p, errStat, errMsg) - type(AD_OutputType), intent( out) :: y !< Module outputs - type(AD_InputType), intent(inout) :: u !< Module inputs -- intent(out) because of mesh sibling copy - type(AD_ParameterType), intent(in ) :: p !< Parameters + type(RotOutputType), intent( out) :: y !< Module outputs + type(RotInputType), intent(inout) :: u !< Module inputs -- intent(out) because of mesh sibling copy + type(RotParameterType), intent(in ) :: p !< Parameters integer(IntKi), intent( out) :: errStat !< Error status of the operation character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None @@ -629,7 +720,18 @@ subroutine Init_y(y, u, p, errStat, errMsg) y%TowerLoad%nnodes = 0 end if + call MeshCopy ( SrcMesh = u%NacelleMotion & + , DestMesh = y%NacelleLoad & + , CtrlCode = MESH_SIBLING & + , IOS = COMPONENT_OUTPUT & + , force = .TRUE. & + , moment = .TRUE. & + , ErrStat = ErrStat2 & + , ErrMess = ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (ErrStat >= AbortErrLev) RETURN + allocate( y%BladeLoad(p%numBlades), stat=ErrStat2 ) if (errStat2 /= 0) then call SetErrStat( ErrID_Fatal, 'Error allocating y%BladeLoad.', ErrStat, ErrMsg, RoutineName ) @@ -661,13 +763,14 @@ subroutine Init_y(y, u, p, errStat, errMsg) end subroutine Init_y !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes AeroDyn meshes and input array variables for use during the simulation. -subroutine Init_u( u, p, InputFileData, InitInp, errStat, errMsg ) +subroutine Init_u( u, p, p_AD, InputFileData, InitInp, errStat, errMsg ) !.................................................................................................................................. - type(AD_InputType), intent( out) :: u !< Input data - type(AD_ParameterType), intent(in ) :: p !< Parameters - type(AD_InputFile), intent(in ) :: InputFileData !< Data stored in the module's input file - type(AD_InitInputType), intent(in ) :: InitInp !< Input data for AD initialization routine + type(RotInputType), intent( out) :: u !< Input data + type(RotParameterType), intent(in ) :: p !< Parameters + type(AD_ParameterType), intent(in ) :: p_AD !< Parameters + type(RotInputFile), intent(in ) :: InputFileData !< Data stored in the module's input file + type(RotInitInputType), intent(in ) :: InitInp !< Input data for AD initialization routine integer(IntKi), intent( out) :: errStat !< Error status of the operation character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None @@ -706,6 +809,7 @@ subroutine Init_u( u, p, InputFileData, InitInp, errStat, errMsg ) u%InflowOnBlade = 0.0_ReKi u%UserProp = 0.0_ReKi + u%InflowOnNacelle = 0.0_ReKi ! Meshes for motion inputs (ElastoDyn and/or BeamDyn) !................ @@ -755,158 +859,197 @@ subroutine Init_u( u, p, InputFileData, InitInp, errStat, errMsg ) end if ! we compute tower loads - !................ - ! hub - !................ - - call MeshCreate ( BlankMesh = u%HubMotion & - ,IOS = COMPONENT_INPUT & - ,Nnodes = 1 & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 & - ,Orientation = .true. & - ,TranslationDisp = .true. & - ,RotationVel = .true. & - ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + !................ + ! hub + !................ + + call MeshCreate ( BlankMesh = u%HubMotion & + ,IOS = COMPONENT_INPUT & + ,Nnodes = 1 & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Orientation = .true. & + ,TranslationDisp = .true. & + ,RotationVel = .true. & + ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - if (errStat >= AbortErrLev) return + if (errStat >= AbortErrLev) return - call MeshPositionNode(u%HubMotion, 1, InitInp%HubPosition, errStat2, errMsg2, InitInp%HubOrientation) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshPositionNode(u%HubMotion, 1, InitInp%HubPosition, errStat2, errMsg2, InitInp%HubOrientation) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - call MeshConstructElement( u%HubMotion, ELEMENT_POINT, errStat2, errMsg2, p1=1 ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshConstructElement( u%HubMotion, ELEMENT_POINT, errStat2, errMsg2, p1=1 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - call MeshCommit(u%HubMotion, errStat2, errMsg2 ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshCommit(u%HubMotion, errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName//':HubMotion' ) - if (errStat >= AbortErrLev) return + if (errStat >= AbortErrLev) return - u%HubMotion%Orientation = u%HubMotion%RefOrientation - u%HubMotion%TranslationDisp = 0.0_R8Ki - u%HubMotion%RotationVel = 0.0_ReKi + u%HubMotion%Orientation = u%HubMotion%RefOrientation + u%HubMotion%TranslationDisp = 0.0_R8Ki + u%HubMotion%RotationVel = 0.0_ReKi - !................ - ! blade roots - !................ + !................ + ! blade roots + !................ - allocate( u%BladeRootMotion(p%NumBlades), STAT = ErrStat2 ) - if (ErrStat2 /= 0) then - call SetErrStat( ErrID_Fatal, 'Error allocating u%BladeRootMotion array.', ErrStat, ErrMsg, RoutineName ) - return - end if + allocate( u%BladeRootMotion(p%NumBlades), STAT = ErrStat2 ) + if (ErrStat2 /= 0) then + call SetErrStat( ErrID_Fatal, 'Error allocating u%BladeRootMotion array.', ErrStat, ErrMsg, RoutineName ) + return + end if - do k=1,p%NumBlades - call MeshCreate ( BlankMesh = u%BladeRootMotion(k) & - ,IOS = COMPONENT_INPUT & - ,Nnodes = 1 & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 & - ,Orientation = .true. & - ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - - if (errStat >= AbortErrLev) return - - call MeshPositionNode(u%BladeRootMotion(k), 1, InitInp%BladeRootPosition(:,k), errStat2, errMsg2, InitInp%BladeRootOrientation(:,:,k)) + do k=1,p%NumBlades + call MeshCreate ( BlankMesh = u%BladeRootMotion(k) & + ,IOS = COMPONENT_INPUT & + ,Nnodes = 1 & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Orientation = .true. & + ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + if (errStat >= AbortErrLev) return + + call MeshPositionNode(u%BladeRootMotion(k), 1, InitInp%BladeRootPosition(:,k), errStat2, errMsg2, InitInp%BladeRootOrientation(:,:,k)) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - call MeshConstructElement( u%BladeRootMotion(k), ELEMENT_POINT, errStat2, errMsg2, p1=1 ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshConstructElement( u%BladeRootMotion(k), ELEMENT_POINT, errStat2, errMsg2, p1=1 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - call MeshCommit(u%BladeRootMotion(k), errStat2, errMsg2 ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshCommit(u%BladeRootMotion(k), errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName//':BladeRootMotion' ) - if (errStat >= AbortErrLev) return + if (errStat >= AbortErrLev) return - u%BladeRootMotion(k)%Orientation = u%BladeRootMotion(k)%RefOrientation + u%BladeRootMotion(k)%Orientation = u%BladeRootMotion(k)%RefOrientation end do !k=numBlades - !................ - ! blades - !................ + !................ + ! blades + !................ - allocate( u%BladeMotion(p%NumBlades), STAT = ErrStat2 ) - if (ErrStat2 /= 0) then - call SetErrStat( ErrID_Fatal, 'Error allocating u%BladeMotion array.', ErrStat, ErrMsg, RoutineName ) - return - end if + allocate( u%BladeMotion(p%NumBlades), STAT = ErrStat2 ) + if (ErrStat2 /= 0) then + call SetErrStat( ErrID_Fatal, 'Error allocating u%BladeMotion array.', ErrStat, ErrMsg, RoutineName ) + return + end if - do k=1,p%NumBlades - call MeshCreate ( BlankMesh = u%BladeMotion(k) & - ,IOS = COMPONENT_INPUT & - ,Nnodes = InputFileData%BladeProps(k)%NumBlNds & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 & - ,Orientation = .true. & - ,TranslationDisp = .true. & - ,TranslationVel = .true. & - ,RotationVel = .true. & - ,TranslationAcc = .true. & - ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - - if (errStat >= AbortErrLev) return + do k=1,p%NumBlades + call MeshCreate ( BlankMesh = u%BladeMotion(k) & + ,IOS = COMPONENT_INPUT & + ,Nnodes = InputFileData%BladeProps(k)%NumBlNds & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Orientation = .true. & + ,TranslationDisp = .true. & + ,TranslationVel = .true. & + ,RotationVel = .true. & + ,TranslationAcc = .true. & + ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + if (errStat >= AbortErrLev) return - do j=1,InputFileData%BladeProps(k)%NumBlNds + do j=1,InputFileData%BladeProps(k)%NumBlNds - ! reference position of the jth node in the kth blade, relative to the root in the local blade coordinate system: - positionL(1) = InputFileData%BladeProps(k)%BlCrvAC(j) - positionL(2) = InputFileData%BladeProps(k)%BlSwpAC(j) - positionL(3) = InputFileData%BladeProps(k)%BlSpn( j) + ! reference position of the jth node in the kth blade, relative to the root in the local blade coordinate system: + positionL(1) = InputFileData%BladeProps(k)%BlCrvAC(j) + positionL(2) = InputFileData%BladeProps(k)%BlSwpAC(j) + positionL(3) = InputFileData%BladeProps(k)%BlSpn( j) - ! reference position of the jth node in the kth blade: - position = u%BladeRootMotion(k)%Position(:,1) + matmul(positionL,u%BladeRootMotion(k)%RefOrientation(:,:,1)) ! note that because positionL is a 1-D array, we're doing the transpose of matmul(transpose(u%BladeRootMotion(k)%RefOrientation),positionL) + ! reference position of the jth node in the kth blade: + position = u%BladeRootMotion(k)%Position(:,1) + matmul(positionL,u%BladeRootMotion(k)%RefOrientation(:,:,1)) ! note that because positionL is a 1-D array, we're doing the transpose of matmul(transpose(u%BladeRootMotion(k)%RefOrientation),positionL) - ! reference orientation of the jth node in the kth blade, relative to the root in the local blade coordinate system: - theta(1) = 0.0_R8Ki - theta(2) = InputFileData%BladeProps(k)%BlCrvAng(j) - theta(3) = -InputFileData%BladeProps(k)%BlTwist( j) - orientationL = EulerConstruct( theta ) + ! reference orientation of the jth node in the kth blade, relative to the root in the local blade coordinate system: + theta(1) = 0.0_R8Ki + theta(2) = InputFileData%BladeProps(k)%BlCrvAng(j) + theta(3) = -InputFileData%BladeProps(k)%BlTwist( j) + orientationL = EulerConstruct( theta ) - ! reference orientation of the jth node in the kth blade - orientation = matmul( orientationL, u%BladeRootMotion(k)%RefOrientation(:,:,1) ) + ! reference orientation of the jth node in the kth blade + orientation = matmul( orientationL, u%BladeRootMotion(k)%RefOrientation(:,:,1) ) - call MeshPositionNode(u%BladeMotion(k), j, position, errStat2, errMsg2, orientation) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call MeshPositionNode(u%BladeMotion(k), j, position, errStat2, errMsg2, orientation) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - end do ! j=blade nodes + end do ! j=blade nodes - ! create line2 elements - do j=1,InputFileData%BladeProps(k)%NumBlNds-1 - call MeshConstructElement( u%BladeMotion(k), ELEMENT_LINE2, errStat2, errMsg2, p1=j, p2=j+1 ) - call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - end do !j - - call MeshCommit(u%BladeMotion(k), errStat2, errMsg2 ) + ! create line2 elements + do j=1,InputFileData%BladeProps(k)%NumBlNds-1 + call MeshConstructElement( u%BladeMotion(k), ELEMENT_LINE2, errStat2, errMsg2, p1=j, p2=j+1 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + end do !j + + call MeshCommit(u%BladeMotion(k), errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName//':BladeMotion'//trim(num2lstr(k)) ) - if (errStat >= AbortErrLev) return + if (errStat >= AbortErrLev) return - u%BladeMotion(k)%Orientation = u%BladeMotion(k)%RefOrientation - u%BladeMotion(k)%TranslationDisp = 0.0_R8Ki - u%BladeMotion(k)%TranslationVel = 0.0_ReKi + u%BladeMotion(k)%Orientation = u%BladeMotion(k)%RefOrientation + u%BladeMotion(k)%TranslationDisp = 0.0_R8Ki + u%BladeMotion(k)%TranslationVel = 0.0_ReKi + u%BladeMotion(k)%RotationVel = 0.0_ReKi + u%BladeMotion(k)%TranslationAcc = 0.0_ReKi + + end do !k=numBlades + + !................ + ! Nacelle + !................ + call MeshCreate ( BlankMesh = u%NacelleMotion & + ,IOS = COMPONENT_INPUT & + ,Nnodes = 1 & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Orientation = .true. & + ,TranslationDisp = .true. & + ,TranslationVel = .true. & + ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + if (errStat >= AbortErrLev) return + + ! set node initial position/orientation + position = InitInp%HubPosition + position(1:2) = 0 + call MeshPositionNode(u%NacelleMotion, 1, position, errStat2, errMsg2, orient=InitInp%NacelleOrientation) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + call MeshConstructElement( u%NacelleMotion, ELEMENT_POINT, errStat2, errMsg2, p1=1 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + call MeshCommit(u%NacelleMotion, errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + + if (errStat >= AbortErrLev) return + + + end subroutine Init_u !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets AeroDyn parameters for use during the simulation; these variables are not changed after AD_Init. -subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) +subroutine SetParameters( InitInp, InputFileData, RotData, p, p_AD, ErrStat, ErrMsg ) TYPE(AD_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine, out is needed because of copy below TYPE(AD_InputFile), INTENT(INout) :: InputFileData !< Data stored in the module's input file -- intent(out) only for move_alloc statements - TYPE(AD_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(RotInputFile), INTENT(INout) :: RotData !< Data stored in the module's input file -- intent(out) only for move_alloc statements + TYPE(RotParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(INOUT) :: p_AD !< Parameters INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -922,8 +1065,8 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) ErrStat = ErrID_None ErrMsg = "" - p%DT = InputFileData%DTAero - p%WakeMod = InputFileData%WakeMod + p_AD%DT = InputFileData%DTAero + p_AD%WakeMod = InputFileData%WakeMod p%TwrPotent = InputFileData%TwrPotent p%TwrShadow = InputFileData%TwrShadow p%TwrAero = InputFileData%TwrAero @@ -942,15 +1085,15 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) ! NOTE: In the following we use InputFileData%BladeProps(1)%NumBlNds as the number of aero nodes on EACH blade, ! but if AD changes this, then it must be handled in the Glue-code linearization code, too (and elsewhere?) ! - p%NumBlNds = InputFileData%BladeProps(1)%NumBlNds + p%NumBlNds = RotData%BladeProps(1)%NumBlNds if (p%TwrPotent == TwrPotent_none .and. p%TwrShadow == TwrShadow_none .and. .not. p%TwrAero) then p%NumTwrNds = 0 else - p%NumTwrNds = InputFileData%NumTwrNds + p%NumTwrNds = RotData%NumTwrNds - call move_alloc( InputFileData%TwrDiam, p%TwrDiam ) - call move_alloc( InputFileData%TwrCd, p%TwrCd ) - call move_alloc( InputFileData%TwrTI, p%TwrTI ) + call move_alloc( RotData%TwrDiam, p%TwrDiam ) + call move_alloc( RotData%TwrCd, p%TwrCd ) + call move_alloc( RotData%TwrTI, p%TwrTI ) end if p%AirDens = InputFileData%AirDens @@ -976,7 +1119,7 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) p%NTwOuts = 0 end if - call SetOutParam(InputFileData%OutList, p, ErrStat2, ErrMsg2 ) ! requires: p%NumOuts, p%numBlades, p%NumBlNds, p%NumTwrNds; sets: p%OutParam. + call SetOutParam(InputFileData%OutList, p, p_AD, ErrStat2, ErrMsg2 ) ! requires: p%NumOuts, p%numBlades, p%NumBlNds, p%NumTwrNds; sets: p%OutParam. call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) return @@ -984,7 +1127,7 @@ subroutine SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) ! Set the nodal output parameters. Note there is some validation in this, so we might get an error from here. - CALL AllBldNdOuts_SetParameters( InitInp, InputFileData, p, ErrStat2, ErrMsg2 ) + CALL AllBldNdOuts_SetParameters( InputFileData, p, p_AD, ErrStat2, ErrMsg2 ) call setErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -1015,10 +1158,16 @@ subroutine AD_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) ErrMsg = "" + ! Place any last minute operations or calculations here: ! End the FVW submodule if (p%WakeMod == WakeMod_FVW ) then call FVW_End( m%FVW_u, p%FVW, x%FVW, xd%FVW, z%FVW, OtherState%FVW, m%FVW_y, m%FVW, ErrStat, ErrMsg ) + + if ( m%FVW%UA_Flag ) then + call UA_End(m%FVW%p_UA) + end if endif + ! Close files here: @@ -1074,6 +1223,7 @@ subroutine AD_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, errStat character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None ! local variables + integer(intKi) :: iR ! Counter on rotors type(AD_InputType) :: uInterp ! Interpolated/Extrapolated input integer(intKi) :: ErrStat2 ! temporary Error status character(ErrMsgLen) :: ErrMsg2 ! temporary Error message @@ -1095,8 +1245,10 @@ subroutine AD_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, errStat call AD_Input_ExtrapInterp(u,utimes,uInterp,t+p%DT, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call SetInputs(p, uInterp, m, 2, errStat2, errMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + do iR = 1,size(p%rotors) + call SetInputs(p%rotors(iR), p, uInterp%rotors(iR), m%rotors(iR), 2, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + enddo ! set values of m%BEMT_u(1) from inputs (uInterp) interpolated at t: ! NOTE: this is different than OpenFAST, which has t at u(2) @@ -1104,25 +1256,29 @@ subroutine AD_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, errStat call AD_Input_ExtrapInterp(u,utimes,uInterp, t, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call SetInputs(p, uInterp, m, 1, errStat2, errMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + do iR = 1,size(p%rotors) + call SetInputs(p%rotors(iR), p, uInterp%rotors(iR), m%rotors(iR), 1, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + enddo if (p%WakeMod /= WakeMod_FVW) then - ! Call into the BEMT update states NOTE: This is a non-standard framework interface!!!!! GJH - ! Also note BEMT_u(1) and BEMT_u(2) are not following the OpenFAST convention for t+dt, t - call BEMT_UpdateStates(t, n, m%BEMT_u(1), m%BEMT_u(2), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, p%AFI, m%BEMT, errStat2, errMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - ! Call AeroAcoustics updates states - if ( p%CompAA ) then - ! We need the outputs from BEMT as inputs to AeroAcoustics module - ! Also, SetInputs() [called above] calls SetInputsForBEMT() which in turn establishes current versions of the Global to local transformations we need as inputs to AA - call SetInputsForAA(p, u(1), m, errStat2, errMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call AA_UpdateStates(t, n,m%AA, m%AA_u, p%AA, xd%AA, errStat2, errMsg2) + do iR = 1,size(p%rotors) + ! Call into the BEMT update states NOTE: This is a non-standard framework interface!!!!! GJH + ! Also note BEMT_u(1) and BEMT_u(2) are not following the OpenFAST convention for t+dt, t + call BEMT_UpdateStates(t, n, m%rotors(iR)%BEMT_u(1), m%rotors(iR)%BEMT_u(2), p%rotors(iR)%BEMT, x%rotors(iR)%BEMT, xd%rotors(iR)%BEMT, z%rotors(iR)%BEMT, OtherState%rotors(iR)%BEMT, p%AFI, m%rotors(iR)%BEMT, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - end if + + ! Call AeroAcoustics updates states + if ( p%rotors(iR)%CompAA ) then + ! We need the outputs from BEMT as inputs to AeroAcoustics module + ! Also, SetInputs() [called above] calls SetInputsForBEMT() which in turn establishes current versions of the Global to local transformations we need as inputs to AA + call SetInputsForAA(p%rotors(iR), u(1)%rotors(iR), m%rotors(iR), errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AA_UpdateStates(t, n, m%rotors(iR)%AA, m%rotors(iR)%AA_u, p%rotors(iR)%AA, xd%rotors(iR)%AA, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + end if + enddo else ! Call the FVW sub module ! This needs to extract the inputs from the AD data types (mesh) and copy pieces for the FVW module @@ -1176,41 +1332,117 @@ subroutine AD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, ! NOTE: m%BEMT_u(i) indices are set differently from the way OpenFAST typically sets up the u and uTimes arrays integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt integer(intKi) :: i - integer(intKi) :: j + integer(intKi) :: iR ! Loop on rotors integer(intKi) :: ErrStat2 character(ErrMsgLen) :: ErrMsg2 character(*), parameter :: RoutineName = 'AD_CalcOutput' - real(ReKi) :: SigmaCavitCrit, SigmaCavit LOGICAL :: CalcWriteOutput ErrStat = ErrID_None ErrMsg = "" -#ifdef UA_OUTS - ! if ( mod(REAL(t,ReKi),.1) < p%dt) then - if (allocated(m%FVW%y_UA%WriteOutput)) m%FVW%y_UA%WriteOutput = 0.0 !reset to zero in case UA shuts off mid-simulation - ! endif -#endif - if (present(NeedWriteOutput)) then CalcWriteOutput = NeedWriteOutput else CalcWriteOutput = .true. ! by default, calculate WriteOutput unless told that we do not need it end if + + + ! SetInputs, Calc BEM Outputs and Twr Outputs + do iR=1,size(p%rotors) + call RotCalcOutput( t, u%rotors(iR), p%rotors(iR), p, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), y%rotors(iR), m%rotors(iR), ErrStat, ErrMsg) + enddo + + if (p%WakeMod == WakeMod_FVW) then + ! This needs to extract the inputs from the AD data types (mesh) and copy pieces for the FVW module + call SetInputsForFVW(p, (/u/), m, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! Calculate Outputs at time t + CALL FVW_CalcOutput( t, m%FVW_u(1), p%FVW, x%FVW, xd%FVW, z%FVW, OtherState%FVW, p%AFI, m%FVW_y, m%FVW, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + call SetOutputsFromFVW( t, u, p, OtherState, x, xd, m, y, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + endif + + + !------------------------------------------------------- + ! get values to output to file: + !------------------------------------------------------- + if (CalcWriteOutput) then + do iR = 1,size(p%rotors) + if (p%rotors(iR)%NumOuts > 0) then + call Calc_WriteOutput( p%rotors(iR), p, u%rotors(iR), m%rotors(iR), m, y%rotors(iR), OtherState%rotors(iR), xd%rotors(iR), indx, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + !............................................................................................................................... + ! Place the selected output channels into the WriteOutput(:) array with the proper sign: + !............................................................................................................................... + + do i = 1,p%rotors(iR)%NumOuts ! Loop through all selected output channels + y%rotors(iR)%WriteOutput(i) = p%rotors(iR)%OutParam(i)%SignM * m%rotors(iR)%AllOuts( p%rotors(iR)%OutParam(i)%Indx ) + end do ! i - All selected output channels + + end if + + y%rotors(iR)%WriteOutput(p%rotors(iR)%NumOuts+1:) = 0.0_ReKi + + ! Now we need to populate the blade node outputs here + call Calc_WriteAllBldNdOutput( p%rotors(iR), p, u%rotors(iR), m%rotors(iR), m, y%rotors(iR), OtherState%rotors(iR), indx, ErrStat2, ErrMsg2 ) ! Call after normal writeoutput. Will just postpend data on here. + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + enddo + end if + + +end subroutine AD_CalcOutput + + +subroutine RotCalcOutput( t, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg) +! NOTE: no matter how many channels are selected for output, all of the outputs are calculated +! All of the calculated output channels are placed into the m%AllOuts(:), while the channels selected for outputs are +! placed in the y%WriteOutput(:) array. +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at t + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at t + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at t + TYPE(RotOutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! NOTE: m%BEMT_u(i) indices are set differently from the way OpenFAST typically sets up the u and uTimes arrays + integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt + integer(intKi) :: i + integer(intKi) :: j + integer(intKi) :: iR ! Loop on rotors + + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'RotCalcOutput' + LOGICAL :: CalcWriteOutput - - call SetInputs(p, u, m, indx, errStat2, errMsg2) + ErrStat = ErrID_None + ErrMsg = "" + + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - if (p%WakeMod /= WakeMod_FVW) then + + if (p_AD%WakeMod /= WakeMod_FVW) then ! Call the BEMT module CalcOutput. Notice that the BEMT outputs are purposely attached to AeroDyn's MiscVar structure to ! avoid issues with the coupling code - call BEMT_CalcOutput(t, m%BEMT_u(indx), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, p%AFI, m%BEMT_y, m%BEMT, ErrStat2, ErrMsg2 ) + call BEMT_CalcOutput(t, m%BEMT_u(indx), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, p_AD%AFI, m%BEMT_y, m%BEMT, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call SetOutputsFromBEMT(p, m, y ) + call SetOutputsFromBEMT( p, m, y ) if ( p%CompAA ) then ! We need the outputs from BEMT as inputs to AeroAcoustics module @@ -1221,89 +1453,63 @@ subroutine AD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) end if - else !(p%WakeMod == WakeMod_FVW) - ! This needs to extract the inputs from the AD data types (mesh) and copy pieces for the FVW module - call SetInputsForFVW(p, (/u/), m, errStat2, errMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - ! Calculate Outputs at time t - CALL FVW_CalcOutput( t, m%FVW_u(1), p%FVW, x%FVW, xd%FVW, z%FVW, OtherState%FVW, p%AFI, m%FVW_y, m%FVW, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - call SetOutputsFromFVW( u, p, OtherState, x, xd, m, y, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + call AD_CavtCrit(u, p, m, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) endif if ( p%TwrAero ) then call ADTwr_CalcOutput(p, u, m, y, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - end if - + endif + +end subroutine RotCalcOutput + + +subroutine AD_CavtCrit(u, p, m, errStat, errMsg) + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + !! nectivity information does not have to be recalculated) + INTEGER(IntKi), INTENT( OUT) :: errStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: errMsg !< Error message if ErrStat /= ErrID_None + integer :: i,j + real(ReKi) :: SigmaCavitCrit, SigmaCavit + + errStat = ErrID_None + errMsg = '' + if ( p%CavitCheck ) then ! Calculate the cavitation number for the airfoil at the node in quesiton, and compare to the critical cavitation number based on the vapour pressure and submerged depth do j = 1,p%numBlades ! Loop through all blades do i = 1,p%NumBlNds ! Loop through all nodes - if ( EqualRealNos( m%BEMT_y%Vrel(i,j), 0.0_ReKi ) ) call SetErrStat( ErrID_Fatal, 'Vrel cannot be zero to do a cavitation check', ErrStat, ErrMsg, RoutineName) - if (ErrStat >= AbortErrLev) return + if ( EqualRealNos( m%BEMT_y%Vrel(i,j), 0.0_ReKi ) ) call SetErrStat( ErrID_Fatal, 'Vrel cannot be zero to do a cavitation check', ErrStat, ErrMsg, 'AD_CavtCrit') + if (ErrStat >= AbortErrLev) return - SigmaCavit= -1* m%BEMT_y%Cpmin(i,j) ! Local cavitation number on node j - SigmaCavitCrit= ( ( p%Patm + ( p%Gravity * (p%FluidDepth - ( u%BladeMotion(j)%Position(3,i) + u%BladeMotion(j)%TranslationDisp(3,i) - u%HubMotion%Position(3,1))) * p%airDens) - p%Pvap ) / ( 0.5_ReKi * p%airDens * m%BEMT_y%Vrel(i,j)**2)) ! Critical value of Sigma, cavitation occurs if local cavitation number is greater than this - - if ( (SigmaCavitCrit < SigmaCavit) .and. (.not. (m%CavitWarnSet(i,j)) ) ) then - call WrScr( NewLine//'Cavitation occurred at blade '//trim(num2lstr(j))//' and node '//trim(num2lstr(i))//'.' ) - m%CavitWarnSet(i,j) = .true. - end if - - m%SigmaCavit(i,j)= SigmaCavit - m%SigmaCavitCrit(i,j)=SigmaCavitCrit + SigmaCavit= -1* m%BEMT_y%Cpmin(i,j) ! Local cavitation number on node j + SigmaCavitCrit= ( ( p%Patm + ( p%Gravity * (p%FluidDepth - ( u%BladeMotion(j)%Position(3,i) + u%BladeMotion(j)%TranslationDisp(3,i) - u%HubMotion%Position(3,1))) * p%airDens) - p%Pvap ) / ( 0.5_ReKi * p%airDens * m%BEMT_y%Vrel(i,j)**2)) ! Critical value of Sigma, cavitation occurs if local cavitation number is greater than this + + if ( (SigmaCavitCrit < SigmaCavit) .and. (.not. (m%CavitWarnSet(i,j)) ) ) then + call WrScr( NewLine//'Cavitation occurred at blade '//trim(num2lstr(j))//' and node '//trim(num2lstr(i))//'.' ) + m%CavitWarnSet(i,j) = .true. + end if + + m%SigmaCavit(i,j)= SigmaCavit + m%SigmaCavitCrit(i,j)=SigmaCavitCrit end do ! p%NumBlNds end do ! p%numBlades end if ! Cavitation check - - - !------------------------------------------------------- - ! get values to output to file: - !------------------------------------------------------- - if (CalcWriteOutput) then - if (p%NumOuts > 0) then - call Calc_WriteOutput( p, u, m, y, OtherState, xd, indx, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - !............................................................................................................................... - ! Place the selected output channels into the WriteOutput(:) array with the proper sign: - !............................................................................................................................... - - do i = 1,p%NumOuts ! Loop through all selected output channels - y%WriteOutput(i) = p%OutParam(i)%SignM * m%AllOuts( p%OutParam(i)%Indx ) - end do ! i - All selected output channels +end subroutine AD_CavtCrit - end if - - y%WriteOutput(p%NumOuts+1:) = 0.0_ReKi - - ! Now we need to populate the blade node outputs here - call Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, indx, ErrStat2, ErrMsg2 ) ! Call after normal writeoutput. Will just postpend data on here. - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - end if - - -#ifdef UA_OUTS - ! if ( mod(REAL(t,ReKi),.1) < p%dt) then - if (allocated(m%FVW%y_UA%WriteOutput)) & - WRITE (69, '(F20.6,'//trim(num2lstr(size(m%FVW%y_UA%WriteOutput)))//'(:,1x,ES19.5E3))') t, ( m%FVW%y_UA%WriteOutput(i), i=1,size(m%FVW%y_UA%WriteOutput)) - ! end if -#endif - - -end subroutine AD_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- !> Tight coupling routine for solving for the residual of the constraint state equations -subroutine AD_CalcConstrStateResidual( Time, u, p, x, xd, z, OtherState, m, z_residual, ErrStat, ErrMsg ) +subroutine AD_CalcConstrStateResidual( Time, u, p, p_AD, x, xd, z, OtherState, m, z_residual, ErrStat, ErrMsg ) !.................................................................................................................................. REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters TYPE(AD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time TYPE(AD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time TYPE(AD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time (possibly a guess) @@ -1313,58 +1519,93 @@ subroutine AD_CalcConstrStateResidual( Time, u, p, x, xd, z, OtherState, m, z_re !! the input values described above INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! Local variables - integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt + integer(intKi) :: iR ! rotor index integer(intKi) :: ErrStat2 character(ErrMsgLen) :: ErrMsg2 character(*), parameter :: RoutineName = 'AD_CalcConstrStateResidual' + ErrStat = ErrID_None + ErrMsg = "" + + + do iR=1, size(p%rotors) + call RotCalcConstrStateResidual( Time, u%rotors(iR), p%rotors(iR), p_AD, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), m%rotors(iR), z_residual%rotors(iR), ErrStat, ErrMsg ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + enddo + +end subroutine AD_CalcConstrStateResidual + +!> Tight coupling routine for solving for the residual of the constraint state equations +subroutine RotCalcConstrStateResidual( Time, u, p, p_AD, x, xd, z, OtherState, m, z_residual, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time (possibly a guess) + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at Time + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + TYPE(RotConstraintStateType), INTENT(INOUT) :: z_residual !< Residual of the constraint state equations using + !! the input values described above + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + ! Local variables + integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt + integer(intKi) :: iR ! rotor index + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'RotCalcConstrStateResidual' ErrStat = ErrID_None ErrMsg = "" - if (.not. allocated(Z_residual%BEMT%phi)) then ! BEMT_CalcConstrStateResidual expects memory to be allocated, so let's make sure it is - call AD_CopyConstrState( z, Z_residual, MESH_NEWCOPY, ErrStat2, ErrMsg2) + if (.not. allocated(z_residual%BEMT%phi)) then ! BEMT_CalcConstrStateResidual expects memory to be allocated, so let's make sure it is + call AD_CopyRotConstraintStateType( z, z_residual, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) end if - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) call BEMT_CalcConstrStateResidual( Time, m%BEMT_u(indx), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, m%BEMT, & - Z_residual%BEMT, p%AFI, ErrStat2, ErrMsg2 ) + z_residual%BEMT, p_AD%AFI, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - -end subroutine AD_CalcConstrStateResidual +end subroutine RotCalcConstrStateResidual + !---------------------------------------------------------------------------------------------------------------------------------- -subroutine AD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg ) +subroutine RotCalcContStateDeriv( t, u, p, p_AD, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg ) ! Tight coupling routine for computing derivatives of continuous states !.................................................................................................................................. REAL(DbKi), INTENT(IN ) :: t ! Current simulation time in seconds - TYPE(AD_InputType), INTENT(IN ) :: u ! Inputs at t - TYPE(AD_ParameterType), INTENT(IN ) :: p ! Parameters - TYPE(AD_ContinuousStateType), INTENT(IN ) :: x ! Continuous states at t - TYPE(AD_DiscreteStateType), INTENT(IN ) :: xd ! Discrete states at t - TYPE(AD_ConstraintStateType), INTENT(IN ) :: z ! Constraint states at t - TYPE(AD_OtherStateType), INTENT(IN ) :: OtherState ! Other states at t - TYPE(AD_MiscVarType), INTENT(INOUT) :: m ! Misc/optimization variables - TYPE(AD_ContinuousStateType), INTENT(INOUT) :: dxdt ! Continuous state derivatives at t + TYPE(RotInputType), INTENT(IN ) :: u ! Inputs at t + TYPE(RotParameterType), INTENT(IN ) :: p ! Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD ! Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x ! Continuous states at t + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd ! Discrete states at t + TYPE(RotConstraintStateType), INTENT(IN ) :: z ! Constraint states at t + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState ! Other states at t + TYPE(RotMiscVarType), INTENT(INOUT) :: m ! Misc/optimization variables + TYPE(RotContinuousStateType), INTENT(INOUT) :: dxdt ! Continuous state derivatives at t INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None ! local variables + INTEGER(IntKi) :: iR ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CalcContStateDeriv' + CHARACTER(*), PARAMETER :: RoutineName = 'RotCalcContStateDeriv' INTEGER(IntKi), parameter :: InputIndex = 1 @@ -1373,20 +1614,21 @@ subroutine AD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrSta ErrStat = ErrID_None ErrMsg = "" - call SetInputs(p, u, m, InputIndex, ErrStat2, ErrMsg2) + call SetInputs(p, p_AD, u, m, InputIndex, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call BEMT_CalcContStateDeriv( t, m%BEMT_u(InputIndex), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, m%BEMT, dxdt%BEMT, p%AFI, ErrStat2, ErrMsg2 ) + call BEMT_CalcContStateDeriv( t, m%BEMT_u(InputIndex), p%BEMT, x%BEMT, xd%BEMT, z%BEMT, OtherState%BEMT, m%BEMT, dxdt%BEMT, p_AD%AFI, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) -END SUBROUTINE AD_CalcContStateDeriv +END SUBROUTINE RotCalcContStateDeriv !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine converts the AeroDyn inputs into values that can be used for its submodules. It calculates the disturbed inflow !! on the blade if tower shadow or tower influence are enabled, then uses these values to set m%BEMT_u(indx). -subroutine SetInputs(p, u, m, indx, errStat, errMsg) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_InputType), intent(in ) :: u !< AD Inputs at Time - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables +subroutine SetInputs(p, p_AD, u, m, indx, errStat, errMsg) + type(RotParameterType), intent(in ) :: p !< AD parameters + type(AD_ParameterType), intent(in ) :: p_AD !< AD parameters + type(RotInputType), intent(in ) :: u !< AD Inputs at Time + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables integer, intent(in ) :: indx !< index into m%BEMT_u(indx) array; 1=t and 2=t+dt (but not checked here) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -1407,7 +1649,7 @@ subroutine SetInputs(p, u, m, indx, errStat, errMsg) m%DisturbedInflow = u%InflowOnBlade end if - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then ! This needs to extract the inputs from the AD data types (mesh) and massage them for the BEMT module call SetInputsForBEMT(p, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -1419,9 +1661,9 @@ end subroutine SetInputs !> This subroutine sets m%BEMT_u(indx). subroutine SetInputsForBEMT(p, u, m, indx, errStat, errMsg) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_InputType), intent(in ) :: u !< AD Inputs at Time - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(RotParameterType), intent(in ) :: p !< AD parameters + type(RotInputType), intent(in ) :: u !< AD Inputs at Time + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables integer, intent(in ) :: indx !< index into m%BEMT_u array; must be 1 or 2 (but not checked here) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -1539,9 +1781,9 @@ subroutine SetInputsForBEMT(p, u, m, indx, errStat, errMsg) end subroutine SetInputsForBEMT !---------------------------------------------------------------------------------------------------------------------------------- subroutine DiskAvgValues(p, u, m, x_hat_disk, y_hat_disk, z_hat_disk, Azimuth) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_InputType), intent(in ) :: u !< AD Inputs at Time - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(RotParameterType), intent(in ) :: p !< AD parameters + type(RotInputType), intent(in ) :: u !< AD Inputs at Time + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables real(R8Ki), intent( out) :: x_hat_disk(3) real(R8Ki), intent( out) :: y_hat_disk(3) real(R8Ki), intent( out) :: z_hat_disk(3) @@ -1590,9 +1832,9 @@ subroutine DiskAvgValues(p, u, m, x_hat_disk, y_hat_disk, z_hat_disk, Azimuth) end subroutine DiskAvgValues !---------------------------------------------------------------------------------------------------------------------------------- subroutine GeomWithoutSweepPitchTwist(p,u,m,thetaBladeNds,ErrStat,ErrMsg) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_InputType), intent(in ) :: u !< AD Inputs at Time - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(RotParameterType), intent(in ) :: p !< AD parameters + type(RotInputType), intent(in ) :: u !< AD Inputs at Time + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables real(R8Ki), intent( out) :: thetaBladeNds(p%NumBlNds,p%NumBlades) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -1660,56 +1902,74 @@ subroutine SetInputsForFVW(p, u, m, errStat, errMsg) real(R8Ki) :: x_hat_disk(3) real(R8Ki) :: y_hat_disk(3) real(R8Ki) :: z_hat_disk(3) - real(R8Ki) :: thetaBladeNds(p%NumBlNds,p%NumBlades) - real(R8Ki) :: Azimuth(p%NumBlades) + real(R8Ki), allocatable :: thetaBladeNds(:,:) + real(R8Ki), allocatable :: Azimuth(:) integer(intKi) :: tIndx + integer(intKi) :: iR ! Loop on rotors integer(intKi) :: k ! loop counter for blades character(*), parameter :: RoutineName = 'SetInputsForFVW' + if( size(p%rotors)>1) then + print*,'TODO FVW with multiple rotors' + STOP + endif + do tIndx=1,size(u) - ! Get disk average values and orientations - ! NOTE: needed because it sets m%V_diskAvg and m%V_dot_x, needed by CalcOutput.. - call DiskAvgValues(p, u(tIndx), m, x_hat_disk, y_hat_disk, z_hat_disk, Azimuth) - call GeomWithoutSweepPitchTwist(p,u(tIndx),m,thetaBladeNds,ErrStat,ErrMsg) - if (ErrStat >= AbortErrLev) return + do iR =1, 1 ! TODO TODO TODO + allocate(thetaBladeNds(p%rotors(iR)%NumBlNds, p%rotors(iR)%NumBlades)) + allocate(azimuth(p%rotors(iR)%NumBlades)) + ! Get disk average values and orientations + ! NOTE: needed because it sets m%V_diskAvg and m%V_dot_x, needed by CalcOutput.. + call DiskAvgValues(p%rotors(iR), u(tIndx)%rotors(iR), m%rotors(iR), x_hat_disk, y_hat_disk, z_hat_disk, Azimuth) + call GeomWithoutSweepPitchTwist(p%rotors(iR),u(tIndx)%rotors(iR), m%rotors(iR), thetaBladeNds,ErrStat,ErrMsg) + if (ErrStat >= AbortErrLev) return - ! Rather than use a meshcopy, we will just copy what we need to the WingsMesh - ! NOTE: MeshCopy requires the source mesh to be INOUT intent - ! NOTE2: If we change the WingsMesh to not be identical to the BladeMotion mesh, add the mapping stuff here. - do k=1,p%NumBlades - if ( u(tIndx)%BladeMotion(k)%nNodes /= m%FVW_u(tIndx)%WingsMesh(k)%nNodes ) then - ErrStat = ErrID_Fatal - ErrMsg = RoutineName//": WingsMesh contains different number of nodes than the BladeMotion mesh" - return - endif - m%FVW%PitchAndTwist(:,k) = thetaBladeNds(:,k) ! local pitch + twist (aerodyanmic + elastic) angle of the jth node in the kth blade - m%FVW_u(tIndx)%WingsMesh(k)%TranslationDisp = u(tIndx)%BladeMotion(k)%TranslationDisp - m%FVW_u(tIndx)%WingsMesh(k)%Orientation = u(tIndx)%BladeMotion(k)%Orientation - m%FVW_u(tIndx)%WingsMesh(k)%TranslationVel = u(tIndx)%BladeMotion(k)%TranslationVel - m%FVW_u(tIndx)%HubPosition = u(tIndx)%HubMotion%Position(:,1) + u(tIndx)%HubMotion%TranslationDisp(:,1) - m%FVW_u(tIndx)%HubOrientation = u(tIndx)%HubMotion%Orientation(:,:,1) - enddo + ! Rather than use a meshcopy, we will just copy what we need to the WingsMesh + ! NOTE: MeshCopy requires the source mesh to be INOUT intent + ! NOTE2: If we change the WingsMesh to not be identical to the BladeMotion mesh, add the mapping stuff here. + do k=1,p%rotors(iR)%NumBlades + if ( u(tIndx)%rotors(iR)%BladeMotion(k)%nNodes /= m%FVW_u(tIndx)%WingsMesh(k)%nNodes ) then + ErrStat = ErrID_Fatal + ErrMsg = RoutineName//": WingsMesh contains different number of nodes than the BladeMotion mesh" + return + endif + m%FVW%PitchAndTwist(:,k) = thetaBladeNds(:,k) ! local pitch + twist (aerodyanmic + elastic) angle of the jth node in the kth blade + m%FVW_u(tIndx)%WingsMesh(k)%TranslationDisp = u(tIndx)%rotors(iR)%BladeMotion(k)%TranslationDisp + m%FVW_u(tIndx)%WingsMesh(k)%Orientation = u(tIndx)%rotors(iR)%BladeMotion(k)%Orientation + m%FVW_u(tIndx)%WingsMesh(k)%TranslationVel = u(tIndx)%rotors(iR)%BladeMotion(k)%TranslationVel + m%FVW_u(tIndx)%HubPosition = u(tIndx)%rotors(iR)%HubMotion%Position(:,1) + u(tIndx)%rotors(iR)%HubMotion%TranslationDisp(:,1) + m%FVW_u(tIndx)%HubOrientation = u(tIndx)%rotors(iR)%HubMotion%Orientation(:,:,1) + enddo ! k blades + if (allocated(thetaBladeNds)) deallocate(thetaBladeNds) + if (allocated(azimuth)) deallocate(azimuth) + enddo ! iR, rotors if (ALLOCATED(m%FVW_u(tIndx)%V_wind)) then m%FVW_u(tIndx)%V_wind = u(tIndx)%InflowWakeVel ! Applying tower shadow to V_wind based on r_wind positions ! NOTE: m%DisturbedInflow also contains tower shadow and we need it for CalcOutput - if (p%TwrPotent /= TwrPotent_none .or. p%TwrShadow /= TwrShadow_none) then - if (p%FVW%TwrShadowOnWake) then - call TwrInflArray( p, u(tIndx), m, m%FVW%r_wind, m%FVW_u(tIndx)%V_wind, ErrStat, ErrMsg ) - if (ErrStat >= AbortErrLev) return - endif + if (p%FVW%TwrShadowOnWake) then + do iR =1, 1 ! TODO TODO TODO + if (p%rotors(iR)%TwrPotent /= TwrPotent_none .or. p%rotors(iR)%TwrShadow /= TwrShadow_none) then + call TwrInflArray( p%rotors(iR), u(tIndx)%rotors(iR), m%rotors(iR), m%FVW%r_wind, m%FVW_u(tIndx)%V_wind, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + endif + enddo end if endif enddo - m%FVW%Vwnd_ND = m%DisturbedInflow ! Nasty transfer for UA, but this is temporary, waiting for AeroDyn to handle UA + do iR =1, 1 ! TODO TODO TODO + m%FVW%Vwnd_ND = m%rotors(iR)%DisturbedInflow ! Nasty transfer for UA, but this is temporary, waiting for AeroDyn to handle UA + enddo + + end subroutine SetInputsForFVW !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets m%AA_u. subroutine SetInputsForAA(p, u, m, errStat, errMsg) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_InputType), intent(in ) :: u !< AD Inputs at Time - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(RotParameterType), intent(in ) :: p !< AD parameters + type(RotInputType), intent(in ) :: u !< AD Inputs at Time + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! local variables @@ -1746,9 +2006,9 @@ end subroutine SetInputsForAA !> This subroutine converts outputs from BEMT (stored in m%BEMT_y) into values on the AeroDyn BladeLoad output mesh. subroutine SetOutputsFromBEMT(p, m, y ) - type(AD_ParameterType), intent(in ) :: p !< AD parameters - type(AD_OutputType), intent(inout) :: y !< AD outputs - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(RotParameterType), intent(in ) :: p !< AD parameters + type(RotOutputType), intent(inout) :: y !< AD outputs + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables !type(BEMT_OutputType), intent(in ) :: BEMT_y ! BEMT outputs !real(ReKi), intent(in ) :: WithoutSweepPitchTwist(:,:,:,:) ! modified orientation matrix @@ -1789,7 +2049,8 @@ end subroutine SetOutputsFromBEMT !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine converts outputs from FVW (stored in m%FVW_y) into values on the AeroDyn BladeLoad output mesh. -subroutine SetOutputsFromFVW(u, p, OtherState, x, xd, m, y, ErrStat, ErrMsg) +subroutine SetOutputsFromFVW(t, u, p, OtherState, x, xd, m, y, ErrStat, ErrMsg) + REAL(DbKi), intent(in ) :: t TYPE(AD_InputType), intent(in ) :: u !< Inputs at Time t type(AD_ParameterType), intent(in ) :: p !< AD parameters type(AD_OtherStateType), intent(in ) :: OtherState !< OtherState @@ -1814,14 +2075,14 @@ subroutine SetOutputsFromFVW(u, p, OtherState, x, xd, m, y, ErrStat, ErrMsg) real(ReKi) :: theta ! Local variables that we store in misc for nodal outputs real(ReKi) :: AxInd, TanInd, Vrel, phi, alpha, Re - type(AFI_OutputType) :: AFI_interp ! Resulting values from lookup table real(ReKi) :: UrelWind_s(3) ! Relative wind (wind+str) in section coords real(ReKi) :: Cx, Cy real(ReKi) :: Cl_Static, Cd_Static, Cm_Static real(ReKi) :: Cl_dyn, Cd_dyn, Cm_dyn - type(UA_InputType) :: u_UA + type(UA_InputType) :: u_UA + integer(intKi) :: iR integer(intKi) :: ErrStat2 character(ErrMsgLen) :: ErrMsg2 @@ -1832,94 +2093,105 @@ subroutine SetOutputsFromFVW(u, p, OtherState, x, xd, m, y, ErrStat, ErrMsg) force(3) = 0.0_ReKi moment(1:2) = 0.0_ReKi - ! set all blade outputs for all nodes (needed in nodal outputs) - ! This loop is separated from below in case we want to move it later. - do k=1,p%numBlades - do j=1,p%NumBlNds - ! --- Computing main aero variables from induction - setting local variables - Vind = m%FVW_y%Vind(1:3,j,k) - Vstr = u%BladeMotion(k)%TranslationVel(1:3,j) - Vwnd = m%DisturbedInflow(1:3,j,k) ! NOTE: contains tower shadow - theta = m%FVW%PitchAndTwist(j,k) - call FVW_AeroOuts( m%WithoutSweepPitchTwist(1:3,1:3,j,k), u%BladeMotion(k)%Orientation(1:3,1:3,j), & ! inputs - theta, Vstr(1:3), Vind(1:3), VWnd(1:3), p%KinVisc, p%FVW%Chord(j,k), & ! inputs - AxInd, TanInd, Vrel, phi, alpha, Re, UrelWind_s(1:3), ErrStat2, ErrMsg2 ) ! outputs - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SetOutputsFromFVW') - - ! Compute steady Airfoil Coefs no matter what.. - call AFI_ComputeAirfoilCoefs( alpha, Re, 0.0_ReKi, p%AFI(p%FVW%AFindx(j,k)), AFI_interp, ErrStat, ErrMsg ) - Cl_Static = AFI_interp%Cl - Cd_Static = AFI_interp%Cd - Cm_Static = AFI_interp%Cm - - ! Set dynamic to the (will be same as static if UA_Flag is false) - Cl_dyn = AFI_interp%Cl - Cd_dyn = AFI_interp%Cd - Cm_dyn = AFI_interp%Cm - - if (m%FVW%UA_Flag) then - if ((OtherState%FVW%UA_Flag(j,k)) .and. ( .not. EqualRealNos(Vrel,0.0_ReKi) ) ) then - - ! ....... compute inputs to UA ........... - u_UA%alpha = alpha - u_UA%U = Vrel - u_UA%Re = Re - u_UA%UserProp = 0.0_ReKi ! FIX ME - - ! FIX ME: this is copied 3 times!!!! - u_UA%v_ac(1) = sin(u_UA%alpha)*u_UA%U - u_UA%v_ac(2) = cos(u_UA%alpha)*u_UA%U - u_UA%omega = dot_product( u%BladeMotion(k)%RotationVel( :,j), m%WithoutSweepPitchTwist(3,:,j,k) ) ! rotation of no-sweep-pitch coordinate system around z of the jth node in the kth blade - - call UA_CalcOutput(j, k, u_UA, m%FVW%p_UA, x%FVW%UA, xd%FVW%UA, OtherState%FVW%UA, p%AFI(p%FVW%AFindx(j,k)), m%FVW%y_UA, m%FVW%m_UA, errStat2, errMsg2 ) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SetOutputsFromFVW') - Cl_dyn = m%FVW%y_UA%Cl - Cd_dyn = m%FVW%y_UA%Cd - Cm_dyn = m%FVW%y_UA%Cm - - end if - end if - - cp = cos(phi) - sp = sin(phi) - Cx = Cl_dyn*cp + Cd_dyn*sp - Cy = Cl_dyn*sp - Cd_dyn*cp - - q = 0.5 * p%airDens * Vrel**2 ! dynamic pressure of the jth node in the kth blade - force(1) = Cx * q * p%FVW%Chord(j,k) ! X = normal force per unit length (normal to the plane, not chord) of the jth node in the kth blade - force(2) = -Cy * q * p%FVW%Chord(j,k) ! Y = tangential force per unit length (tangential to the plane, not chord) of the jth node in the kth blade - moment(3)= Cm_dyn * q * p%FVW%Chord(j,k)**2 ! M = pitching moment per unit length of the jth node in the kth blade - - ! save these values for possible output later: - m%X(j,k) = force(1) - m%Y(j,k) = force(2) - m%M(j,k) = moment(3) - - ! note: because force and moment are 1-d arrays, I'm calculating the transpose of the force and moment outputs - ! so that I don't have to take the transpose of WithoutSweepPitchTwist(:,:,j,k) - y%BladeLoad(k)%Force(:,j) = matmul( force, m%WithoutSweepPitchTwist(:,:,j,k) ) ! force per unit length of the jth node in the kth blade - y%BladeLoad(k)%Moment(:,j) = matmul( moment, m%WithoutSweepPitchTwist(:,:,j,k) ) ! moment per unit length of the jth node in the kth blade + if (size(p%rotors)>1) then + print *, 'FVW with multiple rotors TODO' + STOP + endif - ! Save results for outputs so we don't have to recalculate them all when we write outputs - m%FVW%BN_AxInd(j,k) = AxInd - m%FVW%BN_TanInd(j,k) = TanInd - m%FVW%BN_Vrel(j,k) = Vrel - m%FVW%BN_alpha(j,k) = alpha - m%FVW%BN_phi(j,k) = phi - m%FVW%BN_Re(j,k) = Re - m%FVW%BN_UrelWind_s(1:3,j,k) = UrelWind_s(1:3) - m%FVW%BN_Cl_Static(j,k) = Cl_Static - m%FVW%BN_Cd_Static(j,k) = Cd_Static - m%FVW%BN_Cm_Static(j,k) = Cm_Static - m%FVW%BN_Cl(j,k) = Cl_dyn - m%FVW%BN_Cd(j,k) = Cd_dyn - m%FVW%BN_Cm(j,k) = Cm_dyn - m%FVW%BN_Cx(j,k) = Cx - m%FVW%BN_Cy(j,k) = Cy - end do !j=nodes - end do !k=blades + do iR=1,size(p%rotors) + ! set all blade outputs for all nodes (needed in nodal outputs) + ! This loop is separated from below in case we want to move it later. + do k=1,p%rotors(iR)%numBlades + do j=1,p%rotors(iR)%NumBlNds + ! --- Computing main aero variables from induction - setting local variables + Vind = m%FVW_y%Vind(1:3,j,k) + Vstr = u%rotors(iR)%BladeMotion(k)%TranslationVel(1:3,j) + Vwnd = m%rotors(iR)%DisturbedInflow(1:3,j,k) ! NOTE: contains tower shadow + theta = m%FVW%PitchAndTwist(j,k) ! TODO + call FVW_AeroOuts( m%rotors(iR)%WithoutSweepPitchTwist(1:3,1:3,j,k), u%rotors(iR)%BladeMotion(k)%Orientation(1:3,1:3,j), & ! inputs + theta, Vstr(1:3), Vind(1:3), VWnd(1:3), p%rotors(iR)%KinVisc, p%FVW%Chord(j,k), & ! inputs + AxInd, TanInd, Vrel, phi, alpha, Re, UrelWind_s(1:3), ErrStat2, ErrMsg2 ) ! outputs + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SetOutputsFromFVW') + + ! Compute steady Airfoil Coefs no matter what.. + call AFI_ComputeAirfoilCoefs( alpha, Re, 0.0_ReKi, p%AFI(p%FVW%AFindx(j,k)), AFI_interp, ErrStat, ErrMsg ) + Cl_Static = AFI_interp%Cl + Cd_Static = AFI_interp%Cd + Cm_Static = AFI_interp%Cm + + ! Set dynamic to the (will be same as static if UA_Flag is false) + Cl_dyn = AFI_interp%Cl + Cd_dyn = AFI_interp%Cd + Cm_dyn = AFI_interp%Cm + + if (m%FVW%UA_Flag) then + ! ....... compute inputs to UA ........... + u_UA%alpha = alpha + u_UA%U = Vrel + u_UA%Re = Re + u_UA%UserProp = 0.0_ReKi ! FIX ME + + ! FIX ME: this is copied 3 times!!!! + u_UA%v_ac(1) = sin(u_UA%alpha)*u_UA%U + u_UA%v_ac(2) = cos(u_UA%alpha)*u_UA%U + u_UA%omega = dot_product( u%rotors(iR)%BladeMotion(k)%RotationVel( :,j), m%rotors(iR)%WithoutSweepPitchTwist(3,:,j,k) ) ! rotation of no-sweep-pitch coordinate system around z of the jth node in the kth blade + + call UA_CalcOutput(j, k, u_UA, m%FVW%p_UA, x%FVW%UA, xd%FVW%UA, OtherState%FVW%UA, p%AFI(p%FVW%AFindx(j,k)), m%FVW%y_UA, m%FVW%m_UA, errStat2, errMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SetOutputsFromFVW') + Cl_dyn = m%FVW%y_UA%Cl + Cd_dyn = m%FVW%y_UA%Cd + Cm_dyn = m%FVW%y_UA%Cm + + end if + + cp = cos(phi) + sp = sin(phi) + Cx = Cl_dyn*cp + Cd_dyn*sp + Cy = Cl_dyn*sp - Cd_dyn*cp + + q = 0.5 * p%rotors(iR)%airDens * Vrel**2 ! dynamic pressure of the jth node in the kth blade + force(1) = Cx * q * p%FVW%Chord(j,k) ! X = normal force per unit length (normal to the plane, not chord) of the jth node in the kth blade + force(2) = -Cy * q * p%FVW%Chord(j,k) ! Y = tangential force per unit length (tangential to the plane, not chord) of the jth node in the kth blade + moment(3)= Cm_dyn * q * p%FVW%Chord(j,k)**2 ! M = pitching moment per unit length of the jth node in the kth blade + + ! save these values for possible output later: + m%rotors(iR)%X(j,k) = force(1) + m%rotors(iR)%Y(j,k) = force(2) + m%rotors(iR)%M(j,k) = moment(3) + + ! note: because force and moment are 1-d arrays, I'm calculating the transpose of the force and moment outputs + ! so that I don't have to take the transpose of WithoutSweepPitchTwist(:,:,j,k) + y%rotors(iR)%BladeLoad(k)%Force(:,j) = matmul( force, m%rotors(iR)%WithoutSweepPitchTwist(:,:,j,k) ) ! force per unit length of the jth node in the kth blade + y%rotors(iR)%BladeLoad(k)%Moment(:,j) = matmul( moment, m%rotors(iR)%WithoutSweepPitchTwist(:,:,j,k) ) ! moment per unit length of the jth node in the kth blade + + ! Save results for outputs so we don't have to recalculate them all when we write outputs + m%FVW%BN_AxInd(j,k) = AxInd + m%FVW%BN_TanInd(j,k) = TanInd + m%FVW%BN_Vrel(j,k) = Vrel + m%FVW%BN_alpha(j,k) = alpha + m%FVW%BN_phi(j,k) = phi + m%FVW%BN_Re(j,k) = Re + m%FVW%BN_UrelWind_s(1:3,j,k) = UrelWind_s(1:3) + m%FVW%BN_Cl_Static(j,k) = Cl_Static + m%FVW%BN_Cd_Static(j,k) = Cd_Static + m%FVW%BN_Cm_Static(j,k) = Cm_Static + m%FVW%BN_Cl(j,k) = Cl_dyn + m%FVW%BN_Cd(j,k) = Cd_dyn + m%FVW%BN_Cm(j,k) = Cm_dyn + m%FVW%BN_Cx(j,k) = Cx + m%FVW%BN_Cy(j,k) = Cy + end do !j=nodes + end do !k=blades + end do ! iR rotors + + if ( m%FVW%UA_Flag ) then + ! if ( mod(REAL(t,ReKi),.1) < p%dt) then + call UA_WriteOutputToFile(t, m%FVW%p_UA, m%FVW%y_UA) + ! end if + end if + end subroutine SetOutputsFromFVW !---------------------------------------------------------------------------------------------------------------------------------- !> This routine validates the inputs from the AeroDyn input files. @@ -1940,7 +2212,7 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) type(AD_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine type(AD_InputFile), intent(in) :: InputFileData !< All the data in the AeroDyn input file - integer(IntKi), intent(in) :: NumBl !< Number of blades + integer(IntKi), intent(in) :: NumBl(:) !< Number of blades integer(IntKi), intent(out) :: ErrStat !< Error status character(*), intent(out) :: ErrMsg !< Error message @@ -1948,6 +2220,7 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) ! local variables integer(IntKi) :: k ! Blade number integer(IntKi) :: j ! node number + integer(IntKi) :: iR ! rotor index character(*), parameter :: RoutineName = 'ValidateInputData' ErrStat = ErrID_None @@ -1987,8 +2260,10 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) ! interpret for themselves if it's physical for their scenario, then it ! could go to TI~1. I'd recommend imposing limits of 0.05= 1.0) call SetErrStat ( ErrID_Fatal, 'The turbulence intensity for the Eames tower shadow model must be greater than 0.05 and less than 1.', ErrStat, ErrMsg, RoutineName ) - if ( maxval(InputFileData%TwrTI) > 0.4 .and. maxval(InputFileData%TwrTI) < 1.0) call SetErrStat ( ErrID_Warn, 'The turbulence intensity for the Eames tower shadow model above 0.4 may return unphysical results. Interpret with caution.', ErrStat, ErrMsg, RoutineName ) + do iR=1,size(NumBl) + if ( minval(InputFileData%rotors(iR)%TwrTI) <= 0.05 .or. maxval(InputFileData%rotors(iR)%TwrTI) >= 1.0) call SetErrStat ( ErrID_Fatal, 'The turbulence intensity for the Eames tower shadow model must be greater than 0.05 and less than 1.', ErrStat, ErrMsg, RoutineName ) + if ( maxval(InputFileData%rotors(iR)%TwrTI) > 0.4 .and. maxval(InputFileData%rotors(iR)%TwrTI) < 1.0) call SetErrStat ( ErrID_Warn, 'The turbulence intensity for the Eames tower shadow model above 0.4 may return unphysical results. Interpret with caution.', ErrStat, ErrMsg, RoutineName ) + enddo endif if (InputFileData%AirDens <= 0.0) call SetErrStat ( ErrID_Fatal, 'The air density (AirDens) must be greater than zero.', ErrStat, ErrMsg, RoutineName ) @@ -2026,66 +2301,70 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) ! ............................. ! check blade mesh data: ! ............................. - if ( InputFileData%BladeProps(1)%NumBlNds < 2 ) call SetErrStat( ErrID_Fatal, 'There must be at least two nodes per blade.',ErrStat, ErrMsg, RoutineName ) - do k=2,NumBl - if ( InputFileData%BladeProps(k)%NumBlNds /= InputFileData%BladeProps(k-1)%NumBlNds ) then - call SetErrStat( ErrID_Fatal, 'All blade property files must have the same number of blade nodes.', ErrStat, ErrMsg, RoutineName ) - exit ! exit do loop - end if - end do + do iR = 1,size(NumBl) + if ( InputFileData%rotors(iR)%BladeProps(1)%NumBlNds < 2 ) call SetErrStat( ErrID_Fatal, 'There must be at least two nodes per blade.',ErrStat, ErrMsg, RoutineName ) + do k=2,NumBl(iR) + if ( InputFileData%rotors(iR)%BladeProps(k)%NumBlNds /= InputFileData%rotors(iR)%BladeProps(k-1)%NumBlNds ) then + call SetErrStat( ErrID_Fatal, 'All blade property files must have the same number of blade nodes.', ErrStat, ErrMsg, RoutineName ) + exit ! exit do loop + end if + end do ! Check the list of airfoil tables for blades to make sure they are all within limits. - do k=1,NumBl - do j=1,InputFileData%BladeProps(k)%NumBlNds - if ( ( InputFileData%BladeProps(k)%BlAFID(j) < 1 ) .OR. ( InputFileData%BladeProps(k)%BlAFID(j) > InputFileData%NumAFfiles ) ) then - call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' node '//trim(Num2LStr(j))//' must be a number between 1 and NumAFfiles (' & - //TRIM(Num2LStr(InputFileData%NumAFfiles))//').', ErrStat, ErrMsg, RoutineName ) - end if - end do ! j=nodes - end do ! k=blades + do k=1,NumBl(iR) + do j=1,InputFileData%rotors(iR)%BladeProps(k)%NumBlNds + if ( ( InputFileData%rotors(iR)%BladeProps(k)%BlAFID(j) < 1 ) .OR. ( InputFileData%rotors(iR)%BladeProps(k)%BlAFID(j) > InputFileData%NumAFfiles ) ) then + call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' node '//trim(Num2LStr(j))//' must be a number between 1 and NumAFfiles (' & + //TRIM(Num2LStr(InputFileData%NumAFfiles))//').', ErrStat, ErrMsg, RoutineName ) + end if + end do ! j=nodes + end do ! k=blades ! Check that the blade chord is > 0. - do k=1,NumBl - do j=1,InputFileData%BladeProps(k)%NumBlNds - if ( InputFileData%BladeProps(k)%BlChord(j) <= 0.0_ReKi ) then - call SetErrStat( ErrID_Fatal, 'The chord for blade '//trim(Num2LStr(k))//' node '//trim(Num2LStr(j)) & - //' must be greater than 0.', ErrStat, ErrMsg, RoutineName ) - endif - end do ! j=nodes - end do ! k=blades - - do k=1,NumBl - if ( .not. EqualRealNos(InputFileData%BladeProps(k)%BlSpn(1), 0.0_ReKi) ) call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' span location must start at 0.0 m', ErrStat, ErrMsg, RoutineName) - do j=2,InputFileData%BladeProps(k)%NumBlNds - if ( InputFileData%BladeProps(k)%BlSpn(j) <= InputFileData%BladeProps(k)%BlSpn(j-1) ) then - call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' nodes must be entered in increasing elevation.', ErrStat, ErrMsg, RoutineName ) - exit - end if - end do ! j=nodes - end do ! k=blades + do k=1,NumBl(iR) + do j=1,InputFileData%rotors(iR)%BladeProps(k)%NumBlNds + if ( InputFileData%rotors(iR)%BladeProps(k)%BlChord(j) <= 0.0_ReKi ) then + call SetErrStat( ErrID_Fatal, 'The chord for blade '//trim(Num2LStr(k))//' node '//trim(Num2LStr(j)) & + //' must be greater than 0.', ErrStat, ErrMsg, RoutineName ) + endif + end do ! j=nodes + end do ! k=blades + + do k=1,NumBl(iR) + if ( .not. EqualRealNos(InputFileData%rotors(iR)%BladeProps(k)%BlSpn(1), 0.0_ReKi) ) call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' span location must start at 0.0 m', ErrStat, ErrMsg, RoutineName) + do j=2,InputFileData%rotors(iR)%BladeProps(k)%NumBlNds + if ( InputFileData%rotors(iR)%BladeProps(k)%BlSpn(j) <= InputFileData%rotors(iR)%BladeProps(k)%BlSpn(j-1) ) then + call SetErrStat( ErrID_Fatal, 'Blade '//trim(Num2LStr(k))//' nodes must be entered in increasing elevation.', ErrStat, ErrMsg, RoutineName ) + exit + end if + end do ! j=nodes + end do ! k=blades + end do ! iR rotor ! ............................. ! check tower mesh data: ! ............................. if (InputFileData%TwrPotent /= TwrPotent_none .or. InputFileData%TwrShadow /= TwrShadow_none .or. InputFileData%TwrAero ) then - if (InputFileData%NumTwrNds < 2) call SetErrStat( ErrID_Fatal, 'There must be at least two nodes on the tower.',ErrStat, ErrMsg, RoutineName ) ! Check that the tower diameter is > 0. - do j=1,InputFileData%NumTwrNds - if ( InputFileData%TwrDiam(j) <= 0.0_ReKi ) then - call SetErrStat( ErrID_Fatal, 'The diameter for tower node '//trim(Num2LStr(j))//' must be greater than 0.' & - , ErrStat, ErrMsg, RoutineName ) - end if - end do ! j=nodes - - ! check that the elevation is increasing: - do j=2,InputFileData%NumTwrNds - if ( InputFileData%TwrElev(j) <= InputFileData%TwrElev(j-1) ) then - call SetErrStat( ErrID_Fatal, 'The tower nodes must be entered in increasing elevation.', ErrStat, ErrMsg, RoutineName ) - exit - end if - end do ! j=nodes + do iR = 1,size(NumBl) + if (InputFileData%rotors(iR)%NumTwrNds < 2) call SetErrStat( ErrID_Fatal, 'There must be at least two nodes on the tower.',ErrStat, ErrMsg, RoutineName ) + do j=1,InputFileData%rotors(iR)%NumTwrNds + if ( InputFileData%rotors(iR)%TwrDiam(j) <= 0.0_ReKi ) then + call SetErrStat( ErrID_Fatal, 'The diameter for tower node '//trim(Num2LStr(j))//' must be greater than 0.' & + , ErrStat, ErrMsg, RoutineName ) + end if + end do ! j=nodes + + ! check that the elevation is increasing: + do j=2,InputFileData%rotors(iR)%NumTwrNds + if ( InputFileData%rotors(iR)%TwrElev(j) <= InputFileData%rotors(iR)%TwrElev(j-1) ) then + call SetErrStat( ErrID_Fatal, 'The tower nodes must be entered in increasing elevation.', ErrStat, ErrMsg, RoutineName ) + exit + end if + end do ! j=nodes + end do ! iR rotor end if @@ -2098,13 +2377,15 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) else ! Check to see if all TwOutNd(:) analysis points are existing analysis points: - do j=1,InputFileData%NTwOuts - if ( InputFileData%TwOutNd(j) < 1_IntKi .OR. InputFileData%TwOutNd(j) > InputFileData%NumTwrNds ) then - call SetErrStat( ErrID_Fatal, ' All TwOutNd values must be between 1 and '//& - trim( Num2LStr( InputFileData%NumTwrNds ) )//' (inclusive).', ErrStat, ErrMsg, RoutineName ) - exit ! stop checking this loop - end if - end do + do iR = 1,size(NumBl) + do j=1,InputFileData%NTwOuts + if ( InputFileData%TwOutNd(j) < 1_IntKi .OR. InputFileData%TwOutNd(j) > InputFileData%rotors(iR)%NumTwrNds ) then + call SetErrStat( ErrID_Fatal, ' All TwOutNd values must be between 1 and '//& + trim( Num2LStr( InputFileData%rotors(iR)%NumTwrNds ) )//' (inclusive).', ErrStat, ErrMsg, RoutineName ) + exit ! stop checking this loop + end if + end do + enddo ! iR end if @@ -2115,13 +2396,15 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) ! Check to see if all BlOutNd(:) analysis points are existing analysis points: - do j=1,InputFileData%NBlOuts - if ( InputFileData%BlOutNd(j) < 1_IntKi .OR. InputFileData%BlOutNd(j) > InputFileData%BladeProps(1)%NumBlNds ) then - call SetErrStat( ErrID_Fatal, ' All BlOutNd values must be between 1 and '//& - trim( Num2LStr( InputFileData%BladeProps(1)%NumBlNds ) )//' (inclusive).', ErrStat, ErrMsg, RoutineName ) - exit ! stop checking this loop - end if - end do + do iR = 1,size(NumBl) + do j=1,InputFileData%NBlOuts + if ( InputFileData%BlOutNd(j) < 1_IntKi .OR. InputFileData%BlOutNd(j) > InputFileData%rotors(iR)%BladeProps(1)%NumBlNds ) then + call SetErrStat( ErrID_Fatal, ' All BlOutNd values must be between 1 and '//& + trim( Num2LStr( InputFileData%rotors(iR)%BladeProps(1)%NumBlNds ) )//' (inclusive).', ErrStat, ErrMsg, RoutineName ) + exit ! stop checking this loop + end if + end do + end do ! iR, rotor end if @@ -2144,29 +2427,24 @@ SUBROUTINE ValidateInputData( InitInp, InputFileData, NumBl, ErrStat, ErrMsg ) end if end if - END SUBROUTINE ValidateInputData !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets up the data structures and initializes AirfoilInfo to get the necessary AFI parameters. It then verifies !! that the UA parameters are included in the AFI tables if UA is being used. -SUBROUTINE Init_AFIparams( InputFileData, p_AFI, UnEc, NumBl, ErrStat, ErrMsg ) +SUBROUTINE Init_AFIparams( InputFileData, p_AFI, UnEc, ErrStat, ErrMsg ) ! Passed variables type(AD_InputFile), intent(inout) :: InputFileData !< All the data in the AeroDyn input file (intent(out) only because of the call to MOVE_ALLOC) type(AFI_ParameterType), allocatable, intent( out) :: p_AFI(:) !< parameters returned from the AFI (airfoil info) module integer(IntKi), intent(in ) :: UnEc !< I/O unit for echo file. If > 0, file is open for writing. - integer(IntKi), intent(in ) :: NumBl !< number of blades (for performing check on valid airfoil data read in) integer(IntKi), intent( out) :: ErrStat !< Error status character(*), intent( out) :: ErrMsg !< Error message ! local variables type(AFI_InitInputType) :: AFI_InitInputs ! initialization data for the AFI routines - integer(IntKi) :: j ! loop counter for nodes - integer(IntKi) :: k ! loop counter for blades integer(IntKi) :: File ! loop counter for airfoil files - logical, allocatable :: fileUsed(:) integer(IntKi) :: ErrStat2 character(ErrMsgLen) :: ErrMsg2 @@ -2209,47 +2487,18 @@ SUBROUTINE Init_AFIparams( InputFileData, p_AFI, UnEc, NumBl, ErrStat, ErrMsg ) if (ErrStat >= AbortErrLev) return - ! check that we read the correct airfoil parameters for UA: - if ( InputFileData%AFAeroMod == AFAeroMod_BL_unsteady ) then - - ! determine which airfoil files will be used - call AllocAry( fileUsed, InputFileData%NumAFfiles, 'fileUsed', errStat2, errMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) - if (errStat >= AbortErrLev) return - fileUsed = .false. - - do k=1,NumBl - do j=1,InputFileData%BladeProps(k)%NumBlNds - fileUsed ( InputFileData%BladeProps(k)%BlAFID(j) ) = .true. - end do ! j=nodes - end do ! k=blades - - ! make sure all files in use have proper UA input parameters: - do File = 1,InputFileData%NumAFfiles - - if (fileUsed(File)) then - call UA_ValidateAFI(InputFileData%UAMod, p_AFI(File), InputFileData%AFNames(File), ErrStat2, ErrMsg2) - call SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) - if (errStat >= AbortErrLev) return - end if - - end do - - if ( allocated(fileUsed) ) deallocate(fileUsed) - - end if - - END SUBROUTINE Init_AFIparams !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes the Airfoil Noise module from within AeroDyn. -SUBROUTINE Init_AAmodule( DrvInitInp, AD_InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +SUBROUTINE Init_AAmodule( DrvInitInp, AD_InputFileData, RotInputFileData, u_AD, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) !.................................................................................................................................. - type(AD_InitInputType), intent(in ) :: DrvInitInp !< AeroDyn-level initialization inputs + type(RotInitInputType), intent(in ) :: DrvInitInp !< AeroDyn-level initialization inputs type(AD_InputFile), intent(in ) :: AD_InputFileData !< All the data in the AeroDyn input file - type(AD_InputType), intent(in ) :: u_AD !< AD inputs - used for input mesh node positions + type(RotInputFile), intent(in ) :: RotInputFileData !< Data in the AeroDyn input file related to current rotor + type(RotInputType), intent(in ) :: u_AD !< AD inputs - used for input mesh node positions type(AA_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined - type(AD_ParameterType), intent(inout) :: p !< Parameters ! intent out b/c we set the AA parameters here + type(RotParameterType), intent(inout) :: p !< Parameters ! intent out b/c we set the AA parameters here + type(AD_ParameterType), intent(inout) :: p_AD !< Parameters ! intent out b/c we set the AA parameters here type(AA_ContinuousStateType), intent( out) :: x !< Initial continuous states type(AA_DiscreteStateType), intent( out) :: xd !< Initial discrete states type(AA_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states @@ -2278,24 +2527,24 @@ SUBROUTINE Init_AAmodule( DrvInitInp, AD_InputFileData, u_AD, u, p, x, xd, z, Ot ErrMsg = "" ! Transfer from parameters and input file to init input - Interval = p%DT + Interval = p_AD%DT InitInp%NumBlades = p%NumBlades InitInp%NumBlNds = p%NumBlNds InitInp%airDens = AD_InputFileData%AirDens InitInp%kinVisc = AD_InputFileData%KinVisc InitInp%InputFile = AD_InputFileData%AA_InputFile - InitInp%RootName = DrvInitInp%RootName + InitInp%RootName = p_AD%RootName InitInp%SpdSound = AD_InputFileData%SpdSound InitInp%HubHeight = DrvInitInp%HubPosition(3) ! --- Transfer of airfoil info - ALLOCATE ( InitInp%AFInfo( size(p%AFI) ), STAT=ErrStat2 ) + ALLOCATE ( InitInp%AFInfo( size(p_AD%AFI) ), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Error allocating memory for the InitInp%AFInfo array.', ErrStat2, ErrMsg2, RoutineName ) RETURN ENDIF - do i=1,size(p%AFI) - call AFI_CopyParam( p%AFI(i), InitInp%AFInfo(i), MESH_NEWCOPY, errStat2, errMsg2 ) + do i=1,size(p_AD%AFI) + call AFI_CopyParam( p_AD%AFI(i), InitInp%AFInfo(i), MESH_NEWCOPY, errStat2, errMsg2 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) end do @@ -2312,10 +2561,10 @@ SUBROUTINE Init_AAmodule( DrvInitInp, AD_InputFileData, u_AD, u, p, x, xd, z, Ot return end if do k = 1, p%NumBlades - do j=1, AD_InputFileData%BladeProps(k)%NumBlNds - InitInp%BlChord(j,k) = AD_InputFileData%BladeProps(k)%BlChord( j) - InitInp%BlSpn (j,k) = AD_InputFileData%BladeProps(k)%BlSpn(j) - InitInp%BlAFID(j,k) = AD_InputFileData%BladeProps(k)%BlAFID(j) + do j=1, RotInputFileData%BladeProps(k)%NumBlNds + InitInp%BlChord(j,k) = RotInputFileData%BladeProps(k)%BlChord( j) + InitInp%BlSpn (j,k) = RotInputFileData%BladeProps(k)%BlSpn(j) + InitInp%BlAFID(j,k) = RotInputFileData%BladeProps(k)%BlAFID(j) end do end do @@ -2323,7 +2572,7 @@ SUBROUTINE Init_AAmodule( DrvInitInp, AD_InputFileData, u_AD, u, p, x, xd, z, Ot call AA_Init(InitInp, u, p%AA, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) - if (.not. equalRealNos(Interval, p%DT) ) then + if (.not. equalRealNos(Interval, p_AD%DT) ) then call SetErrStat( ErrID_Fatal, "DTAero was changed in Init_AAmodule(); this is not allowed.", ErrStat2, ErrMsg2, RoutineName) endif @@ -2339,13 +2588,15 @@ end subroutine Cleanup END SUBROUTINE Init_AAmodule !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes the BEMT module from within AeroDyn. -SUBROUTINE Init_BEMTmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +SUBROUTINE Init_BEMTmodule( InputFileData, RotInputFileData, u_AD, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) !.................................................................................................................................. type(AD_InputFile), intent(in ) :: InputFileData !< All the data in the AeroDyn input file - type(AD_InputType), intent(in ) :: u_AD !< AD inputs - used for input mesh node positions + type(RotInputFile), intent(in ) :: RotInputFileData !< Data in AeroDyn input file related to current rotor + type(RotInputType), intent(in ) :: u_AD !< AD inputs - used for input mesh node positions type(BEMT_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined - type(AD_ParameterType), intent(inout) :: p !< Parameters ! intent out b/c we set the BEMT parameters here + type(RotParameterType), intent(inout) :: p !< Parameters ! intent out b/c we set the BEMT parameters here + type(AD_ParameterType), intent(inout) :: p_AD !< Parameters ! intent out b/c we set the BEMT parameters here type(BEMT_ContinuousStateType), intent( out) :: x !< Initial continuous states type(BEMT_DiscreteStateType), intent( out) :: xd !< Initial discrete states type(BEMT_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states @@ -2383,7 +2634,7 @@ SUBROUTINE Init_BEMTmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, ! set initialization data here: - Interval = p%DT + Interval = p_AD%DT InitInp%numBlades = p%NumBlades InitInp%airDens = InputFileData%AirDens @@ -2401,6 +2652,7 @@ SUBROUTINE Init_BEMTmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, InitInp%numReIterations = 1 ! This is currently not available in the input file and is only for testing InitInp%maxIndIterations = InputFileData%MaxIter + call AllocAry(InitInp%chord, InitInp%numBladeNodes,InitInp%numBlades,'chord', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) call AllocAry(InitInp%AFindx,InitInp%numBladeNodes,InitInp%numBlades,'AFindx',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) call AllocAry(InitInp%zHub, InitInp%numBlades,'zHub', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -2445,8 +2697,8 @@ SUBROUTINE Init_BEMTmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, do k=1,p%numBlades do j=1,p%NumBlNds - InitInp%chord (j,k) = InputFileData%BladeProps(k)%BlChord(j) - InitInp%AFindx(j,k) = InputFileData%BladeProps(k)%BlAFID(j) + InitInp%chord (j,k) = RotInputFileData%BladeProps(k)%BlChord(j) + InitInp%AFindx(j,k) = RotInputFileData%BladeProps(k)%BlAFID(j) end do end do @@ -2468,10 +2720,10 @@ SUBROUTINE Init_BEMTmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, end if - call BEMT_Init(InitInp, u, p%BEMT, x, xd, z, OtherState, p%AFI, y, m, Interval, InitOut, ErrStat2, ErrMsg2 ) + call BEMT_Init(InitInp, u, p%BEMT, x, xd, z, OtherState, p_AD%AFI, y, m, Interval, InitOut, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) - if (.not. equalRealNos(Interval, p%DT) ) & + if (.not. equalRealNos(Interval, p_AD%DT) ) & call SetErrStat( ErrID_Fatal, "DTAero was changed in Init_BEMTmodule(); this is not allowed.", ErrStat2, ErrMsg2, RoutineName) !m%UseFrozenWake = .FALSE. !BJJ: set this in BEMT @@ -2484,11 +2736,12 @@ subroutine Cleanup() call BEMT_DestroyInitInput( InitInp, ErrStat2, ErrMsg2 ) call BEMT_DestroyInitOutput( InitOut, ErrStat2, ErrMsg2 ) end subroutine Cleanup + END SUBROUTINE Init_BEMTmodule !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes the FVW module from within AeroDyn. -SUBROUTINE Init_FVWmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +SUBROUTINE Init_FVWmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) !.................................................................................................................................. type(AD_InputFile), intent(in ) :: InputFileData !< All the data in the AeroDyn input file @@ -2499,9 +2752,7 @@ SUBROUTINE Init_FVWmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m type(FVW_DiscreteStateType), intent( out) :: xd !< Initial discrete states type(FVW_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states type(FVW_OtherStateType), intent( out) :: OtherState !< Initial other states - type(FVW_OutputType), intent( out) :: y !< Initial system outputs (outputs are not calculated; - !! only the output mesh is initialized) - type(FVW_MiscVarType), intent( out) :: m !< Initial misc/optimization variables + type(AD_MiscVarType), intent(inout) :: m !< Initial misc/optimization variables integer(IntKi), intent( out) :: errStat !< Error status of the operation character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None @@ -2518,6 +2769,7 @@ SUBROUTINE Init_FVWmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m integer(intKi) :: j ! node index integer(intKi) :: IB ! blade index + integer(intKi) :: iR ! rotor index real(ReKi) :: tmp(3), tmp_sz_y, tmp_sz real(ReKi) :: y_hat_disk(3) real(ReKi) :: z_hat_disk(3) @@ -2530,117 +2782,132 @@ SUBROUTINE Init_FVWmodule( InputFileData, u_AD, u, p, x, xd, z, OtherState, y, m ErrStat = ErrID_None ErrMsg = "" - ! set initialization data here: + if (size(p%rotors)>1) then + print*,'TODO FVW multi rot' + STOP + endif + InitInp%FVWFileName = InputFileData%FVWFileName - InitInp%numBlades = p%numBlades - InitInp%numBladeNodes = p%numBlNds InitInp%DTaero = p%DT ! NOTE: FVW can run a lower timestep internally - InitInp%KinVisc = p%KinVisc - InitInp%RootName = p%RootName(1:len_trim(p%RootName)-2) ! Removing "AD" - - ! NOTE: The following are not meshes - ! It's just the spanwise location. - ! Also, it is off compared to the initial position of the blade - ! Also, it's centered on the hub, but that's fine for now - call AllocAry(InitInp%Chord, InitInp%numBladeNodes,InitInp%numBlades,'chord', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(InitInp%AFindx,InitInp%numBladeNodes,InitInp%numBlades,'AFindx',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(InitInp%zHub, InitInp%numBlades,'zHub', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(InitInp%zLocal,InitInp%numBladeNodes,InitInp%numBlades,'zLocal',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(InitInp%rLocal,InitInp%numBladeNodes,InitInp%numBlades,'rLocal',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(InitInp%zTip, InitInp%numBlades,'zTip', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - if ( ErrStat >= AbortErrLev ) then - call Cleanup() - return - end if + do iR=1, size(p%rotors) + + InitInp%numBlades = p%rotors(iR)%numBlades + InitInp%numBladeNodes = p%rotors(iR)%numBlNds + InitInp%KinVisc = p%rotors(iR)%KinVisc + InitInp%RootName = p%RootName(1:len_trim(p%RootName)-2) ! Removing "AD" + + ! NOTE: The following are not meshes + ! It's just the spanwise location. + ! Also, it is off compared to the initial position of the blade + ! Also, it's centered on the hub, but that's fine for now + call AllocAry(InitInp%Chord, InitInp%numBladeNodes,InitInp%numBlades,'chord', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(InitInp%AFindx,InitInp%numBladeNodes,InitInp%numBlades,'AFindx',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(InitInp%zHub, InitInp%numBlades,'zHub', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(InitInp%zLocal,InitInp%numBladeNodes,InitInp%numBlades,'zLocal',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(InitInp%rLocal,InitInp%numBladeNodes,InitInp%numBlades,'rLocal',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(InitInp%zTip, InitInp%numBlades,'zTip', ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + if ( ErrStat >= AbortErrLev ) then + call Cleanup() + return + end if - ! Hub - do IB=1,p%numBlades - InitInp%zHub(IB) = TwoNorm( u_AD%BladeRootMotion(IB)%Position(:,1) - u_AD%HubMotion%Position(:,1) ) - if (EqualRealNos(InitInp%zHub(IB),0.0_ReKi) ) & - call SetErrStat( ErrID_Fatal, "zHub for blade "//trim(num2lstr(IB))//" is zero.", ErrStat, ErrMsg, RoutineName) - enddo - if (ErrStat >= AbortErrLev) then - call CleanUp() - RETURN - endif - - ! Distance along blade curve -- NOTE: this is an approximation. - do IB=1,p%numBlades - InitInp%zLocal(1,IB) = InitInp%zHub(IB) + TwoNorm( u_AD%BladeMotion(IB)%Position(:,1) - u_AD%BladeRootMotion(IB)%Position(:,1) ) - do j=2,p%NumBlNds - InitInp%zLocal(j,IB) = InitInp%zLocal(j-1,IB) + TwoNorm( u_AD%BladeMotion(IB)%Position(:,j) - u_AD%BladeMotion(IB)%Position(:,j-1) ) - end do !j=nodes - end do !IB=blades - ! Blade tip curve distance - do IB=1,p%numBlades - InitInp%zTip(IB) = InitInp%zLocal(p%NumBlNds,IB) - end do !IB=blades + ! Hub + do IB=1,p%rotors(iR)%numBlades + InitInp%zHub(IB) = TwoNorm( u_AD%rotors(iR)%BladeRootMotion(IB)%Position(:,1) - u_AD%rotors(iR)%HubMotion%Position(:,1) ) + if (EqualRealNos(InitInp%zHub(IB),0.0_ReKi) ) & + call SetErrStat( ErrID_Fatal, "zHub for blade "//trim(num2lstr(IB))//" is zero.", ErrStat, ErrMsg, RoutineName) + enddo + if (ErrStat >= AbortErrLev) then + call CleanUp() + RETURN + endif - ! Distance from blade to hub axis (includes hub radius) - y_hat_disk = u_AD%HubMotion%Orientation(2,:,1) - z_hat_disk = u_AD%HubMotion%Orientation(3,:,1) - do IB=1,p%numBlades - do j=1,p%NumBlNds - ! displaced position of the jth node in the kth blade relative to the hub: - tmp = u_AD%BladeMotion(IB)%Position(:,j) - u_AD%HubMotion%Position(:,1) - ! local radius (normalized distance from rotor centerline) - tmp_sz_y = dot_product( tmp, y_hat_disk )**2 - tmp_sz = dot_product( tmp, z_hat_disk )**2 - InitInp%rLocal(j,IB) = sqrt( tmp_sz + tmp_sz_y ) - end do !j=nodes - end do !IB=blades + ! Distance along blade curve -- NOTE: this is an approximation. + do IB=1,p%rotors(iR)%numBlades + InitInp%zLocal(1,IB) = InitInp%zHub(IB) + TwoNorm( u_AD%rotors(iR)%BladeMotion(IB)%Position(:,1) - u_AD%rotors(iR)%BladeRootMotion(IB)%Position(:,1) ) + do j=2,p%rotors(iR)%NumBlNds + InitInp%zLocal(j,IB) = InitInp%zLocal(j-1,IB) + TwoNorm( u_AD%rotors(iR)%BladeMotion(IB)%Position(:,j) - u_AD%rotors(iR)%BladeMotion(IB)%Position(:,j-1) ) + end do !j=nodes + end do !IB=blades + + ! Blade tip curve distance + do IB=1,p%rotors(iR)%numBlades + InitInp%zTip(IB) = InitInp%zLocal(p%rotors(iR)%NumBlNds,IB) + end do !IB=blades + + ! Distance from blade to hub axis (includes hub radius) + y_hat_disk = u_AD%rotors(iR)%HubMotion%Orientation(2,:,1) + z_hat_disk = u_AD%rotors(iR)%HubMotion%Orientation(3,:,1) + do IB=1,p%rotors(iR)%numBlades + do j=1,p%rotors(iR)%NumBlNds + ! displaced position of the jth node in the kth blade relative to the hub: + tmp = u_AD%rotors(iR)%BladeMotion(IB)%Position(:,j) - u_AD%rotors(iR)%HubMotion%Position(:,1) + ! local radius (normalized distance from rotor centerline) + tmp_sz_y = dot_product( tmp, y_hat_disk )**2 + tmp_sz = dot_product( tmp, z_hat_disk )**2 + InitInp%rLocal(j,IB) = sqrt( tmp_sz + tmp_sz_y ) + end do !j=nodes + end do !IB=blades - ! Copy over chord information - do IB=1,p%numBlades - do j=1,p%NumBlNds - InitInp%Chord (j,IB) = InputFileData%BladeProps(IB)%BlChord(j) - InitInp%AFindx(j,IB) = InputFileData%BladeProps(IB)%BlAFID(j) + ! Copy over chord information + do IB=1,p%rotors(iR)%numBlades + do j=1,p%rotors(iR)%NumBlNds + InitInp%Chord (j,IB) = InputFileData%rotors(iR)%BladeProps(IB)%BlChord(j) + InitInp%AFindx(j,IB) = InputFileData%rotors(iR)%BladeProps(IB)%BlAFID(j) + end do end do - end do - ! Unsteady Aero Data - InitInp%UA_Flag = InputFileData%AFAeroMod == AFAeroMod_BL_unsteady - InitInp%UAMod = InputFileData%UAMod - InitInp%Flookup = InputFileData%Flookup - InitInp%a_s = InputFileData%SpdSound + ! Unsteady Aero Data + InitInp%UA_Flag = InputFileData%AFAeroMod == AFAeroMod_BL_unsteady + InitInp%UAMod = InputFileData%UAMod + InitInp%Flookup = InputFileData%Flookup + InitInp%a_s = InputFileData%SpdSound + + ! Copy the mesh over for InitInp to FVW. We would not need to copy this if we decided to break the Framework + ! by passing u_AD%BladeMotion directly into FVW_Init, but nothing is really gained by doing that. + ALLOCATE( InitInp%WingsMesh(p%rotors(iR)%NumBlades), STAT = ErrStat2 ) ! TODO TODO + IF (ErrStat2 /= 0) THEN + CALL SetErrStat ( ErrID_Fatal, 'Could not allocate InitInp%WingsMesh (meshes)', ErrStat,ErrMsg,RoutineName ) + call Cleanup() + RETURN + END IF + DO IB = 1, p%rotors(iR)%NumBlades + CALL MeshCopy ( SrcMesh = u_AD%rotors(iR)%BladeMotion(IB) & + ,DestMesh = InitInp%WingsMesh(IB) & + ,CtrlCode = MESH_COUSIN & + ,Orientation = .TRUE. & + ,TranslationVel = .TRUE. & + ,RotationVel = .TRUE. & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 ) + CALL SetErrStat ( ErrStat2, ErrMsg2, ErrStat,ErrMsg,RoutineName ) + IF (ErrStat >= AbortErrLev) then + call Cleanup() + RETURN + endif + ENDDO - ! Copy the mesh over for InitInp to FVW. We would not need to copy this if we decided to break the Framework - ! by passing u_AD%BladeMotion directly into FVW_Init, but nothing is really gained by doing that. - ALLOCATE( InitInp%WingsMesh(p%NumBlades), STAT = ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat ( ErrID_Fatal, 'Could not allocate InitInp%WingsMesh (meshes)', ErrStat,ErrMsg,RoutineName ) - RETURN - END IF - DO IB = 1, p%NumBlades - CALL MeshCopy ( SrcMesh = u_AD%BladeMotion(IB) & - ,DestMesh = InitInp%WingsMesh(IB) & - ,CtrlCode = MESH_COUSIN & - ,Orientation = .TRUE. & - ,TranslationVel = .TRUE. & - ,RotationVel = .TRUE. & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 ) - CALL SetErrStat ( ErrStat2, ErrMsg2, ErrStat,ErrMsg,RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN - ENDDO + enddo ! iR, rotors TODO TODO ! NOTE: not passing p%AFI at present. We are not storing it in FVW's parameters. - call FVW_Init(p%AFI, InitInp, u, p%FVW, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat2, ErrMsg2 ) + call FVW_Init(p%AFI, InitInp, u, p%FVW, x, xd, z, OtherState, m%FVW_y, m%FVW, Interval, InitOut, ErrStat2, ErrMsg2 ) CALL SetErrStat ( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! set the size of the input and xd arrays for passing wind info to FVW. - if (ALLOCATED(m%r_wind)) then - call AllocAry(u_AD%InflowWakeVel, 3, size(m%r_wind,DIM=2), 'InflowWakeVel', ErrStat2,ErrMsg2) + if (ALLOCATED(m%FVW%r_wind)) then + call AllocAry(u_AD%InflowWakeVel, 3, size(m%FVW%r_wind,DIM=2), 'InflowWakeVel', ErrStat2,ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) endif if (.not. equalRealNos(Interval, p%DT) ) & call SetErrStat( ErrID_Fatal, "DTAero was changed in Init_FVWmodule(); this is not allowed yet.", ErrStat2, ErrMsg2, RoutineName) + call CleanUp() + contains subroutine Cleanup() call FVW_DestroyInitInput( InitInp, ErrStat2, ErrMsg2 ) @@ -2651,10 +2918,10 @@ END SUBROUTINE Init_FVWmodule !> This subroutine calculates the tower loads for the AeroDyn TowerLoad output mesh. SUBROUTINE ADTwr_CalcOutput(p, u, m, y, ErrStat, ErrMsg ) - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(AD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables - TYPE(AD_OutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + TYPE(RotOutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- !! nectivity information does not have to be recalculated) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -2708,7 +2975,7 @@ END SUBROUTINE ADTwr_CalcOutput !> This routine checks for invalid inputs to the tower influence models. SUBROUTINE CheckTwrInfl(u, ErrStat, ErrMsg ) - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -2743,9 +3010,9 @@ END SUBROUTINE CheckTwrInfl SUBROUTINE TwrInfl( p, u, m, ErrStat, ErrMsg ) !.................................................................................................................................. - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -2803,20 +3070,30 @@ SUBROUTINE TwrInfl( p, u, m, ErrStat, ErrMsg ) denom = (xbar**2 + ybar**2)**2 - u_TwrPotent = ( -1.0*xbar**2 + ybar**2 ) / denom - v_TwrPotent = ( -2.0*xbar * ybar ) / denom + if (equalRealNos(denom,0.0_ReKi)) then + u_TwrPotent = 0.0_ReKi + v_TwrPotent = 0.0_ReKi + else + u_TwrPotent = ( -1.0*xbar**2 + ybar**2 ) / denom + v_TwrPotent = ( -2.0*xbar * ybar ) / denom + end if elseif (p%TwrPotent == TwrPotent_Bak) then xbar = xbar + 0.1 - denom = (xbar**2 + ybar**2)**2 - u_TwrPotent = ( -1.0*xbar**2 + ybar**2 ) / denom - v_TwrPotent = ( -2.0*xbar * ybar ) / denom + denom = (xbar**2 + ybar**2)**2 + if (equalRealNos(denom,0.0_ReKi)) then + u_TwrPotent = 0.0_ReKi + v_TwrPotent = 0.0_ReKi + else + u_TwrPotent = ( -1.0*xbar**2 + ybar**2 ) / denom + v_TwrPotent = ( -2.0*xbar * ybar ) / denom - denom = TwoPi*(xbar**2 + ybar**2) - u_TwrPotent = u_TwrPotent + TwrCd*xbar / denom - v_TwrPotent = v_TwrPotent + TwrCd*ybar / denom + denom = TwoPi*(xbar**2 + ybar**2) + u_TwrPotent = u_TwrPotent + TwrCd*xbar / denom + v_TwrPotent = v_TwrPotent + TwrCd*ybar / denom + end if end if else @@ -2857,9 +3134,9 @@ END SUBROUTINE TwrInfl !! The subroutine has side effecs and modifies the inflow !! Relies heavily (i.e. unfortunate copy pasting), on TwrInfl SUBROUTINE TwrInflArray( p, u, m, Positions, Inflow, ErrStat, ErrMsg ) - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters - type(AD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + type(RotMiscVarType), intent(inout) :: m !< Misc/optimization variables real(ReKi), dimension(:,:), INTENT(IN ) :: Positions !< Positions where tower influence is to be computed real(ReKi), dimension(:,:), INTENT(INOUT) :: Inflow !< Undisturbed inflow (in) -> disturbed inflow (out) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -2969,8 +3246,8 @@ END SUBROUTINE TwrInflArray !! if u%TowerMotion does not have any nodes there will be serious problems. I assume that has been checked earlier. SUBROUTINE getLocalTowerProps(p, u, BladeNodePosition, theta_tower_trans, W_tower, xbar, ybar, zbar, TwrCd, TwrTI, TwrClrnc, ErrStat, ErrMsg) !.................................................................................................................................. - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters REAL(ReKi) ,INTENT(IN ) :: BladeNodePosition(3) !< local blade node position REAL(ReKi) ,INTENT( OUT) :: theta_tower_trans(3,3) !< transpose of local tower orientation expressed as a DCM REAL(ReKi) ,INTENT( OUT) :: W_tower !< local relative wind speed normal to the tower @@ -3021,8 +3298,8 @@ END SUBROUTINE getLocalTowerProps !! Adapted from modmesh_mapping::createmapping_projecttoline2() SUBROUTINE TwrInfl_NearestLine2Element(p, u, BladeNodePosition, r_TowerBlade, theta_tower_trans, W_tower, xbar, ybar, zbar, TwrCd, TwrTI, TwrDiam, found) !.................................................................................................................................. - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters REAL(ReKi) ,INTENT(IN ) :: BladeNodePosition(3) !< local blade node position REAL(ReKi) ,INTENT( OUT) :: r_TowerBlade(3) !< distance vector from tower to blade REAL(ReKi) ,INTENT( OUT) :: theta_tower_trans(3,3) !< transpose of local tower orientation expressed as a DCM @@ -3159,8 +3436,8 @@ END SUBROUTINE TwrInfl_NearestLine2Element !! distance away is found. SUBROUTINE TwrInfl_NearestPoint(p, u, BladeNodePosition, r_TowerBlade, theta_tower_trans, W_tower, xbar, ybar, zbar, TwrCd, TwrTI, TwrDiam) !.................................................................................................................................. - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs at Time t - TYPE(AD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters REAL(ReKi) ,INTENT(IN ) :: BladeNodePosition(3) !< local blade node position REAL(ReKi) ,INTENT( OUT) :: r_TowerBlade(3) !< distance vector from tower to blade REAL(ReKi) ,INTENT( OUT) :: theta_tower_trans(3,3) !< transpose of local tower orientation expressed as a DCM @@ -3301,6 +3578,47 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM TYPE(AD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdu(:,:) !< Partial derivatives of output functions (Y) with respect + !! to the inputs (u) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXdu(:,:) !< Partial derivatives of continuous state functions (X) with + !! respect to the inputs (u) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXddu(:,:) !< Partial derivatives of discrete state functions (Xd) with + !! respect to the inputs (u) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dZdu(:,:) !< Partial derivatives of constraint state functions (Z) with + ! + integer(IntKi), parameter :: iR =1 ! Rotor index + + if (size(p%rotors)>1) then + errStat = ErrID_Fatal + errMsg = 'Linearization with more than one rotor not supported' + return + endif + + call Rot_JacobianPInput( t, u%rotors(iR), p%rotors(iR), p, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), y%rotors(iR), m%rotors(iR), ErrStat, ErrMsg, dYdu, dXdu, dXddu, dZdu) + +END SUBROUTINE AD_JacobianPInput + !! respect to the inputs (u) [intent in to avoid deallocation] + +!> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions +!! with respect to the inputs (u). The partial derivatives dY/du, dX/du, dXd/du, and dZ/du are returned. +SUBROUTINE Rot_JacobianPInput( t, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdu, dXdu, dXddu, dZdu) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Time in seconds at operating point + TYPE(RotInputType), INTENT(INOUT) :: u !< Inputs at operating point (may change to inout if a mesh copy is required) + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at operating point + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at operating point + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point + TYPE(RotOutputType), INTENT(INOUT) :: y !< Output (change to inout if a mesh copy is required); + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., + !! connectivity) does not have to be recalculated for dYdu. + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdu(:,:) !< Partial derivatives of output functions (Y) with respect !! to the inputs (u) [intent in to avoid deallocation] REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXdu(:,:) !< Partial derivatives of continuous state functions (X) with @@ -3310,15 +3628,15 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dZdu(:,:) !< Partial derivatives of constraint state functions (Z) with !! respect to the inputs (u) [intent in to avoid deallocation] ! local variables - TYPE(AD_OutputType) :: y_p - TYPE(AD_OutputType) :: y_m - TYPE(AD_ContinuousStateType) :: x_p - TYPE(AD_ContinuousStateType) :: x_m - TYPE(AD_ContinuousStateType) :: x_init - TYPE(AD_ConstraintStateType) :: z_copy - TYPE(AD_OtherStateType) :: OtherState_copy - TYPE(AD_OtherStateType) :: OtherState_init - TYPE(AD_InputType) :: u_perturb + TYPE(RotOutputType) :: y_p + TYPE(RotOutputType) :: y_m + TYPE(RotContinuousStateType) :: x_p + TYPE(RotContinuousStateType) :: x_m + TYPE(RotContinuousStateType) :: x_init + TYPE(RotConstraintStateType) :: z_copy + TYPE(RotOtherStateType) :: OtherState_copy + TYPE(RotOtherStateType) :: OtherState_init + TYPE(RotInputType) :: u_perturb REAL(R8Ki) :: delta_p, delta_m ! delta change in input INTEGER(IntKi) :: i @@ -3336,7 +3654,7 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! get OP values here (i.e., set inputs for BEMT): if ( p%FrozenWake ) then - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later ! compare m%BEMT_y arguments with call to BEMT_CalcOutput @@ -3345,9 +3663,9 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM end if - call AD_CopyContState( x, x_init, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x, x_init, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOtherState( OtherState, OtherState_init, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOtherStateType( OtherState, OtherState_init, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then @@ -3357,16 +3675,16 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! initialize x_init so that we get accurrate values for first step if (.not. OtherState%BEMT%nodesInitialized ) then - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call BEMT_InitStates(t, m%BEMT_u(indx), p%BEMT, x_init%BEMT, xd%BEMT, z%BEMT, OtherState_init%BEMT, m%BEMT, p%AFI, ErrStat2, ErrMsg2 ) ! changes values only if states haven't been initialized + call BEMT_InitStates(t, m%BEMT_u(indx), p%BEMT, x_init%BEMT, xd%BEMT, z%BEMT, OtherState_init%BEMT, m%BEMT, p_AD%AFI, ErrStat2, ErrMsg2 ) ! changes values only if states haven't been initialized call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) end if ! make a copy of the inputs to perturb - call AD_CopyInput( u, u_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotInputType( u, u_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then call cleanup() @@ -3389,14 +3707,14 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! make a copy of outputs because we will need two for the central difference computations (with orientations) - call AD_CopyOutput( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOutput( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! make a copy of the states to perturb - call AD_CopyConstrState( z, z_copy, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotConstraintStateType( z, z_copy, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOtherState( OtherState_init, OtherState_copy, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOtherStateType( OtherState_init, OtherState_copy, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then @@ -3407,49 +3725,49 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM do i=1,size(p%Jac_u_indx,1) ! get u_op + delta_p u - call AD_CopyInput( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotInputType( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_u( p, i, 1, u_perturb, delta_p ) - call AD_CopyConstrState( z, z_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) + call AD_CopyRotConstraintStateType( z, z_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOtherState( OtherState_init, OtherState_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOtherStateType( OtherState_init, OtherState_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! get updated z%phi values: !call AD_UpdateStates( t, 1, (/u_perturb/), (/t/), p, x_copy, xd_copy, z_copy, OtherState_copy, m, errStat2, errMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) !bjj: this is what we want to do instead of the overkill of calling AD_UpdateStates - call SetInputs(p, u_perturb, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u_perturb, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later - call UpdatePhi( m%BEMT_u(indx), p%BEMT, z_copy%BEMT%phi, p%AFI, m%BEMT, OtherState_copy%BEMT%ValidPhi, errStat2, errMsg2 ) + call UpdatePhi( m%BEMT_u(indx), p%BEMT, z_copy%BEMT%phi, p_AD%AFI, m%BEMT, OtherState_copy%BEMT%ValidPhi, errStat2, errMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later ! compute y at u_op + delta_p u - call AD_CalcOutput( t, u_perturb, p, x_init, xd, z_copy, OtherState_copy, y_p, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u_perturb, p, p_AD, x_init, xd, z_copy, OtherState_copy, y_p, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later ! get u_op - delta_m u - call AD_CopyInput( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotInputType( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_u( p, i, -1, u_perturb, delta_m ) - call AD_CopyConstrState( z, z_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) + call AD_CopyRotConstraintStateType( z, z_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOtherState( OtherState, OtherState_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOtherStateType( OtherState, OtherState_copy, MESH_UPDATECOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! get updated z%phi values: - !call AD_UpdateStates( t, 1, (/u_perturb/), (/t/), p, x_copy, xd_copy, z_copy, OtherState_copy, m, errStat2, errMsg2 ) + !call RotUpdateStates( t, 1, (/u_perturb/), (/t/), p, x_copy, xd_copy, z_copy, OtherState_copy, m, errStat2, errMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call SetInputs(p, u_perturb, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u_perturb, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later - call UpdatePhi( m%BEMT_u(indx), p%BEMT, z_copy%BEMT%phi, p%AFI, m%BEMT, OtherState_copy%BEMT%ValidPhi, errStat2, errMsg2 ) + call UpdatePhi( m%BEMT_u(indx), p%BEMT, z_copy%BEMT%phi, p_AD%AFI, m%BEMT, OtherState_copy%BEMT%ValidPhi, errStat2, errMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later ! compute y at u_op - delta_m u - call AD_CalcOutput( t, u_perturb, p, x_init, xd, z_copy, OtherState_copy, y_m, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u_perturb, p, p_AD, x_init, xd, z_copy, OtherState_copy, y_m, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later @@ -3484,24 +3802,24 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM do i=1,size(p%Jac_u_indx,1) ! get u_op + delta u - call AD_CopyInput( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotInputType( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_u( p, i, 1, u_perturb, delta_p ) ! compute x at u_op + delta u ! note that this routine updates z%phi instead of using the actual state value, so we don't need to call UpdateStates/UpdatePhi here to get z_op + delta_z: - call AD_CalcContStateDeriv( t, u_perturb, p, x_init, xd, z, OtherState_init, m, x_p, ErrStat2, ErrMsg2 ) + call RotCalcContStateDeriv( t, u_perturb, p, p_AD, x_init, xd, z, OtherState_init, m, x_p, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! get u_op - delta u - call AD_CopyInput( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotInputType( u, u_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_u( p, i, -1, u_perturb, delta_m ) ! compute x at u_op - delta u ! note that this routine updates z%phi instead of using the actual state value, so we don't need to call UpdateStates here to get z_op + delta_z: - call AD_CalcContStateDeriv( t, u_perturb, p, x_init, xd, z, OtherState_init, m, x_m, ErrStat2, ErrMsg2 ) + call RotCalcContStateDeriv( t, u_perturb, p, p_AD, x_init, xd, z, OtherState_init, m, x_m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -3518,8 +3836,8 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM end do - call AD_DestroyContState( x_p, ErrStat2, ErrMsg2 ) ! we don't need this any more - call AD_DestroyContState( x_m, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotContinuousStateType( x_p, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotContinuousStateType( x_m, ErrStat2, ErrMsg2 ) ! we don't need this any more END IF IF ( PRESENT( dXddu ) ) THEN @@ -3535,20 +3853,20 @@ SUBROUTINE AD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM subroutine cleanup() m%BEMT%UseFrozenWake = .false. - call AD_DestroyOutput( y_p, ErrStat2, ErrMsg2) - call AD_DestroyOutput( y_m, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_p, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_m, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_init, ErrStat2, ErrMsg2) - call AD_DestroyConstrState( z_copy, ErrStat2, ErrMsg2) - call AD_DestroyOtherState( OtherState_copy, ErrStat2, ErrMsg2) - call AD_DestroyOtherState( OtherState_init, ErrStat2, ErrMsg2) - - call AD_DestroyInput( u_perturb, ErrStat2, ErrMsg2 ) + call AD_DestroyRotOutputType( y_p, ErrStat2, ErrMsg2) + call AD_DestroyRotOutputType( y_m, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( x_p, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( x_m, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( x_init, ErrStat2, ErrMsg2) + call AD_DestroyRotConstraintStateType( z_copy, ErrStat2, ErrMsg2) + call AD_DestroyRotOtherStateType( OtherState_copy, ErrStat2, ErrMsg2) + call AD_DestroyRotOtherStateType( OtherState_init, ErrStat2, ErrMsg2) + + call AD_DestroyRotInputType( u_perturb, ErrStat2, ErrMsg2 ) end subroutine cleanup -END SUBROUTINE AD_JacobianPInput -!---------------------------------------------------------------------------------------------------------------------------------- +END SUBROUTINE Rot_JacobianPInput + !> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions !! with respect to the continuous states (x). The partial derivatives dY/dx, dX/dx, dXd/dx, and dZ/dx are returned. SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdx, dXdx, dXddx, dZdx ) @@ -3568,6 +3886,53 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, TYPE(AD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdx(:,:) !< Partial derivatives of output functions + !! (Y) with respect to the continuous + !! states (x) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXdx(:,:) !< Partial derivatives of continuous state + !! functions (X) with respect to + !! the continuous states (x) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXddx(:,:) !< Partial derivatives of discrete state + !! functions (Xd) with respect to + !! the continuous states (x) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dZdx(:,:) !< Partial derivatives of constraint state + !! functions (Z) with respect to + !! the continuous states (x) [intent in to avoid deallocation] + ! + integer(IntKi), parameter :: iR =1 ! Rotor index + + if (size(p%rotors)>1) then + errStat = ErrID_Fatal + errMsg = 'Linearization with more than one rotor not supported' + return + endif + + call RotJacobianPContState( t, u%rotors(iR), p%rotors(iR), p, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), y%rotors(iR), m%rotors(iR), ErrStat, ErrMsg, dYdx, dXdx, dXddx, dZdx ) + + +END SUBROUTINE AD_JacobianPContState + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions +!! with respect to the continuous states (x). The partial derivatives dY/dx, dX/dx, dXd/dx, and dZ/dx are returned. +SUBROUTINE RotJacobianPContState( t, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdx, dXdx, dXddx, dZdx ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Time in seconds at operating point + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at operating point (may change to inout if a mesh copy is required) + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at operating point + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at operating point + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point + TYPE(RotOutputType), INTENT(INOUT) :: y !< Output (change to inout if a mesh copy is required); + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., + !! connectivity) does not have to be recalculated for dYdx. + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdx(:,:) !< Partial derivatives of output functions !! (Y) with respect to the continuous !! states (x) [intent in to avoid deallocation] @@ -3582,15 +3947,15 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, !! the continuous states (x) [intent in to avoid deallocation] ! local variables - TYPE(AD_OutputType) :: y_p - TYPE(AD_OutputType) :: y_m - TYPE(AD_ContinuousStateType) :: x_p - TYPE(AD_ContinuousStateType) :: x_m - TYPE(AD_ContinuousStateType) :: x_perturb - TYPE(AD_ContinuousStateType) :: x_init - TYPE(AD_OtherStateType) :: OtherState_init + TYPE(RotOutputType) :: y_p + TYPE(RotOutputType) :: y_m + TYPE(RotContinuousStateType) :: x_p + TYPE(RotContinuousStateType) :: x_m + TYPE(RotContinuousStateType) :: x_perturb + TYPE(RotContinuousStateType) :: x_init + TYPE(RotOtherStateType) :: OtherState_init REAL(R8Ki) :: delta_p, delta_m ! delta change in state - INTEGER(IntKi) :: i, k + INTEGER(IntKi) :: i integer, parameter :: indx = 1 ! m%BEMT_u(1) is at t; m%BEMT_u(2) is t+dt integer(intKi) :: ErrStat2 @@ -3605,7 +3970,7 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, if ( p%FrozenWake ) then - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! compare arguments with call to BEMT_CalcOutput @@ -3614,12 +3979,12 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, end if - call AD_CopyContState( x, x_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x, x_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyContState( x, x_init, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x, x_init, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOtherState( OtherState, OtherState_init, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOtherStateType( OtherState, OtherState_init, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then @@ -3629,10 +3994,10 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ! initialize x_init so that we get accurrate values for if (.not. OtherState%BEMT%nodesInitialized ) then - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call BEMT_InitStates(t, m%BEMT_u(indx), p%BEMT, x_init%BEMT, xd%BEMT, z%BEMT, OtherState_init%BEMT, m%BEMT, p%AFI, ErrStat2, ErrMsg2 ) ! changes values only if states haven't been initialized + call BEMT_InitStates(t, m%BEMT_u(indx), p%BEMT, x_init%BEMT, xd%BEMT, z%BEMT, OtherState_init%BEMT, m%BEMT, p_AD%AFI, ErrStat2, ErrMsg2 ) ! changes values only if states haven't been initialized call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) end if @@ -3652,9 +4017,9 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, end if ! make a copy of outputs because we will need two for the central difference computations (with orientations) - call AD_CopyOutput( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOutput( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then call cleanup() @@ -3664,25 +4029,25 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, do i=1,size(p%dx) ! get x_op + delta_p x - call AD_CopyContState( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_x( p, i, 1, x_perturb, delta_p ) ! compute y at x_op + delta_p x ! NOTE: z_op is the same as z because x_perturb does not affect the values of phi, thus I am not updating the states or calling UpdatePhi to get z_perturb. - call AD_CalcOutput( t, u, p, x_perturb, xd, z, OtherState_init, y_p, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u, p, p_AD, x_perturb, xd, z, OtherState_init, y_p, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later ! get x_op - delta_m x - call AD_CopyContState( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_x( p, i, -1, x_perturb, delta_m ) ! compute y at x_op - delta_m x ! NOTE: z_op is the same as z because x_perturb does not affect the values of phi, thus I am not updating the states or calling UpdatePhi to get z_perturb. - call AD_CalcOutput( t, u, p, x_perturb, xd, z, OtherState_init, y_m, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u, p, p_AD, x_perturb, xd, z, OtherState_init, y_m, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later @@ -3696,8 +4061,8 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, call cleanup() return end if - call AD_DestroyOutput( y_p, ErrStat2, ErrMsg2 ) ! we don't need this any more - call AD_DestroyOutput( y_m, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotOutputType( y_p, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotOutputType( y_m, ErrStat2, ErrMsg2 ) ! we don't need this any more END IF @@ -3723,24 +4088,24 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, do i=1,size(p%dx,1) ! get x_op + delta x - call AD_CopyContState( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_x( p, i, 1, x_perturb, delta_p ) ! compute X at x_op + delta x ! NOTE: z_op is the same as z because x_perturb does not affect the values of phi, thus I am not updating the states or calling UpdatePhi to get z_perturb. - call AD_CalcContStateDeriv( t, u, p, x_perturb, xd, z, OtherState_init, m, x_p, ErrStat2, ErrMsg2 ) + call RotCalcContStateDeriv( t, u, p, p_AD, x_perturb, xd, z, OtherState_init, m, x_p, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! get x_op - delta x - call AD_CopyContState( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotContinuousStateType( x_init, x_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call Perturb_x( p, i, -1, x_perturb, delta_m ) ! compute x at u_op - delta u ! NOTE: z_op is the same as z because x_perturb does not affect the values of phi, thus I am not updating the states or calling UpdatePhi to get z_perturb. - call AD_CalcContStateDeriv( t, u, p, x_perturb, xd, z, OtherState_init, m, x_m, ErrStat2, ErrMsg2 ) + call RotCalcContStateDeriv( t, u, p, p_AD, x_perturb, xd, z, OtherState_init, m, x_m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -3757,8 +4122,8 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, end do - call AD_DestroyContState( x_p, ErrStat2, ErrMsg2 ) ! we don't need this any more - call AD_DestroyContState( x_m, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotContinuousStateType( x_p, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotContinuousStateType( x_m, ErrStat2, ErrMsg2 ) ! we don't need this any more END IF @@ -3785,17 +4150,17 @@ SUBROUTINE AD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat, subroutine cleanup() m%BEMT%UseFrozenWake = .false. - call AD_DestroyOutput( y_p, ErrStat2, ErrMsg2) - call AD_DestroyOutput( y_m, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_p, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_m, ErrStat2, ErrMsg2) + call AD_DestroyRotOutputType( y_p, ErrStat2, ErrMsg2) + call AD_DestroyRotOutputType( y_m, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( x_p, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( x_m, ErrStat2, ErrMsg2) - call AD_DestroyContState( x_perturb, ErrStat2, ErrMsg2 ) - call AD_DestroyContState( x_init, ErrStat2, ErrMsg2 ) - call AD_DestroyOtherState( OtherState_init, ErrStat2, ErrMsg2 ) + call AD_DestroyRotContinuousStateType( x_perturb, ErrStat2, ErrMsg2 ) + call AD_DestroyRotContinuousStateType( x_init, ErrStat2, ErrMsg2 ) + call AD_DestroyRotOtherStateType( OtherState_init, ErrStat2, ErrMsg2 ) end subroutine cleanup -END SUBROUTINE AD_JacobianPContState +END SUBROUTINE RotJacobianPContState !---------------------------------------------------------------------------------------------------------------------------------- !> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions !! with respect to the discrete states (xd). The partial derivatives dY/dxd, dX/dxd, dXd/dxd, and dZ/dxd are returned. @@ -3890,6 +4255,51 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat TYPE(AD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdz(:,:) !< Partial derivatives of output + !! functions (Y) with respect to the + !! constraint states (z) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXdz(:,:) !< Partial derivatives of continuous + !! state functions (X) with respect to + !! the constraint states (z) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXddz(:,:) !< Partial derivatives of discrete state + !! functions (Xd) with respect to the + !! constraint states (z) [intent in to avoid deallocation] + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dZdz(:,:) !< Partial derivatives of constraint + !! state functions (Z) with respect to + !! the constraint states (z) [intent in to avoid deallocation] + ! + integer(IntKi), parameter :: iR =1 ! Rotor index + + if (size(p%rotors)>1) then + errStat = ErrID_Fatal + errMsg = 'Linearization with more than one rotor not supported' + return + endif + + call RotJacobianPConstrState( t, u%rotors(iR), p%rotors(iR), p, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), y%rotors(iR), m%rotors(iR), errStat, errMsg, dYdz, dXdz, dXddz, dZdz ) + +END SUBROUTINE AD_JacobianPConstrState +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions +!! with respect to the constraint states (z). The partial derivatives dY/dz, dX/dz, dXd/dz, and dZ/dz are returned. +SUBROUTINE RotJacobianPConstrState( t, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdz, dXdz, dXddz, dZdz ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Time in seconds at operating point + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at operating point (may change to inout if a mesh copy is required) + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at operating point + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at operating point + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point + TYPE(RotOutputType), INTENT(INOUT) :: y !< Output (change to inout if a mesh copy is required); + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., + !! connectivity) does not have to be recalculated for dYdz. + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dYdz(:,:) !< Partial derivatives of output !! functions (Y) with respect to the !! constraint states (z) [intent in to avoid deallocation] @@ -3904,11 +4314,11 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat !! the constraint states (z) [intent in to avoid deallocation] ! local variables - TYPE(AD_OutputType) :: y_p - TYPE(AD_OutputType) :: y_m - TYPE(AD_ConstraintStateType) :: Z_p - TYPE(AD_ConstraintStateType) :: Z_m - TYPE(AD_ConstraintStateType) :: z_perturb + TYPE(RotOutputType) :: y_p + TYPE(RotOutputType) :: y_m + TYPE(RotConstraintStateType) :: Z_p + TYPE(RotConstraintStateType) :: Z_m + TYPE(RotConstraintStateType) :: z_perturb REAL(R8Ki) :: delta_p, delta_m ! delta change in state INTEGER(IntKi) :: i, j, k, n, k2, j2 @@ -3929,7 +4339,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat ! get OP values here: !call AD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) ! (bjj: is this necessary? if not, still need to get BEMT inputs) - call SetInputs(p, u, m, indx, errStat2, errMsg2) + call SetInputs(p, p_AD, u, m, indx, errStat2, errMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later call BEMT_CopyInput( m%BEMT_u(indx), m%BEMT_u(op_indx), MESH_UPDATECOPY, ErrStat2, ErrMsg2) ! copy the BEMT OP inputs to a temporary location that won't be overwritten call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later @@ -3943,7 +4353,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat ! make a copy of the constraint states to perturb - call AD_CopyConstrState( z, z_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotConstraintStateType( z, z_perturb, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then call cleanup() @@ -3967,9 +4377,9 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat ! make a copy of outputs because we will need two for the central difference computations (with orientations) - call AD_CopyOutput( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_p, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AD_CopyOutput( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) + call AD_CopyRotOutputType( y, y_m, MESH_NEWCOPY, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then call cleanup() @@ -3994,7 +4404,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat z_perturb%BEMT%phi(j,k) = z%BEMT%phi(j,k) + delta_p ! compute y at z_op + delta_p z - call AD_CalcOutput( t, u, p, x, xd, z_perturb, OtherState, y_p, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u, p, p_AD, x, xd, z_perturb, OtherState, y_p, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later @@ -4002,7 +4412,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat z_perturb%BEMT%phi(j,k) = z%BEMT%phi(j,k) - delta_m ! compute y at z_op - delta_m z - call AD_CalcOutput( t, u, p, x, xd, z_perturb, OtherState, y_m, m, ErrStat2, ErrMsg2 ) + call RotCalcOutput( t, u, p, p_AD, x, xd, z_perturb, OtherState, y_m, m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! we shouldn't have any errors about allocating memory here so I'm not going to return-on-error until later @@ -4021,8 +4431,8 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat call cleanup() return end if - call AD_DestroyOutput( y_p, ErrStat2, ErrMsg2 ) ! we don't need this any more - call AD_DestroyOutput( y_m, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotOutputType( y_p, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotOutputType( y_m, ErrStat2, ErrMsg2 ) ! we don't need this any more END IF @@ -4057,7 +4467,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat end if - call AD_CopyConstrState( z, z_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + call AD_CopyRotConstraintStateType( z, z_perturb, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) do k=1,p%NumBlades ! size(z%BEMT%Phi,2) do j=1,p%NumBlNds ! size(z%BEMT%Phi,1) @@ -4075,7 +4485,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat z_perturb%BEMT%phi(j,k) = z%BEMT%phi(j,k) + delta_p ! compute z_p at z_op + delta_p z - call AD_CalcConstrStateResidual( t, u, p, x, xd, z_perturb, OtherState, m, z_p, ErrStat2, ErrMsg2 ) + call RotCalcConstrStateResidual( t, u, p, p_AD, x, xd, z_perturb, OtherState, m, z_p, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -4083,7 +4493,7 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat z_perturb%BEMT%phi(j,k) = z%BEMT%phi(j,k) - delta_m ! compute z_m at u_op - delta_m u - call AD_CalcConstrStateResidual( t, u, p, x, xd, z_perturb, OtherState, m, z_m, ErrStat2, ErrMsg2 ) + call RotCalcConstrStateResidual( t, u, p, p_AD, x, xd, z_perturb, OtherState, m, z_m, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then call cleanup() @@ -4109,8 +4519,8 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat end do end do - call AD_DestroyConstrState( z_p, ErrStat2, ErrMsg2 ) ! we don't need this any more - call AD_DestroyConstrState( z_m, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotConstraintStateType( z_p, ErrStat2, ErrMsg2 ) ! we don't need this any more + call AD_DestroyRotConstraintStateType( z_m, ErrStat2, ErrMsg2 ) ! we don't need this any more END IF @@ -4120,14 +4530,14 @@ SUBROUTINE AD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrStat subroutine cleanup() m%BEMT%UseFrozenWake = .false. - call AD_DestroyOutput( y_p, ErrStat2, ErrMsg2 ) - call AD_DestroyOutput( y_m, ErrStat2, ErrMsg2 ) - call AD_DestroyConstrState( z_p, ErrStat2, ErrMsg2 ) - call AD_DestroyConstrState( z_m, ErrStat2, ErrMsg2 ) - call AD_DestroyConstrState( z_perturb, ErrStat2, ErrMsg2 ) + call AD_DestroyRotOutputType( y_p, ErrStat2, ErrMsg2 ) + call AD_DestroyRotOutputType( y_m, ErrStat2, ErrMsg2 ) + call AD_DestroyRotConstraintStateType( z_p, ErrStat2, ErrMsg2 ) + call AD_DestroyRotConstraintStateType( z_m, ErrStat2, ErrMsg2 ) + call AD_DestroyRotConstraintStateType( z_perturb, ErrStat2, ErrMsg2 ) end subroutine cleanup -END SUBROUTINE AD_JacobianPConstrState +END SUBROUTINE RotJacobianPConstrState !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !> Routine to pack the data structures representing the operating points into arrays for linearization. SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, y_op, x_op, dx_op, xd_op, z_op ) @@ -4149,6 +4559,41 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dx_op(:) !< values of first time derivatives of linearized continuous states REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: xd_op(:) !< values of linearized discrete states REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: z_op(:) !< values of linearized constraint states + ! + integer(IntKi), parameter :: iR =1 ! Rotor index + + if (size(p%rotors)>1) then + errStat = ErrID_Fatal + errMsg = 'Linearization with more than one rotor not supported' + return + endif + + call RotGetOP( t, u%rotors(iR), p%rotors(iR), p, x%rotors(iR), xd%rotors(iR), z%rotors(iR), OtherState%rotors(iR), y%rotors(iR), m%rotors(iR), errStat, errMsg, u_op, y_op, x_op, dx_op, xd_op, z_op ) + +END SUBROUTINE AD_GetOP + +!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +!> Routine to pack the data structures representing the operating points into arrays for linearization. +SUBROUTINE RotGetOP( t, u, p, p_AD, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, y_op, x_op, dx_op, xd_op, z_op ) + + REAL(DbKi), INTENT(IN ) :: t !< Time in seconds at operating point + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs at operating point (may change to inout if a mesh copy is required) + TYPE(RotParameterType), INTENT(IN ) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD !< Parameters + TYPE(RotContinuousStateType), INTENT(IN ) :: x !< Continuous states at operating point + TYPE(RotDiscreteStateType), INTENT(IN ) :: xd !< Discrete states at operating point + TYPE(RotConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point + TYPE(RotOutputType), INTENT(IN ) :: y !< Output at operating point + TYPE(RotMiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: u_op(:) !< values of linearized inputs + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: y_op(:) !< values of linearized outputs + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: x_op(:) !< values of linearized continuous states + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dx_op(:) !< values of first time derivatives of linearized continuous states + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: xd_op(:) !< values of linearized discrete states + REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: z_op(:) !< values of linearized constraint states INTEGER(IntKi) :: index, i, j, k INTEGER(IntKi) :: nu @@ -4156,7 +4601,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'AD_GetOP' LOGICAL :: FieldMask(FIELDMASK_SIZE) - TYPE(AD_ContinuousStateType) :: dxdt + TYPE(RotContinuousStateType) :: dxdt ! Initialize ErrStat @@ -4198,6 +4643,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, end do FieldMask(MASKID_TRANSLATIONDISP) = .true. + FieldMask(MASKID_Orientation) = .true. FieldMask(MASKID_TRANSLATIONVel) = .true. FieldMask(MASKID_RotationVel) = .true. FieldMask(MASKID_TRANSLATIONAcc) = .true. @@ -4228,6 +4674,20 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, end do end do + ! I'm not including this in the linearization yet + !do i=1,u%NacelleMotion%NNodes ! 1 or 0 + ! do j=1,3 + ! u_op(index) = u%InflowOnNacelle(j) + ! index = index + 1 + ! end do + !end do + ! + !do i=1,u%HubMotion%NNodes ! 1 + ! do j=1,3 + ! u_op(index) = u%InflowOnHub(j) + ! index = index + 1 + ! end do + !end do END IF @@ -4240,8 +4700,8 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, end if - - index = 1 + + index = 1 call PackLoadMesh(y%TowerLoad, y_op, index) do k=1,p%NumBlades call PackLoadMesh(y%BladeLoad(k), y_op, index) @@ -4289,7 +4749,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, if (p%BEMT%UA%lin_nx>0) then do j=1,p%NumBlades ! size(x%BEMT%UA%element,2) do i=1,p%NumBlNds ! size(x%BEMT%UA%element,1) - do k=1,size(x%BEMT%UA%element(i,j)%x) + do k=1,4 !size(x%BEMT%UA%element(i,j)%x) !linearize only first 4 states (5th is vortex) x_op(index) = x%BEMT%UA%element(i,j)%x(k) index = index + 1 end do @@ -4308,10 +4768,10 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, if (ErrStat>=AbortErrLev) return end if - call AD_CalcContStateDeriv(t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat2, ErrMsg2) + call RotCalcContStateDeriv(t, u, p, p_AD, x, xd, z, OtherState, m, dxdt, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat>=AbortErrLev) then - call AD_DestroyContState( dxdt, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( dxdt, ErrStat2, ErrMsg2) return end if @@ -4342,7 +4802,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, if (p%BEMT%UA%lin_nx>0) then do j=1,p%NumBlades ! size(dxdt%BEMT%UA%element,2) do i=1,p%NumBlNds ! size(dxdt%BEMT%UA%element,1) - do k=1,size(dxdt%BEMT%UA%element(i,j)%x) + do k=1,4 !size(dxdt%BEMT%UA%element(i,j)%x) don't linearize 5th state dx_op(index) = dxdt%BEMT%UA%element(i,j)%x(k) index = index + 1 end do @@ -4350,7 +4810,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, end do end if - call AD_DestroyContState( dxdt, ErrStat2, ErrMsg2) + call AD_DestroyRotContinuousStateType( dxdt, ErrStat2, ErrMsg2) END IF @@ -4367,23 +4827,23 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, end if - index = 1 + index = 1 do k=1,p%NumBlades ! size(z%BEMT%Phi,2) do i=1,p%NumBlNds ! size(z%BEMT%Phi,1) z_op(index) = z%BEMT%phi(i,k) index = index + 1 - end do + end do end do END IF -END SUBROUTINE AD_GetOP +END SUBROUTINE RotGetOP !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUBROUTINE Init_Jacobian_y( p, y, InitOut, ErrStat, ErrMsg) - TYPE(AD_ParameterType) , INTENT(INOUT) :: p !< parameters - TYPE(AD_OutputType) , INTENT(IN ) :: y !< outputs - TYPE(AD_InitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) + TYPE(RotParameterType) , INTENT(INOUT) :: p !< parameters + TYPE(RotOutputType) , INTENT(IN ) :: y !< outputs + TYPE(RotInitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -4441,6 +4901,14 @@ SUBROUTINE Init_Jacobian_y( p, y, InitOut, ErrStat, ErrMsg) do k=1,3 AllOut( BAzimuth(k)) = .true. AllOut( BPitch (k)) = .true. + + ! AllOut( BAeroFx( k)) = .true. + ! AllOut( BAeroFy( k)) = .true. + ! AllOut( BAeroFz( k)) = .true. + ! AllOut( BAeroMx( k)) = .true. + ! AllOut( BAeroMy( k)) = .true. + ! AllOut( BAeroMz( k)) = .true. + do j=1,9 AllOut(BNVUndx(j,k)) = .true. AllOut(BNVUndy(j,k)) = .true. @@ -4498,10 +4966,10 @@ END SUBROUTINE Init_Jacobian_y !---------------------------------------------------------------------------------------------------------------------------------- SUBROUTINE Init_Jacobian_u( InputFileData, p, u, InitOut, ErrStat, ErrMsg) - TYPE(AD_InputFile) , INTENT(IN ) :: InputFileData !< input file data (for default blade perturbation) - TYPE(AD_ParameterType) , INTENT(INOUT) :: p !< parameters - TYPE(AD_InputType) , INTENT(IN ) :: u !< inputs - TYPE(AD_InitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) + TYPE(RotInputFile) , INTENT(IN ) :: InputFileData !< input file data (for default blade perturbation) + TYPE(RotParameterType) , INTENT(INOUT) :: p !< parameters + TYPE(RotInputType) , INTENT(IN ) :: u !< inputs + TYPE(RotInitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -4523,7 +4991,7 @@ SUBROUTINE Init_Jacobian_u( InputFileData, p, u, InitOut, ErrStat, ErrMsg) nu = u%TowerMotion%NNodes * 9 & ! 3 Translation Displacements + 3 orientations + 3 Translation velocities at each node + u%hubMotion%NNodes * 9 & ! 3 Translation Displacements + 3 orientations + 3 Rotation velocities at each node + size( u%InflowOnBlade) & - + size( u%InflowOnTower) & + + size( u%InflowOnTower) & !note that we are not passing the inflow on nacelle or hub here + size( u%UserProp) do i=1,p%NumBlades @@ -4762,12 +5230,19 @@ SUBROUTINE Init_Jacobian_u( InputFileData, p, u, InitOut, ErrStat, ErrMsg) end do end do + do k=1,p%NumBlades + do i=1,p%NumBlNds + InitOut%LinNames_u(index) = 'User property on blade '//trim(num2lstr(k))//', node '//trim(num2lstr(i))//', -' + index = index + 1 + end do + end do + END SUBROUTINE Init_Jacobian_u !---------------------------------------------------------------------------------------------------------------------------------- SUBROUTINE Init_Jacobian_x( p, InitOut, ErrStat, ErrMsg) - TYPE(AD_ParameterType) , INTENT(INOUT) :: p !< parameters - TYPE(AD_InitOutputType) , INTENT(INOUT) :: InitOut !< Output for initialization routine + TYPE(RotParameterType) , INTENT(INOUT) :: p !< parameters + TYPE(RotInitOutputType) , INTENT(INOUT) :: InitOut !< Output for initialization routine INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -4857,14 +5332,15 @@ END SUBROUTINE Init_Jacobian_x !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes the array that maps rows/columns of the Jacobian to specific mesh fields. !! Do not change the order of this packing without changing corresponding parts of AD linearization ! -SUBROUTINE Init_Jacobian( InputFileData, p, u, y, m, InitOut, ErrStat, ErrMsg) +SUBROUTINE Init_Jacobian( InputFileData, p, p_AD, u, y, m, InitOut, ErrStat, ErrMsg) - type(AD_InputFile) , intent(in ) :: InputFileData !< input file data (for default blade perturbation) - TYPE(AD_ParameterType) , INTENT(INOUT) :: p !< parameters - TYPE(AD_InputType) , INTENT(IN ) :: u !< inputs - TYPE(AD_OutputType) , INTENT(IN ) :: y !< outputs - TYPE(AD_MiscVarType) , INTENT(IN ) :: m !< miscellaneous variable - TYPE(AD_InitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) + type(RotInputFile) , intent(in ) :: InputFileData !< input file data (for default blade perturbation) + TYPE(RotParameterType) , INTENT(INOUT) :: p !< parameters + TYPE(AD_ParameterType) , INTENT(INOUT) :: p_AD !< parameters + TYPE(RotInputType) , INTENT(IN ) :: u !< inputs + TYPE(RotOutputType) , INTENT(IN ) :: y !< outputs + TYPE(RotMiscVarType) , INTENT(IN ) :: m !< miscellaneous variable + TYPE(RotInitOutputType) , INTENT(INOUT) :: InitOut !< Initialization output data (for Jacobian row/column names) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -4896,10 +5372,10 @@ END SUBROUTINE Init_Jacobian !! Do not change this without making sure subroutine aerodyn::init_jacobian is consistant with this routine! SUBROUTINE Perturb_u( p, n, perturb_sign, u, du ) - TYPE(AD_ParameterType) , INTENT(IN ) :: p !< parameters + TYPE(RotParameterType) , INTENT(IN ) :: p !< parameters INTEGER( IntKi ) , INTENT(IN ) :: n !< number of array element to use INTEGER( IntKi ) , INTENT(IN ) :: perturb_sign !< +1 or -1 (value to multiply perturbation by; positive or negative difference) - TYPE(AD_InputType) , INTENT(INOUT) :: u !< perturbed AD inputs + TYPE(RotInputType) , INTENT(INOUT) :: u !< perturbed AD inputs REAL( R8Ki ) , INTENT( OUT) :: du !< amount that specific input was perturbed @@ -4994,10 +5470,10 @@ END SUBROUTINE Perturb_u !! Do not change this without making sure subroutine aerodyn::init_jacobian is consistant with this routine! SUBROUTINE Perturb_x( p, n, perturb_sign, x, dx ) - TYPE(AD_ParameterType) , INTENT(IN ) :: p !< parameters + TYPE(RotParameterType) , INTENT(IN ) :: p !< parameters INTEGER( IntKi ) , INTENT(IN ) :: n !< number of array element to use INTEGER( IntKi ) , INTENT(IN ) :: perturb_sign !< +1 or -1 (value to multiply perturbation by; positive or negative difference) - TYPE(AD_ContinuousStateType) , INTENT(INOUT) :: x !< perturbed AD continuous states + TYPE(RotContinuousStateType) , INTENT(INOUT) :: x !< perturbed AD continuous states REAL( R8Ki ) , INTENT( OUT) :: dx !< amount that specific input was perturbed @@ -5020,7 +5496,8 @@ SUBROUTINE Perturb_x( p, n, perturb_sign, x, dx ) endif else - call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), size(x%BEMT%UA%element(1,1)%x), Blade, BladeNode, StateIndex ) + !call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), size(x%BEMT%UA%element(1,1)%x), Blade, BladeNode, StateIndex ) + call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), 4, Blade, BladeNode, StateIndex ) x%BEMT%UA%element(BladeNode,Blade)%x(StateIndex) = x%BEMT%UA%element(BladeNode,Blade)%x(StateIndex) + dx * perturb_sign end if @@ -5054,9 +5531,9 @@ END SUBROUTINE Perturb_x !! Do not change this packing without making sure subroutine aerodyn::init_jacobian is consistant with this routine! SUBROUTINE Compute_dY(p, y_p, y_m, delta_p, delta_m, dY) - TYPE(AD_ParameterType) , INTENT(IN ) :: p !< parameters - TYPE(AD_OutputType) , INTENT(IN ) :: y_p !< AD outputs at \f$ u + \Delta_p u \f$ or \f$ x + \Delta_p x \f$ (p=plus) - TYPE(AD_OutputType) , INTENT(IN ) :: y_m !< AD outputs at \f$ u - \Delta_m u \f$ or \f$ x - \Delta_m x \f$ (m=minus) + TYPE(RotParameterType) , INTENT(IN ) :: p !< parameters + TYPE(RotOutputType) , INTENT(IN ) :: y_p !< AD outputs at \f$ u + \Delta_p u \f$ or \f$ x + \Delta_p x \f$ (p=plus) + TYPE(RotOutputType) , INTENT(IN ) :: y_m !< AD outputs at \f$ u - \Delta_m u \f$ or \f$ x - \Delta_m x \f$ (m=minus) REAL(R8Ki) , INTENT(IN ) :: delta_p !< difference in inputs or states \f$ delta_p = \Delta_p u \f$ or \f$ delta_p = \Delta_p x \f$ REAL(R8Ki) , INTENT(IN ) :: delta_m !< difference in inputs or states \f$ delta_m = \Delta_m u \f$ or \f$ delta_m = \Delta_m x \f$ REAL(R8Ki) , INTENT(INOUT) :: dY(:) !< column of dYdu or dYdx: \f$ \frac{\partial Y}{\partial u_i} = \frac{y_p - y_m}{2 \, \Delta u}\f$ or \f$ \frac{\partial Y}{\partial x_i} = \frac{y_p - y_m}{2 \, \Delta x}\f$ @@ -5088,9 +5565,9 @@ END SUBROUTINE Compute_dY !! Do not change this packing without making sure subroutine aerodyn::init_jacobian is consistant with this routine! SUBROUTINE Compute_dX(p, x_p, x_m, delta_p, delta_m, dX) - TYPE(AD_ParameterType) , INTENT(IN ) :: p !< parameters - TYPE(AD_ContinuousStateType) , INTENT(IN ) :: x_p !< AD continuous states at \f$ u + \Delta_p u \f$ or \f$ x + \Delta_p x \f$ (p=plus) - TYPE(AD_ContinuousStateType) , INTENT(IN ) :: x_m !< AD continuous states at \f$ u - \Delta_m u \f$ or \f$ x - \Delta_m x \f$ (m=minus) + TYPE(RotParameterType) , INTENT(IN ) :: p !< parameters + TYPE(RotContinuousStateType) , INTENT(IN ) :: x_p !< AD continuous states at \f$ u + \Delta_p u \f$ or \f$ x + \Delta_p x \f$ (p=plus) + TYPE(RotContinuousStateType) , INTENT(IN ) :: x_m !< AD continuous states at \f$ u - \Delta_m u \f$ or \f$ x - \Delta_m x \f$ (m=minus) REAL(R8Ki) , INTENT(IN ) :: delta_p !< difference in inputs or states \f$ delta_p = \Delta_p u \f$ or \f$ delta_p = \Delta_p x \f$ REAL(R8Ki) , INTENT(IN ) :: delta_m !< difference in inputs or states \f$ delta_m = \Delta_m u \f$ or \f$ delta_m = \Delta_m x \f$ REAL(R8Ki) , INTENT(INOUT) :: dX(:) !< column of dXdu or dXdx: \f$ \frac{\partial Y}{\partial u_i} = \frac{y_p - y_m}{2 \, \Delta u}\f$ or \f$ \frac{\partial Y}{\partial x_i} = \frac{y_p - y_m}{2 \, \Delta x}\f$ @@ -5125,8 +5602,8 @@ SUBROUTINE Compute_dX(p, x_p, x_m, delta_p, delta_m, dX) do j=1,size(x_p%BEMT%UA%element,2) ! number of blades do i=1,size(x_p%BEMT%UA%element,1) ! number of nodes per blade - dX(indx_first:indx_first+3) = x_p%BEMT%UA%element(i,j)%x - x_m%BEMT%UA%element(i,j)%x - indx_first = indx_first + size(x_p%BEMT%UA%element(i,j)%x) ! = index_first += 4 + dX(indx_first:indx_first+3) = x_p%BEMT%UA%element(i,j)%x(1:4) - x_m%BEMT%UA%element(i,j)%x(1:4) + indx_first = indx_first + 4 ! = index_first += 4 end do end do diff --git a/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 b/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 index 34ba3b9ff1..78d7c08fba 100644 --- a/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 +++ b/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 @@ -101,11 +101,12 @@ MODULE AeroDyn_AllBldNdOuts_IO !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine populates the headers with the blade node outputs. The iteration cycle is blade:node:channel (channel iterated !! fastest). If this iteration order is changed, it should be changed in the Calc_WriteAllBldNdOutput routine as well. -SUBROUTINE AllBldNdOuts_InitOut( InitOut, p, InputFileData, ErrStat, ErrMsg ) +SUBROUTINE AllBldNdOuts_InitOut( InitOut, p, p_AD, InputFileData, ErrStat, ErrMsg ) - TYPE(AD_InitOutputType), INTENT(INOUT) :: InitOut ! output data - TYPE(AD_ParameterType), INTENT(IN ) :: p ! The module parameters - TYPE(AD_InputFile), INTENT(IN ) :: InputFileData ! All the data in the AeroDyn input file (want Blade Span for channel name) + TYPE(RotInitOutputType), INTENT(INOUT) :: InitOut ! output data + TYPE(RotParameterType), INTENT(IN ) :: p ! The module parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD ! The module parameters + TYPE(RotInputFile), INTENT(IN ) :: InputFileData ! All the data in the AeroDyn input file (want Blade Span for channel name) INTEGER(IntKi), INTENT( OUT) :: ErrStat ! The error status code CHARACTER(*), INTENT( OUT) :: ErrMsg ! The error message, if an error occurred @@ -123,6 +124,7 @@ SUBROUTINE AllBldNdOuts_InitOut( InitOut, p, InputFileData, ErrStat, ErrMsg ) ErrStat = ErrID_None + ! Warn if we will run into issues with more than 99 nodes. IF (p%NumBlNds > 999 ) CALL SetErrStat(ErrID_Severe,'More than 999 blade nodes in use. Output channel headers will not '// & 'correctly reflect blade stations beyond 999. Modifications to the variable ChanLen in FAST are required.',ErrStat,ErrMsg,RoutineName) @@ -162,12 +164,14 @@ END SUBROUTINE AllBldNdOuts_InitOut !! NOTE: the equations here came from the output section of AeroDyn_IO.f90. If anything changes in there, it needs to be reflected !! here. -SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrMsg ) - TYPE(AD_ParameterType), INTENT(IN ) :: p ! The module parameters - TYPE(AD_InputType), INTENT(IN ) :: u ! inputs - TYPE(AD_MiscVarType), INTENT(IN ) :: m ! misc variables - TYPE(AD_OutputType), INTENT(INOUT) :: y ! outputs (updates y%WriteOutput) - TYPE(AD_OtherStateType), INTENT(IN ) :: OtherState ! other states +SUBROUTINE Calc_WriteAllBldNdOutput( p, p_AD, u, m, m_AD, y, OtherState, Indx, ErrStat, ErrMsg ) + TYPE(RotParameterType), INTENT(IN ) :: p ! The module parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD ! The module parameters + TYPE(RotInputType), INTENT(IN ) :: u ! inputs + TYPE(RotMiscVarType), INTENT(IN ) :: m ! misc variables + TYPE(AD_MiscVarType), INTENT(IN ) :: m_AD ! misc variables ! NOTE: temporary + TYPE(RotOutputType), INTENT(INOUT) :: y ! outputs (updates y%WriteOutput) + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState ! other states INTEGER, INTENT(IN ) :: Indx ! index into m%BEMT_u(Indx) array; 1=t and 2=t+dt (but not checked here) INTEGER(IntKi), INTENT( OUT) :: ErrStat ! The error status code CHARACTER(*), INTENT( OUT) :: ErrMsg ! The error message, if an error occurred @@ -191,6 +195,11 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Initialize some things ErrMsg = '' ErrStat = ErrID_None + ! NOTE: if no blade outputs, we return + if (p%BldNd_BladesOut<=0 .or. p%BldNd_NumOuts<=0) then + return + endif + ! Precalculate the M_ph matrix -- no reason to recalculate for each output DO IdxBlade=1,p%NumBlades @@ -304,7 +313,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Relative wind speed CASE ( BldNd_VRel ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Vrel(IdxNode,IdxBlade) @@ -314,7 +323,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Vrel(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Vrel(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -322,7 +331,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Dynamic pressure CASE ( BldNd_DynP ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = 0.5 * p%airDens * m%BEMT_y%Vrel(IdxNode,IdxBlade)**2 @@ -332,7 +341,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = 0.5 * p%airDens * m%FVW%BN_Vrel(IdxNode,IdxBlade)**2 + y%WriteOutput( OutIdx ) = 0.5 * p%airDens * m_AD%FVW%BN_Vrel(IdxNode,IdxBlade)**2 OutIdx = OutIdx + 1 END DO END DO @@ -340,7 +349,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Reynolds number (in millions) CASE ( BldNd_Re ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = p%BEMT%chord(IdxNode,IdxBlade) * m%BEMT_y%Vrel(IdxNode,IdxBlade) / p%KinVisc / 1.0E6 @@ -350,7 +359,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Re(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Re(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -358,7 +367,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Mach number CASE ( BldNd_M ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Vrel(IdxNode,IdxBlade) / p%SpdSound @@ -368,7 +377,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Vrel(IdxNode,IdxBlade) / p%SpdSound + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Vrel(IdxNode,IdxBlade) / p%SpdSound OutIdx = OutIdx + 1 END DO END DO @@ -378,7 +387,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Axial and tangential induced wind velocity CASE ( BldNd_Vindx ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = - m%BEMT_u(Indx)%Vx(IdxNode,IdxBlade) * m%BEMT_y%axInduction( IdxNode,IdxBlade) @@ -388,14 +397,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = -m%FVW%BN_UrelWind_s(1,IdxNode,IdxBlade) * m%FVW%BN_AxInd(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = -m_AD%FVW%BN_UrelWind_s(1,IdxNode,IdxBlade) * m_AD%FVW%BN_AxInd(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Vindy ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_u(Indx)%Vy(IdxNode,IdxBlade) * m%BEMT_y%tanInduction(IdxNode,IdxBlade) @@ -405,7 +414,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_UrelWind_s(2,IdxNode,IdxBlade) * m%FVW%BN_TanInd(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_UrelWind_s(2,IdxNode,IdxBlade) * m_AD%FVW%BN_TanInd(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -414,7 +423,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Axial and tangential induction factors CASE ( BldNd_AxInd ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%axInduction(IdxNode,IdxBlade) @@ -424,14 +433,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_AxInd(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_AxInd(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_TnInd ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%tanInduction(IdxNode,IdxBlade) @@ -441,7 +450,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_TanInd(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_TanInd(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -450,7 +459,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! AoA, pitch+twist angle, inflow angle, and curvature angle CASE ( BldNd_Alpha ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = Rad2M180to180Deg( m%BEMT_y%phi(IdxNode,IdxBlade) - m%BEMT_u(Indx)%theta(IdxNode,IdxBlade) ) @@ -460,14 +469,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_alpha(IdxNode,IdxBlade)*R2D + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_alpha(IdxNode,IdxBlade)*R2D OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Theta ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_u(Indx)%theta(IdxNode,IdxBlade)*R2D @@ -477,14 +486,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%PitchAndTwist(IdxNode,IdxBlade)*R2D + y%WriteOutput( OutIdx ) = m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)*R2D OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Phi ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%phi(IdxNode,IdxBlade)*R2D @@ -494,14 +503,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) =m%FVW%BN_phi(IdxNode,IdxBlade)*R2D + y%WriteOutput( OutIdx ) =m_AD%FVW%BN_phi(IdxNode,IdxBlade)*R2D OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Curve ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%Curve(IdxNode,IdxBlade)*R2D @@ -521,7 +530,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Lift force, drag force, pitching moment coefficients CASE ( BldNd_Cl ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Cl(IdxNode,IdxBlade) @@ -531,14 +540,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Cl(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cl(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Cd ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Cd(IdxNode,IdxBlade) @@ -548,14 +557,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Cd(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cd(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Cm ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Cm(IdxNode,IdxBlade) @@ -565,7 +574,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Cm(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cm(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -573,7 +582,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Normal force (to plane), tangential force (to plane) coefficients CASE ( BldNd_Cx ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Cx(IdxNode,IdxBlade) @@ -583,14 +592,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Cx(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cx(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Cy ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%Cy(IdxNode,IdxBlade) @@ -600,7 +609,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_Cy(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cy(IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO @@ -608,7 +617,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Normal force (to chord), and tangential force (to chord) coefficients CASE ( BldNd_Cn ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds ct=cos(m%BEMT_u(Indx)%theta(IdxNode,IdxBlade)) @@ -620,16 +629,16 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - ct=cos(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) - st=sin(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) - y%WriteOutput( OutIdx ) = m%FVW%BN_Cx(IdxNode,IdxBlade)*ct + m%FVW%BN_Cy(IdxNode,IdxBlade)*st + ct=cos(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) + st=sin(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cx(IdxNode,IdxBlade)*ct + m_AD%FVW%BN_Cy(IdxNode,IdxBlade)*st OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Ct ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds ct=cos(m%BEMT_u(Indx)%theta(IdxNode,IdxBlade)) @@ -641,9 +650,9 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - ct=cos(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) - st=sin(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) - y%WriteOutput( OutIdx ) = -m%FVW%BN_Cx(IdxNode,IdxBlade)*st + m%FVW%BN_Cy(IdxNode,IdxBlade)*ct + ct=cos(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) + st=sin(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) + y%WriteOutput( OutIdx ) = -m_AD%FVW%BN_Cx(IdxNode,IdxBlade)*st + m_AD%FVW%BN_Cy(IdxNode,IdxBlade)*ct OutIdx = OutIdx + 1 END DO END DO @@ -652,7 +661,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Lift force, drag force, pitching moment CASE ( BldNd_Fl ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds cp=cos(m%BEMT_y%phi(IdxNode,IdxBlade)) @@ -664,8 +673,8 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - cp=cos(m%FVW%BN_phi(IdxNode,IdxBlade)) - sp=sin(m%FVW%BN_phi(IdxNode,IdxBlade)) + cp=cos(m_AD%FVW%BN_phi(IdxNode,IdxBlade)) + sp=sin(m_AD%FVW%BN_phi(IdxNode,IdxBlade)) y%WriteOutput( OutIdx ) = m%X(IdxNode,IdxBlade)*cp - m%Y(IdxNode,IdxBlade)*sp OutIdx = OutIdx + 1 END DO @@ -673,7 +682,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM endif CASE ( BldNd_Fd ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds cp=cos(m%BEMT_y%phi(IdxNode,IdxBlade)) @@ -685,8 +694,8 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - cp=cos(m%FVW%BN_phi(IdxNode,IdxBlade)) - sp=sin(m%FVW%BN_phi(IdxNode,IdxBlade)) + cp=cos(m_AD%FVW%BN_phi(IdxNode,IdxBlade)) + sp=sin(m_AD%FVW%BN_phi(IdxNode,IdxBlade)) y%WriteOutput( OutIdx ) = m%X(IdxNode,IdxBlade)*sp + m%Y(IdxNode,IdxBlade)*cp OutIdx = OutIdx + 1 END DO @@ -720,7 +729,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Normal force (to chord), and tangential force (to chord) per unit length CASE ( BldNd_Fn ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds ct=cos(m%BEMT_u(Indx)%theta(IdxNode,IdxBlade)) @@ -732,8 +741,8 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - ct=cos(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) - st=sin(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) + ct=cos(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) + st=sin(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) y%WriteOutput( OutIdx ) = m%X(IdxNode,IdxBlade)*ct - m%Y(IdxNode,IdxBlade)*st OutIdx = OutIdx + 1 END DO @@ -741,7 +750,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM endif CASE ( BldNd_Ft ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds ct=cos(m%BEMT_u(Indx)%theta(IdxNode,IdxBlade)) @@ -753,8 +762,8 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - ct=cos(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) - st=sin(m%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) + ct=cos(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! cos(theta) + st=sin(m_AD%FVW%PitchAndTwist(IdxNode,IdxBlade)) ! sin(theta) y%WriteOutput( OutIdx ) = -m%X(IdxNode,IdxBlade)*st - m%Y(IdxNode,IdxBlade)*ct OutIdx = OutIdx + 1 END DO @@ -781,7 +790,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM CASE ( BldNd_Vx ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_u(Indx)%Vx(IdxNode,IdxBlade) @@ -791,14 +800,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_UrelWind_s(1,IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_UrelWind_s(1,IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_Vy ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_u(Indx)%Vy(IdxNode,IdxBlade) @@ -808,14 +817,14 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds - y%WriteOutput( OutIdx ) = m%FVW%BN_UrelWind_s(2,IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_UrelWind_s(2,IdxNode,IdxBlade) OutIdx = OutIdx + 1 END DO END DO endif CASE ( BldNd_GeomPhi ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then if (allocated(OtherState%BEMT%ValidPhi)) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds @@ -845,7 +854,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM endif CASE ( BldNd_chi ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,p%NumBlNds y%WriteOutput( OutIdx ) = m%BEMT_y%chi(IdxNode,IdxBlade)*R2D @@ -863,33 +872,45 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM endif CASE ( BldNd_UA_Flag ) - if (p%WakeMod /= WakeMod_FVW) then - DO IdxBlade=1,p%BldNd_BladesOut - DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - IF ( OtherState%BEMT%UA_Flag(IdxNode, IdxBlade) ) THEN - y%WriteOutput( OutIdx ) = 1.0_ReKi - ELSE + if (p_AD%WakeMod /= WakeMod_FVW) then + IF (p%BEMT%UA_Flag) THEN + DO IdxBlade=1,p%BldNd_BladesOut + DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes + y%WriteOutput( OutIdx ) = m%BEMT%UA%weight(IdxNode, IdxBlade) + OutIdx = OutIdx + 1 + ENDDO + ENDDO + ELSE + DO IdxBlade=1,p%BldNd_BladesOut + DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes y%WriteOutput( OutIdx ) = 0.0_ReKi - ENDIF - OutIdx = OutIdx + 1 + OutIdx = OutIdx + 1 + ENDDO ENDDO - ENDDO + END IF else - DO IdxBlade=1,p%BldNd_BladesOut - DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - IF ( OtherState%FVW%UA_Flag(IdxNode, IdxBlade) ) THEN - y%WriteOutput( OutIdx ) = 1.0_ReKi - ELSE + IF (m_AD%FVW%UA_Flag) THEN + DO IdxBlade=1,p%BldNd_BladesOut + DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes + y%WriteOutput( OutIdx ) = m_AD%FVW%m_UA%weight(IdxNode, IdxBlade) + OutIdx = OutIdx + 1 + ENDDO + ENDDO + ELSE + DO IdxBlade=1,p%BldNd_BladesOut + DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes y%WriteOutput( OutIdx ) = 0.0_ReKi - ENDIF - OutIdx = OutIdx + 1 + OutIdx = OutIdx + 1 + ENDDO ENDDO - ENDDO + END IF + + endif ! CpMin CASE ( BldNd_CpMin ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes y%WriteOutput( OutIdx ) = m%BEMT_y%Cpmin(IdxNode,IdxBlade) @@ -925,7 +946,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! circulation on blade CASE ( BldNd_Gam ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes y%WriteOutput( OutIdx ) = 0.5_ReKi * p%BEMT%chord(IdxNode,IdxBlade) * m%BEMT_y%Vrel(IdxNode,IdxBlade) * m%BEMT_y%Cl(IdxNode,IdxBlade) ! "Gam" [m^2/s] @@ -935,7 +956,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = 0.5_ReKi * p%FVW%Chord(IdxNode,IdxBlade) * m%FVW%BN_Vrel(IdxNode,IdxBlade) * m%FVW%BN_Cl(IdxNode,IdxBlade) ! "Gam" [m^2/s] + y%WriteOutput( OutIdx ) = 0.5_ReKi * p_AD%FVW%Chord(IdxNode,IdxBlade) * m_AD%FVW%BN_Vrel(IdxNode,IdxBlade) * m_AD%FVW%BN_Cl(IdxNode,IdxBlade) ! "Gam" [m^2/s] OutIdx = OutIdx + 1 ENDDO ENDDO @@ -946,7 +967,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Static portion of Cl, Cd, Cm (ignoring unsteady effects) ! Cl_Static CASE ( BldNd_Cl_Static ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes !NOT available in BEMT/DBEMT yet @@ -957,7 +978,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = m%FVW%BN_Cl_Static(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cl_Static(IdxNode,IdxBlade) OutIdx = OutIdx + 1 ENDDO ENDDO @@ -965,7 +986,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Cd_Static CASE ( BldNd_Cd_Static ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes !NOT available in BEMT/DBEMT yet @@ -976,7 +997,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = m%FVW%BN_Cd_Static(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cd_Static(IdxNode,IdxBlade) OutIdx = OutIdx + 1 ENDDO ENDDO @@ -984,7 +1005,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Cm_Static CASE ( BldNd_Cm_Static ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes !NOT available in BEMT/DBEMT yet @@ -995,7 +1016,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = m%FVW%BN_Cm_Static(IdxNode,IdxBlade) + y%WriteOutput( OutIdx ) = m_AD%FVW%BN_Cm_Static(IdxNode,IdxBlade) OutIdx = OutIdx + 1 ENDDO ENDDO @@ -1007,7 +1028,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Inductions in polar rotating hub coordinates ! Axial induction, polar rotating hub coordinates CASE ( BldNd_Uin ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes Vind_s = (/ -m%BEMT_u(Indx)%Vx(IdxNode,IdxBlade)*m%BEMT_y%axInduction(IdxNode,IdxBlade), m%BEMT_u(Indx)%Vy(IdxNode,IdxBlade)*m%BEMT_y%tanInduction(IdxNode,IdxBlade), 0.0_ReKi /) @@ -1019,7 +1040,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = dot_product(M_pg(1,1:3,IdxBlade), m%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uihn, hub normal + y%WriteOutput( OutIdx ) = dot_product(M_pg(1,1:3,IdxBlade), m_AD%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uihn, hub normal OutIdx = OutIdx + 1 ENDDO ENDDO @@ -1027,7 +1048,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Tangential induction, polar rotating hub coordinates CASE ( BldNd_Uit ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes Vind_s = (/ -m%BEMT_u(Indx)%Vx(IdxNode,IdxBlade)*m%BEMT_y%axInduction(IdxNode,IdxBlade), m%BEMT_u(Indx)%Vy(IdxNode,IdxBlade)*m%BEMT_y%tanInduction(IdxNode,IdxBlade), 0.0_ReKi /) @@ -1039,7 +1060,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = dot_product(M_pg(2,1:3,IdxBlade), m%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uiht, hub tangential + y%WriteOutput( OutIdx ) = dot_product(M_pg(2,1:3,IdxBlade), m_AD%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uiht, hub tangential OutIdx = OutIdx + 1 ENDDO ENDDO @@ -1047,7 +1068,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM ! Radial induction, polar rotating hub coordinates CASE ( BldNd_Uir ) - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes Vind_s = (/ -m%BEMT_u(Indx)%Vx(IdxNode,IdxBlade)*m%BEMT_y%axInduction(IdxNode,IdxBlade), m%BEMT_u(Indx)%Vy(IdxNode,IdxBlade)*m%BEMT_y%tanInduction(IdxNode,IdxBlade), 0.0_ReKi /) @@ -1059,7 +1080,7 @@ SUBROUTINE Calc_WriteAllBldNdOutput( p, u, m, y, OtherState, Indx, ErrStat, ErrM else DO IdxBlade=1,p%BldNd_BladesOut DO IdxNode=1,u%BladeMotion(IdxBlade)%NNodes - y%WriteOutput( OutIdx ) = dot_product(M_pg(3,1:3,IdxBlade), m%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uihr, hub radial + y%WriteOutput( OutIdx ) = dot_product(M_pg(3,1:3,IdxBlade), m_AD%FVW_y%Vind(1:3,IdxNode,IdxBlade) ) ! Uihr, hub radial OutIdx = OutIdx + 1 ENDDO ENDDO @@ -1076,15 +1097,15 @@ END SUBROUTINE Calc_WriteAllBldNdOutput !---------------------------------------------------------------------------------------------------------------------------------- !> This routine validates and sets the parameters for the nodal outputs. -SUBROUTINE AllBldNdOuts_SetParameters( InitInp, InputFileData, p, ErrStat, ErrMsg ) +SUBROUTINE AllBldNdOuts_SetParameters( InputFileData, p, p_AD, ErrStat, ErrMsg ) !.................................................................................................................................. ! Passed variables: - TYPE(AD_InitInputType), intent(IN ) :: InitInp !< Input data for initialization routine, out is needed because of copy below TYPE(AD_InputFile), INTENT(IN ) :: InputFileData !< Data stored in the module's input file - TYPE(AD_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(RotParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(AD_ParameterType), INTENT(INOUT) :: p_AD !< Parameters INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -1097,9 +1118,11 @@ SUBROUTINE AllBldNdOuts_SetParameters( InitInp, InputFileData, p, ErrStat, ErrMs ! Check if the requested blades exist - IF ( (InputFileData%BldNd_BladesOut < 0_IntKi) .OR. (InputFileData%BldNd_BladesOut > p%NumBlades) ) THEN - CALL SetErrStat( ErrID_Warn, " Number of blades to output data at all blade nodes (BldNd_BladesOut) must be between 0 and "//TRIM(Num2LStr(p%NumBlades))//".", ErrStat, ErrMsg, RoutineName) + IF ( (InputFileData%BldNd_BladesOut < 0_IntKi) ) then p%BldNd_BladesOut = 0_IntKi + ELSE IF ((InputFileData%BldNd_BladesOut > p%NumBlades) ) THEN + CALL SetErrStat( ErrID_Warn, " Number of blades to output data at all blade nodes (BldNd_BladesOut) must be less than "//TRIM(Num2LStr(p%NumBlades))//".", ErrStat, ErrMsg, RoutineName) + p%BldNd_BladesOut = p%NumBlades ! NOTE: we are forgiving and plateau to numBlades ELSE p%BldNd_BladesOut = InputFileData%BldNd_BladesOut ENDIF @@ -1145,7 +1168,7 @@ SUBROUTINE AllBldNdOuts_SetParameters( InitInp, InputFileData, p, ErrStat, ErrMs ! ENDDO if (p%BldNd_TotNumOuts > 0) then - call BldNdOuts_SetOutParam(InputFileData%BldNd_OutList, p, ErrStat, ErrMsg ) ! requires: p%NumOuts, p%numBlades, p%NumBlNds, p%NumTwrNds; sets: p%BldNdOutParam. + call BldNdOuts_SetOutParam(InputFileData%BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) ! requires: p%NumOuts, p%numBlades, p%NumBlNds, p%NumTwrNds; sets: p%BldNdOutParam. if (ErrStat >= AbortErrLev) return end if @@ -1166,7 +1189,7 @@ END SUBROUTINE AllBldNdOuts_SetParameters !! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. !! !! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 02-Jul-2020 11:33:13. -SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, ErrStat, ErrMsg ) +SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) !.................................................................................................................................. IMPLICIT NONE @@ -1174,7 +1197,8 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, ErrStat, ErrMsg ) ! Passed variables CHARACTER(ChanLen), INTENT(IN) :: BldNd_OutList(:) !< The list out user-requested outputs - TYPE(AD_ParameterType), INTENT(INOUT) :: p !< The module parameters + TYPE(RotParameterType), INTENT(INOUT) :: p !< The module parameters + TYPE(AD_ParameterType), INTENT(INOUT) :: p_AD !< The module parameters INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred @@ -1224,7 +1248,7 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, ErrStat, ErrMsg ) ! ..... Developer must add checking for invalid inputs here: ..... ! The following are valid only for BEMT/DBEMT - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then InvalidOutput( BldNd_Cl_Static ) = .true. InvalidOutput( BldNd_Cd_Static ) = .true. InvalidOutput( BldNd_Cm_Static ) = .true. diff --git a/modules/aerodyn/src/AeroDyn_Driver.f90 b/modules/aerodyn/src/AeroDyn_Driver.f90 index 7fbbe4929d..a715820f68 100644 --- a/modules/aerodyn/src/AeroDyn_Driver.f90 +++ b/modules/aerodyn/src/AeroDyn_Driver.f90 @@ -113,7 +113,7 @@ program AeroDyn_Driver - call Dvr_WriteOutputLine(DvrData%OutFileData, nt, RotAzimuth, AD%y%WriteOutput, DvrData%Cases(iCase), iCase, errStat, errMsg) + call Dvr_WriteOutputLine(DvrData%OutFileData, nt, RotAzimuth, AD%y%rotors(1)%WriteOutput, DvrData%Cases(iCase), iCase, errStat, errMsg) call CheckError() diff --git a/modules/aerodyn/src/AeroDyn_Driver_Subs.f90 b/modules/aerodyn/src/AeroDyn_Driver_Subs.f90 index 86a0d94232..b4622a9c10 100644 --- a/modules/aerodyn/src/AeroDyn_Driver_Subs.f90 +++ b/modules/aerodyn/src/AeroDyn_Driver_Subs.f90 @@ -98,24 +98,32 @@ subroutine Init_AeroDyn(iCase, DvrData, AD, dt, errStat, errMsg) type(AD_InitInputType) :: InitInData ! Input data for initialization type(AD_InitOutputType) :: InitOutData ! Output data from initialization real(ReKi) :: RotAzimuth ! Rotor azimuth -- aligned with blade 1 (deg) - - - + errStat = ErrID_None errMsg = '' + + + allocate(InitInData%rotors(1), stat=errStat) + if (errStat/=0) then + call SetErrStat( ErrID_Fatal, 'Allocating rotors', errStat, errMsg, RoutineName ) + call Cleanup() + return + end if + if (iCase.EQ.1) then InitInData%InputFile = DvrData%AD_InputFile - InitInData%NumBlades = DvrData%numBlades InitInData%RootName = DvrData%outFileData%Root + InitInData%rotors(1)%NumBlades = DvrData%numBlades InitInData%Gravity = 9.80665_ReKi + InitInData%Linearize = .false. ! set initialization data: - call AllocAry( InitInData%BladeRootPosition, 3, InitInData%NumBlades, 'BladeRootPosition', errStat2, ErrMsg2 ) + call AllocAry( InitInData%rotors(1)%BladeRootPosition, 3, InitInData%rotors(1)%NumBlades, 'BladeRootPosition', errStat2, ErrMsg2 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) - call AllocAry( InitInData%BladeRootOrientation, 3, 3, InitInData%NumBlades, 'BladeRootOrientation', errStat2, ErrMsg2 ) + call AllocAry( InitInData%rotors(1)%BladeRootOrientation, 3, 3, InitInData%rotors(1)%NumBlades, 'BladeRootOrientation', errStat2, ErrMsg2 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) if (ErrStat >= AbortErrLev) then @@ -123,21 +131,23 @@ subroutine Init_AeroDyn(iCase, DvrData, AD, dt, errStat, errMsg) return end if - InitInData%HubPosition = (/ DvrData%Overhang * cos(DvrData%shftTilt), 0.0_ReKi, DvrData%HubHt /) + call eye(InitInData%rotors(1)%NacelleOrientation, ErrStat2, ErrMsg2) ! nacelle reference orientation will be identity + + InitInData%rotors(1)%HubPosition = (/ DvrData%Overhang * cos(DvrData%shftTilt), 0.0_ReKi, DvrData%HubHt /) theta(1) = 0.0_ReKi theta(2) = -DvrData%shftTilt theta(3) = 0.0_ReKi - InitInData%HubOrientation = EulerConstruct( theta ) + InitInData%rotors(1)%HubOrientation = EulerConstruct( theta ) - do k=1,InitInData%numBlades + do k=1,InitInData%rotors(1)%numBlades - theta(1) = (k-1)*TwoPi/real(InitInData%numBlades,ReKi) + theta(1) = (k-1)*TwoPi/real(InitInData%rotors(1)%numBlades,ReKi) theta(2) = DvrData%precone theta(3) = 0.0_ReKi - InitInData%BladeRootOrientation(:,:,k) = matmul( EulerConstruct( theta ), InitInData%HubOrientation ) + InitInData%rotors(1)%BladeRootOrientation(:,:,k) = matmul( EulerConstruct( theta ), InitInData%rotors(1)%HubOrientation ) - InitInData%BladeRootPosition(:,k) = InitInData%HubPosition + DvrData%hubRad * InitInData%BladeRootOrientation(3,:,k) + InitInData%rotors(1)%BladeRootPosition(:,k) = InitInData%rotors(1)%HubPosition + DvrData%hubRad * InitInData%rotors(1)%BladeRootOrientation(3,:,k) end do @@ -145,10 +155,12 @@ subroutine Init_AeroDyn(iCase, DvrData, AD, dt, errStat, errMsg) call AD_Init(InitInData, AD%u(1), AD%p, AD%x, AD%xd, AD%z, AD%OtherState, AD%y, AD%m, dt, InitOutData, ErrStat2, ErrMsg2 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (ErrStat >= AbortErrLev) then call Cleanup() return end if + do j = 2, numInp call AD_CopyInput (AD%u(1), AD%u(j), MESH_NEWCOPY, errStat2, errMsg2) @@ -156,8 +168,8 @@ subroutine Init_AeroDyn(iCase, DvrData, AD, dt, errStat, errMsg) end do ! move AD initOut data to AD Driver - call move_alloc( InitOutData%WriteOutputHdr, DvrData%OutFileData%WriteOutputHdr ) - call move_alloc( InitOutData%WriteOutputUnt, DvrData%OutFileData%WriteOutputUnt ) + call move_alloc( InitOutData%rotors(1)%WriteOutputHdr, DvrData%OutFileData%WriteOutputHdr ) + call move_alloc( InitOutData%rotors(1)%WriteOutputUnt, DvrData%OutFileData%WriteOutputUnt ) DvrData%OutFileData%AD_ver = InitOutData%ver @@ -266,28 +278,36 @@ subroutine Set_AD_Inputs(iCase,nt,RotAzimuth,DvrData,AD,errStat,errMsg) !................ ! Tower motions: - do j=1,AD%u(1)%TowerMotion%nnodes - AD%u(1)%TowerMotion%Orientation( :,:,j) = AD%u(1)%TowerMotion%RefOrientation(:,:,j) ! identity - AD%u(1)%TowerMotion%TranslationDisp(:,j) = 0.0_ReKi - AD%u(1)%TowerMotion%TranslationVel( :,j) = 0.0_ReKi + do j=1,AD%u(1)%rotors(1)%TowerMotion%nnodes + AD%u(1)%rotors(1)%TowerMotion%Orientation( :,:,j) = AD%u(1)%rotors(1)%TowerMotion%RefOrientation(:,:,j) ! identity + AD%u(1)%rotors(1)%TowerMotion%TranslationDisp(:,j) = 0.0_ReKi + AD%u(1)%rotors(1)%TowerMotion%TranslationVel( :,j) = 0.0_ReKi end do !j=nnodes - ! Hub motions: + ! Nacelle motions: theta(1) = 0.0_ReKi theta(2) = 0.0_ReKi theta(3) = DvrData%Cases(iCase)%Yaw(timeIndex) orientation = EulerConstruct(theta) + + if (AD%u(1)%rotors(1)%NacelleMotion%Nnodes > 0) then + AD%u(1)%rotors(1)%NacelleMotion%TranslationDisp = 0.0_R8Ki + AD%u(1)%rotors(1)%NacelleMotion%TranslationVel = 0.0_R8Ki + AD%u(1)%rotors(1)%NacelleMotion%Orientation(:,:,1) = orientation + endif - AD%u(1)%HubMotion%TranslationDisp(:,1) = matmul( AD%u(1)%HubMotion%Position(:,1), orientation ) - AD%u(1)%HubMotion%Position(:,1) ! = matmul( transpose(orientation) - eye(3), AD%u(1)%HubMotion%Position(:,1) ) + ! Hub motions: + ! orientation set in nacelle motion calculation + AD%u(1)%rotors(1)%HubMotion%TranslationDisp(:,1) = matmul( AD%u(1)%rotors(1)%HubMotion%Position(:,1), orientation ) - AD%u(1)%rotors(1)%HubMotion%Position(:,1) ! = matmul( transpose(orientation) - eye(3), AD%u(1)%HubMotion%Position(:,1) ) theta(1) = RotAzimuth*D2R + DvrData%Cases(iCase)%dt * DvrData%Cases(iCase)%RotSpeed(timeIndex) ! AD%inputTime(1) * DvrData%Cases(iCase)%RotSpeed theta(2) = 0.0_ReKi theta(3) = 0.0_ReKi - AD%u(1)%HubMotion%Orientation( :,:,1) = matmul( AD%u(1)%HubMotion%RefOrientation(:,:,1), orientation ) + AD%u(1)%rotors(1)%HubMotion%Orientation( :,:,1) = matmul( AD%u(1)%rotors(1)%HubMotion%RefOrientation(:,:,1), orientation ) orientation = EulerConstruct( theta ) - AD%u(1)%HubMotion%Orientation( :,:,1) = matmul( orientation, AD%u(1)%HubMotion%Orientation( :,:,1) ) + AD%u(1)%rotors(1)%HubMotion%Orientation( :,:,1) = matmul( orientation, AD%u(1)%rotors(1)%HubMotion%Orientation( :,:,1) ) - AD%u(1)%HubMotion%RotationVel( :,1) = AD%u(1)%HubMotion%Orientation(1,:,1) * DvrData%Cases(iCase)%RotSpeed(timeIndex) + AD%u(1)%rotors(1)%HubMotion%RotationVel( :,1) = AD%u(1)%rotors(1)%HubMotion%Orientation(1,:,1) * DvrData%Cases(iCase)%RotSpeed(timeIndex) ! Blade motions: do k=1,DvrData%numBlades @@ -296,13 +316,13 @@ subroutine Set_AD_Inputs(iCase,nt,RotAzimuth,DvrData,AD,errStat,errMsg) theta(3) = -DvrData%Cases(iCase)%pitch(timeIndex) orientation = EulerConstruct(theta) - AD%u(1)%BladeRootMotion(k)%Orientation( :,:,1) = matmul( orientation, AD%u(1)%HubMotion%Orientation( :,:,1) ) + AD%u(1)%rotors(1)%BladeRootMotion(k)%Orientation( :,:,1) = matmul( orientation, AD%u(1)%rotors(1)%HubMotion%Orientation( :,:,1) ) end do !k=numBlades ! Blade and blade root motions: do k=1,DvrData%numBlades - rotateMat = transpose( AD%u(1)%BladeRootMotion(k)%Orientation( :,:,1) ) - rotateMat = matmul( rotateMat, AD%u(1)%BladeRootMotion(k)%RefOrientation( :,:,1) ) + rotateMat = transpose( AD%u(1)%rotors(1)%BladeRootMotion(k)%Orientation( :,:,1) ) + rotateMat = matmul( rotateMat, AD%u(1)%rotors(1)%BladeRootMotion(k)%RefOrientation( :,:,1) ) orientation = transpose(rotateMat) rotateMat(1,1) = rotateMat(1,1) - 1.0_ReKi @@ -310,26 +330,26 @@ subroutine Set_AD_Inputs(iCase,nt,RotAzimuth,DvrData,AD,errStat,errMsg) rotateMat(3,3) = rotateMat(3,3) - 1.0_ReKi - position = AD%u(1)%BladeRootMotion(k)%Position(:,1) - AD%u(1)%HubMotion%Position(:,1) - AD%u(1)%BladeRootMotion(k)%TranslationDisp(:,1) = AD%u(1)%HubMotion%TranslationDisp(:,1) + matmul( rotateMat, position ) + position = AD%u(1)%rotors(1)%BladeRootMotion(k)%Position(:,1) - AD%u(1)%rotors(1)%HubMotion%Position(:,1) + AD%u(1)%rotors(1)%BladeRootMotion(k)%TranslationDisp(:,1) = AD%u(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + matmul( rotateMat, position ) - position = AD%u(1)%BladeRootMotion(k)%Position(:,1) + AD%u(1)%BladeRootMotion(k)%TranslationDisp(:,1) & - - AD%u(1)%HubMotion%Position(:,1) - AD%u(1)%HubMotion%TranslationDisp(:,1) - AD%u(1)%BladeRootMotion(k)%TranslationVel( :,1) = cross_product( AD%u(1)%HubMotion%RotationVel(:,1), position ) + position = AD%u(1)%rotors(1)%BladeRootMotion(k)%Position(:,1) + AD%u(1)%rotors(1)%BladeRootMotion(k)%TranslationDisp(:,1) & + - AD%u(1)%rotors(1)%HubMotion%Position(:,1) - AD%u(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + AD%u(1)%rotors(1)%BladeRootMotion(k)%TranslationVel( :,1) = cross_product( AD%u(1)%rotors(1)%HubMotion%RotationVel(:,1), position ) - do j=1,AD%u(1)%BladeMotion(k)%nnodes - position = AD%u(1)%BladeMotion(k)%Position(:,j) - AD%u(1)%HubMotion%Position(:,1) - AD%u(1)%BladeMotion(k)%TranslationDisp(:,j) = AD%u(1)%HubMotion%TranslationDisp(:,1) + matmul( rotateMat, position ) + do j=1,AD%u(1)%rotors(1)%BladeMotion(k)%nnodes + position = AD%u(1)%rotors(1)%BladeMotion(k)%Position(:,j) - AD%u(1)%rotors(1)%HubMotion%Position(:,1) + AD%u(1)%rotors(1)%BladeMotion(k)%TranslationDisp(:,j) = AD%u(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + matmul( rotateMat, position ) - AD%u(1)%BladeMotion(k)%Orientation( :,:,j) = matmul( AD%u(1)%BladeMotion(k)%RefOrientation(:,:,j), orientation ) + AD%u(1)%rotors(1)%BladeMotion(k)%Orientation( :,:,j) = matmul( AD%u(1)%rotors(1)%BladeMotion(k)%RefOrientation(:,:,j), orientation ) - position = AD%u(1)%BladeMotion(k)%Position(:,j) + AD%u(1)%BladeMotion(k)%TranslationDisp(:,j) & - - AD%u(1)%HubMotion%Position(:,1) - AD%u(1)%HubMotion%TranslationDisp(:,1) - AD%u(1)%BladeMotion(k)%TranslationVel( :,j) = cross_product( AD%u(1)%HubMotion%RotationVel(:,1), position ) + position = AD%u(1)%rotors(1)%BladeMotion(k)%Position(:,j) + AD%u(1)%rotors(1)%BladeMotion(k)%TranslationDisp(:,j) & + - AD%u(1)%rotors(1)%HubMotion%Position(:,1) - AD%u(1)%rotors(1)%HubMotion%TranslationDisp(:,1) + AD%u(1)%rotors(1)%BladeMotion(k)%TranslationVel( :,j) = cross_product( AD%u(1)%rotors(1)%HubMotion%RotationVel(:,1), position ) - AD%u(1)%BladeMotion(k)%RotationVel(:,j) = AD%u(1)%HubMotion%Orientation(1,:,1) * DvrData%Cases(iCase)%RotSpeed(timeIndex) ! simplification (without pitch rate) - AD%u(1)%BladeMotion(k)%TranslationAcc(:,j) = 0.0_ReKi ! simplification + AD%u(1)%rotors(1)%BladeMotion(k)%RotationVel(:,j) = AD%u(1)%rotors(1)%HubMotion%Orientation(1,:,1) * DvrData%Cases(iCase)%RotSpeed(timeIndex) ! simplification (without pitch rate) + AD%u(1)%rotors(1)%BladeMotion(k)%TranslationAcc(:,j) = 0.0_ReKi ! simplification end do !j=nnodes end do !k=numBlades @@ -337,21 +357,31 @@ subroutine Set_AD_Inputs(iCase,nt,RotAzimuth,DvrData,AD,errStat,errMsg) ! Inflow wind velocities: ! InflowOnBlade do k=1,DvrData%numBlades - do j=1,AD%u(1)%BladeMotion(k)%nnodes - z = AD%u(1)%BladeMotion(k)%Position(3,j) + AD%u(1)%BladeMotion(k)%TranslationDisp(3,j) - AD%u(1)%InflowOnBlade(1,j,k) = GetU( DvrData%Cases(iCase)%WndSpeed(timeIndex), DvrData%HubHt, DvrData%Cases(iCase)%ShearExp(timeIndex), z ) - AD%u(1)%InflowOnBlade(2,j,k) = 0.0_ReKi !V - AD%u(1)%InflowOnBlade(3,j,k) = 0.0_ReKi !W + do j=1,AD%u(1)%rotors(1)%BladeMotion(k)%nnodes + z = AD%u(1)%rotors(1)%BladeMotion(k)%Position(3,j) + AD%u(1)%rotors(1)%BladeMotion(k)%TranslationDisp(3,j) + AD%u(1)%rotors(1)%InflowOnBlade(1,j,k) = GetU( DvrData%Cases(iCase)%WndSpeed(timeIndex), DvrData%HubHt, DvrData%Cases(iCase)%ShearExp(timeIndex), z ) + AD%u(1)%rotors(1)%InflowOnBlade(2,j,k) = 0.0_ReKi !V + AD%u(1)%rotors(1)%InflowOnBlade(3,j,k) = 0.0_ReKi !W end do !j=nnodes end do !k=numBlades !InflowOnTower - do j=1,AD%u(1)%TowerMotion%nnodes - z = AD%u(1)%TowerMotion%Position(3,j) + AD%u(1)%TowerMotion%TranslationDisp(3,j) - AD%u(1)%InflowOnTower(1,j) = GetU( DvrData%Cases(iCase)%WndSpeed(timeIndex), DvrData%HubHt, DvrData%Cases(iCase)%ShearExp(timeIndex), z ) - AD%u(1)%InflowOnTower(2,j) = 0.0_ReKi !V - AD%u(1)%InflowOnTower(3,j) = 0.0_ReKi !W + do j=1,AD%u(1)%rotors(1)%TowerMotion%nnodes + z = AD%u(1)%rotors(1)%TowerMotion%Position(3,j) + AD%u(1)%rotors(1)%TowerMotion%TranslationDisp(3,j) + AD%u(1)%rotors(1)%InflowOnTower(1,j) = GetU( DvrData%Cases(iCase)%WndSpeed(timeIndex), DvrData%HubHt, DvrData%Cases(iCase)%ShearExp(timeIndex), z ) + AD%u(1)%rotors(1)%InflowOnTower(2,j) = 0.0_ReKi !V + AD%u(1)%rotors(1)%InflowOnTower(3,j) = 0.0_ReKi !W end do !j=nnodes + + !InflowOnNacelle + if (AD%u(1)%rotors(1)%NacelleMotion%Committed) then + z = AD%u(1)%rotors(1)%NacelleMotion%Position(3,1) + AD%u(1)%rotors(1)%NacelleMotion%TranslationDisp(3,1) + AD%u(1)%rotors(1)%InflowOnNacelle(1) = GetU( DvrData%Cases(iCase)%WndSpeed(timeIndex), DvrData%HubHt, DvrData%Cases(iCase)%ShearExp(timeIndex), z ) + else + AD%u(1)%rotors(1)%InflowOnNacelle(2) = 0.0_ReKi ! U + end if + AD%u(1)%rotors(1)%InflowOnNacelle(2) = 0.0_ReKi !V + AD%u(1)%rotors(1)%InflowOnNacelle(3) = 0.0_ReKi !W end subroutine Set_AD_Inputs !---------------------------------------------------------------------------------------------------------------------------------- diff --git a/modules/aerodyn/src/AeroDyn_IO.f90 b/modules/aerodyn/src/AeroDyn_IO.f90 index f66e3a93df..c4f8258e7e 100644 --- a/modules/aerodyn/src/AeroDyn_IO.f90 +++ b/modules/aerodyn/src/AeroDyn_IO.f90 @@ -1318,6 +1318,13 @@ MODULE AeroDyn_IO INTEGER, PARAMETER :: BAzimuth(3) = (/B1Azimuth,B2Azimuth,B3Azimuth/) ! azimuth angle INTEGER, PARAMETER :: BPitch(3) = (/B1Pitch, B2Pitch, B3Pitch/) ! pitch +! INTEGER, PARAMETER :: BAeroFx(3) = (/B1AeroFx, B2AeroFx, B3AeroFx/) ! x-component of total blade root aero force +! INTEGER, PARAMETER :: BAeroFy(3) = (/B1AeroFy, B2AeroFy, B3AeroFy/) ! y-component of total blade root aero force +! INTEGER, PARAMETER :: BAeroFz(3) = (/B1AeroFz, B2AeroFz, B3AeroFz/) ! z-component of total blade root aero force +! INTEGER, PARAMETER :: BAeroMx(3) = (/B1AeroMx, B2AeroMx, B3AeroMx/) ! x-component of total blade root aero moment +! INTEGER, PARAMETER :: BAeroMy(3) = (/B1AeroMy, B2AeroMy, B3AeroMy/) ! y-component of total blade root aero moment +! INTEGER, PARAMETER :: BAeroMz(3) = (/B1AeroMz, B2AeroMz, B3AeroMz/) ! z-component of total blade root aero moment + INTEGER, PARAMETER :: BNVUndx(9, 3) = RESHAPE( (/ & ! undisturbed wind velocity (x component) B1N1VUndx,B1N2VUndx,B1N3VUndx,B1N4VUndx,B1N5VUndx,B1N6VUndx,B1N7VUndx,B1N8VUndx,B1N9VUndx, & B2N1VUndx,B2N2VUndx,B2N3VUndx,B2N4VUndx,B2N5VUndx,B2N6VUndx,B2N7VUndx,B2N8VUndx,B2N9VUndx, & @@ -1538,8 +1545,8 @@ MODULE AeroDyn_IO !! Solely based on AD inputs, needed for FVW since rLocal is not stored PURE REAL(ReKi) FUNCTION Calc_MaxRadius(p, u) result(rmax) implicit none - TYPE(AD_ParameterType), INTENT(IN ) :: p !< The module parameters - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs + TYPE(RotParameterType), INTENT(IN ) :: p !< The module parameters + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs real(ReKi) :: y_hat_disk(3), z_hat_disk(3), dr_gl(3), rLocal integer(IntKi) :: iB, j y_hat_disk = u%HubMotion%Orientation(2,:,1) @@ -1556,7 +1563,7 @@ END FUNCTION Calc_MaxRadius !> Rotor speed PURE REAL(ReKi) FUNCTION Calc_Omega(u) - TYPE(AD_InputType), INTENT(IN ) :: u !< Inputs + TYPE(RotInputType), INTENT(IN ) :: u !< Inputs Calc_Omega = dot_product(u%HubMotion%RotationVel(:,1), u%HubMotion%Orientation(1,:,1)) END FUNCTION Calc_Omega @@ -1579,14 +1586,16 @@ END FUNCTION Calc_Chi0 !---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE Calc_WriteOutput( p, u, m, y, OtherState, xd, indx, ErrStat, ErrMsg ) +SUBROUTINE Calc_WriteOutput( p, p_AD, u, m, m_AD, y, OtherState, xd, indx, ErrStat, ErrMsg ) - TYPE(AD_ParameterType), INTENT(IN ) :: p ! The module parameters - TYPE(AD_InputType), INTENT(IN ) :: u ! inputs - TYPE(AD_MiscVarType), INTENT(INOUT) :: m ! misc variables - TYPE(AD_OutputType), INTENT(IN ) :: y ! outputs - TYPE(AD_OtherStateType), INTENT(IN ) :: OtherState ! other states at t (for DBEMT and UA) - TYPE(AD_DiscreteStateType),INTENT(IN ) :: xd ! Discrete states + TYPE(RotParameterType), INTENT(IN ) :: p ! The module parameters + TYPE(AD_ParameterType), INTENT(IN ) :: p_AD ! The module parameters + TYPE(RotInputType), INTENT(IN ) :: u ! inputs + TYPE(RotMiscVarType), INTENT(INOUT) :: m ! misc variables + TYPE(AD_MiscVarType), INTENT(INOUT) :: m_AD ! misc variables + TYPE(RotOutputType), INTENT(IN ) :: y ! outputs + TYPE(RotOtherStateType), INTENT(IN ) :: OtherState ! other states at t (for DBEMT and UA) + TYPE(RotDiscreteStateType),INTENT(IN ) :: xd ! Discrete states integer, intent(in ) :: indx ! index into m%BEMT_u(indx) array; 1=t and 2=t+dt (but not checked here) INTEGER(IntKi), INTENT( OUT) :: ErrStat ! The error status code CHARACTER(*), INTENT( OUT) :: ErrMsg ! The error message, if an error occurred @@ -1629,7 +1638,7 @@ SUBROUTINE Calc_WriteOutput( p, u, m, y, OtherState, xd, indx, ErrStat, ErrMsg ) end do ! out nodes - if (p%WakeMod /= WakeMod_FVW) then + if (p_AD%WakeMod /= WakeMod_FVW) then call Calc_WriteOutput_BEMT else call Calc_WriteOutput_FVW @@ -1758,6 +1767,8 @@ subroutine Calc_WriteOutput_BEMT m%AllOuts( RtAeroPwr ) = m%BEMT_u(indx)%omega * m%AllOuts( RtAeroMxh ) + + m%AllOuts( RtTSR ) = m%BEMT_u(indx)%TSR if ( EqualRealNos( m%V_dot_x, 0.0_ReKi ) ) then @@ -1773,6 +1784,21 @@ subroutine Calc_WriteOutput_BEMT m%AllOuts( RtAeroCq ) = m%AllOuts( RtAeroMxh ) / (denom * rmax) m%AllOuts( RtAeroCt ) = m%AllOuts( RtAeroFxh ) / denom end if + + ! Integrate force/moments over blades by performing mesh transfer to blade root points: +! do k=1,min(p%NumBlades,MaxBl) +! call Transfer_Line2_to_Point( y%BladeLoad(k), m%BladeRootLoad(k), m%B_L_2_R_P(k), ErrStat2, ErrMsg2, u%BladeMotion(k), u%BladeRootMotion(k) ) +! ! Transform force vector to blade root coordinate system +! tmp = matmul( u%BladeRootMotion(k)%Orientation(:,:,1), m%BladeRootLoad(k)%force( :,1) ) +! m%AllOuts( BAeroFx(k) ) = tmp(1) +! m%AllOuts( BAeroFy(k) ) = tmp(2) +! m%AllOuts( BAeroFz(k) ) = tmp(3) +! ! Transform moment vector to blade root coordinate system +! tmp = matmul( u%BladeRootMotion(k)%Orientation(:,:,1), m%BladeRootLoad(k)%moment( :,1) ) +! m%AllOuts( BAeroMx(k) ) = tmp(1) +! m%AllOuts( BAeroMy(k) ) = tmp(2) +! m%AllOuts( BAeroMz(k) ) = tmp(3) +! end do ! k=blades m%AllOuts( DBEMTau1 ) = OtherState%BEMT%DBEMT%tau1 @@ -1808,39 +1834,39 @@ subroutine Calc_WriteOutput_FVW m%AllOuts( BNSTVy( beta,k) ) = tmp(2) m%AllOuts( BNSTVz( beta,k) ) = tmp(3) - m%AllOuts( BNVrel( beta,k) ) = m%FVW%BN_Vrel(j,k) - m%AllOuts( BNDynP( beta,k) ) = 0.5 * p%airDens * m%FVW%BN_Vrel(j,k)**2 - m%AllOuts( BNRe( beta,k) ) = m%FVW%BN_Re(j,k) - m%AllOuts( BNM( beta,k) ) = m%FVW%BN_Vrel(j,k) / p%SpdSound + m%AllOuts( BNVrel( beta,k) ) = m_AD%FVW%BN_Vrel(j,k) + m%AllOuts( BNDynP( beta,k) ) = 0.5 * p%airDens * m_AD%FVW%BN_Vrel(j,k)**2 + m%AllOuts( BNRe( beta,k) ) = m_AD%FVW%BN_Re(j,k) + m%AllOuts( BNM( beta,k) ) = m_AD%FVW%BN_Vrel(j,k) / p%SpdSound - m%AllOuts( BNVIndx(beta,k) ) = -m%FVW%BN_UrelWind_s(1,j,k) * m%FVW%BN_AxInd(j,k) - m%AllOuts( BNVIndy(beta,k) ) = m%FVW%BN_UrelWind_s(2,j,k) * m%FVW%BN_TanInd(j,k) + m%AllOuts( BNVIndx(beta,k) ) = -m_AD%FVW%BN_UrelWind_s(1,j,k) * m_AD%FVW%BN_AxInd(j,k) + m%AllOuts( BNVIndy(beta,k) ) = m_AD%FVW%BN_UrelWind_s(2,j,k) * m_AD%FVW%BN_TanInd(j,k) - m%AllOuts( BNAxInd(beta,k) ) = m%FVW%BN_AxInd(j,k) - m%AllOuts( BNTnInd(beta,k) ) = m%FVW%BN_TanInd(j,k) + m%AllOuts( BNAxInd(beta,k) ) = m_AD%FVW%BN_AxInd(j,k) + m%AllOuts( BNTnInd(beta,k) ) = m_AD%FVW%BN_TanInd(j,k) - m%AllOuts( BNAlpha(beta,k) ) = m%FVW%BN_alpha(j,k)*R2D - m%AllOuts( BNTheta(beta,k) ) = m%FVW%PitchAndTwist(j,k)*R2D - m%AllOuts( BNPhi( beta,k) ) = m%FVW%BN_phi(j,k)*R2D + m%AllOuts( BNAlpha(beta,k) ) = m_AD%FVW%BN_alpha(j,k)*R2D + m%AllOuts( BNTheta(beta,k) ) = m_AD%FVW%PitchAndTwist(j,k)*R2D + m%AllOuts( BNPhi( beta,k) ) = m_AD%FVW%BN_phi(j,k)*R2D ! m%AllOuts( BNCurve(beta,k) ) = m%Curve(j,k)*R2D ! TODO ! m%AllOuts( BNCpmin( beta,k) ) = m%BEMT_y%Cpmin(j,k) ! TODO m%AllOuts( BNSigCr( beta,k) ) = m%SigmaCavitCrit(j,k) m%AllOuts( BNSgCav( beta,k) ) = m%SigmaCavit(j,k) - m%AllOuts( BNCl( beta,k) ) = m%FVW%BN_Cl(j,k) - m%AllOuts( BNCd( beta,k) ) = m%FVW%BN_Cd(j,k) - m%AllOuts( BNCm( beta,k) ) = m%FVW%BN_Cm(j,k) - m%AllOuts( BNCx( beta,k) ) = m%FVW%BN_Cx(j,k) - m%AllOuts( BNCy( beta,k) ) = m%FVW%BN_Cy(j,k) + m%AllOuts( BNCl( beta,k) ) = m_AD%FVW%BN_Cl(j,k) + m%AllOuts( BNCd( beta,k) ) = m_AD%FVW%BN_Cd(j,k) + m%AllOuts( BNCm( beta,k) ) = m_AD%FVW%BN_Cm(j,k) + m%AllOuts( BNCx( beta,k) ) = m_AD%FVW%BN_Cx(j,k) + m%AllOuts( BNCy( beta,k) ) = m_AD%FVW%BN_Cy(j,k) - ct=cos(m%FVW%PitchAndTwist(j,k)) ! cos(theta) - st=sin(m%FVW%PitchAndTwist(j,k)) ! sin(theta) - m%AllOuts( BNCn( beta,k) ) = m%FVW%BN_Cx(j,k)*ct + m%FVW%BN_Cy(j,k)*st - m%AllOuts( BNCt( beta,k) ) =-m%FVW%BN_Cx(j,k)*st + m%FVW%BN_Cy(j,k)*ct + ct=cos(m_AD%FVW%PitchAndTwist(j,k)) ! cos(theta) + st=sin(m_AD%FVW%PitchAndTwist(j,k)) ! sin(theta) + m%AllOuts( BNCn( beta,k) ) = m_AD%FVW%BN_Cx(j,k)*ct + m_AD%FVW%BN_Cy(j,k)*st + m%AllOuts( BNCt( beta,k) ) =-m_AD%FVW%BN_Cx(j,k)*st + m_AD%FVW%BN_Cy(j,k)*ct - cp=cos(m%FVW%BN_phi(j,k)) - sp=sin(m%FVW%BN_phi(j,k)) + cp=cos(m_AD%FVW%BN_phi(j,k)) + sp=sin(m_AD%FVW%BN_phi(j,k)) m%AllOuts( BNFl( beta,k) ) = m%X(j,k)*cp - m%Y(j,k)*sp m%AllOuts( BNFd( beta,k) ) = m%X(j,k)*sp + m%Y(j,k)*cp m%AllOuts( BNMm( beta,k) ) = m%M(j,k) @@ -1849,7 +1875,7 @@ subroutine Calc_WriteOutput_FVW m%AllOuts( BNFn( beta,k) ) = m%X(j,k)*ct - m%Y(j,k)*st m%AllOuts( BNFt( beta,k) ) = -m%X(j,k)*st - m%Y(j,k)*ct - m%AllOuts( BNGam( beta,k) ) = 0.5_ReKi * p%FVW%Chord(j,k) * m%FVW%BN_Vrel(j,k) * m%FVW%BN_Cl(j,k) ! "Gam" [m^2/s] + m%AllOuts( BNGam( beta,k) ) = 0.5_ReKi * p_AD%FVW%Chord(j,k) * m_AD%FVW%BN_Vrel(j,k) * m_AD%FVW%BN_Cl(j,k) ! "Gam" [m^2/s] end do ! nodes end do ! blades @@ -1915,16 +1941,18 @@ SUBROUTINE ReadInputFiles( InputFileName, InputFileData, Default_DT, OutFileRoot CHARACTER(*), INTENT(IN) :: InputFileName ! Name of the input file CHARACTER(*), INTENT(IN) :: OutFileRoot ! The rootname of all the output files written by this routine. - TYPE(AD_InputFile), INTENT(INOUT) :: InputFileData ! Data stored in the module's input file + TYPE(AD_InputFile), INTENT(INOUT) :: InputFileData ! Data stored in the module's input file INTEGER(IntKi), INTENT(OUT) :: UnEcho ! Unit number for the echo file - INTEGER(IntKi), INTENT(IN) :: NumBlades ! Number of blades for this model + INTEGER(IntKi), INTENT(IN) :: NumBlades(:) ! Number of blades per rotor INTEGER(IntKi), INTENT(OUT) :: ErrStat ! The error status code CHARACTER(*), INTENT(OUT) :: ErrMsg ! The error message, if an error occurred ! local variables INTEGER(IntKi) :: I + INTEGER(IntKi) :: iR ! Loop on rotor + integer(IntKi) :: iBld ! counter on blades INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred @@ -1941,24 +1969,28 @@ SUBROUTINE ReadInputFiles( InputFileName, InputFileData, Default_DT, OutFileRoot ! get the blade input-file data + iBld=1 + do iR = 1, size(InputFileData%rotors) - ALLOCATE( InputFileData%BladeProps( NumBlades ), STAT = ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal,"Error allocating memory for BladeProps.", ErrStat, ErrMsg, RoutineName) - CALL Cleanup() - RETURN - END IF - -!FIXME: add options for passing the blade files. This routine will need restructuring to handle that. - DO I=1,NumBlades - CALL ReadBladeInputs ( InputFileData%ADBlFile(I), InputFileData%BladeProps(I), UnEcho, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName//TRIM(':Blade')//TRIM(Num2LStr(I))) - IF ( ErrStat >= AbortErrLev ) THEN - CALL Cleanup() - RETURN - END IF - END DO + ALLOCATE( InputFileData%rotors(iR)%BladeProps( NumBlades(iR) ), STAT = ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal,"Error allocating memory for BladeProps.", ErrStat, ErrMsg, RoutineName) + CALL Cleanup() + RETURN + END IF + + !FIXME: add options for passing the blade files. This routine will need restructuring to handle that. + DO I=1,NumBlades(iR) + CALL ReadBladeInputs ( InputFileData%ADBlFile(I), InputFileData%rotors(iR)%BladeProps(I), UnEcho, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName//TRIM(':Blade')//TRIM(Num2LStr(I))) + IF ( ErrStat >= AbortErrLev ) THEN + CALL Cleanup() + RETURN + END IF + iBld = iBld+1 ! Increment blade counter + END DO + ENDDO ! Loop on rotors CALL Cleanup ( ) @@ -1984,7 +2016,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv character(*), intent(in ) :: PriPath !< primary path CHARACTER(*), intent(in ) :: InputFile !< Name of the file containing the primary input data CHARACTER(*), intent(in ) :: RootName !< The rootname of the echo file, possibly opened in this routine - integer(IntKi), intent(in ) :: NumBlades !< Number of blades we expect -- from InitInp + integer(IntKi), intent(in ) :: NumBlades(:) !< Number of blades per rotor we expect -- from InitInp real(DBKi), intent(in ) :: interval !< timestep type(AD_InputFile), intent(inout) :: InputFileData !< All the data in the AD15 primary input file type(FileInfoType), intent(in ) :: FileInfo_In !< The derived type for holding the file information. @@ -1994,6 +2026,8 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv ! Local variables: integer(IntKi) :: i !< generic counter + integer(IntKi) :: iR !< Loop on rotors + integer(IntKi) :: numBladesTot !< total number of blades integer(IntKi) :: ErrStat2, IOS !< Temporary Error status character(ErrMsgLen) :: ErrMsg2 !< Temporary Error message character(ErrMsgLen) :: ErrMsg_NoAllBldNdOuts @@ -2004,7 +2038,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv character(*), parameter :: RoutineName = 'ParsePrimaryFileInfo' ! Initialization - ErrStat = 0 + ErrStat = ErrId_None ErrMsg = "" UnEc = -1 ! Echo file unit. >0 when used @@ -2016,6 +2050,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv CALL AllocAry( InputFileData%BldNd_OutList, BldNd_MaxOutPts, "BldNd_Outlist", ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + numBladesTot=sum(NumBlades) !------------------------------------------------------------------------------------------------- ! General settings @@ -2184,8 +2219,9 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv ! Allocate space to hold AFNames ALLOCATE( InputFileData%AFNames(InputFileData%NumAFfiles), STAT=ErrStat2) IF (ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, "Error allocating AFNames.", ErrStat, ErrMsg, RoutineName) - RETURN + ErrStat2=ErrID_Fatal + ErrMsg2 = "Error allocating AFNames." + if (Failed()) return END IF ! AFNames - Airfoil file names (NumAFfiles lines) (quoted strings): -- NOTE: this line may not have a keyname with it DO I = 1,InputFileData%NumAFfiles ! ParseChVar allows empty keynames. @@ -2201,7 +2237,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv call ParseVar( FileInfo_In, CurLine, "UseBlCm", InputFileData%UseBlCm, ErrStat2, ErrMsg2, UnEc ) if (Failed()) return ! Allocate space for AD blade file names -- MaxBl is usually set to 3, but if we specify more blades, this will work still. - call AllocAry( InputFileData%ADBlFile, max(MaxBl,NumBlades), 'ADBlFile', ErrStat2, ErrMsg2) + call AllocAry( InputFileData%ADBlFile, max(MaxBl,NumBladesTot), 'ADBlFile', ErrStat2, ErrMsg2) if (Failed()) return do I =1,size(InputFileData%ADBlFile) ! We expect MaxBl blade file lines. We may want to revisit this idea later if we allow more thn 3 blades call ParseVar( FileInfo_In, CurLine, "", InputFileData%ADBlFile(i), ErrStat2, ErrMsg2, UnEc ) @@ -2210,35 +2246,38 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InputFile, RootName, NumBlades, interv enddo !====== Tower Influence and Aerodynamics ============================================================= [used only when TwrPotent/=0, TwrShadow/=0, or TwrAero=True] - if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo - CurLine = CurLine + 1 - ! NumTwrNds - Number of tower nodes used in the analysis (-) [used only when TwrPotent/=0, TwrShadow/=0, or TwrAero=True] - call ParseVar( FileInfo_In, CurLine, "NumTwrNds", InputFileData%NumTwrNds, ErrStat2, ErrMsg2, UnEc ) - if (Failed()) return - !TwrElev TwrDiam TwrCd - if ( InputFileData%Echo ) WRITE(UnEc, '(A)') 'Tower Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo - CurLine = CurLine + 1 - !(m) (m) (-) - if ( InputFileData%Echo ) WRITE(UnEc, '(A)') 'Tower Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo - CurLine = CurLine + 1 - ! Allocate space for tower table - CALL AllocAry( InputFileData%TwrElev, InputFileData%NumTwrNds, 'TwrElev', ErrStat2, ErrMsg2) - if (Failed()) return - CALL AllocAry( InputFileData%TwrDiam, InputFileData%NumTwrNds, 'TwrDiam', ErrStat2, ErrMsg2) - if (Failed()) return - CALL AllocAry( InputFileData%TwrCd, InputFileData%NumTwrNds, 'TwrCd', ErrStat2, ErrMsg2) - if (Failed()) return - CALL AllocAry( InputFileData%TwrTI, InputFileData%NumTwrNds, 'TwrTI', ErrStat2, ErrMsg2) - if (Failed()) return - do I=1,InputFileData%NumTwrNds - call ParseAry ( FileInfo_In, CurLine, 'Properties for tower node '//trim( Int2LStr( I ) )//'.', TmpRe4, 4, ErrStat2, ErrMsg2, UnEc ) - if (Failed()) return; - InputFileData%TwrElev(I) = TmpRe4( 1) - InputFileData%TwrDiam(I) = TmpRe4( 2) - InputFileData%TwrCd(I) = TmpRe4( 3) - InputFileData%TwrTI(I) = TmpRe4( 4) - end do + do iR = 1,size(NumBlades) ! Loop on rotors + if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! NumTwrNds - Number of tower nodes used in the analysis (-) [used only when TwrPotent/=0, TwrShadow/=0, or TwrAero=True] + call ParseVar( FileInfo_In, CurLine, "NumTwrNds", InputFileData%rotors(iR)%NumTwrNds, ErrStat2, ErrMsg2, UnEc ) + if (Failed()) return + !TwrElev TwrDiam TwrCd + if ( InputFileData%Echo ) WRITE(UnEc, '(A)') 'Tower Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + !(m) (m) (-) + if ( InputFileData%Echo ) WRITE(UnEc, '(A)') 'Tower Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! Allocate space for tower table + CALL AllocAry( InputFileData%rotors(iR)%TwrElev, InputFileData%rotors(iR)%NumTwrNds, 'TwrElev', ErrStat2, ErrMsg2) + if (Failed()) return + CALL AllocAry( InputFileData%rotors(iR)%TwrDiam, InputFileData%rotors(iR)%NumTwrNds, 'TwrDiam', ErrStat2, ErrMsg2) + if (Failed()) return + CALL AllocAry( InputFileData%rotors(iR)%TwrCd, InputFileData%rotors(iR)%NumTwrNds, 'TwrCd', ErrStat2, ErrMsg2) + if (Failed()) return + CALL AllocAry( InputFileData%rotors(iR)%TwrTI, InputFileData%rotors(iR)%NumTwrNds, 'TwrTI', ErrStat2, ErrMsg2) + if (Failed()) return + + do I=1,InputFileData%rotors(iR)%NumTwrNds + call ParseAry ( FileInfo_In, CurLine, 'Properties for tower node '//trim( Int2LStr( I ) )//'.', TmpRe4, 4, ErrStat2, ErrMsg2, UnEc ) + if (Failed()) return; + InputFileData%rotors(iR)%TwrElev(I) = TmpRe4( 1) + InputFileData%rotors(iR)%TwrDiam(I) = TmpRe4( 2) + InputFileData%rotors(iR)%TwrCd(I) = TmpRe4( 3) + InputFileData%rotors(iR)%TwrTI(I) = TmpRe4( 4) + end do + enddo !====== Outputs ==================================================================================== if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo @@ -2463,12 +2502,13 @@ END SUBROUTINE Cleanup END SUBROUTINE ReadBladeInputs !---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE AD_PrintSum( InputFileData, p, u, y, ErrStat, ErrMsg ) +SUBROUTINE AD_PrintSum( InputFileData, p, p_AD, u, y, ErrStat, ErrMsg ) ! This routine generates the summary file, which contains a summary of input file options. ! passed variables TYPE(AD_InputFile), INTENT(IN) :: InputFileData ! Input-file data - TYPE(AD_ParameterType), INTENT(IN) :: p ! Parameters + TYPE(RotParameterType), INTENT(IN) :: p ! Parameters + TYPE(AD_ParameterType), INTENT(IN) :: p_AD ! Parameters TYPE(AD_InputType), INTENT(IN) :: u ! inputs TYPE(AD_OutputType), INTENT(IN) :: y ! outputs INTEGER(IntKi), INTENT(OUT) :: ErrStat @@ -2498,7 +2538,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, u, y, ErrStat, ErrMsg ) WRITE (UnSu,'(/,A)') '====== General Options ============================================================================' ! WakeMod - select case (p%WakeMod) + select case (p_AD%WakeMod) case (WakeMod_BEMT) Msg = 'Blade-Element/Momentum Theory' case (WakeMod_DBEMT) @@ -2510,7 +2550,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, u, y, ErrStat, ErrMsg ) case default Msg = 'unknown' end select - WRITE (UnSu,Ec_IntFrmt) p%WakeMod, 'WakeMod', 'Type of wake/induction model: '//TRIM(Msg) + WRITE (UnSu,Ec_IntFrmt) p_AD%WakeMod, 'WakeMod', 'Type of wake/induction model: '//TRIM(Msg) ! AFAeroMod @@ -2562,7 +2602,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, u, y, ErrStat, ErrMsg ) WRITE (UnSu,Ec_LgFrmt) p%TwrAero, 'TwrAero', 'Calculate tower aerodynamic loads? '//TRIM(Msg) - if (p%WakeMod/=WakeMod_none) then + if (p_AD%WakeMod/=WakeMod_none) then WRITE (UnSu,'(A)') '====== Blade-Element/Momentum Theory Options ======================================================' ! SkewMod @@ -2626,7 +2666,7 @@ SUBROUTINE AD_PrintSum( InputFileData, p, u, y, ErrStat, ErrMsg ) ! MaxIter - if (p%WakeMod == WakeMod_DBEMT) then + if (p_AD%WakeMod == WakeMod_DBEMT) then select case (InputFileData%DBEMT_Mod) case (DBEMT_tauConst) Msg = 'constant tau1' @@ -2739,7 +2779,7 @@ END SUBROUTINE AD_PrintSum !! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. !! !! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 31-Aug-2020 13:14:21. -SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) +SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg ) !.................................................................................................................................. IMPLICIT NONE @@ -2747,7 +2787,8 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) ! Passed variables CHARACTER(ChanLen), INTENT(IN) :: OutList(:) !< The list out user-requested outputs - TYPE(AD_ParameterType), INTENT(INOUT) :: p !< The module parameters + TYPE(RotParameterType), INTENT(INOUT) :: p !< The module parameters + TYPE(AD_ParameterType), INTENT(INOUT) :: p_AD !< The module parameters INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred @@ -3231,6 +3272,7 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) ! ..... Developer must add checking for invalid inputs here: ..... + !bjj: do we want to avoid outputting this if we haven't used tower aero? if ( p%TwrPotent == TwrPotent_none .and. p%TwrShadow == TwrShadow_none ) then @@ -3242,7 +3284,7 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) end if - if (p%WakeMod /= WakeMod_DBEMT) then + if (p_AD%WakeMod /= WakeMod_DBEMT) then InvalidOutput( DBEMTau1 ) = .true. end if @@ -3303,6 +3345,12 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) InvalidOutput( BNSgCav(:,i) ) = .true. InvalidOutput( BNSigCr(:,i) ) = .true. InvalidOutput( BNCpMin(:,i) ) = .true. +! InvalidOutput( BAeroFx( i) ) = .true. +! InvalidOutput( BAeroFy( i) ) = .true. +! InvalidOutput( BAeroFz( i) ) = .true. +! InvalidOutput( BAeroMx( i) ) = .true. +! InvalidOutput( BAeroMy( i) ) = .true. +! InvalidOutput( BAeroMz( i) ) = .true. END DO diff --git a/modules/aerodyn/src/AeroDyn_Registry.txt b/modules/aerodyn/src/AeroDyn_Registry.txt index 67998aa731..6bbfbb24b6 100644 --- a/modules/aerodyn/src/AeroDyn_Registry.txt +++ b/modules/aerodyn/src/AeroDyn_Registry.txt @@ -37,17 +37,20 @@ param ^ - IntKi TwrShadow_Eames - 2 - "Eames towe # ..... Initialization data ....................................................................................................... # Define inputs that the initialization routine may need here: -typedef AeroDyn/AD InitInputType CHARACTER(1024) InputFile - - - "Name of the input file" - -typedef ^ InitInputType Logical Linearize - .FALSE. - "Flag that tells this module if the glue code wants to linearize." - -typedef ^ InitInputType IntKi NumBlades - - - "Number of blades on the turbine" - -typedef ^ InitInputType ReKi Gravity - - - "Gravity force" Nm/s^2 +typedef AeroDyn/AD RotInitInputType IntKi NumBlades - - - "Number of blades on the turbine" - +typedef ^ RotInitInputType ReKi HubPosition {3} - - "X-Y-Z reference position of hub" m +typedef ^ RotInitInputType R8Ki HubOrientation {3}{3} - - "DCM reference orientation of hub" - +typedef ^ RotInitInputType ReKi BladeRootPosition {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m +typedef ^ RotInitInputType R8Ki BladeRootOrientation {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - +typedef ^ RotInitInputType R8Ki NacelleOrientation {3}{3} - - "DCM reference orientation of nacelle" - + +typedef ^ InitInputType RotInitInputType rotors {:} - - "Init Input Types for rotors" - +typedef ^ InitInputType CHARACTER(1024) InputFile - - - "Name of the input file" - typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - -typedef ^ InitInputType ReKi HubPosition {3} - - "X-Y-Z reference position of hub" m -typedef ^ InitInputType R8Ki HubOrientation {3}{3} - - "DCM reference orientation of hub" - -typedef ^ InitInputType ReKi BladeRootPosition {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m -typedef ^ InitInputType R8Ki BladeRootOrientation {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - typedef ^ InitInputType LOGICAL UsePrimaryInputFile - .TRUE. - "Read input file instead of passed data" - typedef ^ InitInputType FileInfoType PassedPrimaryInputData - - - "Primary input file as FileInfoType (set by driver/glue code)" - +typedef ^ InitInputType Logical Linearize - .FALSE. - "Flag that tells this module if the glue code wants to linearize." - +typedef ^ InitInputType ReKi Gravity - - - "Gravity force" Nm/s^2 @@ -64,27 +67,37 @@ typedef ^ AD_BladePropsType IntKi BlAFID {:} - - "ID of Airfoil at blade node" - # Define outputs from the initialization routine here: typedef ^ AD_BladeShape SiKi AirfoilCoords {:}{:}{:} - - "x-y coordinates for airfoils, relative to node" m + # Define outputs from the initialization routine here: -typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - -typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" - -typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - -typedef ^ InitOutputType ReKi AirDens - - - "Air density" kg/m^3 -typedef ^ InitOutputType AD_BladeShape BladeShape {:} - - "airfoil coordinates for each blade" m -typedef ^ InitOutputType CHARACTER(LinChanLen) LinNames_y {:} - - "Names of the outputs used in linearization" - -typedef ^ InitOutputType CHARACTER(LinChanLen) LinNames_x {:} - - "Names of the continuous states used in linearization" - -typedef ^ InitOutputType CHARACTER(LinChanLen) LinNames_u {:} - - "Names of the inputs used in linearization" - -typedef ^ InitOutputType LOGICAL RotFrame_y {:} - - "Flag that tells FAST/MBC3 if the outputs used in linearization are in the rotating frame" - -typedef ^ InitOutputType LOGICAL RotFrame_x {:} - - "Flag that tells FAST/MBC3 if the continuous states used in linearization are in the rotating frame (not used for glue)" - -typedef ^ InitOutputType LOGICAL RotFrame_u {:} - - "Flag that tells FAST/MBC3 if the inputs used in linearization are in the rotating frame" - -typedef ^ InitOutputType LOGICAL IsLoad_u {:} - - "Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix)" - -typedef ^ InitOutputType AD_BladePropsType BladeProps {:} - - "blade property information from blade input files" - -typedef ^ InitOutputType IntKi DerivOrder_x {:} - - "Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization" - -typedef ^ InitOutputType ReKi TwrElev {:} - - "Elevation at tower node" m -typedef ^ InitOutputType ReKi TwrDiam {:} - - "Diameter of tower at node" m +typedef ^ RotInitOutputType ReKi AirDens - - - "Air density" kg/m^3 +typedef ^ RotInitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - +typedef ^ RotInitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" - +typedef ^ RotInitOutputType AD_BladeShape BladeShape {:} - - "airfoil coordinates for each blade" m +typedef ^ RotInitOutputType CHARACTER(LinChanLen) LinNames_y {:} - - "Names of the outputs used in linearization" - +typedef ^ RotInitOutputType CHARACTER(LinChanLen) LinNames_x {:} - - "Names of the continuous states used in linearization" - +typedef ^ RotInitOutputType CHARACTER(LinChanLen) LinNames_u {:} - - "Names of the inputs used in linearization" - +typedef ^ RotInitOutputType LOGICAL RotFrame_y {:} - - "Flag that tells FAST/MBC3 if the outputs used in linearization are in the rotating frame" - +typedef ^ RotInitOutputType LOGICAL RotFrame_x {:} - - "Flag that tells FAST/MBC3 if the continuous states used in linearization are in the rotating frame (not used for glue)" - +typedef ^ RotInitOutputType LOGICAL RotFrame_u {:} - - "Flag that tells FAST/MBC3 if the inputs used in linearization are in the rotating frame" - +typedef ^ RotInitOutputType LOGICAL IsLoad_u {:} - - "Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix)" - +typedef ^ RotInitOutputType AD_BladePropsType BladeProps {:} - - "blade property information from blade input files" - +typedef ^ RotInitOutputType IntKi DerivOrder_x {:} - - "Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization" - +typedef ^ RotInitOutputType ReKi TwrElev {:} - - "Elevation at tower node" m +typedef ^ RotInitOutputType ReKi TwrDiam {:} - - "Diameter of tower at node" m +typedef ^ InitOutputType RotInitOutputType rotors {:} - - "Rotor init output type" - +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - # ..... Input file data ........................................................................................................... # ..... Primary Input file data ................................................................................................... +typedef ^ RotInputFile IntKi BldNd_BladesOut - - - "The blades to output (AD_AllBldNdOuts)" - +typedef ^ RotInputFile AD_BladePropsType BladeProps {:} - - "blade property information from blade input files" - +typedef ^ RotInputFile IntKi NumTwrNds - - - "Number of tower nodes used in the analysis" - +typedef ^ RotInputFile ReKi TwrElev {:} - - "Elevation at tower node" m +typedef ^ RotInputFile ReKi TwrDiam {:} - - "Diameter of tower at node" m +typedef ^ RotInputFile ReKi TwrCd {:} - - "Coefficient of drag at tower node" - +typedef ^ RotInputFile ReKi TwrTI {:} - - "Turbulence intensity for tower shadow at tower node" - + typedef ^ AD_InputFile Logical Echo - - - "Echo input file to echo file" - typedef ^ AD_InputFile DbKi DTAero - - - "Time interval for aerodynamic calculations {or "default"}" s typedef ^ AD_InputFile IntKi WakeMod - - - "Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW}" - @@ -125,12 +138,6 @@ typedef ^ AD_InputFile CHARACTER(1024) FVWFileName - - - "FVW input filename" "q typedef ^ AD_InputFile CHARACTER(1024) AFNames {:} - - "Airfoil file names (NumAF lines)" "quoted strings" typedef ^ AD_InputFile LOGICAL UseBlCm - - - "Include aerodynamic pitching moment in calculations?" flag #typedef ^ AD_InputFile IntKi NumBlNds - - - "Number of blade nodes used in the analysis" - -typedef ^ AD_InputFile AD_BladePropsType BladeProps {:} - - "blade property information from blade input files" - -typedef ^ AD_InputFile IntKi NumTwrNds - - - "Number of tower nodes used in the analysis" - -typedef ^ AD_InputFile ReKi TwrElev {:} - - "Elevation at tower node" m -typedef ^ AD_InputFile ReKi TwrDiam {:} - - "Diameter of tower at node" m -typedef ^ AD_InputFile ReKi TwrCd {:} - - "Coefficient of drag at tower node" - -typedef ^ AD_InputFile ReKi TwrTI {:} - - "Turbulence intensity for tower shadow at tower node" - typedef ^ AD_InputFile LOGICAL SumPrint - - - "Generate a summary file listing input options and interpolated properties to ".AD.sum"?" flag typedef ^ AD_InputFile IntKi NBlOuts - - - "Number of blade node outputs [0 - 9]" - typedef ^ AD_InputFile IntKi BlOutNd {9} - - "Blade nodes whose values will be output" - @@ -146,124 +153,152 @@ typedef ^ AD_InputFile CHARACTER(ChanLen) BldNd_OutList {:} - - "List of user-re typedef ^ AD_InputFile CHARACTER(1024) BldNd_BlOutNd_Str - - - "String to parse for the blade nodes to actually output (AD_AllBldNdOuts)" - typedef ^ AD_InputFile IntKi BldNd_BladesOut - - - "The blades to output (AD_AllBldNdOuts)" - #typedef ^ AD_InputFile CHARACTER(1024) BldNd_BladesOut_Str - - - "String to parse for the he blades to output (AD_AllBldNdOuts)" - +typedef ^ AD_InputFile RotInputFile rotors {:} - - "Rotor (blades and tower) input file data" - + # ..... States .................................................................................................................... # Define continuous (differentiable) states here: -typedef ^ ContinuousStateType BEMT_ContinuousStateType BEMT - - - "Continuous states from the BEMT module" - +typedef ^ RotContinuousStateType BEMT_ContinuousStateType BEMT - - - "Continuous states from the BEMT module" - +typedef ^ RotContinuousStateType AA_ContinuousStateType AA - - - "Continuous states from the AA module" - + +typedef ^ ContinuousStateType RotContinuousStateType rotors {:} - - "Continuous states for each rotor" - typedef ^ ContinuousStateType FVW_ContinuousStateType FVW - - - "Continuous states from the FVW module" - -typedef ^ ContinuousStateType AA_ContinuousStateType AA - - - "Continuous states from the AA module" - + # Define discrete (nondifferentiable) states here: -typedef ^ DiscreteStateType BEMT_DiscreteStateType BEMT - - - "Discrete states from the BEMT module" - +typedef ^ RotDiscreteStateType BEMT_DiscreteStateType BEMT - - - "Discrete states from the BEMT module" - +typedef ^ RotDiscreteStateType AA_DiscreteStateType AA - - - "Discrete states from the AA module" - + +typedef ^ DiscreteStateType RotDiscreteStateType rotors {:} - - "Discrete states for each rotor" - typedef ^ DiscreteStateType FVW_DiscreteStateType FVW - - - "Discrete states from the FVW module" - -typedef ^ DiscreteStateType AA_DiscreteStateType AA - - - "Discrete states from the AA module" - # Define constraint states here: -typedef ^ ConstraintStateType BEMT_ConstraintStateType BEMT - - - "Constraint states from the BEMT module" - +typedef ^ RotConstraintStateType BEMT_ConstraintStateType BEMT - - - "Constraint states from the BEMT module" - +typedef ^ RotConstraintStateType AA_ConstraintStateType AA - - - "Constraint states from the AA module" - + +typedef ^ ConstraintStateType RotConstraintStateType rotors {:} - - "Constraint states for each rotor" - typedef ^ ConstraintStateType FVW_ConstraintStateType FVW - - - "Constraint states from the FVW module" - -typedef ^ ConstraintStateType AA_ConstraintStateType AA - - - "Constraint states from the AA module" - # Define "other" states here: -typedef ^ OtherStateType BEMT_OtherStateType BEMT - - - "OtherStates from the BEMT module" - +typedef ^ RotOtherStateType BEMT_OtherStateType BEMT - - - "OtherStates from the BEMT module" - +typedef ^ RotOtherStateType AA_OtherStateType AA - - - "OtherStates from the AA module" - + +typedef ^ OtherStateType RotOtherStateType rotors {:} - - "OtherStates from the BEMT module" - typedef ^ OtherStateType FVW_OtherStateType FVW - - - "OtherStates from the FVW module" - typedef ^ OtherStateType ReKi WakeLocationPoints {:}{:} - - "wake points velocity" m/s -typedef ^ OtherStateType AA_OtherStateType AA - - - "OtherStates from the AA module" - + # Define misc/optimization variables (any data that are not considered actual states) here: -typedef ^ MiscVarType BEMT_MiscVarType BEMT - - - "MiscVars from the BEMT module" - -typedef ^ MiscVarType BEMT_OutputType BEMT_y - - - "Outputs from the BEMT module" - -typedef ^ MiscVarType BEMT_InputType BEMT_u 2 - - "Inputs to the BEMT module" - -typedef ^ MiscVarType FVW_MiscVarType FVW - - - "MiscVars from the FVW module" - -typedef ^ MiscVarType FVW_OutputType FVW_y - - - "Outputs from the FVW module" - +typedef ^ RotMiscVarType BEMT_MiscVarType BEMT - - - "MiscVars from the BEMT module" - +typedef ^ RotMiscVarType BEMT_OutputType BEMT_y - - - "Outputs from the BEMT module" - +typedef ^ RotMiscVarType BEMT_InputType BEMT_u 2 - - "Inputs to the BEMT module" - +typedef ^ RotMiscVarType AA_MiscVarType AA - - - "MiscVars from the AA module" - +typedef ^ RotMiscVarType AA_OutputType AA_y - - - "Outputs from the AA module" - +typedef ^ RotMiscVarType AA_InputType AA_u - - - "Inputs to the AA module" - + +typedef ^ RotMiscVarType ReKi DisturbedInflow {:}{:}{:} - - "InflowOnBlade values modified by tower influence" m/s +typedef ^ RotMiscVarType ReKi WithoutSweepPitchTwist {:}{:}{:}{:} - - "Coordinate system equivalent to BladeMotion Orientation, but without live sweep, blade-pitch, and twist angles" - +typedef ^ RotMiscVarType ReKi AllOuts {:} - - "An array holding the value of all of the calculated (not only selected) output channels" - +typedef ^ RotMiscVarType ReKi W_Twr {:} - - "relative wind speed normal to the tower at node j" m/s +typedef ^ RotMiscVarType ReKi X_Twr {:} - - "local x-component of force per unit length of the jth node in the tower" m/s +typedef ^ RotMiscVarType ReKi Y_Twr {:} - - "local y-component of force per unit length of the jth node in the tower" m/s +typedef ^ RotMiscVarType ReKi Curve {:}{:} - - "curvature angle, saved for possible output to file" rad +typedef ^ RotMiscVarType ReKi TwrClrnc {:}{:} - - "Distance between tower (including tower radius) and blade node (not including blade width), saved for possible output to file" m +typedef ^ RotMiscVarType ReKi X {:}{:} - - "normal force per unit length (normal to the plane, not chord) of the jth node in the kth blade" N/m +typedef ^ RotMiscVarType ReKi Y {:}{:} - - "tangential force per unit length (tangential to the plane, not chord) of the jth node in the kth blade" N/m +typedef ^ RotMiscVarType ReKi M {:}{:} - - "pitching moment per unit length of the jth node in the kth blade" Nm/m +typedef ^ RotMiscVarType ReKi V_DiskAvg {3} - - "disk-average relative wind speed" m/s +typedef ^ RotMiscVarType ReKi hub_theta_x_root {3} - - "angles saved for FAST.Farm" rad +typedef ^ RotMiscVarType ReKi V_dot_x - - - +typedef ^ RotMiscVarType MeshType HubLoad - - - "mesh at hub; used to compute an integral for mapping the output blade loads to a single point (for writing to file only)" - +typedef ^ RotMiscVarType MeshMapType B_L_2_H_P {:} - - "mapping data structure to map each bladeLoad output mesh to the MiscVar%HubLoad mesh" +typedef ^ RotMiscVarType ReKi SigmaCavitCrit {:}{:} - - "critical cavitation number- inception value (above which cavit will occur)" - +typedef ^ RotMiscVarType ReKi SigmaCavit {:}{:} - - "cavitation number at node " - +typedef ^ RotMiscVarType Logical CavitWarnSet {:}{:} - - "cavitation warning issued " - +typedef ^ RotMiscVarType MeshType BladeRootLoad {:} - - "meshes at blade root; used to compute an integral for mapping the output blade loads to single points (for writing to file only)" - +typedef ^ RotMiscVarType MeshMapType B_L_2_R_P {:} - - "mapping data structure to map each bladeLoad output mesh to corresponding MiscVar%BladeRootLoad mesh" + +typedef ^ MiscVarType RotMiscVarType rotors {:}- - - "MiscVars for each rotor" - typedef ^ MiscVarType FVW_InputType FVW_u : - - "Inputs to the FVW module" - -typedef ^ MiscVarType AA_MiscVarType AA - - - "MiscVars from the AA module" - -typedef ^ MiscVarType AA_OutputType AA_y - - - "Outputs from the AA module" - -typedef ^ MiscVarType AA_InputType AA_u - - - "Inputs to the AA module" - - -typedef ^ MiscVarType ReKi DisturbedInflow {:}{:}{:} - - "InflowOnBlade values modified by tower influence" m/s -typedef ^ MiscVarType ReKi WithoutSweepPitchTwist {:}{:}{:}{:} - - "Coordinate system equivalent to BladeMotion Orientation, but without live sweep, blade-pitch, and twist angles" - -typedef ^ MiscVarType ReKi AllOuts {:} - - "An array holding the value of all of the calculated (not only selected) output channels" - -typedef ^ MiscVarType ReKi W_Twr {:} - - "relative wind speed normal to the tower at node j" m/s -typedef ^ MiscVarType ReKi X_Twr {:} - - "local x-component of force per unit length of the jth node in the tower" m/s -typedef ^ MiscVarType ReKi Y_Twr {:} - - "local y-component of force per unit length of the jth node in the tower" m/s -typedef ^ MiscVarType ReKi Curve {:}{:} - - "curvature angle, saved for possible output to file" rad -typedef ^ MiscVarType ReKi TwrClrnc {:}{:} - - "Distance between tower (including tower radius) and blade node (not including blade width), saved for possible output to file" m -typedef ^ MiscVarType ReKi X {:}{:} - - "normal force per unit length (normal to the plane, not chord) of the jth node in the kth blade" N/m -typedef ^ MiscVarType ReKi Y {:}{:} - - "tangential force per unit length (tangential to the plane, not chord) of the jth node in the kth blade" N/m -typedef ^ MiscVarType ReKi M {:}{:} - - "pitching moment per unit length of the jth node in the kth blade" Nm/m -typedef ^ MiscVarType ReKi V_DiskAvg {3} - - "disk-average relative wind speed" m/s -typedef ^ MiscVarType ReKi hub_theta_x_root {3} - - "angles saved for FAST.Farm" rad -typedef ^ MiscVarType ReKi V_dot_x - - - -typedef ^ MiscVarType MeshType HubLoad - - - "mesh at hub; used to compute an integral for mapping the output blade loads to a single point (for writing to file only)" - -typedef ^ MiscVarType MeshMapType B_L_2_H_P {:} - - "mapping data structure to map each bladeLoad output mesh to the MiscVar%HubLoad mesh" -typedef ^ MiscVarType ReKi SigmaCavitCrit {:}{:} - - "critical cavitation number- inception value (above which cavit will occur)" - -typedef ^ MiscVarType ReKi SigmaCavit {:}{:} - - "cavitation number at node " - -typedef ^ MiscVarType Logical CavitWarnSet {:}{:} - - "cavitation warning issued " - +typedef ^ MiscVarType FVW_OutputType FVW_y - - - "Outputs from the FVW module" - +typedef ^ MiscVarType FVW_MiscVarType FVW - - - "MiscVars from the FVW module" - # ..... Parameters ................................................................................................................ # Define parameters here: +# Parameters for each rotor +typedef ^ RotParameterType IntKi NumBlades - - - "Number of blades on the turbine" - +typedef ^ RotParameterType IntKi NumBlNds - - - "Number of nodes on each blade" - +typedef ^ RotParameterType IntKi NumTwrNds - - - "Number of nodes on the tower" - +typedef ^ RotParameterType ReKi TwrDiam {:} - - "Diameter of tower at node" m +typedef ^ RotParameterType ReKi TwrCd {:} - - "Coefficient of drag at tower node" - +typedef ^ RotParameterType ReKi TwrTI {:} - - "Turbulence intensity for tower shadow at tower node" - +typedef ^ RotParameterType BEMT_ParameterType BEMT - - - "Parameters for BEMT module" +typedef ^ RotParameterType AA_ParameterType AA - - - "Parameters for AA module" +typedef ^ RotParameterType Integer Jac_u_indx {:}{:} - - "matrix to help fill/pack the u vector in computing the jacobian" - +typedef ^ RotParameterType ReKi du {:} - - "vector that determines size of perturbation for u (inputs)" +typedef ^ RotParameterType ReKi dx {:} - - "vector that determines size of perturbation for x (continuous states)" +typedef ^ RotParameterType Integer Jac_ny - - - "number of outputs in jacobian matrix" - # Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: -typedef ^ ParameterType DbKi DT - - - "Time step for continuous state integration & discrete state update" seconds -typedef ^ ParameterType IntKi WakeMod - - - "Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW}" - -typedef ^ ParameterType IntKi TwrPotent - - - "Type tower influence on wind based on potential flow around the tower {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}" - -typedef ^ ParameterType IntKi TwrShadow - - - "Calculate tower influence on wind based on downstream tower shadow {0=none, 1=Powles model, 2=Eames model}" - -typedef ^ ParameterType LOGICAL TwrAero - - - "Calculate tower aerodynamic loads?" flag -typedef ^ ParameterType Logical FrozenWake - - - "Flag that tells this module it should assume a frozen wake during linearization." - -typedef ^ ParameterType Logical CavitCheck - - - "Flag that tells us if we want to check for cavitation" - -typedef ^ ParameterType Logical CompAA - - - "Compute AeroAcoustic noise" flag -typedef ^ ParameterType IntKi NumBlades - - - "Number of blades on the turbine" - -typedef ^ ParameterType IntKi NumBlNds - - - "Number of nodes on each blade" - -typedef ^ ParameterType IntKi NumTwrNds - - - "Number of nodes on the tower" - -typedef ^ ParameterType ReKi TwrDiam {:} - - "Diameter of tower at node" m -typedef ^ ParameterType ReKi TwrCd {:} - - "Coefficient of drag at tower node" - -typedef ^ ParameterType ReKi TwrTI {:} - - "Turbulence intensity for tower shadow at tower node" - -typedef ^ ParameterType ReKi AirDens - - - "Air density" kg/m^3 -typedef ^ ParameterType ReKi KinVisc - - - "Kinematic air viscosity" m^2/s -typedef ^ ParameterType ReKi SpdSound - - - "Speed of sound" m/s -typedef ^ ParameterType ReKi Gravity - - - "Gravitational acceleration" m/s^2 -typedef ^ ParameterType ReKi Patm - - - "Atmospheric pressure" Pa -typedef ^ ParameterType ReKi Pvap - - - "Vapour pressure" Pa -typedef ^ ParameterType ReKi FluidDepth - - - "Submerged hub height" m -typedef ^ ParameterType AFI_ParameterType AFI {:} - - "AirfoilInfo parameters" -typedef ^ ParameterType BEMT_ParameterType BEMT - - - "Parameters for BEMT module" -typedef ^ ParameterType FVW_ParameterType FVW - - - "Parameters for FVW module" -typedef ^ ParameterType AA_ParameterType AA - - - "Parameters for AA module" +typedef ^ RotParameterType IntKi TwrPotent - - - "Type tower influence on wind based on potential flow around the tower {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}" - +typedef ^ RotParameterType IntKi TwrShadow - - - "Calculate tower influence on wind based on downstream tower shadow {0=none, 1=Powles model, 2=Eames model}" - +typedef ^ RotParameterType LOGICAL TwrAero - - - "Calculate tower aerodynamic loads?" flag +typedef ^ RotParameterType Logical FrozenWake - - - "Flag that tells this module it should assume a frozen wake during linearization." - +typedef ^ RotParameterType Logical CavitCheck - - - "Flag that tells us if we want to check for cavitation" - +typedef ^ RotParameterType Logical CompAA - - - "Compute AeroAcoustic noise" flag +typedef ^ RotParameterType ReKi AirDens - - - "Air density" kg/m^3 +typedef ^ RotParameterType ReKi KinVisc - - - "Kinematic air viscosity" m^2/s +typedef ^ RotParameterType ReKi SpdSound - - - "Speed of sound" m/s +typedef ^ RotParameterType ReKi Gravity - - - "Gravitational acceleration" m/s^2 +typedef ^ RotParameterType ReKi Patm - - - "Atmospheric pressure" Pa +typedef ^ RotParameterType ReKi Pvap - - - "Vapour pressure" Pa +typedef ^ RotParameterType ReKi FluidDepth - - - "Submerged hub height" m # parameters for output -typedef ^ ParameterType IntKi NumOuts - - - "Number of parameters in the output list (number of outputs requested)" - -typedef ^ ParameterType CHARACTER(1024) RootName - - - "RootName for writing output files" - -typedef ^ ParameterType OutParmType OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - -typedef ^ ParameterType IntKi NBlOuts - - - "Number of blade node outputs [0 - 9]" - -typedef ^ ParameterType IntKi BlOutNd {9} - - "Blade nodes whose values will be output" - -typedef ^ ParameterType IntKi NTwOuts - - - "Number of tower node outputs [0 - 9]" - -typedef ^ ParameterType IntKi TwOutNd {9} - - "Tower nodes whose values will be output" - +typedef ^ RotParameterType IntKi NumOuts - - - "Number of parameters in the output list (number of outputs requested)" - +typedef ^ RotParameterType CHARACTER(1024) RootName - - - "RootName for writing output files" - +typedef ^ RotParameterType OutParmType OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - +typedef ^ RotParameterType IntKi NBlOuts - - - "Number of blade node outputs [0 - 9]" - +typedef ^ RotParameterType IntKi BlOutNd {9} - - "Blade nodes whose values will be output" - +typedef ^ RotParameterType IntKi NTwOuts - - - "Number of tower node outputs [0 - 9]" - +typedef ^ RotParameterType IntKi TwOutNd {9} - - "Tower nodes whose values will be output" - -typedef ^ ParameterType IntKi BldNd_NumOuts - - - "Number of requested output channels per blade node (AD_AllBldNdOuts)" - -typedef ^ ParameterType IntKi BldNd_TotNumOuts - - - "Total number of requested output channels of blade node information (BldNd_NumOuts * BldNd_BlOutNd * BldNd_BladesOut -- AD_AllBldNdOuts)" - -typedef ^ ParameterType OutParmType BldNd_OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - -typedef ^ ParameterType IntKi BldNd_BlOutNd {:} - - "The blade nodes to actually output (AD_AllBldNdOuts)" - -typedef ^ ParameterType IntKi BldNd_BladesOut - - - "The blades to output (AD_AllBldNdOuts)" - +typedef ^ RotParameterType IntKi BldNd_NumOuts - - - "Number of requested output channels per blade node (AD_AllBldNdOuts)" - +typedef ^ RotParameterType IntKi BldNd_TotNumOuts - - - "Total number of requested output channels of blade node information (BldNd_NumOuts * BldNd_BlOutNd * BldNd_BladesOut -- AD_AllBldNdOuts)" - +typedef ^ RotParameterType OutParmType BldNd_OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - +typedef ^ RotParameterType IntKi BldNd_BlOutNd {:} - - "The blade nodes to actually output (AD_AllBldNdOuts)" - +typedef ^ RotParameterType IntKi BldNd_BladesOut - - - "The blades to output (AD_AllBldNdOuts)" - +typedef ^ ParameterType RotParameterType rotors {:} - - "Parameter types for each rotor" - +typedef ^ ParameterType CHARACTER(1024) RootName - - - "RootName for writing output files" - +typedef ^ ParameterType AFI_ParameterType AFI {:} - - "AirfoilInfo parameters" +typedef ^ ParameterType IntKi WakeMod - - - "Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW}" - +typedef ^ ParameterType FVW_ParameterType FVW - - - "Parameters for FVW module" +typedef ^ ParameterType DbKi DT - - - "Time step for continuous state integration & discrete state update" seconds -typedef ^ ParameterType Integer Jac_u_indx {:}{:} - - "matrix to help fill/pack the u vector in computing the jacobian" - -typedef ^ ParameterType ReKi du {:} - - "vector that determines size of perturbation for u (inputs)" -typedef ^ ParameterType ReKi dx {:} - - "vector that determines size of perturbation for x (continuous states)" -typedef ^ ParameterType Integer Jac_ny - - - "number of outputs in jacobian matrix" - # ..... Inputs .................................................................................................................... -# Define inputs that are contained on the mesh here: -typedef ^ InputType MeshType TowerMotion - - - "motion on the tower" - -typedef ^ InputType MeshType HubMotion - - - "motion on the hub" - -typedef ^ InputType MeshType BladeRootMotion {:} - - "motion on each blade root" - -typedef ^ InputType MeshType BladeMotion {:} - - "motion on each blade" - -# Define inputs that are not on this mesh here: -typedef ^ InputType ReKi InflowOnBlade {:}{:}{:} - - "U,V,W at nodes on each blade (note if we change the requirement that NumNodes is the same for each blade, this will need to change)" m/s -typedef ^ InputType ReKi InflowOnTower {:}{:} - - "U,V,W at nodes on the tower" m/s -typedef ^ InputType ReKi UserProp {:}{:} - - "Optional user property for interpolating airfoils (per element per blade)" - +# Define inputs that are contained on a mesh here: +typedef ^ RotInputType MeshType NacelleMotion - - - "motion on the nacelle" - +typedef ^ RotInputType MeshType TowerMotion - - - "motion on the tower" - +typedef ^ RotInputType MeshType HubMotion - - - "motion on the hub" - +typedef ^ RotInputType MeshType BladeRootMotion {:} - - "motion on each blade root" - +typedef ^ RotInputType MeshType BladeMotion {:} - - "motion on each blade" - +# Define inputs that are not on a mesh here: +typedef ^ RotInputType ReKi InflowOnBlade {:}{:}{:} - - "U,V,W at nodes on each blade (note if we change the requirement that NumNodes is the same for each blade, this will need to change)" m/s +typedef ^ RotInputType ReKi InflowOnTower {:}{:} - - "U,V,W at nodes on the tower" m/s +typedef ^ RotInputType ReKi InflowOnNacelle {3} - - "U,V,W at nacelle" m/s +typedef ^ RotInputType ReKi UserProp {:}{:} - - "Optional user property for interpolating airfoils (per element per blade)" - + +typedef ^ InputType RotInputType rotors {:} - - "Inputs for each rotor" - typedef ^ InputType ReKi InflowWakeVel {:}{:} - - "U,V,W at wake points" m/s + # ..... Outputs ................................................................................................................... -# Define outputs that are contained on the mesh here: -typedef ^ OutputType MeshType TowerLoad - - - "loads on the tower" - -typedef ^ OutputType MeshType BladeLoad {:} - - "loads on each blade" - -# Define outputs that are not on this mesh here: -typedef ^ OutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" +# Define outputs that are contained on a mesh here: +typedef ^ RotOutputType MeshType NacelleLoad - - - "loads on the nacelle" - +typedef ^ RotOutputType MeshType TowerLoad - - - "loads on the tower" - +typedef ^ RotOutputType MeshType BladeLoad {:} - - "loads on each blade" - +# Define outputs that are not on a mesh here: +typedef ^ RotOutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" + +typedef ^ OutputType RotOutputType rotors {:} - - "Ouputs for each rotor" - + diff --git a/modules/aerodyn/src/AeroDyn_Types.f90 b/modules/aerodyn/src/AeroDyn_Types.f90 index c3ac68c372..3332222705 100644 --- a/modules/aerodyn/src/AeroDyn_Types.f90 +++ b/modules/aerodyn/src/AeroDyn_Types.f90 @@ -52,19 +52,25 @@ MODULE AeroDyn_Types INTEGER(IntKi), PUBLIC, PARAMETER :: TwrShadow_none = 0 ! no tower shadow [-] INTEGER(IntKi), PUBLIC, PARAMETER :: TwrShadow_Powles = 1 ! Powles tower shadow model [-] INTEGER(IntKi), PUBLIC, PARAMETER :: TwrShadow_Eames = 2 ! Eames tower shadow model [-] -! ========= AD_InitInputType ======= - TYPE, PUBLIC :: AD_InitInputType - CHARACTER(1024) :: InputFile !< Name of the input file [-] - LOGICAL :: Linearize = .FALSE. !< Flag that tells this module if the glue code wants to linearize. [-] +! ========= RotInitInputType ======= + TYPE, PUBLIC :: RotInitInputType INTEGER(IntKi) :: NumBlades !< Number of blades on the turbine [-] - REAL(ReKi) :: Gravity !< Gravity force [Nm/s^2] - CHARACTER(1024) :: RootName !< RootName for writing output files [-] REAL(ReKi) , DIMENSION(1:3) :: HubPosition !< X-Y-Z reference position of hub [m] REAL(R8Ki) , DIMENSION(1:3,1:3) :: HubOrientation !< DCM reference orientation of hub [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BladeRootPosition !< X-Y-Z reference position of each blade root (3 x NumBlades) [m] REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: BladeRootOrientation !< DCM reference orientation of blade roots (3x3 x NumBlades) [-] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: NacelleOrientation !< DCM reference orientation of nacelle [-] + END TYPE RotInitInputType +! ======================= +! ========= AD_InitInputType ======= + TYPE, PUBLIC :: AD_InitInputType + TYPE(RotInitInputType) , DIMENSION(:), ALLOCATABLE :: rotors !< Init Input Types for rotors [-] + CHARACTER(1024) :: InputFile !< Name of the input file [-] + CHARACTER(1024) :: RootName !< RootName for writing output files [-] LOGICAL :: UsePrimaryInputFile = .TRUE. !< Read input file instead of passed data [-] TYPE(FileInfoType) :: PassedPrimaryInputData !< Primary input file as FileInfoType (set by driver/glue code) [-] + LOGICAL :: Linearize = .FALSE. !< Flag that tells this module if the glue code wants to linearize. [-] + REAL(ReKi) :: Gravity !< Gravity force [Nm/s^2] END TYPE AD_InitInputType ! ======================= ! ========= AD_BladePropsType ======= @@ -84,12 +90,11 @@ MODULE AeroDyn_Types REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE :: AirfoilCoords !< x-y coordinates for airfoils, relative to node [m] END TYPE AD_BladeShape ! ======================= -! ========= AD_InitOutputType ======= - TYPE, PUBLIC :: AD_InitOutputType +! ========= RotInitOutputType ======= + TYPE, PUBLIC :: RotInitOutputType + REAL(ReKi) :: AirDens !< Air density [kg/m^3] CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputHdr !< Names of the output-to-file channels [-] CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputUnt !< Units of the output-to-file channels [-] - TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] - REAL(ReKi) :: AirDens !< Air density [kg/m^3] TYPE(AD_BladeShape) , DIMENSION(:), ALLOCATABLE :: BladeShape !< airfoil coordinates for each blade [m] CHARACTER(LinChanLen) , DIMENSION(:), ALLOCATABLE :: LinNames_y !< Names of the outputs used in linearization [-] CHARACTER(LinChanLen) , DIMENSION(:), ALLOCATABLE :: LinNames_x !< Names of the continuous states used in linearization [-] @@ -102,8 +107,25 @@ MODULE AeroDyn_Types INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: DerivOrder_x !< Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrElev !< Elevation at tower node [m] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrDiam !< Diameter of tower at node [m] + END TYPE RotInitOutputType +! ======================= +! ========= AD_InitOutputType ======= + TYPE, PUBLIC :: AD_InitOutputType + TYPE(RotInitOutputType) , DIMENSION(:), ALLOCATABLE :: rotors !< Rotor init output type [-] + TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] END TYPE AD_InitOutputType ! ======================= +! ========= RotInputFile ======= + TYPE, PUBLIC :: RotInputFile + INTEGER(IntKi) :: BldNd_BladesOut !< The blades to output (AD_AllBldNdOuts) [-] + TYPE(AD_BladePropsType) , DIMENSION(:), ALLOCATABLE :: BladeProps !< blade property information from blade input files [-] + INTEGER(IntKi) :: NumTwrNds !< Number of tower nodes used in the analysis [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrElev !< Elevation at tower node [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrDiam !< Diameter of tower at node [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrCd !< Coefficient of drag at tower node [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrTI !< Turbulence intensity for tower shadow at tower node [-] + END TYPE RotInputFile +! ======================= ! ========= AD_InputFile ======= TYPE, PUBLIC :: AD_InputFile LOGICAL :: Echo !< Echo input file to echo file [-] @@ -145,12 +167,6 @@ MODULE AeroDyn_Types CHARACTER(1024) :: FVWFileName !< FVW input filename [quoted string] CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: AFNames !< Airfoil file names (NumAF lines) [quoted strings] LOGICAL :: UseBlCm !< Include aerodynamic pitching moment in calculations? [flag] - TYPE(AD_BladePropsType) , DIMENSION(:), ALLOCATABLE :: BladeProps !< blade property information from blade input files [-] - INTEGER(IntKi) :: NumTwrNds !< Number of tower nodes used in the analysis [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrElev !< Elevation at tower node [m] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrDiam !< Diameter of tower at node [m] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrCd !< Coefficient of drag at tower node [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrTI !< Turbulence intensity for tower shadow at tower node [-] LOGICAL :: SumPrint !< Generate a summary file listing input options and interpolated properties to ".AD.sum"? [flag] INTEGER(IntKi) :: NBlOuts !< Number of blade node outputs [0 - 9] [-] INTEGER(IntKi) , DIMENSION(1:9) :: BlOutNd !< Blade nodes whose values will be output [-] @@ -164,45 +180,63 @@ MODULE AeroDyn_Types CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: BldNd_OutList !< List of user-requested output channels (AD_AllBldNdOuts) [-] CHARACTER(1024) :: BldNd_BlOutNd_Str !< String to parse for the blade nodes to actually output (AD_AllBldNdOuts) [-] INTEGER(IntKi) :: BldNd_BladesOut !< The blades to output (AD_AllBldNdOuts) [-] + TYPE(RotInputFile) , DIMENSION(:), ALLOCATABLE :: rotors !< Rotor (blades and tower) input file data [-] END TYPE AD_InputFile ! ======================= +! ========= RotContinuousStateType ======= + TYPE, PUBLIC :: RotContinuousStateType + TYPE(BEMT_ContinuousStateType) :: BEMT !< Continuous states from the BEMT module [-] + TYPE(AA_ContinuousStateType) :: AA !< Continuous states from the AA module [-] + END TYPE RotContinuousStateType +! ======================= ! ========= AD_ContinuousStateType ======= TYPE, PUBLIC :: AD_ContinuousStateType - TYPE(BEMT_ContinuousStateType) :: BEMT !< Continuous states from the BEMT module [-] + TYPE(RotContinuousStateType) , DIMENSION(:), ALLOCATABLE :: rotors !< Continuous states for each rotor [-] TYPE(FVW_ContinuousStateType) :: FVW !< Continuous states from the FVW module [-] - TYPE(AA_ContinuousStateType) :: AA !< Continuous states from the AA module [-] END TYPE AD_ContinuousStateType ! ======================= +! ========= RotDiscreteStateType ======= + TYPE, PUBLIC :: RotDiscreteStateType + TYPE(BEMT_DiscreteStateType) :: BEMT !< Discrete states from the BEMT module [-] + TYPE(AA_DiscreteStateType) :: AA !< Discrete states from the AA module [-] + END TYPE RotDiscreteStateType +! ======================= ! ========= AD_DiscreteStateType ======= TYPE, PUBLIC :: AD_DiscreteStateType - TYPE(BEMT_DiscreteStateType) :: BEMT !< Discrete states from the BEMT module [-] + TYPE(RotDiscreteStateType) , DIMENSION(:), ALLOCATABLE :: rotors !< Discrete states for each rotor [-] TYPE(FVW_DiscreteStateType) :: FVW !< Discrete states from the FVW module [-] - TYPE(AA_DiscreteStateType) :: AA !< Discrete states from the AA module [-] END TYPE AD_DiscreteStateType ! ======================= +! ========= RotConstraintStateType ======= + TYPE, PUBLIC :: RotConstraintStateType + TYPE(BEMT_ConstraintStateType) :: BEMT !< Constraint states from the BEMT module [-] + TYPE(AA_ConstraintStateType) :: AA !< Constraint states from the AA module [-] + END TYPE RotConstraintStateType +! ======================= ! ========= AD_ConstraintStateType ======= TYPE, PUBLIC :: AD_ConstraintStateType - TYPE(BEMT_ConstraintStateType) :: BEMT !< Constraint states from the BEMT module [-] + TYPE(RotConstraintStateType) , DIMENSION(:), ALLOCATABLE :: rotors !< Constraint states for each rotor [-] TYPE(FVW_ConstraintStateType) :: FVW !< Constraint states from the FVW module [-] - TYPE(AA_ConstraintStateType) :: AA !< Constraint states from the AA module [-] END TYPE AD_ConstraintStateType ! ======================= +! ========= RotOtherStateType ======= + TYPE, PUBLIC :: RotOtherStateType + TYPE(BEMT_OtherStateType) :: BEMT !< OtherStates from the BEMT module [-] + TYPE(AA_OtherStateType) :: AA !< OtherStates from the AA module [-] + END TYPE RotOtherStateType +! ======================= ! ========= AD_OtherStateType ======= TYPE, PUBLIC :: AD_OtherStateType - TYPE(BEMT_OtherStateType) :: BEMT !< OtherStates from the BEMT module [-] + TYPE(RotOtherStateType) , DIMENSION(:), ALLOCATABLE :: rotors !< OtherStates from the BEMT module [-] TYPE(FVW_OtherStateType) :: FVW !< OtherStates from the FVW module [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WakeLocationPoints !< wake points velocity [m/s] - TYPE(AA_OtherStateType) :: AA !< OtherStates from the AA module [-] END TYPE AD_OtherStateType ! ======================= -! ========= AD_MiscVarType ======= - TYPE, PUBLIC :: AD_MiscVarType +! ========= RotMiscVarType ======= + TYPE, PUBLIC :: RotMiscVarType TYPE(BEMT_MiscVarType) :: BEMT !< MiscVars from the BEMT module [-] TYPE(BEMT_OutputType) :: BEMT_y !< Outputs from the BEMT module [-] TYPE(BEMT_InputType) , DIMENSION(1:2) :: BEMT_u !< Inputs to the BEMT module [-] - TYPE(FVW_MiscVarType) :: FVW !< MiscVars from the FVW module [-] - TYPE(FVW_OutputType) :: FVW_y !< Outputs from the FVW module [-] - TYPE(FVW_InputType) , DIMENSION(:), ALLOCATABLE :: FVW_u !< Inputs to the FVW module [-] TYPE(AA_MiscVarType) :: AA !< MiscVars from the AA module [-] TYPE(AA_OutputType) :: AA_y !< Outputs from the AA module [-] TYPE(AA_InputType) :: AA_u !< Inputs to the AA module [-] @@ -225,24 +259,38 @@ MODULE AeroDyn_Types REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: SigmaCavitCrit !< critical cavitation number- inception value (above which cavit will occur) [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: SigmaCavit !< cavitation number at node [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: CavitWarnSet !< cavitation warning issued [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: BladeRootLoad !< meshes at blade root; used to compute an integral for mapping the output blade loads to single points (for writing to file only) [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: B_L_2_R_P !< mapping data structure to map each bladeLoad output mesh to corresponding MiscVar%BladeRootLoad mesh [-] + END TYPE RotMiscVarType +! ======================= +! ========= AD_MiscVarType ======= + TYPE, PUBLIC :: AD_MiscVarType + TYPE(RotMiscVarType) , DIMENSION(:), ALLOCATABLE :: rotors !< MiscVars for each rotor [-] + TYPE(FVW_InputType) , DIMENSION(:), ALLOCATABLE :: FVW_u !< Inputs to the FVW module [-] + TYPE(FVW_OutputType) :: FVW_y !< Outputs from the FVW module [-] + TYPE(FVW_MiscVarType) :: FVW !< MiscVars from the FVW module [-] END TYPE AD_MiscVarType ! ======================= -! ========= AD_ParameterType ======= - TYPE, PUBLIC :: AD_ParameterType - REAL(DbKi) :: DT !< Time step for continuous state integration & discrete state update [seconds] - INTEGER(IntKi) :: WakeMod !< Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW} [-] - INTEGER(IntKi) :: TwrPotent !< Type tower influence on wind based on potential flow around the tower {0=none, 1=baseline potential flow, 2=potential flow with Bak correction} [-] - INTEGER(IntKi) :: TwrShadow !< Calculate tower influence on wind based on downstream tower shadow {0=none, 1=Powles model, 2=Eames model} [-] - LOGICAL :: TwrAero !< Calculate tower aerodynamic loads? [flag] - LOGICAL :: FrozenWake !< Flag that tells this module it should assume a frozen wake during linearization. [-] - LOGICAL :: CavitCheck !< Flag that tells us if we want to check for cavitation [-] - LOGICAL :: CompAA !< Compute AeroAcoustic noise [flag] +! ========= RotParameterType ======= + TYPE, PUBLIC :: RotParameterType INTEGER(IntKi) :: NumBlades !< Number of blades on the turbine [-] INTEGER(IntKi) :: NumBlNds !< Number of nodes on each blade [-] INTEGER(IntKi) :: NumTwrNds !< Number of nodes on the tower [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrDiam !< Diameter of tower at node [m] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrCd !< Coefficient of drag at tower node [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrTI !< Turbulence intensity for tower shadow at tower node [-] + TYPE(BEMT_ParameterType) :: BEMT !< Parameters for BEMT module [-] + TYPE(AA_ParameterType) :: AA !< Parameters for AA module [-] + INTEGER(IntKi) , DIMENSION(:,:), ALLOCATABLE :: Jac_u_indx !< matrix to help fill/pack the u vector in computing the jacobian [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: du !< vector that determines size of perturbation for u (inputs) [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dx !< vector that determines size of perturbation for x (continuous states) [-] + INTEGER(IntKi) :: Jac_ny !< number of outputs in jacobian matrix [-] + INTEGER(IntKi) :: TwrPotent !< Type tower influence on wind based on potential flow around the tower {0=none, 1=baseline potential flow, 2=potential flow with Bak correction} [-] + INTEGER(IntKi) :: TwrShadow !< Calculate tower influence on wind based on downstream tower shadow {0=none, 1=Powles model, 2=Eames model} [-] + LOGICAL :: TwrAero !< Calculate tower aerodynamic loads? [flag] + LOGICAL :: FrozenWake !< Flag that tells this module it should assume a frozen wake during linearization. [-] + LOGICAL :: CavitCheck !< Flag that tells us if we want to check for cavitation [-] + LOGICAL :: CompAA !< Compute AeroAcoustic noise [flag] REAL(ReKi) :: AirDens !< Air density [kg/m^3] REAL(ReKi) :: KinVisc !< Kinematic air viscosity [m^2/s] REAL(ReKi) :: SpdSound !< Speed of sound [m/s] @@ -250,10 +298,6 @@ MODULE AeroDyn_Types REAL(ReKi) :: Patm !< Atmospheric pressure [Pa] REAL(ReKi) :: Pvap !< Vapour pressure [Pa] REAL(ReKi) :: FluidDepth !< Submerged hub height [m] - TYPE(AFI_ParameterType) , DIMENSION(:), ALLOCATABLE :: AFI !< AirfoilInfo parameters [-] - TYPE(BEMT_ParameterType) :: BEMT !< Parameters for BEMT module [-] - TYPE(FVW_ParameterType) :: FVW !< Parameters for FVW module [-] - TYPE(AA_ParameterType) :: AA !< Parameters for AA module [-] INTEGER(IntKi) :: NumOuts !< Number of parameters in the output list (number of outputs requested) [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] TYPE(OutParmType) , DIMENSION(:), ALLOCATABLE :: OutParam !< Names and units (and other characteristics) of all requested output parameters [-] @@ -266,35 +310,54 @@ MODULE AeroDyn_Types TYPE(OutParmType) , DIMENSION(:), ALLOCATABLE :: BldNd_OutParam !< Names and units (and other characteristics) of all requested output parameters [-] INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: BldNd_BlOutNd !< The blade nodes to actually output (AD_AllBldNdOuts) [-] INTEGER(IntKi) :: BldNd_BladesOut !< The blades to output (AD_AllBldNdOuts) [-] - INTEGER(IntKi) , DIMENSION(:,:), ALLOCATABLE :: Jac_u_indx !< matrix to help fill/pack the u vector in computing the jacobian [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: du !< vector that determines size of perturbation for u (inputs) [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dx !< vector that determines size of perturbation for x (continuous states) [-] - INTEGER(IntKi) :: Jac_ny !< number of outputs in jacobian matrix [-] + END TYPE RotParameterType +! ======================= +! ========= AD_ParameterType ======= + TYPE, PUBLIC :: AD_ParameterType + TYPE(RotParameterType) , DIMENSION(:), ALLOCATABLE :: rotors !< Parameter types for each rotor [-] + CHARACTER(1024) :: RootName !< RootName for writing output files [-] + TYPE(AFI_ParameterType) , DIMENSION(:), ALLOCATABLE :: AFI !< AirfoilInfo parameters [-] + INTEGER(IntKi) :: WakeMod !< Type of wake/induction model {0=none, 1=BEMT, 2=DBEMT, 3=FVW} [-] + TYPE(FVW_ParameterType) :: FVW !< Parameters for FVW module [-] + REAL(DbKi) :: DT !< Time step for continuous state integration & discrete state update [seconds] END TYPE AD_ParameterType ! ======================= -! ========= AD_InputType ======= - TYPE, PUBLIC :: AD_InputType +! ========= RotInputType ======= + TYPE, PUBLIC :: RotInputType + TYPE(MeshType) :: NacelleMotion !< motion on the nacelle [-] TYPE(MeshType) :: TowerMotion !< motion on the tower [-] TYPE(MeshType) :: HubMotion !< motion on the hub [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: BladeRootMotion !< motion on each blade root [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: BladeMotion !< motion on each blade [-] REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: InflowOnBlade !< U,V,W at nodes on each blade (note if we change the requirement that NumNodes is the same for each blade, this will need to change) [m/s] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: InflowOnTower !< U,V,W at nodes on the tower [m/s] + REAL(ReKi) , DIMENSION(1:3) :: InflowOnNacelle !< U,V,W at nacelle [m/s] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: UserProp !< Optional user property for interpolating airfoils (per element per blade) [-] + END TYPE RotInputType +! ======================= +! ========= AD_InputType ======= + TYPE, PUBLIC :: AD_InputType + TYPE(RotInputType) , DIMENSION(:), ALLOCATABLE :: rotors !< Inputs for each rotor [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: InflowWakeVel !< U,V,W at wake points [m/s] END TYPE AD_InputType ! ======================= -! ========= AD_OutputType ======= - TYPE, PUBLIC :: AD_OutputType +! ========= RotOutputType ======= + TYPE, PUBLIC :: RotOutputType + TYPE(MeshType) :: NacelleLoad !< loads on the nacelle [-] TYPE(MeshType) :: TowerLoad !< loads on the tower [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: BladeLoad !< loads on each blade [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: WriteOutput !< Data to be written to an output file: see WriteOutputHdr for names of each variable [see WriteOutputUnt] + END TYPE RotOutputType +! ======================= +! ========= AD_OutputType ======= + TYPE, PUBLIC :: AD_OutputType + TYPE(RotOutputType) , DIMENSION(:), ALLOCATABLE :: rotors !< Ouputs for each rotor [-] END TYPE AD_OutputType ! ======================= CONTAINS - SUBROUTINE AD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_InitInputType), INTENT(IN) :: SrcInitInputData - TYPE(AD_InitInputType), INTENT(INOUT) :: DstInitInputData + SUBROUTINE AD_CopyRotInitInputType( SrcRotInitInputTypeData, DstRotInitInputTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotInitInputType), INTENT(IN) :: SrcRotInitInputTypeData + TYPE(RotInitInputType), INTENT(INOUT) :: DstRotInitInputTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -306,76 +369,68 @@ SUBROUTINE AD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrSt INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotInitInputType' ! ErrStat = ErrID_None ErrMsg = "" - DstInitInputData%InputFile = SrcInitInputData%InputFile - DstInitInputData%Linearize = SrcInitInputData%Linearize - DstInitInputData%NumBlades = SrcInitInputData%NumBlades - DstInitInputData%Gravity = SrcInitInputData%Gravity - DstInitInputData%RootName = SrcInitInputData%RootName - DstInitInputData%HubPosition = SrcInitInputData%HubPosition - DstInitInputData%HubOrientation = SrcInitInputData%HubOrientation -IF (ALLOCATED(SrcInitInputData%BladeRootPosition)) THEN - i1_l = LBOUND(SrcInitInputData%BladeRootPosition,1) - i1_u = UBOUND(SrcInitInputData%BladeRootPosition,1) - i2_l = LBOUND(SrcInitInputData%BladeRootPosition,2) - i2_u = UBOUND(SrcInitInputData%BladeRootPosition,2) - IF (.NOT. ALLOCATED(DstInitInputData%BladeRootPosition)) THEN - ALLOCATE(DstInitInputData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) + DstRotInitInputTypeData%NumBlades = SrcRotInitInputTypeData%NumBlades + DstRotInitInputTypeData%HubPosition = SrcRotInitInputTypeData%HubPosition + DstRotInitInputTypeData%HubOrientation = SrcRotInitInputTypeData%HubOrientation +IF (ALLOCATED(SrcRotInitInputTypeData%BladeRootPosition)) THEN + i1_l = LBOUND(SrcRotInitInputTypeData%BladeRootPosition,1) + i1_u = UBOUND(SrcRotInitInputTypeData%BladeRootPosition,1) + i2_l = LBOUND(SrcRotInitInputTypeData%BladeRootPosition,2) + i2_u = UBOUND(SrcRotInitInputTypeData%BladeRootPosition,2) + IF (.NOT. ALLOCATED(DstRotInitInputTypeData%BladeRootPosition)) THEN + ALLOCATE(DstRotInitInputTypeData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitInputTypeData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%BladeRootPosition = SrcInitInputData%BladeRootPosition + DstRotInitInputTypeData%BladeRootPosition = SrcRotInitInputTypeData%BladeRootPosition ENDIF -IF (ALLOCATED(SrcInitInputData%BladeRootOrientation)) THEN - i1_l = LBOUND(SrcInitInputData%BladeRootOrientation,1) - i1_u = UBOUND(SrcInitInputData%BladeRootOrientation,1) - i2_l = LBOUND(SrcInitInputData%BladeRootOrientation,2) - i2_u = UBOUND(SrcInitInputData%BladeRootOrientation,2) - i3_l = LBOUND(SrcInitInputData%BladeRootOrientation,3) - i3_u = UBOUND(SrcInitInputData%BladeRootOrientation,3) - IF (.NOT. ALLOCATED(DstInitInputData%BladeRootOrientation)) THEN - ALLOCATE(DstInitInputData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotInitInputTypeData%BladeRootOrientation)) THEN + i1_l = LBOUND(SrcRotInitInputTypeData%BladeRootOrientation,1) + i1_u = UBOUND(SrcRotInitInputTypeData%BladeRootOrientation,1) + i2_l = LBOUND(SrcRotInitInputTypeData%BladeRootOrientation,2) + i2_u = UBOUND(SrcRotInitInputTypeData%BladeRootOrientation,2) + i3_l = LBOUND(SrcRotInitInputTypeData%BladeRootOrientation,3) + i3_u = UBOUND(SrcRotInitInputTypeData%BladeRootOrientation,3) + IF (.NOT. ALLOCATED(DstRotInitInputTypeData%BladeRootOrientation)) THEN + ALLOCATE(DstRotInitInputTypeData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitInputTypeData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%BladeRootOrientation = SrcInitInputData%BladeRootOrientation + DstRotInitInputTypeData%BladeRootOrientation = SrcRotInitInputTypeData%BladeRootOrientation ENDIF - DstInitInputData%UsePrimaryInputFile = SrcInitInputData%UsePrimaryInputFile - CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE AD_CopyInitInput + DstRotInitInputTypeData%NacelleOrientation = SrcRotInitInputTypeData%NacelleOrientation + END SUBROUTINE AD_CopyRotInitInputType - SUBROUTINE AD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) - TYPE(AD_InitInputType), INTENT(INOUT) :: InitInputData + SUBROUTINE AD_DestroyRotInitInputType( RotInitInputTypeData, ErrStat, ErrMsg ) + TYPE(RotInitInputType), INTENT(INOUT) :: RotInitInputTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotInitInputType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(InitInputData%BladeRootPosition)) THEN - DEALLOCATE(InitInputData%BladeRootPosition) +IF (ALLOCATED(RotInitInputTypeData%BladeRootPosition)) THEN + DEALLOCATE(RotInitInputTypeData%BladeRootPosition) ENDIF -IF (ALLOCATED(InitInputData%BladeRootOrientation)) THEN - DEALLOCATE(InitInputData%BladeRootOrientation) +IF (ALLOCATED(RotInitInputTypeData%BladeRootOrientation)) THEN + DEALLOCATE(RotInitInputTypeData%BladeRootOrientation) ENDIF - CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) - END SUBROUTINE AD_DestroyInitInput + END SUBROUTINE AD_DestroyRotInitInputType - SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotInitInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_InitInputType), INTENT(IN) :: InData + TYPE(RotInitInputType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -390,7 +445,7 @@ SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotInitInputType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -406,11 +461,7 @@ SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1*LEN(InData%InputFile) ! InputFile - Int_BufSz = Int_BufSz + 1 ! Linearize Int_BufSz = Int_BufSz + 1 ! NumBlades - Re_BufSz = Re_BufSz + 1 ! Gravity - Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName Re_BufSz = Re_BufSz + SIZE(InData%HubPosition) ! HubPosition Db_BufSz = Db_BufSz + SIZE(InData%HubOrientation) ! HubOrientation Int_BufSz = Int_BufSz + 1 ! BladeRootPosition allocated yes/no @@ -423,25 +474,7 @@ SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Int_BufSz = Int_BufSz + 2*3 ! BladeRootOrientation upper/lower bounds for each dimension Db_BufSz = Db_BufSz + SIZE(InData%BladeRootOrientation) ! BladeRootOrientation END IF - Int_BufSz = Int_BufSz + 1 ! UsePrimaryInputFile - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! PassedPrimaryInputData: size of buffers for each call to pack subtype - CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, .TRUE. ) ! PassedPrimaryInputData - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! PassedPrimaryInputData - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! PassedPrimaryInputData - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! PassedPrimaryInputData - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF + Db_BufSz = Db_BufSz + SIZE(InData%NacelleOrientation) ! NacelleOrientation IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -469,20 +502,8 @@ SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Db_Xferred = 1 Int_Xferred = 1 - DO I = 1, LEN(InData%InputFile) - IntKiBuf(Int_Xferred) = ICHAR(InData%InputFile(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = TRANSFER(InData%Linearize, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumBlades Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Gravity - Re_Xferred = Re_Xferred + 1 - DO I = 1, LEN(InData%RootName) - IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I DO i1 = LBOUND(InData%HubPosition,1), UBOUND(InData%HubPosition,1) ReKiBuf(Re_Xferred) = InData%HubPosition(i1) Re_Xferred = Re_Xferred + 1 @@ -538,43 +559,19 @@ SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg END DO END DO END IF - IntKiBuf(Int_Xferred) = TRANSFER(InData%UsePrimaryInputFile, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, OnlySize ) ! PassedPrimaryInputData - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE AD_PackInitInput + DO i2 = LBOUND(InData%NacelleOrientation,2), UBOUND(InData%NacelleOrientation,2) + DO i1 = LBOUND(InData%NacelleOrientation,1), UBOUND(InData%NacelleOrientation,1) + DbKiBuf(Db_Xferred) = InData%NacelleOrientation(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END SUBROUTINE AD_PackRotInitInputType - SUBROUTINE AD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackRotInitInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_InitInputType), INTENT(INOUT) :: OutData + TYPE(RotInitInputType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -589,7 +586,7 @@ SUBROUTINE AD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotInitInputType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -600,20 +597,8 @@ SUBROUTINE AD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - DO I = 1, LEN(OutData%InputFile) - OutData%InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%Linearize = TRANSFER(IntKiBuf(Int_Xferred), OutData%Linearize) - Int_Xferred = Int_Xferred + 1 OutData%NumBlades = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - OutData%Gravity = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - DO I = 1, LEN(OutData%RootName) - OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I i1_l = LBOUND(OutData%HubPosition,1) i1_u = UBOUND(OutData%HubPosition,1) DO i1 = LBOUND(OutData%HubPosition,1), UBOUND(OutData%HubPosition,1) @@ -681,53 +666,21 @@ SUBROUTINE AD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err END DO END DO END IF - OutData%UsePrimaryInputFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%UsePrimaryInputFile) - Int_Xferred = Int_Xferred + 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackfileinfotype( Re_Buf, Db_Buf, Int_Buf, OutData%PassedPrimaryInputData, ErrStat2, ErrMsg2 ) ! PassedPrimaryInputData - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE AD_UnPackInitInput + i1_l = LBOUND(OutData%NacelleOrientation,1) + i1_u = UBOUND(OutData%NacelleOrientation,1) + i2_l = LBOUND(OutData%NacelleOrientation,2) + i2_u = UBOUND(OutData%NacelleOrientation,2) + DO i2 = LBOUND(OutData%NacelleOrientation,2), UBOUND(OutData%NacelleOrientation,2) + DO i1 = LBOUND(OutData%NacelleOrientation,1), UBOUND(OutData%NacelleOrientation,1) + OutData%NacelleOrientation(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END SUBROUTINE AD_UnPackRotInitInputType - SUBROUTINE AD_CopyBladePropsType( SrcBladePropsTypeData, DstBladePropsTypeData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_BladePropsType), INTENT(IN) :: SrcBladePropsTypeData - TYPE(AD_BladePropsType), INTENT(INOUT) :: DstBladePropsTypeData + SUBROUTINE AD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(AD_InitInputType), INTENT(INOUT) :: DstInitInputData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -736,134 +689,59 @@ SUBROUTINE AD_CopyBladePropsType( SrcBladePropsTypeData, DstBladePropsTypeData, INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyBladePropsType' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInitInput' ! ErrStat = ErrID_None ErrMsg = "" - DstBladePropsTypeData%NumBlNds = SrcBladePropsTypeData%NumBlNds -IF (ALLOCATED(SrcBladePropsTypeData%BlSpn)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlSpn,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlSpn,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlSpn)) THEN - ALLOCATE(DstBladePropsTypeData%BlSpn(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlSpn.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlSpn = SrcBladePropsTypeData%BlSpn -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlCrvAC)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlCrvAC,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlCrvAC,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlCrvAC)) THEN - ALLOCATE(DstBladePropsTypeData%BlCrvAC(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlCrvAC.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlCrvAC = SrcBladePropsTypeData%BlCrvAC -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlSwpAC)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlSwpAC,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlSwpAC,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlSwpAC)) THEN - ALLOCATE(DstBladePropsTypeData%BlSwpAC(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlSwpAC.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlSwpAC = SrcBladePropsTypeData%BlSwpAC -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlCrvAng)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlCrvAng,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlCrvAng,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlCrvAng)) THEN - ALLOCATE(DstBladePropsTypeData%BlCrvAng(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlCrvAng.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlCrvAng = SrcBladePropsTypeData%BlCrvAng -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlTwist)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlTwist,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlTwist,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlTwist)) THEN - ALLOCATE(DstBladePropsTypeData%BlTwist(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlTwist.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlTwist = SrcBladePropsTypeData%BlTwist -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlChord)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlChord,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlChord,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlChord)) THEN - ALLOCATE(DstBladePropsTypeData%BlChord(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlChord.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstBladePropsTypeData%BlChord = SrcBladePropsTypeData%BlChord -ENDIF -IF (ALLOCATED(SrcBladePropsTypeData%BlAFID)) THEN - i1_l = LBOUND(SrcBladePropsTypeData%BlAFID,1) - i1_u = UBOUND(SrcBladePropsTypeData%BlAFID,1) - IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlAFID)) THEN - ALLOCATE(DstBladePropsTypeData%BlAFID(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInitInputData%rotors)) THEN + i1_l = LBOUND(SrcInitInputData%rotors,1) + i1_u = UBOUND(SrcInitInputData%rotors,1) + IF (.NOT. ALLOCATED(DstInitInputData%rotors)) THEN + ALLOCATE(DstInitInputData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlAFID.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstBladePropsTypeData%BlAFID = SrcBladePropsTypeData%BlAFID + DO i1 = LBOUND(SrcInitInputData%rotors,1), UBOUND(SrcInitInputData%rotors,1) + CALL AD_Copyrotinitinputtype( SrcInitInputData%rotors(i1), DstInitInputData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF - END SUBROUTINE AD_CopyBladePropsType + DstInitInputData%InputFile = SrcInitInputData%InputFile + DstInitInputData%RootName = SrcInitInputData%RootName + DstInitInputData%UsePrimaryInputFile = SrcInitInputData%UsePrimaryInputFile + CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstInitInputData%Linearize = SrcInitInputData%Linearize + DstInitInputData%Gravity = SrcInitInputData%Gravity + END SUBROUTINE AD_CopyInitInput - SUBROUTINE AD_DestroyBladePropsType( BladePropsTypeData, ErrStat, ErrMsg ) - TYPE(AD_BladePropsType), INTENT(INOUT) :: BladePropsTypeData + SUBROUTINE AD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(AD_InitInputType), INTENT(INOUT) :: InitInputData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyBladePropsType' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInitInput' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(BladePropsTypeData%BlSpn)) THEN - DEALLOCATE(BladePropsTypeData%BlSpn) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlCrvAC)) THEN - DEALLOCATE(BladePropsTypeData%BlCrvAC) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlSwpAC)) THEN - DEALLOCATE(BladePropsTypeData%BlSwpAC) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlCrvAng)) THEN - DEALLOCATE(BladePropsTypeData%BlCrvAng) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlTwist)) THEN - DEALLOCATE(BladePropsTypeData%BlTwist) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlChord)) THEN - DEALLOCATE(BladePropsTypeData%BlChord) -ENDIF -IF (ALLOCATED(BladePropsTypeData%BlAFID)) THEN - DEALLOCATE(BladePropsTypeData%BlAFID) +IF (ALLOCATED(InitInputData%rotors)) THEN +DO i1 = LBOUND(InitInputData%rotors,1), UBOUND(InitInputData%rotors,1) + CALL AD_Destroyrotinitinputtype( InitInputData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InitInputData%rotors) ENDIF - END SUBROUTINE AD_DestroyBladePropsType + CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyInitInput - SUBROUTINE AD_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_BladePropsType), INTENT(IN) :: InData + TYPE(AD_InitInputType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -878,7 +756,7 @@ SUBROUTINE AD_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, E LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackBladePropsType' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInitInput' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -894,42 +772,52 @@ SUBROUTINE AD_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, E Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! NumBlNds - Int_BufSz = Int_BufSz + 1 ! BlSpn allocated yes/no - IF ( ALLOCATED(InData%BlSpn) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlSpn upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlSpn) ! BlSpn - END IF - Int_BufSz = Int_BufSz + 1 ! BlCrvAC allocated yes/no - IF ( ALLOCATED(InData%BlCrvAC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlCrvAC upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlCrvAC) ! BlCrvAC - END IF - Int_BufSz = Int_BufSz + 1 ! BlSwpAC allocated yes/no - IF ( ALLOCATED(InData%BlSwpAC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlSwpAC upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlSwpAC) ! BlSwpAC - END IF - Int_BufSz = Int_BufSz + 1 ! BlCrvAng allocated yes/no - IF ( ALLOCATED(InData%BlCrvAng) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlCrvAng upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlCrvAng) ! BlCrvAng - END IF - Int_BufSz = Int_BufSz + 1 ! BlTwist allocated yes/no - IF ( ALLOCATED(InData%BlTwist) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlTwist upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlTwist) ! BlTwist - END IF - Int_BufSz = Int_BufSz + 1 ! BlChord allocated yes/no - IF ( ALLOCATED(InData%BlChord) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlChord upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BlChord) ! BlChord - END IF - Int_BufSz = Int_BufSz + 1 ! BlAFID allocated yes/no - IF ( ALLOCATED(InData%BlAFID) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BlAFID upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%BlAFID) ! BlAFID + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotinitinputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO END IF + Int_BufSz = Int_BufSz + 1*LEN(InData%InputFile) ! InputFile + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Int_BufSz = Int_BufSz + 1 ! UsePrimaryInputFile + Int_BufSz = Int_BufSz + 3 ! PassedPrimaryInputData: size of buffers for each call to pack subtype + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, .TRUE. ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! PassedPrimaryInputData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! PassedPrimaryInputData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! PassedPrimaryInputData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! Linearize + Re_BufSz = Re_BufSz + 1 ! Gravity IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -957,120 +845,96 @@ SUBROUTINE AD_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, E Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = InData%NumBlNds - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BlSpn) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlSpn,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlSpn,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BlSpn,1), UBOUND(InData%BlSpn,1) - ReKiBuf(Re_Xferred) = InData%BlSpn(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlCrvAC) ) THEN + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlCrvAC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlCrvAC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BlCrvAC,1), UBOUND(InData%BlCrvAC,1) - ReKiBuf(Re_Xferred) = InData%BlCrvAC(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlSwpAC) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlSwpAC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlSwpAC,1) - Int_Xferred = Int_Xferred + 2 + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotinitinputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - DO i1 = LBOUND(InData%BlSwpAC,1), UBOUND(InData%BlSwpAC,1) - ReKiBuf(Re_Xferred) = InData%BlSwpAC(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlCrvAng) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlCrvAng,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlCrvAng,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BlCrvAng,1), UBOUND(InData%BlCrvAng,1) - ReKiBuf(Re_Xferred) = InData%BlCrvAng(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlTwist) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlTwist,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlTwist,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BlTwist,1), UBOUND(InData%BlTwist,1) - ReKiBuf(Re_Xferred) = InData%BlTwist(i1) - Re_Xferred = Re_Xferred + 1 - END DO + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - IF ( .NOT. ALLOCATED(InData%BlChord) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + DO I = 1, LEN(InData%InputFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%InputFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = TRANSFER(InData%UsePrimaryInputFile, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlChord,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlChord,1) - Int_Xferred = Int_Xferred + 2 + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, OnlySize ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - DO i1 = LBOUND(InData%BlChord,1), UBOUND(InData%BlChord,1) - ReKiBuf(Re_Xferred) = InData%BlChord(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlAFID) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%Linearize, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlAFID,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlAFID,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BlAFID,1), UBOUND(InData%BlAFID,1) - IntKiBuf(Int_Xferred) = InData%BlAFID(i1) - Int_Xferred = Int_Xferred + 1 - END DO - END IF - END SUBROUTINE AD_PackBladePropsType + ReKiBuf(Re_Xferred) = InData%Gravity + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE AD_PackInitInput - SUBROUTINE AD_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_BladePropsType), INTENT(INOUT) :: OutData + TYPE(AD_InitInputType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -1082,7 +946,7 @@ SUBROUTINE AD_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackBladePropsType' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInitInput' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1093,190 +957,257 @@ SUBROUTINE AD_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%NumBlNds = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlSpn not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlSpn)) DEALLOCATE(OutData%BlSpn) - ALLOCATE(OutData%BlSpn(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlSpn.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BlSpn,1), UBOUND(OutData%BlSpn,1) - OutData%BlSpn(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlCrvAC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlCrvAC)) DEALLOCATE(OutData%BlCrvAC) - ALLOCATE(OutData%BlCrvAC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlCrvAC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BlCrvAC,1), UBOUND(OutData%BlCrvAC,1) - OutData%BlCrvAC(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackrotinitinputtype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlSwpAC not allocated + DO I = 1, LEN(OutData%InputFile) + OutData%InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%UsePrimaryInputFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%UsePrimaryInputFile) Int_Xferred = Int_Xferred + 1 - ELSE + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackfileinfotype( Re_Buf, Db_Buf, Int_Buf, OutData%PassedPrimaryInputData, ErrStat2, ErrMsg2 ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%Linearize = TRANSFER(IntKiBuf(Int_Xferred), OutData%Linearize) Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlSwpAC)) DEALLOCATE(OutData%BlSwpAC) - ALLOCATE(OutData%BlSwpAC(i1_l:i1_u),STAT=ErrStat2) + OutData%Gravity = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE AD_UnPackInitInput + + SUBROUTINE AD_CopyBladePropsType( SrcBladePropsTypeData, DstBladePropsTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_BladePropsType), INTENT(IN) :: SrcBladePropsTypeData + TYPE(AD_BladePropsType), INTENT(INOUT) :: DstBladePropsTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyBladePropsType' +! + ErrStat = ErrID_None + ErrMsg = "" + DstBladePropsTypeData%NumBlNds = SrcBladePropsTypeData%NumBlNds +IF (ALLOCATED(SrcBladePropsTypeData%BlSpn)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlSpn,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlSpn,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlSpn)) THEN + ALLOCATE(DstBladePropsTypeData%BlSpn(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlSwpAC.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlSpn.', ErrStat, ErrMsg,RoutineName) + RETURN END IF - DO i1 = LBOUND(OutData%BlSwpAC,1), UBOUND(OutData%BlSwpAC,1) - OutData%BlSwpAC(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlCrvAng not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlCrvAng)) DEALLOCATE(OutData%BlCrvAng) - ALLOCATE(OutData%BlCrvAng(i1_l:i1_u),STAT=ErrStat2) + DstBladePropsTypeData%BlSpn = SrcBladePropsTypeData%BlSpn +ENDIF +IF (ALLOCATED(SrcBladePropsTypeData%BlCrvAC)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlCrvAC,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlCrvAC,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlCrvAC)) THEN + ALLOCATE(DstBladePropsTypeData%BlCrvAC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlCrvAng.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlCrvAC.', ErrStat, ErrMsg,RoutineName) + RETURN END IF - DO i1 = LBOUND(OutData%BlCrvAng,1), UBOUND(OutData%BlCrvAng,1) - OutData%BlCrvAng(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlTwist not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlTwist)) DEALLOCATE(OutData%BlTwist) - ALLOCATE(OutData%BlTwist(i1_l:i1_u),STAT=ErrStat2) + DstBladePropsTypeData%BlCrvAC = SrcBladePropsTypeData%BlCrvAC +ENDIF +IF (ALLOCATED(SrcBladePropsTypeData%BlSwpAC)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlSwpAC,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlSwpAC,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlSwpAC)) THEN + ALLOCATE(DstBladePropsTypeData%BlSwpAC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlTwist.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlSwpAC.', ErrStat, ErrMsg,RoutineName) + RETURN END IF - DO i1 = LBOUND(OutData%BlTwist,1), UBOUND(OutData%BlTwist,1) - OutData%BlTwist(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlChord not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlChord)) DEALLOCATE(OutData%BlChord) - ALLOCATE(OutData%BlChord(i1_l:i1_u),STAT=ErrStat2) + DstBladePropsTypeData%BlSwpAC = SrcBladePropsTypeData%BlSwpAC +ENDIF +IF (ALLOCATED(SrcBladePropsTypeData%BlCrvAng)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlCrvAng,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlCrvAng,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlCrvAng)) THEN + ALLOCATE(DstBladePropsTypeData%BlCrvAng(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlChord.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlCrvAng.', ErrStat, ErrMsg,RoutineName) + RETURN END IF - DO i1 = LBOUND(OutData%BlChord,1), UBOUND(OutData%BlChord,1) - OutData%BlChord(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlAFID not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BlAFID)) DEALLOCATE(OutData%BlAFID) - ALLOCATE(OutData%BlAFID(i1_l:i1_u),STAT=ErrStat2) + DstBladePropsTypeData%BlCrvAng = SrcBladePropsTypeData%BlCrvAng +ENDIF +IF (ALLOCATED(SrcBladePropsTypeData%BlTwist)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlTwist,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlTwist,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlTwist)) THEN + ALLOCATE(DstBladePropsTypeData%BlTwist(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlAFID.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlTwist.', ErrStat, ErrMsg,RoutineName) + RETURN END IF - DO i1 = LBOUND(OutData%BlAFID,1), UBOUND(OutData%BlAFID,1) - OutData%BlAFID(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO END IF - END SUBROUTINE AD_UnPackBladePropsType - - SUBROUTINE AD_CopyBladeShape( SrcBladeShapeData, DstBladeShapeData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_BladeShape), INTENT(IN) :: SrcBladeShapeData - TYPE(AD_BladeShape), INTENT(INOUT) :: DstBladeShapeData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyBladeShape' -! - ErrStat = ErrID_None - ErrMsg = "" -IF (ALLOCATED(SrcBladeShapeData%AirfoilCoords)) THEN - i1_l = LBOUND(SrcBladeShapeData%AirfoilCoords,1) - i1_u = UBOUND(SrcBladeShapeData%AirfoilCoords,1) - i2_l = LBOUND(SrcBladeShapeData%AirfoilCoords,2) - i2_u = UBOUND(SrcBladeShapeData%AirfoilCoords,2) - i3_l = LBOUND(SrcBladeShapeData%AirfoilCoords,3) - i3_u = UBOUND(SrcBladeShapeData%AirfoilCoords,3) - IF (.NOT. ALLOCATED(DstBladeShapeData%AirfoilCoords)) THEN - ALLOCATE(DstBladeShapeData%AirfoilCoords(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + DstBladePropsTypeData%BlTwist = SrcBladePropsTypeData%BlTwist +ENDIF +IF (ALLOCATED(SrcBladePropsTypeData%BlChord)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlChord,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlChord,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlChord)) THEN + ALLOCATE(DstBladePropsTypeData%BlChord(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladeShapeData%AirfoilCoords.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlChord.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstBladeShapeData%AirfoilCoords = SrcBladeShapeData%AirfoilCoords + DstBladePropsTypeData%BlChord = SrcBladePropsTypeData%BlChord ENDIF - END SUBROUTINE AD_CopyBladeShape +IF (ALLOCATED(SrcBladePropsTypeData%BlAFID)) THEN + i1_l = LBOUND(SrcBladePropsTypeData%BlAFID,1) + i1_u = UBOUND(SrcBladePropsTypeData%BlAFID,1) + IF (.NOT. ALLOCATED(DstBladePropsTypeData%BlAFID)) THEN + ALLOCATE(DstBladePropsTypeData%BlAFID(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladePropsTypeData%BlAFID.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladePropsTypeData%BlAFID = SrcBladePropsTypeData%BlAFID +ENDIF + END SUBROUTINE AD_CopyBladePropsType - SUBROUTINE AD_DestroyBladeShape( BladeShapeData, ErrStat, ErrMsg ) - TYPE(AD_BladeShape), INTENT(INOUT) :: BladeShapeData + SUBROUTINE AD_DestroyBladePropsType( BladePropsTypeData, ErrStat, ErrMsg ) + TYPE(AD_BladePropsType), INTENT(INOUT) :: BladePropsTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyBladeShape' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyBladePropsType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(BladeShapeData%AirfoilCoords)) THEN - DEALLOCATE(BladeShapeData%AirfoilCoords) +IF (ALLOCATED(BladePropsTypeData%BlSpn)) THEN + DEALLOCATE(BladePropsTypeData%BlSpn) ENDIF - END SUBROUTINE AD_DestroyBladeShape +IF (ALLOCATED(BladePropsTypeData%BlCrvAC)) THEN + DEALLOCATE(BladePropsTypeData%BlCrvAC) +ENDIF +IF (ALLOCATED(BladePropsTypeData%BlSwpAC)) THEN + DEALLOCATE(BladePropsTypeData%BlSwpAC) +ENDIF +IF (ALLOCATED(BladePropsTypeData%BlCrvAng)) THEN + DEALLOCATE(BladePropsTypeData%BlCrvAng) +ENDIF +IF (ALLOCATED(BladePropsTypeData%BlTwist)) THEN + DEALLOCATE(BladePropsTypeData%BlTwist) +ENDIF +IF (ALLOCATED(BladePropsTypeData%BlChord)) THEN + DEALLOCATE(BladePropsTypeData%BlChord) +ENDIF +IF (ALLOCATED(BladePropsTypeData%BlAFID)) THEN + DEALLOCATE(BladePropsTypeData%BlAFID) +ENDIF + END SUBROUTINE AD_DestroyBladePropsType - SUBROUTINE AD_PackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_BladeShape), INTENT(IN) :: InData + TYPE(AD_BladePropsType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -1291,7 +1222,7 @@ SUBROUTINE AD_PackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackBladeShape' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackBladePropsType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1307,70 +1238,183 @@ SUBROUTINE AD_PackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! AirfoilCoords allocated yes/no - IF ( ALLOCATED(InData%AirfoilCoords) ) THEN - Int_BufSz = Int_BufSz + 2*3 ! AirfoilCoords upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%AirfoilCoords) ! AirfoilCoords - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF + Int_BufSz = Int_BufSz + 1 ! NumBlNds + Int_BufSz = Int_BufSz + 1 ! BlSpn allocated yes/no + IF ( ALLOCATED(InData%BlSpn) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlSpn upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlSpn) ! BlSpn END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF + Int_BufSz = Int_BufSz + 1 ! BlCrvAC allocated yes/no + IF ( ALLOCATED(InData%BlCrvAC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlCrvAC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlCrvAC) ! BlCrvAC END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF + Int_BufSz = Int_BufSz + 1 ! BlSwpAC allocated yes/no + IF ( ALLOCATED(InData%BlSwpAC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlSwpAC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlSwpAC) ! BlSwpAC END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - + Int_BufSz = Int_BufSz + 1 ! BlCrvAng allocated yes/no + IF ( ALLOCATED(InData%BlCrvAng) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlCrvAng upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlCrvAng) ! BlCrvAng + END IF + Int_BufSz = Int_BufSz + 1 ! BlTwist allocated yes/no + IF ( ALLOCATED(InData%BlTwist) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlTwist upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlTwist) ! BlTwist + END IF + Int_BufSz = Int_BufSz + 1 ! BlChord allocated yes/no + IF ( ALLOCATED(InData%BlChord) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlChord upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BlChord) ! BlChord + END IF + Int_BufSz = Int_BufSz + 1 ! BlAFID allocated yes/no + IF ( ALLOCATED(InData%BlAFID) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BlAFID upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%BlAFID) ! BlAFID + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - IF ( .NOT. ALLOCATED(InData%AirfoilCoords) ) THEN + IntKiBuf(Int_Xferred) = InData%NumBlNds + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BlSpn) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlSpn,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlSpn,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,2) + + DO i1 = LBOUND(InData%BlSpn,1), UBOUND(InData%BlSpn,1) + ReKiBuf(Re_Xferred) = InData%BlSpn(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlCrvAC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlCrvAC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlCrvAC,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,3) + + DO i1 = LBOUND(InData%BlCrvAC,1), UBOUND(InData%BlCrvAC,1) + ReKiBuf(Re_Xferred) = InData%BlCrvAC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlSwpAC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlSwpAC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlSwpAC,1) Int_Xferred = Int_Xferred + 2 - DO i3 = LBOUND(InData%AirfoilCoords,3), UBOUND(InData%AirfoilCoords,3) - DO i2 = LBOUND(InData%AirfoilCoords,2), UBOUND(InData%AirfoilCoords,2) - DO i1 = LBOUND(InData%AirfoilCoords,1), UBOUND(InData%AirfoilCoords,1) - ReKiBuf(Re_Xferred) = InData%AirfoilCoords(i1,i2,i3) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i1 = LBOUND(InData%BlSwpAC,1), UBOUND(InData%BlSwpAC,1) + ReKiBuf(Re_Xferred) = InData%BlSwpAC(i1) + Re_Xferred = Re_Xferred + 1 END DO END IF - END SUBROUTINE AD_PackBladeShape + IF ( .NOT. ALLOCATED(InData%BlCrvAng) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlCrvAng,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlCrvAng,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE AD_UnPackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + DO i1 = LBOUND(InData%BlCrvAng,1), UBOUND(InData%BlCrvAng,1) + ReKiBuf(Re_Xferred) = InData%BlCrvAng(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlTwist) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlTwist,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlTwist,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BlTwist,1), UBOUND(InData%BlTwist,1) + ReKiBuf(Re_Xferred) = InData%BlTwist(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlChord) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlChord,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlChord,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BlChord,1), UBOUND(InData%BlChord,1) + ReKiBuf(Re_Xferred) = InData%BlChord(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlAFID) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlAFID,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlAFID,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BlAFID,1), UBOUND(InData%BlAFID,1) + IntKiBuf(Int_Xferred) = InData%BlAFID(i1) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + END SUBROUTINE AD_PackBladePropsType + + SUBROUTINE AD_UnPackBladePropsType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_BladeShape), INTENT(INOUT) :: OutData + TYPE(AD_BladePropsType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -1380,11 +1424,9 @@ SUBROUTINE AD_UnPackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackBladeShape' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackBladePropsType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1395,298 +1437,190 @@ SUBROUTINE AD_UnPackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AirfoilCoords not allocated + OutData%NumBlNds = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlSpn not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i3_l = IntKiBuf( Int_Xferred ) - i3_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AirfoilCoords)) DEALLOCATE(OutData%AirfoilCoords) - ALLOCATE(OutData%AirfoilCoords(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BlSpn)) DEALLOCATE(OutData%BlSpn) + ALLOCATE(OutData%BlSpn(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AirfoilCoords.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlSpn.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i3 = LBOUND(OutData%AirfoilCoords,3), UBOUND(OutData%AirfoilCoords,3) - DO i2 = LBOUND(OutData%AirfoilCoords,2), UBOUND(OutData%AirfoilCoords,2) - DO i1 = LBOUND(OutData%AirfoilCoords,1), UBOUND(OutData%AirfoilCoords,1) - OutData%AirfoilCoords(i1,i2,i3) = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i1 = LBOUND(OutData%BlSpn,1), UBOUND(OutData%BlSpn,1) + OutData%BlSpn(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 END DO END IF - END SUBROUTINE AD_UnPackBladeShape - - SUBROUTINE AD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_InitOutputType), INTENT(IN) :: SrcInitOutputData - TYPE(AD_InitOutputType), INTENT(INOUT) :: DstInitOutputData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInitOutput' -! - ErrStat = ErrID_None - ErrMsg = "" -IF (ALLOCATED(SrcInitOutputData%WriteOutputHdr)) THEN - i1_l = LBOUND(SrcInitOutputData%WriteOutputHdr,1) - i1_u = UBOUND(SrcInitOutputData%WriteOutputHdr,1) - IF (.NOT. ALLOCATED(DstInitOutputData%WriteOutputHdr)) THEN - ALLOCATE(DstInitOutputData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlCrvAC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlCrvAC)) DEALLOCATE(OutData%BlCrvAC) + ALLOCATE(OutData%BlCrvAC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlCrvAC.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlCrvAC,1), UBOUND(OutData%BlCrvAC,1) + OutData%BlCrvAC(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInitOutputData%WriteOutputHdr = SrcInitOutputData%WriteOutputHdr -ENDIF -IF (ALLOCATED(SrcInitOutputData%WriteOutputUnt)) THEN - i1_l = LBOUND(SrcInitOutputData%WriteOutputUnt,1) - i1_u = UBOUND(SrcInitOutputData%WriteOutputUnt,1) - IF (.NOT. ALLOCATED(DstInitOutputData%WriteOutputUnt)) THEN - ALLOCATE(DstInitOutputData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlSwpAC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlSwpAC)) DEALLOCATE(OutData%BlSwpAC) + ALLOCATE(OutData%BlSwpAC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlSwpAC.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlSwpAC,1), UBOUND(OutData%BlSwpAC,1) + OutData%BlSwpAC(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInitOutputData%WriteOutputUnt = SrcInitOutputData%WriteOutputUnt -ENDIF - CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - DstInitOutputData%AirDens = SrcInitOutputData%AirDens -IF (ALLOCATED(SrcInitOutputData%BladeShape)) THEN - i1_l = LBOUND(SrcInitOutputData%BladeShape,1) - i1_u = UBOUND(SrcInitOutputData%BladeShape,1) - IF (.NOT. ALLOCATED(DstInitOutputData%BladeShape)) THEN - ALLOCATE(DstInitOutputData%BladeShape(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%BladeShape.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DO i1 = LBOUND(SrcInitOutputData%BladeShape,1), UBOUND(SrcInitOutputData%BladeShape,1) - CALL AD_Copybladeshape( SrcInitOutputData%BladeShape(i1), DstInitOutputData%BladeShape(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcInitOutputData%LinNames_y)) THEN - i1_l = LBOUND(SrcInitOutputData%LinNames_y,1) - i1_u = UBOUND(SrcInitOutputData%LinNames_y,1) - IF (.NOT. ALLOCATED(DstInitOutputData%LinNames_y)) THEN - ALLOCATE(DstInitOutputData%LinNames_y(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%LinNames_y.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%LinNames_y = SrcInitOutputData%LinNames_y -ENDIF -IF (ALLOCATED(SrcInitOutputData%LinNames_x)) THEN - i1_l = LBOUND(SrcInitOutputData%LinNames_x,1) - i1_u = UBOUND(SrcInitOutputData%LinNames_x,1) - IF (.NOT. ALLOCATED(DstInitOutputData%LinNames_x)) THEN - ALLOCATE(DstInitOutputData%LinNames_x(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%LinNames_x.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%LinNames_x = SrcInitOutputData%LinNames_x -ENDIF -IF (ALLOCATED(SrcInitOutputData%LinNames_u)) THEN - i1_l = LBOUND(SrcInitOutputData%LinNames_u,1) - i1_u = UBOUND(SrcInitOutputData%LinNames_u,1) - IF (.NOT. ALLOCATED(DstInitOutputData%LinNames_u)) THEN - ALLOCATE(DstInitOutputData%LinNames_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%LinNames_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%LinNames_u = SrcInitOutputData%LinNames_u -ENDIF -IF (ALLOCATED(SrcInitOutputData%RotFrame_y)) THEN - i1_l = LBOUND(SrcInitOutputData%RotFrame_y,1) - i1_u = UBOUND(SrcInitOutputData%RotFrame_y,1) - IF (.NOT. ALLOCATED(DstInitOutputData%RotFrame_y)) THEN - ALLOCATE(DstInitOutputData%RotFrame_y(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%RotFrame_y.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%RotFrame_y = SrcInitOutputData%RotFrame_y -ENDIF -IF (ALLOCATED(SrcInitOutputData%RotFrame_x)) THEN - i1_l = LBOUND(SrcInitOutputData%RotFrame_x,1) - i1_u = UBOUND(SrcInitOutputData%RotFrame_x,1) - IF (.NOT. ALLOCATED(DstInitOutputData%RotFrame_x)) THEN - ALLOCATE(DstInitOutputData%RotFrame_x(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%RotFrame_x.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%RotFrame_x = SrcInitOutputData%RotFrame_x -ENDIF -IF (ALLOCATED(SrcInitOutputData%RotFrame_u)) THEN - i1_l = LBOUND(SrcInitOutputData%RotFrame_u,1) - i1_u = UBOUND(SrcInitOutputData%RotFrame_u,1) - IF (.NOT. ALLOCATED(DstInitOutputData%RotFrame_u)) THEN - ALLOCATE(DstInitOutputData%RotFrame_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%RotFrame_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInitOutputData%RotFrame_u = SrcInitOutputData%RotFrame_u -ENDIF -IF (ALLOCATED(SrcInitOutputData%IsLoad_u)) THEN - i1_l = LBOUND(SrcInitOutputData%IsLoad_u,1) - i1_u = UBOUND(SrcInitOutputData%IsLoad_u,1) - IF (.NOT. ALLOCATED(DstInitOutputData%IsLoad_u)) THEN - ALLOCATE(DstInitOutputData%IsLoad_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%IsLoad_u.', ErrStat, ErrMsg,RoutineName) - RETURN + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlCrvAng not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlCrvAng)) DEALLOCATE(OutData%BlCrvAng) + ALLOCATE(OutData%BlCrvAng(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlCrvAng.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlCrvAng,1), UBOUND(OutData%BlCrvAng,1) + OutData%BlCrvAng(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInitOutputData%IsLoad_u = SrcInitOutputData%IsLoad_u -ENDIF -IF (ALLOCATED(SrcInitOutputData%BladeProps)) THEN - i1_l = LBOUND(SrcInitOutputData%BladeProps,1) - i1_u = UBOUND(SrcInitOutputData%BladeProps,1) - IF (.NOT. ALLOCATED(DstInitOutputData%BladeProps)) THEN - ALLOCATE(DstInitOutputData%BladeProps(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlTwist not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlTwist)) DEALLOCATE(OutData%BlTwist) + ALLOCATE(OutData%BlTwist(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%BladeProps.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlTwist.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlTwist,1), UBOUND(OutData%BlTwist,1) + OutData%BlTwist(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DO i1 = LBOUND(SrcInitOutputData%BladeProps,1), UBOUND(SrcInitOutputData%BladeProps,1) - CALL AD_Copybladepropstype( SrcInitOutputData%BladeProps(i1), DstInitOutputData%BladeProps(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcInitOutputData%DerivOrder_x)) THEN - i1_l = LBOUND(SrcInitOutputData%DerivOrder_x,1) - i1_u = UBOUND(SrcInitOutputData%DerivOrder_x,1) - IF (.NOT. ALLOCATED(DstInitOutputData%DerivOrder_x)) THEN - ALLOCATE(DstInitOutputData%DerivOrder_x(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlChord not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlChord)) DEALLOCATE(OutData%BlChord) + ALLOCATE(OutData%BlChord(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%DerivOrder_x.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlChord.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlChord,1), UBOUND(OutData%BlChord,1) + OutData%BlChord(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInitOutputData%DerivOrder_x = SrcInitOutputData%DerivOrder_x -ENDIF -IF (ALLOCATED(SrcInitOutputData%TwrElev)) THEN - i1_l = LBOUND(SrcInitOutputData%TwrElev,1) - i1_u = UBOUND(SrcInitOutputData%TwrElev,1) - IF (.NOT. ALLOCATED(DstInitOutputData%TwrElev)) THEN - ALLOCATE(DstInitOutputData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BlAFID not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BlAFID)) DEALLOCATE(OutData%BlAFID) + ALLOCATE(OutData%BlAFID(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%TwrElev.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BlAFID.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BlAFID,1), UBOUND(OutData%BlAFID,1) + OutData%BlAFID(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DstInitOutputData%TwrElev = SrcInitOutputData%TwrElev -ENDIF -IF (ALLOCATED(SrcInitOutputData%TwrDiam)) THEN - i1_l = LBOUND(SrcInitOutputData%TwrDiam,1) - i1_u = UBOUND(SrcInitOutputData%TwrDiam,1) - IF (.NOT. ALLOCATED(DstInitOutputData%TwrDiam)) THEN - ALLOCATE(DstInitOutputData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + END SUBROUTINE AD_UnPackBladePropsType + + SUBROUTINE AD_CopyBladeShape( SrcBladeShapeData, DstBladeShapeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_BladeShape), INTENT(IN) :: SrcBladeShapeData + TYPE(AD_BladeShape), INTENT(INOUT) :: DstBladeShapeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyBladeShape' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcBladeShapeData%AirfoilCoords)) THEN + i1_l = LBOUND(SrcBladeShapeData%AirfoilCoords,1) + i1_u = UBOUND(SrcBladeShapeData%AirfoilCoords,1) + i2_l = LBOUND(SrcBladeShapeData%AirfoilCoords,2) + i2_u = UBOUND(SrcBladeShapeData%AirfoilCoords,2) + i3_l = LBOUND(SrcBladeShapeData%AirfoilCoords,3) + i3_u = UBOUND(SrcBladeShapeData%AirfoilCoords,3) + IF (.NOT. ALLOCATED(DstBladeShapeData%AirfoilCoords)) THEN + ALLOCATE(DstBladeShapeData%AirfoilCoords(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladeShapeData%AirfoilCoords.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitOutputData%TwrDiam = SrcInitOutputData%TwrDiam + DstBladeShapeData%AirfoilCoords = SrcBladeShapeData%AirfoilCoords ENDIF - END SUBROUTINE AD_CopyInitOutput + END SUBROUTINE AD_CopyBladeShape - SUBROUTINE AD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) - TYPE(AD_InitOutputType), INTENT(INOUT) :: InitOutputData + SUBROUTINE AD_DestroyBladeShape( BladeShapeData, ErrStat, ErrMsg ) + TYPE(AD_BladeShape), INTENT(INOUT) :: BladeShapeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyBladeShape' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(InitOutputData%WriteOutputHdr)) THEN - DEALLOCATE(InitOutputData%WriteOutputHdr) -ENDIF -IF (ALLOCATED(InitOutputData%WriteOutputUnt)) THEN - DEALLOCATE(InitOutputData%WriteOutputUnt) -ENDIF - CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) -IF (ALLOCATED(InitOutputData%BladeShape)) THEN -DO i1 = LBOUND(InitOutputData%BladeShape,1), UBOUND(InitOutputData%BladeShape,1) - CALL AD_Destroybladeshape( InitOutputData%BladeShape(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InitOutputData%BladeShape) -ENDIF -IF (ALLOCATED(InitOutputData%LinNames_y)) THEN - DEALLOCATE(InitOutputData%LinNames_y) -ENDIF -IF (ALLOCATED(InitOutputData%LinNames_x)) THEN - DEALLOCATE(InitOutputData%LinNames_x) -ENDIF -IF (ALLOCATED(InitOutputData%LinNames_u)) THEN - DEALLOCATE(InitOutputData%LinNames_u) -ENDIF -IF (ALLOCATED(InitOutputData%RotFrame_y)) THEN - DEALLOCATE(InitOutputData%RotFrame_y) -ENDIF -IF (ALLOCATED(InitOutputData%RotFrame_x)) THEN - DEALLOCATE(InitOutputData%RotFrame_x) -ENDIF -IF (ALLOCATED(InitOutputData%RotFrame_u)) THEN - DEALLOCATE(InitOutputData%RotFrame_u) -ENDIF -IF (ALLOCATED(InitOutputData%IsLoad_u)) THEN - DEALLOCATE(InitOutputData%IsLoad_u) -ENDIF -IF (ALLOCATED(InitOutputData%BladeProps)) THEN -DO i1 = LBOUND(InitOutputData%BladeProps,1), UBOUND(InitOutputData%BladeProps,1) - CALL AD_Destroybladepropstype( InitOutputData%BladeProps(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InitOutputData%BladeProps) -ENDIF -IF (ALLOCATED(InitOutputData%DerivOrder_x)) THEN - DEALLOCATE(InitOutputData%DerivOrder_x) -ENDIF -IF (ALLOCATED(InitOutputData%TwrElev)) THEN - DEALLOCATE(InitOutputData%TwrElev) -ENDIF -IF (ALLOCATED(InitOutputData%TwrDiam)) THEN - DEALLOCATE(InitOutputData%TwrDiam) +IF (ALLOCATED(BladeShapeData%AirfoilCoords)) THEN + DEALLOCATE(BladeShapeData%AirfoilCoords) ENDIF - END SUBROUTINE AD_DestroyInitOutput + END SUBROUTINE AD_DestroyBladeShape - SUBROUTINE AD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_InitOutputType), INTENT(IN) :: InData + TYPE(AD_BladeShape), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -1701,7 +1635,7 @@ SUBROUTINE AD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackBladeShape' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1717,151 +1651,31 @@ SUBROUTINE AD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! WriteOutputHdr allocated yes/no - IF ( ALLOCATED(InData%WriteOutputHdr) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! WriteOutputHdr upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputHdr)*LEN(InData%WriteOutputHdr) ! WriteOutputHdr - END IF - Int_BufSz = Int_BufSz + 1 ! WriteOutputUnt allocated yes/no - IF ( ALLOCATED(InData%WriteOutputUnt) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! WriteOutputUnt upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputUnt)*LEN(InData%WriteOutputUnt) ! WriteOutputUnt - END IF - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype - CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! Ver - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! Ver - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! Ver - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Re_BufSz = Re_BufSz + 1 ! AirDens - Int_BufSz = Int_BufSz + 1 ! BladeShape allocated yes/no - IF ( ALLOCATED(InData%BladeShape) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeShape upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BladeShape,1), UBOUND(InData%BladeShape,1) - Int_BufSz = Int_BufSz + 3 ! BladeShape: size of buffers for each call to pack subtype - CALL AD_Packbladeshape( Re_Buf, Db_Buf, Int_Buf, InData%BladeShape(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeShape - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BladeShape - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeShape - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeShape - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - END DO - END IF - Int_BufSz = Int_BufSz + 1 ! LinNames_y allocated yes/no - IF ( ALLOCATED(InData%LinNames_y) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! LinNames_y upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%LinNames_y)*LEN(InData%LinNames_y) ! LinNames_y - END IF - Int_BufSz = Int_BufSz + 1 ! LinNames_x allocated yes/no - IF ( ALLOCATED(InData%LinNames_x) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! LinNames_x upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%LinNames_x)*LEN(InData%LinNames_x) ! LinNames_x + Int_BufSz = Int_BufSz + 1 ! AirfoilCoords allocated yes/no + IF ( ALLOCATED(InData%AirfoilCoords) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! AirfoilCoords upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AirfoilCoords) ! AirfoilCoords END IF - Int_BufSz = Int_BufSz + 1 ! LinNames_u allocated yes/no - IF ( ALLOCATED(InData%LinNames_u) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! LinNames_u upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%LinNames_u)*LEN(InData%LinNames_u) ! LinNames_u + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - Int_BufSz = Int_BufSz + 1 ! RotFrame_y allocated yes/no - IF ( ALLOCATED(InData%RotFrame_y) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! RotFrame_y upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_y) ! RotFrame_y + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - Int_BufSz = Int_BufSz + 1 ! RotFrame_x allocated yes/no - IF ( ALLOCATED(InData%RotFrame_x) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! RotFrame_x upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_x) ! RotFrame_x - END IF - Int_BufSz = Int_BufSz + 1 ! RotFrame_u allocated yes/no - IF ( ALLOCATED(InData%RotFrame_u) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! RotFrame_u upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_u) ! RotFrame_u - END IF - Int_BufSz = Int_BufSz + 1 ! IsLoad_u allocated yes/no - IF ( ALLOCATED(InData%IsLoad_u) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! IsLoad_u upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%IsLoad_u) ! IsLoad_u - END IF - Int_BufSz = Int_BufSz + 1 ! BladeProps allocated yes/no - IF ( ALLOCATED(InData%BladeProps) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeProps upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) - Int_BufSz = Int_BufSz + 3 ! BladeProps: size of buffers for each call to pack subtype - CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeProps - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BladeProps - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeProps - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeProps - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - END DO - END IF - Int_BufSz = Int_BufSz + 1 ! DerivOrder_x allocated yes/no - IF ( ALLOCATED(InData%DerivOrder_x) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! DerivOrder_x upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%DerivOrder_x) ! DerivOrder_x - END IF - Int_BufSz = Int_BufSz + 1 ! TwrElev allocated yes/no - IF ( ALLOCATED(InData%TwrElev) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrElev upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrElev) ! TwrElev - END IF - Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no - IF ( ALLOCATED(InData%TwrDiam) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) @@ -1869,631 +1683,884 @@ SUBROUTINE AD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Db_Xferred = 1 Int_Xferred = 1 - IF ( .NOT. ALLOCATED(InData%WriteOutputHdr) ) THEN + IF ( .NOT. ALLOCATED(InData%AirfoilCoords) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputHdr,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputHdr,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,1) Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%WriteOutputHdr,1), UBOUND(InData%WriteOutputHdr,1) - DO I = 1, LEN(InData%WriteOutputHdr) - IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputHdr(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - IF ( .NOT. ALLOCATED(InData%WriteOutputUnt) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputUnt,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputUnt,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AirfoilCoords,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AirfoilCoords,3) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%WriteOutputUnt,1), UBOUND(InData%WriteOutputUnt,1) - DO I = 1, LEN(InData%WriteOutputUnt) - IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputUnt(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I + DO i3 = LBOUND(InData%AirfoilCoords,3), UBOUND(InData%AirfoilCoords,3) + DO i2 = LBOUND(InData%AirfoilCoords,2), UBOUND(InData%AirfoilCoords,2) + DO i1 = LBOUND(InData%AirfoilCoords,1), UBOUND(InData%AirfoilCoords,1) + ReKiBuf(Re_Xferred) = InData%AirfoilCoords(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO END DO END IF - CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + END SUBROUTINE AD_PackBladeShape - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - ReKiBuf(Re_Xferred) = InData%AirDens - Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BladeShape) ) THEN - IntKiBuf( Int_Xferred ) = 0 + SUBROUTINE AD_UnPackBladeShape( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_BladeShape), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackBladeShape' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AirfoilCoords not allocated Int_Xferred = Int_Xferred + 1 ELSE - IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeShape,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeShape,1) + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BladeShape,1), UBOUND(InData%BladeShape,1) - CALL AD_Packbladeshape( Re_Buf, Db_Buf, Int_Buf, InData%BladeShape(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeShape - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO - END IF - IF ( .NOT. ALLOCATED(InData%LinNames_y) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_y,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_y,1) + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%LinNames_y,1), UBOUND(InData%LinNames_y,1) - DO I = 1, LEN(InData%LinNames_y) - IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_y(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - IF ( .NOT. ALLOCATED(InData%LinNames_x) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_x,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_x,1) + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%LinNames_x,1), UBOUND(InData%LinNames_x,1) - DO I = 1, LEN(InData%LinNames_x) - IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_x(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I + IF (ALLOCATED(OutData%AirfoilCoords)) DEALLOCATE(OutData%AirfoilCoords) + ALLOCATE(OutData%AirfoilCoords(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AirfoilCoords.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%AirfoilCoords,3), UBOUND(OutData%AirfoilCoords,3) + DO i2 = LBOUND(OutData%AirfoilCoords,2), UBOUND(OutData%AirfoilCoords,2) + DO i1 = LBOUND(OutData%AirfoilCoords,1), UBOUND(OutData%AirfoilCoords,1) + OutData%AirfoilCoords(i1,i2,i3) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%LinNames_u) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_u,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_u,1) - Int_Xferred = Int_Xferred + 2 + END SUBROUTINE AD_UnPackBladeShape - DO i1 = LBOUND(InData%LinNames_u,1), UBOUND(InData%LinNames_u,1) - DO I = 1, LEN(InData%LinNames_u) - IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_u(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO + SUBROUTINE AD_CopyRotInitOutputType( SrcRotInitOutputTypeData, DstRotInitOutputTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotInitOutputType), INTENT(IN) :: SrcRotInitOutputTypeData + TYPE(RotInitOutputType), INTENT(INOUT) :: DstRotInitOutputTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotInitOutputType' +! + ErrStat = ErrID_None + ErrMsg = "" + DstRotInitOutputTypeData%AirDens = SrcRotInitOutputTypeData%AirDens +IF (ALLOCATED(SrcRotInitOutputTypeData%WriteOutputHdr)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%WriteOutputHdr,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%WriteOutputHdr,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%WriteOutputHdr)) THEN + ALLOCATE(DstRotInitOutputTypeData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%RotFrame_y) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_y,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_y,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%RotFrame_y,1), UBOUND(InData%RotFrame_y,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_y(i1), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO + DstRotInitOutputTypeData%WriteOutputHdr = SrcRotInitOutputTypeData%WriteOutputHdr +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%WriteOutputUnt)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%WriteOutputUnt,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%WriteOutputUnt,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%WriteOutputUnt)) THEN + ALLOCATE(DstRotInitOutputTypeData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%RotFrame_x) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_x,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_x,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%RotFrame_x,1), UBOUND(InData%RotFrame_x,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_x(i1), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO + DstRotInitOutputTypeData%WriteOutputUnt = SrcRotInitOutputTypeData%WriteOutputUnt +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%BladeShape)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%BladeShape,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%BladeShape,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%BladeShape)) THEN + ALLOCATE(DstRotInitOutputTypeData%BladeShape(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%BladeShape.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%RotFrame_u) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_u,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_u,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%RotFrame_u,1), UBOUND(InData%RotFrame_u,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_u(i1), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO + DO i1 = LBOUND(SrcRotInitOutputTypeData%BladeShape,1), UBOUND(SrcRotInitOutputTypeData%BladeShape,1) + CALL AD_Copybladeshape( SrcRotInitOutputTypeData%BladeShape(i1), DstRotInitOutputTypeData%BladeShape(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%LinNames_y)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%LinNames_y,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%LinNames_y,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%LinNames_y)) THEN + ALLOCATE(DstRotInitOutputTypeData%LinNames_y(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%LinNames_y.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%IsLoad_u) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%IsLoad_u,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IsLoad_u,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%IsLoad_u,1), UBOUND(InData%IsLoad_u,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%IsLoad_u(i1), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO + DstRotInitOutputTypeData%LinNames_y = SrcRotInitOutputTypeData%LinNames_y +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%LinNames_x)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%LinNames_x,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%LinNames_x,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%LinNames_x)) THEN + ALLOCATE(DstRotInitOutputTypeData%LinNames_x(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%LinNames_x.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%BladeProps) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeProps,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeProps,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) - CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeProps - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO + DstRotInitOutputTypeData%LinNames_x = SrcRotInitOutputTypeData%LinNames_x +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%LinNames_u)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%LinNames_u,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%LinNames_u,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%LinNames_u)) THEN + ALLOCATE(DstRotInitOutputTypeData%LinNames_u(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%LinNames_u.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%DerivOrder_x) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%DerivOrder_x,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DerivOrder_x,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%DerivOrder_x,1), UBOUND(InData%DerivOrder_x,1) - IntKiBuf(Int_Xferred) = InData%DerivOrder_x(i1) - Int_Xferred = Int_Xferred + 1 - END DO + DstRotInitOutputTypeData%LinNames_u = SrcRotInitOutputTypeData%LinNames_u +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%RotFrame_y)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%RotFrame_y,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%RotFrame_y,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%RotFrame_y)) THEN + ALLOCATE(DstRotInitOutputTypeData%RotFrame_y(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%RotFrame_y.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%TwrElev) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrElev,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrElev,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrElev,1), UBOUND(InData%TwrElev,1) - ReKiBuf(Re_Xferred) = InData%TwrElev(i1) - Re_Xferred = Re_Xferred + 1 - END DO + DstRotInitOutputTypeData%RotFrame_y = SrcRotInitOutputTypeData%RotFrame_y +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%RotFrame_x)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%RotFrame_x,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%RotFrame_x,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%RotFrame_x)) THEN + ALLOCATE(DstRotInitOutputTypeData%RotFrame_x(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%RotFrame_x.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) - ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) - Re_Xferred = Re_Xferred + 1 - END DO + DstRotInitOutputTypeData%RotFrame_x = SrcRotInitOutputTypeData%RotFrame_x +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%RotFrame_u)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%RotFrame_u,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%RotFrame_u,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%RotFrame_u)) THEN + ALLOCATE(DstRotInitOutputTypeData%RotFrame_u(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%RotFrame_u.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF END IF - END SUBROUTINE AD_PackInitOutput + DstRotInitOutputTypeData%RotFrame_u = SrcRotInitOutputTypeData%RotFrame_u +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%IsLoad_u)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%IsLoad_u,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%IsLoad_u,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%IsLoad_u)) THEN + ALLOCATE(DstRotInitOutputTypeData%IsLoad_u(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%IsLoad_u.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInitOutputTypeData%IsLoad_u = SrcRotInitOutputTypeData%IsLoad_u +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%BladeProps)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%BladeProps,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%BladeProps,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%BladeProps)) THEN + ALLOCATE(DstRotInitOutputTypeData%BladeProps(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%BladeProps.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcRotInitOutputTypeData%BladeProps,1), UBOUND(SrcRotInitOutputTypeData%BladeProps,1) + CALL AD_Copybladepropstype( SrcRotInitOutputTypeData%BladeProps(i1), DstRotInitOutputTypeData%BladeProps(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%DerivOrder_x)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%DerivOrder_x,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%DerivOrder_x,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%DerivOrder_x)) THEN + ALLOCATE(DstRotInitOutputTypeData%DerivOrder_x(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%DerivOrder_x.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInitOutputTypeData%DerivOrder_x = SrcRotInitOutputTypeData%DerivOrder_x +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%TwrElev)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%TwrElev,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%TwrElev,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%TwrElev)) THEN + ALLOCATE(DstRotInitOutputTypeData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%TwrElev.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInitOutputTypeData%TwrElev = SrcRotInitOutputTypeData%TwrElev +ENDIF +IF (ALLOCATED(SrcRotInitOutputTypeData%TwrDiam)) THEN + i1_l = LBOUND(SrcRotInitOutputTypeData%TwrDiam,1) + i1_u = UBOUND(SrcRotInitOutputTypeData%TwrDiam,1) + IF (.NOT. ALLOCATED(DstRotInitOutputTypeData%TwrDiam)) THEN + ALLOCATE(DstRotInitOutputTypeData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInitOutputTypeData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInitOutputTypeData%TwrDiam = SrcRotInitOutputTypeData%TwrDiam +ENDIF + END SUBROUTINE AD_CopyRotInitOutputType - SUBROUTINE AD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_InitOutputType), INTENT(INOUT) :: OutData + SUBROUTINE AD_DestroyRotInitOutputType( RotInitOutputTypeData, ErrStat, ErrMsg ) + TYPE(RotInitOutputType), INTENT(INOUT) :: RotInitOutputTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInitOutput' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotInitOutputType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! ErrStat = ErrID_None ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputHdr not allocated +IF (ALLOCATED(RotInitOutputTypeData%WriteOutputHdr)) THEN + DEALLOCATE(RotInitOutputTypeData%WriteOutputHdr) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%WriteOutputUnt)) THEN + DEALLOCATE(RotInitOutputTypeData%WriteOutputUnt) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%BladeShape)) THEN +DO i1 = LBOUND(RotInitOutputTypeData%BladeShape,1), UBOUND(RotInitOutputTypeData%BladeShape,1) + CALL AD_Destroybladeshape( RotInitOutputTypeData%BladeShape(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotInitOutputTypeData%BladeShape) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%LinNames_y)) THEN + DEALLOCATE(RotInitOutputTypeData%LinNames_y) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%LinNames_x)) THEN + DEALLOCATE(RotInitOutputTypeData%LinNames_x) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%LinNames_u)) THEN + DEALLOCATE(RotInitOutputTypeData%LinNames_u) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%RotFrame_y)) THEN + DEALLOCATE(RotInitOutputTypeData%RotFrame_y) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%RotFrame_x)) THEN + DEALLOCATE(RotInitOutputTypeData%RotFrame_x) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%RotFrame_u)) THEN + DEALLOCATE(RotInitOutputTypeData%RotFrame_u) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%IsLoad_u)) THEN + DEALLOCATE(RotInitOutputTypeData%IsLoad_u) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%BladeProps)) THEN +DO i1 = LBOUND(RotInitOutputTypeData%BladeProps,1), UBOUND(RotInitOutputTypeData%BladeProps,1) + CALL AD_Destroybladepropstype( RotInitOutputTypeData%BladeProps(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotInitOutputTypeData%BladeProps) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%DerivOrder_x)) THEN + DEALLOCATE(RotInitOutputTypeData%DerivOrder_x) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%TwrElev)) THEN + DEALLOCATE(RotInitOutputTypeData%TwrElev) +ENDIF +IF (ALLOCATED(RotInitOutputTypeData%TwrDiam)) THEN + DEALLOCATE(RotInitOutputTypeData%TwrDiam) +ENDIF + END SUBROUTINE AD_DestroyRotInitOutputType + + SUBROUTINE AD_PackRotInitOutputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(RotInitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotInitOutputType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! AirDens + Int_BufSz = Int_BufSz + 1 ! WriteOutputHdr allocated yes/no + IF ( ALLOCATED(InData%WriteOutputHdr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WriteOutputHdr upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputHdr)*LEN(InData%WriteOutputHdr) ! WriteOutputHdr + END IF + Int_BufSz = Int_BufSz + 1 ! WriteOutputUnt allocated yes/no + IF ( ALLOCATED(InData%WriteOutputUnt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WriteOutputUnt upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputUnt)*LEN(InData%WriteOutputUnt) ! WriteOutputUnt + END IF + Int_BufSz = Int_BufSz + 1 ! BladeShape allocated yes/no + IF ( ALLOCATED(InData%BladeShape) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeShape upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%BladeShape,1), UBOUND(InData%BladeShape,1) + Int_BufSz = Int_BufSz + 3 ! BladeShape: size of buffers for each call to pack subtype + CALL AD_Packbladeshape( Re_Buf, Db_Buf, Int_Buf, InData%BladeShape(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeShape + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BladeShape + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BladeShape + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BladeShape + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! LinNames_y allocated yes/no + IF ( ALLOCATED(InData%LinNames_y) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! LinNames_y upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%LinNames_y)*LEN(InData%LinNames_y) ! LinNames_y + END IF + Int_BufSz = Int_BufSz + 1 ! LinNames_x allocated yes/no + IF ( ALLOCATED(InData%LinNames_x) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! LinNames_x upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%LinNames_x)*LEN(InData%LinNames_x) ! LinNames_x + END IF + Int_BufSz = Int_BufSz + 1 ! LinNames_u allocated yes/no + IF ( ALLOCATED(InData%LinNames_u) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! LinNames_u upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%LinNames_u)*LEN(InData%LinNames_u) ! LinNames_u + END IF + Int_BufSz = Int_BufSz + 1 ! RotFrame_y allocated yes/no + IF ( ALLOCATED(InData%RotFrame_y) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! RotFrame_y upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_y) ! RotFrame_y + END IF + Int_BufSz = Int_BufSz + 1 ! RotFrame_x allocated yes/no + IF ( ALLOCATED(InData%RotFrame_x) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! RotFrame_x upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_x) ! RotFrame_x + END IF + Int_BufSz = Int_BufSz + 1 ! RotFrame_u allocated yes/no + IF ( ALLOCATED(InData%RotFrame_u) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! RotFrame_u upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%RotFrame_u) ! RotFrame_u + END IF + Int_BufSz = Int_BufSz + 1 ! IsLoad_u allocated yes/no + IF ( ALLOCATED(InData%IsLoad_u) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IsLoad_u upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%IsLoad_u) ! IsLoad_u + END IF + Int_BufSz = Int_BufSz + 1 ! BladeProps allocated yes/no + IF ( ALLOCATED(InData%BladeProps) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeProps upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) + Int_BufSz = Int_BufSz + 3 ! BladeProps: size of buffers for each call to pack subtype + CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeProps + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BladeProps + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BladeProps + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BladeProps + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! DerivOrder_x allocated yes/no + IF ( ALLOCATED(InData%DerivOrder_x) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! DerivOrder_x upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%DerivOrder_x) ! DerivOrder_x + END IF + Int_BufSz = Int_BufSz + 1 ! TwrElev allocated yes/no + IF ( ALLOCATED(InData%TwrElev) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrElev upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrElev) ! TwrElev + END IF + Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no + IF ( ALLOCATED(InData%TwrDiam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%AirDens + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%WriteOutputHdr) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputHdr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputHdr,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%WriteOutputHdr)) DEALLOCATE(OutData%WriteOutputHdr) - ALLOCATE(OutData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%WriteOutputHdr,1), UBOUND(OutData%WriteOutputHdr,1) - DO I = 1, LEN(OutData%WriteOutputHdr) - OutData%WriteOutputHdr(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + + DO i1 = LBOUND(InData%WriteOutputHdr,1), UBOUND(InData%WriteOutputHdr,1) + DO I = 1, LEN(InData%WriteOutputHdr) + IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputHdr(i1)(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputUnt not allocated + IF ( .NOT. ALLOCATED(InData%WriteOutputUnt) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputUnt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputUnt,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%WriteOutputUnt)) DEALLOCATE(OutData%WriteOutputUnt) - ALLOCATE(OutData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%WriteOutputUnt,1), UBOUND(OutData%WriteOutputUnt,1) - DO I = 1, LEN(OutData%WriteOutputUnt) - OutData%WriteOutputUnt(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + + DO i1 = LBOUND(InData%WriteOutputUnt,1), UBOUND(InData%WriteOutputUnt,1) + DO I = 1, LEN(InData%WriteOutputUnt) + IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputUnt(i1)(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I END DO END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - OutData%AirDens = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeShape not allocated + IF ( .NOT. ALLOCATED(InData%BladeShape) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeShape,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeShape,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeShape)) DEALLOCATE(OutData%BladeShape) - ALLOCATE(OutData%BladeShape(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeShape.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BladeShape,1), UBOUND(OutData%BladeShape,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL AD_Unpackbladeshape( Re_Buf, Db_Buf, Int_Buf, OutData%BladeShape(i1), ErrStat2, ErrMsg2 ) ! BladeShape + + DO i1 = LBOUND(InData%BladeShape,1), UBOUND(InData%BladeShape,1) + CALL AD_Packbladeshape( Re_Buf, Db_Buf, Int_Buf, InData%BladeShape(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeShape CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_y not allocated + IF ( .NOT. ALLOCATED(InData%LinNames_y) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_y,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_y,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%LinNames_y)) DEALLOCATE(OutData%LinNames_y) - ALLOCATE(OutData%LinNames_y(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_y.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%LinNames_y,1), UBOUND(OutData%LinNames_y,1) - DO I = 1, LEN(OutData%LinNames_y) - OutData%LinNames_y(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + + DO i1 = LBOUND(InData%LinNames_y,1), UBOUND(InData%LinNames_y,1) + DO I = 1, LEN(InData%LinNames_y) + IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_y(i1)(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_x not allocated + IF ( .NOT. ALLOCATED(InData%LinNames_x) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_x,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_x,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%LinNames_x)) DEALLOCATE(OutData%LinNames_x) - ALLOCATE(OutData%LinNames_x(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_x.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%LinNames_x,1), UBOUND(OutData%LinNames_x,1) - DO I = 1, LEN(OutData%LinNames_x) - OutData%LinNames_x(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + + DO i1 = LBOUND(InData%LinNames_x,1), UBOUND(InData%LinNames_x,1) + DO I = 1, LEN(InData%LinNames_x) + IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_x(i1)(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_u not allocated + IF ( .NOT. ALLOCATED(InData%LinNames_u) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%LinNames_u,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%LinNames_u,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%LinNames_u)) DEALLOCATE(OutData%LinNames_u) - ALLOCATE(OutData%LinNames_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%LinNames_u,1), UBOUND(OutData%LinNames_u,1) - DO I = 1, LEN(OutData%LinNames_u) - OutData%LinNames_u(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + + DO i1 = LBOUND(InData%LinNames_u,1), UBOUND(InData%LinNames_u,1) + DO I = 1, LEN(InData%LinNames_u) + IntKiBuf(Int_Xferred) = ICHAR(InData%LinNames_u(i1)(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_y not allocated + IF ( .NOT. ALLOCATED(InData%RotFrame_y) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_y,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_y,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%RotFrame_y)) DEALLOCATE(OutData%RotFrame_y) - ALLOCATE(OutData%RotFrame_y(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_y.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%RotFrame_y,1), UBOUND(OutData%RotFrame_y,1) - OutData%RotFrame_y(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_y(i1)) + + DO i1 = LBOUND(InData%RotFrame_y,1), UBOUND(InData%RotFrame_y,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_y(i1), IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_x not allocated + IF ( .NOT. ALLOCATED(InData%RotFrame_x) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_x,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_x,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%RotFrame_x)) DEALLOCATE(OutData%RotFrame_x) - ALLOCATE(OutData%RotFrame_x(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_x.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%RotFrame_x,1), UBOUND(OutData%RotFrame_x,1) - OutData%RotFrame_x(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_x(i1)) + + DO i1 = LBOUND(InData%RotFrame_x,1), UBOUND(InData%RotFrame_x,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_x(i1), IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_u not allocated + IF ( .NOT. ALLOCATED(InData%RotFrame_u) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%RotFrame_u,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RotFrame_u,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%RotFrame_u)) DEALLOCATE(OutData%RotFrame_u) - ALLOCATE(OutData%RotFrame_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%RotFrame_u,1), UBOUND(OutData%RotFrame_u,1) - OutData%RotFrame_u(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_u(i1)) + + DO i1 = LBOUND(InData%RotFrame_u,1), UBOUND(InData%RotFrame_u,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%RotFrame_u(i1), IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IsLoad_u not allocated + IF ( .NOT. ALLOCATED(InData%IsLoad_u) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%IsLoad_u,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IsLoad_u,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%IsLoad_u)) DEALLOCATE(OutData%IsLoad_u) - ALLOCATE(OutData%IsLoad_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IsLoad_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%IsLoad_u,1), UBOUND(OutData%IsLoad_u,1) - OutData%IsLoad_u(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsLoad_u(i1)) + + DO i1 = LBOUND(InData%IsLoad_u,1), UBOUND(InData%IsLoad_u,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%IsLoad_u(i1), IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeProps not allocated + IF ( .NOT. ALLOCATED(InData%BladeProps) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeProps,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeProps,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeProps)) DEALLOCATE(OutData%BladeProps) - ALLOCATE(OutData%BladeProps(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeProps.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BladeProps,1), UBOUND(OutData%BladeProps,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size + + DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) + CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeProps + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%DerivOrder_x) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%DerivOrder_x,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DerivOrder_x,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%DerivOrder_x,1), UBOUND(InData%DerivOrder_x,1) + IntKiBuf(Int_Xferred) = InData%DerivOrder_x(i1) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrElev) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrElev,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrElev,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TwrElev,1), UBOUND(InData%TwrElev,1) + ReKiBuf(Re_Xferred) = InData%TwrElev(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) + ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE AD_PackRotInitOutputType + + SUBROUTINE AD_UnPackRotInitOutputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotInitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotInitOutputType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%AirDens = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputHdr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WriteOutputHdr)) DEALLOCATE(OutData%WriteOutputHdr) + ALLOCATE(OutData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WriteOutputHdr,1), UBOUND(OutData%WriteOutputHdr,1) + DO I = 1, LEN(OutData%WriteOutputHdr) + OutData%WriteOutputHdr(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputUnt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WriteOutputUnt)) DEALLOCATE(OutData%WriteOutputUnt) + ALLOCATE(OutData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WriteOutputUnt,1), UBOUND(OutData%WriteOutputUnt,1) + DO I = 1, LEN(OutData%WriteOutputUnt) + OutData%WriteOutputUnt(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeShape not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeShape)) DEALLOCATE(OutData%BladeShape) + ALLOCATE(OutData%BladeShape(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeShape.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BladeShape,1), UBOUND(OutData%BladeShape,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 @@ -2517,7 +2584,7 @@ SUBROUTINE AD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AD_Unpackbladepropstype( Re_Buf, Db_Buf, Int_Buf, OutData%BladeProps(i1), ErrStat2, ErrMsg2 ) ! BladeProps + CALL AD_Unpackbladeshape( Re_Buf, Db_Buf, Int_Buf, OutData%BladeShape(i1), ErrStat2, ErrMsg2 ) ! BladeShape CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -2526,286 +2593,309 @@ SUBROUTINE AD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! DerivOrder_x not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_y not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%DerivOrder_x)) DEALLOCATE(OutData%DerivOrder_x) - ALLOCATE(OutData%DerivOrder_x(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%LinNames_y)) DEALLOCATE(OutData%LinNames_y) + ALLOCATE(OutData%LinNames_y(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%DerivOrder_x.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_y.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%DerivOrder_x,1), UBOUND(OutData%DerivOrder_x,1) - OutData%DerivOrder_x(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(OutData%LinNames_y,1), UBOUND(OutData%LinNames_y,1) + DO I = 1, LEN(OutData%LinNames_y) + OutData%LinNames_y(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrElev not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_x not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrElev)) DEALLOCATE(OutData%TwrElev) - ALLOCATE(OutData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%LinNames_x)) DEALLOCATE(OutData%LinNames_x) + ALLOCATE(OutData%LinNames_x(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrElev.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_x.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%TwrElev,1), UBOUND(OutData%TwrElev,1) - OutData%TwrElev(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(OutData%LinNames_x,1), UBOUND(OutData%LinNames_x,1) + DO I = 1, LEN(OutData%LinNames_x) + OutData%LinNames_x(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! LinNames_u not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) - ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%LinNames_u)) DEALLOCATE(OutData%LinNames_u) + ALLOCATE(OutData%LinNames_u(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%LinNames_u.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) - OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(OutData%LinNames_u,1), UBOUND(OutData%LinNames_u,1) + DO I = 1, LEN(OutData%LinNames_u) + OutData%LinNames_u(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I END DO END IF - END SUBROUTINE AD_UnPackInitOutput - - SUBROUTINE AD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_InputFile), INTENT(IN) :: SrcInputFileData - TYPE(AD_InputFile), INTENT(INOUT) :: DstInputFileData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInputFile' -! - ErrStat = ErrID_None - ErrMsg = "" - DstInputFileData%Echo = SrcInputFileData%Echo - DstInputFileData%DTAero = SrcInputFileData%DTAero - DstInputFileData%WakeMod = SrcInputFileData%WakeMod - DstInputFileData%AFAeroMod = SrcInputFileData%AFAeroMod - DstInputFileData%TwrPotent = SrcInputFileData%TwrPotent - DstInputFileData%TwrShadow = SrcInputFileData%TwrShadow - DstInputFileData%TwrAero = SrcInputFileData%TwrAero - DstInputFileData%FrozenWake = SrcInputFileData%FrozenWake - DstInputFileData%CavitCheck = SrcInputFileData%CavitCheck - DstInputFileData%CompAA = SrcInputFileData%CompAA - DstInputFileData%AA_InputFile = SrcInputFileData%AA_InputFile -IF (ALLOCATED(SrcInputFileData%ADBlFile)) THEN - i1_l = LBOUND(SrcInputFileData%ADBlFile,1) - i1_u = UBOUND(SrcInputFileData%ADBlFile,1) - IF (.NOT. ALLOCATED(DstInputFileData%ADBlFile)) THEN - ALLOCATE(DstInputFileData%ADBlFile(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%ADBlFile.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInputFileData%ADBlFile = SrcInputFileData%ADBlFile -ENDIF - DstInputFileData%AirDens = SrcInputFileData%AirDens - DstInputFileData%KinVisc = SrcInputFileData%KinVisc - DstInputFileData%Patm = SrcInputFileData%Patm - DstInputFileData%Pvap = SrcInputFileData%Pvap - DstInputFileData%FluidDepth = SrcInputFileData%FluidDepth - DstInputFileData%SpdSound = SrcInputFileData%SpdSound - DstInputFileData%SkewMod = SrcInputFileData%SkewMod - DstInputFileData%SkewModFactor = SrcInputFileData%SkewModFactor - DstInputFileData%TipLoss = SrcInputFileData%TipLoss - DstInputFileData%HubLoss = SrcInputFileData%HubLoss - DstInputFileData%TanInd = SrcInputFileData%TanInd - DstInputFileData%AIDrag = SrcInputFileData%AIDrag - DstInputFileData%TIDrag = SrcInputFileData%TIDrag - DstInputFileData%IndToler = SrcInputFileData%IndToler - DstInputFileData%MaxIter = SrcInputFileData%MaxIter - DstInputFileData%UAMod = SrcInputFileData%UAMod - DstInputFileData%FLookup = SrcInputFileData%FLookup - DstInputFileData%InCol_Alfa = SrcInputFileData%InCol_Alfa - DstInputFileData%InCol_Cl = SrcInputFileData%InCol_Cl - DstInputFileData%InCol_Cd = SrcInputFileData%InCol_Cd - DstInputFileData%InCol_Cm = SrcInputFileData%InCol_Cm - DstInputFileData%InCol_Cpmin = SrcInputFileData%InCol_Cpmin - DstInputFileData%AFTabMod = SrcInputFileData%AFTabMod - DstInputFileData%NumAFfiles = SrcInputFileData%NumAFfiles - DstInputFileData%FVWFileName = SrcInputFileData%FVWFileName -IF (ALLOCATED(SrcInputFileData%AFNames)) THEN - i1_l = LBOUND(SrcInputFileData%AFNames,1) - i1_u = UBOUND(SrcInputFileData%AFNames,1) - IF (.NOT. ALLOCATED(DstInputFileData%AFNames)) THEN - ALLOCATE(DstInputFileData%AFNames(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_y not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%RotFrame_y)) DEALLOCATE(OutData%RotFrame_y) + ALLOCATE(OutData%RotFrame_y(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%AFNames.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_y.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%RotFrame_y,1), UBOUND(OutData%RotFrame_y,1) + OutData%RotFrame_y(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_y(i1)) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DstInputFileData%AFNames = SrcInputFileData%AFNames -ENDIF - DstInputFileData%UseBlCm = SrcInputFileData%UseBlCm -IF (ALLOCATED(SrcInputFileData%BladeProps)) THEN - i1_l = LBOUND(SrcInputFileData%BladeProps,1) - i1_u = UBOUND(SrcInputFileData%BladeProps,1) - IF (.NOT. ALLOCATED(DstInputFileData%BladeProps)) THEN - ALLOCATE(DstInputFileData%BladeProps(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_x not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%RotFrame_x)) DEALLOCATE(OutData%RotFrame_x) + ALLOCATE(OutData%RotFrame_x(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%BladeProps.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_x.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%RotFrame_x,1), UBOUND(OutData%RotFrame_x,1) + OutData%RotFrame_x(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_x(i1)) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DO i1 = LBOUND(SrcInputFileData%BladeProps,1), UBOUND(SrcInputFileData%BladeProps,1) - CALL AD_Copybladepropstype( SrcInputFileData%BladeProps(i1), DstInputFileData%BladeProps(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF - DstInputFileData%NumTwrNds = SrcInputFileData%NumTwrNds -IF (ALLOCATED(SrcInputFileData%TwrElev)) THEN - i1_l = LBOUND(SrcInputFileData%TwrElev,1) - i1_u = UBOUND(SrcInputFileData%TwrElev,1) - IF (.NOT. ALLOCATED(DstInputFileData%TwrElev)) THEN - ALLOCATE(DstInputFileData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RotFrame_u not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%RotFrame_u)) DEALLOCATE(OutData%RotFrame_u) + ALLOCATE(OutData%RotFrame_u(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%TwrElev.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RotFrame_u.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%RotFrame_u,1), UBOUND(OutData%RotFrame_u,1) + OutData%RotFrame_u(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%RotFrame_u(i1)) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DstInputFileData%TwrElev = SrcInputFileData%TwrElev -ENDIF -IF (ALLOCATED(SrcInputFileData%TwrDiam)) THEN - i1_l = LBOUND(SrcInputFileData%TwrDiam,1) - i1_u = UBOUND(SrcInputFileData%TwrDiam,1) - IF (.NOT. ALLOCATED(DstInputFileData%TwrDiam)) THEN - ALLOCATE(DstInputFileData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IsLoad_u not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IsLoad_u)) DEALLOCATE(OutData%IsLoad_u) + ALLOCATE(OutData%IsLoad_u(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%TwrDiam.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IsLoad_u.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%IsLoad_u,1), UBOUND(OutData%IsLoad_u,1) + OutData%IsLoad_u(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%IsLoad_u(i1)) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DstInputFileData%TwrDiam = SrcInputFileData%TwrDiam -ENDIF -IF (ALLOCATED(SrcInputFileData%TwrCd)) THEN - i1_l = LBOUND(SrcInputFileData%TwrCd,1) - i1_u = UBOUND(SrcInputFileData%TwrCd,1) - IF (.NOT. ALLOCATED(DstInputFileData%TwrCd)) THEN - ALLOCATE(DstInputFileData%TwrCd(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeProps not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeProps)) DEALLOCATE(OutData%BladeProps) + ALLOCATE(OutData%BladeProps(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%TwrCd.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeProps.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%BladeProps,1), UBOUND(OutData%BladeProps,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackbladepropstype( Re_Buf, Db_Buf, Int_Buf, OutData%BladeProps(i1), ErrStat2, ErrMsg2 ) ! BladeProps + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO END IF - DstInputFileData%TwrCd = SrcInputFileData%TwrCd -ENDIF -IF (ALLOCATED(SrcInputFileData%TwrTI)) THEN - i1_l = LBOUND(SrcInputFileData%TwrTI,1) - i1_u = UBOUND(SrcInputFileData%TwrTI,1) - IF (.NOT. ALLOCATED(DstInputFileData%TwrTI)) THEN - ALLOCATE(DstInputFileData%TwrTI(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! DerivOrder_x not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%DerivOrder_x)) DEALLOCATE(OutData%DerivOrder_x) + ALLOCATE(OutData%DerivOrder_x(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%TwrTI.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%DerivOrder_x.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%DerivOrder_x,1), UBOUND(OutData%DerivOrder_x,1) + OutData%DerivOrder_x(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO END IF - DstInputFileData%TwrTI = SrcInputFileData%TwrTI -ENDIF - DstInputFileData%SumPrint = SrcInputFileData%SumPrint - DstInputFileData%NBlOuts = SrcInputFileData%NBlOuts - DstInputFileData%BlOutNd = SrcInputFileData%BlOutNd - DstInputFileData%NTwOuts = SrcInputFileData%NTwOuts - DstInputFileData%TwOutNd = SrcInputFileData%TwOutNd - DstInputFileData%NumOuts = SrcInputFileData%NumOuts -IF (ALLOCATED(SrcInputFileData%OutList)) THEN - i1_l = LBOUND(SrcInputFileData%OutList,1) - i1_u = UBOUND(SrcInputFileData%OutList,1) - IF (.NOT. ALLOCATED(DstInputFileData%OutList)) THEN - ALLOCATE(DstInputFileData%OutList(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrElev not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrElev)) DEALLOCATE(OutData%TwrElev) + ALLOCATE(OutData%TwrElev(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%OutList.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrElev.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%TwrElev,1), UBOUND(OutData%TwrElev,1) + OutData%TwrElev(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInputFileData%OutList = SrcInputFileData%OutList -ENDIF - DstInputFileData%tau1_const = SrcInputFileData%tau1_const - DstInputFileData%DBEMT_Mod = SrcInputFileData%DBEMT_Mod - DstInputFileData%BldNd_NumOuts = SrcInputFileData%BldNd_NumOuts -IF (ALLOCATED(SrcInputFileData%BldNd_OutList)) THEN - i1_l = LBOUND(SrcInputFileData%BldNd_OutList,1) - i1_u = UBOUND(SrcInputFileData%BldNd_OutList,1) - IF (.NOT. ALLOCATED(DstInputFileData%BldNd_OutList)) THEN - ALLOCATE(DstInputFileData%BldNd_OutList(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) + ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%BldNd_OutList.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) + OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DstInputFileData%BldNd_OutList = SrcInputFileData%BldNd_OutList -ENDIF - DstInputFileData%BldNd_BlOutNd_Str = SrcInputFileData%BldNd_BlOutNd_Str - DstInputFileData%BldNd_BladesOut = SrcInputFileData%BldNd_BladesOut - END SUBROUTINE AD_CopyInputFile + END SUBROUTINE AD_UnPackRotInitOutputType - SUBROUTINE AD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) - TYPE(AD_InputFile), INTENT(INOUT) :: InputFileData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInputFile' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 + SUBROUTINE AD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(AD_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInitOutputData%rotors)) THEN + i1_l = LBOUND(SrcInitOutputData%rotors,1) + i1_u = UBOUND(SrcInitOutputData%rotors,1) + IF (.NOT. ALLOCATED(DstInitOutputData%rotors)) THEN + ALLOCATE(DstInitOutputData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInitOutputData%rotors,1), UBOUND(SrcInitOutputData%rotors,1) + CALL AD_Copyrotinitoutputtype( SrcInitOutputData%rotors(i1), DstInitOutputData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyInitOutput + + SUBROUTINE AD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(AD_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(InputFileData%ADBlFile)) THEN - DEALLOCATE(InputFileData%ADBlFile) -ENDIF -IF (ALLOCATED(InputFileData%AFNames)) THEN - DEALLOCATE(InputFileData%AFNames) -ENDIF -IF (ALLOCATED(InputFileData%BladeProps)) THEN -DO i1 = LBOUND(InputFileData%BladeProps,1), UBOUND(InputFileData%BladeProps,1) - CALL AD_Destroybladepropstype( InputFileData%BladeProps(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(InitOutputData%rotors)) THEN +DO i1 = LBOUND(InitOutputData%rotors,1), UBOUND(InitOutputData%rotors,1) + CALL AD_Destroyrotinitoutputtype( InitOutputData%rotors(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(InputFileData%BladeProps) -ENDIF -IF (ALLOCATED(InputFileData%TwrElev)) THEN - DEALLOCATE(InputFileData%TwrElev) -ENDIF -IF (ALLOCATED(InputFileData%TwrDiam)) THEN - DEALLOCATE(InputFileData%TwrDiam) -ENDIF -IF (ALLOCATED(InputFileData%TwrCd)) THEN - DEALLOCATE(InputFileData%TwrCd) -ENDIF -IF (ALLOCATED(InputFileData%TwrTI)) THEN - DEALLOCATE(InputFileData%TwrTI) + DEALLOCATE(InitOutputData%rotors) ENDIF -IF (ALLOCATED(InputFileData%OutList)) THEN - DEALLOCATE(InputFileData%OutList) -ENDIF -IF (ALLOCATED(InputFileData%BldNd_OutList)) THEN - DEALLOCATE(InputFileData%BldNd_OutList) -ENDIF - END SUBROUTINE AD_DestroyInputFile + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyInitOutput - SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_InputFile), INTENT(IN) :: InData + TYPE(AD_InitOutputType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -2820,7 +2910,7 @@ SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInputFile' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInitOutput' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -2836,119 +2926,47 @@ SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! Echo - Db_BufSz = Db_BufSz + 1 ! DTAero - Int_BufSz = Int_BufSz + 1 ! WakeMod - Int_BufSz = Int_BufSz + 1 ! AFAeroMod - Int_BufSz = Int_BufSz + 1 ! TwrPotent - Int_BufSz = Int_BufSz + 1 ! TwrShadow - Int_BufSz = Int_BufSz + 1 ! TwrAero - Int_BufSz = Int_BufSz + 1 ! FrozenWake - Int_BufSz = Int_BufSz + 1 ! CavitCheck - Int_BufSz = Int_BufSz + 1 ! CompAA - Int_BufSz = Int_BufSz + 1*LEN(InData%AA_InputFile) ! AA_InputFile - Int_BufSz = Int_BufSz + 1 ! ADBlFile allocated yes/no - IF ( ALLOCATED(InData%ADBlFile) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! ADBlFile upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%ADBlFile)*LEN(InData%ADBlFile) ! ADBlFile - END IF - Re_BufSz = Re_BufSz + 1 ! AirDens - Re_BufSz = Re_BufSz + 1 ! KinVisc - Re_BufSz = Re_BufSz + 1 ! Patm - Re_BufSz = Re_BufSz + 1 ! Pvap - Re_BufSz = Re_BufSz + 1 ! FluidDepth - Re_BufSz = Re_BufSz + 1 ! SpdSound - Int_BufSz = Int_BufSz + 1 ! SkewMod - Re_BufSz = Re_BufSz + 1 ! SkewModFactor - Int_BufSz = Int_BufSz + 1 ! TipLoss - Int_BufSz = Int_BufSz + 1 ! HubLoss - Int_BufSz = Int_BufSz + 1 ! TanInd - Int_BufSz = Int_BufSz + 1 ! AIDrag - Int_BufSz = Int_BufSz + 1 ! TIDrag - Re_BufSz = Re_BufSz + 1 ! IndToler - Re_BufSz = Re_BufSz + 1 ! MaxIter - Int_BufSz = Int_BufSz + 1 ! UAMod - Int_BufSz = Int_BufSz + 1 ! FLookup - Re_BufSz = Re_BufSz + 1 ! InCol_Alfa - Re_BufSz = Re_BufSz + 1 ! InCol_Cl - Re_BufSz = Re_BufSz + 1 ! InCol_Cd - Re_BufSz = Re_BufSz + 1 ! InCol_Cm - Re_BufSz = Re_BufSz + 1 ! InCol_Cpmin - Int_BufSz = Int_BufSz + 1 ! AFTabMod - Int_BufSz = Int_BufSz + 1 ! NumAFfiles - Int_BufSz = Int_BufSz + 1*LEN(InData%FVWFileName) ! FVWFileName - Int_BufSz = Int_BufSz + 1 ! AFNames allocated yes/no - IF ( ALLOCATED(InData%AFNames) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! AFNames upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%AFNames)*LEN(InData%AFNames) ! AFNames - END IF - Int_BufSz = Int_BufSz + 1 ! UseBlCm - Int_BufSz = Int_BufSz + 1 ! BladeProps allocated yes/no - IF ( ALLOCATED(InData%BladeProps) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeProps upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) - Int_BufSz = Int_BufSz + 3 ! BladeProps: size of buffers for each call to pack subtype - CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeProps + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotinitoutputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BladeProps + IF(ALLOCATED(Re_Buf)) THEN ! rotors Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeProps + IF(ALLOCATED(Db_Buf)) THEN ! rotors Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeProps + IF(ALLOCATED(Int_Buf)) THEN ! rotors Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! NumTwrNds - Int_BufSz = Int_BufSz + 1 ! TwrElev allocated yes/no - IF ( ALLOCATED(InData%TwrElev) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrElev upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrElev) ! TwrElev - END IF - Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no - IF ( ALLOCATED(InData%TwrDiam) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam - END IF - Int_BufSz = Int_BufSz + 1 ! TwrCd allocated yes/no - IF ( ALLOCATED(InData%TwrCd) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrCd upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrCd) ! TwrCd - END IF - Int_BufSz = Int_BufSz + 1 ! TwrTI allocated yes/no - IF ( ALLOCATED(InData%TwrTI) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrTI upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrTI) ! TwrTI - END IF - Int_BufSz = Int_BufSz + 1 ! SumPrint - Int_BufSz = Int_BufSz + 1 ! NBlOuts - Int_BufSz = Int_BufSz + SIZE(InData%BlOutNd) ! BlOutNd - Int_BufSz = Int_BufSz + 1 ! NTwOuts - Int_BufSz = Int_BufSz + SIZE(InData%TwOutNd) ! TwOutNd - Int_BufSz = Int_BufSz + 1 ! NumOuts - Int_BufSz = Int_BufSz + 1 ! OutList allocated yes/no - IF ( ALLOCATED(InData%OutList) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! OutList upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%OutList)*LEN(InData%OutList) ! OutList - END IF - Re_BufSz = Re_BufSz + 1 ! tau1_const - Int_BufSz = Int_BufSz + 1 ! DBEMT_Mod - Int_BufSz = Int_BufSz + 1 ! BldNd_NumOuts - Int_BufSz = Int_BufSz + 1 ! BldNd_OutList allocated yes/no - IF ( ALLOCATED(InData%BldNd_OutList) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BldNd_OutList upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%BldNd_OutList)*LEN(InData%BldNd_OutList) ! BldNd_OutList - END IF - Int_BufSz = Int_BufSz + 1*LEN(InData%BldNd_BlOutNd_Str) ! BldNd_BlOutNd_Str - Int_BufSz = Int_BufSz + 1 ! BldNd_BladesOut + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -2976,130 +2994,48 @@ SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%Echo, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - DbKiBuf(Db_Xferred) = InData%DTAero - Db_Xferred = Db_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%WakeMod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%AFAeroMod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TwrPotent - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TwrShadow - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TwrAero, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%FrozenWake, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitCheck, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompAA, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%AA_InputFile) - IntKiBuf(Int_Xferred) = ICHAR(InData%AA_InputFile(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( .NOT. ALLOCATED(InData%ADBlFile) ) THEN + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ADBlFile,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ADBlFile,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%ADBlFile,1), UBOUND(InData%ADBlFile,1) - DO I = 1, LEN(InData%ADBlFile) - IntKiBuf(Int_Xferred) = ICHAR(InData%ADBlFile(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotinitoutputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - ReKiBuf(Re_Xferred) = InData%AirDens - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%KinVisc - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Patm - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Pvap - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%FluidDepth - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%SpdSound - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%SkewMod - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%SkewModFactor - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TipLoss, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%HubLoss, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TanInd, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%AIDrag, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TIDrag, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%IndToler - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%MaxIter - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%UAMod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%FLookup, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%InCol_Alfa - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%InCol_Cl - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%InCol_Cd - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%InCol_Cm - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%InCol_Cpmin - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%AFTabMod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumAFfiles - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%FVWFileName) - IntKiBuf(Int_Xferred) = ICHAR(InData%FVWFileName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( .NOT. ALLOCATED(InData%AFNames) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AFNames,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AFNames,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%AFNames,1), UBOUND(InData%AFNames,1) - DO I = 1, LEN(InData%AFNames) - IntKiBuf(Int_Xferred) = ICHAR(InData%AFNames(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - IntKiBuf(Int_Xferred) = TRANSFER(InData%UseBlCm, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BladeProps) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeProps,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeProps,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) - CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeProps + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3127,139 +3063,13 @@ SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END DO - END IF - IntKiBuf(Int_Xferred) = InData%NumTwrNds - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%TwrElev) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrElev,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrElev,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrElev,1), UBOUND(InData%TwrElev,1) - ReKiBuf(Re_Xferred) = InData%TwrElev(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) - ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrCd) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrCd,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrCd,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrCd,1), UBOUND(InData%TwrCd,1) - ReKiBuf(Re_Xferred) = InData%TwrCd(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrTI) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrTI,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrTI,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrTI,1), UBOUND(InData%TwrTI,1) - ReKiBuf(Re_Xferred) = InData%TwrTI(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IntKiBuf(Int_Xferred) = TRANSFER(InData%SumPrint, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NBlOuts - Int_Xferred = Int_Xferred + 1 - DO i1 = LBOUND(InData%BlOutNd,1), UBOUND(InData%BlOutNd,1) - IntKiBuf(Int_Xferred) = InData%BlOutNd(i1) - Int_Xferred = Int_Xferred + 1 - END DO - IntKiBuf(Int_Xferred) = InData%NTwOuts - Int_Xferred = Int_Xferred + 1 - DO i1 = LBOUND(InData%TwOutNd,1), UBOUND(InData%TwOutNd,1) - IntKiBuf(Int_Xferred) = InData%TwOutNd(i1) - Int_Xferred = Int_Xferred + 1 - END DO - IntKiBuf(Int_Xferred) = InData%NumOuts - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%OutList) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%OutList,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutList,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%OutList,1), UBOUND(InData%OutList,1) - DO I = 1, LEN(InData%OutList) - IntKiBuf(Int_Xferred) = ICHAR(InData%OutList(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - ReKiBuf(Re_Xferred) = InData%tau1_const - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%DBEMT_Mod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%BldNd_NumOuts - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BldNd_OutList) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_OutList,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_OutList,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BldNd_OutList,1), UBOUND(InData%BldNd_OutList,1) - DO I = 1, LEN(InData%BldNd_OutList) - IntKiBuf(Int_Xferred) = ICHAR(InData%BldNd_OutList(i1)(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - DO I = 1, LEN(InData%BldNd_BlOutNd_Str) - IntKiBuf(Int_Xferred) = ICHAR(InData%BldNd_BlOutNd_Str(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = InData%BldNd_BladesOut - Int_Xferred = Int_Xferred + 1 - END SUBROUTINE AD_PackInputFile + END SUBROUTINE AD_PackInitOutput - SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_InputFile), INTENT(INOUT) :: OutData + TYPE(AD_InitOutputType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -3271,7 +3081,7 @@ SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInputFile' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInitOutput' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -3282,138 +3092,20 @@ SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%Echo = TRANSFER(IntKiBuf(Int_Xferred), OutData%Echo) - Int_Xferred = Int_Xferred + 1 - OutData%DTAero = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - OutData%WakeMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%AFAeroMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrPotent = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrShadow = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrAero = TRANSFER(IntKiBuf(Int_Xferred), OutData%TwrAero) - Int_Xferred = Int_Xferred + 1 - OutData%FrozenWake = TRANSFER(IntKiBuf(Int_Xferred), OutData%FrozenWake) - Int_Xferred = Int_Xferred + 1 - OutData%CavitCheck = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitCheck) - Int_Xferred = Int_Xferred + 1 - OutData%CompAA = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompAA) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%AA_InputFile) - OutData%AA_InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ADBlFile not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ADBlFile)) DEALLOCATE(OutData%ADBlFile) - ALLOCATE(OutData%ADBlFile(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ADBlFile.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%ADBlFile,1), UBOUND(OutData%ADBlFile,1) - DO I = 1, LEN(OutData%ADBlFile) - OutData%ADBlFile(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - OutData%AirDens = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%KinVisc = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Patm = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Pvap = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%FluidDepth = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%SpdSound = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%SkewMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%SkewModFactor = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TipLoss = TRANSFER(IntKiBuf(Int_Xferred), OutData%TipLoss) - Int_Xferred = Int_Xferred + 1 - OutData%HubLoss = TRANSFER(IntKiBuf(Int_Xferred), OutData%HubLoss) - Int_Xferred = Int_Xferred + 1 - OutData%TanInd = TRANSFER(IntKiBuf(Int_Xferred), OutData%TanInd) - Int_Xferred = Int_Xferred + 1 - OutData%AIDrag = TRANSFER(IntKiBuf(Int_Xferred), OutData%AIDrag) - Int_Xferred = Int_Xferred + 1 - OutData%TIDrag = TRANSFER(IntKiBuf(Int_Xferred), OutData%TIDrag) - Int_Xferred = Int_Xferred + 1 - OutData%IndToler = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%MaxIter = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%UAMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%FLookup = TRANSFER(IntKiBuf(Int_Xferred), OutData%FLookup) - Int_Xferred = Int_Xferred + 1 - OutData%InCol_Alfa = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%InCol_Cl = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%InCol_Cd = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%InCol_Cm = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%InCol_Cpmin = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%AFTabMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%NumAFfiles = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%FVWFileName) - OutData%FVWFileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AFNames not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AFNames)) DEALLOCATE(OutData%AFNames) - ALLOCATE(OutData%AFNames(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AFNames.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%AFNames,1), UBOUND(OutData%AFNames,1) - DO I = 1, LEN(OutData%AFNames) - OutData%AFNames(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - OutData%UseBlCm = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseBlCm) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeProps not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeProps)) DEALLOCATE(OutData%BladeProps) - ALLOCATE(OutData%BladeProps(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeProps.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BladeProps,1), UBOUND(OutData%BladeProps,1) + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3447,7 +3139,7 @@ SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AD_Unpackbladepropstype( Re_Buf, Db_Buf, Int_Buf, OutData%BladeProps(i1), ErrStat2, ErrMsg2 ) ! BladeProps + CALL AD_Unpackrotinitoutputtype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3456,198 +3148,165 @@ SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - OutData%NumTwrNds = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrElev not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrElev)) DEALLOCATE(OutData%TwrElev) - ALLOCATE(OutData%TwrElev(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrElev.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrElev,1), UBOUND(OutData%TwrElev,1) - OutData%TwrElev(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) - ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) - OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrCd not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrCd)) DEALLOCATE(OutData%TwrCd) - ALLOCATE(OutData%TwrCd(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrCd.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrCd,1), UBOUND(OutData%TwrCd,1) - OutData%TwrCd(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrTI not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrTI)) DEALLOCATE(OutData%TwrTI) - ALLOCATE(OutData%TwrTI(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrTI.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrTI,1), UBOUND(OutData%TwrTI,1) - OutData%TwrTI(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - OutData%SumPrint = TRANSFER(IntKiBuf(Int_Xferred), OutData%SumPrint) - Int_Xferred = Int_Xferred + 1 - OutData%NBlOuts = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - i1_l = LBOUND(OutData%BlOutNd,1) - i1_u = UBOUND(OutData%BlOutNd,1) - DO i1 = LBOUND(OutData%BlOutNd,1), UBOUND(OutData%BlOutNd,1) - OutData%BlOutNd(i1) = IntKiBuf(Int_Xferred) + Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 - END DO - OutData%NTwOuts = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - i1_l = LBOUND(OutData%TwOutNd,1) - i1_u = UBOUND(OutData%TwOutNd,1) - DO i1 = LBOUND(OutData%TwOutNd,1), UBOUND(OutData%TwOutNd,1) - OutData%TwOutNd(i1) = IntKiBuf(Int_Xferred) + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 - END DO - OutData%NumOuts = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutList not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%OutList)) DEALLOCATE(OutData%OutList) - ALLOCATE(OutData%OutList(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutList.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%OutList,1), UBOUND(OutData%OutList,1) - DO I = 1, LEN(OutData%OutList) - OutData%OutList(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - OutData%tau1_const = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%DBEMT_Mod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%BldNd_NumOuts = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_OutList not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BldNd_OutList)) DEALLOCATE(OutData%BldNd_OutList) - ALLOCATE(OutData%BldNd_OutList(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_OutList.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BldNd_OutList,1), UBOUND(OutData%BldNd_OutList,1) - DO I = 1, LEN(OutData%BldNd_OutList) - OutData%BldNd_OutList(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - END DO - END IF - DO I = 1, LEN(OutData%BldNd_BlOutNd_Str) - OutData%BldNd_BlOutNd_Str(I:I) = CHAR(IntKiBuf(Int_Xferred)) + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%BldNd_BladesOut = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END SUBROUTINE AD_UnPackInputFile + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - SUBROUTINE AD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_ContinuousStateType), INTENT(IN) :: SrcContStateData - TYPE(AD_ContinuousStateType), INTENT(INOUT) :: DstContStateData + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackInitOutput + + SUBROUTINE AD_CopyRotInputFile( SrcRotInputFileData, DstRotInputFileData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotInputFile), INTENT(IN) :: SrcRotInputFileData + TYPE(RotInputFile), INTENT(INOUT) :: DstRotInputFileData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyContState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotInputFile' ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_CopyContState( SrcContStateData%BEMT, DstContStateData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyContState( SrcContStateData%FVW, DstContStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyContState( SrcContStateData%AA, DstContStateData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + DstRotInputFileData%BldNd_BladesOut = SrcRotInputFileData%BldNd_BladesOut +IF (ALLOCATED(SrcRotInputFileData%BladeProps)) THEN + i1_l = LBOUND(SrcRotInputFileData%BladeProps,1) + i1_u = UBOUND(SrcRotInputFileData%BladeProps,1) + IF (.NOT. ALLOCATED(DstRotInputFileData%BladeProps)) THEN + ALLOCATE(DstRotInputFileData%BladeProps(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputFileData%BladeProps.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcRotInputFileData%BladeProps,1), UBOUND(SrcRotInputFileData%BladeProps,1) + CALL AD_Copybladepropstype( SrcRotInputFileData%BladeProps(i1), DstRotInputFileData%BladeProps(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE AD_CopyContState - - SUBROUTINE AD_DestroyContState( ContStateData, ErrStat, ErrMsg ) - TYPE(AD_ContinuousStateType), INTENT(INOUT) :: ContStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyContState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 + ENDDO +ENDIF + DstRotInputFileData%NumTwrNds = SrcRotInputFileData%NumTwrNds +IF (ALLOCATED(SrcRotInputFileData%TwrElev)) THEN + i1_l = LBOUND(SrcRotInputFileData%TwrElev,1) + i1_u = UBOUND(SrcRotInputFileData%TwrElev,1) + IF (.NOT. ALLOCATED(DstRotInputFileData%TwrElev)) THEN + ALLOCATE(DstRotInputFileData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputFileData%TwrElev.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInputFileData%TwrElev = SrcRotInputFileData%TwrElev +ENDIF +IF (ALLOCATED(SrcRotInputFileData%TwrDiam)) THEN + i1_l = LBOUND(SrcRotInputFileData%TwrDiam,1) + i1_u = UBOUND(SrcRotInputFileData%TwrDiam,1) + IF (.NOT. ALLOCATED(DstRotInputFileData%TwrDiam)) THEN + ALLOCATE(DstRotInputFileData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputFileData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInputFileData%TwrDiam = SrcRotInputFileData%TwrDiam +ENDIF +IF (ALLOCATED(SrcRotInputFileData%TwrCd)) THEN + i1_l = LBOUND(SrcRotInputFileData%TwrCd,1) + i1_u = UBOUND(SrcRotInputFileData%TwrCd,1) + IF (.NOT. ALLOCATED(DstRotInputFileData%TwrCd)) THEN + ALLOCATE(DstRotInputFileData%TwrCd(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputFileData%TwrCd.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInputFileData%TwrCd = SrcRotInputFileData%TwrCd +ENDIF +IF (ALLOCATED(SrcRotInputFileData%TwrTI)) THEN + i1_l = LBOUND(SrcRotInputFileData%TwrTI,1) + i1_u = UBOUND(SrcRotInputFileData%TwrTI,1) + IF (.NOT. ALLOCATED(DstRotInputFileData%TwrTI)) THEN + ALLOCATE(DstRotInputFileData%TwrTI(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputFileData%TwrTI.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotInputFileData%TwrTI = SrcRotInputFileData%TwrTI +ENDIF + END SUBROUTINE AD_CopyRotInputFile + + SUBROUTINE AD_DestroyRotInputFile( RotInputFileData, ErrStat, ErrMsg ) + TYPE(RotInputFile), INTENT(INOUT) :: RotInputFileData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotInputFile' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_DestroyContState( ContStateData%BEMT, ErrStat, ErrMsg ) - CALL FVW_DestroyContState( ContStateData%FVW, ErrStat, ErrMsg ) - CALL AA_DestroyContState( ContStateData%AA, ErrStat, ErrMsg ) - END SUBROUTINE AD_DestroyContState +IF (ALLOCATED(RotInputFileData%BladeProps)) THEN +DO i1 = LBOUND(RotInputFileData%BladeProps,1), UBOUND(RotInputFileData%BladeProps,1) + CALL AD_Destroybladepropstype( RotInputFileData%BladeProps(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotInputFileData%BladeProps) +ENDIF +IF (ALLOCATED(RotInputFileData%TwrElev)) THEN + DEALLOCATE(RotInputFileData%TwrElev) +ENDIF +IF (ALLOCATED(RotInputFileData%TwrDiam)) THEN + DEALLOCATE(RotInputFileData%TwrDiam) +ENDIF +IF (ALLOCATED(RotInputFileData%TwrCd)) THEN + DEALLOCATE(RotInputFileData%TwrCd) +ENDIF +IF (ALLOCATED(RotInputFileData%TwrTI)) THEN + DEALLOCATE(RotInputFileData%TwrTI) +ENDIF + END SUBROUTINE AD_DestroyRotInputFile - SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_ContinuousStateType), INTENT(IN) :: InData + TYPE(RotInputFile), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -3662,7 +3321,7 @@ SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackContState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotInputFile' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -3678,58 +3337,52 @@ SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! BldNd_BladesOut + Int_BufSz = Int_BufSz + 1 ! BladeProps allocated yes/no + IF ( ALLOCATED(InData%BladeProps) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeProps upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BEMT - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) + Int_BufSz = Int_BufSz + 3 ! BladeProps: size of buffers for each call to pack subtype + CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BladeProps CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! AA + IF(ALLOCATED(Re_Buf)) THEN ! BladeProps Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA + IF(ALLOCATED(Db_Buf)) THEN ! BladeProps Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA + IF(ALLOCATED(Int_Buf)) THEN ! BladeProps Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NumTwrNds + Int_BufSz = Int_BufSz + 1 ! TwrElev allocated yes/no + IF ( ALLOCATED(InData%TwrElev) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrElev upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrElev) ! TwrElev + END IF + Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no + IF ( ALLOCATED(InData%TwrDiam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam + END IF + Int_BufSz = Int_BufSz + 1 ! TwrCd allocated yes/no + IF ( ALLOCATED(InData%TwrCd) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrCd upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrCd) ! TwrCd + END IF + Int_BufSz = Int_BufSz + 1 ! TwrTI allocated yes/no + IF ( ALLOCATED(InData%TwrTI) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrTI upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrTI) ! TwrTI + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3757,35 +3410,20 @@ SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Db_Xferred = 1 Int_Xferred = 1 - CALL BEMT_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + IntKiBuf(Int_Xferred) = InData%BldNd_BladesOut + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BladeProps) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeProps,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeProps,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL FVW_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + DO i1 = LBOUND(InData%BladeProps,1), UBOUND(InData%BladeProps,1) + CALL AD_Packbladepropstype( Re_Buf, Db_Buf, Int_Buf, InData%BladeProps(i1), ErrStat2, ErrMsg2, OnlySize ) ! BladeProps CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3813,41 +3451,77 @@ SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL AA_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumTwrNds + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%TwrElev) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrElev,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrElev,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE AD_PackContState + DO i1 = LBOUND(InData%TwrElev,1), UBOUND(InData%TwrElev,1) + ReKiBuf(Re_Xferred) = InData%TwrElev(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE AD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) + ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrCd) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrCd,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrCd,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TwrCd,1), UBOUND(InData%TwrCd,1) + ReKiBuf(Re_Xferred) = InData%TwrCd(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrTI) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrTI,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrTI,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TwrTI,1), UBOUND(InData%TwrTI,1) + ReKiBuf(Re_Xferred) = InData%TwrTI(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE AD_PackRotInputFile + + SUBROUTINE AD_UnPackRotInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_ContinuousStateType), INTENT(INOUT) :: OutData + TYPE(RotInputFile), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -3856,9 +3530,10 @@ SUBROUTINE AD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackContState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotInputFile' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -3869,6 +3544,22 @@ SUBROUTINE AD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + OutData%BldNd_BladesOut = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeProps not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeProps)) DEALLOCATE(OutData%BladeProps) + ALLOCATE(OutData%BladeProps(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeProps.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BladeProps,1), UBOUND(OutData%BladeProps,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3902,221 +3593,376 @@ SUBROUTINE AD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL FVW_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL AA_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL AD_Unpackbladepropstype( Re_Buf, Db_Buf, Int_Buf, OutData%BladeProps(i1), ErrStat2, ErrMsg2 ) ! BladeProps CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE AD_UnPackContState + END DO + END IF + OutData%NumTwrNds = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrElev not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrElev)) DEALLOCATE(OutData%TwrElev) + ALLOCATE(OutData%TwrElev(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrElev.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrElev,1), UBOUND(OutData%TwrElev,1) + OutData%TwrElev(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) + ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) + OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrCd not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrCd)) DEALLOCATE(OutData%TwrCd) + ALLOCATE(OutData%TwrCd(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrCd.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrCd,1), UBOUND(OutData%TwrCd,1) + OutData%TwrCd(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrTI not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrTI)) DEALLOCATE(OutData%TwrTI) + ALLOCATE(OutData%TwrTI(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrTI.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrTI,1), UBOUND(OutData%TwrTI,1) + OutData%TwrTI(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE AD_UnPackRotInputFile - SUBROUTINE AD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData - TYPE(AD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + SUBROUTINE AD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_InputFile), INTENT(IN) :: SrcInputFileData + TYPE(AD_InputFile), INTENT(INOUT) :: DstInputFileData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyDiscState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInputFile' ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_CopyDiscState( SrcDiscStateData%BEMT, DstDiscStateData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyDiscState( SrcDiscStateData%FVW, DstDiscStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyDiscState( SrcDiscStateData%AA, DstDiscStateData%AA, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE AD_CopyDiscState - - SUBROUTINE AD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) - TYPE(AD_DiscreteStateType), INTENT(INOUT) :: DiscStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyDiscState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL BEMT_DestroyDiscState( DiscStateData%BEMT, ErrStat, ErrMsg ) - CALL FVW_DestroyDiscState( DiscStateData%FVW, ErrStat, ErrMsg ) - CALL AA_DestroyDiscState( DiscStateData%AA, ErrStat, ErrMsg ) - END SUBROUTINE AD_DestroyDiscState - - SUBROUTINE AD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_DiscreteStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackDiscState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BEMT - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + DstInputFileData%Echo = SrcInputFileData%Echo + DstInputFileData%DTAero = SrcInputFileData%DTAero + DstInputFileData%WakeMod = SrcInputFileData%WakeMod + DstInputFileData%AFAeroMod = SrcInputFileData%AFAeroMod + DstInputFileData%TwrPotent = SrcInputFileData%TwrPotent + DstInputFileData%TwrShadow = SrcInputFileData%TwrShadow + DstInputFileData%TwrAero = SrcInputFileData%TwrAero + DstInputFileData%FrozenWake = SrcInputFileData%FrozenWake + DstInputFileData%CavitCheck = SrcInputFileData%CavitCheck + DstInputFileData%CompAA = SrcInputFileData%CompAA + DstInputFileData%AA_InputFile = SrcInputFileData%AA_InputFile +IF (ALLOCATED(SrcInputFileData%ADBlFile)) THEN + i1_l = LBOUND(SrcInputFileData%ADBlFile,1) + i1_u = UBOUND(SrcInputFileData%ADBlFile,1) + IF (.NOT. ALLOCATED(DstInputFileData%ADBlFile)) THEN + ALLOCATE(DstInputFileData%ADBlFile(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%ADBlFile.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%ADBlFile = SrcInputFileData%ADBlFile +ENDIF + DstInputFileData%AirDens = SrcInputFileData%AirDens + DstInputFileData%KinVisc = SrcInputFileData%KinVisc + DstInputFileData%Patm = SrcInputFileData%Patm + DstInputFileData%Pvap = SrcInputFileData%Pvap + DstInputFileData%FluidDepth = SrcInputFileData%FluidDepth + DstInputFileData%SpdSound = SrcInputFileData%SpdSound + DstInputFileData%SkewMod = SrcInputFileData%SkewMod + DstInputFileData%SkewModFactor = SrcInputFileData%SkewModFactor + DstInputFileData%TipLoss = SrcInputFileData%TipLoss + DstInputFileData%HubLoss = SrcInputFileData%HubLoss + DstInputFileData%TanInd = SrcInputFileData%TanInd + DstInputFileData%AIDrag = SrcInputFileData%AIDrag + DstInputFileData%TIDrag = SrcInputFileData%TIDrag + DstInputFileData%IndToler = SrcInputFileData%IndToler + DstInputFileData%MaxIter = SrcInputFileData%MaxIter + DstInputFileData%UAMod = SrcInputFileData%UAMod + DstInputFileData%FLookup = SrcInputFileData%FLookup + DstInputFileData%InCol_Alfa = SrcInputFileData%InCol_Alfa + DstInputFileData%InCol_Cl = SrcInputFileData%InCol_Cl + DstInputFileData%InCol_Cd = SrcInputFileData%InCol_Cd + DstInputFileData%InCol_Cm = SrcInputFileData%InCol_Cm + DstInputFileData%InCol_Cpmin = SrcInputFileData%InCol_Cpmin + DstInputFileData%AFTabMod = SrcInputFileData%AFTabMod + DstInputFileData%NumAFfiles = SrcInputFileData%NumAFfiles + DstInputFileData%FVWFileName = SrcInputFileData%FVWFileName +IF (ALLOCATED(SrcInputFileData%AFNames)) THEN + i1_l = LBOUND(SrcInputFileData%AFNames,1) + i1_u = UBOUND(SrcInputFileData%AFNames,1) + IF (.NOT. ALLOCATED(DstInputFileData%AFNames)) THEN + ALLOCATE(DstInputFileData%AFNames(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%AFNames.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%AFNames = SrcInputFileData%AFNames +ENDIF + DstInputFileData%UseBlCm = SrcInputFileData%UseBlCm + DstInputFileData%SumPrint = SrcInputFileData%SumPrint + DstInputFileData%NBlOuts = SrcInputFileData%NBlOuts + DstInputFileData%BlOutNd = SrcInputFileData%BlOutNd + DstInputFileData%NTwOuts = SrcInputFileData%NTwOuts + DstInputFileData%TwOutNd = SrcInputFileData%TwOutNd + DstInputFileData%NumOuts = SrcInputFileData%NumOuts +IF (ALLOCATED(SrcInputFileData%OutList)) THEN + i1_l = LBOUND(SrcInputFileData%OutList,1) + i1_u = UBOUND(SrcInputFileData%OutList,1) + IF (.NOT. ALLOCATED(DstInputFileData%OutList)) THEN + ALLOCATE(DstInputFileData%OutList(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%OutList.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%OutList = SrcInputFileData%OutList +ENDIF + DstInputFileData%tau1_const = SrcInputFileData%tau1_const + DstInputFileData%DBEMT_Mod = SrcInputFileData%DBEMT_Mod + DstInputFileData%BldNd_NumOuts = SrcInputFileData%BldNd_NumOuts +IF (ALLOCATED(SrcInputFileData%BldNd_OutList)) THEN + i1_l = LBOUND(SrcInputFileData%BldNd_OutList,1) + i1_u = UBOUND(SrcInputFileData%BldNd_OutList,1) + IF (.NOT. ALLOCATED(DstInputFileData%BldNd_OutList)) THEN + ALLOCATE(DstInputFileData%BldNd_OutList(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%BldNd_OutList.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%BldNd_OutList = SrcInputFileData%BldNd_OutList +ENDIF + DstInputFileData%BldNd_BlOutNd_Str = SrcInputFileData%BldNd_BlOutNd_Str + DstInputFileData%BldNd_BladesOut = SrcInputFileData%BldNd_BladesOut +IF (ALLOCATED(SrcInputFileData%rotors)) THEN + i1_l = LBOUND(SrcInputFileData%rotors,1) + i1_u = UBOUND(SrcInputFileData%rotors,1) + IF (.NOT. ALLOCATED(DstInputFileData%rotors)) THEN + ALLOCATE(DstInputFileData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputFileData%rotors,1), UBOUND(SrcInputFileData%rotors,1) + CALL AD_Copyrotinputfile( SrcInputFileData%rotors(i1), DstInputFileData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AD_CopyInputFile + + SUBROUTINE AD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) + TYPE(AD_InputFile), INTENT(INOUT) :: InputFileData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInputFile' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputFileData%ADBlFile)) THEN + DEALLOCATE(InputFileData%ADBlFile) +ENDIF +IF (ALLOCATED(InputFileData%AFNames)) THEN + DEALLOCATE(InputFileData%AFNames) +ENDIF +IF (ALLOCATED(InputFileData%OutList)) THEN + DEALLOCATE(InputFileData%OutList) +ENDIF +IF (ALLOCATED(InputFileData%BldNd_OutList)) THEN + DEALLOCATE(InputFileData%BldNd_OutList) +ENDIF +IF (ALLOCATED(InputFileData%rotors)) THEN +DO i1 = LBOUND(InputFileData%rotors,1), UBOUND(InputFileData%rotors,1) + CALL AD_Destroyrotinputfile( InputFileData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputFileData%rotors) +ENDIF + END SUBROUTINE AD_DestroyInputFile + + SUBROUTINE AD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_InputFile), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInputFile' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Echo + Db_BufSz = Db_BufSz + 1 ! DTAero + Int_BufSz = Int_BufSz + 1 ! WakeMod + Int_BufSz = Int_BufSz + 1 ! AFAeroMod + Int_BufSz = Int_BufSz + 1 ! TwrPotent + Int_BufSz = Int_BufSz + 1 ! TwrShadow + Int_BufSz = Int_BufSz + 1 ! TwrAero + Int_BufSz = Int_BufSz + 1 ! FrozenWake + Int_BufSz = Int_BufSz + 1 ! CavitCheck + Int_BufSz = Int_BufSz + 1 ! CompAA + Int_BufSz = Int_BufSz + 1*LEN(InData%AA_InputFile) ! AA_InputFile + Int_BufSz = Int_BufSz + 1 ! ADBlFile allocated yes/no + IF ( ALLOCATED(InData%ADBlFile) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ADBlFile upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%ADBlFile)*LEN(InData%ADBlFile) ! ADBlFile + END IF + Re_BufSz = Re_BufSz + 1 ! AirDens + Re_BufSz = Re_BufSz + 1 ! KinVisc + Re_BufSz = Re_BufSz + 1 ! Patm + Re_BufSz = Re_BufSz + 1 ! Pvap + Re_BufSz = Re_BufSz + 1 ! FluidDepth + Re_BufSz = Re_BufSz + 1 ! SpdSound + Int_BufSz = Int_BufSz + 1 ! SkewMod + Re_BufSz = Re_BufSz + 1 ! SkewModFactor + Int_BufSz = Int_BufSz + 1 ! TipLoss + Int_BufSz = Int_BufSz + 1 ! HubLoss + Int_BufSz = Int_BufSz + 1 ! TanInd + Int_BufSz = Int_BufSz + 1 ! AIDrag + Int_BufSz = Int_BufSz + 1 ! TIDrag + Re_BufSz = Re_BufSz + 1 ! IndToler + Re_BufSz = Re_BufSz + 1 ! MaxIter + Int_BufSz = Int_BufSz + 1 ! UAMod + Int_BufSz = Int_BufSz + 1 ! FLookup + Re_BufSz = Re_BufSz + 1 ! InCol_Alfa + Re_BufSz = Re_BufSz + 1 ! InCol_Cl + Re_BufSz = Re_BufSz + 1 ! InCol_Cd + Re_BufSz = Re_BufSz + 1 ! InCol_Cm + Re_BufSz = Re_BufSz + 1 ! InCol_Cpmin + Int_BufSz = Int_BufSz + 1 ! AFTabMod + Int_BufSz = Int_BufSz + 1 ! NumAFfiles + Int_BufSz = Int_BufSz + 1*LEN(InData%FVWFileName) ! FVWFileName + Int_BufSz = Int_BufSz + 1 ! AFNames allocated yes/no + IF ( ALLOCATED(InData%AFNames) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AFNames upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%AFNames)*LEN(InData%AFNames) ! AFNames + END IF + Int_BufSz = Int_BufSz + 1 ! UseBlCm + Int_BufSz = Int_BufSz + 1 ! SumPrint + Int_BufSz = Int_BufSz + 1 ! NBlOuts + Int_BufSz = Int_BufSz + SIZE(InData%BlOutNd) ! BlOutNd + Int_BufSz = Int_BufSz + 1 ! NTwOuts + Int_BufSz = Int_BufSz + SIZE(InData%TwOutNd) ! TwOutNd + Int_BufSz = Int_BufSz + 1 ! NumOuts + Int_BufSz = Int_BufSz + 1 ! OutList allocated yes/no + IF ( ALLOCATED(InData%OutList) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutList upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%OutList)*LEN(InData%OutList) ! OutList + END IF + Re_BufSz = Re_BufSz + 1 ! tau1_const + Int_BufSz = Int_BufSz + 1 ! DBEMT_Mod + Int_BufSz = Int_BufSz + 1 ! BldNd_NumOuts + Int_BufSz = Int_BufSz + 1 ! BldNd_OutList allocated yes/no + IF ( ALLOCATED(InData%BldNd_OutList) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BldNd_OutList upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%BldNd_OutList)*LEN(InData%BldNd_OutList) ! BldNd_OutList + END IF + Int_BufSz = Int_BufSz + 1*LEN(InData%BldNd_BlOutNd_Str) ! BldNd_BlOutNd_Str + Int_BufSz = Int_BufSz + 1 ! BldNd_BladesOut + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotinputfile( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! AA + IF(ALLOCATED(Re_Buf)) THEN ! rotors Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA + IF(ALLOCATED(Db_Buf)) THEN ! rotors Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA + IF(ALLOCATED(Int_Buf)) THEN ! rotors Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4144,63 +3990,192 @@ SUBROUTINE AD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Db_Xferred = 1 Int_Xferred = 1 - CALL BEMT_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL FVW_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + IntKiBuf(Int_Xferred) = TRANSFER(InData%Echo, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%DTAero + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%WakeMod + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%AFAeroMod + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TwrPotent + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TwrShadow + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%TwrAero, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FrozenWake, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitCheck, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%CompAA, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%AA_InputFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%AA_InputFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%ADBlFile) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ADBlFile,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ADBlFile,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL AA_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + DO i1 = LBOUND(InData%ADBlFile,1), UBOUND(InData%ADBlFile,1) + DO I = 1, LEN(InData%ADBlFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%ADBlFile(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + ReKiBuf(Re_Xferred) = InData%AirDens + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%KinVisc + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Patm + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Pvap + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%FluidDepth + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%SpdSound + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%SkewMod + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%SkewModFactor + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%TipLoss, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%HubLoss, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%TanInd, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%AIDrag, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%TIDrag, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%IndToler + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%MaxIter + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%UAMod + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FLookup, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%InCol_Alfa + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%InCol_Cl + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%InCol_Cd + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%InCol_Cm + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%InCol_Cpmin + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%AFTabMod + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumAFfiles + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%FVWFileName) + IntKiBuf(Int_Xferred) = ICHAR(InData%FVWFileName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%AFNames) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AFNames,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AFNames,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AFNames,1), UBOUND(InData%AFNames,1) + DO I = 1, LEN(InData%AFNames) + IntKiBuf(Int_Xferred) = ICHAR(InData%AFNames(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseBlCm, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%SumPrint, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NBlOuts + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%BlOutNd,1), UBOUND(InData%BlOutNd,1) + IntKiBuf(Int_Xferred) = InData%BlOutNd(i1) + Int_Xferred = Int_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%NTwOuts + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%TwOutNd,1), UBOUND(InData%TwOutNd,1) + IntKiBuf(Int_Xferred) = InData%TwOutNd(i1) + Int_Xferred = Int_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%NumOuts + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutList) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutList,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutList,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutList,1), UBOUND(InData%OutList,1) + DO I = 1, LEN(InData%OutList) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutList(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + ReKiBuf(Re_Xferred) = InData%tau1_const + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%DBEMT_Mod + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%BldNd_NumOuts + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BldNd_OutList) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_OutList,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_OutList,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BldNd_OutList,1), UBOUND(InData%BldNd_OutList,1) + DO I = 1, LEN(InData%BldNd_OutList) + IntKiBuf(Int_Xferred) = ICHAR(InData%BldNd_OutList(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + DO I = 1, LEN(InData%BldNd_BlOutNd_Str) + IntKiBuf(Int_Xferred) = ICHAR(InData%BldNd_BlOutNd_Str(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%BldNd_BladesOut + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotinputfile( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4228,13 +4203,15 @@ SUBROUTINE AD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE AD_PackDiscState + END DO + END IF + END SUBROUTINE AD_PackInputFile - SUBROUTINE AD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_DiscreteStateType), INTENT(INOUT) :: OutData + TYPE(AD_InputFile), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -4243,9 +4220,10 @@ SUBROUTINE AD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackDiscState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInputFile' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -4256,46 +4234,210 @@ SUBROUTINE AD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) + OutData%Echo = TRANSFER(IntKiBuf(Int_Xferred), OutData%Echo) + Int_Xferred = Int_Xferred + 1 + OutData%DTAero = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%WakeMod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%AFAeroMod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrPotent = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrShadow = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrAero = TRANSFER(IntKiBuf(Int_Xferred), OutData%TwrAero) + Int_Xferred = Int_Xferred + 1 + OutData%FrozenWake = TRANSFER(IntKiBuf(Int_Xferred), OutData%FrozenWake) + Int_Xferred = Int_Xferred + 1 + OutData%CavitCheck = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitCheck) + Int_Xferred = Int_Xferred + 1 + OutData%CompAA = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompAA) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%AA_InputFile) + OutData%AA_InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL BEMT_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ADBlFile not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ADBlFile)) DEALLOCATE(OutData%ADBlFile) + ALLOCATE(OutData%ADBlFile(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ADBlFile.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ADBlFile,1), UBOUND(OutData%ADBlFile,1) + DO I = 1, LEN(OutData%ADBlFile) + OutData%ADBlFile(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%AirDens = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%KinVisc = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Patm = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Pvap = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%FluidDepth = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%SpdSound = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%SkewMod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%SkewModFactor = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%TipLoss = TRANSFER(IntKiBuf(Int_Xferred), OutData%TipLoss) + Int_Xferred = Int_Xferred + 1 + OutData%HubLoss = TRANSFER(IntKiBuf(Int_Xferred), OutData%HubLoss) + Int_Xferred = Int_Xferred + 1 + OutData%TanInd = TRANSFER(IntKiBuf(Int_Xferred), OutData%TanInd) + Int_Xferred = Int_Xferred + 1 + OutData%AIDrag = TRANSFER(IntKiBuf(Int_Xferred), OutData%AIDrag) + Int_Xferred = Int_Xferred + 1 + OutData%TIDrag = TRANSFER(IntKiBuf(Int_Xferred), OutData%TIDrag) + Int_Xferred = Int_Xferred + 1 + OutData%IndToler = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%MaxIter = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%UAMod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%FLookup = TRANSFER(IntKiBuf(Int_Xferred), OutData%FLookup) + Int_Xferred = Int_Xferred + 1 + OutData%InCol_Alfa = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%InCol_Cl = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%InCol_Cd = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%InCol_Cm = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%InCol_Cpmin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AFTabMod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumAFfiles = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%FVWFileName) + OutData%FVWFileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AFNames not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AFNames)) DEALLOCATE(OutData%AFNames) + ALLOCATE(OutData%AFNames(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AFNames.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AFNames,1), UBOUND(OutData%AFNames,1) + DO I = 1, LEN(OutData%AFNames) + OutData%AFNames(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%UseBlCm = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseBlCm) + Int_Xferred = Int_Xferred + 1 + OutData%SumPrint = TRANSFER(IntKiBuf(Int_Xferred), OutData%SumPrint) + Int_Xferred = Int_Xferred + 1 + OutData%NBlOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%BlOutNd,1) + i1_u = UBOUND(OutData%BlOutNd,1) + DO i1 = LBOUND(OutData%BlOutNd,1), UBOUND(OutData%BlOutNd,1) + OutData%BlOutNd(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + OutData%NTwOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%TwOutNd,1) + i1_u = UBOUND(OutData%TwOutNd,1) + DO i1 = LBOUND(OutData%TwOutNd,1), UBOUND(OutData%TwOutNd,1) + OutData%TwOutNd(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + OutData%NumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutList not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutList)) DEALLOCATE(OutData%OutList) + ALLOCATE(OutData%OutList(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutList.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutList,1), UBOUND(OutData%OutList,1) + DO I = 1, LEN(OutData%OutList) + OutData%OutList(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%tau1_const = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%DBEMT_Mod = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%BldNd_NumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_OutList not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BldNd_OutList)) DEALLOCATE(OutData%BldNd_OutList) + ALLOCATE(OutData%BldNd_OutList(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_OutList.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BldNd_OutList,1), UBOUND(OutData%BldNd_OutList,1) + DO I = 1, LEN(OutData%BldNd_OutList) + OutData%BldNd_OutList(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + DO I = 1, LEN(OutData%BldNd_BlOutNd_Str) + OutData%BldNd_BlOutNd_Str(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%BldNd_BladesOut = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4329,58 +4471,20 @@ SUBROUTINE AD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FVW_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL AD_Unpackrotinputfile( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL AA_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE AD_UnPackDiscState + END DO + END IF + END SUBROUTINE AD_UnPackInputFile - SUBROUTINE AD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData - TYPE(AD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + SUBROUTINE AD_CopyRotContinuousStateType( SrcRotContinuousStateTypeData, DstRotContinuousStateTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotContinuousStateType), INTENT(IN) :: SrcRotContinuousStateTypeData + TYPE(RotContinuousStateType), INTENT(INOUT) :: DstRotContinuousStateTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -4388,40 +4492,36 @@ SUBROUTINE AD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyConstrState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotContinuousStateType' ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_CopyConstrState( SrcConstrStateData%BEMT, DstConstrStateData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyConstrState( SrcConstrStateData%FVW, DstConstrStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL BEMT_CopyContState( SrcRotContinuousStateTypeData%BEMT, DstRotContinuousStateTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyConstrState( SrcConstrStateData%AA, DstConstrStateData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL AA_CopyContState( SrcRotContinuousStateTypeData%AA, DstRotContinuousStateTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE AD_CopyConstrState + END SUBROUTINE AD_CopyRotContinuousStateType - SUBROUTINE AD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) - TYPE(AD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + SUBROUTINE AD_DestroyRotContinuousStateType( RotContinuousStateTypeData, ErrStat, ErrMsg ) + TYPE(RotContinuousStateType), INTENT(INOUT) :: RotContinuousStateTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyConstrState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotContinuousStateType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_DestroyConstrState( ConstrStateData%BEMT, ErrStat, ErrMsg ) - CALL FVW_DestroyConstrState( ConstrStateData%FVW, ErrStat, ErrMsg ) - CALL AA_DestroyConstrState( ConstrStateData%AA, ErrStat, ErrMsg ) - END SUBROUTINE AD_DestroyConstrState + CALL BEMT_DestroyContState( RotContinuousStateTypeData%BEMT, ErrStat, ErrMsg ) + CALL AA_DestroyContState( RotContinuousStateTypeData%AA, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyRotContinuousStateType - SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotContinuousStateType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_ConstraintStateType), INTENT(IN) :: InData + TYPE(RotContinuousStateType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -4436,7 +4536,7 @@ SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackConstrState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotContinuousStateType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -4454,7 +4554,7 @@ SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = 0 ! Allocate buffers for subtypes, if any (we'll get sizes from these) Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL BEMT_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4470,25 +4570,8 @@ SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL AA_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4509,140 +4592,4459 @@ SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) RETURN - END IF + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL BEMT_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackRotContinuousStateType + + SUBROUTINE AD_UnPackRotContinuousStateType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotContinuousStateType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackRotContinuousStateType + + SUBROUTINE AD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(AD_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcContStateData%rotors)) THEN + i1_l = LBOUND(SrcContStateData%rotors,1) + i1_u = UBOUND(SrcContStateData%rotors,1) + IF (.NOT. ALLOCATED(DstContStateData%rotors)) THEN + ALLOCATE(DstContStateData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%rotors,1), UBOUND(SrcContStateData%rotors,1) + CALL AD_Copyrotcontinuousstatetype( SrcContStateData%rotors(i1), DstContStateData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL FVW_CopyContState( SrcContStateData%FVW, DstContStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyContState + + SUBROUTINE AD_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(AD_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ContStateData%rotors)) THEN +DO i1 = LBOUND(ContStateData%rotors,1), UBOUND(ContStateData%rotors,1) + CALL AD_Destroyrotcontinuousstatetype( ContStateData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%rotors) +ENDIF + CALL FVW_DestroyContState( ContStateData%FVW, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyContState + + SUBROUTINE AD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotcontinuousstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotcontinuousstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL FVW_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackContState + + SUBROUTINE AD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackrotcontinuousstatetype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FVW_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackContState + + SUBROUTINE AD_CopyRotDiscreteStateType( SrcRotDiscreteStateTypeData, DstRotDiscreteStateTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotDiscreteStateType), INTENT(IN) :: SrcRotDiscreteStateTypeData + TYPE(RotDiscreteStateType), INTENT(INOUT) :: DstRotDiscreteStateTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotDiscreteStateType' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_CopyDiscState( SrcRotDiscreteStateTypeData%BEMT, DstRotDiscreteStateTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyDiscState( SrcRotDiscreteStateTypeData%AA, DstRotDiscreteStateTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyRotDiscreteStateType + + SUBROUTINE AD_DestroyRotDiscreteStateType( RotDiscreteStateTypeData, ErrStat, ErrMsg ) + TYPE(RotDiscreteStateType), INTENT(INOUT) :: RotDiscreteStateTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotDiscreteStateType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_DestroyDiscState( RotDiscreteStateTypeData%BEMT, ErrStat, ErrMsg ) + CALL AA_DestroyDiscState( RotDiscreteStateTypeData%AA, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyRotDiscreteStateType + + SUBROUTINE AD_PackRotDiscreteStateType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(RotDiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotDiscreteStateType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype + CALL BEMT_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype + CALL AA_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL BEMT_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackRotDiscreteStateType + + SUBROUTINE AD_UnPackRotDiscreteStateType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotDiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotDiscreteStateType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackRotDiscreteStateType + + SUBROUTINE AD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(AD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcDiscStateData%rotors)) THEN + i1_l = LBOUND(SrcDiscStateData%rotors,1) + i1_u = UBOUND(SrcDiscStateData%rotors,1) + IF (.NOT. ALLOCATED(DstDiscStateData%rotors)) THEN + ALLOCATE(DstDiscStateData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%rotors,1), UBOUND(SrcDiscStateData%rotors,1) + CALL AD_Copyrotdiscretestatetype( SrcDiscStateData%rotors(i1), DstDiscStateData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL FVW_CopyDiscState( SrcDiscStateData%FVW, DstDiscStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyDiscState + + SUBROUTINE AD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(AD_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(DiscStateData%rotors)) THEN +DO i1 = LBOUND(DiscStateData%rotors,1), UBOUND(DiscStateData%rotors,1) + CALL AD_Destroyrotdiscretestatetype( DiscStateData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%rotors) +ENDIF + CALL FVW_DestroyDiscState( DiscStateData%FVW, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyDiscState + + SUBROUTINE AD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotdiscretestatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotdiscretestatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL FVW_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackDiscState + + SUBROUTINE AD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackrotdiscretestatetype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FVW_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackDiscState + + SUBROUTINE AD_CopyRotConstraintStateType( SrcRotConstraintStateTypeData, DstRotConstraintStateTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotConstraintStateType), INTENT(IN) :: SrcRotConstraintStateTypeData + TYPE(RotConstraintStateType), INTENT(INOUT) :: DstRotConstraintStateTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotConstraintStateType' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_CopyConstrState( SrcRotConstraintStateTypeData%BEMT, DstRotConstraintStateTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyConstrState( SrcRotConstraintStateTypeData%AA, DstRotConstraintStateTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyRotConstraintStateType + + SUBROUTINE AD_DestroyRotConstraintStateType( RotConstraintStateTypeData, ErrStat, ErrMsg ) + TYPE(RotConstraintStateType), INTENT(INOUT) :: RotConstraintStateTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotConstraintStateType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_DestroyConstrState( RotConstraintStateTypeData%BEMT, ErrStat, ErrMsg ) + CALL AA_DestroyConstrState( RotConstraintStateTypeData%AA, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyRotConstraintStateType + + SUBROUTINE AD_PackRotConstraintStateType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(RotConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotConstraintStateType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype + CALL BEMT_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype + CALL AA_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL BEMT_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackRotConstraintStateType + + SUBROUTINE AD_UnPackRotConstraintStateType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotConstraintStateType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackRotConstraintStateType + + SUBROUTINE AD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(AD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcConstrStateData%rotors)) THEN + i1_l = LBOUND(SrcConstrStateData%rotors,1) + i1_u = UBOUND(SrcConstrStateData%rotors,1) + IF (.NOT. ALLOCATED(DstConstrStateData%rotors)) THEN + ALLOCATE(DstConstrStateData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%rotors,1), UBOUND(SrcConstrStateData%rotors,1) + CALL AD_Copyrotconstraintstatetype( SrcConstrStateData%rotors(i1), DstConstrStateData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL FVW_CopyConstrState( SrcConstrStateData%FVW, DstConstrStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyConstrState + + SUBROUTINE AD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(AD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ConstrStateData%rotors)) THEN +DO i1 = LBOUND(ConstrStateData%rotors,1), UBOUND(ConstrStateData%rotors,1) + CALL AD_Destroyrotconstraintstatetype( ConstrStateData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%rotors) +ENDIF + CALL FVW_DestroyConstrState( ConstrStateData%FVW, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyConstrState + + SUBROUTINE AD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_ConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackConstrState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotconstraintstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotconstraintstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL FVW_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackConstrState + + SUBROUTINE AD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_ConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackConstrState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackrotconstraintstatetype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FVW_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackConstrState + + SUBROUTINE AD_CopyRotOtherStateType( SrcRotOtherStateTypeData, DstRotOtherStateTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotOtherStateType), INTENT(IN) :: SrcRotOtherStateTypeData + TYPE(RotOtherStateType), INTENT(INOUT) :: DstRotOtherStateTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotOtherStateType' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_CopyOtherState( SrcRotOtherStateTypeData%BEMT, DstRotOtherStateTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyOtherState( SrcRotOtherStateTypeData%AA, DstRotOtherStateTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyRotOtherStateType + + SUBROUTINE AD_DestroyRotOtherStateType( RotOtherStateTypeData, ErrStat, ErrMsg ) + TYPE(RotOtherStateType), INTENT(INOUT) :: RotOtherStateTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotOtherStateType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_DestroyOtherState( RotOtherStateTypeData%BEMT, ErrStat, ErrMsg ) + CALL AA_DestroyOtherState( RotOtherStateTypeData%AA, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyRotOtherStateType + + SUBROUTINE AD_PackRotOtherStateType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(RotOtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotOtherStateType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype + CALL BEMT_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype + CALL AA_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL BEMT_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AD_PackRotOtherStateType + + SUBROUTINE AD_UnPackRotOtherStateType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotOtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotOtherStateType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackRotOtherStateType + + SUBROUTINE AD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(AD_OtherStateType), INTENT(INOUT) :: DstOtherStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyOtherState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOtherStateData%rotors)) THEN + i1_l = LBOUND(SrcOtherStateData%rotors,1) + i1_u = UBOUND(SrcOtherStateData%rotors,1) + IF (.NOT. ALLOCATED(DstOtherStateData%rotors)) THEN + ALLOCATE(DstOtherStateData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%rotors,1), UBOUND(SrcOtherStateData%rotors,1) + CALL AD_Copyrototherstatetype( SrcOtherStateData%rotors(i1), DstOtherStateData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL FVW_CopyOtherState( SrcOtherStateData%FVW, DstOtherStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcOtherStateData%WakeLocationPoints)) THEN + i1_l = LBOUND(SrcOtherStateData%WakeLocationPoints,1) + i1_u = UBOUND(SrcOtherStateData%WakeLocationPoints,1) + i2_l = LBOUND(SrcOtherStateData%WakeLocationPoints,2) + i2_u = UBOUND(SrcOtherStateData%WakeLocationPoints,2) + IF (.NOT. ALLOCATED(DstOtherStateData%WakeLocationPoints)) THEN + ALLOCATE(DstOtherStateData%WakeLocationPoints(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%WakeLocationPoints.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOtherStateData%WakeLocationPoints = SrcOtherStateData%WakeLocationPoints +ENDIF + END SUBROUTINE AD_CopyOtherState + + SUBROUTINE AD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(AD_OtherStateType), INTENT(INOUT) :: OtherStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyOtherState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OtherStateData%rotors)) THEN +DO i1 = LBOUND(OtherStateData%rotors,1), UBOUND(OtherStateData%rotors,1) + CALL AD_Destroyrototherstatetype( OtherStateData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%rotors) +ENDIF + CALL FVW_DestroyOtherState( OtherStateData%FVW, ErrStat, ErrMsg ) +IF (ALLOCATED(OtherStateData%WakeLocationPoints)) THEN + DEALLOCATE(OtherStateData%WakeLocationPoints) +ENDIF + END SUBROUTINE AD_DestroyOtherState + + SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_OtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackOtherState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrototherstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! WakeLocationPoints allocated yes/no + IF ( ALLOCATED(InData%WakeLocationPoints) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! WakeLocationPoints upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WakeLocationPoints) ! WakeLocationPoints + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrototherstatetype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL FVW_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%WakeLocationPoints) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WakeLocationPoints,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WakeLocationPoints,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WakeLocationPoints,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WakeLocationPoints,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%WakeLocationPoints,2), UBOUND(InData%WakeLocationPoints,2) + DO i1 = LBOUND(InData%WakeLocationPoints,1), UBOUND(InData%WakeLocationPoints,1) + ReKiBuf(Re_Xferred) = InData%WakeLocationPoints(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AD_PackOtherState + + SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_OtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackOtherState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AD_Unpackrototherstatetype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FVW_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WakeLocationPoints not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WakeLocationPoints)) DEALLOCATE(OutData%WakeLocationPoints) + ALLOCATE(OutData%WakeLocationPoints(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WakeLocationPoints.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%WakeLocationPoints,2), UBOUND(OutData%WakeLocationPoints,2) + DO i1 = LBOUND(OutData%WakeLocationPoints,1), UBOUND(OutData%WakeLocationPoints,1) + OutData%WakeLocationPoints(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AD_UnPackOtherState + + SUBROUTINE AD_CopyRotMiscVarType( SrcRotMiscVarTypeData, DstRotMiscVarTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotMiscVarType), INTENT(INOUT) :: SrcRotMiscVarTypeData + TYPE(RotMiscVarType), INTENT(INOUT) :: DstRotMiscVarTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotMiscVarType' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_CopyMisc( SrcRotMiscVarTypeData%BEMT, DstRotMiscVarTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL BEMT_CopyOutput( SrcRotMiscVarTypeData%BEMT_y, DstRotMiscVarTypeData%BEMT_y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DO i1 = LBOUND(SrcRotMiscVarTypeData%BEMT_u,1), UBOUND(SrcRotMiscVarTypeData%BEMT_u,1) + CALL BEMT_CopyInput( SrcRotMiscVarTypeData%BEMT_u(i1), DstRotMiscVarTypeData%BEMT_u(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + CALL AA_CopyMisc( SrcRotMiscVarTypeData%AA, DstRotMiscVarTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyOutput( SrcRotMiscVarTypeData%AA_y, DstRotMiscVarTypeData%AA_y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyInput( SrcRotMiscVarTypeData%AA_u, DstRotMiscVarTypeData%AA_u, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcRotMiscVarTypeData%DisturbedInflow)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%DisturbedInflow,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%DisturbedInflow,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%DisturbedInflow,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%DisturbedInflow,2) + i3_l = LBOUND(SrcRotMiscVarTypeData%DisturbedInflow,3) + i3_u = UBOUND(SrcRotMiscVarTypeData%DisturbedInflow,3) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%DisturbedInflow)) THEN + ALLOCATE(DstRotMiscVarTypeData%DisturbedInflow(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%DisturbedInflow.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%DisturbedInflow = SrcRotMiscVarTypeData%DisturbedInflow +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%WithoutSweepPitchTwist)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,2) + i3_l = LBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,3) + i3_u = UBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,3) + i4_l = LBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,4) + i4_u = UBOUND(SrcRotMiscVarTypeData%WithoutSweepPitchTwist,4) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%WithoutSweepPitchTwist)) THEN + ALLOCATE(DstRotMiscVarTypeData%WithoutSweepPitchTwist(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%WithoutSweepPitchTwist.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%WithoutSweepPitchTwist = SrcRotMiscVarTypeData%WithoutSweepPitchTwist +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%AllOuts)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%AllOuts,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%AllOuts,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%AllOuts)) THEN + ALLOCATE(DstRotMiscVarTypeData%AllOuts(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%AllOuts.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%AllOuts = SrcRotMiscVarTypeData%AllOuts +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%W_Twr)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%W_Twr,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%W_Twr,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%W_Twr)) THEN + ALLOCATE(DstRotMiscVarTypeData%W_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%W_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%W_Twr = SrcRotMiscVarTypeData%W_Twr +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%X_Twr)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%X_Twr,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%X_Twr,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%X_Twr)) THEN + ALLOCATE(DstRotMiscVarTypeData%X_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%X_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%X_Twr = SrcRotMiscVarTypeData%X_Twr +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%Y_Twr)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%Y_Twr,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%Y_Twr,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%Y_Twr)) THEN + ALLOCATE(DstRotMiscVarTypeData%Y_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%Y_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%Y_Twr = SrcRotMiscVarTypeData%Y_Twr +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%Curve)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%Curve,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%Curve,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%Curve,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%Curve,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%Curve)) THEN + ALLOCATE(DstRotMiscVarTypeData%Curve(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%Curve.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%Curve = SrcRotMiscVarTypeData%Curve +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%TwrClrnc)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%TwrClrnc,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%TwrClrnc,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%TwrClrnc,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%TwrClrnc,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%TwrClrnc)) THEN + ALLOCATE(DstRotMiscVarTypeData%TwrClrnc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%TwrClrnc.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%TwrClrnc = SrcRotMiscVarTypeData%TwrClrnc +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%X)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%X,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%X,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%X,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%X,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%X)) THEN + ALLOCATE(DstRotMiscVarTypeData%X(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%X.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%X = SrcRotMiscVarTypeData%X +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%Y)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%Y,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%Y,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%Y,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%Y,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%Y)) THEN + ALLOCATE(DstRotMiscVarTypeData%Y(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%Y.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%Y = SrcRotMiscVarTypeData%Y +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%M)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%M,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%M,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%M,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%M,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%M)) THEN + ALLOCATE(DstRotMiscVarTypeData%M(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%M.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%M = SrcRotMiscVarTypeData%M +ENDIF + DstRotMiscVarTypeData%V_DiskAvg = SrcRotMiscVarTypeData%V_DiskAvg + DstRotMiscVarTypeData%hub_theta_x_root = SrcRotMiscVarTypeData%hub_theta_x_root + DstRotMiscVarTypeData%V_dot_x = SrcRotMiscVarTypeData%V_dot_x + CALL MeshCopy( SrcRotMiscVarTypeData%HubLoad, DstRotMiscVarTypeData%HubLoad, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcRotMiscVarTypeData%B_L_2_H_P)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%B_L_2_H_P,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%B_L_2_H_P,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%B_L_2_H_P)) THEN + ALLOCATE(DstRotMiscVarTypeData%B_L_2_H_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%B_L_2_H_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcRotMiscVarTypeData%B_L_2_H_P,1), UBOUND(SrcRotMiscVarTypeData%B_L_2_H_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcRotMiscVarTypeData%B_L_2_H_P(i1), DstRotMiscVarTypeData%B_L_2_H_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%SigmaCavitCrit)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%SigmaCavitCrit,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%SigmaCavitCrit,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%SigmaCavitCrit,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%SigmaCavitCrit,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%SigmaCavitCrit)) THEN + ALLOCATE(DstRotMiscVarTypeData%SigmaCavitCrit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%SigmaCavitCrit.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%SigmaCavitCrit = SrcRotMiscVarTypeData%SigmaCavitCrit +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%SigmaCavit)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%SigmaCavit,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%SigmaCavit,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%SigmaCavit,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%SigmaCavit,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%SigmaCavit)) THEN + ALLOCATE(DstRotMiscVarTypeData%SigmaCavit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%SigmaCavit.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%SigmaCavit = SrcRotMiscVarTypeData%SigmaCavit +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%CavitWarnSet)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%CavitWarnSet,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%CavitWarnSet,1) + i2_l = LBOUND(SrcRotMiscVarTypeData%CavitWarnSet,2) + i2_u = UBOUND(SrcRotMiscVarTypeData%CavitWarnSet,2) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%CavitWarnSet)) THEN + ALLOCATE(DstRotMiscVarTypeData%CavitWarnSet(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%CavitWarnSet.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRotMiscVarTypeData%CavitWarnSet = SrcRotMiscVarTypeData%CavitWarnSet +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%BladeRootLoad)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%BladeRootLoad,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%BladeRootLoad,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%BladeRootLoad)) THEN + ALLOCATE(DstRotMiscVarTypeData%BladeRootLoad(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%BladeRootLoad.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcRotMiscVarTypeData%BladeRootLoad,1), UBOUND(SrcRotMiscVarTypeData%BladeRootLoad,1) + CALL MeshCopy( SrcRotMiscVarTypeData%BladeRootLoad(i1), DstRotMiscVarTypeData%BladeRootLoad(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcRotMiscVarTypeData%B_L_2_R_P)) THEN + i1_l = LBOUND(SrcRotMiscVarTypeData%B_L_2_R_P,1) + i1_u = UBOUND(SrcRotMiscVarTypeData%B_L_2_R_P,1) + IF (.NOT. ALLOCATED(DstRotMiscVarTypeData%B_L_2_R_P)) THEN + ALLOCATE(DstRotMiscVarTypeData%B_L_2_R_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotMiscVarTypeData%B_L_2_R_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcRotMiscVarTypeData%B_L_2_R_P,1), UBOUND(SrcRotMiscVarTypeData%B_L_2_R_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcRotMiscVarTypeData%B_L_2_R_P(i1), DstRotMiscVarTypeData%B_L_2_R_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AD_CopyRotMiscVarType + + SUBROUTINE AD_DestroyRotMiscVarType( RotMiscVarTypeData, ErrStat, ErrMsg ) + TYPE(RotMiscVarType), INTENT(INOUT) :: RotMiscVarTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotMiscVarType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL BEMT_DestroyMisc( RotMiscVarTypeData%BEMT, ErrStat, ErrMsg ) + CALL BEMT_DestroyOutput( RotMiscVarTypeData%BEMT_y, ErrStat, ErrMsg ) +DO i1 = LBOUND(RotMiscVarTypeData%BEMT_u,1), UBOUND(RotMiscVarTypeData%BEMT_u,1) + CALL BEMT_DestroyInput( RotMiscVarTypeData%BEMT_u(i1), ErrStat, ErrMsg ) +ENDDO + CALL AA_DestroyMisc( RotMiscVarTypeData%AA, ErrStat, ErrMsg ) + CALL AA_DestroyOutput( RotMiscVarTypeData%AA_y, ErrStat, ErrMsg ) + CALL AA_DestroyInput( RotMiscVarTypeData%AA_u, ErrStat, ErrMsg ) +IF (ALLOCATED(RotMiscVarTypeData%DisturbedInflow)) THEN + DEALLOCATE(RotMiscVarTypeData%DisturbedInflow) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%WithoutSweepPitchTwist)) THEN + DEALLOCATE(RotMiscVarTypeData%WithoutSweepPitchTwist) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%AllOuts)) THEN + DEALLOCATE(RotMiscVarTypeData%AllOuts) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%W_Twr)) THEN + DEALLOCATE(RotMiscVarTypeData%W_Twr) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%X_Twr)) THEN + DEALLOCATE(RotMiscVarTypeData%X_Twr) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%Y_Twr)) THEN + DEALLOCATE(RotMiscVarTypeData%Y_Twr) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%Curve)) THEN + DEALLOCATE(RotMiscVarTypeData%Curve) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%TwrClrnc)) THEN + DEALLOCATE(RotMiscVarTypeData%TwrClrnc) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%X)) THEN + DEALLOCATE(RotMiscVarTypeData%X) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%Y)) THEN + DEALLOCATE(RotMiscVarTypeData%Y) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%M)) THEN + DEALLOCATE(RotMiscVarTypeData%M) +ENDIF + CALL MeshDestroy( RotMiscVarTypeData%HubLoad, ErrStat, ErrMsg ) +IF (ALLOCATED(RotMiscVarTypeData%B_L_2_H_P)) THEN +DO i1 = LBOUND(RotMiscVarTypeData%B_L_2_H_P,1), UBOUND(RotMiscVarTypeData%B_L_2_H_P,1) + CALL NWTC_Library_Destroymeshmaptype( RotMiscVarTypeData%B_L_2_H_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotMiscVarTypeData%B_L_2_H_P) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%SigmaCavitCrit)) THEN + DEALLOCATE(RotMiscVarTypeData%SigmaCavitCrit) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%SigmaCavit)) THEN + DEALLOCATE(RotMiscVarTypeData%SigmaCavit) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%CavitWarnSet)) THEN + DEALLOCATE(RotMiscVarTypeData%CavitWarnSet) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%BladeRootLoad)) THEN +DO i1 = LBOUND(RotMiscVarTypeData%BladeRootLoad,1), UBOUND(RotMiscVarTypeData%BladeRootLoad,1) + CALL MeshDestroy( RotMiscVarTypeData%BladeRootLoad(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotMiscVarTypeData%BladeRootLoad) +ENDIF +IF (ALLOCATED(RotMiscVarTypeData%B_L_2_R_P)) THEN +DO i1 = LBOUND(RotMiscVarTypeData%B_L_2_R_P,1), UBOUND(RotMiscVarTypeData%B_L_2_R_P,1) + CALL NWTC_Library_Destroymeshmaptype( RotMiscVarTypeData%B_L_2_R_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotMiscVarTypeData%B_L_2_R_P) +ENDIF + END SUBROUTINE AD_DestroyRotMiscVarType + + SUBROUTINE AD_PackRotMiscVarType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(RotMiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotMiscVarType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype + CALL BEMT_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! BEMT_y: size of buffers for each call to pack subtype + CALL BEMT_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_y, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT_y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT_y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT_y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + DO i1 = LBOUND(InData%BEMT_u,1), UBOUND(InData%BEMT_u,1) + Int_BufSz = Int_BufSz + 3 ! BEMT_u: size of buffers for each call to pack subtype + CALL BEMT_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_u(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BEMT_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BEMT_u + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BEMT_u + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BEMT_u + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype + CALL AA_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AA_y: size of buffers for each call to pack subtype + CALL AA_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%AA_y, ErrStat2, ErrMsg2, .TRUE. ) ! AA_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA_y + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA_y + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA_y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AA_u: size of buffers for each call to pack subtype + CALL AA_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%AA_u, ErrStat2, ErrMsg2, .TRUE. ) ! AA_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AA_u + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AA_u + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AA_u + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! DisturbedInflow allocated yes/no + IF ( ALLOCATED(InData%DisturbedInflow) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! DisturbedInflow upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%DisturbedInflow) ! DisturbedInflow + END IF + Int_BufSz = Int_BufSz + 1 ! WithoutSweepPitchTwist allocated yes/no + IF ( ALLOCATED(InData%WithoutSweepPitchTwist) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! WithoutSweepPitchTwist upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WithoutSweepPitchTwist) ! WithoutSweepPitchTwist + END IF + Int_BufSz = Int_BufSz + 1 ! AllOuts allocated yes/no + IF ( ALLOCATED(InData%AllOuts) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AllOuts upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AllOuts) ! AllOuts + END IF + Int_BufSz = Int_BufSz + 1 ! W_Twr allocated yes/no + IF ( ALLOCATED(InData%W_Twr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! W_Twr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%W_Twr) ! W_Twr + END IF + Int_BufSz = Int_BufSz + 1 ! X_Twr allocated yes/no + IF ( ALLOCATED(InData%X_Twr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! X_Twr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%X_Twr) ! X_Twr + END IF + Int_BufSz = Int_BufSz + 1 ! Y_Twr allocated yes/no + IF ( ALLOCATED(InData%Y_Twr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Y_Twr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Y_Twr) ! Y_Twr + END IF + Int_BufSz = Int_BufSz + 1 ! Curve allocated yes/no + IF ( ALLOCATED(InData%Curve) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Curve upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Curve) ! Curve + END IF + Int_BufSz = Int_BufSz + 1 ! TwrClrnc allocated yes/no + IF ( ALLOCATED(InData%TwrClrnc) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! TwrClrnc upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrClrnc) ! TwrClrnc + END IF + Int_BufSz = Int_BufSz + 1 ! X allocated yes/no + IF ( ALLOCATED(InData%X) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! X upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%X) ! X + END IF + Int_BufSz = Int_BufSz + 1 ! Y allocated yes/no + IF ( ALLOCATED(InData%Y) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Y upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Y) ! Y + END IF + Int_BufSz = Int_BufSz + 1 ! M allocated yes/no + IF ( ALLOCATED(InData%M) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! M upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%M) ! M + END IF + Re_BufSz = Re_BufSz + SIZE(InData%V_DiskAvg) ! V_DiskAvg + Re_BufSz = Re_BufSz + SIZE(InData%hub_theta_x_root) ! hub_theta_x_root + Re_BufSz = Re_BufSz + 1 ! V_dot_x + Int_BufSz = Int_BufSz + 3 ! HubLoad: size of buffers for each call to pack subtype + CALL MeshPack( InData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! HubLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! HubLoad + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! HubLoad + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! HubLoad + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! B_L_2_H_P allocated yes/no + IF ( ALLOCATED(InData%B_L_2_H_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! B_L_2_H_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%B_L_2_H_P,1), UBOUND(InData%B_L_2_H_P,1) + Int_BufSz = Int_BufSz + 3 ! B_L_2_H_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_H_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! B_L_2_H_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! B_L_2_H_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! B_L_2_H_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! B_L_2_H_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SigmaCavitCrit allocated yes/no + IF ( ALLOCATED(InData%SigmaCavitCrit) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! SigmaCavitCrit upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%SigmaCavitCrit) ! SigmaCavitCrit + END IF + Int_BufSz = Int_BufSz + 1 ! SigmaCavit allocated yes/no + IF ( ALLOCATED(InData%SigmaCavit) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! SigmaCavit upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%SigmaCavit) ! SigmaCavit + END IF + Int_BufSz = Int_BufSz + 1 ! CavitWarnSet allocated yes/no + IF ( ALLOCATED(InData%CavitWarnSet) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! CavitWarnSet upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%CavitWarnSet) ! CavitWarnSet + END IF + Int_BufSz = Int_BufSz + 1 ! BladeRootLoad allocated yes/no + IF ( ALLOCATED(InData%BladeRootLoad) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeRootLoad upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BladeRootLoad,1), UBOUND(InData%BladeRootLoad,1) + Int_BufSz = Int_BufSz + 3 ! BladeRootLoad: size of buffers for each call to pack subtype + CALL MeshPack( InData%BladeRootLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeRootLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BladeRootLoad + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BladeRootLoad + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BladeRootLoad + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! B_L_2_R_P allocated yes/no + IF ( ALLOCATED(InData%B_L_2_R_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! B_L_2_R_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%B_L_2_R_P,1), UBOUND(InData%B_L_2_R_P,1) + Int_BufSz = Int_BufSz + 3 ! B_L_2_R_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_R_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! B_L_2_R_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! B_L_2_R_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! B_L_2_R_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! B_L_2_R_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL BEMT_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL BEMT_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_y, ErrStat2, ErrMsg2, OnlySize ) ! BEMT_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + DO i1 = LBOUND(InData%BEMT_u,1), UBOUND(InData%BEMT_u,1) + CALL BEMT_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_u(i1), ErrStat2, ErrMsg2, OnlySize ) ! BEMT_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + CALL AA_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%AA_y, ErrStat2, ErrMsg2, OnlySize ) ! AA_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL AA_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%AA_u, ErrStat2, ErrMsg2, OnlySize ) ! AA_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%DisturbedInflow) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%DisturbedInflow,3), UBOUND(InData%DisturbedInflow,3) + DO i2 = LBOUND(InData%DisturbedInflow,2), UBOUND(InData%DisturbedInflow,2) + DO i1 = LBOUND(InData%DisturbedInflow,1), UBOUND(InData%DisturbedInflow,1) + ReKiBuf(Re_Xferred) = InData%DisturbedInflow(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WithoutSweepPitchTwist) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%WithoutSweepPitchTwist,4), UBOUND(InData%WithoutSweepPitchTwist,4) + DO i3 = LBOUND(InData%WithoutSweepPitchTwist,3), UBOUND(InData%WithoutSweepPitchTwist,3) + DO i2 = LBOUND(InData%WithoutSweepPitchTwist,2), UBOUND(InData%WithoutSweepPitchTwist,2) + DO i1 = LBOUND(InData%WithoutSweepPitchTwist,1), UBOUND(InData%WithoutSweepPitchTwist,1) + ReKiBuf(Re_Xferred) = InData%WithoutSweepPitchTwist(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%AllOuts) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AllOuts,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AllOuts,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AllOuts,1), UBOUND(InData%AllOuts,1) + ReKiBuf(Re_Xferred) = InData%AllOuts(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%W_Twr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%W_Twr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%W_Twr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%W_Twr,1), UBOUND(InData%W_Twr,1) + ReKiBuf(Re_Xferred) = InData%W_Twr(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%X_Twr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X_Twr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X_Twr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%X_Twr,1), UBOUND(InData%X_Twr,1) + ReKiBuf(Re_Xferred) = InData%X_Twr(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Y_Twr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y_Twr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y_Twr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Y_Twr,1), UBOUND(InData%Y_Twr,1) + ReKiBuf(Re_Xferred) = InData%Y_Twr(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Curve) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Curve,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Curve,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Curve,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Curve,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Curve,2), UBOUND(InData%Curve,2) + DO i1 = LBOUND(InData%Curve,1), UBOUND(InData%Curve,1) + ReKiBuf(Re_Xferred) = InData%Curve(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrClrnc) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrClrnc,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrClrnc,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrClrnc,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrClrnc,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%TwrClrnc,2), UBOUND(InData%TwrClrnc,2) + DO i1 = LBOUND(InData%TwrClrnc,1), UBOUND(InData%TwrClrnc,1) + ReKiBuf(Re_Xferred) = InData%TwrClrnc(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%X) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%X,2), UBOUND(InData%X,2) + DO i1 = LBOUND(InData%X,1), UBOUND(InData%X,1) + ReKiBuf(Re_Xferred) = InData%X(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Y) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Y,2), UBOUND(InData%Y,2) + DO i1 = LBOUND(InData%Y,1), UBOUND(InData%Y,1) + ReKiBuf(Re_Xferred) = InData%Y(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%M) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%M,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%M,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%M,2), UBOUND(InData%M,2) + DO i1 = LBOUND(InData%M,1), UBOUND(InData%M,1) + ReKiBuf(Re_Xferred) = InData%M(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + DO i1 = LBOUND(InData%V_DiskAvg,1), UBOUND(InData%V_DiskAvg,1) + ReKiBuf(Re_Xferred) = InData%V_DiskAvg(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%hub_theta_x_root,1), UBOUND(InData%hub_theta_x_root,1) + ReKiBuf(Re_Xferred) = InData%hub_theta_x_root(i1) + Re_Xferred = Re_Xferred + 1 + END DO + ReKiBuf(Re_Xferred) = InData%V_dot_x + Re_Xferred = Re_Xferred + 1 + CALL MeshPack( InData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! HubLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%B_L_2_H_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%B_L_2_H_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%B_L_2_H_P,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%B_L_2_H_P,1), UBOUND(InData%B_L_2_H_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_H_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! B_L_2_H_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SigmaCavitCrit) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavitCrit,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavitCrit,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavitCrit,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavitCrit,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%SigmaCavitCrit,2), UBOUND(InData%SigmaCavitCrit,2) + DO i1 = LBOUND(InData%SigmaCavitCrit,1), UBOUND(InData%SigmaCavitCrit,1) + ReKiBuf(Re_Xferred) = InData%SigmaCavitCrit(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SigmaCavit) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavit,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavit,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavit,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavit,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%SigmaCavit,2), UBOUND(InData%SigmaCavit,2) + DO i1 = LBOUND(InData%SigmaCavit,1), UBOUND(InData%SigmaCavit,1) + ReKiBuf(Re_Xferred) = InData%SigmaCavit(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CavitWarnSet) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CavitWarnSet,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CavitWarnSet,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CavitWarnSet,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CavitWarnSet,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%CavitWarnSet,2), UBOUND(InData%CavitWarnSet,2) + DO i1 = LBOUND(InData%CavitWarnSet,1), UBOUND(InData%CavitWarnSet,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitWarnSet(i1,i2), IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BladeRootLoad) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootLoad,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootLoad,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BladeRootLoad,1), UBOUND(InData%BladeRootLoad,1) + CALL MeshPack( InData%BladeRootLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeRootLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%B_L_2_R_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%B_L_2_R_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%B_L_2_R_P,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%B_L_2_R_P,1), UBOUND(InData%B_L_2_R_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_R_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! B_L_2_R_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE AD_PackRotMiscVarType + + SUBROUTINE AD_UnPackRotMiscVarType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotMiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotMiscVarType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT_y, ErrStat2, ErrMsg2 ) ! BEMT_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + i1_l = LBOUND(OutData%BEMT_u,1) + i1_u = UBOUND(OutData%BEMT_u,1) + DO i1 = LBOUND(OutData%BEMT_u,1), UBOUND(OutData%BEMT_u,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL BEMT_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT_u(i1), ErrStat2, ErrMsg2 ) ! BEMT_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%AA_y, ErrStat2, ErrMsg2 ) ! AA_y + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AA_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%AA_u, ErrStat2, ErrMsg2 ) ! AA_u + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! DisturbedInflow not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%DisturbedInflow)) DEALLOCATE(OutData%DisturbedInflow) + ALLOCATE(OutData%DisturbedInflow(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%DisturbedInflow.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%DisturbedInflow,3), UBOUND(OutData%DisturbedInflow,3) + DO i2 = LBOUND(OutData%DisturbedInflow,2), UBOUND(OutData%DisturbedInflow,2) + DO i1 = LBOUND(OutData%DisturbedInflow,1), UBOUND(OutData%DisturbedInflow,1) + OutData%DisturbedInflow(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WithoutSweepPitchTwist not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WithoutSweepPitchTwist)) DEALLOCATE(OutData%WithoutSweepPitchTwist) + ALLOCATE(OutData%WithoutSweepPitchTwist(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WithoutSweepPitchTwist.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%WithoutSweepPitchTwist,4), UBOUND(OutData%WithoutSweepPitchTwist,4) + DO i3 = LBOUND(OutData%WithoutSweepPitchTwist,3), UBOUND(OutData%WithoutSweepPitchTwist,3) + DO i2 = LBOUND(OutData%WithoutSweepPitchTwist,2), UBOUND(OutData%WithoutSweepPitchTwist,2) + DO i1 = LBOUND(OutData%WithoutSweepPitchTwist,1), UBOUND(OutData%WithoutSweepPitchTwist,1) + OutData%WithoutSweepPitchTwist(i1,i2,i3,i4) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AllOuts not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AllOuts)) DEALLOCATE(OutData%AllOuts) + ALLOCATE(OutData%AllOuts(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AllOuts.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AllOuts,1), UBOUND(OutData%AllOuts,1) + OutData%AllOuts(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! W_Twr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%W_Twr)) DEALLOCATE(OutData%W_Twr) + ALLOCATE(OutData%W_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%W_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%W_Twr,1), UBOUND(OutData%W_Twr,1) + OutData%W_Twr(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X_Twr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%X_Twr)) DEALLOCATE(OutData%X_Twr) + ALLOCATE(OutData%X_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%X_Twr,1), UBOUND(OutData%X_Twr,1) + OutData%X_Twr(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y_Twr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Y_Twr)) DEALLOCATE(OutData%Y_Twr) + ALLOCATE(OutData%Y_Twr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y_Twr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Y_Twr,1), UBOUND(OutData%Y_Twr,1) + OutData%Y_Twr(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Curve not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Curve)) DEALLOCATE(OutData%Curve) + ALLOCATE(OutData%Curve(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Curve.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Curve,2), UBOUND(OutData%Curve,2) + DO i1 = LBOUND(OutData%Curve,1), UBOUND(OutData%Curve,1) + OutData%Curve(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrClrnc not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrClrnc)) DEALLOCATE(OutData%TwrClrnc) + ALLOCATE(OutData%TwrClrnc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrClrnc.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%TwrClrnc,2), UBOUND(OutData%TwrClrnc,2) + DO i1 = LBOUND(OutData%TwrClrnc,1), UBOUND(OutData%TwrClrnc,1) + OutData%TwrClrnc(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%X)) DEALLOCATE(OutData%X) + ALLOCATE(OutData%X(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%X,2), UBOUND(OutData%X,2) + DO i1 = LBOUND(OutData%X,1), UBOUND(OutData%X,1) + OutData%X(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Y)) DEALLOCATE(OutData%Y) + ALLOCATE(OutData%Y(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y.', ErrStat, ErrMsg,RoutineName) RETURN - END IF + END IF + DO i2 = LBOUND(OutData%Y,2), UBOUND(OutData%Y,2) + DO i1 = LBOUND(OutData%Y,1), UBOUND(OutData%Y,1) + OutData%Y(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! M not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%M)) DEALLOCATE(OutData%M) + ALLOCATE(OutData%M(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%M.', ErrStat, ErrMsg,RoutineName) RETURN - END IF + END IF + DO i2 = LBOUND(OutData%M,2), UBOUND(OutData%M,2) + DO i1 = LBOUND(OutData%M,1), UBOUND(OutData%M,1) + OutData%M(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - CALL BEMT_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL FVW_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL AA_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + i1_l = LBOUND(OutData%V_DiskAvg,1) + i1_u = UBOUND(OutData%V_DiskAvg,1) + DO i1 = LBOUND(OutData%V_DiskAvg,1), UBOUND(OutData%V_DiskAvg,1) + OutData%V_DiskAvg(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%hub_theta_x_root,1) + i1_u = UBOUND(OutData%hub_theta_x_root,1) + DO i1 = LBOUND(OutData%hub_theta_x_root,1), UBOUND(OutData%hub_theta_x_root,1) + OutData%hub_theta_x_root(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%V_dot_x = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! HubLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE AD_PackConstrState - - SUBROUTINE AD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_ConstraintStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackConstrState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! B_L_2_H_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%B_L_2_H_P)) DEALLOCATE(OutData%B_L_2_H_P) + ALLOCATE(OutData%B_L_2_H_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%B_L_2_H_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%B_L_2_H_P,1), UBOUND(OutData%B_L_2_H_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4676,13 +9078,98 @@ SUBROUTINE AD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%B_L_2_H_P(i1), ErrStat2, ErrMsg2 ) ! B_L_2_H_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SigmaCavitCrit not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SigmaCavitCrit)) DEALLOCATE(OutData%SigmaCavitCrit) + ALLOCATE(OutData%SigmaCavitCrit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SigmaCavitCrit.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%SigmaCavitCrit,2), UBOUND(OutData%SigmaCavitCrit,2) + DO i1 = LBOUND(OutData%SigmaCavitCrit,1), UBOUND(OutData%SigmaCavitCrit,1) + OutData%SigmaCavitCrit(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SigmaCavit not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SigmaCavit)) DEALLOCATE(OutData%SigmaCavit) + ALLOCATE(OutData%SigmaCavit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SigmaCavit.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%SigmaCavit,2), UBOUND(OutData%SigmaCavit,2) + DO i1 = LBOUND(OutData%SigmaCavit,1), UBOUND(OutData%SigmaCavit,1) + OutData%SigmaCavit(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CavitWarnSet not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CavitWarnSet)) DEALLOCATE(OutData%CavitWarnSet) + ALLOCATE(OutData%CavitWarnSet(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CavitWarnSet.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%CavitWarnSet,2), UBOUND(OutData%CavitWarnSet,2) + DO i1 = LBOUND(OutData%CavitWarnSet,1), UBOUND(OutData%CavitWarnSet,1) + OutData%CavitWarnSet(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitWarnSet(i1,i2)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootLoad not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootLoad)) DEALLOCATE(OutData%BladeRootLoad) + ALLOCATE(OutData%BladeRootLoad(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootLoad.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BladeRootLoad,1), UBOUND(OutData%BladeRootLoad,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4716,13 +9203,29 @@ SUBROUTINE AD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FVW_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL MeshUnpack( OutData%BladeRootLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeRootLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! B_L_2_R_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%B_L_2_R_P)) DEALLOCATE(OutData%B_L_2_R_P) + ALLOCATE(OutData%B_L_2_R_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%B_L_2_R_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%B_L_2_R_P,1), UBOUND(OutData%B_L_2_R_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4756,78 +9259,102 @@ SUBROUTINE AD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AA_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%B_L_2_R_P(i1), ErrStat2, ErrMsg2 ) ! B_L_2_R_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE AD_UnPackConstrState + END DO + END IF + END SUBROUTINE AD_UnPackRotMiscVarType - SUBROUTINE AD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_OtherStateType), INTENT(IN) :: SrcOtherStateData - TYPE(AD_OtherStateType), INTENT(INOUT) :: DstOtherStateData + SUBROUTINE AD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_MiscVarType), INTENT(INOUT) :: SrcMiscData + TYPE(AD_MiscVarType), INTENT(INOUT) :: DstMiscData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyOtherState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyMisc' ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_CopyOtherState( SrcOtherStateData%BEMT, DstOtherStateData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyOtherState( SrcOtherStateData%FVW, DstOtherStateData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcMiscData%rotors)) THEN + i1_l = LBOUND(SrcMiscData%rotors,1) + i1_u = UBOUND(SrcMiscData%rotors,1) + IF (.NOT. ALLOCATED(DstMiscData%rotors)) THEN + ALLOCATE(DstMiscData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%rotors,1), UBOUND(SrcMiscData%rotors,1) + CALL AD_Copyrotmiscvartype( SrcMiscData%rotors(i1), DstMiscData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcOtherStateData%WakeLocationPoints)) THEN - i1_l = LBOUND(SrcOtherStateData%WakeLocationPoints,1) - i1_u = UBOUND(SrcOtherStateData%WakeLocationPoints,1) - i2_l = LBOUND(SrcOtherStateData%WakeLocationPoints,2) - i2_u = UBOUND(SrcOtherStateData%WakeLocationPoints,2) - IF (.NOT. ALLOCATED(DstOtherStateData%WakeLocationPoints)) THEN - ALLOCATE(DstOtherStateData%WakeLocationPoints(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%FVW_u)) THEN + i1_l = LBOUND(SrcMiscData%FVW_u,1) + i1_u = UBOUND(SrcMiscData%FVW_u,1) + IF (.NOT. ALLOCATED(DstMiscData%FVW_u)) THEN + ALLOCATE(DstMiscData%FVW_u(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%WakeLocationPoints.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%FVW_u.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstOtherStateData%WakeLocationPoints = SrcOtherStateData%WakeLocationPoints + DO i1 = LBOUND(SrcMiscData%FVW_u,1), UBOUND(SrcMiscData%FVW_u,1) + CALL FVW_CopyInput( SrcMiscData%FVW_u(i1), DstMiscData%FVW_u(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF - CALL AA_CopyOtherState( SrcOtherStateData%AA, DstOtherStateData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL FVW_CopyOutput( SrcMiscData%FVW_y, DstMiscData%FVW_y, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE AD_CopyOtherState + CALL FVW_CopyMisc( SrcMiscData%FVW, DstMiscData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AD_CopyMisc - SUBROUTINE AD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) - TYPE(AD_OtherStateType), INTENT(INOUT) :: OtherStateData + SUBROUTINE AD_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(AD_MiscVarType), INTENT(INOUT) :: MiscData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyOtherState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyMisc' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_DestroyOtherState( OtherStateData%BEMT, ErrStat, ErrMsg ) - CALL FVW_DestroyOtherState( OtherStateData%FVW, ErrStat, ErrMsg ) -IF (ALLOCATED(OtherStateData%WakeLocationPoints)) THEN - DEALLOCATE(OtherStateData%WakeLocationPoints) +IF (ALLOCATED(MiscData%rotors)) THEN +DO i1 = LBOUND(MiscData%rotors,1), UBOUND(MiscData%rotors,1) + CALL AD_Destroyrotmiscvartype( MiscData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%rotors) ENDIF - CALL AA_DestroyOtherState( OtherStateData%AA, ErrStat, ErrMsg ) - END SUBROUTINE AD_DestroyOtherState +IF (ALLOCATED(MiscData%FVW_u)) THEN +DO i1 = LBOUND(MiscData%FVW_u,1), UBOUND(MiscData%FVW_u,1) + CALL FVW_DestroyInput( MiscData%FVW_u(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%FVW_u) +ENDIF + CALL FVW_DestroyOutput( MiscData%FVW_y, ErrStat, ErrMsg ) + CALL FVW_DestroyMisc( MiscData%FVW, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyMisc - SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_OtherStateType), INTENT(IN) :: InData + TYPE(AD_MiscVarType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -4842,7 +9369,7 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackOtherState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackMisc' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -4858,60 +9385,84 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotmiscvartype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BEMT + IF(ALLOCATED(Re_Buf)) THEN ! rotors Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT + IF(ALLOCATED(Db_Buf)) THEN ! rotors Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT + IF(ALLOCATED(Int_Buf)) THEN ! rotors Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! FVW_u allocated yes/no + IF ( ALLOCATED(InData%FVW_u) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! FVW_u upper/lower bounds for each dimension + DO i1 = LBOUND(InData%FVW_u,1), UBOUND(InData%FVW_u,1) + Int_BufSz = Int_BufSz + 3 ! FVW_u: size of buffers for each call to pack subtype + CALL FVW_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_u(i1), ErrStat2, ErrMsg2, .TRUE. ) ! FVW_u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! FVW + IF(ALLOCATED(Re_Buf)) THEN ! FVW_u Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW + IF(ALLOCATED(Db_Buf)) THEN ! FVW_u Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW + IF(ALLOCATED(Int_Buf)) THEN ! FVW_u Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! WakeLocationPoints allocated yes/no - IF ( ALLOCATED(InData%WakeLocationPoints) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! WakeLocationPoints upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%WakeLocationPoints) ! WakeLocationPoints + END DO END IF - Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + Int_BufSz = Int_BufSz + 3 ! FVW_y: size of buffers for each call to pack subtype + CALL FVW_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_y, ErrStat2, ErrMsg2, .TRUE. ) ! FVW_y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! AA + IF(ALLOCATED(Re_Buf)) THEN ! FVW_y Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA + IF(ALLOCATED(Db_Buf)) THEN ! FVW_y Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA + IF(ALLOCATED(Int_Buf)) THEN ! FVW_y + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF @@ -4942,7 +9493,59 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Db_Xferred = 1 Int_Xferred = 1 - CALL BEMT_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotmiscvartype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%FVW_u) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%FVW_u,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FVW_u,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%FVW_u,1), UBOUND(InData%FVW_u,1) + CALL FVW_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_u(i1), ErrStat2, ErrMsg2, OnlySize ) ! FVW_u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4970,7 +9573,9 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL FVW_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + END DO + END IF + CALL FVW_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_y, ErrStat2, ErrMsg2, OnlySize ) ! FVW_y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4998,27 +9603,7 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%WakeLocationPoints) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WakeLocationPoints,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WakeLocationPoints,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WakeLocationPoints,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WakeLocationPoints,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%WakeLocationPoints,2), UBOUND(InData%WakeLocationPoints,2) - DO i1 = LBOUND(InData%WakeLocationPoints,1), UBOUND(InData%WakeLocationPoints,1) - ReKiBuf(Re_Xferred) = InData%WakeLocationPoints(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - CALL AA_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL FVW_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5046,13 +9631,13 @@ SUBROUTINE AD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE AD_PackOtherState + END SUBROUTINE AD_PackMisc - SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_OtherStateType), INTENT(INOUT) :: OutData + TYPE(AD_MiscVarType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -5062,10 +9647,9 @@ SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackOtherState' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackMisc' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -5076,6 +9660,20 @@ SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -5109,13 +9707,29 @@ SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL AD_Unpackrotmiscvartype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! FVW_u not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%FVW_u)) DEALLOCATE(OutData%FVW_u) + ALLOCATE(OutData%FVW_u(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%FVW_u.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%FVW_u,1), UBOUND(OutData%FVW_u,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -5149,35 +9763,14 @@ SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FVW_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL FVW_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%FVW_u(i1), ErrStat2, ErrMsg2 ) ! FVW_u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WakeLocationPoints not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%WakeLocationPoints)) DEALLOCATE(OutData%WakeLocationPoints) - ALLOCATE(OutData%WakeLocationPoints(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WakeLocationPoints.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%WakeLocationPoints,2), UBOUND(OutData%WakeLocationPoints,2) - DO i1 = LBOUND(OutData%WakeLocationPoints,1), UBOUND(OutData%WakeLocationPoints,1) - OutData%WakeLocationPoints(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + END DO END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 @@ -5212,18 +9805,58 @@ SUBROUTINE AD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AA_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL FVW_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%FVW_y, ErrStat2, ErrMsg2 ) ! FVW_y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE AD_UnPackOtherState + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL FVW_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - SUBROUTINE AD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_MiscVarType), INTENT(INOUT) :: SrcMiscData - TYPE(AD_MiscVarType), INTENT(INOUT) :: DstMiscData + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AD_UnPackMisc + + SUBROUTINE AD_CopyRotParameterType( SrcRotParameterTypeData, DstRotParameterTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotParameterType), INTENT(IN) :: SrcRotParameterTypeData + TYPE(RotParameterType), INTENT(INOUT) :: DstRotParameterTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -5231,355 +9864,215 @@ SUBROUTINE AD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 - INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotParameterType' ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_CopyMisc( SrcMiscData%BEMT, DstMiscData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL BEMT_CopyOutput( SrcMiscData%BEMT_y, DstMiscData%BEMT_y, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - DO i1 = LBOUND(SrcMiscData%BEMT_u,1), UBOUND(SrcMiscData%BEMT_u,1) - CALL BEMT_CopyInput( SrcMiscData%BEMT_u(i1), DstMiscData%BEMT_u(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO - CALL FVW_CopyMisc( SrcMiscData%FVW, DstMiscData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyOutput( SrcMiscData%FVW_y, DstMiscData%FVW_y, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcMiscData%FVW_u)) THEN - i1_l = LBOUND(SrcMiscData%FVW_u,1) - i1_u = UBOUND(SrcMiscData%FVW_u,1) - IF (.NOT. ALLOCATED(DstMiscData%FVW_u)) THEN - ALLOCATE(DstMiscData%FVW_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%FVW_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DO i1 = LBOUND(SrcMiscData%FVW_u,1), UBOUND(SrcMiscData%FVW_u,1) - CALL FVW_CopyInput( SrcMiscData%FVW_u(i1), DstMiscData%FVW_u(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF - CALL AA_CopyMisc( SrcMiscData%AA, DstMiscData%AA, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyOutput( SrcMiscData%AA_y, DstMiscData%AA_y, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyInput( SrcMiscData%AA_u, DstMiscData%AA_u, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcMiscData%DisturbedInflow)) THEN - i1_l = LBOUND(SrcMiscData%DisturbedInflow,1) - i1_u = UBOUND(SrcMiscData%DisturbedInflow,1) - i2_l = LBOUND(SrcMiscData%DisturbedInflow,2) - i2_u = UBOUND(SrcMiscData%DisturbedInflow,2) - i3_l = LBOUND(SrcMiscData%DisturbedInflow,3) - i3_u = UBOUND(SrcMiscData%DisturbedInflow,3) - IF (.NOT. ALLOCATED(DstMiscData%DisturbedInflow)) THEN - ALLOCATE(DstMiscData%DisturbedInflow(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%DisturbedInflow.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%DisturbedInflow = SrcMiscData%DisturbedInflow -ENDIF -IF (ALLOCATED(SrcMiscData%WithoutSweepPitchTwist)) THEN - i1_l = LBOUND(SrcMiscData%WithoutSweepPitchTwist,1) - i1_u = UBOUND(SrcMiscData%WithoutSweepPitchTwist,1) - i2_l = LBOUND(SrcMiscData%WithoutSweepPitchTwist,2) - i2_u = UBOUND(SrcMiscData%WithoutSweepPitchTwist,2) - i3_l = LBOUND(SrcMiscData%WithoutSweepPitchTwist,3) - i3_u = UBOUND(SrcMiscData%WithoutSweepPitchTwist,3) - i4_l = LBOUND(SrcMiscData%WithoutSweepPitchTwist,4) - i4_u = UBOUND(SrcMiscData%WithoutSweepPitchTwist,4) - IF (.NOT. ALLOCATED(DstMiscData%WithoutSweepPitchTwist)) THEN - ALLOCATE(DstMiscData%WithoutSweepPitchTwist(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%WithoutSweepPitchTwist.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%WithoutSweepPitchTwist = SrcMiscData%WithoutSweepPitchTwist -ENDIF -IF (ALLOCATED(SrcMiscData%AllOuts)) THEN - i1_l = LBOUND(SrcMiscData%AllOuts,1) - i1_u = UBOUND(SrcMiscData%AllOuts,1) - IF (.NOT. ALLOCATED(DstMiscData%AllOuts)) THEN - ALLOCATE(DstMiscData%AllOuts(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%AllOuts.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%AllOuts = SrcMiscData%AllOuts -ENDIF -IF (ALLOCATED(SrcMiscData%W_Twr)) THEN - i1_l = LBOUND(SrcMiscData%W_Twr,1) - i1_u = UBOUND(SrcMiscData%W_Twr,1) - IF (.NOT. ALLOCATED(DstMiscData%W_Twr)) THEN - ALLOCATE(DstMiscData%W_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%W_Twr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%W_Twr = SrcMiscData%W_Twr -ENDIF -IF (ALLOCATED(SrcMiscData%X_Twr)) THEN - i1_l = LBOUND(SrcMiscData%X_Twr,1) - i1_u = UBOUND(SrcMiscData%X_Twr,1) - IF (.NOT. ALLOCATED(DstMiscData%X_Twr)) THEN - ALLOCATE(DstMiscData%X_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%X_Twr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%X_Twr = SrcMiscData%X_Twr -ENDIF -IF (ALLOCATED(SrcMiscData%Y_Twr)) THEN - i1_l = LBOUND(SrcMiscData%Y_Twr,1) - i1_u = UBOUND(SrcMiscData%Y_Twr,1) - IF (.NOT. ALLOCATED(DstMiscData%Y_Twr)) THEN - ALLOCATE(DstMiscData%Y_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Y_Twr.', ErrStat, ErrMsg,RoutineName) + DstRotParameterTypeData%NumBlades = SrcRotParameterTypeData%NumBlades + DstRotParameterTypeData%NumBlNds = SrcRotParameterTypeData%NumBlNds + DstRotParameterTypeData%NumTwrNds = SrcRotParameterTypeData%NumTwrNds +IF (ALLOCATED(SrcRotParameterTypeData%TwrDiam)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%TwrDiam,1) + i1_u = UBOUND(SrcRotParameterTypeData%TwrDiam,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%TwrDiam)) THEN + ALLOCATE(DstRotParameterTypeData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%TwrDiam.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%Y_Twr = SrcMiscData%Y_Twr + DstRotParameterTypeData%TwrDiam = SrcRotParameterTypeData%TwrDiam ENDIF -IF (ALLOCATED(SrcMiscData%Curve)) THEN - i1_l = LBOUND(SrcMiscData%Curve,1) - i1_u = UBOUND(SrcMiscData%Curve,1) - i2_l = LBOUND(SrcMiscData%Curve,2) - i2_u = UBOUND(SrcMiscData%Curve,2) - IF (.NOT. ALLOCATED(DstMiscData%Curve)) THEN - ALLOCATE(DstMiscData%Curve(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotParameterTypeData%TwrCd)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%TwrCd,1) + i1_u = UBOUND(SrcRotParameterTypeData%TwrCd,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%TwrCd)) THEN + ALLOCATE(DstRotParameterTypeData%TwrCd(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Curve.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%TwrCd.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%Curve = SrcMiscData%Curve + DstRotParameterTypeData%TwrCd = SrcRotParameterTypeData%TwrCd ENDIF -IF (ALLOCATED(SrcMiscData%TwrClrnc)) THEN - i1_l = LBOUND(SrcMiscData%TwrClrnc,1) - i1_u = UBOUND(SrcMiscData%TwrClrnc,1) - i2_l = LBOUND(SrcMiscData%TwrClrnc,2) - i2_u = UBOUND(SrcMiscData%TwrClrnc,2) - IF (.NOT. ALLOCATED(DstMiscData%TwrClrnc)) THEN - ALLOCATE(DstMiscData%TwrClrnc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotParameterTypeData%TwrTI)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%TwrTI,1) + i1_u = UBOUND(SrcRotParameterTypeData%TwrTI,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%TwrTI)) THEN + ALLOCATE(DstRotParameterTypeData%TwrTI(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TwrClrnc.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%TwrTI.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%TwrClrnc = SrcMiscData%TwrClrnc + DstRotParameterTypeData%TwrTI = SrcRotParameterTypeData%TwrTI ENDIF -IF (ALLOCATED(SrcMiscData%X)) THEN - i1_l = LBOUND(SrcMiscData%X,1) - i1_u = UBOUND(SrcMiscData%X,1) - i2_l = LBOUND(SrcMiscData%X,2) - i2_u = UBOUND(SrcMiscData%X,2) - IF (.NOT. ALLOCATED(DstMiscData%X)) THEN - ALLOCATE(DstMiscData%X(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%X.', ErrStat, ErrMsg,RoutineName) + CALL BEMT_CopyParam( SrcRotParameterTypeData%BEMT, DstRotParameterTypeData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL AA_CopyParam( SrcRotParameterTypeData%AA, DstRotParameterTypeData%AA, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcRotParameterTypeData%Jac_u_indx)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%Jac_u_indx,1) + i1_u = UBOUND(SrcRotParameterTypeData%Jac_u_indx,1) + i2_l = LBOUND(SrcRotParameterTypeData%Jac_u_indx,2) + i2_u = UBOUND(SrcRotParameterTypeData%Jac_u_indx,2) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%Jac_u_indx)) THEN + ALLOCATE(DstRotParameterTypeData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%X = SrcMiscData%X + DstRotParameterTypeData%Jac_u_indx = SrcRotParameterTypeData%Jac_u_indx ENDIF -IF (ALLOCATED(SrcMiscData%Y)) THEN - i1_l = LBOUND(SrcMiscData%Y,1) - i1_u = UBOUND(SrcMiscData%Y,1) - i2_l = LBOUND(SrcMiscData%Y,2) - i2_u = UBOUND(SrcMiscData%Y,2) - IF (.NOT. ALLOCATED(DstMiscData%Y)) THEN - ALLOCATE(DstMiscData%Y(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotParameterTypeData%du)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%du,1) + i1_u = UBOUND(SrcRotParameterTypeData%du,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%du)) THEN + ALLOCATE(DstRotParameterTypeData%du(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Y.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%du.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%Y = SrcMiscData%Y + DstRotParameterTypeData%du = SrcRotParameterTypeData%du ENDIF -IF (ALLOCATED(SrcMiscData%M)) THEN - i1_l = LBOUND(SrcMiscData%M,1) - i1_u = UBOUND(SrcMiscData%M,1) - i2_l = LBOUND(SrcMiscData%M,2) - i2_u = UBOUND(SrcMiscData%M,2) - IF (.NOT. ALLOCATED(DstMiscData%M)) THEN - ALLOCATE(DstMiscData%M(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotParameterTypeData%dx)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%dx,1) + i1_u = UBOUND(SrcRotParameterTypeData%dx,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%dx)) THEN + ALLOCATE(DstRotParameterTypeData%dx(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%M.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%dx.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%M = SrcMiscData%M -ENDIF - DstMiscData%V_DiskAvg = SrcMiscData%V_DiskAvg - DstMiscData%hub_theta_x_root = SrcMiscData%hub_theta_x_root - DstMiscData%V_dot_x = SrcMiscData%V_dot_x - CALL MeshCopy( SrcMiscData%HubLoad, DstMiscData%HubLoad, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcMiscData%B_L_2_H_P)) THEN - i1_l = LBOUND(SrcMiscData%B_L_2_H_P,1) - i1_u = UBOUND(SrcMiscData%B_L_2_H_P,1) - IF (.NOT. ALLOCATED(DstMiscData%B_L_2_H_P)) THEN - ALLOCATE(DstMiscData%B_L_2_H_P(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%B_L_2_H_P.', ErrStat, ErrMsg,RoutineName) + DstRotParameterTypeData%dx = SrcRotParameterTypeData%dx +ENDIF + DstRotParameterTypeData%Jac_ny = SrcRotParameterTypeData%Jac_ny + DstRotParameterTypeData%TwrPotent = SrcRotParameterTypeData%TwrPotent + DstRotParameterTypeData%TwrShadow = SrcRotParameterTypeData%TwrShadow + DstRotParameterTypeData%TwrAero = SrcRotParameterTypeData%TwrAero + DstRotParameterTypeData%FrozenWake = SrcRotParameterTypeData%FrozenWake + DstRotParameterTypeData%CavitCheck = SrcRotParameterTypeData%CavitCheck + DstRotParameterTypeData%CompAA = SrcRotParameterTypeData%CompAA + DstRotParameterTypeData%AirDens = SrcRotParameterTypeData%AirDens + DstRotParameterTypeData%KinVisc = SrcRotParameterTypeData%KinVisc + DstRotParameterTypeData%SpdSound = SrcRotParameterTypeData%SpdSound + DstRotParameterTypeData%Gravity = SrcRotParameterTypeData%Gravity + DstRotParameterTypeData%Patm = SrcRotParameterTypeData%Patm + DstRotParameterTypeData%Pvap = SrcRotParameterTypeData%Pvap + DstRotParameterTypeData%FluidDepth = SrcRotParameterTypeData%FluidDepth + DstRotParameterTypeData%NumOuts = SrcRotParameterTypeData%NumOuts + DstRotParameterTypeData%RootName = SrcRotParameterTypeData%RootName +IF (ALLOCATED(SrcRotParameterTypeData%OutParam)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%OutParam,1) + i1_u = UBOUND(SrcRotParameterTypeData%OutParam,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%OutParam)) THEN + ALLOCATE(DstRotParameterTypeData%OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%OutParam.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcMiscData%B_L_2_H_P,1), UBOUND(SrcMiscData%B_L_2_H_P,1) - CALL NWTC_Library_Copymeshmaptype( SrcMiscData%B_L_2_H_P(i1), DstMiscData%B_L_2_H_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcRotParameterTypeData%OutParam,1), UBOUND(SrcRotParameterTypeData%OutParam,1) + CALL NWTC_Library_Copyoutparmtype( SrcRotParameterTypeData%OutParam(i1), DstRotParameterTypeData%OutParam(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%SigmaCavitCrit)) THEN - i1_l = LBOUND(SrcMiscData%SigmaCavitCrit,1) - i1_u = UBOUND(SrcMiscData%SigmaCavitCrit,1) - i2_l = LBOUND(SrcMiscData%SigmaCavitCrit,2) - i2_u = UBOUND(SrcMiscData%SigmaCavitCrit,2) - IF (.NOT. ALLOCATED(DstMiscData%SigmaCavitCrit)) THEN - ALLOCATE(DstMiscData%SigmaCavitCrit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%SigmaCavitCrit.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstMiscData%SigmaCavitCrit = SrcMiscData%SigmaCavitCrit -ENDIF -IF (ALLOCATED(SrcMiscData%SigmaCavit)) THEN - i1_l = LBOUND(SrcMiscData%SigmaCavit,1) - i1_u = UBOUND(SrcMiscData%SigmaCavit,1) - i2_l = LBOUND(SrcMiscData%SigmaCavit,2) - i2_u = UBOUND(SrcMiscData%SigmaCavit,2) - IF (.NOT. ALLOCATED(DstMiscData%SigmaCavit)) THEN - ALLOCATE(DstMiscData%SigmaCavit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%SigmaCavit.', ErrStat, ErrMsg,RoutineName) + DstRotParameterTypeData%NBlOuts = SrcRotParameterTypeData%NBlOuts + DstRotParameterTypeData%BlOutNd = SrcRotParameterTypeData%BlOutNd + DstRotParameterTypeData%NTwOuts = SrcRotParameterTypeData%NTwOuts + DstRotParameterTypeData%TwOutNd = SrcRotParameterTypeData%TwOutNd + DstRotParameterTypeData%BldNd_NumOuts = SrcRotParameterTypeData%BldNd_NumOuts + DstRotParameterTypeData%BldNd_TotNumOuts = SrcRotParameterTypeData%BldNd_TotNumOuts +IF (ALLOCATED(SrcRotParameterTypeData%BldNd_OutParam)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%BldNd_OutParam,1) + i1_u = UBOUND(SrcRotParameterTypeData%BldNd_OutParam,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%BldNd_OutParam)) THEN + ALLOCATE(DstRotParameterTypeData%BldNd_OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%BldNd_OutParam.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%SigmaCavit = SrcMiscData%SigmaCavit + DO i1 = LBOUND(SrcRotParameterTypeData%BldNd_OutParam,1), UBOUND(SrcRotParameterTypeData%BldNd_OutParam,1) + CALL NWTC_Library_Copyoutparmtype( SrcRotParameterTypeData%BldNd_OutParam(i1), DstRotParameterTypeData%BldNd_OutParam(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%CavitWarnSet)) THEN - i1_l = LBOUND(SrcMiscData%CavitWarnSet,1) - i1_u = UBOUND(SrcMiscData%CavitWarnSet,1) - i2_l = LBOUND(SrcMiscData%CavitWarnSet,2) - i2_u = UBOUND(SrcMiscData%CavitWarnSet,2) - IF (.NOT. ALLOCATED(DstMiscData%CavitWarnSet)) THEN - ALLOCATE(DstMiscData%CavitWarnSet(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotParameterTypeData%BldNd_BlOutNd)) THEN + i1_l = LBOUND(SrcRotParameterTypeData%BldNd_BlOutNd,1) + i1_u = UBOUND(SrcRotParameterTypeData%BldNd_BlOutNd,1) + IF (.NOT. ALLOCATED(DstRotParameterTypeData%BldNd_BlOutNd)) THEN + ALLOCATE(DstRotParameterTypeData%BldNd_BlOutNd(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%CavitWarnSet.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotParameterTypeData%BldNd_BlOutNd.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%CavitWarnSet = SrcMiscData%CavitWarnSet + DstRotParameterTypeData%BldNd_BlOutNd = SrcRotParameterTypeData%BldNd_BlOutNd ENDIF - END SUBROUTINE AD_CopyMisc + DstRotParameterTypeData%BldNd_BladesOut = SrcRotParameterTypeData%BldNd_BladesOut + END SUBROUTINE AD_CopyRotParameterType - SUBROUTINE AD_DestroyMisc( MiscData, ErrStat, ErrMsg ) - TYPE(AD_MiscVarType), INTENT(INOUT) :: MiscData + SUBROUTINE AD_DestroyRotParameterType( RotParameterTypeData, ErrStat, ErrMsg ) + TYPE(RotParameterType), INTENT(INOUT) :: RotParameterTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotParameterType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL BEMT_DestroyMisc( MiscData%BEMT, ErrStat, ErrMsg ) - CALL BEMT_DestroyOutput( MiscData%BEMT_y, ErrStat, ErrMsg ) -DO i1 = LBOUND(MiscData%BEMT_u,1), UBOUND(MiscData%BEMT_u,1) - CALL BEMT_DestroyInput( MiscData%BEMT_u(i1), ErrStat, ErrMsg ) -ENDDO - CALL FVW_DestroyMisc( MiscData%FVW, ErrStat, ErrMsg ) - CALL FVW_DestroyOutput( MiscData%FVW_y, ErrStat, ErrMsg ) -IF (ALLOCATED(MiscData%FVW_u)) THEN -DO i1 = LBOUND(MiscData%FVW_u,1), UBOUND(MiscData%FVW_u,1) - CALL FVW_DestroyInput( MiscData%FVW_u(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(MiscData%FVW_u) -ENDIF - CALL AA_DestroyMisc( MiscData%AA, ErrStat, ErrMsg ) - CALL AA_DestroyOutput( MiscData%AA_y, ErrStat, ErrMsg ) - CALL AA_DestroyInput( MiscData%AA_u, ErrStat, ErrMsg ) -IF (ALLOCATED(MiscData%DisturbedInflow)) THEN - DEALLOCATE(MiscData%DisturbedInflow) -ENDIF -IF (ALLOCATED(MiscData%WithoutSweepPitchTwist)) THEN - DEALLOCATE(MiscData%WithoutSweepPitchTwist) -ENDIF -IF (ALLOCATED(MiscData%AllOuts)) THEN - DEALLOCATE(MiscData%AllOuts) -ENDIF -IF (ALLOCATED(MiscData%W_Twr)) THEN - DEALLOCATE(MiscData%W_Twr) -ENDIF -IF (ALLOCATED(MiscData%X_Twr)) THEN - DEALLOCATE(MiscData%X_Twr) -ENDIF -IF (ALLOCATED(MiscData%Y_Twr)) THEN - DEALLOCATE(MiscData%Y_Twr) +IF (ALLOCATED(RotParameterTypeData%TwrDiam)) THEN + DEALLOCATE(RotParameterTypeData%TwrDiam) ENDIF -IF (ALLOCATED(MiscData%Curve)) THEN - DEALLOCATE(MiscData%Curve) +IF (ALLOCATED(RotParameterTypeData%TwrCd)) THEN + DEALLOCATE(RotParameterTypeData%TwrCd) ENDIF -IF (ALLOCATED(MiscData%TwrClrnc)) THEN - DEALLOCATE(MiscData%TwrClrnc) +IF (ALLOCATED(RotParameterTypeData%TwrTI)) THEN + DEALLOCATE(RotParameterTypeData%TwrTI) ENDIF -IF (ALLOCATED(MiscData%X)) THEN - DEALLOCATE(MiscData%X) + CALL BEMT_DestroyParam( RotParameterTypeData%BEMT, ErrStat, ErrMsg ) + CALL AA_DestroyParam( RotParameterTypeData%AA, ErrStat, ErrMsg ) +IF (ALLOCATED(RotParameterTypeData%Jac_u_indx)) THEN + DEALLOCATE(RotParameterTypeData%Jac_u_indx) ENDIF -IF (ALLOCATED(MiscData%Y)) THEN - DEALLOCATE(MiscData%Y) +IF (ALLOCATED(RotParameterTypeData%du)) THEN + DEALLOCATE(RotParameterTypeData%du) ENDIF -IF (ALLOCATED(MiscData%M)) THEN - DEALLOCATE(MiscData%M) +IF (ALLOCATED(RotParameterTypeData%dx)) THEN + DEALLOCATE(RotParameterTypeData%dx) ENDIF - CALL MeshDestroy( MiscData%HubLoad, ErrStat, ErrMsg ) -IF (ALLOCATED(MiscData%B_L_2_H_P)) THEN -DO i1 = LBOUND(MiscData%B_L_2_H_P,1), UBOUND(MiscData%B_L_2_H_P,1) - CALL NWTC_Library_Destroymeshmaptype( MiscData%B_L_2_H_P(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(RotParameterTypeData%OutParam)) THEN +DO i1 = LBOUND(RotParameterTypeData%OutParam,1), UBOUND(RotParameterTypeData%OutParam,1) + CALL NWTC_Library_Destroyoutparmtype( RotParameterTypeData%OutParam(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(MiscData%B_L_2_H_P) + DEALLOCATE(RotParameterTypeData%OutParam) ENDIF -IF (ALLOCATED(MiscData%SigmaCavitCrit)) THEN - DEALLOCATE(MiscData%SigmaCavitCrit) -ENDIF -IF (ALLOCATED(MiscData%SigmaCavit)) THEN - DEALLOCATE(MiscData%SigmaCavit) +IF (ALLOCATED(RotParameterTypeData%BldNd_OutParam)) THEN +DO i1 = LBOUND(RotParameterTypeData%BldNd_OutParam,1), UBOUND(RotParameterTypeData%BldNd_OutParam,1) + CALL NWTC_Library_Destroyoutparmtype( RotParameterTypeData%BldNd_OutParam(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(RotParameterTypeData%BldNd_OutParam) ENDIF -IF (ALLOCATED(MiscData%CavitWarnSet)) THEN - DEALLOCATE(MiscData%CavitWarnSet) +IF (ALLOCATED(RotParameterTypeData%BldNd_BlOutNd)) THEN + DEALLOCATE(RotParameterTypeData%BldNd_BlOutNd) ENDIF - END SUBROUTINE AD_DestroyMisc + END SUBROUTINE AD_DestroyRotParameterType - SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotParameterType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_MiscVarType), INTENT(IN) :: InData + TYPE(RotParameterType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -5594,7 +10087,7 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotParameterType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -5610,9 +10103,27 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! NumBlades + Int_BufSz = Int_BufSz + 1 ! NumBlNds + Int_BufSz = Int_BufSz + 1 ! NumTwrNds + Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no + IF ( ALLOCATED(InData%TwrDiam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam + END IF + Int_BufSz = Int_BufSz + 1 ! TwrCd allocated yes/no + IF ( ALLOCATED(InData%TwrCd) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrCd upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrCd) ! TwrCd + END IF + Int_BufSz = Int_BufSz + 1 ! TwrTI allocated yes/no + IF ( ALLOCATED(InData%TwrTI) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TwrTI upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TwrTI) ! TwrTI + END IF ! Allocate buffers for subtypes, if any (we'll get sizes from these) Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + CALL BEMT_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5628,101 +10139,8 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! BEMT_y: size of buffers for each call to pack subtype - CALL BEMT_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_y, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT_y - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BEMT_y - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT_y - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT_y - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - DO i1 = LBOUND(InData%BEMT_u,1), UBOUND(InData%BEMT_u,1) - Int_BufSz = Int_BufSz + 3 ! BEMT_u: size of buffers for each call to pack subtype - CALL BEMT_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_u(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BEMT_u - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! BEMT_u - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT_u - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT_u - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - END DO - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! FVW_y: size of buffers for each call to pack subtype - CALL FVW_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_y, ErrStat2, ErrMsg2, .TRUE. ) ! FVW_y - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW_y - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW_y - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW_y - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 1 ! FVW_u allocated yes/no - IF ( ALLOCATED(InData%FVW_u) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! FVW_u upper/lower bounds for each dimension - DO i1 = LBOUND(InData%FVW_u,1), UBOUND(InData%FVW_u,1) - Int_BufSz = Int_BufSz + 3 ! FVW_u: size of buffers for each call to pack subtype - CALL FVW_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_u(i1), ErrStat2, ErrMsg2, .TRUE. ) ! FVW_u - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! FVW_u - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW_u - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW_u - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - END DO - END IF Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + CALL AA_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5738,153 +10156,95 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! AA_y: size of buffers for each call to pack subtype - CALL AA_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%AA_y, ErrStat2, ErrMsg2, .TRUE. ) ! AA_y - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! AA_y - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA_y - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA_y - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! AA_u: size of buffers for each call to pack subtype - CALL AA_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%AA_u, ErrStat2, ErrMsg2, .TRUE. ) ! AA_u - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! AA_u - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA_u - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA_u - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 1 ! DisturbedInflow allocated yes/no - IF ( ALLOCATED(InData%DisturbedInflow) ) THEN - Int_BufSz = Int_BufSz + 2*3 ! DisturbedInflow upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%DisturbedInflow) ! DisturbedInflow - END IF - Int_BufSz = Int_BufSz + 1 ! WithoutSweepPitchTwist allocated yes/no - IF ( ALLOCATED(InData%WithoutSweepPitchTwist) ) THEN - Int_BufSz = Int_BufSz + 2*4 ! WithoutSweepPitchTwist upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%WithoutSweepPitchTwist) ! WithoutSweepPitchTwist - END IF - Int_BufSz = Int_BufSz + 1 ! AllOuts allocated yes/no - IF ( ALLOCATED(InData%AllOuts) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! AllOuts upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%AllOuts) ! AllOuts - END IF - Int_BufSz = Int_BufSz + 1 ! W_Twr allocated yes/no - IF ( ALLOCATED(InData%W_Twr) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! W_Twr upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%W_Twr) ! W_Twr - END IF - Int_BufSz = Int_BufSz + 1 ! X_Twr allocated yes/no - IF ( ALLOCATED(InData%X_Twr) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! X_Twr upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%X_Twr) ! X_Twr - END IF - Int_BufSz = Int_BufSz + 1 ! Y_Twr allocated yes/no - IF ( ALLOCATED(InData%Y_Twr) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! Y_Twr upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%Y_Twr) ! Y_Twr - END IF - Int_BufSz = Int_BufSz + 1 ! Curve allocated yes/no - IF ( ALLOCATED(InData%Curve) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! Curve upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%Curve) ! Curve - END IF - Int_BufSz = Int_BufSz + 1 ! TwrClrnc allocated yes/no - IF ( ALLOCATED(InData%TwrClrnc) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! TwrClrnc upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrClrnc) ! TwrClrnc - END IF - Int_BufSz = Int_BufSz + 1 ! X allocated yes/no - IF ( ALLOCATED(InData%X) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! X upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%X) ! X + Int_BufSz = Int_BufSz + 1 ! Jac_u_indx allocated yes/no + IF ( ALLOCATED(InData%Jac_u_indx) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Jac_u_indx upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%Jac_u_indx) ! Jac_u_indx END IF - Int_BufSz = Int_BufSz + 1 ! Y allocated yes/no - IF ( ALLOCATED(InData%Y) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! Y upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%Y) ! Y + Int_BufSz = Int_BufSz + 1 ! du allocated yes/no + IF ( ALLOCATED(InData%du) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! du upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%du) ! du END IF - Int_BufSz = Int_BufSz + 1 ! M allocated yes/no - IF ( ALLOCATED(InData%M) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! M upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%M) ! M + Int_BufSz = Int_BufSz + 1 ! dx allocated yes/no + IF ( ALLOCATED(InData%dx) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dx upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dx) ! dx END IF - Re_BufSz = Re_BufSz + SIZE(InData%V_DiskAvg) ! V_DiskAvg - Re_BufSz = Re_BufSz + SIZE(InData%hub_theta_x_root) ! hub_theta_x_root - Re_BufSz = Re_BufSz + 1 ! V_dot_x - Int_BufSz = Int_BufSz + 3 ! HubLoad: size of buffers for each call to pack subtype - CALL MeshPack( InData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! HubLoad + Int_BufSz = Int_BufSz + 1 ! Jac_ny + Int_BufSz = Int_BufSz + 1 ! TwrPotent + Int_BufSz = Int_BufSz + 1 ! TwrShadow + Int_BufSz = Int_BufSz + 1 ! TwrAero + Int_BufSz = Int_BufSz + 1 ! FrozenWake + Int_BufSz = Int_BufSz + 1 ! CavitCheck + Int_BufSz = Int_BufSz + 1 ! CompAA + Re_BufSz = Re_BufSz + 1 ! AirDens + Re_BufSz = Re_BufSz + 1 ! KinVisc + Re_BufSz = Re_BufSz + 1 ! SpdSound + Re_BufSz = Re_BufSz + 1 ! Gravity + Re_BufSz = Re_BufSz + 1 ! Patm + Re_BufSz = Re_BufSz + 1 ! Pvap + Re_BufSz = Re_BufSz + 1 ! FluidDepth + Int_BufSz = Int_BufSz + 1 ! NumOuts + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Int_BufSz = Int_BufSz + 1 ! OutParam allocated yes/no + IF ( ALLOCATED(InData%OutParam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutParam upper/lower bounds for each dimension + DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) + Int_BufSz = Int_BufSz + 3 ! OutParam: size of buffers for each call to pack subtype + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, .TRUE. ) ! OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! HubLoad + IF(ALLOCATED(Re_Buf)) THEN ! OutParam Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! HubLoad + IF(ALLOCATED(Db_Buf)) THEN ! OutParam Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! HubLoad + IF(ALLOCATED(Int_Buf)) THEN ! OutParam Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! B_L_2_H_P allocated yes/no - IF ( ALLOCATED(InData%B_L_2_H_P) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! B_L_2_H_P upper/lower bounds for each dimension - DO i1 = LBOUND(InData%B_L_2_H_P,1), UBOUND(InData%B_L_2_H_P,1) - Int_BufSz = Int_BufSz + 3 ! B_L_2_H_P: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_H_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! B_L_2_H_P + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NBlOuts + Int_BufSz = Int_BufSz + SIZE(InData%BlOutNd) ! BlOutNd + Int_BufSz = Int_BufSz + 1 ! NTwOuts + Int_BufSz = Int_BufSz + SIZE(InData%TwOutNd) ! TwOutNd + Int_BufSz = Int_BufSz + 1 ! BldNd_NumOuts + Int_BufSz = Int_BufSz + 1 ! BldNd_TotNumOuts + Int_BufSz = Int_BufSz + 1 ! BldNd_OutParam allocated yes/no + IF ( ALLOCATED(InData%BldNd_OutParam) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BldNd_OutParam upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BldNd_OutParam,1), UBOUND(InData%BldNd_OutParam,1) + Int_BufSz = Int_BufSz + 3 ! BldNd_OutParam: size of buffers for each call to pack subtype + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%BldNd_OutParam(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BldNd_OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! B_L_2_H_P + IF(ALLOCATED(Re_Buf)) THEN ! BldNd_OutParam Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! B_L_2_H_P + IF(ALLOCATED(Db_Buf)) THEN ! BldNd_OutParam Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! B_L_2_H_P + IF(ALLOCATED(Int_Buf)) THEN ! BldNd_OutParam Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SigmaCavitCrit allocated yes/no - IF ( ALLOCATED(InData%SigmaCavitCrit) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! SigmaCavitCrit upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SigmaCavitCrit) ! SigmaCavitCrit - END IF - Int_BufSz = Int_BufSz + 1 ! SigmaCavit allocated yes/no - IF ( ALLOCATED(InData%SigmaCavit) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! SigmaCavit upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SigmaCavit) ! SigmaCavit - END IF - Int_BufSz = Int_BufSz + 1 ! CavitWarnSet allocated yes/no - IF ( ALLOCATED(InData%CavitWarnSet) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! CavitWarnSet upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%CavitWarnSet) ! CavitWarnSet + Int_BufSz = Int_BufSz + 1 ! BldNd_BlOutNd allocated yes/no + IF ( ALLOCATED(InData%BldNd_BlOutNd) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BldNd_BlOutNd upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%BldNd_BlOutNd) ! BldNd_BlOutNd END IF + Int_BufSz = Int_BufSz + 1 ! BldNd_BladesOut IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -5912,218 +10272,58 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Db_Xferred = 1 Int_Xferred = 1 - CALL BEMT_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL BEMT_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_y, ErrStat2, ErrMsg2, OnlySize ) ! BEMT_y - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - DO i1 = LBOUND(InData%BEMT_u,1), UBOUND(InData%BEMT_u,1) - CALL BEMT_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BEMT_u(i1), ErrStat2, ErrMsg2, OnlySize ) ! BEMT_u - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO - CALL FVW_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL FVW_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_y, ErrStat2, ErrMsg2, OnlySize ) ! FVW_y - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF ( .NOT. ALLOCATED(InData%FVW_u) ) THEN + IntKiBuf(Int_Xferred) = InData%NumBlades + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumBlNds + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumTwrNds + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%FVW_u,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FVW_u,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%FVW_u,1), UBOUND(InData%FVW_u,1) - CALL FVW_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%FVW_u(i1), ErrStat2, ErrMsg2, OnlySize ) ! FVW_u - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO + DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) + ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) + Re_Xferred = Re_Xferred + 1 + END DO END IF - CALL AA_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + IF ( .NOT. ALLOCATED(InData%TwrCd) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrCd,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrCd,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL AA_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%AA_y, ErrStat2, ErrMsg2, OnlySize ) ! AA_y + DO i1 = LBOUND(InData%TwrCd,1), UBOUND(InData%TwrCd,1) + ReKiBuf(Re_Xferred) = InData%TwrCd(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TwrTI) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrTI,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrTI,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TwrTI,1), UBOUND(InData%TwrTI,1) + ReKiBuf(Re_Xferred) = InData%TwrTI(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + CALL BEMT_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6151,7 +10351,7 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL AA_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%AA_u, ErrStat2, ErrMsg2, OnlySize ) ! AA_u + CALL AA_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6179,232 +10379,102 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%DisturbedInflow) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,2) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%DisturbedInflow,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%DisturbedInflow,3) - Int_Xferred = Int_Xferred + 2 - - DO i3 = LBOUND(InData%DisturbedInflow,3), UBOUND(InData%DisturbedInflow,3) - DO i2 = LBOUND(InData%DisturbedInflow,2), UBOUND(InData%DisturbedInflow,2) - DO i1 = LBOUND(InData%DisturbedInflow,1), UBOUND(InData%DisturbedInflow,1) - ReKiBuf(Re_Xferred) = InData%DisturbedInflow(i1,i2,i3) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%WithoutSweepPitchTwist) ) THEN + IF ( .NOT. ALLOCATED(InData%Jac_u_indx) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,2) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,3) + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WithoutSweepPitchTwist,4) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WithoutSweepPitchTwist,4) + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,2) Int_Xferred = Int_Xferred + 2 - DO i4 = LBOUND(InData%WithoutSweepPitchTwist,4), UBOUND(InData%WithoutSweepPitchTwist,4) - DO i3 = LBOUND(InData%WithoutSweepPitchTwist,3), UBOUND(InData%WithoutSweepPitchTwist,3) - DO i2 = LBOUND(InData%WithoutSweepPitchTwist,2), UBOUND(InData%WithoutSweepPitchTwist,2) - DO i1 = LBOUND(InData%WithoutSweepPitchTwist,1), UBOUND(InData%WithoutSweepPitchTwist,1) - ReKiBuf(Re_Xferred) = InData%WithoutSweepPitchTwist(i1,i2,i3,i4) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i2 = LBOUND(InData%Jac_u_indx,2), UBOUND(InData%Jac_u_indx,2) + DO i1 = LBOUND(InData%Jac_u_indx,1), UBOUND(InData%Jac_u_indx,1) + IntKiBuf(Int_Xferred) = InData%Jac_u_indx(i1,i2) + Int_Xferred = Int_Xferred + 1 END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%AllOuts) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AllOuts,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AllOuts,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%AllOuts,1), UBOUND(InData%AllOuts,1) - ReKiBuf(Re_Xferred) = InData%AllOuts(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%W_Twr) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%W_Twr,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%W_Twr,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%W_Twr,1), UBOUND(InData%W_Twr,1) - ReKiBuf(Re_Xferred) = InData%W_Twr(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%X_Twr) ) THEN + IF ( .NOT. ALLOCATED(InData%du) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%X_Twr,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X_Twr,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%du,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%du,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%X_Twr,1), UBOUND(InData%X_Twr,1) - ReKiBuf(Re_Xferred) = InData%X_Twr(i1) + DO i1 = LBOUND(InData%du,1), UBOUND(InData%du,1) + ReKiBuf(Re_Xferred) = InData%du(i1) Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%Y_Twr) ) THEN + IF ( .NOT. ALLOCATED(InData%dx) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Y_Twr,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y_Twr,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%dx,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dx,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%Y_Twr,1), UBOUND(InData%Y_Twr,1) - ReKiBuf(Re_Xferred) = InData%Y_Twr(i1) + DO i1 = LBOUND(InData%dx,1), UBOUND(InData%dx,1) + ReKiBuf(Re_Xferred) = InData%dx(i1) Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%Curve) ) THEN - IntKiBuf( Int_Xferred ) = 0 + IntKiBuf(Int_Xferred) = InData%Jac_ny Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + IntKiBuf(Int_Xferred) = InData%TwrPotent Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Curve,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Curve,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Curve,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Curve,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%Curve,2), UBOUND(InData%Curve,2) - DO i1 = LBOUND(InData%Curve,1), UBOUND(InData%Curve,1) - ReKiBuf(Re_Xferred) = InData%Curve(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrClrnc) ) THEN - IntKiBuf( Int_Xferred ) = 0 + IntKiBuf(Int_Xferred) = InData%TwrShadow Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%TwrAero, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrClrnc,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrClrnc,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrClrnc,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrClrnc,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%TwrClrnc,2), UBOUND(InData%TwrClrnc,2) - DO i1 = LBOUND(InData%TwrClrnc,1), UBOUND(InData%TwrClrnc,1) - ReKiBuf(Re_Xferred) = InData%TwrClrnc(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%X) ) THEN - IntKiBuf( Int_Xferred ) = 0 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FrozenWake, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitCheck, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%X,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%X,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%X,2), UBOUND(InData%X,2) - DO i1 = LBOUND(InData%X,1), UBOUND(InData%X,1) - ReKiBuf(Re_Xferred) = InData%X(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%Y) ) THEN - IntKiBuf( Int_Xferred ) = 0 + IntKiBuf(Int_Xferred) = TRANSFER(InData%CompAA, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + ReKiBuf(Re_Xferred) = InData%AirDens + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%KinVisc + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%SpdSound + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Gravity + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Patm + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Pvap + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%FluidDepth + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumOuts Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Y,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Y,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%Y,2), UBOUND(InData%Y,2) - DO i1 = LBOUND(InData%Y,1), UBOUND(InData%Y,1) - ReKiBuf(Re_Xferred) = InData%Y(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%M) ) THEN + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%OutParam) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%M,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%M,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutParam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutParam,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%M,2), UBOUND(InData%M,2) - DO i1 = LBOUND(InData%M,1), UBOUND(InData%M,1) - ReKiBuf(Re_Xferred) = InData%M(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - DO i1 = LBOUND(InData%V_DiskAvg,1), UBOUND(InData%V_DiskAvg,1) - ReKiBuf(Re_Xferred) = InData%V_DiskAvg(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%hub_theta_x_root,1), UBOUND(InData%hub_theta_x_root,1) - ReKiBuf(Re_Xferred) = InData%hub_theta_x_root(i1) - Re_Xferred = Re_Xferred + 1 - END DO - ReKiBuf(Re_Xferred) = InData%V_dot_x - Re_Xferred = Re_Xferred + 1 - CALL MeshPack( InData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! HubLoad + DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6432,18 +10502,36 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%B_L_2_H_P) ) THEN + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NBlOuts + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%BlOutNd,1), UBOUND(InData%BlOutNd,1) + IntKiBuf(Int_Xferred) = InData%BlOutNd(i1) + Int_Xferred = Int_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%NTwOuts + Int_Xferred = Int_Xferred + 1 + DO i1 = LBOUND(InData%TwOutNd,1), UBOUND(InData%TwOutNd,1) + IntKiBuf(Int_Xferred) = InData%TwOutNd(i1) + Int_Xferred = Int_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%BldNd_NumOuts + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%BldNd_TotNumOuts + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BldNd_OutParam) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%B_L_2_H_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%B_L_2_H_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_OutParam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_OutParam,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%B_L_2_H_P,1), UBOUND(InData%B_L_2_H_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%B_L_2_H_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! B_L_2_H_P + DO i1 = LBOUND(InData%BldNd_OutParam,1), UBOUND(InData%BldNd_OutParam,1) + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%BldNd_OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! BldNd_OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6473,73 +10561,30 @@ SUBROUTINE AD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SigmaCavitCrit) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavitCrit,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavitCrit,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavitCrit,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavitCrit,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%SigmaCavitCrit,2), UBOUND(InData%SigmaCavitCrit,2) - DO i1 = LBOUND(InData%SigmaCavitCrit,1), UBOUND(InData%SigmaCavitCrit,1) - ReKiBuf(Re_Xferred) = InData%SigmaCavitCrit(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%SigmaCavit) ) THEN + IF ( .NOT. ALLOCATED(InData%BldNd_BlOutNd) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavit,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavit,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SigmaCavit,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SigmaCavit,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_BlOutNd,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_BlOutNd,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%SigmaCavit,2), UBOUND(InData%SigmaCavit,2) - DO i1 = LBOUND(InData%SigmaCavit,1), UBOUND(InData%SigmaCavit,1) - ReKiBuf(Re_Xferred) = InData%SigmaCavit(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO + DO i1 = LBOUND(InData%BldNd_BlOutNd,1), UBOUND(InData%BldNd_BlOutNd,1) + IntKiBuf(Int_Xferred) = InData%BldNd_BlOutNd(i1) + Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%CavitWarnSet) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 + IntKiBuf(Int_Xferred) = InData%BldNd_BladesOut Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%CavitWarnSet,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CavitWarnSet,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%CavitWarnSet,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CavitWarnSet,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%CavitWarnSet,2), UBOUND(InData%CavitWarnSet,2) - DO i1 = LBOUND(InData%CavitWarnSet,1), UBOUND(InData%CavitWarnSet,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitWarnSet(i1,i2), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE AD_PackMisc + END SUBROUTINE AD_PackRotParameterType - SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackRotParameterType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_MiscVarType), INTENT(INOUT) :: OutData + TYPE(RotParameterType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -6550,11 +10595,9 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 - INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotParameterType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -6565,6 +10608,66 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + OutData%NumBlades = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumBlNds = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumTwrNds = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) + ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) + OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrCd not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrCd)) DEALLOCATE(OutData%TwrCd) + ALLOCATE(OutData%TwrCd(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrCd.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrCd,1), UBOUND(OutData%TwrCd,1) + OutData%TwrCd(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrTI not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TwrTI)) DEALLOCATE(OutData%TwrTI) + ALLOCATE(OutData%TwrTI(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrTI.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TwrTI,1), UBOUND(OutData%TwrTI,1) + OutData%TwrTI(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6598,7 +10701,7 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL BEMT_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6638,16 +10741,120 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT_y, ErrStat2, ErrMsg2 ) ! BEMT_y + CALL AA_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - i1_l = LBOUND(OutData%BEMT_u,1) - i1_u = UBOUND(OutData%BEMT_u,1) - DO i1 = LBOUND(OutData%BEMT_u,1), UBOUND(OutData%BEMT_u,1) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jac_u_indx not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Jac_u_indx)) DEALLOCATE(OutData%Jac_u_indx) + ALLOCATE(OutData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Jac_u_indx,2), UBOUND(OutData%Jac_u_indx,2) + DO i1 = LBOUND(OutData%Jac_u_indx,1), UBOUND(OutData%Jac_u_indx,1) + OutData%Jac_u_indx(i1,i2) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! du not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%du)) DEALLOCATE(OutData%du) + ALLOCATE(OutData%du(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%du.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%du,1), UBOUND(OutData%du,1) + OutData%du(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dx not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dx)) DEALLOCATE(OutData%dx) + ALLOCATE(OutData%dx(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dx.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dx,1), UBOUND(OutData%dx,1) + OutData%dx(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%Jac_ny = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrPotent = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrShadow = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%TwrAero = TRANSFER(IntKiBuf(Int_Xferred), OutData%TwrAero) + Int_Xferred = Int_Xferred + 1 + OutData%FrozenWake = TRANSFER(IntKiBuf(Int_Xferred), OutData%FrozenWake) + Int_Xferred = Int_Xferred + 1 + OutData%CavitCheck = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitCheck) + Int_Xferred = Int_Xferred + 1 + OutData%CompAA = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompAA) + Int_Xferred = Int_Xferred + 1 + OutData%AirDens = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%KinVisc = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%SpdSound = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Gravity = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Patm = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Pvap = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%FluidDepth = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%NumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutParam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutParam)) DEALLOCATE(OutData%OutParam) + ALLOCATE(OutData%OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutParam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutParam,1), UBOUND(OutData%OutParam,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6681,7 +10888,7 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT_u(i1), ErrStat2, ErrMsg2 ) ! BEMT_u + CALL NWTC_Library_Unpackoutparmtype( Re_Buf, Db_Buf, Int_Buf, OutData%OutParam(i1), ErrStat2, ErrMsg2 ) ! OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6689,6 +10896,41 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO + END IF + OutData%NBlOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%BlOutNd,1) + i1_u = UBOUND(OutData%BlOutNd,1) + DO i1 = LBOUND(OutData%BlOutNd,1), UBOUND(OutData%BlOutNd,1) + OutData%BlOutNd(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + OutData%NTwOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + i1_l = LBOUND(OutData%TwOutNd,1) + i1_u = UBOUND(OutData%TwOutNd,1) + DO i1 = LBOUND(OutData%TwOutNd,1), UBOUND(OutData%TwOutNd,1) + OutData%TwOutNd(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + OutData%BldNd_NumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%BldNd_TotNumOuts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_OutParam not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BldNd_OutParam)) DEALLOCATE(OutData%BldNd_OutParam) + ALLOCATE(OutData%BldNd_OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_OutParam.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BldNd_OutParam,1), UBOUND(OutData%BldNd_OutParam,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6722,189 +10964,406 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FVW_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL NWTC_Library_Unpackoutparmtype( Re_Buf, Db_Buf, Int_Buf, OutData%BldNd_OutParam(i1), ErrStat2, ErrMsg2 ) ! BldNd_OutParam CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_BlOutNd not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BldNd_BlOutNd)) DEALLOCATE(OutData%BldNd_BlOutNd) + ALLOCATE(OutData%BldNd_BlOutNd(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_BlOutNd.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BldNd_BlOutNd,1), UBOUND(OutData%BldNd_BlOutNd,1) + OutData%BldNd_BlOutNd(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + OutData%BldNd_BladesOut = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE AD_UnPackRotParameterType + + SUBROUTINE AD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_ParameterType), INTENT(IN) :: SrcParamData + TYPE(AD_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcParamData%rotors)) THEN + i1_l = LBOUND(SrcParamData%rotors,1) + i1_u = UBOUND(SrcParamData%rotors,1) + IF (.NOT. ALLOCATED(DstParamData%rotors)) THEN + ALLOCATE(DstParamData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%rotors,1), UBOUND(SrcParamData%rotors,1) + CALL AD_Copyrotparametertype( SrcParamData%rotors(i1), DstParamData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + DstParamData%RootName = SrcParamData%RootName +IF (ALLOCATED(SrcParamData%AFI)) THEN + i1_l = LBOUND(SrcParamData%AFI,1) + i1_u = UBOUND(SrcParamData%AFI,1) + IF (.NOT. ALLOCATED(DstParamData%AFI)) THEN + ALLOCATE(DstParamData%AFI(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%AFI.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%AFI,1), UBOUND(SrcParamData%AFI,1) + CALL AFI_CopyParam( SrcParamData%AFI(i1), DstParamData%AFI(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + DstParamData%WakeMod = SrcParamData%WakeMod + CALL FVW_CopyParam( SrcParamData%FVW, DstParamData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstParamData%DT = SrcParamData%DT + END SUBROUTINE AD_CopyParam + + SUBROUTINE AD_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(AD_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%rotors)) THEN +DO i1 = LBOUND(ParamData%rotors,1), UBOUND(ParamData%rotors,1) + CALL AD_Destroyrotparametertype( ParamData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%rotors) +ENDIF +IF (ALLOCATED(ParamData%AFI)) THEN +DO i1 = LBOUND(ParamData%AFI,1), UBOUND(ParamData%AFI,1) + CALL AFI_DestroyParam( ParamData%AFI(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%AFI) +ENDIF + CALL FVW_DestroyParam( ParamData%FVW, ErrStat, ErrMsg ) + END SUBROUTINE AD_DestroyParam + + SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotparametertype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) END IF - CALL FVW_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%FVW_y, ErrStat2, ErrMsg2 ) ! FVW_y + END DO + END IF + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Int_BufSz = Int_BufSz + 1 ! AFI allocated yes/no + IF ( ALLOCATED(InData%AFI) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! AFI upper/lower bounds for each dimension + DO i1 = LBOUND(InData%AFI,1), UBOUND(InData%AFI,1) + Int_BufSz = Int_BufSz + 3 ! AFI: size of buffers for each call to pack subtype + CALL AFI_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AFI(i1), ErrStat2, ErrMsg2, .TRUE. ) ! AFI + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AFI + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AFI + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AFI + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! WakeMod + Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype + CALL FVW_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! FVW_u not allocated + IF(ALLOCATED(Re_Buf)) THEN ! FVW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! FVW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! FVW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Db_BufSz = Db_BufSz + 1 ! DT + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%FVW_u)) DEALLOCATE(OutData%FVW_u) - ALLOCATE(OutData%FVW_u(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%FVW_u.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%FVW_u,1), UBOUND(OutData%FVW_u,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL FVW_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%FVW_u(i1), ErrStat2, ErrMsg2 ) ! FVW_u + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotparametertype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF END DO END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL AA_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + END DO ! I + IF ( .NOT. ALLOCATED(InData%AFI) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AFI,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AFI,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%AFI,1), UBOUND(InData%AFI,1) + CALL AFI_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AFI(i1), ErrStat2, ErrMsg2, OnlySize ) ! AFI CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL AA_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%AA_y, ErrStat2, ErrMsg2 ) ! AA_y + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IntKiBuf(Int_Xferred) = InData%WakeMod + Int_Xferred = Int_Xferred + 1 + CALL FVW_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + DbKiBuf(Db_Xferred) = InData%DT + Db_Xferred = Db_Xferred + 1 + END SUBROUTINE AD_PackParam + + SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6938,275 +11397,33 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AA_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%AA_u, ErrStat2, ErrMsg2 ) ! AA_u + CALL AD_Unpackrotparametertype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! DisturbedInflow not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i3_l = IntKiBuf( Int_Xferred ) - i3_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%DisturbedInflow)) DEALLOCATE(OutData%DisturbedInflow) - ALLOCATE(OutData%DisturbedInflow(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%DisturbedInflow.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i3 = LBOUND(OutData%DisturbedInflow,3), UBOUND(OutData%DisturbedInflow,3) - DO i2 = LBOUND(OutData%DisturbedInflow,2), UBOUND(OutData%DisturbedInflow,2) - DO i1 = LBOUND(OutData%DisturbedInflow,1), UBOUND(OutData%DisturbedInflow,1) - OutData%DisturbedInflow(i1,i2,i3) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WithoutSweepPitchTwist not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i3_l = IntKiBuf( Int_Xferred ) - i3_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i4_l = IntKiBuf( Int_Xferred ) - i4_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%WithoutSweepPitchTwist)) DEALLOCATE(OutData%WithoutSweepPitchTwist) - ALLOCATE(OutData%WithoutSweepPitchTwist(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WithoutSweepPitchTwist.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i4 = LBOUND(OutData%WithoutSweepPitchTwist,4), UBOUND(OutData%WithoutSweepPitchTwist,4) - DO i3 = LBOUND(OutData%WithoutSweepPitchTwist,3), UBOUND(OutData%WithoutSweepPitchTwist,3) - DO i2 = LBOUND(OutData%WithoutSweepPitchTwist,2), UBOUND(OutData%WithoutSweepPitchTwist,2) - DO i1 = LBOUND(OutData%WithoutSweepPitchTwist,1), UBOUND(OutData%WithoutSweepPitchTwist,1) - OutData%WithoutSweepPitchTwist(i1,i2,i3,i4) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AllOuts not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AllOuts)) DEALLOCATE(OutData%AllOuts) - ALLOCATE(OutData%AllOuts(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AllOuts.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%AllOuts,1), UBOUND(OutData%AllOuts,1) - OutData%AllOuts(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! W_Twr not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%W_Twr)) DEALLOCATE(OutData%W_Twr) - ALLOCATE(OutData%W_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%W_Twr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%W_Twr,1), UBOUND(OutData%W_Twr,1) - OutData%W_Twr(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X_Twr not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%X_Twr)) DEALLOCATE(OutData%X_Twr) - ALLOCATE(OutData%X_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X_Twr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%X_Twr,1), UBOUND(OutData%X_Twr,1) - OutData%X_Twr(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y_Twr not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Y_Twr)) DEALLOCATE(OutData%Y_Twr) - ALLOCATE(OutData%Y_Twr(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y_Twr.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%Y_Twr,1), UBOUND(OutData%Y_Twr,1) - OutData%Y_Twr(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Curve not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Curve)) DEALLOCATE(OutData%Curve) - ALLOCATE(OutData%Curve(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Curve.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%Curve,2), UBOUND(OutData%Curve,2) - DO i1 = LBOUND(OutData%Curve,1), UBOUND(OutData%Curve,1) - OutData%Curve(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrClrnc not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrClrnc)) DEALLOCATE(OutData%TwrClrnc) - ALLOCATE(OutData%TwrClrnc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrClrnc.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%TwrClrnc,2), UBOUND(OutData%TwrClrnc,2) - DO i1 = LBOUND(OutData%TwrClrnc,1), UBOUND(OutData%TwrClrnc,1) - OutData%TwrClrnc(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%X)) DEALLOCATE(OutData%X) - ALLOCATE(OutData%X(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%X,2), UBOUND(OutData%X,2) - DO i1 = LBOUND(OutData%X,1), UBOUND(OutData%X,1) - OutData%X(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Y)) DEALLOCATE(OutData%Y) - ALLOCATE(OutData%Y(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%Y,2), UBOUND(OutData%Y,2) - DO i1 = LBOUND(OutData%Y,1), UBOUND(OutData%Y,1) - OutData%Y(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! M not allocated + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AFI not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) + i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%M)) DEALLOCATE(OutData%M) - ALLOCATE(OutData%M(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%AFI)) DEALLOCATE(OutData%AFI) + ALLOCATE(OutData%AFI(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%M.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AFI.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%M,2), UBOUND(OutData%M,2) - DO i1 = LBOUND(OutData%M,1), UBOUND(OutData%M,1) - OutData%M(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - i1_l = LBOUND(OutData%V_DiskAvg,1) - i1_u = UBOUND(OutData%V_DiskAvg,1) - DO i1 = LBOUND(OutData%V_DiskAvg,1), UBOUND(OutData%V_DiskAvg,1) - OutData%V_DiskAvg(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%hub_theta_x_root,1) - i1_u = UBOUND(OutData%hub_theta_x_root,1) - DO i1 = LBOUND(OutData%hub_theta_x_root,1), UBOUND(OutData%hub_theta_x_root,1) - OutData%hub_theta_x_root(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - OutData%V_dot_x = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(OutData%AFI,1), UBOUND(OutData%AFI,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7240,27 +11457,17 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%HubLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! HubLoad + CALL AFI_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%AFI(i1), ErrStat2, ErrMsg2 ) ! AFI CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! B_L_2_H_P not allocated - Int_Xferred = Int_Xferred + 1 - ELSE + END DO + END IF + OutData%WakeMod = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%B_L_2_H_P)) DEALLOCATE(OutData%B_L_2_H_P) - ALLOCATE(OutData%B_L_2_H_P(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%B_L_2_H_P.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%B_L_2_H_P,1), UBOUND(OutData%B_L_2_H_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7294,89 +11501,20 @@ SUBROUTINE AD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%B_L_2_H_P(i1), ErrStat2, ErrMsg2 ) ! B_L_2_H_P + CALL FVW_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SigmaCavitCrit not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SigmaCavitCrit)) DEALLOCATE(OutData%SigmaCavitCrit) - ALLOCATE(OutData%SigmaCavitCrit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SigmaCavitCrit.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%SigmaCavitCrit,2), UBOUND(OutData%SigmaCavitCrit,2) - DO i1 = LBOUND(OutData%SigmaCavitCrit,1), UBOUND(OutData%SigmaCavitCrit,1) - OutData%SigmaCavitCrit(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SigmaCavit not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SigmaCavit)) DEALLOCATE(OutData%SigmaCavit) - ALLOCATE(OutData%SigmaCavit(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SigmaCavit.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%SigmaCavit,2), UBOUND(OutData%SigmaCavit,2) - DO i1 = LBOUND(OutData%SigmaCavit,1), UBOUND(OutData%SigmaCavit,1) - OutData%SigmaCavit(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CavitWarnSet not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%CavitWarnSet)) DEALLOCATE(OutData%CavitWarnSet) - ALLOCATE(OutData%CavitWarnSet(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CavitWarnSet.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%CavitWarnSet,2), UBOUND(OutData%CavitWarnSet,2) - DO i1 = LBOUND(OutData%CavitWarnSet,1), UBOUND(OutData%CavitWarnSet,1) - OutData%CavitWarnSet(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitWarnSet(i1,i2)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE AD_UnPackMisc + OutData%DT = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + END SUBROUTINE AD_UnPackParam - SUBROUTINE AD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_ParameterType), INTENT(IN) :: SrcParamData - TYPE(AD_ParameterType), INTENT(INOUT) :: DstParamData + SUBROUTINE AD_CopyRotInputType( SrcRotInputTypeData, DstRotInputTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotInputType), INTENT(INOUT) :: SrcRotInputTypeData + TYPE(RotInputType), INTENT(INOUT) :: DstRotInputTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -7384,243 +11522,141 @@ SUBROUTINE AD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyParam' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotInputType' ! ErrStat = ErrID_None ErrMsg = "" - DstParamData%DT = SrcParamData%DT - DstParamData%WakeMod = SrcParamData%WakeMod - DstParamData%TwrPotent = SrcParamData%TwrPotent - DstParamData%TwrShadow = SrcParamData%TwrShadow - DstParamData%TwrAero = SrcParamData%TwrAero - DstParamData%FrozenWake = SrcParamData%FrozenWake - DstParamData%CavitCheck = SrcParamData%CavitCheck - DstParamData%CompAA = SrcParamData%CompAA - DstParamData%NumBlades = SrcParamData%NumBlades - DstParamData%NumBlNds = SrcParamData%NumBlNds - DstParamData%NumTwrNds = SrcParamData%NumTwrNds -IF (ALLOCATED(SrcParamData%TwrDiam)) THEN - i1_l = LBOUND(SrcParamData%TwrDiam,1) - i1_u = UBOUND(SrcParamData%TwrDiam,1) - IF (.NOT. ALLOCATED(DstParamData%TwrDiam)) THEN - ALLOCATE(DstParamData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%TwrDiam.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstParamData%TwrDiam = SrcParamData%TwrDiam -ENDIF -IF (ALLOCATED(SrcParamData%TwrCd)) THEN - i1_l = LBOUND(SrcParamData%TwrCd,1) - i1_u = UBOUND(SrcParamData%TwrCd,1) - IF (.NOT. ALLOCATED(DstParamData%TwrCd)) THEN - ALLOCATE(DstParamData%TwrCd(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%TwrCd.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstParamData%TwrCd = SrcParamData%TwrCd -ENDIF -IF (ALLOCATED(SrcParamData%TwrTI)) THEN - i1_l = LBOUND(SrcParamData%TwrTI,1) - i1_u = UBOUND(SrcParamData%TwrTI,1) - IF (.NOT. ALLOCATED(DstParamData%TwrTI)) THEN - ALLOCATE(DstParamData%TwrTI(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%TwrTI.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstParamData%TwrTI = SrcParamData%TwrTI -ENDIF - DstParamData%AirDens = SrcParamData%AirDens - DstParamData%KinVisc = SrcParamData%KinVisc - DstParamData%SpdSound = SrcParamData%SpdSound - DstParamData%Gravity = SrcParamData%Gravity - DstParamData%Patm = SrcParamData%Patm - DstParamData%Pvap = SrcParamData%Pvap - DstParamData%FluidDepth = SrcParamData%FluidDepth -IF (ALLOCATED(SrcParamData%AFI)) THEN - i1_l = LBOUND(SrcParamData%AFI,1) - i1_u = UBOUND(SrcParamData%AFI,1) - IF (.NOT. ALLOCATED(DstParamData%AFI)) THEN - ALLOCATE(DstParamData%AFI(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%AFI.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DO i1 = LBOUND(SrcParamData%AFI,1), UBOUND(SrcParamData%AFI,1) - CALL AFI_CopyParam( SrcParamData%AFI(i1), DstParamData%AFI(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF - CALL BEMT_CopyParam( SrcParamData%BEMT, DstParamData%BEMT, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + CALL MeshCopy( SrcRotInputTypeData%NacelleMotion, DstRotInputTypeData%NacelleMotion, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL FVW_CopyParam( SrcParamData%FVW, DstParamData%FVW, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + CALL MeshCopy( SrcRotInputTypeData%TowerMotion, DstRotInputTypeData%TowerMotion, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL AA_CopyParam( SrcParamData%AA, DstParamData%AA, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + CALL MeshCopy( SrcRotInputTypeData%HubMotion, DstRotInputTypeData%HubMotion, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN - DstParamData%NumOuts = SrcParamData%NumOuts - DstParamData%RootName = SrcParamData%RootName -IF (ALLOCATED(SrcParamData%OutParam)) THEN - i1_l = LBOUND(SrcParamData%OutParam,1) - i1_u = UBOUND(SrcParamData%OutParam,1) - IF (.NOT. ALLOCATED(DstParamData%OutParam)) THEN - ALLOCATE(DstParamData%OutParam(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotInputTypeData%BladeRootMotion)) THEN + i1_l = LBOUND(SrcRotInputTypeData%BladeRootMotion,1) + i1_u = UBOUND(SrcRotInputTypeData%BladeRootMotion,1) + IF (.NOT. ALLOCATED(DstRotInputTypeData%BladeRootMotion)) THEN + ALLOCATE(DstRotInputTypeData%BladeRootMotion(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutParam.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputTypeData%BladeRootMotion.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcParamData%OutParam,1), UBOUND(SrcParamData%OutParam,1) - CALL NWTC_Library_Copyoutparmtype( SrcParamData%OutParam(i1), DstParamData%OutParam(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i1 = LBOUND(SrcRotInputTypeData%BladeRootMotion,1), UBOUND(SrcRotInputTypeData%BladeRootMotion,1) + CALL MeshCopy( SrcRotInputTypeData%BladeRootMotion(i1), DstRotInputTypeData%BladeRootMotion(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF - DstParamData%NBlOuts = SrcParamData%NBlOuts - DstParamData%BlOutNd = SrcParamData%BlOutNd - DstParamData%NTwOuts = SrcParamData%NTwOuts - DstParamData%TwOutNd = SrcParamData%TwOutNd - DstParamData%BldNd_NumOuts = SrcParamData%BldNd_NumOuts - DstParamData%BldNd_TotNumOuts = SrcParamData%BldNd_TotNumOuts -IF (ALLOCATED(SrcParamData%BldNd_OutParam)) THEN - i1_l = LBOUND(SrcParamData%BldNd_OutParam,1) - i1_u = UBOUND(SrcParamData%BldNd_OutParam,1) - IF (.NOT. ALLOCATED(DstParamData%BldNd_OutParam)) THEN - ALLOCATE(DstParamData%BldNd_OutParam(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%BldNd_OutParam.', ErrStat, ErrMsg,RoutineName) +IF (ALLOCATED(SrcRotInputTypeData%BladeMotion)) THEN + i1_l = LBOUND(SrcRotInputTypeData%BladeMotion,1) + i1_u = UBOUND(SrcRotInputTypeData%BladeMotion,1) + IF (.NOT. ALLOCATED(DstRotInputTypeData%BladeMotion)) THEN + ALLOCATE(DstRotInputTypeData%BladeMotion(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputTypeData%BladeMotion.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcParamData%BldNd_OutParam,1), UBOUND(SrcParamData%BldNd_OutParam,1) - CALL NWTC_Library_Copyoutparmtype( SrcParamData%BldNd_OutParam(i1), DstParamData%BldNd_OutParam(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i1 = LBOUND(SrcRotInputTypeData%BladeMotion,1), UBOUND(SrcRotInputTypeData%BladeMotion,1) + CALL MeshCopy( SrcRotInputTypeData%BladeMotion(i1), DstRotInputTypeData%BladeMotion(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcParamData%BldNd_BlOutNd)) THEN - i1_l = LBOUND(SrcParamData%BldNd_BlOutNd,1) - i1_u = UBOUND(SrcParamData%BldNd_BlOutNd,1) - IF (.NOT. ALLOCATED(DstParamData%BldNd_BlOutNd)) THEN - ALLOCATE(DstParamData%BldNd_BlOutNd(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%BldNd_BlOutNd.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstParamData%BldNd_BlOutNd = SrcParamData%BldNd_BlOutNd -ENDIF - DstParamData%BldNd_BladesOut = SrcParamData%BldNd_BladesOut -IF (ALLOCATED(SrcParamData%Jac_u_indx)) THEN - i1_l = LBOUND(SrcParamData%Jac_u_indx,1) - i1_u = UBOUND(SrcParamData%Jac_u_indx,1) - i2_l = LBOUND(SrcParamData%Jac_u_indx,2) - i2_u = UBOUND(SrcParamData%Jac_u_indx,2) - IF (.NOT. ALLOCATED(DstParamData%Jac_u_indx)) THEN - ALLOCATE(DstParamData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) +IF (ALLOCATED(SrcRotInputTypeData%InflowOnBlade)) THEN + i1_l = LBOUND(SrcRotInputTypeData%InflowOnBlade,1) + i1_u = UBOUND(SrcRotInputTypeData%InflowOnBlade,1) + i2_l = LBOUND(SrcRotInputTypeData%InflowOnBlade,2) + i2_u = UBOUND(SrcRotInputTypeData%InflowOnBlade,2) + i3_l = LBOUND(SrcRotInputTypeData%InflowOnBlade,3) + i3_u = UBOUND(SrcRotInputTypeData%InflowOnBlade,3) + IF (.NOT. ALLOCATED(DstRotInputTypeData%InflowOnBlade)) THEN + ALLOCATE(DstRotInputTypeData%InflowOnBlade(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputTypeData%InflowOnBlade.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstParamData%Jac_u_indx = SrcParamData%Jac_u_indx + DstRotInputTypeData%InflowOnBlade = SrcRotInputTypeData%InflowOnBlade ENDIF -IF (ALLOCATED(SrcParamData%du)) THEN - i1_l = LBOUND(SrcParamData%du,1) - i1_u = UBOUND(SrcParamData%du,1) - IF (.NOT. ALLOCATED(DstParamData%du)) THEN - ALLOCATE(DstParamData%du(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotInputTypeData%InflowOnTower)) THEN + i1_l = LBOUND(SrcRotInputTypeData%InflowOnTower,1) + i1_u = UBOUND(SrcRotInputTypeData%InflowOnTower,1) + i2_l = LBOUND(SrcRotInputTypeData%InflowOnTower,2) + i2_u = UBOUND(SrcRotInputTypeData%InflowOnTower,2) + IF (.NOT. ALLOCATED(DstRotInputTypeData%InflowOnTower)) THEN + ALLOCATE(DstRotInputTypeData%InflowOnTower(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%du.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputTypeData%InflowOnTower.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstParamData%du = SrcParamData%du + DstRotInputTypeData%InflowOnTower = SrcRotInputTypeData%InflowOnTower ENDIF -IF (ALLOCATED(SrcParamData%dx)) THEN - i1_l = LBOUND(SrcParamData%dx,1) - i1_u = UBOUND(SrcParamData%dx,1) - IF (.NOT. ALLOCATED(DstParamData%dx)) THEN - ALLOCATE(DstParamData%dx(i1_l:i1_u),STAT=ErrStat2) + DstRotInputTypeData%InflowOnNacelle = SrcRotInputTypeData%InflowOnNacelle +IF (ALLOCATED(SrcRotInputTypeData%UserProp)) THEN + i1_l = LBOUND(SrcRotInputTypeData%UserProp,1) + i1_u = UBOUND(SrcRotInputTypeData%UserProp,1) + i2_l = LBOUND(SrcRotInputTypeData%UserProp,2) + i2_u = UBOUND(SrcRotInputTypeData%UserProp,2) + IF (.NOT. ALLOCATED(DstRotInputTypeData%UserProp)) THEN + ALLOCATE(DstRotInputTypeData%UserProp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%dx.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotInputTypeData%UserProp.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstParamData%dx = SrcParamData%dx + DstRotInputTypeData%UserProp = SrcRotInputTypeData%UserProp ENDIF - DstParamData%Jac_ny = SrcParamData%Jac_ny - END SUBROUTINE AD_CopyParam + END SUBROUTINE AD_CopyRotInputType - SUBROUTINE AD_DestroyParam( ParamData, ErrStat, ErrMsg ) - TYPE(AD_ParameterType), INTENT(INOUT) :: ParamData + SUBROUTINE AD_DestroyRotInputType( RotInputTypeData, ErrStat, ErrMsg ) + TYPE(RotInputType), INTENT(INOUT) :: RotInputTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyParam' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotInputType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(ParamData%TwrDiam)) THEN - DEALLOCATE(ParamData%TwrDiam) -ENDIF -IF (ALLOCATED(ParamData%TwrCd)) THEN - DEALLOCATE(ParamData%TwrCd) -ENDIF -IF (ALLOCATED(ParamData%TwrTI)) THEN - DEALLOCATE(ParamData%TwrTI) -ENDIF -IF (ALLOCATED(ParamData%AFI)) THEN -DO i1 = LBOUND(ParamData%AFI,1), UBOUND(ParamData%AFI,1) - CALL AFI_DestroyParam( ParamData%AFI(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(ParamData%AFI) -ENDIF - CALL BEMT_DestroyParam( ParamData%BEMT, ErrStat, ErrMsg ) - CALL FVW_DestroyParam( ParamData%FVW, ErrStat, ErrMsg ) - CALL AA_DestroyParam( ParamData%AA, ErrStat, ErrMsg ) -IF (ALLOCATED(ParamData%OutParam)) THEN -DO i1 = LBOUND(ParamData%OutParam,1), UBOUND(ParamData%OutParam,1) - CALL NWTC_Library_Destroyoutparmtype( ParamData%OutParam(i1), ErrStat, ErrMsg ) + CALL MeshDestroy( RotInputTypeData%NacelleMotion, ErrStat, ErrMsg ) + CALL MeshDestroy( RotInputTypeData%TowerMotion, ErrStat, ErrMsg ) + CALL MeshDestroy( RotInputTypeData%HubMotion, ErrStat, ErrMsg ) +IF (ALLOCATED(RotInputTypeData%BladeRootMotion)) THEN +DO i1 = LBOUND(RotInputTypeData%BladeRootMotion,1), UBOUND(RotInputTypeData%BladeRootMotion,1) + CALL MeshDestroy( RotInputTypeData%BladeRootMotion(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ParamData%OutParam) + DEALLOCATE(RotInputTypeData%BladeRootMotion) ENDIF -IF (ALLOCATED(ParamData%BldNd_OutParam)) THEN -DO i1 = LBOUND(ParamData%BldNd_OutParam,1), UBOUND(ParamData%BldNd_OutParam,1) - CALL NWTC_Library_Destroyoutparmtype( ParamData%BldNd_OutParam(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(RotInputTypeData%BladeMotion)) THEN +DO i1 = LBOUND(RotInputTypeData%BladeMotion,1), UBOUND(RotInputTypeData%BladeMotion,1) + CALL MeshDestroy( RotInputTypeData%BladeMotion(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ParamData%BldNd_OutParam) + DEALLOCATE(RotInputTypeData%BladeMotion) ENDIF -IF (ALLOCATED(ParamData%BldNd_BlOutNd)) THEN - DEALLOCATE(ParamData%BldNd_BlOutNd) +IF (ALLOCATED(RotInputTypeData%InflowOnBlade)) THEN + DEALLOCATE(RotInputTypeData%InflowOnBlade) ENDIF -IF (ALLOCATED(ParamData%Jac_u_indx)) THEN - DEALLOCATE(ParamData%Jac_u_indx) +IF (ALLOCATED(RotInputTypeData%InflowOnTower)) THEN + DEALLOCATE(RotInputTypeData%InflowOnTower) ENDIF -IF (ALLOCATED(ParamData%du)) THEN - DEALLOCATE(ParamData%du) +IF (ALLOCATED(RotInputTypeData%UserProp)) THEN + DEALLOCATE(RotInputTypeData%UserProp) ENDIF -IF (ALLOCATED(ParamData%dx)) THEN - DEALLOCATE(ParamData%dx) -ENDIF - END SUBROUTINE AD_DestroyParam + END SUBROUTINE AD_DestroyRotInputType - SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_ParameterType), INTENT(IN) :: InData + TYPE(RotInputType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -7635,206 +11671,136 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackParam' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Db_BufSz = Db_BufSz + 1 ! DT - Int_BufSz = Int_BufSz + 1 ! WakeMod - Int_BufSz = Int_BufSz + 1 ! TwrPotent - Int_BufSz = Int_BufSz + 1 ! TwrShadow - Int_BufSz = Int_BufSz + 1 ! TwrAero - Int_BufSz = Int_BufSz + 1 ! FrozenWake - Int_BufSz = Int_BufSz + 1 ! CavitCheck - Int_BufSz = Int_BufSz + 1 ! CompAA - Int_BufSz = Int_BufSz + 1 ! NumBlades - Int_BufSz = Int_BufSz + 1 ! NumBlNds - Int_BufSz = Int_BufSz + 1 ! NumTwrNds - Int_BufSz = Int_BufSz + 1 ! TwrDiam allocated yes/no - IF ( ALLOCATED(InData%TwrDiam) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrDiam upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrDiam) ! TwrDiam - END IF - Int_BufSz = Int_BufSz + 1 ! TwrCd allocated yes/no - IF ( ALLOCATED(InData%TwrCd) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrCd upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrCd) ! TwrCd - END IF - Int_BufSz = Int_BufSz + 1 ! TwrTI allocated yes/no - IF ( ALLOCATED(InData%TwrTI) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TwrTI upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%TwrTI) ! TwrTI - END IF - Re_BufSz = Re_BufSz + 1 ! AirDens - Re_BufSz = Re_BufSz + 1 ! KinVisc - Re_BufSz = Re_BufSz + 1 ! SpdSound - Re_BufSz = Re_BufSz + 1 ! Gravity - Re_BufSz = Re_BufSz + 1 ! Patm - Re_BufSz = Re_BufSz + 1 ! Pvap - Re_BufSz = Re_BufSz + 1 ! FluidDepth - Int_BufSz = Int_BufSz + 1 ! AFI allocated yes/no - IF ( ALLOCATED(InData%AFI) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! AFI upper/lower bounds for each dimension - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - DO i1 = LBOUND(InData%AFI,1), UBOUND(InData%AFI,1) - Int_BufSz = Int_BufSz + 3 ! AFI: size of buffers for each call to pack subtype - CALL AFI_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AFI(i1), ErrStat2, ErrMsg2, .TRUE. ) ! AFI - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotInputType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - IF(ALLOCATED(Re_Buf)) THEN ! AFI - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! AFI - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! AFI - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - END DO - END IF - Int_BufSz = Int_BufSz + 3 ! BEMT: size of buffers for each call to pack subtype - CALL BEMT_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, .TRUE. ) ! BEMT + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! NacelleMotion: size of buffers for each call to pack subtype + CALL MeshPack( InData%NacelleMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! NacelleMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BEMT + IF(ALLOCATED(Re_Buf)) THEN ! NacelleMotion Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BEMT + IF(ALLOCATED(Db_Buf)) THEN ! NacelleMotion Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BEMT + IF(ALLOCATED(Int_Buf)) THEN ! NacelleMotion Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! FVW: size of buffers for each call to pack subtype - CALL FVW_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, .TRUE. ) ! FVW + Int_BufSz = Int_BufSz + 3 ! TowerMotion: size of buffers for each call to pack subtype + CALL MeshPack( InData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TowerMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! FVW + IF(ALLOCATED(Re_Buf)) THEN ! TowerMotion Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! FVW + IF(ALLOCATED(Db_Buf)) THEN ! TowerMotion Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! FVW + IF(ALLOCATED(Int_Buf)) THEN ! TowerMotion Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! AA: size of buffers for each call to pack subtype - CALL AA_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, .TRUE. ) ! AA + Int_BufSz = Int_BufSz + 3 ! HubMotion: size of buffers for each call to pack subtype + CALL MeshPack( InData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! HubMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! AA + IF(ALLOCATED(Re_Buf)) THEN ! HubMotion Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! AA + IF(ALLOCATED(Db_Buf)) THEN ! HubMotion Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! AA + IF(ALLOCATED(Int_Buf)) THEN ! HubMotion Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! NumOuts - Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName - Int_BufSz = Int_BufSz + 1 ! OutParam allocated yes/no - IF ( ALLOCATED(InData%OutParam) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! OutParam upper/lower bounds for each dimension - DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) - Int_BufSz = Int_BufSz + 3 ! OutParam: size of buffers for each call to pack subtype - CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, .TRUE. ) ! OutParam + Int_BufSz = Int_BufSz + 1 ! BladeRootMotion allocated yes/no + IF ( ALLOCATED(InData%BladeRootMotion) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeRootMotion upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BladeRootMotion,1), UBOUND(InData%BladeRootMotion,1) + Int_BufSz = Int_BufSz + 3 ! BladeRootMotion: size of buffers for each call to pack subtype + CALL MeshPack( InData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeRootMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! OutParam + IF(ALLOCATED(Re_Buf)) THEN ! BladeRootMotion Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! OutParam + IF(ALLOCATED(Db_Buf)) THEN ! BladeRootMotion Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! OutParam + IF(ALLOCATED(Int_Buf)) THEN ! BladeRootMotion Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! NBlOuts - Int_BufSz = Int_BufSz + SIZE(InData%BlOutNd) ! BlOutNd - Int_BufSz = Int_BufSz + 1 ! NTwOuts - Int_BufSz = Int_BufSz + SIZE(InData%TwOutNd) ! TwOutNd - Int_BufSz = Int_BufSz + 1 ! BldNd_NumOuts - Int_BufSz = Int_BufSz + 1 ! BldNd_TotNumOuts - Int_BufSz = Int_BufSz + 1 ! BldNd_OutParam allocated yes/no - IF ( ALLOCATED(InData%BldNd_OutParam) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BldNd_OutParam upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BldNd_OutParam,1), UBOUND(InData%BldNd_OutParam,1) - Int_BufSz = Int_BufSz + 3 ! BldNd_OutParam: size of buffers for each call to pack subtype - CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%BldNd_OutParam(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BldNd_OutParam + Int_BufSz = Int_BufSz + 1 ! BladeMotion allocated yes/no + IF ( ALLOCATED(InData%BladeMotion) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeMotion upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BladeMotion,1), UBOUND(InData%BladeMotion,1) + Int_BufSz = Int_BufSz + 3 ! BladeMotion: size of buffers for each call to pack subtype + CALL MeshPack( InData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BldNd_OutParam + IF(ALLOCATED(Re_Buf)) THEN ! BladeMotion Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BldNd_OutParam + IF(ALLOCATED(Db_Buf)) THEN ! BladeMotion Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BldNd_OutParam + IF(ALLOCATED(Int_Buf)) THEN ! BladeMotion Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! BldNd_BlOutNd allocated yes/no - IF ( ALLOCATED(InData%BldNd_BlOutNd) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BldNd_BlOutNd upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%BldNd_BlOutNd) ! BldNd_BlOutNd - END IF - Int_BufSz = Int_BufSz + 1 ! BldNd_BladesOut - Int_BufSz = Int_BufSz + 1 ! Jac_u_indx allocated yes/no - IF ( ALLOCATED(InData%Jac_u_indx) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! Jac_u_indx upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%Jac_u_indx) ! Jac_u_indx + Int_BufSz = Int_BufSz + 1 ! InflowOnBlade allocated yes/no + IF ( ALLOCATED(InData%InflowOnBlade) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! InflowOnBlade upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InflowOnBlade) ! InflowOnBlade END IF - Int_BufSz = Int_BufSz + 1 ! du allocated yes/no - IF ( ALLOCATED(InData%du) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! du upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%du) ! du + Int_BufSz = Int_BufSz + 1 ! InflowOnTower allocated yes/no + IF ( ALLOCATED(InData%InflowOnTower) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InflowOnTower upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InflowOnTower) ! InflowOnTower END IF - Int_BufSz = Int_BufSz + 1 ! dx allocated yes/no - IF ( ALLOCATED(InData%dx) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! dx upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%dx) ! dx + Re_BufSz = Re_BufSz + SIZE(InData%InflowOnNacelle) ! InflowOnNacelle + Int_BufSz = Int_BufSz + 1 ! UserProp allocated yes/no + IF ( ALLOCATED(InData%UserProp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! UserProp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%UserProp) ! UserProp END IF - Int_BufSz = Int_BufSz + 1 ! Jac_ny IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -7858,133 +11824,11 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si END IF IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DbKiBuf(Db_Xferred) = InData%DT - Db_Xferred = Db_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%WakeMod - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TwrPotent - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TwrShadow - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TwrAero, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%FrozenWake, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CavitCheck, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompAA, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumBlades - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumBlNds - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumTwrNds - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%TwrDiam) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrDiam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrDiam,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrDiam,1), UBOUND(InData%TwrDiam,1) - ReKiBuf(Re_Xferred) = InData%TwrDiam(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrCd) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrCd,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrCd,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrCd,1), UBOUND(InData%TwrCd,1) - ReKiBuf(Re_Xferred) = InData%TwrCd(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%TwrTI) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TwrTI,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TwrTI,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%TwrTI,1), UBOUND(InData%TwrTI,1) - ReKiBuf(Re_Xferred) = InData%TwrTI(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - ReKiBuf(Re_Xferred) = InData%AirDens - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%KinVisc - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%SpdSound - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Gravity - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Patm - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Pvap - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%FluidDepth - Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%AFI) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AFI,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AFI,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%AFI,1), UBOUND(InData%AFI,1) - CALL AFI_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AFI(i1), ErrStat2, ErrMsg2, OnlySize ) ! AFI - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO - END IF - CALL BEMT_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BEMT, ErrStat2, ErrMsg2, OnlySize ) ! BEMT + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL MeshPack( InData%NacelleMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! NacelleMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8012,7 +11856,7 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL FVW_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%FVW, ErrStat2, ErrMsg2, OnlySize ) ! FVW + CALL MeshPack( InData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TowerMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8040,7 +11884,7 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL AA_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%AA, ErrStat2, ErrMsg2, OnlySize ) ! AA + CALL MeshPack( InData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! HubMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8068,24 +11912,18 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IntKiBuf(Int_Xferred) = InData%NumOuts - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%RootName) - IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( .NOT. ALLOCATED(InData%OutParam) ) THEN + IF ( .NOT. ALLOCATED(InData%BladeRootMotion) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%OutParam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutParam,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootMotion,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootMotion,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) - CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutParam + DO i1 = LBOUND(InData%BladeRootMotion,1), UBOUND(InData%BladeRootMotion,1) + CALL MeshPack( InData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeRootMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8115,34 +11953,18 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ENDIF END DO END IF - IntKiBuf(Int_Xferred) = InData%NBlOuts - Int_Xferred = Int_Xferred + 1 - DO i1 = LBOUND(InData%BlOutNd,1), UBOUND(InData%BlOutNd,1) - IntKiBuf(Int_Xferred) = InData%BlOutNd(i1) - Int_Xferred = Int_Xferred + 1 - END DO - IntKiBuf(Int_Xferred) = InData%NTwOuts - Int_Xferred = Int_Xferred + 1 - DO i1 = LBOUND(InData%TwOutNd,1), UBOUND(InData%TwOutNd,1) - IntKiBuf(Int_Xferred) = InData%TwOutNd(i1) - Int_Xferred = Int_Xferred + 1 - END DO - IntKiBuf(Int_Xferred) = InData%BldNd_NumOuts - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%BldNd_TotNumOuts - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BldNd_OutParam) ) THEN + IF ( .NOT. ALLOCATED(InData%BladeMotion) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_OutParam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_OutParam,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeMotion,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeMotion,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BldNd_OutParam,1), UBOUND(InData%BldNd_OutParam,1) - CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%BldNd_OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! BldNd_OutParam + DO i1 = LBOUND(InData%BladeMotion,1), UBOUND(InData%BladeMotion,1) + CALL MeshPack( InData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8172,209 +11994,106 @@ SUBROUTINE AD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%BldNd_BlOutNd) ) THEN + IF ( .NOT. ALLOCATED(InData%InflowOnBlade) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BldNd_BlOutNd,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BldNd_BlOutNd,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,1) Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BldNd_BlOutNd,1), UBOUND(InData%BldNd_BlOutNd,1) - IntKiBuf(Int_Xferred) = InData%BldNd_BlOutNd(i1) - Int_Xferred = Int_Xferred + 1 - END DO - END IF - IntKiBuf(Int_Xferred) = InData%BldNd_BladesOut - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%Jac_u_indx) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,2) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,3) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%Jac_u_indx,2), UBOUND(InData%Jac_u_indx,2) - DO i1 = LBOUND(InData%Jac_u_indx,1), UBOUND(InData%Jac_u_indx,1) - IntKiBuf(Int_Xferred) = InData%Jac_u_indx(i1,i2) - Int_Xferred = Int_Xferred + 1 + DO i3 = LBOUND(InData%InflowOnBlade,3), UBOUND(InData%InflowOnBlade,3) + DO i2 = LBOUND(InData%InflowOnBlade,2), UBOUND(InData%InflowOnBlade,2) + DO i1 = LBOUND(InData%InflowOnBlade,1), UBOUND(InData%InflowOnBlade,1) + ReKiBuf(Re_Xferred) = InData%InflowOnBlade(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%du) ) THEN + IF ( .NOT. ALLOCATED(InData%InflowOnTower) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%du,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%du,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnTower,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnTower,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnTower,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnTower,2) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%du,1), UBOUND(InData%du,1) - ReKiBuf(Re_Xferred) = InData%du(i1) - Re_Xferred = Re_Xferred + 1 + DO i2 = LBOUND(InData%InflowOnTower,2), UBOUND(InData%InflowOnTower,2) + DO i1 = LBOUND(InData%InflowOnTower,1), UBOUND(InData%InflowOnTower,1) + ReKiBuf(Re_Xferred) = InData%InflowOnTower(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%dx) ) THEN + DO i1 = LBOUND(InData%InflowOnNacelle,1), UBOUND(InData%InflowOnNacelle,1) + ReKiBuf(Re_Xferred) = InData%InflowOnNacelle(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IF ( .NOT. ALLOCATED(InData%UserProp) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%dx,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dx,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%dx,1), UBOUND(InData%dx,1) - ReKiBuf(Re_Xferred) = InData%dx(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IntKiBuf(Int_Xferred) = InData%Jac_ny - Int_Xferred = Int_Xferred + 1 - END SUBROUTINE AD_PackParam - - SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_ParameterType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackParam' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DT = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - OutData%WakeMod = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrPotent = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrShadow = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TwrAero = TRANSFER(IntKiBuf(Int_Xferred), OutData%TwrAero) - Int_Xferred = Int_Xferred + 1 - OutData%FrozenWake = TRANSFER(IntKiBuf(Int_Xferred), OutData%FrozenWake) - Int_Xferred = Int_Xferred + 1 - OutData%CavitCheck = TRANSFER(IntKiBuf(Int_Xferred), OutData%CavitCheck) - Int_Xferred = Int_Xferred + 1 - OutData%CompAA = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompAA) - Int_Xferred = Int_Xferred + 1 - OutData%NumBlades = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%NumBlNds = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%NumTwrNds = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrDiam not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrDiam)) DEALLOCATE(OutData%TwrDiam) - ALLOCATE(OutData%TwrDiam(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrDiam.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrDiam,1), UBOUND(OutData%TwrDiam,1) - OutData%TwrDiam(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrCd not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrCd)) DEALLOCATE(OutData%TwrCd) - ALLOCATE(OutData%TwrCd(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrCd.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrCd,1), UBOUND(OutData%TwrCd,1) - OutData%TwrCd(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TwrTI not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%UserProp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UserProp,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TwrTI)) DEALLOCATE(OutData%TwrTI) - ALLOCATE(OutData%TwrTI(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TwrTI.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%TwrTI,1), UBOUND(OutData%TwrTI,1) - OutData%TwrTI(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - OutData%AirDens = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%KinVisc = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%SpdSound = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Gravity = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Patm = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Pvap = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%FluidDepth = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AFI not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%UserProp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UserProp,2) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AFI)) DEALLOCATE(OutData%AFI) - ALLOCATE(OutData%AFI(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AFI.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%AFI,1), UBOUND(OutData%AFI,1) + + DO i2 = LBOUND(InData%UserProp,2), UBOUND(InData%UserProp,2) + DO i1 = LBOUND(InData%UserProp,1), UBOUND(InData%UserProp,1) + ReKiBuf(Re_Xferred) = InData%UserProp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AD_PackRotInputType + + SUBROUTINE AD_UnPackRotInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(RotInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotInputType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -8408,15 +12127,13 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AFI_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%AFI(i1), ErrStat2, ErrMsg2 ) ! AFI + CALL MeshUnpack( OutData%NacelleMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! NacelleMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -8450,7 +12167,7 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL BEMT_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%BEMT, ErrStat2, ErrMsg2 ) ! BEMT + CALL MeshUnpack( OutData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TowerMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8490,13 +12207,27 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FVW_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%FVW, ErrStat2, ErrMsg2 ) ! FVW + CALL MeshUnpack( OutData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! HubMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootMotion not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootMotion)) DEALLOCATE(OutData%BladeRootMotion) + ALLOCATE(OutData%BladeRootMotion(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootMotion.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BladeRootMotion,1), UBOUND(OutData%BladeRootMotion,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -8530,33 +12261,29 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL AA_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%AA, ErrStat2, ErrMsg2 ) ! AA + CALL MeshUnpack( OutData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeRootMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - OutData%NumOuts = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%RootName) - OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutParam not allocated + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeMotion not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%OutParam)) DEALLOCATE(OutData%OutParam) - ALLOCATE(OutData%OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BladeMotion)) DEALLOCATE(OutData%BladeMotion) + ALLOCATE(OutData%BladeMotion(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutParam.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeMotion.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%OutParam,1), UBOUND(OutData%OutParam,1) + DO i1 = LBOUND(OutData%BladeMotion,1), UBOUND(OutData%BladeMotion,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -8590,7 +12317,7 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackoutparmtype( Re_Buf, Db_Buf, Int_Buf, OutData%OutParam(i1), ErrStat2, ErrMsg2 ) ! OutParam + CALL MeshUnpack( OutData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeMotion CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8599,40 +12326,352 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - OutData%NBlOuts = IntKiBuf(Int_Xferred) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowOnBlade not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InflowOnBlade)) DEALLOCATE(OutData%InflowOnBlade) + ALLOCATE(OutData%InflowOnBlade(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowOnBlade.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%InflowOnBlade,3), UBOUND(OutData%InflowOnBlade,3) + DO i2 = LBOUND(OutData%InflowOnBlade,2), UBOUND(OutData%InflowOnBlade,2) + DO i1 = LBOUND(OutData%InflowOnBlade,1), UBOUND(OutData%InflowOnBlade,1) + OutData%InflowOnBlade(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowOnTower not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InflowOnTower)) DEALLOCATE(OutData%InflowOnTower) + ALLOCATE(OutData%InflowOnTower(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowOnTower.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InflowOnTower,2), UBOUND(OutData%InflowOnTower,2) + DO i1 = LBOUND(OutData%InflowOnTower,1), UBOUND(OutData%InflowOnTower,1) + OutData%InflowOnTower(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + i1_l = LBOUND(OutData%InflowOnNacelle,1) + i1_u = UBOUND(OutData%InflowOnNacelle,1) + DO i1 = LBOUND(OutData%InflowOnNacelle,1), UBOUND(OutData%InflowOnNacelle,1) + OutData%InflowOnNacelle(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! UserProp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%UserProp)) DEALLOCATE(OutData%UserProp) + ALLOCATE(OutData%UserProp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%UserProp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%UserProp,2), UBOUND(OutData%UserProp,2) + DO i1 = LBOUND(OutData%UserProp,1), UBOUND(OutData%UserProp,1) + OutData%UserProp(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AD_UnPackRotInputType + + SUBROUTINE AD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AD_InputType), INTENT(INOUT) :: SrcInputData + TYPE(AD_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInputData%rotors)) THEN + i1_l = LBOUND(SrcInputData%rotors,1) + i1_u = UBOUND(SrcInputData%rotors,1) + IF (.NOT. ALLOCATED(DstInputData%rotors)) THEN + ALLOCATE(DstInputData%rotors(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%rotors.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%rotors,1), UBOUND(SrcInputData%rotors,1) + CALL AD_Copyrotinputtype( SrcInputData%rotors(i1), DstInputData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%InflowWakeVel)) THEN + i1_l = LBOUND(SrcInputData%InflowWakeVel,1) + i1_u = UBOUND(SrcInputData%InflowWakeVel,1) + i2_l = LBOUND(SrcInputData%InflowWakeVel,2) + i2_u = UBOUND(SrcInputData%InflowWakeVel,2) + IF (.NOT. ALLOCATED(DstInputData%InflowWakeVel)) THEN + ALLOCATE(DstInputData%InflowWakeVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%InflowWakeVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%InflowWakeVel = SrcInputData%InflowWakeVel +ENDIF + END SUBROUTINE AD_CopyInput + + SUBROUTINE AD_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(AD_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputData%rotors)) THEN +DO i1 = LBOUND(InputData%rotors,1), UBOUND(InputData%rotors,1) + CALL AD_Destroyrotinputtype( InputData%rotors(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%rotors) +ENDIF +IF (ALLOCATED(InputData%InflowWakeVel)) THEN + DEALLOCATE(InputData%InflowWakeVel) +ENDIF + END SUBROUTINE AD_DestroyInput + + SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AD_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotinputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! rotors + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! rotors + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! rotors + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! InflowWakeVel allocated yes/no + IF ( ALLOCATED(InData%InflowWakeVel) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InflowWakeVel upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InflowWakeVel) ! InflowWakeVel + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 - i1_l = LBOUND(OutData%BlOutNd,1) - i1_u = UBOUND(OutData%BlOutNd,1) - DO i1 = LBOUND(OutData%BlOutNd,1), UBOUND(OutData%BlOutNd,1) - OutData%BlOutNd(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - OutData%NTwOuts = IntKiBuf(Int_Xferred) + ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = LBOUND(OutData%TwOutNd,1) - i1_u = UBOUND(OutData%TwOutNd,1) - DO i1 = LBOUND(OutData%TwOutNd,1), UBOUND(OutData%TwOutNd,1) - OutData%TwOutNd(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotinputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF END DO - OutData%BldNd_NumOuts = IntKiBuf(Int_Xferred) + END IF + IF ( .NOT. ALLOCATED(InData%InflowWakeVel) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 - OutData%BldNd_TotNumOuts = IntKiBuf(Int_Xferred) + ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_OutParam not allocated + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowWakeVel,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowWakeVel,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowWakeVel,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowWakeVel,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InflowWakeVel,2), UBOUND(InData%InflowWakeVel,2) + DO i1 = LBOUND(InData%InflowWakeVel,1), UBOUND(InData%InflowWakeVel,1) + ReKiBuf(Re_Xferred) = InData%InflowWakeVel(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AD_PackInput + + SUBROUTINE AD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AD_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BldNd_OutParam)) DEALLOCATE(OutData%BldNd_OutParam) - ALLOCATE(OutData%BldNd_OutParam(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_OutParam.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BldNd_OutParam,1), UBOUND(OutData%BldNd_OutParam,1) + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -8666,7 +12705,7 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackoutparmtype( Re_Buf, Db_Buf, Int_Buf, OutData%BldNd_OutParam(i1), ErrStat2, ErrMsg2 ) ! BldNd_OutParam + CALL AD_Unpackrotinputtype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -8675,27 +12714,7 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BldNd_BlOutNd not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BldNd_BlOutNd)) DEALLOCATE(OutData%BldNd_BlOutNd) - ALLOCATE(OutData%BldNd_BlOutNd(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BldNd_BlOutNd.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BldNd_BlOutNd,1), UBOUND(OutData%BldNd_BlOutNd,1) - OutData%BldNd_BlOutNd(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - END IF - OutData%BldNd_BladesOut = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jac_u_indx not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowWakeVel not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -8705,216 +12724,99 @@ SUBROUTINE AD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Jac_u_indx)) DEALLOCATE(OutData%Jac_u_indx) - ALLOCATE(OutData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%InflowWakeVel)) DEALLOCATE(OutData%InflowWakeVel) + ALLOCATE(OutData%InflowWakeVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowWakeVel.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%Jac_u_indx,2), UBOUND(OutData%Jac_u_indx,2) - DO i1 = LBOUND(OutData%Jac_u_indx,1), UBOUND(OutData%Jac_u_indx,1) - OutData%Jac_u_indx(i1,i2) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 + DO i2 = LBOUND(OutData%InflowWakeVel,2), UBOUND(OutData%InflowWakeVel,2) + DO i1 = LBOUND(OutData%InflowWakeVel,1), UBOUND(OutData%InflowWakeVel,1) + OutData%InflowWakeVel(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! du not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%du)) DEALLOCATE(OutData%du) - ALLOCATE(OutData%du(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%du.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%du,1), UBOUND(OutData%du,1) - OutData%du(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dx not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%dx)) DEALLOCATE(OutData%dx) - ALLOCATE(OutData%dx(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dx.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%dx,1), UBOUND(OutData%dx,1) - OutData%dx(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - OutData%Jac_ny = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END SUBROUTINE AD_UnPackParam + END SUBROUTINE AD_UnPackInput - SUBROUTINE AD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(AD_InputType), INTENT(INOUT) :: SrcInputData - TYPE(AD_InputType), INTENT(INOUT) :: DstInputData + SUBROUTINE AD_CopyRotOutputType( SrcRotOutputTypeData, DstRotOutputTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(RotOutputType), INTENT(INOUT) :: SrcRotOutputTypeData + TYPE(RotOutputType), INTENT(INOUT) :: DstRotOutputTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyInput' -! - ErrStat = ErrID_None - ErrMsg = "" - CALL MeshCopy( SrcInputData%TowerMotion, DstInputData%TowerMotion, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL MeshCopy( SrcInputData%HubMotion, DstInputData%HubMotion, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcInputData%BladeRootMotion)) THEN - i1_l = LBOUND(SrcInputData%BladeRootMotion,1) - i1_u = UBOUND(SrcInputData%BladeRootMotion,1) - IF (.NOT. ALLOCATED(DstInputData%BladeRootMotion)) THEN - ALLOCATE(DstInputData%BladeRootMotion(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%BladeRootMotion.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DO i1 = LBOUND(SrcInputData%BladeRootMotion,1), UBOUND(SrcInputData%BladeRootMotion,1) - CALL MeshCopy( SrcInputData%BladeRootMotion(i1), DstInputData%BladeRootMotion(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcInputData%BladeMotion)) THEN - i1_l = LBOUND(SrcInputData%BladeMotion,1) - i1_u = UBOUND(SrcInputData%BladeMotion,1) - IF (.NOT. ALLOCATED(DstInputData%BladeMotion)) THEN - ALLOCATE(DstInputData%BladeMotion(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%BladeMotion.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DO i1 = LBOUND(SrcInputData%BladeMotion,1), UBOUND(SrcInputData%BladeMotion,1) - CALL MeshCopy( SrcInputData%BladeMotion(i1), DstInputData%BladeMotion(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcInputData%InflowOnBlade)) THEN - i1_l = LBOUND(SrcInputData%InflowOnBlade,1) - i1_u = UBOUND(SrcInputData%InflowOnBlade,1) - i2_l = LBOUND(SrcInputData%InflowOnBlade,2) - i2_u = UBOUND(SrcInputData%InflowOnBlade,2) - i3_l = LBOUND(SrcInputData%InflowOnBlade,3) - i3_u = UBOUND(SrcInputData%InflowOnBlade,3) - IF (.NOT. ALLOCATED(DstInputData%InflowOnBlade)) THEN - ALLOCATE(DstInputData%InflowOnBlade(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%InflowOnBlade.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInputData%InflowOnBlade = SrcInputData%InflowOnBlade -ENDIF -IF (ALLOCATED(SrcInputData%InflowOnTower)) THEN - i1_l = LBOUND(SrcInputData%InflowOnTower,1) - i1_u = UBOUND(SrcInputData%InflowOnTower,1) - i2_l = LBOUND(SrcInputData%InflowOnTower,2) - i2_u = UBOUND(SrcInputData%InflowOnTower,2) - IF (.NOT. ALLOCATED(DstInputData%InflowOnTower)) THEN - ALLOCATE(DstInputData%InflowOnTower(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%InflowOnTower.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInputData%InflowOnTower = SrcInputData%InflowOnTower -ENDIF -IF (ALLOCATED(SrcInputData%UserProp)) THEN - i1_l = LBOUND(SrcInputData%UserProp,1) - i1_u = UBOUND(SrcInputData%UserProp,1) - i2_l = LBOUND(SrcInputData%UserProp,2) - i2_u = UBOUND(SrcInputData%UserProp,2) - IF (.NOT. ALLOCATED(DstInputData%UserProp)) THEN - ALLOCATE(DstInputData%UserProp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AD_CopyRotOutputType' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL MeshCopy( SrcRotOutputTypeData%NacelleLoad, DstRotOutputTypeData%NacelleLoad, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL MeshCopy( SrcRotOutputTypeData%TowerLoad, DstRotOutputTypeData%TowerLoad, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcRotOutputTypeData%BladeLoad)) THEN + i1_l = LBOUND(SrcRotOutputTypeData%BladeLoad,1) + i1_u = UBOUND(SrcRotOutputTypeData%BladeLoad,1) + IF (.NOT. ALLOCATED(DstRotOutputTypeData%BladeLoad)) THEN + ALLOCATE(DstRotOutputTypeData%BladeLoad(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%UserProp.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotOutputTypeData%BladeLoad.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%UserProp = SrcInputData%UserProp + DO i1 = LBOUND(SrcRotOutputTypeData%BladeLoad,1), UBOUND(SrcRotOutputTypeData%BladeLoad,1) + CALL MeshCopy( SrcRotOutputTypeData%BladeLoad(i1), DstRotOutputTypeData%BladeLoad(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF -IF (ALLOCATED(SrcInputData%InflowWakeVel)) THEN - i1_l = LBOUND(SrcInputData%InflowWakeVel,1) - i1_u = UBOUND(SrcInputData%InflowWakeVel,1) - i2_l = LBOUND(SrcInputData%InflowWakeVel,2) - i2_u = UBOUND(SrcInputData%InflowWakeVel,2) - IF (.NOT. ALLOCATED(DstInputData%InflowWakeVel)) THEN - ALLOCATE(DstInputData%InflowWakeVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcRotOutputTypeData%WriteOutput)) THEN + i1_l = LBOUND(SrcRotOutputTypeData%WriteOutput,1) + i1_u = UBOUND(SrcRotOutputTypeData%WriteOutput,1) + IF (.NOT. ALLOCATED(DstRotOutputTypeData%WriteOutput)) THEN + ALLOCATE(DstRotOutputTypeData%WriteOutput(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%InflowWakeVel.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRotOutputTypeData%WriteOutput.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%InflowWakeVel = SrcInputData%InflowWakeVel + DstRotOutputTypeData%WriteOutput = SrcRotOutputTypeData%WriteOutput ENDIF - END SUBROUTINE AD_CopyInput + END SUBROUTINE AD_CopyRotOutputType - SUBROUTINE AD_DestroyInput( InputData, ErrStat, ErrMsg ) - TYPE(AD_InputType), INTENT(INOUT) :: InputData + SUBROUTINE AD_DestroyRotOutputType( RotOutputTypeData, ErrStat, ErrMsg ) + TYPE(RotOutputType), INTENT(INOUT) :: RotOutputTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_DestroyRotOutputType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL MeshDestroy( InputData%TowerMotion, ErrStat, ErrMsg ) - CALL MeshDestroy( InputData%HubMotion, ErrStat, ErrMsg ) -IF (ALLOCATED(InputData%BladeRootMotion)) THEN -DO i1 = LBOUND(InputData%BladeRootMotion,1), UBOUND(InputData%BladeRootMotion,1) - CALL MeshDestroy( InputData%BladeRootMotion(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InputData%BladeRootMotion) -ENDIF -IF (ALLOCATED(InputData%BladeMotion)) THEN -DO i1 = LBOUND(InputData%BladeMotion,1), UBOUND(InputData%BladeMotion,1) - CALL MeshDestroy( InputData%BladeMotion(i1), ErrStat, ErrMsg ) + CALL MeshDestroy( RotOutputTypeData%NacelleLoad, ErrStat, ErrMsg ) + CALL MeshDestroy( RotOutputTypeData%TowerLoad, ErrStat, ErrMsg ) +IF (ALLOCATED(RotOutputTypeData%BladeLoad)) THEN +DO i1 = LBOUND(RotOutputTypeData%BladeLoad,1), UBOUND(RotOutputTypeData%BladeLoad,1) + CALL MeshDestroy( RotOutputTypeData%BladeLoad(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(InputData%BladeMotion) + DEALLOCATE(RotOutputTypeData%BladeLoad) ENDIF -IF (ALLOCATED(InputData%InflowOnBlade)) THEN - DEALLOCATE(InputData%InflowOnBlade) -ENDIF -IF (ALLOCATED(InputData%InflowOnTower)) THEN - DEALLOCATE(InputData%InflowOnTower) -ENDIF -IF (ALLOCATED(InputData%UserProp)) THEN - DEALLOCATE(InputData%UserProp) -ENDIF -IF (ALLOCATED(InputData%InflowWakeVel)) THEN - DEALLOCATE(InputData%InflowWakeVel) +IF (ALLOCATED(RotOutputTypeData%WriteOutput)) THEN + DEALLOCATE(RotOutputTypeData%WriteOutput) ENDIF - END SUBROUTINE AD_DestroyInput + END SUBROUTINE AD_DestroyRotOutputType - SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE AD_PackRotOutputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(AD_InputType), INTENT(IN) :: InData + TYPE(RotOutputType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -8929,7 +12831,7 @@ SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_PackRotOutputType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -8946,105 +12848,67 @@ SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Db_BufSz = 0 Int_BufSz = 0 ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! TowerMotion: size of buffers for each call to pack subtype - CALL MeshPack( InData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TowerMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! TowerMotion - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! TowerMotion - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! TowerMotion - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! HubMotion: size of buffers for each call to pack subtype - CALL MeshPack( InData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! HubMotion + Int_BufSz = Int_BufSz + 3 ! NacelleLoad: size of buffers for each call to pack subtype + CALL MeshPack( InData%NacelleLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! NacelleLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! HubMotion + IF(ALLOCATED(Re_Buf)) THEN ! NacelleLoad Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! HubMotion + IF(ALLOCATED(Db_Buf)) THEN ! NacelleLoad Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! HubMotion + IF(ALLOCATED(Int_Buf)) THEN ! NacelleLoad Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! BladeRootMotion allocated yes/no - IF ( ALLOCATED(InData%BladeRootMotion) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeRootMotion upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BladeRootMotion,1), UBOUND(InData%BladeRootMotion,1) - Int_BufSz = Int_BufSz + 3 ! BladeRootMotion: size of buffers for each call to pack subtype - CALL MeshPack( InData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeRootMotion + Int_BufSz = Int_BufSz + 3 ! TowerLoad: size of buffers for each call to pack subtype + CALL MeshPack( InData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TowerLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BladeRootMotion + IF(ALLOCATED(Re_Buf)) THEN ! TowerLoad Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeRootMotion + IF(ALLOCATED(Db_Buf)) THEN ! TowerLoad Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeRootMotion + IF(ALLOCATED(Int_Buf)) THEN ! TowerLoad Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - END DO - END IF - Int_BufSz = Int_BufSz + 1 ! BladeMotion allocated yes/no - IF ( ALLOCATED(InData%BladeMotion) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeMotion upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BladeMotion,1), UBOUND(InData%BladeMotion,1) - Int_BufSz = Int_BufSz + 3 ! BladeMotion: size of buffers for each call to pack subtype - CALL MeshPack( InData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeMotion + Int_BufSz = Int_BufSz + 1 ! BladeLoad allocated yes/no + IF ( ALLOCATED(InData%BladeLoad) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BladeLoad upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BladeLoad,1), UBOUND(InData%BladeLoad,1) + Int_BufSz = Int_BufSz + 3 ! BladeLoad: size of buffers for each call to pack subtype + CALL MeshPack( InData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BladeMotion + IF(ALLOCATED(Re_Buf)) THEN ! BladeLoad Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeMotion + IF(ALLOCATED(Db_Buf)) THEN ! BladeLoad Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeMotion + IF(ALLOCATED(Int_Buf)) THEN ! BladeLoad Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! InflowOnBlade allocated yes/no - IF ( ALLOCATED(InData%InflowOnBlade) ) THEN - Int_BufSz = Int_BufSz + 2*3 ! InflowOnBlade upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%InflowOnBlade) ! InflowOnBlade - END IF - Int_BufSz = Int_BufSz + 1 ! InflowOnTower allocated yes/no - IF ( ALLOCATED(InData%InflowOnTower) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! InflowOnTower upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%InflowOnTower) ! InflowOnTower - END IF - Int_BufSz = Int_BufSz + 1 ! UserProp allocated yes/no - IF ( ALLOCATED(InData%UserProp) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! UserProp upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%UserProp) ! UserProp - END IF - Int_BufSz = Int_BufSz + 1 ! InflowWakeVel allocated yes/no - IF ( ALLOCATED(InData%InflowWakeVel) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! InflowWakeVel upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%InflowWakeVel) ! InflowWakeVel + Int_BufSz = Int_BufSz + 1 ! WriteOutput allocated yes/no + IF ( ALLOCATED(InData%WriteOutput) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WriteOutput upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WriteOutput) ! WriteOutput END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) @@ -9073,74 +12937,7 @@ SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Db_Xferred = 1 Int_Xferred = 1 - CALL MeshPack( InData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TowerMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL MeshPack( InData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! HubMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF ( .NOT. ALLOCATED(InData%BladeRootMotion) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootMotion,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootMotion,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BladeRootMotion,1), UBOUND(InData%BladeRootMotion,1) - CALL MeshPack( InData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeRootMotion + CALL MeshPack( InData%NacelleLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! NacelleLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -9168,20 +12965,7 @@ SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BladeMotion) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeMotion,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeMotion,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%BladeMotion,1), UBOUND(InData%BladeMotion,1) - CALL MeshPack( InData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeMotion + CALL MeshPack( InData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TowerLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -9200,109 +12984,78 @@ SUBROUTINE AD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si DEALLOCATE(Db_Buf) ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO - END IF - IF ( .NOT. ALLOCATED(InData%InflowOnBlade) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,2) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnBlade,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnBlade,3) - Int_Xferred = Int_Xferred + 2 - - DO i3 = LBOUND(InData%InflowOnBlade,3), UBOUND(InData%InflowOnBlade,3) - DO i2 = LBOUND(InData%InflowOnBlade,2), UBOUND(InData%InflowOnBlade,2) - DO i1 = LBOUND(InData%InflowOnBlade,1), UBOUND(InData%InflowOnBlade,1) - ReKiBuf(Re_Xferred) = InData%InflowOnBlade(i1,i2,i3) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%InflowOnTower) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnTower,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnTower,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowOnTower,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowOnTower,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%InflowOnTower,2), UBOUND(InData%InflowOnTower,2) - DO i1 = LBOUND(InData%InflowOnTower,1), UBOUND(InData%InflowOnTower,1) - ReKiBuf(Re_Xferred) = InData%InflowOnTower(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( .NOT. ALLOCATED(InData%UserProp) ) THEN + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%BladeLoad) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UserProp,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UserProp,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UserProp,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UserProp,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeLoad,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeLoad,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%UserProp,2), UBOUND(InData%UserProp,2) - DO i1 = LBOUND(InData%UserProp,1), UBOUND(InData%UserProp,1) - ReKiBuf(Re_Xferred) = InData%UserProp(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i1 = LBOUND(InData%BladeLoad,1), UBOUND(InData%BladeLoad,1) + CALL MeshPack( InData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - IF ( .NOT. ALLOCATED(InData%InflowWakeVel) ) THEN + IF ( .NOT. ALLOCATED(InData%WriteOutput) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowWakeVel,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowWakeVel,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InflowWakeVel,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InflowWakeVel,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutput,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutput,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%InflowWakeVel,2), UBOUND(InData%InflowWakeVel,2) - DO i1 = LBOUND(InData%InflowWakeVel,1), UBOUND(InData%InflowWakeVel,1) - ReKiBuf(Re_Xferred) = InData%InflowWakeVel(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO + DO i1 = LBOUND(InData%WriteOutput,1), UBOUND(InData%WriteOutput,1) + ReKiBuf(Re_Xferred) = InData%WriteOutput(i1) + Re_Xferred = Re_Xferred + 1 END DO END IF - END SUBROUTINE AD_PackInput + END SUBROUTINE AD_PackRotOutputType - SUBROUTINE AD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE AD_UnPackRotOutputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(AD_InputType), INTENT(INOUT) :: OutData + TYPE(RotOutputType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -9312,11 +13065,9 @@ SUBROUTINE AD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackInput' + CHARACTER(*), PARAMETER :: RoutineName = 'AD_UnPackRotOutputType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -9360,123 +13111,13 @@ SUBROUTINE AD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%TowerMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TowerMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%HubMotion, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! HubMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootMotion not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeRootMotion)) DEALLOCATE(OutData%BladeRootMotion) - ALLOCATE(OutData%BladeRootMotion(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootMotion.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BladeRootMotion,1), UBOUND(OutData%BladeRootMotion,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%BladeRootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeRootMotion + CALL MeshUnpack( OutData%NacelleLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! NacelleLoad CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeMotion not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeMotion)) DEALLOCATE(OutData%BladeMotion) - ALLOCATE(OutData%BladeMotion(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeMotion.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BladeMotion,1), UBOUND(OutData%BladeMotion,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -9502,121 +13143,96 @@ SUBROUTINE AD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%BladeMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeMotion - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowOnBlade not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i3_l = IntKiBuf( Int_Xferred ) - i3_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%InflowOnBlade)) DEALLOCATE(OutData%InflowOnBlade) - ALLOCATE(OutData%InflowOnBlade(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowOnBlade.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i3 = LBOUND(OutData%InflowOnBlade,3), UBOUND(OutData%InflowOnBlade,3) - DO i2 = LBOUND(OutData%InflowOnBlade,2), UBOUND(OutData%InflowOnBlade,2) - DO i1 = LBOUND(OutData%InflowOnBlade,1), UBOUND(OutData%InflowOnBlade,1) - OutData%InflowOnBlade(i1,i2,i3) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowOnTower not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%InflowOnTower)) DEALLOCATE(OutData%InflowOnTower) - ALLOCATE(OutData%InflowOnTower(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowOnTower.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%InflowOnTower,2), UBOUND(OutData%InflowOnTower,2) - DO i1 = LBOUND(OutData%InflowOnTower,1), UBOUND(OutData%InflowOnTower,1) - OutData%InflowOnTower(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! UserProp not allocated + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TowerLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeLoad not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%UserProp)) DEALLOCATE(OutData%UserProp) - ALLOCATE(OutData%UserProp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BladeLoad)) DEALLOCATE(OutData%BladeLoad) + ALLOCATE(OutData%BladeLoad(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%UserProp.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeLoad.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%UserProp,2), UBOUND(OutData%UserProp,2) - DO i1 = LBOUND(OutData%UserProp,1), UBOUND(OutData%UserProp,1) - OutData%UserProp(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i1 = LBOUND(OutData%BladeLoad,1), UBOUND(OutData%BladeLoad,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InflowWakeVel not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutput not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%InflowWakeVel)) DEALLOCATE(OutData%InflowWakeVel) - ALLOCATE(OutData%InflowWakeVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%WriteOutput)) DEALLOCATE(OutData%WriteOutput) + ALLOCATE(OutData%WriteOutput(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InflowWakeVel.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutput.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%InflowWakeVel,2), UBOUND(OutData%InflowWakeVel,2) - DO i1 = LBOUND(OutData%InflowWakeVel,1), UBOUND(OutData%InflowWakeVel,1) - OutData%InflowWakeVel(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO + DO i1 = LBOUND(OutData%WriteOutput,1), UBOUND(OutData%WriteOutput,1) + OutData%WriteOutput(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 END DO END IF - END SUBROUTINE AD_UnPackInput + END SUBROUTINE AD_UnPackRotOutputType SUBROUTINE AD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) TYPE(AD_OutputType), INTENT(INOUT) :: SrcOutputData @@ -9633,36 +13249,21 @@ SUBROUTINE AD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMs ! ErrStat = ErrID_None ErrMsg = "" - CALL MeshCopy( SrcOutputData%TowerLoad, DstOutputData%TowerLoad, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcOutputData%BladeLoad)) THEN - i1_l = LBOUND(SrcOutputData%BladeLoad,1) - i1_u = UBOUND(SrcOutputData%BladeLoad,1) - IF (.NOT. ALLOCATED(DstOutputData%BladeLoad)) THEN - ALLOCATE(DstOutputData%BladeLoad(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcOutputData%rotors)) THEN + i1_l = LBOUND(SrcOutputData%rotors,1) + i1_u = UBOUND(SrcOutputData%rotors,1) + IF (.NOT. ALLOCATED(DstOutputData%rotors)) THEN + ALLOCATE(DstOutputData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%BladeLoad.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcOutputData%BladeLoad,1), UBOUND(SrcOutputData%BladeLoad,1) - CALL MeshCopy( SrcOutputData%BladeLoad(i1), DstOutputData%BladeLoad(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + DO i1 = LBOUND(SrcOutputData%rotors,1), UBOUND(SrcOutputData%rotors,1) + CALL AD_Copyrotoutputtype( SrcOutputData%rotors(i1), DstOutputData%rotors(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO -ENDIF -IF (ALLOCATED(SrcOutputData%WriteOutput)) THEN - i1_l = LBOUND(SrcOutputData%WriteOutput,1) - i1_u = UBOUND(SrcOutputData%WriteOutput,1) - IF (.NOT. ALLOCATED(DstOutputData%WriteOutput)) THEN - ALLOCATE(DstOutputData%WriteOutput(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%WriteOutput.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstOutputData%WriteOutput = SrcOutputData%WriteOutput ENDIF END SUBROUTINE AD_CopyOutput @@ -9675,15 +13276,11 @@ SUBROUTINE AD_DestroyOutput( OutputData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" - CALL MeshDestroy( OutputData%TowerLoad, ErrStat, ErrMsg ) -IF (ALLOCATED(OutputData%BladeLoad)) THEN -DO i1 = LBOUND(OutputData%BladeLoad,1), UBOUND(OutputData%BladeLoad,1) - CALL MeshDestroy( OutputData%BladeLoad(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(OutputData%rotors)) THEN +DO i1 = LBOUND(OutputData%rotors,1), UBOUND(OutputData%rotors,1) + CALL AD_Destroyrotoutputtype( OutputData%rotors(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(OutputData%BladeLoad) -ENDIF -IF (ALLOCATED(OutputData%WriteOutput)) THEN - DEALLOCATE(OutputData%WriteOutput) + DEALLOCATE(OutputData%rotors) ENDIF END SUBROUTINE AD_DestroyOutput @@ -9722,52 +13319,30 @@ SUBROUTINE AD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! rotors allocated yes/no + IF ( ALLOCATED(InData%rotors) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! rotors upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! TowerLoad: size of buffers for each call to pack subtype - CALL MeshPack( InData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TowerLoad - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! TowerLoad - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! TowerLoad - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! TowerLoad - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 1 ! BladeLoad allocated yes/no - IF ( ALLOCATED(InData%BladeLoad) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BladeLoad upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BladeLoad,1), UBOUND(InData%BladeLoad,1) - Int_BufSz = Int_BufSz + 3 ! BladeLoad: size of buffers for each call to pack subtype - CALL MeshPack( InData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BladeLoad + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + Int_BufSz = Int_BufSz + 3 ! rotors: size of buffers for each call to pack subtype + CALL AD_Packrotoutputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, .TRUE. ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BladeLoad + IF(ALLOCATED(Re_Buf)) THEN ! rotors Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BladeLoad + IF(ALLOCATED(Db_Buf)) THEN ! rotors Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BladeLoad + IF(ALLOCATED(Int_Buf)) THEN ! rotors Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! WriteOutput allocated yes/no - IF ( ALLOCATED(InData%WriteOutput) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! WriteOutput upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%WriteOutput) ! WriteOutput - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -9795,46 +13370,18 @@ SUBROUTINE AD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Db_Xferred = 1 Int_Xferred = 1 - CALL MeshPack( InData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TowerLoad - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF ( .NOT. ALLOCATED(InData%BladeLoad) ) THEN + IF ( .NOT. ALLOCATED(InData%rotors) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeLoad,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeLoad,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%rotors,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rotors,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BladeLoad,1), UBOUND(InData%BladeLoad,1) - CALL MeshPack( InData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BladeLoad + DO i1 = LBOUND(InData%rotors,1), UBOUND(InData%rotors,1) + CALL AD_Packrotoutputtype( Re_Buf, Db_Buf, Int_Buf, InData%rotors(i1), ErrStat2, ErrMsg2, OnlySize ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -9864,21 +13411,6 @@ SUBROUTINE AD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%WriteOutput) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutput,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutput,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%WriteOutput,1), UBOUND(InData%WriteOutput,1) - ReKiBuf(Re_Xferred) = InData%WriteOutput(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE AD_PackOutput SUBROUTINE AD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -9908,60 +13440,20 @@ SUBROUTINE AD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%TowerLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TowerLoad - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeLoad not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rotors not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeLoad)) DEALLOCATE(OutData%BladeLoad) - ALLOCATE(OutData%BladeLoad(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%rotors)) DEALLOCATE(OutData%rotors) + ALLOCATE(OutData%rotors(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeLoad.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rotors.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BladeLoad,1), UBOUND(OutData%BladeLoad,1) + DO i1 = LBOUND(OutData%rotors,1), UBOUND(OutData%rotors,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -9995,7 +13487,7 @@ SUBROUTINE AD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%BladeLoad(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BladeLoad + CALL AD_Unpackrotoutputtype( Re_Buf, Db_Buf, Int_Buf, OutData%rotors(i1), ErrStat2, ErrMsg2 ) ! rotors CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10004,24 +13496,6 @@ SUBROUTINE AD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutput not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%WriteOutput)) DEALLOCATE(OutData%WriteOutput) - ALLOCATE(OutData%WriteOutput(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutput.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%WriteOutput,1), UBOUND(OutData%WriteOutput,1) - OutData%WriteOutput(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE AD_UnPackOutput @@ -10123,47 +13597,73 @@ SUBROUTINE AD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg ) END IF ScaleFactor = t_out / t(2) - CALL MeshExtrapInterp1(u1%TowerMotion, u2%TowerMotion, tin, u_out%TowerMotion, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(u_out%rotors) .AND. ALLOCATED(u1%rotors)) THEN + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp1(u1%rotors(i01)%NacelleMotion, u2%rotors(i01)%NacelleMotion, tin, u_out%rotors(i01)%NacelleMotion, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL MeshExtrapInterp1(u1%HubMotion, u2%HubMotion, tin, u_out%HubMotion, tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp1(u1%rotors(i01)%TowerMotion, u2%rotors(i01)%TowerMotion, tin, u_out%rotors(i01)%TowerMotion, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(u_out%BladeRootMotion) .AND. ALLOCATED(u1%BladeRootMotion)) THEN - DO i1 = LBOUND(u_out%BladeRootMotion,1),UBOUND(u_out%BladeRootMotion,1) - CALL MeshExtrapInterp1(u1%BladeRootMotion(i1), u2%BladeRootMotion(i1), tin, u_out%BladeRootMotion(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp1(u1%rotors(i01)%HubMotion, u2%rotors(i01)%HubMotion, tin, u_out%rotors(i01)%HubMotion, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%BladeRootMotion) .AND. ALLOCATED(u1%rotors(i01)%BladeRootMotion)) THEN + DO i1 = LBOUND(u_out%rotors(i01)%BladeRootMotion,1),UBOUND(u_out%rotors(i01)%BladeRootMotion,1) + CALL MeshExtrapInterp1(u1%rotors(i01)%BladeRootMotion(i1), u2%rotors(i01)%BladeRootMotion(i1), tin, u_out%rotors(i01)%BladeRootMotion(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(u_out%BladeMotion) .AND. ALLOCATED(u1%BladeMotion)) THEN - DO i1 = LBOUND(u_out%BladeMotion,1),UBOUND(u_out%BladeMotion,1) - CALL MeshExtrapInterp1(u1%BladeMotion(i1), u2%BladeMotion(i1), tin, u_out%BladeMotion(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%BladeMotion) .AND. ALLOCATED(u1%rotors(i01)%BladeMotion)) THEN + DO i1 = LBOUND(u_out%rotors(i01)%BladeMotion,1),UBOUND(u_out%rotors(i01)%BladeMotion,1) + CALL MeshExtrapInterp1(u1%rotors(i01)%BladeMotion(i1), u2%rotors(i01)%BladeMotion(i1), tin, u_out%rotors(i01)%BladeMotion(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(u_out%InflowOnBlade) .AND. ALLOCATED(u1%InflowOnBlade)) THEN - DO i3 = LBOUND(u_out%InflowOnBlade,3),UBOUND(u_out%InflowOnBlade,3) - DO i2 = LBOUND(u_out%InflowOnBlade,2),UBOUND(u_out%InflowOnBlade,2) - DO i1 = LBOUND(u_out%InflowOnBlade,1),UBOUND(u_out%InflowOnBlade,1) - b = -(u1%InflowOnBlade(i1,i2,i3) - u2%InflowOnBlade(i1,i2,i3)) - u_out%InflowOnBlade(i1,i2,i3) = u1%InflowOnBlade(i1,i2,i3) + b * ScaleFactor + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%InflowOnBlade) .AND. ALLOCATED(u1%rotors(i01)%InflowOnBlade)) THEN + DO i3 = LBOUND(u_out%rotors(i01)%InflowOnBlade,3),UBOUND(u_out%rotors(i01)%InflowOnBlade,3) + DO i2 = LBOUND(u_out%rotors(i01)%InflowOnBlade,2),UBOUND(u_out%rotors(i01)%InflowOnBlade,2) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnBlade,1),UBOUND(u_out%rotors(i01)%InflowOnBlade,1) + b = -(u1%rotors(i01)%InflowOnBlade(i1,i2,i3) - u2%rotors(i01)%InflowOnBlade(i1,i2,i3)) + u_out%rotors(i01)%InflowOnBlade(i1,i2,i3) = u1%rotors(i01)%InflowOnBlade(i1,i2,i3) + b * ScaleFactor END DO END DO END DO END IF ! check if allocated -IF (ALLOCATED(u_out%InflowOnTower) .AND. ALLOCATED(u1%InflowOnTower)) THEN - DO i2 = LBOUND(u_out%InflowOnTower,2),UBOUND(u_out%InflowOnTower,2) - DO i1 = LBOUND(u_out%InflowOnTower,1),UBOUND(u_out%InflowOnTower,1) - b = -(u1%InflowOnTower(i1,i2) - u2%InflowOnTower(i1,i2)) - u_out%InflowOnTower(i1,i2) = u1%InflowOnTower(i1,i2) + b * ScaleFactor + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%InflowOnTower) .AND. ALLOCATED(u1%rotors(i01)%InflowOnTower)) THEN + DO i2 = LBOUND(u_out%rotors(i01)%InflowOnTower,2),UBOUND(u_out%rotors(i01)%InflowOnTower,2) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnTower,1),UBOUND(u_out%rotors(i01)%InflowOnTower,1) + b = -(u1%rotors(i01)%InflowOnTower(i1,i2) - u2%rotors(i01)%InflowOnTower(i1,i2)) + u_out%rotors(i01)%InflowOnTower(i1,i2) = u1%rotors(i01)%InflowOnTower(i1,i2) + b * ScaleFactor END DO END DO END IF ! check if allocated -IF (ALLOCATED(u_out%UserProp) .AND. ALLOCATED(u1%UserProp)) THEN - DO i2 = LBOUND(u_out%UserProp,2),UBOUND(u_out%UserProp,2) - DO i1 = LBOUND(u_out%UserProp,1),UBOUND(u_out%UserProp,1) - b = -(u1%UserProp(i1,i2) - u2%UserProp(i1,i2)) - u_out%UserProp(i1,i2) = u1%UserProp(i1,i2) + b * ScaleFactor + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnNacelle,1),UBOUND(u_out%rotors(i01)%InflowOnNacelle,1) + b = -(u1%rotors(i01)%InflowOnNacelle(i1) - u2%rotors(i01)%InflowOnNacelle(i1)) + u_out%rotors(i01)%InflowOnNacelle(i1) = u1%rotors(i01)%InflowOnNacelle(i1) + b * ScaleFactor + END DO + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%UserProp) .AND. ALLOCATED(u1%rotors(i01)%UserProp)) THEN + DO i2 = LBOUND(u_out%rotors(i01)%UserProp,2),UBOUND(u_out%rotors(i01)%UserProp,2) + DO i1 = LBOUND(u_out%rotors(i01)%UserProp,1),UBOUND(u_out%rotors(i01)%UserProp,1) + b = -(u1%rotors(i01)%UserProp(i1,i2) - u2%rotors(i01)%UserProp(i1,i2)) + u_out%rotors(i01)%UserProp(i1,i2) = u1%rotors(i01)%UserProp(i1,i2) + b * ScaleFactor END DO END DO +END IF ! check if allocated + ENDDO END IF ! check if allocated IF (ALLOCATED(u_out%InflowWakeVel) .AND. ALLOCATED(u1%InflowWakeVel)) THEN DO i2 = LBOUND(u_out%InflowWakeVel,2),UBOUND(u_out%InflowWakeVel,2) @@ -10234,50 +13734,77 @@ SUBROUTINE AD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, ErrM END IF ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) - CALL MeshExtrapInterp2(u1%TowerMotion, u2%TowerMotion, u3%TowerMotion, tin, u_out%TowerMotion, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(u_out%rotors) .AND. ALLOCATED(u1%rotors)) THEN + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp2(u1%rotors(i01)%NacelleMotion, u2%rotors(i01)%NacelleMotion, u3%rotors(i01)%NacelleMotion, tin, u_out%rotors(i01)%NacelleMotion, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp2(u1%rotors(i01)%TowerMotion, u2%rotors(i01)%TowerMotion, u3%rotors(i01)%TowerMotion, tin, u_out%rotors(i01)%TowerMotion, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL MeshExtrapInterp2(u1%HubMotion, u2%HubMotion, u3%HubMotion, tin, u_out%HubMotion, tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + CALL MeshExtrapInterp2(u1%rotors(i01)%HubMotion, u2%rotors(i01)%HubMotion, u3%rotors(i01)%HubMotion, tin, u_out%rotors(i01)%HubMotion, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(u_out%BladeRootMotion) .AND. ALLOCATED(u1%BladeRootMotion)) THEN - DO i1 = LBOUND(u_out%BladeRootMotion,1),UBOUND(u_out%BladeRootMotion,1) - CALL MeshExtrapInterp2(u1%BladeRootMotion(i1), u2%BladeRootMotion(i1), u3%BladeRootMotion(i1), tin, u_out%BladeRootMotion(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%BladeRootMotion) .AND. ALLOCATED(u1%rotors(i01)%BladeRootMotion)) THEN + DO i1 = LBOUND(u_out%rotors(i01)%BladeRootMotion,1),UBOUND(u_out%rotors(i01)%BladeRootMotion,1) + CALL MeshExtrapInterp2(u1%rotors(i01)%BladeRootMotion(i1), u2%rotors(i01)%BladeRootMotion(i1), u3%rotors(i01)%BladeRootMotion(i1), tin, u_out%rotors(i01)%BladeRootMotion(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(u_out%BladeMotion) .AND. ALLOCATED(u1%BladeMotion)) THEN - DO i1 = LBOUND(u_out%BladeMotion,1),UBOUND(u_out%BladeMotion,1) - CALL MeshExtrapInterp2(u1%BladeMotion(i1), u2%BladeMotion(i1), u3%BladeMotion(i1), tin, u_out%BladeMotion(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%BladeMotion) .AND. ALLOCATED(u1%rotors(i01)%BladeMotion)) THEN + DO i1 = LBOUND(u_out%rotors(i01)%BladeMotion,1),UBOUND(u_out%rotors(i01)%BladeMotion,1) + CALL MeshExtrapInterp2(u1%rotors(i01)%BladeMotion(i1), u2%rotors(i01)%BladeMotion(i1), u3%rotors(i01)%BladeMotion(i1), tin, u_out%rotors(i01)%BladeMotion(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(u_out%InflowOnBlade) .AND. ALLOCATED(u1%InflowOnBlade)) THEN - DO i3 = LBOUND(u_out%InflowOnBlade,3),UBOUND(u_out%InflowOnBlade,3) - DO i2 = LBOUND(u_out%InflowOnBlade,2),UBOUND(u_out%InflowOnBlade,2) - DO i1 = LBOUND(u_out%InflowOnBlade,1),UBOUND(u_out%InflowOnBlade,1) - b = (t(3)**2*(u1%InflowOnBlade(i1,i2,i3) - u2%InflowOnBlade(i1,i2,i3)) + t(2)**2*(-u1%InflowOnBlade(i1,i2,i3) + u3%InflowOnBlade(i1,i2,i3)))* scaleFactor - c = ( (t(2)-t(3))*u1%InflowOnBlade(i1,i2,i3) + t(3)*u2%InflowOnBlade(i1,i2,i3) - t(2)*u3%InflowOnBlade(i1,i2,i3) ) * scaleFactor - u_out%InflowOnBlade(i1,i2,i3) = u1%InflowOnBlade(i1,i2,i3) + b + c * t_out + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%InflowOnBlade) .AND. ALLOCATED(u1%rotors(i01)%InflowOnBlade)) THEN + DO i3 = LBOUND(u_out%rotors(i01)%InflowOnBlade,3),UBOUND(u_out%rotors(i01)%InflowOnBlade,3) + DO i2 = LBOUND(u_out%rotors(i01)%InflowOnBlade,2),UBOUND(u_out%rotors(i01)%InflowOnBlade,2) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnBlade,1),UBOUND(u_out%rotors(i01)%InflowOnBlade,1) + b = (t(3)**2*(u1%rotors(i01)%InflowOnBlade(i1,i2,i3) - u2%rotors(i01)%InflowOnBlade(i1,i2,i3)) + t(2)**2*(-u1%rotors(i01)%InflowOnBlade(i1,i2,i3) + u3%rotors(i01)%InflowOnBlade(i1,i2,i3)))* scaleFactor + c = ( (t(2)-t(3))*u1%rotors(i01)%InflowOnBlade(i1,i2,i3) + t(3)*u2%rotors(i01)%InflowOnBlade(i1,i2,i3) - t(2)*u3%rotors(i01)%InflowOnBlade(i1,i2,i3) ) * scaleFactor + u_out%rotors(i01)%InflowOnBlade(i1,i2,i3) = u1%rotors(i01)%InflowOnBlade(i1,i2,i3) + b + c * t_out END DO END DO END DO END IF ! check if allocated -IF (ALLOCATED(u_out%InflowOnTower) .AND. ALLOCATED(u1%InflowOnTower)) THEN - DO i2 = LBOUND(u_out%InflowOnTower,2),UBOUND(u_out%InflowOnTower,2) - DO i1 = LBOUND(u_out%InflowOnTower,1),UBOUND(u_out%InflowOnTower,1) - b = (t(3)**2*(u1%InflowOnTower(i1,i2) - u2%InflowOnTower(i1,i2)) + t(2)**2*(-u1%InflowOnTower(i1,i2) + u3%InflowOnTower(i1,i2)))* scaleFactor - c = ( (t(2)-t(3))*u1%InflowOnTower(i1,i2) + t(3)*u2%InflowOnTower(i1,i2) - t(2)*u3%InflowOnTower(i1,i2) ) * scaleFactor - u_out%InflowOnTower(i1,i2) = u1%InflowOnTower(i1,i2) + b + c * t_out + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%InflowOnTower) .AND. ALLOCATED(u1%rotors(i01)%InflowOnTower)) THEN + DO i2 = LBOUND(u_out%rotors(i01)%InflowOnTower,2),UBOUND(u_out%rotors(i01)%InflowOnTower,2) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnTower,1),UBOUND(u_out%rotors(i01)%InflowOnTower,1) + b = (t(3)**2*(u1%rotors(i01)%InflowOnTower(i1,i2) - u2%rotors(i01)%InflowOnTower(i1,i2)) + t(2)**2*(-u1%rotors(i01)%InflowOnTower(i1,i2) + u3%rotors(i01)%InflowOnTower(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%rotors(i01)%InflowOnTower(i1,i2) + t(3)*u2%rotors(i01)%InflowOnTower(i1,i2) - t(2)*u3%rotors(i01)%InflowOnTower(i1,i2) ) * scaleFactor + u_out%rotors(i01)%InflowOnTower(i1,i2) = u1%rotors(i01)%InflowOnTower(i1,i2) + b + c * t_out END DO END DO END IF ! check if allocated -IF (ALLOCATED(u_out%UserProp) .AND. ALLOCATED(u1%UserProp)) THEN - DO i2 = LBOUND(u_out%UserProp,2),UBOUND(u_out%UserProp,2) - DO i1 = LBOUND(u_out%UserProp,1),UBOUND(u_out%UserProp,1) - b = (t(3)**2*(u1%UserProp(i1,i2) - u2%UserProp(i1,i2)) + t(2)**2*(-u1%UserProp(i1,i2) + u3%UserProp(i1,i2)))* scaleFactor - c = ( (t(2)-t(3))*u1%UserProp(i1,i2) + t(3)*u2%UserProp(i1,i2) - t(2)*u3%UserProp(i1,i2) ) * scaleFactor - u_out%UserProp(i1,i2) = u1%UserProp(i1,i2) + b + c * t_out + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) + DO i1 = LBOUND(u_out%rotors(i01)%InflowOnNacelle,1),UBOUND(u_out%rotors(i01)%InflowOnNacelle,1) + b = (t(3)**2*(u1%rotors(i01)%InflowOnNacelle(i1) - u2%rotors(i01)%InflowOnNacelle(i1)) + t(2)**2*(-u1%rotors(i01)%InflowOnNacelle(i1) + u3%rotors(i01)%InflowOnNacelle(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%rotors(i01)%InflowOnNacelle(i1) + t(3)*u2%rotors(i01)%InflowOnNacelle(i1) - t(2)*u3%rotors(i01)%InflowOnNacelle(i1) ) * scaleFactor + u_out%rotors(i01)%InflowOnNacelle(i1) = u1%rotors(i01)%InflowOnNacelle(i1) + b + c * t_out + END DO + ENDDO + DO i01 = LBOUND(u_out%rotors,1),UBOUND(u_out%rotors,1) +IF (ALLOCATED(u_out%rotors(i01)%UserProp) .AND. ALLOCATED(u1%rotors(i01)%UserProp)) THEN + DO i2 = LBOUND(u_out%rotors(i01)%UserProp,2),UBOUND(u_out%rotors(i01)%UserProp,2) + DO i1 = LBOUND(u_out%rotors(i01)%UserProp,1),UBOUND(u_out%rotors(i01)%UserProp,1) + b = (t(3)**2*(u1%rotors(i01)%UserProp(i1,i2) - u2%rotors(i01)%UserProp(i1,i2)) + t(2)**2*(-u1%rotors(i01)%UserProp(i1,i2) + u3%rotors(i01)%UserProp(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%rotors(i01)%UserProp(i1,i2) + t(3)*u2%rotors(i01)%UserProp(i1,i2) - t(2)*u3%rotors(i01)%UserProp(i1,i2) ) * scaleFactor + u_out%rotors(i01)%UserProp(i1,i2) = u1%rotors(i01)%UserProp(i1,i2) + b + c * t_out END DO END DO +END IF ! check if allocated + ENDDO END IF ! check if allocated IF (ALLOCATED(u_out%InflowWakeVel) .AND. ALLOCATED(u1%InflowWakeVel)) THEN DO i2 = LBOUND(u_out%InflowWakeVel,2),UBOUND(u_out%InflowWakeVel,2) @@ -10385,19 +13912,31 @@ SUBROUTINE AD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg END IF ScaleFactor = t_out / t(2) - CALL MeshExtrapInterp1(y1%TowerLoad, y2%TowerLoad, tin, y_out%TowerLoad, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%rotors) .AND. ALLOCATED(y1%rotors)) THEN + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) + CALL MeshExtrapInterp1(y1%rotors(i01)%NacelleLoad, y2%rotors(i01)%NacelleLoad, tin, y_out%rotors(i01)%NacelleLoad, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(y_out%BladeLoad) .AND. ALLOCATED(y1%BladeLoad)) THEN - DO i1 = LBOUND(y_out%BladeLoad,1),UBOUND(y_out%BladeLoad,1) - CALL MeshExtrapInterp1(y1%BladeLoad(i1), y2%BladeLoad(i1), tin, y_out%BladeLoad(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) + CALL MeshExtrapInterp1(y1%rotors(i01)%TowerLoad, y2%rotors(i01)%TowerLoad, tin, y_out%rotors(i01)%TowerLoad, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) +IF (ALLOCATED(y_out%rotors(i01)%BladeLoad) .AND. ALLOCATED(y1%rotors(i01)%BladeLoad)) THEN + DO i1 = LBOUND(y_out%rotors(i01)%BladeLoad,1),UBOUND(y_out%rotors(i01)%BladeLoad,1) + CALL MeshExtrapInterp1(y1%rotors(i01)%BladeLoad(i1), y2%rotors(i01)%BladeLoad(i1), tin, y_out%rotors(i01)%BladeLoad(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%WriteOutput) .AND. ALLOCATED(y1%WriteOutput)) THEN - DO i1 = LBOUND(y_out%WriteOutput,1),UBOUND(y_out%WriteOutput,1) - b = -(y1%WriteOutput(i1) - y2%WriteOutput(i1)) - y_out%WriteOutput(i1) = y1%WriteOutput(i1) + b * ScaleFactor + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) +IF (ALLOCATED(y_out%rotors(i01)%WriteOutput) .AND. ALLOCATED(y1%rotors(i01)%WriteOutput)) THEN + DO i1 = LBOUND(y_out%rotors(i01)%WriteOutput,1),UBOUND(y_out%rotors(i01)%WriteOutput,1) + b = -(y1%rotors(i01)%WriteOutput(i1) - y2%rotors(i01)%WriteOutput(i1)) + y_out%rotors(i01)%WriteOutput(i1) = y1%rotors(i01)%WriteOutput(i1) + b * ScaleFactor END DO +END IF ! check if allocated + ENDDO END IF ! check if allocated END SUBROUTINE AD_Output_ExtrapInterp1 @@ -10456,20 +13995,32 @@ SUBROUTINE AD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, Err END IF ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) - CALL MeshExtrapInterp2(y1%TowerLoad, y2%TowerLoad, y3%TowerLoad, tin, y_out%TowerLoad, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%rotors) .AND. ALLOCATED(y1%rotors)) THEN + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) + CALL MeshExtrapInterp2(y1%rotors(i01)%NacelleLoad, y2%rotors(i01)%NacelleLoad, y3%rotors(i01)%NacelleLoad, tin, y_out%rotors(i01)%NacelleLoad, tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(y_out%BladeLoad) .AND. ALLOCATED(y1%BladeLoad)) THEN - DO i1 = LBOUND(y_out%BladeLoad,1),UBOUND(y_out%BladeLoad,1) - CALL MeshExtrapInterp2(y1%BladeLoad(i1), y2%BladeLoad(i1), y3%BladeLoad(i1), tin, y_out%BladeLoad(i1), tin_out, ErrStat2, ErrMsg2 ) + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) + CALL MeshExtrapInterp2(y1%rotors(i01)%TowerLoad, y2%rotors(i01)%TowerLoad, y3%rotors(i01)%TowerLoad, tin, y_out%rotors(i01)%TowerLoad, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) +IF (ALLOCATED(y_out%rotors(i01)%BladeLoad) .AND. ALLOCATED(y1%rotors(i01)%BladeLoad)) THEN + DO i1 = LBOUND(y_out%rotors(i01)%BladeLoad,1),UBOUND(y_out%rotors(i01)%BladeLoad,1) + CALL MeshExtrapInterp2(y1%rotors(i01)%BladeLoad(i1), y2%rotors(i01)%BladeLoad(i1), y3%rotors(i01)%BladeLoad(i1), tin, y_out%rotors(i01)%BladeLoad(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%WriteOutput) .AND. ALLOCATED(y1%WriteOutput)) THEN - DO i1 = LBOUND(y_out%WriteOutput,1),UBOUND(y_out%WriteOutput,1) - b = (t(3)**2*(y1%WriteOutput(i1) - y2%WriteOutput(i1)) + t(2)**2*(-y1%WriteOutput(i1) + y3%WriteOutput(i1)))* scaleFactor - c = ( (t(2)-t(3))*y1%WriteOutput(i1) + t(3)*y2%WriteOutput(i1) - t(2)*y3%WriteOutput(i1) ) * scaleFactor - y_out%WriteOutput(i1) = y1%WriteOutput(i1) + b + c * t_out + ENDDO + DO i01 = LBOUND(y_out%rotors,1),UBOUND(y_out%rotors,1) +IF (ALLOCATED(y_out%rotors(i01)%WriteOutput) .AND. ALLOCATED(y1%rotors(i01)%WriteOutput)) THEN + DO i1 = LBOUND(y_out%rotors(i01)%WriteOutput,1),UBOUND(y_out%rotors(i01)%WriteOutput,1) + b = (t(3)**2*(y1%rotors(i01)%WriteOutput(i1) - y2%rotors(i01)%WriteOutput(i1)) + t(2)**2*(-y1%rotors(i01)%WriteOutput(i1) + y3%rotors(i01)%WriteOutput(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%rotors(i01)%WriteOutput(i1) + t(3)*y2%rotors(i01)%WriteOutput(i1) - t(2)*y3%rotors(i01)%WriteOutput(i1) ) * scaleFactor + y_out%rotors(i01)%WriteOutput(i1) = y1%rotors(i01)%WriteOutput(i1) + b + c * t_out END DO +END IF ! check if allocated + ENDDO END IF ! check if allocated END SUBROUTINE AD_Output_ExtrapInterp2 diff --git a/modules/aerodyn/src/AirfoilInfo.f90 b/modules/aerodyn/src/AirfoilInfo.f90 index 5787870b2f..30fa9d6ca3 100644 --- a/modules/aerodyn/src/AirfoilInfo.f90 +++ b/modules/aerodyn/src/AirfoilInfo.f90 @@ -95,6 +95,7 @@ SUBROUTINE AFI_Init ( InitInput, p, ErrStat, ErrMsg, UnEcho ) ! Display the version for this module. !CALL DispNVD ( AFI_Ver ) + p%FileName = InitInput%FileName ! store this for error messages later (e.g., in UA) CALL AFI_ValidateInitInput(InitInput, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -247,27 +248,24 @@ SUBROUTINE AFI_Init ( InitInput, p, ErrStat, ErrMsg, UnEcho ) do iTable = 1, p%NumTabs + ! We need to deal with constant data. + IF ( p%Table(iTable)%ConstData ) THEN + + CALL SetErrStat ( ErrID_FATAL, 'The part to deal with constant data in AFI_Init is not written yet!', ErrStat, ErrMsg, RoutineName ) + CALL Cleanup() + RETURN + + END IF + ! Allocate the arrays to hold spline coefficients. - allocate ( p%Table(iTable)%SplineCoefs( p%Table(iTable)%NumAlf-1 & - , NumCoefs, 0:3 ), STAT=ErrStat2 ) + allocate ( p%Table(iTable)%SplineCoefs( p%Table(iTable)%NumAlf-1, size(p%Table(iTable)%Coefs,2), 0:3 ), STAT=ErrStat2 ) if ( ErrStat2 /= 0 ) then call SetErrStat ( ErrStat2, 'Error allocating memory for the SplineCoefs array.', ErrStat, ErrMsg, RoutineName ) call Cleanup() return end if - ! Check that the second dimensions of the SplineCoefs table and the Coefs table match. If they don't, it may indicate - ! that the number of columns in each table in the AF input file are different. This will result in array bounds issues - ! in the CubicSplineInitM routine. - if ( size(p%Table(iTable)%SplineCoefs, DIM=2) /= size(p%Table(iTable)%Coefs, DIM=2) ) then - call SetErrStat ( ErrID_Fatal, 'Number of columns in the SplineCoefs table and Coefs tables do not match in size.'// & - ' Check that all tables in airfoil input file "'//TRIM( InitInput%FileName )//'" have the same number of columns.', & - ErrStat, ErrMsg, RoutineName ) - call Cleanup() - return - end if - ! Compute the one set of coefficients of the piecewise polynomials for the irregularly-spaced data. ! Unlike the 2-D interpolation in which we use diffent knots for each airfoil coefficient, we can do ! the 1-D stuff all at once. @@ -308,26 +306,6 @@ SUBROUTINE AFI_Init ( InitInput, p, ErrStat, ErrMsg, UnEcho ) end do - - ! Compute the spline coefficients of the piecewise cubic polynomials for the irregularly-spaced airfoil data in each file. - ! Unless the data are constant. - - DO Co=1,NumCoefs - - ! We use 1D cubic spline interpolation if the data are not constant. - IF ( p%Table(1)%ConstData ) THEN - - ! We need to deal with constant data. - - CALL SetErrStat ( ErrID_FATAL, 'The part to deal with constant data in AFI_Init is not written yet!', ErrStat, ErrMsg, RoutineName ) - CALL Cleanup() - RETURN - - ENDIF ! p%Table(1)%ConstData - - END DO ! Co - - CALL Cleanup ( ) RETURN @@ -374,7 +352,7 @@ SUBROUTINE AFI_ValidateInitInput(InitInput, ErrStat, ErrMsg) END SUBROUTINE AFI_ValidateInitInput !============================================================================= - SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_Cm, InCol_Cpmin, p & + SUBROUTINE ReadAFfile ( AFfile, NumCoefsIn, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_Cm, InCol_Cpmin, p & , ErrStat, ErrMsg, UnEc ) @@ -389,7 +367,7 @@ SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_ INTEGER(IntKi), INTENT(IN) :: InCol_Cm ! The airfoil-table input column for pitching-moment coefficient. INTEGER(IntKi), INTENT(IN) :: InCol_Cpmin ! The airfoil-table input column for minimum pressure coefficient. INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status. - INTEGER(IntKi), INTENT(INOUT) :: NumCoefs ! The number of aerodynamic coefficients to be stored. + INTEGER(IntKi), INTENT(IN ) :: NumCoefsIn ! The number of aerodynamic coefficients to be stored. INTEGER, INTENT(IN) :: UnEc ! I/O unit for echo file. If present and > 0, write to UnEc. CHARACTER(*), INTENT(IN) :: AFfile ! The file to be read. @@ -414,7 +392,6 @@ SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_ LOGICAL :: BadVals ! A flag that indicates if the values in a table are invalid. TYPE (FileInfoType) :: FileInfo ! The derived type for holding the file information. - INTEGER(IntKi) :: NumCoefsIn ! The number of aerodynamic coefficients input to routine INTEGER(IntKi) :: NumCoefsTab ! The number of aerodynamic coefficients to be stored for this table. INTEGER(IntKi) :: DefaultInterpOrd ! value of default interp order @@ -428,9 +405,6 @@ SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_ ErrMsg = "" defaultStr = "" - ! store NumCoefs passed in - NumCoefsIn = NumCoefs - ! Getting parent folder of airfoils data (e.g. "Arifoils/") CALL GetPath( AFFile, PriPath ) ! Process the (possibly) nested set of files. This copies the decommented contents of @@ -683,7 +657,7 @@ SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_ CALL ParseVarWDefault ( FileInfo, CurLine, 'filtCutOff', p%Table(iTable)%UA_BL%filtCutOff, 0.5_ReKi, ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - p%ColUAf = NumCoefsTab + 1 ! column for f_st + p%ColUAf = NumCoefsIn + 1 ! column for f_st NumCoefsTab = p%ColUAf + 1 ! precompute f_st and cl_fs for the HGM model IF (ErrStat >= AbortErrLev) THEN @@ -777,17 +751,20 @@ SUBROUTINE ReadAFfile ( AFfile, NumCoefs, InCol_Alfa, InCol_Cl, InCol_Cd, InCol_ ! CALL SetErrStat( ErrID_Fatal & CALL SetErrStat( ErrID_Warn, & 'Airfoil data should go from -180 degrees to 180 degrees and the coefficients at the ends should be the same.', ErrStat, ErrMsg, RoutineName ) - CALL Cleanup() - RETURN + !CALL Cleanup() + !RETURN ENDIF ENDIF ! ( .NOT. p%Table(iTable)%ConstData ) - ! Set the NumCoefs value we return based on tables so far - NumCoefs = max(NumCoefs, NumCoefsTab) - ENDDO ! iTable - + DO iTable=1,p%NumTabs + if ( .not. p%Table(iTable)%InclUAdata ) then + p%ColUAf = 0 ! in case some tables have UA data and others don't; this is not set on a per-table basis + exit ! exit loop + end if + ENDDO ! iTable + CALL Cleanup( ) RETURN @@ -824,7 +801,8 @@ SUBROUTINE CalculateUACoeffs(p,ColCl,ColUAf) col_clFs = ColUAf + 1 if ( p%InclUAdata ) then - + p%UA_BL%UACutout_blend = max(0.0_ReKi, p%UA_BL%UACutout - 5.0_ReKi*D2R) ! begin turning off 5 degrees before (or at 0 degrees) + if (EqualRealNos(p%UA_BL%c_lalpha,0.0_ReKi)) then p%Coefs(:,ColUAf) = 0.0_ReKi ! Eq. 59 p%Coefs(:,col_clFs) = p%Coefs(:,ColCl) ! Eq. 61 diff --git a/modules/aerodyn/src/AirfoilInfo_Registry.txt b/modules/aerodyn/src/AirfoilInfo_Registry.txt index be71570d7b..009f64fb4c 100644 --- a/modules/aerodyn/src/AirfoilInfo_Registry.txt +++ b/modules/aerodyn/src/AirfoilInfo_Registry.txt @@ -55,6 +55,7 @@ typedef ^ ^ ReKi k3 typedef ^ ^ ReKi k1_hat - - - "Constant in the expression of Cc due to leading edge vortex effects. [ignored if UAMod<>1]" - typedef ^ ^ ReKi x_cp_bar - - - "Constant in the expression of \hat(x)_cp^v [ignored if UAMod<>1, default = 0.2]" - typedef ^ ^ ReKi UACutout - - - "Angle of attack above which unsteady aerodynamics are disabled" "input in degrees; stored as radians" +typedef ^ ^ ReKi UACutout_blend - - - "Angle of attack above which unsteady aerodynamics begins to be disabled" "stored as radians" typedef ^ ^ ReKi filtCutOff - - - "Reduced frequency cutoff used to calculate the dynamic low pass filter cut-off frequency for the pitching rate and accelerations [default = 0.5]" - # The following derived type stores data for an airfoil at a single combination of Re and control setting. @@ -99,6 +100,7 @@ typedef ^ ^ ReKi Y_Coord typedef ^ ^ INTEGER NumTabs - - - "The number of airfoil tables in the airfoil file" - typedef ^ ^ AFI_Table_Type Table {:} - - "The tables of airfoil data for given Re and control setting" - typedef ^ ^ CHARACTER(1024) BL_file - - - "The name of the file with the boundary layer data" +typedef ^ ^ CHARACTER(1024) FileName - - - "The name of the file that stored this information." - # ..... Inputs .................................................................................................................... # Define inputs that are not on this mesh here: diff --git a/modules/aerodyn/src/AirfoilInfo_Types.f90 b/modules/aerodyn/src/AirfoilInfo_Types.f90 index aa3fb2a01b..d092af28c6 100644 --- a/modules/aerodyn/src/AirfoilInfo_Types.f90 +++ b/modules/aerodyn/src/AirfoilInfo_Types.f90 @@ -70,6 +70,7 @@ MODULE AirfoilInfo_Types REAL(ReKi) :: k1_hat !< Constant in the expression of Cc due to leading edge vortex effects. [ignored if UAMod<>1] [-] REAL(ReKi) :: x_cp_bar !< Constant in the expression of \hat(x)_cp^v [ignored if UAMod<>1, default = 0.2] [-] REAL(ReKi) :: UACutout !< Angle of attack above which unsteady aerodynamics are disabled [input in degrees; stored as radians] + REAL(ReKi) :: UACutout_blend !< Angle of attack above which unsteady aerodynamics begins to be disabled [stored as radians] REAL(ReKi) :: filtCutOff !< Reduced frequency cutoff used to calculate the dynamic low pass filter cut-off frequency for the pitching rate and accelerations [default = 0.5] [-] END TYPE AFI_UA_BL_Type ! ======================= @@ -119,6 +120,7 @@ MODULE AirfoilInfo_Types INTEGER(IntKi) :: NumTabs !< The number of airfoil tables in the airfoil file [-] TYPE(AFI_Table_Type) , DIMENSION(:), ALLOCATABLE :: Table !< The tables of airfoil data for given Re and control setting [-] CHARACTER(1024) :: BL_file !< The name of the file with the boundary layer data [-] + CHARACTER(1024) :: FileName !< The name of the file that stored this information. [-] END TYPE AFI_ParameterType ! ======================= ! ========= AFI_InputType ======= @@ -190,6 +192,7 @@ SUBROUTINE AFI_CopyUA_BL_Type( SrcUA_BL_TypeData, DstUA_BL_TypeData, CtrlCode, E DstUA_BL_TypeData%k1_hat = SrcUA_BL_TypeData%k1_hat DstUA_BL_TypeData%x_cp_bar = SrcUA_BL_TypeData%x_cp_bar DstUA_BL_TypeData%UACutout = SrcUA_BL_TypeData%UACutout + DstUA_BL_TypeData%UACutout_blend = SrcUA_BL_TypeData%UACutout_blend DstUA_BL_TypeData%filtCutOff = SrcUA_BL_TypeData%filtCutOff END SUBROUTINE AFI_CopyUA_BL_Type @@ -271,6 +274,7 @@ SUBROUTINE AFI_PackUA_BL_Type( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_BufSz = Re_BufSz + 1 ! k1_hat Re_BufSz = Re_BufSz + 1 ! x_cp_bar Re_BufSz = Re_BufSz + 1 ! UACutout + Re_BufSz = Re_BufSz + 1 ! UACutout_blend Re_BufSz = Re_BufSz + 1 ! filtCutOff IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) @@ -363,6 +367,8 @@ SUBROUTINE AFI_PackUA_BL_Type( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%UACutout Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%UACutout_blend + Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%filtCutOff Re_Xferred = Re_Xferred + 1 END SUBROUTINE AFI_PackUA_BL_Type @@ -460,6 +466,8 @@ SUBROUTINE AFI_UnPackUA_BL_Type( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = Re_Xferred + 1 OutData%UACutout = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + OutData%UACutout_blend = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 OutData%filtCutOff = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END SUBROUTINE AFI_UnPackUA_BL_Type @@ -1356,6 +1364,7 @@ SUBROUTINE AFI_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ENDDO ENDIF DstParamData%BL_file = SrcParamData%BL_file + DstParamData%FileName = SrcParamData%FileName END SUBROUTINE AFI_CopyParam SUBROUTINE AFI_DestroyParam( ParamData, ErrStat, ErrMsg ) @@ -1469,6 +1478,7 @@ SUBROUTINE AFI_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S END DO END IF Int_BufSz = Int_BufSz + 1*LEN(InData%BL_file) ! BL_file + Int_BufSz = Int_BufSz + 1*LEN(InData%FileName) ! FileName IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -1606,6 +1616,10 @@ SUBROUTINE AFI_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S IntKiBuf(Int_Xferred) = ICHAR(InData%BL_file(I:I), IntKi) Int_Xferred = Int_Xferred + 1 END DO ! I + DO I = 1, LEN(InData%FileName) + IntKiBuf(Int_Xferred) = ICHAR(InData%FileName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I END SUBROUTINE AFI_PackParam SUBROUTINE AFI_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -1769,6 +1783,10 @@ SUBROUTINE AFI_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg OutData%BL_file(I:I) = CHAR(IntKiBuf(Int_Xferred)) Int_Xferred = Int_Xferred + 1 END DO ! I + DO I = 1, LEN(OutData%FileName) + OutData%FileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I END SUBROUTINE AFI_UnPackParam SUBROUTINE AFI_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) @@ -2419,6 +2437,8 @@ SUBROUTINE AFI_UA_BL_Type_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, Er u_out%x_cp_bar = u1%x_cp_bar + b * ScaleFactor b = -(u1%UACutout - u2%UACutout) u_out%UACutout = u1%UACutout + b * ScaleFactor + b = -(u1%UACutout_blend - u2%UACutout_blend) + u_out%UACutout_blend = u1%UACutout_blend + b * ScaleFactor b = -(u1%filtCutOff - u2%filtCutOff) u_out%filtCutOff = u1%filtCutOff + b * ScaleFactor END SUBROUTINE AFI_UA_BL_Type_ExtrapInterp1 @@ -2566,6 +2586,9 @@ SUBROUTINE AFI_UA_BL_Type_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat b = (t(3)**2*(u1%UACutout - u2%UACutout) + t(2)**2*(-u1%UACutout + u3%UACutout))* scaleFactor c = ( (t(2)-t(3))*u1%UACutout + t(3)*u2%UACutout - t(2)*u3%UACutout ) * scaleFactor u_out%UACutout = u1%UACutout + b + c * t_out + b = (t(3)**2*(u1%UACutout_blend - u2%UACutout_blend) + t(2)**2*(-u1%UACutout_blend + u3%UACutout_blend))* scaleFactor + c = ( (t(2)-t(3))*u1%UACutout_blend + t(3)*u2%UACutout_blend - t(2)*u3%UACutout_blend ) * scaleFactor + u_out%UACutout_blend = u1%UACutout_blend + b + c * t_out b = (t(3)**2*(u1%filtCutOff - u2%filtCutOff) + t(2)**2*(-u1%filtCutOff + u3%filtCutOff))* scaleFactor c = ( (t(2)-t(3))*u1%filtCutOff + t(3)*u2%filtCutOff - t(2)*u3%filtCutOff ) * scaleFactor u_out%filtCutOff = u1%filtCutOff + b + c * t_out diff --git a/modules/aerodyn/src/BEMT.f90 b/modules/aerodyn/src/BEMT.f90 index 2e44dacc91..fda132b403 100644 --- a/modules/aerodyn/src/BEMT.f90 +++ b/modules/aerodyn/src/BEMT.f90 @@ -129,10 +129,10 @@ subroutine BEMT_Set_UA_InitData( InitInp, interval, Init_UA_Data, errStat, errMs Init_UA_Data%numBlades = InitInp%numBlades Init_UA_Data%nNodesPerBlade = InitInp%numBladeNodes - Init_UA_Data%NumOuts = 0 Init_UA_Data%UAMod = InitInp%UAMod Init_UA_Data%Flookup = InitInp%Flookup Init_UA_Data%a_s = InitInp%a_s ! m/s + Init_UA_Data%ShedEffect = .true. ! This should be true when coupled to BEM end subroutine BEMT_Set_UA_InitData @@ -290,12 +290,6 @@ subroutine BEMT_InitOtherStates( OtherState, p, errStat, errMsg ) errStat = ErrID_None errMsg = "" - ! We need to set an other state version so that we can change this during execution if the AOA is too large! - allocate ( OtherState%UA_Flag( p%numBladeNodes, p%numBlades ), STAT = errStat2 ) - if ( errStat2 /= 0 ) then - call SetErrStat( ErrID_Fatal, 'Error allocating memory for OtherState%UA_Flag.', errStat, errMsg, RoutineName ) - return - end if if (p%UseInduction) then @@ -502,10 +496,6 @@ subroutine BEMT_Init( InitInp, u, p, x, xd, z, OtherState, AFInfo, y, misc, Inte type(DBEMT_InitInputType) :: InitInp_DBEMT type(DBEMT_InitOutputType) :: InitOut_DBEMT -#ifdef UA_OUTS - integer(IntKi) :: i -#endif - ! Initialize variables for this routine errStat = ErrID_None errMsg = "" @@ -590,40 +580,12 @@ subroutine BEMT_Init( InitInp, u, p, x, xd, z, OtherState, AFInfo, y, misc, Inte return end if - call UA_Init( Init_UA_Data, misc%u_UA(1,1,1), p%UA, x%UA, xd%UA, OtherState%UA, misc%y_UA, misc%UA, interval, InitOutData_UA, errStat2, errMsg2 ) + call UA_Init( Init_UA_Data, misc%u_UA(1,1,1), p%UA, x%UA, xd%UA, OtherState%UA, misc%y_UA, misc%UA, interval, AFInfo, p%AFIndx, InitOutData_UA, errStat2, errMsg2 ) call SetErrStat( errStat2, errMsg2, errStat, errMsg, RoutineName ) if (errStat >= AbortErrLev) then call cleanup() return end if - p%UA%ShedEffect=.True. ! This should be true when coupled to BEM. True in registry as default. - - - ! note: we check the validity of using UA in BEMT_ReInit() - -# ifdef UA_OUTS - !CALL GetNewUnit( UnUAOuts, ErrStat, ErrMsg ) - !IF ( ErrStat /= ErrID_None ) RETURN - - CALL OpenFOutFile ( 69, 'Debug.UA.out', errStat, errMsg ) - IF (ErrStat >= AbortErrLev) RETURN - - - ! Heading: - WRITE (69,'(/,A)') 'This output information was generated by '//TRIM( GetNVD(BEMT_Ver) )// & - ' on '//CurDate()//' at '//CurTime()//'.' - WRITE (69,'(:,A20)', ADVANCE='no' ) 'Time' - do i=1,size(InitOutData_UA%WriteOutputHdr) - WRITE (69,'(:,A20)', ADVANCE='no' ) trim(InitOutData_UA%WriteOutputHdr(i)) - end do - write (69,'(A)') ' ' - - WRITE (69,'(:,A20)', ADVANCE='no' ) '(s)' - do i=1,size(InitOutData_UA%WriteOutputUnt) - WRITE (69,'(:,A20)', ADVANCE='no' ) trim(InitOutData_UA%WriteOutputUnt(i)) - end do - write (69,'(A)') ' ' -# endif else p%UA%lin_nx = 0 end if ! unsteady aero is used @@ -665,9 +627,8 @@ subroutine BEMT_Init( InitInp, u, p, x, xd, z, OtherState, AFInfo, y, misc, Inte return end if - ! set initial values for states and misc vars - call BEMT_ReInit(p,x,xd,z,OtherState,misc,AFinfo,ErrStat2,ErrMsg2) + call BEMT_ReInit(p,x,xd,z,OtherState,misc,ErrStat2,ErrMsg2) call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) call Cleanup() @@ -687,7 +648,7 @@ END SUBROUTINE BEMT_Init !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine reinitializes BEMT and UA, assuming that we will start the simulation over again, with only the inputs being different. !! This allows us to bypass reading input files and allocating arrays. -subroutine BEMT_ReInit(p,x,xd,z,OtherState,misc,AFinfo,ErrStat,ErrMsg) +subroutine BEMT_ReInit(p,x,xd,z,OtherState,misc,ErrStat,ErrMsg) type(BEMT_ParameterType), intent(in ) :: p ! Parameters type(BEMT_ContinuousStateType), intent(inout) :: x ! Initial continuous states @@ -695,12 +656,9 @@ subroutine BEMT_ReInit(p,x,xd,z,OtherState,misc,AFinfo,ErrStat,ErrMsg) type(BEMT_ConstraintStateType), intent(inout) :: z ! Initial guess of the constraint states type(BEMT_OtherStateType), intent(inout) :: OtherState ! Initial other states type(BEMT_MiscVarType), intent(inout) :: misc ! Initial misc/optimization variables - type(AFI_ParameterType), intent(in ) :: AFInfo(:) ! The airfoil parameter data INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - character(ErrMsgLen) :: errMsg2 ! temporary Error message if ErrStat /= ErrID_None - integer(IntKi) :: errStat2 ! temporary Error status of the operation character(*), parameter :: RoutineName = 'BEMT_ReInit' ErrStat = ErrID_None @@ -729,51 +687,9 @@ subroutine BEMT_ReInit(p,x,xd,z,OtherState,misc,AFinfo,ErrStat,ErrMsg) z%phi = 0.0_ReKi OtherState%nodesInitialized = .false. ! z%phi hasn't been initialized properly, so make sure we compute a value for phi until we've updated them in the first call to BEMT_UpdateStates() - OtherState%UA_Flag = p%UA_Flag - if (p%UA_Flag) then - call UA_ReInit( p%UA, x%UA, xd%UA, OtherState%UA, misc%UA, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - call BEMT_CheckInitUA(p, OtherState, AFInfo, ErrStat2, ErrMsg2) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - end if - - end subroutine BEMT_ReInit !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine finds C_nalpha for each node, and turns off unsteady aero for that node if C_nalpha=0. It is called only during initialization. -subroutine BEMT_CheckInitUA(p, OtherState, AFInfo, ErrStat, ErrMsg) - - type(BEMT_ParameterType), intent(in ) :: p !< Parameters - type(BEMT_OtherStateType), intent(inout) :: OtherState !< Initial other states - type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - integer(IntKi) :: i,j ! node and blade loop counters - character(ErrMsgLen) :: errMsg2 ! temporary Error message if ErrStat /= ErrID_None - integer(IntKi) :: errStat2 ! temporary Error status of the operation - - - - ErrStat = ErrID_None - ErrMsg = "" - - do j = 1,p%numBlades - do i = 1,p%numBladeNodes ! Loop over blades and nodes - - call UA_TurnOff_param(p%UA, AFInfo(p%AFindx(i,j)), ErrStat2, ErrMsg2) - if (ErrStat2 /= ErrID_None) then - call WrScr( 'Warning: Turning off Unsteady Aerodynamics because '//trim(ErrMsg2)//" "//trim(NodeText(i,j)) ) - OtherState%UA_Flag(i,j) = .false. - end if - - end do - end do - -end subroutine BEMT_CheckInitUA -!---------------------------------------------------------------------------------------------------------------------------------- subroutine BEMT_End( u, p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) ! This routine is called at the end of the simulation. !.................................................................................................................................. @@ -800,7 +716,9 @@ subroutine BEMT_End( u, p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) ! Close files here: - + if ( p%UA_Flag ) then + CALL UA_End(p%UA) + end if ! Destroy the input data: @@ -825,11 +743,6 @@ subroutine BEMT_End( u, p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) CALL BEMT_DestroyOutput( y, ErrStat, ErrMsg ) -#ifdef UA_OUTS - CLOSE(69) -#endif - - END SUBROUTINE BEMT_End @@ -859,6 +772,7 @@ subroutine BEMT_UpdateStates( t, n, u1, u2, p, x, xd, z, OtherState, AFInfo, m, integer(IntKi), intent( out) :: errStat ! Error status of the operation character(*), intent( out) :: errMsg ! Error message if ErrStat /= ErrID_None + integer(IntKi) :: i,j @@ -893,10 +807,11 @@ subroutine BEMT_UpdateStates( t, n, u1, u2, p, x, xd, z, OtherState, AFInfo, m, if (p%useInduction) call WriteDEBUGValuesToFile(t, u1, p, x, xd, z, OtherState, m, AFInfo) #endif !............................................................................................................................... - ! compute inputs to UA at step n + ! compute inputs to UA at time n (also setting inductions--including DBEMT and skewed wake corrections--at time n) !............................................................................................................................... if (p%UA_Flag) then - call CalculateInputsAndOtherStatesForUA(1, u1, p, x, xd, z, OtherState, AFInfo, m) + m%phi = z%phi + call SetInputs_for_UA_AllNodes(u1, p, m%phi, m%axInduction, m%tanInduction, m%u_UA(:,:,1)) end if !............................................................................................................................... @@ -957,7 +872,8 @@ subroutine BEMT_UpdateStates( t, n, u1, u2, p, x, xd, z, OtherState, AFInfo, m, end if - call CalculateInputsAndOtherStatesForUA(2, u2, p, x, xd, z, OtherState, AFInfo, m) + m%phi = z%phi + call SetInputs_for_UA_AllNodes(u2, p, m%phi, m%axInduction, m%tanInduction, m%u_UA(:,:,2)) !............................................................................................................................... ! compute UA states at t+dt @@ -965,20 +881,17 @@ subroutine BEMT_UpdateStates( t, n, u1, u2, p, x, xd, z, OtherState, AFInfo, m, do j = 1,p%numBlades do i = 1,p%numBladeNodes - ! We only update the UnsteadyAero states if we have unsteady aero turned on for this node - if (OtherState%UA_Flag(i,j)) then - ! COMPUTE: x%UA and/or xd%UA, OtherState%UA - call UA_UpdateStates( i, j, t, n, m%u_UA(i,j,:), uTimes, p%UA, x%UA, xd%UA, OtherState%UA, AFInfo(p%AFIndx(i,j)), m%UA, errStat2, errMsg2 ) - if (ErrStat2 /= ErrID_None) then - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//trim(NodeText(i,j))) - if (errStat >= AbortErrLev) return - end if - - end if + ! COMPUTE: x%UA and/or xd%UA, OtherState%UA + call UA_UpdateStates( i, j, t, n, m%u_UA(i,j,:), uTimes, p%UA, x%UA, xd%UA, OtherState%UA, AFInfo(p%AFIndx(i,j)), m%UA, errStat2, errMsg2 ) + if (ErrStat2 /= ErrID_None) then + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//trim(NodeText(i,j))) + if (errStat >= AbortErrLev) return + end if end do end do + end if ! is UA used? end subroutine BEMT_UpdateStates @@ -1036,54 +949,6 @@ subroutine SetInputs_For_DBEMT(u_DBEMT, u, p, axInduction, tanInduction, Rtip) end subroutine SetInputs_For_DBEMT -!.................................................................................................................................. -subroutine CalculateInputsAndOtherStatesForUA(InputIndex, u, p, x, xd, z, OtherState, AFInfo, m) - integer(IntKi), intent(in ) :: InputIndex ! InputIndex= 1 or 2, depending on time step we are calculating inputs for - type(BEMT_InputType), intent(in ) :: u ! Input - type(BEMT_ParameterType), intent(in ) :: p ! Parameters - type(BEMT_ContinuousStateType), intent(in ) :: x ! Input: Continuous states at t; - ! Output: Continuous states at t + Interval - type(BEMT_DiscreteStateType), intent(in ) :: xd ! Input: Discrete states at t; - ! Output: Discrete states at t + Interval - type(BEMT_ConstraintStateType), intent(in ) :: z ! Input: Constraint states at t; - ! Output: Constraint states at t + Interval - type(BEMT_OtherStateType), intent(inout) :: OtherState ! Input: Other states at t; - ! Output: Other states at t + Interval - type(BEMT_MiscVarType), intent(inout) :: m ! Misc/optimization variables - type(AFI_ParameterType), intent(in ) :: AFInfo(:) ! The airfoil parameter data - - - integer(IntKi) :: i,j - - character(ErrMsgLen) :: errMsg2 ! temporary Error message if ErrStat /= ErrID_None - integer(IntKi) :: errStat2 ! temporary Error status of the operation - - - - !............................................................................................................................... - ! compute inputs to UA at time n (also setting inductions--including DBEMT and skewed wake corrections--at time n) - !............................................................................................................................... - m%phi = z%phi - call SetInputs_for_UA_AllNodes(u, p, m%phi, m%axInduction, m%tanInduction, m%u_UA(:,:,InputIndex)) - - do j = 1,p%numBlades - do i = 1,p%numBladeNodes - - ! We only update the UnsteadyAero states if we have unsteady aero turned on for this node - if (OtherState%UA_Flag(i,j)) then - ! ....... check inputs to UA ........... - call UA_TurnOff_input(p%UA, AFInfo(p%AFIndx(i,j)), m%u_UA(i,j,InputIndex), ErrStat2, ErrMsg2) - if (ErrStat2 /= ErrID_None) then - OtherState%UA_Flag(i,j) = .FALSE. - call WrScr( 'Warning: Turning off Unsteady Aerodynamics due to '//trim(ErrMsg2)//" "//trim(NodeText(i,j)) ) - end if - end if - - end do - end do - -end subroutine CalculateInputsAndOtherStatesForUA - !.................................................................................................................................. subroutine UpdatePhi( u, p, phi, AFInfo, m, ValidPhi, errStat, errMsg ) !.................................................................................................................................. @@ -1333,22 +1198,11 @@ subroutine BEMT_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, errStat character(*), parameter :: RoutineName = 'BEMT_CalcOutput' type(AFI_OutputType) :: AFI_interp - - -#ifdef UA_OUTS - integer(IntKi) :: k -#endif ! Initialize some output values errStat = ErrID_None errMsg = "" - -#ifdef UA_OUTS - ! if ( mod(REAL(t,ReKi),.1) < p%dt) then - if (allocated(m%y_UA%WriteOutput)) m%y_UA%WriteOutput = 0.0 !reset to zero in case UA shuts off mid-simulation -#endif - !!#ifdef DEBUG_BEMT_RESIDUAL !! call WriteDEBUGValuesToFile(t, u, p, x, xd, z, OtherState, m, AFInfo) !!#endif @@ -1368,7 +1222,7 @@ subroutine BEMT_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, errStat call BEMT_CalcOutput_Inductions( InputIndex, t, .false., .true., y%phi, u, p, x, xd, z, OtherState, AFInfo, y%axInduction, y%tanInduction, y%chi, m, errStat, errMsg ) !............................................ - ! update phi if necessary (consistent with inductions) and calculate inputs to UA: + ! update phi if necessary (consistent with inductions) and calculate inputs to UA (EVEN if UA isn't used, because we use the inputs later): !............................................ call SetInputs_for_UA_AllNodes(u, p, y%phi, y%axInduction, y%tanInduction, m%u_UA(:,:,InputIndex)) @@ -1382,28 +1236,52 @@ subroutine BEMT_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, errStat y%AOA( i,j) = m%u_UA(i,j,InputIndex)%alpha y%Vrel(i,j) = m%u_UA(i,j,InputIndex)%U y%Re( i,j) = m%u_UA(i,j,InputIndex)%Re + + enddo ! I - Blade nodes / elements + enddo ! J - All blades + + ! Now depending on the option for UA get the airfoil coefs, Cl, Cd, Cm for unsteady or steady implementation + if (p%UA_Flag ) then + + do j = 1,p%numBlades ! Loop through all blades + do i = 1,p%numBladeNodes ! Loop through the blade nodes / elements - ! Now depending on the option for UA get the airfoil coefs, Cl, Cd, Cm for unsteady or steady implementation - if (OtherState%UA_Flag(i,j) ) then call UA_CalcOutput(i, j, m%u_UA(i,j,InputIndex), p%UA, x%UA, xd%UA, OtherState%UA, AFInfo(p%AFindx(i,j)), m%y_UA, m%UA, errStat2, errMsg2 ) + if (ErrStat2 /= ErrID_None) then + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//trim(NodeText(i,j))) + if (errStat >= AbortErrLev) return + end if + y%Cl(i,j) = m%y_UA%Cl y%Cd(i,j) = m%y_UA%Cd y%Cm(i,j) = m%y_UA%Cm - else - ! compute steady Airfoil Coefs + y%Cpmin(i,j) = 0.0_ReKi !bjj: this isn't set anywhere... ???? + enddo ! I - Blade nodes / elements + enddo ! J - All blades + + ! if ( mod(REAL(t,ReKi),.1) < p%dt) then + call UA_WriteOutputToFile(t, p%UA, m%y_UA) + ! end if + + else + ! compute steady Airfoil Coefs + do j = 1,p%numBlades ! Loop through all blades + do i = 1,p%numBladeNodes ! Loop through the blade nodes / elements + call AFI_ComputeAirfoilCoefs( y%AOA(i,j), y%Re(i,j), u%UserProp(i,j), AFInfo(p%AFindx(i,j)), AFI_interp, errStat2, errMsg2 ) + if (ErrStat2 /= ErrID_None) then + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//trim(NodeText(i,j))) + if (errStat >= AbortErrLev) return + end if y%Cl(i,j) = AFI_interp%Cl y%Cd(i,j) = AFI_interp%Cd y%Cm(i,j) = AFI_interp%Cm y%Cpmin(i,j) = AFI_interp%Cpmin - end if - if (ErrStat2 /= ErrID_None) then - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//trim(NodeText(i,j))) - if (errStat >= AbortErrLev) return - end if - enddo ! I - Blade nodes / elements - enddo ! J - All blades + enddo ! I - Blade nodes / elements + enddo ! J - All blades + + end if !............................................ @@ -1417,15 +1295,7 @@ subroutine BEMT_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, errStat enddo ! I - Blade nodes / elements enddo ! J - All blades -#ifdef UA_OUTS - ! if ( mod(REAL(t,ReKi),.1) < p%dt) then - if (allocated(m%y_UA%WriteOutput)) & - WRITE (69, '(F20.6,'//trim(num2lstr(size(m%y_UA%WriteOutput)))//'(:,1x,ES19.5E3))') t, ( m%y_UA%WriteOutput(k), k=1,size(m%y_UA%WriteOutput)) - ! end if -#endif - return - end subroutine BEMT_CalcOutput @@ -1444,13 +1314,10 @@ subroutine BEMT_InitStates(t, u, p, x, xd, z, OtherState, m, AFInfo, ErrStat, Er integer(IntKi), intent( out) :: errStat ! Error status of the operation character(*), intent( out) :: errMsg ! Error message if ErrStat /= ErrID_None - INTEGER(IntKi) :: i, j INTEGER(IntKi), parameter :: InputIndex = 1 LOGICAL, parameter :: CalculateDBEMTInputs = .true. LOGICAL, parameter :: ApplyCorrections = .true. - integer(IntKi) :: errStat2 ! Error status of the operation - character(ErrMsgLen) :: errMsg2 ! Error message if ErrStat /= ErrID_None character(*), parameter :: RoutineName = 'BEMT_InitStates' @@ -1467,8 +1334,9 @@ subroutine BEMT_InitStates(t, u, p, x, xd, z, OtherState, m, AFInfo, ErrStat, Er end if if (p%UA_Flag) then - call CalculateInputsAndOtherStatesForUA(InputIndex, u, p, x, xd, z, OtherState, AFInfo, m) - call UA_InitStates_AllNodes( m%u_UA(i,j,InputIndex), p%UA, x%UA, OtherState%UA, OtherState%UA_Flag, AFInfo, p%AFIndx ) + call SetInputs_for_UA_AllNodes(u, p, m%phi, m%axInduction, m%tanInduction, m%u_UA(:,:,InputIndex)) + + call UA_InitStates_AllNodes( m%u_UA(:,:,InputIndex), p%UA, x%UA, OtherState%UA, AFInfo, p%AFIndx ) end if ! is UA used? @@ -1727,12 +1595,7 @@ subroutine BEMT_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, AFIn do j = 1,p%numBlades do i = 1,p%numBladeNodes - ! We only update the UnsteadyAero states if we have unsteady aero turned on for this node - if (OtherState%UA_Flag(i,j)) then - call UA_CalcContStateDeriv( i, j, t, m%u_UA(i,j,InputIndex), p%UA, x%UA%element(i,j), OtherState%UA, AFInfo(p%AFIndx(i,j)), m%UA, dxdt%UA%element(i,j), ErrStat2, ErrMsg2 ) - else - dxdt%UA%element(i,j)%x = 0.0_R8Ki - end if + call UA_CalcContStateDeriv( i, j, t, m%u_UA(i,j,InputIndex), p%UA, x%UA%element(i,j), OtherState%UA, AFInfo(p%AFIndx(i,j)), m%UA, dxdt%UA%element(i,j), ErrStat2, ErrMsg2 ) end do end do diff --git a/modules/aerodyn/src/BEMT_Registry.txt b/modules/aerodyn/src/BEMT_Registry.txt index d0c1984977..db8b8ec98b 100644 --- a/modules/aerodyn/src/BEMT_Registry.txt +++ b/modules/aerodyn/src/BEMT_Registry.txt @@ -82,7 +82,6 @@ typedef ^ ConstraintStateType ReKi # typedef ^ OtherStateType UA_OtherStateType UA - - - "other states for UnsteadyAero" - typedef ^ OtherStateType DBEMT_OtherStateType DBEMT - - - "other states for DBEMT" - -typedef ^ ^ LOGICAL UA_Flag {:}{:} - - "logical flag indicating whether to use UnsteadyAero" - typedef ^ ^ LOGICAL ValidPhi {:}{:} - - "set to indicate when there is no valid Phi for this node at this time (temporarially turn off induction when this is false)" - typedef ^ OtherStateType Logical nodesInitialized - - - "the node states have been initialized properly" - diff --git a/modules/aerodyn/src/BEMT_Types.f90 b/modules/aerodyn/src/BEMT_Types.f90 index 385866ddd7..88e7648f3f 100644 --- a/modules/aerodyn/src/BEMT_Types.f90 +++ b/modules/aerodyn/src/BEMT_Types.f90 @@ -92,7 +92,6 @@ MODULE BEMT_Types TYPE, PUBLIC :: BEMT_OtherStateType TYPE(UA_OtherStateType) :: UA !< other states for UnsteadyAero [-] TYPE(DBEMT_OtherStateType) :: DBEMT !< other states for DBEMT [-] - LOGICAL , DIMENSION(:,:), ALLOCATABLE :: UA_Flag !< logical flag indicating whether to use UnsteadyAero [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: ValidPhi !< set to indicate when there is no valid Phi for this node at this time (temporarially turn off induction when this is false) [-] LOGICAL :: nodesInitialized !< the node states have been initialized properly [-] END TYPE BEMT_OtherStateType @@ -1727,20 +1726,6 @@ SUBROUTINE BEMT_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, CALL DBEMT_CopyOtherState( SrcOtherStateData%DBEMT, DstOtherStateData%DBEMT, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcOtherStateData%UA_Flag)) THEN - i1_l = LBOUND(SrcOtherStateData%UA_Flag,1) - i1_u = UBOUND(SrcOtherStateData%UA_Flag,1) - i2_l = LBOUND(SrcOtherStateData%UA_Flag,2) - i2_u = UBOUND(SrcOtherStateData%UA_Flag,2) - IF (.NOT. ALLOCATED(DstOtherStateData%UA_Flag)) THEN - ALLOCATE(DstOtherStateData%UA_Flag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%UA_Flag.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstOtherStateData%UA_Flag = SrcOtherStateData%UA_Flag -ENDIF IF (ALLOCATED(SrcOtherStateData%ValidPhi)) THEN i1_l = LBOUND(SrcOtherStateData%ValidPhi,1) i1_u = UBOUND(SrcOtherStateData%ValidPhi,1) @@ -1769,9 +1754,6 @@ SUBROUTINE BEMT_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) ErrMsg = "" CALL UA_DestroyOtherState( OtherStateData%UA, ErrStat, ErrMsg ) CALL DBEMT_DestroyOtherState( OtherStateData%DBEMT, ErrStat, ErrMsg ) -IF (ALLOCATED(OtherStateData%UA_Flag)) THEN - DEALLOCATE(OtherStateData%UA_Flag) -ENDIF IF (ALLOCATED(OtherStateData%ValidPhi)) THEN DEALLOCATE(OtherStateData%ValidPhi) ENDIF @@ -1847,11 +1829,6 @@ SUBROUTINE BEMT_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! UA_Flag allocated yes/no - IF ( ALLOCATED(InData%UA_Flag) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! UA_Flag upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%UA_Flag) ! UA_Flag - END IF Int_BufSz = Int_BufSz + 1 ! ValidPhi allocated yes/no IF ( ALLOCATED(InData%ValidPhi) ) THEN Int_BufSz = Int_BufSz + 2*2 ! ValidPhi upper/lower bounds for each dimension @@ -1941,26 +1918,6 @@ SUBROUTINE BEMT_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%UA_Flag) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_Flag,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_Flag,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_Flag,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_Flag,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%UA_Flag,2), UBOUND(InData%UA_Flag,2) - DO i1 = LBOUND(InData%UA_Flag,1), UBOUND(InData%UA_Flag,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%UA_Flag(i1,i2), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF IF ( .NOT. ALLOCATED(InData%ValidPhi) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -2093,29 +2050,6 @@ SUBROUTINE BEMT_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! UA_Flag not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%UA_Flag)) DEALLOCATE(OutData%UA_Flag) - ALLOCATE(OutData%UA_Flag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%UA_Flag.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%UA_Flag,2), UBOUND(OutData%UA_Flag,2) - DO i1 = LBOUND(OutData%UA_Flag,1), UBOUND(OutData%UA_Flag,1) - OutData%UA_Flag(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%UA_Flag(i1,i2)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ValidPhi not allocated Int_Xferred = Int_Xferred + 1 ELSE diff --git a/modules/aerodyn/src/FVW.f90 b/modules/aerodyn/src/FVW.f90 index 4a984e362f..7293823921 100644 --- a/modules/aerodyn/src/FVW.f90 +++ b/modules/aerodyn/src/FVW.f90 @@ -485,6 +485,7 @@ subroutine FVW_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) ErrMsg = "" ! Place any last minute operations or calculations here: ! Close files here: + ! Destroy the input data: if (allocated(u)) then do i=1,size(u) @@ -505,9 +506,6 @@ subroutine FVW_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) ! Destroy the output data: call FVW_DestroyOutput( y, ErrStat, ErrMsg ) -#ifdef UA_OUTS - CLOSE(69) -#endif end subroutine FVW_End @@ -986,8 +984,7 @@ subroutine FVW_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, ErrStat, endif endif endif - - + contains logical function Failed() @@ -1000,7 +997,6 @@ end subroutine FVW_CalcOutput ! --- UA related, should be merged with AeroDyn !---------------------------------------------------------------------------------------------------------------------------------- subroutine UA_Init_Wrapper(AFInfo, InitInp, interval, p, x, xd, OtherState, m, ErrStat, ErrMsg ) - use UnsteadyAero, only: UA_Init, UA_TurnOff_param type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data, temporary, for UA.. type(FVW_InitInputType), intent(inout) :: InitInp !< Input data for initialization routine (inout so we can use MOVE_ALLOC) real(DbKi), intent(inout) :: interval !< time interval @@ -1020,53 +1016,32 @@ subroutine UA_Init_Wrapper(AFInfo, InitInp, interval, p, x, xd, OtherState, m, E character(ErrMsgLen) :: ErrMsg2 ErrStat = ErrID_None ErrMsg = "" - + m%UA_Flag=InitInp%UA_Flag ! --- Condensed version of BEMT_Init_Otherstate - allocate ( OtherState%UA_Flag( InitInp%numBladeNodes, InitInp%NumBlades ), STAT = ErrStat2 ) - OtherState%UA_Flag=m%UA_Flag if ( m%UA_Flag ) then ErrMsg2='Unsteady aerodynamic (`AFAeroMod>1`) cannot be used with the free wake code (`WakeMod=3`) for now.'; ErrStat2=ErrID_Fatal; call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'UA_Init_Wrapper'); return ! ---Condensed version of "BEMT_Set_UA_InitData" allocate(Init_UA_Data%c(InitInp%numBladeNodes,InitInp%numBlades), STAT = errStat2) - do j = 1,InitInp%NumBlades; do i = 1,InitInp%numBladeNodes; + do j = 1,InitInp%NumBlades + do i = 1,InitInp%numBladeNodes Init_UA_Data%c(i,j) = p%chord(i,j) ! NOTE: InitInp chord move-allocd to p - end do; end do + end do + end do Init_UA_Data%dt = interval - Init_UA_Data%OutRootName = '' + Init_UA_Data%OutRootName = 'Debug.UA' Init_UA_Data%numBlades = InitInp%NumBlades Init_UA_Data%nNodesPerBlade = InitInp%numBladeNodes - Init_UA_Data%NumOuts = 0 Init_UA_Data%UAMod = InitInp%UAMod Init_UA_Data%Flookup = InitInp%Flookup - Init_UA_Data%a_s = InitInp%a_s ! m/s + Init_UA_Data%a_s = InitInp%a_s ! m/s + Init_UA_Data%ShedEffect = .False. ! Important, when coupling UA wih vortex code, shed vorticity is inherently accounted for + ! --- UA init call UA_Init( Init_UA_Data, u_UA, m%p_UA, x%UA, xd%UA, OtherState%UA, m%y_UA, m%m_UA, interval, InitOutData_UA, ErrStat2, ErrMsg2); if(Failed())return - m%p_UA%ShedEffect=.False. !< Important, when coupling UA wih vortex code, shed vorticity is inherently accounted for - ! --- Condensed version of "BEMT_CheckInitUA" - do j = 1,InitInp%numBlades; do i = 1,InitInp%numBladeNodes; ! Loop over blades and nodes - call UA_TurnOff_param(m%p_UA, AFInfo(p%AFindx(i,j)), ErrStat2, ErrMsg2) - if (ErrStat2 /= ErrID_None) then - call WrScr( 'Warning: Turning off Unsteady Aerodynamics because '//trim(ErrMsg2)//' BladeNode = '//trim(num2lstr(i))//', Blade = '//trim(num2lstr(j)) ) - OtherState%UA_Flag(i,j) = .false. - end if - end do; end do; -#ifdef UA_OUTS - CALL OpenFOutFile ( 69, 'Debug.UA.out', errStat, errMsg ); IF (ErrStat >= AbortErrLev) RETURN - WRITE (69,'(/,A)') 'This output information was generated by FVW'// ' on '//CurDate()//' at '//CurTime()//'.' - WRITE (69,'(:,A20)', ADVANCE='no' ) 'Time' - do i=1,size(InitOutData_UA%WriteOutputHdr) - WRITE (69,'(:,A20)', ADVANCE='no' ) trim(InitOutData_UA%WriteOutputHdr(i)) - end do - write (69,'(A)') ' ' - WRITE (69,'(:,A20)', ADVANCE='no' ) '(s)' - do i=1,size(InitOutData_UA%WriteOutputUnt) - WRITE (69,'(:,A20)', ADVANCE='no' ) trim(InitOutData_UA%WriteOutputUnt(i)) - end do - write (69,'(A)') ' ' -#endif + call UA_DestroyInput( u_UA, ErrStat2, ErrMsg2 ); if(Failed())return call UA_DestroyInitInput( Init_UA_Data, ErrStat2, ErrMsg2 ); if(Failed())return call UA_DestroyInitOutput( InitOutData_UA, ErrStat2, ErrMsg2 ); if(Failed())return @@ -1086,7 +1061,7 @@ end subroutine UA_Init_Wrapper subroutine UA_UpdateState_Wrapper(AFInfo, t, n, u, p, x, xd, OtherState, m, ErrStat, ErrMsg ) use FVW_VortexTools, only: interpextrap_cp2node - use UnsteadyAero, only: UA_UpdateStates, UA_TurnOff_input + use UnsteadyAero, only: UA_UpdateStates type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data, temporary, for UA.. real(DbKi), intent(in ) :: t !< Current simulation time in seconds integer(IntKi), intent(in ) :: n !< time step @@ -1135,34 +1110,25 @@ subroutine UA_UpdateState_Wrapper(AFInfo, t, n, u, p, x, xd, OtherState, m, ErrS endif do i = 1,p%nSpan+1 - ! We only update the UnsteadyAero states if we have unsteady aero turned on for this node - if (OtherState%UA_Flag(i,j) .and. n > 0) then - !! ....... compute inputs to UA ........... - ! NOTE: To be consistent with CalcOutput we take Vwind_ND that was set using m%DisturbedInflow from AeroDyn.. - ! This is not clean, but done to be consistent, waiting for AeroDyn to handle UA - call AlphaVrel_Generic(u%WingsMesh(j)%Orientation(1:3,1:3,i), u%WingsMesh(j)%TranslationVel(1:3,i), Vind_node(:,i), m%Vwnd_ND(:,i,j), & - p%KinVisc, p%Chord(i,j), u_UA(k)%U, u_UA(k)%alpha, u_UA(k)%Re) - ! FIX ME: this is copied 3 times!!!! - u_UA%v_ac(1) = sin(u_UA%alpha)*u_UA%U - u_UA%v_ac(2) = cos(u_UA%alpha)*u_UA%U - u_UA%omega = 0.0_ReKi ! FIX ME!!!! dot_product( u%BladeMotion(j)%RotationVel( :,i), m%WithoutSweepPitchTwist(3,:,i,j) ) ! rotation of no-sweep-pitch coordinate system around z of the jth node in the kth blade - u_UA(k)%UserProp = 0 ! u1%UserProp(i,j) ! TODO + !! ....... compute inputs to UA ........... + ! NOTE: To be consistent with CalcOutput we take Vwind_ND that was set using m%DisturbedInflow from AeroDyn.. + ! This is not clean, but done to be consistent, waiting for AeroDyn to handle UA + call AlphaVrel_Generic(u%WingsMesh(j)%Orientation(1:3,1:3,i), u%WingsMesh(j)%TranslationVel(1:3,i), Vind_node(:,i), m%Vwnd_ND(:,i,j), & + p%KinVisc, p%Chord(i,j), u_UA(k)%U, u_UA(k)%alpha, u_UA(k)%Re) + ! FIX ME: this is copied 3 times!!!! + u_UA%v_ac(1) = sin(u_UA%alpha)*u_UA%U + u_UA%v_ac(2) = cos(u_UA%alpha)*u_UA%U + u_UA%omega = 0.0_ReKi ! FIX ME!!!! dot_product( u%BladeMotion(j)%RotationVel( :,i), m%WithoutSweepPitchTwist(3,:,i,j) ) ! rotation of no-sweep-pitch coordinate system around z of the jth node in the kth blade + u_UA(k)%UserProp = 0 ! u1%UserProp(i,j) ! TODO - !! ....... check inputs to UA ........... - call UA_TurnOff_input(m%p_UA, AFInfo(p%AFIndx(i,j)), u_UA(k), ErrStat2, ErrMsg2) - if (ErrStat2 /= ErrID_None) then - OtherState%UA_Flag(i,j) = .FALSE. - call WrScr( 'Warning: Turning off dynamic stall due to '//trim(ErrMsg2)//' '//trim(NodeText(i,j))) - else - ! COMPUTE: xd%UA, OtherState%UA - call UA_UpdateStates( i, j, t, n, u_UA, uTimes, m%p_UA, x%UA, xd%UA, OtherState%UA, AFInfo(p%AFIndx(i,j)), m%m_UA, ErrStat2, ErrMsg2 ) - if (ErrStat2 /= ErrID_None) then - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'UA_UpdateState_Wrapper'//trim(NodeText(i,j))) - call WrScr(trim(ErrMsg)) - if (ErrStat >= AbortErrLev) return - end if - end if + ! COMPUTE: xd%UA, OtherState%UA + call UA_UpdateStates( i, j, t, n, u_UA, uTimes, m%p_UA, x%UA, xd%UA, OtherState%UA, AFInfo(p%AFIndx(i,j)), m%m_UA, ErrStat2, ErrMsg2 ) + if (ErrStat2 /= ErrID_None) then + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'UA_UpdateState_Wrapper'//trim(NodeText(i,j))) + call WrScr(trim(ErrMsg)) + if (ErrStat >= AbortErrLev) return end if + end do end do call UA_DestroyInput( u_UA(k), ErrStat2, ErrMsg2 ); diff --git a/modules/aerodyn/src/FVW_Registry.txt b/modules/aerodyn/src/FVW_Registry.txt index fb513c41c0..629b28bb7b 100644 --- a/modules/aerodyn/src/FVW_Registry.txt +++ b/modules/aerodyn/src/FVW_Registry.txt @@ -43,7 +43,7 @@ typedef ^ ^ IntKi typedef ^ ^ DbKi DTaero - - - "Time interval for calls calculations" s typedef ^ ^ DbKi DTfvw - - - "Time interval for calculating wake induced velocities" s typedef ^ ^ ReKi KinVisc - - - "Kinematic air viscosity" m^2/s -# Parametesr output options +# Parameter output options typedef ^ ^ IntKi WrVTK - - - "Outputs VTK at each calcoutput call, even if main fst doesnt do it" - typedef ^ ^ IntKi VTKBlades - - - "Outputs VTk for each blade 0=no blade, 1=Bld 1" - typedef ^ ^ DbKi DTvtk - - - "DT between vtk writes" s @@ -165,7 +165,6 @@ typedef ^ ^ Reki typedef FVW/FVW OtherStateType IntKi NULL - - - "Number of active near wake panels" - # TODO UA typedef ^ ^ UA_OtherStateType UA - - - "other states for UnsteadyAero" - -typedef ^ ^ Logical UA_Flag {:}{:} - - "logical flag indicating whether to use UnsteadyAero" - #.......... InitInputType ...... diff --git a/modules/aerodyn/src/FVW_Types.f90 b/modules/aerodyn/src/FVW_Types.f90 index 530c8a2dd2..99f4966fd6 100644 --- a/modules/aerodyn/src/FVW_Types.f90 +++ b/modules/aerodyn/src/FVW_Types.f90 @@ -185,7 +185,6 @@ MODULE FVW_Types TYPE, PUBLIC :: FVW_OtherStateType INTEGER(IntKi) :: NULL !< Number of active near wake panels [-] TYPE(UA_OtherStateType) :: UA !< other states for UnsteadyAero [-] - LOGICAL , DIMENSION(:,:), ALLOCATABLE :: UA_Flag !< logical flag indicating whether to use UnsteadyAero [-] END TYPE FVW_OtherStateType ! ======================= ! ========= FVW_InitInputType ======= @@ -6453,8 +6452,6 @@ SUBROUTINE FVW_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, E CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FVW_CopyOtherState' @@ -6465,20 +6462,6 @@ SUBROUTINE FVW_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, E CALL UA_CopyOtherState( SrcOtherStateData%UA, DstOtherStateData%UA, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcOtherStateData%UA_Flag)) THEN - i1_l = LBOUND(SrcOtherStateData%UA_Flag,1) - i1_u = UBOUND(SrcOtherStateData%UA_Flag,1) - i2_l = LBOUND(SrcOtherStateData%UA_Flag,2) - i2_u = UBOUND(SrcOtherStateData%UA_Flag,2) - IF (.NOT. ALLOCATED(DstOtherStateData%UA_Flag)) THEN - ALLOCATE(DstOtherStateData%UA_Flag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%UA_Flag.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstOtherStateData%UA_Flag = SrcOtherStateData%UA_Flag -ENDIF END SUBROUTINE FVW_CopyOtherState SUBROUTINE FVW_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) @@ -6491,9 +6474,6 @@ SUBROUTINE FVW_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) ErrStat = ErrID_None ErrMsg = "" CALL UA_DestroyOtherState( OtherStateData%UA, ErrStat, ErrMsg ) -IF (ALLOCATED(OtherStateData%UA_Flag)) THEN - DEALLOCATE(OtherStateData%UA_Flag) -ENDIF END SUBROUTINE FVW_DestroyOtherState SUBROUTINE FVW_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -6550,11 +6530,6 @@ SUBROUTINE FVW_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! UA_Flag allocated yes/no - IF ( ALLOCATED(InData%UA_Flag) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! UA_Flag upper/lower bounds for each dimension - Int_BufSz = Int_BufSz + SIZE(InData%UA_Flag) ! UA_Flag - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -6612,26 +6587,6 @@ SUBROUTINE FVW_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%UA_Flag) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_Flag,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_Flag,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_Flag,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_Flag,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%UA_Flag,2), UBOUND(InData%UA_Flag,2) - DO i1 = LBOUND(InData%UA_Flag,1), UBOUND(InData%UA_Flag,1) - IntKiBuf(Int_Xferred) = TRANSFER(InData%UA_Flag(i1,i2), IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF END SUBROUTINE FVW_PackOtherState SUBROUTINE FVW_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -6647,8 +6602,6 @@ SUBROUTINE FVW_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FVW_UnPackOtherState' @@ -6704,29 +6657,6 @@ SUBROUTINE FVW_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! UA_Flag not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%UA_Flag)) DEALLOCATE(OutData%UA_Flag) - ALLOCATE(OutData%UA_Flag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%UA_Flag.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%UA_Flag,2), UBOUND(OutData%UA_Flag,2) - DO i1 = LBOUND(OutData%UA_Flag,1), UBOUND(OutData%UA_Flag,1) - OutData%UA_Flag(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%UA_Flag(i1,i2)) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF END SUBROUTINE FVW_UnPackOtherState SUBROUTINE FVW_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/aerodyn/src/FVW_VTK.f90 b/modules/aerodyn/src/FVW_VTK.f90 index 8770d43b83..8bd5f3ade4 100644 --- a/modules/aerodyn/src/FVW_VTK.f90 +++ b/modules/aerodyn/src/FVW_VTK.f90 @@ -95,6 +95,7 @@ logical function vtk_new_ascii_file(filename,label,mvtk) !form='UNFORMATTED',access='SEQUENTIAL',action='WRITE',convert='BIG_ENDIAN',recordtype='STREAM',buffered='YES', !print*,'Not available for this compiler' !COMPAQ-COMPILER !STOP !COMPAQ-COMPILER +!bjj: CONVERT is non-standard, so maybe this should be part of Sys*.f90? Like OpenUnfInpBEFile()? open(unit = mvtk%vtk_unit,file= trim(adjustl(filename)),form='UNFORMATTED',access = 'stream',& !OTHER-COMPILER action = 'WRITE',convert= 'BIG_ENDIAN',iostat=iostatvar,status='replace') !OTHER-COMPILER else diff --git a/modules/aerodyn/src/UA_Dvr_Subs.f90 b/modules/aerodyn/src/UA_Dvr_Subs.f90 index cb56cb2642..50a90f329c 100644 --- a/modules/aerodyn/src/UA_Dvr_Subs.f90 +++ b/modules/aerodyn/src/UA_Dvr_Subs.f90 @@ -571,17 +571,6 @@ subroutine Init_AFI(p, NumAFfiles, afNames, UseCm, AFI_Params, ErrStat, ErrMsg) return end if end do - - - - do i=1,NumAFfiles - - call UA_ValidateAFI(p%UAMod, AFI_Params(i), afNames(i), ErrStat2, ErrMsg2) - call SetErrStat(errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) - - call UA_TurnOff_param(p, AFI_Params(i), ErrStat2, ErrMsg2) - call SetErrStat(errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) - end do call Cleanup() @@ -605,15 +594,39 @@ end subroutine Cleanup end subroutine Init_AFI + subroutine WriteAFITables(AFI_Params,OutRootName) + type(AFI_ParameterType), intent(in) :: AFI_Params + character(ErrMsgLen) , intent(in) :: OutRootName + + integer(IntKi) :: unOutFile + integer(IntKi) :: row + integer(IntKi) :: ErrStat + character(ErrMsgLen) :: ErrMsg + + CALL GetNewUnit( unOutFile, ErrStat, ErrMsg ) + IF ( ErrStat /= ErrID_None ) RETURN + + CALL OpenFOutFile ( unOutFile, trim(OutRootName)//'.Coefs.out', ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) then + call WrScr(Trim(ErrMsg)) + return + end if + - - - - - - - + WRITE (unOutFile,'(/,A/)') 'These predictions were generated by UnsteadyAero Driver on '//CurDate()//' at '//CurTime()//'.' + WRITE (unOutFile,'(/,A/)') ' ' + ! note that this header assumes we have Cm and unsteady aero coefficients + WRITE(unOutFile, '(20(A20,1x))') 'Alpha', 'Cl', 'Cd', 'Cm', 'f_st', 'cl_fs', 'f_st2', 'cn_fs' + WRITE(unOutFile, '(20(A20,1x))') '(deg)', '(-)', '(-)', '(-)', '(-)', '(-)', '(-)', '(-)' + + do row=1,size(AFI_Params%Table(1)%Alpha) + WRITE(unOutFile, '(20(F20.6,1x))') AFI_Params%Table(1)%Alpha(row)*R2D, AFI_Params%Table(1)%Coefs(row,:) + end do + + CLOSE(unOutFile) + + end subroutine WriteAFITables diff --git a/modules/aerodyn/src/UnsteadyAero.f90 b/modules/aerodyn/src/UnsteadyAero.f90 index d24a730daf..810035c1c3 100644 --- a/modules/aerodyn/src/UnsteadyAero.f90 +++ b/modules/aerodyn/src/UnsteadyAero.f90 @@ -32,16 +32,14 @@ module UnsteadyAero public :: UA_Init - public :: UA_UpdateDiscOtherState public :: UA_UpdateStates public :: UA_CalcOutput public :: UA_CalcContStateDeriv + public :: UA_End + public :: UA_WriteOutputToFile public :: UA_ReInit - public :: UA_ValidateAFI - public :: UA_TurnOff_param - public :: UA_TurnOff_input - public :: UA_InitStates_AllNodes + public :: UA_InitStates_AllNodes ! used for AD linearization initialization integer(intki), parameter :: UA_Baseline = 1 ! UAMod = 1 [Baseline model (Original)] integer(intki), parameter :: UA_Gonzalez = 2 ! UAMod = 2 [Gonzalez's variant (changes in Cn,Cc,Cm)] @@ -49,7 +47,9 @@ module UnsteadyAero integer(intki), parameter, public :: UA_HGM = 4 ! UAMod = 4 [continuous variant of HGM (Hansen) model] real(ReKi), parameter :: Gonzalez_factor = 0.2_ReKi ! this factor, proposed by Gonzalez (for "all" models) is used to modify Cc to account for negative values seen at f=0 (see Eqn 1.40) - + + real(ReKi), parameter, public :: UA_u_min = 0.01_ReKi ! m/s; used to provide a minimum value so UA equations don't blow up (this should be much lower than range where UA is turned off) + contains ! ************************************************** @@ -419,6 +419,7 @@ subroutine ComputeKelvinChain( i, j, u, p, xd, OtherState, misc, AFInfo, KC, BL_ KC%dalpha0 = KC%alpha_filt_cur - BL_p%alpha0 + ! Compute Kalpha using Eqn 1.7 Kalpha = ( KC%alpha_filt_cur - alpha_filt_minus1 ) / p%dt ! Eqn 1.7, using filtered values of alpha @@ -513,7 +514,7 @@ subroutine ComputeKelvinChain( i, j, u, p, xd, OtherState, misc, AFInfo, KC, BL_ KC%Cn_q_circ = KC%C_nalpha_circ*KC%q_f_cur/2.0 - KC%X3 - KC%X4 ! Eqn 1.16 - else ! these aren't used (they are possibly output to UA_OUT file, though) + else ! these aren't used (they are possibly output to UA output file (when UA_OUTS defined) file, though) KC%X3 = 0.0_ReKi KC%X4 = 0.0_ReKi KC%Cn_q_circ = 0.0_ReKi @@ -732,6 +733,7 @@ subroutine UA_SetParameters( dt, InitInp, p, ErrStat, ErrMsg ) p%UAMod = InitInp%UAMod p%a_s = InitInp%a_s ! this can't be 0 p%Flookup = InitInp%Flookup + p%ShedEffect = InitInp%ShedEffect if (p%UAMod==UA_HGM) then p%lin_nx = p%numBlades*p%nNodesPerBlade*4 @@ -743,12 +745,14 @@ end subroutine UA_SetParameters !============================================================================== !============================================================================== -subroutine UA_InitStates_Misc( p, x, xd, OtherState, m, ErrStat, ErrMsg ) +subroutine UA_InitStates_Misc( p, AFInfo, AFIndx, x, xd, OtherState, m, ErrStat, ErrMsg ) ! Called by : UA_Init ! Calls to : NONE !.............................................................................. type(UA_ParameterType), intent(in ) :: p ! Parameters + type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data + integer(IntKi), intent(in ) :: AFIndx(:,:) type(UA_ContinuousStateType), intent(inout) :: x ! Initial continuous states type(UA_DiscreteStateType), intent(inout) :: xd ! Initial discrete states type(UA_OtherStateType), intent(inout) :: OtherState ! Initial other states @@ -819,22 +823,27 @@ subroutine UA_InitStates_Misc( p, x, xd, OtherState, m, ErrStat, ErrMsg ) call AllocAry(m%TESF ,p%nNodesPerBlade,p%numBlades,'m%TESF',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) call AllocAry(m%LESF ,p%nNodesPerBlade,p%numBlades,'m%LESF',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) call AllocAry(m%VRTX ,p%nNodesPerBlade,p%numBlades,'m%VRTX',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - call AllocAry(m%T_Sh ,p%nNodesPerBlade,p%numBlades,'m%T_Sh',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(m%T_Sh ,p%nNodesPerBlade,p%numBlades,'m%T_Sh',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) # endif end if + + call AllocAry(m%weight ,p%nNodesPerBlade,p%numBlades,'m%weight',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) call AllocAry(OtherState%FirstPass,p%nNodesPerBlade,p%numBlades,'OtherState%FirstPass',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + call AllocAry(OtherState%UA_off_forGood,p%nNodesPerBlade,p%numBlades,'OtherState%UA_off_forGood',ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) return + - - call UA_ReInit( p, x, xd, OtherState, m,ErrStat2,ErrMsg2 ) ! initializes values of states and misc vars + call UA_ReInit( p, AFInfo, AFIndx, x, xd, OtherState, m, ErrStat2,ErrMsg2 ) ! initializes values of states and misc vars call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) end subroutine UA_InitStates_Misc !============================================================================== -subroutine UA_ReInit( p, x, xd, OtherState, m, ErrStat, ErrMsg ) +subroutine UA_ReInit( p, AFInfo, AFIndx, x, xd, OtherState, m, ErrStat, ErrMsg ) type(UA_ParameterType), intent(in ) :: p ! Parameters + type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data + integer(IntKi), intent(in ) :: AFIndx(:,:) type(UA_ContinuousStateType), intent(inout) :: x ! Initial continuous states type(UA_DiscreteStateType), intent(inout) :: xd ! Initial discrete states type(UA_OtherStateType), intent(inout) :: OtherState ! Initial other states @@ -854,9 +863,26 @@ subroutine UA_ReInit( p, x, xd, OtherState, m, ErrStat, ErrMsg ) m%FirstWarn_M = .true. m%FirstWarn_UA = .true. + m%FirstWarn_UA_off = .true. + m%weight = 1.0 OtherState%FirstPass = .true. + OtherState%UA_off_forGood = .false. ! flag that determines if UA parameters are invalid and should be turned off for the whole simulation + do j=1,size(OtherState%UA_off_forGood,2) + do i=1,size(OtherState%UA_off_forGood,1) + + call UA_TurnOff_param(p, AFInfo(AFIndx(i,j)), ErrStat2, ErrMsg2) + if (ErrStat2 > ErrID_None) then + call WrScr( 'Warning: Turning off Unsteady Aerodynamics because '//trim(ErrMsg2)//' (node '//trim(num2lstr(i))//', blade '//trim(num2lstr(j))//')' ) + OtherState%UA_off_forGood(i,j) = .true. + m%weight(i,j) = 0.0_ReKi + end if + + end do + end do + + if ( p%UAMod == UA_HGM ) then OtherState%n = -1 ! we haven't updated OtherState%xdot, yet @@ -922,7 +948,7 @@ subroutine UA_ReInit( p, x, xd, OtherState, m, ErrStat, ErrMsg ) end subroutine UA_ReInit !============================================================================== subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & - InitOut,ErrStat, ErrMsg ) + AFInfo, AFIndx, InitOut,ErrStat, ErrMsg ) ! This routine is called at the start of the simulation to perform initialization steps. ! The parameters are set here and not changed during the simulation. ! The initial states and initial guess for the input are defined. @@ -945,6 +971,8 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & ! Input is the suggested time from the glue code; ! Output is the actual coupling interval that will be used ! by the glue code. + type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data + integer(IntKi), intent(in ) :: AFIndx(:,:) type(UA_InitOutputType), intent( out) :: InitOut ! Output for initialization routine integer(IntKi), intent( out) :: ErrStat ! Error status of the operation character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None @@ -968,7 +996,7 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & ! Initialize the NWTC Subroutine Library call NWTC_Init( EchoLibVer=.FALSE. ) - call UA_ValidateInput(InitInp, ErrStat2, ErrMsg2) + call UA_ValidateInput(InitInp, AFInfo, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if (ErrStat >= AbortErrLev) return @@ -978,7 +1006,7 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & if (ErrStat >= AbortErrLev) return ! initialize the discrete states, other states, and misc variables - call UA_InitStates_Misc( p, x, xd, OtherState, m, ErrStat2, ErrMsg2 ) ! initialize the continuous states + call UA_InitStates_Misc( p, AFInfo, AFIndx, x, xd, OtherState, m, ErrStat2, ErrMsg2 ) ! initialize the continuous states call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if (ErrStat >= AbortErrLev) return @@ -987,9 +1015,9 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & ! Allocate and set the InitOut data if (p%UAMod == UA_HGM) then - p%NumOuts = 17 + p%NumOuts = 19 else - p%NumOuts = 42 + p%NumOuts = 45 end if allocate(InitOut%WriteOutputHdr(p%NumOuts*p%numBlades*p%nNodesPerBlade),STAT=ErrStat2) @@ -999,6 +1027,7 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & allocate(y%WriteOutput(p%NumOuts*p%numBlades*p%nNodesPerBlade),STAT=ErrStat2) if (ErrStat2 /= 0) call SetErrStat(ErrID_Fatal,'Error allocating y%WriteOutput.',ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) return + y%WriteOutput = 0.0_ReKi iNode = 0 do j = 1,p%numBlades @@ -1008,6 +1037,7 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & chanPrefix = "B"//trim(num2lstr(j))//"N"//trim(num2lstr(i)) + InitOut%WriteOutputHdr(iOffset+ 1) = trim(chanPrefix)//'ALPHA' InitOut%WriteOutputHdr(iOffset+ 2) = trim(chanPrefix)//'VREL' InitOut%WriteOutputHdr(iOffset+ 3) = trim(chanPrefix)//'Cn' InitOut%WriteOutputHdr(iOffset+ 4) = trim(chanPrefix)//'Cc' @@ -1015,6 +1045,7 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputHdr(iOffset+ 6) = trim(chanPrefix)//'Cd' InitOut%WriteOutputHdr(iOffset+ 7) = trim(chanPrefix)//'Cm' + InitOut%WriteOutputUnt(iOffset+ 1) ='(deg)' InitOut%WriteOutputUnt(iOffset+ 2) ='(m/s)' InitOut%WriteOutputUnt(iOffset+ 3) ='(-)' InitOut%WriteOutputUnt(iOffset+ 4) ='(-)' @@ -1023,7 +1054,6 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputUnt(iOffset+ 7) ='(-)' if (p%UAmod == UA_HGM) then - InitOut%WriteOutputHdr(iOffset+ 1) = trim(chanPrefix)//'ALPHA' InitOut%WriteOutputHdr(iOffset+ 8) = trim(chanPrefix)//'omega' InitOut%WriteOutputHdr(iOffset+ 9) = trim(chanPrefix)//'alphaE' @@ -1036,9 +1066,9 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputHdr(iOffset+15) = trim(chanPrefix)//'x2' InitOut%WriteOutputHdr(iOffset+16) = trim(chanPrefix)//'x3' InitOut%WriteOutputHdr(iOffset+17) = trim(chanPrefix)//'x4' - + InitOut%WriteOutputHdr(iOffset+18) = trim(chanPrefix)//'k' + InitOut%WriteOutputHdr(iOffset+19) = trim(chanPrefix)//'weight' - InitOut%WriteOutputUnt(iOffset+ 1) ='(deg)' InitOut%WriteOutputUnt(iOffset+ 8) = '(deg/sec)' InitOut%WriteOutputUnt(iOffset+ 9) = '(deg)' @@ -1051,10 +1081,10 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputUnt(iOffset+15) = '(rad)' InitOut%WriteOutputUnt(iOffset+16) = '(-)' InitOut%WriteOutputUnt(iOffset+17) = '(-)' + InitOut%WriteOutputUnt(iOffset+18) = '(-)' + InitOut%WriteOutputUnt(iOffset+19) = '(-)' else - InitOut%WriteOutputHdr(iOffset+ 1) = trim(chanPrefix)//'ALPHA_filt' - InitOut%WriteOutputHdr(iOffset+ 8) = trim(chanPrefix)//'Cn_aq_circ' InitOut%WriteOutputHdr(iOffset+ 9) = trim(chanPrefix)//'Cn_aq_nc' InitOut%WriteOutputHdr(iOffset+10) = trim(chanPrefix)//'Cn_pot' @@ -1090,10 +1120,11 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputHdr(iOffset+40) = trim(chanPrefix)//'sigma1' InitOut%WriteOutputHdr(iOffset+41) = trim(chanPrefix)//'sigma3' InitOut%WriteOutputHdr(iOffset+42) = trim(chanPrefix)//'T_sh' + InitOut%WriteOutputHdr(iOffset+43) = trim(chanPrefix)//'k' + InitOut%WriteOutputHdr(iOffset+44) = trim(chanPrefix)//'ALPHA_filt' + InitOut%WriteOutputHdr(iOffset+44) = trim(chanPrefix)//'weight' - InitOut%WriteOutputUnt(iOffset+1) ='(deg)' - InitOut%WriteOutputUnt(iOffset+8) ='(-)' InitOut%WriteOutputUnt(iOffset+9) ='(-)' InitOut%WriteOutputUnt(iOffset+10) ='(-)' @@ -1129,13 +1160,48 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & InitOut%WriteOutputUnt(iOffset+40) ='(-)' InitOut%WriteOutputUnt(iOffset+41) ='(-)' InitOut%WriteOutputUnt(iOffset+42) ='(-)' + InitOut%WriteOutputUnt(iOffset+43) ='(-)' + InitOut%WriteOutputUnt(iOffset+44) ='(deg)' + InitOut%WriteOutputUnt(iOffset+45) ='(-)' end if end do end do + + p%OutSFmt = 'A19' + p%OutFmt = 'ES19.5e3' + p%Delim ='' + + if (p%NumOuts > 0) then + CALL GetNewUnit( p%unOutFile, ErrStat, ErrMsg ) + IF ( ErrStat /= ErrID_None ) RETURN + + CALL OpenFOutFile ( p%unOutFile, trim(InitInp%OutRootName)//'.out', ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + ! Heading: + WRITE (p%unOutFile,'(/,A/)') 'These predictions were generated by UnsteadyAero on '//CurDate()//' at '//CurTime()//'.' + WRITE (p%unOutFile,'(/,A/)', IOSTAT=ErrStat) ' ' + + ! Write the names of the output parameters: + WRITE (p%unOutFile,'('//p%OutSFmt//')', ADVANCE='no' ) 'Time' + do i=1,size(InitOut%WriteOutputHdr) + WRITE (p%unOutFile,'(:,A,'//trim( p%OutSFmt )//')', ADVANCE='no' ) p%Delim, trim(InitOut%WriteOutputHdr(i)) + end do + WRITE (p%unOutFile,'()', IOSTAT=ErrStat2) ! write the line return + + WRITE (p%unOutFile,'('//p%OutSFmt//')', ADVANCE='no' ) '(s)' + do i=1,size(InitOut%WriteOutputUnt) + WRITE (p%unOutFile,'(:,A,'//trim( p%OutSFmt )//')', ADVANCE='no' ) p%Delim, trim(InitOut%WriteOutputUnt(i)) + end do + WRITE (p%unOutFile,'()', IOSTAT=ErrStat2) ! write the line return + end if + + #else p%NumOuts = 0 - + p%unOutFile = -1 !..................................... ! add the following two lines only to avoid compiler warnings about uninitialized variables when not building the UA driver: y%cm = 0.0_ReKi @@ -1146,12 +1212,18 @@ subroutine UA_Init( InitInp, u, p, x, xd, OtherState, y, m, Interval, & end subroutine UA_Init !============================================================================== -subroutine UA_ValidateInput(InitInp, ErrStat, ErrMsg) +subroutine UA_ValidateInput(InitInp, AFInfo, ErrStat, ErrMsg) type(UA_InitInputType), intent(inout) :: InitInp ! Input data for initialization routine, needs to be inout because there is a copy of some data in InitInp in BEMT_SetParameters() + type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data integer(IntKi), intent( out) :: ErrStat ! Error status of the operation character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat /= ErrID_None character(*), parameter :: RoutineName = 'UA_ValidateInput' + integer(IntKi) :: i ! loop counter + ErrStat = ErrID_None ErrMsg = "" @@ -1168,12 +1240,19 @@ subroutine UA_ValidateInput(InitInp, ErrStat, ErrMsg) if (InitInp%a_s <= 0.0) call SetErrStat ( ErrID_Fatal, 'The speed of sound (SpdSound) must be greater than zero.', ErrStat, ErrMsg, RoutineName ) + ! check that the airfoils have appropriate data for UA + do i=1,size(AFInfo,1) + call UA_ValidateAFI(InitInp%UAMod, AFInfo(i), ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + end do + + + end subroutine UA_ValidateInput !============================================================================== -subroutine UA_ValidateAFI(UAMod, AFInfo, afName, ErrStat, ErrMsg) +subroutine UA_ValidateAFI(UAMod, AFInfo, ErrStat, ErrMsg) integer(IntKi), intent(in ) :: UAMod ! which UA model we are using type(AFI_ParameterType), intent(in ) :: AFInfo ! The airfoil parameter data - character(*), intent(in ) :: afName ! The airfoil file name integer(IntKi), intent( out) :: ErrStat ! Error status of the operation character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None @@ -1184,54 +1263,52 @@ subroutine UA_ValidateAFI(UAMod, AFInfo, afName, ErrStat, ErrMsg) ErrMsg = "" if (.not. allocated(AFInfo%Table)) then - call SetErrStat(ErrID_Fatal, 'Airfoil table not allocated in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'Airfoil table not allocated in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) else do j=1, AFInfo%NumTabs if ( .not. AFInfo%Table(j)%InclUAdata ) then - call SetErrStat(ErrID_Fatal, 'Airfoil file "'//trim(afName)//'", table #'//trim(num2lstr(j))// & + call SetErrStat(ErrID_Fatal, 'Airfoil file "'//trim(AFInfo%FileName)//'", table #'//trim(num2lstr(j))// & ' does not contain parameters for UA data.', ErrStat, ErrMsg, RoutineName ) else ! parameters used only for UAMod/=UA_HGM) if (UAMod /= UA_HGM) then if ( EqualRealNos(AFInfo%Table(j)%UA_BL%St_sh, 0.0_ReKi) ) then - call SetErrStat(ErrID_Fatal, 'UA St_sh parameter must not be 0 in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'UA St_sh parameter must not be 0 in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if if ( AFInfo%Table(j)%UA_BL%alpha1 > pi .or. AFInfo%Table(j)%UA_BL%alpha1 < -pi ) then - call SetErrStat(ErrID_Fatal, 'UA alpha1 parameter must be between -180 and 180 degrees in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'UA alpha1 parameter must be between -180 and 180 degrees in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if if ( AFInfo%Table(j)%UA_BL%alpha2 > pi .or. AFInfo%Table(j)%UA_BL%alpha2 < -pi ) then - call SetErrStat(ErrID_Fatal, 'UA alpha2 parameter must be between -180 and 180 degrees in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'UA alpha2 parameter must be between -180 and 180 degrees in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if - if ( AFInfo%Table(j)%UA_BL%filtCutOff < 0 ) then - call SetErrStat(ErrID_Fatal, 'UA filtCutOff parameter must be greater than 0 in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + if ( AFInfo%Table(j)%UA_BL%filtCutOff < 0.0_ReKi ) then + call SetErrStat(ErrID_Fatal, 'UA filtCutOff parameter must be greater than 0 in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if end if ! variables used in all UA models: if ( AFInfo%Table(j)%UA_BL%alpha0 > pi .or. AFInfo%Table(j)%UA_BL%alpha0 < -pi ) then - call SetErrStat(ErrID_Fatal, 'UA alpha0 parameter must be between -180 and 180 degrees in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'UA alpha0 parameter must be between -180 and 180 degrees in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if - if ( AFInfo%Table(j)%UA_BL%T_f0 < 0 ) then - call SetErrStat(ErrID_Fatal, 'UA T_f0 parameter must be greater than 0 in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + if ( AFInfo%Table(j)%UA_BL%T_f0 < 0.0_ReKi ) then + call SetErrStat(ErrID_Fatal, 'UA T_f0 parameter must be greater than 0 in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if - if ( AFInfo%Table(j)%UA_BL%T_p < 0 ) then - call SetErrStat(ErrID_Fatal, 'UA T_p parameter must be greater than 0 in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + if ( AFInfo%Table(j)%UA_BL%T_p < 0.0_ReKi ) then + call SetErrStat(ErrID_Fatal, 'UA T_p parameter must be greater than 0 in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) end if end if - -!bjj: check that these SHOULD be used for UA_HGM (EB wasn't sure this was necessary) - if ( AFInfo%Table(j)%UA_BL%UACutout < 0.0_ReKi ) then - call SetErrStat(ErrID_Fatal, 'UA UACutout parameter must not be negative in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) - end if + if ( AFInfo%Table(j)%UA_BL%UACutout < 0.0_ReKi ) then + call SetErrStat(ErrID_Fatal, 'UA UACutout parameter must not be negative in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) + end if @@ -1245,7 +1322,7 @@ subroutine UA_ValidateAFI(UAMod, AFInfo, afName, ErrStat, ErrMsg) do j=2, AFInfo%NumTabs if ( sign( 1.0_ReKi, AFInfo%Table(j)%UA_BL%St_sh) /= & sign( 1.0_ReKi, AFInfo%Table(1)%UA_BL%St_sh) ) then - call SetErrStat(ErrID_Fatal, 'UA St_sh parameter (interpolated value) must not be 0 in "'//trim(afName)//'".', ErrStat, ErrMsg, RoutineName ) + call SetErrStat(ErrID_Fatal, 'UA St_sh parameter (interpolated value) must not be 0 in "'//trim(AFInfo%FileName)//'".', ErrStat, ErrMsg, RoutineName ) exit end if end do @@ -1314,46 +1391,6 @@ subroutine UA_TurnOff_param(p, AFInfo, ErrStat, ErrMsg) end subroutine UA_TurnOff_param !============================================================================== -!> This routine checks if the inputs to UA indicate that UA should not be used. -!! This should be called before updating UA states (and maybe other places). -subroutine UA_TurnOff_input(p, AFInfo, u, ErrStat, ErrMsg) - type(UA_ParameterType), intent(in ) :: p ! UA parameters - type(AFI_ParameterType), intent(in ) :: AFInfo ! The airfoil parameter data - type(UA_InputType), intent(in ) :: u ! UA input - integer(IntKi), intent( out) :: ErrStat ! Error status of the operation - character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None - - REAL(ReKi) :: AoA ! The angle of attack - TYPE(AFI_UA_BL_Type) :: UA_BL ! The tables of Leishman-Beddoes unsteady-aero data for given Re and control setting [-] - - - ErrStat = ErrID_None - ErrMsg = "" - - ! check for zero relative velocity - if (EqualRealNos(u%U, 0.0_ReKi) ) then - ErrStat = ErrID_Fatal - ErrMsg = 'zero relative velocity.' - return - end if - - - ! check for high angle of attack (value larger than cutout specified in tables) - call AFI_ComputeUACoefs( AFInfo, u%Re, u%UserProp, UA_BL, ErrMsg, ErrStat ) - if (ErrStat >= AbortErrLev) return - - ! put alpha in [-pi,pi] before checking its value - AoA = u%alpha - call Mpi2pi(AoA) - - if ( abs(AoA) >= UA_BL%UACutout ) then ! Is the angle of attack larger than the UA cut-out for this airfoil? - ErrStat = ErrID_Fatal - ErrMsg = 'high angle of attack ('//trim(num2lstr(AoA*R2D))//' deg).' - return - end if - -end subroutine UA_TurnOff_input -!============================================================================== subroutine UA_UpdateDiscOtherState( i, j, u, p, xd, OtherState, AFInfo, m, ErrStat, ErrMsg ) ! Routine for updating discrete states and other states (note it breaks the framework) !.............................................................................. @@ -1655,6 +1692,7 @@ subroutine UA_UpdateStates( i, j, t, n, u, uTimes, p, x, xd, OtherState, AFInfo, character(ErrMsgLen) :: errMsg2 integer(IntKi) :: errStat2 character(*), parameter :: RoutineName = 'UA_UpdateStates' + type(UA_InputType) :: u_interp_raw ! Input at current timestep, t and t+dt type(UA_InputType) :: u_interp ! Input at current timestep, t and t+dt ! Initialize variables @@ -1662,9 +1700,11 @@ subroutine UA_UpdateStates( i, j, t, n, u, uTimes, p, x, xd, OtherState, AFInfo, ErrStat = ErrID_None ! no error has occurred ErrMsg = "" - !BJJ: this seems to be the root cause of all sorts of numerical problems.... + !BJJ: u%u == 0 seems to be the root cause of all sorts of numerical problems.... + if (OtherState%UA_off_forGood(i,j)) return ! we don't have any states to update here + if (p%UAMod == UA_HGM) then ! initialize states to steady-state values: @@ -1696,11 +1736,15 @@ subroutine UA_UpdateStates( i, j, t, n, u, uTimes, p, x, xd, OtherState, AFInfo, else if (n<=0) return ! previous logic (before adding UA_HGM required n > 0 before UA_UpdateStates was called) - CALL UA_Input_ExtrapInterp( u, utimes, u_interp, t, ErrStat2, ErrMsg2 ) + CALL UA_Input_ExtrapInterp( u, utimes, u_interp_raw, t, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF ( ErrStat >= AbortErrLev ) RETURN - + ! make sure that u%u is not zero (this previously turned off UA for the entire simulation. + ! Now, we keep it on, but we don't want the math to blow up when we divide by u%u) + call UA_fixInputs(u_interp_raw, u_interp, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! Update discrete states: # ifdef DEBUG_v14 call UA_UpdateDiscOtherState2( i, j, u_interp, p, xd, OtherState, AFInfo, m, ErrStat2, ErrMsg2 ) @@ -1717,13 +1761,13 @@ end subroutine UA_UpdateStates !============================================================================== !!---------------------------------------------------------------------------------------------------------------------------------- !> routine to initialize the states based on inputs at t=0 -subroutine UA_InitStates_AllNodes( u, p, x, OtherState, UA_is_on, AFInfo, AFIndx ) - type(UA_InputType), intent(in ) :: u !< Inputs at t +!! used to obtain initial values in linearization so that they don't change with each call to calcOutput (or other routines) +subroutine UA_InitStates_AllNodes( u, p, x, OtherState, AFInfo, AFIndx ) + type(UA_InputType), intent(in ) :: u(:,:) !< Inputs at t type(UA_ParameterType), intent(in ) :: p !< Parameters type(UA_ContinuousStateType), intent(inout) :: x !< Input: Continuous states at t; type(UA_OtherStateType), intent(inout) :: OtherState !< Other/logical states at t on input; at t+dt on output type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data - logical, intent(in) :: UA_is_on(:,:) INTEGER(IntKi), intent(in) :: AFIndx(:,:) INTEGER(IntKi) :: i !< blade node counter @@ -1738,14 +1782,14 @@ subroutine UA_InitStates_AllNodes( u, p, x, OtherState, UA_is_on, AFInfo, AFIndx !............................................................................................................................... if (p%UAMod == UA_HGM) then - do j = 1,size(UA_is_on,2) ! blades - do i = 1,size(UA_is_on,1) ! nodes + do j = 1,size(OtherState%UA_off_forGood,2) ! blades + do i = 1,size(OtherState%UA_off_forGood,1) ! nodes ! We only update the UnsteadyAero states if we have unsteady aero turned on for this node - if ( UA_is_on(i,j) .and. OtherState%FirstPass(i,j) ) then + if ( .not. OtherState%UA_off_forGood(i,j) .and. OtherState%FirstPass(i,j) ) then ! initialize states to steady-state values: - call HGM_Steady( i, j, u, p, x%element(i,j), AFInfo(AFIndx(i,j)), ErrStat2, ErrMsg2 ) + call HGM_Steady( i, j, u(i,j), p, x%element(i,j), AFInfo(AFIndx(i,j)), ErrStat2, ErrMsg2 ) !call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) OtherState%FirstPass(i,j) = .false. @@ -1820,14 +1864,14 @@ SUBROUTINE HGM_Steady( i, j, u, p, x, AFInfo, ErrStat, ErrMsg ) end subroutine HGM_Steady !---------------------------------------------------------------------------------------------------------------------------------- -subroutine UA_CalcContStateDeriv( i, j, t, u, p, x, OtherState, AFInfo, m, dxdt, ErrStat, ErrMsg ) +subroutine UA_CalcContStateDeriv( i, j, t, u_in, p, x, OtherState, AFInfo, m, dxdt, ErrStat, ErrMsg ) ! Tight coupling routine for computing derivatives of continuous states !.................................................................................................................................. INTEGER(IntKi), INTENT(IN ) :: i !< blade node counter INTEGER(IntKi), INTENT(IN ) :: j !< blade counter REAL(DbKi), INTENT(IN ) :: t ! Current simulation time in seconds - TYPE(UA_InputType), INTENT(IN ) :: u ! Inputs at t + TYPE(UA_InputType), INTENT(IN ) :: u_in ! Inputs at t TYPE(UA_ParameterType), INTENT(IN ) :: p ! Parameters TYPE(UA_ElementContinuousStateType), INTENT(IN ) :: x ! Continuous states at t TYPE(UA_OtherStateType), INTENT(IN ) :: OtherState ! Other states at t @@ -1852,6 +1896,7 @@ subroutine UA_CalcContStateDeriv( i, j, t, u, p, x, OtherState, AFInfo, m, dxdt, real(R8Ki) :: x4 real(ReKi) :: alpha_34 real(ReKi), parameter :: U_dot = 0.0_ReKi ! at some point we may add this term + TYPE(UA_InputType) :: u ! Inputs at t ! Initialize ErrStat @@ -1859,14 +1904,31 @@ subroutine UA_CalcContStateDeriv( i, j, t, u, p, x, OtherState, AFInfo, m, dxdt, ErrStat = ErrID_None ErrMsg = "" + if (OtherState%UA_off_forGood(i,j)) then + dxdt%x = 0.0_R8Ki + return + end if + + ! make sure that u%u is not zero (this previously turned off UA for the entire simulation. + ! Now, we keep it on, but we don't want the math to blow up when we divide by u%u) + call UA_fixInputs(u_in, u, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! Lookup values using Airfoil Info module call AFI_ComputeUACoefs( AFInfo, u%Re, u%UserProp, BL_p, ErrMsg2, ErrStat2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) return + call Get_HGM_constants(i, j, p, u, x, BL_p, Tu, alpha_34, alphaE) ! compute Tu, alpha_34, and alphaE Clp = BL_p%c_lalpha * (alphaE - BL_p%alpha0) + pi * Tu * u%omega ! Eq. 13 + + ! fix definitions of T_f0 and T_p (based on email from Emmanuel 12-28-20 regarding HAWC2 default values) + BL_p%T_f0 = BL_p%T_f0 * 2.0_ReKi * Tu + BL_p%T_p = BL_p%T_p * Tu + ! calculate fs_aF (stored in AFI_interp%f_st): @@ -1911,7 +1973,7 @@ SUBROUTINE Get_HGM_constants(i, j, p, u, x, BL_p, Tu, alpha_34, alphaE) ! Variables derived from inputs !u%u = U_ac = TwoNorm(u%v_ac) ! page 4 definitions - Tu = p%c(i,j) / (2.0_ReKi* u%u) ! Eq. 23 + Tu = p%c(i,j) / (2.0_ReKi* max(u%u, UA_u_min)) ! Eq. 23 Tu = min(Tu, 50.0_ReKi) ! ensure the time constant doesn't exceed 50 s. Tu = max(Tu, 0.001_ReKi) ! ensure the time constant doesn't get too small, either. @@ -2208,13 +2270,13 @@ END SUBROUTINE UA_ABM4 !============================================================================== -subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrStat, ErrMsg ) +subroutine UA_CalcOutput( i, j, u_in, p, x, xd, OtherState, AFInfo, y, misc, ErrStat, ErrMsg ) ! Routine for computing outputs, used in both loose and tight coupling. !.............................................................................. integer(IntKi), intent(in ) :: i ! node index within a blade integer(IntKi), intent(in ) :: j ! blade index - type(UA_InputType), intent(in ) :: u ! Inputs at Time + type(UA_InputType), intent(in ) :: u_in ! Inputs at Time type(UA_ParameterType), intent(in ) :: p ! Parameters type(UA_ContinuousStateType), intent(in ) :: x ! Continuous states at Time type(UA_DiscreteStateType), intent(in ) :: xd ! Discrete states at Time @@ -2231,8 +2293,11 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta character(ErrMsgLen) :: errMsg2 ! Error message if ErrStat2 /= ErrID_None character(*), parameter :: RoutineName = 'UA_CalcOutput' - type(AFI_UA_BL_Type) :: BL_p ! airfoil values computed in Kelvin Chain - type(UA_KelvinChainType) :: KC ! values computed in Kelvin Chain + type(AFI_UA_BL_Type) :: BL_p ! airfoil values computed in Kelvin Chain + type(UA_KelvinChainType) :: KC ! values computed in Kelvin Chain + + type(UA_InputType) :: u ! Inputs at Time (with u%u set to appropriate value) + real(ReKi) :: Cm_FS real(ReKi) :: Cc_FS @@ -2241,6 +2306,7 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta real(ReKi) :: Cm_v, alpha_prime_f real(ReKi) :: x_cp_hat ! center-of-pressure distance from LE in chord fraction real(ReKi) :: Cm_common ! + real(ReKi) :: k ! reduced frequency ! for UA_HGM real(ReKi) :: alphaE @@ -2268,8 +2334,16 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta AFI_interp%Cm = 0.0_ReKi ! value will be output if not computed below alpha_prime_f = 0.0_ReKi ! value will be output if not computed below - if ( (OtherState%FirstPass(i, j) .and. p%UAMod /= UA_HGM) .or. EqualRealNos(u%U, 0.0_ReKi) ) then ! note: if u%U is = 0 in UpdateStates, BEMT shuts off UA; however, it could still be called with u%U=TwoNorm(u%v_ac)=0 here - + ! make sure that u%u is not zero (this previously turned off UA for the entire simulation. + ! Now, we keep it on, but we don't want the math to blow up when we divide by u%u) + call UA_fixInputs(u_in, u, ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + k = abs(u%omega * p%c(i, j) / (2.0_ReKi* u%u)) + + if ( OtherState%UA_off_forGood(i,j) .or. (OtherState%FirstPass(i, j) .and. p%UAMod /= UA_HGM) ) then ! note: if u%U isn't zero because we've called UA_fixInputs + + misc%weight(i,j) = 0.0 + call AFI_ComputeAirfoilCoefs( u%alpha, u%Re, u%UserProp, AFInfo, AFI_interp, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) y%Cl = AFI_interp%Cl @@ -2295,7 +2369,7 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta KC%Dalphaf = 0.0_ReKi KC%T_f = 0.0_ReKi KC%T_V = 0.0_ReKi - KC%alpha_filt_cur = 0.0_ReKi + KC%alpha_filt_cur = u%alpha KC%ds = 2.0_ReKi*u%U*p%dt/p%c(i, j) alphaE = 0.0 @@ -2343,6 +2417,9 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta y%Cn = y%Cl*cos(u%alpha) + y%Cd*sin(u%alpha) y%Cc = y%Cl*sin(u%alpha) - y%Cd*cos(u%alpha) + ! now check if we should have turned off UA, and modify outputs accordingly (with linear combination of steady outputs) + call UA_BlendSteady(k, u, p, AFInfo, y, misc%FirstWarn_UA_off, misc%weight(i,j), ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) else M = u%U / p%a_s @@ -2485,12 +2562,18 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta end if end if + + ! now check if we should have turned off UA, and modify outputs accordingly (with linear combination of steady outputs) + call UA_BlendSteady(k, u, p, AFInfo, y, misc%FirstWarn_UA_off, misc%weight(i,j), ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + end if #ifdef UA_OUTS iOffset = (i-1)*p%NumOuts + (j-1)*p%nNodesPerBlade*p%NumOuts if (allocated(y%WriteOutput)) then !bjj: because BEMT uses local variables for UA output, y%WriteOutput is not necessarially allocated. Need to figure out a better solution. + y%WriteOutput(iOffset+ 1) = u%alpha*R2D y%WriteOutput(iOffset+ 2) = u%U y%WriteOutput(iOffset+ 3) = y%Cn y%WriteOutput(iOffset+ 4) = y%Cc @@ -2500,8 +2583,6 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta if (p%UAMod == UA_HGM) then - y%WriteOutput(iOffset+ 1) = u%alpha*R2D - y%WriteOutput(iOffset+ 8) = u%omega*R2D y%WriteOutput(iOffset+ 9) = alphaE*R2D y%WriteOutput(iOffset+10) = Tu @@ -2513,10 +2594,10 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta y%WriteOutput(iOffset+15) = x%element(i,j)%x(2) y%WriteOutput(iOffset+16) = x%element(i,j)%x(3) y%WriteOutput(iOffset+17) = x%element(i,j)%x(4) + y%WriteOutput(iOffset+18) = k + y%WriteOutput(iOffset+19) = misc%weight(i,j) else - y%WriteOutput(iOffset+ 1) = KC%alpha_filt_cur*R2D - y%WriteOutput(iOffset+ 8) = KC%Cn_alpha_q_circ ! CNCP in ADv14 y%WriteOutput(iOffset+ 9) = KC%Cn_alpha_q_nc ! CNIQ in ADv14 y%WriteOutput(iOffset+10) = KC%Cn_pot @@ -2566,12 +2647,126 @@ subroutine UA_CalcOutput( i, j, u, p, x, xd, OtherState, AFInfo, y, misc, ErrSta y%WriteOutput(iOffset+40) = OtherState%sigma1(i, j) y%WriteOutput(iOffset+41) = OtherState%sigma3(i, j) y%WriteOutput(iOffset+42) = misc%T_sh(i, j) + y%WriteOutput(iOffset+43) = k + y%WriteOutput(iOffset+44) = KC%alpha_filt_cur*R2D + y%WriteOutput(iOffset+45) = misc%weight(i,j) end if end if #endif end subroutine UA_CalcOutput !============================================================================== +subroutine UA_WriteOutputToFile(t, p, y) + real(DbKi), intent(in ) :: t ! current time (s) + type(UA_ParameterType), intent(in ) :: p ! Parameters + type(UA_OutputType), intent(in ) :: y ! Outputs computed at Time (Input only so that mesh con- + ! nectivity information does not have to be recalculated) +! type(UA_ContinuousStateType), intent(in ) :: x ! Continuous states at Time +! type(UA_DiscreteStateType), intent(in ) :: xd ! Discrete states at Time +! type(UA_OtherStateType), intent(in ) :: OtherState ! Other states at Time +! type(AFI_ParameterType), intent(in ) :: AFInfo ! The airfoil parameter data +! type(UA_MiscVarType), intent(inout) :: misc ! Misc/optimization variables +! integer(IntKi), intent( out) :: ErrStat ! Error status of the operation +! character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + integer :: k + + ! Generate file outputs +#ifdef UA_OUTS + if (p%unOutFile > 0 .and. allocated(y%WriteOutput)) then + + write (p%unOutFile,"(F19.6)",ADVANCE='no') t + do k=1,size(y%WriteOutput) + WRITE (p%unOutFile,'(:,A,'//trim( p%OutFmt )//')', ADVANCE='no' ) p%Delim, y%WriteOutput(k) + end do + WRITE (p%unOutFile,'()') ! write the line return + + end if +#endif + +end subroutine UA_WriteOutputToFile +!============================================================================== +subroutine UA_End(p) + type(UA_ParameterType), intent(inout) :: p ! Parameters +! type(UA_ContinuousStateType), intent(in ) :: x ! Continuous states at Time +! type(UA_DiscreteStateType), intent(in ) :: xd ! Discrete states at Time +! type(UA_OtherStateType), intent(in ) :: OtherState ! Other states at Time +! type(AFI_ParameterType), intent(in ) :: AFInfo ! The airfoil parameter data +! type(UA_OutputType), intent(inout) :: y ! Outputs computed at Time (Input only so that mesh con- +! ! nectivity information does not have to be recalculated) +! type(UA_MiscVarType), intent(inout) :: misc ! Misc/optimization variables +! integer(IntKi), intent( out) :: ErrStat ! Error status of the operation +! character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + if (p%NumOuts > 0 .and. p%UnOutFile > 0) CLOSE(p%UnOutFile) + p%unOutFile = -1 +end subroutine UA_End +!============================================================================== +!>This subroutine blends the steady outputs with the unsteady-outputs so that +!! UA can turn back on if the angle of attack goes back into a reasonable range. +subroutine UA_BlendSteady(k, u, p, AFInfo, y, FirstWarn_UA_off, weight, ErrStat, ErrMsg) + REAL(ReKi), intent(in ) :: k ! reduced frequency + type(UA_InputType), intent(in ) :: u ! "Fixed" Inputs at Time + type(UA_ParameterType), intent(in ) :: p ! Parameters + type(AFI_ParameterType), intent(in ) :: AFInfo ! The airfoil parameter data + type(UA_OutputType), intent(inout) :: y ! Outputs computed at Time (Input only so that mesh con- + LOGICAL, intent(inout) :: FirstWarn_UA_off ! flag to determine if warning message should be displayed + REAL(ReKi), intent( out) :: weight ! scaling weight for UA vs steady outputs + integer(IntKi), intent( out) :: ErrStat ! Error status of the operation + character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + type(AFI_OutputType) :: AFI_steady + REAL(ReKi) :: W1,W2,W3 ! Weights for turning off UA temporarily + REAL(ReKi) :: AFI_steady_Cn ! Cn from steady coefficients + REAL(ReKi) :: AFI_steady_Cc ! Cc from steady coefficients + TYPE(AFI_UA_BL_Type) :: UA_BL ! The tables of Leishman-Beddoes unsteady-aero data for given Re and control setting [-] + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'UA_BlendSteady' + + ErrStat = ErrID_None + ErrMsg = "" + + weight = 1.0_ReKi ! default in case of error + + ! Determine what the cutout angle of attack is + call AFI_ComputeUACoefs( AFInfo, u%Re, u%UserProp, UA_BL, ErrMsg, ErrStat ) + if (ErrStat >= AbortErrLev) return ! would only have error if there is a memory problem + + ! put alpha in [-pi,pi] before checking its value + + W1 = 1.0_ReKi - BlendCosine( abs(u%alpha), UA_BL%UACutout_blend, UA_BL%UACutout ) ! shut off when AoA reaches UACutout, but blend it off 5 degrees before (5 degrees is set in AFI to avoid that math each time) + W2 = BlendCosine( abs(u%U), UA_u_min, 1.0_ReKi ) ! turn off UA when inflow velocity is 0 m/s, but start blend it off 1 m/s before (make sure it is greater than u_min) + !W3 = BlendCosine( k, 0.0_ReKi, 0.02_ReKi ) ! turn off UA when reduced frequency is 0, but start blend it off at k=0.02 (this is a quasi-static state) + W3 = 1.0_ReKi + weight = W1*W2*W3 + + if (weight < 1.0_ReKi) then + + if (FirstWarn_UA_off) then + CALL SetErrStat(ErrID_Warn,"Temporarily turning off UA due to high angle of attack or low relative velocity. This warning will not be repeated though the condition may persist.", ErrStat, ErrMsg, RoutineName) + FirstWarn_UA_off = .false. + end if + + ! calculate the steady coefficients + call AFI_ComputeAirfoilCoefs( u%alpha, u%Re, u%UserProp, AFInfo, AFI_steady, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + AFI_steady_Cn = AFI_steady%Cl*cos(u%alpha) + (AFI_steady%Cd-AFI_steady%Cd0)*sin(u%alpha) + AFI_steady_Cc = AFI_steady%Cl*sin(u%alpha) - (AFI_steady%Cd-AFI_steady%Cd0)*cos(u%alpha) + + y%Cn = y%Cn*weight + (1.0_ReKi - weight)*AFI_steady_Cn + y%Cc = y%Cc*weight + (1.0_ReKi - weight)*AFI_steady_Cc + y%Cm = y%Cm*weight + (1.0_ReKi - weight)*AFI_steady%Cm + y%Cl = y%Cl*weight + (1.0_ReKi - weight)*AFI_steady%Cl + y%Cd = y%Cd*weight + (1.0_ReKi - weight)*AFI_steady%Cd + + + end if + + +end subroutine UA_BlendSteady +!============================================================================== !> This subroutine checks that the Mach number is valid. If M > 0.3, the theory !! is invalid. If M > 1, numerical issues result in the code. subroutine UA_CheckMachNumber(M, FirstWarn_M, ErrStat, ErrMsg ) @@ -2604,7 +2799,27 @@ subroutine UA_CheckMachNumber(M, FirstWarn_M, ErrStat, ErrMsg ) end subroutine UA_CheckMachNumber - +subroutine UA_fixInputs(u_in, u, errStat, errMsg) + type(UA_InputType), intent(in ) :: u_in ! Inputs at Time + type(UA_InputType), intent(inout) :: u ! Inputs at Time + + integer(IntKi) :: errStat ! Error status of the operation (secondary error) + character(ErrMsgLen) :: errMsg ! Error message if ErrStat2 /= ErrID_None + + ! make sure that u%u is not zero (this previously turned off UA for the entire simulation. + ! Now, we keep it on, but we don't want the math to blow up when we divide by u%u) + call UA_CopyInput(u_in, u, MESH_UPDATECOPY, errStat, errMsg) + + call mPi2Pi(u%alpha) ! make sure alpha is in a good range + + if (abs(u%u) < UA_u_min) then + u%u = sign(UA_u_min, u%u) + + u%v_ac(1) = sin(u%alpha)*u%U + u%v_ac(2) = cos(u%alpha)*u%U + end if + +end subroutine UA_fixInputs end module UnsteadyAero diff --git a/modules/aerodyn/src/UnsteadyAero_Driver.f90 b/modules/aerodyn/src/UnsteadyAero_Driver.f90 index e544a7850c..e01fed2d42 100644 --- a/modules/aerodyn/src/UnsteadyAero_Driver.f90 +++ b/modules/aerodyn/src/UnsteadyAero_Driver.f90 @@ -44,7 +44,7 @@ program UnsteadyAero_Driver integer(IntKi), parameter :: NumInp = 2 ! Number of inputs sent to UA_UpdateStates (must be at least 2) real(DbKi) :: dt, t, uTimes(NumInp) - integer :: i, j, k, n, iu + integer :: i, j, n, iu type(UA_InitInputType) :: InitInData ! Input data for initialization type(UA_InitOutputType) :: InitOutData ! Output data from initialization type(UA_ContinuousStateType) :: x ! Continuous states @@ -61,9 +61,6 @@ program UnsteadyAero_Driver character(1024) :: afNames(NumAFfiles) type(AFI_ParameterType) :: AFI_Params(NumAFfiles) integer, allocatable :: AFIndx(:,:) - character(1024) :: outFileName - integer :: unOutFile - character(200) :: TimeFrmt, Frmt CHARACTER(1024) :: dvrFilename ! Filename and path for the driver input file. This is passed in as a command line argument when running the Driver exe. TYPE(UA_Dvr_InitInput) :: dvrInitInp ! Initialization data for the driver program real(DbKi) :: simTime @@ -151,6 +148,8 @@ program UnsteadyAero_Driver dvrInitInp%InputsFile = '' end if + InitInData%OutRootName = dvrInitInp%OutRootName + if ( dvrInitInp%SimMod == 1 ) then ! Using the frequency and NCycles, determine how long the simulation needs to run @@ -168,54 +167,34 @@ program UnsteadyAero_Driver end if - ! Initialize UnsteadyAero - call UA_Init( InitInData, u(1), p, x, xd, OtherState, y, m, dt, InitOutData, errStat, errMsg ) - call checkError() - ! Initialize the Airfoil Info Params afNames(1) = dvrInitInp%AirFoil1 ! All nodes/blades are using the same 2D airfoil AFIndx(1,1) = 1 call Init_AFI( p, NumAFfiles, afNames, dvrInitInp%UseCm, AFI_Params, errStat, errMsg ) call checkError() + +! call WriteAFITables(AFI_Params(1), dvrInitInp%OutRootName) - if (p%NumOuts > 0) then - ! Initialize the output file - ! Open the file for output - outFileName = trim(dvrInitInp%OutRootName)//'.out' - call GetNewUnit( unOutFile ) - call OpenFOutFile ( unOutFile, outFileName, errStat, errMsg ) - call checkError() - - ! Write the output file header - p%OutSFmt = 'A19' - p%OutFmt = 'ES19.5e2' - p%Delim ='' + ! Initialize UnsteadyAero (after AFI) + call UA_Init( InitInData, u(1), p, x, xd, OtherState, y, m, dt, AFI_Params, AFIndx, InitOutData, errStat, errMsg ) + call checkError() - Frmt = '('//trim(Int2LStr(p%NumOuts*p%numBlades*p%nNodesPerBlade))//'(:,A,'//trim( p%OutSFmt )//'))' - - write (unOutFile,'(/,A/)', IOSTAT=ErrStat) 'These predictions were generated by UnSteadyAero on '//CurDate()//' at '//CurTime()//'.' - write (unOutFile,'(/,A/)', IOSTAT=ErrStat) 'Driver file name: '//trim(dvrFilename) - - ! Write the names of the output parameters: - write(unOutFile, '(A15)', ADVANCE='no') trim( 'Time' ) - write(unOutFile, Frmt, ADVANCE='no') ( p%Delim, trim( InitOutData%WriteOutputHdr(I) ), i=1,p%NumOuts*p%numBlades*p%nNodesPerBlade ) - write (unOutFile,'()', IOSTAT=ErrStat) ! write the line return - - ! Write the units of the output parameters: - write(unOutFile, '(A15)', ADVANCE='no') trim( '(sec)' ) - write(unOutFile, Frmt, ADVANCE='no') ( p%Delim, trim( InitOutData%WriteOutputUnt(I) ), i=1,p%NumOuts*p%numBlades*p%nNodesPerBlade ) - write (unOutFile,'()', IOSTAT=ErrStat) ! write the line return - - TimeFrmt = '(F15.4)' - Frmt = '('//trim(Int2LStr(p%NumOuts*p%numBlades*p%nNodesPerBlade))//'(:,A,'//trim( p%OutFmt )//'))' + + if (p%NumOuts <= 0) then + ErrStat = ErrID_Fatal + ErrMsg = "No outputs have been selected. Rebuild the executable with -DUA_OUT" + call checkError() end if - - - ! set inputs: - DO iu = 1, NumInp - call setUAinputs(-iu+2, u(iu), uTimes(iu), dt, dvrInitInp, timeArr, AOAarr, Uarr, OmegaArr) - END DO + + ! set inputs: + !u(1) = time at n=1 (t= 0) + !u(2) = time at n=0 (t= -dt) + !u(3) = time at n=-1 (t= -2dt) if NumInp > 2 + + DO iu = 1, NumInp-1 !u(NumInp) is overwritten in time-sim loop, so no need to init here + call setUAinputs(2-iu, u(iu), uTimes(iu), dt, dvrInitInp, timeArr, AOAarr, Uarr, OmegaArr) + END DO ! Set inputs which do not vary with node or time @@ -241,11 +220,8 @@ program UnsteadyAero_Driver call checkError() ! Generate file outputs - if (p%NumOuts > 0) then - write (unOutFile,TimeFrmt,ADVANCE='no') t - write (unOutFile,Frmt,ADVANCE='no') ( p%Delim, y%WriteOutput(k) , k=1,p%NumOuts*p%numBlades*p%nNodesPerBlade ) - write (unOutFile,'()', IOSTAT=ErrStat) ! write the line return - end if + call UA_WriteOutputToFile(t, p, y) + ! Prepare states for next time step call UA_UpdateStates(i, j, t, n, u, uTimes, p, x, xd, OtherState, AFI_Params(AFIndx(i,j)), m, errStat, errMsg ) @@ -254,13 +230,11 @@ program UnsteadyAero_Driver end do - ! write (unOutFile,'(/,A/)', IOSTAT=ErrStat) 'This output file was closed on '//CurDate()//' at '//CurTime()//'.' !------------------------------------------------------------------------------------------------- ! Close our output file !------------------------------------------------------------------------------------------------- - call Cleanup() call NormStop() @@ -271,9 +245,9 @@ subroutine Cleanup() ! The routine cleans up the module echo file and resets the NWTC_Library, reattaching it to ! any existing echo information !---------------------------------------------------------------------------------------------------- + call UA_End(p) - if (p%NumOuts > 0) close( unOutFile, IOSTAT = ErrStat ) - + ! probably should also deallocate driver variables here end subroutine Cleanup @@ -320,6 +294,7 @@ subroutine setUAinputs(n,u,t,dt,dvrInitInp,timeArr,AOAarr,Uarr,OmegaArr) u%U = dvrInitInp%InflowVel ! m/s else indx = min(n,size(timeArr)) + indx = max(1, indx) ! use constant data at initialization ! Load timestep data from the time-series inputs which were previous read from input file t = timeArr(indx) @@ -328,6 +303,8 @@ subroutine setUAinputs(n,u,t,dt,dvrInitInp,timeArr,AOAarr,Uarr,OmegaArr) u%U = Uarr(indx) if (n> size(timeArr)) then t = t + dt*(n - size(timeArr) ) ! update for NumInp>1; + elseif (n < 1) then + t = (n-1)*dt end if end if u%v_ac(1) = sin(u%alpha)*u%U diff --git a/modules/aerodyn/src/UnsteadyAero_Registry.txt b/modules/aerodyn/src/UnsteadyAero_Registry.txt index 617a09cf5c..6b9ccafe92 100644 --- a/modules/aerodyn/src/UnsteadyAero_Registry.txt +++ b/modules/aerodyn/src/UnsteadyAero_Registry.txt @@ -28,7 +28,7 @@ typedef ^ ^ INTEGER typedef ^ ^ INTEGER UAMod - - - "Model for the dynamic stall equations [1 = Leishman/Beddoes, 2 = Gonzalez, 3 = Minnema]" - typedef ^ ^ ReKi a_s - - - "speed of sound" m/s typedef ^ ^ LOGICAL Flookup - - - "Use table lookup for f' and f'' " - -typedef ^ ^ INTEGER NumOuts - - - "The number of outputs for this module as requested in the input file" - +typedef ^ ^ Logical ShedEffect - .True. - "Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods)" - # # Define outputs from the initialization routine here: @@ -138,6 +138,7 @@ typedef ^ ConstraintStateType ReKi # # # Define any other states, including integer or logical states here: +typedef ^ OtherStateType LOGICAL UA_off_forGood {:}{:} - - "logical flag indicating if UA is off for good" - typedef ^ OtherStateType LOGICAL FirstPass {:}{:} - - "logical flag indicating if this is the first time step" - typedef ^ OtherStateType ReKi sigma1 {:}{:} - - "multiplier for T_fn" - typedef ^ OtherStateType ReKi sigma1c {:}{:} - - "multiplier for T_fc" - @@ -151,12 +152,14 @@ typedef ^ OtherStateType UA_Continuo # e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc. typedef ^ MiscVarType Logical FirstWarn_M - - - "flag so Mach number warning doesn't get repeated forever" - typedef ^ MiscVarType Logical FirstWarn_UA - - - "flag so UA state warning doesn't get repeated forever" - +typedef ^ MiscVarType Logical FirstWarn_UA_off - - - "flag so UA state warning doesn't get repeated forever" - # these COULD be OtherStates or just scalar local variables (they are calcaulted/used in UpdateDiscState and written to WriteOutput in CalcOutput) typedef ^ MiscVarType LOGICAL TESF {:}{:} - - "logical flag indicating if trailing edge separation is possible" - typedef ^ MiscVarType LOGICAL LESF {:}{:} - - "logical flag indicating if leading edge separation is possible" - typedef ^ MiscVarType LOGICAL VRTX {:}{:} - - "logical flag indicating if a vortex is being processed" - typedef ^ MiscVarType ReKi T_Sh {:}{:} - - "shedding frequency" - typedef ^ MiscVarType LOGICAL BEDSEP {:}{:} - - "logical flag indicating if this is undergoing separated flow (for compison with AD14)" - +typedef ^ MiscVarType ReKi weight {:}{:} - - "value between 0 and 1 indicating if UA is on (1) or off (0) or somewhere in between" - # ..... Parameters ................................................................................................................ @@ -168,13 +171,13 @@ typedef ^ ^ INTEGER typedef ^ ^ INTEGER UAMod - - - "Model for the dynamic stall equations [1 = Leishman/Beddoes, 2 = Gonzalez, 3 = Minnema]" - typedef ^ ^ LOGICAL Flookup - - - "Use table lookup for f' and f'' " - typedef ^ ^ ReKi a_s - - - "speed of sound" m/s -typedef ^ ^ INTEGER NumOuts - - - "Number of outputs" - +typedef ^ ^ INTEGER NumOuts - 0 - "Number of outputs" - typedef ^ ^ INTEGER OutSwtch - - - "Output requested channels to: [1=Unsteady.out 2=GlueCode.out 3=both files]" - typedef ^ ^ CHARACTER(20) OutFmt - - - "Output format for numerical results" - typedef ^ ^ CHARACTER(20) OutSFmt - - - "Output format for header strings" - typedef ^ ^ CHARACTER(1) Delim - - - "Delimiter string for outputs, defaults to tab-delimiters" - -typedef ^ ^ INTEGER UnOutFile - - - "File unit for the UnsteadyAero outputs" - -typedef ^ ^ Logical ShedEffect - .True. - "Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods)" - +typedef ^ ^ INTEGER UnOutFile - 0 - "File unit for the UnsteadyAero outputs" - +typedef ^ ^ Logical ShedEffect - - - "Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods)" - typedef ^ ParameterType IntKi lin_nx - 0 - "Number of continuous states for linearization" - # ..... Inputs .................................................................................................................... diff --git a/modules/aerodyn/src/UnsteadyAero_Types.f90 b/modules/aerodyn/src/UnsteadyAero_Types.f90 index cd19e10c4a..a4f5a156b7 100644 --- a/modules/aerodyn/src/UnsteadyAero_Types.f90 +++ b/modules/aerodyn/src/UnsteadyAero_Types.f90 @@ -44,7 +44,7 @@ MODULE UnsteadyAero_Types INTEGER(IntKi) :: UAMod !< Model for the dynamic stall equations [1 = Leishman/Beddoes, 2 = Gonzalez, 3 = Minnema] [-] REAL(ReKi) :: a_s !< speed of sound [m/s] LOGICAL :: Flookup !< Use table lookup for f' and f'' [-] - INTEGER(IntKi) :: NumOuts !< The number of outputs for this module as requested in the input file [-] + LOGICAL :: ShedEffect = .True. !< Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods) [-] END TYPE UA_InitInputType ! ======================= ! ========= UA_InitOutputType ======= @@ -160,6 +160,7 @@ MODULE UnsteadyAero_Types ! ======================= ! ========= UA_OtherStateType ======= TYPE, PUBLIC :: UA_OtherStateType + LOGICAL , DIMENSION(:,:), ALLOCATABLE :: UA_off_forGood !< logical flag indicating if UA is off for good [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: FirstPass !< logical flag indicating if this is the first time step [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: sigma1 !< multiplier for T_fn [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: sigma1c !< multiplier for T_fc [-] @@ -173,11 +174,13 @@ MODULE UnsteadyAero_Types TYPE, PUBLIC :: UA_MiscVarType LOGICAL :: FirstWarn_M !< flag so Mach number warning doesn't get repeated forever [-] LOGICAL :: FirstWarn_UA !< flag so UA state warning doesn't get repeated forever [-] + LOGICAL :: FirstWarn_UA_off !< flag so UA state warning doesn't get repeated forever [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: TESF !< logical flag indicating if trailing edge separation is possible [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: LESF !< logical flag indicating if leading edge separation is possible [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: VRTX !< logical flag indicating if a vortex is being processed [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: T_Sh !< shedding frequency [-] LOGICAL , DIMENSION(:,:), ALLOCATABLE :: BEDSEP !< logical flag indicating if this is undergoing separated flow (for compison with AD14) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: weight !< value between 0 and 1 indicating if UA is on (1) or off (0) or somewhere in between [-] END TYPE UA_MiscVarType ! ======================= ! ========= UA_ParameterType ======= @@ -189,13 +192,13 @@ MODULE UnsteadyAero_Types INTEGER(IntKi) :: UAMod !< Model for the dynamic stall equations [1 = Leishman/Beddoes, 2 = Gonzalez, 3 = Minnema] [-] LOGICAL :: Flookup !< Use table lookup for f' and f'' [-] REAL(ReKi) :: a_s !< speed of sound [m/s] - INTEGER(IntKi) :: NumOuts !< Number of outputs [-] + INTEGER(IntKi) :: NumOuts = 0 !< Number of outputs [-] INTEGER(IntKi) :: OutSwtch !< Output requested channels to: [1=Unsteady.out 2=GlueCode.out 3=both files] [-] CHARACTER(20) :: OutFmt !< Output format for numerical results [-] CHARACTER(20) :: OutSFmt !< Output format for header strings [-] CHARACTER(1) :: Delim !< Delimiter string for outputs, defaults to tab-delimiters [-] - INTEGER(IntKi) :: UnOutFile !< File unit for the UnsteadyAero outputs [-] - LOGICAL :: ShedEffect = .True. !< Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods) [-] + INTEGER(IntKi) :: UnOutFile = 0 !< File unit for the UnsteadyAero outputs [-] + LOGICAL :: ShedEffect !< Include the effect of shed vorticity. If False, the input alpha is assumed to already contain this effect (e.g. vortex methods) [-] INTEGER(IntKi) :: lin_nx = 0 !< Number of continuous states for linearization [-] END TYPE UA_ParameterType ! ======================= @@ -257,7 +260,7 @@ SUBROUTINE UA_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrSt DstInitInputData%UAMod = SrcInitInputData%UAMod DstInitInputData%a_s = SrcInitInputData%a_s DstInitInputData%Flookup = SrcInitInputData%Flookup - DstInitInputData%NumOuts = SrcInitInputData%NumOuts + DstInitInputData%ShedEffect = SrcInitInputData%ShedEffect END SUBROUTINE UA_CopyInitInput SUBROUTINE UA_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) @@ -321,7 +324,7 @@ SUBROUTINE UA_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Int_BufSz = Int_BufSz + 1 ! UAMod Re_BufSz = Re_BufSz + 1 ! a_s Int_BufSz = Int_BufSz + 1 ! Flookup - Int_BufSz = Int_BufSz + 1 ! NumOuts + Int_BufSz = Int_BufSz + 1 ! ShedEffect IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -385,7 +388,7 @@ SUBROUTINE UA_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_Xferred = Re_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%Flookup, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumOuts + IntKiBuf(Int_Xferred) = TRANSFER(InData%ShedEffect, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 END SUBROUTINE UA_PackInitInput @@ -456,7 +459,7 @@ SUBROUTINE UA_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = Re_Xferred + 1 OutData%Flookup = TRANSFER(IntKiBuf(Int_Xferred), OutData%Flookup) Int_Xferred = Int_Xferred + 1 - OutData%NumOuts = IntKiBuf(Int_Xferred) + OutData%ShedEffect = TRANSFER(IntKiBuf(Int_Xferred), OutData%ShedEffect) Int_Xferred = Int_Xferred + 1 END SUBROUTINE UA_UnPackInitInput @@ -3959,6 +3962,20 @@ SUBROUTINE UA_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, Er ! ErrStat = ErrID_None ErrMsg = "" +IF (ALLOCATED(SrcOtherStateData%UA_off_forGood)) THEN + i1_l = LBOUND(SrcOtherStateData%UA_off_forGood,1) + i1_u = UBOUND(SrcOtherStateData%UA_off_forGood,1) + i2_l = LBOUND(SrcOtherStateData%UA_off_forGood,2) + i2_u = UBOUND(SrcOtherStateData%UA_off_forGood,2) + IF (.NOT. ALLOCATED(DstOtherStateData%UA_off_forGood)) THEN + ALLOCATE(DstOtherStateData%UA_off_forGood(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%UA_off_forGood.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOtherStateData%UA_off_forGood = SrcOtherStateData%UA_off_forGood +ENDIF IF (ALLOCATED(SrcOtherStateData%FirstPass)) THEN i1_l = LBOUND(SrcOtherStateData%FirstPass,1) i1_u = UBOUND(SrcOtherStateData%FirstPass,1) @@ -4059,6 +4076,9 @@ SUBROUTINE UA_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" +IF (ALLOCATED(OtherStateData%UA_off_forGood)) THEN + DEALLOCATE(OtherStateData%UA_off_forGood) +ENDIF IF (ALLOCATED(OtherStateData%FirstPass)) THEN DEALLOCATE(OtherStateData%FirstPass) ENDIF @@ -4117,6 +4137,11 @@ SUBROUTINE UA_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! UA_off_forGood allocated yes/no + IF ( ALLOCATED(InData%UA_off_forGood) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! UA_off_forGood upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%UA_off_forGood) ! UA_off_forGood + END IF Int_BufSz = Int_BufSz + 1 ! FirstPass allocated yes/no IF ( ALLOCATED(InData%FirstPass) ) THEN Int_BufSz = Int_BufSz + 2*2 ! FirstPass upper/lower bounds for each dimension @@ -4194,6 +4219,26 @@ SUBROUTINE UA_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Db_Xferred = 1 Int_Xferred = 1 + IF ( .NOT. ALLOCATED(InData%UA_off_forGood) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_off_forGood,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_off_forGood,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%UA_off_forGood,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%UA_off_forGood,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%UA_off_forGood,2), UBOUND(InData%UA_off_forGood,2) + DO i1 = LBOUND(InData%UA_off_forGood,1), UBOUND(InData%UA_off_forGood,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%UA_off_forGood(i1,i2), IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF IF ( .NOT. ALLOCATED(InData%FirstPass) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -4374,6 +4419,29 @@ SUBROUTINE UA_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! UA_off_forGood not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%UA_off_forGood)) DEALLOCATE(OutData%UA_off_forGood) + ALLOCATE(OutData%UA_off_forGood(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%UA_off_forGood.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%UA_off_forGood,2), UBOUND(OutData%UA_off_forGood,2) + DO i1 = LBOUND(OutData%UA_off_forGood,1), UBOUND(OutData%UA_off_forGood,1) + OutData%UA_off_forGood(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%UA_off_forGood(i1,i2)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! FirstPass not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -4576,6 +4644,7 @@ SUBROUTINE UA_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) ErrMsg = "" DstMiscData%FirstWarn_M = SrcMiscData%FirstWarn_M DstMiscData%FirstWarn_UA = SrcMiscData%FirstWarn_UA + DstMiscData%FirstWarn_UA_off = SrcMiscData%FirstWarn_UA_off IF (ALLOCATED(SrcMiscData%TESF)) THEN i1_l = LBOUND(SrcMiscData%TESF,1) i1_u = UBOUND(SrcMiscData%TESF,1) @@ -4645,6 +4714,20 @@ SUBROUTINE UA_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) END IF END IF DstMiscData%BEDSEP = SrcMiscData%BEDSEP +ENDIF +IF (ALLOCATED(SrcMiscData%weight)) THEN + i1_l = LBOUND(SrcMiscData%weight,1) + i1_u = UBOUND(SrcMiscData%weight,1) + i2_l = LBOUND(SrcMiscData%weight,2) + i2_u = UBOUND(SrcMiscData%weight,2) + IF (.NOT. ALLOCATED(DstMiscData%weight)) THEN + ALLOCATE(DstMiscData%weight(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%weight.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%weight = SrcMiscData%weight ENDIF END SUBROUTINE UA_CopyMisc @@ -4671,6 +4754,9 @@ SUBROUTINE UA_DestroyMisc( MiscData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(MiscData%BEDSEP)) THEN DEALLOCATE(MiscData%BEDSEP) +ENDIF +IF (ALLOCATED(MiscData%weight)) THEN + DEALLOCATE(MiscData%weight) ENDIF END SUBROUTINE UA_DestroyMisc @@ -4711,6 +4797,7 @@ SUBROUTINE UA_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Int_BufSz = 0 Int_BufSz = Int_BufSz + 1 ! FirstWarn_M Int_BufSz = Int_BufSz + 1 ! FirstWarn_UA + Int_BufSz = Int_BufSz + 1 ! FirstWarn_UA_off Int_BufSz = Int_BufSz + 1 ! TESF allocated yes/no IF ( ALLOCATED(InData%TESF) ) THEN Int_BufSz = Int_BufSz + 2*2 ! TESF upper/lower bounds for each dimension @@ -4736,6 +4823,11 @@ SUBROUTINE UA_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Int_BufSz = Int_BufSz + 2*2 ! BEDSEP upper/lower bounds for each dimension Int_BufSz = Int_BufSz + SIZE(InData%BEDSEP) ! BEDSEP END IF + Int_BufSz = Int_BufSz + 1 ! weight allocated yes/no + IF ( ALLOCATED(InData%weight) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! weight upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%weight) ! weight + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4767,6 +4859,8 @@ SUBROUTINE UA_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%FirstWarn_UA, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FirstWarn_UA_off, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 IF ( .NOT. ALLOCATED(InData%TESF) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -4867,6 +4961,26 @@ SUBROUTINE UA_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Siz END DO END DO END IF + IF ( .NOT. ALLOCATED(InData%weight) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%weight,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%weight,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%weight,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%weight,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%weight,2), UBOUND(InData%weight,2) + DO i1 = LBOUND(InData%weight,1), UBOUND(InData%weight,1) + ReKiBuf(Re_Xferred) = InData%weight(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE UA_PackMisc SUBROUTINE UA_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -4901,6 +5015,8 @@ SUBROUTINE UA_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) Int_Xferred = Int_Xferred + 1 OutData%FirstWarn_UA = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn_UA) Int_Xferred = Int_Xferred + 1 + OutData%FirstWarn_UA_off = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn_UA_off) + Int_Xferred = Int_Xferred + 1 IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TESF not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -5016,6 +5132,29 @@ SUBROUTINE UA_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) END DO END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! weight not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%weight)) DEALLOCATE(OutData%weight) + ALLOCATE(OutData%weight(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%weight.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%weight,2), UBOUND(OutData%weight,2) + DO i1 = LBOUND(OutData%weight,1), UBOUND(OutData%weight,1) + OutData%weight(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE UA_UnPackMisc SUBROUTINE UA_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/aerodyn14/src/AeroDyn14.f90 b/modules/aerodyn14/src/AeroDyn14.f90 index b608cef645..93ec5ebbb5 100644 --- a/modules/aerodyn14/src/AeroDyn14.f90 +++ b/modules/aerodyn14/src/AeroDyn14.f90 @@ -107,6 +107,8 @@ SUBROUTINE AD14_Init( InitInp, u, p, x, xd, z, O, y, m, Interval, InitOut, ErrSt ! Display the module information CALL DispNVD( AD14_Ver ) + + CALL ProgWarn( ' AeroDyn 14 is deprecated and will be removed in a future release.' ) InitOut%Ver = AD14_Ver m%FirstWarn = .TRUE. diff --git a/cmake/FindYAMLCPP.cmake b/modules/awae/CMakeLists.txt similarity index 52% rename from cmake/FindYAMLCPP.cmake rename to modules/awae/CMakeLists.txt index a3557319e3..941c0c97da 100644 --- a/cmake/FindYAMLCPP.cmake +++ b/modules/awae/CMakeLists.txt @@ -1,4 +1,6 @@ # +# Copyright 2016 National Renewable Energy Laboratory +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -11,17 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # +if (GENERATE_TYPES) + generate_f90_types(src/AWAE_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/AWAE_Types.f90 -noextrap) +endif() -find_path(YAML_INCLUDES - yaml-cpp/yaml.h - HINTS ${YAML_ROOT} ${CMAKE_INSTALL_PREFIX} - PATH_SUFFIXES include) +set(AWAE_LIBS_SOURCES + src/AWAE.f90 + src/AWAE_IO.f90 + src/AWAE_Types.f90 + ) -find_library(YAML_LIBRARIES - NAMES yaml-cpp libyaml-cpp.a - HINTS ${YAML_ROOT} ${CMAKE_INSTALL_PREFIX} - PATH_SUFFIXES lib) +add_library(awaelib ${AWAE_LIBS_SOURCES}) +target_link_libraries(awaelib ifwlib nwtclibs) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(YAMLCPP DEFAULT_MSG YAML_INCLUDES YAML_LIBRARIES) -mark_as_advanced(YAML_INCLUDES YAML_LIBRARIES) +install(TARGETS awaelib + EXPORT "${CMAKE_PROJECT_NAME}Libraries" + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/modules/awae/src/AWAE.f90 b/modules/awae/src/AWAE.f90 new file mode 100644 index 0000000000..bbfbf33e65 --- /dev/null +++ b/modules/awae/src/AWAE.f90 @@ -0,0 +1,1816 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2015-2016 National Renewable Energy Laboratory +! +! This file is part of Ambient Wind and Array Effects model for FAST.Farm. +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +! File last committed: $Date$ +! (File) Revision #: $Rev$ +! URL: $HeadURL$ +!********************************************************************************************************************************** +!> AWAE is a time-domain module for modeling Ambient Wind and Array Effects of one or more horizontal-axis wind turbines. +module AWAE + + use NWTC_Library + use AWAE_Types + use AWAE_IO + use InflowWind_Types + use InflowWind + +#ifdef _OPENMP + use OMP_LIB +#endif + + implicit none + + private + + + ! ..... Public Subroutines ................................................................................................... + + public :: AWAE_Init ! Initialization routine + public :: AWAE_End ! Ending routine (includes clean up) + public :: AWAE_UpdateStates ! Loose coupling routine for solving for constraint states, integrating + ! continuous states, and updating discrete states + public :: AWAE_CalcOutput ! Routine for computing outputs + public :: AWAE_CalcConstrStateResidual ! Tight coupling routine for returning the constraint state residual + + + ! Unit testing routines + public :: AWAE_TEST_Init_BadData + public :: AWAE_TEST_Init_GoodData + public :: AWAE_TEST_CalcOutput + + + contains + + +subroutine ExtractSlice( sliceType, s, s0, szs, sz1, sz2, ds, V, slice) + + integer(IntKi), intent(in ) :: sliceType !< Type of slice: XYSlice, YZSlice, XZSlice + real(ReKi), intent(in ) :: s !< data value in meters of the interpolatan + real(ReKi), intent(in ) :: s0 !< origin value in meters of the interpolatan + integer(IntKi), intent(in ) :: szs + integer(IntKi), intent(in ) :: sz1 !< 1st dimension of slice + integer(IntKi), intent(in ) :: sz2 !< 2nd dimension of slice + real(ReKi), intent(in ) :: ds + real(SiKi), intent(in ) :: V(:,0:,0:,0:) + real(SiKi), intent(inout) :: slice(:,0:,0:) + + integer(IntKi) :: s_grid0,s_grid1,i,j + real(SiKi) :: s_grid, sd + + + ! s is in meters but all the s_grid variables are in the grid units so that we can index into the grid arrays properly + ! NOTE: The grid coordinates run from 0 to sz-1 + + s_grid = real((s-s0)/ds,SiKi) + + ! Lower bounds of grid cell in interpolation direction + s_grid0 = floor(s_grid) + + ! Upper bounds of grid cell in interpolation direction + s_grid1 = s_grid0 + 1 + + ! fractional distance of requested slice from lower cell bounds in the range [0-1] + sd = (s_grid-real(s_grid0,SiKi)) + + if (s_grid0 == (szs-1)) s_grid1 = s_grid0 ! Handle case where s0 is the last index in the grid, in this case sd = 0.0, so the 2nd term in the interpolation will not contribute + + do j = 0,sz2-1 + do i = 0,sz1-1 + select case (sliceType) + case (XYSlice) + slice(:,i,j) = V(:,i,j,s_grid0)*(1.0_SiKi-sd) + V(:,i,j,s_grid1)*sd + case (YZSlice) + slice(:,i,j) = V(:,s_grid0,i,j)*(1.0_SiKi-sd) + V(:,s_grid1,i,j)*sd + case (XZSlice) + slice(:,i,j) = V(:,i,s_grid0,j)*(1.0_SiKi-sd) + V(:,i,s_grid1,j)*sd + end select + end do + end do + +end subroutine ExtractSlice +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine +!! +subroutine ComputeLocals(n, u, p, y, m, errStat, errMsg) + integer(IntKi), intent(in ) :: n !< Current simulation time increment (zero-based) + type(AWAE_InputType), intent(in ) :: u !< Inputs at Time t + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_OutputType), intent(inout) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + integer(IntKi) :: nt, np, maxPln + real(ReKi) :: cosTerm, sinTerm, dp(3), rmax + + errStat = 0 + errMsg = "" + maxPln = min(n,p%NumPlanes-2) + rmax = p%r(p%NumRadii-1) + do nt = 1,p%NumTurbines + do np = 0, maxPln + cosTerm = dot_product(u%xhat_plane(:,np+1,nt),u%xhat_plane(:,np,nt)) + if (EqualRealNos(cosTerm, 1.0_ReKi)) then + sinTerm = 0.0_ReKi + else + sinTerm = sqrt(1.0_ReKi - cosTerm**2) + end if + + dp = u%p_plane(:,np+1,nt) - u%p_plane(:,np,nt) + m%r_e(np,nt) = abs( dot_product( u%xhat_plane(:,np ,nt), dp ) ) + m%r_s(np,nt) = abs( dot_product( u%xhat_plane(:,np+1,nt), dp ) ) + + if ( sinTerm > ( max( m%r_e(np,nt), m%r_s(np,nt) ) / ( 100.0_ReKi*rmax ) ) ) then + m%parallelFlag(np,nt) = .false. + m%r_e(np,nt) = m%r_e(np,nt) / sinTerm + m%r_s(np,nt) = m%r_s(np,nt) / sinTerm + m%rhat_s(:,np,nt) = (u%xhat_plane(:,np,nt)*cosTerm - u%xhat_plane(:,np+1,nt) ) / sinTerm + m%rhat_e(:,np,nt) = (u%xhat_plane(:,np,nt) - u%xhat_plane(:,np+1,nt)*cosTerm) / sinTerm + m%pvec_cs(:,np,nt) = u%p_plane(:,np ,nt) - m%r_s(np,nt)*m%rhat_s(:,np,nt) + m%pvec_ce(:,np,nt) = u%p_plane(:,np+1,nt) - m%r_e(np,nt)*m%rhat_e(:,np,nt) + else + m%parallelFlag(np,nt) = .true. + end if + + end do + + end do + + +end subroutine ComputeLocals +!---------------------------------------------------------------------------------------------------------------------------------- +!> This function calculates jinc(x) = J_1(2*Pi*x)/x +real(ReKi) function jinc ( x ) + + real(ReKi), intent(in ) :: x + + if ( EqualRealNos(x,0.0_ReKi) ) then + jinc = Pi + else + jinc = BESSEL_JN( 1, TwoPi*x )/x + end if + +end function jinc +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine +!! +subroutine LowResGridCalcOutput(n, u, p, y, m, errStat, errMsg) + integer(IntKi), intent(in ) :: n !< Current simulation time increment (zero-based) + type(AWAE_InputType), intent(in ) :: u !< Inputs at Time t + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_OutputType), intent(inout) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + integer(IntKi) :: nx, ny, nz, nt, np, nw, nx_low, ny_low, nz_low, nr, npsi, wamb, iwsum !< loop counters + integer(IntKi) :: nXYZ_low, n_wake, n_r_polar, n_psi_polar !< accumulating counters + real(ReKi) :: xhatBar_plane(3) !< + real(ReKi) :: x_end_plane + real(ReKi) :: x_start_plane + real(ReKi) :: r_vec_plane(3) + real(ReKi) :: tmp_xhatBar_plane + real(ReKi) :: r_tmp_plane + real(ReKi) :: Vx_wake_tmp + real(ReKi) :: Vr_wake_tmp(3) + real(ReKi) :: Vr_term(3) + real(ReKi) :: Vx_term + real(ReKi) :: Vsum_low(3) + real(ReKi) :: p_tmp_plane(3) + real(ReKi) :: tmp_vec(3) + real(ReKi) :: Vave_amb_low_norm, Vamb_lowpol_tmp(3), Vdist_lowpol_tmp(3), Vamb_low_tmp(3,8) + real(ReKi) :: delta, deltad + real(ReKi) :: wsum_tmp, w + real(ReKi) :: tmp_x,tmp_y,tmp_z !, tm1, tm2 + real(ReKi) :: xxplane(3), xyplane(3), yyplane(3), yxplane(3), psi_polar, r_polar, p_polar(3) + real(ReKi) :: yzplane_Y(3), xyplane_norm + real(ReKi) :: xplane_sq, yplane_sq, xysq_Z(3), xzplane_X(3), tmp_yhat_plane(3), tmp_zhat_plane(3) + real(ReKi), ALLOCATABLE :: tmp_rhat_plane(:,:), tmp_xhat_plane(:,:) + real(ReKi), ALLOCATABLE :: tmp_Vx_wake(:), tmp_Vr_wake(:) + integer(IntKi) :: ILo + integer(IntKi) :: maxPln, tmpPln, maxN_wake + integer(IntKi) :: i,np1,errStat2 + character(*), parameter :: RoutineName = 'LowResGridCalcOutput' + logical :: within + + errStat = ErrID_None + errMsg = "" + + maxPln = min(n,p%NumPlanes-2) + tmpPln = min(p%NumPlanes-1, n+1) + + + +!#ifdef _OPENMP +! tm1 = omp_get_wtime() +!#endif + + maxN_wake = p%NumTurbines*( p%NumPlanes-1 ) + ! Temporary variables needed by OpenMP + allocate ( tmp_xhat_plane ( 3, 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for tmp_xhat_plane.', errStat, errMsg, RoutineName ) + allocate ( tmp_rhat_plane ( 3, 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for tmp_rhat_plane.', errStat, errMsg, RoutineName ) + allocate ( tmp_Vx_wake ( 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for tmp_Vx_wake.', errStat, errMsg, RoutineName ) + allocate ( tmp_Vr_wake ( 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for tmp_Vr_wake.', errStat, errMsg, RoutineName ) + if (ErrStat >= AbortErrLev) return + + + ! Loop over the entire grid of low resolution ambient wind data to compute: + ! 1) the disturbed flow at each point and 2) the averaged disturbed velocity of each wake plane + + !$OMP PARALLEL DO PRIVATE(nx_low,ny_low,nz_low, nXYZ_low, n_wake, xhatBar_plane, x_end_plane,nt,np,ILo,x_start_plane,delta,deltad,p_tmp_plane,tmp_vec,r_vec_plane,r_tmp_plane,tmp_xhatBar_plane, Vx_wake_tmp,Vr_wake_tmp,nw,Vr_term,Vx_term,tmp_x,tmp_y,tmp_z,tmp_xhat_plane,tmp_rhat_plane,tmp_Vx_wake,tmp_Vr_wake,i,np1,errStat2) SHARED(m,u,p,maxPln,errStat,errMsg) DEFAULT(NONE) + !do nz_low=0, p%nZ_low-1 + ! do ny_low=0, p%yZ_low-1 + ! do nx_low=0, p%nX_low-1 + ! nXYZ_low=0 + do i = 0 , p%NumGrid_low - 1 + + nx_low = mod( i ,p%nX_low) + ny_low = mod(int( i / (p%nX_low ) ),p%nY_low) + nz_low = int( i / (p%nX_low*p%nY_low) ) + + ! set the disturbed flow equal to the ambient flow for this time step + m%Vdist_low(:,nx_low,ny_low,nz_low) = m%Vamb_low(:,nx_low,ny_low,nz_low) + + !nXYZ_low = nXYZ_low + 1 + nXYZ_low = i + 1 + n_wake = 0 + xhatBar_plane = 0.0_ReKi + + do nt = 1,p%NumTurbines + + ! H Long: replace intrinsic dot_product with explicit do product can save as much as 10% of total calculation time! + !x_end_plane = dot_product(u%xhat_plane(:,0,nt), (p%Grid_Low(:,nXYZ_low) - u%p_plane(:,0,nt)) ) + tmp_x = u%xhat_plane(1,0,nt) * (p%Grid_Low(1,nXYZ_low) - u%p_plane(1,0,nt)) + tmp_y = u%xhat_plane(2,0,nt) * (p%Grid_Low(2,nXYZ_low) - u%p_plane(2,0,nt)) + tmp_z = u%xhat_plane(3,0,nt) * (p%Grid_Low(3,nXYZ_low) - u%p_plane(3,0,nt)) + x_end_plane = tmp_x + tmp_y + tmp_z + + do np = 0, maxPln + ! Reset interpolation counter + ILo = 0 + np1 = np + 1 + ! Construct the endcaps of the current wake plane volume + x_start_plane = x_end_plane + ! H Long: again, replace intrinsic dot_product + !x_end_plane = dot_product(u%xhat_plane(:,np+1,nt), (p%Grid_Low(:,nXYZ_low) - u%p_plane(:,np+1,nt)) ) + tmp_x = u%xhat_plane(1,np1,nt) * (p%Grid_Low(1,nXYZ_low) - u%p_plane(1,np1,nt)) + tmp_y = u%xhat_plane(2,np1,nt) * (p%Grid_Low(2,nXYZ_low) - u%p_plane(2,np1,nt)) + tmp_z = u%xhat_plane(3,np1,nt) * (p%Grid_Low(3,nXYZ_low) - u%p_plane(3,np1,nt)) + + + x_end_plane = tmp_x + tmp_y + tmp_z + + ! test if the point is within the endcaps of the wake volume + + if ( ( ( x_start_plane >= 0.0_ReKi ) .and. ( x_end_plane < 0.0_ReKi ) ) .or. & + ( ( x_start_plane <= 0.0_ReKi ) .and. ( x_end_plane > 0.0_ReKi ) ) ) then + + if ( EqualRealNos( x_start_plane, x_end_plane ) ) then + delta = 0.5_ReKi + else + delta = x_start_plane / ( x_start_plane - x_end_plane ) + end if + deltad = (1.0_ReKi - delta) + if ( m%parallelFlag(np,nt) ) then + p_tmp_plane = delta*u%p_plane(:,np1,nt) + deltad*u%p_plane(:,np,nt) + else + tmp_vec = delta*m%rhat_e(:,np,nt) + deltad*m%rhat_s(:,np,nt) + p_tmp_plane = delta*m%pvec_ce(:,np,nt) + deltad*m%pvec_cs(:,np,nt) + ( delta*m%r_e(np,nt) + deltad*m%r_s(np,nt) )* tmp_vec / TwoNorm(tmp_vec) + end if + + + + r_vec_plane = p%Grid_Low(:,nXYZ_low) - p_tmp_plane + r_tmp_plane = TwoNorm( r_vec_plane ) + + ! test if the point is within radial finite-difference grid + if ( r_tmp_plane <= p%r(p%numRadii-1) ) then + + n_wake = n_wake + 1 + + + if ( EqualRealNos(r_tmp_plane, 0.0_ReKi) ) then + tmp_rhat_plane(:,n_wake) = 0.0_ReKi + else + tmp_rhat_plane(:,n_wake) = ( r_vec_plane ) / r_tmp_plane + end if + + + ! given r_tmp_plane and Vx_wake at p%dr increments, find value of m%Vx_wake(@r_tmp_plane) using interpolation + tmp_Vx_wake(n_wake) = delta*InterpBin( r_tmp_plane, p%r, u%Vx_wake(:,np1,nt), ILo, p%NumRadii ) + deltad*InterpBin( r_tmp_plane, p%r, u%Vx_wake(:,np,nt), ILo, p%NumRadii ) !( XVal, XAry, YAry, ILo, AryLen ) + tmp_Vr_wake(n_wake) = delta*InterpBin( r_tmp_plane, p%r, u%Vr_wake(:,np1,nt), ILo, p%NumRadii ) + deltad*InterpBin( r_tmp_plane, p%r, u%Vr_wake(:,np,nt), ILo, p%NumRadii ) !( XVal, XAry, YAry, ILo, AryLen ) + + + tmp_xhat_plane(:,n_wake) = delta*u%xhat_plane(:,np1,nt) + deltad*u%xhat_plane(:,np,nt) + tmp_xhat_plane(:,n_wake) = tmp_xhat_plane(:,n_wake) / TwoNorm(tmp_xhat_plane(:,n_wake)) + xhatBar_plane = xhatBar_plane + abs(tmp_Vx_wake(n_wake))*tmp_xhat_plane(:,n_wake) + end if ! if the point is within radial finite-difference grid + end if + end do ! do np = 0, p%NumPlanes-2 + end do ! do nt = 1,p%NumTurbines + + if (n_wake > 0) then + tmp_xhatBar_plane = TwoNorm(xhatBar_plane) + if ( EqualRealNos(tmp_xhatBar_plane, 0.0_ReKi) ) then + xhatBar_plane = 0.0_ReKi + else + xhatBar_plane = xhatBar_plane / tmp_xhatBar_plane + end if + + Vx_wake_tmp = 0.0_ReKi + Vr_wake_tmp = 0.0_ReKi + do nw = 1,n_wake + Vr_term = tmp_Vx_wake(nw)*tmp_xhat_plane(:,nw) + tmp_Vr_wake(nw)*tmp_rhat_plane(:,nw) + Vx_term = dot_product( xhatBar_plane, Vr_term ) + Vx_wake_tmp = Vx_wake_tmp + Vx_term*Vx_term + Vr_wake_tmp = Vr_wake_tmp + Vr_term + end do + ! [I - XX']V = V - (V dot X)X + Vr_wake_tmp = Vr_wake_tmp - dot_product(Vr_wake_tmp,xhatBar_plane)*xhatBar_plane + m%Vdist_low(:,nx_low,ny_low,nz_low) = m%Vdist_low(:,nx_low,ny_low,nz_low) + real(Vr_wake_tmp - xhatBar_plane*sqrt(Vx_wake_tmp),SiKi) + end if ! (n_wake > 0) + end do + ! end do ! do nx_low=0, p%nX_low-1 + ! end do ! do ny_low=0, p%nY_low-1 + !end do ! do nz_low=0, p%nZ_low-1 + !$OMP END PARALLEL DO + + do nt = 1,p%NumTurbines + + do np = 0,tmpPln + + !!Defining yhat and zhat + xxplane = (/u%xhat_plane(1,np,nt), 0.0_ReKi, 0.0_ReKi/) + xyplane = (/0.0_ReKi, u%xhat_plane(1,np,nt), 0.0_ReKi/) + yyplane = (/0.0_ReKi, u%xhat_plane(2,np,nt), 0.0_ReKi/) + yxplane = (/u%xhat_plane(2,np,nt), 0.0_ReKi, 0.0_ReKi/) + xyplane_norm = TwoNorm(xxplane+yyplane) + + IF (EqualRealNos(xyplane_norm, 0.0_ReKi)) THEN ! This should only be true during the first call to AWAE_CalcOutput at model initialization + + y%Vx_wind_disk(nt) = 0.0_ReKi + y%TI_amb( nt) = 0.0_ReKi + y%V_plane(:,np,nt) = 0.0_ReKi + + ELSE ! All subsequent calls to AWAE_CalcOutput + + + ! Warn our kind users if wake planes leave the low-resolution domain: + if ( u%p_plane(1,np,nt) < p%Grid_Low(1, 1) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the lowest-most X boundary of the low-resolution domain.', errStat, errMsg, RoutineName) + if ( u%p_plane(1,np,nt) > p%Grid_Low(1,p%NumGrid_low) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the upper-most X boundary of the low-resolution domain.' , errStat, errMsg, RoutineName) + if ( u%p_plane(2,np,nt) < p%Grid_Low(2, 1) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the lowest-most Y boundary of the low-resolution domain.', errStat, errMsg, RoutineName) + if ( u%p_plane(2,np,nt) > p%Grid_Low(2,p%NumGrid_low) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the upper-most Y boundary of the low-resolution domain.' , errStat, errMsg, RoutineName) + if ( u%p_plane(3,np,nt) < p%Grid_Low(3, 1) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the lowest-most Z boundary of the low-resolution domain.', errStat, errMsg, RoutineName) + if ( u%p_plane(3,np,nt) > p%Grid_Low(3,p%NumGrid_low) ) call SetErrStat(ErrID_Warn, 'The center of wake plane #'//trim(num2lstr(np))//' for turbine #'//trim(num2lstr(nt))//' has passed the upper-most Z boundary of the low-resolution domain.' , errStat, errMsg, RoutineName) + + + xplane_sq = u%xhat_plane(1,np,nt)**2.0_ReKi + yplane_sq = u%xhat_plane(2,np,nt)**2.0_ReKi + xysq_Z = (/0.0_ReKi, 0.0_ReKi, xplane_sq+yplane_sq/) + xzplane_X = (/u%xhat_plane(1,np,nt)*u%xhat_plane(3,np,nt), 0.0_ReKi, 0.0_ReKi/) + yzplane_Y = (/0.0_ReKi, u%xhat_plane(2,np,nt)*u%xhat_plane(3,np,nt), 0.0_ReKi/) + tmp_yhat_plane = (xyplane-yxplane)/xyplane_norm + tmp_zhat_plane = (xysq_Z-xzplane_X-yzplane_Y)/xyplane_norm + + + ! Calculate y%Vx_wind_disk and y%TI_amb at the rotor disk + + if ( np == 0 ) then + + Vsum_low = 0.0_ReKi + iwsum = 0 + n_r_polar = FLOOR((p%C_Meander*u%D_wake(np,nt))/(2.0_ReKi*p%dpol)) + + do nr = 0,n_r_polar + + r_polar = REAL(nr,ReKi)*p%dpol + n_psi_polar = MAX(CEILING(TwoPi*REAL(nr,ReKi))-1,0) + + do npsi = 0,n_psi_polar + + psi_polar = (TwoPi*REAL(npsi,ReKi))/(REAL(n_psi_polar+1,ReKi)) + p_polar = u%p_plane(:,np,nt) + r_polar*COS(psi_polar)*tmp_yhat_plane + r_polar*SIN(psi_polar)*tmp_zhat_plane + Vamb_lowpol_tmp = INTERP3D( p_polar, p%Grid_Low(:,1), p%dXYZ_Low, m%Vamb_low, within, p%nX_low, p%nY_low, p%nZ_low, Vbox=Vamb_low_tmp ) + if ( within ) then + Vsum_low = Vsum_low + Vamb_lowpol_tmp + do i = 1,8 + iwsum = iwsum + 1 + m%Vamb_lowpol(:,iwsum) = Vamb_low_tmp(:,i) + end do + end if + + end do + + end do + + if ( iwsum == 0 ) then + + call SetErrStat( ErrID_Fatal, 'The rotor plane for turbine '//trim(num2lstr(nt))//' has left the low-resolution domain (i.e., there are no points in the polar grid that lie within the low-resolution domain).', errStat, errMsg, RoutineName ) + return + + else + + Vsum_low = Vsum_low/REAL(iwsum/8,ReKi) ! iwsum is always a multiple of 8 + Vave_amb_low_norm = TwoNorm(Vsum_low) + if ( EqualRealNos(Vave_amb_low_norm, 0.0_ReKi ) ) then + call SetErrStat( ErrID_Fatal, 'The magnitude of the spatial-averaged ambient wind speed in the low-resolution domain associated with the wake plane at the rotor disk for turbine #'//trim(num2lstr(nt))//' is zero.', errStat, errMsg, RoutineName ) + return + else + y%Vx_wind_disk(nt) = dot_product( u%xhat_plane(:,np,nt),Vsum_low ) + y%TI_amb(nt) = 0.0_ReKi + do wamb = 1, iwsum + y%TI_amb(nt) = y%TI_amb(nt)+TwoNorm(m%Vamb_lowpol(:,wamb)-Vsum_low)**2.0_ReKi + end do !wamb + y%TI_amb(nt) = sqrt(y%TI_amb(nt)/(3.0_ReKi*REAL(iwsum,ReKi)))/Vave_amb_low_norm + end if !Vave_amb_low_norm + + end if + + end if + + + ! Calculate y%V_plane + + y%V_plane(:,np,nt) = 0.0_ReKi + wsum_tmp = 0.0_ReKi + n_r_polar = FLOOR((p%C_ScaleDiam*u%D_wake(np,nt))/p%dpol) + + do nr = 0, n_r_polar + + r_polar = REAL(nr,ReKi)*p%dpol + + select case ( p%Mod_Meander ) + case (MeanderMod_Uniform) + w = 1.0_ReKi + case (MeanderMod_TruncJinc) + w = jinc( r_polar/(p%C_Meander*u%D_wake(np,nt) ) ) + case (MeanderMod_WndwdJinc) + w = jinc( r_polar/(p%C_Meander*u%D_wake(np,nt) ) )*jinc( r_polar/(2.0_ReKi*p%C_Meander*u%D_wake(np,nt) ) ) + end select + + n_psi_polar = MAX(CEILING(TwoPi*REAL(nr,ReKi))-1,0) + + do npsi = 0,n_psi_polar + + psi_polar = (TwoPi*REAL(npsi,ReKi))/(REAL(n_psi_polar+1,ReKi)) + p_polar = u%p_plane(:,np,nt) + r_polar*COS(psi_polar)*tmp_yhat_plane + r_polar*SIN(psi_polar)*tmp_zhat_plane + Vdist_lowpol_tmp = INTERP3D( p_polar, p%Grid_Low(:,1), p%dXYZ_Low, m%Vdist_low, within, p%nX_low, p%nY_low, p%nZ_low ) + if ( within ) then + y%V_plane(:,np,nt) = y%V_plane(:,np,nt) + w*Vdist_lowpol_tmp + wsum_tmp = wsum_tmp + w + end if + + end do !npsi + + end do!nr + + if ( wsum_tmp > 0.0_ReKi ) y%V_plane(:,np,nt) = y%V_plane(:,np,nt)/wsum_tmp + + end if + + end do + end do + +!#ifdef _OPENMP +! tm2 = omp_get_wtime() +! write(*,*) 'Total AWAE:LowResGridCalcOutput using '//trim(num2lstr(tm2-tm1))//' seconds' + +!#endif + + if (allocated(tmp_xhat_plane)) deallocate(tmp_xhat_plane) + if (allocated(tmp_rhat_plane)) deallocate(tmp_rhat_plane) + if (allocated(tmp_Vx_wake)) deallocate(tmp_Vx_wake) + if (allocated(tmp_Vr_wake)) deallocate(tmp_Vr_wake) + +end subroutine LowResGridCalcOutput + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine +!! +subroutine HighResGridCalcOutput(n, u, p, y, m, errStat, errMsg) + integer(IntKi), intent(in ) :: n !< Current high-res, simulation time increment (zero-based) + type(AWAE_InputType), intent(in ) :: u !< Inputs at Time t + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_OutputType), intent(inout) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + integer(IntKi) :: nx, ny, nz, nt, nt2, np, nw, nx_high, ny_high, nz_high, n_hl !< loop counters + integer(IntKi) :: nXYZ_high, n_wake !< accumulating counters + real(ReKi) :: xhatBar_plane(3) !< + real(ReKi) :: tmp_xhatBar_plane + real(ReKi) :: x_end_plane + real(ReKi) :: x_start_plane + real(ReKi) :: r_vec_plane(3) + real(ReKi) :: r_tmp_plane + real(ReKi) :: Vx_wake_tmp + real(ReKi) :: Vr_wake_tmp(3) + real(ReKi) :: Vr_term(3) + real(ReKi) :: Vx_term + real(ReKi) :: Vsum_low(3) + real(ReKi) :: p_tmp_plane(3) + real(ReKi) :: tmp_vec(3) + real(ReKi) :: delta, deltad + integer(IntKi) :: ILo + integer(IntKi) :: maxPln + integer(IntKi) :: n_high_low + character(*), parameter :: RoutineName = 'HighResGridCalcOutput' + errStat = ErrID_None + errMsg = "" + + + maxPln = min(n,p%NumPlanes-2) + + ! We only need one high res file for that last simulation time + if ( (n/p%n_high_low) == (p%NumDT-1) ) then + n_high_low = 0 + else + n_high_low = p%n_high_low + end if + + + ! Loop over the entire grid of low resolution ambient wind data to compute: + ! 1) the disturbed flow at each point and 2) the averaged disturbed velocity of each wake plane + + + do nt = 1,p%NumTurbines + nXYZ_high = 0 + + ! set the disturbed flow equal to the ambient flow for this time step + y%Vdist_high(nt)%data = m%Vamb_high(nt)%data + + do nz_high=0, p%nZ_high-1 + do ny_high=0, p%nY_high-1 + do nx_high=0, p%nX_high-1 + + nXYZ_high = nXYZ_high + 1 + n_wake = 0 + xhatBar_plane = 0.0_ReKi + + do nt2 = 1,p%NumTurbines + if (nt /= nt2) then + + x_end_plane = dot_product(u%xhat_plane(:,0,nt2), (p%Grid_high(:,nXYZ_high,nt) - u%p_plane(:,0,nt2)) ) + + do np = 0, maxPln !p%NumPlanes-2 + + ! Reset interpolation counter + ILo = 0 + + ! Construct the endcaps of the current wake plane volume + x_start_plane = x_end_plane + x_end_plane = dot_product(u%xhat_plane(:,np+1,nt2), (p%Grid_high(:,nXYZ_high,nt) - u%p_plane(:,np+1,nt2)) ) + + ! test if the point is within the endcaps of the wake volume + if ( ( ( x_start_plane >= 0.0_ReKi ) .and. ( x_end_plane < 0.0_ReKi ) ) .or. & + ( ( x_start_plane <= 0.0_ReKi ) .and. ( x_end_plane > 0.0_ReKi ) ) ) then + + if ( EqualRealNos( x_start_plane, x_end_plane ) ) then + delta = 0.5_ReKi + else + delta = x_start_plane / ( x_start_plane - x_end_plane ) + end if + deltad = (1.0_ReKi - delta) + if ( m%parallelFlag(np,nt2) ) then + p_tmp_plane = delta*u%p_plane(:,np+1,nt2) + deltad*u%p_plane(:,np,nt2) + else + tmp_vec = delta*m%rhat_e(:,np,nt2) + deltad*m%rhat_s(:,np,nt2) + p_tmp_plane = delta*m%pvec_ce(:,np,nt2) + deltad*m%pvec_cs(:,np,nt2) + ( delta*m%r_e(np,nt2) + deltad*m%r_s(np,nt2) )* tmp_vec / TwoNorm(tmp_vec) + end if + + r_vec_plane = p%Grid_high(:,nXYZ_high,nt) - p_tmp_plane + r_tmp_plane = TwoNorm( r_vec_plane ) + + ! test if the point is within radial finite-difference grid + if ( r_tmp_plane <= p%r(p%numRadii-1) ) then + + n_wake = n_wake + 1 + + + if ( EqualRealNos(r_tmp_plane, 0.0_ReKi) ) then + m%rhat_plane(:,n_wake) = 0.0_ReKi + else + m%rhat_plane(:,n_wake) = ( r_vec_plane ) / r_tmp_plane + end if + + + + ! given r_tmp_plane and Vx_wake at p%dr increments, find value of m%Vx_wake(@r_tmp_plane) using interpolation + m%Vx_wake(n_wake) = delta*InterpBin( r_tmp_plane, p%r, u%Vx_wake(:,np+1,nt2), ILo, p%NumRadii ) + deltad*InterpBin( r_tmp_plane, p%r, u%Vx_wake(:,np,nt2), ILo, p%NumRadii ) !( XVal, XAry, YAry, ILo, AryLen ) + m%Vr_wake(n_wake) = delta*InterpBin( r_tmp_plane, p%r, u%Vr_wake(:,np+1,nt2), ILo, p%NumRadii ) + deltad*InterpBin( r_tmp_plane, p%r, u%Vr_wake(:,np,nt2), ILo, p%NumRadii )!( XVal, XAry, YAry, ILo, AryLen ) + + m%xhat_plane(:,n_wake) = delta*u%xhat_plane(:,np+1,nt2) + deltad*u%xhat_plane(:,np,nt2) + m%xhat_plane(:,n_wake) = m%xhat_plane(:,n_wake) / TwoNorm(m%xhat_plane(:,n_wake)) + xhatBar_plane = xhatBar_plane + abs(m%Vx_wake(n_wake))*m%xhat_plane(:,n_wake) + + end if ! if the point is within radial finite-difference grid + + end if ! if the point is within the endcaps of the wake volume + end do ! np = 0, p%NumPlanes-2 + end if ! nt /= nt2 + end do ! nt2 = 1,p%NumTurbines + if (n_wake > 0) then + + tmp_xhatBar_plane = TwoNorm(xhatBar_plane) + if ( EqualRealNos(tmp_xhatBar_plane, 0.0_ReKi) ) then + xhatBar_plane = 0.0_ReKi + else + xhatBar_plane = xhatBar_plane / tmp_xhatBar_plane + end if + + Vx_wake_tmp = 0.0_ReKi + Vr_wake_tmp = 0.0_ReKi + do nw = 1,n_wake + Vr_term = m%Vx_wake(nw)*m%xhat_plane(:,nw) + m%Vr_wake(nw)*m%rhat_plane(:,nw) + Vx_term = dot_product( xhatBar_plane, Vr_term ) + Vx_wake_tmp = Vx_wake_tmp + Vx_term*Vx_term + Vr_wake_tmp = Vr_wake_tmp + Vr_term + end do + ! [I - XX']V = V - (V dot X)X + Vr_wake_tmp = Vr_wake_tmp - dot_product(Vr_wake_tmp,xhatBar_plane)*xhatBar_plane + do n_hl=0, n_high_low + y%Vdist_high(nt)%data(:,nx_high,ny_high,nz_high,n_hl) = y%Vdist_high(nt)%data(:,nx_high,ny_high,nz_high,n_hl) + real(Vr_wake_tmp - xhatBar_plane*sqrt(Vx_wake_tmp),SiKi) + end do + + end if ! (n_wake > 0) + + end do ! nx_high=0, p%nX_high-1 + end do ! ny_high=0, p%nY_high-1 + end do ! nz_high=0, p%nZ_high-1 + end do ! nt = 1,p%NumTurbines + + +end subroutine HighResGridCalcOutput + + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the start of the simulation to perform initialization steps. +!! The parameters are set here and not changed during the simulation. +!! The initial states and initial guess for the input are defined. +subroutine AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, errStat, errMsg ) +!.................................................................................................................................. + + type(AWAE_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(AWAE_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined + type(AWAE_ParameterType), intent( out) :: p !< Parameters + type(AWAE_ContinuousStateType), intent( out) :: x !< Initial continuous states + type(AWAE_DiscreteStateType), intent( out) :: xd !< Initial discrete states + type(AWAE_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states + type(AWAE_OtherStateType), intent( out) :: OtherState !< Initial other states + type(AWAE_OutputType), intent( out) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(AWAE_MiscVarType), intent( out) :: m !< Initial misc/optimization variables + real(DbKi), intent(in ) :: interval !< Low-resolution (FAST.Farm driver/glue code) time step, s + type(AWAE_InitOutputType), intent( out) :: InitOut !< Output for initialization routine + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + + ! Local variables + character(1024) :: rootDir, baseName, OutFileVTKDir ! Simulation root dir, basename for outputs + integer(IntKi) :: i,j,nt ! loop counter + integer(IntKi) :: maxN_wake + real(ReKi) :: gridLoc ! Location of requested output slice in grid coordinates [0,sz-1] + integer(IntKi) :: errStat2 ! temporary error status of the operation + character(ErrMsgLen) :: errMsg2 ! temporary error message + character(*), parameter :: RoutineName = 'AWAE_Init' + type(InflowWind_InitInputType) :: IfW_InitInp + type(InflowWind_InitOutputType) :: IfW_InitOut + ! Initialize variables for this routine + + errStat = ErrID_None + errMsg = "" + + ! Initialize the NWTC Subroutine Library + + call NWTC_Init( EchoLibVer=.FALSE. ) + + ! Display the module information + + call DispNVD( AWAE_Ver ) + + p%OutFileRoot = TRIM(InitInp%OutFileRoot) + + + + + ! Validate the initialization inputs + call ValidateInitInputData( InitInp%InputFileData, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, errStat, errMsg, RoutineName ) + if (errStat >= AbortErrLev) then + return + end if + + !............................................................................................ + ! Define parameters + !............................................................................................ + + + + ! set the rest of the parameters + p%Mod_AmbWind = InitInp%InputFileData%Mod_AmbWind + p%NumPlanes = InitInp%InputFileData%NumPlanes + p%NumRadii = InitInp%InputFileData%NumRadii + p%NumTurbines = InitInp%InputFileData%NumTurbines + p%WindFilePath = InitInp%InputFileData%WindFilePath ! TODO: Make sure this wasn't specified with the trailing folder separator. Note: on Windows a trailing / or \ causes no problem! GJH + p%n_high_low = InitInp%n_high_low + p%dt_low = InitInp%InputFileData%dt_low + p%NumDT = InitInp%NumDT + p%NOutDisWindXY = InitInp%InputFileData%NOutDisWindXY + p%NOutDisWindYZ = InitInp%InputFileData%NOutDisWindYZ + p%NOutDisWindXZ = InitInp%InputFileData%NOutDisWindXZ + p%WrDisWind = InitInp%InputFileData%WrDisWind + p%WrDisSkp1 = nint(InitInp%InputFileData%WrDisDT / p%dt_low) + p%Mod_Meander = InitInp%InputFileData%Mod_Meander + p%C_Meander = InitInp%InputFileData%C_Meander + + select case ( p%Mod_Meander ) + case (MeanderMod_Uniform) + p%C_ScaleDiam = 0.5_ReKi*p%C_Meander + case (MeanderMod_TruncJinc) + p%C_ScaleDiam = 0.5_ReKi*p%C_Meander*1.21967_ReKi + case (MeanderMod_WndwdJinc) + p%C_ScaleDiam = 0.5_ReKi*p%C_Meander*2.23313_ReKi + end select + + + call allocAry( p%OutDisWindZ, p%NOutDisWindXY, "OutDisWindZ", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + RETURN + end if + + call allocAry( p%OutDisWindX, p%NOutDisWindYZ, "OutDisWindX", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + RETURN + end if + + call allocAry( p%OutDisWindY, p%NOutDisWindXZ, "OutDisWindY", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if ( ErrStat >= AbortErrLev ) then + RETURN + end if + + p%OutDisWindZ = InitInp%InputFileData%OutDisWindZ + p%OutDisWindX = InitInp%InputFileData%OutDisWindX + p%OutDisWindY = InitInp%InputFileData%OutDisWindY + + ! --- Vtk Outputs + call GetPath( p%OutFileRoot, rootDir, baseName ) + OutFileVTKDir = trim(rootDir) // 'vtk_ff' ! Directory for VTK outputs + p%OutFileVTKRoot = trim(rootDir) // 'vtk_ff' // PathSep // trim(baseName) ! Basename for VTK files + p%VTK_tWidth = CEILING( log10( real(p%NumDT, ReKi)/real(p%WrDisSkp1, ReKi) ) + 1) ! Length for time stamp + if (p%WrDisWind .or. p%NOutDisWindXY>0 .or. p%NOutDisWindYZ>0 .or. p%NOutDisWindXZ>0) then + call MKDIR(OutFileVTKDir) ! creating output directory + end if + + + allocate( p%r(0:p%NumRadii-1),stat=errStat2) + if (errStat2 /= 0) then + call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for p%r.', errStat, errMsg, RoutineName ) + return + end if + + do i = 0,p%NumRadii-1 + p%r(i) = InitInp%InputFileData%dr*i + end do + + allocate( p%WT_Position(3,p%NumTurbines),stat=errStat2) + if (errStat2 /= 0) then + call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for p%WT_Position.', errStat, errMsg, RoutineName ) + return + end if + p%WT_Position = InitInp%InputFileData%WT_Position + + ! Obtain the precursor grid information by parsing the necessary input files + ! This will establish certain parameters as well as all of the initialization outputs + ! Sets: + ! Parameters: nX_low, nY_low, nZ_low, nX_high, nY_high, nZ_high, Grid_low, + ! Grid_high, n_high_low, n_rp_max + ! InitOutput: X0_high, Y0_high, Z0_high, dX_high, dY_high, dZ_high, nX_high, nY_high, nZ_high + + + call AWAE_IO_InitGridInfo(InitInp, p, InitOut, errStat2, errMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + if ( p%Mod_AmbWind > 1 ) then + ! Using InflowWind, so initialize that module now + IfW_InitInp%Linearize = .false. + IfW_InitInp%RootName = TRIM(p%OutFileRoot)//'.IfW' + IfW_InitInp%UseInputFile = .TRUE. + IfW_InitInp%InputFileName = InitInp%InputFileData%InflowFile + IfW_InitInp%lidar%Tmax = 0.0_ReKi + IfW_InitInp%lidar%HubPosition = 0.0_ReKi + IfW_InitInp%lidar%SensorType = SensorType_None + IfW_InitInp%Use4Dext = .false. + + if ( p%Mod_AmbWind == 2 ) then ! one InflowWind module + + ALLOCATE(p%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind parameter data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(x%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind continuous states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(xd%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind discrete states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(z%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind constraint states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(OtherState%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind other states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(m%IfW(0:0),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind miscvar data', ErrStat, ErrMsg, RoutineName ) + return + end if + + ! Initialize InflowWind + IfW_InitInp%FixedWindFileRootName = .false. + IfW_InitInp%NumWindPoints = p%NumGrid_low + + call InflowWind_Init( IfW_InitInp, m%u_IfW_Low, p%IfW(0), x%IfW(0), xd%IfW(0), z%IfW(0), OtherState%IfW(0), m%y_IfW_Low, m%IfW(0), Interval, IfW_InitOut, ErrStat2, ErrMsg2 ) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + else if ( p%Mod_AmbWind == 3 ) then ! multiple InflowWind modules + + ALLOCATE(p%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind parameter data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(x%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind continuous states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(xd%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind discrete states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(z%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind constraint states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(OtherState%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind other states data', ErrStat, ErrMsg, RoutineName ) + return + end if + ALLOCATE(m%IfW(0:p%NumTurbines),STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate memory for InflowWind miscvar data', ErrStat, ErrMsg, RoutineName ) + return + end if + + ! Initialize InflowWind for the low-resolution domain + IfW_InitInp%FixedWindFileRootName = .true. + IfW_InitInp%NumWindPoints = p%NumGrid_low + IfW_InitInp%TurbineID = 0 + + call InflowWind_Init( IfW_InitInp, m%u_IfW_Low, p%IfW(0), x%IfW(0), xd%IfW(0), z%IfW(0), OtherState%IfW(0), m%y_IfW_Low, m%IfW(0), Interval, IfW_InitOut, ErrStat2, ErrMsg2 ) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + ! Initialize InflowWind for each high-resolution domain + IfW_InitInp%NumWindPoints = p%nX_high*p%nY_high*p%nZ_high + + do nt = 1,p%NumTurbines + + IfW_InitInp%TurbineID = nt + + call InflowWind_Init( IfW_InitInp, m%u_IfW_High, p%IfW(nt), x%IfW(nt), xd%IfW(nt), z%IfW(nt), OtherState%IfW(nt), m%y_IfW_High, m%IfW(nt), Interval, IfW_InitOut, ErrStat2, ErrMsg2 ) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + end do + + end if + + ! Set the position inputs once for the low-resolution grid + m%u_IfW_Low%PositionXYZ = p%Grid_low + + ! Initialize the high-resolution grid inputs and outputs + IF ( .NOT. ALLOCATED( m%u_IfW_High%PositionXYZ ) ) THEN + call AllocAry(m%u_IfW_High%PositionXYZ, 3, p%nX_high*p%nY_high*p%nZ_high, 'm%u_IfW_High%PositionXYZ', ErrStat2, ErrMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call AllocAry(m%y_IfW_High%VelocityUVW, 3, p%nX_high*p%nY_high*p%nZ_high, 'm%y_IfW_High%VelocityUVW', ErrStat2, ErrMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + call AllocAry(m%y_IfW_High%WriteOutput, size(m%y_IfW_Low%WriteOutput), 'm%y_IfW_High%WriteOutput', ErrStat2, ErrMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + END IF + if (errStat2 >= AbortErrLev) then + return + end if + + end if + + InitOut%Ver = AWAE_Ver + + ! Test the request output wind locations against grid information + + ! XY plane slices + do i = 1,p%NOutDisWindXY + gridLoc = (p%OutDisWindZ(i) - p%Z0_low) / p%dZ_low + if ( ( gridLoc < 0.0_ReKi ) .or. ( gridLoc > real(p%nZ_low-1, ReKi) ) ) then + call SetErrStat(ErrID_Fatal, "The requested low-resolution XY output slice location, Z="//TRIM(Num2LStr(p%OutDisWindZ(i)))//", is outside of the low-resolution grid.", errStat, errMsg, RoutineName ) + end if + end do + + ! XZ plane slices + do i = 1,p%NOutDisWindXZ + gridLoc = (p%OutDisWindY(i) - p%Y0_low) / p%dY_low + if ( ( gridLoc < 0.0_ReKi ) .or. ( gridLoc > real(p%nY_low-1, ReKi) ) ) then + call SetErrStat(ErrID_Fatal, "The requested low-resolution XZ output slice location, Y="//TRIM(Num2LStr(p%OutDisWindY(i)))//", is outside of the low-resolution grid.", errStat, errMsg, RoutineName ) + end if + end do + + ! XZ plane slices + do i = 1,p%NOutDisWindYZ + gridLoc = (p%OutDisWindX(i) - p%X0_low) / p%dX_low + if ( ( gridLoc < 0.0_ReKi ) .or. ( gridLoc > real(p%nX_low-1, ReKi) ) ) then + call SetErrStat(ErrID_Fatal, "The requested low-resolution YZ output slice location, X="//TRIM(Num2LStr(p%OutDisWindX(i)))//", is outside of the low-resolution grid.", errStat, errMsg, RoutineName ) + end if + end do + if (errStat2 >= AbortErrLev) then + return + end if + + + !interval = InitOut%dt_low + + !............................................................................................ + ! Define and initialize inputs here + !............................................................................................ + + allocate ( u%xhat_plane(3,0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%xhat_plane.', errStat, errMsg, RoutineName ) + allocate ( u%p_plane (3,0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%p_plane.', errStat, errMsg, RoutineName ) + allocate ( u%Vx_wake (0:p%NumRadii-1,0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%Vx_wake.', errStat, errMsg, RoutineName ) + allocate ( u%Vr_wake (0:p%NumRadii-1,0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%Vr_wake.', errStat, errMsg, RoutineName ) + allocate ( u%D_wake (0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%D_wake.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + + + + !............................................................................................ + ! Define outputs here + !............................................................................................ + + allocate ( y%V_plane(3,0:p%NumPlanes-1,1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%V_plane.', errStat, errMsg, RoutineName ) + allocate ( y%Vdist_High(1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%Vdist_High.', errStat, errMsg, RoutineName ) + do i = 1, p%NumTurbines + allocate ( y%Vdist_High(i)%data(3,0:p%nX_high-1,0:p%nY_high-1,0:p%nZ_high-1,0:p%n_high_low), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%Vdist_High%data.', errStat, errMsg, RoutineName ) + y%Vdist_High(i)%data = 0.0_Siki + end do + + allocate ( y%Vx_wind_disk (1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%Vx_rel_disk.', errStat, errMsg, RoutineName ) + allocate ( y%TI_amb (1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%TI_amb.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + ! This next step is not strictly necessary + y%V_plane = 0.0_Reki + y%Vx_wind_disk = 0.0_Reki + y%TI_amb = 0.0_Reki + + + if ( p%NOutDisWindXY > 0 ) then + ALLOCATE ( m%OutVizXYPlane(3,p%nX_low, p%nY_low,1) , STAT=ErrStat ) + IF ( ErrStat /= 0 ) THEN + ErrStat = ErrID_Fatal + ErrMsg = ' Error allocating memory for the Fast.Farm OutVizXYPlane arrays.' + RETURN + ENDIF + end if + if ( p%NOutDisWindYZ > 0 ) then + ALLOCATE ( m%OutVizYZPlane(3,p%nY_low, p%nZ_low,1) , STAT=ErrStat ) + IF ( ErrStat /= 0 ) THEN + ErrStat = ErrID_Fatal + ErrMsg = ' Error allocating memory for the Fast.Farm OutVizYZPlane arrays.' + RETURN + ENDIF + end if + if ( p%NOutDisWindXZ > 0 ) then + ALLOCATE ( m%OutVizXZPlane(3,p%nX_low, p%nZ_low,1) , STAT=ErrStat ) + IF ( ErrStat /= 0 ) THEN + ErrStat = ErrID_Fatal + ErrMsg = ' Error allocating memory for the Fast.Farm OutVizXZPlane arrays.' + RETURN + ENDIF + end if + !............................................................................................ + ! Initialize misc vars : Note these are not the correct initializations because + ! that would require valid input data, which we do not have here. Instead we will check for + ! an firstPass flag on the miscVars and if it is false we will properly initialize these state + ! in CalcOutput or UpdateStates, as necessary. + !............................................................................................ + + + + + ! miscvars to avoid the allocation per timestep + + allocate ( m%Vamb_low ( 3, 0:p%nX_low-1 , 0:p%nY_low-1 , 0:p%nZ_low-1 ) , STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vamb_low.', errStat, errMsg, RoutineName ) + allocate ( m%Vamb_lowpol ( 3, 0:p%n_rp_max*8 ) , STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vamb_lowpol.', errStat, errMsg, RoutineName ) + allocate ( m%Vdist_low ( 3, 0:p%nX_low-1 , 0:p%nY_low-1 , 0:p%nZ_low-1 ) , STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vdist_low.', errStat, errMsg, RoutineName ) + + allocate ( m%Vamb_high(1:p%NumTurbines), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vamb_high.', errStat, errMsg, RoutineName ) + do i = 1, p%NumTurbines + allocate ( m%Vamb_high(i)%data(3,0:p%nX_high-1,0:p%nY_high-1,0:p%nZ_high-1,0:p%n_high_low), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vamb_high%data.', errStat, errMsg, RoutineName ) + end do + maxN_wake = p%NumTurbines*( p%NumPlanes-1 ) + allocate ( m%xhat_plane ( 3, 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%xhat_plane.', errStat, errMsg, RoutineName ) + allocate ( m%rhat_plane ( 3, 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%rhat_plane.', errStat, errMsg, RoutineName ) + allocate ( m%Vx_wake ( 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vx_wake.', errStat, errMsg, RoutineName ) + allocate ( m%Vr_wake ( 1:maxN_wake ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vr_wake.', errStat, errMsg, RoutineName ) + + allocate ( m%parallelFlag( 0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%parallelFlag.', errStat, errMsg, RoutineName ) + allocate ( m%r_s( 0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%r_s.', errStat, errMsg, RoutineName ) + allocate ( m%r_e( 0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%r_e.', errStat, errMsg, RoutineName ) + allocate ( m%rhat_s( 3,0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%rhat_s.', errStat, errMsg, RoutineName ) + allocate ( m%rhat_e( 3,0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%rhat_e.', errStat, errMsg, RoutineName ) + allocate ( m%pvec_cs( 3,0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%pvec_cs.', errStat, errMsg, RoutineName ) + allocate ( m%pvec_ce( 3,0:p%NumPlanes-2,1:p%NumTurbines ), STAT=errStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%pvec_ce.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + + ! Read-in the ambient wind data for the initial calculate output + + call AWAE_UpdateStates( 0.0_DbKi, -1, u, p, x, xd, z, OtherState, m, errStat, errMsg ) + + + + + +end subroutine AWAE_Init + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the end of the simulation. +subroutine AWAE_End( u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) +!.................................................................................................................................. + + type(AWAE_InputType), intent(inout) :: u !< System inputs + type(AWAE_ParameterType), intent(inout) :: p !< Parameters + type(AWAE_ContinuousStateType), intent(inout) :: x !< Continuous states + type(AWAE_DiscreteStateType), intent(inout) :: xd !< Discrete states + type(AWAE_ConstraintStateType), intent(inout) :: z !< Constraint states + type(AWAE_OtherStateType), intent(inout) :: OtherState !< Other states + type(AWAE_OutputType), intent(inout) :: y !< System outputs + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + ! Local variables + integer(IntKi) :: nt !< loop counter + + + ! Initialize errStat + + errStat = ErrID_None + errMsg = "" + + + ! Place any last minute operations or calculations here: + + + ! Close files here: + + ! End all instances of the InflowWind module + if ( p%Mod_AmbWind == 2 ) then + call InflowWind_End( m%u_IfW_Low, p%IfW(0 ), x%IfW(0 ), xd%IfW(0 ), z%IfW(0 ), OtherState%IfW(0 ), m%y_IfW_Low, m%IfW(0 ), errStat, errMsg ) + else if ( p%Mod_AmbWind == 3 ) then + call InflowWind_End( m%u_IfW_Low, p%IfW(0 ), x%IfW(0 ), xd%IfW(0 ), z%IfW(0 ), OtherState%IfW(0 ), m%y_IfW_Low, m%IfW(0 ), errStat, errMsg ) + do nt = 1,p%NumTurbines + call InflowWind_End( m%u_IfW_Low, p%IfW(nt), x%IfW(nt), xd%IfW(nt), z%IfW(nt), OtherState%IfW(nt), m%y_IfW_Low, m%IfW(nt), errStat, errMsg ) + end do + end if + + + + ! Destroy the input data: + + call AWAE_DestroyInput( u, errStat, errMsg ) + + + ! Destroy the parameter data: + + call AWAE_DestroyParam( p, errStat, errMsg ) + + + ! Destroy the state data: + + call AWAE_DestroyContState( x, errStat, errMsg ) + call AWAE_DestroyDiscState( xd, errStat, errMsg ) + call AWAE_DestroyConstrState( z, errStat, errMsg ) + call AWAE_DestroyOtherState( OtherState, errStat, errMsg ) + call AWAE_DestroyMisc( m, errStat, errMsg ) + + ! Destroy the output data: + + call AWAE_DestroyOutput( y, errStat, errMsg ) + + + + +end subroutine AWAE_End +!---------------------------------------------------------------------------------------------------------------------------------- +!> Loose coupling routine for solving for constraint states, integrating continuous states, and updating discrete and other states. +!! Continuous, constraint, discrete, and other states are updated for t + Interval +subroutine AWAE_UpdateStates( t, n, u, p, x, xd, z, OtherState, m, errStat, errMsg ) +!.................................................................................................................................. + + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + integer(IntKi), intent(in ) :: n !< Current simulation time step n = 0,1,... + type(AWAE_InputType), intent(inout) :: u !< Inputs at utimes (out only for mesh record-keeping in ExtrapInterp routine) + ! real(DbKi), intent(in ) :: utimes !< Times associated with u(:), in seconds + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_ContinuousStateType), intent(inout) :: x !< Input: Continuous states at t; + !! Output: Continuous states at t + Interval + type(AWAE_DiscreteStateType), intent(inout) :: xd !< Input: Discrete states at t; + !! Output: Discrete states at t + Interval + type(AWAE_ConstraintStateType), intent(inout) :: z !< Input: Constraint states at t; + !! Output: Constraint states at t+dt + type(AWAE_OtherStateType), intent(inout) :: OtherState !< Input: Other states at t; + !! Output: Other states at t+dt + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + ! local variables + type(AWAE_InputType) :: uInterp ! Interpolated/Extrapolated input + integer(intKi) :: errStat2 ! temporary Error status + character(ErrMsgLen) :: errMsg2 ! temporary Error message + character(*), parameter :: RoutineName = 'AWAE_UpdateStates' +! real(DbKi) :: t1, t2 + integer(IntKi) :: n_high_low, nt, n_hl, i,j,k,c + + errStat = ErrID_None + errMsg = "" + + ! Read the ambient wind data that is needed for t+dt, i.e., n+1 +!#ifdef _OPENMP +! t1 = omp_get_wtime() +!#endif + + if ( (n+1) == (p%NumDT-1) ) then + n_high_low = 0 + else + n_high_low = p%n_high_low + end if + + if ( p%Mod_AmbWind == 1 ) then + ! read from file the ambient flow for the n+1 time step + call ReadLowResWindFile(n+1, p, m%Vamb_Low, errStat, errMsg) + if ( errStat >= AbortErrLev ) then + return + end if + !#ifdef _OPENMP + ! t2 = omp_get_wtime() + ! write(*,*) ' AWAE_UpdateStates: Time spent reading Low Res data : '//trim(num2lstr(t2-t1))//' seconds' + !#endif + + do nt = 1,p%NumTurbines + do n_hl=0, n_high_low + ! read from file the ambient flow for the current time step + call ReadHighResWindFile(nt, (n+1)*p%n_high_low + n_hl, p, m%Vamb_high(nt)%data(:,:,:,:,n_hl), errStat, errMsg) + if ( errStat >= AbortErrLev ) then + return + end if + end do + end do + + else ! p%Mod_AmbWind == 2 .or. 3 + + ! Set low-resolution inflow wind velocities + call InflowWind_CalcOutput(t+p%dt_low, m%u_IfW_Low, p%IfW(0), x%IfW(0), xd%IfW(0), z%IfW(0), OtherState%IfW(0), m%y_IfW_Low, m%IfW(0), errStat, errMsg) + if ( errStat >= AbortErrLev ) then + return + end if + c = 1 + do k = 0,p%nZ_low-1 + do j = 0,p%nY_low-1 + do i = 0,p%nX_low-1 + m%Vamb_Low(:,i,j,k) = m%y_IfW_Low%VelocityUVW(:,c) + c = c+1 + end do + end do + end do + ! Set the high-resoultion inflow wind velocities for each turbine + if ( p%Mod_AmbWind == 2 ) then + do nt = 1,p%NumTurbines + m%u_IfW_High%PositionXYZ = p%Grid_high(:,:,nt) + do n_hl=0, n_high_low + call InflowWind_CalcOutput(t+p%dt_low+n_hl*p%DT_high, m%u_IfW_High, p%IfW(0), x%IfW(0), xd%IfW(0), z%IfW(0), OtherState%IfW(0), m%y_IfW_High, m%IfW(0), errStat, errMsg) + if ( errStat >= AbortErrLev ) then + return + end if + c = 1 + do k = 0,p%nZ_high-1 + do j = 0,p%nY_high-1 + do i = 0,p%nX_high-1 + m%Vamb_high(nt)%data(:,i,j,k,n_hl) = m%y_IfW_High%VelocityUVW(:,c) + c = c+1 + end do + end do + end do + end do + end do + + else !p%Mod_AmbWind == 3 + do nt = 1,p%NumTurbines + c = 1 + do k = 0,p%nZ_high-1 + do j = 0,p%nY_high-1 + do i = 0,p%nX_high-1 + m%u_IfW_High%PositionXYZ(:,c) = p%Grid_high(:,c,nt) - p%WT_Position(:,nt) + c = c+1 + end do + end do + end do + do n_hl=0, n_high_low + call InflowWind_CalcOutput(t+p%dt_low+n_hl*p%DT_high, m%u_IfW_High, p%IfW(nt), x%IfW(nt), xd%IfW(nt), z%IfW(nt), OtherState%IfW(nt), m%y_IfW_High, m%IfW(nt), errStat, errMsg) + if ( errStat >= AbortErrLev ) then + return + end if + c = 1 + do k = 0,p%nZ_high-1 + do j = 0,p%nY_high-1 + do i = 0,p%nX_high-1 + m%Vamb_high(nt)%data(:,i,j,k,n_hl) = m%y_IfW_High%VelocityUVW(:,c) + c = c+1 + end do + end do + end do + end do + end do + end if + + end if + +!#ifdef _OPENMP +! t1 = omp_get_wtime() +! write(*,*) ' AWAE_UpdateStates: Time spent reading High Res data : '//trim(num2lstr(t1-t2))//' seconds' +!#endif + +end subroutine AWAE_UpdateStates + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing outputs, used in both loose and tight coupling. +!! This subroutine is used to compute the output channels (motions and loads) and place them in the WriteOutput() array. +!! The descriptions of the output channels are not given here. Please see the included OutListParameters.xlsx sheet for +!! for a complete description of each output parameter. +subroutine AWAE_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) +! NOTE: no matter how many channels are selected for output, all of the outputs are calcalated +! All of the calculated output channels are placed into the m%AllOuts(:), while the channels selected for outputs are +! placed in the y%WriteOutput(:) array. +!.................................................................................................................................. + + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + type(AWAE_InputType), intent(in ) :: u !< Inputs at Time t + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_ContinuousStateType), intent(in ) :: x !< Continuous states at t + type(AWAE_DiscreteStateType), intent(in ) :: xd !< Discrete states at t + type(AWAE_ConstraintStateType), intent(in ) :: z !< Constraint states at t + type(AWAE_OtherStateType), intent(in ) :: OtherState !< Other states at t + type(AWAE_OutputType), intent(inout) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + + integer, parameter :: indx = 1 + character(p%VTK_tWidth) :: Tstr ! string for current VTK write-out step (padded with zeros) + integer(intKi) :: i, j, k + integer(intKi) :: errStat2 + character(ErrMsgLen) :: errMsg2 + character(*), parameter :: RoutineName = 'AWAE_CalcOutput' + integer(intKi) :: n, n_high + CHARACTER(1024) :: FileName + INTEGER(IntKi) :: Un ! unit number of opened file + + + errStat = ErrID_None + errMsg = "" + n = nint(t / p%dt_low) + call ComputeLocals(n, u, p, y, m, errStat2, errMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + call LowResGridCalcOutput(n, u, p, y, m, errStat2, errMsg2) + + + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + ! starting index for the high-res files + n_high = n*p%n_high_low + call HighResGridCalcOutput(n_high, u, p, y, m, errStat2, errMsg2) + call SetErrStat ( errStat2, errMsg2, errStat, errMsg, RoutineName ) + if (errStat2 >= AbortErrLev) then + return + end if + + if (mod(n,p%WrDisSkp1) == 0) then + + if ( p%WrDisWind ) then + call WriteDisWindFiles( n, p%WrDisSkp1, p, y, m, ErrStat2, ErrMsg2 ) + end if + + ! TimeStamp + write(Tstr, '(i' // trim(Num2LStr(p%VTK_tWidth)) //'.'// trim(Num2LStr(p%VTK_tWidth)) // ')') n/p%WrDisSkp1 ! TODO use n instead.. + + ! XY plane slices + do k = 1,p%NOutDisWindXY + + call ExtractSlice( XYSlice, p%OutDisWindZ(k), p%Z0_low, p%nZ_low, p%nX_low, p%nY_low, p%dZ_low, m%Vdist_low, m%outVizXYPlane(:,:,:,1)) + ! Create the output vtk file with naming /Low/DisXY.t.vtk + FileName = trim(p%OutFileVTKRoot)//".Low.DisXY"//trim(num2lstr(k))//"."//trim(Tstr)//".vtk" + call WrVTK_SP_header( FileName, "Low resolution, disturbed wind of XY Slice at time = "//trim(num2lstr(t))//" seconds.", Un, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call WrVTK_SP_vectors3D( Un, "Velocity", (/p%nX_low,p%nY_low,1_IntKi/), (/p%X0_low,p%Y0_low,p%OutDisWindZ(k)/), (/p%dX_low,p%dY_low,p%dZ_low/), m%outVizXYPlane, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + end do + + + ! YZ plane slices + do k = 1,p%NOutDisWindYZ + call ExtractSlice( YZSlice, p%OutDisWindX(k), p%X0_low, p%nX_low, p%nY_low, p%nZ_low, p%dX_low, m%Vdist_low, m%outVizYZPlane(:,:,:,1)) + ! Create the output vtk file with naming /Low/DisYZ.t.vtk + FileName = trim(p%OutFileVTKRoot)//".Low.DisYZ"//trim(num2lstr(k))//"."//trim(Tstr)//".vtk" + call WrVTK_SP_header( FileName, "Low resolution, disturbed wind of YZ Slice at time = "//trim(num2lstr(t))//" seconds.", Un, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call WrVTK_SP_vectors3D( Un, "Velocity", (/1,p%nY_low,p%nZ_low/), (/p%OutDisWindX(k),p%Y0_low,p%Z0_low/), (/p%dX_low,p%dY_low,p%dZ_low/), m%outVizYZPlane, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + end do + + ! XZ plane slices + do k = 1,p%NOutDisWindXZ + call ExtractSlice( XZSlice, p%OutDisWindY(k), p%Y0_low, p%nY_low, p%nX_low, p%nZ_low, p%dY_low, m%Vdist_low, m%outVizXZPlane(:,:,:,1)) + ! Create the output vtk file with naming /Low/DisXZ.t.vtk + FileName = trim(p%OutFileVTKRoot)//".Low.DisXZ"//trim(num2lstr(k))//"."//trim(Tstr)//".vtk" + call WrVTK_SP_header( FileName, "Low resolution, disturbed wind of XZ Slice at time = "//trim(num2lstr(t))//" seconds.", Un, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call WrVTK_SP_vectors3D( Un, "Velocity", (/p%nX_low,1,p%nZ_low/), (/p%X0_low,p%OutDisWindY(k),p%Z0_low/), (/p%dX_low,p%dY_low,p%dZ_low/), m%outVizXZPlane, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + end do + end if + +end subroutine AWAE_CalcOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Tight coupling routine for solving for the residual of the constraint state equations +subroutine AWAE_CalcConstrStateResidual( Time, u, p, x, xd, z, OtherState, m, z_residual, errStat, errMsg ) +!.................................................................................................................................. + + real(DbKi), intent(in ) :: Time !< Current simulation time in seconds + type(AWAE_InputType), intent(in ) :: u !< Inputs at Time + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_ContinuousStateType), intent(in ) :: x !< Continuous states at Time + type(AWAE_DiscreteStateType), intent(in ) :: xd !< Discrete states at Time + type(AWAE_ConstraintStateType), intent(in ) :: z !< Constraint states at Time (possibly a guess) + type(AWAE_OtherStateType), intent(in ) :: OtherState !< Other states at Time + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + type(AWAE_ConstraintStateType), intent(inout) :: Z_residual !< Residual of the constraint state equations using + !! the input values described above + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + ! Local variables + integer, parameter :: indx = 1 + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'AWAE_CalcConstrStateResidual' + + + + errStat = ErrID_None + errMsg = "" + +end subroutine AWAE_CalcConstrStateResidual + + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine validates the inputs from the Wind_AmbientAndArray input files. +subroutine ValidateInitInputData( InputFileData, errStat, errMsg ) +!.................................................................................................................................. + + ! Passed variables: + type(AWAE_InputFileType), intent(in) :: InputFileData !< All the data in the Wind_AmbientAndArray input file + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + ! local variables + integer(IntKi) :: k ! Blade number + integer(IntKi) :: j ! node number + character(*), parameter :: RoutineName = 'ValidateInitInputData' + + errStat = ErrID_None + errMsg = "" + + if ( (InputFileData%Mod_AmbWind < 1) .or. (InputFileData%Mod_AmbWind > 3) ) call SetErrStat ( ErrID_Fatal, 'Mod_AmbWind must be 1: high-fidelity precursor in VTK format, 2: one instance of InflowWind module, or 3: multiple instances of InflowWind module.', errStat, errMsg, RoutineName ) + if ( InputFileData%Mod_AmbWind == 1 ) then + if (len_trim(InputFileData%WindFilePath) == 0) call SetErrStat ( ErrID_Fatal, 'WindFilePath must contain at least one character.', errStat, errMsg, RoutineName ) + else + if (len_trim(InputFileData%InflowFile) == 0) call SetErrStat ( ErrID_Fatal, 'InflowFile must contain at least one character.', errStat, errMsg, RoutineName ) + if ( (InputFileData%nX_low < 2) .or. (InputFileData%nY_low < 2) .or. (InputFileData%nZ_low < 2) ) & + call SetErrStat ( ErrID_Fatal, 'The low resolution grid dimensions must contain a minimum of 2 nodes in each spatial direction. ', errStat, errMsg, RoutineName ) + if ( (InputFileData%nX_high < 2) .or. (InputFileData%nY_high < 2) .or. (InputFileData%nY_high < 2) ) & + call SetErrStat ( ErrID_Fatal, 'The high resolution grid dimensions must contain a minimum of 2 nodes in each spatial direction. ', errStat, errMsg, RoutineName ) + if ( (InputFileData%dX_low <= 0.0_ReKi) .or. (InputFileData%dY_low <= 0.0_ReKi) .or. (InputFileData%dY_low <= 0.0_ReKi) ) & + call SetErrStat ( ErrID_Fatal, 'The low resolution spatial resolution must be greater than zero in each spatial direction. ', errStat, errMsg, RoutineName ) + end if + + if ( InputFileData%NumTurbines < 1 ) call SetErrStat ( ErrID_Fatal, 'Number of turbines must be greater than zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%NumPlanes < 2 ) call SetErrStat ( ErrID_Fatal, 'Number of wake planes must be greater than one.', errStat, errMsg, RoutineName ) + if ( InputFileData%NumRadii < 2 ) call SetErrStat ( ErrID_Fatal, 'Number of radii in the radial finite-difference grid must be greater than one.', errStat, errMsg, RoutineName ) + if ( InputFileData%dr <= 0.0) call SetErrStat ( ErrID_Fatal, 'dr must be greater than zero.', errStat, errMsg, RoutineName ) + if (.not. ((InputFileData%Mod_Meander == 1) .or. (InputFileData%Mod_Meander == 2) .or. (InputFileData%Mod_Meander == 3)) ) call SetErrStat ( ErrID_Fatal, 'Mod_Meander must be equal to 1, 2, or 3.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_Meander < 1.0_ReKi ) call SetErrStat ( ErrID_Fatal, 'C_Meander must not be less than 1.', errStat, errMsg, RoutineName ) + +end subroutine ValidateInitInputData + + + +!======================================================================= +! Unit Tests +!======================================================================= + +subroutine AWAE_TEST_Init_BadData(errStat, errMsg) + + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + type(AWAE_InitInputType) :: InitInp !< Input data for initialization routine + type(AWAE_InputType) :: u !< An initial guess for the input; input mesh must be defined + type(AWAE_ParameterType) :: p !< Parameters + type(AWAE_ContinuousStateType) :: x !< Initial continuous states + type(AWAE_DiscreteStateType) :: xd !< Initial discrete states + type(AWAE_ConstraintStateType) :: z !< Initial guess of the constraint states + type(AWAE_OtherStateType) :: OtherState !< Initial other states + type(AWAE_OutputType) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(AWAE_MiscVarType) :: m !< Initial misc/optimization variables + real(DbKi) :: interval !< Coupling interval in seconds: the rate that + + type(AWAE_InitOutputType) :: initOut !< Input data for initialization routine + + + + + + ! Set up the initialization inputs + + + interval = 0.0_DbKi + InitInp%InputFileData%WindFilePath = '' + InitInp%InputFileData%NumTurbines = 0 + InitInp%InputFileData%NumPlanes = 0 + InitInp%InputFileData%NumRadii = 0 + InitInp%InputFileData%dr = 0.0_ReKi + InitInp%InputFileData%Mod_Meander = 0 + InitInp%InputFileData%C_Meander = 0.0_ReKi + + + call AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, errStat, errMsg ) + + return + +end subroutine AWAE_TEST_Init_BadData + +subroutine AWAE_TEST_SetGoodInitInpData(interval, InitInp) + real(DbKi) , intent(out) :: interval + type(AWAE_InitInputType), intent(out) :: InitInp !< Input data for initialization routine + + ! Based on NREL 5MW + interval = 2.0_DbKi + InitInp%InputFileData%WindFilePath = 'C:\Dev\OpenFAST-farm\OpenFAST-test\fast-farm\steady' + InitInp%InputFileData%WindFilePath = 'Y:\Wind\Public\Projects\Projects F\FAST.Farm\AmbWind\04' + InitInp%InputFileData%NumTurbines = 1 + InitInp%InputFileData%NumPlanes = 140 + InitInp%InputFileData%NumRadii = 40 + InitInp%InputFileData%dr = 5.0_ReKi + InitInp%n_high_low = 6 + InitInp%InputFileData%dt_low = 2.0_DbKi + InitInp%NumDT = 1 + InitInp%InputFileData%NOutDisWindXY = 0 + InitInp%InputFileData%NOutDisWindYZ = 0 + InitInp%InputFileData%NOutDisWindXZ = 0 + InitInp%InputFileData%WrDisWind = .false. + InitInp%InputFileData%WrDisDT = 0.0 + InitInp%InputFileData%OutDisWindY = 0 + InitInp%InputFileData%OutDisWindZ = 0 + InitInp%InputFileData%OutDisWindX = 0 + InitInp%InputFileData%Mod_Meander = 1 + InitInp%InputFileData%C_Meander = 2.0_ReKi + + +end subroutine AWAE_TEST_SetGoodInitInpData + + +subroutine AWAE_TEST_Init_GoodData(errStat, errMsg) + + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + type(AWAE_InitInputType) :: InitInp !< Input data for initialization routine + type(AWAE_InputType) :: u !< An initial guess for the input; input mesh must be defined + type(AWAE_ParameterType) :: p !< Parameters + type(AWAE_ContinuousStateType) :: x !< Initial continuous states + type(AWAE_DiscreteStateType) :: xd !< Initial discrete states + type(AWAE_ConstraintStateType) :: z !< Initial guess of the constraint states + type(AWAE_OtherStateType) :: OtherState !< Initial other states + type(AWAE_OutputType) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(AWAE_MiscVarType) :: m !< Initial misc/optimization variables + real(DbKi) :: interval !< Coupling interval in seconds: the rate that + + type(AWAE_InitOutputType) :: initOut !< Input data for initialization routine + + + + + + ! Set up the initialization inputs + call AWAE_TEST_SetGoodInitInpData(interval, InitInp) + + call AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, interval, InitOut, errStat, errMsg ) + + return + +end subroutine AWAE_TEST_Init_GoodData + + +subroutine AWAE_TEST_CalcOutput(errStat, errMsg) + + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + type(AWAE_InitInputType) :: InitInp !< Input data for initialization routine + type(AWAE_InputType) :: u !< An initial guess for the input; input mesh must be defined + type(AWAE_ParameterType) :: p !< Parameters + type(AWAE_ContinuousStateType) :: x !< Initial continuous states + type(AWAE_DiscreteStateType) :: xd !< Initial discrete states + type(AWAE_ConstraintStateType) :: z !< Initial guess of the constraint states + type(AWAE_OtherStateType) :: OtherState !< Initial other states + type(AWAE_OutputType) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(AWAE_MiscVarType) :: m !< Initial misc/optimization variables + real(DbKi) :: interval !< Coupling interval in seconds: the rate that + + type(AWAE_InitOutputType) :: initOut !< Input data for initialization routine + + integer(IntKi) :: nt, nr, np + real(DbKi) :: t + + ! This example creates turbine 1 at the global coordinate [0,0,0] + ! The data is hardcoded in: AWAE_IO_InitGridInfo() as follows: + ! X0_low = -750.0_ReKi + ! Y0_low = -500.0_ReKi + ! Z0_low = 0.0_ReKi + ! dX_low = 10.0_ReKi + ! dY_low = 10.0_ReKi + ! dZ_low = 10.0_ReKi + ! ! Parse a low res wind input file to gather the grid information + ! p%nX_Low = 151 + ! p%nY_low = 101 + ! p%nZ_low = 51 + ! ! Grid runs from (X0_low, Y0_low, Z0_low) to (X0_low + (p%nX_Low-1)*dX_low, Y0_low+ (p%nY_Low-1)*dY_low, Z0_low+ (p%nZ_Low-1)*dZ_low) + ! ! (0,0,0) to (180,180,180) + ! ! Parse a high res wind input file to gather the grid information + ! p%nX_high = 16 + ! p%nY_high = 16 + ! p%nZ_high = 16 + ! The low resolution grid extends from [-750,-500,0] to [750,500,500] + ! The first turbine's grid is located at [ + + ! Based on NREL 5MW + interval = 1.0_DbKi + InitInp%InputFileData%WindFilePath = 'C:\Dev\NWTC Github\FAST.Farm\data' + InitInp%InputFileData%NumTurbines = 3 + InitInp%InputFileData%NumPlanes = 500 + InitInp%InputFileData%NumRadii = 40 + InitInp%InputFileData%dr = 5.0_ReKi + + ! Initialize the module + call AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, interval, InitOut, errStat, errMsg ) + if (errStat > ErrID_None) then + return + end if + + + ! Set up the inputs + do nt = 1,p%NumTurbines + do np = 0,p%NumPlanes-1 + do nr = 0,p%NumRadii-1 + u%Vx_wake(nr,np,nt) = -1.0_ReKi + u%Vr_wake(nr,np,nt) = 0.1_ReKi + end do + end do + end do + + + u%xhat_plane(1,:,:) = 1.0_ReKi + u%xhat_plane(2,:,:) = 0.0_ReKi + u%xhat_plane(3,:,:) = 0.0_ReKi + + do nt = 1,p%NumTurbines + do np = 0,p%NumPlanes-1 + u%p_plane(1,np,nt) = 0.0_ReKi + 8.0*np*interval + 250.0_ReKi*(nt-1) + u%p_Plane(2,np,nt) = 0.0_ReKi + u%p_Plane(3,np,nt) = 90.0_ReKi + u%D_wake(np,nt) = 126.0_ReKi + end do + end do + + t = 0.0_DbKi + + call AWAE_CalcOutput(t, u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) + if (errStat > ErrID_None) then + return + end if + ! call AWAE_UpdateStates(t, 0, u, p, x, xd, z, OtherState, m, errStat, errMsg ) + + !t = t + interval + !call AWAE_CalcOutput(t, u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) + ! + ! ! Verify that xd and y are the same + ! + !if (errStat == ErrID_None) then + ! call AWAE_UpdateStates(0.0_DbKi, 1, u, p, x, xd, z, OtherState, m, errStat, errMsg ) + !end if + + return + + +end subroutine AWAE_TEST_CalcOutput + +FUNCTION INTERP3D(p,p0,del,V,within,nX,nY,nZ,Vbox) + ! I/O variables + Real(ReKi), INTENT( IN ) :: p(3) !< Position where the 3D velocity field will be interpreted (m) + Real(ReKi), INTENT( IN ) :: p0(3) !< Origin of the spatial domain (m) + Real(ReKi), INTENT( IN ) :: del(3) !< XYZ-components of the spatial increment of the domain (m) + INTEGER(IntKi), INTENT( IN) :: nX, nY, nZ !< Size of XYZ spatial dimensions + Real(SiKi), INTENT( IN ) :: V(3,0:nX-1,0:nY-1,0:nZ-1) !< 3D velocity field to be interpolated + + Real(SiKi) :: INTERP3D(3) !Vint(3) !< Interpolated velocity (m/s) + Logical, INTENT( OUT ) :: within !< Logical flag indicating weather or not the input position lies within the domain (flag) + REAL(ReKi), OPTIONAL, INTENT(OUT) :: Vbox(3,8) !< Wind velocities at the 8 points in the 3D spatial domain surrounding the input position + + ! Local variables + INTEGER(IntKi) :: i + Real(ReKi) :: f(3), N(8) + Real(SiKi) :: Vtmp(3,8) + INTEGER(IntKi) :: n_lo(3), n_hi(3) + + + !!! CHECK BOUNDS + within = .TRUE. + do i = 1, 3 + f(i) = (p(i)-p0(i))/del(i) + n_lo(i) = FLOOR(f(i)) + n_hi(i) = n_lo(i)+1_IntKi + f(i) = 2.0_ReKi*( f(i)-REAL(n_lo(i),ReKi) )-1.0_ReKi ! convert to value between -1 and 1 + if (( n_lo(i) < 0) .OR. (n_hi(i) > size(V,i+1)-1)) THEN + within = .FALSE. + END IF + end do + + !!! INTERPOLATE + INTERP3D = 0.0_SiKi + if (within) then + + N(1) = ((1.0_ReKi-f(1))*(1.0_ReKi-f(2))*(1.0_ReKi-f(3)))/8.0_ReKi + N(2) = ((1.0_ReKi+f(1))*(1.0_ReKi-f(2))*(1.0_ReKi-f(3)))/8.0_ReKi + N(3) = ((1.0_ReKi-f(1))*(1.0_ReKi+f(2))*(1.0_ReKi-f(3)))/8.0_ReKi + N(4) = ((1.0_ReKi+f(1))*(1.0_ReKi+f(2))*(1.0_ReKi-f(3)))/8.0_ReKi + N(5) = ((1.0_ReKi-f(1))*(1.0_ReKi-f(2))*(1.0_ReKi+f(3)))/8.0_ReKi + N(6) = ((1.0_ReKi+f(1))*(1.0_ReKi-f(2))*(1.0_ReKi+f(3)))/8.0_ReKi + N(7) = ((1.0_ReKi-f(1))*(1.0_ReKi+f(2))*(1.0_ReKi+f(3)))/8.0_ReKi + N(8) = ((1.0_ReKi+f(1))*(1.0_ReKi+f(2))*(1.0_ReKi+f(3)))/8.0_ReKi + Vtmp(:,1) = V(:,n_lo(1),n_lo(2),n_lo(3)) + Vtmp(:,2) = V(:,n_hi(1),n_lo(2),n_lo(3)) + Vtmp(:,3) = V(:,n_lo(1),n_hi(2),n_lo(3)) + Vtmp(:,4) = V(:,n_hi(1),n_hi(2),n_lo(3)) + Vtmp(:,5) = V(:,n_lo(1),n_lo(2),n_hi(3)) + Vtmp(:,6) = V(:,n_hi(1),n_lo(2),n_hi(3)) + Vtmp(:,7) = V(:,n_lo(1),n_hi(2),n_hi(3)) + Vtmp(:,8) = V(:,n_hi(1),n_hi(2),n_hi(3)) + + do i=1,8 + + ! To support complex terrain, the wind data will have NaNs at any point in the domain below the ground; throw away these points. + if ( Is_NaN( REAL(vtmp(1,i),DbKi) ) .OR. Is_NaN( REAL(vtmp(2,i),DbKi) ) .OR. Is_NaN( REAL(vtmp(3,i),DbKi) ) ) then + within = .FALSE. + INTERP3D(:) = 0.0_SiKi + EXIT + end if + + INTERP3D(:) = INTERP3D(:) + N(i)*Vtmp(:,i) + + end do + + else + + vtmp = 0.0_SiKi + + end if + + ! Output the wind velocities at the 8 points in the 3D spatial domain surrounding the input position (if necessary) + IF ( PRESENT( Vbox ) ) Vbox = REAL( Vtmp, ReKi ) + +END FUNCTION + +end module AWAE diff --git a/modules/awae/src/AWAE_Driver.f90 b/modules/awae/src/AWAE_Driver.f90 new file mode 100644 index 0000000000..ba02644f78 --- /dev/null +++ b/modules/awae/src/AWAE_Driver.f90 @@ -0,0 +1,94 @@ +! AWAE_Driver.f90 +! +! FUNCTIONS: +! AWAE_Driver - Entry point of console application. +! + +!**************************************************************************** +! +! PROGRAM: AWAE_Driver +! +! PURPOSE: Entry point for the console application. +! +!**************************************************************************** + +program AWAE_Driver + use AWAE + use AWAE_Driver_Subs + use NWTC_Library + + implicit none + + + + character(1024) :: AWAE_Dvr_InputFile !< Name of the file containing the driver input data + type(AWAE_InitInputType) :: AWAE_InitInp !< Input data for initialization routine + type(AWAE_InitOutputType) :: AWAE_InitOut !< Input data for initialization routine + type(AWAE_InputType) :: AWAE_u !< Input data for initialization routine + type(AWAE_ParameterType) :: AWAE_p !< Input data for initialization routine + type(AWAE_DiscreteStateType) :: AWAE_xd !< Input data for initialization routine + type(AWAE_OutputType) :: AWAE_y !< Input data for initialization routine + + integer(IntKi) :: errStat !< Error status + character(ErrMsgLen) :: errMsg !< Error message + + errStat = ErrID_None + errMsg = '' + + ! Initialize the NWTC Subroutine Library + call NWTC_Init( EchoLibVer=.FALSE. ) + !call AWAE_TEST_ExtractSlice(errStat, errMsg) + call AWAE_TEST_LowResGridCalcs(errStat, errMsg) +! call AWAE_Dvr_Tests(1, errStat, errMsg) + call CheckError( errStat, errMsg ) + ! Initialize the Driver and the WD module + !call AWAE_TEST_Init_BadData(errStat, ErrMsg) + !call CheckError( ErrStat, ErrMsg ) + + ! call AWAE_TEST_Init_GoodData(errStat, ErrMsg) + ! call CheckError( ErrStat, ErrMsg ) + !call AWAE_Dvr_Init( AWAE_InitInp, AWAE_InitOut, AWAE_u,AWAE_p, AWAE_xd, AWAE_y, errStat, errMsg) + ! call AWAE_TEST_CalcOutput(errStat, errMsg) + ! call CheckError( ErrStat, ErrMsg ) + ! Run the time marching loop + ! call AWAE_Dvr_Time_Marching() + + ! Cleanup + ! call AWAE_Dvr_Cleanup() + CONTAINS + !............................................................................................................................... + SUBROUTINE CheckError(ErrID,Msg,ErrLocMsg) + ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev + !............................................................................................................................... + + ! Passed arguments + INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) + CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) + CHARACTER(*), INTENT(IN), OPTIONAL :: ErrLocMsg ! an optional message describing the location of the error + + ! CHARACTER(1024) :: SimMsg + ! integer(IntKi) :: i_turb2 + + + IF ( ErrID /= ErrID_None ) THEN + CALL WrScr( NewLine//TRIM(Msg)//NewLine ) + !IF ( ErrID >= AbortErrLev ) THEN + ! + ! IF (PRESENT(ErrLocMsg)) THEN + ! SimMsg = ErrLocMsg + ! ELSE + ! SimMsg = 'at simulation time '//TRIM(Num2LStr(Turbine(1)%m_FAST%t_global))//' of '//TRIM(Num2LStr(Turbine(1)%p_FAST%TMax))//' seconds' + ! END IF + ! + ! DO i_turb2 = 1,NumTurbines + ! CALL ExitThisProgram_T( Turbine(i_turb2), ErrID, i_turb2==NumTurbines, SimMsg ) + ! END DO + ! + !END IF + + END IF + + + END SUBROUTINE CheckError +end program AWAE_Driver + diff --git a/modules/awae/src/AWAE_Driver_Subs.f90 b/modules/awae/src/AWAE_Driver_Subs.f90 new file mode 100644 index 0000000000..24bcc165b8 --- /dev/null +++ b/modules/awae/src/AWAE_Driver_Subs.f90 @@ -0,0 +1,490 @@ +module AWAE_Driver_Subs + + use AWAE_Types + + implicit none + + + + contains + +!!---------------------------------------------------------------------------------------------------------------------------------- +!subroutine ReadAWAE_DvrInputFile( filename, OutFileRoot, InputFileData, , errStat, errMsg ) +!! This subroutine reads the input file and stores all the data in the AWAE_InputFile structure. +!! It does not perform data validation. +!!.................................................................................................................................. +! +! ! Passed variables +! +! character(*), intent(in) :: filename ! Name of the input file +! +! +! type(AWAE_InputFile), intent(out) :: InputFileData ! Data stored in the module's input file +! real(DbKi), intent(out) :: Default_DT ! The default DT (from glue code) +! +! integer(IntKi), intent(out) :: errStat ! The error status code +! character(*), intent(out) :: errMsg ! The error message, if an error occurred +! +! ! local variables +! +! integer(IntKi) :: I +! integer(IntKi) :: UnEc +! integer(IntKi) :: UnIn ! Unit number for reading file +! logical :: Echo ! Determines if an echo file should be written +! character(1024) :: PriPath ! Path name of the primary file +! character(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents +! character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") +! integer(IntKi) :: errStat2, IOS ! The error status code +! character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred +! character(*) :: DvrFileRoot ! The rootname of all the driver input file. +! !character(*) :: OutFileRoot ! The rootname of output files written by this routine. +! character(*), parameter :: RoutineName = 'ReadAWAE_DvrInputFile' +! +! +! ! initialize values: +! +! errStat = ErrID_None +! errMsg = '' +! +! ! get the driver input-file data +! +! ! Initialize some variables: +! ErrStat = ErrID_None +! ErrMsg = "" +! +! UnEc = -1 +! Echo = .FALSE. +! call GetPath( filename, PriPath ) ! Input files will be relative to the path where the driver input file is located. +! +! +! ! Get an available unit number for the file. +! +! call GetNewUnit( UnIn, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! Open the driver input file. +! +! call OpenFInpFile ( UnIn, filename, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! +! +! ! Read the lines up/including to the "Echo" simulation control variable +! ! If echo is FALSE, don't write these lines to the echo file. +! ! If Echo is TRUE, rewind and write on the second try. +! +! I = 1 !set the number of times we've read the file +! do +! !----------- HEADER ------------------------------------------------------------- +! +! call ReadCom( UnIn, filename, 'File header: Module Version (line 1)', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! call ReadStr( UnIn, filename, FTitle, 'FTitle', 'File Header: File Description (line 2)', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! +! !----------- GENERAL OPTIONS ---------------------------------------------------- +! +! call ReadCom( UnIn, filename, 'Section Header: General Options', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! Echo - Echo input to ".WD.ech". +! +! call ReadVar( UnIn, filename, Echo, 'Echo', 'Echo flag', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! +! if (.NOT. Echo .OR. I > 1) exit !exit this loop +! +! ! Otherwise, open the echo file, then rewind the input file and echo everything we've read +! call getroot(filename,DvrFileRoot) +! I = I + 1 ! make sure we do this only once (increment counter that says how many times we've read this file) +! +! call OpenEcho ( UnEc, trim(DvrFileRoot)//'.ech', errStat2, errMsg2, AWAE_Ver ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! if ( UnEc > 0 ) write (UnEc,'(/,A,/)') 'Data from '//trim(AWAE_Drv_Ver%Name)//' primary input file "'//trim( filename )//'":' +! +! rewind( UnIn, IOSTAT=errStat2 ) +! if (errStat2 /= 0_IntKi ) then +! call SetErrStat( ErrID_Fatal, 'Error rewinding file "'//trim(filename)//'".', ErrStat, ErrMsg, RoutineName ) +! call Cleanup() +! return +! end if +! +! end do +! +! if (NWTC_VerboseLevel == NWTC_Verbose) then +! call WrScr( ' Heading of the '//trim(AWAE_Drv_Ver%Name)//' input file: ' ) +! call WrScr( ' '//trim( FTitle ) ) +! end if +! +! +! ! DT - Time interval for Wake dynamics calculations {or default} (s): +! Line = "" +! call ReadVar( UnIn, filename, Line, "DT", "Time interval for Wake dynamics calculations {or default} (s)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! call Conv2UC( Line ) +! if ( index(Line, "DEFAULT" ) /= 1 ) then ! If it's not "default", read this variable; otherwise use the value already stored in InputFileData%DT +! READ( Line, *, IOSTAT=IOS) InputFileData%DT +! call CheckIOS ( IOS, filename, 'DT', NumType, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! end if +! +! ! NumPlanes - Number of wake planes (-): +! call ReadVar( UnIn, filename, InputFileData%NumPlanes, "NumPlanes", "Number of wake planes (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! NumRadii - Number of radii in the radial finite-difference grid (-): +! call ReadVar( UnIn, filename, InputFileData%NumRadii, "NumRadii", "Number of radii in the radial finite-difference grid (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! dR - Radial increment of radial finite-difference grid (m) : +! call ReadVar( UnIn, filename, InputFileData%dR, "dR", "Radial increment of radial finite-difference grid (m)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! filtParam - Low-pass time-filter parameter, with a value between 0 (minimum filtering) and 1 (maximum filtering) (exclusive) (-) : +! call ReadVar( UnIn, filename, InputFileData%filtParam, "filtParam", "Low-pass time-filter parameter, with a value between 0 (minimum filtering) and 1 (maximum filtering) (exclusive) (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_NearWake - Calibrated parameter for near-wake correction (-): +! call ReadVar( UnIn, filename, InputFileData%C_NearWake, "C_NearWake", "Calibrated parameter for near-wake correction (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_DMin_vAmb - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-): +! call ReadVar( UnIn, filename, InputFileData%C_DMin_vAmb, "C_DMin_vAmb", "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_DMax_vAmb - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-): +! call ReadVar( UnIn, filename, InputFileData%C_DMax_vAmb, "C_DMax_vAmb", "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_FMin_vAmb - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the functional value in the minimum region (-): +! call ReadVar( UnIn, filename, InputFileData%C_FMin_vAmb, "C_FMin_vAmb", "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the functional value in the minimum region (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_Exp_vAmb - Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-): +! call ReadVar( UnIn, filename, InputFileData%C_Exp_vAmb, "C_Exp_vAmb", "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_DMin_vShr - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-): +! call ReadVar( UnIn, filename, InputFileData%C_DMin_vShr, "C_DMin_vShr", "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_DMax_vShr - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-): +! call ReadVar( UnIn, filename, InputFileData%C_DMax_vShr, "C_DMax_vShr", "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_FMin_vShr - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the functional value in the minimum region (-): +! call ReadVar( UnIn, filename, InputFileData%C_FMin_vShr, "C_FMin_vShr", "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the functional value in the minimum region (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_Exp_vShr - Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-): +! call ReadVar( UnIn, filename, InputFileData%C_Exp_vShr, "C_Exp_vShr", "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! k_vAmb - Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-): +! call ReadVar( UnIn, filename, InputFileData%k_vAmb, "k_vAmb", "Calibrated parameter for the influence of ambient turbulence in the eddy viscosity (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! k_vShr - Calibrated parameter for the influence of the shear layer in the eddy viscosity (-): +! call ReadVar( UnIn, filename, InputFileData%k_vShr, "k_vShr", "Calibrated parameter for the influence of the shear layer in the eddy viscosity (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! WakeDiam_Mod - Wake diameter calculation model (-): +! call ReadVar( UnIn, filename, InputFileData%WakeDiam_Mod, "WakeDiam_Mod", "Wake diameter calculation model (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! C_WakeDiam - Calibrated parameter for wake diameter calculation (-): +! call ReadVar( UnIn, filename, InputFileData%C_WakeDiam, "C_WakeDiam", "Calibrated parameter for wake diameter calculation (-)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! +! +! ! Return on error at end of section +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! +! +! call Cleanup ( ) +! return +! +!contains +! !............................................................................................................................... +! subroutine Cleanup() +! ! This subroutine cleans up before exiting this subroutine +! !............................................................................................................................... +! +! ! if ( UnEcho > 0 ) close( UnEcho ) +! if (UnIn > 0) close ( UnIn ) +! +! end subroutine Cleanup +! +!end subroutine ReadAWAE_DvrInputFile +! +!!---------------------------------------------------------------------------------------------------------------------------------- +!subroutine ReadWDInputFile( InputFile, InputFileData, Default_DT, OutFileRoot, UnEcho, ErrStat, ErrMsg ) +!! This subroutine reads the input file and stores all the data in the AWAE_InputFile structure. +!! It does not perform data validation. +!!.................................................................................................................................. +! +! ! Passed variables +! real(DbKi), intent(in) :: Default_DT ! The default DT (from glue code) +! +! character(*), intent(in) :: InputFile ! Name of the input file +! character(*), intent(in) :: OutFileRoot ! The rootname of all the output files written by this routine. +! +! type(AWAE_InputFile), intent(out) :: InputFileData ! Data stored in the module's input file +! integer(IntKi), intent(out) :: UnEcho ! Unit number for the echo file +! +! integer(IntKi), intent(out) :: ErrStat ! The error status code +! character(*), intent(out) :: ErrMsg ! The error message, if an error occurred +! +! ! local variables +! +! integer(IntKi) :: I +! integer(IntKi) :: UnEc +! integer(IntKi) :: UnIn ! Unit number for reading file +! logical :: Echo ! Determines if an echo file should be written +! character(1024) :: PriPath ! Path name of the primary file +! character(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents +! character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") +! integer(IntKi) :: errStat2, IOS ! The error status code +! character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred +! +! character(*), parameter :: RoutineName = 'ReadWDInputFile' +! +! +! ! initialize values: +! +! ErrStat = ErrID_None +! ErrMsg = '' +! UnEcho = -1 +! InputFileData%DT = Default_DT ! the glue code's suggested DT for the module (may be overwritten in ReadPrimaryFile()) +! +! ! get the primary/platform input-file data +! ! sets UnEcho, ADBlFile +! +! ! Initialize some variables: +! ErrStat = ErrID_None +! ErrMsg = "" +! +! UnEc = -1 +! Echo = .FALSE. +! call GetPath( InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. +! +! +! !call AllocAry( InputFileData%OutList, MaxOutPts, "Outlist", errStat2, errMsg2 ) +! ! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! Get an available unit number for the file. +! +! call GetNewUnit( UnIn, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! Open the Primary input file. +! +! call OpenFInpFile ( UnIn, InputFile, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! +! +! ! Read the lines up/including to the "Echo" simulation control variable +! ! If echo is FALSE, don't write these lines to the echo file. +! ! If Echo is TRUE, rewind and write on the second try. +! +! I = 1 !set the number of times we've read the file +! do +! !----------- HEADER ------------------------------------------------------------- +! +! call ReadCom( UnIn, InputFile, 'File header: Module Version (line 1)', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! call ReadStr( UnIn, InputFile, FTitle, 'FTitle', 'File Header: File Description (line 2)', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! +! !----------- GENERAL OPTIONS ---------------------------------------------------- +! +! call ReadCom( UnIn, InputFile, 'Section Header: General Options', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! ! Echo - Echo input to ".WD.ech". +! +! call ReadVar( UnIn, InputFile, Echo, 'Echo', 'Echo flag', errStat2, errMsg2, UnEc ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! +! if (.NOT. Echo .OR. I > 1) exit !exit this loop +! +! ! Otherwise, open the echo file, then rewind the input file and echo everything we've read +! +! I = I + 1 ! make sure we do this only once (increment counter that says how many times we've read this file) +! +! call OpenEcho ( UnEc, trim(OutFileRoot)//'.ech', errStat2, errMsg2, AWAE_Ver ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! if ( ErrStat >= AbortErrLev ) then +! call Cleanup() +! return +! end if +! +! if ( UnEc > 0 ) write (UnEc,'(/,A,/)') 'Data from '//trim(AWAE_Ver%Name)//' primary input file "'//trim( InputFile )//'":' +! +! rewind( UnIn, IOSTAT=errStat2 ) +! if (errStat2 /= 0_IntKi ) then +! call SetErrStat( ErrID_Fatal, 'Error rewinding file "'//trim(InputFile)//'".', ErrStat, ErrMsg, RoutineName ) +! call Cleanup() +! return +! end if +! +! end do +! +! if (NWTC_VerboseLevel == NWTC_Verbose) then +! call WrScr( ' Heading of the '//trim(AWAE_Ver%Name)//' input file: ' ) +! call WrScr( ' '//trim( FTitle ) ) +! end if +! +! +! ! DT - Time interval for Wake dynamics calculations {or default} (s): +! Line = "" +! call ReadVar( UnIn, InputFile, Line, "DT", "Time interval for Wake dynamics calculations {or default} (s)", errStat2, errMsg2, UnEc) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! +! call Conv2UC( Line ) +! if ( index(Line, "DEFAULT" ) /= 1 ) then ! If it's not "default", read this variable; otherwise use the value already stored in InputFileData%DT +! READ( Line, *, IOSTAT=IOS) InputFileData%DT +! call CheckIOS ( IOS, InputFile, 'DT', NumType, errStat2, errMsg2 ) +! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) +! end if +! +! +! +! +! +! call Cleanup ( ) +! return +! +!contains +! !............................................................................................................................... +! subroutine Cleanup() +! ! This subroutine cleans up before exiting this subroutine +! !............................................................................................................................... +! +! ! if ( UnEcho > 0 ) close( UnEcho ) +! if (UnIn > 0) close ( UnIn ) +! +! end subroutine Cleanup +! +!end subroutine ReadWDInputFile + + + +subroutine AWAE_Dvr_Tests(pMod, errStat, errMsg) + integer(IntKi), intent(out) :: pMod !< Flag indicating parallel code mode [0=serial code, 1=parallel code] + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + +end subroutine AWAE_Dvr_Tests + + + + +subroutine AWAE_Dvr_Init( AWAE_InitInp, AWAE_InitOut, AWAE_u,AWAE_p, AWAE_xd, AWAE_y, errStat, errMsg) + + type(AWAE_InitInputType), intent( out) :: AWAE_InitInp !< Input data for initialization routine + type(AWAE_InitOutputType), intent( out) :: AWAE_InitOut !< Input data for initialization routine + type(AWAE_InputType), intent( out) :: AWAE_u !< Input data for initialization routine + type(AWAE_ParameterType), intent( out) :: AWAE_p !< Input data for initialization routine + type(AWAE_DiscreteStateType), intent( out) :: AWAE_xd !< Input data for initialization routine + type(AWAE_OutputType), intent( out) :: AWAE_y !< Input data for initialization routine + + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + ! Local variables + TYPE(ProgDesc), PARAMETER :: version = ProgDesc( 'AWAE_Dvr', 'v0.02', '25-May-2017') ! The name, version, and date of AirfoilInfo. + character(*), parameter :: RoutineName = 'AWAE_Dvr_Init' + character(1024) :: OutFileRoot !< The rootname of the echo file, possibly opened in this routine + integer(IntKi) :: errStat2 ! local status of error message + character(ErrMsgLen) :: errMsg2 ! local error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! loop counter + character(1024) :: inputFile ! String to hold the driver input file name. + character(1024) :: AWAE_InputFile ! String to hold the WakeDynamics input file name. + real(DbKi) :: interval ! Default timestep size + + character(1024) :: Rootname + integer(IntKi) :: Unecho + + Unecho = 0 + Rootname = "Test" + + ! Initialize the library which handle file echos and WrScr, for example + call NWTC_Init() + + ! Display the copyright notice + CAlL DispCopyrightLicense( version ) + + ! Tell our users what they're running + call WrScr( ' Running '//GetNVD( version )//NewLine//' linked with '//trim( GetNVD( NWTC_Ver ))//NewLine ) + + inputFile = "" ! initialize to empty string to make sure it's input from the command line + call CheckArgs( inputFile, ErrStat2 ) + if (len_trim(inputFile) == 0) then ! no input file was specified + call SetErrStat(ErrID_Fatal, 'The required input file was not specified on the command line.', ErrStat, ErrMsg, RoutineName) + + if (BITS_IN_ADDR==32) then + call NWTC_DisplaySyntax( inputFile, 'AWAE_Driver_Win32.exe' ) + elseif( BITS_IN_ADDR == 64) then + call NWTC_DisplaySyntax( inputFile, 'AWAE_Driver_x64.exe' ) + else + call NWTC_DisplaySyntax( inputFile, 'AWAE_Driver.exe' ) + end if + + return + end if + + ! Read the driver input file, and populate some of the data for both the driver and the WD module + !call ReadAWAE_DvrInputFile( inputFile, AWAE_InitInp, interval, RootName, UnEcho, errStat2, errMsg2 ) + + + ! ! Read the primary WakeDynamics input file + !call ReadWDInputFile( AWAE_InputFile, AWAE_InitInp, interval, RootName, UnEcho, errStat2, errMsg2 ) + ! call SetErrStat( errStat2, errMsg2, ErrStat, ErrMsg, RoutineName ) + ! if (ErrStat >= AbortErrLev) then + ! call Cleanup() + ! return + ! end if + +end subroutine AWAE_Dvr_Init + + + + +end module AWAE_Driver_Subs + \ No newline at end of file diff --git a/modules/awae/src/AWAE_IO.f90 b/modules/awae/src/AWAE_IO.f90 new file mode 100644 index 0000000000..2f9645adcc --- /dev/null +++ b/modules/awae/src/AWAE_IO.f90 @@ -0,0 +1,554 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2015-2016 National Renewable Energy Laboratory +! +! This file is part of Ambient Wind and Array Effects model for FAST.Farm. +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +! File last committed: $Date$ +! (File) Revision #: $Rev$ +! URL: $HeadURL$ +!********************************************************************************************************************************** +MODULE AWAE_IO + + use NWTC_Library + use AWAE_Types + + + implicit none + + type(ProgDesc), parameter :: AWAE_Ver = ProgDesc( 'AWAE', '', '' ) + character(*), parameter :: AWAE_Nickname = 'AWAE' + + public :: AWAE_IO_InitGridInfo + public :: ReadLowResWindFile + + contains + +subroutine HiResWindCheck(n, nt, nX, nY, nZ, dX, dY, dZ, X0, Y0, Z0, dims, gridSpacing, origin, callingRoutine, errMsg, errStat) + integer(IntKi), intent(in ) :: n !< high-resolution time step number (0-based) + integer(IntKi), intent(in ) :: nt !< turbine number + integer(IntKi), intent(in ) :: nX !< number of grid points in the X-direction for turbine 1 at high-res time step 0 + integer(IntKi), intent(in ) :: nY !< number of grid points in the Y-direction for turbine 1 at high-res time step 0 + integer(IntKi), intent(in ) :: nZ !< number of grid points in the Z-direction for turbine 1 at high-res time step 0 + real(ReKi), intent(in ) :: dX !< space between grid points in the X-direction for turbine 1 at high-res time step 0 + real(ReKi), intent(in ) :: dY !< space between grid points in the Y-direction for turbine 1 at high-res time step 0 + real(ReKi), intent(in ) :: dZ !< space between grid points in the Z-direction for turbine 1 at high-res time step 0 + real(ReKi), intent(in ) :: X0 !< starting X-location of the grid for turbine 1 at high-res time step 0 (m) + real(ReKi), intent(in ) :: Y0 !< starting Y-location of the grid for turbine 1 at high-res time step 0 (m) + real(ReKi), intent(in ) :: Z0 !< starting Z-location of the grid for turbine 1 at high-res time step 0 (m) + integer(IntKi), intent(in ) :: dims(3) !< dimensions of the grid for turbine nt at high-res time step n (m) + real(ReKi), intent(in ) :: gridSpacing(3) !< spacing between grid points for turbine nt at high-res time step n (m) + real(ReKi), intent(in ) :: origin(3) !< starting coordinates of the grid for turbine nt at high-res time step n (m) + character(*), intent(in ) :: callingRoutine !< string containing the name of the calling routine. + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + ! grid must have two points in each direction + if ( (dims(1) < 2) .or. (dims(2) < 2) .or. (dims(3) < 2) ) then + call SetErrStat ( ErrID_Fatal, 'The high resolution grid dimensions must contain a minimum of 2 nodes in each spatial direction. Turbine #'//trim(num2lstr(nt))//', time step '//trim(num2lstr(n)), errStat, errMsg, callingRoutine ) + return + end if + + ! All turbines and all time steps must have the same grid dimensions due to array allocation assumptions + if ( ( dims(1) .ne. nX ) .or. ( dims(2) .ne. nY ) .or. ( dims(3) .ne. nZ ) ) then + call SetErrStat ( ErrID_Fatal, 'The high resolution grid dimensions for turbine #'//trim(num2lstr(nt))//' and high-res time step '//trim(num2lstr(n))//' do not match turbine #1 and time step 0.', errStat, errMsg, callingRoutine ) + return + end if + + ! spacing must be consistent for a given turbine across all time steps + if ( ( gridSpacing(1) .ne. dX ) .or. ( gridSpacing(2) .ne. dY ) .or. ( gridSpacing(3) .ne. dZ ) ) then + call SetErrStat ( ErrID_Fatal, 'The high resolution grid spacing for turbine #'//trim(num2lstr(nt))//' and high-res time step '//trim(num2lstr(n))//' do not match time step 0.', errStat, errMsg, callingRoutine ) + return + end if + + ! verify origin of any given turbine is not changing with time step. + if ( ( origin(1) .ne. X0 ) .or. ( origin(2) .ne. Y0 ) .or. ( origin(3) .ne. Z0 ) ) then + call SetErrStat ( ErrID_Fatal, 'The high resolution grid origin for turbine #'//trim(num2lstr(nt))//' and high-res time step '//trim(num2lstr(n))//' do not match time step 0.', errStat, errMsg, callingRoutine ) + return + end if + +end subroutine HiResWindCheck + +subroutine WriteDisWindFiles( n, WrDisSkp1, p, y, m, errStat, errMsg ) + integer(IntKi), intent(in ) :: n !< Low-resolution time step increment + integer(IntKi), intent(in ) :: WrDisSkp1 !< Number of low resolution time step increments per one output increment + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + type(AWAE_OutputType), intent(in ) :: y !< Outputs + type(AWAE_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + CHARACTER(1024) :: FileName + INTEGER(IntKi) :: Un ! unit number of opened file + INTEGER(IntKi) :: ErrStat2 ! Temporary Error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message + CHARACTER(*), PARAMETER :: RoutineName = 'WriteDisWindFiles' + INTEGER(IntKi) :: nt, n_out + REAL(ReKi) :: t_out + character(p%VTK_tWidth) :: Tstr ! string for current VTK write-out step (padded with zeros) + + n_out = n/WrDisSkp1 + t_out = n*p%DT_low + + ! TimeStamp + write(Tstr, '(i' // trim(Num2LStr(p%VTK_tWidth)) //'.'// trim(Num2LStr(p%VTK_tWidth)) // ')') n_out ! TODO use n instead.. + + FileName = trim(p%OutFileVTKRoot)//".Low.Dis."//trim(Tstr)//".vtk" + call WrVTK_SP_header( FileName, "Low resolution disturbed wind for time = "//trim(num2lstr(t_out))//" seconds.", Un, errStat2, errMsg2 ) + call SetErrStat(errStat2, errMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call WrVTK_SP_vectors3D( Un, "Velocity", (/p%nX_low,p%nY_low,p%nZ_low/), (/p%X0_low,p%Y0_low,p%Z0_low/), (/p%dX_low,p%dY_low,p%dZ_low/), m%Vdist_low, errStat2, errMsg2 ) + call SetErrStat(errStat2, errMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + do nt= 1,p%NumTurbines + ! We are only writing out the first of the high res data for a given low res time step + + FileName = trim(p%OutFileVTKRoot)//".HighT"//trim(num2lstr(nt))//".Dis."//trim(Tstr)//".vtk" + call WrVTK_SP_header( FileName, "High resolution disturbed wind for time = "//trim(num2lstr(t_out))//" seconds.", Un, errStat2, errMsg2 ) + call SetErrStat(errStat2, errMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + call WrVTK_SP_vectors3D( Un, "Velocity", (/p%nX_high,p%nY_high,p%nZ_high/), (/p%X0_high(nt),p%Y0_high(nt),p%Z0_high(nt)/), (/p%dX_high(nt),p%dY_high(nt),p%dZ_high(nt)/), y%Vdist_high(nt)%data(:,:,:,:,0), errStat2, errMsg2 ) + call SetErrStat(ErrStat2, errMsg2, ErrStat, ErrMsg, RoutineName) + if (ErrStat >= AbortErrLev) return + + end do + + +end subroutine WriteDisWindFiles + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine +!! +subroutine ReadLowResWindFile(n, p, Vamb_Low, errStat, errMsg) + integer(IntKi), intent(in ) :: n !< Current simulation timestep increment (zero-based) + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + real(SiKi), intent(inout) :: Vamb_Low(:,0:,0:,0:) !< Array which will contain the low resolution grid of ambient wind velocities + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + integer(IntKi) :: dims(3) ! dimension of the 3D grid (nX,nY,nZ) + real(ReKi) :: origin(3) ! the lower-left corner of the 3D grid (X0,Y0,Z0) + real(ReKi) :: gridSpacing(3) ! spacing between grid points in each of the 3 directions (dX,dY,dZ) + integer(IntKi) :: Un ! unit number of opened file + character(1024) :: FileName ! Name of output file + character(1024) :: descr ! Line describing the contents of the file + character(1024) :: vecLabel ! descriptor of the vector data + + errStat = ErrID_None + errMsg = "" + + FileName = trim(p%WindFilePath)//trim(PathSep)//"Low"//trim(PathSep)//"Amb.t"//trim(num2lstr(n))//".vtk" + Un = 0; ! Initialization different from -1, important to prevent file closing + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + call ReadVTK_SP_vectors( FileName, Un, dims, Vamb_Low, ErrStat, ErrMsg ) + + +!============================================================================== + + +end subroutine ReadLowResWindFile + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine +!! +subroutine ReadHighResWindFile(nt, n, p, Vamb_high, errStat, errMsg) + + integer(IntKi), intent(in ) :: nt + integer(IntKi), intent(in ) :: n !< high-res time increment + type(AWAE_ParameterType), intent(in ) :: p !< Parameters + real(SiKi), intent(inout) :: Vamb_high(:,0:,0:,0:) !< Array which will contain the low resolution grid of ambient wind velocities + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + + integer(IntKi) :: dims(3) ! dimension of the 3D grid (nX,nY,nZ) + real(ReKi) :: origin(3) ! the lower-left corner of the 3D grid (X0,Y0,Z0) + real(ReKi) :: gridSpacing(3) ! spacing between grid points in each of the 3 directions (dX,dY,dZ) + integer(IntKi) :: Un ! unit number of opened file + character(1024) :: FileName ! Name of output file + character(1024) :: descr ! Line describing the contents of the file + character(1024) :: vecLabel ! descriptor of the vector data + + errStat = ErrID_None + errMsg = "" + + FileName = trim(p%WindFilePath)//trim(PathSep)//"HighT"//trim(num2lstr(nt))//trim(PathSep)//"Amb.t"//trim(num2lstr(n))//".vtk" + Un = 0; ! Initialization different from -1, important to prevent file closing + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + call ReadVTK_SP_vectors( FileName, Un, dims, Vamb_high, ErrStat, ErrMsg ) + + +!============================================================================== + +end subroutine ReadHighResWindFile + +subroutine AWAE_IO_InitGridInfo(InitInp, p, InitOut, errStat, errMsg) + + type(AWAE_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(AWAE_ParameterType), intent(inout) :: p !< Parameters + type(AWAE_InitOutputType), intent( out) :: InitOut !< Output for initialization routine + integer(IntKi), intent( out) :: errStat + character(*), intent( out) :: errMsg + + integer(IntKi) :: NumGrid_high + integer(IntKi) :: errStat2 ! temporary error status of the operation + character(ErrMsgLen) :: errMsg2 ! temporary error message + character(*), parameter :: RoutineName = 'AWAE_IO_InitGridInfo' + integer(IntKi) :: nXYZ_low, nx_low, ny_low, nz_low, nXYZ_high, nx_high, ny_high, nz_high + integer(IntKi) :: dims(3) ! dimension of the 3D grid (nX,nY,nZ) + real(ReKi) :: origin(3) ! the lower-left corner of the 3D grid (X0,Y0,Z0) + real(ReKi) :: gridSpacing(3) ! spacing between grid points in each of the 3 directions (dX,dY,dZ) + character(1024) :: FileName ! Name of output file + character(1024) :: descr ! Line describing the contents of the file + character(1024) :: vecLabel ! descriptor of the vector data + integer(IntKi) :: Un ! file unit + integer(IntKi) :: n, nt, nh, n_high_low, nhigh + + + errStat = ErrID_None + errMsg = "" + + + !--------------------------------------------------------------------------- + ! Parse time 0.0, low res wind input file to gather the grid + ! information and set data associated with the low res grid + !--------------------------------------------------------------------------- + + if ( p%Mod_AmbWind == 1 ) then + FileName = trim(p%WindFilePath)//trim(PathSep)//"Low"//trim(PathSep)//"Amb.t0.vtk" + Un = -1 ! Set to force closing of file on return + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + + if ( (dims(1) < 2) .or. (dims(2) < 2) .or. (dims(3) < 2) ) then + call SetErrStat ( ErrID_Fatal, 'The low resolution grid dimensions most contain a minimum of 2 nodes in each spatial direction.', errStat, errMsg, RoutineName ) + return + end if + else + ! Using InflowWind, so data has been passed in via the InitInp data structure + origin(1) = InitInp%InputFileData%X0_low + origin(2) = InitInp%InputFileData%Y0_low + origin(3) = InitInp%InputFileData%Z0_low + dims(1) = InitInp%InputFileData%nX_low + dims(2) = InitInp%InputFileData%nY_low + dims(3) = InitInp%InputFileData%nZ_low + gridSpacing(1) = InitInp%InputFileData%dX_low + gridSpacing(2) = InitInp%InputFileData%dY_low + gridSpacing(3) = InitInp%InputFileData%dZ_low + + end if + + if ( (gridSpacing(1) <= 0.0_ReKi) .or. (gridSpacing(2) <= 0.0_ReKi) .or. (gridSpacing(3) <= 0.0_ReKi) ) & + call SetErrStat ( ErrID_Fatal, 'The low resolution spatial resolution for Turbine 1 must be greater than zero in each spatial direction. ', errStat, errMsg, RoutineName ) + + p%X0_low = origin(1) + p%Y0_low = origin(2) + p%Z0_low = origin(3) + p%nX_low = dims(1) + p%nY_low = dims(2) + p%nZ_low = dims(3) + p%dX_low = gridSpacing(1) + p%dY_low = gridSpacing(2) + p%dZ_low = gridSpacing(3) + + InitOut%X0_Low = origin(1) + InitOut%Y0_low = origin(2) + InitOut%Z0_low = origin(3) + InitOut%nX_Low = dims(1) + InitOut%nY_low = dims(2) + InitOut%nZ_low = dims(3) + InitOut%dX_low = gridSpacing(1) + InitOut%dY_low = gridSpacing(2) + InitOut%dZ_low = gridSpacing(3) + + p%NumGrid_low = p%nX_Low*p%nY_Low*p%nZ_Low + + p%dXYZ_Low = gridSpacing + p%dpol = (gridSpacing(1)+gridSpacing(2)+gridSpacing(3))/3.0_ReKi + p%n_rp_max = ceiling(pi*((p%C_Meander*(p%r(p%NumRadii-1)+p%dpol))/p%dpol)**2.0_ReKi) + ! Grid runs from (X0_low, Y0_low, Z0_low) to (X0_low + (p%nX_Low-1)*dX_low, Y0_low+ (p%nY_Low-1)*dY_low, Z0_low+ (p%nZ_Low-1)*dZ_low) + ! (0,0,0) to (180,180,180) + + + allocate( p%Grid_low(3,p%NumGrid_low),stat=errStat2) + if (errStat2 /= 0) then + call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for Grid_low.', errStat, errMsg, RoutineName ) + return + end if + + nXYZ_low = 0 + do nz_low=0, p%nZ_low-1 + do ny_low=0, p%nY_low-1 + do nx_low=0, p%nX_low-1 + nXYZ_low = nXYZ_low + 1 + p%Grid_low(1,nXYZ_low) = origin(1) + nx_low*gridSpacing(1) + p%Grid_low(2,nXYZ_low) = origin(2) + ny_low*gridSpacing(2) + p%Grid_low(3,nXYZ_low) = origin(3) + nz_low*gridSpacing(3) + end do + end do + end do + + if ( (InitInp%InputFileData%ChkWndFiles) .and. (p%Mod_AmbWind == 1) ) then + do n=1,p%NumDT-1 ! We have already checked the first low res time step + + FileName = trim(p%WindFilePath)//trim(PathSep)//"Low"//trim(PathSep)//"Amb.t"//trim(num2lstr(n))//".vtk" + Un = -1 ! Set to force closing of file on return + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + + ! verify dims, origin, gridSpacing match the first input file + if ( ( dims(1) .ne. p%nX_low ) .or. ( dims(2) .ne. p%nY_low ) .or. ( dims(3) .ne. p%nZ_low ) ) then + call SetErrStat ( ErrID_Fatal, 'The low resolution grid dimensions for time step '//trim(num2lstr(n))//' do not match time step 0.', errStat, errMsg, RoutineName ) + return + end if + if ( ( origin(1) .ne. InitOut%X0_Low ) .or. ( origin(2) .ne. InitOut%Y0_Low ) .or. ( origin(3) .ne. InitOut%Z0_Low ) ) then + call SetErrStat ( ErrID_Fatal, 'The low resolution grid origins for time step '//trim(num2lstr(n))//' do not match time step 0.', errStat, errMsg, RoutineName ) + return + end if + if ( ( gridSpacing(1) .ne. p%dX_low ) .or. ( gridSpacing(2) .ne. p%dY_low ) .or. ( gridSpacing(3) .ne. p%dZ_low ) ) then + call SetErrStat ( ErrID_Fatal, 'The low resolution grid spacing for time step '//trim(num2lstr(n))//' do not match time step 0.', errStat, errMsg, RoutineName ) + return + end if + + end do + end if + + + + allocate( InitOut%X0_high(p%NumTurbines), InitOut%Y0_high(p%NumTurbines), InitOut%Z0_high(p%NumTurbines), stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for InitOut origin arrays.', errStat, errMsg, RoutineName ) + allocate( InitOut%dX_high(p%NumTurbines), InitOut%dY_high(p%NumTurbines), InitOut%dZ_high(p%NumTurbines), stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for InitOut spatial increment arrays.', errStat, errMsg, RoutineName ) + allocate( p%X0_high(p%NumTurbines), p%Y0_high(p%NumTurbines), p%Z0_high(p%NumTurbines), stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for p origin arrays.', errStat, errMsg, RoutineName ) + allocate( p%dX_high(p%NumTurbines), p%dY_high(p%NumTurbines), p%dZ_high(p%NumTurbines), stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for p spatial increment arrays.', errStat, errMsg, RoutineName ) + if (ErrStat >= AbortErrLev) return + + if ( p%Mod_AmbWind == 1 ) then + + !--------------------------------------------------------------------------- + ! Parse turbine 1, 1st timestep, high res wind input file to gather the grid + ! information and set data associated with turbine 1 + !--------------------------------------------------------------------------- + + FileName = trim(p%WindFilePath)//trim(PathSep)//"HighT1"//trim(PathSep)//"Amb.t0.vtk" + Un = -1 ! Set to force closing of file on return + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, errStat, errMsg ) + if (errStat >= AbortErrLev) return + else + + ! Using InflowWind, so data has been passed in via the InitInp data structure + origin(1) = InitInp%InputFileData%X0_high(1) + origin(2) = InitInp%InputFileData%Y0_high(1) + origin(3) = InitInp%InputFileData%Z0_high(1) + dims(1) = InitInp%InputFileData%nX_high + dims(2) = InitInp%InputFileData%nY_high + dims(3) = InitInp%InputFileData%nZ_high + gridSpacing(1) = InitInp%InputFileData%dX_high(1) + gridSpacing(2) = InitInp%InputFileData%dY_high(1) + gridSpacing(3) = InitInp%InputFileData%dZ_high(1) + p%dt_high = InitInp%InputFileData%dt_high + + end if + + if ( (gridSpacing(1) <= 0.0_ReKi) .or. (gridSpacing(2) <= 0.0_ReKi) .or. (gridSpacing(3) <= 0.0_ReKi) ) & + call SetErrStat ( ErrID_Fatal, 'The high resolution spatial resolution for Turbine 1 must be greater than zero in each spatial direction. ', errStat, errMsg, RoutineName ) + + p%nX_high = dims(1) + p%nY_high = dims(2) + p%nZ_high = dims(3) + p%X0_high(1) = origin(1) + p%Y0_high(1) = origin(2) + p%Z0_high(1) = origin(3) + p%dX_high(1) = gridSpacing(1) + p%dY_high(1) = gridSpacing(2) + p%dZ_high(1) = gridSpacing(3) + NumGrid_high = p%nX_high*p%nY_high*p%nZ_high + + InitOut%X0_high(1) = origin(1) + InitOut%Y0_high(1) = origin(2) + InitOut%Z0_high(1) = origin(3) + InitOut%dX_high(1) = gridSpacing(1) + InitOut%dY_high(1) = gridSpacing(2) + InitOut%dZ_high(1) = gridSpacing(3) + + if ( p%Mod_AmbWind == 1 ) then + ! Just using this to make sure dims are >=2 points in each direction + call HiResWindCheck(0, 1, p%nX_high, p%nY_high, p%nZ_high, p%dX_high(1), p%dY_high(1), p%dZ_high(1), p%X0_high(1), p%Y0_high(1), p%Z0_high(1), dims, gridSpacing, origin, RoutineName, errMsg, errStat) + if (errStat >= AbortErrLev ) return + end if + + allocate( p%Grid_high(3,NumGrid_high,p%NumTurbines ),stat=errStat2) + if (errStat2 /= 0) then + call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for Grid_high.', errStat, errMsg, RoutineName ) + return + end if + + nXYZ_high = 0 + do nz_high=0, p%nZ_high-1 + do ny_high=0, p%nY_high-1 + do nx_high=0, p%nX_high-1 + nXYZ_high = nXYZ_high + 1 + p%Grid_high(1,nXYZ_high,1) = InitOut%X0_high(1) + nx_high*InitOut%dX_high(1) + p%Grid_high(2,nXYZ_high,1) = InitOut%Y0_high(1) + ny_high*InitOut%dY_high(1) + p%Grid_high(3,nXYZ_high,1) = InitOut%Z0_high(1) + nz_high*InitOut%dZ_high(1) + end do + end do + end do + + !--------------------------------------------------------------------------- + ! Parse the remaining turbine's 1st timestep, high res wind input files to + ! gather the grid information and set data associated with those turbines + !--------------------------------------------------------------------------- + + do nt = 2, p%NumTurbines + + if ( p%Mod_AmbWind == 1 ) then + FileName = trim(p%WindFilePath)//trim(PathSep)//"HighT"//trim(num2lstr(nt))//trim(PathSep)//"Amb.t0.vtk" + Un = -1 ! Set to force closing of file on return + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + else + ! Using InflowWind, so data has been passed in via the InitInp data structure + origin(1) = InitInp%InputFileData%X0_high(nt) + origin(2) = InitInp%InputFileData%Y0_high(nt) + origin(3) = InitInp%InputFileData%Z0_high(nt) + gridSpacing(1) = InitInp%InputFileData%dX_high(nt) + gridSpacing(2) = InitInp%InputFileData%dY_high(nt) + gridSpacing(3) = InitInp%InputFileData%dZ_high(nt) + + end if + + if ( (gridSpacing(1) <= 0.0_ReKi) .or. (gridSpacing(2) <= 0.0_ReKi) .or. (gridSpacing(3) <= 0.0_ReKi) ) & + call SetErrStat ( ErrID_Fatal, 'The high resolution spatial resolution for Turbine '//trim(num2lstr(nt))//' must be greater than zero in each spatial direction. ', errStat, errMsg, RoutineName ) + + InitOut%X0_high(nt) = origin(1) + InitOut%Y0_high(nt) = origin(2) + InitOut%Z0_high(nt) = origin(3) + + InitOut%dX_high(nt) = gridSpacing(1) + InitOut%dY_high(nt) = gridSpacing(2) + InitOut%dZ_high(nt) = gridSpacing(3) + p%X0_high(nt) = origin(1) + p%Y0_high(nt) = origin(2) + p%Z0_high(nt) = origin(3) + p%dX_high(nt) = gridSpacing(1) + p%dY_high(nt) = gridSpacing(2) + p%dZ_high(nt) = gridSpacing(3) + + if ( p%Mod_AmbWind == 1 ) then + ! Using this to make sure dims are >=2 points in each direction, and number of grid points in each direction matches turbine 1 + call HiResWindCheck(0, nt, p%nX_high, p%nY_high, p%nZ_high, p%dX_high(nt), p%dY_high(nt), p%dZ_high(nt), p%X0_high(nt), p%Y0_high(nt), p%Z0_high(nt), dims, gridSpacing, origin, RoutineName, errMsg, errStat) + if (errStat >= AbortErrLev ) return + end if + + nXYZ_high = 0 + do nz_high=0, p%nZ_high-1 + do ny_high=0, p%nY_high-1 + do nx_high=0, p%nX_high-1 + nXYZ_high = nXYZ_high + 1 + p%Grid_high(1,nXYZ_high,nt) = InitOut%X0_high(nt) + nx_high*InitOut%dX_high(nt) + p%Grid_high(2,nXYZ_high,nt) = InitOut%Y0_high(nt) + ny_high*InitOut%dY_high(nt) + p%Grid_high(3,nXYZ_high,nt) = InitOut%Z0_high(nt) + nz_high*InitOut%dZ_high(nt) + end do + end do + end do + + end do + + InitOut%nx_high = p%nx_high + InitOut%ny_high = p%ny_high + InitOut%nz_high = p%nz_high + + + if ( (InitInp%InputFileData%ChkWndFiles) .and. (p%Mod_AmbWind == 1) ) then + do nt=1,p%NumTurbines + do n=0,p%NumDT-1 ! We have already checked the first high-res files associated with n=0, but need to check the remaining, so for simplicity of code we will repeat the check on the first file + + ! We only have one high res input for for the very last low res timestep + if ( n == (p%NumDT-1) ) then + n_high_low = 1 + else + n_high_low = p%n_high_low + end if + + do nh=1,n_high_low + nhigh = nh+n*p%n_high_low-1 + FileName = trim(p%WindFilePath)//trim(PathSep)//"HighT"//trim(num2lstr(nt))//trim(PathSep)//"Amb.t"//trim(num2lstr(nhigh))//".vtk" !TODO: Should the turbine numbers be padding with leading zero(es)? + Un = -1 ! Set to force closing of file on return + call ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel, Un, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + + call HiResWindCheck(nhigh, nt, p%nX_high, p%nY_high, p%nZ_high, p%dX_high(nt), p%dY_high(nt), p%dZ_high(nt), p%X0_high(nt), p%Y0_high(nt), p%Z0_high(nt), dims, gridSpacing, origin, RoutineName, errMsg, errStat) + if (errStat >= AbortErrLev ) return + + end do + end do + end do + end if + +! End simulated read of low and high res ambient wind files +!============================================================================== + +end subroutine AWAE_IO_InitGridInfo + +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE AWAE_PrintSum( p, u, y, ErrStat, ErrMsg ) +! This routine generates the summary file, which contains a summary of input file options. + + ! passed variables + !TYPE(AWAE_InitInput), INTENT(IN) :: InputFileData ! Input-file data + type(AWAE_ParameterType), intent(in) :: p ! Parameters + type(AWAE_InputType), intent(in) :: u ! inputs + type(AWAE_OutputType), intent(in) :: y ! outputs + integer(IntKi), intent(out) :: ErrStat + character(*), intent(out) :: ErrMsg + + + ! Local variables. + + INTEGER(IntKi) :: I ! Index for the nodes. + INTEGER(IntKi) :: UnSu ! I/O unit number for the summary output file + + CHARACTER(*), PARAMETER :: FmtDat = '(A,T35,1(:,F13.3))' ! Format for outputting mass and modal data. + CHARACTER(*), PARAMETER :: FmtDatT = '(A,T35,1(:,F13.8))' ! Format for outputting time steps. + + CHARACTER(30) :: OutPFmt ! Format to print list of selected output channels to summary file + CHARACTER(100) :: Msg ! temporary string for writing appropriate text to summary file + + ! Open the summary file and give it a heading. + + CALL GetNewUnit( UnSu, ErrStat, ErrMsg ) + CALL OpenFOutFile ( UnSu, TRIM( p%OutFileRoot )//'.sum', ErrStat, ErrMsg ) + IF ( ErrStat >= AbortErrLev ) RETURN + + + + CLOSE(UnSu) + +RETURN +END SUBROUTINE AWAE_PrintSum +!---------------------------------------------------------------------------------------------------------------------------------- + + + +END MODULE AWAE_IO + diff --git a/modules/awae/src/AWAE_Registry.txt b/modules/awae/src/AWAE_Registry.txt new file mode 100644 index 0000000000..d8b236238d --- /dev/null +++ b/modules/awae/src/AWAE_Registry.txt @@ -0,0 +1,213 @@ +################################################################################################################################### +# Registry for FAST.Farm's Ambient Wind and Array Effects (AWAE) module in the FAST Modularization Framework +# This Registry file is used to create MODULE AWAE_Types, which contains all of the user-defined types needed in AWAE. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# +# Entries are of the form +# keyword +# +# Use ^ as a shortcut for the value from the previous line. +# See NWTC Programmer's Handbook at https://nwtc.nrel.gov/FAST-Developers for further information on the format/contents of this file. +################################################################################################################################### + +# ...... Include files (definitions from NWTC Library) ............................................................................ +include Registry_NWTC_Library.txt +usefrom InflowWind.txt + +# ..... Constants ....................................................................................................... +param AWAE/AWAE - INTEGER XYSlice - 1 - "Extract an XY slice of data from the 3D grid" - +param ^ - INTEGER YZSlice - 2 - "Extract an YZ slice of data from the 3D grid" - +param ^ - INTEGER XZSlice - 3 - "Extract an XZ slice of data from the 3D grid" - +param ^ - INTEGER MeanderMod_Uniform - 1 - "Spatial filter model for wake meandering: uniform" - +param ^ - INTEGER MeanderMod_TruncJinc - 2 - "Spatial filter model for wake meandering: truncated jinc" - +param ^ - INTEGER MeanderMod_WndwdJinc - 3 - "Spatial filter model for wake meandering: windowed jinc" - + +# ..... Wind 3D Data ....................................................................................................... +typedef AWAE/AWAE AWAE_HighWindGrid SiKi data {:}{:}{:}{:}{:} - - "UVW components of wind data across the high-res regularly-spaced grid" m/s +# ..... InputFile Data ....................................................................................................... +typedef AWAE/AWAE AWAE_InputFileType ReKi dr - - - "Radial increment of radial finite-difference grid [>0.0]" m +typedef ^ ^ DbKi dt_low - - - "Low-resolution (FAST.Farm driver/glue code) time step" s +typedef ^ ^ IntKi NumTurbines - - - "Number of wind turbines in the farm [>=1]" - +typedef ^ ^ IntKi NumRadii - - - "Number of radii in the radial finite-difference grid [>=2]" - +typedef ^ ^ IntKi NumPlanes - - - "Number of wake planes downwind of the rotor where the wake is propagated [>=2]" - +typedef ^ ^ CHARACTER(1024) WindFilePath - - - "Path name to the Root folder containing the wind data files from ABLSolver precursor" - +typedef ^ ^ LOGICAL WrDisWind - - - "Write disturbed wind data to /Low/Dis.t.vtk etc.?" - +typedef ^ ^ IntKi NOutDisWindXY - - - "Number of XY planes for output of disturbed wind data across the low-resolution domain to /Low/DisXY..t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutDisWindZ {:} - - "Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXY]" meters +typedef ^ ^ IntKi NOutDisWindYZ - - - "Number of YZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisYZ..t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutDisWindX {:} - - "X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindYZ]" meters +typedef ^ ^ IntKi NOutDisWindXZ - - - "Number of XZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisXZ..t.vtk [0 to 9]" - +typedef ^ ^ ReKi OutDisWindY {:} - - "Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXZ]" meters +typedef ^ ^ DbKi WrDisDT - - - "The time between vtk outputs [must be a multiple of the low resolution time step]" s +typedef ^ ^ LOGICAL ChkWndFiles - - - "Check all the ambient wind files for data consistency (flag)" - +typedef ^ ^ IntKi Mod_Meander - - - "Spatial filter model for wake meandering {1: uniform, 2: truncated jinc, 3: windowed jinc} [DEFAULT=2]" - +typedef ^ ^ ReKi C_Meander - - - "Calibrated parameter for wake meandering [>=1.0] [DEFAULT=1.9]" - +typedef ^ ^ IntKi Mod_AmbWind - - - "Ambient wind model {1: high-fidelity precursor in VTK format, 2: InflowWind module}" - +typedef ^ ^ CHARACTER(1024) InflowFile - - - "Name of file containing InflowWind module input parameters" - +typedef ^ ^ DbKi dt_high - - - "High-resolution (FAST) time step" s +typedef ^ ^ ReKi X0_high {:} - - "X-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ^ ReKi Y0_high {:} - - "Y-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ^ ReKi Z0_high {:} - - "Z-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ^ ReKi dX_high {:} - - "X-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ^ ReKi dY_high {:} - - "Y-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ^ ReKi dZ_high {:} - - "Z-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ^ IntKi nX_high - - - "Number of high-resolution spatial nodes in X direction " - +typedef ^ ^ IntKi nY_high - - - "Number of high-resolution spatial nodes in Y direction" - +typedef ^ ^ IntKi nZ_high - - - "Number of high-resolution spatial nodes in Z direction" - +typedef ^ ^ ReKi dX_low - - - "The spacing of the low-resolution nodes in X direction" m +typedef ^ ^ ReKi dY_low - - - "The spacing of the low-resolution nodes in Y direction" m +typedef ^ ^ ReKi dZ_low - - - "The spacing of the low-resolution nodes in Z direction" m +typedef ^ ^ IntKi nX_low - - - "Number of low-resolution spatial nodes in X direction" - +typedef ^ ^ IntKi nY_low - - - "Number of low-resolution spatial nodes in Y direction" - +typedef ^ ^ IntKi nZ_low - - - "Number of low-resolution spatial nodes in Z direction" - +typedef ^ ^ ReKi X0_low - - - "X-component of the origin of the low-resolution spatial domain" m +typedef ^ ^ ReKi Y0_low - - - "Y-component of the origin of the low-resolution spatial domain" m +typedef ^ ^ ReKi Z0_low - - - "Z-component of the origin of the low-resolution spatial domain" m +typedef ^ ^ ReKi WT_Position {:}{:} - - "X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number" meters + +# ..... Initialization data ....................................................................................................... +# Define inputs that the initialization routine may need here: +# e.g., the name of the input file, the file root name, etc. +typedef ^ InitInputType AWAE_InputFileType InputFileData - - - "FAST.Farm input-file data for AWAE module" - +typedef ^ InitInputType IntKi n_high_low - - - "Number of high-resolution time steps per low" - +typedef ^ InitInputType IntKi NumDT - - - "Number of low-resolution (FAST.Farm driver/glue code) time steps" - +typedef ^ InitInputType CHARACTER(1024) OutFileRoot - - - "The root name derived from the primary FAST.Farm input file" - + + +# Define outputs from the initialization routine here: +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" - +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - +typedef ^ InitOutputType ReKi X0_high {:} - - "X-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType ReKi Y0_high {:} - - "Y-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType ReKi Z0_high {:} - - "Z-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType ReKi dX_high {:} - - "X-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType ReKi dY_high {:} - - "Y-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType ReKi dZ_high {:} - - "Z-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ InitOutputType IntKi nX_high - - - "Number of high-resolution spatial nodes in X direction " - +typedef ^ InitOutputType IntKi nY_high - - - "Number of high-resolution spatial nodes in Y direction" - +typedef ^ InitOutputType IntKi nZ_high - - - "Number of high-resolution spatial nodes in Z direction" - +typedef ^ InitOutputType ReKi dX_low - - - "The spacing of the low-resolution nodes in X direction" m +typedef ^ InitOutputType ReKi dY_low - - - "The spacing of the low-resolution nodes in Y direction" m +typedef ^ InitOutputType ReKi dZ_low - - - "The spacing of the low-resolution nodes in Z direction" m +typedef ^ InitOutputType IntKi nX_low - - - "Number of low-resolution spatial nodes in X direction" - +typedef ^ InitOutputType IntKi nY_low - - - "Number of low-resolution spatial nodes in Y direction" - +typedef ^ InitOutputType IntKi nZ_low - - - "Number of low-resolution spatial nodes in Z direction" - +typedef ^ InitOutputType ReKi X0_low - - - "X-component of the origin of the low-resolution spatial domain" m +typedef ^ InitOutputType ReKi Y0_low - - - "Y-component of the origin of the low-resolution spatial domain" m +typedef ^ InitOutputType ReKi Z0_low - - - "Z-component of the origin of the low-resolution spatial domain" m + +# ..... States .................................................................................................................... +# Define continuous (differentiable) states here: +typedef ^ ContinuousStateType InflowWind_ContinuousStateType IfW {:} - - "Dummy IfW continuous states" - + +# Define discrete (nondifferentiable) states here: +typedef ^ DiscreteStateType InflowWind_DiscreteStateType IfW {:} - - "Dummy IfW discrete states" - + +# Define constraint states here: +typedef ^ ConstraintStateType InflowWind_ConstraintStateType IfW {:} - - "Dummy IfW constraint states" - + +# Define any other states, including integer or logical states here: +typedef ^ OtherStateType InflowWind_OtherStateType IfW {:} - - "Dummy IfW other states" - + +# ..... Misc/Optimization variables................................................................................................. +# Define any data that are used only for efficiency purposes (these variables are not associated with time): +# e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc. +typedef ^ MiscVarType SiKi Vamb_low {:}{:}{:}{:} - - "UVW components of ambient wind across the low-resolution domain throughout the farm" m/s +typedef ^ MiscVarType ReKi Vamb_lowpol {:}{:} - - "UVW components of disturbed wind (ambient + wakes) at points in the polar grid for each wake plane for each turbine" m/s +typedef ^ MiscVarType SiKi Vdist_low {:}{:}{:}{:} - - "UVW components of disturbed wind (ambient + deficits) across the low-resolution domain throughout the farm" m/s +typedef ^ MiscVarType AWAE_HighWindGrid Vamb_High {:} - - "UVW components of ambient wind across each high-resolution domain around a turbine (one for each turbine) for each high-resolution time step within a low-resolution time step" m/s +typedef ^ MiscVarType ReKi xhat_plane {:}{:} - - "Orientations of wake planes, normal to wake planes, associated with a given point in the wind spatial domain Orientations of wake planes, normal to wake planes, associated with a given point in the wind spatial domain" - +typedef ^ MiscVarType ReKi rhat_plane {:}{:} - - "" - +typedef ^ MiscVarType Logical parallelFlag {:}{:} - - "" - +typedef ^ MiscVarType ReKi r_s {:}{:} - - "" - +typedef ^ MiscVarType ReKi r_e {:}{:} - - "" - +typedef ^ MiscVarType ReKi rhat_s {:}{:}{:} - - "" - +typedef ^ MiscVarType ReKi rhat_e {:}{:}{:} - - "" - +typedef ^ MiscVarType ReKi pvec_cs {:}{:}{:} - - "" - +typedef ^ MiscVarType ReKi pvec_ce {:}{:}{:} - - "" - +typedef ^ MiscVarType ReKi Vx_wake {:} - - "" m/s +typedef ^ MiscVarType ReKi Vr_wake {:} - - "" m/s +typedef ^ MiscVarType SiKi outVizXYPlane {:}{:}{:}{:} -- "An array holding the output data for a 2D visualization slice" - +typedef ^ MiscVarType SiKi outVizYZPlane {:}{:}{:}{:} -- "An array holding the output data for a 2D visualization slice" - +typedef ^ MiscVarType SiKi outVizXZPlane {:}{:}{:}{:} -- "An array holding the output data for a 2D visualization slice" - +typedef ^ MiscVarType InflowWind_MiscVarType IfW {:} - - "InflowWind module misc vars" +typedef ^ MiscVarType InflowWind_InputType u_IfW_Low - - - "InflowWind module inputs for the low-resolution grid" +typedef ^ MiscVarType InflowWind_InputType u_IfW_High - - - "InflowWind module inputs for the high-resolution grid" +typedef ^ MiscVarType InflowWind_OutputType y_IfW_Low - - - "InflowWind module outputs for the low-resolution grid" +typedef ^ MiscVarType InflowWind_OutputType y_IfW_High - - - "InflowWind module outputs for the high-resolution grid" + +# ..... Parameters ................................................................................................................ +# Define parameters here: +# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: +typedef ^ ParameterType CHARACTER(1024) WindFilePath - - - "Path name to the Root folder containing the wind data files from ABLSolver precursor" - +typedef ^ ParameterType IntKi NumTurbines - - - "Number of wind turbines in the farm [>=1]" - +typedef ^ ParameterType IntKi NumRadii - - - "Number of radii in the radial finite-difference grid [>=2]" - +typedef ^ ParameterType IntKi NumPlanes - - - "Number of wake planes downwind of the rotor where the wake is propagated [>=2]" - +typedef ^ ParameterType ReKi r {:} - - "Discretization of radial finite-difference grid" m +typedef ^ ^ IntKi Mod_AmbWind - - - "Ambient wind model {1: high-fidelity precursor in VTK format, 2: InflowWind module}" - +typedef ^ ParameterType IntKi nX_low - - - "Number of low-resolution spatial nodes in X direction" - +typedef ^ ParameterType IntKi nY_low - - - "Number of low-resolution spatial nodes in Y direction" - +typedef ^ ParameterType IntKi nZ_low - - - "Number of low-resolution spatial nodes in Z direction" - +typedef ^ ParameterType IntKi NumGrid_low - - - "Total number of low-resolution spatial nodes" - +typedef ^ ParameterType IntKi n_rp_max - - - "Maximum possible number of points in the polar grid for the wake plane at each rotor" - +typedef ^ ParameterTYpe ReKi dpol - - - "Spatial resolution of the polar grid for each wake plane of each turbine" m +typedef ^ ParameterType ReKi dXYZ_low {3} - - "XYZ-components of the spatial increment of the low-resolution domain" m +typedef ^ ParameterType ReKi dX_low - - - "The spacing of the low-resolution nodes in X direction" m +typedef ^ ParameterType ReKi dY_low - - - "The spacing of the low-resolution nodes in Y direction" m +typedef ^ ParameterType ReKi dZ_low - - - "The spacing of the low-resolution nodes in Z direction" m +typedef ^ ParameterType ReKi X0_low - - - "X-component of the origin of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi Y0_low - - - "Y-component of the origin of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi Z0_low - - - "Z-component of the origin of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi X0_high {:} - - "X-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType ReKi Y0_high {:} - - "Y-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType ReKi Z0_high {:} - - "Z-component of the origin of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType ReKi dX_high {:} - - "X-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType ReKi dY_high {:} - - "Y-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType ReKi dZ_high {:} - - "Z-component of the spatial increment of the high-resolution spatial domain for each turbine" m +typedef ^ ParameterType IntKi nX_high - - - "Number of high-resolution spatial nodes in X direction " - +typedef ^ ParameterType IntKi nY_high - - - "Number of high-resolution spatial nodes in Y direction" - +typedef ^ ParameterType IntKi nZ_high - - - "Number of high-resolution spatial nodes in Z direction" - +typedef ^ ParameterType ReKi Grid_low {:}{:} - - "XYZ components (global positions) of the spatial discretization of the low-resolution spatial domain" m +typedef ^ ParameterType ReKi Grid_high {:}{:}{:} - - "XYZ components (global positions) of the spatial discretization of the high-resolution spatial domain for each turbine " m +typedef ^ ParameterType ReKi WT_Position {:}{:} - - "X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number" meters +typedef ^ ParameterType IntKi n_high_low - - - "Number of high-resolution time steps per low" - +typedef ^ ParameterType DbKi dt_low - - - "Low-resolution (FAST.Farm driver/glue code) time step" s +typedef ^ ParameterType DbKi dt_high - - - "High-resolution (FAST) time step" s +typedef ^ ParameterType IntKi NumDT - - - "Number of low-resolution (FAST.Farm driver/glue code) time steps" - +typedef ^ ParameterType IntKi Mod_Meander - - - "Spatial filter model for wake meandering" - +typedef ^ ParameterType ReKi C_Meander - - - "Calibrated parameter for wake meandering" - +typedef ^ ParameterType ReKi C_ScaleDiam - - - "Normalized wake volume radius for wake meandering (normalized by the wake diameter)" - +typedef ^ ParameterType InflowWind_ParameterType IfW {:} - - "InflowWind module parameters" - +# parameters for output +#typedef ^ ParameterType IntKi NumOuts - - - "Number of parameters in the output list (number of outputs requested)" - +typedef ^ ParameterType IntKi WrDisSkp1 - - - "Number of time steps to skip plus one" - +typedef ^ ParameterType LOGICAL WrDisWind - - - "Write disturbed wind data to /Low/Dis.t.vtk etc.?" - +typedef ^ ParameterType IntKi NOutDisWindXY - - - "Number of XY planes for output of disturbed wind data across the low-resolution domain to /Low/DisXY..t.vtk [0 to 9]" - +typedef ^ ParameterType ReKi OutDisWindZ {:} - - "Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXY]" meters +typedef ^ ParameterType IntKi NOutDisWindYZ - - - "Number of YZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisYZ..t.vtk [0 to 9]" - +typedef ^ ParameterType ReKi OutDisWindX {:} - - "X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindYZ]" meters +typedef ^ ParameterType IntKi NOutDisWindXZ - - - "Number of XZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisXZ..t.vtk [0 to 9]" - +typedef ^ ParameterType ReKi OutDisWindY {:} - - "Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXZ]" meters +typedef ^ ParameterType CHARACTER(1024) OutFileRoot - - - "The root name derived from the primary FAST.Farm input file" - +typedef ^ ParameterType CHARACTER(1024) OutFileVTKRoot - - - "The root name for VTK outputs" - +typedef ^ ParameterType IntKi VTK_tWidth - - - "Number of characters for VTK timestamp outputs" - +#typedef ^ ParameterType OutParmType OutParam {:} - - "Names and units (and other characteristics) of all requested output parameters" - + + +# ..... Outputs .................................................................................................................... +# Define outputs that are contained on the mesh here: +typedef ^ OutputType AWAE_HighWindGrid Vdist_High {:} - - "Wind velocity of disturbed wind (ambient + wakes) across each high-resolution domain around a turbine for each high-resolution step within a low-resolution step" m/s +typedef ^ OutputType ReKi V_plane {:}{:}{:} - - "Advection, deflection, and meandering velocity of wake planes for each turbine" m/s +typedef ^ OutputType ReKi TI_amb {:} - - "Ambient turbulence intensity of wind at rotor disk for each turbine" - +typedef ^ OutputType ReKi Vx_wind_disk {:} - - "Rotor-disk-averaged ambient wind speed, normal to disk, for each turbine" m/s + + +# ..... Inputs ........................................................................................................... +# Define inputs that are contained on the mesh here: +typedef ^ InputType ReKi xhat_plane {:}{:}{:} - - "Orientations of wake planes, normal to wake planes, for each turbine" - +typedef ^ InputType ReKi p_plane {:}{:}{:} - - "Center positions of wake planes for each turbine" m +typedef ^ InputType ReKi Vx_wake {:}{:}{:} - - "Axial wake velocity deficit at wake planes, distributed radially, for each turbine" m/s +typedef ^ InputType ReKi Vr_wake {:}{:}{:} - - "Radial wake velocity deficit at wake planes, distributed radially, for each turbine" m/s +typedef ^ InputType ReKi D_wake {:}{:} - - "Wake diameters at wake planes for each turbine" m + diff --git a/modules/awae/src/AWAE_Types.f90 b/modules/awae/src/AWAE_Types.f90 new file mode 100644 index 0000000000..903027b464 --- /dev/null +++ b/modules/awae/src/AWAE_Types.f90 @@ -0,0 +1,7420 @@ +!STARTOFREGISTRYGENERATEDFILE 'AWAE_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! AWAE_Types +!................................................................................................................................. +! This file is part of AWAE. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in AWAE. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE AWAE_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE IfW_UniformWind_Types +USE IfW_FFWind_Base_Types +USE IfW_TSFFWind_Types +USE IfW_BladedFFWind_Types +USE IfW_HAWCWind_Types +USE IfW_UserWind_Types +USE IfW_4Dext_Types +USE Lidar_Types +USE InflowWind_Types +USE NWTC_Library +IMPLICIT NONE + INTEGER(IntKi), PUBLIC, PARAMETER :: XYSlice = 1 ! Extract an XY slice of data from the 3D grid [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: YZSlice = 2 ! Extract an YZ slice of data from the 3D grid [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: XZSlice = 3 ! Extract an XZ slice of data from the 3D grid [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: MeanderMod_Uniform = 1 ! Spatial filter model for wake meandering: uniform [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: MeanderMod_TruncJinc = 2 ! Spatial filter model for wake meandering: truncated jinc [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: MeanderMod_WndwdJinc = 3 ! Spatial filter model for wake meandering: windowed jinc [-] +! ========= AWAE_HighWindGrid ======= + TYPE, PUBLIC :: AWAE_HighWindGrid + REAL(SiKi) , DIMENSION(:,:,:,:,:), ALLOCATABLE :: data !< UVW components of wind data across the high-res regularly-spaced grid [m/s] + END TYPE AWAE_HighWindGrid +! ======================= +! ========= AWAE_InputFileType ======= + TYPE, PUBLIC :: AWAE_InputFileType + REAL(ReKi) :: dr !< Radial increment of radial finite-difference grid [>0.0] [m] + REAL(DbKi) :: dt_low !< Low-resolution (FAST.Farm driver/glue code) time step [s] + INTEGER(IntKi) :: NumTurbines !< Number of wind turbines in the farm [>=1] [-] + INTEGER(IntKi) :: NumRadii !< Number of radii in the radial finite-difference grid [>=2] [-] + INTEGER(IntKi) :: NumPlanes !< Number of wake planes downwind of the rotor where the wake is propagated [>=2] [-] + CHARACTER(1024) :: WindFilePath !< Path name to the Root folder containing the wind data files from ABLSolver precursor [-] + LOGICAL :: WrDisWind !< Write disturbed wind data to /Low/Dis.t.vtk etc.? [-] + INTEGER(IntKi) :: NOutDisWindXY !< Number of XY planes for output of disturbed wind data across the low-resolution domain to /Low/DisXY..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindZ !< Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXY] [meters] + INTEGER(IntKi) :: NOutDisWindYZ !< Number of YZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisYZ..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindX !< X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindYZ] [meters] + INTEGER(IntKi) :: NOutDisWindXZ !< Number of XZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisXZ..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindY !< Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXZ] [meters] + REAL(DbKi) :: WrDisDT !< The time between vtk outputs [must be a multiple of the low resolution time step] [s] + LOGICAL :: ChkWndFiles !< Check all the ambient wind files for data consistency (flag) [-] + INTEGER(IntKi) :: Mod_Meander !< Spatial filter model for wake meandering {1: uniform, 2: truncated jinc, 3: windowed jinc} [DEFAULT=2] [-] + REAL(ReKi) :: C_Meander !< Calibrated parameter for wake meandering [>=1.0] [DEFAULT=1.9] [-] + INTEGER(IntKi) :: Mod_AmbWind !< Ambient wind model {1: high-fidelity precursor in VTK format, 2: InflowWind module} [-] + CHARACTER(1024) :: InflowFile !< Name of file containing InflowWind module input parameters [-] + REAL(DbKi) :: dt_high !< High-resolution (FAST) time step [s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: X0_high !< X-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Y0_high !< Y-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Z0_high !< Z-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dX_high !< X-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dY_high !< Y-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dZ_high !< Z-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + INTEGER(IntKi) :: nX_high !< Number of high-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_high !< Number of high-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_high !< Number of high-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: dX_low !< The spacing of the low-resolution nodes in X direction [m] + REAL(ReKi) :: dY_low !< The spacing of the low-resolution nodes in Y direction [m] + REAL(ReKi) :: dZ_low !< The spacing of the low-resolution nodes in Z direction [m] + INTEGER(IntKi) :: nX_low !< Number of low-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_low !< Number of low-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_low !< Number of low-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: X0_low !< X-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Y0_low !< Y-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Z0_low !< Z-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WT_Position !< X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number [meters] + END TYPE AWAE_InputFileType +! ======================= +! ========= AWAE_InitInputType ======= + TYPE, PUBLIC :: AWAE_InitInputType + TYPE(AWAE_InputFileType) :: InputFileData !< FAST.Farm input-file data for AWAE module [-] + INTEGER(IntKi) :: n_high_low !< Number of high-resolution time steps per low [-] + INTEGER(IntKi) :: NumDT !< Number of low-resolution (FAST.Farm driver/glue code) time steps [-] + CHARACTER(1024) :: OutFileRoot !< The root name derived from the primary FAST.Farm input file [-] + END TYPE AWAE_InitInputType +! ======================= +! ========= AWAE_InitOutputType ======= + TYPE, PUBLIC :: AWAE_InitOutputType + TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: X0_high !< X-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Y0_high !< Y-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Z0_high !< Z-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dX_high !< X-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dY_high !< Y-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dZ_high !< Z-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + INTEGER(IntKi) :: nX_high !< Number of high-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_high !< Number of high-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_high !< Number of high-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: dX_low !< The spacing of the low-resolution nodes in X direction [m] + REAL(ReKi) :: dY_low !< The spacing of the low-resolution nodes in Y direction [m] + REAL(ReKi) :: dZ_low !< The spacing of the low-resolution nodes in Z direction [m] + INTEGER(IntKi) :: nX_low !< Number of low-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_low !< Number of low-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_low !< Number of low-resolution spatial nodes in Z direction [-] + REAL(ReKi) :: X0_low !< X-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Y0_low !< Y-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Z0_low !< Z-component of the origin of the low-resolution spatial domain [m] + END TYPE AWAE_InitOutputType +! ======================= +! ========= AWAE_ContinuousStateType ======= + TYPE, PUBLIC :: AWAE_ContinuousStateType + TYPE(InflowWind_ContinuousStateType) , DIMENSION(:), ALLOCATABLE :: IfW !< Dummy IfW continuous states [-] + END TYPE AWAE_ContinuousStateType +! ======================= +! ========= AWAE_DiscreteStateType ======= + TYPE, PUBLIC :: AWAE_DiscreteStateType + TYPE(InflowWind_DiscreteStateType) , DIMENSION(:), ALLOCATABLE :: IfW !< Dummy IfW discrete states [-] + END TYPE AWAE_DiscreteStateType +! ======================= +! ========= AWAE_ConstraintStateType ======= + TYPE, PUBLIC :: AWAE_ConstraintStateType + TYPE(InflowWind_ConstraintStateType) , DIMENSION(:), ALLOCATABLE :: IfW !< Dummy IfW constraint states [-] + END TYPE AWAE_ConstraintStateType +! ======================= +! ========= AWAE_OtherStateType ======= + TYPE, PUBLIC :: AWAE_OtherStateType + TYPE(InflowWind_OtherStateType) , DIMENSION(:), ALLOCATABLE :: IfW !< Dummy IfW other states [-] + END TYPE AWAE_OtherStateType +! ======================= +! ========= AWAE_MiscVarType ======= + TYPE, PUBLIC :: AWAE_MiscVarType + REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: Vamb_low !< UVW components of ambient wind across the low-resolution domain throughout the farm [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Vamb_lowpol !< UVW components of disturbed wind (ambient + wakes) at points in the polar grid for each wake plane for each turbine [m/s] + REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: Vdist_low !< UVW components of disturbed wind (ambient + deficits) across the low-resolution domain throughout the farm [m/s] + TYPE(AWAE_HighWindGrid) , DIMENSION(:), ALLOCATABLE :: Vamb_High !< UVW components of ambient wind across each high-resolution domain around a turbine (one for each turbine) for each high-resolution time step within a low-resolution time step [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: xhat_plane !< Orientations of wake planes, normal to wake planes, associated with a given point in the wind spatial domain Orientations of wake planes, normal to wake planes, associated with a given point in the wind spatial domain [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: rhat_plane !< [-] + LOGICAL , DIMENSION(:,:), ALLOCATABLE :: parallelFlag !< [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: r_s !< [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: r_e !< [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: rhat_s !< [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: rhat_e !< [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: pvec_cs !< [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: pvec_ce !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Vx_wake !< [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Vr_wake !< [m/s] + REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: outVizXYPlane + REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: outVizYZPlane + REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE :: outVizXZPlane + TYPE(InflowWind_MiscVarType) , DIMENSION(:), ALLOCATABLE :: IfW !< InflowWind module misc vars [-] + TYPE(InflowWind_InputType) :: u_IfW_Low !< InflowWind module inputs for the low-resolution grid [-] + TYPE(InflowWind_InputType) :: u_IfW_High !< InflowWind module inputs for the high-resolution grid [-] + TYPE(InflowWind_OutputType) :: y_IfW_Low !< InflowWind module outputs for the low-resolution grid [-] + TYPE(InflowWind_OutputType) :: y_IfW_High !< InflowWind module outputs for the high-resolution grid [-] + END TYPE AWAE_MiscVarType +! ======================= +! ========= AWAE_ParameterType ======= + TYPE, PUBLIC :: AWAE_ParameterType + CHARACTER(1024) :: WindFilePath !< Path name to the Root folder containing the wind data files from ABLSolver precursor [-] + INTEGER(IntKi) :: NumTurbines !< Number of wind turbines in the farm [>=1] [-] + INTEGER(IntKi) :: NumRadii !< Number of radii in the radial finite-difference grid [>=2] [-] + INTEGER(IntKi) :: NumPlanes !< Number of wake planes downwind of the rotor where the wake is propagated [>=2] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: r !< Discretization of radial finite-difference grid [m] + INTEGER(IntKi) :: Mod_AmbWind !< Ambient wind model {1: high-fidelity precursor in VTK format, 2: InflowWind module} [-] + INTEGER(IntKi) :: nX_low !< Number of low-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_low !< Number of low-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_low !< Number of low-resolution spatial nodes in Z direction [-] + INTEGER(IntKi) :: NumGrid_low !< Total number of low-resolution spatial nodes [-] + INTEGER(IntKi) :: n_rp_max !< Maximum possible number of points in the polar grid for the wake plane at each rotor [-] + REAL(ReKi) :: dpol !< Spatial resolution of the polar grid for each wake plane of each turbine [m] + REAL(ReKi) , DIMENSION(1:3) :: dXYZ_low !< XYZ-components of the spatial increment of the low-resolution domain [m] + REAL(ReKi) :: dX_low !< The spacing of the low-resolution nodes in X direction [m] + REAL(ReKi) :: dY_low !< The spacing of the low-resolution nodes in Y direction [m] + REAL(ReKi) :: dZ_low !< The spacing of the low-resolution nodes in Z direction [m] + REAL(ReKi) :: X0_low !< X-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Y0_low !< Y-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) :: Z0_low !< Z-component of the origin of the low-resolution spatial domain [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: X0_high !< X-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Y0_high !< Y-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Z0_high !< Z-component of the origin of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dX_high !< X-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dY_high !< Y-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dZ_high !< Z-component of the spatial increment of the high-resolution spatial domain for each turbine [m] + INTEGER(IntKi) :: nX_high !< Number of high-resolution spatial nodes in X direction [-] + INTEGER(IntKi) :: nY_high !< Number of high-resolution spatial nodes in Y direction [-] + INTEGER(IntKi) :: nZ_high !< Number of high-resolution spatial nodes in Z direction [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Grid_low !< XYZ components (global positions) of the spatial discretization of the low-resolution spatial domain [m] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: Grid_high !< XYZ components (global positions) of the spatial discretization of the high-resolution spatial domain for each turbine [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: WT_Position !< X-Y-Z position of each wind turbine; index 1 = XYZ; index 2 = turbine number [meters] + INTEGER(IntKi) :: n_high_low !< Number of high-resolution time steps per low [-] + REAL(DbKi) :: dt_low !< Low-resolution (FAST.Farm driver/glue code) time step [s] + REAL(DbKi) :: dt_high !< High-resolution (FAST) time step [s] + INTEGER(IntKi) :: NumDT !< Number of low-resolution (FAST.Farm driver/glue code) time steps [-] + INTEGER(IntKi) :: Mod_Meander !< Spatial filter model for wake meandering [-] + REAL(ReKi) :: C_Meander !< Calibrated parameter for wake meandering [-] + REAL(ReKi) :: C_ScaleDiam !< Normalized wake volume radius for wake meandering (normalized by the wake diameter) [-] + TYPE(InflowWind_ParameterType) , DIMENSION(:), ALLOCATABLE :: IfW !< InflowWind module parameters [-] + INTEGER(IntKi) :: WrDisSkp1 !< Number of time steps to skip plus one [-] + LOGICAL :: WrDisWind !< Write disturbed wind data to /Low/Dis.t.vtk etc.? [-] + INTEGER(IntKi) :: NOutDisWindXY !< Number of XY planes for output of disturbed wind data across the low-resolution domain to /Low/DisXY..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindZ !< Z coordinates of XY planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXY] [meters] + INTEGER(IntKi) :: NOutDisWindYZ !< Number of YZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisYZ..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindX !< X coordinates of YZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindYZ] [meters] + INTEGER(IntKi) :: NOutDisWindXZ !< Number of XZ planes for output of disturbed wind data across the low-resolution domain to /Low/DisXZ..t.vtk [0 to 9] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: OutDisWindY !< Y coordinates of XZ planes for output of disturbed wind data across the low-resolution domain [1 to NOutDisWindXZ] [meters] + CHARACTER(1024) :: OutFileRoot !< The root name derived from the primary FAST.Farm input file [-] + CHARACTER(1024) :: OutFileVTKRoot !< The root name for VTK outputs [-] + INTEGER(IntKi) :: VTK_tWidth !< Number of characters for VTK timestamp outputs [-] + END TYPE AWAE_ParameterType +! ======================= +! ========= AWAE_OutputType ======= + TYPE, PUBLIC :: AWAE_OutputType + TYPE(AWAE_HighWindGrid) , DIMENSION(:), ALLOCATABLE :: Vdist_High !< Wind velocity of disturbed wind (ambient + wakes) across each high-resolution domain around a turbine for each high-resolution step within a low-resolution step [m/s] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: V_plane !< Advection, deflection, and meandering velocity of wake planes for each turbine [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TI_amb !< Ambient turbulence intensity of wind at rotor disk for each turbine [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Vx_wind_disk !< Rotor-disk-averaged ambient wind speed, normal to disk, for each turbine [m/s] + END TYPE AWAE_OutputType +! ======================= +! ========= AWAE_InputType ======= + TYPE, PUBLIC :: AWAE_InputType + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: xhat_plane !< Orientations of wake planes, normal to wake planes, for each turbine [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: p_plane !< Center positions of wake planes for each turbine [m] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: Vx_wake !< Axial wake velocity deficit at wake planes, distributed radially, for each turbine [m/s] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: Vr_wake !< Radial wake velocity deficit at wake planes, distributed radially, for each turbine [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: D_wake !< Wake diameters at wake planes for each turbine [m] + END TYPE AWAE_InputType +! ======================= +CONTAINS + SUBROUTINE AWAE_CopyHighWindGrid( SrcHighWindGridData, DstHighWindGridData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_HighWindGrid), INTENT(IN) :: SrcHighWindGridData + TYPE(AWAE_HighWindGrid), INTENT(INOUT) :: DstHighWindGridData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyHighWindGrid' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcHighWindGridData%data)) THEN + i1_l = LBOUND(SrcHighWindGridData%data,1) + i1_u = UBOUND(SrcHighWindGridData%data,1) + i2_l = LBOUND(SrcHighWindGridData%data,2) + i2_u = UBOUND(SrcHighWindGridData%data,2) + i3_l = LBOUND(SrcHighWindGridData%data,3) + i3_u = UBOUND(SrcHighWindGridData%data,3) + i4_l = LBOUND(SrcHighWindGridData%data,4) + i4_u = UBOUND(SrcHighWindGridData%data,4) + i5_l = LBOUND(SrcHighWindGridData%data,5) + i5_u = UBOUND(SrcHighWindGridData%data,5) + IF (.NOT. ALLOCATED(DstHighWindGridData%data)) THEN + ALLOCATE(DstHighWindGridData%data(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u,i5_l:i5_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstHighWindGridData%data.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstHighWindGridData%data = SrcHighWindGridData%data +ENDIF + END SUBROUTINE AWAE_CopyHighWindGrid + + SUBROUTINE AWAE_DestroyHighWindGrid( HighWindGridData, ErrStat, ErrMsg ) + TYPE(AWAE_HighWindGrid), INTENT(INOUT) :: HighWindGridData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyHighWindGrid' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(HighWindGridData%data)) THEN + DEALLOCATE(HighWindGridData%data) +ENDIF + END SUBROUTINE AWAE_DestroyHighWindGrid + + SUBROUTINE AWAE_PackHighWindGrid( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_HighWindGrid), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackHighWindGrid' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! data allocated yes/no + IF ( ALLOCATED(InData%data) ) THEN + Int_BufSz = Int_BufSz + 2*5 ! data upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%data) ! data + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%data) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%data,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%data,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%data,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%data,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%data,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%data,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%data,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%data,4) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%data,5) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%data,5) + Int_Xferred = Int_Xferred + 2 + + DO i5 = LBOUND(InData%data,5), UBOUND(InData%data,5) + DO i4 = LBOUND(InData%data,4), UBOUND(InData%data,4) + DO i3 = LBOUND(InData%data,3), UBOUND(InData%data,3) + DO i2 = LBOUND(InData%data,2), UBOUND(InData%data,2) + DO i1 = LBOUND(InData%data,1), UBOUND(InData%data,1) + ReKiBuf(Re_Xferred) = InData%data(i1,i2,i3,i4,i5) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END DO + END IF + END SUBROUTINE AWAE_PackHighWindGrid + + SUBROUTINE AWAE_UnPackHighWindGrid( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_HighWindGrid), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: i5, i5_l, i5_u ! bounds (upper/lower) for an array dimension 5 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackHighWindGrid' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! data not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i5_l = IntKiBuf( Int_Xferred ) + i5_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%data)) DEALLOCATE(OutData%data) + ALLOCATE(OutData%data(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u,i5_l:i5_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%data.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i5 = LBOUND(OutData%data,5), UBOUND(OutData%data,5) + DO i4 = LBOUND(OutData%data,4), UBOUND(OutData%data,4) + DO i3 = LBOUND(OutData%data,3), UBOUND(OutData%data,3) + DO i2 = LBOUND(OutData%data,2), UBOUND(OutData%data,2) + DO i1 = LBOUND(OutData%data,1), UBOUND(OutData%data,1) + OutData%data(i1,i2,i3,i4,i5) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END DO + END IF + END SUBROUTINE AWAE_UnPackHighWindGrid + + SUBROUTINE AWAE_CopyInputFileType( SrcInputFileTypeData, DstInputFileTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_InputFileType), INTENT(IN) :: SrcInputFileTypeData + TYPE(AWAE_InputFileType), INTENT(INOUT) :: DstInputFileTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyInputFileType' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInputFileTypeData%dr = SrcInputFileTypeData%dr + DstInputFileTypeData%dt_low = SrcInputFileTypeData%dt_low + DstInputFileTypeData%NumTurbines = SrcInputFileTypeData%NumTurbines + DstInputFileTypeData%NumRadii = SrcInputFileTypeData%NumRadii + DstInputFileTypeData%NumPlanes = SrcInputFileTypeData%NumPlanes + DstInputFileTypeData%WindFilePath = SrcInputFileTypeData%WindFilePath + DstInputFileTypeData%WrDisWind = SrcInputFileTypeData%WrDisWind + DstInputFileTypeData%NOutDisWindXY = SrcInputFileTypeData%NOutDisWindXY +IF (ALLOCATED(SrcInputFileTypeData%OutDisWindZ)) THEN + i1_l = LBOUND(SrcInputFileTypeData%OutDisWindZ,1) + i1_u = UBOUND(SrcInputFileTypeData%OutDisWindZ,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%OutDisWindZ)) THEN + ALLOCATE(DstInputFileTypeData%OutDisWindZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%OutDisWindZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%OutDisWindZ = SrcInputFileTypeData%OutDisWindZ +ENDIF + DstInputFileTypeData%NOutDisWindYZ = SrcInputFileTypeData%NOutDisWindYZ +IF (ALLOCATED(SrcInputFileTypeData%OutDisWindX)) THEN + i1_l = LBOUND(SrcInputFileTypeData%OutDisWindX,1) + i1_u = UBOUND(SrcInputFileTypeData%OutDisWindX,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%OutDisWindX)) THEN + ALLOCATE(DstInputFileTypeData%OutDisWindX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%OutDisWindX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%OutDisWindX = SrcInputFileTypeData%OutDisWindX +ENDIF + DstInputFileTypeData%NOutDisWindXZ = SrcInputFileTypeData%NOutDisWindXZ +IF (ALLOCATED(SrcInputFileTypeData%OutDisWindY)) THEN + i1_l = LBOUND(SrcInputFileTypeData%OutDisWindY,1) + i1_u = UBOUND(SrcInputFileTypeData%OutDisWindY,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%OutDisWindY)) THEN + ALLOCATE(DstInputFileTypeData%OutDisWindY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%OutDisWindY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%OutDisWindY = SrcInputFileTypeData%OutDisWindY +ENDIF + DstInputFileTypeData%WrDisDT = SrcInputFileTypeData%WrDisDT + DstInputFileTypeData%ChkWndFiles = SrcInputFileTypeData%ChkWndFiles + DstInputFileTypeData%Mod_Meander = SrcInputFileTypeData%Mod_Meander + DstInputFileTypeData%C_Meander = SrcInputFileTypeData%C_Meander + DstInputFileTypeData%Mod_AmbWind = SrcInputFileTypeData%Mod_AmbWind + DstInputFileTypeData%InflowFile = SrcInputFileTypeData%InflowFile + DstInputFileTypeData%dt_high = SrcInputFileTypeData%dt_high +IF (ALLOCATED(SrcInputFileTypeData%X0_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%X0_high,1) + i1_u = UBOUND(SrcInputFileTypeData%X0_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%X0_high)) THEN + ALLOCATE(DstInputFileTypeData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%X0_high = SrcInputFileTypeData%X0_high +ENDIF +IF (ALLOCATED(SrcInputFileTypeData%Y0_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%Y0_high,1) + i1_u = UBOUND(SrcInputFileTypeData%Y0_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%Y0_high)) THEN + ALLOCATE(DstInputFileTypeData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%Y0_high = SrcInputFileTypeData%Y0_high +ENDIF +IF (ALLOCATED(SrcInputFileTypeData%Z0_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%Z0_high,1) + i1_u = UBOUND(SrcInputFileTypeData%Z0_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%Z0_high)) THEN + ALLOCATE(DstInputFileTypeData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%Z0_high = SrcInputFileTypeData%Z0_high +ENDIF +IF (ALLOCATED(SrcInputFileTypeData%dX_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%dX_high,1) + i1_u = UBOUND(SrcInputFileTypeData%dX_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%dX_high)) THEN + ALLOCATE(DstInputFileTypeData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%dX_high = SrcInputFileTypeData%dX_high +ENDIF +IF (ALLOCATED(SrcInputFileTypeData%dY_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%dY_high,1) + i1_u = UBOUND(SrcInputFileTypeData%dY_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%dY_high)) THEN + ALLOCATE(DstInputFileTypeData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%dY_high = SrcInputFileTypeData%dY_high +ENDIF +IF (ALLOCATED(SrcInputFileTypeData%dZ_high)) THEN + i1_l = LBOUND(SrcInputFileTypeData%dZ_high,1) + i1_u = UBOUND(SrcInputFileTypeData%dZ_high,1) + IF (.NOT. ALLOCATED(DstInputFileTypeData%dZ_high)) THEN + ALLOCATE(DstInputFileTypeData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%dZ_high = SrcInputFileTypeData%dZ_high +ENDIF + DstInputFileTypeData%nX_high = SrcInputFileTypeData%nX_high + DstInputFileTypeData%nY_high = SrcInputFileTypeData%nY_high + DstInputFileTypeData%nZ_high = SrcInputFileTypeData%nZ_high + DstInputFileTypeData%dX_low = SrcInputFileTypeData%dX_low + DstInputFileTypeData%dY_low = SrcInputFileTypeData%dY_low + DstInputFileTypeData%dZ_low = SrcInputFileTypeData%dZ_low + DstInputFileTypeData%nX_low = SrcInputFileTypeData%nX_low + DstInputFileTypeData%nY_low = SrcInputFileTypeData%nY_low + DstInputFileTypeData%nZ_low = SrcInputFileTypeData%nZ_low + DstInputFileTypeData%X0_low = SrcInputFileTypeData%X0_low + DstInputFileTypeData%Y0_low = SrcInputFileTypeData%Y0_low + DstInputFileTypeData%Z0_low = SrcInputFileTypeData%Z0_low +IF (ALLOCATED(SrcInputFileTypeData%WT_Position)) THEN + i1_l = LBOUND(SrcInputFileTypeData%WT_Position,1) + i1_u = UBOUND(SrcInputFileTypeData%WT_Position,1) + i2_l = LBOUND(SrcInputFileTypeData%WT_Position,2) + i2_u = UBOUND(SrcInputFileTypeData%WT_Position,2) + IF (.NOT. ALLOCATED(DstInputFileTypeData%WT_Position)) THEN + ALLOCATE(DstInputFileTypeData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileTypeData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileTypeData%WT_Position = SrcInputFileTypeData%WT_Position +ENDIF + END SUBROUTINE AWAE_CopyInputFileType + + SUBROUTINE AWAE_DestroyInputFileType( InputFileTypeData, ErrStat, ErrMsg ) + TYPE(AWAE_InputFileType), INTENT(INOUT) :: InputFileTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyInputFileType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputFileTypeData%OutDisWindZ)) THEN + DEALLOCATE(InputFileTypeData%OutDisWindZ) +ENDIF +IF (ALLOCATED(InputFileTypeData%OutDisWindX)) THEN + DEALLOCATE(InputFileTypeData%OutDisWindX) +ENDIF +IF (ALLOCATED(InputFileTypeData%OutDisWindY)) THEN + DEALLOCATE(InputFileTypeData%OutDisWindY) +ENDIF +IF (ALLOCATED(InputFileTypeData%X0_high)) THEN + DEALLOCATE(InputFileTypeData%X0_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%Y0_high)) THEN + DEALLOCATE(InputFileTypeData%Y0_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%Z0_high)) THEN + DEALLOCATE(InputFileTypeData%Z0_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%dX_high)) THEN + DEALLOCATE(InputFileTypeData%dX_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%dY_high)) THEN + DEALLOCATE(InputFileTypeData%dY_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%dZ_high)) THEN + DEALLOCATE(InputFileTypeData%dZ_high) +ENDIF +IF (ALLOCATED(InputFileTypeData%WT_Position)) THEN + DEALLOCATE(InputFileTypeData%WT_Position) +ENDIF + END SUBROUTINE AWAE_DestroyInputFileType + + SUBROUTINE AWAE_PackInputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_InputFileType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackInputFileType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! dr + Db_BufSz = Db_BufSz + 1 ! dt_low + Int_BufSz = Int_BufSz + 1 ! NumTurbines + Int_BufSz = Int_BufSz + 1 ! NumRadii + Int_BufSz = Int_BufSz + 1 ! NumPlanes + Int_BufSz = Int_BufSz + 1*LEN(InData%WindFilePath) ! WindFilePath + Int_BufSz = Int_BufSz + 1 ! WrDisWind + Int_BufSz = Int_BufSz + 1 ! NOutDisWindXY + Int_BufSz = Int_BufSz + 1 ! OutDisWindZ allocated yes/no + IF ( ALLOCATED(InData%OutDisWindZ) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindZ upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindZ) ! OutDisWindZ + END IF + Int_BufSz = Int_BufSz + 1 ! NOutDisWindYZ + Int_BufSz = Int_BufSz + 1 ! OutDisWindX allocated yes/no + IF ( ALLOCATED(InData%OutDisWindX) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindX upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindX) ! OutDisWindX + END IF + Int_BufSz = Int_BufSz + 1 ! NOutDisWindXZ + Int_BufSz = Int_BufSz + 1 ! OutDisWindY allocated yes/no + IF ( ALLOCATED(InData%OutDisWindY) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindY upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindY) ! OutDisWindY + END IF + Db_BufSz = Db_BufSz + 1 ! WrDisDT + Int_BufSz = Int_BufSz + 1 ! ChkWndFiles + Int_BufSz = Int_BufSz + 1 ! Mod_Meander + Re_BufSz = Re_BufSz + 1 ! C_Meander + Int_BufSz = Int_BufSz + 1 ! Mod_AmbWind + Int_BufSz = Int_BufSz + 1*LEN(InData%InflowFile) ! InflowFile + Db_BufSz = Db_BufSz + 1 ! dt_high + Int_BufSz = Int_BufSz + 1 ! X0_high allocated yes/no + IF ( ALLOCATED(InData%X0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! X0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%X0_high) ! X0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Y0_high allocated yes/no + IF ( ALLOCATED(InData%Y0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Y0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Y0_high) ! Y0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Z0_high allocated yes/no + IF ( ALLOCATED(InData%Z0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Z0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Z0_high) ! Z0_high + END IF + Int_BufSz = Int_BufSz + 1 ! dX_high allocated yes/no + IF ( ALLOCATED(InData%dX_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dX_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dX_high) ! dX_high + END IF + Int_BufSz = Int_BufSz + 1 ! dY_high allocated yes/no + IF ( ALLOCATED(InData%dY_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dY_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dY_high) ! dY_high + END IF + Int_BufSz = Int_BufSz + 1 ! dZ_high allocated yes/no + IF ( ALLOCATED(InData%dZ_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dZ_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dZ_high) ! dZ_high + END IF + Int_BufSz = Int_BufSz + 1 ! nX_high + Int_BufSz = Int_BufSz + 1 ! nY_high + Int_BufSz = Int_BufSz + 1 ! nZ_high + Re_BufSz = Re_BufSz + 1 ! dX_low + Re_BufSz = Re_BufSz + 1 ! dY_low + Re_BufSz = Re_BufSz + 1 ! dZ_low + Int_BufSz = Int_BufSz + 1 ! nX_low + Int_BufSz = Int_BufSz + 1 ! nY_low + Int_BufSz = Int_BufSz + 1 ! nZ_low + Re_BufSz = Re_BufSz + 1 ! X0_low + Re_BufSz = Re_BufSz + 1 ! Y0_low + Re_BufSz = Re_BufSz + 1 ! Z0_low + Int_BufSz = Int_BufSz + 1 ! WT_Position allocated yes/no + IF ( ALLOCATED(InData%WT_Position) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! WT_Position upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WT_Position) ! WT_Position + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%dr + Re_Xferred = Re_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%dt_low + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumTurbines + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumRadii + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumPlanes + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%WindFilePath) + IntKiBuf(Int_Xferred) = ICHAR(InData%WindFilePath(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = TRANSFER(InData%WrDisWind, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NOutDisWindXY + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindZ) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindZ,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindZ,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindZ,1), UBOUND(InData%OutDisWindZ,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindZ(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NOutDisWindYZ + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindX) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindX,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindX,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindX,1), UBOUND(InData%OutDisWindX,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindX(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NOutDisWindXZ + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindY) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindY,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindY,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindY,1), UBOUND(InData%OutDisWindY,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindY(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + DbKiBuf(Db_Xferred) = InData%WrDisDT + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%ChkWndFiles, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%Mod_Meander + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_Meander + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%Mod_AmbWind + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%InflowFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%InflowFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DbKiBuf(Db_Xferred) = InData%dt_high + Db_Xferred = Db_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%X0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%X0_high,1), UBOUND(InData%X0_high,1) + ReKiBuf(Re_Xferred) = InData%X0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Y0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Y0_high,1), UBOUND(InData%Y0_high,1) + ReKiBuf(Re_Xferred) = InData%Y0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Z0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Z0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Z0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Z0_high,1), UBOUND(InData%Z0_high,1) + ReKiBuf(Re_Xferred) = InData%Z0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dX_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dX_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dX_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dX_high,1), UBOUND(InData%dX_high,1) + ReKiBuf(Re_Xferred) = InData%dX_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dY_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dY_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dY_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dY_high,1), UBOUND(InData%dY_high,1) + ReKiBuf(Re_Xferred) = InData%dY_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dZ_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dZ_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dZ_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dZ_high,1), UBOUND(InData%dZ_high,1) + ReKiBuf(Re_Xferred) = InData%dZ_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%nX_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_high + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dX_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dY_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dZ_low + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nX_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_low + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%X0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Y0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Z0_low + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%WT_Position) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%WT_Position,2), UBOUND(InData%WT_Position,2) + DO i1 = LBOUND(InData%WT_Position,1), UBOUND(InData%WT_Position,1) + ReKiBuf(Re_Xferred) = InData%WT_Position(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AWAE_PackInputFileType + + SUBROUTINE AWAE_UnPackInputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_InputFileType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackInputFileType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dt_low = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%NumTurbines = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumRadii = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumPlanes = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%WindFilePath) + OutData%WindFilePath(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%WrDisWind = TRANSFER(IntKiBuf(Int_Xferred), OutData%WrDisWind) + Int_Xferred = Int_Xferred + 1 + OutData%NOutDisWindXY = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindZ not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindZ)) DEALLOCATE(OutData%OutDisWindZ) + ALLOCATE(OutData%OutDisWindZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindZ,1), UBOUND(OutData%OutDisWindZ,1) + OutData%OutDisWindZ(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%NOutDisWindYZ = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindX not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindX)) DEALLOCATE(OutData%OutDisWindX) + ALLOCATE(OutData%OutDisWindX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindX,1), UBOUND(OutData%OutDisWindX,1) + OutData%OutDisWindX(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%NOutDisWindXZ = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindY not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindY)) DEALLOCATE(OutData%OutDisWindY) + ALLOCATE(OutData%OutDisWindY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindY,1), UBOUND(OutData%OutDisWindY,1) + OutData%OutDisWindY(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%WrDisDT = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%ChkWndFiles = TRANSFER(IntKiBuf(Int_Xferred), OutData%ChkWndFiles) + Int_Xferred = Int_Xferred + 1 + OutData%Mod_Meander = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_Meander = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Mod_AmbWind = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%InflowFile) + OutData%InflowFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%dt_high = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%X0_high)) DEALLOCATE(OutData%X0_high) + ALLOCATE(OutData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%X0_high,1), UBOUND(OutData%X0_high,1) + OutData%X0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Y0_high)) DEALLOCATE(OutData%Y0_high) + ALLOCATE(OutData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Y0_high,1), UBOUND(OutData%Y0_high,1) + OutData%Y0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Z0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Z0_high)) DEALLOCATE(OutData%Z0_high) + ALLOCATE(OutData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Z0_high,1), UBOUND(OutData%Z0_high,1) + OutData%Z0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dX_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dX_high)) DEALLOCATE(OutData%dX_high) + ALLOCATE(OutData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dX_high,1), UBOUND(OutData%dX_high,1) + OutData%dX_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dY_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dY_high)) DEALLOCATE(OutData%dY_high) + ALLOCATE(OutData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dY_high,1), UBOUND(OutData%dY_high,1) + OutData%dY_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dZ_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dZ_high)) DEALLOCATE(OutData%dZ_high) + ALLOCATE(OutData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dZ_high,1), UBOUND(OutData%dZ_high,1) + OutData%dZ_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%nX_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dX_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dY_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dZ_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%nX_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%X0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Y0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Z0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WT_Position not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WT_Position)) DEALLOCATE(OutData%WT_Position) + ALLOCATE(OutData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%WT_Position,2), UBOUND(OutData%WT_Position,2) + DO i1 = LBOUND(OutData%WT_Position,1), UBOUND(OutData%WT_Position,1) + OutData%WT_Position(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AWAE_UnPackInputFileType + + SUBROUTINE AWAE_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(AWAE_InitInputType), INTENT(INOUT) :: DstInitInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL AWAE_Copyinputfiletype( SrcInitInputData%InputFileData, DstInitInputData%InputFileData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstInitInputData%n_high_low = SrcInitInputData%n_high_low + DstInitInputData%NumDT = SrcInitInputData%NumDT + DstInitInputData%OutFileRoot = SrcInitInputData%OutFileRoot + END SUBROUTINE AWAE_CopyInitInput + + SUBROUTINE AWAE_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(AWAE_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL AWAE_Destroyinputfiletype( InitInputData%InputFileData, ErrStat, ErrMsg ) + END SUBROUTINE AWAE_DestroyInitInput + + SUBROUTINE AWAE_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! InputFileData: size of buffers for each call to pack subtype + CALL AWAE_Packinputfiletype( Re_Buf, Db_Buf, Int_Buf, InData%InputFileData, ErrStat2, ErrMsg2, .TRUE. ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! InputFileData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! InputFileData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! InputFileData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! n_high_low + Int_BufSz = Int_BufSz + 1 ! NumDT + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFileRoot) ! OutFileRoot + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL AWAE_Packinputfiletype( Re_Buf, Db_Buf, Int_Buf, InData%InputFileData, ErrStat2, ErrMsg2, OnlySize ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = InData%n_high_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumDT + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%OutFileRoot) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFileRoot(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END SUBROUTINE AWAE_PackInitInput + + SUBROUTINE AWAE_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_Unpackinputfiletype( Re_Buf, Db_Buf, Int_Buf, OutData%InputFileData, ErrStat2, ErrMsg2 ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%n_high_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumDT = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%OutFileRoot) + OutData%OutFileRoot(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END SUBROUTINE AWAE_UnPackInitInput + + SUBROUTINE AWAE_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(AWAE_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcInitOutputData%X0_high)) THEN + i1_l = LBOUND(SrcInitOutputData%X0_high,1) + i1_u = UBOUND(SrcInitOutputData%X0_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%X0_high)) THEN + ALLOCATE(DstInitOutputData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%X0_high = SrcInitOutputData%X0_high +ENDIF +IF (ALLOCATED(SrcInitOutputData%Y0_high)) THEN + i1_l = LBOUND(SrcInitOutputData%Y0_high,1) + i1_u = UBOUND(SrcInitOutputData%Y0_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%Y0_high)) THEN + ALLOCATE(DstInitOutputData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%Y0_high = SrcInitOutputData%Y0_high +ENDIF +IF (ALLOCATED(SrcInitOutputData%Z0_high)) THEN + i1_l = LBOUND(SrcInitOutputData%Z0_high,1) + i1_u = UBOUND(SrcInitOutputData%Z0_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%Z0_high)) THEN + ALLOCATE(DstInitOutputData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%Z0_high = SrcInitOutputData%Z0_high +ENDIF +IF (ALLOCATED(SrcInitOutputData%dX_high)) THEN + i1_l = LBOUND(SrcInitOutputData%dX_high,1) + i1_u = UBOUND(SrcInitOutputData%dX_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%dX_high)) THEN + ALLOCATE(DstInitOutputData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%dX_high = SrcInitOutputData%dX_high +ENDIF +IF (ALLOCATED(SrcInitOutputData%dY_high)) THEN + i1_l = LBOUND(SrcInitOutputData%dY_high,1) + i1_u = UBOUND(SrcInitOutputData%dY_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%dY_high)) THEN + ALLOCATE(DstInitOutputData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%dY_high = SrcInitOutputData%dY_high +ENDIF +IF (ALLOCATED(SrcInitOutputData%dZ_high)) THEN + i1_l = LBOUND(SrcInitOutputData%dZ_high,1) + i1_u = UBOUND(SrcInitOutputData%dZ_high,1) + IF (.NOT. ALLOCATED(DstInitOutputData%dZ_high)) THEN + ALLOCATE(DstInitOutputData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%dZ_high = SrcInitOutputData%dZ_high +ENDIF + DstInitOutputData%nX_high = SrcInitOutputData%nX_high + DstInitOutputData%nY_high = SrcInitOutputData%nY_high + DstInitOutputData%nZ_high = SrcInitOutputData%nZ_high + DstInitOutputData%dX_low = SrcInitOutputData%dX_low + DstInitOutputData%dY_low = SrcInitOutputData%dY_low + DstInitOutputData%dZ_low = SrcInitOutputData%dZ_low + DstInitOutputData%nX_low = SrcInitOutputData%nX_low + DstInitOutputData%nY_low = SrcInitOutputData%nY_low + DstInitOutputData%nZ_low = SrcInitOutputData%nZ_low + DstInitOutputData%X0_low = SrcInitOutputData%X0_low + DstInitOutputData%Y0_low = SrcInitOutputData%Y0_low + DstInitOutputData%Z0_low = SrcInitOutputData%Z0_low + END SUBROUTINE AWAE_CopyInitOutput + + SUBROUTINE AWAE_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(AWAE_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) +IF (ALLOCATED(InitOutputData%X0_high)) THEN + DEALLOCATE(InitOutputData%X0_high) +ENDIF +IF (ALLOCATED(InitOutputData%Y0_high)) THEN + DEALLOCATE(InitOutputData%Y0_high) +ENDIF +IF (ALLOCATED(InitOutputData%Z0_high)) THEN + DEALLOCATE(InitOutputData%Z0_high) +ENDIF +IF (ALLOCATED(InitOutputData%dX_high)) THEN + DEALLOCATE(InitOutputData%dX_high) +ENDIF +IF (ALLOCATED(InitOutputData%dY_high)) THEN + DEALLOCATE(InitOutputData%dY_high) +ENDIF +IF (ALLOCATED(InitOutputData%dZ_high)) THEN + DEALLOCATE(InitOutputData%dZ_high) +ENDIF + END SUBROUTINE AWAE_DestroyInitOutput + + SUBROUTINE AWAE_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! X0_high allocated yes/no + IF ( ALLOCATED(InData%X0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! X0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%X0_high) ! X0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Y0_high allocated yes/no + IF ( ALLOCATED(InData%Y0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Y0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Y0_high) ! Y0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Z0_high allocated yes/no + IF ( ALLOCATED(InData%Z0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Z0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Z0_high) ! Z0_high + END IF + Int_BufSz = Int_BufSz + 1 ! dX_high allocated yes/no + IF ( ALLOCATED(InData%dX_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dX_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dX_high) ! dX_high + END IF + Int_BufSz = Int_BufSz + 1 ! dY_high allocated yes/no + IF ( ALLOCATED(InData%dY_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dY_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dY_high) ! dY_high + END IF + Int_BufSz = Int_BufSz + 1 ! dZ_high allocated yes/no + IF ( ALLOCATED(InData%dZ_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dZ_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dZ_high) ! dZ_high + END IF + Int_BufSz = Int_BufSz + 1 ! nX_high + Int_BufSz = Int_BufSz + 1 ! nY_high + Int_BufSz = Int_BufSz + 1 ! nZ_high + Re_BufSz = Re_BufSz + 1 ! dX_low + Re_BufSz = Re_BufSz + 1 ! dY_low + Re_BufSz = Re_BufSz + 1 ! dZ_low + Int_BufSz = Int_BufSz + 1 ! nX_low + Int_BufSz = Int_BufSz + 1 ! nY_low + Int_BufSz = Int_BufSz + 1 ! nZ_low + Re_BufSz = Re_BufSz + 1 ! X0_low + Re_BufSz = Re_BufSz + 1 ! Y0_low + Re_BufSz = Re_BufSz + 1 ! Z0_low + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%X0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%X0_high,1), UBOUND(InData%X0_high,1) + ReKiBuf(Re_Xferred) = InData%X0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Y0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Y0_high,1), UBOUND(InData%Y0_high,1) + ReKiBuf(Re_Xferred) = InData%Y0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Z0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Z0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Z0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Z0_high,1), UBOUND(InData%Z0_high,1) + ReKiBuf(Re_Xferred) = InData%Z0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dX_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dX_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dX_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dX_high,1), UBOUND(InData%dX_high,1) + ReKiBuf(Re_Xferred) = InData%dX_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dY_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dY_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dY_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dY_high,1), UBOUND(InData%dY_high,1) + ReKiBuf(Re_Xferred) = InData%dY_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dZ_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dZ_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dZ_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dZ_high,1), UBOUND(InData%dZ_high,1) + ReKiBuf(Re_Xferred) = InData%dZ_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%nX_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_high + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dX_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dY_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dZ_low + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nX_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_low + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%X0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Y0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Z0_low + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE AWAE_PackInitOutput + + SUBROUTINE AWAE_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%X0_high)) DEALLOCATE(OutData%X0_high) + ALLOCATE(OutData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%X0_high,1), UBOUND(OutData%X0_high,1) + OutData%X0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Y0_high)) DEALLOCATE(OutData%Y0_high) + ALLOCATE(OutData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Y0_high,1), UBOUND(OutData%Y0_high,1) + OutData%Y0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Z0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Z0_high)) DEALLOCATE(OutData%Z0_high) + ALLOCATE(OutData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Z0_high,1), UBOUND(OutData%Z0_high,1) + OutData%Z0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dX_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dX_high)) DEALLOCATE(OutData%dX_high) + ALLOCATE(OutData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dX_high,1), UBOUND(OutData%dX_high,1) + OutData%dX_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dY_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dY_high)) DEALLOCATE(OutData%dY_high) + ALLOCATE(OutData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dY_high,1), UBOUND(OutData%dY_high,1) + OutData%dY_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dZ_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dZ_high)) DEALLOCATE(OutData%dZ_high) + ALLOCATE(OutData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dZ_high,1), UBOUND(OutData%dZ_high,1) + OutData%dZ_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%nX_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dX_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dY_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dZ_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%nX_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%X0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Y0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Z0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE AWAE_UnPackInitOutput + + SUBROUTINE AWAE_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(AWAE_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcContStateData%IfW)) THEN + i1_l = LBOUND(SrcContStateData%IfW,1) + i1_u = UBOUND(SrcContStateData%IfW,1) + IF (.NOT. ALLOCATED(DstContStateData%IfW)) THEN + ALLOCATE(DstContStateData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%IfW,1), UBOUND(SrcContStateData%IfW,1) + CALL InflowWind_CopyContState( SrcContStateData%IfW(i1), DstContStateData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AWAE_CopyContState + + SUBROUTINE AWAE_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(AWAE_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ContStateData%IfW)) THEN +DO i1 = LBOUND(ContStateData%IfW,1), UBOUND(ContStateData%IfW,1) + CALL InflowWind_DestroyContState( ContStateData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%IfW) +ENDIF + END SUBROUTINE AWAE_DestroyContState + + SUBROUTINE AWAE_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE AWAE_PackContState + + SUBROUTINE AWAE_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE AWAE_UnPackContState + + SUBROUTINE AWAE_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(AWAE_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcDiscStateData%IfW)) THEN + i1_l = LBOUND(SrcDiscStateData%IfW,1) + i1_u = UBOUND(SrcDiscStateData%IfW,1) + IF (.NOT. ALLOCATED(DstDiscStateData%IfW)) THEN + ALLOCATE(DstDiscStateData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%IfW,1), UBOUND(SrcDiscStateData%IfW,1) + CALL InflowWind_CopyDiscState( SrcDiscStateData%IfW(i1), DstDiscStateData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AWAE_CopyDiscState + + SUBROUTINE AWAE_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(AWAE_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(DiscStateData%IfW)) THEN +DO i1 = LBOUND(DiscStateData%IfW,1), UBOUND(DiscStateData%IfW,1) + CALL InflowWind_DestroyDiscState( DiscStateData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%IfW) +ENDIF + END SUBROUTINE AWAE_DestroyDiscState + + SUBROUTINE AWAE_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE AWAE_PackDiscState + + SUBROUTINE AWAE_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE AWAE_UnPackDiscState + + SUBROUTINE AWAE_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(AWAE_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcConstrStateData%IfW)) THEN + i1_l = LBOUND(SrcConstrStateData%IfW,1) + i1_u = UBOUND(SrcConstrStateData%IfW,1) + IF (.NOT. ALLOCATED(DstConstrStateData%IfW)) THEN + ALLOCATE(DstConstrStateData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%IfW,1), UBOUND(SrcConstrStateData%IfW,1) + CALL InflowWind_CopyConstrState( SrcConstrStateData%IfW(i1), DstConstrStateData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AWAE_CopyConstrState + + SUBROUTINE AWAE_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(AWAE_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ConstrStateData%IfW)) THEN +DO i1 = LBOUND(ConstrStateData%IfW,1), UBOUND(ConstrStateData%IfW,1) + CALL InflowWind_DestroyConstrState( ConstrStateData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%IfW) +ENDIF + END SUBROUTINE AWAE_DestroyConstrState + + SUBROUTINE AWAE_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_ConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackConstrState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE AWAE_PackConstrState + + SUBROUTINE AWAE_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_ConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackConstrState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE AWAE_UnPackConstrState + + SUBROUTINE AWAE_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(AWAE_OtherStateType), INTENT(INOUT) :: DstOtherStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyOtherState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOtherStateData%IfW)) THEN + i1_l = LBOUND(SrcOtherStateData%IfW,1) + i1_u = UBOUND(SrcOtherStateData%IfW,1) + IF (.NOT. ALLOCATED(DstOtherStateData%IfW)) THEN + ALLOCATE(DstOtherStateData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%IfW,1), UBOUND(SrcOtherStateData%IfW,1) + CALL InflowWind_CopyOtherState( SrcOtherStateData%IfW(i1), DstOtherStateData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE AWAE_CopyOtherState + + SUBROUTINE AWAE_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(AWAE_OtherStateType), INTENT(INOUT) :: OtherStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyOtherState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OtherStateData%IfW)) THEN +DO i1 = LBOUND(OtherStateData%IfW,1), UBOUND(OtherStateData%IfW,1) + CALL InflowWind_DestroyOtherState( OtherStateData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%IfW) +ENDIF + END SUBROUTINE AWAE_DestroyOtherState + + SUBROUTINE AWAE_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_OtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackOtherState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE AWAE_PackOtherState + + SUBROUTINE AWAE_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_OtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackOtherState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE AWAE_UnPackOtherState + + SUBROUTINE AWAE_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(AWAE_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcMiscData%Vamb_low)) THEN + i1_l = LBOUND(SrcMiscData%Vamb_low,1) + i1_u = UBOUND(SrcMiscData%Vamb_low,1) + i2_l = LBOUND(SrcMiscData%Vamb_low,2) + i2_u = UBOUND(SrcMiscData%Vamb_low,2) + i3_l = LBOUND(SrcMiscData%Vamb_low,3) + i3_u = UBOUND(SrcMiscData%Vamb_low,3) + i4_l = LBOUND(SrcMiscData%Vamb_low,4) + i4_u = UBOUND(SrcMiscData%Vamb_low,4) + IF (.NOT. ALLOCATED(DstMiscData%Vamb_low)) THEN + ALLOCATE(DstMiscData%Vamb_low(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vamb_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vamb_low = SrcMiscData%Vamb_low +ENDIF +IF (ALLOCATED(SrcMiscData%Vamb_lowpol)) THEN + i1_l = LBOUND(SrcMiscData%Vamb_lowpol,1) + i1_u = UBOUND(SrcMiscData%Vamb_lowpol,1) + i2_l = LBOUND(SrcMiscData%Vamb_lowpol,2) + i2_u = UBOUND(SrcMiscData%Vamb_lowpol,2) + IF (.NOT. ALLOCATED(DstMiscData%Vamb_lowpol)) THEN + ALLOCATE(DstMiscData%Vamb_lowpol(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vamb_lowpol.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vamb_lowpol = SrcMiscData%Vamb_lowpol +ENDIF +IF (ALLOCATED(SrcMiscData%Vdist_low)) THEN + i1_l = LBOUND(SrcMiscData%Vdist_low,1) + i1_u = UBOUND(SrcMiscData%Vdist_low,1) + i2_l = LBOUND(SrcMiscData%Vdist_low,2) + i2_u = UBOUND(SrcMiscData%Vdist_low,2) + i3_l = LBOUND(SrcMiscData%Vdist_low,3) + i3_u = UBOUND(SrcMiscData%Vdist_low,3) + i4_l = LBOUND(SrcMiscData%Vdist_low,4) + i4_u = UBOUND(SrcMiscData%Vdist_low,4) + IF (.NOT. ALLOCATED(DstMiscData%Vdist_low)) THEN + ALLOCATE(DstMiscData%Vdist_low(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vdist_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vdist_low = SrcMiscData%Vdist_low +ENDIF +IF (ALLOCATED(SrcMiscData%Vamb_High)) THEN + i1_l = LBOUND(SrcMiscData%Vamb_High,1) + i1_u = UBOUND(SrcMiscData%Vamb_High,1) + IF (.NOT. ALLOCATED(DstMiscData%Vamb_High)) THEN + ALLOCATE(DstMiscData%Vamb_High(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vamb_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%Vamb_High,1), UBOUND(SrcMiscData%Vamb_High,1) + CALL AWAE_Copyhighwindgrid( SrcMiscData%Vamb_High(i1), DstMiscData%Vamb_High(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%xhat_plane)) THEN + i1_l = LBOUND(SrcMiscData%xhat_plane,1) + i1_u = UBOUND(SrcMiscData%xhat_plane,1) + i2_l = LBOUND(SrcMiscData%xhat_plane,2) + i2_u = UBOUND(SrcMiscData%xhat_plane,2) + IF (.NOT. ALLOCATED(DstMiscData%xhat_plane)) THEN + ALLOCATE(DstMiscData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%xhat_plane = SrcMiscData%xhat_plane +ENDIF +IF (ALLOCATED(SrcMiscData%rhat_plane)) THEN + i1_l = LBOUND(SrcMiscData%rhat_plane,1) + i1_u = UBOUND(SrcMiscData%rhat_plane,1) + i2_l = LBOUND(SrcMiscData%rhat_plane,2) + i2_u = UBOUND(SrcMiscData%rhat_plane,2) + IF (.NOT. ALLOCATED(DstMiscData%rhat_plane)) THEN + ALLOCATE(DstMiscData%rhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rhat_plane = SrcMiscData%rhat_plane +ENDIF +IF (ALLOCATED(SrcMiscData%parallelFlag)) THEN + i1_l = LBOUND(SrcMiscData%parallelFlag,1) + i1_u = UBOUND(SrcMiscData%parallelFlag,1) + i2_l = LBOUND(SrcMiscData%parallelFlag,2) + i2_u = UBOUND(SrcMiscData%parallelFlag,2) + IF (.NOT. ALLOCATED(DstMiscData%parallelFlag)) THEN + ALLOCATE(DstMiscData%parallelFlag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%parallelFlag.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%parallelFlag = SrcMiscData%parallelFlag +ENDIF +IF (ALLOCATED(SrcMiscData%r_s)) THEN + i1_l = LBOUND(SrcMiscData%r_s,1) + i1_u = UBOUND(SrcMiscData%r_s,1) + i2_l = LBOUND(SrcMiscData%r_s,2) + i2_u = UBOUND(SrcMiscData%r_s,2) + IF (.NOT. ALLOCATED(DstMiscData%r_s)) THEN + ALLOCATE(DstMiscData%r_s(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%r_s.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%r_s = SrcMiscData%r_s +ENDIF +IF (ALLOCATED(SrcMiscData%r_e)) THEN + i1_l = LBOUND(SrcMiscData%r_e,1) + i1_u = UBOUND(SrcMiscData%r_e,1) + i2_l = LBOUND(SrcMiscData%r_e,2) + i2_u = UBOUND(SrcMiscData%r_e,2) + IF (.NOT. ALLOCATED(DstMiscData%r_e)) THEN + ALLOCATE(DstMiscData%r_e(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%r_e.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%r_e = SrcMiscData%r_e +ENDIF +IF (ALLOCATED(SrcMiscData%rhat_s)) THEN + i1_l = LBOUND(SrcMiscData%rhat_s,1) + i1_u = UBOUND(SrcMiscData%rhat_s,1) + i2_l = LBOUND(SrcMiscData%rhat_s,2) + i2_u = UBOUND(SrcMiscData%rhat_s,2) + i3_l = LBOUND(SrcMiscData%rhat_s,3) + i3_u = UBOUND(SrcMiscData%rhat_s,3) + IF (.NOT. ALLOCATED(DstMiscData%rhat_s)) THEN + ALLOCATE(DstMiscData%rhat_s(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rhat_s.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rhat_s = SrcMiscData%rhat_s +ENDIF +IF (ALLOCATED(SrcMiscData%rhat_e)) THEN + i1_l = LBOUND(SrcMiscData%rhat_e,1) + i1_u = UBOUND(SrcMiscData%rhat_e,1) + i2_l = LBOUND(SrcMiscData%rhat_e,2) + i2_u = UBOUND(SrcMiscData%rhat_e,2) + i3_l = LBOUND(SrcMiscData%rhat_e,3) + i3_u = UBOUND(SrcMiscData%rhat_e,3) + IF (.NOT. ALLOCATED(DstMiscData%rhat_e)) THEN + ALLOCATE(DstMiscData%rhat_e(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rhat_e.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rhat_e = SrcMiscData%rhat_e +ENDIF +IF (ALLOCATED(SrcMiscData%pvec_cs)) THEN + i1_l = LBOUND(SrcMiscData%pvec_cs,1) + i1_u = UBOUND(SrcMiscData%pvec_cs,1) + i2_l = LBOUND(SrcMiscData%pvec_cs,2) + i2_u = UBOUND(SrcMiscData%pvec_cs,2) + i3_l = LBOUND(SrcMiscData%pvec_cs,3) + i3_u = UBOUND(SrcMiscData%pvec_cs,3) + IF (.NOT. ALLOCATED(DstMiscData%pvec_cs)) THEN + ALLOCATE(DstMiscData%pvec_cs(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%pvec_cs.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%pvec_cs = SrcMiscData%pvec_cs +ENDIF +IF (ALLOCATED(SrcMiscData%pvec_ce)) THEN + i1_l = LBOUND(SrcMiscData%pvec_ce,1) + i1_u = UBOUND(SrcMiscData%pvec_ce,1) + i2_l = LBOUND(SrcMiscData%pvec_ce,2) + i2_u = UBOUND(SrcMiscData%pvec_ce,2) + i3_l = LBOUND(SrcMiscData%pvec_ce,3) + i3_u = UBOUND(SrcMiscData%pvec_ce,3) + IF (.NOT. ALLOCATED(DstMiscData%pvec_ce)) THEN + ALLOCATE(DstMiscData%pvec_ce(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%pvec_ce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%pvec_ce = SrcMiscData%pvec_ce +ENDIF +IF (ALLOCATED(SrcMiscData%Vx_wake)) THEN + i1_l = LBOUND(SrcMiscData%Vx_wake,1) + i1_u = UBOUND(SrcMiscData%Vx_wake,1) + IF (.NOT. ALLOCATED(DstMiscData%Vx_wake)) THEN + ALLOCATE(DstMiscData%Vx_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vx_wake = SrcMiscData%Vx_wake +ENDIF +IF (ALLOCATED(SrcMiscData%Vr_wake)) THEN + i1_l = LBOUND(SrcMiscData%Vr_wake,1) + i1_u = UBOUND(SrcMiscData%Vr_wake,1) + IF (.NOT. ALLOCATED(DstMiscData%Vr_wake)) THEN + ALLOCATE(DstMiscData%Vr_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vr_wake = SrcMiscData%Vr_wake +ENDIF +IF (ALLOCATED(SrcMiscData%outVizXYPlane)) THEN + i1_l = LBOUND(SrcMiscData%outVizXYPlane,1) + i1_u = UBOUND(SrcMiscData%outVizXYPlane,1) + i2_l = LBOUND(SrcMiscData%outVizXYPlane,2) + i2_u = UBOUND(SrcMiscData%outVizXYPlane,2) + i3_l = LBOUND(SrcMiscData%outVizXYPlane,3) + i3_u = UBOUND(SrcMiscData%outVizXYPlane,3) + i4_l = LBOUND(SrcMiscData%outVizXYPlane,4) + i4_u = UBOUND(SrcMiscData%outVizXYPlane,4) + IF (.NOT. ALLOCATED(DstMiscData%outVizXYPlane)) THEN + ALLOCATE(DstMiscData%outVizXYPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%outVizXYPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%outVizXYPlane = SrcMiscData%outVizXYPlane +ENDIF +IF (ALLOCATED(SrcMiscData%outVizYZPlane)) THEN + i1_l = LBOUND(SrcMiscData%outVizYZPlane,1) + i1_u = UBOUND(SrcMiscData%outVizYZPlane,1) + i2_l = LBOUND(SrcMiscData%outVizYZPlane,2) + i2_u = UBOUND(SrcMiscData%outVizYZPlane,2) + i3_l = LBOUND(SrcMiscData%outVizYZPlane,3) + i3_u = UBOUND(SrcMiscData%outVizYZPlane,3) + i4_l = LBOUND(SrcMiscData%outVizYZPlane,4) + i4_u = UBOUND(SrcMiscData%outVizYZPlane,4) + IF (.NOT. ALLOCATED(DstMiscData%outVizYZPlane)) THEN + ALLOCATE(DstMiscData%outVizYZPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%outVizYZPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%outVizYZPlane = SrcMiscData%outVizYZPlane +ENDIF +IF (ALLOCATED(SrcMiscData%outVizXZPlane)) THEN + i1_l = LBOUND(SrcMiscData%outVizXZPlane,1) + i1_u = UBOUND(SrcMiscData%outVizXZPlane,1) + i2_l = LBOUND(SrcMiscData%outVizXZPlane,2) + i2_u = UBOUND(SrcMiscData%outVizXZPlane,2) + i3_l = LBOUND(SrcMiscData%outVizXZPlane,3) + i3_u = UBOUND(SrcMiscData%outVizXZPlane,3) + i4_l = LBOUND(SrcMiscData%outVizXZPlane,4) + i4_u = UBOUND(SrcMiscData%outVizXZPlane,4) + IF (.NOT. ALLOCATED(DstMiscData%outVizXZPlane)) THEN + ALLOCATE(DstMiscData%outVizXZPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%outVizXZPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%outVizXZPlane = SrcMiscData%outVizXZPlane +ENDIF +IF (ALLOCATED(SrcMiscData%IfW)) THEN + i1_l = LBOUND(SrcMiscData%IfW,1) + i1_u = UBOUND(SrcMiscData%IfW,1) + IF (.NOT. ALLOCATED(DstMiscData%IfW)) THEN + ALLOCATE(DstMiscData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%IfW,1), UBOUND(SrcMiscData%IfW,1) + CALL InflowWind_CopyMisc( SrcMiscData%IfW(i1), DstMiscData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL InflowWind_CopyInput( SrcMiscData%u_IfW_Low, DstMiscData%u_IfW_Low, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL InflowWind_CopyInput( SrcMiscData%u_IfW_High, DstMiscData%u_IfW_High, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL InflowWind_CopyOutput( SrcMiscData%y_IfW_Low, DstMiscData%y_IfW_Low, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL InflowWind_CopyOutput( SrcMiscData%y_IfW_High, DstMiscData%y_IfW_High, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE AWAE_CopyMisc + + SUBROUTINE AWAE_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(AWAE_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(MiscData%Vamb_low)) THEN + DEALLOCATE(MiscData%Vamb_low) +ENDIF +IF (ALLOCATED(MiscData%Vamb_lowpol)) THEN + DEALLOCATE(MiscData%Vamb_lowpol) +ENDIF +IF (ALLOCATED(MiscData%Vdist_low)) THEN + DEALLOCATE(MiscData%Vdist_low) +ENDIF +IF (ALLOCATED(MiscData%Vamb_High)) THEN +DO i1 = LBOUND(MiscData%Vamb_High,1), UBOUND(MiscData%Vamb_High,1) + CALL AWAE_Destroyhighwindgrid( MiscData%Vamb_High(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%Vamb_High) +ENDIF +IF (ALLOCATED(MiscData%xhat_plane)) THEN + DEALLOCATE(MiscData%xhat_plane) +ENDIF +IF (ALLOCATED(MiscData%rhat_plane)) THEN + DEALLOCATE(MiscData%rhat_plane) +ENDIF +IF (ALLOCATED(MiscData%parallelFlag)) THEN + DEALLOCATE(MiscData%parallelFlag) +ENDIF +IF (ALLOCATED(MiscData%r_s)) THEN + DEALLOCATE(MiscData%r_s) +ENDIF +IF (ALLOCATED(MiscData%r_e)) THEN + DEALLOCATE(MiscData%r_e) +ENDIF +IF (ALLOCATED(MiscData%rhat_s)) THEN + DEALLOCATE(MiscData%rhat_s) +ENDIF +IF (ALLOCATED(MiscData%rhat_e)) THEN + DEALLOCATE(MiscData%rhat_e) +ENDIF +IF (ALLOCATED(MiscData%pvec_cs)) THEN + DEALLOCATE(MiscData%pvec_cs) +ENDIF +IF (ALLOCATED(MiscData%pvec_ce)) THEN + DEALLOCATE(MiscData%pvec_ce) +ENDIF +IF (ALLOCATED(MiscData%Vx_wake)) THEN + DEALLOCATE(MiscData%Vx_wake) +ENDIF +IF (ALLOCATED(MiscData%Vr_wake)) THEN + DEALLOCATE(MiscData%Vr_wake) +ENDIF +IF (ALLOCATED(MiscData%outVizXYPlane)) THEN + DEALLOCATE(MiscData%outVizXYPlane) +ENDIF +IF (ALLOCATED(MiscData%outVizYZPlane)) THEN + DEALLOCATE(MiscData%outVizYZPlane) +ENDIF +IF (ALLOCATED(MiscData%outVizXZPlane)) THEN + DEALLOCATE(MiscData%outVizXZPlane) +ENDIF +IF (ALLOCATED(MiscData%IfW)) THEN +DO i1 = LBOUND(MiscData%IfW,1), UBOUND(MiscData%IfW,1) + CALL InflowWind_DestroyMisc( MiscData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%IfW) +ENDIF + CALL InflowWind_DestroyInput( MiscData%u_IfW_Low, ErrStat, ErrMsg ) + CALL InflowWind_DestroyInput( MiscData%u_IfW_High, ErrStat, ErrMsg ) + CALL InflowWind_DestroyOutput( MiscData%y_IfW_Low, ErrStat, ErrMsg ) + CALL InflowWind_DestroyOutput( MiscData%y_IfW_High, ErrStat, ErrMsg ) + END SUBROUTINE AWAE_DestroyMisc + + SUBROUTINE AWAE_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Vamb_low allocated yes/no + IF ( ALLOCATED(InData%Vamb_low) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! Vamb_low upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vamb_low) ! Vamb_low + END IF + Int_BufSz = Int_BufSz + 1 ! Vamb_lowpol allocated yes/no + IF ( ALLOCATED(InData%Vamb_lowpol) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Vamb_lowpol upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vamb_lowpol) ! Vamb_lowpol + END IF + Int_BufSz = Int_BufSz + 1 ! Vdist_low allocated yes/no + IF ( ALLOCATED(InData%Vdist_low) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! Vdist_low upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vdist_low) ! Vdist_low + END IF + Int_BufSz = Int_BufSz + 1 ! Vamb_High allocated yes/no + IF ( ALLOCATED(InData%Vamb_High) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vamb_High upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%Vamb_High,1), UBOUND(InData%Vamb_High,1) + Int_BufSz = Int_BufSz + 3 ! Vamb_High: size of buffers for each call to pack subtype + CALL AWAE_Packhighwindgrid( Re_Buf, Db_Buf, Int_Buf, InData%Vamb_High(i1), ErrStat2, ErrMsg2, .TRUE. ) ! Vamb_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Vamb_High + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Vamb_High + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Vamb_High + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! xhat_plane allocated yes/no + IF ( ALLOCATED(InData%xhat_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! xhat_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xhat_plane) ! xhat_plane + END IF + Int_BufSz = Int_BufSz + 1 ! rhat_plane allocated yes/no + IF ( ALLOCATED(InData%rhat_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! rhat_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rhat_plane) ! rhat_plane + END IF + Int_BufSz = Int_BufSz + 1 ! parallelFlag allocated yes/no + IF ( ALLOCATED(InData%parallelFlag) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! parallelFlag upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%parallelFlag) ! parallelFlag + END IF + Int_BufSz = Int_BufSz + 1 ! r_s allocated yes/no + IF ( ALLOCATED(InData%r_s) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! r_s upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r_s) ! r_s + END IF + Int_BufSz = Int_BufSz + 1 ! r_e allocated yes/no + IF ( ALLOCATED(InData%r_e) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! r_e upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r_e) ! r_e + END IF + Int_BufSz = Int_BufSz + 1 ! rhat_s allocated yes/no + IF ( ALLOCATED(InData%rhat_s) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! rhat_s upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rhat_s) ! rhat_s + END IF + Int_BufSz = Int_BufSz + 1 ! rhat_e allocated yes/no + IF ( ALLOCATED(InData%rhat_e) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! rhat_e upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rhat_e) ! rhat_e + END IF + Int_BufSz = Int_BufSz + 1 ! pvec_cs allocated yes/no + IF ( ALLOCATED(InData%pvec_cs) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! pvec_cs upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%pvec_cs) ! pvec_cs + END IF + Int_BufSz = Int_BufSz + 1 ! pvec_ce allocated yes/no + IF ( ALLOCATED(InData%pvec_ce) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! pvec_ce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%pvec_ce) ! pvec_ce + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wake allocated yes/no + IF ( ALLOCATED(InData%Vx_wake) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vx_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wake) ! Vx_wake + END IF + Int_BufSz = Int_BufSz + 1 ! Vr_wake allocated yes/no + IF ( ALLOCATED(InData%Vr_wake) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vr_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vr_wake) ! Vr_wake + END IF + Int_BufSz = Int_BufSz + 1 ! outVizXYPlane allocated yes/no + IF ( ALLOCATED(InData%outVizXYPlane) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! outVizXYPlane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%outVizXYPlane) ! outVizXYPlane + END IF + Int_BufSz = Int_BufSz + 1 ! outVizYZPlane allocated yes/no + IF ( ALLOCATED(InData%outVizYZPlane) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! outVizYZPlane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%outVizYZPlane) ! outVizYZPlane + END IF + Int_BufSz = Int_BufSz + 1 ! outVizXZPlane allocated yes/no + IF ( ALLOCATED(InData%outVizXZPlane) ) THEN + Int_BufSz = Int_BufSz + 2*4 ! outVizXZPlane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%outVizXZPlane) ! outVizXZPlane + END IF + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! u_IfW_Low: size of buffers for each call to pack subtype + CALL InflowWind_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_IfW_Low, ErrStat2, ErrMsg2, .TRUE. ) ! u_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_IfW_Low + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_IfW_Low + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_IfW_Low + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! u_IfW_High: size of buffers for each call to pack subtype + CALL InflowWind_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_IfW_High, ErrStat2, ErrMsg2, .TRUE. ) ! u_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_IfW_High + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_IfW_High + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_IfW_High + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! y_IfW_Low: size of buffers for each call to pack subtype + CALL InflowWind_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_IfW_Low, ErrStat2, ErrMsg2, .TRUE. ) ! y_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_IfW_Low + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_IfW_Low + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_IfW_Low + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! y_IfW_High: size of buffers for each call to pack subtype + CALL InflowWind_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_IfW_High, ErrStat2, ErrMsg2, .TRUE. ) ! y_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_IfW_High + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_IfW_High + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_IfW_High + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%Vamb_low) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_low,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_low,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_low,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_low,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_low,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_low,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_low,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_low,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%Vamb_low,4), UBOUND(InData%Vamb_low,4) + DO i3 = LBOUND(InData%Vamb_low,3), UBOUND(InData%Vamb_low,3) + DO i2 = LBOUND(InData%Vamb_low,2), UBOUND(InData%Vamb_low,2) + DO i1 = LBOUND(InData%Vamb_low,1), UBOUND(InData%Vamb_low,1) + ReKiBuf(Re_Xferred) = InData%Vamb_low(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vamb_lowpol) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_lowpol,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_lowpol,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_lowpol,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_lowpol,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Vamb_lowpol,2), UBOUND(InData%Vamb_lowpol,2) + DO i1 = LBOUND(InData%Vamb_lowpol,1), UBOUND(InData%Vamb_lowpol,1) + ReKiBuf(Re_Xferred) = InData%Vamb_lowpol(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vdist_low) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_low,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_low,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_low,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_low,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_low,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_low,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_low,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_low,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%Vdist_low,4), UBOUND(InData%Vdist_low,4) + DO i3 = LBOUND(InData%Vdist_low,3), UBOUND(InData%Vdist_low,3) + DO i2 = LBOUND(InData%Vdist_low,2), UBOUND(InData%Vdist_low,2) + DO i1 = LBOUND(InData%Vdist_low,1), UBOUND(InData%Vdist_low,1) + ReKiBuf(Re_Xferred) = InData%Vdist_low(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vamb_High) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vamb_High,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vamb_High,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vamb_High,1), UBOUND(InData%Vamb_High,1) + CALL AWAE_Packhighwindgrid( Re_Buf, Db_Buf, Int_Buf, InData%Vamb_High(i1), ErrStat2, ErrMsg2, OnlySize ) ! Vamb_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%xhat_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%xhat_plane,2), UBOUND(InData%xhat_plane,2) + DO i1 = LBOUND(InData%xhat_plane,1), UBOUND(InData%xhat_plane,1) + ReKiBuf(Re_Xferred) = InData%xhat_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rhat_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%rhat_plane,2), UBOUND(InData%rhat_plane,2) + DO i1 = LBOUND(InData%rhat_plane,1), UBOUND(InData%rhat_plane,1) + ReKiBuf(Re_Xferred) = InData%rhat_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%parallelFlag) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%parallelFlag,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%parallelFlag,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%parallelFlag,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%parallelFlag,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%parallelFlag,2), UBOUND(InData%parallelFlag,2) + DO i1 = LBOUND(InData%parallelFlag,1), UBOUND(InData%parallelFlag,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%parallelFlag(i1,i2), IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%r_s) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r_s,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r_s,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r_s,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r_s,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%r_s,2), UBOUND(InData%r_s,2) + DO i1 = LBOUND(InData%r_s,1), UBOUND(InData%r_s,1) + ReKiBuf(Re_Xferred) = InData%r_s(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%r_e) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r_e,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r_e,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r_e,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r_e,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%r_e,2), UBOUND(InData%r_e,2) + DO i1 = LBOUND(InData%r_e,1), UBOUND(InData%r_e,1) + ReKiBuf(Re_Xferred) = InData%r_e(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rhat_s) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_s,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_s,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_s,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_s,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_s,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_s,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%rhat_s,3), UBOUND(InData%rhat_s,3) + DO i2 = LBOUND(InData%rhat_s,2), UBOUND(InData%rhat_s,2) + DO i1 = LBOUND(InData%rhat_s,1), UBOUND(InData%rhat_s,1) + ReKiBuf(Re_Xferred) = InData%rhat_s(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rhat_e) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_e,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_e,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_e,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_e,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rhat_e,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rhat_e,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%rhat_e,3), UBOUND(InData%rhat_e,3) + DO i2 = LBOUND(InData%rhat_e,2), UBOUND(InData%rhat_e,2) + DO i1 = LBOUND(InData%rhat_e,1), UBOUND(InData%rhat_e,1) + ReKiBuf(Re_Xferred) = InData%rhat_e(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%pvec_cs) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_cs,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_cs,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_cs,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_cs,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_cs,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_cs,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%pvec_cs,3), UBOUND(InData%pvec_cs,3) + DO i2 = LBOUND(InData%pvec_cs,2), UBOUND(InData%pvec_cs,2) + DO i1 = LBOUND(InData%pvec_cs,1), UBOUND(InData%pvec_cs,1) + ReKiBuf(Re_Xferred) = InData%pvec_cs(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%pvec_ce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_ce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_ce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_ce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_ce,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%pvec_ce,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%pvec_ce,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%pvec_ce,3), UBOUND(InData%pvec_ce,3) + DO i2 = LBOUND(InData%pvec_ce,2), UBOUND(InData%pvec_ce,2) + DO i1 = LBOUND(InData%pvec_ce,1), UBOUND(InData%pvec_ce,1) + ReKiBuf(Re_Xferred) = InData%pvec_ce(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vx_wake,1), UBOUND(InData%Vx_wake,1) + ReKiBuf(Re_Xferred) = InData%Vx_wake(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vr_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vr_wake,1), UBOUND(InData%Vr_wake,1) + ReKiBuf(Re_Xferred) = InData%Vr_wake(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%outVizXYPlane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXYPlane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXYPlane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXYPlane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXYPlane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXYPlane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXYPlane,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXYPlane,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXYPlane,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%outVizXYPlane,4), UBOUND(InData%outVizXYPlane,4) + DO i3 = LBOUND(InData%outVizXYPlane,3), UBOUND(InData%outVizXYPlane,3) + DO i2 = LBOUND(InData%outVizXYPlane,2), UBOUND(InData%outVizXYPlane,2) + DO i1 = LBOUND(InData%outVizXYPlane,1), UBOUND(InData%outVizXYPlane,1) + ReKiBuf(Re_Xferred) = InData%outVizXYPlane(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%outVizYZPlane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizYZPlane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizYZPlane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizYZPlane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizYZPlane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizYZPlane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizYZPlane,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizYZPlane,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizYZPlane,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%outVizYZPlane,4), UBOUND(InData%outVizYZPlane,4) + DO i3 = LBOUND(InData%outVizYZPlane,3), UBOUND(InData%outVizYZPlane,3) + DO i2 = LBOUND(InData%outVizYZPlane,2), UBOUND(InData%outVizYZPlane,2) + DO i1 = LBOUND(InData%outVizYZPlane,1), UBOUND(InData%outVizYZPlane,1) + ReKiBuf(Re_Xferred) = InData%outVizYZPlane(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%outVizXZPlane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXZPlane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXZPlane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXZPlane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXZPlane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXZPlane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXZPlane,3) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%outVizXZPlane,4) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%outVizXZPlane,4) + Int_Xferred = Int_Xferred + 2 + + DO i4 = LBOUND(InData%outVizXZPlane,4), UBOUND(InData%outVizXZPlane,4) + DO i3 = LBOUND(InData%outVizXZPlane,3), UBOUND(InData%outVizXZPlane,3) + DO i2 = LBOUND(InData%outVizXZPlane,2), UBOUND(InData%outVizXZPlane,2) + DO i1 = LBOUND(InData%outVizXZPlane,1), UBOUND(InData%outVizXZPlane,1) + ReKiBuf(Re_Xferred) = InData%outVizXZPlane(i1,i2,i3,i4) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL InflowWind_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_IfW_Low, ErrStat2, ErrMsg2, OnlySize ) ! u_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL InflowWind_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_IfW_High, ErrStat2, ErrMsg2, OnlySize ) ! u_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL InflowWind_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_IfW_Low, ErrStat2, ErrMsg2, OnlySize ) ! y_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL InflowWind_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_IfW_High, ErrStat2, ErrMsg2, OnlySize ) ! y_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE AWAE_PackMisc + + SUBROUTINE AWAE_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: i4, i4_l, i4_u ! bounds (upper/lower) for an array dimension 4 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vamb_low not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vamb_low)) DEALLOCATE(OutData%Vamb_low) + ALLOCATE(OutData%Vamb_low(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vamb_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%Vamb_low,4), UBOUND(OutData%Vamb_low,4) + DO i3 = LBOUND(OutData%Vamb_low,3), UBOUND(OutData%Vamb_low,3) + DO i2 = LBOUND(OutData%Vamb_low,2), UBOUND(OutData%Vamb_low,2) + DO i1 = LBOUND(OutData%Vamb_low,1), UBOUND(OutData%Vamb_low,1) + OutData%Vamb_low(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vamb_lowpol not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vamb_lowpol)) DEALLOCATE(OutData%Vamb_lowpol) + ALLOCATE(OutData%Vamb_lowpol(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vamb_lowpol.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Vamb_lowpol,2), UBOUND(OutData%Vamb_lowpol,2) + DO i1 = LBOUND(OutData%Vamb_lowpol,1), UBOUND(OutData%Vamb_lowpol,1) + OutData%Vamb_lowpol(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vdist_low not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vdist_low)) DEALLOCATE(OutData%Vdist_low) + ALLOCATE(OutData%Vdist_low(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vdist_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%Vdist_low,4), UBOUND(OutData%Vdist_low,4) + DO i3 = LBOUND(OutData%Vdist_low,3), UBOUND(OutData%Vdist_low,3) + DO i2 = LBOUND(OutData%Vdist_low,2), UBOUND(OutData%Vdist_low,2) + DO i1 = LBOUND(OutData%Vdist_low,1), UBOUND(OutData%Vdist_low,1) + OutData%Vdist_low(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vamb_High not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vamb_High)) DEALLOCATE(OutData%Vamb_High) + ALLOCATE(OutData%Vamb_High(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vamb_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vamb_High,1), UBOUND(OutData%Vamb_High,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_Unpackhighwindgrid( Re_Buf, Db_Buf, Int_Buf, OutData%Vamb_High(i1), ErrStat2, ErrMsg2 ) ! Vamb_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xhat_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xhat_plane)) DEALLOCATE(OutData%xhat_plane) + ALLOCATE(OutData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%xhat_plane,2), UBOUND(OutData%xhat_plane,2) + DO i1 = LBOUND(OutData%xhat_plane,1), UBOUND(OutData%xhat_plane,1) + OutData%xhat_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rhat_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rhat_plane)) DEALLOCATE(OutData%rhat_plane) + ALLOCATE(OutData%rhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%rhat_plane,2), UBOUND(OutData%rhat_plane,2) + DO i1 = LBOUND(OutData%rhat_plane,1), UBOUND(OutData%rhat_plane,1) + OutData%rhat_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! parallelFlag not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%parallelFlag)) DEALLOCATE(OutData%parallelFlag) + ALLOCATE(OutData%parallelFlag(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%parallelFlag.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%parallelFlag,2), UBOUND(OutData%parallelFlag,2) + DO i1 = LBOUND(OutData%parallelFlag,1), UBOUND(OutData%parallelFlag,1) + OutData%parallelFlag(i1,i2) = TRANSFER(IntKiBuf(Int_Xferred), OutData%parallelFlag(i1,i2)) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r_s not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r_s)) DEALLOCATE(OutData%r_s) + ALLOCATE(OutData%r_s(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r_s.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%r_s,2), UBOUND(OutData%r_s,2) + DO i1 = LBOUND(OutData%r_s,1), UBOUND(OutData%r_s,1) + OutData%r_s(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r_e not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r_e)) DEALLOCATE(OutData%r_e) + ALLOCATE(OutData%r_e(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r_e.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%r_e,2), UBOUND(OutData%r_e,2) + DO i1 = LBOUND(OutData%r_e,1), UBOUND(OutData%r_e,1) + OutData%r_e(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rhat_s not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rhat_s)) DEALLOCATE(OutData%rhat_s) + ALLOCATE(OutData%rhat_s(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rhat_s.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%rhat_s,3), UBOUND(OutData%rhat_s,3) + DO i2 = LBOUND(OutData%rhat_s,2), UBOUND(OutData%rhat_s,2) + DO i1 = LBOUND(OutData%rhat_s,1), UBOUND(OutData%rhat_s,1) + OutData%rhat_s(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rhat_e not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rhat_e)) DEALLOCATE(OutData%rhat_e) + ALLOCATE(OutData%rhat_e(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rhat_e.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%rhat_e,3), UBOUND(OutData%rhat_e,3) + DO i2 = LBOUND(OutData%rhat_e,2), UBOUND(OutData%rhat_e,2) + DO i1 = LBOUND(OutData%rhat_e,1), UBOUND(OutData%rhat_e,1) + OutData%rhat_e(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! pvec_cs not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%pvec_cs)) DEALLOCATE(OutData%pvec_cs) + ALLOCATE(OutData%pvec_cs(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%pvec_cs.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%pvec_cs,3), UBOUND(OutData%pvec_cs,3) + DO i2 = LBOUND(OutData%pvec_cs,2), UBOUND(OutData%pvec_cs,2) + DO i1 = LBOUND(OutData%pvec_cs,1), UBOUND(OutData%pvec_cs,1) + OutData%pvec_cs(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! pvec_ce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%pvec_ce)) DEALLOCATE(OutData%pvec_ce) + ALLOCATE(OutData%pvec_ce(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%pvec_ce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%pvec_ce,3), UBOUND(OutData%pvec_ce,3) + DO i2 = LBOUND(OutData%pvec_ce,2), UBOUND(OutData%pvec_ce,2) + DO i1 = LBOUND(OutData%pvec_ce,1), UBOUND(OutData%pvec_ce,1) + OutData%pvec_ce(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wake)) DEALLOCATE(OutData%Vx_wake) + ALLOCATE(OutData%Vx_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vx_wake,1), UBOUND(OutData%Vx_wake,1) + OutData%Vx_wake(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vr_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vr_wake)) DEALLOCATE(OutData%Vr_wake) + ALLOCATE(OutData%Vr_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vr_wake,1), UBOUND(OutData%Vr_wake,1) + OutData%Vr_wake(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! outVizXYPlane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%outVizXYPlane)) DEALLOCATE(OutData%outVizXYPlane) + ALLOCATE(OutData%outVizXYPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%outVizXYPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%outVizXYPlane,4), UBOUND(OutData%outVizXYPlane,4) + DO i3 = LBOUND(OutData%outVizXYPlane,3), UBOUND(OutData%outVizXYPlane,3) + DO i2 = LBOUND(OutData%outVizXYPlane,2), UBOUND(OutData%outVizXYPlane,2) + DO i1 = LBOUND(OutData%outVizXYPlane,1), UBOUND(OutData%outVizXYPlane,1) + OutData%outVizXYPlane(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! outVizYZPlane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%outVizYZPlane)) DEALLOCATE(OutData%outVizYZPlane) + ALLOCATE(OutData%outVizYZPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%outVizYZPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%outVizYZPlane,4), UBOUND(OutData%outVizYZPlane,4) + DO i3 = LBOUND(OutData%outVizYZPlane,3), UBOUND(OutData%outVizYZPlane,3) + DO i2 = LBOUND(OutData%outVizYZPlane,2), UBOUND(OutData%outVizYZPlane,2) + DO i1 = LBOUND(OutData%outVizYZPlane,1), UBOUND(OutData%outVizYZPlane,1) + OutData%outVizYZPlane(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! outVizXZPlane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i4_l = IntKiBuf( Int_Xferred ) + i4_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%outVizXZPlane)) DEALLOCATE(OutData%outVizXZPlane) + ALLOCATE(OutData%outVizXZPlane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%outVizXZPlane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i4 = LBOUND(OutData%outVizXZPlane,4), UBOUND(OutData%outVizXZPlane,4) + DO i3 = LBOUND(OutData%outVizXZPlane,3), UBOUND(OutData%outVizXZPlane,3) + DO i2 = LBOUND(OutData%outVizXZPlane,2), UBOUND(OutData%outVizXZPlane,2) + DO i1 = LBOUND(OutData%outVizXZPlane,1), UBOUND(OutData%outVizXZPlane,1) + OutData%outVizXZPlane(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_IfW_Low, ErrStat2, ErrMsg2 ) ! u_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_IfW_High, ErrStat2, ErrMsg2 ) ! u_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_IfW_Low, ErrStat2, ErrMsg2 ) ! y_IfW_Low + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_IfW_High, ErrStat2, ErrMsg2 ) ! y_IfW_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE AWAE_UnPackMisc + + SUBROUTINE AWAE_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_ParameterType), INTENT(IN) :: SrcParamData + TYPE(AWAE_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%WindFilePath = SrcParamData%WindFilePath + DstParamData%NumTurbines = SrcParamData%NumTurbines + DstParamData%NumRadii = SrcParamData%NumRadii + DstParamData%NumPlanes = SrcParamData%NumPlanes +IF (ALLOCATED(SrcParamData%r)) THEN + i1_l = LBOUND(SrcParamData%r,1) + i1_u = UBOUND(SrcParamData%r,1) + IF (.NOT. ALLOCATED(DstParamData%r)) THEN + ALLOCATE(DstParamData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%r = SrcParamData%r +ENDIF + DstParamData%Mod_AmbWind = SrcParamData%Mod_AmbWind + DstParamData%nX_low = SrcParamData%nX_low + DstParamData%nY_low = SrcParamData%nY_low + DstParamData%nZ_low = SrcParamData%nZ_low + DstParamData%NumGrid_low = SrcParamData%NumGrid_low + DstParamData%n_rp_max = SrcParamData%n_rp_max + DstParamData%dpol = SrcParamData%dpol + DstParamData%dXYZ_low = SrcParamData%dXYZ_low + DstParamData%dX_low = SrcParamData%dX_low + DstParamData%dY_low = SrcParamData%dY_low + DstParamData%dZ_low = SrcParamData%dZ_low + DstParamData%X0_low = SrcParamData%X0_low + DstParamData%Y0_low = SrcParamData%Y0_low + DstParamData%Z0_low = SrcParamData%Z0_low +IF (ALLOCATED(SrcParamData%X0_high)) THEN + i1_l = LBOUND(SrcParamData%X0_high,1) + i1_u = UBOUND(SrcParamData%X0_high,1) + IF (.NOT. ALLOCATED(DstParamData%X0_high)) THEN + ALLOCATE(DstParamData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%X0_high = SrcParamData%X0_high +ENDIF +IF (ALLOCATED(SrcParamData%Y0_high)) THEN + i1_l = LBOUND(SrcParamData%Y0_high,1) + i1_u = UBOUND(SrcParamData%Y0_high,1) + IF (.NOT. ALLOCATED(DstParamData%Y0_high)) THEN + ALLOCATE(DstParamData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%Y0_high = SrcParamData%Y0_high +ENDIF +IF (ALLOCATED(SrcParamData%Z0_high)) THEN + i1_l = LBOUND(SrcParamData%Z0_high,1) + i1_u = UBOUND(SrcParamData%Z0_high,1) + IF (.NOT. ALLOCATED(DstParamData%Z0_high)) THEN + ALLOCATE(DstParamData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%Z0_high = SrcParamData%Z0_high +ENDIF +IF (ALLOCATED(SrcParamData%dX_high)) THEN + i1_l = LBOUND(SrcParamData%dX_high,1) + i1_u = UBOUND(SrcParamData%dX_high,1) + IF (.NOT. ALLOCATED(DstParamData%dX_high)) THEN + ALLOCATE(DstParamData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%dX_high = SrcParamData%dX_high +ENDIF +IF (ALLOCATED(SrcParamData%dY_high)) THEN + i1_l = LBOUND(SrcParamData%dY_high,1) + i1_u = UBOUND(SrcParamData%dY_high,1) + IF (.NOT. ALLOCATED(DstParamData%dY_high)) THEN + ALLOCATE(DstParamData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%dY_high = SrcParamData%dY_high +ENDIF +IF (ALLOCATED(SrcParamData%dZ_high)) THEN + i1_l = LBOUND(SrcParamData%dZ_high,1) + i1_u = UBOUND(SrcParamData%dZ_high,1) + IF (.NOT. ALLOCATED(DstParamData%dZ_high)) THEN + ALLOCATE(DstParamData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%dZ_high = SrcParamData%dZ_high +ENDIF + DstParamData%nX_high = SrcParamData%nX_high + DstParamData%nY_high = SrcParamData%nY_high + DstParamData%nZ_high = SrcParamData%nZ_high +IF (ALLOCATED(SrcParamData%Grid_low)) THEN + i1_l = LBOUND(SrcParamData%Grid_low,1) + i1_u = UBOUND(SrcParamData%Grid_low,1) + i2_l = LBOUND(SrcParamData%Grid_low,2) + i2_u = UBOUND(SrcParamData%Grid_low,2) + IF (.NOT. ALLOCATED(DstParamData%Grid_low)) THEN + ALLOCATE(DstParamData%Grid_low(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%Grid_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%Grid_low = SrcParamData%Grid_low +ENDIF +IF (ALLOCATED(SrcParamData%Grid_high)) THEN + i1_l = LBOUND(SrcParamData%Grid_high,1) + i1_u = UBOUND(SrcParamData%Grid_high,1) + i2_l = LBOUND(SrcParamData%Grid_high,2) + i2_u = UBOUND(SrcParamData%Grid_high,2) + i3_l = LBOUND(SrcParamData%Grid_high,3) + i3_u = UBOUND(SrcParamData%Grid_high,3) + IF (.NOT. ALLOCATED(DstParamData%Grid_high)) THEN + ALLOCATE(DstParamData%Grid_high(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%Grid_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%Grid_high = SrcParamData%Grid_high +ENDIF +IF (ALLOCATED(SrcParamData%WT_Position)) THEN + i1_l = LBOUND(SrcParamData%WT_Position,1) + i1_u = UBOUND(SrcParamData%WT_Position,1) + i2_l = LBOUND(SrcParamData%WT_Position,2) + i2_u = UBOUND(SrcParamData%WT_Position,2) + IF (.NOT. ALLOCATED(DstParamData%WT_Position)) THEN + ALLOCATE(DstParamData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%WT_Position = SrcParamData%WT_Position +ENDIF + DstParamData%n_high_low = SrcParamData%n_high_low + DstParamData%dt_low = SrcParamData%dt_low + DstParamData%dt_high = SrcParamData%dt_high + DstParamData%NumDT = SrcParamData%NumDT + DstParamData%Mod_Meander = SrcParamData%Mod_Meander + DstParamData%C_Meander = SrcParamData%C_Meander + DstParamData%C_ScaleDiam = SrcParamData%C_ScaleDiam +IF (ALLOCATED(SrcParamData%IfW)) THEN + i1_l = LBOUND(SrcParamData%IfW,1) + i1_u = UBOUND(SrcParamData%IfW,1) + IF (.NOT. ALLOCATED(DstParamData%IfW)) THEN + ALLOCATE(DstParamData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%IfW,1), UBOUND(SrcParamData%IfW,1) + CALL InflowWind_CopyParam( SrcParamData%IfW(i1), DstParamData%IfW(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + DstParamData%WrDisSkp1 = SrcParamData%WrDisSkp1 + DstParamData%WrDisWind = SrcParamData%WrDisWind + DstParamData%NOutDisWindXY = SrcParamData%NOutDisWindXY +IF (ALLOCATED(SrcParamData%OutDisWindZ)) THEN + i1_l = LBOUND(SrcParamData%OutDisWindZ,1) + i1_u = UBOUND(SrcParamData%OutDisWindZ,1) + IF (.NOT. ALLOCATED(DstParamData%OutDisWindZ)) THEN + ALLOCATE(DstParamData%OutDisWindZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutDisWindZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%OutDisWindZ = SrcParamData%OutDisWindZ +ENDIF + DstParamData%NOutDisWindYZ = SrcParamData%NOutDisWindYZ +IF (ALLOCATED(SrcParamData%OutDisWindX)) THEN + i1_l = LBOUND(SrcParamData%OutDisWindX,1) + i1_u = UBOUND(SrcParamData%OutDisWindX,1) + IF (.NOT. ALLOCATED(DstParamData%OutDisWindX)) THEN + ALLOCATE(DstParamData%OutDisWindX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutDisWindX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%OutDisWindX = SrcParamData%OutDisWindX +ENDIF + DstParamData%NOutDisWindXZ = SrcParamData%NOutDisWindXZ +IF (ALLOCATED(SrcParamData%OutDisWindY)) THEN + i1_l = LBOUND(SrcParamData%OutDisWindY,1) + i1_u = UBOUND(SrcParamData%OutDisWindY,1) + IF (.NOT. ALLOCATED(DstParamData%OutDisWindY)) THEN + ALLOCATE(DstParamData%OutDisWindY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%OutDisWindY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%OutDisWindY = SrcParamData%OutDisWindY +ENDIF + DstParamData%OutFileRoot = SrcParamData%OutFileRoot + DstParamData%OutFileVTKRoot = SrcParamData%OutFileVTKRoot + DstParamData%VTK_tWidth = SrcParamData%VTK_tWidth + END SUBROUTINE AWAE_CopyParam + + SUBROUTINE AWAE_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(AWAE_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%r)) THEN + DEALLOCATE(ParamData%r) +ENDIF +IF (ALLOCATED(ParamData%X0_high)) THEN + DEALLOCATE(ParamData%X0_high) +ENDIF +IF (ALLOCATED(ParamData%Y0_high)) THEN + DEALLOCATE(ParamData%Y0_high) +ENDIF +IF (ALLOCATED(ParamData%Z0_high)) THEN + DEALLOCATE(ParamData%Z0_high) +ENDIF +IF (ALLOCATED(ParamData%dX_high)) THEN + DEALLOCATE(ParamData%dX_high) +ENDIF +IF (ALLOCATED(ParamData%dY_high)) THEN + DEALLOCATE(ParamData%dY_high) +ENDIF +IF (ALLOCATED(ParamData%dZ_high)) THEN + DEALLOCATE(ParamData%dZ_high) +ENDIF +IF (ALLOCATED(ParamData%Grid_low)) THEN + DEALLOCATE(ParamData%Grid_low) +ENDIF +IF (ALLOCATED(ParamData%Grid_high)) THEN + DEALLOCATE(ParamData%Grid_high) +ENDIF +IF (ALLOCATED(ParamData%WT_Position)) THEN + DEALLOCATE(ParamData%WT_Position) +ENDIF +IF (ALLOCATED(ParamData%IfW)) THEN +DO i1 = LBOUND(ParamData%IfW,1), UBOUND(ParamData%IfW,1) + CALL InflowWind_DestroyParam( ParamData%IfW(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%IfW) +ENDIF +IF (ALLOCATED(ParamData%OutDisWindZ)) THEN + DEALLOCATE(ParamData%OutDisWindZ) +ENDIF +IF (ALLOCATED(ParamData%OutDisWindX)) THEN + DEALLOCATE(ParamData%OutDisWindX) +ENDIF +IF (ALLOCATED(ParamData%OutDisWindY)) THEN + DEALLOCATE(ParamData%OutDisWindY) +ENDIF + END SUBROUTINE AWAE_DestroyParam + + SUBROUTINE AWAE_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1*LEN(InData%WindFilePath) ! WindFilePath + Int_BufSz = Int_BufSz + 1 ! NumTurbines + Int_BufSz = Int_BufSz + 1 ! NumRadii + Int_BufSz = Int_BufSz + 1 ! NumPlanes + Int_BufSz = Int_BufSz + 1 ! r allocated yes/no + IF ( ALLOCATED(InData%r) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! r upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r) ! r + END IF + Int_BufSz = Int_BufSz + 1 ! Mod_AmbWind + Int_BufSz = Int_BufSz + 1 ! nX_low + Int_BufSz = Int_BufSz + 1 ! nY_low + Int_BufSz = Int_BufSz + 1 ! nZ_low + Int_BufSz = Int_BufSz + 1 ! NumGrid_low + Int_BufSz = Int_BufSz + 1 ! n_rp_max + Re_BufSz = Re_BufSz + 1 ! dpol + Re_BufSz = Re_BufSz + SIZE(InData%dXYZ_low) ! dXYZ_low + Re_BufSz = Re_BufSz + 1 ! dX_low + Re_BufSz = Re_BufSz + 1 ! dY_low + Re_BufSz = Re_BufSz + 1 ! dZ_low + Re_BufSz = Re_BufSz + 1 ! X0_low + Re_BufSz = Re_BufSz + 1 ! Y0_low + Re_BufSz = Re_BufSz + 1 ! Z0_low + Int_BufSz = Int_BufSz + 1 ! X0_high allocated yes/no + IF ( ALLOCATED(InData%X0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! X0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%X0_high) ! X0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Y0_high allocated yes/no + IF ( ALLOCATED(InData%Y0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Y0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Y0_high) ! Y0_high + END IF + Int_BufSz = Int_BufSz + 1 ! Z0_high allocated yes/no + IF ( ALLOCATED(InData%Z0_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Z0_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Z0_high) ! Z0_high + END IF + Int_BufSz = Int_BufSz + 1 ! dX_high allocated yes/no + IF ( ALLOCATED(InData%dX_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dX_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dX_high) ! dX_high + END IF + Int_BufSz = Int_BufSz + 1 ! dY_high allocated yes/no + IF ( ALLOCATED(InData%dY_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dY_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dY_high) ! dY_high + END IF + Int_BufSz = Int_BufSz + 1 ! dZ_high allocated yes/no + IF ( ALLOCATED(InData%dZ_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dZ_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dZ_high) ! dZ_high + END IF + Int_BufSz = Int_BufSz + 1 ! nX_high + Int_BufSz = Int_BufSz + 1 ! nY_high + Int_BufSz = Int_BufSz + 1 ! nZ_high + Int_BufSz = Int_BufSz + 1 ! Grid_low allocated yes/no + IF ( ALLOCATED(InData%Grid_low) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Grid_low upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Grid_low) ! Grid_low + END IF + Int_BufSz = Int_BufSz + 1 ! Grid_high allocated yes/no + IF ( ALLOCATED(InData%Grid_high) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! Grid_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Grid_high) ! Grid_high + END IF + Int_BufSz = Int_BufSz + 1 ! WT_Position allocated yes/no + IF ( ALLOCATED(InData%WT_Position) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! WT_Position upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%WT_Position) ! WT_Position + END IF + Int_BufSz = Int_BufSz + 1 ! n_high_low + Db_BufSz = Db_BufSz + 1 ! dt_low + Db_BufSz = Db_BufSz + 1 ! dt_high + Int_BufSz = Int_BufSz + 1 ! NumDT + Int_BufSz = Int_BufSz + 1 ! Mod_Meander + Re_BufSz = Re_BufSz + 1 ! C_Meander + Re_BufSz = Re_BufSz + 1 ! C_ScaleDiam + Int_BufSz = Int_BufSz + 1 ! IfW allocated yes/no + IF ( ALLOCATED(InData%IfW) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! IfW upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + Int_BufSz = Int_BufSz + 3 ! IfW: size of buffers for each call to pack subtype + CALL InflowWind_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, .TRUE. ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! IfW + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! IfW + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! IfW + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! WrDisSkp1 + Int_BufSz = Int_BufSz + 1 ! WrDisWind + Int_BufSz = Int_BufSz + 1 ! NOutDisWindXY + Int_BufSz = Int_BufSz + 1 ! OutDisWindZ allocated yes/no + IF ( ALLOCATED(InData%OutDisWindZ) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindZ upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindZ) ! OutDisWindZ + END IF + Int_BufSz = Int_BufSz + 1 ! NOutDisWindYZ + Int_BufSz = Int_BufSz + 1 ! OutDisWindX allocated yes/no + IF ( ALLOCATED(InData%OutDisWindX) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindX upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindX) ! OutDisWindX + END IF + Int_BufSz = Int_BufSz + 1 ! NOutDisWindXZ + Int_BufSz = Int_BufSz + 1 ! OutDisWindY allocated yes/no + IF ( ALLOCATED(InData%OutDisWindY) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! OutDisWindY upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%OutDisWindY) ! OutDisWindY + END IF + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFileRoot) ! OutFileRoot + Int_BufSz = Int_BufSz + 1*LEN(InData%OutFileVTKRoot) ! OutFileVTKRoot + Int_BufSz = Int_BufSz + 1 ! VTK_tWidth + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DO I = 1, LEN(InData%WindFilePath) + IntKiBuf(Int_Xferred) = ICHAR(InData%WindFilePath(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%NumTurbines + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumRadii + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumPlanes + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%r) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%r,1), UBOUND(InData%r,1) + ReKiBuf(Re_Xferred) = InData%r(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%Mod_AmbWind + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nX_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumGrid_low + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%n_rp_max + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dpol + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%dXYZ_low,1), UBOUND(InData%dXYZ_low,1) + ReKiBuf(Re_Xferred) = InData%dXYZ_low(i1) + Re_Xferred = Re_Xferred + 1 + END DO + ReKiBuf(Re_Xferred) = InData%dX_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dY_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dZ_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%X0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Y0_low + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Z0_low + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%X0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%X0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%X0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%X0_high,1), UBOUND(InData%X0_high,1) + ReKiBuf(Re_Xferred) = InData%X0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Y0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Y0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Y0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Y0_high,1), UBOUND(InData%Y0_high,1) + ReKiBuf(Re_Xferred) = InData%Y0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Z0_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Z0_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Z0_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Z0_high,1), UBOUND(InData%Z0_high,1) + ReKiBuf(Re_Xferred) = InData%Z0_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dX_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dX_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dX_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dX_high,1), UBOUND(InData%dX_high,1) + ReKiBuf(Re_Xferred) = InData%dX_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dY_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dY_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dY_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dY_high,1), UBOUND(InData%dY_high,1) + ReKiBuf(Re_Xferred) = InData%dY_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dZ_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dZ_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dZ_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dZ_high,1), UBOUND(InData%dZ_high,1) + ReKiBuf(Re_Xferred) = InData%dZ_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%nX_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nY_high + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nZ_high + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%Grid_low) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Grid_low,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Grid_low,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Grid_low,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Grid_low,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Grid_low,2), UBOUND(InData%Grid_low,2) + DO i1 = LBOUND(InData%Grid_low,1), UBOUND(InData%Grid_low,1) + ReKiBuf(Re_Xferred) = InData%Grid_low(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Grid_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Grid_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Grid_high,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Grid_high,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Grid_high,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Grid_high,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Grid_high,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%Grid_high,3), UBOUND(InData%Grid_high,3) + DO i2 = LBOUND(InData%Grid_high,2), UBOUND(InData%Grid_high,2) + DO i1 = LBOUND(InData%Grid_high,1), UBOUND(InData%Grid_high,1) + ReKiBuf(Re_Xferred) = InData%Grid_high(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WT_Position) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WT_Position,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WT_Position,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%WT_Position,2), UBOUND(InData%WT_Position,2) + DO i1 = LBOUND(InData%WT_Position,1), UBOUND(InData%WT_Position,1) + ReKiBuf(Re_Xferred) = InData%WT_Position(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = InData%n_high_low + Int_Xferred = Int_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%dt_low + Db_Xferred = Db_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%dt_high + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumDT + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%Mod_Meander + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_Meander + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_ScaleDiam + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%IfW) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%IfW,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IfW,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%IfW,1), UBOUND(InData%IfW,1) + CALL InflowWind_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%IfW(i1), ErrStat2, ErrMsg2, OnlySize ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IntKiBuf(Int_Xferred) = InData%WrDisSkp1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%WrDisWind, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NOutDisWindXY + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindZ) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindZ,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindZ,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindZ,1), UBOUND(InData%OutDisWindZ,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindZ(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NOutDisWindYZ + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindX) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindX,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindX,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindX,1), UBOUND(InData%OutDisWindX,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindX(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NOutDisWindXZ + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%OutDisWindY) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutDisWindY,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutDisWindY,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutDisWindY,1), UBOUND(InData%OutDisWindY,1) + ReKiBuf(Re_Xferred) = InData%OutDisWindY(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + DO I = 1, LEN(InData%OutFileRoot) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFileRoot(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%OutFileVTKRoot) + IntKiBuf(Int_Xferred) = ICHAR(InData%OutFileVTKRoot(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%VTK_tWidth + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE AWAE_PackParam + + SUBROUTINE AWAE_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + DO I = 1, LEN(OutData%WindFilePath) + OutData%WindFilePath(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%NumTurbines = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumRadii = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumPlanes = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r)) DEALLOCATE(OutData%r) + ALLOCATE(OutData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%r,1), UBOUND(OutData%r,1) + OutData%r(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%Mod_AmbWind = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nX_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumGrid_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%n_rp_max = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dpol = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%dXYZ_low,1) + i1_u = UBOUND(OutData%dXYZ_low,1) + DO i1 = LBOUND(OutData%dXYZ_low,1), UBOUND(OutData%dXYZ_low,1) + OutData%dXYZ_low(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%dX_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dY_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%dZ_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%X0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Y0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Z0_low = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! X0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%X0_high)) DEALLOCATE(OutData%X0_high) + ALLOCATE(OutData%X0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%X0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%X0_high,1), UBOUND(OutData%X0_high,1) + OutData%X0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Y0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Y0_high)) DEALLOCATE(OutData%Y0_high) + ALLOCATE(OutData%Y0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Y0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Y0_high,1), UBOUND(OutData%Y0_high,1) + OutData%Y0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Z0_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Z0_high)) DEALLOCATE(OutData%Z0_high) + ALLOCATE(OutData%Z0_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Z0_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Z0_high,1), UBOUND(OutData%Z0_high,1) + OutData%Z0_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dX_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dX_high)) DEALLOCATE(OutData%dX_high) + ALLOCATE(OutData%dX_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dX_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dX_high,1), UBOUND(OutData%dX_high,1) + OutData%dX_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dY_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dY_high)) DEALLOCATE(OutData%dY_high) + ALLOCATE(OutData%dY_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dY_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dY_high,1), UBOUND(OutData%dY_high,1) + OutData%dY_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dZ_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dZ_high)) DEALLOCATE(OutData%dZ_high) + ALLOCATE(OutData%dZ_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dZ_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dZ_high,1), UBOUND(OutData%dZ_high,1) + OutData%dZ_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%nX_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nY_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%nZ_high = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Grid_low not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Grid_low)) DEALLOCATE(OutData%Grid_low) + ALLOCATE(OutData%Grid_low(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Grid_low.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Grid_low,2), UBOUND(OutData%Grid_low,2) + DO i1 = LBOUND(OutData%Grid_low,1), UBOUND(OutData%Grid_low,1) + OutData%Grid_low(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Grid_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Grid_high)) DEALLOCATE(OutData%Grid_high) + ALLOCATE(OutData%Grid_high(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Grid_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%Grid_high,3), UBOUND(OutData%Grid_high,3) + DO i2 = LBOUND(OutData%Grid_high,2), UBOUND(OutData%Grid_high,2) + DO i1 = LBOUND(OutData%Grid_high,1), UBOUND(OutData%Grid_high,1) + OutData%Grid_high(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WT_Position not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WT_Position)) DEALLOCATE(OutData%WT_Position) + ALLOCATE(OutData%WT_Position(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WT_Position.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%WT_Position,2), UBOUND(OutData%WT_Position,2) + DO i1 = LBOUND(OutData%WT_Position,1), UBOUND(OutData%WT_Position,1) + OutData%WT_Position(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%n_high_low = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dt_low = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%dt_high = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%NumDT = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%Mod_Meander = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_Meander = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_ScaleDiam = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IfW not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IfW)) DEALLOCATE(OutData%IfW) + ALLOCATE(OutData%IfW(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IfW.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IfW,1), UBOUND(OutData%IfW,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL InflowWind_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%IfW(i1), ErrStat2, ErrMsg2 ) ! IfW + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + OutData%WrDisSkp1 = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%WrDisWind = TRANSFER(IntKiBuf(Int_Xferred), OutData%WrDisWind) + Int_Xferred = Int_Xferred + 1 + OutData%NOutDisWindXY = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindZ not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindZ)) DEALLOCATE(OutData%OutDisWindZ) + ALLOCATE(OutData%OutDisWindZ(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindZ.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindZ,1), UBOUND(OutData%OutDisWindZ,1) + OutData%OutDisWindZ(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%NOutDisWindYZ = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindX not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindX)) DEALLOCATE(OutData%OutDisWindX) + ALLOCATE(OutData%OutDisWindX(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindX.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindX,1), UBOUND(OutData%OutDisWindX,1) + OutData%OutDisWindX(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%NOutDisWindXZ = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! OutDisWindY not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%OutDisWindY)) DEALLOCATE(OutData%OutDisWindY) + ALLOCATE(OutData%OutDisWindY(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%OutDisWindY.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%OutDisWindY,1), UBOUND(OutData%OutDisWindY,1) + OutData%OutDisWindY(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + DO I = 1, LEN(OutData%OutFileRoot) + OutData%OutFileRoot(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%OutFileVTKRoot) + OutData%OutFileVTKRoot(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%VTK_tWidth = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE AWAE_UnPackParam + + SUBROUTINE AWAE_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_OutputType), INTENT(IN) :: SrcOutputData + TYPE(AWAE_OutputType), INTENT(INOUT) :: DstOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOutputData%Vdist_High)) THEN + i1_l = LBOUND(SrcOutputData%Vdist_High,1) + i1_u = UBOUND(SrcOutputData%Vdist_High,1) + IF (.NOT. ALLOCATED(DstOutputData%Vdist_High)) THEN + ALLOCATE(DstOutputData%Vdist_High(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Vdist_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%Vdist_High,1), UBOUND(SrcOutputData%Vdist_High,1) + CALL AWAE_Copyhighwindgrid( SrcOutputData%Vdist_High(i1), DstOutputData%Vdist_High(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%V_plane)) THEN + i1_l = LBOUND(SrcOutputData%V_plane,1) + i1_u = UBOUND(SrcOutputData%V_plane,1) + i2_l = LBOUND(SrcOutputData%V_plane,2) + i2_u = UBOUND(SrcOutputData%V_plane,2) + i3_l = LBOUND(SrcOutputData%V_plane,3) + i3_u = UBOUND(SrcOutputData%V_plane,3) + IF (.NOT. ALLOCATED(DstOutputData%V_plane)) THEN + ALLOCATE(DstOutputData%V_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%V_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%V_plane = SrcOutputData%V_plane +ENDIF +IF (ALLOCATED(SrcOutputData%TI_amb)) THEN + i1_l = LBOUND(SrcOutputData%TI_amb,1) + i1_u = UBOUND(SrcOutputData%TI_amb,1) + IF (.NOT. ALLOCATED(DstOutputData%TI_amb)) THEN + ALLOCATE(DstOutputData%TI_amb(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%TI_amb.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%TI_amb = SrcOutputData%TI_amb +ENDIF +IF (ALLOCATED(SrcOutputData%Vx_wind_disk)) THEN + i1_l = LBOUND(SrcOutputData%Vx_wind_disk,1) + i1_u = UBOUND(SrcOutputData%Vx_wind_disk,1) + IF (.NOT. ALLOCATED(DstOutputData%Vx_wind_disk)) THEN + ALLOCATE(DstOutputData%Vx_wind_disk(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Vx_wind_disk.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%Vx_wind_disk = SrcOutputData%Vx_wind_disk +ENDIF + END SUBROUTINE AWAE_CopyOutput + + SUBROUTINE AWAE_DestroyOutput( OutputData, ErrStat, ErrMsg ) + TYPE(AWAE_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OutputData%Vdist_High)) THEN +DO i1 = LBOUND(OutputData%Vdist_High,1), UBOUND(OutputData%Vdist_High,1) + CALL AWAE_Destroyhighwindgrid( OutputData%Vdist_High(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%Vdist_High) +ENDIF +IF (ALLOCATED(OutputData%V_plane)) THEN + DEALLOCATE(OutputData%V_plane) +ENDIF +IF (ALLOCATED(OutputData%TI_amb)) THEN + DEALLOCATE(OutputData%TI_amb) +ENDIF +IF (ALLOCATED(OutputData%Vx_wind_disk)) THEN + DEALLOCATE(OutputData%Vx_wind_disk) +ENDIF + END SUBROUTINE AWAE_DestroyOutput + + SUBROUTINE AWAE_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_OutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Vdist_High allocated yes/no + IF ( ALLOCATED(InData%Vdist_High) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vdist_High upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%Vdist_High,1), UBOUND(InData%Vdist_High,1) + Int_BufSz = Int_BufSz + 3 ! Vdist_High: size of buffers for each call to pack subtype + CALL AWAE_Packhighwindgrid( Re_Buf, Db_Buf, Int_Buf, InData%Vdist_High(i1), ErrStat2, ErrMsg2, .TRUE. ) ! Vdist_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Vdist_High + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Vdist_High + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Vdist_High + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! V_plane allocated yes/no + IF ( ALLOCATED(InData%V_plane) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! V_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%V_plane) ! V_plane + END IF + Int_BufSz = Int_BufSz + 1 ! TI_amb allocated yes/no + IF ( ALLOCATED(InData%TI_amb) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TI_amb upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TI_amb) ! TI_amb + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wind_disk allocated yes/no + IF ( ALLOCATED(InData%Vx_wind_disk) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vx_wind_disk upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wind_disk) ! Vx_wind_disk + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%Vdist_High) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vdist_High,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vdist_High,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vdist_High,1), UBOUND(InData%Vdist_High,1) + CALL AWAE_Packhighwindgrid( Re_Buf, Db_Buf, Int_Buf, InData%Vdist_High(i1), ErrStat2, ErrMsg2, OnlySize ) ! Vdist_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%V_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%V_plane,3), UBOUND(InData%V_plane,3) + DO i2 = LBOUND(InData%V_plane,2), UBOUND(InData%V_plane,2) + DO i1 = LBOUND(InData%V_plane,1), UBOUND(InData%V_plane,1) + ReKiBuf(Re_Xferred) = InData%V_plane(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TI_amb) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TI_amb,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TI_amb,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TI_amb,1), UBOUND(InData%TI_amb,1) + ReKiBuf(Re_Xferred) = InData%TI_amb(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wind_disk) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wind_disk,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wind_disk,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vx_wind_disk,1), UBOUND(InData%Vx_wind_disk,1) + ReKiBuf(Re_Xferred) = InData%Vx_wind_disk(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE AWAE_PackOutput + + SUBROUTINE AWAE_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_OutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vdist_High not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vdist_High)) DEALLOCATE(OutData%Vdist_High) + ALLOCATE(OutData%Vdist_High(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vdist_High.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vdist_High,1), UBOUND(OutData%Vdist_High,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL AWAE_Unpackhighwindgrid( Re_Buf, Db_Buf, Int_Buf, OutData%Vdist_High(i1), ErrStat2, ErrMsg2 ) ! Vdist_High + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! V_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%V_plane)) DEALLOCATE(OutData%V_plane) + ALLOCATE(OutData%V_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%V_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%V_plane,3), UBOUND(OutData%V_plane,3) + DO i2 = LBOUND(OutData%V_plane,2), UBOUND(OutData%V_plane,2) + DO i1 = LBOUND(OutData%V_plane,1), UBOUND(OutData%V_plane,1) + OutData%V_plane(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TI_amb not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TI_amb)) DEALLOCATE(OutData%TI_amb) + ALLOCATE(OutData%TI_amb(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TI_amb.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TI_amb,1), UBOUND(OutData%TI_amb,1) + OutData%TI_amb(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wind_disk not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wind_disk)) DEALLOCATE(OutData%Vx_wind_disk) + ALLOCATE(OutData%Vx_wind_disk(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wind_disk.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vx_wind_disk,1), UBOUND(OutData%Vx_wind_disk,1) + OutData%Vx_wind_disk(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE AWAE_UnPackOutput + + SUBROUTINE AWAE_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(AWAE_InputType), INTENT(IN) :: SrcInputData + TYPE(AWAE_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInputData%xhat_plane)) THEN + i1_l = LBOUND(SrcInputData%xhat_plane,1) + i1_u = UBOUND(SrcInputData%xhat_plane,1) + i2_l = LBOUND(SrcInputData%xhat_plane,2) + i2_u = UBOUND(SrcInputData%xhat_plane,2) + i3_l = LBOUND(SrcInputData%xhat_plane,3) + i3_u = UBOUND(SrcInputData%xhat_plane,3) + IF (.NOT. ALLOCATED(DstInputData%xhat_plane)) THEN + ALLOCATE(DstInputData%xhat_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%xhat_plane = SrcInputData%xhat_plane +ENDIF +IF (ALLOCATED(SrcInputData%p_plane)) THEN + i1_l = LBOUND(SrcInputData%p_plane,1) + i1_u = UBOUND(SrcInputData%p_plane,1) + i2_l = LBOUND(SrcInputData%p_plane,2) + i2_u = UBOUND(SrcInputData%p_plane,2) + i3_l = LBOUND(SrcInputData%p_plane,3) + i3_u = UBOUND(SrcInputData%p_plane,3) + IF (.NOT. ALLOCATED(DstInputData%p_plane)) THEN + ALLOCATE(DstInputData%p_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%p_plane = SrcInputData%p_plane +ENDIF +IF (ALLOCATED(SrcInputData%Vx_wake)) THEN + i1_l = LBOUND(SrcInputData%Vx_wake,1) + i1_u = UBOUND(SrcInputData%Vx_wake,1) + i2_l = LBOUND(SrcInputData%Vx_wake,2) + i2_u = UBOUND(SrcInputData%Vx_wake,2) + i3_l = LBOUND(SrcInputData%Vx_wake,3) + i3_u = UBOUND(SrcInputData%Vx_wake,3) + IF (.NOT. ALLOCATED(DstInputData%Vx_wake)) THEN + ALLOCATE(DstInputData%Vx_wake(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%Vx_wake = SrcInputData%Vx_wake +ENDIF +IF (ALLOCATED(SrcInputData%Vr_wake)) THEN + i1_l = LBOUND(SrcInputData%Vr_wake,1) + i1_u = UBOUND(SrcInputData%Vr_wake,1) + i2_l = LBOUND(SrcInputData%Vr_wake,2) + i2_u = UBOUND(SrcInputData%Vr_wake,2) + i3_l = LBOUND(SrcInputData%Vr_wake,3) + i3_u = UBOUND(SrcInputData%Vr_wake,3) + IF (.NOT. ALLOCATED(DstInputData%Vr_wake)) THEN + ALLOCATE(DstInputData%Vr_wake(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%Vr_wake = SrcInputData%Vr_wake +ENDIF +IF (ALLOCATED(SrcInputData%D_wake)) THEN + i1_l = LBOUND(SrcInputData%D_wake,1) + i1_u = UBOUND(SrcInputData%D_wake,1) + i2_l = LBOUND(SrcInputData%D_wake,2) + i2_u = UBOUND(SrcInputData%D_wake,2) + IF (.NOT. ALLOCATED(DstInputData%D_wake)) THEN + ALLOCATE(DstInputData%D_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%D_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%D_wake = SrcInputData%D_wake +ENDIF + END SUBROUTINE AWAE_CopyInput + + SUBROUTINE AWAE_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(AWAE_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputData%xhat_plane)) THEN + DEALLOCATE(InputData%xhat_plane) +ENDIF +IF (ALLOCATED(InputData%p_plane)) THEN + DEALLOCATE(InputData%p_plane) +ENDIF +IF (ALLOCATED(InputData%Vx_wake)) THEN + DEALLOCATE(InputData%Vx_wake) +ENDIF +IF (ALLOCATED(InputData%Vr_wake)) THEN + DEALLOCATE(InputData%Vr_wake) +ENDIF +IF (ALLOCATED(InputData%D_wake)) THEN + DEALLOCATE(InputData%D_wake) +ENDIF + END SUBROUTINE AWAE_DestroyInput + + SUBROUTINE AWAE_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(AWAE_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! xhat_plane allocated yes/no + IF ( ALLOCATED(InData%xhat_plane) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! xhat_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xhat_plane) ! xhat_plane + END IF + Int_BufSz = Int_BufSz + 1 ! p_plane allocated yes/no + IF ( ALLOCATED(InData%p_plane) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! p_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%p_plane) ! p_plane + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wake allocated yes/no + IF ( ALLOCATED(InData%Vx_wake) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! Vx_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wake) ! Vx_wake + END IF + Int_BufSz = Int_BufSz + 1 ! Vr_wake allocated yes/no + IF ( ALLOCATED(InData%Vr_wake) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! Vr_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vr_wake) ! Vr_wake + END IF + Int_BufSz = Int_BufSz + 1 ! D_wake allocated yes/no + IF ( ALLOCATED(InData%D_wake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! D_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%D_wake) ! D_wake + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%xhat_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%xhat_plane,3), UBOUND(InData%xhat_plane,3) + DO i2 = LBOUND(InData%xhat_plane,2), UBOUND(InData%xhat_plane,2) + DO i1 = LBOUND(InData%xhat_plane,1), UBOUND(InData%xhat_plane,1) + ReKiBuf(Re_Xferred) = InData%xhat_plane(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%p_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%p_plane,3), UBOUND(InData%p_plane,3) + DO i2 = LBOUND(InData%p_plane,2), UBOUND(InData%p_plane,2) + DO i1 = LBOUND(InData%p_plane,1), UBOUND(InData%p_plane,1) + ReKiBuf(Re_Xferred) = InData%p_plane(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%Vx_wake,3), UBOUND(InData%Vx_wake,3) + DO i2 = LBOUND(InData%Vx_wake,2), UBOUND(InData%Vx_wake,2) + DO i1 = LBOUND(InData%Vx_wake,1), UBOUND(InData%Vx_wake,1) + ReKiBuf(Re_Xferred) = InData%Vx_wake(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vr_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%Vr_wake,3), UBOUND(InData%Vr_wake,3) + DO i2 = LBOUND(InData%Vr_wake,2), UBOUND(InData%Vr_wake,2) + DO i1 = LBOUND(InData%Vr_wake,1), UBOUND(InData%Vr_wake,1) + ReKiBuf(Re_Xferred) = InData%Vr_wake(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%D_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%D_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%D_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%D_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%D_wake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%D_wake,2), UBOUND(InData%D_wake,2) + DO i1 = LBOUND(InData%D_wake,1), UBOUND(InData%D_wake,1) + ReKiBuf(Re_Xferred) = InData%D_wake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AWAE_PackInput + + SUBROUTINE AWAE_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(AWAE_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'AWAE_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xhat_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xhat_plane)) DEALLOCATE(OutData%xhat_plane) + ALLOCATE(OutData%xhat_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%xhat_plane,3), UBOUND(OutData%xhat_plane,3) + DO i2 = LBOUND(OutData%xhat_plane,2), UBOUND(OutData%xhat_plane,2) + DO i1 = LBOUND(OutData%xhat_plane,1), UBOUND(OutData%xhat_plane,1) + OutData%xhat_plane(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! p_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%p_plane)) DEALLOCATE(OutData%p_plane) + ALLOCATE(OutData%p_plane(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%p_plane,3), UBOUND(OutData%p_plane,3) + DO i2 = LBOUND(OutData%p_plane,2), UBOUND(OutData%p_plane,2) + DO i1 = LBOUND(OutData%p_plane,1), UBOUND(OutData%p_plane,1) + OutData%p_plane(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wake)) DEALLOCATE(OutData%Vx_wake) + ALLOCATE(OutData%Vx_wake(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%Vx_wake,3), UBOUND(OutData%Vx_wake,3) + DO i2 = LBOUND(OutData%Vx_wake,2), UBOUND(OutData%Vx_wake,2) + DO i1 = LBOUND(OutData%Vx_wake,1), UBOUND(OutData%Vx_wake,1) + OutData%Vx_wake(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vr_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vr_wake)) DEALLOCATE(OutData%Vr_wake) + ALLOCATE(OutData%Vr_wake(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%Vr_wake,3), UBOUND(OutData%Vr_wake,3) + DO i2 = LBOUND(OutData%Vr_wake,2), UBOUND(OutData%Vr_wake,2) + DO i1 = LBOUND(OutData%Vr_wake,1), UBOUND(OutData%Vr_wake,1) + OutData%Vr_wake(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! D_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%D_wake)) DEALLOCATE(OutData%D_wake) + ALLOCATE(OutData%D_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%D_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%D_wake,2), UBOUND(OutData%D_wake,2) + DO i1 = LBOUND(OutData%D_wake,1), UBOUND(OutData%D_wake,1) + OutData%D_wake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE AWAE_UnPackInput + +END MODULE AWAE_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/beamdyn/src/BeamDyn_Subs.f90 b/modules/beamdyn/src/BeamDyn_Subs.f90 index 4a47bbd5ba..e60ab59dab 100644 --- a/modules/beamdyn/src/BeamDyn_Subs.f90 +++ b/modules/beamdyn/src/BeamDyn_Subs.f90 @@ -1028,14 +1028,15 @@ END SUBROUTINE BD_Interp_Pos_CRV !----------------------------------------------------------------------------------------------------------------------------------- !> This subroutine computes initial CRV parameters !! given geometry information -SUBROUTINE BD_ComputeIniNodalCrv(e1, phi, cc, ErrStat, ErrMsg) +SUBROUTINE BD_ComputeIniNodalCrv(e3, phi, cc, ErrStat, ErrMsg) - REAL(BDKi), INTENT(IN ) :: e1(:) !< Tangent unit vector + REAL(BDKi), INTENT(IN ) :: e3(3) !< Tangent unit vector REAL(BDKi), INTENT(IN ) :: phi !< Initial twist angle, in degrees REAL(BDKi), INTENT( OUT) :: cc(:) !< Initial Crv Parameter INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(BDKi) :: e1(3) !< Unit normal vector REAL(BDKi) :: e2(3) !< Unit normal vector REAL(BDKi) :: Rr(3,3) !< Initial rotation matrix REAL(BDKi) :: PhiRad !< Phi in radians @@ -1045,22 +1046,49 @@ SUBROUTINE BD_ComputeIniNodalCrv(e1, phi, cc, ErrStat, ErrMsg) CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message CHARACTER(*), PARAMETER :: RoutineName = 'BD_ComputeIniNodalCrv' + INTEGER(IntKi) :: i,j + REAL(BDKi) :: rtwist(3,3),q0,q1,q2,q3,identity(3,3),qt(3,3) + ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" PhiRad = phi*D2R_D ! convert to radians - ! Note that e1 corresponds with the Z-axis direction in our formulation. For Beam theory, this would be the x-axis. - Rr(:,3) = e1(:) - - e2(3) = -(e1(1)*COS(PhiRad) + e1(2)*SIN(PhiRad))/e1(3) - Delta = SQRT(1.0_BDKi + e2(3)*e2(3)) - e2(1) = COS(PhiRad) - e2(2) = SIN(PhiRad) - e2 = e2 / Delta - Rr(:,1) = e2 - Rr(:,2) = Cross_Product(e1,e2) + ! e3 defines tangent + Rr(:,3) = e3(:) + + ! define e1 initially as normal to e3 with zero component in the 2 direction + e1(3) = -e3(1) / sqrt( e3(1)**2 + e3(3)**2 ) + e1(1) = sqrt( 1.0_BDKi - e1(3)**2 ) + e1(2) = 0. + + ! e2 comes from cross product e3 x e1 + Rr(:,2) = Cross_Product(e3,e1) + Rr(:,1) = e1(:) + + identity = 0. + do i = 1,3 + identity(i,i) = 1.0_BDKi + enddo + + q0=cos(phirad/2.0_BDKi) + q1=e3(1) * sin(phirad/2.0_BDKi) + q2=e3(2) * sin(phirad/2.0_BDKi) + q3=e3(3) * sin(phirad/2.0_BDKi) + + qt = 0.0_BDKi + qt(1,2) = -q3 + qt(1,3) = q2 + qt(2,1) = q3 + qt(2,3) = -q1 + qt(3,1) = -q2 + qt(3,2) = q1 + + ! Rotation matrix for rotating Rr Phi degress about e3 + Rtwist = identity + 2.0_BDKi*q0*qt + 2.0_BDKi*matmul(qt,qt) + + Rr = matmul(Rtwist,Rr) CALL BD_CrvExtractCrv(Rr, cc, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) diff --git a/modules/beamdyn/src/Driver_Beam.f90 b/modules/beamdyn/src/Driver_Beam.f90 index 8c11cb9a59..18b1f87e62 100644 --- a/modules/beamdyn/src/Driver_Beam.f90 +++ b/modules/beamdyn/src/Driver_Beam.f90 @@ -98,8 +98,7 @@ PROGRAM BeamDyn_Driver_Program ! initialize the BD_InitInput values not in the driver input file BD_InitInput%RootName = TRIM(BD_Initinput%InputFile) - BD_InitInput%RootDisp = matmul(transpose(BD_InitInput%RootOri),BD_InitInput%GlbPos) - BD_InitInput%GlbPos - BD_InitInput%RootVel(1:3) = matmul(BD_InitInput%RootOri, Cross_Product( BD_InitInput%RootVel(4:6), BD_InitInput%GlbPos )) ! set translational velocities based on rotation and GlbPos. + BD_InitInput%RootDisp = 0.d0 BD_InitInput%DynamicSolve = DvrData%DynamicSolve ! QuasiStatic options handled within the BD code. t_global = DvrData%t_initial diff --git a/modules/beamdyn/tests/test_BD_ComputeIniNodalCrv.F90 b/modules/beamdyn/tests/test_BD_ComputeIniNodalCrv.F90 index 17f476db34..a32f7a0b0b 100644 --- a/modules/beamdyn/tests/test_BD_ComputeIniNodalCrv.F90 +++ b/modules/beamdyn/tests/test_BD_ComputeIniNodalCrv.F90 @@ -58,7 +58,7 @@ subroutine test_BD_ComputeIniNodalCrv() angle = 0.0_BDKi ! Baseline Wiener-Milenkovic parameters - param = 4*tan((-Pi_D/4)/4) + param = 4.*tan((-Pi_D/4.)/4.) baseline_wmparams = (/ param, real(0.0, BDKi), real(0.0, BDKi) /) call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg) @@ -72,7 +72,7 @@ subroutine test_BD_ComputeIniNodalCrv() angle = 45.0_BDKi ! Baseline Wiener-Milenkovic parameters - param = 4*tan((Pi_D/4)/4) + param = 4.*tan((Pi_D/4.)/4.) baseline_wmparams = (/ real(0.0, BDKi), real(0.0, BDKi), param /) call BD_ComputeIniNodalCrv(n, angle, test_wmparams, ErrStat, ErrMsg) diff --git a/modules/beamdyn/tests/test_BD_CrvMatrixH.F90 b/modules/beamdyn/tests/test_BD_CrvMatrixH.F90 index 5f7ff9e9bc..b71381de57 100644 --- a/modules/beamdyn/tests/test_BD_CrvMatrixH.F90 +++ b/modules/beamdyn/tests/test_BD_CrvMatrixH.F90 @@ -30,7 +30,7 @@ subroutine test_BD_CrvMatrixH() tolerance = 1e-14 ! set the rotation axis for all tests - n = (/ 1, 0, 0 /) ! x axis + n = (/ 1., 0., 0. /) ! x axis ! -------------------------------------------------------------------------- @@ -66,7 +66,7 @@ subroutine test_BD_CrvMatrixH() angle = 0.1*Pi_D ! Wiener-Milenkovic parameters are calculated; note tangent is asymptotic at +/- pi/2 - wmparams = 4*tan(angle/4)*n + wmparams = 4.*tan(angle/4.)*n baselineH = H(wmparams) @@ -81,10 +81,10 @@ function H(c) c0 = 2.0 - dot_product(c,c) / 8.0 - H(1,:) = (/ c0 + c(1)*c(1)/4, c(1)*c(2)/4 - c(3), c(1)*c(3)/4 + c(2) /) - H(2,:) = (/ c(1)*c(2)/4 + c(3), c0 + c(2)*c(2)/4, c(2)*c(3)/4 - c(1) /) - H(3,:) = (/ c(1)*c(3)/4 - c(2), c(2)*c(3)/4 + c(1), c0 + c(3)*c(3)/4 /) - H = 2*H/(4-c0)**2 + H(1,:) = (/ c0 + c(1)*c(1)/4., c(1)*c(2)/4. - c(3), c(1)*c(3)/4. + c(2) /) + H(2,:) = (/ c(1)*c(2)/4. + c(3), c0 + c(2)*c(2)/4., c(2)*c(3)/4. - c(1) /) + H(3,:) = (/ c(1)*c(3)/4. - c(2), c(2)*c(3)/4. + c(1), c0 + c(3)*c(3)/4. /) + H = 2.*H/(4.-c0)**2 end function end subroutine diff --git a/modules/beamdyn/tests/test_BD_DistrLoadCopy.F90 b/modules/beamdyn/tests/test_BD_DistrLoadCopy.F90 index bfa6037513..64f2970e4c 100644 --- a/modules/beamdyn/tests/test_BD_DistrLoadCopy.F90 +++ b/modules/beamdyn/tests/test_BD_DistrLoadCopy.F90 @@ -30,7 +30,7 @@ subroutine test_BD_DistrLoadCopy() ! build the parametertype, inputtype, and miscvartype parametertype = simpleParameterType(1,16,16,0,1) - miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%elem_total) + miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%dof_node, parametertype%elem_total, parametertype%nodes_per_elem) inputtype = simpleInputType(parametertype%nqp, parametertype%elem_total) call BD_DistrLoadCopy(parametertype, inputtype, miscvartype) diff --git a/modules/beamdyn/tests/test_BD_GravityForce.F90 b/modules/beamdyn/tests/test_BD_GravityForce.F90 index 6b7b4bc4dd..8b5aef8fcf 100644 --- a/modules/beamdyn/tests/test_BD_GravityForce.F90 +++ b/modules/beamdyn/tests/test_BD_GravityForce.F90 @@ -31,7 +31,7 @@ subroutine test_BD_GravityForce() ! allocate and build the custom types parametertype = simpleParameterType(1,16,16,0,1) - miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%elem_total) + miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%dof_node, parametertype%elem_total, parametertype%nodes_per_elem) gravity = getGravityInZ() diff --git a/modules/beamdyn/tests/test_BD_QPData_mEta_rho.F90 b/modules/beamdyn/tests/test_BD_QPData_mEta_rho.F90 index 5cea831001..19a9cb5ab6 100644 --- a/modules/beamdyn/tests/test_BD_QPData_mEta_rho.F90 +++ b/modules/beamdyn/tests/test_BD_QPData_mEta_rho.F90 @@ -35,7 +35,7 @@ subroutine test_BD_QPData_mEta_rho() ! allocate and build the custom input types parametertype = simpleParameterType(1,16,16,0,1) - miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%elem_total) + miscvartype = simpleMiscVarType(parametertype%nqp, parametertype%dof_node, parametertype%elem_total, parametertype%nodes_per_elem) ! allocate the results call BD_QPData_mEta_rho(parametertype, miscvartype) diff --git a/modules/beamdyn/tests/test_BD_QuadraturePointData.F90 b/modules/beamdyn/tests/test_BD_QuadraturePointData.F90 new file mode 100644 index 0000000000..fcf4f75a4f --- /dev/null +++ b/modules/beamdyn/tests/test_BD_QuadraturePointData.F90 @@ -0,0 +1,279 @@ +module test_BD_QuadraturePointData + + ! Tests the following routines: + ! BD_QuadraturePointDataAt0 + ! BD_DisplacementQP + ! BD_RotationalInterpQP + ! BD_StifAtDeformedQP + ! + ! Assumes BD_InitShpDerJaco is tested elsewhere; but implicitly tests it here + + use pFUnit_mod + use BeamDyn + use NWTC_Num + use test_tools + + implicit none + + type(BD_ParameterType) :: p + type(BD_ContinuousStateType) :: x !< Continuous states at t + type(BD_MiscVarType) :: m !< misc/optimization variables + + integer(IntKi) :: idx_qp, idx_node, i, j + integer(IntKi) :: nodes_per_elem + integer(IntKi) :: elem_total + integer(IntKi) :: nelem + integer(IntKi) :: nqp + + real(BDKi), allocatable :: gll_nodes(:) + real(BDKi), allocatable :: baseline_uu0(:,:,:) + real(BDKi), allocatable :: baseline_rrN0(:,:,:) + real(BDKi), allocatable :: baseline_E10(:,:,:) + + real(BDKi), allocatable :: baseline_uuu(:,:,:) + real(BDKi), allocatable :: baseline_uup(:,:,:) + real(BDKi), allocatable :: baseline_E1(:,:,:) + + real(BDKi), allocatable :: baseline_kappa(:,:,:) + real(BDKi), allocatable :: baseline_Nrrr(:,:,:) + real(BDKi), allocatable :: baseline_RR0(:,:,:,:) + + real(BDKi), allocatable :: baseline_Stif(:,:,:,:) + + integer(IntKi) :: ErrStat + character :: ErrMsg + character(1024) :: testname + real(BDKi) :: tolerance + +contains + + @test + subroutine test_BD_QuadraturePointData_5node() + ! branches to test + ! - 5 node, 1 element; deformed + ! + ! tests the initial values at nodes, and the interpolated values at a single quadrature point + ! test results were created with mathematica + ! + ! DETAILS ABOUT UNDERLYING MODEL + ! Reference-line definition on 0 <= t <= 1 + ! fx[t_] = t - 2. t^4; + ! fy[t_] = -2 t + 3. t^2; + ! fz[t_] = 5. t; + ! ft[t_] = 90. t^2; + ! Length of undeformed line: 5.82222272658737 + ! + ! Displacement, 0 <= t <= 1 + ! ux[t_] = t^2; + ! uy[t_] = t^3 - t^2; + ! uz[t_] = t^2 + 0.2 t^3; + ! ucrv1[t_] = 0.1 t^2; + ! ucrv2[t_] = 0.2 t; + ! ucrv3[t_] = 0.1 t^3; + ! + ! Length of deformed line: 6.75332330098143 + ! + ! For 5 nodes (p=4), nodes located at {-1., -0.654654, 0., 0.654654, 1.} + + ! initialize NWTC_Num constants + call SetConstants() + + tolerance = 1e-13 + + ! -------------------------------------------------------------------------- + testname = "5 node, 1 element, 1 qp, curved:" + + nodes_per_elem = 5 ! fourth-order polynomial representation + elem_total = 1 + nqp = 1 ! we are testing at a single, randomly chosen quadrature point + + p = simpleparametertype(elem_total,nodes_per_elem,nqp,0,1) + + call AllocAry(baseline_uu0 , p%dof_node, p%nqp, p%elem_total, 'baseline_uu0' , ErrStat, ErrMsg) + call AllocAry(baseline_E10 , p%dof_node/2, p%nqp, p%elem_total, 'baseline_E10' , ErrStat, ErrMsg) + call AllocAry(baseline_rrN0 , p%dof_node/2, p%nodes_per_elem, p%elem_total, 'baseline_rrN0' , ErrStat, ErrMsg) + + call AllocAry(baseline_uuu , p%dof_node, p%nqp, p%elem_total, 'baseline_uuu' , ErrStat, ErrMsg) + call AllocAry(baseline_uup , p%dof_node/2, p%nqp, p%elem_total, 'baseline_uup' , ErrStat, ErrMsg) + call AllocAry(baseline_E1 , p%dof_node/2, p%nodes_per_elem, p%elem_total, 'baseline_E1' , ErrStat, ErrMsg) + + call AllocAry(baseline_kappa, p%dof_node/2, p%nqp, p%elem_total, 'baseline_kappa' , ErrStat, ErrMsg) + call AllocAry(baseline_Nrrr , p%dof_node/2, p%nodes_per_elem, p%elem_total, 'baseline_Nrrr' , ErrStat, ErrMsg) + + call AllocAry(baseline_RR0 , 3, 3, p%nqp, p%elem_total, 'baseline_RR0' , ErrStat, ErrMsg) + + call AllocAry(baseline_Stif , 6, 6, p%nqp, p%elem_total, 'baseline_Stif' , ErrStat, ErrMsg) + + ! assign baseline results + + ! uuN0 is of dimension (6 dof, nodes_per_elem, elem_total) + ! The following comes directly from the fx,fy,fz,ft defined above evaluated at the nodes + p%uuN0(1:3,1,1) = (/ 0.0, 0.0, 0.0 /) + p%uuN0(4:6,1,1) = (/ 0.37396158360688636,0.1958165026139741,-0.03702949411114144 /) + + p%uuN0(1:3,2,1) = (/ 0.17089517433538276,-0.2558982639254171,0.8633658232300558 /) + p%uuN0(4:6,2,1) = (/ 0.19122693263749954,0.18476700337274984,0.028875646293600333 /) + + p%uuN0(1:3,3,1) = (/ 0.375,-0.24999999999999997,2.5 /) + p%uuN0(4:6,3,1) = (/ -0.19563492419200498,0.03891420591317169,0.3929953248730882 /) + + p%uuN0(1:3,4,1) = (/ -0.10967068453946444,0.3987554067825597,4.136634176769939 /) + p%uuN0(4:6,4,1) = (/ -0.7291347777813711,-0.3147268839962532,0.9114830702745595 /) + + p%uuN0(1:3,5,1) = (/ -1., 1., 5. /) + p%uuN0(4:6,5,1) = (/ -1.0730193445455083,-0.42803085368057275,1.292451050059679 /) + + + ! the following is uuN0(4:6) with rotation of first node removed + baseline_rrN0(1:3,1,1) = (/ 0., 0., 0. /) + baseline_rrN0(1:3,2,1) = (/ -0.18695562365337798,-0.0032641497706398077,0.048935661676787534 /) + baseline_rrN0(1:3,3,1) = (/ -0.6080640291857297,-0.08595023366039768,0.4027112581652146 /) + baseline_rrN0(1:3,4,1) = (/ -1.1980591841054526,-0.3478409509012645,0.9658032687192992 /) + baseline_rrN0(1:3,5,1) = (/ -1.5856082606694464,-0.3853274394272689,1.3714709059387975 /) + + ! We are just looking at one randomly selected point in the domain to test interpolation; can be expanded + p%QptN(1) = 0.3 + + ! Input baseline/reference quantities; uu0 and E10 are only for at quadrature points, so just 1 point here + ! uu0 is reference line evaluated at quadrature point + ! E10 is tangent evaluated at qudrature point + baseline_uu0(1:3,1,1) = (/ 0.29298750000000007,-0.03250000000000007,3.2499999999999996 /) + baseline_uu0(4:6,1,1) = (/ -0.419497643454797,-0.1153574679103733,0.610107968645409 /) + baseline_E10(1:3,1,1) = (/ -0.22332806017852783,0.3449485111415417,0.9116661133321399 /) + + ! Allocate memory for GLL node positions in 1D parametric space + call AllocAry(gll_nodes, nodes_per_elem, "GLL points array", ErrStat, ErrMsg) + gll_nodes = (/ -1., -0.6546536707079771, 0., 0.6546536707079771, 1. /) + + ! Build the shape functions and derivative of shape functions evaluated at QP points; this is tested elsewhere + call BD_InitShpDerJaco(gll_nodes, p) + + ! **** primary function being tested ***** + call BD_QuadraturePointDataAt0( p ) + + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQPAt0: rrN0" + @assertEqual(baseline_rrN0(:,:,1), p%rrN0(:,:,1), tolerance, testname) + + ! Test uu0; only one quadrature point for now + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQPAt0: uu0" + do idx_qp = 1, p%nqp + @assertEqual(baseline_uu0(:,idx_qp,1), p%uu0(:,idx_qp,1), tolerance, testname) + end do + + ! Test E10; only one quadrature point for now + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQPAt0: E10" + do idx_qp = 1, p%nqp + @assertEqual(baseline_E10(:,idx_qp,1), p%E10(:,idx_qp,1), tolerance, testname) + end do + + ! Now test "displacement" components at quadrature points by testing the three subroutine calls + ! in BD_QuadraturePointData: BD_DisplacementQP, BD_RotationalInterpQP, BD_StifAtDeformedQP + + x = simpleContinuousStateType(nodes_per_elem, nodes_per_elem, elem_total) + m = simpleMiscVarType(nqp, p%dof_node, elem_total, nodes_per_elem) + + x%q(1:3,1) = (/ 0., 0., 0. /) + x%q(4:6,1) = (/ 0., 0., 0. /) + + x%q(1:3,2) = (/ 0.02981602178886858,-0.02466759494943021,0.030845707156756254 /) + x%q(4:6,2) = (/ 0.0029816021788868583,0.034534632929202294, 0.000514842683943837 /) + + x%q(1:3,3) = (/ 0.25,-0.125,0.275 /) + x%q(4:6,3) = (/ 0.025,0.1,0.0125 /) + + x%q(1:3,4) = (/ 0.6844696924968456,-0.11818954790771263,0.7977257214146722 /) + x%q(4:6,4) = (/ 0.06844696924968456,0.16546536707079773,0.0566280144589133/) + + x%q(1:3,5) = (/ 1.,0.,1.2 /) + x%q(4:6,5) = (/ 0.1,0.2,0.1 /) + + idx_qp = 1 + nelem = 1 + baseline_uuu(1:3,idx_qp,nelem) = (/ 0.42250000000000015,-0.14787500000000003,0.4774250000000001 /) + baseline_uuu(4:6,idx_qp,nelem) = (/ 0.042250000000000024,0.1300000000000001,0.02746250000000002 /) + baseline_uup(1:3,idx_qp,nelem) = (/ 0.23717727987485349,-0.005929431996871376,0.2834268494504499 /) + baseline_E1(1:3, idx_qp,nelem) = (/ 0.01384921969632566, 0.33901907914467033, 1.1950929627825897 /) + + call BD_DisplacementQP( nelem, p, x, m ) + + do idx_qp = 1, p%nqp + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQP: uuu" + @assertEqual(baseline_uuu(1:3,idx_qp,1), m%qp%uuu(1:3,idx_qp,1), tolerance, testname) + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQP: uup" + @assertEqual(baseline_uup(1:3,idx_qp,1), m%qp%uup(1:3,idx_qp,1), tolerance, testname) + testname = "5 node, 1 element, 1 qp, curved: BD_DisplacementQP: E1" + @assertEqual(baseline_E1(1:3,idx_qp,1), m%qp%E1(1:3,idx_qp,1), tolerance, testname) + end do + + ! because x%q(4:6,1)=(0.,0.,0.) we don't have to rotate xq to get Nrrrr + baseline_Nrrr(1:3,1,nelem) = x%q(4:6,1) + baseline_Nrrr(1:3,2,nelem) = x%q(4:6,2) + baseline_Nrrr(1:3,3,nelem) = x%q(4:6,3) + baseline_Nrrr(1:3,4,nelem) = x%q(4:6,4) + baseline_Nrrr(1:3,5,nelem) = x%q(4:6,5) + + baseline_kappa(1:3,1,1) = (/ 0.024664714695954715,0.036297077098213545,0.02229356260962948 /) + + baseline_RR0(1,1:3,1,nelem) = (/0.7967507798136657,-0.5939809735620473,-0.11124206898740374/) + baseline_RR0(2,1:3,1,nelem) = (/0.5966254150993577,0.7439195402109748,0.3010346022466711 /) + baseline_RR0(3,1:3,1,nelem) = (/-0.09605367730511442,-0.30621939967705303,0.9471026186942948 /) + + CALL BD_RotationalInterpQP( nelem, p, x, m ) + + testname = "5 node, 1 element, 1 qp, curved: BD_RotationalInterpQP: m%Nrrr(1:3)" + do idx_node = 1, nodes_per_elem + @assertEqual(baseline_Nrrr(1:3,idx_node,1), m%Nrrr(1:3,idx_node,1), tolerance, testname) + end do + + do idx_qp = 1, p%nqp + testname = "5 node, 1 element, 1 qp, curved: BD_RotationalInterpQP: m%qp%uuu(4:6)" + @assertEqual(baseline_uuu(4:6,idx_qp,1), m%qp%uuu(4:6,idx_qp,1), tolerance, testname) + testname = "5 node, 1 element, 1 qp, curved: BD_RotationalInterpQP: m%qp%kappa" + @assertEqual(baseline_kappa(1:3,idx_qp,1), m%qp%kappa(1:3,idx_qp,1), tolerance, testname) + testname = "5 node, 1 element, 1 qp, curved: BD_RotationalInterpQP: m%qp%RR0" + @assertEqual(baseline_RR0(1:3,1:3,idx_qp,1), m%qp%RR0(1:3,1:3,idx_qp,1), tolerance, testname) + end do + + idx_qp = 1 + nelem = 1 + do i = 1, 6 + do j = 1, 6 + p%Stif0_QP(i,j,idx_qp) = float(i*j)*10.+float(i)*10. ! rather randomly chosen way to fully populate p%Stif0_QP + enddo + enddo + ! the following should be the result from MATMUL(tempR6,MATMUL(p%Stif0_QP(1:6,1:6,temp_id2+idx_qp),TRANSPOSE(tempR6))) + baseline_Stif(1,1:6,idx_qp,nelem) = (/4.5918231909187375, -33.558422946165074, -19.41124878362651, 2.60126686515566, -69.25969416961556, -31.26026770547517 /) + baseline_Stif(2,1:6,idx_qp,nelem) = (/-18.923545538732206, 138.2989541247406, 79.99647091096304, -10.720184539884109, 285.4288856786646, 128.8279349796045 /) + baseline_Stif(3,1:6,idx_qp,nelem) = (/ -13.509458152867301, 98.7311774904666, 57.109222684340786, -7.65310518243836, 203.76676129761876, 91.96984745617996 /) + baseline_Stif(4,1:6,idx_qp,nelem) = (/ 2.852586665816869, -20.847560074045475, -12.058885358769254, 1.6159897420374438, -43.026325677681456, -19.419872917332995 /) + baseline_Stif(5,1:6,idx_qp,nelem) = (/-50.11731488891121, 366.27238899233606, 211.8634858589486, -28.39144827024861, 755.9328304872744, 341.18924335009 /) + baseline_Stif(6,1:6,idx_qp,nelem) = (/-23.86246662028767, 174.39407269994138, 100.87502434184734, -13.518082286573822, 359.9239499295936, 162.45117977068867 /) + + CALL BD_StifAtDeformedQP( nelem, p, m ) + + do idx_qp = 1, p%nqp + testname = "5 node, 1 element, 1 qp, curved: BD_StifAtDeformedQP: m%qp%Stif" + @assertEqual(baseline_Stif(1:6,1:6,idx_qp,1), m%qp%Stif(1:6,1:6,idx_qp,1), 10.*tolerance, testname) + end do + + ! dealocate baseline variables + if (allocated(gll_nodes)) deallocate(gll_nodes) + if (allocated(baseline_uu0)) deallocate(baseline_uu0) + if (allocated(baseline_E10)) deallocate(baseline_E10) + if (allocated(baseline_rrN0)) deallocate(baseline_rrN0) + if (allocated(baseline_rrN0)) deallocate(baseline_rrN0) + if (allocated(baseline_E10)) deallocate(baseline_E10) + if (allocated(baseline_uuu)) deallocate(baseline_uuu) + if (allocated(baseline_uup)) deallocate(baseline_uup) + if (allocated(baseline_E1)) deallocate(baseline_E1) + if (allocated(baseline_kappa)) deallocate(baseline_kappa) + if (allocated(baseline_Nrrr)) deallocate(baseline_Nrrr) + if (allocated(baseline_RR0)) deallocate(baseline_RR0) + if (allocated(baseline_Stif)) deallocate(baseline_Stif) + + call BD_DestroyParam( p, ErrStat, ErrMsg) + CALL BD_DestroyMisc( m, ErrStat, ErrMsg) + CALL BD_DestroyContState(x, ErrStat, ErrMsg) + + end subroutine +end module diff --git a/modules/beamdyn/tests/test_tools.F90 b/modules/beamdyn/tests/test_tools.F90 index 909a7c10ba..a2b9fe2f19 100644 --- a/modules/beamdyn/tests/test_tools.F90 +++ b/modules/beamdyn/tests/test_tools.F90 @@ -118,7 +118,8 @@ type(BD_ParameterType) function simpleParameterType(elem_total, nodes_per_elem, ! allocate arrays call AllocAry(p%qp%mmm, p%nqp, p%elem_total, 'qp_mmm', ErrStat, ErrMsg) call AllocAry(p%qp%mEta, 3, p%nqp, p%elem_total, 'qp_RR0mEta', ErrStat, ErrMsg) - call AllocAry(p%Mass0_QP, 6, 6, p%nqp*p%elem_total, 'Mass0_QP', ErrStat, ErrMsg) + call AllocAry(p%Mass0_QP, 6, 6, p%nqp*p%elem_total, 'Mass0_QP', ErrStat, ErrMsg) ! if called, this allocated in InitializeMassStiffnessMatrices + call AllocAry(p%Stif0_QP, 6, 6, p%nqp*p%elem_total, 'Stif0_QP', ErrStat, ErrMsg) ! if called, this allocated in InitializeMassStiffnessMatrices call AllocAry(p%QPtw_Shp_Shp_Jac, p%nqp, p%nodes_per_elem, p%nodes_per_elem, p%elem_total, 'QPtw_Shp_Shp_Jac', ErrStat, ErrMsg) call AllocAry(p%QPtw_ShpDer_ShpDer_Jac, p%nqp, p%nodes_per_elem, p%nodes_per_elem, p%elem_total, 'QPtw_ShpDer_ShpDer_Jac', ErrStat, ErrMsg) call AllocAry(p%QPtw_Shp_ShpDer, p%nqp, p%nodes_per_elem, p%nodes_per_elem, 'QPtw_Shp_ShpDer', ErrStat, ErrMsg) @@ -131,9 +132,20 @@ type(BD_ParameterType) function simpleParameterType(elem_total, nodes_per_elem, call AllocAry(p%Jacobian, p%nqp, p%elem_total, 'Jacobian', ErrStat, ErrMsg) call AllocAry(p%uuN0, p%dof_node, p%nodes_per_elem, p%elem_total,'uuN0', ErrStat, ErrMsg) + call AllocAry(p%uu0, p%dof_node, p%nqp, p%elem_total,'uu0', ErrStat, ErrMsg) + call AllocAry(p%E10, p%dof_node/2, p%nqp, p%elem_total,'E10', ErrStat, ErrMsg) + call AllocAry(p%rrN0, p%dof_node/2, p%nodes_per_elem, p%elem_total,'rrN0', ErrStat, ErrMsg) + + CALL AllocAry(p%node_elem_idx,p%elem_total,2,'start and end node numbers of elements in p%node_total sized arrays',ErrStat,ErrMsg) + ! construct arrays p%qp%mmm = 1.0 + DO i=1,p%elem_total + p%node_elem_idx(i,1) = (i-1)*(p%nodes_per_elem-1) + 1 ! First node in element + p%node_elem_idx(i,2) = i *(p%nodes_per_elem-1) + 1 ! Last node in element + ENDDO + do j=1, p%elem_total do i=1, p%nqp p%qp%mEta(:,i,j) = (/ 0.0, 0.0, 0.0 /) @@ -143,9 +155,9 @@ type(BD_ParameterType) function simpleParameterType(elem_total, nodes_per_elem, end function - type(BD_MiscVarType) function simpleMiscVarType(nqp, nelem) RESULT(m) + type(BD_MiscVarType) function simpleMiscVarType(nqp, dof_node, elem_total, nodes_per_elem) RESULT(m) - integer, intent(in) :: nqp, nelem + integer, intent(in) :: nqp, elem_total, dof_node, nodes_per_elem integer :: i, j integer :: ErrStat character(1024) :: ErrMsg @@ -155,14 +167,31 @@ type(BD_MiscVarType) function simpleMiscVarType(nqp, nelem) RESULT(m) ! fixed size arrays ! allocate arrays - call AllocAry(m%qp%Fg, 6, nqp, nelem, 'qp_Fg', ErrStat, ErrMsg) - call AllocAry(m%qp%RR0, 3, 3, nqp, nelem, 'qp_RR0', ErrStat, ErrMsg) - call AllocAry(m%qp%RR0mEta, 3, nqp, nelem, 'qp_RR0mEta', ErrStat, ErrMsg) - call AllocAry(m%DistrLoad_QP, 6, nqp, nelem, 'DistrLoad_QP', ErrStat, ErrMsg) - call AllocAry(m%qp%rho, 3, 3, nqp, nelem, 'qp_rho', ErrStat, ErrMsg) - + call AllocAry(m%qp%Fg, 6, nqp, elem_total, 'qp_Fg', ErrStat, ErrMsg) + call AllocAry(m%qp%RR0, 3, 3, nqp, elem_total, 'qp_RR0', ErrStat, ErrMsg) + call AllocAry(m%qp%RR0mEta, 3, nqp, elem_total, 'qp_RR0mEta', ErrStat, ErrMsg) + call AllocAry(m%DistrLoad_QP, 6, nqp, elem_total, 'DistrLoad_QP', ErrStat, ErrMsg) + + CALL AllocAry(m%qp%uuu, dof_node ,nqp,elem_total, 'm%qp%uuu displacement at quadrature point',ErrStat,ErrMsg) + CALL AllocAry(m%qp%uup, dof_node/2,nqp,elem_total, 'm%qp%uup displacement prime at quadrature point',ErrStat,ErrMsg) + + ! E1, kappa -- used in force calculations + CALL AllocAry(m%qp%E1, dof_node/2,nqp,elem_total, 'm%qp%E1 at quadrature point',ErrStat,ErrMsg) + CALL AllocAry(m%qp%kappa, dof_node/2,nqp,elem_total, 'm%qp%kappa at quadrature point',ErrStat,ErrMsg) + CALL AllocAry(m%qp%RR0, 3,3, nqp,elem_total, 'm%qp%RR0 at quadrature point',ErrStat,ErrMsg) + CALL AllocAry(m%qp%Stif, 6,6, nqp,elem_total, 'm%qp%Stif at quadrature point',ErrStat,ErrMsg) + + CALL AllocAry(m%qp%RR0mEta, dof_node/2, nqp, elem_total, 'm%qp%RRo times p%qp%mEta at quadrature point',ErrStat,ErrMsg) + call AllocAry(m%qp%rho, 3, 3, nqp, elem_total, 'qp_rho', ErrStat, ErrMsg) + CALL AllocAry(m%qp%betaC, 6,6, nqp,elem_total, 'm%qp%betaC at quadrature point',ErrStat,ErrMsg) + + CALL AllocAry(m%qp%Fc, dof_node, nqp, elem_total, 'm%qp%Fc at quadrature point',ErrStat,ErrMsg) + CALL AllocAry(m%qp%Fd, dof_node, nqp, elem_total, 'm%qp%Fd at quadrature point',ErrStat,ErrMsg) + + CALL AllocAry(m%Nrrr, dof_node/2, nodes_per_elem, elem_total,'Nrrr: rotation parameters relative to root', ErrStat,ErrMsg) + ! construct arrays - do j=1, nelem + do j=1, elem_total do i=1, nqp m%qp%RR0(:,:,i,j) = identity() m%qp%RR0mEta(:,i,j) = (/ 0.0, 0.0, 0.0 /) @@ -234,5 +263,22 @@ type(BD_InputFile) function simpleInputFile() RESULT(i) i%kp_coordinate(3,:) = (/ 0.000000, 0.000000, 10.0000, 0.00000 /) end function + + type(BD_ContinuousStateType) function simpleContinuousStateType(node_total, nodes_per_elem, elem_total) RESULT(x) + + integer, intent(in) :: node_total,nodes_per_elem, elem_total + integer :: j + integer :: ErrStat + character(1024) :: ErrMsg + + ! scalars + + ! fixed size arrays + + ! allocate arrays + call AllocAry(x%q, 6, node_total, 'Displacement/Rotation Nodal DOF', ErrStat, ErrMsg) + call AllocAry(x%dqdt, 6, node_total, 'Velocity Nodal DOF', ErrStat, ErrMsg) + + end function end module diff --git a/modules/elastodyn/src/ElastoDyn.f90 b/modules/elastodyn/src/ElastoDyn.f90 index 7bc2708c94..b79a97043a 100644 --- a/modules/elastodyn/src/ElastoDyn.f90 +++ b/modules/elastodyn/src/ElastoDyn.f90 @@ -97,7 +97,7 @@ SUBROUTINE ED_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut TYPE(ED_InputFile) :: InputFileData ! Data stored in the module's input file INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation - INTEGER(IntKi) :: i ! loop counters + INTEGER(IntKi) :: i, K ! loop counters LOGICAL, PARAMETER :: GetAdamsVals = .FALSE. ! Determines if we should read Adams values and create (update) an Adams model CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None REAL(R8Ki) :: TransMat(3,3) ! Initial rotation matrix at Platform Refz @@ -250,7 +250,8 @@ SUBROUTINE ED_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut InitOut%PlatformPos(3) = InitOut%PlatformPos(3) - TransMat(3,3)*p%PtfmRefzt + p%PtfmRefzt InitOut%HubHt = p%HubHt - InitOut%TwrBasePos = y%TowerLn2Mesh%Position(:,p%TwrNodes + 2) + InitOut%TwrBasePos = y%TowerLn2Mesh%Position(:,p%TwrNodes + 2) + InitOut%TwrBaseOrient = y%TowerLn2Mesh%Orientation(:,:,p%TwrNodes + 2) InitOut%HubRad = p%HubRad InitOut%RotSpeed = p%RotSpeed InitOut%isFixed_GenDOF = .not. InputFileData%GenDOF @@ -537,6 +538,7 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) REAL(R8Ki) :: TmpVec2 (NDims) ! A temporary vector. REAL(ReKi) :: LinAccES (NDims,0:p%TipNode,p%NumBl) ! Total linear acceleration of a point on a blade (point S) in the inertia frame (body E for earth). + REAL(ReKi) :: AngAccEK (NDims,0:p%TipNode,p%NumBl) ! Total rotational acceleration of a point on a blade (point S) in the inertia frame (body E for earth). REAL(ReKi) :: LinAccET (NDims,0:p%TwrNodes) ! Total linear acceleration of a point on the tower (point T) in the inertia frame (body E for earth). REAL(ReKi) :: AngAccEF (NDims,0:p%TwrNodes) ! Total angular acceleration of tower element J (body F) in the inertia frame (body E for earth). REAL(ReKi) :: FrcS0B (NDims,p%NumBl) ! Total force at the blade root (point S(0)) due to the blade. @@ -673,9 +675,10 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) DO J = 0,p%TipNode ! Loop through the blade nodes / elements LinAccES(:,J,K) = m%RtHS%LinAccESt(:,K,J) - + AngAccEK(:,J,K) = m%RtHs%AngAccEKt(:,J,K) DO I = 1,p%DOFs%NPSE(K) ! Loop through all active (enabled) DOFs that contribute to the QD2T-related linear accelerations of blade K LinAccES(:,J,K) = LinAccES(:,J,K) + m%RtHS%PLinVelES(K,J,p%DOFs%PSE(K,I),0,:)*m%QD2T(p%DOFs%PSE(K,I)) + AngAccEK(:,J,K) = AngAccEK(:,J,K) + m%RtHS%PAngVelEM(K,J,p%DOFs%PSE(K,I),0,:)*m%QD2T(p%DOFs%PSE(K,I)) ENDDO ! I - All active (enabled) DOFs that contribute to the QD2T-related linear accelerations of blade K ENDDO ! J - Blade nodes / elements @@ -885,6 +888,9 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) m%AllOuts(YawBrTDxt) = DOT_PRODUCT( rOPO, m%CoordSys%a1 ) m%AllOuts(YawBrTDyt) = -DOT_PRODUCT( rOPO, m%CoordSys%a3 ) m%AllOuts(YawBrTDzt) = DOT_PRODUCT( rOPO, m%CoordSys%a2 ) + m%AllOuts(YawBrTVxp) = DOT_PRODUCT( m%RtHS%LinVelEO, m%CoordSys%b1 ) + m%AllOuts(YawBrTVyp) = -DOT_PRODUCT( m%RtHS%LinVelEO, m%CoordSys%b3 ) + m%AllOuts(YawBrTVzp) = DOT_PRODUCT( m%RtHS%LinVelEO, m%CoordSys%b2 ) m%AllOuts(YawBrTAxp) = DOT_PRODUCT( LinAccEO, m%CoordSys%b1 ) m%AllOuts(YawBrTAyp) = -DOT_PRODUCT( LinAccEO, m%CoordSys%b3 ) m%AllOuts(YawBrTAzp) = DOT_PRODUCT( LinAccEO, m%CoordSys%b2 ) @@ -1249,11 +1255,8 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) m%AllOuts( QD_Y ) = x%QDT( DOF_Y ) m%AllOuts( QD2_B1E1 ) = m%QD2T( DOF_BE(1,1) ) - m%AllOuts( QD2_B2E1 ) = m%QD2T( DOF_BE(2,1) ) m%AllOuts( QD2_B1F1 ) = m%QD2T( DOF_BF(1,1) ) - m%AllOuts( QD2_B2F1 ) = m%QD2T( DOF_BF(2,1) ) m%AllOuts( QD2_B1F2 ) = m%QD2T( DOF_BF(1,2) ) - m%AllOuts( QD2_B2F2 ) = m%QD2T( DOF_BF(2,2) ) m%AllOuts( QD2_DrTr ) = m%QD2T( DOF_DrTr ) m%AllOuts( QD2_GeAz ) = m%QD2T( DOF_GeAz ) m%AllOuts( QD2_RFrl ) = m%QD2T( DOF_RFrl ) @@ -1279,6 +1282,10 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) m%AllOuts( QD_B2E1 ) = x%QDT( DOF_BE(2,1) ) m%AllOuts( QD_B2F1 ) = x%QDT( DOF_BF(2,1) ) m%AllOuts( QD_B2F2 ) = x%QDT( DOF_BF(2,2) ) + + m%AllOuts( QD2_B2E1 ) = m%QD2T( DOF_BE(2,1) ) + m%AllOuts( QD2_B2F1 ) = m%QD2T( DOF_BF(2,1) ) + m%AllOuts( QD2_B2F2 ) = m%QD2T( DOF_BF(2,2) ) IF ( p%NumBl > 2 ) THEN m%AllOuts( Q_B3E1 ) = x%QT( DOF_BE(3,1) ) @@ -1398,6 +1405,11 @@ SUBROUTINE ED_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) y%BladeLn2Mesh(K)%TranslationAcc(1,NodeNum) = LinAccES(1,J2,K) y%BladeLn2Mesh(K)%TranslationAcc(2,NodeNum) = -1.*LinAccES(3,J2,K) y%BladeLn2Mesh(K)%TranslationAcc(3,NodeNum) = LinAccES(2,J2,K) + + ! Rotational Acceleration + y%BladeLn2Mesh(K)%RotationAcc(1,NodeNum) = AngAccEK(1,J2,K) + y%BladeLn2Mesh(K)%RotationAcc(2,NodeNum) = -1.*AngAccEK(3,J2,K) + y%BladeLn2Mesh(K)%RotationAcc(3,NodeNum) = AngAccEK(2,J2,K) END DO !J = 1,p%BldNodes ! Loop through the blade nodes / elements @@ -2100,8 +2112,9 @@ SUBROUTINE Init_DOFparameters( InputFileData, p, ErrStat, ErrMsg ) ErrStat = ErrID_None ErrMsg = '' - - IF ( p%NumBl == 2 ) THEN + IF ( p%NumBl == 1 ) THEN + p%NDOF = 18 + ELSEIF ( p%NumBl == 2 ) THEN p%NDOF = 22 ELSE p%NDOF = ED_MaxDOFs @@ -3135,6 +3148,12 @@ SUBROUTINE Alloc_RtHS( RtHS, p, ErrStat, ErrMsg ) ErrMsg = ' Error allocating memory for LinAccESt.' RETURN ENDIF + ALLOCATE ( RtHS%AngAccEKt( Dims, 0:p%TipNode, p%NumBl ) , STAT=ErrStat ) + IF ( ErrStat /= 0_IntKi ) THEN + ErrStat = ErrID_Fatal + ErrMsg = ' Error allocating memory for AngAccEKt.' + RETURN + ENDIF ALLOCATE(RtHS%AngPosHM(Dims, p%NumBl, 0:p%TipNode), STAT=ErrStat ) IF ( ErrStat /= 0_IntKi ) THEN @@ -3898,7 +3917,7 @@ END SUBROUTINE Init_MiscOtherStates !! the sign is set to 0 if the channel is invalid. !! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. !! -!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 08-Jun-2020 17:05:31. +!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 25-Jan-2021 13:23:51. SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -3924,429 +3943,378 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam" - CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(978) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically - "AZIMUTH ","BLDPITCH1","BLDPITCH2","BLDPITCH3","BLPITCH1 ","BLPITCH2 ","BLPITCH3 ", & - "GENACCEL ","GENSPEED ","HSSBRTQ ","HSSHFTA ","HSSHFTPWR","HSSHFTTQ ","HSSHFTV ", & - "IPDEFL1 ","IPDEFL2 ","IPDEFL3 ","LSSGAGA ","LSSGAGAXA","LSSGAGAXS","LSSGAGFXA", & - "LSSGAGFXS","LSSGAGFYA","LSSGAGFYS","LSSGAGFZA","LSSGAGFZS","LSSGAGMXA","LSSGAGMXS", & - "LSSGAGMYA","LSSGAGMYS","LSSGAGMZA","LSSGAGMZS","LSSGAGP ","LSSGAGPXA","LSSGAGPXS", & - "LSSGAGV ","LSSGAGVXA","LSSGAGVXS","LSSHFTFXA","LSSHFTFXS","LSSHFTFYA","LSSHFTFYS", & - "LSSHFTFZA","LSSHFTFZS","LSSHFTMXA","LSSHFTMXS","LSSHFTPWR","LSSHFTTQ ","LSSTIPA ", & - "LSSTIPAXA","LSSTIPAXS","LSSTIPMYA","LSSTIPMYS","LSSTIPMZA","LSSTIPMZS","LSSTIPP ", & - "LSSTIPPXA","LSSTIPPXS","LSSTIPV ","LSSTIPVXA","LSSTIPVXS","NACYAW ","NACYAWA ", & - "NACYAWP ","NACYAWV ","NCIMURAXS","NCIMURAYS","NCIMURAZS","NCIMURVXS","NCIMURVYS", & - "NCIMURVZS","NCIMUTAXS","NCIMUTAYS","NCIMUTAZS","NCIMUTVXS","NCIMUTVYS","NCIMUTVZS", & - "OOPDEFL1 ","OOPDEFL2 ","OOPDEFL3 ","PTCHDEFL1","PTCHDEFL2","PTCHDEFL3","PTCHPMZB1", & - "PTCHPMZB2","PTCHPMZB3","PTCHPMZC1","PTCHPMZC2","PTCHPMZC3","PTFMHEAVE","PTFMPITCH", & - "PTFMRAXI ","PTFMRAXT ","PTFMRAYI ","PTFMRAYT ","PTFMRAZI ","PTFMRAZT ","PTFMRDXI ", & - "PTFMRDYI ","PTFMRDZI ","PTFMROLL ","PTFMRVXI ","PTFMRVXT ","PTFMRVYI ","PTFMRVYT ", & - "PTFMRVZI ","PTFMRVZT ","PTFMSURGE","PTFMSWAY ","PTFMTAXI ","PTFMTAXT ","PTFMTAYI ", & - "PTFMTAYT ","PTFMTAZI ","PTFMTAZT ","PTFMTDXI ","PTFMTDXT ","PTFMTDYI ","PTFMTDYT ", & - "PTFMTDZI ","PTFMTDZT ","PTFMTVXI ","PTFMTVXT ","PTFMTVYI ","PTFMTVYT ","PTFMTVZI ", & - "PTFMTVZT ","PTFMYAW ","QD2_B1E1 ","QD2_B1F1 ","QD2_B1F2 ","QD2_B2E1 ","QD2_B2F1 ", & - "QD2_B2F2 ","QD2_B3E1 ","QD2_B3F1 ","QD2_B3F2 ","QD2_DRTR ","QD2_GEAZ ","QD2_HV ", & - "QD2_P ","QD2_R ","QD2_RFRL ","QD2_SG ","QD2_SW ","QD2_TEET ","QD2_TFA1 ", & - "QD2_TFA2 ","QD2_TFRL ","QD2_TSS1 ","QD2_TSS2 ","QD2_Y ","QD2_YAW ","QD_B1E1 ", & - "QD_B1F1 ","QD_B1F2 ","QD_B2E1 ","QD_B2F1 ","QD_B2F2 ","QD_B3E1 ","QD_B3F1 ", & - "QD_B3F2 ","QD_DRTR ","QD_GEAZ ","QD_HV ","QD_P ","QD_R ","QD_RFRL ", & - "QD_SG ","QD_SW ","QD_TEET ","QD_TFA1 ","QD_TFA2 ","QD_TFRL ","QD_TSS1 ", & - "QD_TSS2 ","QD_Y ","QD_YAW ","Q_B1E1 ","Q_B1F1 ","Q_B1F2 ","Q_B2E1 ", & - "Q_B2F1 ","Q_B2F2 ","Q_B3E1 ","Q_B3F1 ","Q_B3F2 ","Q_DRTR ","Q_GEAZ ", & - "Q_HV ","Q_P ","Q_R ","Q_RFRL ","Q_SG ","Q_SW ","Q_TEET ", & - "Q_TFA1 ","Q_TFA2 ","Q_TFRL ","Q_TSS1 ","Q_TSS2 ","Q_Y ","Q_YAW ", & - "RFRLBRM ","ROLLDEFL1","ROLLDEFL2","ROLLDEFL3","ROOTFXB1 ","ROOTFXB2 ","ROOTFXB3 ", & - "ROOTFXC1 ","ROOTFXC2 ","ROOTFXC3 ","ROOTFYB1 ","ROOTFYB2 ","ROOTFYB3 ","ROOTFYC1 ", & - "ROOTFYC2 ","ROOTFYC3 ","ROOTFZB1 ","ROOTFZB2 ","ROOTFZB3 ","ROOTFZC1 ","ROOTFZC2 ", & - "ROOTFZC3 ","ROOTMEDG1","ROOTMEDG2","ROOTMEDG3","ROOTMFLP1","ROOTMFLP2","ROOTMFLP3", & - "ROOTMIP1 ","ROOTMIP2 ","ROOTMIP3 ","ROOTMOOP1","ROOTMOOP2","ROOTMOOP3","ROOTMXB1 ", & - "ROOTMXB2 ","ROOTMXB3 ","ROOTMXC1 ","ROOTMXC2 ","ROOTMXC3 ","ROOTMYB1 ","ROOTMYB2 ", & - "ROOTMYB3 ","ROOTMYC1 ","ROOTMYC2 ","ROOTMYC3 ","ROOTMZB1 ","ROOTMZB2 ","ROOTMZB3 ", & - "ROOTMZC1 ","ROOTMZC2 ","ROOTMZC3 ","ROTACCEL ","ROTFURL ","ROTFURLA ","ROTFURLP ", & - "ROTFURLV ","ROTPWR ","ROTSPEED ","ROTTEETA ","ROTTEETP ","ROTTEETV ","ROTTHRUST", & - "ROTTORQ ","SPN1ALXB1","SPN1ALXB2","SPN1ALXB3","SPN1ALYB1","SPN1ALYB2","SPN1ALYB3", & - "SPN1ALZB1","SPN1ALZB2","SPN1ALZB3","SPN1FLXB1","SPN1FLXB2","SPN1FLXB3","SPN1FLYB1", & - "SPN1FLYB2","SPN1FLYB3","SPN1FLZB1","SPN1FLZB2","SPN1FLZB3","SPN1MLXB1","SPN1MLXB2", & - "SPN1MLXB3","SPN1MLYB1","SPN1MLYB2","SPN1MLYB3","SPN1MLZB1","SPN1MLZB2","SPN1MLZB3", & - "SPN1RDXB1","SPN1RDXB2","SPN1RDXB3","SPN1RDYB1","SPN1RDYB2","SPN1RDYB3","SPN1RDZB1", & - "SPN1RDZB2","SPN1RDZB3","SPN1TDXB1","SPN1TDXB2","SPN1TDXB3","SPN1TDYB1","SPN1TDYB2", & - "SPN1TDYB3","SPN1TDZB1","SPN1TDZB2","SPN1TDZB3","SPN2ALXB1","SPN2ALXB2","SPN2ALXB3", & - "SPN2ALYB1","SPN2ALYB2","SPN2ALYB3","SPN2ALZB1","SPN2ALZB2","SPN2ALZB3","SPN2FLXB1", & - "SPN2FLXB2","SPN2FLXB3","SPN2FLYB1","SPN2FLYB2","SPN2FLYB3","SPN2FLZB1","SPN2FLZB2", & - "SPN2FLZB3","SPN2MLXB1","SPN2MLXB2","SPN2MLXB3","SPN2MLYB1","SPN2MLYB2","SPN2MLYB3", & - "SPN2MLZB1","SPN2MLZB2","SPN2MLZB3","SPN2RDXB1","SPN2RDXB2","SPN2RDXB3","SPN2RDYB1", & - "SPN2RDYB2","SPN2RDYB3","SPN2RDZB1","SPN2RDZB2","SPN2RDZB3","SPN2TDXB1","SPN2TDXB2", & - "SPN2TDXB3","SPN2TDYB1","SPN2TDYB2","SPN2TDYB3","SPN2TDZB1","SPN2TDZB2","SPN2TDZB3", & - "SPN3ALXB1","SPN3ALXB2","SPN3ALXB3","SPN3ALYB1","SPN3ALYB2","SPN3ALYB3","SPN3ALZB1", & - "SPN3ALZB2","SPN3ALZB3","SPN3FLXB1","SPN3FLXB2","SPN3FLXB3","SPN3FLYB1","SPN3FLYB2", & - "SPN3FLYB3","SPN3FLZB1","SPN3FLZB2","SPN3FLZB3","SPN3MLXB1","SPN3MLXB2","SPN3MLXB3", & - "SPN3MLYB1","SPN3MLYB2","SPN3MLYB3","SPN3MLZB1","SPN3MLZB2","SPN3MLZB3","SPN3RDXB1", & - "SPN3RDXB2","SPN3RDXB3","SPN3RDYB1","SPN3RDYB2","SPN3RDYB3","SPN3RDZB1","SPN3RDZB2", & - "SPN3RDZB3","SPN3TDXB1","SPN3TDXB2","SPN3TDXB3","SPN3TDYB1","SPN3TDYB2","SPN3TDYB3", & - "SPN3TDZB1","SPN3TDZB2","SPN3TDZB3","SPN4ALXB1","SPN4ALXB2","SPN4ALXB3","SPN4ALYB1", & - "SPN4ALYB2","SPN4ALYB3","SPN4ALZB1","SPN4ALZB2","SPN4ALZB3","SPN4FLXB1","SPN4FLXB2", & - "SPN4FLXB3","SPN4FLYB1","SPN4FLYB2","SPN4FLYB3","SPN4FLZB1","SPN4FLZB2","SPN4FLZB3", & - "SPN4MLXB1","SPN4MLXB2","SPN4MLXB3","SPN4MLYB1","SPN4MLYB2","SPN4MLYB3","SPN4MLZB1", & - "SPN4MLZB2","SPN4MLZB3","SPN4RDXB1","SPN4RDXB2","SPN4RDXB3","SPN4RDYB1","SPN4RDYB2", & - "SPN4RDYB3","SPN4RDZB1","SPN4RDZB2","SPN4RDZB3","SPN4TDXB1","SPN4TDXB2","SPN4TDXB3", & - "SPN4TDYB1","SPN4TDYB2","SPN4TDYB3","SPN4TDZB1","SPN4TDZB2","SPN4TDZB3","SPN5ALXB1", & - "SPN5ALXB2","SPN5ALXB3","SPN5ALYB1","SPN5ALYB2","SPN5ALYB3","SPN5ALZB1","SPN5ALZB2", & - "SPN5ALZB3","SPN5FLXB1","SPN5FLXB2","SPN5FLXB3","SPN5FLYB1","SPN5FLYB2","SPN5FLYB3", & - "SPN5FLZB1","SPN5FLZB2","SPN5FLZB3","SPN5MLXB1","SPN5MLXB2","SPN5MLXB3","SPN5MLYB1", & - "SPN5MLYB2","SPN5MLYB3","SPN5MLZB1","SPN5MLZB2","SPN5MLZB3","SPN5RDXB1","SPN5RDXB2", & - "SPN5RDXB3","SPN5RDYB1","SPN5RDYB2","SPN5RDYB3","SPN5RDZB1","SPN5RDZB2","SPN5RDZB3", & - "SPN5TDXB1","SPN5TDXB2","SPN5TDXB3","SPN5TDYB1","SPN5TDYB2","SPN5TDYB3","SPN5TDZB1", & - "SPN5TDZB2","SPN5TDZB3","SPN6ALXB1","SPN6ALXB2","SPN6ALXB3","SPN6ALYB1","SPN6ALYB2", & - "SPN6ALYB3","SPN6ALZB1","SPN6ALZB2","SPN6ALZB3","SPN6FLXB1","SPN6FLXB2","SPN6FLXB3", & - "SPN6FLYB1","SPN6FLYB2","SPN6FLYB3","SPN6FLZB1","SPN6FLZB2","SPN6FLZB3","SPN6MLXB1", & - "SPN6MLXB2","SPN6MLXB3","SPN6MLYB1","SPN6MLYB2","SPN6MLYB3","SPN6MLZB1","SPN6MLZB2", & - "SPN6MLZB3","SPN6RDXB1","SPN6RDXB2","SPN6RDXB3","SPN6RDYB1","SPN6RDYB2","SPN6RDYB3", & - "SPN6RDZB1","SPN6RDZB2","SPN6RDZB3","SPN6TDXB1","SPN6TDXB2","SPN6TDXB3","SPN6TDYB1", & - "SPN6TDYB2","SPN6TDYB3","SPN6TDZB1","SPN6TDZB2","SPN6TDZB3","SPN7ALXB1","SPN7ALXB2", & - "SPN7ALXB3","SPN7ALYB1","SPN7ALYB2","SPN7ALYB3","SPN7ALZB1","SPN7ALZB2","SPN7ALZB3", & - "SPN7FLXB1","SPN7FLXB2","SPN7FLXB3","SPN7FLYB1","SPN7FLYB2","SPN7FLYB3","SPN7FLZB1", & - "SPN7FLZB2","SPN7FLZB3","SPN7MLXB1","SPN7MLXB2","SPN7MLXB3","SPN7MLYB1","SPN7MLYB2", & - "SPN7MLYB3","SPN7MLZB1","SPN7MLZB2","SPN7MLZB3","SPN7RDXB1","SPN7RDXB2","SPN7RDXB3", & - "SPN7RDYB1","SPN7RDYB2","SPN7RDYB3","SPN7RDZB1","SPN7RDZB2","SPN7RDZB3","SPN7TDXB1", & - "SPN7TDXB2","SPN7TDXB3","SPN7TDYB1","SPN7TDYB2","SPN7TDYB3","SPN7TDZB1","SPN7TDZB2", & - "SPN7TDZB3","SPN8ALXB1","SPN8ALXB2","SPN8ALXB3","SPN8ALYB1","SPN8ALYB2","SPN8ALYB3", & - "SPN8ALZB1","SPN8ALZB2","SPN8ALZB3","SPN8FLXB1","SPN8FLXB2","SPN8FLXB3","SPN8FLYB1", & - "SPN8FLYB2","SPN8FLYB3","SPN8FLZB1","SPN8FLZB2","SPN8FLZB3","SPN8MLXB1","SPN8MLXB2", & - "SPN8MLXB3","SPN8MLYB1","SPN8MLYB2","SPN8MLYB3","SPN8MLZB1","SPN8MLZB2","SPN8MLZB3", & - "SPN8RDXB1","SPN8RDXB2","SPN8RDXB3","SPN8RDYB1","SPN8RDYB2","SPN8RDYB3","SPN8RDZB1", & - "SPN8RDZB2","SPN8RDZB3","SPN8TDXB1","SPN8TDXB2","SPN8TDXB3","SPN8TDYB1","SPN8TDYB2", & - "SPN8TDYB3","SPN8TDZB1","SPN8TDZB2","SPN8TDZB3","SPN9ALXB1","SPN9ALXB2","SPN9ALXB3", & - "SPN9ALYB1","SPN9ALYB2","SPN9ALYB3","SPN9ALZB1","SPN9ALZB2","SPN9ALZB3","SPN9FLXB1", & - "SPN9FLXB2","SPN9FLXB3","SPN9FLYB1","SPN9FLYB2","SPN9FLYB3","SPN9FLZB1","SPN9FLZB2", & - "SPN9FLZB3","SPN9MLXB1","SPN9MLXB2","SPN9MLXB3","SPN9MLYB1","SPN9MLYB2","SPN9MLYB3", & - "SPN9MLZB1","SPN9MLZB2","SPN9MLZB3","SPN9RDXB1","SPN9RDXB2","SPN9RDXB3","SPN9RDYB1", & - "SPN9RDYB2","SPN9RDYB3","SPN9RDZB1","SPN9RDZB2","SPN9RDZB3","SPN9TDXB1","SPN9TDXB2", & - "SPN9TDXB3","SPN9TDYB1","SPN9TDYB2","SPN9TDYB3","SPN9TDZB1","SPN9TDZB2","SPN9TDZB3", & - "TAILFURL ","TAILFURLA","TAILFURLP","TAILFURLV","TEETAYA ","TEETDEFL ","TEETPYA ", & - "TEETVYA ","TFRLBRM ","TIP2TWR1 ","TIP2TWR2 ","TIP2TWR3 ","TIPALXB1 ","TIPALXB2 ", & - "TIPALXB3 ","TIPALYB1 ","TIPALYB2 ","TIPALYB3 ","TIPALZB1 ","TIPALZB2 ","TIPALZB3 ", & - "TIPCLRNC1","TIPCLRNC2","TIPCLRNC3","TIPDXB1 ","TIPDXB2 ","TIPDXB3 ","TIPDXC1 ", & - "TIPDXC2 ","TIPDXC3 ","TIPDYB1 ","TIPDYB2 ","TIPDYB3 ","TIPDYC1 ","TIPDYC2 ", & - "TIPDYC3 ","TIPDZB1 ","TIPDZB2 ","TIPDZB3 ","TIPDZC1 ","TIPDZC2 ","TIPDZC3 ", & - "TIPRDXB1 ","TIPRDXB2 ","TIPRDXB3 ","TIPRDYB1 ","TIPRDYB2 ","TIPRDYB3 ","TIPRDZB1 ", & - "TIPRDZB2 ","TIPRDZB3 ","TIPRDZC1 ","TIPRDZC2 ","TIPRDZC3 ","TTDSPAX ","TTDSPFA ", & - "TTDSPPTCH","TTDSPROLL","TTDSPSS ","TTDSPTWST","TWHT1ALXT","TWHT1ALYT","TWHT1ALZT", & - "TWHT1FLXT","TWHT1FLYT","TWHT1FLZT","TWHT1MLXT","TWHT1MLYT","TWHT1MLZT","TWHT1RDXT", & - "TWHT1RDYT","TWHT1RDZT","TWHT1RPXI","TWHT1RPYI","TWHT1RPZI","TWHT1TDXT","TWHT1TDYT", & - "TWHT1TDZT","TWHT1TPXI","TWHT1TPYI","TWHT1TPZI","TWHT2ALXT","TWHT2ALYT","TWHT2ALZT", & - "TWHT2FLXT","TWHT2FLYT","TWHT2FLZT","TWHT2MLXT","TWHT2MLYT","TWHT2MLZT","TWHT2RDXT", & - "TWHT2RDYT","TWHT2RDZT","TWHT2RPXI","TWHT2RPYI","TWHT2RPZI","TWHT2TDXT","TWHT2TDYT", & - "TWHT2TDZT","TWHT2TPXI","TWHT2TPYI","TWHT2TPZI","TWHT3ALXT","TWHT3ALYT","TWHT3ALZT", & - "TWHT3FLXT","TWHT3FLYT","TWHT3FLZT","TWHT3MLXT","TWHT3MLYT","TWHT3MLZT","TWHT3RDXT", & - "TWHT3RDYT","TWHT3RDZT","TWHT3RPXI","TWHT3RPYI","TWHT3RPZI","TWHT3TDXT","TWHT3TDYT", & - "TWHT3TDZT","TWHT3TPXI","TWHT3TPYI","TWHT3TPZI","TWHT4ALXT","TWHT4ALYT","TWHT4ALZT", & - "TWHT4FLXT","TWHT4FLYT","TWHT4FLZT","TWHT4MLXT","TWHT4MLYT","TWHT4MLZT","TWHT4RDXT", & - "TWHT4RDYT","TWHT4RDZT","TWHT4RPXI","TWHT4RPYI","TWHT4RPZI","TWHT4TDXT","TWHT4TDYT", & - "TWHT4TDZT","TWHT4TPXI","TWHT4TPYI","TWHT4TPZI","TWHT5ALXT","TWHT5ALYT","TWHT5ALZT", & - "TWHT5FLXT","TWHT5FLYT","TWHT5FLZT","TWHT5MLXT","TWHT5MLYT","TWHT5MLZT","TWHT5RDXT", & - "TWHT5RDYT","TWHT5RDZT","TWHT5RPXI","TWHT5RPYI","TWHT5RPZI","TWHT5TDXT","TWHT5TDYT", & - "TWHT5TDZT","TWHT5TPXI","TWHT5TPYI","TWHT5TPZI","TWHT6ALXT","TWHT6ALYT","TWHT6ALZT", & - "TWHT6FLXT","TWHT6FLYT","TWHT6FLZT","TWHT6MLXT","TWHT6MLYT","TWHT6MLZT","TWHT6RDXT", & - "TWHT6RDYT","TWHT6RDZT","TWHT6RPXI","TWHT6RPYI","TWHT6RPZI","TWHT6TDXT","TWHT6TDYT", & - "TWHT6TDZT","TWHT6TPXI","TWHT6TPYI","TWHT6TPZI","TWHT7ALXT","TWHT7ALYT","TWHT7ALZT", & - "TWHT7FLXT","TWHT7FLYT","TWHT7FLZT","TWHT7MLXT","TWHT7MLYT","TWHT7MLZT","TWHT7RDXT", & - "TWHT7RDYT","TWHT7RDZT","TWHT7RPXI","TWHT7RPYI","TWHT7RPZI","TWHT7TDXT","TWHT7TDYT", & - "TWHT7TDZT","TWHT7TPXI","TWHT7TPYI","TWHT7TPZI","TWHT8ALXT","TWHT8ALYT","TWHT8ALZT", & - "TWHT8FLXT","TWHT8FLYT","TWHT8FLZT","TWHT8MLXT","TWHT8MLYT","TWHT8MLZT","TWHT8RDXT", & - "TWHT8RDYT","TWHT8RDZT","TWHT8RPXI","TWHT8RPYI","TWHT8RPZI","TWHT8TDXT","TWHT8TDYT", & - "TWHT8TDZT","TWHT8TPXI","TWHT8TPYI","TWHT8TPZI","TWHT9ALXT","TWHT9ALYT","TWHT9ALZT", & - "TWHT9FLXT","TWHT9FLYT","TWHT9FLZT","TWHT9MLXT","TWHT9MLYT","TWHT9MLZT","TWHT9RDXT", & - "TWHT9RDYT","TWHT9RDZT","TWHT9RPXI","TWHT9RPYI","TWHT9RPZI","TWHT9TDXT","TWHT9TDYT", & - "TWHT9TDZT","TWHT9TPXI","TWHT9TPYI","TWHT9TPZI","TWRBSFXT ","TWRBSFYT ","TWRBSFZT ", & - "TWRBSMXT ","TWRBSMYT ","TWRBSMZT ","TWRCLRNC1","TWRCLRNC2","TWRCLRNC3","TWRTPTDXI", & - "TWRTPTDYI","TWRTPTDZI","TWSTDEFL1","TWSTDEFL2","TWSTDEFL3","YAWACCEL ","YAWAZN ", & - "YAWAZP ","YAWBRFXN ","YAWBRFXP ","YAWBRFYN ","YAWBRFYP ","YAWBRFZN ","YAWBRFZP ", & - "YAWBRMXN ","YAWBRMXP ","YAWBRMYN ","YAWBRMYP ","YAWBRMZN ","YAWBRMZP ","YAWBRRAXP", & - "YAWBRRAYP","YAWBRRAZP","YAWBRRDXT","YAWBRRDYT","YAWBRRDZT","YAWBRRVXP","YAWBRRVYP", & - "YAWBRRVZP","YAWBRTAXP","YAWBRTAYP","YAWBRTAZP","YAWBRTDXI","YAWBRTDXP","YAWBRTDXT", & - "YAWBRTDYI","YAWBRTDYP","YAWBRTDYT","YAWBRTDZI","YAWBRTDZP","YAWBRTDZT","YAWPOS ", & + CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(981) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically + "AZIMUTH ","BLDPITCH1","BLDPITCH2","BLDPITCH3","BLPITCH1 ","BLPITCH2 ","BLPITCH3 ","GENACCEL ", & + "GENSPEED ","HSSBRTQ ","HSSHFTA ","HSSHFTPWR","HSSHFTTQ ","HSSHFTV ","IPDEFL1 ","IPDEFL2 ", & + "IPDEFL3 ","LSSGAGA ","LSSGAGAXA","LSSGAGAXS","LSSGAGFXA","LSSGAGFXS","LSSGAGFYA","LSSGAGFYS", & + "LSSGAGFZA","LSSGAGFZS","LSSGAGMXA","LSSGAGMXS","LSSGAGMYA","LSSGAGMYS","LSSGAGMZA","LSSGAGMZS", & + "LSSGAGP ","LSSGAGPXA","LSSGAGPXS","LSSGAGV ","LSSGAGVXA","LSSGAGVXS","LSSHFTFXA","LSSHFTFXS", & + "LSSHFTFYA","LSSHFTFYS","LSSHFTFZA","LSSHFTFZS","LSSHFTMXA","LSSHFTMXS","LSSHFTPWR","LSSHFTTQ ", & + "LSSTIPA ","LSSTIPAXA","LSSTIPAXS","LSSTIPMYA","LSSTIPMYS","LSSTIPMZA","LSSTIPMZS","LSSTIPP ", & + "LSSTIPPXA","LSSTIPPXS","LSSTIPV ","LSSTIPVXA","LSSTIPVXS","NACYAW ","NACYAWA ","NACYAWP ", & + "NACYAWV ","NCIMURAXS","NCIMURAYS","NCIMURAZS","NCIMURVXS","NCIMURVYS","NCIMURVZS","NCIMUTAXS", & + "NCIMUTAYS","NCIMUTAZS","NCIMUTVXS","NCIMUTVYS","NCIMUTVZS","OOPDEFL1 ","OOPDEFL2 ","OOPDEFL3 ", & + "PTCHDEFL1","PTCHDEFL2","PTCHDEFL3","PTCHPMZB1","PTCHPMZB2","PTCHPMZB3","PTCHPMZC1","PTCHPMZC2", & + "PTCHPMZC3","PTFMHEAVE","PTFMPITCH","PTFMRAXI ","PTFMRAXT ","PTFMRAYI ","PTFMRAYT ","PTFMRAZI ", & + "PTFMRAZT ","PTFMRDXI ","PTFMRDYI ","PTFMRDZI ","PTFMROLL ","PTFMRVXI ","PTFMRVXT ","PTFMRVYI ", & + "PTFMRVYT ","PTFMRVZI ","PTFMRVZT ","PTFMSURGE","PTFMSWAY ","PTFMTAXI ","PTFMTAXT ","PTFMTAYI ", & + "PTFMTAYT ","PTFMTAZI ","PTFMTAZT ","PTFMTDXI ","PTFMTDXT ","PTFMTDYI ","PTFMTDYT ","PTFMTDZI ", & + "PTFMTDZT ","PTFMTVXI ","PTFMTVXT ","PTFMTVYI ","PTFMTVYT ","PTFMTVZI ","PTFMTVZT ","PTFMYAW ", & + "QD2_B1E1 ","QD2_B1F1 ","QD2_B1F2 ","QD2_B2E1 ","QD2_B2F1 ","QD2_B2F2 ","QD2_B3E1 ","QD2_B3F1 ", & + "QD2_B3F2 ","QD2_DRTR ","QD2_GEAZ ","QD2_HV ","QD2_P ","QD2_R ","QD2_RFRL ","QD2_SG ", & + "QD2_SW ","QD2_TEET ","QD2_TFA1 ","QD2_TFA2 ","QD2_TFRL ","QD2_TSS1 ","QD2_TSS2 ","QD2_Y ", & + "QD2_YAW ","QD_B1E1 ","QD_B1F1 ","QD_B1F2 ","QD_B2E1 ","QD_B2F1 ","QD_B2F2 ","QD_B3E1 ", & + "QD_B3F1 ","QD_B3F2 ","QD_DRTR ","QD_GEAZ ","QD_HV ","QD_P ","QD_R ","QD_RFRL ", & + "QD_SG ","QD_SW ","QD_TEET ","QD_TFA1 ","QD_TFA2 ","QD_TFRL ","QD_TSS1 ","QD_TSS2 ", & + "QD_Y ","QD_YAW ","Q_B1E1 ","Q_B1F1 ","Q_B1F2 ","Q_B2E1 ","Q_B2F1 ","Q_B2F2 ", & + "Q_B3E1 ","Q_B3F1 ","Q_B3F2 ","Q_DRTR ","Q_GEAZ ","Q_HV ","Q_P ","Q_R ", & + "Q_RFRL ","Q_SG ","Q_SW ","Q_TEET ","Q_TFA1 ","Q_TFA2 ","Q_TFRL ","Q_TSS1 ", & + "Q_TSS2 ","Q_Y ","Q_YAW ","RFRLBRM ","ROLLDEFL1","ROLLDEFL2","ROLLDEFL3","ROOTFXB1 ", & + "ROOTFXB2 ","ROOTFXB3 ","ROOTFXC1 ","ROOTFXC2 ","ROOTFXC3 ","ROOTFYB1 ","ROOTFYB2 ","ROOTFYB3 ", & + "ROOTFYC1 ","ROOTFYC2 ","ROOTFYC3 ","ROOTFZB1 ","ROOTFZB2 ","ROOTFZB3 ","ROOTFZC1 ","ROOTFZC2 ", & + "ROOTFZC3 ","ROOTMEDG1","ROOTMEDG2","ROOTMEDG3","ROOTMFLP1","ROOTMFLP2","ROOTMFLP3","ROOTMIP1 ", & + "ROOTMIP2 ","ROOTMIP3 ","ROOTMOOP1","ROOTMOOP2","ROOTMOOP3","ROOTMXB1 ","ROOTMXB2 ","ROOTMXB3 ", & + "ROOTMXC1 ","ROOTMXC2 ","ROOTMXC3 ","ROOTMYB1 ","ROOTMYB2 ","ROOTMYB3 ","ROOTMYC1 ","ROOTMYC2 ", & + "ROOTMYC3 ","ROOTMZB1 ","ROOTMZB2 ","ROOTMZB3 ","ROOTMZC1 ","ROOTMZC2 ","ROOTMZC3 ","ROTACCEL ", & + "ROTFURL ","ROTFURLA ","ROTFURLP ","ROTFURLV ","ROTPWR ","ROTSPEED ","ROTTEETA ","ROTTEETP ", & + "ROTTEETV ","ROTTHRUST","ROTTORQ ","SPN1ALXB1","SPN1ALXB2","SPN1ALXB3","SPN1ALYB1","SPN1ALYB2", & + "SPN1ALYB3","SPN1ALZB1","SPN1ALZB2","SPN1ALZB3","SPN1FLXB1","SPN1FLXB2","SPN1FLXB3","SPN1FLYB1", & + "SPN1FLYB2","SPN1FLYB3","SPN1FLZB1","SPN1FLZB2","SPN1FLZB3","SPN1MLXB1","SPN1MLXB2","SPN1MLXB3", & + "SPN1MLYB1","SPN1MLYB2","SPN1MLYB3","SPN1MLZB1","SPN1MLZB2","SPN1MLZB3","SPN1RDXB1","SPN1RDXB2", & + "SPN1RDXB3","SPN1RDYB1","SPN1RDYB2","SPN1RDYB3","SPN1RDZB1","SPN1RDZB2","SPN1RDZB3","SPN1TDXB1", & + "SPN1TDXB2","SPN1TDXB3","SPN1TDYB1","SPN1TDYB2","SPN1TDYB3","SPN1TDZB1","SPN1TDZB2","SPN1TDZB3", & + "SPN2ALXB1","SPN2ALXB2","SPN2ALXB3","SPN2ALYB1","SPN2ALYB2","SPN2ALYB3","SPN2ALZB1","SPN2ALZB2", & + "SPN2ALZB3","SPN2FLXB1","SPN2FLXB2","SPN2FLXB3","SPN2FLYB1","SPN2FLYB2","SPN2FLYB3","SPN2FLZB1", & + "SPN2FLZB2","SPN2FLZB3","SPN2MLXB1","SPN2MLXB2","SPN2MLXB3","SPN2MLYB1","SPN2MLYB2","SPN2MLYB3", & + "SPN2MLZB1","SPN2MLZB2","SPN2MLZB3","SPN2RDXB1","SPN2RDXB2","SPN2RDXB3","SPN2RDYB1","SPN2RDYB2", & + "SPN2RDYB3","SPN2RDZB1","SPN2RDZB2","SPN2RDZB3","SPN2TDXB1","SPN2TDXB2","SPN2TDXB3","SPN2TDYB1", & + "SPN2TDYB2","SPN2TDYB3","SPN2TDZB1","SPN2TDZB2","SPN2TDZB3","SPN3ALXB1","SPN3ALXB2","SPN3ALXB3", & + "SPN3ALYB1","SPN3ALYB2","SPN3ALYB3","SPN3ALZB1","SPN3ALZB2","SPN3ALZB3","SPN3FLXB1","SPN3FLXB2", & + "SPN3FLXB3","SPN3FLYB1","SPN3FLYB2","SPN3FLYB3","SPN3FLZB1","SPN3FLZB2","SPN3FLZB3","SPN3MLXB1", & + "SPN3MLXB2","SPN3MLXB3","SPN3MLYB1","SPN3MLYB2","SPN3MLYB3","SPN3MLZB1","SPN3MLZB2","SPN3MLZB3", & + "SPN3RDXB1","SPN3RDXB2","SPN3RDXB3","SPN3RDYB1","SPN3RDYB2","SPN3RDYB3","SPN3RDZB1","SPN3RDZB2", & + "SPN3RDZB3","SPN3TDXB1","SPN3TDXB2","SPN3TDXB3","SPN3TDYB1","SPN3TDYB2","SPN3TDYB3","SPN3TDZB1", & + "SPN3TDZB2","SPN3TDZB3","SPN4ALXB1","SPN4ALXB2","SPN4ALXB3","SPN4ALYB1","SPN4ALYB2","SPN4ALYB3", & + "SPN4ALZB1","SPN4ALZB2","SPN4ALZB3","SPN4FLXB1","SPN4FLXB2","SPN4FLXB3","SPN4FLYB1","SPN4FLYB2", & + "SPN4FLYB3","SPN4FLZB1","SPN4FLZB2","SPN4FLZB3","SPN4MLXB1","SPN4MLXB2","SPN4MLXB3","SPN4MLYB1", & + "SPN4MLYB2","SPN4MLYB3","SPN4MLZB1","SPN4MLZB2","SPN4MLZB3","SPN4RDXB1","SPN4RDXB2","SPN4RDXB3", & + "SPN4RDYB1","SPN4RDYB2","SPN4RDYB3","SPN4RDZB1","SPN4RDZB2","SPN4RDZB3","SPN4TDXB1","SPN4TDXB2", & + "SPN4TDXB3","SPN4TDYB1","SPN4TDYB2","SPN4TDYB3","SPN4TDZB1","SPN4TDZB2","SPN4TDZB3","SPN5ALXB1", & + "SPN5ALXB2","SPN5ALXB3","SPN5ALYB1","SPN5ALYB2","SPN5ALYB3","SPN5ALZB1","SPN5ALZB2","SPN5ALZB3", & + "SPN5FLXB1","SPN5FLXB2","SPN5FLXB3","SPN5FLYB1","SPN5FLYB2","SPN5FLYB3","SPN5FLZB1","SPN5FLZB2", & + "SPN5FLZB3","SPN5MLXB1","SPN5MLXB2","SPN5MLXB3","SPN5MLYB1","SPN5MLYB2","SPN5MLYB3","SPN5MLZB1", & + "SPN5MLZB2","SPN5MLZB3","SPN5RDXB1","SPN5RDXB2","SPN5RDXB3","SPN5RDYB1","SPN5RDYB2","SPN5RDYB3", & + "SPN5RDZB1","SPN5RDZB2","SPN5RDZB3","SPN5TDXB1","SPN5TDXB2","SPN5TDXB3","SPN5TDYB1","SPN5TDYB2", & + "SPN5TDYB3","SPN5TDZB1","SPN5TDZB2","SPN5TDZB3","SPN6ALXB1","SPN6ALXB2","SPN6ALXB3","SPN6ALYB1", & + "SPN6ALYB2","SPN6ALYB3","SPN6ALZB1","SPN6ALZB2","SPN6ALZB3","SPN6FLXB1","SPN6FLXB2","SPN6FLXB3", & + "SPN6FLYB1","SPN6FLYB2","SPN6FLYB3","SPN6FLZB1","SPN6FLZB2","SPN6FLZB3","SPN6MLXB1","SPN6MLXB2", & + "SPN6MLXB3","SPN6MLYB1","SPN6MLYB2","SPN6MLYB3","SPN6MLZB1","SPN6MLZB2","SPN6MLZB3","SPN6RDXB1", & + "SPN6RDXB2","SPN6RDXB3","SPN6RDYB1","SPN6RDYB2","SPN6RDYB3","SPN6RDZB1","SPN6RDZB2","SPN6RDZB3", & + "SPN6TDXB1","SPN6TDXB2","SPN6TDXB3","SPN6TDYB1","SPN6TDYB2","SPN6TDYB3","SPN6TDZB1","SPN6TDZB2", & + "SPN6TDZB3","SPN7ALXB1","SPN7ALXB2","SPN7ALXB3","SPN7ALYB1","SPN7ALYB2","SPN7ALYB3","SPN7ALZB1", & + "SPN7ALZB2","SPN7ALZB3","SPN7FLXB1","SPN7FLXB2","SPN7FLXB3","SPN7FLYB1","SPN7FLYB2","SPN7FLYB3", & + "SPN7FLZB1","SPN7FLZB2","SPN7FLZB3","SPN7MLXB1","SPN7MLXB2","SPN7MLXB3","SPN7MLYB1","SPN7MLYB2", & + "SPN7MLYB3","SPN7MLZB1","SPN7MLZB2","SPN7MLZB3","SPN7RDXB1","SPN7RDXB2","SPN7RDXB3","SPN7RDYB1", & + "SPN7RDYB2","SPN7RDYB3","SPN7RDZB1","SPN7RDZB2","SPN7RDZB3","SPN7TDXB1","SPN7TDXB2","SPN7TDXB3", & + "SPN7TDYB1","SPN7TDYB2","SPN7TDYB3","SPN7TDZB1","SPN7TDZB2","SPN7TDZB3","SPN8ALXB1","SPN8ALXB2", & + "SPN8ALXB3","SPN8ALYB1","SPN8ALYB2","SPN8ALYB3","SPN8ALZB1","SPN8ALZB2","SPN8ALZB3","SPN8FLXB1", & + "SPN8FLXB2","SPN8FLXB3","SPN8FLYB1","SPN8FLYB2","SPN8FLYB3","SPN8FLZB1","SPN8FLZB2","SPN8FLZB3", & + "SPN8MLXB1","SPN8MLXB2","SPN8MLXB3","SPN8MLYB1","SPN8MLYB2","SPN8MLYB3","SPN8MLZB1","SPN8MLZB2", & + "SPN8MLZB3","SPN8RDXB1","SPN8RDXB2","SPN8RDXB3","SPN8RDYB1","SPN8RDYB2","SPN8RDYB3","SPN8RDZB1", & + "SPN8RDZB2","SPN8RDZB3","SPN8TDXB1","SPN8TDXB2","SPN8TDXB3","SPN8TDYB1","SPN8TDYB2","SPN8TDYB3", & + "SPN8TDZB1","SPN8TDZB2","SPN8TDZB3","SPN9ALXB1","SPN9ALXB2","SPN9ALXB3","SPN9ALYB1","SPN9ALYB2", & + "SPN9ALYB3","SPN9ALZB1","SPN9ALZB2","SPN9ALZB3","SPN9FLXB1","SPN9FLXB2","SPN9FLXB3","SPN9FLYB1", & + "SPN9FLYB2","SPN9FLYB3","SPN9FLZB1","SPN9FLZB2","SPN9FLZB3","SPN9MLXB1","SPN9MLXB2","SPN9MLXB3", & + "SPN9MLYB1","SPN9MLYB2","SPN9MLYB3","SPN9MLZB1","SPN9MLZB2","SPN9MLZB3","SPN9RDXB1","SPN9RDXB2", & + "SPN9RDXB3","SPN9RDYB1","SPN9RDYB2","SPN9RDYB3","SPN9RDZB1","SPN9RDZB2","SPN9RDZB3","SPN9TDXB1", & + "SPN9TDXB2","SPN9TDXB3","SPN9TDYB1","SPN9TDYB2","SPN9TDYB3","SPN9TDZB1","SPN9TDZB2","SPN9TDZB3", & + "TAILFURL ","TAILFURLA","TAILFURLP","TAILFURLV","TEETAYA ","TEETDEFL ","TEETPYA ","TEETVYA ", & + "TFRLBRM ","TIP2TWR1 ","TIP2TWR2 ","TIP2TWR3 ","TIPALXB1 ","TIPALXB2 ","TIPALXB3 ","TIPALYB1 ", & + "TIPALYB2 ","TIPALYB3 ","TIPALZB1 ","TIPALZB2 ","TIPALZB3 ","TIPCLRNC1","TIPCLRNC2","TIPCLRNC3", & + "TIPDXB1 ","TIPDXB2 ","TIPDXB3 ","TIPDXC1 ","TIPDXC2 ","TIPDXC3 ","TIPDYB1 ","TIPDYB2 ", & + "TIPDYB3 ","TIPDYC1 ","TIPDYC2 ","TIPDYC3 ","TIPDZB1 ","TIPDZB2 ","TIPDZB3 ","TIPDZC1 ", & + "TIPDZC2 ","TIPDZC3 ","TIPRDXB1 ","TIPRDXB2 ","TIPRDXB3 ","TIPRDYB1 ","TIPRDYB2 ","TIPRDYB3 ", & + "TIPRDZB1 ","TIPRDZB2 ","TIPRDZB3 ","TIPRDZC1 ","TIPRDZC2 ","TIPRDZC3 ","TTDSPAX ","TTDSPFA ", & + "TTDSPPTCH","TTDSPROLL","TTDSPSS ","TTDSPTWST","TWHT1ALXT","TWHT1ALYT","TWHT1ALZT","TWHT1FLXT", & + "TWHT1FLYT","TWHT1FLZT","TWHT1MLXT","TWHT1MLYT","TWHT1MLZT","TWHT1RDXT","TWHT1RDYT","TWHT1RDZT", & + "TWHT1RPXI","TWHT1RPYI","TWHT1RPZI","TWHT1TDXT","TWHT1TDYT","TWHT1TDZT","TWHT1TPXI","TWHT1TPYI", & + "TWHT1TPZI","TWHT2ALXT","TWHT2ALYT","TWHT2ALZT","TWHT2FLXT","TWHT2FLYT","TWHT2FLZT","TWHT2MLXT", & + "TWHT2MLYT","TWHT2MLZT","TWHT2RDXT","TWHT2RDYT","TWHT2RDZT","TWHT2RPXI","TWHT2RPYI","TWHT2RPZI", & + "TWHT2TDXT","TWHT2TDYT","TWHT2TDZT","TWHT2TPXI","TWHT2TPYI","TWHT2TPZI","TWHT3ALXT","TWHT3ALYT", & + "TWHT3ALZT","TWHT3FLXT","TWHT3FLYT","TWHT3FLZT","TWHT3MLXT","TWHT3MLYT","TWHT3MLZT","TWHT3RDXT", & + "TWHT3RDYT","TWHT3RDZT","TWHT3RPXI","TWHT3RPYI","TWHT3RPZI","TWHT3TDXT","TWHT3TDYT","TWHT3TDZT", & + "TWHT3TPXI","TWHT3TPYI","TWHT3TPZI","TWHT4ALXT","TWHT4ALYT","TWHT4ALZT","TWHT4FLXT","TWHT4FLYT", & + "TWHT4FLZT","TWHT4MLXT","TWHT4MLYT","TWHT4MLZT","TWHT4RDXT","TWHT4RDYT","TWHT4RDZT","TWHT4RPXI", & + "TWHT4RPYI","TWHT4RPZI","TWHT4TDXT","TWHT4TDYT","TWHT4TDZT","TWHT4TPXI","TWHT4TPYI","TWHT4TPZI", & + "TWHT5ALXT","TWHT5ALYT","TWHT5ALZT","TWHT5FLXT","TWHT5FLYT","TWHT5FLZT","TWHT5MLXT","TWHT5MLYT", & + "TWHT5MLZT","TWHT5RDXT","TWHT5RDYT","TWHT5RDZT","TWHT5RPXI","TWHT5RPYI","TWHT5RPZI","TWHT5TDXT", & + "TWHT5TDYT","TWHT5TDZT","TWHT5TPXI","TWHT5TPYI","TWHT5TPZI","TWHT6ALXT","TWHT6ALYT","TWHT6ALZT", & + "TWHT6FLXT","TWHT6FLYT","TWHT6FLZT","TWHT6MLXT","TWHT6MLYT","TWHT6MLZT","TWHT6RDXT","TWHT6RDYT", & + "TWHT6RDZT","TWHT6RPXI","TWHT6RPYI","TWHT6RPZI","TWHT6TDXT","TWHT6TDYT","TWHT6TDZT","TWHT6TPXI", & + "TWHT6TPYI","TWHT6TPZI","TWHT7ALXT","TWHT7ALYT","TWHT7ALZT","TWHT7FLXT","TWHT7FLYT","TWHT7FLZT", & + "TWHT7MLXT","TWHT7MLYT","TWHT7MLZT","TWHT7RDXT","TWHT7RDYT","TWHT7RDZT","TWHT7RPXI","TWHT7RPYI", & + "TWHT7RPZI","TWHT7TDXT","TWHT7TDYT","TWHT7TDZT","TWHT7TPXI","TWHT7TPYI","TWHT7TPZI","TWHT8ALXT", & + "TWHT8ALYT","TWHT8ALZT","TWHT8FLXT","TWHT8FLYT","TWHT8FLZT","TWHT8MLXT","TWHT8MLYT","TWHT8MLZT", & + "TWHT8RDXT","TWHT8RDYT","TWHT8RDZT","TWHT8RPXI","TWHT8RPYI","TWHT8RPZI","TWHT8TDXT","TWHT8TDYT", & + "TWHT8TDZT","TWHT8TPXI","TWHT8TPYI","TWHT8TPZI","TWHT9ALXT","TWHT9ALYT","TWHT9ALZT","TWHT9FLXT", & + "TWHT9FLYT","TWHT9FLZT","TWHT9MLXT","TWHT9MLYT","TWHT9MLZT","TWHT9RDXT","TWHT9RDYT","TWHT9RDZT", & + "TWHT9RPXI","TWHT9RPYI","TWHT9RPZI","TWHT9TDXT","TWHT9TDYT","TWHT9TDZT","TWHT9TPXI","TWHT9TPYI", & + "TWHT9TPZI","TWRBSFXT ","TWRBSFYT ","TWRBSFZT ","TWRBSMXT ","TWRBSMYT ","TWRBSMZT ","TWRCLRNC1", & + "TWRCLRNC2","TWRCLRNC3","TWRTPTDXI","TWRTPTDYI","TWRTPTDZI","TWSTDEFL1","TWSTDEFL2","TWSTDEFL3", & + "YAWACCEL ","YAWAZN ","YAWAZP ","YAWBRFXN ","YAWBRFXP ","YAWBRFYN ","YAWBRFYP ","YAWBRFZN ", & + "YAWBRFZP ","YAWBRMXN ","YAWBRMXP ","YAWBRMYN ","YAWBRMYP ","YAWBRMZN ","YAWBRMZP ","YAWBRRAXP", & + "YAWBRRAYP","YAWBRRAZP","YAWBRRDXT","YAWBRRDYT","YAWBRRDZT","YAWBRRVXP","YAWBRRVYP","YAWBRRVZP", & + "YAWBRTAXP","YAWBRTAYP","YAWBRTAZP","YAWBRTDXI","YAWBRTDXP","YAWBRTDXT","YAWBRTDYI","YAWBRTDYP", & + "YAWBRTDYT","YAWBRTDZI","YAWBRTDZP","YAWBRTDZT","YAWBRTVXP","YAWBRTVYP","YAWBRTVZP","YAWPOS ", & "YAWPZN ","YAWPZP ","YAWRATE ","YAWVZN ","YAWVZP "/) - INTEGER(IntKi), PARAMETER :: ParamIndxAry(978) = (/ & ! This lists the index into AllOuts(:) of the allowed parameters ValidParamAry(:) - LSSTipPxa , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , & - HSShftA , HSShftV , HSSBrTq , HSShftA , HSShftPwr , HSShftTq , HSShftV , & - TipDyc1 , TipDyc2 , TipDyc3 , LSSGagAxa , LSSGagAxa , LSSGagAxa , LSShftFxa , & - LSShftFxa , LSShftFya , LSShftFys , LSShftFza , LSShftFzs , LSShftMxa , LSShftMxa , & - LSSGagMya , LSSGagMys , LSSGagMza , LSSGagMzs , LSSGagPxa , LSSGagPxa , LSSGagPxa , & - LSSGagVxa , LSSGagVxa , LSSGagVxa , LSShftFxa , LSShftFxa , LSShftFya , LSShftFys , & - LSShftFza , LSShftFzs , LSShftMxa , LSShftMxa , RotPwr , LSShftMxa , LSSTipAxa , & - LSSTipAxa , LSSTipAxa , LSSTipMya , LSSTipMys , LSSTipMza , LSSTipMzs , LSSTipPxa , & - LSSTipPxa , LSSTipPxa , LSSTipVxa , LSSTipVxa , LSSTipVxa , YawPzn , YawAzn , & - YawPzn , YawVzn , NcIMURAxs , NcIMURAys , NcIMURAzs , NcIMURVxs , NcIMURVys , & - NcIMURVzs , NcIMUTAxs , NcIMUTAys , NcIMUTAzs , NcIMUTVxs , NcIMUTVys , NcIMUTVzs , & - TipDxc1 , TipDxc2 , TipDxc3 , TipRDyb1 , TipRDyb2 , TipRDyb3 , PtchPMzc1 , & - PtchPMzc2 , PtchPMzc3 , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , PtfmTDzi , PtfmRDyi , & - PtfmRAxi , PtfmRAxt , PtfmRAyi , PtfmRAyt , PtfmRAzi , PtfmRAzt , PtfmRDxi , & - PtfmRDyi , PtfmRDzi , PtfmRDxi , PtfmRVxi , PtfmRVxt , PtfmRVyi , PtfmRVyt , & - PtfmRVzi , PtfmRVzt , PtfmTDxi , PtfmTDyi , PtfmTAxi , PtfmTAxt , PtfmTAyi , & - PtfmTAyt , PtfmTAzi , PtfmTAzt , PtfmTDxi , PtfmTDxt , PtfmTDyi , PtfmTDyt , & - PtfmTDzi , PtfmTDzt , PtfmTVxi , PtfmTVxt , PtfmTVyi , PtfmTVyt , PtfmTVzi , & - PtfmTVzt , PtfmRDzi , QD2_B1E1 , QD2_B1F1 , QD2_B1F2 , QD2_B2E1 , QD2_B2F1 , & - QD2_B2F2 , QD2_B3E1 , QD2_B3F1 , QD2_B3F2 , QD2_DrTr , QD2_GeAz , QD2_Hv , & - QD2_P , QD2_R , QD2_RFrl , QD2_Sg , QD2_Sw , QD2_Teet , QD2_TFA1 , & - QD2_TFA2 , QD2_TFrl , QD2_TSS1 , QD2_TSS2 , QD2_Y , QD2_Yaw , QD_B1E1 , & - QD_B1F1 , QD_B1F2 , QD_B2E1 , QD_B2F1 , QD_B2F2 , QD_B3E1 , QD_B3F1 , & - QD_B3F2 , QD_DrTr , QD_GeAz , QD_Hv , QD_P , QD_R , QD_RFrl , & - QD_Sg , QD_Sw , QD_Teet , QD_TFA1 , QD_TFA2 , QD_TFrl , QD_TSS1 , & - QD_TSS2 , QD_Y , QD_Yaw , Q_B1E1 , Q_B1F1 , Q_B1F2 , Q_B2E1 , & - Q_B2F1 , Q_B2F2 , Q_B3E1 , Q_B3F1 , Q_B3F2 , Q_DrTr , Q_GeAz , & - Q_Hv , Q_P , Q_R , Q_RFrl , Q_Sg , Q_Sw , Q_Teet , & - Q_TFA1 , Q_TFA2 , Q_TFrl , Q_TSS1 , Q_TSS2 , Q_Y , Q_Yaw , & - RFrlBrM , TipRDxb1 , TipRDxb2 , TipRDxb3 , RootFxb1 , RootFxb2 , RootFxb3 , & - RootFxc1 , RootFxc2 , RootFxc3 , RootFyb1 , RootFyb2 , RootFyb3 , RootFyc1 , & - RootFyc2 , RootFyc3 , RootFzc1 , RootFzc2 , RootFzc3 , RootFzc1 , RootFzc2 , & - RootFzc3 , RootMxb1 , RootMxb2 , RootMxb3 , RootMyb1 , RootMyb2 , RootMyb3 , & - RootMxc1 , RootMxc2 , RootMxc3 , RootMyc1 , RootMyc2 , RootMyc3 , RootMxb1 , & - RootMxb2 , RootMxb3 , RootMxc1 , RootMxc2 , RootMxc3 , RootMyb1 , RootMyb2 , & - RootMyb3 , RootMyc1 , RootMyc2 , RootMyc3 , RootMzc1 , RootMzc2 , RootMzc3 , & - RootMzc1 , RootMzc2 , RootMzc3 , LSSTipAxa , RotFurlP , RotFurlA , RotFurlP , & - RotFurlV , RotPwr , LSSTipVxa , TeetAya , TeetPya , TeetVya , LSShftFxa , & - LSShftMxa , Spn1ALxb1 , Spn1ALxb2 , Spn1ALxb3 , Spn1ALyb1 , Spn1ALyb2 , Spn1ALyb3 , & - Spn1ALzb1 , Spn1ALzb2 , Spn1ALzb3 , Spn1FLxb1 , Spn1FLxb2 , Spn1FLxb3 , Spn1FLyb1 , & - Spn1FLyb2 , Spn1FLyb3 , Spn1FLzb1 , Spn1FLzb2 , Spn1FLzb3 , Spn1MLxb1 , Spn1MLxb2 , & - Spn1MLxb3 , Spn1MLyb1 , Spn1MLyb2 , Spn1MLyb3 , Spn1MLzb1 , Spn1MLzb2 , Spn1MLzb3 , & - Spn1RDxb1 , Spn1RDxb2 , Spn1RDxb3 , Spn1RDyb1 , Spn1RDyb2 , Spn1RDyb3 , Spn1RDzb1 , & - Spn1RDzb2 , Spn1RDzb3 , Spn1TDxb1 , Spn1TDxb2 , Spn1TDxb3 , Spn1TDyb1 , Spn1TDyb2 , & - Spn1TDyb3 , Spn1TDzb1 , Spn1TDzb2 , Spn1TDzb3 , Spn2ALxb1 , Spn2ALxb2 , Spn2ALxb3 , & - Spn2ALyb1 , Spn2ALyb2 , Spn2ALyb3 , Spn2ALzb1 , Spn2ALzb2 , Spn2ALzb3 , Spn2FLxb1 , & - Spn2FLxb2 , Spn2FLxb3 , Spn2FLyb1 , Spn2FLyb2 , Spn2FLyb3 , Spn2FLzb1 , Spn2FLzb2 , & - Spn2FLzb3 , Spn2MLxb1 , Spn2MLxb2 , Spn2MLxb3 , Spn2MLyb1 , Spn2MLyb2 , Spn2MLyb3 , & - Spn2MLzb1 , Spn2MLzb2 , Spn2MLzb3 , Spn2RDxb1 , Spn2RDxb2 , Spn2RDxb3 , Spn2RDyb1 , & - Spn2RDyb2 , Spn2RDyb3 , Spn2RDzb1 , Spn2RDzb2 , Spn2RDzb3 , Spn2TDxb1 , Spn2TDxb2 , & - Spn2TDxb3 , Spn2TDyb1 , Spn2TDyb2 , Spn2TDyb3 , Spn2TDzb1 , Spn2TDzb2 , Spn2TDzb3 , & - Spn3ALxb1 , Spn3ALxb2 , Spn3ALxb3 , Spn3ALyb1 , Spn3ALyb2 , Spn3ALyb3 , Spn3ALzb1 , & - Spn3ALzb2 , Spn3ALzb3 , Spn3FLxb1 , Spn3FLxb2 , Spn3FLxb3 , Spn3FLyb1 , Spn3FLyb2 , & - Spn3FLyb3 , Spn3FLzb1 , Spn3FLzb2 , Spn3FLzb3 , Spn3MLxb1 , Spn3MLxb2 , Spn3MLxb3 , & - Spn3MLyb1 , Spn3MLyb2 , Spn3MLyb3 , Spn3MLzb1 , Spn3MLzb2 , Spn3MLzb3 , Spn3RDxb1 , & - Spn3RDxb2 , Spn3RDxb3 , Spn3RDyb1 , Spn3RDyb2 , Spn3RDyb3 , Spn3RDzb1 , Spn3RDzb2 , & - Spn3RDzb3 , Spn3TDxb1 , Spn3TDxb2 , Spn3TDxb3 , Spn3TDyb1 , Spn3TDyb2 , Spn3TDyb3 , & - Spn3TDzb1 , Spn3TDzb2 , Spn3TDzb3 , Spn4ALxb1 , Spn4ALxb2 , Spn4ALxb3 , Spn4ALyb1 , & - Spn4ALyb2 , Spn4ALyb3 , Spn4ALzb1 , Spn4ALzb2 , Spn4ALzb3 , Spn4FLxb1 , Spn4FLxb2 , & - Spn4FLxb3 , Spn4FLyb1 , Spn4FLyb2 , Spn4FLyb3 , Spn4FLzb1 , Spn4FLzb2 , Spn4FLzb3 , & - Spn4MLxb1 , Spn4MLxb2 , Spn4MLxb3 , Spn4MLyb1 , Spn4MLyb2 , Spn4MLyb3 , Spn4MLzb1 , & - Spn4MLzb2 , Spn4MLzb3 , Spn4RDxb1 , Spn4RDxb2 , Spn4RDxb3 , Spn4RDyb1 , Spn4RDyb2 , & - Spn4RDyb3 , Spn4RDzb1 , Spn4RDzb2 , Spn4RDzb3 , Spn4TDxb1 , Spn4TDxb2 , Spn4TDxb3 , & - Spn4TDyb1 , Spn4TDyb2 , Spn4TDyb3 , Spn4TDzb1 , Spn4TDzb2 , Spn4TDzb3 , Spn5ALxb1 , & - Spn5ALxb2 , Spn5ALxb3 , Spn5ALyb1 , Spn5ALyb2 , Spn5ALyb3 , Spn5ALzb1 , Spn5ALzb2 , & - Spn5ALzb3 , Spn5FLxb1 , Spn5FLxb2 , Spn5FLxb3 , Spn5FLyb1 , Spn5FLyb2 , Spn5FLyb3 , & - Spn5FLzb1 , Spn5FLzb2 , Spn5FLzb3 , Spn5MLxb1 , Spn5MLxb2 , Spn5MLxb3 , Spn5MLyb1 , & - Spn5MLyb2 , Spn5MLyb3 , Spn5MLzb1 , Spn5MLzb2 , Spn5MLzb3 , Spn5RDxb1 , Spn5RDxb2 , & - Spn5RDxb3 , Spn5RDyb1 , Spn5RDyb2 , Spn5RDyb3 , Spn5RDzb1 , Spn5RDzb2 , Spn5RDzb3 , & - Spn5TDxb1 , Spn5TDxb2 , Spn5TDxb3 , Spn5TDyb1 , Spn5TDyb2 , Spn5TDyb3 , Spn5TDzb1 , & - Spn5TDzb2 , Spn5TDzb3 , Spn6ALxb1 , Spn6ALxb2 , Spn6ALxb3 , Spn6ALyb1 , Spn6ALyb2 , & - Spn6ALyb3 , Spn6ALzb1 , Spn6ALzb2 , Spn6ALzb3 , Spn6FLxb1 , Spn6FLxb2 , Spn6FLxb3 , & - Spn6FLyb1 , Spn6FLyb2 , Spn6FLyb3 , Spn6FLzb1 , Spn6FLzb2 , Spn6FLzb3 , Spn6MLxb1 , & - Spn6MLxb2 , Spn6MLxb3 , Spn6MLyb1 , Spn6MLyb2 , Spn6MLyb3 , Spn6MLzb1 , Spn6MLzb2 , & - Spn6MLzb3 , Spn6RDxb1 , Spn6RDxb2 , Spn6RDxb3 , Spn6RDyb1 , Spn6RDyb2 , Spn6RDyb3 , & - Spn6RDzb1 , Spn6RDzb2 , Spn6RDzb3 , Spn6TDxb1 , Spn6TDxb2 , Spn6TDxb3 , Spn6TDyb1 , & - Spn6TDyb2 , Spn6TDyb3 , Spn6TDzb1 , Spn6TDzb2 , Spn6TDzb3 , Spn7ALxb1 , Spn7ALxb2 , & - Spn7ALxb3 , Spn7ALyb1 , Spn7ALyb2 , Spn7ALyb3 , Spn7ALzb1 , Spn7ALzb2 , Spn7ALzb3 , & - Spn7FLxb1 , Spn7FLxb2 , Spn7FLxb3 , Spn7FLyb1 , Spn7FLyb2 , Spn7FLyb3 , Spn7FLzb1 , & - Spn7FLzb2 , Spn7FLzb3 , Spn7MLxb1 , Spn7MLxb2 , Spn7MLxb3 , Spn7MLyb1 , Spn7MLyb2 , & - Spn7MLyb3 , Spn7MLzb1 , Spn7MLzb2 , Spn7MLzb3 , Spn7RDxb1 , Spn7RDxb2 , Spn7RDxb3 , & - Spn7RDyb1 , Spn7RDyb2 , Spn7RDyb3 , Spn7RDzb1 , Spn7RDzb2 , Spn7RDzb3 , Spn7TDxb1 , & - Spn7TDxb2 , Spn7TDxb3 , Spn7TDyb1 , Spn7TDyb2 , Spn7TDyb3 , Spn7TDzb1 , Spn7TDzb2 , & - Spn7TDzb3 , Spn8ALxb1 , Spn8ALxb2 , Spn8ALxb3 , Spn8ALyb1 , Spn8ALyb2 , Spn8ALyb3 , & - Spn8ALzb1 , Spn8ALzb2 , Spn8ALzb3 , Spn8FLxb1 , Spn8FLxb2 , Spn8FLxb3 , Spn8FLyb1 , & - Spn8FLyb2 , Spn8FLyb3 , Spn8FLzb1 , Spn8FLzb2 , Spn8FLzb3 , Spn8MLxb1 , Spn8MLxb2 , & - Spn8MLxb3 , Spn8MLyb1 , Spn8MLyb2 , Spn8MLyb3 , Spn8MLzb1 , Spn8MLzb2 , Spn8MLzb3 , & - Spn8RDxb1 , Spn8RDxb2 , Spn8RDxb3 , Spn8RDyb1 , Spn8RDyb2 , Spn8RDyb3 , Spn8RDzb1 , & - Spn8RDzb2 , Spn8RDzb3 , Spn8TDxb1 , Spn8TDxb2 , Spn8TDxb3 , Spn8TDyb1 , Spn8TDyb2 , & - Spn8TDyb3 , Spn8TDzb1 , Spn8TDzb2 , Spn8TDzb3 , Spn9ALxb1 , Spn9ALxb2 , Spn9ALxb3 , & - Spn9ALyb1 , Spn9ALyb2 , Spn9ALyb3 , Spn9ALzb1 , Spn9ALzb2 , Spn9ALzb3 , Spn9FLxb1 , & - Spn9FLxb2 , Spn9FLxb3 , Spn9FLyb1 , Spn9FLyb2 , Spn9FLyb3 , Spn9FLzb1 , Spn9FLzb2 , & - Spn9FLzb3 , Spn9MLxb1 , Spn9MLxb2 , Spn9MLxb3 , Spn9MLyb1 , Spn9MLyb2 , Spn9MLyb3 , & - Spn9MLzb1 , Spn9MLzb2 , Spn9MLzb3 , Spn9RDxb1 , Spn9RDxb2 , Spn9RDxb3 , Spn9RDyb1 , & - Spn9RDyb2 , Spn9RDyb3 , Spn9RDzb1 , Spn9RDzb2 , Spn9RDzb3 , Spn9TDxb1 , Spn9TDxb2 , & - Spn9TDxb3 , Spn9TDyb1 , Spn9TDyb2 , Spn9TDyb3 , Spn9TDzb1 , Spn9TDzb2 , Spn9TDzb3 , & - TailFurlP , TailFurlA , TailFurlP , TailFurlV , TeetAya , TeetPya , TeetPya , & - TeetVya , TFrlBrM , TipClrnc1 , TipClrnc2 , TipClrnc3 , TipALxb1 , TipALxb2 , & - TipALxb3 , TipALyb1 , TipALyb2 , TipALyb3 , TipALzb1 , TipALzb2 , TipALzb3 , & - TipClrnc1 , TipClrnc2 , TipClrnc3 , TipDxb1 , TipDxb2 , TipDxb3 , TipDxc1 , & - TipDxc2 , TipDxc3 , TipDyb1 , TipDyb2 , TipDyb3 , TipDyc1 , TipDyc2 , & - TipDyc3 , TipDzc1 , TipDzc2 , TipDzc3 , TipDzc1 , TipDzc2 , TipDzc3 , & - TipRDxb1 , TipRDxb2 , TipRDxb3 , TipRDyb1 , TipRDyb2 , TipRDyb3 , TipRDzc1 , & - TipRDzc2 , TipRDzc3 , TipRDzc1 , TipRDzc2 , TipRDzc3 , YawBrTDzt , YawBrTDxt , & - YawBrRDyt , YawBrRDxt , YawBrTDyt , YawBrRDzt , TwHt1ALxt , TwHt1ALyt , TwHt1ALzt , & - TwHt1FLxt , TwHt1FLyt , TwHt1FLzt , TwHt1MLxt , TwHt1MLyt , TwHt1MLzt , TwHt1RDxt , & - TwHt1RDyt , TwHt1RDzt , TwHt1RPxi , TwHt1RPyi , TwHt1RPzi , TwHt1TDxt , TwHt1TDyt , & - TwHt1TDzt , TwHt1TPxi , TwHt1TPyi , TwHt1TPzi , TwHt2ALxt , TwHt2ALyt , TwHt2ALzt , & - TwHt2FLxt , TwHt2FLyt , TwHt2FLzt , TwHt2MLxt , TwHt2MLyt , TwHt2MLzt , TwHt2RDxt , & - TwHt2RDyt , TwHt2RDzt , TwHt2RPxi , TwHt2RPyi , TwHt2RPzi , TwHt2TDxt , TwHt2TDyt , & - TwHt2TDzt , TwHt2TPxi , TwHt2TPyi , TwHt2TPzi , TwHt3ALxt , TwHt3ALyt , TwHt3ALzt , & - TwHt3FLxt , TwHt3FLyt , TwHt3FLzt , TwHt3MLxt , TwHt3MLyt , TwHt3MLzt , TwHt3RDxt , & - TwHt3RDyt , TwHt3RDzt , TwHt3RPxi , TwHt3RPyi , TwHt3RPzi , TwHt3TDxt , TwHt3TDyt , & - TwHt3TDzt , TwHt3TPxi , TwHt3TPyi , TwHt3TPzi , TwHt4ALxt , TwHt4ALyt , TwHt4ALzt , & - TwHt4FLxt , TwHt4FLyt , TwHt4FLzt , TwHt4MLxt , TwHt4MLyt , TwHt4MLzt , TwHt4RDxt , & - TwHt4RDyt , TwHt4RDzt , TwHt4RPxi , TwHt4RPyi , TwHt4RPzi , TwHt4TDxt , TwHt4TDyt , & - TwHt4TDzt , TwHt4TPxi , TwHt4TPyi , TwHt4TPzi , TwHt5ALxt , TwHt5ALyt , TwHt5ALzt , & - TwHt5FLxt , TwHt5FLyt , TwHt5FLzt , TwHt5MLxt , TwHt5MLyt , TwHt5MLzt , TwHt5RDxt , & - TwHt5RDyt , TwHt5RDzt , TwHt5RPxi , TwHt5RPyi , TwHt5RPzi , TwHt5TDxt , TwHt5TDyt , & - TwHt5TDzt , TwHt5TPxi , TwHt5TPyi , TwHt5TPzi , TwHt6ALxt , TwHt6ALyt , TwHt6ALzt , & - TwHt6FLxt , TwHt6FLyt , TwHt6FLzt , TwHt6MLxt , TwHt6MLyt , TwHt6MLzt , TwHt6RDxt , & - TwHt6RDyt , TwHt6RDzt , TwHt6RPxi , TwHt6RPyi , TwHt6RPzi , TwHt6TDxt , TwHt6TDyt , & - TwHt6TDzt , TwHt6TPxi , TwHt6TPyi , TwHt6TPzi , TwHt7ALxt , TwHt7ALyt , TwHt7ALzt , & - TwHt7FLxt , TwHt7FLyt , TwHt7FLzt , TwHt7MLxt , TwHt7MLyt , TwHt7MLzt , TwHt7RDxt , & - TwHt7RDyt , TwHt7RDzt , TwHt7RPxi , TwHt7RPyi , TwHt7RPzi , TwHt7TDxt , TwHt7TDyt , & - TwHt7TDzt , TwHt7TPxi , TwHt7TPyi , TwHt7TPzi , TwHt8ALxt , TwHt8ALyt , TwHt8ALzt , & - TwHt8FLxt , TwHt8FLyt , TwHt8FLzt , TwHt8MLxt , TwHt8MLyt , TwHt8MLzt , TwHt8RDxt , & - TwHt8RDyt , TwHt8RDzt , TwHt8RPxi , TwHt8RPyi , TwHt8RPzi , TwHt8TDxt , TwHt8TDyt , & - TwHt8TDzt , TwHt8TPxi , TwHt8TPyi , TwHt8TPzi , TwHt9ALxt , TwHt9ALyt , TwHt9ALzt , & - TwHt9FLxt , TwHt9FLyt , TwHt9FLzt , TwHt9MLxt , TwHt9MLyt , TwHt9MLzt , TwHt9RDxt , & - TwHt9RDyt , TwHt9RDzt , TwHt9RPxi , TwHt9RPyi , TwHt9RPzi , TwHt9TDxt , TwHt9TDyt , & - TwHt9TDzt , TwHt9TPxi , TwHt9TPyi , TwHt9TPzi , TwrBsFxt , TwrBsFyt , TwrBsFzt , & - TwrBsMxt , TwrBsMyt , TwrBsMzt , TipClrnc1 , TipClrnc2 , TipClrnc3 , TwrTpTDxi , & - TwrTpTDyi , TwrTpTDzi , TipRDzc1 , TipRDzc2 , TipRDzc3 , YawAzn , YawAzn , & - YawAzn , YawBrFxn , YawBrFxp , YawBrFyn , YawBrFyp , YawBrFzn , YawBrFzn , & - YawBrMxn , YawBrMxp , YawBrMyn , YawBrMyp , YawBrMzn , YawBrMzn , YawBrRAxp , & - YawBrRAyp , YawBrRAzp , YawBrRDxt , YawBrRDyt , YawBrRDzt , YawBrRVxp , YawBrRVyp , & - YawBrRVzp , YawBrTAxp , YawBrTAyp , YawBrTAzp , TwrTpTDxi , YawBrTDxp , YawBrTDxt , & - TwrTpTDyi , YawBrTDyp , YawBrTDyt , TwrTpTDzi , YawBrTDzp , YawBrTDzt , YawPzn , & + INTEGER(IntKi), PARAMETER :: ParamIndxAry(981) = (/ & ! This lists the index into AllOuts(:) of the allowed parameters ValidParamAry(:) + LSSTipPxa , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , HSShftA , & + HSShftV , HSSBrTq , HSShftA , HSShftPwr , HSShftTq , HSShftV , TipDyc1 , TipDyc2 , & + TipDyc3 , LSSGagAxa , LSSGagAxa , LSSGagAxa , LSShftFxa , LSShftFxa , LSShftFya , LSShftFys , & + LSShftFza , LSShftFzs , LSShftMxa , LSShftMxa , LSSGagMya , LSSGagMys , LSSGagMza , LSSGagMzs , & + LSSGagPxa , LSSGagPxa , LSSGagPxa , LSSGagVxa , LSSGagVxa , LSSGagVxa , LSShftFxa , LSShftFxa , & + LSShftFya , LSShftFys , LSShftFza , LSShftFzs , LSShftMxa , LSShftMxa , RotPwr , LSShftMxa , & + LSSTipAxa , LSSTipAxa , LSSTipAxa , LSSTipMya , LSSTipMys , LSSTipMza , LSSTipMzs , LSSTipPxa , & + LSSTipPxa , LSSTipPxa , LSSTipVxa , LSSTipVxa , LSSTipVxa , YawPzn , YawAzn , YawPzn , & + YawVzn , NcIMURAxs , NcIMURAys , NcIMURAzs , NcIMURVxs , NcIMURVys , NcIMURVzs , NcIMUTAxs , & + NcIMUTAys , NcIMUTAzs , NcIMUTVxs , NcIMUTVys , NcIMUTVzs , TipDxc1 , TipDxc2 , TipDxc3 , & + TipRDyb1 , TipRDyb2 , TipRDyb3 , PtchPMzc1 , PtchPMzc2 , PtchPMzc3 , PtchPMzc1 , PtchPMzc2 , & + PtchPMzc3 , PtfmTDzi , PtfmRDyi , PtfmRAxi , PtfmRAxt , PtfmRAyi , PtfmRAyt , PtfmRAzi , & + PtfmRAzt , PtfmRDxi , PtfmRDyi , PtfmRDzi , PtfmRDxi , PtfmRVxi , PtfmRVxt , PtfmRVyi , & + PtfmRVyt , PtfmRVzi , PtfmRVzt , PtfmTDxi , PtfmTDyi , PtfmTAxi , PtfmTAxt , PtfmTAyi , & + PtfmTAyt , PtfmTAzi , PtfmTAzt , PtfmTDxi , PtfmTDxt , PtfmTDyi , PtfmTDyt , PtfmTDzi , & + PtfmTDzt , PtfmTVxi , PtfmTVxt , PtfmTVyi , PtfmTVyt , PtfmTVzi , PtfmTVzt , PtfmRDzi , & + QD2_B1E1 , QD2_B1F1 , QD2_B1F2 , QD2_B2E1 , QD2_B2F1 , QD2_B2F2 , QD2_B3E1 , QD2_B3F1 , & + QD2_B3F2 , QD2_DrTr , QD2_GeAz , QD2_Hv , QD2_P , QD2_R , QD2_RFrl , QD2_Sg , & + QD2_Sw , QD2_Teet , QD2_TFA1 , QD2_TFA2 , QD2_TFrl , QD2_TSS1 , QD2_TSS2 , QD2_Y , & + QD2_Yaw , QD_B1E1 , QD_B1F1 , QD_B1F2 , QD_B2E1 , QD_B2F1 , QD_B2F2 , QD_B3E1 , & + QD_B3F1 , QD_B3F2 , QD_DrTr , QD_GeAz , QD_Hv , QD_P , QD_R , QD_RFrl , & + QD_Sg , QD_Sw , QD_Teet , QD_TFA1 , QD_TFA2 , QD_TFrl , QD_TSS1 , QD_TSS2 , & + QD_Y , QD_Yaw , Q_B1E1 , Q_B1F1 , Q_B1F2 , Q_B2E1 , Q_B2F1 , Q_B2F2 , & + Q_B3E1 , Q_B3F1 , Q_B3F2 , Q_DrTr , Q_GeAz , Q_Hv , Q_P , Q_R , & + Q_RFrl , Q_Sg , Q_Sw , Q_Teet , Q_TFA1 , Q_TFA2 , Q_TFrl , Q_TSS1 , & + Q_TSS2 , Q_Y , Q_Yaw , RFrlBrM , TipRDxb1 , TipRDxb2 , TipRDxb3 , RootFxb1 , & + RootFxb2 , RootFxb3 , RootFxc1 , RootFxc2 , RootFxc3 , RootFyb1 , RootFyb2 , RootFyb3 , & + RootFyc1 , RootFyc2 , RootFyc3 , RootFzc1 , RootFzc2 , RootFzc3 , RootFzc1 , RootFzc2 , & + RootFzc3 , RootMxb1 , RootMxb2 , RootMxb3 , RootMyb1 , RootMyb2 , RootMyb3 , RootMxc1 , & + RootMxc2 , RootMxc3 , RootMyc1 , RootMyc2 , RootMyc3 , RootMxb1 , RootMxb2 , RootMxb3 , & + RootMxc1 , RootMxc2 , RootMxc3 , RootMyb1 , RootMyb2 , RootMyb3 , RootMyc1 , RootMyc2 , & + RootMyc3 , RootMzc1 , RootMzc2 , RootMzc3 , RootMzc1 , RootMzc2 , RootMzc3 , LSSTipAxa , & + RotFurlP , RotFurlA , RotFurlP , RotFurlV , RotPwr , LSSTipVxa , TeetAya , TeetPya , & + TeetVya , LSShftFxa , LSShftMxa , Spn1ALxb1 , Spn1ALxb2 , Spn1ALxb3 , Spn1ALyb1 , Spn1ALyb2 , & + Spn1ALyb3 , Spn1ALzb1 , Spn1ALzb2 , Spn1ALzb3 , Spn1FLxb1 , Spn1FLxb2 , Spn1FLxb3 , Spn1FLyb1 , & + Spn1FLyb2 , Spn1FLyb3 , Spn1FLzb1 , Spn1FLzb2 , Spn1FLzb3 , Spn1MLxb1 , Spn1MLxb2 , Spn1MLxb3 , & + Spn1MLyb1 , Spn1MLyb2 , Spn1MLyb3 , Spn1MLzb1 , Spn1MLzb2 , Spn1MLzb3 , Spn1RDxb1 , Spn1RDxb2 , & + Spn1RDxb3 , Spn1RDyb1 , Spn1RDyb2 , Spn1RDyb3 , Spn1RDzb1 , Spn1RDzb2 , Spn1RDzb3 , Spn1TDxb1 , & + Spn1TDxb2 , Spn1TDxb3 , Spn1TDyb1 , Spn1TDyb2 , Spn1TDyb3 , Spn1TDzb1 , Spn1TDzb2 , Spn1TDzb3 , & + Spn2ALxb1 , Spn2ALxb2 , Spn2ALxb3 , Spn2ALyb1 , Spn2ALyb2 , Spn2ALyb3 , Spn2ALzb1 , Spn2ALzb2 , & + Spn2ALzb3 , Spn2FLxb1 , Spn2FLxb2 , Spn2FLxb3 , Spn2FLyb1 , Spn2FLyb2 , Spn2FLyb3 , Spn2FLzb1 , & + Spn2FLzb2 , Spn2FLzb3 , Spn2MLxb1 , Spn2MLxb2 , Spn2MLxb3 , Spn2MLyb1 , Spn2MLyb2 , Spn2MLyb3 , & + Spn2MLzb1 , Spn2MLzb2 , Spn2MLzb3 , Spn2RDxb1 , Spn2RDxb2 , Spn2RDxb3 , Spn2RDyb1 , Spn2RDyb2 , & + Spn2RDyb3 , Spn2RDzb1 , Spn2RDzb2 , Spn2RDzb3 , Spn2TDxb1 , Spn2TDxb2 , Spn2TDxb3 , Spn2TDyb1 , & + Spn2TDyb2 , Spn2TDyb3 , Spn2TDzb1 , Spn2TDzb2 , Spn2TDzb3 , Spn3ALxb1 , Spn3ALxb2 , Spn3ALxb3 , & + Spn3ALyb1 , Spn3ALyb2 , Spn3ALyb3 , Spn3ALzb1 , Spn3ALzb2 , Spn3ALzb3 , Spn3FLxb1 , Spn3FLxb2 , & + Spn3FLxb3 , Spn3FLyb1 , Spn3FLyb2 , Spn3FLyb3 , Spn3FLzb1 , Spn3FLzb2 , Spn3FLzb3 , Spn3MLxb1 , & + Spn3MLxb2 , Spn3MLxb3 , Spn3MLyb1 , Spn3MLyb2 , Spn3MLyb3 , Spn3MLzb1 , Spn3MLzb2 , Spn3MLzb3 , & + Spn3RDxb1 , Spn3RDxb2 , Spn3RDxb3 , Spn3RDyb1 , Spn3RDyb2 , Spn3RDyb3 , Spn3RDzb1 , Spn3RDzb2 , & + Spn3RDzb3 , Spn3TDxb1 , Spn3TDxb2 , Spn3TDxb3 , Spn3TDyb1 , Spn3TDyb2 , Spn3TDyb3 , Spn3TDzb1 , & + Spn3TDzb2 , Spn3TDzb3 , Spn4ALxb1 , Spn4ALxb2 , Spn4ALxb3 , Spn4ALyb1 , Spn4ALyb2 , Spn4ALyb3 , & + Spn4ALzb1 , Spn4ALzb2 , Spn4ALzb3 , Spn4FLxb1 , Spn4FLxb2 , Spn4FLxb3 , Spn4FLyb1 , Spn4FLyb2 , & + Spn4FLyb3 , Spn4FLzb1 , Spn4FLzb2 , Spn4FLzb3 , Spn4MLxb1 , Spn4MLxb2 , Spn4MLxb3 , Spn4MLyb1 , & + Spn4MLyb2 , Spn4MLyb3 , Spn4MLzb1 , Spn4MLzb2 , Spn4MLzb3 , Spn4RDxb1 , Spn4RDxb2 , Spn4RDxb3 , & + Spn4RDyb1 , Spn4RDyb2 , Spn4RDyb3 , Spn4RDzb1 , Spn4RDzb2 , Spn4RDzb3 , Spn4TDxb1 , Spn4TDxb2 , & + Spn4TDxb3 , Spn4TDyb1 , Spn4TDyb2 , Spn4TDyb3 , Spn4TDzb1 , Spn4TDzb2 , Spn4TDzb3 , Spn5ALxb1 , & + Spn5ALxb2 , Spn5ALxb3 , Spn5ALyb1 , Spn5ALyb2 , Spn5ALyb3 , Spn5ALzb1 , Spn5ALzb2 , Spn5ALzb3 , & + Spn5FLxb1 , Spn5FLxb2 , Spn5FLxb3 , Spn5FLyb1 , Spn5FLyb2 , Spn5FLyb3 , Spn5FLzb1 , Spn5FLzb2 , & + Spn5FLzb3 , Spn5MLxb1 , Spn5MLxb2 , Spn5MLxb3 , Spn5MLyb1 , Spn5MLyb2 , Spn5MLyb3 , Spn5MLzb1 , & + Spn5MLzb2 , Spn5MLzb3 , Spn5RDxb1 , Spn5RDxb2 , Spn5RDxb3 , Spn5RDyb1 , Spn5RDyb2 , Spn5RDyb3 , & + Spn5RDzb1 , Spn5RDzb2 , Spn5RDzb3 , Spn5TDxb1 , Spn5TDxb2 , Spn5TDxb3 , Spn5TDyb1 , Spn5TDyb2 , & + Spn5TDyb3 , Spn5TDzb1 , Spn5TDzb2 , Spn5TDzb3 , Spn6ALxb1 , Spn6ALxb2 , Spn6ALxb3 , Spn6ALyb1 , & + Spn6ALyb2 , Spn6ALyb3 , Spn6ALzb1 , Spn6ALzb2 , Spn6ALzb3 , Spn6FLxb1 , Spn6FLxb2 , Spn6FLxb3 , & + Spn6FLyb1 , Spn6FLyb2 , Spn6FLyb3 , Spn6FLzb1 , Spn6FLzb2 , Spn6FLzb3 , Spn6MLxb1 , Spn6MLxb2 , & + Spn6MLxb3 , Spn6MLyb1 , Spn6MLyb2 , Spn6MLyb3 , Spn6MLzb1 , Spn6MLzb2 , Spn6MLzb3 , Spn6RDxb1 , & + Spn6RDxb2 , Spn6RDxb3 , Spn6RDyb1 , Spn6RDyb2 , Spn6RDyb3 , Spn6RDzb1 , Spn6RDzb2 , Spn6RDzb3 , & + Spn6TDxb1 , Spn6TDxb2 , Spn6TDxb3 , Spn6TDyb1 , Spn6TDyb2 , Spn6TDyb3 , Spn6TDzb1 , Spn6TDzb2 , & + Spn6TDzb3 , Spn7ALxb1 , Spn7ALxb2 , Spn7ALxb3 , Spn7ALyb1 , Spn7ALyb2 , Spn7ALyb3 , Spn7ALzb1 , & + Spn7ALzb2 , Spn7ALzb3 , Spn7FLxb1 , Spn7FLxb2 , Spn7FLxb3 , Spn7FLyb1 , Spn7FLyb2 , Spn7FLyb3 , & + Spn7FLzb1 , Spn7FLzb2 , Spn7FLzb3 , Spn7MLxb1 , Spn7MLxb2 , Spn7MLxb3 , Spn7MLyb1 , Spn7MLyb2 , & + Spn7MLyb3 , Spn7MLzb1 , Spn7MLzb2 , Spn7MLzb3 , Spn7RDxb1 , Spn7RDxb2 , Spn7RDxb3 , Spn7RDyb1 , & + Spn7RDyb2 , Spn7RDyb3 , Spn7RDzb1 , Spn7RDzb2 , Spn7RDzb3 , Spn7TDxb1 , Spn7TDxb2 , Spn7TDxb3 , & + Spn7TDyb1 , Spn7TDyb2 , Spn7TDyb3 , Spn7TDzb1 , Spn7TDzb2 , Spn7TDzb3 , Spn8ALxb1 , Spn8ALxb2 , & + Spn8ALxb3 , Spn8ALyb1 , Spn8ALyb2 , Spn8ALyb3 , Spn8ALzb1 , Spn8ALzb2 , Spn8ALzb3 , Spn8FLxb1 , & + Spn8FLxb2 , Spn8FLxb3 , Spn8FLyb1 , Spn8FLyb2 , Spn8FLyb3 , Spn8FLzb1 , Spn8FLzb2 , Spn8FLzb3 , & + Spn8MLxb1 , Spn8MLxb2 , Spn8MLxb3 , Spn8MLyb1 , Spn8MLyb2 , Spn8MLyb3 , Spn8MLzb1 , Spn8MLzb2 , & + Spn8MLzb3 , Spn8RDxb1 , Spn8RDxb2 , Spn8RDxb3 , Spn8RDyb1 , Spn8RDyb2 , Spn8RDyb3 , Spn8RDzb1 , & + Spn8RDzb2 , Spn8RDzb3 , Spn8TDxb1 , Spn8TDxb2 , Spn8TDxb3 , Spn8TDyb1 , Spn8TDyb2 , Spn8TDyb3 , & + Spn8TDzb1 , Spn8TDzb2 , Spn8TDzb3 , Spn9ALxb1 , Spn9ALxb2 , Spn9ALxb3 , Spn9ALyb1 , Spn9ALyb2 , & + Spn9ALyb3 , Spn9ALzb1 , Spn9ALzb2 , Spn9ALzb3 , Spn9FLxb1 , Spn9FLxb2 , Spn9FLxb3 , Spn9FLyb1 , & + Spn9FLyb2 , Spn9FLyb3 , Spn9FLzb1 , Spn9FLzb2 , Spn9FLzb3 , Spn9MLxb1 , Spn9MLxb2 , Spn9MLxb3 , & + Spn9MLyb1 , Spn9MLyb2 , Spn9MLyb3 , Spn9MLzb1 , Spn9MLzb2 , Spn9MLzb3 , Spn9RDxb1 , Spn9RDxb2 , & + Spn9RDxb3 , Spn9RDyb1 , Spn9RDyb2 , Spn9RDyb3 , Spn9RDzb1 , Spn9RDzb2 , Spn9RDzb3 , Spn9TDxb1 , & + Spn9TDxb2 , Spn9TDxb3 , Spn9TDyb1 , Spn9TDyb2 , Spn9TDyb3 , Spn9TDzb1 , Spn9TDzb2 , Spn9TDzb3 , & + TailFurlP , TailFurlA , TailFurlP , TailFurlV , TeetAya , TeetPya , TeetPya , TeetVya , & + TFrlBrM , TipClrnc1 , TipClrnc2 , TipClrnc3 , TipALxb1 , TipALxb2 , TipALxb3 , TipALyb1 , & + TipALyb2 , TipALyb3 , TipALzb1 , TipALzb2 , TipALzb3 , TipClrnc1 , TipClrnc2 , TipClrnc3 , & + TipDxb1 , TipDxb2 , TipDxb3 , TipDxc1 , TipDxc2 , TipDxc3 , TipDyb1 , TipDyb2 , & + TipDyb3 , TipDyc1 , TipDyc2 , TipDyc3 , TipDzc1 , TipDzc2 , TipDzc3 , TipDzc1 , & + TipDzc2 , TipDzc3 , TipRDxb1 , TipRDxb2 , TipRDxb3 , TipRDyb1 , TipRDyb2 , TipRDyb3 , & + TipRDzc1 , TipRDzc2 , TipRDzc3 , TipRDzc1 , TipRDzc2 , TipRDzc3 , YawBrTDzt , YawBrTDxt , & + YawBrRDyt , YawBrRDxt , YawBrTDyt , YawBrRDzt , TwHt1ALxt , TwHt1ALyt , TwHt1ALzt , TwHt1FLxt , & + TwHt1FLyt , TwHt1FLzt , TwHt1MLxt , TwHt1MLyt , TwHt1MLzt , TwHt1RDxt , TwHt1RDyt , TwHt1RDzt , & + TwHt1RPxi , TwHt1RPyi , TwHt1RPzi , TwHt1TDxt , TwHt1TDyt , TwHt1TDzt , TwHt1TPxi , TwHt1TPyi , & + TwHt1TPzi , TwHt2ALxt , TwHt2ALyt , TwHt2ALzt , TwHt2FLxt , TwHt2FLyt , TwHt2FLzt , TwHt2MLxt , & + TwHt2MLyt , TwHt2MLzt , TwHt2RDxt , TwHt2RDyt , TwHt2RDzt , TwHt2RPxi , TwHt2RPyi , TwHt2RPzi , & + TwHt2TDxt , TwHt2TDyt , TwHt2TDzt , TwHt2TPxi , TwHt2TPyi , TwHt2TPzi , TwHt3ALxt , TwHt3ALyt , & + TwHt3ALzt , TwHt3FLxt , TwHt3FLyt , TwHt3FLzt , TwHt3MLxt , TwHt3MLyt , TwHt3MLzt , TwHt3RDxt , & + TwHt3RDyt , TwHt3RDzt , TwHt3RPxi , TwHt3RPyi , TwHt3RPzi , TwHt3TDxt , TwHt3TDyt , TwHt3TDzt , & + TwHt3TPxi , TwHt3TPyi , TwHt3TPzi , TwHt4ALxt , TwHt4ALyt , TwHt4ALzt , TwHt4FLxt , TwHt4FLyt , & + TwHt4FLzt , TwHt4MLxt , TwHt4MLyt , TwHt4MLzt , TwHt4RDxt , TwHt4RDyt , TwHt4RDzt , TwHt4RPxi , & + TwHt4RPyi , TwHt4RPzi , TwHt4TDxt , TwHt4TDyt , TwHt4TDzt , TwHt4TPxi , TwHt4TPyi , TwHt4TPzi , & + TwHt5ALxt , TwHt5ALyt , TwHt5ALzt , TwHt5FLxt , TwHt5FLyt , TwHt5FLzt , TwHt5MLxt , TwHt5MLyt , & + TwHt5MLzt , TwHt5RDxt , TwHt5RDyt , TwHt5RDzt , TwHt5RPxi , TwHt5RPyi , TwHt5RPzi , TwHt5TDxt , & + TwHt5TDyt , TwHt5TDzt , TwHt5TPxi , TwHt5TPyi , TwHt5TPzi , TwHt6ALxt , TwHt6ALyt , TwHt6ALzt , & + TwHt6FLxt , TwHt6FLyt , TwHt6FLzt , TwHt6MLxt , TwHt6MLyt , TwHt6MLzt , TwHt6RDxt , TwHt6RDyt , & + TwHt6RDzt , TwHt6RPxi , TwHt6RPyi , TwHt6RPzi , TwHt6TDxt , TwHt6TDyt , TwHt6TDzt , TwHt6TPxi , & + TwHt6TPyi , TwHt6TPzi , TwHt7ALxt , TwHt7ALyt , TwHt7ALzt , TwHt7FLxt , TwHt7FLyt , TwHt7FLzt , & + TwHt7MLxt , TwHt7MLyt , TwHt7MLzt , TwHt7RDxt , TwHt7RDyt , TwHt7RDzt , TwHt7RPxi , TwHt7RPyi , & + TwHt7RPzi , TwHt7TDxt , TwHt7TDyt , TwHt7TDzt , TwHt7TPxi , TwHt7TPyi , TwHt7TPzi , TwHt8ALxt , & + TwHt8ALyt , TwHt8ALzt , TwHt8FLxt , TwHt8FLyt , TwHt8FLzt , TwHt8MLxt , TwHt8MLyt , TwHt8MLzt , & + TwHt8RDxt , TwHt8RDyt , TwHt8RDzt , TwHt8RPxi , TwHt8RPyi , TwHt8RPzi , TwHt8TDxt , TwHt8TDyt , & + TwHt8TDzt , TwHt8TPxi , TwHt8TPyi , TwHt8TPzi , TwHt9ALxt , TwHt9ALyt , TwHt9ALzt , TwHt9FLxt , & + TwHt9FLyt , TwHt9FLzt , TwHt9MLxt , TwHt9MLyt , TwHt9MLzt , TwHt9RDxt , TwHt9RDyt , TwHt9RDzt , & + TwHt9RPxi , TwHt9RPyi , TwHt9RPzi , TwHt9TDxt , TwHt9TDyt , TwHt9TDzt , TwHt9TPxi , TwHt9TPyi , & + TwHt9TPzi , TwrBsFxt , TwrBsFyt , TwrBsFzt , TwrBsMxt , TwrBsMyt , TwrBsMzt , TipClrnc1 , & + TipClrnc2 , TipClrnc3 , TwrTpTDxi , TwrTpTDyi , TwrTpTDzi , TipRDzc1 , TipRDzc2 , TipRDzc3 , & + YawAzn , YawAzn , YawAzn , YawBrFxn , YawBrFxp , YawBrFyn , YawBrFyp , YawBrFzn , & + YawBrFzn , YawBrMxn , YawBrMxp , YawBrMyn , YawBrMyp , YawBrMzn , YawBrMzn , YawBrRAxp , & + YawBrRAyp , YawBrRAzp , YawBrRDxt , YawBrRDyt , YawBrRDzt , YawBrRVxp , YawBrRVyp , YawBrRVzp , & + YawBrTAxp , YawBrTAyp , YawBrTAzp , TwrTpTDxi , YawBrTDxp , YawBrTDxt , TwrTpTDyi , YawBrTDyp , & + YawBrTDyt , TwrTpTDzi , YawBrTDzp , YawBrTDzt , YawBrTVxp , YawBrTVyp , YawBrTVzp , YawPzn , & YawPzn , YawPzn , YawVzn , YawVzn , YawVzn /) - CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(978) = (/ & ! This lists the units corresponding to the allowed parameters - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg/s^2) ","(rpm) ","(kN-m) ","(deg/s^2) ","(kW) ","(kN-m) ","(rpm) ", & - "(m) ","(m) ","(m) ","(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ", & - "(rpm) ","(rpm) ","(rpm) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kW) ","(kN-m) ","(deg/s^2) ", & - "(deg/s^2) ","(deg/s^2) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(rpm) ","(rpm) ","(rpm) ","(deg) ","(deg/s^2) ", & - "(deg) ","(deg/s) ","(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(deg/s) ","(deg/s) ", & - "(deg/s) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s) ","(m/s) ","(m/s) ", & - "(m) ","(m) ","(m) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(deg) ", & - "(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(deg/s^2) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg/s) ","(deg/s) ","(deg/s) ","(deg/s) ", & - "(deg/s) ","(deg/s) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & - "(m/s) ","(deg) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(rad/s^2) ","(rad/s^2) ","(m/s^2) ", & - "(rad/s^2) ","(rad/s^2) ","(rad/s^2) ","(m/s^2) ","(m/s^2) ","(rad/s^2) ","(m/s^2) ", & - "(m/s^2) ","(rad/s^2) ","(m/s^2) ","(m/s^2) ","(rad/s^2) ","(rad/s^2) ","(m/s) ", & - "(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & - "(m/s) ","(rad/s) ","(rad/s) ","(m/s) ","(rad/s) ","(rad/s) ","(rad/s) ", & - "(m/s) ","(m/s) ","(rad/s) ","(m/s) ","(m/s) ","(rad/s) ","(m/s) ", & - "(m/s) ","(rad/s) ","(rad/s) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(rad) ","(rad) ", & - "(m) ","(rad) ","(rad) ","(rad) ","(m) ","(m) ","(rad) ", & - "(m) ","(m) ","(rad) ","(m) ","(m) ","(rad) ","(rad) ", & - "(kN-m) ","(deg) ","(deg) ","(deg) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(deg/s^2) ","(deg) ","(deg/s^2) ","(deg) ", & - "(deg/s) ","(kW) ","(rpm) ","(deg/s^2) ","(deg) ","(deg/s) ","(kN) ", & - "(kN-m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ", & - "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(deg) ","(deg/s^2) ","(deg) ","(deg/s) ","(deg/s^2) ","(deg) ","(deg) ", & - "(deg/s) ","(kN-m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ", & - "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(deg) ","(deg) ","(m) ","(deg) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & - "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & - "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(kN) ","(kN) ","(kN) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(m) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(deg) ","(deg) ","(deg) ","(deg/s^2) ","(deg/s^2) ", & - "(deg/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & - "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg/s^2) ", & - "(deg/s^2) ","(deg/s^2) ","(deg) ","(deg) ","(deg) ","(deg/s) ","(deg/s) ", & - "(deg/s) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m) ","(m) ","(m) ", & - "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(deg) ", & - "(deg) ","(deg) ","(deg/s) ","(deg/s) ","(deg/s) "/) + CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(981) = (/ & ! This lists the units corresponding to the allowed parameters + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg/s^2)", & + "(rpm) ","(kN-m) ","(deg/s^2)","(kW) ","(kN-m) ","(rpm) ","(m) ","(m) ", & + "(m) ","(deg/s^2)","(deg/s^2)","(deg/s^2)","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(deg) ","(deg) ","(deg) ","(rpm) ","(rpm) ","(rpm) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kW) ","(kN-m) ", & + "(deg/s^2)","(deg/s^2)","(deg/s^2)","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & + "(deg) ","(deg) ","(rpm) ","(rpm) ","(rpm) ","(deg) ","(deg/s^2)","(deg) ", & + "(deg/s) ","(deg/s^2)","(deg/s^2)","(deg/s^2)","(deg/s) ","(deg/s) ","(deg/s) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s) ","(m/s) ","(m/s) ","(m) ","(m) ","(m) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(m) ","(deg) ","(deg/s^2)","(deg/s^2)","(deg/s^2)","(deg/s^2)","(deg/s^2)", & + "(deg/s^2)","(deg) ","(deg) ","(deg) ","(deg) ","(deg/s) ","(deg/s) ","(deg/s) ", & + "(deg/s) ","(deg/s) ","(deg/s) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(deg) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(rad/s^2)","(rad/s^2)","(m/s^2) ","(rad/s^2)","(rad/s^2)","(rad/s^2)","(m/s^2) ", & + "(m/s^2) ","(rad/s^2)","(m/s^2) ","(m/s^2) ","(rad/s^2)","(m/s^2) ","(m/s^2) ","(rad/s^2)", & + "(rad/s^2)","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ","(m/s) ", & + "(m/s) ","(m/s) ","(rad/s) ","(rad/s) ","(m/s) ","(rad/s) ","(rad/s) ","(rad/s) ", & + "(m/s) ","(m/s) ","(rad/s) ","(m/s) ","(m/s) ","(rad/s) ","(m/s) ","(m/s) ", & + "(rad/s) ","(rad/s) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(rad) ","(rad) ","(m) ","(rad) ","(rad) ", & + "(rad) ","(m) ","(m) ","(rad) ","(m) ","(m) ","(rad) ","(m) ", & + "(m) ","(rad) ","(rad) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg/s^2)", & + "(deg) ","(deg/s^2)","(deg) ","(deg/s) ","(kW) ","(rpm) ","(deg/s^2)","(deg) ", & + "(deg/s) ","(kN) ","(kN-m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(deg) ","(deg/s^2)","(deg) ","(deg/s) ","(deg/s^2)","(deg) ","(deg) ","(deg/s) ", & + "(kN-m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & + "(deg) ","(deg) ","(m) ","(deg) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ", & + "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN-m) ", & + "(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ", & + "(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ", & + "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ", & + "(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ", & + "(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ", & + "(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m) ","(m/s^2) ", & + "(m/s^2) ","(m/s^2) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ", & + "(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(deg) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m/s^2) ","(m/s^2) ","(m/s^2) ","(kN) ", & + "(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg) ","(deg) ","(deg) ", & + "(deg) ","(deg) ","(deg) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(kN) ","(kN) ","(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m) ","(deg) ","(deg) ","(deg) ", & + "(deg/s^2)","(deg/s^2)","(deg/s^2)","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(kN-m) ","(deg/s^2)", & + "(deg/s^2)","(deg/s^2)","(deg) ","(deg) ","(deg) ","(deg/s) ","(deg/s) ","(deg/s) ", & + "(m/s^2) ","(m/s^2) ","(m/s^2) ","(m) ","(m) ","(m) ","(m) ","(m) ", & + "(m) ","(m) ","(m) ","(m) ","(m/s) ","(m/s) ","(m/s) ","(deg) ", & + "(deg) ","(deg) ","(deg/s) ","(deg/s) ","(deg/s) "/) ! Initialize values @@ -4486,21 +4454,34 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) END DO - IF ( p%NumBl < 3_IntKi ) THEN - InvalidOutput(PtchPMzc3) = .TRUE. - InvalidOutput( Q_B3E1) = .TRUE. - InvalidOutput( Q_B3F1) = .TRUE. - InvalidOutput( Q_B3F2) = .TRUE. - - InvalidOutput( QD_B3E1) = .TRUE. - InvalidOutput( QD_B3F1) = .TRUE. - InvalidOutput( QD_B3F2) = .TRUE. - - InvalidOutput( QD2_B3E1) = .TRUE. - InvalidOutput( QD2_B3F1) = .TRUE. - InvalidOutput( QD2_B3F2) = .TRUE. - ELSE IF ( p%NumBl > 2_IntKi ) THEN + ! Invalid outputs based on number of blades + IF ( p%NumBl < 3 ) THEN + InvalidOutput(PtchPMzc3) = .TRUE. + InvalidOutput( Q_B3E1) = .TRUE. + InvalidOutput( Q_B3F1) = .TRUE. + InvalidOutput( Q_B3F2) = .TRUE. + InvalidOutput( QD_B3E1) = .TRUE. + InvalidOutput( QD_B3F1) = .TRUE. + InvalidOutput( QD_B3F2) = .TRUE. + InvalidOutput( QD2_B3E1) = .TRUE. + InvalidOutput( QD2_B3F1) = .TRUE. + InvalidOutput( QD2_B3F2) = .TRUE. + ENDIF + IF ( p%NumBl < 2 ) THEN + InvalidOutput(PtchPMzc2) = .TRUE. + InvalidOutput( Q_B2E1) = .TRUE. + InvalidOutput( Q_B2F1) = .TRUE. + InvalidOutput( Q_B2F2) = .TRUE. + InvalidOutput( QD_B2E1) = .TRUE. + InvalidOutput( QD_B2F1) = .TRUE. + InvalidOutput( QD_B2F2) = .TRUE. + InvalidOutput( QD2_B2E1) = .TRUE. + InvalidOutput( QD2_B2F1) = .TRUE. + InvalidOutput( QD2_B2F2) = .TRUE. + ENDIF + ! 1-bladed or 3-bladed, no teeter + IF ( p%NumBl /= 2 ) THEN InvalidOutput( TeetPya) = .TRUE. InvalidOutput( TeetVya) = .TRUE. InvalidOutput( TeetAya) = .TRUE. @@ -6964,8 +6945,10 @@ SUBROUTINE CalculateAngularPosVelPAcc( p, x, CoordSys, RtHSdat ) RtHSdat%AngPosHM(:,K,J ) = x%QT (DOF_BF(K,1))*RtHSdat%PAngVelEM(K,J,DOF_BF(K,1),0,:) & + x%QT (DOF_BF(K,2))*RtHSdat%PAngVelEM(K,J,DOF_BF(K,2),0,:) & + x%QT (DOF_BE(K,1))*RtHSdat%PAngVelEM(K,J,DOF_BE(K,1),0,:) - - + RtHSdat%AngAccEKt(:,J ,K) = RtHSdat%AngAccEHt + x%QDT(DOF_BF(K,1))*RtHSdat%PAngVelEM(K,J,DOF_BF(K,1),1,:) & + + x%QDT(DOF_BF(K,2))*RtHSdat%PAngVelEM(K,J,DOF_BF(K,2),1,:) & + + x%QDT(DOF_BE(K,1))*RtHSdat%PAngVelEM(K,J,DOF_BE(K,1),1,:) + ! Define the 1st derivatives of the partial angular velocities of the current node (body M(RNodes(J))) in the inertia frame: ! NOTE: These are currently unused by the code, therefore, they need not @@ -8241,11 +8224,13 @@ SUBROUTINE FillAugMat( p, x, CoordSys, u, HSSBrTrq, RtHSdat, AugMat ) ! Initialize the portions of the mass matrix below the diagonal associated ! with the teeter and pure blade DOFs using the partial loads at the teeter pin; only do this if necessary: - IF ( ( p%NumBl == 2 ) .AND. ( p%DOF_Flag(DOF_Teet) ) ) THEN - DO L = 1,p%DOFs%NPSBE(K) ! Loop through all active (enabled) blade DOFs that contribute to the QD2T-related linear accelerations of the blade - AugMat(DOF_Teet,p%DOFs%PSBE(K,L)) = -DOT_PRODUCT( RtHSdat%PAngVelEH(DOF_Teet,0,:), & - RtHSdat%PMomLPRot(:,p%DOFs%PSBE(K,L)) ) ! [C(q,t)]B - ENDDO ! L - All active (enabled) blade DOFs that contribute to the QD2T-related linear accelerations of the blade + IF ( ( p%NumBl == 2 ) ) THEN + IF ( p%DOF_Flag(DOF_Teet) ) THEN ! NOTE: two "ifs" since DOF_Teet might be out of bound + DO L = 1,p%DOFs%NPSBE(K) ! Loop through all active (enabled) blade DOFs that contribute to the QD2T-related linear accelerations of the blade + AugMat(DOF_Teet,p%DOFs%PSBE(K,L)) = -DOT_PRODUCT( RtHSdat%PAngVelEH(DOF_Teet,0,:), & + RtHSdat%PMomLPRot(:,p%DOFs%PSBE(K,L)) ) ! [C(q,t)]B + ENDDO ! L - All active (enabled) blade DOFs that contribute to the QD2T-related linear accelerations of the blade + ENDIF ENDIF @@ -8528,11 +8513,13 @@ SUBROUTINE FillAugMat( p, x, CoordSys, u, HSSBrTrq, RtHSdat, AugMat ) + RtHSdat%TFrlMom ! + {-f(qd,q,t)}SpringTF + {-f(qd,q,t)}DampTF ENDIF - IF ( ( p%NumBl == 2 ) .AND. ( p%DOF_Flag(DOF_Teet) ) ) THEN - ! The teeter DOF does not affect any DOF index larger than DOF_Teet. Therefore, there is no need to perform the loop: DO I = Diag(DOF_Teet),NActvDOF + IF ( ( p%NumBl == 2 ) ) THEN + IF ( p%DOF_Flag(DOF_Teet) ) THEN ! NOTE: two "ifs" since DOF_Teet may be out of bound + ! The teeter DOF does not affect any DOF index larger than DOF_Teet. Therefore, there is no need to perform the loop: DO I = Diag(DOF_Teet),NActvDOF AugMat(DOF_Teet, DOF_Teet) = -DOT_PRODUCT( RtHSdat%PAngVelEH(DOF_Teet,0,:), RtHSdat%PMomLPRot(:,DOF_Teet) ) ! [C(q,t)]H + [C(q,t)]B AugMat(DOF_Teet, p%NAug) = DOT_PRODUCT( RtHSdat%PAngVelEH(DOF_Teet,0,:), RtHSdat%MomLPRott ) & ! {-f(qd,q,t)}H + {-f(qd,q,t)}GravH + {-f(qd,q,t)}B + {-f(qd,q,t)}GravB + {-f(qd,q,t)}AeroB + RtHSdat%TeetMom ! + {-f(qd,q,t)}SpringTeet + {-f(qd,q,t)}DampTeet + ENDIF ENDIF !.................................................................................................................................. ! So far, we have only filled in the portions of the mass matrix on and below the diagonal. Because the mass matrix is symmetric @@ -10102,15 +10089,15 @@ SUBROUTINE ED_PrintSum( p, OtherState, GenerateAdamsModel, ErrStat, ErrMsg ) ELSE RotorType = 'Upwind,' ENDIF - IF ( p%NumBl == 2 ) THEN - RotorType = TRIM(RotorType)//' two-bladed rotor' - IF ( p%DOF_Flag(DOF_Teet) ) THEN + RotorType = TRIM(RotorType)//' '//trim(Num2LStr(p%NumBl))//'-bladed rotor' + IF ( p%NumBl==2 ) THEN + IF ( p%DOF_Flag(DOF_Teet) ) THEN ! NOTE: two "ifs" required since DOF_Teet might be out of bound RotorType = TRIM(RotorType)//' with teetering hub.' ELSE RotorType = TRIM(RotorType)//' with rigid hub.' ENDIF ELSE - RotorType = TRIM(RotorType)//' three-bladed rotor with rigid hub.' + RotorType = TRIM(RotorType)//' with rigid hub.' ENDIF WRITE (UnSu,'(A)') ' '//TRIM(RotorType) diff --git a/modules/elastodyn/src/ElastoDyn_IO.f90 b/modules/elastodyn/src/ElastoDyn_IO.f90 index d097d0801b..1574a2e795 100644 --- a/modules/elastodyn/src/ElastoDyn_IO.f90 +++ b/modules/elastodyn/src/ElastoDyn_IO.f90 @@ -98,10 +98,10 @@ MODULE ElastoDyn_Parameters ! =================================================================================================== ! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" -! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these -! lines should be modified in the Matlab script and/or Excel worksheet as necessary. +! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these +! lines should be modified in the Matlab script and/or Excel worksheet as necessary. ! =================================================================================================== -! This code was generated by Write_ChckOutLst.m at 08-Jun-2020 13:26:29. +! This code was generated by Write_ChckOutLst.m at 25-Jan-2021 13:23:51. ! Parameters related to output length (number of characters allowed in the output data headers): @@ -110,11 +110,11 @@ MODULE ElastoDyn_Parameters ! Indices for computing output channels: - ! NOTES: + ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter - ! Time: + ! Time: INTEGER(IntKi), PARAMETER :: Time = 0 @@ -496,620 +496,622 @@ MODULE ElastoDyn_Parameters INTEGER(IntKi), PARAMETER :: YawBrTDxt = 321 INTEGER(IntKi), PARAMETER :: YawBrTDyt = 322 INTEGER(IntKi), PARAMETER :: YawBrTDzt = 323 - INTEGER(IntKi), PARAMETER :: YawBrTAxp = 324 - INTEGER(IntKi), PARAMETER :: YawBrTAyp = 325 - INTEGER(IntKi), PARAMETER :: YawBrTAzp = 326 - INTEGER(IntKi), PARAMETER :: YawBrRDxt = 327 - INTEGER(IntKi), PARAMETER :: YawBrRDyt = 328 - INTEGER(IntKi), PARAMETER :: YawBrRDzt = 329 - INTEGER(IntKi), PARAMETER :: YawBrRVxp = 330 - INTEGER(IntKi), PARAMETER :: YawBrRVyp = 331 - INTEGER(IntKi), PARAMETER :: YawBrRVzp = 332 - INTEGER(IntKi), PARAMETER :: YawBrRAxp = 333 - INTEGER(IntKi), PARAMETER :: YawBrRAyp = 334 - INTEGER(IntKi), PARAMETER :: YawBrRAzp = 335 + INTEGER(IntKi), PARAMETER :: YawBrTVxp = 324 + INTEGER(IntKi), PARAMETER :: YawBrTVyp = 325 + INTEGER(IntKi), PARAMETER :: YawBrTVzp = 326 + INTEGER(IntKi), PARAMETER :: YawBrTAxp = 327 + INTEGER(IntKi), PARAMETER :: YawBrTAyp = 328 + INTEGER(IntKi), PARAMETER :: YawBrTAzp = 329 + INTEGER(IntKi), PARAMETER :: YawBrRDxt = 330 + INTEGER(IntKi), PARAMETER :: YawBrRDyt = 331 + INTEGER(IntKi), PARAMETER :: YawBrRDzt = 332 + INTEGER(IntKi), PARAMETER :: YawBrRVxp = 333 + INTEGER(IntKi), PARAMETER :: YawBrRVyp = 334 + INTEGER(IntKi), PARAMETER :: YawBrRVzp = 335 + INTEGER(IntKi), PARAMETER :: YawBrRAxp = 336 + INTEGER(IntKi), PARAMETER :: YawBrRAyp = 337 + INTEGER(IntKi), PARAMETER :: YawBrRAzp = 338 ! Local Tower Motions: - INTEGER(IntKi), PARAMETER :: TwHt1ALxt = 336 - INTEGER(IntKi), PARAMETER :: TwHt1ALyt = 337 - INTEGER(IntKi), PARAMETER :: TwHt1ALzt = 338 - INTEGER(IntKi), PARAMETER :: TwHt2ALxt = 339 - INTEGER(IntKi), PARAMETER :: TwHt2ALyt = 340 - INTEGER(IntKi), PARAMETER :: TwHt2ALzt = 341 - INTEGER(IntKi), PARAMETER :: TwHt3ALxt = 342 - INTEGER(IntKi), PARAMETER :: TwHt3ALyt = 343 - INTEGER(IntKi), PARAMETER :: TwHt3ALzt = 344 - INTEGER(IntKi), PARAMETER :: TwHt4ALxt = 345 - INTEGER(IntKi), PARAMETER :: TwHt4ALyt = 346 - INTEGER(IntKi), PARAMETER :: TwHt4ALzt = 347 - INTEGER(IntKi), PARAMETER :: TwHt5ALxt = 348 - INTEGER(IntKi), PARAMETER :: TwHt5ALyt = 349 - INTEGER(IntKi), PARAMETER :: TwHt5ALzt = 350 - INTEGER(IntKi), PARAMETER :: TwHt6ALxt = 351 - INTEGER(IntKi), PARAMETER :: TwHt6ALyt = 352 - INTEGER(IntKi), PARAMETER :: TwHt6ALzt = 353 - INTEGER(IntKi), PARAMETER :: TwHt7ALxt = 354 - INTEGER(IntKi), PARAMETER :: TwHt7ALyt = 355 - INTEGER(IntKi), PARAMETER :: TwHt7ALzt = 356 - INTEGER(IntKi), PARAMETER :: TwHt8ALxt = 357 - INTEGER(IntKi), PARAMETER :: TwHt8ALyt = 358 - INTEGER(IntKi), PARAMETER :: TwHt8ALzt = 359 - INTEGER(IntKi), PARAMETER :: TwHt9ALxt = 360 - INTEGER(IntKi), PARAMETER :: TwHt9ALyt = 361 - INTEGER(IntKi), PARAMETER :: TwHt9ALzt = 362 - INTEGER(IntKi), PARAMETER :: TwHt1TDxt = 363 - INTEGER(IntKi), PARAMETER :: TwHt1TDyt = 364 - INTEGER(IntKi), PARAMETER :: TwHt1TDzt = 365 - INTEGER(IntKi), PARAMETER :: TwHt2TDxt = 366 - INTEGER(IntKi), PARAMETER :: TwHt2TDyt = 367 - INTEGER(IntKi), PARAMETER :: TwHt2TDzt = 368 - INTEGER(IntKi), PARAMETER :: TwHt3TDxt = 369 - INTEGER(IntKi), PARAMETER :: TwHt3TDyt = 370 - INTEGER(IntKi), PARAMETER :: TwHt3TDzt = 371 - INTEGER(IntKi), PARAMETER :: TwHt4TDxt = 372 - INTEGER(IntKi), PARAMETER :: TwHt4TDyt = 373 - INTEGER(IntKi), PARAMETER :: TwHt4TDzt = 374 - INTEGER(IntKi), PARAMETER :: TwHt5TDxt = 375 - INTEGER(IntKi), PARAMETER :: TwHt5TDyt = 376 - INTEGER(IntKi), PARAMETER :: TwHt5TDzt = 377 - INTEGER(IntKi), PARAMETER :: TwHt6TDxt = 378 - INTEGER(IntKi), PARAMETER :: TwHt6TDyt = 379 - INTEGER(IntKi), PARAMETER :: TwHt6TDzt = 380 - INTEGER(IntKi), PARAMETER :: TwHt7TDxt = 381 - INTEGER(IntKi), PARAMETER :: TwHt7TDyt = 382 - INTEGER(IntKi), PARAMETER :: TwHt7TDzt = 383 - INTEGER(IntKi), PARAMETER :: TwHt8TDxt = 384 - INTEGER(IntKi), PARAMETER :: TwHt8TDyt = 385 - INTEGER(IntKi), PARAMETER :: TwHt8TDzt = 386 - INTEGER(IntKi), PARAMETER :: TwHt9TDxt = 387 - INTEGER(IntKi), PARAMETER :: TwHt9TDyt = 388 - INTEGER(IntKi), PARAMETER :: TwHt9TDzt = 389 - INTEGER(IntKi), PARAMETER :: TwHt1RDxt = 390 - INTEGER(IntKi), PARAMETER :: TwHt1RDyt = 391 - INTEGER(IntKi), PARAMETER :: TwHt1RDzt = 392 - INTEGER(IntKi), PARAMETER :: TwHt2RDxt = 393 - INTEGER(IntKi), PARAMETER :: TwHt2RDyt = 394 - INTEGER(IntKi), PARAMETER :: TwHt2RDzt = 395 - INTEGER(IntKi), PARAMETER :: TwHt3RDxt = 396 - INTEGER(IntKi), PARAMETER :: TwHt3RDyt = 397 - INTEGER(IntKi), PARAMETER :: TwHt3RDzt = 398 - INTEGER(IntKi), PARAMETER :: TwHt4RDxt = 399 - INTEGER(IntKi), PARAMETER :: TwHt4RDyt = 400 - INTEGER(IntKi), PARAMETER :: TwHt4RDzt = 401 - INTEGER(IntKi), PARAMETER :: TwHt5RDxt = 402 - INTEGER(IntKi), PARAMETER :: TwHt5RDyt = 403 - INTEGER(IntKi), PARAMETER :: TwHt5RDzt = 404 - INTEGER(IntKi), PARAMETER :: TwHt6RDxt = 405 - INTEGER(IntKi), PARAMETER :: TwHt6RDyt = 406 - INTEGER(IntKi), PARAMETER :: TwHt6RDzt = 407 - INTEGER(IntKi), PARAMETER :: TwHt7RDxt = 408 - INTEGER(IntKi), PARAMETER :: TwHt7RDyt = 409 - INTEGER(IntKi), PARAMETER :: TwHt7RDzt = 410 - INTEGER(IntKi), PARAMETER :: TwHt8RDxt = 411 - INTEGER(IntKi), PARAMETER :: TwHt8RDyt = 412 - INTEGER(IntKi), PARAMETER :: TwHt8RDzt = 413 - INTEGER(IntKi), PARAMETER :: TwHt9RDxt = 414 - INTEGER(IntKi), PARAMETER :: TwHt9RDyt = 415 - INTEGER(IntKi), PARAMETER :: TwHt9RDzt = 416 - INTEGER(IntKi), PARAMETER :: TwHt1TPxi = 417 - INTEGER(IntKi), PARAMETER :: TwHt1TPyi = 418 - INTEGER(IntKi), PARAMETER :: TwHt1TPzi = 419 - INTEGER(IntKi), PARAMETER :: TwHt2TPxi = 420 - INTEGER(IntKi), PARAMETER :: TwHt2TPyi = 421 - INTEGER(IntKi), PARAMETER :: TwHt2TPzi = 422 - INTEGER(IntKi), PARAMETER :: TwHt3TPxi = 423 - INTEGER(IntKi), PARAMETER :: TwHt3TPyi = 424 - INTEGER(IntKi), PARAMETER :: TwHt3TPzi = 425 - INTEGER(IntKi), PARAMETER :: TwHt4TPxi = 426 - INTEGER(IntKi), PARAMETER :: TwHt4TPyi = 427 - INTEGER(IntKi), PARAMETER :: TwHt4TPzi = 428 - INTEGER(IntKi), PARAMETER :: TwHt5TPxi = 429 - INTEGER(IntKi), PARAMETER :: TwHt5TPyi = 430 - INTEGER(IntKi), PARAMETER :: TwHt5TPzi = 431 - INTEGER(IntKi), PARAMETER :: TwHt6TPxi = 432 - INTEGER(IntKi), PARAMETER :: TwHt6TPyi = 433 - INTEGER(IntKi), PARAMETER :: TwHt6TPzi = 434 - INTEGER(IntKi), PARAMETER :: TwHt7TPxi = 435 - INTEGER(IntKi), PARAMETER :: TwHt7TPyi = 436 - INTEGER(IntKi), PARAMETER :: TwHt7TPzi = 437 - INTEGER(IntKi), PARAMETER :: TwHt8TPxi = 438 - INTEGER(IntKi), PARAMETER :: TwHt8TPyi = 439 - INTEGER(IntKi), PARAMETER :: TwHt8TPzi = 440 - INTEGER(IntKi), PARAMETER :: TwHt9TPxi = 441 - INTEGER(IntKi), PARAMETER :: TwHt9TPyi = 442 - INTEGER(IntKi), PARAMETER :: TwHt9TPzi = 443 - INTEGER(IntKi), PARAMETER :: TwHt1RPxi = 444 - INTEGER(IntKi), PARAMETER :: TwHt1RPyi = 445 - INTEGER(IntKi), PARAMETER :: TwHt1RPzi = 446 - INTEGER(IntKi), PARAMETER :: TwHt2RPxi = 447 - INTEGER(IntKi), PARAMETER :: TwHt2RPyi = 448 - INTEGER(IntKi), PARAMETER :: TwHt2RPzi = 449 - INTEGER(IntKi), PARAMETER :: TwHt3RPxi = 450 - INTEGER(IntKi), PARAMETER :: TwHt3RPyi = 451 - INTEGER(IntKi), PARAMETER :: TwHt3RPzi = 452 - INTEGER(IntKi), PARAMETER :: TwHt4RPxi = 453 - INTEGER(IntKi), PARAMETER :: TwHt4RPyi = 454 - INTEGER(IntKi), PARAMETER :: TwHt4RPzi = 455 - INTEGER(IntKi), PARAMETER :: TwHt5RPxi = 456 - INTEGER(IntKi), PARAMETER :: TwHt5RPyi = 457 - INTEGER(IntKi), PARAMETER :: TwHt5RPzi = 458 - INTEGER(IntKi), PARAMETER :: TwHt6RPxi = 459 - INTEGER(IntKi), PARAMETER :: TwHt6RPyi = 460 - INTEGER(IntKi), PARAMETER :: TwHt6RPzi = 461 - INTEGER(IntKi), PARAMETER :: TwHt7RPxi = 462 - INTEGER(IntKi), PARAMETER :: TwHt7RPyi = 463 - INTEGER(IntKi), PARAMETER :: TwHt7RPzi = 464 - INTEGER(IntKi), PARAMETER :: TwHt8RPxi = 465 - INTEGER(IntKi), PARAMETER :: TwHt8RPyi = 466 - INTEGER(IntKi), PARAMETER :: TwHt8RPzi = 467 - INTEGER(IntKi), PARAMETER :: TwHt9RPxi = 468 - INTEGER(IntKi), PARAMETER :: TwHt9RPyi = 469 - INTEGER(IntKi), PARAMETER :: TwHt9RPzi = 470 + INTEGER(IntKi), PARAMETER :: TwHt1ALxt = 339 + INTEGER(IntKi), PARAMETER :: TwHt1ALyt = 340 + INTEGER(IntKi), PARAMETER :: TwHt1ALzt = 341 + INTEGER(IntKi), PARAMETER :: TwHt2ALxt = 342 + INTEGER(IntKi), PARAMETER :: TwHt2ALyt = 343 + INTEGER(IntKi), PARAMETER :: TwHt2ALzt = 344 + INTEGER(IntKi), PARAMETER :: TwHt3ALxt = 345 + INTEGER(IntKi), PARAMETER :: TwHt3ALyt = 346 + INTEGER(IntKi), PARAMETER :: TwHt3ALzt = 347 + INTEGER(IntKi), PARAMETER :: TwHt4ALxt = 348 + INTEGER(IntKi), PARAMETER :: TwHt4ALyt = 349 + INTEGER(IntKi), PARAMETER :: TwHt4ALzt = 350 + INTEGER(IntKi), PARAMETER :: TwHt5ALxt = 351 + INTEGER(IntKi), PARAMETER :: TwHt5ALyt = 352 + INTEGER(IntKi), PARAMETER :: TwHt5ALzt = 353 + INTEGER(IntKi), PARAMETER :: TwHt6ALxt = 354 + INTEGER(IntKi), PARAMETER :: TwHt6ALyt = 355 + INTEGER(IntKi), PARAMETER :: TwHt6ALzt = 356 + INTEGER(IntKi), PARAMETER :: TwHt7ALxt = 357 + INTEGER(IntKi), PARAMETER :: TwHt7ALyt = 358 + INTEGER(IntKi), PARAMETER :: TwHt7ALzt = 359 + INTEGER(IntKi), PARAMETER :: TwHt8ALxt = 360 + INTEGER(IntKi), PARAMETER :: TwHt8ALyt = 361 + INTEGER(IntKi), PARAMETER :: TwHt8ALzt = 362 + INTEGER(IntKi), PARAMETER :: TwHt9ALxt = 363 + INTEGER(IntKi), PARAMETER :: TwHt9ALyt = 364 + INTEGER(IntKi), PARAMETER :: TwHt9ALzt = 365 + INTEGER(IntKi), PARAMETER :: TwHt1TDxt = 366 + INTEGER(IntKi), PARAMETER :: TwHt1TDyt = 367 + INTEGER(IntKi), PARAMETER :: TwHt1TDzt = 368 + INTEGER(IntKi), PARAMETER :: TwHt2TDxt = 369 + INTEGER(IntKi), PARAMETER :: TwHt2TDyt = 370 + INTEGER(IntKi), PARAMETER :: TwHt2TDzt = 371 + INTEGER(IntKi), PARAMETER :: TwHt3TDxt = 372 + INTEGER(IntKi), PARAMETER :: TwHt3TDyt = 373 + INTEGER(IntKi), PARAMETER :: TwHt3TDzt = 374 + INTEGER(IntKi), PARAMETER :: TwHt4TDxt = 375 + INTEGER(IntKi), PARAMETER :: TwHt4TDyt = 376 + INTEGER(IntKi), PARAMETER :: TwHt4TDzt = 377 + INTEGER(IntKi), PARAMETER :: TwHt5TDxt = 378 + INTEGER(IntKi), PARAMETER :: TwHt5TDyt = 379 + INTEGER(IntKi), PARAMETER :: TwHt5TDzt = 380 + INTEGER(IntKi), PARAMETER :: TwHt6TDxt = 381 + INTEGER(IntKi), PARAMETER :: TwHt6TDyt = 382 + INTEGER(IntKi), PARAMETER :: TwHt6TDzt = 383 + INTEGER(IntKi), PARAMETER :: TwHt7TDxt = 384 + INTEGER(IntKi), PARAMETER :: TwHt7TDyt = 385 + INTEGER(IntKi), PARAMETER :: TwHt7TDzt = 386 + INTEGER(IntKi), PARAMETER :: TwHt8TDxt = 387 + INTEGER(IntKi), PARAMETER :: TwHt8TDyt = 388 + INTEGER(IntKi), PARAMETER :: TwHt8TDzt = 389 + INTEGER(IntKi), PARAMETER :: TwHt9TDxt = 390 + INTEGER(IntKi), PARAMETER :: TwHt9TDyt = 391 + INTEGER(IntKi), PARAMETER :: TwHt9TDzt = 392 + INTEGER(IntKi), PARAMETER :: TwHt1RDxt = 393 + INTEGER(IntKi), PARAMETER :: TwHt1RDyt = 394 + INTEGER(IntKi), PARAMETER :: TwHt1RDzt = 395 + INTEGER(IntKi), PARAMETER :: TwHt2RDxt = 396 + INTEGER(IntKi), PARAMETER :: TwHt2RDyt = 397 + INTEGER(IntKi), PARAMETER :: TwHt2RDzt = 398 + INTEGER(IntKi), PARAMETER :: TwHt3RDxt = 399 + INTEGER(IntKi), PARAMETER :: TwHt3RDyt = 400 + INTEGER(IntKi), PARAMETER :: TwHt3RDzt = 401 + INTEGER(IntKi), PARAMETER :: TwHt4RDxt = 402 + INTEGER(IntKi), PARAMETER :: TwHt4RDyt = 403 + INTEGER(IntKi), PARAMETER :: TwHt4RDzt = 404 + INTEGER(IntKi), PARAMETER :: TwHt5RDxt = 405 + INTEGER(IntKi), PARAMETER :: TwHt5RDyt = 406 + INTEGER(IntKi), PARAMETER :: TwHt5RDzt = 407 + INTEGER(IntKi), PARAMETER :: TwHt6RDxt = 408 + INTEGER(IntKi), PARAMETER :: TwHt6RDyt = 409 + INTEGER(IntKi), PARAMETER :: TwHt6RDzt = 410 + INTEGER(IntKi), PARAMETER :: TwHt7RDxt = 411 + INTEGER(IntKi), PARAMETER :: TwHt7RDyt = 412 + INTEGER(IntKi), PARAMETER :: TwHt7RDzt = 413 + INTEGER(IntKi), PARAMETER :: TwHt8RDxt = 414 + INTEGER(IntKi), PARAMETER :: TwHt8RDyt = 415 + INTEGER(IntKi), PARAMETER :: TwHt8RDzt = 416 + INTEGER(IntKi), PARAMETER :: TwHt9RDxt = 417 + INTEGER(IntKi), PARAMETER :: TwHt9RDyt = 418 + INTEGER(IntKi), PARAMETER :: TwHt9RDzt = 419 + INTEGER(IntKi), PARAMETER :: TwHt1TPxi = 420 + INTEGER(IntKi), PARAMETER :: TwHt1TPyi = 421 + INTEGER(IntKi), PARAMETER :: TwHt1TPzi = 422 + INTEGER(IntKi), PARAMETER :: TwHt2TPxi = 423 + INTEGER(IntKi), PARAMETER :: TwHt2TPyi = 424 + INTEGER(IntKi), PARAMETER :: TwHt2TPzi = 425 + INTEGER(IntKi), PARAMETER :: TwHt3TPxi = 426 + INTEGER(IntKi), PARAMETER :: TwHt3TPyi = 427 + INTEGER(IntKi), PARAMETER :: TwHt3TPzi = 428 + INTEGER(IntKi), PARAMETER :: TwHt4TPxi = 429 + INTEGER(IntKi), PARAMETER :: TwHt4TPyi = 430 + INTEGER(IntKi), PARAMETER :: TwHt4TPzi = 431 + INTEGER(IntKi), PARAMETER :: TwHt5TPxi = 432 + INTEGER(IntKi), PARAMETER :: TwHt5TPyi = 433 + INTEGER(IntKi), PARAMETER :: TwHt5TPzi = 434 + INTEGER(IntKi), PARAMETER :: TwHt6TPxi = 435 + INTEGER(IntKi), PARAMETER :: TwHt6TPyi = 436 + INTEGER(IntKi), PARAMETER :: TwHt6TPzi = 437 + INTEGER(IntKi), PARAMETER :: TwHt7TPxi = 438 + INTEGER(IntKi), PARAMETER :: TwHt7TPyi = 439 + INTEGER(IntKi), PARAMETER :: TwHt7TPzi = 440 + INTEGER(IntKi), PARAMETER :: TwHt8TPxi = 441 + INTEGER(IntKi), PARAMETER :: TwHt8TPyi = 442 + INTEGER(IntKi), PARAMETER :: TwHt8TPzi = 443 + INTEGER(IntKi), PARAMETER :: TwHt9TPxi = 444 + INTEGER(IntKi), PARAMETER :: TwHt9TPyi = 445 + INTEGER(IntKi), PARAMETER :: TwHt9TPzi = 446 + INTEGER(IntKi), PARAMETER :: TwHt1RPxi = 447 + INTEGER(IntKi), PARAMETER :: TwHt1RPyi = 448 + INTEGER(IntKi), PARAMETER :: TwHt1RPzi = 449 + INTEGER(IntKi), PARAMETER :: TwHt2RPxi = 450 + INTEGER(IntKi), PARAMETER :: TwHt2RPyi = 451 + INTEGER(IntKi), PARAMETER :: TwHt2RPzi = 452 + INTEGER(IntKi), PARAMETER :: TwHt3RPxi = 453 + INTEGER(IntKi), PARAMETER :: TwHt3RPyi = 454 + INTEGER(IntKi), PARAMETER :: TwHt3RPzi = 455 + INTEGER(IntKi), PARAMETER :: TwHt4RPxi = 456 + INTEGER(IntKi), PARAMETER :: TwHt4RPyi = 457 + INTEGER(IntKi), PARAMETER :: TwHt4RPzi = 458 + INTEGER(IntKi), PARAMETER :: TwHt5RPxi = 459 + INTEGER(IntKi), PARAMETER :: TwHt5RPyi = 460 + INTEGER(IntKi), PARAMETER :: TwHt5RPzi = 461 + INTEGER(IntKi), PARAMETER :: TwHt6RPxi = 462 + INTEGER(IntKi), PARAMETER :: TwHt6RPyi = 463 + INTEGER(IntKi), PARAMETER :: TwHt6RPzi = 464 + INTEGER(IntKi), PARAMETER :: TwHt7RPxi = 465 + INTEGER(IntKi), PARAMETER :: TwHt7RPyi = 466 + INTEGER(IntKi), PARAMETER :: TwHt7RPzi = 467 + INTEGER(IntKi), PARAMETER :: TwHt8RPxi = 468 + INTEGER(IntKi), PARAMETER :: TwHt8RPyi = 469 + INTEGER(IntKi), PARAMETER :: TwHt8RPzi = 470 + INTEGER(IntKi), PARAMETER :: TwHt9RPxi = 471 + INTEGER(IntKi), PARAMETER :: TwHt9RPyi = 472 + INTEGER(IntKi), PARAMETER :: TwHt9RPzi = 473 ! Platform Motions: - INTEGER(IntKi), PARAMETER :: PtfmTDxt = 471 - INTEGER(IntKi), PARAMETER :: PtfmTDyt = 472 - INTEGER(IntKi), PARAMETER :: PtfmTDzt = 473 - INTEGER(IntKi), PARAMETER :: PtfmTDxi = 474 - INTEGER(IntKi), PARAMETER :: PtfmTDyi = 475 - INTEGER(IntKi), PARAMETER :: PtfmTDzi = 476 - INTEGER(IntKi), PARAMETER :: PtfmTVxt = 477 - INTEGER(IntKi), PARAMETER :: PtfmTVyt = 478 - INTEGER(IntKi), PARAMETER :: PtfmTVzt = 479 - INTEGER(IntKi), PARAMETER :: PtfmTVxi = 480 - INTEGER(IntKi), PARAMETER :: PtfmTVyi = 481 - INTEGER(IntKi), PARAMETER :: PtfmTVzi = 482 - INTEGER(IntKi), PARAMETER :: PtfmTAxt = 483 - INTEGER(IntKi), PARAMETER :: PtfmTAyt = 484 - INTEGER(IntKi), PARAMETER :: PtfmTAzt = 485 - INTEGER(IntKi), PARAMETER :: PtfmTAxi = 486 - INTEGER(IntKi), PARAMETER :: PtfmTAyi = 487 - INTEGER(IntKi), PARAMETER :: PtfmTAzi = 488 - INTEGER(IntKi), PARAMETER :: PtfmRDxi = 489 - INTEGER(IntKi), PARAMETER :: PtfmRDyi = 490 - INTEGER(IntKi), PARAMETER :: PtfmRDzi = 491 - INTEGER(IntKi), PARAMETER :: PtfmRVxt = 492 - INTEGER(IntKi), PARAMETER :: PtfmRVyt = 493 - INTEGER(IntKi), PARAMETER :: PtfmRVzt = 494 - INTEGER(IntKi), PARAMETER :: PtfmRVxi = 495 - INTEGER(IntKi), PARAMETER :: PtfmRVyi = 496 - INTEGER(IntKi), PARAMETER :: PtfmRVzi = 497 - INTEGER(IntKi), PARAMETER :: PtfmRAxt = 498 - INTEGER(IntKi), PARAMETER :: PtfmRAyt = 499 - INTEGER(IntKi), PARAMETER :: PtfmRAzt = 500 - INTEGER(IntKi), PARAMETER :: PtfmRAxi = 501 - INTEGER(IntKi), PARAMETER :: PtfmRAyi = 502 - INTEGER(IntKi), PARAMETER :: PtfmRAzi = 503 + INTEGER(IntKi), PARAMETER :: PtfmTDxt = 474 + INTEGER(IntKi), PARAMETER :: PtfmTDyt = 475 + INTEGER(IntKi), PARAMETER :: PtfmTDzt = 476 + INTEGER(IntKi), PARAMETER :: PtfmTDxi = 477 + INTEGER(IntKi), PARAMETER :: PtfmTDyi = 478 + INTEGER(IntKi), PARAMETER :: PtfmTDzi = 479 + INTEGER(IntKi), PARAMETER :: PtfmTVxt = 480 + INTEGER(IntKi), PARAMETER :: PtfmTVyt = 481 + INTEGER(IntKi), PARAMETER :: PtfmTVzt = 482 + INTEGER(IntKi), PARAMETER :: PtfmTVxi = 483 + INTEGER(IntKi), PARAMETER :: PtfmTVyi = 484 + INTEGER(IntKi), PARAMETER :: PtfmTVzi = 485 + INTEGER(IntKi), PARAMETER :: PtfmTAxt = 486 + INTEGER(IntKi), PARAMETER :: PtfmTAyt = 487 + INTEGER(IntKi), PARAMETER :: PtfmTAzt = 488 + INTEGER(IntKi), PARAMETER :: PtfmTAxi = 489 + INTEGER(IntKi), PARAMETER :: PtfmTAyi = 490 + INTEGER(IntKi), PARAMETER :: PtfmTAzi = 491 + INTEGER(IntKi), PARAMETER :: PtfmRDxi = 492 + INTEGER(IntKi), PARAMETER :: PtfmRDyi = 493 + INTEGER(IntKi), PARAMETER :: PtfmRDzi = 494 + INTEGER(IntKi), PARAMETER :: PtfmRVxt = 495 + INTEGER(IntKi), PARAMETER :: PtfmRVyt = 496 + INTEGER(IntKi), PARAMETER :: PtfmRVzt = 497 + INTEGER(IntKi), PARAMETER :: PtfmRVxi = 498 + INTEGER(IntKi), PARAMETER :: PtfmRVyi = 499 + INTEGER(IntKi), PARAMETER :: PtfmRVzi = 500 + INTEGER(IntKi), PARAMETER :: PtfmRAxt = 501 + INTEGER(IntKi), PARAMETER :: PtfmRAyt = 502 + INTEGER(IntKi), PARAMETER :: PtfmRAzt = 503 + INTEGER(IntKi), PARAMETER :: PtfmRAxi = 504 + INTEGER(IntKi), PARAMETER :: PtfmRAyi = 505 + INTEGER(IntKi), PARAMETER :: PtfmRAzi = 506 ! Blade 1 Root Loads: - INTEGER(IntKi), PARAMETER :: RootFxc1 = 504 - INTEGER(IntKi), PARAMETER :: RootFyc1 = 505 - INTEGER(IntKi), PARAMETER :: RootFzc1 = 506 - INTEGER(IntKi), PARAMETER :: RootFxb1 = 507 - INTEGER(IntKi), PARAMETER :: RootFyb1 = 508 - INTEGER(IntKi), PARAMETER :: RootMxc1 = 509 - INTEGER(IntKi), PARAMETER :: RootMyc1 = 510 - INTEGER(IntKi), PARAMETER :: RootMzc1 = 511 - INTEGER(IntKi), PARAMETER :: RootMxb1 = 512 - INTEGER(IntKi), PARAMETER :: RootMyb1 = 513 + INTEGER(IntKi), PARAMETER :: RootFxc1 = 507 + INTEGER(IntKi), PARAMETER :: RootFyc1 = 508 + INTEGER(IntKi), PARAMETER :: RootFzc1 = 509 + INTEGER(IntKi), PARAMETER :: RootFxb1 = 510 + INTEGER(IntKi), PARAMETER :: RootFyb1 = 511 + INTEGER(IntKi), PARAMETER :: RootMxc1 = 512 + INTEGER(IntKi), PARAMETER :: RootMyc1 = 513 + INTEGER(IntKi), PARAMETER :: RootMzc1 = 514 + INTEGER(IntKi), PARAMETER :: RootMxb1 = 515 + INTEGER(IntKi), PARAMETER :: RootMyb1 = 516 ! Blade 2 Root Loads: - INTEGER(IntKi), PARAMETER :: RootFxc2 = 514 - INTEGER(IntKi), PARAMETER :: RootFyc2 = 515 - INTEGER(IntKi), PARAMETER :: RootFzc2 = 516 - INTEGER(IntKi), PARAMETER :: RootFxb2 = 517 - INTEGER(IntKi), PARAMETER :: RootFyb2 = 518 - INTEGER(IntKi), PARAMETER :: RootMxc2 = 519 - INTEGER(IntKi), PARAMETER :: RootMyc2 = 520 - INTEGER(IntKi), PARAMETER :: RootMzc2 = 521 - INTEGER(IntKi), PARAMETER :: RootMxb2 = 522 - INTEGER(IntKi), PARAMETER :: RootMyb2 = 523 + INTEGER(IntKi), PARAMETER :: RootFxc2 = 517 + INTEGER(IntKi), PARAMETER :: RootFyc2 = 518 + INTEGER(IntKi), PARAMETER :: RootFzc2 = 519 + INTEGER(IntKi), PARAMETER :: RootFxb2 = 520 + INTEGER(IntKi), PARAMETER :: RootFyb2 = 521 + INTEGER(IntKi), PARAMETER :: RootMxc2 = 522 + INTEGER(IntKi), PARAMETER :: RootMyc2 = 523 + INTEGER(IntKi), PARAMETER :: RootMzc2 = 524 + INTEGER(IntKi), PARAMETER :: RootMxb2 = 525 + INTEGER(IntKi), PARAMETER :: RootMyb2 = 526 ! Blade 3 Root Loads: - INTEGER(IntKi), PARAMETER :: RootFxc3 = 524 - INTEGER(IntKi), PARAMETER :: RootFyc3 = 525 - INTEGER(IntKi), PARAMETER :: RootFzc3 = 526 - INTEGER(IntKi), PARAMETER :: RootFxb3 = 527 - INTEGER(IntKi), PARAMETER :: RootFyb3 = 528 - INTEGER(IntKi), PARAMETER :: RootMxc3 = 529 - INTEGER(IntKi), PARAMETER :: RootMyc3 = 530 - INTEGER(IntKi), PARAMETER :: RootMzc3 = 531 - INTEGER(IntKi), PARAMETER :: RootMxb3 = 532 - INTEGER(IntKi), PARAMETER :: RootMyb3 = 533 + INTEGER(IntKi), PARAMETER :: RootFxc3 = 527 + INTEGER(IntKi), PARAMETER :: RootFyc3 = 528 + INTEGER(IntKi), PARAMETER :: RootFzc3 = 529 + INTEGER(IntKi), PARAMETER :: RootFxb3 = 530 + INTEGER(IntKi), PARAMETER :: RootFyb3 = 531 + INTEGER(IntKi), PARAMETER :: RootMxc3 = 532 + INTEGER(IntKi), PARAMETER :: RootMyc3 = 533 + INTEGER(IntKi), PARAMETER :: RootMzc3 = 534 + INTEGER(IntKi), PARAMETER :: RootMxb3 = 535 + INTEGER(IntKi), PARAMETER :: RootMyb3 = 536 ! Blade 1 Local Span Loads: - INTEGER(IntKi), PARAMETER :: Spn1MLxb1 = 534 - INTEGER(IntKi), PARAMETER :: Spn1MLyb1 = 535 - INTEGER(IntKi), PARAMETER :: Spn1MLzb1 = 536 - INTEGER(IntKi), PARAMETER :: Spn2MLxb1 = 537 - INTEGER(IntKi), PARAMETER :: Spn2MLyb1 = 538 - INTEGER(IntKi), PARAMETER :: Spn2MLzb1 = 539 - INTEGER(IntKi), PARAMETER :: Spn3MLxb1 = 540 - INTEGER(IntKi), PARAMETER :: Spn3MLyb1 = 541 - INTEGER(IntKi), PARAMETER :: Spn3MLzb1 = 542 - INTEGER(IntKi), PARAMETER :: Spn4MLxb1 = 543 - INTEGER(IntKi), PARAMETER :: Spn4MLyb1 = 544 - INTEGER(IntKi), PARAMETER :: Spn4MLzb1 = 545 - INTEGER(IntKi), PARAMETER :: Spn5MLxb1 = 546 - INTEGER(IntKi), PARAMETER :: Spn5MLyb1 = 547 - INTEGER(IntKi), PARAMETER :: Spn5MLzb1 = 548 - INTEGER(IntKi), PARAMETER :: Spn6MLxb1 = 549 - INTEGER(IntKi), PARAMETER :: Spn6MLyb1 = 550 - INTEGER(IntKi), PARAMETER :: Spn6MLzb1 = 551 - INTEGER(IntKi), PARAMETER :: Spn7MLxb1 = 552 - INTEGER(IntKi), PARAMETER :: Spn7MLyb1 = 553 - INTEGER(IntKi), PARAMETER :: Spn7MLzb1 = 554 - INTEGER(IntKi), PARAMETER :: Spn8MLxb1 = 555 - INTEGER(IntKi), PARAMETER :: Spn8MLyb1 = 556 - INTEGER(IntKi), PARAMETER :: Spn8MLzb1 = 557 - INTEGER(IntKi), PARAMETER :: Spn9MLxb1 = 558 - INTEGER(IntKi), PARAMETER :: Spn9MLyb1 = 559 - INTEGER(IntKi), PARAMETER :: Spn9MLzb1 = 560 - INTEGER(IntKi), PARAMETER :: Spn1FLxb1 = 561 - INTEGER(IntKi), PARAMETER :: Spn1FLyb1 = 562 - INTEGER(IntKi), PARAMETER :: Spn1FLzb1 = 563 - INTEGER(IntKi), PARAMETER :: Spn2FLxb1 = 564 - INTEGER(IntKi), PARAMETER :: Spn2FLyb1 = 565 - INTEGER(IntKi), PARAMETER :: Spn2FLzb1 = 566 - INTEGER(IntKi), PARAMETER :: Spn3FLxb1 = 567 - INTEGER(IntKi), PARAMETER :: Spn3FLyb1 = 568 - INTEGER(IntKi), PARAMETER :: Spn3FLzb1 = 569 - INTEGER(IntKi), PARAMETER :: Spn4FLxb1 = 570 - INTEGER(IntKi), PARAMETER :: Spn4FLyb1 = 571 - INTEGER(IntKi), PARAMETER :: Spn4FLzb1 = 572 - INTEGER(IntKi), PARAMETER :: Spn5FLxb1 = 573 - INTEGER(IntKi), PARAMETER :: Spn5FLyb1 = 574 - INTEGER(IntKi), PARAMETER :: Spn5FLzb1 = 575 - INTEGER(IntKi), PARAMETER :: Spn6FLxb1 = 576 - INTEGER(IntKi), PARAMETER :: Spn6FLyb1 = 577 - INTEGER(IntKi), PARAMETER :: Spn6FLzb1 = 578 - INTEGER(IntKi), PARAMETER :: Spn7FLxb1 = 579 - INTEGER(IntKi), PARAMETER :: Spn7FLyb1 = 580 - INTEGER(IntKi), PARAMETER :: Spn7FLzb1 = 581 - INTEGER(IntKi), PARAMETER :: Spn8FLxb1 = 582 - INTEGER(IntKi), PARAMETER :: Spn8FLyb1 = 583 - INTEGER(IntKi), PARAMETER :: Spn8FLzb1 = 584 - INTEGER(IntKi), PARAMETER :: Spn9FLxb1 = 585 - INTEGER(IntKi), PARAMETER :: Spn9FLyb1 = 586 - INTEGER(IntKi), PARAMETER :: Spn9FLzb1 = 587 + INTEGER(IntKi), PARAMETER :: Spn1MLxb1 = 537 + INTEGER(IntKi), PARAMETER :: Spn1MLyb1 = 538 + INTEGER(IntKi), PARAMETER :: Spn1MLzb1 = 539 + INTEGER(IntKi), PARAMETER :: Spn2MLxb1 = 540 + INTEGER(IntKi), PARAMETER :: Spn2MLyb1 = 541 + INTEGER(IntKi), PARAMETER :: Spn2MLzb1 = 542 + INTEGER(IntKi), PARAMETER :: Spn3MLxb1 = 543 + INTEGER(IntKi), PARAMETER :: Spn3MLyb1 = 544 + INTEGER(IntKi), PARAMETER :: Spn3MLzb1 = 545 + INTEGER(IntKi), PARAMETER :: Spn4MLxb1 = 546 + INTEGER(IntKi), PARAMETER :: Spn4MLyb1 = 547 + INTEGER(IntKi), PARAMETER :: Spn4MLzb1 = 548 + INTEGER(IntKi), PARAMETER :: Spn5MLxb1 = 549 + INTEGER(IntKi), PARAMETER :: Spn5MLyb1 = 550 + INTEGER(IntKi), PARAMETER :: Spn5MLzb1 = 551 + INTEGER(IntKi), PARAMETER :: Spn6MLxb1 = 552 + INTEGER(IntKi), PARAMETER :: Spn6MLyb1 = 553 + INTEGER(IntKi), PARAMETER :: Spn6MLzb1 = 554 + INTEGER(IntKi), PARAMETER :: Spn7MLxb1 = 555 + INTEGER(IntKi), PARAMETER :: Spn7MLyb1 = 556 + INTEGER(IntKi), PARAMETER :: Spn7MLzb1 = 557 + INTEGER(IntKi), PARAMETER :: Spn8MLxb1 = 558 + INTEGER(IntKi), PARAMETER :: Spn8MLyb1 = 559 + INTEGER(IntKi), PARAMETER :: Spn8MLzb1 = 560 + INTEGER(IntKi), PARAMETER :: Spn9MLxb1 = 561 + INTEGER(IntKi), PARAMETER :: Spn9MLyb1 = 562 + INTEGER(IntKi), PARAMETER :: Spn9MLzb1 = 563 + INTEGER(IntKi), PARAMETER :: Spn1FLxb1 = 564 + INTEGER(IntKi), PARAMETER :: Spn1FLyb1 = 565 + INTEGER(IntKi), PARAMETER :: Spn1FLzb1 = 566 + INTEGER(IntKi), PARAMETER :: Spn2FLxb1 = 567 + INTEGER(IntKi), PARAMETER :: Spn2FLyb1 = 568 + INTEGER(IntKi), PARAMETER :: Spn2FLzb1 = 569 + INTEGER(IntKi), PARAMETER :: Spn3FLxb1 = 570 + INTEGER(IntKi), PARAMETER :: Spn3FLyb1 = 571 + INTEGER(IntKi), PARAMETER :: Spn3FLzb1 = 572 + INTEGER(IntKi), PARAMETER :: Spn4FLxb1 = 573 + INTEGER(IntKi), PARAMETER :: Spn4FLyb1 = 574 + INTEGER(IntKi), PARAMETER :: Spn4FLzb1 = 575 + INTEGER(IntKi), PARAMETER :: Spn5FLxb1 = 576 + INTEGER(IntKi), PARAMETER :: Spn5FLyb1 = 577 + INTEGER(IntKi), PARAMETER :: Spn5FLzb1 = 578 + INTEGER(IntKi), PARAMETER :: Spn6FLxb1 = 579 + INTEGER(IntKi), PARAMETER :: Spn6FLyb1 = 580 + INTEGER(IntKi), PARAMETER :: Spn6FLzb1 = 581 + INTEGER(IntKi), PARAMETER :: Spn7FLxb1 = 582 + INTEGER(IntKi), PARAMETER :: Spn7FLyb1 = 583 + INTEGER(IntKi), PARAMETER :: Spn7FLzb1 = 584 + INTEGER(IntKi), PARAMETER :: Spn8FLxb1 = 585 + INTEGER(IntKi), PARAMETER :: Spn8FLyb1 = 586 + INTEGER(IntKi), PARAMETER :: Spn8FLzb1 = 587 + INTEGER(IntKi), PARAMETER :: Spn9FLxb1 = 588 + INTEGER(IntKi), PARAMETER :: Spn9FLyb1 = 589 + INTEGER(IntKi), PARAMETER :: Spn9FLzb1 = 590 ! Blade 2 Local Span Loads: - INTEGER(IntKi), PARAMETER :: Spn1MLxb2 = 588 - INTEGER(IntKi), PARAMETER :: Spn1MLyb2 = 589 - INTEGER(IntKi), PARAMETER :: Spn1MLzb2 = 590 - INTEGER(IntKi), PARAMETER :: Spn2MLxb2 = 591 - INTEGER(IntKi), PARAMETER :: Spn2MLyb2 = 592 - INTEGER(IntKi), PARAMETER :: Spn2MLzb2 = 593 - INTEGER(IntKi), PARAMETER :: Spn3MLxb2 = 594 - INTEGER(IntKi), PARAMETER :: Spn3MLyb2 = 595 - INTEGER(IntKi), PARAMETER :: Spn3MLzb2 = 596 - INTEGER(IntKi), PARAMETER :: Spn4MLxb2 = 597 - INTEGER(IntKi), PARAMETER :: Spn4MLyb2 = 598 - INTEGER(IntKi), PARAMETER :: Spn4MLzb2 = 599 - INTEGER(IntKi), PARAMETER :: Spn5MLxb2 = 600 - INTEGER(IntKi), PARAMETER :: Spn5MLyb2 = 601 - INTEGER(IntKi), PARAMETER :: Spn5MLzb2 = 602 - INTEGER(IntKi), PARAMETER :: Spn6MLxb2 = 603 - INTEGER(IntKi), PARAMETER :: Spn6MLyb2 = 604 - INTEGER(IntKi), PARAMETER :: Spn6MLzb2 = 605 - INTEGER(IntKi), PARAMETER :: Spn7MLxb2 = 606 - INTEGER(IntKi), PARAMETER :: Spn7MLyb2 = 607 - INTEGER(IntKi), PARAMETER :: Spn7MLzb2 = 608 - INTEGER(IntKi), PARAMETER :: Spn8MLxb2 = 609 - INTEGER(IntKi), PARAMETER :: Spn8MLyb2 = 610 - INTEGER(IntKi), PARAMETER :: Spn8MLzb2 = 611 - INTEGER(IntKi), PARAMETER :: Spn9MLxb2 = 612 - INTEGER(IntKi), PARAMETER :: Spn9MLyb2 = 613 - INTEGER(IntKi), PARAMETER :: Spn9MLzb2 = 614 - INTEGER(IntKi), PARAMETER :: Spn1FLxb2 = 615 - INTEGER(IntKi), PARAMETER :: Spn1FLyb2 = 616 - INTEGER(IntKi), PARAMETER :: Spn1FLzb2 = 617 - INTEGER(IntKi), PARAMETER :: Spn2FLxb2 = 618 - INTEGER(IntKi), PARAMETER :: Spn2FLyb2 = 619 - INTEGER(IntKi), PARAMETER :: Spn2FLzb2 = 620 - INTEGER(IntKi), PARAMETER :: Spn3FLxb2 = 621 - INTEGER(IntKi), PARAMETER :: Spn3FLyb2 = 622 - INTEGER(IntKi), PARAMETER :: Spn3FLzb2 = 623 - INTEGER(IntKi), PARAMETER :: Spn4FLxb2 = 624 - INTEGER(IntKi), PARAMETER :: Spn4FLyb2 = 625 - INTEGER(IntKi), PARAMETER :: Spn4FLzb2 = 626 - INTEGER(IntKi), PARAMETER :: Spn5FLxb2 = 627 - INTEGER(IntKi), PARAMETER :: Spn5FLyb2 = 628 - INTEGER(IntKi), PARAMETER :: Spn5FLzb2 = 629 - INTEGER(IntKi), PARAMETER :: Spn6FLxb2 = 630 - INTEGER(IntKi), PARAMETER :: Spn6FLyb2 = 631 - INTEGER(IntKi), PARAMETER :: Spn6FLzb2 = 632 - INTEGER(IntKi), PARAMETER :: Spn7FLxb2 = 633 - INTEGER(IntKi), PARAMETER :: Spn7FLyb2 = 634 - INTEGER(IntKi), PARAMETER :: Spn7FLzb2 = 635 - INTEGER(IntKi), PARAMETER :: Spn8FLxb2 = 636 - INTEGER(IntKi), PARAMETER :: Spn8FLyb2 = 637 - INTEGER(IntKi), PARAMETER :: Spn8FLzb2 = 638 - INTEGER(IntKi), PARAMETER :: Spn9FLxb2 = 639 - INTEGER(IntKi), PARAMETER :: Spn9FLyb2 = 640 - INTEGER(IntKi), PARAMETER :: Spn9FLzb2 = 641 + INTEGER(IntKi), PARAMETER :: Spn1MLxb2 = 591 + INTEGER(IntKi), PARAMETER :: Spn1MLyb2 = 592 + INTEGER(IntKi), PARAMETER :: Spn1MLzb2 = 593 + INTEGER(IntKi), PARAMETER :: Spn2MLxb2 = 594 + INTEGER(IntKi), PARAMETER :: Spn2MLyb2 = 595 + INTEGER(IntKi), PARAMETER :: Spn2MLzb2 = 596 + INTEGER(IntKi), PARAMETER :: Spn3MLxb2 = 597 + INTEGER(IntKi), PARAMETER :: Spn3MLyb2 = 598 + INTEGER(IntKi), PARAMETER :: Spn3MLzb2 = 599 + INTEGER(IntKi), PARAMETER :: Spn4MLxb2 = 600 + INTEGER(IntKi), PARAMETER :: Spn4MLyb2 = 601 + INTEGER(IntKi), PARAMETER :: Spn4MLzb2 = 602 + INTEGER(IntKi), PARAMETER :: Spn5MLxb2 = 603 + INTEGER(IntKi), PARAMETER :: Spn5MLyb2 = 604 + INTEGER(IntKi), PARAMETER :: Spn5MLzb2 = 605 + INTEGER(IntKi), PARAMETER :: Spn6MLxb2 = 606 + INTEGER(IntKi), PARAMETER :: Spn6MLyb2 = 607 + INTEGER(IntKi), PARAMETER :: Spn6MLzb2 = 608 + INTEGER(IntKi), PARAMETER :: Spn7MLxb2 = 609 + INTEGER(IntKi), PARAMETER :: Spn7MLyb2 = 610 + INTEGER(IntKi), PARAMETER :: Spn7MLzb2 = 611 + INTEGER(IntKi), PARAMETER :: Spn8MLxb2 = 612 + INTEGER(IntKi), PARAMETER :: Spn8MLyb2 = 613 + INTEGER(IntKi), PARAMETER :: Spn8MLzb2 = 614 + INTEGER(IntKi), PARAMETER :: Spn9MLxb2 = 615 + INTEGER(IntKi), PARAMETER :: Spn9MLyb2 = 616 + INTEGER(IntKi), PARAMETER :: Spn9MLzb2 = 617 + INTEGER(IntKi), PARAMETER :: Spn1FLxb2 = 618 + INTEGER(IntKi), PARAMETER :: Spn1FLyb2 = 619 + INTEGER(IntKi), PARAMETER :: Spn1FLzb2 = 620 + INTEGER(IntKi), PARAMETER :: Spn2FLxb2 = 621 + INTEGER(IntKi), PARAMETER :: Spn2FLyb2 = 622 + INTEGER(IntKi), PARAMETER :: Spn2FLzb2 = 623 + INTEGER(IntKi), PARAMETER :: Spn3FLxb2 = 624 + INTEGER(IntKi), PARAMETER :: Spn3FLyb2 = 625 + INTEGER(IntKi), PARAMETER :: Spn3FLzb2 = 626 + INTEGER(IntKi), PARAMETER :: Spn4FLxb2 = 627 + INTEGER(IntKi), PARAMETER :: Spn4FLyb2 = 628 + INTEGER(IntKi), PARAMETER :: Spn4FLzb2 = 629 + INTEGER(IntKi), PARAMETER :: Spn5FLxb2 = 630 + INTEGER(IntKi), PARAMETER :: Spn5FLyb2 = 631 + INTEGER(IntKi), PARAMETER :: Spn5FLzb2 = 632 + INTEGER(IntKi), PARAMETER :: Spn6FLxb2 = 633 + INTEGER(IntKi), PARAMETER :: Spn6FLyb2 = 634 + INTEGER(IntKi), PARAMETER :: Spn6FLzb2 = 635 + INTEGER(IntKi), PARAMETER :: Spn7FLxb2 = 636 + INTEGER(IntKi), PARAMETER :: Spn7FLyb2 = 637 + INTEGER(IntKi), PARAMETER :: Spn7FLzb2 = 638 + INTEGER(IntKi), PARAMETER :: Spn8FLxb2 = 639 + INTEGER(IntKi), PARAMETER :: Spn8FLyb2 = 640 + INTEGER(IntKi), PARAMETER :: Spn8FLzb2 = 641 + INTEGER(IntKi), PARAMETER :: Spn9FLxb2 = 642 + INTEGER(IntKi), PARAMETER :: Spn9FLyb2 = 643 + INTEGER(IntKi), PARAMETER :: Spn9FLzb2 = 644 ! Blade 3 Local Span Loads: - INTEGER(IntKi), PARAMETER :: Spn1MLxb3 = 642 - INTEGER(IntKi), PARAMETER :: Spn1MLyb3 = 643 - INTEGER(IntKi), PARAMETER :: Spn1MLzb3 = 644 - INTEGER(IntKi), PARAMETER :: Spn2MLxb3 = 645 - INTEGER(IntKi), PARAMETER :: Spn2MLyb3 = 646 - INTEGER(IntKi), PARAMETER :: Spn2MLzb3 = 647 - INTEGER(IntKi), PARAMETER :: Spn3MLxb3 = 648 - INTEGER(IntKi), PARAMETER :: Spn3MLyb3 = 649 - INTEGER(IntKi), PARAMETER :: Spn3MLzb3 = 650 - INTEGER(IntKi), PARAMETER :: Spn4MLxb3 = 651 - INTEGER(IntKi), PARAMETER :: Spn4MLyb3 = 652 - INTEGER(IntKi), PARAMETER :: Spn4MLzb3 = 653 - INTEGER(IntKi), PARAMETER :: Spn5MLxb3 = 654 - INTEGER(IntKi), PARAMETER :: Spn5MLyb3 = 655 - INTEGER(IntKi), PARAMETER :: Spn5MLzb3 = 656 - INTEGER(IntKi), PARAMETER :: Spn6MLxb3 = 657 - INTEGER(IntKi), PARAMETER :: Spn6MLyb3 = 658 - INTEGER(IntKi), PARAMETER :: Spn6MLzb3 = 659 - INTEGER(IntKi), PARAMETER :: Spn7MLxb3 = 660 - INTEGER(IntKi), PARAMETER :: Spn7MLyb3 = 661 - INTEGER(IntKi), PARAMETER :: Spn7MLzb3 = 662 - INTEGER(IntKi), PARAMETER :: Spn8MLxb3 = 663 - INTEGER(IntKi), PARAMETER :: Spn8MLyb3 = 664 - INTEGER(IntKi), PARAMETER :: Spn8MLzb3 = 665 - INTEGER(IntKi), PARAMETER :: Spn9MLxb3 = 666 - INTEGER(IntKi), PARAMETER :: Spn9MLyb3 = 667 - INTEGER(IntKi), PARAMETER :: Spn9MLzb3 = 668 - INTEGER(IntKi), PARAMETER :: Spn1FLxb3 = 669 - INTEGER(IntKi), PARAMETER :: Spn1FLyb3 = 670 - INTEGER(IntKi), PARAMETER :: Spn1FLzb3 = 671 - INTEGER(IntKi), PARAMETER :: Spn2FLxb3 = 672 - INTEGER(IntKi), PARAMETER :: Spn2FLyb3 = 673 - INTEGER(IntKi), PARAMETER :: Spn2FLzb3 = 674 - INTEGER(IntKi), PARAMETER :: Spn3FLxb3 = 675 - INTEGER(IntKi), PARAMETER :: Spn3FLyb3 = 676 - INTEGER(IntKi), PARAMETER :: Spn3FLzb3 = 677 - INTEGER(IntKi), PARAMETER :: Spn4FLxb3 = 678 - INTEGER(IntKi), PARAMETER :: Spn4FLyb3 = 679 - INTEGER(IntKi), PARAMETER :: Spn4FLzb3 = 680 - INTEGER(IntKi), PARAMETER :: Spn5FLxb3 = 681 - INTEGER(IntKi), PARAMETER :: Spn5FLyb3 = 682 - INTEGER(IntKi), PARAMETER :: Spn5FLzb3 = 683 - INTEGER(IntKi), PARAMETER :: Spn6FLxb3 = 684 - INTEGER(IntKi), PARAMETER :: Spn6FLyb3 = 685 - INTEGER(IntKi), PARAMETER :: Spn6FLzb3 = 686 - INTEGER(IntKi), PARAMETER :: Spn7FLxb3 = 687 - INTEGER(IntKi), PARAMETER :: Spn7FLyb3 = 688 - INTEGER(IntKi), PARAMETER :: Spn7FLzb3 = 689 - INTEGER(IntKi), PARAMETER :: Spn8FLxb3 = 690 - INTEGER(IntKi), PARAMETER :: Spn8FLyb3 = 691 - INTEGER(IntKi), PARAMETER :: Spn8FLzb3 = 692 - INTEGER(IntKi), PARAMETER :: Spn9FLxb3 = 693 - INTEGER(IntKi), PARAMETER :: Spn9FLyb3 = 694 - INTEGER(IntKi), PARAMETER :: Spn9FLzb3 = 695 + INTEGER(IntKi), PARAMETER :: Spn1MLxb3 = 645 + INTEGER(IntKi), PARAMETER :: Spn1MLyb3 = 646 + INTEGER(IntKi), PARAMETER :: Spn1MLzb3 = 647 + INTEGER(IntKi), PARAMETER :: Spn2MLxb3 = 648 + INTEGER(IntKi), PARAMETER :: Spn2MLyb3 = 649 + INTEGER(IntKi), PARAMETER :: Spn2MLzb3 = 650 + INTEGER(IntKi), PARAMETER :: Spn3MLxb3 = 651 + INTEGER(IntKi), PARAMETER :: Spn3MLyb3 = 652 + INTEGER(IntKi), PARAMETER :: Spn3MLzb3 = 653 + INTEGER(IntKi), PARAMETER :: Spn4MLxb3 = 654 + INTEGER(IntKi), PARAMETER :: Spn4MLyb3 = 655 + INTEGER(IntKi), PARAMETER :: Spn4MLzb3 = 656 + INTEGER(IntKi), PARAMETER :: Spn5MLxb3 = 657 + INTEGER(IntKi), PARAMETER :: Spn5MLyb3 = 658 + INTEGER(IntKi), PARAMETER :: Spn5MLzb3 = 659 + INTEGER(IntKi), PARAMETER :: Spn6MLxb3 = 660 + INTEGER(IntKi), PARAMETER :: Spn6MLyb3 = 661 + INTEGER(IntKi), PARAMETER :: Spn6MLzb3 = 662 + INTEGER(IntKi), PARAMETER :: Spn7MLxb3 = 663 + INTEGER(IntKi), PARAMETER :: Spn7MLyb3 = 664 + INTEGER(IntKi), PARAMETER :: Spn7MLzb3 = 665 + INTEGER(IntKi), PARAMETER :: Spn8MLxb3 = 666 + INTEGER(IntKi), PARAMETER :: Spn8MLyb3 = 667 + INTEGER(IntKi), PARAMETER :: Spn8MLzb3 = 668 + INTEGER(IntKi), PARAMETER :: Spn9MLxb3 = 669 + INTEGER(IntKi), PARAMETER :: Spn9MLyb3 = 670 + INTEGER(IntKi), PARAMETER :: Spn9MLzb3 = 671 + INTEGER(IntKi), PARAMETER :: Spn1FLxb3 = 672 + INTEGER(IntKi), PARAMETER :: Spn1FLyb3 = 673 + INTEGER(IntKi), PARAMETER :: Spn1FLzb3 = 674 + INTEGER(IntKi), PARAMETER :: Spn2FLxb3 = 675 + INTEGER(IntKi), PARAMETER :: Spn2FLyb3 = 676 + INTEGER(IntKi), PARAMETER :: Spn2FLzb3 = 677 + INTEGER(IntKi), PARAMETER :: Spn3FLxb3 = 678 + INTEGER(IntKi), PARAMETER :: Spn3FLyb3 = 679 + INTEGER(IntKi), PARAMETER :: Spn3FLzb3 = 680 + INTEGER(IntKi), PARAMETER :: Spn4FLxb3 = 681 + INTEGER(IntKi), PARAMETER :: Spn4FLyb3 = 682 + INTEGER(IntKi), PARAMETER :: Spn4FLzb3 = 683 + INTEGER(IntKi), PARAMETER :: Spn5FLxb3 = 684 + INTEGER(IntKi), PARAMETER :: Spn5FLyb3 = 685 + INTEGER(IntKi), PARAMETER :: Spn5FLzb3 = 686 + INTEGER(IntKi), PARAMETER :: Spn6FLxb3 = 687 + INTEGER(IntKi), PARAMETER :: Spn6FLyb3 = 688 + INTEGER(IntKi), PARAMETER :: Spn6FLzb3 = 689 + INTEGER(IntKi), PARAMETER :: Spn7FLxb3 = 690 + INTEGER(IntKi), PARAMETER :: Spn7FLyb3 = 691 + INTEGER(IntKi), PARAMETER :: Spn7FLzb3 = 692 + INTEGER(IntKi), PARAMETER :: Spn8FLxb3 = 693 + INTEGER(IntKi), PARAMETER :: Spn8FLyb3 = 694 + INTEGER(IntKi), PARAMETER :: Spn8FLzb3 = 695 + INTEGER(IntKi), PARAMETER :: Spn9FLxb3 = 696 + INTEGER(IntKi), PARAMETER :: Spn9FLyb3 = 697 + INTEGER(IntKi), PARAMETER :: Spn9FLzb3 = 698 ! Hub and Rotor Loads: - INTEGER(IntKi), PARAMETER :: LSShftFxa = 696 - INTEGER(IntKi), PARAMETER :: LSShftFya = 697 - INTEGER(IntKi), PARAMETER :: LSShftFza = 698 - INTEGER(IntKi), PARAMETER :: LSShftFys = 699 - INTEGER(IntKi), PARAMETER :: LSShftFzs = 700 - INTEGER(IntKi), PARAMETER :: LSShftMxa = 701 - INTEGER(IntKi), PARAMETER :: LSSTipMya = 702 - INTEGER(IntKi), PARAMETER :: LSSTipMza = 703 - INTEGER(IntKi), PARAMETER :: LSSTipMys = 704 - INTEGER(IntKi), PARAMETER :: LSSTipMzs = 705 - INTEGER(IntKi), PARAMETER :: RotPwr = 706 + INTEGER(IntKi), PARAMETER :: LSShftFxa = 699 + INTEGER(IntKi), PARAMETER :: LSShftFya = 700 + INTEGER(IntKi), PARAMETER :: LSShftFza = 701 + INTEGER(IntKi), PARAMETER :: LSShftFys = 702 + INTEGER(IntKi), PARAMETER :: LSShftFzs = 703 + INTEGER(IntKi), PARAMETER :: LSShftMxa = 704 + INTEGER(IntKi), PARAMETER :: LSSTipMya = 705 + INTEGER(IntKi), PARAMETER :: LSSTipMza = 706 + INTEGER(IntKi), PARAMETER :: LSSTipMys = 707 + INTEGER(IntKi), PARAMETER :: LSSTipMzs = 708 + INTEGER(IntKi), PARAMETER :: RotPwr = 709 ! Shaft Strain Gage Loads: - INTEGER(IntKi), PARAMETER :: LSSGagMya = 707 - INTEGER(IntKi), PARAMETER :: LSSGagMza = 708 - INTEGER(IntKi), PARAMETER :: LSSGagMys = 709 - INTEGER(IntKi), PARAMETER :: LSSGagMzs = 710 + INTEGER(IntKi), PARAMETER :: LSSGagMya = 710 + INTEGER(IntKi), PARAMETER :: LSSGagMza = 711 + INTEGER(IntKi), PARAMETER :: LSSGagMys = 712 + INTEGER(IntKi), PARAMETER :: LSSGagMzs = 713 ! High-Speed Shaft Loads: - INTEGER(IntKi), PARAMETER :: HSShftTq = 711 - INTEGER(IntKi), PARAMETER :: HSSBrTq = 712 - INTEGER(IntKi), PARAMETER :: HSShftPwr = 713 + INTEGER(IntKi), PARAMETER :: HSShftTq = 714 + INTEGER(IntKi), PARAMETER :: HSSBrTq = 715 + INTEGER(IntKi), PARAMETER :: HSShftPwr = 716 ! Rotor-Furl Bearing Loads: - INTEGER(IntKi), PARAMETER :: RFrlBrM = 714 + INTEGER(IntKi), PARAMETER :: RFrlBrM = 717 ! Tail-Furl Bearing Loads: - INTEGER(IntKi), PARAMETER :: TFrlBrM = 715 + INTEGER(IntKi), PARAMETER :: TFrlBrM = 718 ! Tower-Top / Yaw Bearing Loads: - INTEGER(IntKi), PARAMETER :: YawBrFxn = 716 - INTEGER(IntKi), PARAMETER :: YawBrFyn = 717 - INTEGER(IntKi), PARAMETER :: YawBrFzn = 718 - INTEGER(IntKi), PARAMETER :: YawBrFxp = 719 - INTEGER(IntKi), PARAMETER :: YawBrFyp = 720 - INTEGER(IntKi), PARAMETER :: YawBrMxn = 721 - INTEGER(IntKi), PARAMETER :: YawBrMyn = 722 - INTEGER(IntKi), PARAMETER :: YawBrMzn = 723 - INTEGER(IntKi), PARAMETER :: YawBrMxp = 724 - INTEGER(IntKi), PARAMETER :: YawBrMyp = 725 + INTEGER(IntKi), PARAMETER :: YawBrFxn = 719 + INTEGER(IntKi), PARAMETER :: YawBrFyn = 720 + INTEGER(IntKi), PARAMETER :: YawBrFzn = 721 + INTEGER(IntKi), PARAMETER :: YawBrFxp = 722 + INTEGER(IntKi), PARAMETER :: YawBrFyp = 723 + INTEGER(IntKi), PARAMETER :: YawBrMxn = 724 + INTEGER(IntKi), PARAMETER :: YawBrMyn = 725 + INTEGER(IntKi), PARAMETER :: YawBrMzn = 726 + INTEGER(IntKi), PARAMETER :: YawBrMxp = 727 + INTEGER(IntKi), PARAMETER :: YawBrMyp = 728 ! Tower Base Loads: - INTEGER(IntKi), PARAMETER :: TwrBsFxt = 726 - INTEGER(IntKi), PARAMETER :: TwrBsFyt = 727 - INTEGER(IntKi), PARAMETER :: TwrBsFzt = 728 - INTEGER(IntKi), PARAMETER :: TwrBsMxt = 729 - INTEGER(IntKi), PARAMETER :: TwrBsMyt = 730 - INTEGER(IntKi), PARAMETER :: TwrBsMzt = 731 + INTEGER(IntKi), PARAMETER :: TwrBsFxt = 729 + INTEGER(IntKi), PARAMETER :: TwrBsFyt = 730 + INTEGER(IntKi), PARAMETER :: TwrBsFzt = 731 + INTEGER(IntKi), PARAMETER :: TwrBsMxt = 732 + INTEGER(IntKi), PARAMETER :: TwrBsMyt = 733 + INTEGER(IntKi), PARAMETER :: TwrBsMzt = 734 ! Local Tower Loads: - INTEGER(IntKi), PARAMETER :: TwHt1MLxt = 732 - INTEGER(IntKi), PARAMETER :: TwHt1MLyt = 733 - INTEGER(IntKi), PARAMETER :: TwHt1MLzt = 734 - INTEGER(IntKi), PARAMETER :: TwHt2MLxt = 735 - INTEGER(IntKi), PARAMETER :: TwHt2MLyt = 736 - INTEGER(IntKi), PARAMETER :: TwHt2MLzt = 737 - INTEGER(IntKi), PARAMETER :: TwHt3MLxt = 738 - INTEGER(IntKi), PARAMETER :: TwHt3MLyt = 739 - INTEGER(IntKi), PARAMETER :: TwHt3MLzt = 740 - INTEGER(IntKi), PARAMETER :: TwHt4MLxt = 741 - INTEGER(IntKi), PARAMETER :: TwHt4MLyt = 742 - INTEGER(IntKi), PARAMETER :: TwHt4MLzt = 743 - INTEGER(IntKi), PARAMETER :: TwHt5MLxt = 744 - INTEGER(IntKi), PARAMETER :: TwHt5MLyt = 745 - INTEGER(IntKi), PARAMETER :: TwHt5MLzt = 746 - INTEGER(IntKi), PARAMETER :: TwHt6MLxt = 747 - INTEGER(IntKi), PARAMETER :: TwHt6MLyt = 748 - INTEGER(IntKi), PARAMETER :: TwHt6MLzt = 749 - INTEGER(IntKi), PARAMETER :: TwHt7MLxt = 750 - INTEGER(IntKi), PARAMETER :: TwHt7MLyt = 751 - INTEGER(IntKi), PARAMETER :: TwHt7MLzt = 752 - INTEGER(IntKi), PARAMETER :: TwHt8MLxt = 753 - INTEGER(IntKi), PARAMETER :: TwHt8MLyt = 754 - INTEGER(IntKi), PARAMETER :: TwHt8MLzt = 755 - INTEGER(IntKi), PARAMETER :: TwHt9MLxt = 756 - INTEGER(IntKi), PARAMETER :: TwHt9MLyt = 757 - INTEGER(IntKi), PARAMETER :: TwHt9MLzt = 758 - INTEGER(IntKi), PARAMETER :: TwHt1FLxt = 759 - INTEGER(IntKi), PARAMETER :: TwHt1FLyt = 760 - INTEGER(IntKi), PARAMETER :: TwHt1FLzt = 761 - INTEGER(IntKi), PARAMETER :: TwHt2FLxt = 762 - INTEGER(IntKi), PARAMETER :: TwHt2FLyt = 763 - INTEGER(IntKi), PARAMETER :: TwHt2FLzt = 764 - INTEGER(IntKi), PARAMETER :: TwHt3FLxt = 765 - INTEGER(IntKi), PARAMETER :: TwHt3FLyt = 766 - INTEGER(IntKi), PARAMETER :: TwHt3FLzt = 767 - INTEGER(IntKi), PARAMETER :: TwHt4FLxt = 768 - INTEGER(IntKi), PARAMETER :: TwHt4FLyt = 769 - INTEGER(IntKi), PARAMETER :: TwHt4FLzt = 770 - INTEGER(IntKi), PARAMETER :: TwHt5FLxt = 771 - INTEGER(IntKi), PARAMETER :: TwHt5FLyt = 772 - INTEGER(IntKi), PARAMETER :: TwHt5FLzt = 773 - INTEGER(IntKi), PARAMETER :: TwHt6FLxt = 774 - INTEGER(IntKi), PARAMETER :: TwHt6FLyt = 775 - INTEGER(IntKi), PARAMETER :: TwHt6FLzt = 776 - INTEGER(IntKi), PARAMETER :: TwHt7FLxt = 777 - INTEGER(IntKi), PARAMETER :: TwHt7FLyt = 778 - INTEGER(IntKi), PARAMETER :: TwHt7FLzt = 779 - INTEGER(IntKi), PARAMETER :: TwHt8FLxt = 780 - INTEGER(IntKi), PARAMETER :: TwHt8FLyt = 781 - INTEGER(IntKi), PARAMETER :: TwHt8FLzt = 782 - INTEGER(IntKi), PARAMETER :: TwHt9FLxt = 783 - INTEGER(IntKi), PARAMETER :: TwHt9FLyt = 784 - INTEGER(IntKi), PARAMETER :: TwHt9FLzt = 785 + INTEGER(IntKi), PARAMETER :: TwHt1MLxt = 735 + INTEGER(IntKi), PARAMETER :: TwHt1MLyt = 736 + INTEGER(IntKi), PARAMETER :: TwHt1MLzt = 737 + INTEGER(IntKi), PARAMETER :: TwHt2MLxt = 738 + INTEGER(IntKi), PARAMETER :: TwHt2MLyt = 739 + INTEGER(IntKi), PARAMETER :: TwHt2MLzt = 740 + INTEGER(IntKi), PARAMETER :: TwHt3MLxt = 741 + INTEGER(IntKi), PARAMETER :: TwHt3MLyt = 742 + INTEGER(IntKi), PARAMETER :: TwHt3MLzt = 743 + INTEGER(IntKi), PARAMETER :: TwHt4MLxt = 744 + INTEGER(IntKi), PARAMETER :: TwHt4MLyt = 745 + INTEGER(IntKi), PARAMETER :: TwHt4MLzt = 746 + INTEGER(IntKi), PARAMETER :: TwHt5MLxt = 747 + INTEGER(IntKi), PARAMETER :: TwHt5MLyt = 748 + INTEGER(IntKi), PARAMETER :: TwHt5MLzt = 749 + INTEGER(IntKi), PARAMETER :: TwHt6MLxt = 750 + INTEGER(IntKi), PARAMETER :: TwHt6MLyt = 751 + INTEGER(IntKi), PARAMETER :: TwHt6MLzt = 752 + INTEGER(IntKi), PARAMETER :: TwHt7MLxt = 753 + INTEGER(IntKi), PARAMETER :: TwHt7MLyt = 754 + INTEGER(IntKi), PARAMETER :: TwHt7MLzt = 755 + INTEGER(IntKi), PARAMETER :: TwHt8MLxt = 756 + INTEGER(IntKi), PARAMETER :: TwHt8MLyt = 757 + INTEGER(IntKi), PARAMETER :: TwHt8MLzt = 758 + INTEGER(IntKi), PARAMETER :: TwHt9MLxt = 759 + INTEGER(IntKi), PARAMETER :: TwHt9MLyt = 760 + INTEGER(IntKi), PARAMETER :: TwHt9MLzt = 761 + INTEGER(IntKi), PARAMETER :: TwHt1FLxt = 762 + INTEGER(IntKi), PARAMETER :: TwHt1FLyt = 763 + INTEGER(IntKi), PARAMETER :: TwHt1FLzt = 764 + INTEGER(IntKi), PARAMETER :: TwHt2FLxt = 765 + INTEGER(IntKi), PARAMETER :: TwHt2FLyt = 766 + INTEGER(IntKi), PARAMETER :: TwHt2FLzt = 767 + INTEGER(IntKi), PARAMETER :: TwHt3FLxt = 768 + INTEGER(IntKi), PARAMETER :: TwHt3FLyt = 769 + INTEGER(IntKi), PARAMETER :: TwHt3FLzt = 770 + INTEGER(IntKi), PARAMETER :: TwHt4FLxt = 771 + INTEGER(IntKi), PARAMETER :: TwHt4FLyt = 772 + INTEGER(IntKi), PARAMETER :: TwHt4FLzt = 773 + INTEGER(IntKi), PARAMETER :: TwHt5FLxt = 774 + INTEGER(IntKi), PARAMETER :: TwHt5FLyt = 775 + INTEGER(IntKi), PARAMETER :: TwHt5FLzt = 776 + INTEGER(IntKi), PARAMETER :: TwHt6FLxt = 777 + INTEGER(IntKi), PARAMETER :: TwHt6FLyt = 778 + INTEGER(IntKi), PARAMETER :: TwHt6FLzt = 779 + INTEGER(IntKi), PARAMETER :: TwHt7FLxt = 780 + INTEGER(IntKi), PARAMETER :: TwHt7FLyt = 781 + INTEGER(IntKi), PARAMETER :: TwHt7FLzt = 782 + INTEGER(IntKi), PARAMETER :: TwHt8FLxt = 783 + INTEGER(IntKi), PARAMETER :: TwHt8FLyt = 784 + INTEGER(IntKi), PARAMETER :: TwHt8FLzt = 785 + INTEGER(IntKi), PARAMETER :: TwHt9FLxt = 786 + INTEGER(IntKi), PARAMETER :: TwHt9FLyt = 787 + INTEGER(IntKi), PARAMETER :: TwHt9FLzt = 788 ! Internal Degrees of Freedom: - INTEGER(IntKi), PARAMETER :: Q_B1E1 = 786 - INTEGER(IntKi), PARAMETER :: Q_B2E1 = 787 - INTEGER(IntKi), PARAMETER :: Q_B3E1 = 788 - INTEGER(IntKi), PARAMETER :: Q_B1F1 = 789 - INTEGER(IntKi), PARAMETER :: Q_B2F1 = 790 - INTEGER(IntKi), PARAMETER :: Q_B3F1 = 791 - INTEGER(IntKi), PARAMETER :: Q_B1F2 = 792 - INTEGER(IntKi), PARAMETER :: Q_B2F2 = 793 - INTEGER(IntKi), PARAMETER :: Q_B3F2 = 794 - INTEGER(IntKi), PARAMETER :: Q_Teet = 795 - INTEGER(IntKi), PARAMETER :: Q_DrTr = 796 - INTEGER(IntKi), PARAMETER :: Q_GeAz = 797 - INTEGER(IntKi), PARAMETER :: Q_RFrl = 798 - INTEGER(IntKi), PARAMETER :: Q_TFrl = 799 - INTEGER(IntKi), PARAMETER :: Q_Yaw = 800 - INTEGER(IntKi), PARAMETER :: Q_TFA1 = 801 - INTEGER(IntKi), PARAMETER :: Q_TSS1 = 802 - INTEGER(IntKi), PARAMETER :: Q_TFA2 = 803 - INTEGER(IntKi), PARAMETER :: Q_TSS2 = 804 - INTEGER(IntKi), PARAMETER :: Q_Sg = 805 - INTEGER(IntKi), PARAMETER :: Q_Sw = 806 - INTEGER(IntKi), PARAMETER :: Q_Hv = 807 - INTEGER(IntKi), PARAMETER :: Q_R = 808 - INTEGER(IntKi), PARAMETER :: Q_P = 809 - INTEGER(IntKi), PARAMETER :: Q_Y = 810 - INTEGER(IntKi), PARAMETER :: QD_B1E1 = 811 - INTEGER(IntKi), PARAMETER :: QD_B2E1 = 812 - INTEGER(IntKi), PARAMETER :: QD_B3E1 = 813 - INTEGER(IntKi), PARAMETER :: QD_B1F1 = 814 - INTEGER(IntKi), PARAMETER :: QD_B2F1 = 815 - INTEGER(IntKi), PARAMETER :: QD_B3F1 = 816 - INTEGER(IntKi), PARAMETER :: QD_B1F2 = 817 - INTEGER(IntKi), PARAMETER :: QD_B2F2 = 818 - INTEGER(IntKi), PARAMETER :: QD_B3F2 = 819 - INTEGER(IntKi), PARAMETER :: QD_Teet = 820 - INTEGER(IntKi), PARAMETER :: QD_DrTr = 821 - INTEGER(IntKi), PARAMETER :: QD_GeAz = 822 - INTEGER(IntKi), PARAMETER :: QD_RFrl = 823 - INTEGER(IntKi), PARAMETER :: QD_TFrl = 824 - INTEGER(IntKi), PARAMETER :: QD_Yaw = 825 - INTEGER(IntKi), PARAMETER :: QD_TFA1 = 826 - INTEGER(IntKi), PARAMETER :: QD_TSS1 = 827 - INTEGER(IntKi), PARAMETER :: QD_TFA2 = 828 - INTEGER(IntKi), PARAMETER :: QD_TSS2 = 829 - INTEGER(IntKi), PARAMETER :: QD_Sg = 830 - INTEGER(IntKi), PARAMETER :: QD_Sw = 831 - INTEGER(IntKi), PARAMETER :: QD_Hv = 832 - INTEGER(IntKi), PARAMETER :: QD_R = 833 - INTEGER(IntKi), PARAMETER :: QD_P = 834 - INTEGER(IntKi), PARAMETER :: QD_Y = 835 - INTEGER(IntKi), PARAMETER :: QD2_B1E1 = 836 - INTEGER(IntKi), PARAMETER :: QD2_B2E1 = 837 - INTEGER(IntKi), PARAMETER :: QD2_B3E1 = 838 - INTEGER(IntKi), PARAMETER :: QD2_B1F1 = 839 - INTEGER(IntKi), PARAMETER :: QD2_B2F1 = 840 - INTEGER(IntKi), PARAMETER :: QD2_B3F1 = 841 - INTEGER(IntKi), PARAMETER :: QD2_B1F2 = 842 - INTEGER(IntKi), PARAMETER :: QD2_B2F2 = 843 - INTEGER(IntKi), PARAMETER :: QD2_B3F2 = 844 - INTEGER(IntKi), PARAMETER :: QD2_Teet = 845 - INTEGER(IntKi), PARAMETER :: QD2_DrTr = 846 - INTEGER(IntKi), PARAMETER :: QD2_GeAz = 847 - INTEGER(IntKi), PARAMETER :: QD2_RFrl = 848 - INTEGER(IntKi), PARAMETER :: QD2_TFrl = 849 - INTEGER(IntKi), PARAMETER :: QD2_Yaw = 850 - INTEGER(IntKi), PARAMETER :: QD2_TFA1 = 851 - INTEGER(IntKi), PARAMETER :: QD2_TSS1 = 852 - INTEGER(IntKi), PARAMETER :: QD2_TFA2 = 853 - INTEGER(IntKi), PARAMETER :: QD2_TSS2 = 854 - INTEGER(IntKi), PARAMETER :: QD2_Sg = 855 - INTEGER(IntKi), PARAMETER :: QD2_Sw = 856 - INTEGER(IntKi), PARAMETER :: QD2_Hv = 857 - INTEGER(IntKi), PARAMETER :: QD2_R = 858 - INTEGER(IntKi), PARAMETER :: QD2_P = 859 - INTEGER(IntKi), PARAMETER :: QD2_Y = 860 + INTEGER(IntKi), PARAMETER :: Q_B1E1 = 789 + INTEGER(IntKi), PARAMETER :: Q_B2E1 = 790 + INTEGER(IntKi), PARAMETER :: Q_B3E1 = 791 + INTEGER(IntKi), PARAMETER :: Q_B1F1 = 792 + INTEGER(IntKi), PARAMETER :: Q_B2F1 = 793 + INTEGER(IntKi), PARAMETER :: Q_B3F1 = 794 + INTEGER(IntKi), PARAMETER :: Q_B1F2 = 795 + INTEGER(IntKi), PARAMETER :: Q_B2F2 = 796 + INTEGER(IntKi), PARAMETER :: Q_B3F2 = 797 + INTEGER(IntKi), PARAMETER :: Q_Teet = 798 + INTEGER(IntKi), PARAMETER :: Q_DrTr = 799 + INTEGER(IntKi), PARAMETER :: Q_GeAz = 800 + INTEGER(IntKi), PARAMETER :: Q_RFrl = 801 + INTEGER(IntKi), PARAMETER :: Q_TFrl = 802 + INTEGER(IntKi), PARAMETER :: Q_Yaw = 803 + INTEGER(IntKi), PARAMETER :: Q_TFA1 = 804 + INTEGER(IntKi), PARAMETER :: Q_TSS1 = 805 + INTEGER(IntKi), PARAMETER :: Q_TFA2 = 806 + INTEGER(IntKi), PARAMETER :: Q_TSS2 = 807 + INTEGER(IntKi), PARAMETER :: Q_Sg = 808 + INTEGER(IntKi), PARAMETER :: Q_Sw = 809 + INTEGER(IntKi), PARAMETER :: Q_Hv = 810 + INTEGER(IntKi), PARAMETER :: Q_R = 811 + INTEGER(IntKi), PARAMETER :: Q_P = 812 + INTEGER(IntKi), PARAMETER :: Q_Y = 813 + INTEGER(IntKi), PARAMETER :: QD_B1E1 = 814 + INTEGER(IntKi), PARAMETER :: QD_B2E1 = 815 + INTEGER(IntKi), PARAMETER :: QD_B3E1 = 816 + INTEGER(IntKi), PARAMETER :: QD_B1F1 = 817 + INTEGER(IntKi), PARAMETER :: QD_B2F1 = 818 + INTEGER(IntKi), PARAMETER :: QD_B3F1 = 819 + INTEGER(IntKi), PARAMETER :: QD_B1F2 = 820 + INTEGER(IntKi), PARAMETER :: QD_B2F2 = 821 + INTEGER(IntKi), PARAMETER :: QD_B3F2 = 822 + INTEGER(IntKi), PARAMETER :: QD_Teet = 823 + INTEGER(IntKi), PARAMETER :: QD_DrTr = 824 + INTEGER(IntKi), PARAMETER :: QD_GeAz = 825 + INTEGER(IntKi), PARAMETER :: QD_RFrl = 826 + INTEGER(IntKi), PARAMETER :: QD_TFrl = 827 + INTEGER(IntKi), PARAMETER :: QD_Yaw = 828 + INTEGER(IntKi), PARAMETER :: QD_TFA1 = 829 + INTEGER(IntKi), PARAMETER :: QD_TSS1 = 830 + INTEGER(IntKi), PARAMETER :: QD_TFA2 = 831 + INTEGER(IntKi), PARAMETER :: QD_TSS2 = 832 + INTEGER(IntKi), PARAMETER :: QD_Sg = 833 + INTEGER(IntKi), PARAMETER :: QD_Sw = 834 + INTEGER(IntKi), PARAMETER :: QD_Hv = 835 + INTEGER(IntKi), PARAMETER :: QD_R = 836 + INTEGER(IntKi), PARAMETER :: QD_P = 837 + INTEGER(IntKi), PARAMETER :: QD_Y = 838 + INTEGER(IntKi), PARAMETER :: QD2_B1E1 = 839 + INTEGER(IntKi), PARAMETER :: QD2_B2E1 = 840 + INTEGER(IntKi), PARAMETER :: QD2_B3E1 = 841 + INTEGER(IntKi), PARAMETER :: QD2_B1F1 = 842 + INTEGER(IntKi), PARAMETER :: QD2_B2F1 = 843 + INTEGER(IntKi), PARAMETER :: QD2_B3F1 = 844 + INTEGER(IntKi), PARAMETER :: QD2_B1F2 = 845 + INTEGER(IntKi), PARAMETER :: QD2_B2F2 = 846 + INTEGER(IntKi), PARAMETER :: QD2_B3F2 = 847 + INTEGER(IntKi), PARAMETER :: QD2_Teet = 848 + INTEGER(IntKi), PARAMETER :: QD2_DrTr = 849 + INTEGER(IntKi), PARAMETER :: QD2_GeAz = 850 + INTEGER(IntKi), PARAMETER :: QD2_RFrl = 851 + INTEGER(IntKi), PARAMETER :: QD2_TFrl = 852 + INTEGER(IntKi), PARAMETER :: QD2_Yaw = 853 + INTEGER(IntKi), PARAMETER :: QD2_TFA1 = 854 + INTEGER(IntKi), PARAMETER :: QD2_TSS1 = 855 + INTEGER(IntKi), PARAMETER :: QD2_TFA2 = 856 + INTEGER(IntKi), PARAMETER :: QD2_TSS2 = 857 + INTEGER(IntKi), PARAMETER :: QD2_Sg = 858 + INTEGER(IntKi), PARAMETER :: QD2_Sw = 859 + INTEGER(IntKi), PARAMETER :: QD2_Hv = 860 + INTEGER(IntKi), PARAMETER :: QD2_R = 861 + INTEGER(IntKi), PARAMETER :: QD2_P = 862 + INTEGER(IntKi), PARAMETER :: QD2_Y = 863 ! The maximum number of output channels which can be output by the code. - INTEGER(IntKi), PARAMETER :: MaxOutPts = 860 + INTEGER(IntKi), PARAMETER :: MaxOutPts = 863 !End of code generated by Matlab script ! =================================================================================================== - INTEGER, PARAMETER :: TipDxc( 3) = (/TipDxc1, TipDxc2, TipDxc3/) INTEGER, PARAMETER :: TipDyc( 3) = (/TipDyc1, TipDyc2, TipDyc3/) INTEGER, PARAMETER :: TipDzc( 3) = (/TipDzc1, TipDzc2, TipDzc3/) @@ -5045,8 +5047,8 @@ SUBROUTINE ValidatePrimaryData( InputFileData, BD4Blades, Linearize, ErrStat, Er CALL SetErrStat( ErrID_Fatal, 'NumBl must be 1, 2, or 3 for BeamDyn simulations.',ErrStat,ErrMsg,RoutineName) END IF ELSE - IF ( ( InputFileData%NumBl < 2 ) .OR. ( InputFileData%NumBl > MaxBl ) ) THEN - CALL SetErrStat( ErrID_Fatal, 'NumBl must be either 2 or 3.',ErrStat,ErrMsg,RoutineName) + IF ( ( InputFileData%NumBl < 1 ) .OR. ( InputFileData%NumBl > MaxBl ) ) THEN + CALL SetErrStat( ErrID_Fatal, 'NumBl must be 1, 2, or 3.',ErrStat,ErrMsg,RoutineName) END IF END IF diff --git a/modules/elastodyn/src/ElastoDyn_Registry.txt b/modules/elastodyn/src/ElastoDyn_Registry.txt index ed6dc2c2b9..8fef40e57f 100644 --- a/modules/elastodyn/src/ElastoDyn_Registry.txt +++ b/modules/elastodyn/src/ElastoDyn_Registry.txt @@ -39,6 +39,7 @@ typedef ^ InitOutputType ReKi BldRNodes {:} - - "Radius to analysis nodes relati typedef ^ InitOutputType ReKi TwrHNodes {:} - - "Location of variable-spaced tower nodes (relative to the tower rigid base height" typedef ^ InitOutputType ReKi PlatformPos {6} - - "Initial platform position (6 DOFs)" typedef ^ InitOutputType ReKi TwrBasePos {3} - - "initial position of the tower base (for SrvD)" m +typedef ^ InitOutputType R8Ki TwrBaseOrient {3}{3} - - "initial orientation of the tower base (for SrvD)" typedef ^ InitOutputType ReKi HubRad - - - "Preconed hub radius (distance from the rotor apex to the blade root)" m typedef ^ InitOutputType ReKi RotSpeed - - - "Initial or fixed rotor speed" rad/s typedef ^ InitOutputType LOGICAL isFixed_GenDOF - - - "whether the generator is fixed or free" - @@ -428,9 +429,11 @@ typedef ^ ED_RtHndSide ReKi AngAccERt 3 - - "Portion of the angular acceleration typedef ^ ED_RtHndSide ReKi AngAccEXt 3 - - "Portion of the angular acceleration of the platform (body X) in the inertia frame (body E for earth) associated with everything but the QD2T()s" typedef ^ ED_RtHndSide ReKi AngAccEFt {:}{:} - - "Portion of the angular acceleration of tower element J (body F) in the inertia frame (body E for earth) associated with everything but the QD2T()s" typedef ^ ED_RtHndSide ReKi AngVelEF {:}{:} - - "Angular velocity of the current point on the tower (body F) in the inertia frame (body E for earth)" +typedef ^ ED_RtHndSide ReKi AngVelHM {:}{:}{:} - - "Angular velocity of the current point on the blade in the inertia frame " typedef ^ ED_RtHndSide ReKi AngAccEAt 3 - - "Portion of the angular acceleration of the tail (body A) in the inertia frame (body E for earth) associated with everything but the QD2T()'s" typedef ^ ED_RtHndSide ReKi AngAccEGt 3 - - "Portion of the angular acceleration of the generator (body G) in the inertia frame (body E for earth) associated with everything but the QD2T()'s" typedef ^ ED_RtHndSide ReKi AngAccEHt 3 - - "Portion of the angular acceleration of the hub (body H) in the inertia frame (body E for earth) associated with everything but the QD2T()'s" +typedef ^ ED_RtHndSide ReKi AngAccEKt {:}{:}{:} - - "Portion of the angular acceleration of the blade in the inertia frame associated with everything but the QD2T()'s" #typedef ^ ED_RtHndSide ReKi AngAccELt 3 - - "Portion of the angular acceleration of the low-speed shaft (body L) in the inertia frame (body E for earth) associated with everything but the QD2T()'s" typedef ^ ED_RtHndSide ReKi AngAccENt 3 - - "Portion of the angular acceleration of the nacelle (body N) in the inertia frame (body E for earth) associated with everything but the QD2T()'s" # RtHS Linear diff --git a/modules/elastodyn/src/ElastoDyn_Types.f90 b/modules/elastodyn/src/ElastoDyn_Types.f90 index 35338dc227..4adb4f1958 100644 --- a/modules/elastodyn/src/ElastoDyn_Types.f90 +++ b/modules/elastodyn/src/ElastoDyn_Types.f90 @@ -59,6 +59,7 @@ MODULE ElastoDyn_Types REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrHNodes !< Location of variable-spaced tower nodes (relative to the tower rigid base height [-] REAL(ReKi) , DIMENSION(1:6) :: PlatformPos !< Initial platform position (6 DOFs) [-] REAL(ReKi) , DIMENSION(1:3) :: TwrBasePos !< initial position of the tower base (for SrvD) [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseOrient !< initial orientation of the tower base (for SrvD) [-] REAL(ReKi) :: HubRad !< Preconed hub radius (distance from the rotor apex to the blade root) [m] REAL(ReKi) :: RotSpeed !< Initial or fixed rotor speed [rad/s] LOGICAL :: isFixed_GenDOF !< whether the generator is fixed or free [-] @@ -438,9 +439,11 @@ MODULE ElastoDyn_Types REAL(ReKi) , DIMENSION(1:3) :: AngAccEXt !< Portion of the angular acceleration of the platform (body X) in the inertia frame (body E for earth) associated with everything but the QD2T()s [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: AngAccEFt !< Portion of the angular acceleration of tower element J (body F) in the inertia frame (body E for earth) associated with everything but the QD2T()s [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: AngVelEF !< Angular velocity of the current point on the tower (body F) in the inertia frame (body E for earth) [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AngVelHM !< Angular velocity of the current point on the blade in the inertia frame [-] REAL(ReKi) , DIMENSION(1:3) :: AngAccEAt !< Portion of the angular acceleration of the tail (body A) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] REAL(ReKi) , DIMENSION(1:3) :: AngAccEGt !< Portion of the angular acceleration of the generator (body G) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] REAL(ReKi) , DIMENSION(1:3) :: AngAccEHt !< Portion of the angular acceleration of the hub (body H) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] + REAL(ReKi) , DIMENSION(:,:,:), ALLOCATABLE :: AngAccEKt !< Portion of the angular acceleration of the blade in the inertia frame associated with everything but the QD2T()'s [-] REAL(ReKi) , DIMENSION(1:3) :: AngAccENt !< Portion of the angular acceleration of the nacelle (body N) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] REAL(ReKi) , DIMENSION(1:3) :: LinAccECt !< Portion of the linear acceleration of the hub center of mass (point C) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] REAL(ReKi) , DIMENSION(1:3) :: LinAccEDt !< Portion of the linear acceleration of the center of mass of the structure that furls with the rotor (not including rotor) (point D) in the inertia frame (body E for earth) associated with everything but the QD2T()'s [-] @@ -1052,6 +1055,7 @@ SUBROUTINE ED_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'ED_CopyInitOutput' @@ -1129,6 +1133,7 @@ SUBROUTINE ED_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er ENDIF DstInitOutputData%PlatformPos = SrcInitOutputData%PlatformPos DstInitOutputData%TwrBasePos = SrcInitOutputData%TwrBasePos + DstInitOutputData%TwrBaseOrient = SrcInitOutputData%TwrBaseOrient DstInitOutputData%HubRad = SrcInitOutputData%HubRad DstInitOutputData%RotSpeed = SrcInitOutputData%RotSpeed DstInitOutputData%isFixed_GenDOF = SrcInitOutputData%isFixed_GenDOF @@ -1367,6 +1372,7 @@ SUBROUTINE ED_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs END IF Re_BufSz = Re_BufSz + SIZE(InData%PlatformPos) ! PlatformPos Re_BufSz = Re_BufSz + SIZE(InData%TwrBasePos) ! TwrBasePos + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseOrient) ! TwrBaseOrient Re_BufSz = Re_BufSz + 1 ! HubRad Re_BufSz = Re_BufSz + 1 ! RotSpeed Int_BufSz = Int_BufSz + 1 ! isFixed_GenDOF @@ -1564,6 +1570,12 @@ SUBROUTINE ED_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ReKiBuf(Re_Xferred) = InData%TwrBasePos(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i2 = LBOUND(InData%TwrBaseOrient,2), UBOUND(InData%TwrBaseOrient,2) + DO i1 = LBOUND(InData%TwrBaseOrient,1), UBOUND(InData%TwrBaseOrient,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO ReKiBuf(Re_Xferred) = InData%HubRad Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%RotSpeed @@ -1712,6 +1724,7 @@ SUBROUTINE ED_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'ED_UnPackInitOutput' @@ -1883,6 +1896,16 @@ SUBROUTINE ED_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er OutData%TwrBasePos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%TwrBaseOrient,1) + i1_u = UBOUND(OutData%TwrBaseOrient,1) + i2_l = LBOUND(OutData%TwrBaseOrient,2) + i2_u = UBOUND(OutData%TwrBaseOrient,2) + DO i2 = LBOUND(OutData%TwrBaseOrient,2), UBOUND(OutData%TwrBaseOrient,2) + DO i1 = LBOUND(OutData%TwrBaseOrient,1), UBOUND(OutData%TwrBaseOrient,1) + OutData%TwrBaseOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO OutData%HubRad = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%RotSpeed = ReKiBuf(Re_Xferred) @@ -9205,10 +9228,42 @@ SUBROUTINE ED_CopyRtHndSide( SrcRtHndSideData, DstRtHndSideData, CtrlCode, ErrSt END IF END IF DstRtHndSideData%AngVelEF = SrcRtHndSideData%AngVelEF +ENDIF +IF (ALLOCATED(SrcRtHndSideData%AngVelHM)) THEN + i1_l = LBOUND(SrcRtHndSideData%AngVelHM,1) + i1_u = UBOUND(SrcRtHndSideData%AngVelHM,1) + i2_l = LBOUND(SrcRtHndSideData%AngVelHM,2) + i2_u = UBOUND(SrcRtHndSideData%AngVelHM,2) + i3_l = LBOUND(SrcRtHndSideData%AngVelHM,3) + i3_u = UBOUND(SrcRtHndSideData%AngVelHM,3) + IF (.NOT. ALLOCATED(DstRtHndSideData%AngVelHM)) THEN + ALLOCATE(DstRtHndSideData%AngVelHM(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRtHndSideData%AngVelHM.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRtHndSideData%AngVelHM = SrcRtHndSideData%AngVelHM ENDIF DstRtHndSideData%AngAccEAt = SrcRtHndSideData%AngAccEAt DstRtHndSideData%AngAccEGt = SrcRtHndSideData%AngAccEGt DstRtHndSideData%AngAccEHt = SrcRtHndSideData%AngAccEHt +IF (ALLOCATED(SrcRtHndSideData%AngAccEKt)) THEN + i1_l = LBOUND(SrcRtHndSideData%AngAccEKt,1) + i1_u = UBOUND(SrcRtHndSideData%AngAccEKt,1) + i2_l = LBOUND(SrcRtHndSideData%AngAccEKt,2) + i2_u = UBOUND(SrcRtHndSideData%AngAccEKt,2) + i3_l = LBOUND(SrcRtHndSideData%AngAccEKt,3) + i3_u = UBOUND(SrcRtHndSideData%AngAccEKt,3) + IF (.NOT. ALLOCATED(DstRtHndSideData%AngAccEKt)) THEN + ALLOCATE(DstRtHndSideData%AngAccEKt(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstRtHndSideData%AngAccEKt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstRtHndSideData%AngAccEKt = SrcRtHndSideData%AngAccEKt +ENDIF DstRtHndSideData%AngAccENt = SrcRtHndSideData%AngAccENt DstRtHndSideData%LinAccECt = SrcRtHndSideData%LinAccECt DstRtHndSideData%LinAccEDt = SrcRtHndSideData%LinAccEDt @@ -10008,6 +10063,12 @@ SUBROUTINE ED_DestroyRtHndSide( RtHndSideData, ErrStat, ErrMsg ) IF (ALLOCATED(RtHndSideData%AngVelEF)) THEN DEALLOCATE(RtHndSideData%AngVelEF) ENDIF +IF (ALLOCATED(RtHndSideData%AngVelHM)) THEN + DEALLOCATE(RtHndSideData%AngVelHM) +ENDIF +IF (ALLOCATED(RtHndSideData%AngAccEKt)) THEN + DEALLOCATE(RtHndSideData%AngAccEKt) +ENDIF IF (ALLOCATED(RtHndSideData%LinVelES)) THEN DEALLOCATE(RtHndSideData%LinVelES) ENDIF @@ -10329,10 +10390,20 @@ SUBROUTINE ED_PackRtHndSide( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg IF ( ALLOCATED(InData%AngVelEF) ) THEN Int_BufSz = Int_BufSz + 2*2 ! AngVelEF upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%AngVelEF) ! AngVelEF + END IF + Int_BufSz = Int_BufSz + 1 ! AngVelHM allocated yes/no + IF ( ALLOCATED(InData%AngVelHM) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! AngVelHM upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AngVelHM) ! AngVelHM END IF Re_BufSz = Re_BufSz + SIZE(InData%AngAccEAt) ! AngAccEAt Re_BufSz = Re_BufSz + SIZE(InData%AngAccEGt) ! AngAccEGt Re_BufSz = Re_BufSz + SIZE(InData%AngAccEHt) ! AngAccEHt + Int_BufSz = Int_BufSz + 1 ! AngAccEKt allocated yes/no + IF ( ALLOCATED(InData%AngAccEKt) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! AngAccEKt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%AngAccEKt) ! AngAccEKt + END IF Re_BufSz = Re_BufSz + SIZE(InData%AngAccENt) ! AngAccENt Re_BufSz = Re_BufSz + SIZE(InData%LinAccECt) ! LinAccECt Re_BufSz = Re_BufSz + SIZE(InData%LinAccEDt) ! LinAccEDt @@ -11307,6 +11378,31 @@ SUBROUTINE ED_PackRtHndSide( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_Xferred = Re_Xferred + 1 END DO END DO + END IF + IF ( .NOT. ALLOCATED(InData%AngVelHM) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngVelHM,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngVelHM,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngVelHM,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngVelHM,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngVelHM,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngVelHM,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%AngVelHM,3), UBOUND(InData%AngVelHM,3) + DO i2 = LBOUND(InData%AngVelHM,2), UBOUND(InData%AngVelHM,2) + DO i1 = LBOUND(InData%AngVelHM,1), UBOUND(InData%AngVelHM,1) + ReKiBuf(Re_Xferred) = InData%AngVelHM(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO END IF DO i1 = LBOUND(InData%AngAccEAt,1), UBOUND(InData%AngAccEAt,1) ReKiBuf(Re_Xferred) = InData%AngAccEAt(i1) @@ -11320,6 +11416,31 @@ SUBROUTINE ED_PackRtHndSide( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg ReKiBuf(Re_Xferred) = InData%AngAccEHt(i1) Re_Xferred = Re_Xferred + 1 END DO + IF ( .NOT. ALLOCATED(InData%AngAccEKt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngAccEKt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngAccEKt,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngAccEKt,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngAccEKt,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%AngAccEKt,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AngAccEKt,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%AngAccEKt,3), UBOUND(InData%AngAccEKt,3) + DO i2 = LBOUND(InData%AngAccEKt,2), UBOUND(InData%AngAccEKt,2) + DO i1 = LBOUND(InData%AngAccEKt,1), UBOUND(InData%AngAccEKt,1) + ReKiBuf(Re_Xferred) = InData%AngAccEKt(i1,i2,i3) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF DO i1 = LBOUND(InData%AngAccENt,1), UBOUND(InData%AngAccENt,1) ReKiBuf(Re_Xferred) = InData%AngAccENt(i1) Re_Xferred = Re_Xferred + 1 @@ -13346,6 +13467,34 @@ SUBROUTINE ED_UnPackRtHndSide( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = Re_Xferred + 1 END DO END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AngVelHM not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AngVelHM)) DEALLOCATE(OutData%AngVelHM) + ALLOCATE(OutData%AngVelHM(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AngVelHM.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%AngVelHM,3), UBOUND(OutData%AngVelHM,3) + DO i2 = LBOUND(OutData%AngVelHM,2), UBOUND(OutData%AngVelHM,2) + DO i1 = LBOUND(OutData%AngVelHM,1), UBOUND(OutData%AngVelHM,1) + OutData%AngVelHM(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO END IF i1_l = LBOUND(OutData%AngAccEAt,1) i1_u = UBOUND(OutData%AngAccEAt,1) @@ -13365,6 +13514,34 @@ SUBROUTINE ED_UnPackRtHndSide( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err OutData%AngAccEHt(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AngAccEKt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AngAccEKt)) DEALLOCATE(OutData%AngAccEKt) + ALLOCATE(OutData%AngAccEKt(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AngAccEKt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%AngAccEKt,3), UBOUND(OutData%AngAccEKt,3) + DO i2 = LBOUND(OutData%AngAccEKt,2), UBOUND(OutData%AngAccEKt,2) + DO i1 = LBOUND(OutData%AngAccEKt,1), UBOUND(OutData%AngAccEKt,1) + OutData%AngAccEKt(i1,i2,i3) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END DO + END IF i1_l = LBOUND(OutData%AngAccENt,1) i1_u = UBOUND(OutData%AngAccENt,1) DO i1 = LBOUND(OutData%AngAccENt,1), UBOUND(OutData%AngAccENt,1) diff --git a/modules/hydrodyn/src/Morison.f90 b/modules/hydrodyn/src/Morison.f90 index b98fec7192..5307424e39 100644 --- a/modules/hydrodyn/src/Morison.f90 +++ b/modules/hydrodyn/src/Morison.f90 @@ -2119,6 +2119,7 @@ SUBROUTINE Morison_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, In ! get rotation matrix for moment of inertia orientations call RodrigMat(I_n, R_I, errStat, errMsg) + IF ( errStat >= AbortErrLev ) RETURN ! globally-oreinted moment of inertia matrix for joint Irl_mat = 0.0 @@ -2183,16 +2184,12 @@ SUBROUTINE RodrigMat(a, R, errStat, errMsg) REAL(ReKi) :: vec(3) ! scaled and adjusted input vector REAL(ReKi) :: factor ! denomenator used for scaling + ErrStat = ErrID_None + ErrMsg = "" factor = Dot_Product(a,a) + ! Return the identity if the vector is zero. We are defining it this way because of how this is used if ( EqualRealNos(factor, 0.0_ReKi) ) then - !IF ((a(1) == 0) .AND. (a(2)==0)) THEN ! return identity if vertical - ! CALL EYE(R, errStat,errMsg) - ! IF (a(3) < 0) THEN - ! R = -R - ! END IF - ! - errStat = ErrID_Fatal - errMsg = 'RodrigMat encountered vector of zero length' + CALL EYE(R, errStat,errMsg) else IF ( EqualRealNos(a(1), 0.0_ReKi) .AND. EqualRealNos(a(2), 0.0_ReKi) ) THEN ! return identity if vertical CALL EYE(R, errStat,errMsg) IF (a(3) < 0) THEN @@ -2652,8 +2649,6 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat, m%F_B_End = 0.0_ReKi y%Mesh%Force = 0.0_ReKi y%Mesh%Moment = 0.0_ReKi - F_WMG(1) = 0.0_ReKi - F_WMG(2) = 0.0_ReKi ! Loop through each member DO im = 1, p%NMembers @@ -2687,7 +2682,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat, z2 = pos2(3) r1 = mem%RMG(i ) ! outer radius element nodes including marine growth r2 = mem%RMG(i+1) - dRdl_mg = mem%dRdl_mg(i) ! mass of element including marine growth + dRdl_mg = mem%dRdl_mg(i) ! Taper of element including marine growth a_s1 = u%Mesh%TranslationAcc(:, mem%NodeIndx(i )) alpha_s1= u%Mesh%RotationAcc (:, mem%NodeIndx(i )) omega_s1= u%Mesh%RotationVel (:, mem%NodeIndx(i )) @@ -2701,6 +2696,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat, ! should lumped half-element coefficients get combined at initialization? <<< ! ------------------ marine growth: Sides: Section 4.1.2 -------------------- + F_WMG = 0.0_ReKi ! lower node !m%F_WMG(3, mem%NodeIndx(i )) = m%F_WMG(3, mem%NodeIndx(i )) - mem%m_mg_l(i)*g ! weight force : Note: this is a constant @@ -2816,7 +2812,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat, a0 = rh/((C_1)*cosPhi) ! simplified from what's in ConicalCalcs.ipynb a0b0 = a0*b0 C_2 = a0b0*rh*cosPhi - r1**3 - cl = (0.75*a0b0*r1**2*cosPhi + 0.75*r1**4*C_1 + r1*C_1*C_2) / (dRdl_mg*C_1*C_2) + cl = -(-0.75*a0b0*rh**2*cosPhi + 0.75*r1**4*C_1 + r1*C_1*C_2) / (dRdl_mg*C_1*C_2) cr = (0.75*a0b0*dRdl_mg*rh**2*sinPhi)/(C_1*C_2) cx = cr*cosPhi + cl*sinPhi Vs = pi*(a0b0*rh*cosPhi - r1**3)/(3.0*dRdl_mg) diff --git a/modules/inflowwind/src/IfW_4Dext.f90 b/modules/inflowwind/src/IfW_4Dext.f90 index a6730ad0f5..dea5bd8e44 100644 --- a/modules/inflowwind/src/IfW_4Dext.f90 +++ b/modules/inflowwind/src/IfW_4Dext.f90 @@ -222,44 +222,51 @@ FUNCTION Interp4D( Time, Position, p, m, ErrStat, ErrMsg ) ErrStat = ErrID_None ErrMsg = "" - + + !------------------------------------------------------------------------------------------------- ! Find the bounding indices for XYZ position !------------------------------------------------------------------------------------------------- do i=1,3 Tmp = (Position(i) - p%pZero(i)) / p%delta(i) - Indx_Lo(i) = INT( Tmp ) + 1 ! convert REAL to INTEGER, then add one since our grid indices start at 1, not 0 + Indx_Lo(i) = INT( Tmp ) + 1 ! convert REAL to INTEGER, then add one since our grid indices start at 1, not 0 isopc(i) = 2.0_ReKi * (Tmp - REAL(Indx_Lo(i) - 1_IntKi, ReKi)) - 1.0_ReKi ! convert to value between -1 and 1 enddo - !------------------------------------------------------------------------------------------------- ! Find the bounding indices for time !------------------------------------------------------------------------------------------------- i=4 Tmp = (Time - m%TgridStart) / p%delta(i) Indx_Lo(i) = INT( Tmp ) + 1 ! convert REAL to INTEGER, then add one since our grid indices start at 1, not 0 - !isopc(i) = 2.0_ReKi * (Tmp - REAL(Indx_Lo(i) - 1_IntKi, ReKi)) - 1.0_ReKi ! convert to value between -1 and 1 - isopc(i) = -1.0_ReKi ! For consistency, we're not going to interpolate in time; this is because we can't interpolate the last time grid in FAST.Farm anyway + isopc(i) = 2.0_ReKi * (Tmp - REAL(Indx_Lo(i) - 1_IntKi, ReKi)) - 1.0_ReKi ! convert to value between -1 and 1 + IF ( ( Indx_Lo(i) == p%n(i) ) ) then + if ( abs(isopc(i) + 1.0_SiKi) < 0.001_SiKi ) THEN ! Allow for the special case where Time = TgridStart + deltat*( n_high_low - 1 ) + Indx_Lo(i) = Indx_Lo(i) - 1 + isopc(i) = 1.0_SiKi + end if + END IF !------------------------------------------------------------------------------------------------- ! to verify that we don't extrapolate, make sure isopc is bound between -1 and 1 (effectively nearest neighbor) !------------------------------------------------------------------------------------------------- - DO i=1,size(isopc) + DO i=1,size(isopc) isopc(i) = min( 1.0_SiKi, isopc(i) ) isopc(i) = max(-1.0_SiKi, isopc(i) ) END DO !------------------------------------------------------------------------------------------------- - ! also make sure we're not outside the bounds. we should probably throw an error here, but I'm just going to go with the closest grid point. + ! also make sure we're not outside the bounds !------------------------------------------------------------------------------------------------- - DO i=1,size(p%n) + DO i=1,size(p%n) IF (Indx_Lo(i) <= 0) THEN Indx_Lo(i) = 1 - CALL SetErrStat(ErrID_Fatal,'Outside the grid bounds.',ErrStat,ErrMsg,RoutineName) !BJJ: check that this isn't too restrictive, especially in time + CALL SetErrStat(ErrID_Fatal,'Outside the grid bounds.',ErrStat,ErrMsg,RoutineName) !error out if x,y,z, or time is outside the lower bounds RETURN ELSEIF (Indx_Lo(i) >= p%n(i) ) THEN Indx_Lo(i) = max( p%n(i) - 1, 1 ) ! make sure it's a valid index + CALL SetErrStat(ErrID_Fatal,'Outside the grid bounds.',ErrStat,ErrMsg,RoutineName) !error out if x,y,z, or time is outside the upper bounds + RETURN END IF Indx_Hi(i) = min( Indx_Lo(i) + 1, p%n(i) ) ! make sure it's a valid index END DO diff --git a/modules/inflowwind/src/IfW_BladedFFWind.f90 b/modules/inflowwind/src/IfW_BladedFFWind.f90 index 620d387016..7f8998fbc2 100644 --- a/modules/inflowwind/src/IfW_BladedFFWind.f90 +++ b/modules/inflowwind/src/IfW_BladedFFWind.f90 @@ -253,6 +253,13 @@ SUBROUTINE ReadFiles(InitInp, FF_InitInp, InitOut, ParamData, TI, ErrStat, ErrMs BinFileName = TRIM(PriPath)//TRIM(BinFileName) end if + IF ( InitInp%FixedWindFileRootName ) THEN ! .TRUE. when FAST.Farm uses multiple instances of InflowWind for ambient wind data + IF ( InitInp%TurbineID == 0 ) THEN ! .TRUE. for the FAST.Farm low-resolution domain + BinFileName = TRIM(BinFileName)//TRIM(PathSep)//'Low' + ELSE ! FAST.Farm high-resolution domain(s) + BinFileName = TRIM(BinFileName)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(InitInp%TurbineID)) + ENDIF + ENDIF ! default values for Bladed Format CWise = .false. diff --git a/modules/inflowwind/src/IfW_BladedFFWind.txt b/modules/inflowwind/src/IfW_BladedFFWind.txt index 0893b0527c..76a57b1b5f 100644 --- a/modules/inflowwind/src/IfW_BladedFFWind.txt +++ b/modules/inflowwind/src/IfW_BladedFFWind.txt @@ -17,6 +17,8 @@ typedef IfW_BladedFFWind/IfW_BladedFFWind InitInputType CHARACTER(1024) typedef ^ ^ Logical TowerFileExist - - - "Tower file exists" - typedef ^ ^ IntKi SumFileUnit - - - "Unit number for the summary file (-1 for none). Provided by IfW." - typedef ^ ^ Logical NativeBladedFmt - - - "Whether this is native Bladed (needs wind profile and TI scaling) or not" - +typedef ^ ^ IntKi TurbineID - 0 - "Wind turbine ID number in the fixed (DEFAULT) file name when FixedWindFileRootName = .TRUE. (used by FAST.Farm)" - +typedef ^ ^ LOGICAL FixedWindFileRootName - .FALSE. - "Do the wind data files have a fixed (DEFAULT) file name? (used by FAST.Farm)" - #typedef ^ ^ IfW_FFWind_InitInputType FF - - - "scaling data (provided for native Bladed format)" - diff --git a/modules/inflowwind/src/IfW_BladedFFWind_Types.f90 b/modules/inflowwind/src/IfW_BladedFFWind_Types.f90 index 6c38d1b100..2b6c032c89 100644 --- a/modules/inflowwind/src/IfW_BladedFFWind_Types.f90 +++ b/modules/inflowwind/src/IfW_BladedFFWind_Types.f90 @@ -40,6 +40,8 @@ MODULE IfW_BladedFFWind_Types LOGICAL :: TowerFileExist !< Tower file exists [-] INTEGER(IntKi) :: SumFileUnit !< Unit number for the summary file (-1 for none). Provided by IfW. [-] LOGICAL :: NativeBladedFmt !< Whether this is native Bladed (needs wind profile and TI scaling) or not [-] + INTEGER(IntKi) :: TurbineID = 0 !< Wind turbine ID number in the fixed (DEFAULT) file name when FixedWindFileRootName = .TRUE. (used by FAST.Farm) [-] + LOGICAL :: FixedWindFileRootName = .FALSE. !< Do the wind data files have a fixed (DEFAULT) file name? (used by FAST.Farm) [-] END TYPE IfW_BladedFFWind_InitInputType ! ======================= ! ========= IfW_BladedFFWind_InitOutputType ======= @@ -80,6 +82,8 @@ SUBROUTINE IfW_BladedFFWind_CopyInitInput( SrcInitInputData, DstInitInputData, C DstInitInputData%TowerFileExist = SrcInitInputData%TowerFileExist DstInitInputData%SumFileUnit = SrcInitInputData%SumFileUnit DstInitInputData%NativeBladedFmt = SrcInitInputData%NativeBladedFmt + DstInitInputData%TurbineID = SrcInitInputData%TurbineID + DstInitInputData%FixedWindFileRootName = SrcInitInputData%FixedWindFileRootName END SUBROUTINE IfW_BladedFFWind_CopyInitInput SUBROUTINE IfW_BladedFFWind_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) @@ -132,6 +136,8 @@ SUBROUTINE IfW_BladedFFWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, E Int_BufSz = Int_BufSz + 1 ! TowerFileExist Int_BufSz = Int_BufSz + 1 ! SumFileUnit Int_BufSz = Int_BufSz + 1 ! NativeBladedFmt + Int_BufSz = Int_BufSz + 1 ! TurbineID + Int_BufSz = Int_BufSz + 1 ! FixedWindFileRootName IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -169,6 +175,10 @@ SUBROUTINE IfW_BladedFFWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, E Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%NativeBladedFmt, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TurbineID + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FixedWindFileRootName, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE IfW_BladedFFWind_PackInitInput SUBROUTINE IfW_BladedFFWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -208,6 +218,10 @@ SUBROUTINE IfW_BladedFFWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata Int_Xferred = Int_Xferred + 1 OutData%NativeBladedFmt = TRANSFER(IntKiBuf(Int_Xferred), OutData%NativeBladedFmt) Int_Xferred = Int_Xferred + 1 + OutData%TurbineID = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%FixedWindFileRootName = TRANSFER(IntKiBuf(Int_Xferred), OutData%FixedWindFileRootName) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE IfW_BladedFFWind_UnPackInitInput SUBROUTINE IfW_BladedFFWind_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/inflowwind/src/InflowWind.f90 b/modules/inflowwind/src/InflowWind.f90 index 555afde4a2..e6f52fa10c 100644 --- a/modules/inflowwind/src/InflowWind.f90 +++ b/modules/inflowwind/src/InflowWind.f90 @@ -221,7 +221,8 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, ENDIF - CALL InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, InitInp%InputFileName, EchoFileName, TmpErrStat, TmpErrMsg ) + CALL InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, InitInp%InputFileName, EchoFileName, InitInp%FixedWindFileRootName, InitInp%TurbineID, TmpErrStat, TmpErrMsg ) + CALL SetErrStat(TmpErrStat,TmpErrMsg,ErrStat,ErrMsg,RoutineName) IF ( ErrStat >= AbortErrLev ) THEN CALL Cleanup() @@ -502,8 +503,18 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, ! Set InitInp information BladedFF_InitData%SumFileUnit = SumFileUnit + BladedFF_InitData%FixedWindFileRootName = InitInp%FixedWindFileRootName + BladedFF_InitData%TurbineID = InitInp%TurbineID if (InputFileData%WindType /= BladedFF_Shr_WindNumber) then + IF ( InitInp%FixedWindFileRootName ) THEN ! .TRUE. when FAST.Farm uses multiple instances of InflowWind for ambient wind data + IF ( InitInp%TurbineID == 0 ) THEN ! .TRUE. for the FAST.Farm low-resolution domain + InputFileData%BladedFF_FileName = TRIM(InputFileData%BladedFF_FileName)//TRIM(PathSep)//'Low' + ELSE ! FAST.Farm high-resolution domain(s) + InputFileData%BladedFF_FileName = TRIM(InputFileData%BladedFF_FileName)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(InitInp%TurbineID)) + ENDIF + ENDIF + BladedFF_InitData%WindFileName = TRIM(InputFileData%BladedFF_FileName)//'.wnd' BladedFF_InitData%TowerFileExist = InputFileData%BladedFF_TowerFile BladedFF_InitData%NativeBladedFmt = .false. diff --git a/modules/inflowwind/src/InflowWind.txt b/modules/inflowwind/src/InflowWind.txt index 98d21cb8d5..d00380ea4d 100644 --- a/modules/inflowwind/src/InflowWind.txt +++ b/modules/inflowwind/src/InflowWind.txt @@ -103,6 +103,8 @@ typedef ^ InitInputType CHARACTER(1024) InputFileNa typedef ^ ^ LOGICAL Linearize - .FALSE. - "Flag that tells this module if the glue code wants to linearize." - typedef ^ ^ LOGICAL Use4Dext - .FALSE. - "Flag that tells this module if an external module will pass it 4-D velocity grids." - typedef ^ ^ IntKi NumWindPoints - - - "Number of wind velocity points expected" - +typedef ^ ^ IntKi TurbineID - 0 - "Wind turbine ID number in the fixed (DEFAULT) file name when FixedWindFileRootName = .TRUE. (used by FAST.Farm)" - +typedef ^ ^ LOGICAL FixedWindFileRootName - .FALSE. - "Do the wind data files have a fixed (DEFAULT) file name? (used by FAST.Farm)" - typedef ^ ^ LOGICAL UseInputFile - .TRUE. - "Should we read everthing from an input file, or do we get it some other way" - typedef ^ ^ CHARACTER(1024) RootName - - - "RootName for writing output files" typedef ^ ^ FileInfoType PassedFileData - - - "If we don't use the input file, pass everything through this" - diff --git a/modules/inflowwind/src/InflowWind_Subs.f90 b/modules/inflowwind/src/InflowWind_Subs.f90 index 0cdb22e911..78b7b5d1b5 100644 --- a/modules/inflowwind/src/InflowWind_Subs.f90 +++ b/modules/inflowwind/src/InflowWind_Subs.f90 @@ -156,13 +156,15 @@ MODULE InflowWind_Subs !==================================================================================================== !> This public subroutine parses the array of strings in InputFileData for the input parameters. -SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, InputFileName, EchoFileName, ErrStat, ErrMsg ) +SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, InputFileName, EchoFileName, FixedWindFileRootName, TurbineID, ErrStat, ErrMsg ) !---------------------------------------------------------------------------------------------------- IMPLICIT NONE CHARACTER(*), PARAMETER :: RoutineName="InflowWind_ParseInputFileInfo" ! Passed variables + LOGICAL, INTENT(IN ) :: FixedWindFileRootName!< Do the wind data files have a fixed (DEFAULT) file name? (used by FAST.Farm) + INTEGER(IntKi), INTENT(IN ) :: TurbineID !< Wind turbine ID number in the fixed (DEFAULT) file name when FixedWindFileRootName = .TRUE. (used by FAST.Farm) TYPE(InflowWind_InputFile), INTENT(INOUT) :: InputFileData !< Data of the InflowWind Input File TYPE(FileInfoType), INTENT(IN ) :: InFileInfo !< The derived type for holding the file information CHARACTER(*), INTENT(IN ) :: PriPath !< Path to InflowWind input files @@ -290,6 +292,13 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) if (Failed()) return IF ( PathIsRelative( InputFileData%Uniform_FileName ) ) InputFileData%Uniform_FileName = TRIM(PriPath)//TRIM(InputFileData%Uniform_FileName) + IF ( FixedWindFileRootName ) THEN ! .TRUE. when FAST.Farm uses multiple instances of InflowWind for ambient wind data + IF ( TurbineID == 0 ) THEN ! .TRUE. for the FAST.Farm low-resolution domain + InputFileData%Uniform_FileName = TRIM(InputFileData%Uniform_FileName)//TRIM(PathSep)//'Low.dat' + ELSE ! FAST.Farm high-resolution domain(s) + InputFileData%Uniform_FileName = TRIM(InputFileData%Uniform_FileName)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(TurbineID))//'.dat' + ENDIF + ENDIF CALL ParseVar( InFileInfo, CurLine, "RefHt_Uni", InputFileData%Uniform_RefHt, TmpErrStat, TmpErrMsg, UnEc ) CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) @@ -308,6 +317,13 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) if (Failed()) return IF ( PathIsRelative( InputFileData%TSFF_FileName ) ) InputFileData%TSFF_FileName = TRIM(PriPath)//TRIM(InputFileData%TSFF_FileName) + IF ( FixedWindFileRootName ) THEN ! .TRUE. when FAST.Farm uses multiple instances of InflowWind for ambient wind data + IF ( TurbineID == 0 ) THEN ! .TRUE. for the FAST.Farm low-resolution domain + InputFileData%TSFF_FileName = TRIM(InputFileData%TSFF_FileName)//TRIM(PathSep)//'Low.bts' + ELSE ! FAST.Farm high-resolution domain(s) + InputFileData%TSFF_FileName = TRIM(InputFileData%TSFF_FileName)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(TurbineID))//'.bts' + ENDIF + ENDIF !------------------------------------------------------------------------------------------------- !> Read the _Parameters for Binary Bladed-style Full-Field files [used only for WindType = 4]_ section @@ -361,7 +377,19 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) if (Failed()) return IF ( PathIsRelative( InputFileData%HAWC_FileName_w ) ) InputFileData%HAWC_FileName_w = TRIM(PriPath)//TRIM(InputFileData%HAWC_FileName_w) - + + IF ( FixedWindFileRootName ) THEN ! .TRUE. when FAST.Farm uses multiple instances of InflowWind for ambient wind data + IF ( TurbineID == 0 ) THEN ! .TRUE. for the FAST.Farm low-resolution domain + InputFileData%HAWC_FileName_u = TRIM(InputFileData%HAWC_FileName_u)//TRIM(PathSep)//'Low_u.bin' + InputFileData%HAWC_FileName_v = TRIM(InputFileData%HAWC_FileName_v)//TRIM(PathSep)//'Low_v.bin' + InputFileData%HAWC_FileName_w = TRIM(InputFileData%HAWC_FileName_w)//TRIM(PathSep)//'Low_w.bin' + ELSE ! FAST.Farm high-resolution domain(s) + InputFileData%HAWC_FileName_u = TRIM(InputFileData%HAWC_FileName_u)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(TurbineID))//'_u.bin' + InputFileData%HAWC_FileName_v = TRIM(InputFileData%HAWC_FileName_v)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(TurbineID))//'_v.bin' + InputFileData%HAWC_FileName_w = TRIM(InputFileData%HAWC_FileName_w)//TRIM(PathSep)//'HighT'//TRIM(Num2Lstr(TurbineID))//'_w.bin' + ENDIF + ENDIF + CALL ParseVar( InFileInfo, CurLine, "nx", InputFileData%HAWC_nx, TmpErrStat, TmpErrMsg, UnEc ) CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) if (Failed()) return @@ -1446,7 +1474,7 @@ SUBROUTINE CalculateOutput( Time, InputData, p, x, xd, z, OtherStates, y, m, Fil ENDDO ENDIF - + !--------------------------------- ! diff --git a/modules/inflowwind/src/InflowWind_Types.f90 b/modules/inflowwind/src/InflowWind_Types.f90 index a3f726ff6d..8ed4bd6b2c 100644 --- a/modules/inflowwind/src/InflowWind_Types.f90 +++ b/modules/inflowwind/src/InflowWind_Types.f90 @@ -120,6 +120,8 @@ MODULE InflowWind_Types LOGICAL :: Linearize = .FALSE. !< Flag that tells this module if the glue code wants to linearize. [-] LOGICAL :: Use4Dext = .FALSE. !< Flag that tells this module if an external module will pass it 4-D velocity grids. [-] INTEGER(IntKi) :: NumWindPoints !< Number of wind velocity points expected [-] + INTEGER(IntKi) :: TurbineID = 0 !< Wind turbine ID number in the fixed (DEFAULT) file name when FixedWindFileRootName = .TRUE. (used by FAST.Farm) [-] + LOGICAL :: FixedWindFileRootName = .FALSE. !< Do the wind data files have a fixed (DEFAULT) file name? (used by FAST.Farm) [-] LOGICAL :: UseInputFile = .TRUE. !< Should we read everthing from an input file, or do we get it some other way [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] TYPE(FileInfoType) :: PassedFileData !< If we don't use the input file, pass everything through this [-] @@ -1152,6 +1154,8 @@ SUBROUTINE InflowWind_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCod DstInitInputData%Linearize = SrcInitInputData%Linearize DstInitInputData%Use4Dext = SrcInitInputData%Use4Dext DstInitInputData%NumWindPoints = SrcInitInputData%NumWindPoints + DstInitInputData%TurbineID = SrcInitInputData%TurbineID + DstInitInputData%FixedWindFileRootName = SrcInitInputData%FixedWindFileRootName DstInitInputData%UseInputFile = SrcInitInputData%UseInputFile DstInitInputData%RootName = SrcInitInputData%RootName CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedFileData, DstInitInputData%PassedFileData, CtrlCode, ErrStat2, ErrMsg2 ) @@ -1223,6 +1227,8 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat Int_BufSz = Int_BufSz + 1 ! Linearize Int_BufSz = Int_BufSz + 1 ! Use4Dext Int_BufSz = Int_BufSz + 1 ! NumWindPoints + Int_BufSz = Int_BufSz + 1 ! TurbineID + Int_BufSz = Int_BufSz + 1 ! FixedWindFileRootName Int_BufSz = Int_BufSz + 1 ! UseInputFile Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName ! Allocate buffers for subtypes, if any (we'll get sizes from these) @@ -1332,6 +1338,10 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumWindPoints Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TurbineID + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%FixedWindFileRootName, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%UseInputFile, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 DO I = 1, LEN(InData%RootName) @@ -1490,6 +1500,10 @@ SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS Int_Xferred = Int_Xferred + 1 OutData%NumWindPoints = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 + OutData%TurbineID = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%FixedWindFileRootName = TRANSFER(IntKiBuf(Int_Xferred), OutData%FixedWindFileRootName) + Int_Xferred = Int_Xferred + 1 OutData%UseInputFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseInputFile) Int_Xferred = Int_Xferred + 1 DO I = 1, LEN(OutData%RootName) diff --git a/modules/inflowwind/tests/test_bladed_wind.F90 b/modules/inflowwind/tests/test_bladed_wind.F90 index fe9755d8aa..5dd860e139 100644 --- a/modules/inflowwind/tests/test_bladed_wind.F90 +++ b/modules/inflowwind/tests/test_bladed_wind.F90 @@ -24,7 +24,7 @@ subroutine test_bladed_wind_input() PriPath = "" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(trim(expected), InputFileData%BladedFF_FileName) diff --git a/modules/inflowwind/tests/test_hawc_wind.F90 b/modules/inflowwind/tests/test_hawc_wind.F90 index 158cda1d00..2e2e1a0b7c 100644 --- a/modules/inflowwind/tests/test_hawc_wind.F90 +++ b/modules/inflowwind/tests/test_hawc_wind.F90 @@ -28,7 +28,7 @@ subroutine test_hawc_wind_input() expected_fnw = "wasp\Output\basic_5w.bin" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') diff --git a/modules/inflowwind/tests/test_outputs.F90 b/modules/inflowwind/tests/test_outputs.F90 index d2e403dd4d..3a89f57598 100644 --- a/modules/inflowwind/tests/test_outputs.F90 +++ b/modules/inflowwind/tests/test_outputs.F90 @@ -21,7 +21,7 @@ subroutine test_outputs_parsing() PriPath = "" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(.FALSE., InputFileData%SumPrint) @@ -50,7 +50,7 @@ subroutine test_outputs_parsing_alternate() '"Wind1VelX,Wind1VelY" - Wind velocity at point WindVxiList(1),WindVyiList(1),WindVziList(1). X, Y, and Z direction components. ' & /) - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(.TRUE., InputFileData%SumPrint) diff --git a/modules/inflowwind/tests/test_steady_wind.F90 b/modules/inflowwind/tests/test_steady_wind.F90 index 1917ae94fd..3f6def1a54 100644 --- a/modules/inflowwind/tests/test_steady_wind.F90 +++ b/modules/inflowwind/tests/test_steady_wind.F90 @@ -21,7 +21,7 @@ subroutine test_steady_wind_input_single_height() PriPath = "" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(1, InputFileData%WindType) @@ -50,7 +50,7 @@ subroutine test_steady_wind_input_mult_heights() ' 80,100 WindVziList - List of coordinates in the inertial Z direction (m) ' & /) - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(1, InputFileData%WindType) diff --git a/modules/inflowwind/tests/test_turbsim_wind.F90 b/modules/inflowwind/tests/test_turbsim_wind.F90 index e56df74c74..854b8497f4 100644 --- a/modules/inflowwind/tests/test_turbsim_wind.F90 +++ b/modules/inflowwind/tests/test_turbsim_wind.F90 @@ -24,7 +24,7 @@ subroutine test_steady_wind_input_single_height() PriPath = "" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(trim(expected), InputFileData%TSFF_FileName) diff --git a/modules/inflowwind/tests/test_uniform_wind.F90 b/modules/inflowwind/tests/test_uniform_wind.F90 index ced5f198c8..f5525cfb7e 100644 --- a/modules/inflowwind/tests/test_uniform_wind.F90 +++ b/modules/inflowwind/tests/test_uniform_wind.F90 @@ -25,7 +25,7 @@ subroutine test_uniform_wind_input() PriPath = "" InFileInfo = getInputFileData() - CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", TmpErrStat, TmpErrMsg) + CALL InflowWind_ParseInputFileInfo(InputFileData , InFileInfo, PriPath, "inputFile.inp", "test.ech", .false., -1, TmpErrStat, TmpErrMsg) @assertEqual(0, TmpErrStat, message='Error message: '//trim(TmpErrMsg)//NewLine//'ErrStat: ') @assertEqual(trim(expected), InputFileData%Uniform_FileName) diff --git a/modules/map/src/MAP_Registry.txt b/modules/map/src/MAP_Registry.txt index 705ad34c04..316376a55b 100644 --- a/modules/map/src/MAP_Registry.txt +++ b/modules/map/src/MAP_Registry.txt @@ -16,9 +16,9 @@ include Registry_NWTC_Library.txt usefrom MAP_Fortran_Registry.txt ## ============================== Define input types here: ============================================================================================================================================ -typedef MAP InitInputType DbKi gravity - -999.9 - "gravity constant" "[m/s^2]" -typedef ^ ^ DbKi sea_density - -999.9 - "sea density" "[kg/m^3]" -typedef ^ ^ DbKi depth - -999.9 - "depth of water" "[m]" +typedef MAP InitInputType R8Ki gravity - -999.9 - "gravity constant" "[m/s^2]" +typedef ^ ^ R8Ki sea_density - -999.9 - "sea density" "[kg/m^3]" +typedef ^ ^ R8Ki depth - -999.9 - "depth of water" "[m]" typedef ^ ^ CHARACTER(255) file_name - "" - "MAP input file" typedef ^ ^ CHARACTER(255) summary_file_name - "" - "MAP summary file name" typedef ^ ^ CHARACTER(255) library_input_str - "" - "cable library string information (from input file)" @@ -36,122 +36,68 @@ typedef ^ ^ ProgDesc Ver typedef ^ ^ Lin_InitOutputType LinInitOut - - - "Init Output linearization data (fortran-only)" - ## ============================== Define Continuous states here: ===================================================================================================================================== -typedef ^ ContinuousStateType DbKI dummy - - - "Remove this variable if you have continuous states" - +typedef ^ ContinuousStateType R8Ki dummy - - - "Remove this variable if you have continuous states" - ## ============================== Define Discrete states here: ===================================================================================================================================== -typedef ^ DiscreteStateType DbKi dummy - - - "Remove this variable if you have discrete states" - +typedef ^ DiscreteStateType R8Ki dummy - - - "Remove this variable if you have discrete states" - ## ============================== Define Other states here: ===================================================================================================================================== -typedef ^ OtherStateType DbKi H {:} - - "horizontal line force" "[N]" -typedef ^ ^ DbKi V {:} - - "Vertical line force" "[N]" -typedef ^ ^ DbKi Ha {:} - - "horizontal line force at anchor" "[N]" -typedef ^ ^ DbKi Va {:} - - "Vertical line force at anchor" "[N]" -typedef ^ ^ DbKi x {:} - - "x fairlead line position" "[m]" -typedef ^ ^ DbKi y {:} - - "y fairlead line position" "[m]" -typedef ^ ^ DbKi z {:} - - "z fairlead line position" "[m]" -typedef ^ ^ DbKi xa {:} - - "x fairlead line position at anchor" "[m]" -typedef ^ ^ DbKi ya {:} - - "y fairlead line position at anchor" "[m]" -typedef ^ ^ DbKi za {:} - - "z fairlead line position at anchor" "[m]" -typedef ^ ^ DbKi Fx_connect {:} - - "horizontal x line force at connect node" "[N]" -typedef ^ ^ DbKi Fy_connect {:} - - "horizontal y line force at connect node" "[N]" -typedef ^ ^ DbKi Fz_connect {:} - - "vertical z line force at connect node" "[N]" -typedef ^ ^ DbKi Fx_anchor {:} - - "horizontal x line force at connect node" "[N]" -typedef ^ ^ DbKi Fy_anchor {:} - - "horizontal y line force at connect node" "[N]" -typedef ^ ^ DbKi Fz_anchor {:} - - "vertical z line force at connect node" "[N]" +typedef ^ OtherStateType R8Ki H {:} - - "horizontal line force" "[N]" +typedef ^ ^ R8Ki V {:} - - "Vertical line force" "[N]" +typedef ^ ^ R8Ki Ha {:} - - "horizontal line force at anchor" "[N]" +typedef ^ ^ R8Ki Va {:} - - "Vertical line force at anchor" "[N]" +typedef ^ ^ R8Ki x {:} - - "x fairlead line position" "[m]" +typedef ^ ^ R8Ki y {:} - - "y fairlead line position" "[m]" +typedef ^ ^ R8Ki z {:} - - "z fairlead line position" "[m]" +typedef ^ ^ R8Ki xa {:} - - "x fairlead line position at anchor" "[m]" +typedef ^ ^ R8Ki ya {:} - - "y fairlead line position at anchor" "[m]" +typedef ^ ^ R8Ki za {:} - - "z fairlead line position at anchor" "[m]" +typedef ^ ^ R8Ki Fx_connect {:} - - "horizontal x line force at connect node" "[N]" +typedef ^ ^ R8Ki Fy_connect {:} - - "horizontal y line force at connect node" "[N]" +typedef ^ ^ R8Ki Fz_connect {:} - - "vertical z line force at connect node" "[N]" +typedef ^ ^ R8Ki Fx_anchor {:} - - "horizontal x line force at connect node" "[N]" +typedef ^ ^ R8Ki Fy_anchor {:} - - "horizontal y line force at connect node" "[N]" +typedef ^ ^ R8Ki Fz_anchor {:} - - "vertical z line force at connect node" "[N]" ## ============================== Define constraint states here: ===================================================================================================================================== -typedef ^ ConstraintStateType DbKi H {:} - - "horizontal line force" "[N]" -typedef ^ ^ DbKi V {:} - - "Vertical line force" "[N]" -typedef ^ ^ DbKi x {:} - - "fairlead x displacement" "[m]" -typedef ^ ^ DbKi y {:} - - "fairlead y displacement" "[m]" -typedef ^ ^ DbKi z {:} - - "fairlead z displacement" "[m]" +typedef ^ ConstraintStateType R8Ki H {:} - - "horizontal line force" "[N]" +typedef ^ ^ R8Ki V {:} - - "Vertical line force" "[N]" +typedef ^ ^ R8Ki x {:} - - "fairlead x displacement" "[m]" +typedef ^ ^ R8Ki y {:} - - "fairlead y displacement" "[m]" +typedef ^ ^ R8Ki z {:} - - "fairlead z displacement" "[m]" ## ============================== Parameters ============================================================================================================================================ -typedef ^ ParameterType DbKi g - - - "gravitational constant" "[kg/m^2]" -typedef ^ ^ DbKi depth - - - "distance to seabed" "[m]" -typedef ^ ^ DbKi rho_sea - - - "density of seawater" "[m]" -typedef ^ ^ DbKi dt - - - "time step coupling interval" "[sec]" -#typedef ^ ^ DbKi Lu - - - "unstretched cable length" "[m]" -#typedef ^ ^ DbKi EA - - - "Axial stiffness" "[N]" -#typedef ^ ^ DbKi diam - - - "cable diameter" "[m]" -#typedef ^ ^ DbKi cb - - - "cable/seabed friction coefficient" -#typedef ^ ^ DbKi mu - - - "cable mass denity" "[kg/m]" +typedef ^ ParameterType R8Ki g - - - "gravitational constant" "[kg/m^2]" +typedef ^ ^ R8Ki depth - - - "distance to seabed" "[m]" +typedef ^ ^ R8Ki rho_sea - - - "density of seawater" "[m]" +typedef ^ ^ R8Ki dt - - - "time step coupling interval" "[sec]" +#typedef ^ ^ R8Ki Lu - - - "unstretched cable length" "[m]" +#typedef ^ ^ R8Ki EA - - - "Axial stiffness" "[N]" +#typedef ^ ^ R8Ki diam - - - "cable diameter" "[m]" +#typedef ^ ^ R8Ki cb - - - "cable/seabed friction coefficient" +#typedef ^ ^ R8Ki mu - - - "cable mass denity" "[kg/m]" typedef ^ ^ CHARACTER(255) InputLines {500} - - "input file line for restart" typedef ^ ^ CHARACTER(1) InputLineType {500} - - "input file line type for restart" typedef ^ ^ INTEGER numOuts - 0 - "Number of write outputs" - -typedef ^ ^ Lin_ParamType LinParams - - - "Parameter linearization data (fortran-only)" - +typedef ^ ^ Lin_ParamType LinParams - - - "Parameter linearization data (fortran-only)" - # ============================== Inputs ============================================================================================================================================ -typedef ^ InputType DbKi x {:} - - "fairlead x displacement" "[m]" -typedef ^ ^ DbKi y {:} - - "fairlead y displacement" "[m]" -typedef ^ ^ DbKi z {:} - - "fairlead z displacement" "[m]" +typedef ^ InputType R8Ki x {:} - - "fairlead x displacement" "[m]" +typedef ^ ^ R8Ki y {:} - - "fairlead y displacement" "[m]" +typedef ^ ^ R8Ki z {:} - - "fairlead z displacement" "[m]" typedef ^ ^ MeshType PtFairDisplacement - - - "position of each fairlead in X,Y,Z" "[m]" ## ============================== Outputs ============================================================================================================================================ -typedef ^ OutputType DbKi Fx {:} - - "horizontal line force" "[N]" -typedef ^ ^ DbKi Fy {:} - - "Vertical line force" "[N]" -typedef ^ ^ DbKi Fz {:} - - "horizontal line force at anchor" "[N]" +typedef ^ OutputType R8Ki Fx {:} - - "horizontal line force" "[N]" +typedef ^ ^ R8Ki Fy {:} - - "Vertical line force" "[N]" +typedef ^ ^ R8Ki Fz {:} - - "horizontal line force at anchor" "[N]" typedef ^ ^ ReKi WriteOutput {:} - - "outpur vector" "" -typedef ^ ^ DbKi wrtOutput {:} - - "outpur vector" "" +typedef ^ ^ R8Ki wrtOutput {:} - - "outpur vector" "" typedef ^ ^ MeshType ptFairleadLoad - - - "point mesh for forces in X,Y,Z" "[N]" -##################################################################################################################################### -## These are not necessary to define in the Registry, but are here to generate blank types until we do actually implement the -## Jacobians in the FAST framework. In the final implementation, they will probably not contain subtypes, but instead be -## square matrices of type ReKi or DbKi. -e##################################################################################################################################### -## ..... Jacobians ................................................................................................................. -## Define the Jacobian of the output equations (Y) with respect to the inputs (u), dY/du (or Partial Y / Partial u): -#typedef ^ SD_PartialOutputPInputType SD_InputType DummyOutput - - - "If you have output equations and input data, update this variable" - -# -## Define the Jacobian of the output equations (Y) with respect to the inputs (u), dY/du (or Partial Y / Partial u): -#typedef ^ SD_PartialContStatePInputType SD_InputType DummyContState - - - "If you have continuous state equations and input data, update this variable" - -# -##Define the Jacobian of the discrete state equations (Xd) with respect to the inputs (u), dXd/du (or Partial Xd / Partial u): -#typedef ^ SD_PartialDiscStatePInputType SD_InputType DummyDiscState - - - "If you have discrete state equations and input data, update this variable" - -# -## Define the Jacobian of the constraint state equations (Z) with respect to the inputs (u), dZ/du (or Partial Z / Partial u): -#typedef ^ SD_PartialConstrStatePInputType SD_InputType DummyConstrState - - - "If you have constraint state equations and input data, update this variable" - -# -## Define the Jacobian of the output equations (Y) with respect to the continuous states (x), dY/dx (or Partial Y / Partial x): -#typedef ^ SD_PartialOutputPContStateType SD_ContinuousStateType DummyOutput - - - "If you have output equations and continuous states, update this variable" - -# -## Define the Jacobian of the continuous state equations (X) with respect to the continuous states (x), dX/dx (or Partial X / Partial x): -#typedef ^ SD_PartialContStatePContStateType SD_ContinuousStateType DummyContState - - - "If you have continuous state equations and continuous states, update this variable" - -# -## Define the Jacobian of the discrete state equations (Xd) with respect to the continuous states (x), dXd/dx (or Partial Xd / Partial x): -#typedef ^ SD_PartialDiscStatePContStateType SD_ContinuousStateType DummyDiscState - - - "If you have discrete state equations and continuous states, update this variable" - -# -## Define the Jacobian of the constraint state equations (Z) with respect to the continuous states (x), dZ/dx (or Partial Z / Partial x): -#typedef ^ SD_PartialConstrStatePContStateType SD_ContinuousStateType DummyConstrState - - - "If you have constraint state equations and continuous states, update this variable" - -# -## Define the Jacobian of the output equations (Y) with respect to the discrete states (xd), dY/dxd (or Partial Y / Partial xd): -#typedef ^ SD_PartialOutputPDiscStateType SD_DiscreteStateType DummyOutput - - - "If you have output equations and discrete states, update this variable" - -# -## Define the Jacobian of the continuous state equations (X) with respect to the discrete states (xd), dX/dxd (or Partial X / Partial xd): -#typedef ^ SD_PartialContStatePDiscStateType SD_DiscreteStateType DummyContState - - - "If you have continuous state equations and discrete states, update this variable" - -# -## Define the Jacobian of the discrete state equations (Xd) with respect to the discrete states (xd), dXd/dxd (or Partial Xd / Partial xd): -#typedef ^ SD_PartialDiscStatePDiscStateType SD_DiscreteStateType DummyDiscState - - - "If you have discrete state equations and discrete states, update this variable" - -# -## Define the Jacobian of the constraint state equations (Z) with respect to the discrete states (xd), dZ/dxd (or Partial Z / Partial xd): -#typedef ^ SD_PartialConstrStatePDiscStateType SD_DiscreteStateType DummyConstrState - - - "If you have constraint state equations and discrete states, update this variable" - -# -## Define the Jacobian of the output equations (Y) with respect to the constraint states (z), dY/dz (or Partial Y / Partial z): -#typedef ^ SD_PartialOutputPConstrStateType SD_ConstraintStateType DummyOutput - - - "If you have output equations and constraint states, update this variable" - -# -## Define the Jacobian of the continuous state equations (X) with respect to the constraint states (z), dX/dz (or Partial X / Partial z): -#typedef ^ SD_PartialContStatePConstrStateType SD_ConstraintStateType DummyContState - - - "If you have continuous state equations and constraint states, update this variable" - -# -## Define the Jacobian of the discrete state equations (Xd) with respect to the constraint states (z), dXd/dz (or Partial Xd / Partial z): -#typedef ^ SD_PartialDiscStatePConstrStateType SD_ConstraintStateType DummyDiscState - - - "If you have discrete state equations and constraint states, update this variable" - -# -## Define the Jacobian of the constraint state equations (Z) with respect to the constraint states (z), dZ/dz (or Partial Z / Partial z): -#typedef ^ SD_PartialConstrStatePConstrStateType SD_ConstraintStateType DummyConstrState - - - "If you have constraint state equations and constraint states, update this variable" - - diff --git a/modules/map/src/MAP_Types.f90 b/modules/map/src/MAP_Types.f90 index 1b15b8f331..af274d629f 100644 --- a/modules/map/src/MAP_Types.f90 +++ b/modules/map/src/MAP_Types.f90 @@ -50,9 +50,9 @@ MODULE MAP_Types END TYPE MAP_InitInputType_C TYPE, PUBLIC :: MAP_InitInputType TYPE( MAP_InitInputType_C ) :: C_obj - REAL(DbKi) :: gravity = -999.9 !< gravity constant [[m/s^2]] - REAL(DbKi) :: sea_density = -999.9 !< sea density [[kg/m^3]] - REAL(DbKi) :: depth = -999.9 !< depth of water [[m]] + REAL(R8Ki) :: gravity = -999.9 !< gravity constant [[m/s^2]] + REAL(R8Ki) :: sea_density = -999.9 !< sea density [[kg/m^3]] + REAL(R8Ki) :: depth = -999.9 !< depth of water [[m]] CHARACTER(255) :: file_name !< MAP input file [-] CHARACTER(255) :: summary_file_name !< MAP summary file name [-] CHARACTER(255) :: library_input_str !< cable library string information (from input file) [-] @@ -91,7 +91,7 @@ MODULE MAP_Types END TYPE MAP_ContinuousStateType_C TYPE, PUBLIC :: MAP_ContinuousStateType TYPE( MAP_ContinuousStateType_C ) :: C_obj - REAL(DbKi) :: dummy !< Remove this variable if you have continuous states [-] + REAL(R8Ki) :: dummy !< Remove this variable if you have continuous states [-] END TYPE MAP_ContinuousStateType ! ======================= ! ========= MAP_DiscreteStateType_C ======= @@ -101,7 +101,7 @@ MODULE MAP_Types END TYPE MAP_DiscreteStateType_C TYPE, PUBLIC :: MAP_DiscreteStateType TYPE( MAP_DiscreteStateType_C ) :: C_obj - REAL(DbKi) :: dummy !< Remove this variable if you have discrete states [-] + REAL(R8Ki) :: dummy !< Remove this variable if you have discrete states [-] END TYPE MAP_DiscreteStateType ! ======================= ! ========= MAP_OtherStateType_C ======= @@ -194,10 +194,10 @@ MODULE MAP_Types END TYPE MAP_ParameterType_C TYPE, PUBLIC :: MAP_ParameterType TYPE( MAP_ParameterType_C ) :: C_obj - REAL(DbKi) :: g !< gravitational constant [[kg/m^2]] - REAL(DbKi) :: depth !< distance to seabed [[m]] - REAL(DbKi) :: rho_sea !< density of seawater [[m]] - REAL(DbKi) :: dt !< time step coupling interval [[sec]] + REAL(R8Ki) :: g !< gravitational constant [[kg/m^2]] + REAL(R8Ki) :: depth !< distance to seabed [[m]] + REAL(R8Ki) :: rho_sea !< density of seawater [[m]] + REAL(R8Ki) :: dt !< time step coupling interval [[sec]] CHARACTER(255) , DIMENSION(1:500) :: InputLines !< input file line for restart [-] CHARACTER(1) , DIMENSION(1:500) :: InputLineType !< input file line type for restart [-] INTEGER(IntKi) :: numOuts = 0 !< Number of write outputs [-] @@ -475,13 +475,13 @@ SUBROUTINE MAP_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%gravity = DbKiBuf(Db_Xferred) + OutData%gravity = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%gravity = OutData%gravity - OutData%sea_density = DbKiBuf(Db_Xferred) + OutData%sea_density = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%sea_density = OutData%sea_density - OutData%depth = DbKiBuf(Db_Xferred) + OutData%depth = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%depth = OutData%depth DO I = 1, LEN(OutData%file_name) @@ -1224,7 +1224,7 @@ SUBROUTINE MAP_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%dummy = DbKiBuf(Db_Xferred) + OutData%dummy = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%dummy = OutData%dummy END SUBROUTINE MAP_UnPackContState @@ -1389,7 +1389,7 @@ SUBROUTINE MAP_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%dummy = DbKiBuf(Db_Xferred) + OutData%dummy = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%dummy = OutData%dummy END SUBROUTINE MAP_UnPackDiscState @@ -3699,16 +3699,16 @@ SUBROUTINE MAP_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%g = DbKiBuf(Db_Xferred) + OutData%g = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%g = OutData%g - OutData%depth = DbKiBuf(Db_Xferred) + OutData%depth = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%depth = OutData%depth - OutData%rho_sea = DbKiBuf(Db_Xferred) + OutData%rho_sea = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%rho_sea = OutData%rho_sea - OutData%dt = DbKiBuf(Db_Xferred) + OutData%dt = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 OutData%C_obj%dt = OutData%dt i1_l = LBOUND(OutData%InputLines,1) diff --git a/modules/nwtc-library/CMakeLists.txt b/modules/nwtc-library/CMakeLists.txt index 4630e604ef..7bf80a9b3c 100644 --- a/modules/nwtc-library/CMakeLists.txt +++ b/modules/nwtc-library/CMakeLists.txt @@ -61,7 +61,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) set_source_files_properties(src/NetLib/slatec/NWTC_SLATEC.f90 PROPERTIES COMPILE_FLAGS -frecursive) set_source_files_properties(src/NetLib/slatec/dqk61.f PROPERTIES COMPILE_FLAGS -frecursive) set_source_files_properties(src/NetLib/slatec/qk61.f PROPERTIES COMPILE_FLAGS -frecursive) - elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "19") if (WIN32) set_source_files_properties(src/NetLib/slatec/NWTC_SLATEC.f90 PROPERTIES COMPILE_FLAGS "/recursive") @@ -93,7 +93,7 @@ if(BUILD_OPENFAST_SIMULINK_API) if (APPLE OR UNIX) if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") set(NWTC_SYS_FILE src/SysMatlabLinuxGnu.f90) - elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") set(NWTC_SYS_FILE src/SysMatlabLinuxIntel.f90) endif() elseif (WIN32) @@ -106,7 +106,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") elseif (APPLE OR UNIX OR CYGWIN) set(NWTC_SYS_FILE src/SysGnuLinux.f90) endif () -elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") +elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") if (APPLE OR UNIX) set(NWTC_SYS_FILE src/SysIFL.f90) elseif (WIN32) diff --git a/modules/nwtc-library/src/NWTC_Base.f90 b/modules/nwtc-library/src/NWTC_Base.f90 index bd3ff35b4f..dddf9b63fe 100644 --- a/modules/nwtc-library/src/NWTC_Base.f90 +++ b/modules/nwtc-library/src/NWTC_Base.f90 @@ -53,7 +53,7 @@ MODULE NWTC_Base INTEGER(IntKi) :: AbortErrLev = ErrID_Fatal !< ErrStat that indicates the error level when program should end; ErrID_Fatal by default. Note that this is not a PARAMETER - INTEGER(IntKi), PARAMETER :: NWTC_MAX_DLL_PROC = 3 !< maximum number of procedures that can be dynamically loaded from a DLL (see DLL_Type nwtc_base::dll_type) + INTEGER(IntKi), PARAMETER :: NWTC_MAX_DLL_PROC = 5 !< maximum number of procedures that can be dynamically loaded from a DLL (see DLL_Type nwtc_base::dll_type) !> Type definition for dynamically loaded libraries: diff --git a/modules/nwtc-library/src/NWTC_IO.f90 b/modules/nwtc-library/src/NWTC_IO.f90 index 3440ebed04..d7b454d5fe 100644 --- a/modules/nwtc-library/src/NWTC_IO.f90 +++ b/modules/nwtc-library/src/NWTC_IO.f90 @@ -2253,6 +2253,9 @@ END SUBROUTINE DLLTypeUnPack !======================================================================= !> SUBROUTINE DispCompileRuntimeInfo() +#ifdef _OPENMP + USE OMP_LIB +#endif #ifdef HAS_FORTRAN2008_FEATURES USE iso_fortran_env, ONLY: compiler_version #endif @@ -2285,6 +2288,15 @@ SUBROUTINE DispCompileRuntimeInfo() call wrscr(' - Compiler: '//trim(compiler_version_str)) CALL WrScr(' - Architecture: '//trim(architecture)) CALL WrScr(' - Precision: '//trim(compiled_precision)) +#ifdef _OPENMP + !$OMP PARALLEL default(shared) + if (omp_get_thread_num()==0) then + call WrScr(' - OpenMP: Yes, number of threads: '//trim(Num2LStr(omp_get_num_threads()))//'/'//trim(Num2LStr(omp_get_max_threads()))) + endif + !$OMP END PARALLEL +#else + call WrScr(' - OpenMP: No') +#endif CALL WrScr(' - Date: '//__DATE__) CALL WrScr(' - Time: '//__TIME__) ! call wrscr(' - Options: '//trim(compiler_options())) @@ -8436,7 +8448,7 @@ SUBROUTINE WrVTK_footer( Un ) CLOSE(Un) RETURN - END SUBROUTINE WrVTK_footer + END SUBROUTINE WrVTK_footer !======================================================================= !> This routine reads the header for a vtk, ascii, structured_points dataset file, @@ -8456,11 +8468,12 @@ SUBROUTINE ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel CHARACTER(*) , INTENT( OUT) :: ErrMsg !< message when error occurs INTEGER(IntKi) :: ErrStat2 ! local error level/status of OpenFOutFile operation - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local message when error occurs - CHARACTER(1024) :: Line, Line2 ! one line of the file + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local message when error occurs + CHARACTER(1024) :: Dummy1, Dummy2 + CHARACTER(1024) :: Line ! one line of the file CHARACTER(1024) :: formatLbl CHARACTER(*), PARAMETER :: RoutineName = 'ReadVTK_SP_info' - INTEGER(IntKi) :: sz, nPts + INTEGER(IntKi) :: sz, nPts, nArr, nums(2) LOGICAL :: closeOnReturn ErrStat = ErrID_None @@ -8573,26 +8586,57 @@ SUBROUTINE ReadVTK_SP_info( FileName, descr, dims, origin, gridSpacing, vecLabel if (ErrStat2 /= 0) then CALL SetErrStat( ErrID_Fatal, 'Error reading "nPts".', ErrStat, ErrMsg, RoutineName ) end if + IF ( nPts /= ( dims(1)*dims(2)*dims(3) ) ) THEN ! Abort if DIMENSIONS AND POINT_DATA don't agree + CALL SetErrStat( ErrID_Fatal, 'Invalid vtk structured_points file: POINT_DATA does not match DIMENSIONS', ErrStat, ErrMsg, RoutineName ) + END IF END IF - ! Vector Label + ! VECTOR or FIELD Label Line = "" - CALL ReadStr( Un, FileName, Line, "Vectors", "VECTORS label", ErrStat2, ErrMsg2 ) + CALL ReadStr( Un, FileName, Line, "VECTORS or FIELD", "VECTORS or FIELD label", ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) Line = trim(Line) - Line2 = Line - CALL Conv2UC( Line2 ) - IF ( INDEX(Line2, "VECTORS" ) /= 1 ) THEN ! If this line doesn't contain the word dataset, we have a bad file header - CALL SetErrStat( ErrID_Fatal, 'Invalid vtk structured_points file: did not find VECTORS label', ErrStat, ErrMsg, RoutineName ) + CALL Conv2UC( Line ) + IF ( ( INDEX(Line, "VECTORS" ) /= 1 ) .AND. ( INDEX(Line, "FIELD" ) /= 1 ) ) THEN + CALL SetErrStat( ErrID_Fatal, 'Invalid vtk structured_points file: did not find VECTORS or FIELD label', ErrStat, ErrMsg, RoutineName ) ELSE - sz = INDEX(Line2, "FLOAT" ) - IF ( sz == 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Invalid VECTORS datatype. Must be set to float.', ErrStat, ErrMsg, RoutineName ) - ELSE - vecLabel = Line(9:sz-2) + IF ( INDEX(Line, "FIELD" ) == 1 ) THEN ! Must be FIELD + READ(Line,*,IOSTAT=ErrStat2) Dummy1, Dummy2, nArr + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Error reading "nArr".', ErrStat, ErrMsg, RoutineName ) + ELSE IF ( nArr /= 1_IntKi ) THEN + CALL SetErrStat( ErrID_Fatal, 'Invalid vtk structured_points file: FIELD label must have only 1 array', ErrStat, ErrMsg, RoutineName ) + END IF + + Line = "" + CALL ReadStr( Un, FileName, Line, "Array", "Array definition", ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + Line = trim(Line) + Call Conv2UC( Line ) + sz = INDEX(Line, "FLOAT" ) + IF ( sz == 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Invalid FIELD datatype. Must be set to float.', ErrStat, ErrMsg, RoutineName ) + ELSE + READ(Line,*,IOSTAT=ErrStat2) Dummy1, nums + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Error reading "nums".', ErrStat, ErrMsg, RoutineName ) + ELSEIF ( nums(1) /= 3_IntKi ) THEN ! Abort if we don't have 3-element vectors + CALL SetErrStat( ErrID_Fatal, 'Invalid FIELD datatype. FIELD array must have 3 elements.', ErrStat, ErrMsg, RoutineName ) + ELSEIF ( nums(2) /= ( dims(1)*dims(2)*dims(3) ) ) THEN ! Abort if DIMENSIONS AND FIELD data don't agree + CALL SetErrStat( ErrID_Fatal, 'Invalid vtk structured_points file: FIELD array does not match DIMENSIONS', ErrStat, ErrMsg, RoutineName ) + END IF + END IF + ELSE ! Must be VECTORS + sz = INDEX(Line, "FLOAT" ) + IF ( sz == 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Invalid VECTORS datatype. Must be set to float.', ErrStat, ErrMsg, RoutineName ) + ELSE + vecLabel = Line(9:sz-2) + END IF END IF - END IF + END IF IF ( (ErrStat >= AbortErrLev) .or. closeOnReturn ) THEN close(Un) @@ -8607,26 +8651,26 @@ END SUBROUTINE ReadVTK_SP_info !> This routine reads the vector data for a vtk, ascii, structured_points dataset file, !! The Unit number of the file is already assumed to be valid via a previous call to !! ReadVTK_SP_info. - SUBROUTINE ReadVTK_SP_vectors( Un, dims, gridVals, ErrStat, ErrMsg ) + SUBROUTINE ReadVTK_SP_vectors( FileName, Un, dims, gridVals, ErrStat, ErrMsg ) + CHARACTER(*) , INTENT(IN ) :: FileName !< Name of output file INTEGER(IntKi) , INTENT(IN ) :: Un !< unit number of opened file INTEGER(IntKi) , INTENT(IN ) :: dims(3) !< dimension of the 3D grid (nX,nY,nZ) - REAL(ReKi) , INTENT( OUT) :: gridVals(:,:,:,:) !< 4D array of data, size (3,nX,nY,nZ), must be pre-allocated + REAL(SiKi) , INTENT( OUT) :: gridVals(:,:,:,:) !< 4D array of data, size (3,nX,nY,nZ), must be pre-allocated INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< error level/status of OpenFOutFile operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< message when error occurs - - INTEGER(IntKi) :: ErrStat2 ! local error level/status of OpenFOutFile operation - CHARACTER(*), PARAMETER :: RoutineName = 'ReadVTK_SP_vectors' + + INTEGER :: ErrStat2 ErrStat = ErrID_None ErrMsg = '' READ(Un,*, IOSTAT=ErrStat2) gridVals(1:3,1:dims(1),1:dims(2),1:dims(3)) + + close(Un) if (ErrStat2 /= 0) then - CALL SetErrStat( ErrID_Fatal, 'Error reading vector data.', ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( ErrID_Fatal, 'Invalid vtk file: '//trim(FileName)//'.', ErrStat, ErrMsg, 'ReadVTK_SP_vectors' ) end if - - close(Un) END SUBROUTINE ReadVTK_SP_vectors @@ -8654,7 +8698,6 @@ SUBROUTINE WrVTK_SP_header( FileName, descr, Un, ErrStat, ErrMsg ) END SUBROUTINE WrVTK_SP_header - SUBROUTINE WrVTK_SP_vectors3D( Un, dataDescr, dims, origin, gridSpacing, gridVals, ErrStat, ErrMsg ) INTEGER(IntKi) , INTENT(IN ) :: Un !< unit number of previously opened file (via call to WrVTK_SP_header) @@ -8662,7 +8705,7 @@ SUBROUTINE WrVTK_SP_vectors3D( Un, dataDescr, dims, origin, gridSpacing, gridVal INTEGER(IntKi) , INTENT(IN ) :: dims(3) !< dimension of the 3D grid (nX,nY,nZ) REAL(ReKi) , INTENT(IN ) :: origin(3) !< the lower-left corner of the 3D grid (X0,Y0,Z0) REAL(ReKi) , INTENT(IN ) :: gridSpacing(3) !< spacing between grid points in each of the 3 directions (dX,dY,dZ) - REAL(ReKi) , INTENT(IN ) :: gridVals(:,:,:,:) !< 3D array of data, size (nX,nY,nZ) + REAL(SiKi) , INTENT(IN ) :: gridVals(:,:,:,:) !< 3D array of data, size (nX,nY,nZ) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< error level/status of OpenFOutFile operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< message when error occurs diff --git a/modules/nwtc-library/src/SysMatlabLinuxGnu.f90 b/modules/nwtc-library/src/SysMatlabLinuxGnu.f90 index 7c2931c26a..f948f6cd3e 100644 --- a/modules/nwtc-library/src/SysMatlabLinuxGnu.f90 +++ b/modules/nwtc-library/src/SysMatlabLinuxGnu.f90 @@ -291,7 +291,7 @@ SUBROUTINE ProgExit ( StatCode ) END SUBROUTINE ProgExit ! ( StatCode ) !======================================================================= -SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf ) +SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf, NaN_S, Inf_S ) ! routine that sets the values of NaN_D, Inf_D, NaN, Inf (IEEE ! values for not-a-number and infinity in sindle and double @@ -302,30 +302,37 @@ SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf ) REAL(DbKi), INTENT(inout) :: Inf_D ! IEEE value for NaN (not-a-number) in double precision REAL(DbKi), INTENT(inout) :: NaN_D ! IEEE value for Inf (infinity) in double precision + REAL(ReKi), INTENT(inout) :: Inf ! IEEE value for NaN (not-a-number) REAL(ReKi), INTENT(inout) :: NaN ! IEEE value for Inf (infinity) - ! local variables for getting values of NaN and Inf (not necessary when using ieee_arithmetic) - REAL(DbKi) :: Neg_D ! a negative real(DbKi) number - REAL(ReKi) :: Neg ! a negative real(ReKi) number + REAL(SiKi), INTENT(inout) :: Inf_S ! IEEE value for NaN (not-a-number) in single precision + REAL(SiKi), INTENT(inout) :: NaN_S ! IEEE value for Inf (infinity) in single precision + + real(DbKi) :: Neg_D + real(SiKi) :: Neg_S + real(ReKi) :: Neg - ! if compiling with floating-point-exception traps, this will not work, so we've added a compiler directive. ! note that anything that refers to NaN or Inf will be incorrect in that case. #ifndef FPE_TRAP_ENABLED ! set variables to negative numbers to calculate NaNs (compilers may complain when taking sqrt of negative constants) Neg_D = -1.0_DbKi + Neg_S = -1.0_SiKi Neg = -1.0_ReKi NaN_D = SQRT ( Neg_D ) + NaN_S = SQRT ( Neg_S ) NaN = SQRT ( Neg ) ! set variables to zero to calculate Infs (using division by zero) Neg_D = 0.0_DbKi + Neg_S = 0.0_SiKi Neg = 0.0_ReKi Inf_D = 1.0_DbKi / Neg_D + Inf_S = 1.0_SiKi / Neg_S Inf = 1.0_ReKi / Neg #endif diff --git a/modules/nwtc-library/src/SysMatlabLinuxIntel.f90 b/modules/nwtc-library/src/SysMatlabLinuxIntel.f90 index cb66012814..6935a9ffaa 100644 --- a/modules/nwtc-library/src/SysMatlabLinuxIntel.f90 +++ b/modules/nwtc-library/src/SysMatlabLinuxIntel.f90 @@ -297,8 +297,8 @@ SUBROUTINE ProgExit ( StatCode ) END SUBROUTINE ProgExit ! ( StatCode ) !======================================================================= -SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf ) - +SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf, NaN_S, Inf_S ) + ! routine that sets the values of NaN_D, Inf_D, NaN, Inf (IEEE ! values for not-a-number and infinity in sindle and double ! precision) This uses standard F03 intrinsic routines, @@ -313,6 +313,9 @@ SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf ) REAL(ReKi), INTENT(inout) :: Inf ! IEEE value for NaN (not-a-number) REAL(ReKi), INTENT(inout) :: NaN ! IEEE value for Inf (infinity) + REAL(SiKi), INTENT(inout) :: Inf_S ! IEEE value for NaN (not-a-number) in single precision + REAL(SiKi), INTENT(inout) :: NaN_S ! IEEE value for Inf (infinity) in single precision + NaN_D = ieee_value(0.0_DbKi, ieee_quiet_nan) Inf_D = ieee_value(0.0_DbKi, ieee_positive_inf) @@ -320,6 +323,9 @@ SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf ) NaN = ieee_value(0.0_ReKi, ieee_quiet_nan) Inf = ieee_value(0.0_ReKi, ieee_positive_inf) + NaN_S = ieee_value(0.0_SiKi, ieee_quiet_nan) + Inf_S = ieee_value(0.0_SiKi, ieee_positive_inf) + END SUBROUTINE Set_IEEE_Constants !======================================================================= SUBROUTINE UsrAlarm diff --git a/modules/nwtc-library/src/SysMatlabWindows.f90 b/modules/nwtc-library/src/SysMatlabWindows.f90 index 8e73364b73..004a72ef30 100644 --- a/modules/nwtc-library/src/SysMatlabWindows.f90 +++ b/modules/nwtc-library/src/SysMatlabWindows.f90 @@ -27,30 +27,6 @@ MODULE SysSubs -<<<<<<< HEAD:modules/nwtc-library/src/SysMatlab.f90 - ! It contains the following routines: - - ! FUNCTION FileSize( Unit ) ! Returns the size (in bytes) of an open file. - ! SUBROUTINE FlushOut ( Unit ) - ! FUNCTION NWTC_ERF( x ) - ! FUNCTION NWTC_gamma( x ) - ! SUBROUTINE GET_CWD( DirName, Status ) - ! FUNCTION Is_NaN( DblNum ) ! Please use IEEE_IS_NAN() instead - ! FUNCTION NWTC_Gamma( x ) ! Returns the gamma value of its argument. - ! per MLB, this can be removed, but only if CU is OUTPUT_UNIT: - ! SUBROUTINE OpenCon ! Actually, it can't be removed until we get Intel's FLUSH working. (mlb) - ! SUBROUTINE OpenUnfInpBEFile ( Un, InFile, RecLen, Error ) - ! SUBROUTINE ProgExit ( StatCode ) - ! SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf, NaN_S, Inf_S ) - ! SUBROUTINE UsrAlarm - ! SUBROUTINE WrNR ( Str ) - ! SUBROUTINE WrOver ( Str ) - ! SUBROUTINE WriteScr ( Str, Frm ) - ! SUBROUTINE LoadDynamicLib( DLL, ErrStat, ErrMsg ) - ! SUBROUTINE FreeDynamicLib( DLL, ErrStat, ErrMsg ) - -======= ->>>>>>> upstream/master:modules/nwtc-library/src/SysMatlabWindows.f90 USE NWTC_Base @@ -363,12 +339,6 @@ SUBROUTINE Set_IEEE_Constants( NaN_D, Inf_D, NaN, Inf, NaN_S, Inf_S ) NaN_S = ieee_value(0.0_SiKi, ieee_quiet_nan) Inf_S = ieee_value(0.0_SiKi, ieee_positive_inf) - - NaN_D = ieee_value(0.0_DbKi, ieee_quiet_nan) - Inf_D = ieee_value(0.0_DbKi, ieee_positive_inf) - - NaN = ieee_value(0.0_ReKi, ieee_quiet_nan) - Inf = ieee_value(0.0_ReKi, ieee_positive_inf) END SUBROUTINE Set_IEEE_Constants !======================================================================= diff --git a/modules/nwtc-library/tests/NWTC_Library_test_tools.F90 b/modules/nwtc-library/tests/NWTC_Library_test_tools.F90 new file mode 100644 index 0000000000..01df14383a --- /dev/null +++ b/modules/nwtc-library/tests/NWTC_Library_test_tools.F90 @@ -0,0 +1,27 @@ +module nwtc_library_test_tools + +use NWTC_IO + +implicit none + +#ifdef _WIN32 + character(9), parameter :: nullfile="NUL" + character(11), parameter :: terminal="CON" +#else + character(9), parameter :: nullfile="/dev/null" + character(11), parameter :: terminal="/dev/stdout" +#endif + +integer, parameter :: stdout=CU + +contains + +subroutine hide_terminal_output() + open(unit=stdout, file=trim(nullfile)) +end subroutine + +subroutine show_terminal_output() + open(unit=stdout, file=terminal, status="old") +end subroutine + +end module diff --git a/modules/nwtc-library/tests/test_NWTC_IO_CheckArgs.F90 b/modules/nwtc-library/tests/test_NWTC_IO_CheckArgs.F90 index 1249751ea3..49b4d207e1 100644 --- a/modules/nwtc-library/tests/test_NWTC_IO_CheckArgs.F90 +++ b/modules/nwtc-library/tests/test_NWTC_IO_CheckArgs.F90 @@ -2,13 +2,10 @@ module test_NWTC_IO_CheckArgs use pFUnit_mod use NWTC_IO + use nwtc_library_test_tools implicit none - integer, parameter :: stdout=6 - character(9), parameter :: nullfile="/dev/null" - character(11), parameter :: terminal="/dev/stdout" - contains ! PASSING CASES @@ -31,9 +28,9 @@ subroutine test_input_file_user_specified() argument_array = (/ & "first_arg.txt " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -52,9 +49,9 @@ subroutine test_input_file_default() filename = "default.txt" allocate(argument_array(0)) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "default.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -74,9 +71,9 @@ subroutine test_input_file_default_user_specified() argument_array = (/ & "first_arg.txt " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -105,9 +102,9 @@ subroutine test_restart_flag1() "first_arg.txt ", & "second_arg " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "second_arg", second_argument ) @@ -131,9 +128,9 @@ subroutine test_restart_flag2() "-restart ", & "second_arg " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "second_arg", second_argument ) @@ -156,9 +153,9 @@ subroutine test_restart_flag3() "-restart ", & "first_arg.txt " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "", filename ) @assertEqual( 0, error_status ) @assertEqual( "first_arg.txt", second_argument ) @@ -185,9 +182,9 @@ subroutine test_second_argument() "first_arg.txt ", & "second_arg " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "second_arg", second_argument ) @@ -214,9 +211,9 @@ subroutine test_help1() "-h ", & "first_arg.txt " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -239,9 +236,9 @@ subroutine test_help2() "first_arg.txt ", & "-h " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -268,9 +265,9 @@ subroutine test_version1() "-v ", & "first_arg.txt " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -293,9 +290,9 @@ subroutine test_version2() "first_arg.txt ", & "-VERSION " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 0, error_status ) @assertEqual( "", second_argument ) @@ -317,9 +314,9 @@ subroutine test_no_args_no_default() filename = "" allocate(argument_array(0)) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "", filename ) @assertEqual( 4, error_status ) @assertEqual( "", second_argument ) @@ -343,9 +340,9 @@ subroutine test_unsupported_flag() "first_arg.txt ", & "-flag " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "first_arg.txt", filename ) @assertEqual( 4, error_status ) @assertEqual( "", second_argument ) @@ -368,9 +365,9 @@ subroutine test_restart_bad_syntax() argument_array = (/ & "-restart " & /) - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call CheckArgs( filename, error_status, second_argument, flag, argument_array ) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( "", filename ) @assertEqual( 4, error_status ) @assertEqual( "", second_argument ) diff --git a/modules/nwtc-library/tests/test_NWTC_RandomNumber.F90 b/modules/nwtc-library/tests/test_NWTC_RandomNumber.F90 index 4e3d472f08..2821a521fe 100644 --- a/modules/nwtc-library/tests/test_NWTC_RandomNumber.F90 +++ b/modules/nwtc-library/tests/test_NWTC_RandomNumber.F90 @@ -2,12 +2,11 @@ module test_NWTC_RandomNumber use pFUnit_mod use NWTC_RandomNumber + use nwtc_library_test_tools implicit none - integer, parameter :: stdout=6 - character(9), parameter :: nullfile="/dev/null" - character(11), parameter :: terminal="/dev/stdout" + character(1024), parameter :: dumpfile="randnumber.temp" contains @@ -45,9 +44,9 @@ subroutine test_INTRINSIC() p%RandSeed(1) = 1 p%RandSeed(2) = 2 - open(unit=stdout, file=nullfile, status="old") + call hide_terminal_output() call RandNum_Init(p, error_status, error_message) - open(unit=stdout, file=terminal, status="old") + call show_terminal_output() @assertEqual( 0, error_status ) ! We cant use this test since it will fail for various machine/compiler combinations diff --git a/modules/openfast-library/CMakeLists.txt b/modules/openfast-library/CMakeLists.txt index ed53eddd38..d27f0f2d8b 100644 --- a/modules/openfast-library/CMakeLists.txt +++ b/modules/openfast-library/CMakeLists.txt @@ -37,7 +37,7 @@ target_link_libraries(openfast_prelib orcaflexlib extptfm_mckflib openfoamtypeslib - sctypeslib + scdataextypeslib feamlib moordynlib icedynlib @@ -51,10 +51,10 @@ add_library(openfast_postlib src/FAST_Subs.f90 src/FAST_Solver.f90 ) -target_link_libraries(openfast_postlib openfast_prelib scfastlib foamfastlib versioninfolib) +target_link_libraries(openfast_postlib openfast_prelib scdataexlib foamfastlib versioninfolib) add_library(openfastlib src/FAST_Library.f90) -target_link_libraries(openfastlib openfast_postlib openfast_prelib scfastlib foamfastlib) +target_link_libraries(openfastlib openfast_postlib openfast_prelib scdataexlib foamfastlib) string(TOUPPER ${CMAKE_Fortran_COMPILER_ID} _compiler_id) string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type) diff --git a/modules/openfast-library/src/FAST_Library.f90 b/modules/openfast-library/src/FAST_Library.f90 index 1c5620bb4c..3f1606b227 100644 --- a/modules/openfast-library/src/FAST_Library.f90 +++ b/modules/openfast-library/src/FAST_Library.f90 @@ -44,13 +44,13 @@ subroutine FAST_AllocateTurbines(nTurbines, ErrStat_c, ErrMsg_c) BIND (C, NAME=' INTEGER(C_INT), INTENT( OUT) :: ErrStat_c CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) - if (nTurbines .gt. 0) then + if (nTurbines > 0) then NumTurbines = nTurbines end if - if (nTurbines .gt. 10) then + if (nTurbines > 10) then call wrscr1('Number of turbines is > 10! Are you sure you have enough memory?') - call wrscr1('Proceeding anyway') + call wrscr1('Proceeding anyway.') end if allocate(Turbine(0:NumTurbines-1),Stat=ErrStat) !Allocate in C style because most of the other Turbine properties from the input file are in C style inside the C++ driver @@ -65,7 +65,7 @@ subroutine FAST_AllocateTurbines(nTurbines, ErrStat_c, ErrMsg_c) BIND (C, NAME=' ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) end subroutine FAST_AllocateTurbines - +!================================================================================================================================== subroutine FAST_DeallocateTurbines(ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_DeallocateTurbines') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT @@ -82,7 +82,7 @@ subroutine FAST_DeallocateTurbines(ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_Deal ErrStat_c = ErrID_None ErrMsg_c = C_NULL_CHAR end subroutine - +!================================================================================================================================== subroutine FAST_Sizes(iTurb, TMax, InitInpAry, InputFileName_c, AbortErrLev_c, NumOuts_c, dt_c, ErrStat_c, ErrMsg_c, ChannelNames_c) BIND (C, NAME='FAST_Sizes') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT @@ -131,10 +131,10 @@ subroutine FAST_Sizes(iTurb, TMax, InitInpAry, InputFileName_c, AbortErrLev_c, N - CALL FAST_InitializeAll_T( t_initial, 1_IntKi, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) + CALL FAST_InitializeAll_T( t_initial, iTurb, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) AbortErrLev_c = AbortErrLev - NumOuts_c = min(MAXOUTPUTS, 1 + SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time + NumOuts_c = min(MAXOUTPUTS, SUM( Turbine(iTurb)%y_FAST%numOuts )) dt_c = Turbine(iTurb)%p_FAST%dt ErrStat_c = ErrStat @@ -214,7 +214,7 @@ subroutine FAST_Start(iTurb, NumInputs_c, NumOutputs_c, InputAry, OutputAry, Err OutputAry(1) = Turbine(iTurb)%m_FAST%t_global OutputAry(2:NumOutputs_c) = Outputs - CALL FAST_Linearize_T(t_initial, 0, Turbine(iTurb), ErrStat, ErrMsg) + CALL FAST_Linearize_T(t_initial, 0, Turbine(iTurb), ErrStat2, ErrMsg2) if (ErrStat2 /= ErrID_None) then ErrStat = max(ErrStat,ErrStat2) ErrMsg = TRIM(ErrMsg)//NewLine//TRIM(ErrMsg2) @@ -452,8 +452,8 @@ subroutine FAST_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, NumOuts_c, d end subroutine FAST_Restart !================================================================================================================================== -subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2Ctrl, NumCtrl2SC, NumActForcePtsBlade, NumActForcePtsTower, TurbPosn, AbortErrLev_c, dt_c, NumBl_c, NumBlElem_c, & - OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_Input_from_FAST, SC_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Init') +subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2CtrlGlob, NumSC2Ctrl, NumCtrl2SC, InitSCOutputsGlob, InitSCOutputsTurbine, NumActForcePtsBlade, NumActForcePtsTower, TurbPosn, AbortErrLev_c, dt_c, NumBl_c, NumBlElem_c, & + OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Init') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT !DEC$ ATTRIBUTES DLLEXPORT :: FAST_OpFM_Init @@ -463,8 +463,11 @@ subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2Ctrl, NumC REAL(C_DOUBLE), INTENT(IN ) :: TMax CHARACTER(KIND=C_CHAR), INTENT(IN ) :: InputFileName_c(IntfStrLen) INTEGER(C_INT), INTENT(IN ) :: TurbID ! Need not be same as iTurb + INTEGER(C_INT), INTENT(IN ) :: NumSC2CtrlGlob ! Supercontroller global outputs = controller global inputs INTEGER(C_INT), INTENT(IN ) :: NumSC2Ctrl ! Supercontroller outputs = controller inputs INTEGER(C_INT), INTENT(IN ) :: NumCtrl2SC ! controller outputs = Supercontroller inputs + REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsGlob (*) ! Initial Supercontroller global outputs = controller inputs + REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsTurbine (*) ! Initial Supercontroller turbine specific outputs = controller inputs INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsBlade ! number of actuator line force points in blade INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsTower ! number of actuator line force points in tower REAL(C_FLOAT), INTENT(IN ) :: TurbPosn(3) @@ -472,10 +475,10 @@ subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2Ctrl, NumC REAL(C_DOUBLE), INTENT( OUT) :: dt_c INTEGER(C_INT), INTENT( OUT) :: NumBl_c INTEGER(C_INT), INTENT( OUT) :: NumBlElem_c - TYPE(OpFM_InputType_C), INTENT( OUT) :: OpFM_Input_from_FAST - TYPE(OpFM_OutputType_C),INTENT( OUT) :: OpFM_Output_to_FAST - TYPE(SC_InputType_C), INTENT(INOUT) :: SC_Input_from_FAST - TYPE(SC_OutputType_C), INTENT(INOUT) :: SC_Output_to_FAST + TYPE(OpFM_InputType_C), INTENT(INOUT) :: OpFM_Input_from_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(OpFM_OutputType_C),INTENT(INOUT) :: OpFM_Output_to_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(SC_DX_InputType_C), INTENT(INOUT) :: SC_DX_Input_from_FAST + TYPE(SC_DX_OutputType_C), INTENT(INOUT) :: SC_DX_Output_to_FAST INTEGER(C_INT), INTENT( OUT) :: ErrStat_c CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) @@ -494,16 +497,39 @@ subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2Ctrl, NumC ErrStat = ErrID_None ErrMsg = "" + NumBl_c = 0 ! initialize here in case of error + NumBlElem_c = 0 ! initialize here in case of error + ExternInitData%TMax = TMax ExternInitData%TurbineID = TurbID ExternInitData%TurbinePos = TurbPosn ExternInitData%SensorType = SensorType_None ExternInitData%NumCtrl2SC = NumCtrl2SC + ExternInitData%NumSC2CtrlGlob = NumSC2CtrlGlob + + if ( NumSC2CtrlGlob > 0 ) then + CALL AllocAry( ExternInitData%fromSCGlob, NumSC2CtrlGlob, 'ExternInitData%fromSCGlob', ErrStat, ErrMsg) + IF (FAILED()) RETURN + + do i=1,NumSC2CtrlGlob + ExternInitData%fromSCGlob(i) = InitScOutputsGlob(i) + end do + end if + ExternInitData%NumSC2Ctrl = NumSC2Ctrl + if ( NumSC2Ctrl > 0 ) then + CALL AllocAry( ExternInitData%fromSC, NumSC2Ctrl, 'ExternInitData%fromSC', ErrStat, ErrMsg) + IF (FAILED()) RETURN + + do i=1,NumSC2Ctrl + ExternInitData%fromSC(i) = InitScOutputsTurbine(i) + end do + end if + ExternInitData%NumActForcePtsBlade = NumActForcePtsBlade ExternInitData%NumActForcePtsTower = NumActForcePtsTower - CALL FAST_InitializeAll_T( t_initial, 1_IntKi, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) + CALL FAST_InitializeAll_T( t_initial, iTurb, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) ! set values for return to OpenFOAM AbortErrLev_c = AbortErrLev @@ -511,28 +537,52 @@ subroutine FAST_OpFM_Init(iTurb, TMax, InputFileName_c, TurbID, NumSC2Ctrl, NumC ErrStat_c = ErrStat ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) - + IF ( ErrStat >= AbortErrLev ) THEN CALL WrScr( "Error in FAST_OpFM_Init:FAST_InitializeAll_T" // TRIM(ErrMsg) ) - IF (ALLOCATED(Turbine)) DEALLOCATE(Turbine) RETURN END IF - call SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_Input_from_FAST, SC_Output_to_FAST) + call SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) ! 7-Sep-2015: Sang wants these integers for the OpenFOAM mapping, which is tied to the AeroDyn nodes. FAST doesn't restrict the number of nodes on each ! blade mesh to be the same, so if this DOES ever change, we'll need to make OpenFOAM less tied to the AeroDyn mapping. IF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD14) THEN NumBl_c = SIZE(Turbine(iTurb)%AD14%Input(1)%InputMarkers) NumBlElem_c = Turbine(iTurb)%AD14%Input(1)%InputMarkers(1)%Nnodes - ELSEIF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD) THEN - NumBl_c = SIZE(Turbine(iTurb)%AD%Input(1)%BladeMotion) - NumBlElem_c = Turbine(iTurb)%AD%Input(1)%BladeMotion(1)%Nnodes - ELSE - NumBl_c = 0 - NumBlElem_c = 0 - END IF + ELSEIF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD) THEN + IF (ALLOCATED(Turbine(iTurb)%AD%Input(1)%rotors)) THEN + IF (ALLOCATED(Turbine(iTurb)%AD%Input(1)%rotors(1)%BladeMotion)) THEN + NumBl_c = SIZE(Turbine(iTurb)%AD%Input(1)%rotors(1)%BladeMotion) + END IF + END IF + IF (NumBl_c > 0) THEN + NumBlElem_c = Turbine(iTurb)%AD%Input(1)%rotors(1)%BladeMotion(1)%Nnodes + END IF + END IF + +contains + LOGICAL FUNCTION FAILED() + FAILED = ErrStat >= AbortErrLev + + IF (ErrStat > 0) THEN + CALL WrScr( "Error in FAST_OpFM_Init:FAST_InitializeAll_T" // TRIM(ErrMsg) ) + + IF ( FAILED ) THEN + + AbortErrLev_c = AbortErrLev + ErrStat_c = ErrStat + ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR + ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) + + !IF (ALLOCATED(Turbine)) DEALLOCATE(Turbine) + ! bjj: if there is an error, the driver should call FAST_DeallocateTurbines() instead of putting this deallocate statement here + END IF + END IF + + + END FUNCTION FAILED end subroutine !================================================================================================================================== subroutine FAST_OpFM_Solution0(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Solution0') @@ -545,15 +595,11 @@ subroutine FAST_OpFM_Solution0(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_O INTEGER(C_INT), INTENT( OUT) :: ErrStat_c CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) - if(Turbine(iTurb)%SC%p%scOn) then - CALL SC_SetOutputs(Turbine(iTurb)%p_FAST, Turbine(iTurb)%SrvD%Input(1), Turbine(iTurb)%SC, ErrStat, ErrMsg) - end if - call FAST_Solution0_T(Turbine(iTurb), ErrStat, ErrMsg ) - if(Turbine(iTurb)%SC%p%scOn) then - CALL SC_SetInputs(Turbine(iTurb)%p_FAST, Turbine(iTurb)%SrvD%y, Turbine(iTurb)%SC, ErrStat, ErrMsg) - end if +! if(Turbine(iTurb)%SC_DX%p%useSC) then +! CALL SC_SetInputs(Turbine(iTurb)%p_FAST, Turbine(iTurb)%SrvD%y, Turbine(iTurb)%SC_DX, ErrStat, ErrMsg) +! end if ! set values for return to OpenFOAM ErrStat_c = ErrStat @@ -564,7 +610,7 @@ subroutine FAST_OpFM_Solution0(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_O end subroutine FAST_OpFM_Solution0 !================================================================================================================================== subroutine FAST_OpFM_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, numblades_c, numElementsPerBlade_c, n_t_global_c, & - OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_Input_from_FAST, SC_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Restart') + OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Restart') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT !DEC$ ATTRIBUTES DLLEXPORT :: FAST_OpFM_Restart @@ -577,10 +623,10 @@ subroutine FAST_OpFM_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, n INTEGER(C_INT), INTENT( OUT) :: numElementsPerBlade_c REAL(C_DOUBLE), INTENT( OUT) :: dt_c INTEGER(C_INT), INTENT( OUT) :: n_t_global_c - TYPE(OpFM_InputType_C), INTENT( OUT) :: OpFM_Input_from_FAST - TYPE(OpFM_OutputType_C),INTENT( OUT) :: OpFM_Output_to_FAST - TYPE(SC_InputType_C), INTENT(INOUT) :: SC_Input_from_FAST - TYPE(SC_OutputType_C), INTENT(INOUT) :: SC_Output_to_FAST + TYPE(OpFM_InputType_C), INTENT(INOUT) :: OpFM_Input_from_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(OpFM_OutputType_C),INTENT(INOUT) :: OpFM_Output_to_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(SC_DX_InputType_C), INTENT(INOUT) :: SC_DX_Input_from_FAST + TYPE(SC_DX_OutputType_C), INTENT(INOUT) :: SC_DX_Output_to_FAST INTEGER(C_INT), INTENT( OUT) :: ErrStat_c CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) @@ -610,8 +656,14 @@ subroutine FAST_OpFM_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, n n_t_global_c = n_t_global AbortErrLev_c = AbortErrLev NumOuts_c = min(MAXOUTPUTS, 1 + SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time - numBlades_c = Turbine(iTurb)%ad%p%numblades - numElementsPerBlade_c = Turbine(iTurb)%ad%p%numblnds ! I'm not sure if FASTv8 can handle different number of blade nodes for each blade. + if (allocated(Turbine(iTurb)%ad%p%rotors)) then ! this might not be allocated if we had an error earlier + numBlades_c = Turbine(iTurb)%ad%p%rotors(1)%numblades + numElementsPerBlade_c = Turbine(iTurb)%ad%p%rotors(1)%numblnds ! I'm not sure if FASTv8 can handle different number of blade nodes for each blade. + else + numBlades_c = 0 + numElementsPerBlade_c = 0 + end if + dt_c = Turbine(iTurb)%p_FAST%dt ErrStat_c = ErrStat @@ -622,18 +674,20 @@ subroutine FAST_OpFM_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, n if (ErrStat /= ErrID_None) call wrscr1(trim(ErrMsg)) #endif - call SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_Input_from_FAST, SC_Output_to_FAST) + if (ErrStat >= AbortErrLev) return + + call SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) end subroutine FAST_OpFM_Restart !================================================================================================================================== -subroutine SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_Input_from_FAST, SC_Output_to_FAST) +subroutine SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) IMPLICIT NONE - INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number - TYPE(OpFM_InputType_C), INTENT(INOUT) :: OpFM_Input_from_FAST - TYPE(OpFM_OutputType_C),INTENT(INOUT) :: OpFM_Output_to_FAST - TYPE(SC_InputType_C), INTENT(INOUT) :: SC_Input_from_FAST - TYPE(SC_OutputType_C), INTENT(INOUT) :: SC_Output_to_FAST + INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number + TYPE(OpFM_InputType_C), INTENT(INOUT) :: OpFM_Input_from_FAST + TYPE(OpFM_OutputType_C), INTENT(INOUT) :: OpFM_Output_to_FAST + TYPE(SC_DX_InputType_C), INTENT(INOUT) :: SC_DX_Input_from_FAST + TYPE(SC_DX_OutputType_C), INTENT(INOUT) :: SC_DX_Output_to_FAST OpFM_Input_from_FAST%pxVel_Len = Turbine(iTurb)%OpFM%u%c_obj%pxVel_Len; OpFM_Input_from_FAST%pxVel = Turbine(iTurb)%OpFM%u%c_obj%pxVel OpFM_Input_from_FAST%pyVel_Len = Turbine(iTurb)%OpFM%u%c_obj%pyVel_Len; OpFM_Input_from_FAST%pyVel = Turbine(iTurb)%OpFM%u%c_obj%pyVel @@ -652,21 +706,21 @@ subroutine SetOpenFOAM_pointers(iTurb, OpFM_Input_from_FAST, OpFM_Output_to_FAST OpFM_Input_from_FAST%momenty_Len = Turbine(iTurb)%OpFM%u%c_obj%momenty_Len; OpFM_Input_from_FAST%momenty = Turbine(iTurb)%OpFM%u%c_obj%momenty OpFM_Input_from_FAST%momentz_Len = Turbine(iTurb)%OpFM%u%c_obj%momentz_Len; OpFM_Input_from_FAST%momentz = Turbine(iTurb)%OpFM%u%c_obj%momentz OpFM_Input_from_FAST%forceNodesChord_Len = Turbine(iTurb)%OpFM%u%c_obj%forceNodesChord_Len; OpFM_Input_from_FAST%forceNodesChord = Turbine(iTurb)%OpFM%u%c_obj%forceNodesChord - OpFM_Input_from_FAST%SuperController_Len = Turbine(iTurb)%OpFM%u%c_obj%SuperController_Len - OpFM_Input_from_FAST%SuperController = Turbine(iTurb)%OpFM%u%c_obj%SuperController - SC_Input_from_FAST%toSC_Len = Turbine(iTurb)%SC%u%c_obj%toSC_Len - SC_Input_from_FAST%toSC = Turbine(iTurb)%SC%u%c_obj%toSC - - OpFM_Output_to_FAST%u_Len = Turbine(iTurb)%OpFM%y%c_obj%u_Len; OpFM_Output_to_FAST%u = Turbine(iTurb)%OpFM%y%c_obj%u - OpFM_Output_to_FAST%v_Len = Turbine(iTurb)%OpFM%y%c_obj%v_Len; OpFM_Output_to_FAST%v = Turbine(iTurb)%OpFM%y%c_obj%v - OpFM_Output_to_FAST%w_Len = Turbine(iTurb)%OpFM%y%c_obj%w_Len; OpFM_Output_to_FAST%w = Turbine(iTurb)%OpFM%y%c_obj%w - OpFM_Output_to_FAST%SuperController_Len = Turbine(iTurb)%OpFM%y%c_obj%SuperController_Len - OpFM_Output_to_FAST%SuperController = Turbine(iTurb)%OpFM%y%c_obj%SuperController + if (Turbine(iTurb)%p_FAST%UseSC) then + SC_DX_Input_from_FAST%toSC_Len = Turbine(iTurb)%SC_DX%u%c_obj%toSC_Len + SC_DX_Input_from_FAST%toSC = Turbine(iTurb)%SC_DX%u%c_obj%toSC + end if + + OpFM_Output_to_FAST%u_Len = Turbine(iTurb)%OpFM%y%c_obj%u_Len; OpFM_Output_to_FAST%u = Turbine(iTurb)%OpFM%y%c_obj%u + OpFM_Output_to_FAST%v_Len = Turbine(iTurb)%OpFM%y%c_obj%v_Len; OpFM_Output_to_FAST%v = Turbine(iTurb)%OpFM%y%c_obj%v + OpFM_Output_to_FAST%w_Len = Turbine(iTurb)%OpFM%y%c_obj%w_Len; OpFM_Output_to_FAST%w = Turbine(iTurb)%OpFM%y%c_obj%w + + if (Turbine(iTurb)%p_FAST%UseSC) then + SC_DX_Output_to_FAST%fromSC_Len = Turbine(iTurb)%SC_DX%y%c_obj%fromSC_Len + SC_DX_Output_to_FAST%fromSC = Turbine(iTurb)%SC_DX%y%c_obj%fromSC + end if - SC_Output_to_FAST%fromSC_Len = Turbine(iTurb)%SC%y%c_obj%fromSC_Len - SC_Output_to_FAST%fromSC = Turbine(iTurb)%SC%y%c_obj%fromSC - end subroutine SetOpenFOAM_pointers !================================================================================================================================== subroutine FAST_OpFM_Step(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_Step') @@ -699,16 +753,7 @@ subroutine FAST_OpFM_Step(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_OpFM_S ELSE - if(Turbine(iTurb)%SC%p%scOn) then - CALL SC_SetOutputs(Turbine(iTurb)%p_FAST, Turbine(iTurb)%SrvD%Input(1), Turbine(iTurb)%SC, ErrStat, ErrMsg) - end if - CALL FAST_Solution_T( t_initial, n_t_global, Turbine(iTurb), ErrStat, ErrMsg ) - - if(Turbine(iTurb)%SC%p%scOn) then - CALL SC_SetInputs(Turbine(iTurb)%p_FAST, Turbine(iTurb)%SrvD%y, Turbine(iTurb)%SC, ErrStat, ErrMsg) - end if - if (iTurb .eq. (NumTurbines-1) ) then n_t_global = n_t_global + 1 end if diff --git a/modules/openfast-library/src/FAST_Library.h b/modules/openfast-library/src/FAST_Library.h index 494769c093..fd4e9399f1 100644 --- a/modules/openfast-library/src/FAST_Library.h +++ b/modules/openfast-library/src/FAST_Library.h @@ -3,7 +3,7 @@ // routines in FAST_Library_$(PlatformName).dll #include "OpenFOAM_Types.h" -#include "SuperController_Types.h" +#include "SCDataEx_Types.h" #ifdef __cplusplus #define EXTERNAL_ROUTINE extern "C" @@ -15,9 +15,9 @@ EXTERNAL_ROUTINE void FAST_AllocateTurbines(int * iTurb, int *ErrStat, char *Err EXTERNAL_ROUTINE void FAST_DeallocateTurbines(int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_OpFM_Restart(int * iTurb, const char *CheckpointRootName, int *AbortErrLev, double * dt, int * NumBl, int * NumBlElem, int * n_t_global, - OpFM_InputType_t* OpFM_Input, OpFM_OutputType_t* OpFM_Output, SC_InputType_t* SC_Input, SC_OutputType_t* SC_Output, int *ErrStat, char *ErrMsg); -EXTERNAL_ROUTINE void FAST_OpFM_Init(int * iTurb, double *TMax, const char *InputFileName, int * TurbineID, int * NumSC2Ctrl, int * NumCtrl2SC, int * NumActForcePtsBlade, int * NumActForcePtsTower, float * TurbinePosition, - int *AbortErrLev, double * dt, int * NumBl, int * NumBlElem, OpFM_InputType_t* OpFM_Input, OpFM_OutputType_t* OpFM_Output, SC_InputType_t* SC_Input, SC_OutputType_t* SC_Output, + OpFM_InputType_t* OpFM_Input, OpFM_OutputType_t* OpFM_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); +EXTERNAL_ROUTINE void FAST_OpFM_Init(int * iTurb, double *TMax, const char *InputFileName, int * TurbineID, int * NumSC2CtrlGlob, int * NumSC2Ctrl, int * NumCtrl2SC, float * initSCInputsGlob, float * initSCInputsTurbine, int * NumActForcePtsBlade, int * NumActForcePtsTower, float * TurbinePosition, + int *AbortErrLev, double * dt, int * NumBl, int * NumBlElem, OpFM_InputType_t* OpFM_Input, OpFM_OutputType_t* OpFM_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_OpFM_Solution0(int * iTurb, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_OpFM_Step(int * iTurb, int *ErrStat, char *ErrMsg); diff --git a/modules/openfast-library/src/FAST_Lin.f90 b/modules/openfast-library/src/FAST_Lin.f90 index 30696f80fd..9a406701c0 100644 --- a/modules/openfast-library/src/FAST_Lin.f90 +++ b/modules/openfast-library/src/FAST_Lin.f90 @@ -378,8 +378,8 @@ SUBROUTINE Init_Lin_IfW( p_FAST, y_FAST, u_AD ) IF (p_FAST%CompAero == MODULE_AD) THEN - DO K = 1,SIZE(u_AD%BladeMotion) - DO J = 1,u_AD%BladeMotion(k)%Nnodes + DO K = 1,SIZE(u_AD%rotors(1)%BladeMotion) + DO J = 1,u_AD%rotors(1)%BladeMotion(k)%Nnodes Node = Node + 1 ! InflowWind node NodeDesc = ' (blade '//trim(num2lstr(k))//', node '//trim(num2lstr(j))//')' @@ -403,7 +403,7 @@ SUBROUTINE Init_Lin_IfW( p_FAST, y_FAST, u_AD ) END DO !K = 1,p%NumBl ! tower: - DO J=1,u_AD%TowerMotion%nnodes + DO J=1,u_AD%rotors(1)%TowerMotion%nnodes Node = Node + 1 NodeDesc = ' (Tower node '//trim(num2lstr(j))//')' @@ -1828,16 +1828,16 @@ SUBROUTINE Linear_IfW_InputSolve_du_AD( p_FAST, y_FAST, u_AD, dUdu ) ! blades: AD_Start_Bl = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) & - + u_AD%TowerMotion%NNodes * 9 & ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components - + u_AD%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components + + u_AD%rotors(1)%TowerMotion%NNodes * 9 & ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components + + u_AD%rotors(1)%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components - do k = 1,size(u_AD%BladeRootMotion) - AD_Start_Bl = AD_Start_Bl + u_AD%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components + do k = 1,size(u_AD%rotors(1)%BladeRootMotion) + AD_Start_Bl = AD_Start_Bl + u_AD%rotors(1)%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components end do ! next is u_AD%BladeMotion(k): - DO K = 1,SIZE(u_AD%BladeMotion) - DO J = 1,u_AD%BladeMotion(k)%Nnodes + DO K = 1,SIZE(u_AD%rotors(1)%BladeMotion) + DO J = 1,u_AD%rotors(1)%BladeMotion(k)%Nnodes Node = Node + 1 ! InflowWind node do i=1,3 !XYZ components of this node i2 = y_FAST%Lin%Modules(MODULE_IfW)%Instance(1)%LinStartIndx(LIN_INPUT_COL) + (Node-1)*3 + i - 1 @@ -1847,11 +1847,11 @@ SUBROUTINE Linear_IfW_InputSolve_du_AD( p_FAST, y_FAST, u_AD, dUdu ) END DO !J = 1,p%BldNodes ! Loop through the blade nodes / elements ! get starting AD index of BladeMotion for next blade - AD_Start_Bl = AD_Start_Bl + u_AD%BladeMotion(k)%Nnodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components + AD_Start_Bl = AD_Start_Bl + u_AD%rotors(1)%BladeMotion(k)%Nnodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components END DO !K = 1,p%NumBl ! tower: - DO J=1,u_AD%TowerMotion%nnodes + DO J=1,u_AD%rotors(1)%TowerMotion%nnodes Node = Node + 1 do i=1,3 !XYZ components of this node i2 = y_FAST%Lin%Modules(MODULE_IfW)%Instance(1)%LinStartIndx(LIN_INPUT_COL) + (Node-1)*3 + i - 1 @@ -1915,7 +1915,7 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(k)%NNodes*3 ! skip the forces on this blade AD_Start_Bl = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) - CALL Linearize_Line2_to_Point( y_AD%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), y_ED%BladeLn2Mesh(k) ) + CALL Linearize_Line2_to_Point( y_AD%rotors(1)%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), y_ED%BladeLn2Mesh(k) ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ! AD is source in the mapping, so we want M_{uSm} @@ -1932,11 +1932,11 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! ED inputs on tower from AD: - IF ( y_AD%TowerLoad%Committed ) THEN + IF ( y_AD%rotors(1)%TowerLoad%Committed ) THEN ED_Start_mt = Indx_u_ED_Tower_Start(u_ED, y_FAST) & + u_ED%TowerPtLoads%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) - CALL Linearize_Line2_to_Point( y_AD%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%TowerMotion, y_ED%TowerLn2Mesh ) + CALL Linearize_Line2_to_Point( y_AD%rotors(1)%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%rotors(1)%TowerMotion, y_ED%TowerLn2Mesh ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ! AD is source in the mapping, so we want M_{uSm} @@ -2337,7 +2337,7 @@ SUBROUTINE Linear_BD_InputSolve_du( p_FAST, y_FAST, y_ED, y_AD, u_AD, BD, MeshMa if (p_FAST%BD_OutputSibling) then DO K = 1,p_FAST%nBeams ! Loop through all blades - CALL Linearize_Line2_to_Line2( y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), BD%y(k)%BldMotion ) + CALL Linearize_Line2_to_Line2( y_AD%rotors(1)%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), BD%y(k)%BldMotion ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO @@ -2349,7 +2349,7 @@ SUBROUTINE Linear_BD_InputSolve_du( p_FAST, y_FAST, y_ED, y_AD, u_AD, BD, MeshMa CALL Linearize_Line2_to_Line2( BD%y(k)%BldMotion, MeshMapData%y_BD_BldMotion_4Loads(k), MeshMapData%BD_L_2_BD_L(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - CALL Linearize_Line2_to_Line2( y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), MeshMapData%y_BD_BldMotion_4Loads(k) ) + CALL Linearize_Line2_to_Line2( y_AD%rotors(1)%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), MeshMapData%y_BD_BldMotion_4Loads(k) ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO @@ -2444,16 +2444,16 @@ SUBROUTINE Linear_AD_InputSolve_du( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMapData, !------------------------------------------------------------------------------------------------- ! tower - IF (u_AD%TowerMotion%Committed) THEN + IF (u_AD%rotors(1)%TowerMotion%Committed) THEN - CALL Linearize_Line2_to_Line2( y_ED%TowerLn2Mesh, u_AD%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) + CALL Linearize_Line2_to_Line2( y_ED%TowerLn2Mesh, u_AD%rotors(1)%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%TowerMotion' ) !AD is the destination here, so we need tv_ud if (allocated( MeshMapData%ED_L_2_AD_L_T%dM%tv_ud)) then AD_Start_td = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - AD_Start_tv = AD_Start_td + u_AD%TowerMotion%NNodes * 6 ! 2 fields (TranslationDisp and Orientation) with 3 components before translational velocity field + AD_Start_tv = AD_Start_td + u_AD%rotors(1)%TowerMotion%NNodes * 6 ! 2 fields (TranslationDisp and Orientation) with 3 components before translational velocity field call SetBlockMatrix( dUdu, MeshMapData%ED_L_2_AD_L_T%dM%tv_ud, AD_Start_tv, AD_Start_td ) end if @@ -2465,15 +2465,15 @@ SUBROUTINE Linear_AD_InputSolve_du( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMapData, ! blades IF (p_FAST%CompElast == Module_ED ) THEN - DO k=1,size(u_AD%BladeMotion) - CALL Linearize_Line2_to_Line2( y_ED%BladeLn2Mesh(k), u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) + DO k=1,size(u_AD%rotors(1)%BladeMotion) + CALL Linearize_Line2_to_Line2( y_ED%BladeLn2Mesh(k), u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeMotion('//trim(num2lstr(k))//')' ) END DO ELSEIF (p_FAST%CompElast == Module_BD ) THEN - DO k=1,size(u_AD%BladeMotion) - CALL Linearize_Line2_to_Line2( BD%y(k)%BldMotion, u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) + DO k=1,size(u_AD%rotors(1)%BladeMotion) + CALL Linearize_Line2_to_Line2( BD%y(k)%BldMotion, u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeMotion('//trim(num2lstr(k))//')' ) END DO @@ -2481,19 +2481,19 @@ SUBROUTINE Linear_AD_InputSolve_du( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMapData, - DO k=1,size(u_AD%BladeMotion) + DO k=1,size(u_AD%rotors(1)%BladeMotion) AD_Start_td = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) ! index for u_AD%BladeMotion(k)%translationDisp field !AD is the destination here, so we need tv_ud if (allocated( MeshMapData%BDED_L_2_AD_L_B(k)%dM%tv_ud)) then ! index for u_AD%BladeMotion(k+1)%translationVel field - AD_Start_tv = AD_Start_td + u_AD%BladeMotion(k)%NNodes * 6 ! 2 fields (TranslationDisp and Orientation) with 3 components before translational velocity field + AD_Start_tv = AD_Start_td + u_AD%rotors(1)%BladeMotion(k)%NNodes * 6 ! 2 fields (TranslationDisp and Orientation) with 3 components before translational velocity field call SetBlockMatrix( dUdu, MeshMapData%BDED_L_2_AD_L_B(k)%dM%tv_ud, AD_Start_tv, AD_Start_td ) end if if (allocated( MeshMapData%BDED_L_2_AD_L_B(k)%dM%tv_ud)) then - AD_Start_ta = AD_Start_td + u_AD%BladeMotion(k)%NNodes * 12 ! 4 fields (TranslationDisp, Orientation, TranslationVel, and RotationVel) with 3 components before translational velocity field + AD_Start_ta = AD_Start_td + u_AD%rotors(1)%BladeMotion(k)%NNodes * 12 ! 4 fields (TranslationDisp, Orientation, TranslationVel, and RotationVel) with 3 components before translational velocity field call SetBlockMatrix( dUdu, MeshMapData%BDED_L_2_AD_L_B(k)%dM%ta_ud, AD_Start_ta, AD_Start_td ) end if @@ -2527,16 +2527,16 @@ SUBROUTINE Linear_SrvD_InputSolve_dy( p_FAST, y_FAST, dUdy ) dUdy(y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) + SrvD_Indx_Y_BlPitchCom(i) - 1, ED_Start_Yaw + i - 1) = -1.0_ReKi end do - !IF (u_SrvD%NTMD%Mesh%Committed) THEN + !IF (u_SrvD%NStC%Mesh%Committed) THEN ! - ! CALL Linearize_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NTMD%Mesh, MeshMapData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) + ! CALL Linearize_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStC%Mesh, MeshMapData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! !END IF ! - !IF (u_SrvD%TTMD%Mesh%Committed) THEN + !IF (u_SrvD%TSC%Mesh%Committed) THEN ! - ! CALL Linearize_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TTMD%Mesh, MeshMapData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) + ! CALL Linearize_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStC%Mesh, MeshMapData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! !END IF @@ -2590,13 +2590,13 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, dUdy(ED_Start + i - 1, y_FAST%Lin%Modules(Module_SrvD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + i - 1) = -1.0_ReKi !SrvD_Indx_Y_BlPitchCom end do - !IF (y_SrvD%NTMD%Mesh%Committed) THEN - ! CALL Linearize_Point_to_Point( y_SrvD%NTMD%Mesh, u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, u_SrvD%NTMD%Mesh, y_ED%NacelleMotion ) + !IF (y_SrvD%NStC%Mesh%Committed) THEN + ! CALL Linearize_Point_to_Point( y_SrvD%NStC%Mesh, u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, u_SrvD%NStC%Mesh, y_ED%NacelleMotion ) ! CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) !END IF ! - !IF (y_SrvD%TTMD%Mesh%Committed) THEN - ! CALL Linearize_Point_to_Point( y_SrvD%TTMD%Mesh, u_ED%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, u_SrvD%TTMD%Mesh, y_ED%TowerLn2Mesh ) + !IF (y_SrvD%TStC%Mesh%Committed) THEN + ! CALL Linearize_Point_to_Point( y_SrvD%TStC%Mesh, u_ED%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, u_SrvD%TStC%Mesh, y_ED%TowerLn2Mesh ) ! CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) !END IF @@ -2608,7 +2608,7 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, IF ( p_FAST%CompAero == Module_AD ) THEN IF (p_FAST%CompElast == Module_ED) THEN - AD_Out_Start = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + y_AD%TowerLoad%NNodes * 6 ! start of y_AD%BladeLoad(1)%Force field [2 fields (force, moment) with 3 components] + AD_Out_Start = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + y_AD%rotors(1)%TowerLoad%NNodes * 6 ! start of y_AD%BladeLoad(1)%Force field [2 fields (force, moment) with 3 components] DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) !!! ! This linearization was done in forming dUdu (see Linear_ED_InputSolve_du()), so we don't need to re-calculate these matrices @@ -2617,19 +2617,19 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! AD loads-to-ED loads transfer (dU^{ED}/dy^{AD}): ED_Start = Indx_u_ED_Blade_Start(u_ED, y_FAST, k) ! start of u_ED%BladePtLoads(k)%Force field - call Assemble_dUdy_Loads(y_AD%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ED_Start, AD_Out_Start, dUdy) + call Assemble_dUdy_Loads(y_AD%rotors(1)%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ED_Start, AD_Out_Start, dUdy) ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): ED_Start = Indx_u_ED_Blade_Start(u_ED, y_FAST, k) + u_ED%BladePtLoads(k)%NNodes*3 ! start of u_ED%BladePtLoads(k)%Moment field (skip the ED forces) ED_Out_Start = Indx_y_ED_Blade_Start(y_ED, y_FAST, k) ! start of y_ED%BladeLn2Mesh(1)%TranslationDisp field call SetBlockMatrix( dUdy, MeshMapData%AD_L_2_BDED_B(k)%dM%m_uD, ED_Start, ED_Out_Start ) - AD_Out_Start = AD_Out_Start + y_AD%BladeLoad(k)%NNodes*6 ! start of y_AD%BladeLoad(k+1)%Force field [skip 2 fields to forces on next blade] + AD_Out_Start = AD_Out_Start + y_AD%rotors(1)%BladeLoad(k)%NNodes*6 ! start of y_AD%BladeLoad(k+1)%Force field [skip 2 fields to forces on next blade] END DO END IF ! ED - IF ( y_AD%TowerLoad%Committed ) THEN + IF ( y_AD%rotors(1)%TowerLoad%Committed ) THEN !!! ! This linearization was done in forming dUdu (see Linear_ED_InputSolve_du()), so we don't need to re-calculate these matrices !!! ! while forming dUdy, too. !CALL Linearize_Line2_to_Point( y_AD%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%TowerMotion, y_ED%TowerLn2Mesh ) @@ -2637,7 +2637,7 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! AD loads-to-ED loads transfer (dU^{ED}/dy^{AD}): ED_Start = Indx_u_ED_Tower_Start(u_ED, y_FAST) ! u_ED%TowerPtLoads%Force field AD_Out_Start = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) ! start of y_AD%Tower%Force - call Assemble_dUdy_Loads(y_AD%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ED_Start, AD_Out_Start, dUdy) + call Assemble_dUdy_Loads(y_AD%rotors(1)%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ED_Start, AD_Out_Start, dUdy) ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): ED_Start = ED_Start + u_ED%TowerPtLoads%NNodes*3 ! start of u_ED%TowerPtLoads%Moment field [skip the ED forces to get to the moments] @@ -2792,7 +2792,7 @@ SUBROUTINE Linear_BD_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, !!! CALL Linearize_Line2_to_Line2( y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), MeshMapData%y_BD_BldMotion_4Loads(k) ) !!!end if - AD_Out_Start = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + y_AD%TowerLoad%NNodes * 6 ! start of y_AD%BladeLoad(1)%Force field [2 fields (force, moment) with 3 components] + AD_Out_Start = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + y_AD%rotors(1)%TowerLoad%NNodes * 6 ! start of y_AD%BladeLoad(1)%Force field [2 fields (force, moment) with 3 components] DO K = 1,p_FAST%nBeams ! Loop through all blades BD_Start = y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%LinStartIndx(LIN_INPUT_COL) & ! start of BD%Input(1,k)%DistrLoad%Force field @@ -2800,8 +2800,8 @@ SUBROUTINE Linear_BD_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, + BD%Input(1,k)%PointLoad%NNodes * 6 ! force + moment fields for each node ! AD loads-to-BD loads transfer (dU^{BD}/dy^{AD}): - call Assemble_dUdy_Loads(y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), BD_Start, AD_Out_Start, dUdy) - AD_Out_Start = AD_Out_Start + y_AD%BladeLoad(k)%NNodes*6 ! start of y_AD%BladeLoad(k+1)%Force field [skip the moments to get to forces on next blade] + call Assemble_dUdy_Loads(y_AD%rotors(1)%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), BD_Start, AD_Out_Start, dUdy) + AD_Out_Start = AD_Out_Start + y_AD%rotors(1)%BladeLoad(k)%NNodes*6 ! start of y_AD%BladeLoad(k+1)%Force field [skip the moments to get to forces on next blade] ! BD translation displacement-to-BD moment transfer (dU^{BD}/dy^{BD}): @@ -2880,8 +2880,8 @@ SUBROUTINE Linear_AD_InputSolve_IfW_dy( p_FAST, y_FAST, u_AD, dUdy ) AD_Start = Indx_u_AD_BladeInflow_Start(u_AD, y_FAST) ! start of u_AD%InflowOnBlade array - do k=1,size(u_AD%InflowOnBlade,3) ! blades - do j=1,size(u_AD%InflowOnBlade,2) ! nodes + do k=1,size(u_AD%rotors(1)%InflowOnBlade,3) ! blades + do j=1,size(u_AD%rotors(1)%InflowOnBlade,2) ! nodes do i=1,3 !velocity component dUdy( AD_Start + i - 1, y_FAST%Lin%Modules(MODULE_IfW)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + (node-1)*3 + i - 1 ) = -1.0_R8Ki end do @@ -2890,8 +2890,8 @@ SUBROUTINE Linear_AD_InputSolve_IfW_dy( p_FAST, y_FAST, u_AD, dUdy ) end do end do - if ( allocated(u_AD%InflowOnTower) ) then - do j=1,size(u_AD%InflowOnTower,2) !nodes + if ( allocated(u_AD%rotors(1)%InflowOnTower) ) then + do j=1,size(u_AD%rotors(1)%InflowOnTower,2) !nodes do i=1,3 !velocity component dUdy( AD_Start + i - 1, y_FAST%Lin%Modules(MODULE_IfW)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) + (node-1)*3 + i - 1 ) = -1.0_R8Ki end do @@ -2941,7 +2941,7 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa !................................... ! tower !................................... - IF (u_AD%TowerMotion%Committed) THEN + IF (u_AD%rotors(1)%TowerMotion%Committed) THEN !!! ! This linearization was done in forming dUdu (see Linear_AD_InputSolve_du()), so we don't need to re-calculate these matrices !!! ! while forming dUdy, too. @@ -2950,14 +2950,14 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa AD_Start = Indx_u_AD_Tower_Start(u_AD, y_FAST) ! start of u_AD%TowerMotion%TranslationDisp field ED_Out_Start = Indx_y_ED_Tower_Start(y_ED, y_FAST) ! start of y_ED%TowerLn2Mesh%TranslationDisp field - call Assemble_dUdy_Motions(y_ED%TowerLn2Mesh, u_AD%TowerMotion, MeshMapData%ED_L_2_AD_L_T, AD_Start, ED_Out_Start, dUdy, skipRotVel=.true.) + call Assemble_dUdy_Motions(y_ED%TowerLn2Mesh, u_AD%rotors(1)%TowerMotion, MeshMapData%ED_L_2_AD_L_T, AD_Start, ED_Out_Start, dUdy, skipRotVel=.true.) END IF !................................... ! hub !................................... - CALL Linearize_Point_to_Point( y_ED%HubPtMotion, u_AD%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) + CALL Linearize_Point_to_Point( y_ED%HubPtMotion, u_AD%rotors(1)%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%HubMotion' ) if (errStat>=AbortErrLev) return @@ -2970,11 +2970,11 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa call SetBlockMatrix( dUdy, MeshMapData%ED_P_2_AD_P_H%dM%fx_p, AD_Start, ED_Out_Start ) ! *** AD orientation: from ED orientation - AD_Start = AD_Start + u_AD%HubMotion%NNodes * 3 ! move past the AD translation disp field to orientation field + AD_Start = AD_Start + u_AD%rotors(1)%HubMotion%NNodes * 3 ! move past the AD translation disp field to orientation field call SetBlockMatrix( dUdy, MeshMapData%ED_P_2_AD_P_H%dM%mi, AD_Start, ED_Out_Start ) ! *** AD rotational velocity: from ED rotational velocity - AD_Start = AD_Start + u_AD%HubMotion%NNodes * 3 ! move past the AD orientation field to rotational velocity field + AD_Start = AD_Start + u_AD%rotors(1)%HubMotion%NNodes * 3 ! move past the AD orientation field to rotational velocity field ED_Out_Start = Indx_y_ED_Hub_Start(y_ED, y_FAST) + y_ED%HubPtMotion%NNodes * 6 ! ! start of y_ED%HubPtMotion%RotationVel field call SetBlockMatrix( dUdy, MeshMapData%ED_P_2_AD_P_H%dM%mi, AD_Start, ED_Out_Start ) @@ -2984,7 +2984,7 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa ! blade root !................................... DO k=1,size(y_ED%BladeRootMotion) - CALL Linearize_Point_to_Point( y_ED%BladeRootMotion(k), u_AD%BladeRootMotion(k), MeshMapData%ED_P_2_AD_P_R(k), ErrStat2, ErrMsg2 ) + CALL Linearize_Point_to_Point( y_ED%BladeRootMotion(k), u_AD%rotors(1)%BladeRootMotion(k), MeshMapData%ED_P_2_AD_P_R(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeRootMotion('//trim(num2lstr(k))//')' ) if (errStat>=AbortErrLev) return @@ -3011,7 +3011,7 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa AD_Start = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) ! start of u_AD%BladeMotion(k)%TranslationDisp field ED_Out_Start = Indx_y_ED_Blade_Start(y_ED, y_FAST, k) ! start of y_ED%BladeLn2Mesh(k)%TranslationDisp field - CALL Assemble_dUdy_Motions(y_ED%BladeLn2Mesh(k), u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), AD_Start, ED_Out_Start, dUdy, skipRotAcc=.true.) + CALL Assemble_dUdy_Motions(y_ED%BladeLn2Mesh(k), u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), AD_Start, ED_Out_Start, dUdy, skipRotAcc=.true.) END DO @@ -3024,7 +3024,7 @@ SUBROUTINE Linear_AD_InputSolve_NoIfW_dy( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMa AD_Start = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) ! start of u_AD%BladeMotion(k)%TranslationDisp field BD_Out_Start = y_FAST%Lin%Modules(Module_BD)%Instance(k)%LinStartIndx(LIN_OUTPUT_COL) - CALL Assemble_dUdy_Motions(BD%y(k)%BldMotion, u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), AD_Start, BD_Out_Start, dUdy, skipRotAcc=.true.) + CALL Assemble_dUdy_Motions(BD%y(k)%BldMotion, u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), AD_Start, BD_Out_Start, dUdy, skipRotAcc=.true.) END DO END IF @@ -4181,7 +4181,7 @@ FUNCTION Indx_u_AD_Hub_Start(u_AD, y_FAST) RESULT(AD_Start) INTEGER :: AD_Start !< starting index of this mesh in AeroDyn inputs - AD_Start = Indx_u_AD_Tower_Start(u_AD, y_FAST) + u_AD%TowerMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components + AD_Start = Indx_u_AD_Tower_Start(u_AD, y_FAST) + u_AD%rotors(1)%TowerMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components END FUNCTION Indx_u_AD_Hub_Start !---------------------------------------------------------------------------------------------------------------------------------- @@ -4194,10 +4194,10 @@ FUNCTION Indx_u_AD_BladeRoot_Start(u_AD, y_FAST, BladeNum) RESULT(AD_Start) INTEGER :: AD_Start !< starting index of this mesh in AeroDyn inputs - AD_Start = Indx_u_AD_Hub_Start(u_AD, y_FAST) + u_AD%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components + AD_Start = Indx_u_AD_Hub_Start(u_AD, y_FAST) + u_AD%rotors(1)%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components - do k = 1,min(BladeNum-1,size(u_AD%BladeRootMotion)) - AD_Start = AD_Start + u_AD%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components + do k = 1,min(BladeNum-1,size(u_AD%rotors(1)%BladeRootMotion)) + AD_Start = AD_Start + u_AD%rotors(1)%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components end do END FUNCTION Indx_u_AD_BladeRoot_Start !---------------------------------------------------------------------------------------------------------------------------------- @@ -4212,8 +4212,8 @@ FUNCTION Indx_u_AD_Blade_Start(u_AD, y_FAST, BladeNum) RESULT(AD_Start) AD_Start = Indx_u_AD_BladeRoot_Start(u_AD, y_FAST, MaxNBlades+1) - do k = 1,min(BladeNum-1,size(u_AD%BladeMotion)) - AD_Start = AD_Start + u_AD%BladeMotion(k)%NNodes * 15 ! 5 fields (TranslationDisp, MASKID_Orientation, TranslationVel, RotationVel, TranslationAcc) with 3 components + do k = 1,min(BladeNum-1,size(u_AD%rotors(1)%BladeMotion)) + AD_Start = AD_Start + u_AD%rotors(1)%BladeMotion(k)%NNodes * 15 ! 5 fields (TranslationDisp, MASKID_Orientation, TranslationVel, RotationVel, TranslationAcc) with 3 components end do END FUNCTION Indx_u_AD_Blade_Start !---------------------------------------------------------------------------------------------------------------------------------- @@ -4893,33 +4893,33 @@ SUBROUTINE PerturbOP(t, iLinTime, iMode, p_FAST, y_FAST, ED, BD, SrvD, AD, IfW, indx = 1 ! set linearization operating points: - if (AD%p%BEMT%DBEMT%lin_nx>0) then - do j=1,size(AD%x(STATE_CURR)%BEMT%DBEMT%element,2) - do i=1,size(AD%x(STATE_CURR)%BEMT%DBEMT%element,1) - indx_last = indx + size(AD%x(STATE_CURR)%BEMT%DBEMT%element(i,j)%vind) - 1 - call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%BEMT%DBEMT%element(i,j)%vind, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & - y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) + if (AD%p%rotors(1)%BEMT%DBEMT%lin_nx>0) then + do j=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element,2) + do i=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element,1) + indx_last = indx + size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element(i,j)%vind) - 1 + call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element(i,j)%vind, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & + y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) indx = indx_last + 1 end do end do - do j=1,size(AD%x(STATE_CURR)%BEMT%DBEMT%element,2) - do i=1,size(AD%x(STATE_CURR)%BEMT%DBEMT%element,1) - indx_last = indx + size(AD%x(STATE_CURR)%BEMT%DBEMT%element(i,j)%vind_dot) - 1 - call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%BEMT%DBEMT%element(i,j)%vind_dot, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & - y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) + do j=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element,2) + do i=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element,1) + indx_last = indx + size(AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element(i,j)%vind_dot) - 1 + call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%rotors(1)%BEMT%DBEMT%element(i,j)%vind_dot, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & + y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) indx = indx_last + 1 end do end do end if - if (AD%p%BEMT%UA%lin_nx>0) then - do j=1,size(AD%x(STATE_CURR)%BEMT%UA%element,2) - do i=1,size(AD%x(STATE_CURR)%BEMT%UA%element,1) - indx_last = indx + size(AD%x(STATE_CURR)%BEMT%UA%element(i,j)%x) - 1 - call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%BEMT%UA%element(i,j)%x, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & - y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) + if (AD%p%rotors(1)%BEMT%UA%lin_nx>0) then + do j=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%UA%element,2) + do i=1,size(AD%x(STATE_CURR)%rotors(1)%BEMT%UA%element,1) + indx_last = indx + size(AD%x(STATE_CURR)%rotors(1)%BEMT%UA%element(i,j)%x) - 1 + call GetStateAry(p_FAST, iMode, t, AD%x(STATE_CURR)%rotors(1)%BEMT%UA%element(i,j)%x, y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_mag( indx : indx_last), & + y_FAST%Lin%Modules(ThisModule)%Instance(1)%op_x_eig_phase(indx : indx_last) ) indx = indx_last + 1 end do end do diff --git a/modules/openfast-library/src/FAST_Registry.txt b/modules/openfast-library/src/FAST_Registry.txt index 563d6b8ee5..d6fd234edb 100644 --- a/modules/openfast-library/src/FAST_Registry.txt +++ b/modules/openfast-library/src/FAST_Registry.txt @@ -21,7 +21,7 @@ usefrom HydroDyn.txt usefrom IceFloe_FASTRegistry.inp usefrom InflowWind.txt usefrom OpenFOAM_Registry.txt -usefrom SuperController_Registry.txt +usefrom SC_DataEx_Registry.txt usefrom Registry_IceDyn.txt usefrom FEAM_Registry.txt usefrom MAP_Registry.txt @@ -36,23 +36,24 @@ usefrom ExtPtfm_MCKF_Registry.txt # Make sure the module identifiers start at 1 and that this order matches the orders in WrOutputLine and FAST_InitOutput!!! param FAST - INTEGER Module_Unknown - -1 - "Unknown" - param ^ - INTEGER Module_None - 0 - "No module selected" - -param ^ - INTEGER Module_IfW - 1 - "InflowWind" - -param ^ - INTEGER Module_OpFM - 2 - "OpenFOAM" - -param ^ - INTEGER Module_ED - 3 - "ElastoDyn" - -param ^ - INTEGER Module_BD - 4 - "BeamDyn" - -param ^ - INTEGER Module_AD14 - 5 - "AeroDyn14" - -param ^ - INTEGER Module_AD - 6 - "AeroDyn" - -param ^ - INTEGER Module_SrvD - 7 - "ServoDyn" - -param ^ - INTEGER Module_HD - 8 - "HydroDyn" - -param ^ - INTEGER Module_SD - 9 - "SubDyn" - -param ^ - INTEGER Module_ExtPtfm - 10 - "External Platform Loading MCKF" - -param ^ - INTEGER Module_MAP - 11 - "MAP (Mooring Analysis Program)" - -param ^ - INTEGER Module_FEAM - 12 - "FEAMooring" - -param ^ - INTEGER Module_MD - 13 - "MoorDyn" - -param ^ - INTEGER Module_Orca - 14 - "OrcaFlex integration (HD/Mooring)" - -param ^ - INTEGER Module_IceF - 15 - "IceFloe" - -param ^ - INTEGER Module_IceD - 16 - "IceDyn" - -param ^ - INTEGER NumModules - 16 - "The number of modules available in FAST" - +param ^ - INTEGER Module_Glue - 1 - "Glue code" - +param ^ - INTEGER Module_IfW - 2 - "InflowWind" - +param ^ - INTEGER Module_OpFM - 3 - "OpenFOAM" - +param ^ - INTEGER Module_ED - 4 - "ElastoDyn" - +param ^ - INTEGER Module_BD - 5 - "BeamDyn" - +param ^ - INTEGER Module_AD14 - 6 - "AeroDyn14" - +param ^ - INTEGER Module_AD - 7 - "AeroDyn" - +param ^ - INTEGER Module_SrvD - 8 - "ServoDyn" - +param ^ - INTEGER Module_HD - 9 - "HydroDyn" - +param ^ - INTEGER Module_SD - 10 - "SubDyn" - +param ^ - INTEGER Module_ExtPtfm - 11 - "External Platform Loading MCKF" - +param ^ - INTEGER Module_MAP - 12 - "MAP (Mooring Analysis Program)" - +param ^ - INTEGER Module_FEAM - 13 - "FEAMooring" - +param ^ - INTEGER Module_MD - 14 - "MoorDyn" - +param ^ - INTEGER Module_Orca - 15 - "OrcaFlex integration (HD/Mooring)" - +param ^ - INTEGER Module_IceF - 16 - "IceFloe" - +param ^ - INTEGER Module_IceD - 17 - "IceDyn" - +param ^ - INTEGER NumModules - 17 - "The number of modules available in FAST" - # Other Constants param ^ - INTEGER MaxNBlades - 3 - "Maximum number of blades allowed on a turbine" - param ^ - INTEGER IceD_MaxLegs - 4 - "because I don't know how many legs there are before calling IceD_Init and I don't want to copy the data because of sibling mesh issues, I'm going to allocate IceD based on this number" - @@ -104,6 +105,7 @@ typedef ^ FAST_ParameterType LOGICAL ModuleInitialized {NumModules} - - "An arra typedef ^ FAST_ParameterType DbKi DT_Ujac - - - "Time between when we need to re-calculate these Jacobians" s typedef ^ FAST_ParameterType Reki UJacSclFact - - - "Scaling factor used to get similar magnitudes between accelerations, forces, and moments in Jacobians" - typedef ^ FAST_ParameterType IntKi SizeJac_Opt1 {9} - - "(1)=size of matrix; (2)=size of ED portion; (3)=size of SD portion [2 meshes]; (4)=size of HD portion; (5)=size of BD portion blade 1; (6)=size of BD portion blade 2; (7)=size of BD portion blade 3; (8)=size of Orca portion; (9)=size of ExtPtfm portion;" - +#typedef ^ FAST_ParameterType IntKi SolveOption - - - "Switch to determine which solve option we are going to use (see Solve_FullOpt1, etc)" - # Feature switches and flags: typedef ^ FAST_ParameterType IntKi CompElast - - - "Compute blade loads (switch) {Module_ED; Module_BD}" - typedef ^ FAST_ParameterType IntKi CompInflow - - - "Compute inflow wind conditions (switch) {Module_None; Module_IfW; Module_OpFM}" - @@ -170,8 +172,9 @@ typedef ^ FAST_ParameterType IntKi LinInputs - - - "Inputs included in lineariza typedef ^ FAST_ParameterType IntKi LinOutputs - - - "Outputs included in linearization (switch) {0=none; 1=from OutList(s); 2=all module outputs (debug)} [unused if Linearize=False]" - typedef ^ FAST_ParameterType LOGICAL LinOutJac - - - "Include full Jacabians in linearization output (for debug) (flag) [unused if Linearize=False; used only if LinInputs=LinOutputs=2]" - typedef ^ FAST_ParameterType LOGICAL LinOutMod - - - "Write module-level linearization output files in addition to output for full system? (flag) [unused if Linearize=False]" - -typedef ^ FAST_ParameterType FAST_VTK_ModeShapeType VTK_modes - - - "Data for VTK mode-shape visualization" +typedef ^ FAST_ParameterType FAST_VTK_ModeShapeType VTK_modes - - - "Data for VTK mode-shape visualization" - +typedef ^ FAST_ParameterType LOGICAL UseSC - - - "Use Supercontroller" - typedef ^ FAST_ParameterType IntKi Lin_NumMods - - - "number of modules in the linearization" typedef ^ FAST_ParameterType IntKi Lin_ModOrder {NumModules} - - "indices that determine which order the modules are in the glue-code linearization matrix" typedef ^ FAST_ParameterType IntKi LinInterpOrder - - - "Interpolation order for CalcSteady solution" - @@ -341,6 +344,9 @@ typedef ^ FAST_OutputFileType FAST_LinFileType Lin - - - "linearization data for typedef ^ FAST_OutputFileType IntKi ActualChanLen - - - "width of the column headers output in the text and/or binary file" - typedef ^ FAST_OutputFileType CHARACTER(30) OutFmt_a - - - "Format used for text tabular output (except time); combines OutFmt with delim and appropriate spaces" - typedef ^ FAST_OutputFileType FAST_LinStateSave op - - - "operating points of states and inputs for VTK output of mode shapes" +typedef ^ FAST_OutputFileType ReKi DriverWriteOutput {5} - - "pitch and tsr for current aero map case, plus error, number of iterations, wind speed" +#typedef ^ FAST_OutputFileType CHARACTER(ChanLen) DriverWriteOutputHdr {:} - - "headers of data output from the driver" +#typedef ^ FAST_OutputFileType CHARACTER(ChanLen) DriverWriteOutputUnit {:} - - "units of data output from the driver" # ..... IceDyn data ....................................................................................................... @@ -449,9 +455,9 @@ typedef ^ ^ OpFM_ParameterType p - - - "Parameters" typedef ^ ^ OpFM_MiscVarType m - - - "Parameters" # ..... SuperController integration data ....................................................................................................... -typedef FAST SuperController_Data SC_InputType u - - - "System inputs" -typedef ^ ^ SC_OutputType y - - - "System outputs" -typedef ^ ^ SC_ParameterType p - - - "System parameters" +typedef FAST SCDataEx_Data SC_DX_InputType u - - - "System inputs" +typedef ^ ^ SC_DX_OutputType y - - - "System outputs" +typedef ^ ^ SC_DX_ParameterType p - - - "System parameters" # ..... SubDyn data ....................................................................................................... typedef FAST SubDyn_Data SD_ContinuousStateType x {2} - - "Continuous states" @@ -581,16 +587,27 @@ typedef ^ FAST_ModuleMapType MeshMapType SD_P_2_HD_M_P - - - "Map SubDyn y2Mesh typedef ^ FAST_ModuleMapType MeshMapType HD_M_P_2_SD_P - - - "Map HydroDyn Morison Point to SubDyn y2Mesh Point" typedef ^ FAST_ModuleMapType MeshMapType SD_P_2_HD_W_P - - - "Map SubDyn y2Mesh Point to HydroDyn WAMIT Point" typedef ^ FAST_ModuleMapType MeshMapType HD_W_P_2_SD_P - - - "Map HydroDyn WAMIT Point to SubDyn y2Mesh Point" -# ED <-> SrvD/TMD -typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_N - - - "Map ElastoDyn Nacelle point mesh to ServoDyn/TMD point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_N - - - "Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle" -typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_SrvD_P_T - - - "Map ElastoDyn tower line2 mesh to ServoDyn/TTMD point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_T - - - "Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower" +# ED/BD <-> SrvD/StC +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_N {:} - - "Map ElastoDyn Nacelle point mesh to ServoDyn/NStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_N {:} - - "Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle" +typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_SrvD_P_T {:} - - "Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_T {:} - - "Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower" +typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_SrvD_P_B {:}{:} - - "Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade" +typedef ^ FAST_ModuleMapType MeshMapType BD_L_2_SrvD_P_B {:}{:} - - "Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_BD_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade" +# ED/SD <-> SrvD/StC -- Platform TMD +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_P_2_ED_P {:} - - "Map ServoDyn platform point mesh load to ElastoDyn point load mesh" +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_P {:} - - "Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_P_2_SD_P {:} - - "Map ServoDyn platform point mesh load to SubDyn point load mesh" +typedef ^ FAST_ModuleMapType MeshMapType SD_P_2_SrvD_P_P {:} - - "Map SubDyn platform point mesh motion to ServoDyn/SStC point mesh" # ED/BD <-> AD (blades) typedef ^ FAST_ModuleMapType MeshMapType BDED_L_2_AD_L_B {:} - - "Map ElastoDyn BladeLn2Mesh point meshes OR BeamDyn BldMotion line2 meshes to AeroDyn14 InputMarkers OR AeroDyn BladeMotion line2 meshes" typedef ^ FAST_ModuleMapType MeshMapType AD_L_2_BDED_B {:} - - "Map AeroDyn14 InputMarkers or AeroDyn BladeLoad line2 meshes to ElastoDyn BladePtLoad point meshes or BeamDyn BldMotion line2 meshes" typedef ^ FAST_ModuleMapType MeshMapType BD_L_2_BD_L {:} - - "Map BeamDyn BldMotion output meshes to locations on the BD input DistrLoad mesh stored in MeshMapType%y_BD_BldMotion_4Loads (BD input and output meshes are not siblings and in fact have nodes at different locations" -# ED <-> AD (tower, hub, blade root) +# ED <-> AD (nacelle, tower, hub, blade root) +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_AD_P_N - - - "Map ElastoDyn Nacelle point motion mesh to AeroDyn Nacelle point motion mesh" +typedef ^ FAST_ModuleMapType MeshMapType AD_P_2_ED_P_N - - - "Map AeroDyn Nacelle point load mesh to ElastoDyn nacelle point load mesh" typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_AD_L_T - - - "Map ElastoDyn TowerLn2Mesh line2 mesh to AeroDyn14 Twr_InputMarkers or AeroDyn TowerMotion line2 mesh" typedef ^ FAST_ModuleMapType MeshMapType AD_L_2_ED_P_T - - - "Map AeroDyn14 Twr_InputMarkers or AeroDyn TowerLoad line2 mesh to ElastoDyn TowerPtLoads point mesh" typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_AD_P_R {:} - - "Map ElastoDyn BladeRootMotion point meshes to AeroDyn BladeRootMotion point meshes" @@ -606,8 +623,12 @@ typedef ^ FAST_ModuleMapType ReKi Jacobian_Opt1 {:}{:} - - "Stored Jacobian in E typedef ^ FAST_ModuleMapType Integer Jacobian_pivot {:} - - "Pivot array used for LU decomposition of Jacobian_Opt1" typedef ^ FAST_ModuleMapType Integer Jac_u_indx {:}{:} - - "matrix to help fill/pack the u vector in computing the jacobian" # Temporary copies of input meshes (stored here so we don't have to keep allocating/destroying them) +typedef ^ FAST_ModuleMapType MeshType u_ED_NacelleLoads - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh_2 - - - "copy of ED input mesh (used only for temporary storage)" +typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh_3 - - - "copy of ED input mesh (used only for temporary storage)" +typedef ^ FAST_ModuleMapType MeshType u_ED_TowerPtloads - - - "copy of ED input mesh" +typedef ^ FAST_ModuleMapType MeshType u_ED_BladePtLoads {:} - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_SD_TPMesh - - - "copy of SD input mesh" typedef ^ FAST_ModuleMapType MeshType u_SD_LMesh - - - "copy of SD input mesh" typedef ^ FAST_ModuleMapType MeshType u_SD_LMesh_2 - - - "copy of SD input mesh (used only for temporary storage)" @@ -619,6 +640,7 @@ typedef ^ FAST_ModuleMapType MeshType u_ED_HubPtLoad - - - "copy of ED input me typedef ^ FAST_ModuleMapType MeshType u_ED_HubPtLoad_2 - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_BD_RootMotion {:} - - "copy of BD input meshes" typedef ^ FAST_ModuleMapType MeshType y_BD_BldMotion_4Loads {:} - - "BD blade motion output at locations on DistrLoad input meshes" +typedef ^ FAST_ModuleMapType MeshType u_BD_Distrload {:} - - "copy of BD DistrLoad input meshes" typedef ^ FAST_ModuleMapType MeshType u_Orca_PtfmMesh - - - "copy of Orca PtfmMesh input mesh" typedef ^ FAST_ModuleMapType MeshType u_ExtPtfm_PtfmMesh - - - "copy of ExtPtfm_MCKF PtfmMesh input mesh" # ..... FAST_ExternalInput data ....................................................................................................... @@ -630,6 +652,20 @@ typedef ^ FAST_ExternInputType ReKi BlPitchCom 3 - 2pi "blade pitch commands fro typedef ^ FAST_ExternInputType ReKi HSSBrFrac - - - "Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW" typedef ^ FAST_ExternInputType ReKi LidarFocus 3 - - "lidar focus (relative to lidar location)" m +# ..... FAST_MiscVarType data ....................................................................................................... +typedef FAST FAST_MiscVarType DbKi TiLstPrn - - - "The simulation time of the last print (to file)" (s) +typedef ^ FAST_MiscVarType DbKi t_global - - - "Current simulation time (for global/FAST simulation)" (s) +typedef ^ FAST_MiscVarType DbKi NextJacCalcTime - - - "Time between calculating Jacobians in the HD-ED and SD-ED simulations" (s) +typedef ^ FAST_MiscVarType ReKi PrevClockTime - - - "Clock time at start of simulation in seconds" (s) +typedef ^ FAST_MiscVarType ReKi UsrTime1 - - - "User CPU time for simulation initialization" (s) +typedef ^ FAST_MiscVarType ReKi UsrTime2 - - - "User CPU time for simulation (without intialization)" (s) +typedef ^ FAST_MiscVarType INTEGER StrtTime {8} - - "Start time of simulation (including intialization)" +typedef ^ FAST_MiscVarType INTEGER SimStrtTime {8} - - "Start time of simulation (after initialization)" +#typedef ^ FAST_MiscVarType IntKi n_t_global - - - "simulation time step, loop counter for global (FAST) simulation" (s) +typedef ^ FAST_MiscVarType Logical calcJacobian - - - "Should we calculate Jacobians in Option 1?" (flag) +typedef ^ FAST_MiscVarType FAST_ExternInputType ExternInput - - - "external input values" - +typedef ^ FAST_MiscVarType FAST_MiscLinType Lin - - - "misc data for linearization analysis" - + # ..... FAST_InitData data ....................................................................................................... typedef ^ FAST_InitData ED_InitInputType InData_ED - - - "ED Initialization input data" @@ -664,32 +700,19 @@ typedef ^ FAST_InitData IceFloe_InitInputType InData_IceF - - typedef ^ FAST_InitData IceFloe_InitOutputType OutData_IceF - - - "IceF Initialization output data" typedef ^ FAST_InitData IceD_InitInputType InData_IceD - - - "IceD Initialization input data" typedef ^ FAST_InitData IceD_InitOutputType OutData_IceD - - - "IceD Initialization output data (each instance will have the same output channels)" -typedef ^ FAST_InitData SC_InitInputType InData_SC - - - "SC Initialization input data" -typedef ^ FAST_InitData SC_InitOutputType OutData_SC - - - "SC Initialization output data" -# ..... FAST_MiscVarType data ....................................................................................................... -typedef FAST FAST_MiscVarType DbKi TiLstPrn - - - "The simulation time of the last print (to file)" (s) -typedef ^ FAST_MiscVarType DbKi t_global - - - "Current simulation time (for global/FAST simulation)" (s) -typedef ^ FAST_MiscVarType DbKi NextJacCalcTime - - - "Time between calculating Jacobians in the HD-ED and SD-ED simulations" (s) -typedef ^ FAST_MiscVarType ReKi PrevClockTime - - - "Clock time at start of simulation in seconds" (s) -typedef ^ FAST_MiscVarType ReKi UsrTime1 - - - "User CPU time for simulation initialization" (s) -typedef ^ FAST_MiscVarType ReKi UsrTime2 - - - "User CPU time for simulation (without intialization)" (s) -typedef ^ FAST_MiscVarType INTEGER StrtTime {8} - - "Start time of simulation (including intialization)" -typedef ^ FAST_MiscVarType INTEGER SimStrtTime {8} - - "Start time of simulation (after initialization)" -#typedef ^ FAST_MiscVarType IntKi n_t_global - - - "simulation time step, loop counter for global (FAST) simulation" (s) -typedef ^ FAST_MiscVarType Logical calcJacobian - - - "Should we calculate Jacobians in Option 1?" (flag) -typedef ^ FAST_MiscVarType FAST_ExternInputType ExternInput - - - "external input values" - -typedef ^ FAST_MiscVarType FAST_MiscLinType Lin - - - "misc data for linearization analysis" - - # ..... FAST External Initialization Input data ....................................................................................................... typedef ^ FAST_ExternInitType DbKi Tmax - -1 - "External code specified Tmax" s typedef ^ FAST_ExternInitType IntKi SensorType - SensorType_None - "lidar sensor type, which should not be pulsed at the moment; this input should be replaced with a section in the InflowWind input file" - typedef ^ FAST_ExternInitType LOGICAL LidRadialVel - - - "TRUE => return radial component, FALSE => return 'x' direction estimate" - typedef ^ FAST_ExternInitType IntKi TurbineID - 0 - "ID number for turbine (used to create output file naming convention)" - typedef ^ FAST_ExternInitType ReKi TurbinePos {3} - - "Initial position of turbine base (origin used in future for graphics)" m -typedef ^ FAST_ExternInitType IntKi NumSC2Ctrl - - - "number of controller inputs [from supercontroller]" - +typedef ^ FAST_ExternInitType IntKi NumSC2CtrlGlob - - - "number of global controller inputs [from supercontroller]" - +typedef ^ FAST_ExternInitType IntKi NumSC2Ctrl - - - "number of turbine specific controller inputs [from supercontroller]" - typedef ^ FAST_ExternInitType IntKi NumCtrl2SC - - - "number of controller outputs [to supercontroller]" - +typedef ^ FAST_ExternInitType ReKi fromSCGlob {:} - - "Initial global inputs to the controller [from the supercontroller]" - +typedef ^ FAST_ExternInitType ReKi fromSC {:} - - "Initial turbine specific inputs to the controller [from the supercontroller]" - typedef ^ FAST_ExternInitType logical FarmIntegration - .false. - "whether this is called from FAST.Farm (or another program that doesn't want FAST to call all of the init stuff first)" - typedef ^ FAST_ExternInitType IntKi windGrid_n 4 - - "number of grid points in the x, y, z, and t directions for IfW" - typedef ^ FAST_ExternInitType ReKi windGrid_delta 4 - - "size between 2 consecutive grid points in each grid direction for IfW" "m,m,m,s" @@ -712,7 +735,7 @@ typedef ^ FAST_TurbineType AeroDyn_Data AD - - - "Data for the AeroDyn module" - typedef ^ FAST_TurbineType AeroDyn14_Data AD14 - - - "Data for the AeroDyn14 module" - typedef ^ FAST_TurbineType InflowWind_Data IfW - - - "Data for InflowWind module" - typedef ^ FAST_TurbineType OpenFOAM_Data OpFM - - - "Data for OpenFOAM integration module" - -typedef ^ FAST_TurbineType SuperController_Data SC - - - "Data for SuperController integration module" - +typedef ^ FAST_TurbineType SCDataEx_Data SC_DX - - - "Data for SuperController integration module" - typedef ^ FAST_TurbineType HydroDyn_Data HD - - - "Data for the HydroDyn module" - typedef ^ FAST_TurbineType SubDyn_Data SD - - - "Data for the SubDyn module" - typedef ^ FAST_TurbineType MAP_Data MAP - - - "Data for the MAP (Mooring Analysis Program) module" - diff --git a/modules/openfast-library/src/FAST_Solver.f90 b/modules/openfast-library/src/FAST_Solver.f90 index 6a0423af5f..693de352df 100644 --- a/modules/openfast-library/src/FAST_Solver.f90 +++ b/modules/openfast-library/src/FAST_Solver.f90 @@ -42,7 +42,6 @@ MODULE FAST_Solver USE ServoDyn USE SubDyn USE OpenFOAM - USE SuperController Use ExtPtfm_MCKF @@ -52,7 +51,7 @@ MODULE FAST_Solver !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the inputs required for BD--using the Option 2 solve method; currently the only inputs solved in this routine !! are the blade distributed loads from AD15; other inputs are solved in option 1. -SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, ErrMsg ) +SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, y_SrvD, u_SrvD, MeshMapData, ErrStat, ErrMsg ) !.................................................................................................................................. TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST !< Glue-code simulation parameters @@ -60,7 +59,9 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, Er TYPE(AD_OutputType), INTENT(IN ) :: y_AD !< AeroDyn outputs TYPE(AD_InputType), INTENT(IN ) :: u_AD !< AD inputs (for AD-BD load transfer) TYPE(ED_OutputType), INTENT(IN ) :: y_ED !< ElastoDyn outputs - + TYPE(SrvD_OutputType), INTENT(IN ) :: y_SrvD !< ServoDyn outputs + TYPE(SrvD_InputType), INTENT(IN ) :: u_SrvD !< ServoDyn Inputs (for SrvD-BD load transfer) + TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message @@ -71,18 +72,19 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, Er REAL(R8Ki) :: r_hub(3) ! variable for adding damping REAL(R8Ki) :: Vrot(3) ! variable for adding damping - INTEGER(IntKi) :: J ! Loops through blade nodes + INTEGER(IntKi) :: I ! Loops through blade nodes + INTEGER(IntKi) :: J ! Loops through SrvD instances INTEGER(IntKi) :: K ! Loops through blades INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'BD_InputSolve' + ! Initialize error status - ErrStat = ErrID_None ErrMsg = "" - + ! BD inputs on blade from AeroDyn IF (p_FAST%CompElast == Module_BD) THEN @@ -92,7 +94,7 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, Er DO K = 1,p_FAST%nBeams ! Loop through all blades - CALL Transfer_Line2_to_Line2( y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), BD%y(k)%BldMotion ) + CALL Transfer_Line2_to_Line2( y_AD%rotors(1)%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), BD%y(k)%BldMotion ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO @@ -104,13 +106,12 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, Er CALL Transfer_Line2_to_Line2( BD%y(k)%BldMotion, MeshMapData%y_BD_BldMotion_4Loads(k), MeshMapData%BD_L_2_BD_L(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - CALL Transfer_Line2_to_Line2( y_AD%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), MeshMapData%y_BD_BldMotion_4Loads(k) ) + CALL Transfer_Line2_to_Line2( y_AD%rotors(1)%BladeLoad(k), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), MeshMapData%y_BD_BldMotion_4Loads(k) ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO end if - ELSE DO K = 1,p_FAST%nBeams ! Loop through all blades @@ -119,7 +120,27 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, MeshMapData, ErrStat, Er END DO END IF - + + ! Add blade loads from StrucCtrl in SrvD to BD loads + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%BStC)) THEN + do j=1,size(y_SrvD%BStC) + if (allocated(y_SrvD%BStC(j)%Mesh)) then + DO K = 1,p_FAST%nBeams ! Loop through all blades + IF (y_SrvD%BStC(j)%Mesh(K)%Committed) THEN + MeshMapData%u_BD_DistrLoad(k)%Force = 0.0_ReKi + MeshMapData%u_BD_DistrLoad(k)%Moment = 0.0_ReKi + CALL Transfer_Point_to_Line2( y_SrvD%BStC(j)%Mesh(k), MeshMapData%u_BD_DistrLoad(k), MeshMapData%SrvD_P_2_BD_P_B(j,k), ErrStat2, ErrMsg2, u_SrvD%BStC(j)%Mesh(k), BD%y(k)%BldMotion ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_BD_DistrLoad' ) + do I = 1,BD%Input(1,k)%DistrLoad%Nnodes ! Loop through the tower nodes / elements + BD%Input(1,k)%DistrLoad%Force(:,I) = BD%Input(1,k)%DistrLoad%Force(:,I) + MeshMapData%u_BD_DistrLoad(k)%Force(:,I) + BD%Input(1,k)%DistrLoad%Moment(:,I) = BD%Input(1,k)%DistrLoad%Moment(:,I) + MeshMapData%u_BD_DistrLoad(k)%Moment(:,I) + enddo + ENDIF + ENDDO + endif + enddo + ENDIF + END IF ! add damping in blades for linearization convergence @@ -182,54 +203,20 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD REAL(R8Ki) :: Vrot(3) ! variable for adding damping INTEGER(IntKi) :: J ! Loops through nodes / elements + INTEGER(IntKi) :: i ! Loops through nodes / elements INTEGER(IntKi) :: K ! Loops through blades INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'ED_InputSolve' -!bjj: make these misc vars to avoid reallocation each step! - real(reKi) :: Force(3,u_ED%TowerPtLoads%Nnodes) - real(reKi) :: Moment(3,u_ED%TowerPtLoads%Nnodes) - - + + TYPE(MeshType), POINTER :: PlatformMotion + TYPE(MeshType), POINTER :: PlatformLoads + ! Initialize error status - ErrStat = ErrID_None ErrMsg = "" - Force = 0.0_ReKi - Moment = 0.0_ReKi - - ! ED inputs from ServoDyn - IF ( p_FAST%CompServo == Module_SrvD ) THEN - - u_ED%GenTrq = y_SrvD%GenTrq - u_ED%HSSBrTrqC = y_SrvD%HSSBrTrqC - u_ED%BlPitchCom = y_SrvD%BlPitchCom - u_ED%YawMom = y_SrvD%YawMom - ! u_ED%TBDrCon = y_SrvD%TBDrCon !array - - IF (y_SrvD%NTMD%Mesh%Committed) THEN - - CALL Transfer_Point_to_Point( y_SrvD%NTMD%Mesh, u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, u_SrvD%NTMD%Mesh, y_ED%NacelleMotion ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) - - END IF - - IF (y_SrvD%TTMD%Mesh%Committed) THEN - - CALL Transfer_Point_to_Point( y_SrvD%TTMD%Mesh, u_ED%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, u_SrvD%TTMD%Mesh, y_ED%TowerLn2Mesh ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) - - ! we'll need to add this to the loads from AeroDyn, later, so we're going to transfer to a temp mesh here instead of u_ED%TowerPtLoads - Force = u_ED%TowerPtLoads%force - Moment = u_ED%TowerPtLoads%moment - - END IF - - ELSE !we'll just take the initial guesses.. - END IF - - + ! ED inputs on blade from AeroDyn IF (p_FAST%CompElast == Module_ED) THEN @@ -246,7 +233,7 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD ELSEIF ( p_FAST%CompAero == Module_AD ) THEN DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) - CALL Transfer_Line2_to_Point( y_AD%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), y_ED%BladeLn2Mesh(k) ) + CALL Transfer_Line2_to_Point( y_AD%rotors(1)%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), y_ED%BladeLn2Mesh(k) ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO @@ -262,9 +249,9 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD END IF + u_ED%TowerPtLoads%Force = 0.0_ReKi + u_ED%TowerPtLoads%Moment = 0.0_ReKi IF ( p_FAST%CompAero == Module_AD14 ) THEN - u_ED%TowerPtLoads%Force = 0.0_ReKi - u_ED%TowerPtLoads%Moment = 0.0_ReKi ! add aero force to the tower, if it's provided: IF ( y_AD14%Twr_OutputLoads%Committed ) THEN @@ -285,8 +272,8 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD ELSEIF ( p_FAST%CompAero == Module_AD ) THEN - IF ( y_AD%TowerLoad%Committed ) THEN - CALL Transfer_Line2_to_Point( y_AD%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%TowerMotion, y_ED%TowerLn2Mesh ) + IF ( y_AD%rotors(1)%TowerLoad%Committed ) THEN + CALL Transfer_Line2_to_Point( y_AD%rotors(1)%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%rotors(1)%TowerMotion, y_ED%TowerLn2Mesh ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END IF @@ -295,15 +282,100 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD u_ED%TowerPtLoads%Moment = 0.0_ReKi END IF - ! add potential loads from TMD module: - u_ED%TowerPtLoads%Force = u_ED%TowerPtLoads%Force + Force - u_ED%TowerPtLoads%Moment = u_ED%TowerPtLoads%Moment + Moment - + ! Initialize here so because we may be adding loads from SrvD/NStC with AD nacelle drag: + u_ED%NacelleLoads%Force = 0.0_ReKi + u_ED%NacelleLoads%Moment = 0.0_ReKi + + ! ED inputs from ServoDyn + IF ( p_FAST%CompServo == Module_SrvD ) THEN + + u_ED%GenTrq = y_SrvD%GenTrq + u_ED%HSSBrTrqC = y_SrvD%HSSBrTrqC + u_ED%BlPitchCom = y_SrvD%BlPitchCom + u_ED%YawMom = y_SrvD%YawMom + ! u_ED%TBDrCon = y_SrvD%TBDrCon !array + + ! StrucCtrl loads + IF ( ALLOCATED(y_SrvD%NStC) ) THEN ! Nacelle + do j=1,size(y_SrvD%NStC) + IF ( ALLOCATED(y_SrvD%NStC(j)%Mesh) ) THEN + IF (y_SrvD%NStC(j)%Mesh(1)%Committed) THEN ! size 1 only for NStC + CALL Transfer_Point_to_Point( y_SrvD%NStC(j)%Mesh(1), u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N(j), ErrStat2, ErrMsg2, u_SrvD%NStC(j)%Mesh(1), y_ED%NacelleMotion ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) + ENDIF + END IF + enddo + END IF + + IF ( ALLOCATED(y_SrvD%TStC) ) THEN ! Tower + do j=1,size(y_SrvD%TStC) + IF ( ALLOCATED(y_SrvD%TStC(j)%Mesh) ) THEN + IF (y_SrvD%TStC(j)%Mesh(1)%Committed) THEN ! size 1 only for TStC + MeshMapData%u_ED_TowerPtLoads%Force = 0.0_ReKi + MeshMapData%u_ED_TowerPtLoads%Moment = 0.0_ReKi + CALL Transfer_Point_to_Point( y_SrvD%TStC(j)%Mesh(1), MeshMapData%u_ED_TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T(j), ErrStat2, ErrMsg2, u_SrvD%TStC(j)%Mesh(1), y_ED%TowerLn2Mesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) + do K = 1,u_ED%TowerPtLoads%Nnodes ! Loop through the tower nodes / elements + u_ED%TowerPtLoads%Force(:,K) = u_ED%TowerPtLoads%Force(:,K) + MeshMapData%u_ED_TowerPtLoads%Force(:,K) + u_ED%TowerPtLoads%Moment(:,K) = u_ED%TowerPtLoads%Moment(:,K) + MeshMapData%u_ED_TowerPtLoads%Moment(:,K) + enddo + ENDIF + END IF + enddo + ENDIF + + IF (p_FAST%CompElast == Module_ED) THEN + IF ( ALLOCATED(y_SrvD%BStC) ) THEN ! Blades + do j=1,size(y_SrvD%BStC) + IF ( ALLOCATED(y_SrvD%BStC(j)%Mesh) ) THEN + DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) + IF (y_SrvD%BStC(j)%Mesh(k)%Committed) THEN + MeshMapData%u_ED_BladePtLoads(k)%Force = 0.0_ReKi + MeshMapData%u_ED_BladePtLoads(k)%Moment = 0.0_ReKi + CALL Transfer_Point_to_Point( y_SrvD%BStC(j)%Mesh(k), MeshMapData%u_ED_BladePtLoads(k), MeshMapData%SrvD_P_2_ED_P_B(j,k), ErrStat2, ErrMsg2, u_SrvD%BStC(j)%Mesh(k), y_ED%BladeLn2Mesh(k) ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%BladePtLoads' ) + do I = 1,u_ED%BladePtLoads(k)%Nnodes ! Loop through the tower nodes / elements + u_ED%BladePtLoads(k)%Force(:,I) = u_ED%BladePtLoads(k)%Force(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Force(:,I) + u_ED%BladePtLoads(k)%Moment(:,I) = u_ED%BladePtLoads(k)%Moment(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Moment(:,I) + enddo + END IF + ENDDO + ENDIF + enddo + ENDIF + ENDIF + + IF ( p_FAST%CompSub /= Module_SD ) THEN ! Platform loads if not SD + IF ( ALLOCATED(y_SrvD%SStC) ) THEN ! Platform + do j=1,size(y_SrvD%SStC) + IF ( ALLOCATED(y_SrvD%SStC(j)%Mesh) ) THEN + IF (y_SrvD%SStC(j)%Mesh(1)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStC(j)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStC(j)%Mesh(1), y_ED%PlatformPtMesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + u_ED%PlatformPtMesh%Force = u_ED%PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh%Force + u_ED%PlatformPtMesh%Moment = u_ED%PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh%Moment + ENDIF + ENDIF + enddo + ENDIF + ENDIF + END IF + + u_ED%TwrAddedMass = 0.0_ReKi u_ED%PtfmAddedMass = 0.0_ReKi - + IF ( p_FAST%CompAero == Module_AD ) THEN ! we have to do this after the nacelle loads from StrucCtrl NStC + IF ( u_AD%rotors(1)%NacelleMotion%Committed ) THEN + CALL Transfer_Point_to_Point( y_AD%rotors(1)%NacelleLoad, MeshMapData%u_ED_NacelleLoads, MeshMapData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2, u_AD%rotors(1)%NacelleMotion, y_ED%NacelleMotion ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + u_ED%NacelleLoads%Force = u_ED%NacelleLoads%Force + MeshMapData%u_ED_NacelleLoads%Force + u_ED%NacelleLoads%Moment = u_ED%NacelleLoads%Moment + MeshMapData%u_ED_NacelleLoads%Moment + END IF + END IF + ! add damping in blades and tower for linearization convergence if (p_FAST%CalcSteady) then @@ -332,7 +404,7 @@ END SUBROUTINE ED_InputSolve !> This routine determines the points in space where InflowWind needs to compute wind speeds. SUBROUTINE IfW_InputSolve( p_FAST, m_FAST, u_IfW, p_IfW, u_AD14, u_AD, OtherSt_AD, y_ED, ErrStat, ErrMsg ) - TYPE(InflowWind_InputType), INTENT(INOUT) :: u_IfW(:) !< The inputs to InflowWind + TYPE(InflowWind_InputType), INTENT(INOUT) :: u_IfW !< The inputs to InflowWind TYPE(InflowWind_ParameterType), INTENT(IN ) :: p_IfW !< The parameters to InflowWind TYPE(AD14_InputType), INTENT(IN) :: u_AD14 !< The input meshes (already calculated) from AeroDyn14 TYPE(AD_InputType), INTENT(IN) :: u_AD !< The input meshes (already calculated) from AeroDyn @@ -360,7 +432,7 @@ SUBROUTINE IfW_InputSolve( p_FAST, m_FAST, u_IfW, p_IfW, u_AD14, u_AD, OtherSt_A Node = 0 IF (p_FAST%CompServo == MODULE_SrvD) THEN Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = y_ED%HubPtMotion%Position(:,1) ! undisplaced position. Maybe we want to use the displaced position (y_ED%HubPtMotion%TranslationDisp) at some point in time. + u_IfW%PositionXYZ(:,Node) = y_ED%HubPtMotion%Position(:,1) ! undisplaced position. Maybe we want to use the displaced position (y_ED%HubPtMotion%TranslationDisp) at some point in time. END IF IF (p_FAST%CompAero == MODULE_AD14) THEN @@ -368,46 +440,53 @@ SUBROUTINE IfW_InputSolve( p_FAST, m_FAST, u_IfW, p_IfW, u_AD14, u_AD, OtherSt_A DO K = 1,SIZE(u_AD14%InputMarkers) DO J = 1,u_AD14%InputMarkers(K)%nnodes !this mesh isn't properly set up (it's got the global [absolute] position and no reference position) Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = u_AD14%InputMarkers(K)%Position(:,J) + u_IfW%PositionXYZ(:,Node) = u_AD14%InputMarkers(K)%Position(:,J) END DO !J = 1,p%BldNodes ! Loop through the blade nodes / elements END DO !K = 1,p%NumBl DO J=1,u_AD14%Twr_InputMarkers%nnodes Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = u_AD14%Twr_InputMarkers%TranslationDisp(:,J) + u_AD14%Twr_InputMarkers%Position(:,J) + u_IfW%PositionXYZ(:,Node) = u_AD14%Twr_InputMarkers%TranslationDisp(:,J) + u_AD14%Twr_InputMarkers%Position(:,J) END DO ELSEIF (p_FAST%CompAero == MODULE_AD) THEN - DO K = 1,SIZE(u_AD%BladeMotion) - DO J = 1,u_AD%BladeMotion(k)%Nnodes + DO K = 1,SIZE(u_AD%rotors(1)%BladeMotion) + DO J = 1,u_AD%rotors(1)%BladeMotion(k)%Nnodes Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = u_AD%BladeMotion(k)%TranslationDisp(:,j) + u_AD%BladeMotion(k)%Position(:,j) + u_IfW%PositionXYZ(:,Node) = u_AD%rotors(1)%BladeMotion(k)%TranslationDisp(:,j) + u_AD%rotors(1)%BladeMotion(k)%Position(:,j) END DO !J = 1,p%BldNodes ! Loop through the blade nodes / elements END DO !K = 1,p%NumBl - DO J=1,u_AD%TowerMotion%nnodes + DO J=1,u_AD%rotors(1)%TowerMotion%nnodes Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = u_AD%TowerMotion%TranslationDisp(:,J) + u_AD%TowerMotion%Position(:,J) + u_IfW%PositionXYZ(:,Node) = u_AD%rotors(1)%TowerMotion%TranslationDisp(:,J) + u_AD%rotors(1)%TowerMotion%Position(:,J) END DO + + if (u_AD%rotors(1)%NacelleMotion%Committed) then + Node = Node + 1 + u_IfW%PositionXYZ(:,Node) = u_AD%rotors(1)%NacelleMotion%TranslationDisp(:,1) + u_AD%rotors(1)%NacelleMotion%Position(:,1) + end if + +! if (u_AD%HubMotion%Committed) then +! Node = Node + 1 +! u_IfW%PositionXYZ(:,Node) = u_AD%HubMotion%TranslationDisp(:,1) + u_AD%HubMotion%Position(:,1) +! end if - ! vortex points from FVW in AD15 + ! vortex points from FVW in AD15 (should be at then end, since not "rotor dependent" if (allocated(OtherSt_AD%WakeLocationPoints)) then do J=1,size(OtherSt_AD%WakeLocationPoints,DIM=2) Node = Node + 1 - u_IfW(1)%PositionXYZ(:,Node) = OtherSt_AD%WakeLocationPoints(:,J) - ! rewrite the history of this so that extrapolation doesn't make a mess of things - do k=2,size(u_IfW) - if (allocated(u_IfW(k)%PositionXYZ)) u_IfW(k)%PositionXYZ(:,Node) = u_IfW(1)%PositionXYZ(:,Node) - end do + u_IfW%PositionXYZ(:,Node) = OtherSt_AD%WakeLocationPoints(:,J) enddo end if + END IF - CALL IfW_SetExternalInputs( p_IfW, m_FAST, y_ED, u_IfW(1) ) + CALL IfW_SetExternalInputs( p_IfW, m_FAST, y_ED, u_IfW ) END SUBROUTINE IfW_InputSolve @@ -469,24 +548,39 @@ SUBROUTINE AD_InputSolve_IfW( p_FAST, u_AD, y_IfW, y_OpFM, ErrStat, ErrMsg ) end if - NumBl = size(u_AD%InflowOnBlade,3) - Nnodes = size(u_AD%InflowOnBlade,2) + NumBl = size(u_AD%rotors(1)%InflowOnBlade,3) + Nnodes = size(u_AD%rotors(1)%InflowOnBlade,2) do k=1,NumBl do j=1,Nnodes - u_AD%InflowOnBlade(:,j,k) = y_IfW%VelocityUVW(:,node) + u_AD%rotors(1)%InflowOnBlade(:,j,k) = y_IfW%VelocityUVW(:,node) node = node + 1 end do end do - if ( allocated(u_AD%InflowOnTower) ) then - Nnodes = size(u_AD%InflowOnTower,2) + if ( allocated(u_AD%rotors(1)%InflowOnTower) ) then + Nnodes = size(u_AD%rotors(1)%InflowOnTower,2) do j=1,Nnodes - u_AD%InflowOnTower(:,j) = y_IfW%VelocityUVW(:,node) + u_AD%rotors(1)%InflowOnTower(:,j) = y_IfW%VelocityUVW(:,node) node = node + 1 end do end if - ! velocity at vortex wake points velocity array handoff here + + if (u_AD%rotors(1)%NacelleMotion%NNodes > 0) then + u_AD%rotors(1)%InflowOnNacelle(:) = y_IfW%VelocityUVW(:,node) + node = node + 1 + else + u_AD%rotors(1)%InflowOnNacelle = 0.0_ReKi + end if + +! if (u_AD%HubMotion%NNodes > 0) then +! u_AD%InflowOnHub(:) = y_IfW%VelocityUVW(:,node) +! node = node + 1 +! else +! u_AD%InflowOnHub = 0.0_ReKi +! end if + + ! vortex points from FVW in AD15 (should be at then end, since not "rotor dependent" if ( allocated(u_AD%InflowWakeVel) ) then Nnodes = size(u_AD%InflowWakeVel,DIM=2) do j=1,Nnodes @@ -495,35 +589,52 @@ SUBROUTINE AD_InputSolve_IfW( p_FAST, u_AD, y_IfW, y_OpFM, ErrStat, ErrMsg ) end do end if - ELSEIF ( p_FAST%CompInflow == MODULE_OpFM ) THEN node = 2 !start of inputs to AD15 - NumBl = size(u_AD%InflowOnBlade,3) - Nnodes = size(u_AD%InflowOnBlade,2) + NumBl = size(u_AD%rotors(1)%InflowOnBlade,3) + Nnodes = size(u_AD%rotors(1)%InflowOnBlade,2) do k=1,NumBl do j=1,Nnodes - u_AD%InflowOnBlade(1,j,k) = y_OpFM%u(node) - u_AD%InflowOnBlade(2,j,k) = y_OpFM%v(node) - u_AD%InflowOnBlade(3,j,k) = y_OpFM%w(node) + u_AD%rotors(1)%InflowOnBlade(1,j,k) = y_OpFM%u(node) + u_AD%rotors(1)%InflowOnBlade(2,j,k) = y_OpFM%v(node) + u_AD%rotors(1)%InflowOnBlade(3,j,k) = y_OpFM%w(node) node = node + 1 end do end do - if ( allocated(u_AD%InflowOnTower) ) then - Nnodes = size(u_AD%InflowOnTower,2) + if ( allocated(u_AD%rotors(1)%InflowOnTower) ) then + Nnodes = size(u_AD%rotors(1)%InflowOnTower,2) do j=1,Nnodes - u_AD%InflowOnTower(1,j) = y_OpFM%u(node) - u_AD%InflowOnTower(2,j) = y_OpFM%v(node) - u_AD%InflowOnTower(3,j) = y_OpFM%w(node) + u_AD%rotors(1)%InflowOnTower(1,j) = y_OpFM%u(node) + u_AD%rotors(1)%InflowOnTower(2,j) = y_OpFM%v(node) + u_AD%rotors(1)%InflowOnTower(3,j) = y_OpFM%w(node) node = node + 1 end do - end if + end if + + if (u_AD%rotors(1)%NacelleMotion%NNodes > 0) then + u_AD%rotors(1)%InflowOnNacelle(1) = y_OpFM%u(node) + u_AD%rotors(1)%InflowOnNacelle(2) = y_OpFM%v(node) + u_AD%rotors(1)%InflowOnNacelle(3) = y_OpFM%w(node) + node = node + 1 + else + u_AD%rotors(1)%InflowOnNacelle = 0.0_ReKi + end if + +! if (u_AD%HubMotion%NNodes > 0) then +! u_AD%InflowOnHub(1) = y_OpFM%u(node) +! u_AD%InflowOnHub(2) = y_OpFM%v(node) +! u_AD%InflowOnHub(3) = y_OpFM%w(node) +! node = node + 1 +! else +! u_AD%InflowOnHub = 0.0_ReKi +! end if ELSE - u_AD%InflowOnBlade = 0.0_ReKi ! whole array + u_AD%rotors(1)%InflowOnBlade = 0.0_ReKi ! whole array END IF @@ -563,22 +674,22 @@ SUBROUTINE AD_InputSolve_NoIfW( p_FAST, u_AD, y_SrvD, y_ED, BD, MeshMapData, Err !------------------------------------------------------------------------------------------------- ! tower - IF (u_AD%TowerMotion%Committed) THEN + IF (u_AD%rotors(1)%TowerMotion%Committed) THEN - CALL Transfer_Line2_to_Line2( y_ED%TowerLn2Mesh, u_AD%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) + CALL Transfer_Line2_to_Line2( y_ED%TowerLn2Mesh, u_AD%rotors(1)%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%TowerMotion' ) END IF ! hub - CALL Transfer_Point_to_Point( y_ED%HubPtMotion, u_AD%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) + CALL Transfer_Point_to_Point( y_ED%HubPtMotion, u_AD%rotors(1)%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%HubMotion' ) ! blade root DO k=1,size(y_ED%BladeRootMotion) - CALL Transfer_Point_to_Point( y_ED%BladeRootMotion(k), u_AD%BladeRootMotion(k), MeshMapData%ED_P_2_AD_P_R(k), ErrStat2, ErrMsg2 ) + CALL Transfer_Point_to_Point( y_ED%BladeRootMotion(k), u_AD%rotors(1)%BladeRootMotion(k), MeshMapData%ED_P_2_AD_P_R(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeRootMotion('//trim(num2lstr(k))//')' ) END DO @@ -587,20 +698,29 @@ SUBROUTINE AD_InputSolve_NoIfW( p_FAST, u_AD, y_SrvD, y_ED, BD, MeshMapData, Err IF (p_FAST%CompElast == Module_ED ) THEN DO k=1,size(y_ED%BladeLn2Mesh) - CALL Transfer_Line2_to_Line2( y_ED%BladeLn2Mesh(k), u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) + CALL Transfer_Line2_to_Line2( y_ED%BladeLn2Mesh(k), u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeMotion('//trim(num2lstr(k))//')' ) END DO ELSEIF (p_FAST%CompElast == Module_BD ) THEN ! get them from BeamDyn - DO k=1,size(u_AD%BladeMotion) - CALL Transfer_Line2_to_Line2( BD%y(k)%BldMotion, u_AD%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) + DO k=1,size(u_AD%rotors(1)%BladeMotion) + CALL Transfer_Line2_to_Line2( BD%y(k)%BldMotion, u_AD%rotors(1)%BladeMotion(k), MeshMapData%BDED_L_2_AD_L_B(k), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//':u_AD%BladeMotion('//trim(num2lstr(k))//')' ) END DO + END IF + + ! nacelle + IF (u_AD%rotors(1)%NacelleMotion%Committed) THEN + + CALL Transfer_Point_to_Point( y_ED%NacelleMotion, u_AD%rotors(1)%NacelleMotion, MeshMapData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) END IF + + ! Set Conrol parameter (i.e. flaps) if using ServoDyn @@ -610,9 +730,9 @@ SUBROUTINE AD_InputSolve_NoIfW( p_FAST, u_AD, y_SrvD, y_ED, BD, MeshMapData, Err ! This is passed to AD15 to be interpolated with the airfoil table userprop column ! (might be used for airfoil flap angles for example) if (p_FAST%CompServo == Module_SrvD) then - DO k_bl=1,size(u_AD%UserProp,DIM=2) - DO k_bn=1,size(u_AD%UserProp,DIM=1) - u_AD%UserProp(k_bn , k_bl) = y_SrvD%BlAirfoilCom(k_bl) ! Must be same units as given in airfoil (no unit conversions handled in code) + DO k_bl=1,size(u_AD%rotors(1)%UserProp,DIM=2) + DO k_bn=1,size(u_AD%rotors(1)%UserProp,DIM=1) + u_AD%rotors(1)%UserProp(k_bn , k_bl) = y_SrvD%BlAirfoilCom(k_bl) ! Must be same units as given in airfoil (no unit conversions handled in code) END DO END DO endif @@ -804,29 +924,34 @@ SUBROUTINE AD14_InputSolve_NoIfW( p_FAST, u_AD14, y_ED, MeshMapData, ErrStat, Er ! u_AD14%MulTabLoc(IElements,IBlades) = ??? END SUBROUTINE AD14_InputSolve_NoIfW + !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the inputs required for ServoDyn -SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, MeshMapData, ErrStat, ErrMsg ) +SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, y_SD, MeshMapData, ErrStat, ErrMsg ) !.................................................................................................................................. TYPE(FAST_ParameterType), INTENT(IN) :: p_FAST !< Glue-code simulation parameters TYPE(FAST_MiscVarType), INTENT(IN) :: m_FAST !< Glue-code misc variables (including inputs from external sources like Simulink) TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< ServoDyn Inputs at t - TYPE(ED_OutputType), INTENT(IN) :: y_ED !< ElastoDyn outputs + TYPE(ED_OutputType),TARGET, INTENT(IN) :: y_ED !< ElastoDyn outputs TYPE(InflowWind_OutputType), INTENT(IN) :: y_IfW !< InflowWind outputs TYPE(OpFM_OutputType), INTENT(IN) :: y_OpFM !< OpenFOAM outputs TYPE(BD_OutputType), INTENT(IN) :: y_BD(:) !< BD Outputs + TYPE(SD_OutputType), INTENT(IN) :: y_SD !< SD Outputs TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message ! TYPE(AD_OutputType), INTENT(IN) :: y_AD !< AeroDyn outputs INTEGER(IntKi) :: k ! blade loop counter + INTEGER(IntKi) :: j ! StC instance counter + TYPE(MeshType), POINTER :: PlatformMotion INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_InputSolve' + PlatformMotion => y_ED%PlatformPtMesh ErrStat = ErrID_None ErrMsg = "" @@ -837,19 +962,13 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, M IF ( p_FAST%CompInflow == Module_IfW ) THEN u_SrvD%WindDir = ATAN2( y_IfW%VelocityUVW(2,1), y_IfW%VelocityUVW(1,1) ) - u_SrvD%YawErr = u_SrvD%WindDir - y_ED%YawAngle u_SrvD%HorWindV = SQRT( y_IfW%VelocityUVW(1,1)**2 + y_IfW%VelocityUVW(2,1)**2 ) ELSEIF ( p_FAST%CompInflow == Module_OpFM ) THEN u_SrvD%WindDir = ATAN2( y_OpFM%v(1), y_OpFM%u(1) ) - u_SrvD%YawErr = u_SrvD%WindDir - y_ED%YawAngle u_SrvD%HorWindV = SQRT( y_OpFM%u(1)**2 + y_OpFM%v(1)**2 ) - - if ( allocated(u_SrvD%SuperController) ) then - u_SrvD%SuperController = y_OpFM%SuperController - end if - + ELSE ! No wind inflow u_SrvD%WindDir = 0.0 @@ -859,6 +978,8 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, M + + ! ServoDyn inputs from combination of InflowWind and ElastoDyn @@ -879,7 +1000,7 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, M ! translate "b" system output from BD into "c" system for SrvD do k=1,p_FAST%nBeams u_SrvD%RootMxc(k) = y_BD(k)%RootMxr*COS(y_ED%BlPitch(k)) + y_BD(k)%RootMyr*SIN(y_ED%BlPitch(k)) - u_SrvD%RootMyc(k) = -y_BD(k)%RootMxr*SIN(y_ED%BlPitch(k)) + y_BD(k)%RootMyr*COS(y_ED%BlPitch(k)) + u_SrvD%RootMyc(k) = -y_BD(k)%RootMxr*SIN(y_ED%BlPitch(k)) + y_BD(k)%RootMyr*COS(y_ED%BlPitch(k)) end do ELSE @@ -912,21 +1033,67 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, M !END IF ! - IF (u_SrvD%NTMD%Mesh%Committed) THEN - - CALL Transfer_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NTMD%Mesh, MeshMapData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - END IF + ! StrucCtrl input motion meshes + IF ( ALLOCATED(u_SrvD%NStC) ) THEN + do j = 1,size(u_SrvD%NStC) + IF ( ALLOCATED(u_SrvD%NStC(j)%Mesh) ) THEN + IF (u_SrvD%NStC(j)%Mesh(1)%Committed) THEN + CALL Transfer_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_N(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + END IF + enddo + ENDIF - IF (u_SrvD%TTMD%Mesh%Committed) THEN - - CALL Transfer_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TTMD%Mesh, MeshMapData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - END IF - + IF ( ALLOCATED(u_SrvD%TStC) ) THEN + do j=1,size(u_SrvD%TStC) + IF ( ALLOCATED(u_SrvD%TStC(j)%Mesh) ) THEN + IF (u_SrvD%TStC(j)%Mesh(1)%Committed) THEN + CALL Transfer_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStC(j)%Mesh(1), MeshMapData%ED_L_2_SrvD_P_T(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + END IF + enddo + ENDIF + ! Blade StrucCtrl + IF ( p_FAST%CompElast == Module_ED ) then + IF ( ALLOCATED(u_SrvD%BStC) ) THEN + do j=1,size(u_SrvD%BStC) + IF ( ALLOCATED(u_SrvD%BStC(j)%Mesh) ) THEN + DO K = 1,SIZE(y_ED%BladeLn2Mesh,1) + IF (u_SrvD%BStC(j)%Mesh(K)%Committed) THEN + CALL Transfer_Line2_to_Point( y_ED%BladeLn2Mesh(K), u_SrvD%BStC(j)%Mesh(K), MeshMapData%ED_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + ENDDO + ENDIF + enddo + ENDIF + ELSEIF ( p_FAST%CompElast == Module_BD ) THEN + IF ( ALLOCATED(u_SrvD%BStC) ) THEN + do j=1,size(u_SrvD%BStC) + IF ( ALLOCATED(u_SrvD%BStC(j)%Mesh) ) THEN + DO K = 1,SIZE(y_BD,1) + IF (u_SrvD%BStC(j)%Mesh(K)%Committed) THEN + CALL Transfer_Line2_to_Point( y_BD(k)%BldMotion, u_SrvD%BStC(j)%Mesh(K), MeshMapData%BD_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + ENDDO + ENDIF + enddo + ENDIF + ENDIF + + ! Platform + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD ) THEN + call Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ELSE + call Transfer_SD_to_SStC( u_SrvD, y_SD, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + #ifdef SIMULINK_TIMESHIFT ! we're going to use the extrapolated values instead of the old values (Simulink inputs are from t, not t+dt) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, u_SrvD ) @@ -935,6 +1102,66 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, M END SUBROUTINE SrvD_InputSolve !---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the inputs for the SrvD%SStC mesh motion from ElastoDyn +SUBROUTINE Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat, ErrMsg ) +!.................................................................................................................................. + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< ServoDyn input + TYPE(ED_OutputType), INTENT(IN ) :: y_ED !< The outputs of the structural dynamics module + TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< data for mapping meshes between modules + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation + CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Generic counter + + ErrStat = ErrID_None + ErrMsg = '' + !---------------------------------------------------------------------------------------------------- + ! Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh -- motions + !---------------------------------------------------------------------------------------------------- + ! motions: + IF ( ALLOCATED(u_SrvD%SStC) ) THEN + do j=1,size(u_SrvD%SStC) + IF ( ALLOCATED(u_SrvD%SStC(j)%Mesh) ) THEN + IF (u_SrvD%SStC(j)%Mesh(1)%Committed) THEN + CALL Transfer_Point_to_Point( y_ED%PlatformPtMesh, u_SrvD%SStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_ED_to_SStC') + ENDIF + END IF + enddo + ENDIF +END SUBROUTINE Transfer_ED_to_SStC +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the inputs for the SrvD%SStC mesh motion from SubDyn +SUBROUTINE Transfer_SD_to_SStC( u_SrvD, y_SD, MeshMapData, ErrStat, ErrMsg ) +!.................................................................................................................................. + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< ServoDyn input + TYPE(SD_OutputType), INTENT(IN ) :: y_SD !< The outputs of the structural dynamics module + TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< data for mapping meshes between modules + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation + CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Generic counter + + ErrStat = ErrID_None + ErrMsg = '' + !---------------------------------------------------------------------------------------------------- + ! Map SubDyn platform point mesh motion to ServoDyn/SStC point mesh -- motions + !---------------------------------------------------------------------------------------------------- + ! motions: + IF ( ALLOCATED(u_SrvD%SStC) ) THEN + do j=1,size(u_SrvD%SStC) + IF ( ALLOCATED(u_SrvD%SStC(j)%Mesh) ) THEN + IF (u_SrvD%SStC(j)%Mesh(1)%Committed) THEN + CALL Transfer_Point_to_Point( y_SD%y2Mesh, u_SrvD%SStC(j)%Mesh(1), MeshMapData%SD_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_SD_to_SStC') + ENDIF + END IF + enddo + ENDIF +END SUBROUTINE Transfer_SD_to_SStC +!---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the inputs required for ServoDyn from an external source (Simulink) SUBROUTINE SrvD_SetExternalInputs( p_FAST, m_FAST, u_SrvD ) !.................................................................................................................................. @@ -1047,7 +1274,7 @@ SUBROUTINE Transfer_PlatformMotion_to_HD( PlatformMotion, u_HD, MeshMapData, Err END SUBROUTINE Transfer_PlatformMotion_to_HD !---------------------------------------------------------------------------------------------------------------------------------- !> This routine transfers the ED outputs into inputs required for HD, SD, ExtPtfm, BD, MAP, and/or FEAM -SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, u_MAP, u_FEAM, u_MD, u_Orca, u_BD, MeshMapData, ErrStat, ErrMsg ) +SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, u_MAP, u_FEAM, u_MD, u_Orca, u_BD, u_SrvD, MeshMapData, ErrStat, ErrMsg ) !.................................................................................................................................. TYPE(FAST_ParameterType), INTENT(IN) :: p_FAST !< Glue-code simulation parameters TYPE(ED_OutputType), INTENT(IN ) :: y_ED !< The outputs of the structural dynamics module @@ -1059,6 +1286,7 @@ SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, TYPE(MD_InputType), INTENT(INOUT) :: u_MD !< MoorDyn input TYPE(Orca_InputType), INTENT(INOUT) :: u_Orca !< OrcaFlex input TYPE(BD_InputType), INTENT(INOUT) :: u_BD(:) !< BeamDyn inputs + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< SrvD input TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< data for mapping meshes between modules INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status of the operation @@ -1138,6 +1366,13 @@ SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, END IF end if + + ! Map motions for ServodDyn Structural control (TMD) if used. + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD ) THEN + call Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//'u_SrvD%SStC%Mesh') + ENDIF + contains subroutine TransferEDToHD_PRP() @@ -1374,7 +1609,7 @@ END FUNCTION GetPerturb SUBROUTINE ED_HD_InputOutputSolve( this_time, p_FAST, calcJacobian & , u_ED, p_ED, x_ED, xd_ED, z_ED, OtherSt_ED, y_ED, m_ED & , u_HD, p_HD, x_HD, xd_HD, z_HD, OtherSt_HD, y_HD, m_HD & - , u_MAP, y_MAP, u_FEAM, y_FEAM, u_MD, y_MD & + , u_MAP, y_MAP, u_FEAM, y_FEAM, u_MD, y_MD, u_SrvD, y_SrvD & , MeshMapData , ErrStat, ErrMsg, WriteThisStep ) !.................................................................................................................................. @@ -1414,6 +1649,10 @@ SUBROUTINE ED_HD_InputOutputSolve( this_time, p_FAST, calcJacobian & TYPE(FEAM_InputType), INTENT(INOUT) :: u_FEAM !< FEAM inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) TYPE(MD_OutputType), INTENT(IN ) :: y_MD !< MoorDyn outputs TYPE(MD_InputType), INTENT(INOUT) :: u_MD !< MoorDyn inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) + + ! SrvD for TMD at platform + TYPE(SrvD_OutputType), INTENT(IN ) :: y_SrvD !< SrvD outputs + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< SrvD inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) TYPE(FAST_ModuleMapType) , INTENT(INOUT) :: MeshMapData !< data for mapping meshes between modules INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation @@ -1737,6 +1976,7 @@ SUBROUTINE U_ED_HD_Residual( y_ED2, y_HD2, u_IN, U_Resid) REAL(ReKi) , INTENT(IN ) :: u_in(NumInputs) REAL(ReKi) , INTENT( OUT) :: U_Resid(NumInputs) + integer(IntKi) :: j ! Generic counter TYPE(MeshType), POINTER :: PlatformMotions PlatformMotions => y_ED2%PlatformPtMesh @@ -1783,6 +2023,27 @@ SUBROUTINE U_ED_HD_Residual( y_ED2, y_HD2, u_IN, U_Resid) END IF + + ! Map motions for ServodDyn Structural control (TMD) if used and forces from the TMD to the platform + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD ) THEN + call Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//'u_SrvD%SStC%Mesh') + ! we're mapping loads, so we also need the sibling meshes' displacements: + IF ( ALLOCATED(y_SrvD%SStC) ) THEN ! Platform + do j=1,size(y_SrvD%SStC) + IF ( ALLOCATED(y_SrvD%SStC(j)%Mesh) ) THEN + IF (y_SrvD%SStC(j)%Mesh(1)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStC(j)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh_3, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStC(j)%Mesh(1), PlatformMotions ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + MeshMapData%u_ED_PlatformPtMesh_2%Force = MeshMapData%u_ED_PlatformPtMesh_2%Force + MeshMapData%u_ED_PlatformPtMesh_3%Force + MeshMapData%u_ED_PlatformPtMesh_2%Moment = MeshMapData%u_ED_PlatformPtMesh_2%Moment + MeshMapData%u_ED_PlatformPtMesh_3%Moment + ENDIF + ENDIF + enddo + ENDIF + ENDIF + + ! we use copies of the input meshes (we don't need to update values in the original data structures): !bjj: why don't we update u_HD2 here? shouldn't we update before using it to transfer the loads? @@ -1859,6 +2120,7 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & , u_MD, y_MD & , u_IceF, y_IceF & , u_IceD, y_IceD & + , u_SrvD, y_SrvD & , MeshMapData , ErrStat, ErrMsg, WriteThisStep ) !.................................................................................................................................. @@ -1946,6 +2208,8 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & TYPE(IceFloe_InputType), INTENT(INOUT) :: u_IceF !< IceFloe inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) TYPE(IceD_OutputType), INTENT(IN ) :: y_IceD(:) !< IceDyn outputs TYPE(IceD_InputType), INTENT(INOUT) :: u_IceD(:) !< IceDyn inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) + TYPE(SrvD_OutputType), INTENT(IN ) :: y_SrvD !< SrvD outputs + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD !< SrvD inputs (INOUT just because I don't want to use another tempoarary mesh and we'll overwrite this later) TYPE(FAST_ModuleMapType) , INTENT(INOUT) :: MeshMapData !< data for mapping meshes between modules INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation @@ -2081,7 +2345,7 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & CALL Create_FullOpt1_UVector(u, u_ED%PlatformPtMesh, u_SD%TPMesh, u_SD%LMesh, & u_HD%Morison%Mesh, u_HD%WAMITMesh, u_ED%HubPtLoad, MeshMapData%u_BD_RootMotion, u_Orca%PtfmMesh, & - u_ExtPtfm%PtfmMesh, p_FAST ) + u_ExtPtfm%PtfmMesh, u_SrvD%SStC, p_FAST ) K = 0 @@ -2643,6 +2907,7 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, REAL(ReKi) , INTENT( OUT) :: U_Resid(:) INTEGER(IntKi) :: i ! counter for ice leg and beamdyn loops + INTEGER(IntKi) :: k ! counter for SrvD TMD instances TYPE(MeshType), POINTER :: PlatformMotions PlatformMotions => y_ED2%PlatformPtMesh @@ -2697,6 +2962,7 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, END IF + IF ( p_FAST%CompIce == Module_IceF ) THEN CALL IceFloe_InputSolve( u_IceF, y_SD2, MeshMapData, ErrStat2, ErrMsg2 ) @@ -2712,7 +2978,18 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, END DO END IF - + + + !.................. + ! Set motions for the ServoDyn Structural control for platform inputs (this has accelerations, but we assume the loads generated are small) + ! Note that these values get overwritten at the completion of this routine.) + !.................. + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub == Module_SD ) THEN + call Transfer_SD_to_SStC( u_SrvD, y_SD2, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + + IF ( p_FAST%CompElast == Module_BD .and. BD_Solve_Option1) THEN ! Transfer ED motions to BD inputs: @@ -2735,12 +3012,13 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, IF ( p_FAST%CompSub == Module_SD ) THEN - IF ( p_FAST%CompHydro == Module_HD ) THEN - - ! initialize these SD loads inputs here in case HD is used (note from initialiazation that these meshes don't exist if HD isn't used) + IF ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%SStC)) ) THEN + ! initialize these SD loads inputs here in case HD is used (note from initialiazation that these meshes don't exist if HD isn't used) MeshMapData%u_SD_LMesh%Force = 0.0_ReKi MeshMapData%u_SD_LMesh%Moment = 0.0_ReKi - + ENDIF + + IF ( p_FAST%CompHydro == Module_HD ) THEN !.................. ! Get HD inputs on Morison%Mesh and WAMITMesh @@ -2806,8 +3084,25 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, END DO END IF ! Ice loading - + END IF ! HD is used (IceFloe/IceDyn can't be used unless HydroDyn is used) + + !.................. + ! Get SD loads inputs from ServoDyn Structural control + !.................. + + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%SStC) ) THEN + do k=1,size(y_SrvD%SStC) + IF ( ALLOCATED(y_SrvD%SStC(k)%Mesh) ) THEN + IF (y_SrvD%SStC(k)%Mesh(1)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStC(k)%Mesh(1), MeshMapData%u_SD_LMesh_2, MeshMapData%SrvD_P_P_2_SD_P(k), ErrStat2, ErrMsg2, u_SrvD%SStC(k)%Mesh(1), y_SD2%Y2Mesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName ) + MeshMapData%u_SD_LMesh%Force = MeshMapData%u_SD_LMesh%Force + MeshMapData%u_SD_LMesh_2%Force + MeshMapData%u_SD_LMesh%Moment = MeshMapData%u_SD_LMesh%Moment + MeshMapData%u_SD_LMesh_2%Moment + ENDIF + END IF + enddo + ENDIF @@ -2965,6 +3260,21 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, MeshMapData%u_ED_PlatformPtMesh%Moment = MeshMapData%u_ED_PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh_2%Moment END IF + + ! Map the forces from the platform mounted TMD (from ServoDyn) to the platform reference point + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD .and. allocated(y_SrvD%SStC)) THEN + do k=1,size(y_SrvD%SStC) + IF ( ALLOCATED(y_SrvD%SStC(k)%Mesh) ) THEN + IF (y_SrvD%SStC(k)%Mesh(1)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStC(k)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh_2, MeshMapData%SrvD_P_P_2_ED_P(k), ErrStat2, ErrMsg2, u_SrvD%SStC(k)%Mesh(1), PlatformMotions ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + MeshMapData%u_ED_PlatformPtMesh%Force = MeshMapData%u_ED_PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh_2%Force + MeshMapData%u_ED_PlatformPtMesh%Moment = MeshMapData%u_ED_PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh_2%Moment + ENDIF + ENDIF + enddo + ENDIF + !.................. ! Calculate the residual with these new inputs: !.................. @@ -2972,7 +3282,7 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, CALL Create_FullOpt1_UVector(U_Resid, MeshMapData%u_ED_PlatformPtMesh, MeshMapData%u_SD_TPMesh, MeshMapData%u_SD_LMesh, & MeshMapData%u_HD_M_Mesh, MeshMapData%u_HD_W_Mesh, & MeshMapData%u_ED_HubPtLoad, MeshMapData%u_BD_RootMotion, MeshMapData%u_Orca_PtfmMesh, & - MeshMapData%u_ExtPtfm_PtfmMesh, p_FAST ) + MeshMapData%u_ExtPtfm_PtfmMesh, u_SrvD%SStC, p_FAST ) U_Resid = u_in - U_Resid @@ -2983,6 +3293,7 @@ END SUBROUTINE U_FullOpt1_Residual SUBROUTINE CleanUp() INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) + INTEGER(IntKi) :: nb_local IF ( calcJacobian ) THEN CALL ED_DestroyInput( u_ED_perturb, ErrStat3, ErrMsg3 ) @@ -3003,8 +3314,8 @@ SUBROUTINE CleanUp() CALL BD_DestroyInput( u_BD_perturb, ErrStat3, ErrMsg3 ) IF (ErrStat3 /= ErrID_None) CALL WrScr(' '//RoutineName//TRIM(ErrMsg3) ) if (allocated(y_BD_perturb)) then - do nb=1,size(y_BD_perturb) - CALL BD_DestroyOutput(y_BD_perturb(nb), ErrStat3, ErrMsg3 ) + do nb_local=1,size(y_BD_perturb) + CALL BD_DestroyOutput(y_BD_perturb(nb_local), ErrStat3, ErrMsg3 ) IF (ErrStat3 /= ErrID_None) CALL WrScr(' '//RoutineName//TRIM(ErrMsg3) ) end do deallocate(y_BD_perturb) @@ -3030,7 +3341,7 @@ END SUBROUTINE FullOpt1_InputOutputSolve !> This routine initializes the array that maps rows/columns of the Jacobian to specific mesh fields. !! Do not change the order of this packing without changing subroutine Create_FullOpt1_UVector()! SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD_M_Mesh, & - HD_WAMIT_Mesh, ED_HubPtLoad, u_BD, Orca_PtfmMesh, ExtPtfm_PtfmMesh, ErrStat, ErrMsg) + HD_WAMIT_Mesh, ED_HubPtLoad, u_BD, Orca_PtfmMesh, ExtPtfm_PtfmMesh, SrvD_u_SStC, ErrStat, ErrMsg) TYPE(FAST_ParameterType) , INTENT(INOUT) :: p_FAST !< FAST parameters TYPE(FAST_ModuleMapType) , INTENT(INOUT) :: MeshMapData !< data that maps meshes together @@ -3045,6 +3356,7 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP TYPE(BD_InputType) , INTENT(IN ) :: u_BD(:) !< inputs for each instance of the BeamDyn module (for the RootMotion meshes) TYPE(MeshType) , INTENT(IN ) :: Orca_PtfmMesh !< OrcaFlex interface PtfmMesh TYPE(MeshType) , INTENT(IN ) :: ExtPtfm_PtfmMesh !< ExtPtfm_MCKF interface PtfmMesh + TYPE(StC_InputType), ALLOCATABLE , INTENT(IN ) :: SrvD_u_SStC(:) !< ServoDyn SStC inputs (this will be changed later to mesh) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -3068,7 +3380,7 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP p_FAST%SizeJac_Opt1(3) = SD_TPMesh%NNodes*6 ! SD inputs: 6 accelerations per node (size of SD input from ED) - IF ( p_FAST%CompHydro == Module_HD ) THEN + IF ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) THEN p_FAST%SizeJac_Opt1(3) = p_FAST%SizeJac_Opt1(3) & + SD_LMesh%NNodes *6 ! SD inputs: 6 loads per node (size of SD input from HD) END IF @@ -3197,7 +3509,7 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP end do !j end do !i - IF ( p_FAST%CompHydro == Module_HD ) THEN ! this SD mesh linked only when HD is enabled + if ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) then ! this SD mesh linked only when HD is enabled, or SrvD SStC enabled ! SD_LMesh do i=1,SD_LMesh%NNodes @@ -3345,7 +3657,7 @@ END SUBROUTINE Init_FullOpt1_Jacobian !> This routine basically packs the relevant parts of the modules' input meshes for use in this InputOutput solve. !! Do not change the order of this packing without changing subroutine Init_FullOpt1_Jacobian()! SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD_M_Mesh, HD_WAMIT_Mesh, & - ED_HubPtLoad, BD_RootMotion, Orca_PtfmMesh, ExtPtfm_PtfmMesh, p_FAST ) + ED_HubPtLoad, BD_RootMotion, Orca_PtfmMesh, ExtPtfm_PtfmMesh, SrvD_u_SStC, p_FAST ) !.................................................................................................................................. REAL(ReKi) , INTENT(INOUT) :: u(:) !< output u vector @@ -3360,6 +3672,7 @@ SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD TYPE(MeshType) , INTENT(IN ) :: BD_RootMotion(:) !< BeamDyn RootMotion meshes TYPE(MeshType) , INTENT(IN ) :: Orca_PtfmMesh !< OrcaFlex interface PtfmMesh TYPE(MeshType) , INTENT(IN ) :: ExtPtfm_PtfmMesh !< ExtPtfm interface PtfmMesh + TYPE(StC_InputType), ALLOCATABLE , INTENT(IN ) :: SrvD_u_SStC(:) !< ServoDyn SStC inputs (this will be changed later to mesh) TYPE(FAST_ParameterType) , INTENT(IN ) :: p_FAST !< FAST parameters @@ -3411,7 +3724,7 @@ SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD indx_first = indx_last + 1 end do - if ( p_FAST%CompHydro == Module_HD ) then ! this SD mesh linked only when HD is enabled + if ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) then ! this SD mesh linked only when HD is enabled, or SrvD SStC enabled ! SD inputs (SD_LMesh): do i=1,SD_LMesh%NNodes indx_last = indx_first + 2 @@ -3726,6 +4039,7 @@ SUBROUTINE ResetRemapFlags(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, MAPp INTEGER(IntKi) :: i ! counter for ice legs INTEGER(IntKi) :: k ! counter for blades + INTEGER(IntKi) :: j ! Counter for StC instances !..................................................................... ! Reset each mesh's RemapFlag (after calling all InputSolve routines): @@ -3778,38 +4092,85 @@ SUBROUTINE ResetRemapFlags(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, MAPp END IF ELSEIF ( p_FAST%CompAero == Module_AD ) THEN - AD%Input(1)%HubMotion%RemapFlag = .FALSE. + AD%Input(1)%rotors(1)%HubMotion%RemapFlag = .FALSE. - IF (AD%Input(1)%TowerMotion%Committed) THEN - AD%Input(1)%TowerMotion%RemapFlag = .FALSE. + IF (AD%Input(1)%rotors(1)%TowerMotion%Committed) THEN + AD%Input(1)%rotors(1)%TowerMotion%RemapFlag = .FALSE. - IF (AD%y%TowerLoad%Committed) THEN - AD%y%TowerLoad%RemapFlag = .FALSE. + IF (AD%y%rotors(1)%TowerLoad%Committed) THEN + AD%y%rotors(1)%TowerLoad%RemapFlag = .FALSE. END IF - END IF + END IF + + IF (AD%Input(1)%rotors(1)%NacelleMotion%Committed) THEN + AD%Input(1)%rotors(1)%NacelleMotion%RemapFlag = .FALSE. + AD%y%rotors(1)%NacelleLoad%RemapFlag = .FALSE. + END IF - DO k=1,SIZE(AD%Input(1)%BladeMotion) - AD%Input(1)%BladeRootMotion(k)%RemapFlag = .FALSE. - AD%Input(1)%BladeMotion( k)%RemapFlag = .FALSE. - AD%y%BladeLoad( k)%RemapFlag = .FALSE. + DO k=1,SIZE(AD%Input(1)%rotors(1)%BladeMotion) + AD%Input(1)%rotors(1)%BladeRootMotion(k)%RemapFlag = .FALSE. + AD%Input(1)%rotors(1)%BladeMotion( k)%RemapFlag = .FALSE. + AD%y%rotors(1)%BladeLoad( k)%RemapFlag = .FALSE. END DO END IF - ! ServoDyn + ! ServoDyn -- StrucCtrl meshes IF ( p_FAST%CompServo == Module_SrvD ) THEN - IF (SrvD%y%NTMD%Mesh%Committed) THEN - SrvD%y%NTMD%Mesh%RemapFlag = .FALSE. - SrvD%Input(1)%NTMD%Mesh%RemapFlag = .FALSE. + IF ( ALLOCATED(SrvD%y%NStC) ) THEN + do j=1,size(SrvD%y%NStC) + IF ( ALLOCATED(SrvD%y%NStC(j)%Mesh) ) THEN + DO K = 1,SIZE(SrvD%y%NStC(j)%Mesh) + IF (SrvD%y%NStC(j)%Mesh(K)%Committed) THEN + SrvD%y%NStC(j)%Mesh(K)%RemapFlag = .FALSE. + SrvD%Input(1)%NStC(j)%Mesh(K)%RemapFlag = .FALSE. + END IF + ENDDO + END IF + enddo END IF - - IF (SrvD%y%TTMD%Mesh%Committed) THEN - SrvD%y%TTMD%Mesh%RemapFlag = .FALSE. - SrvD%Input(1)%TTMD%Mesh%RemapFlag = .FALSE. - END IF + + IF ( ALLOCATED(SrvD%y%TStC) ) THEN + do j=1,size(SrvD%y%TStC) + IF ( ALLOCATED(SrvD%y%TStC(j)%Mesh) ) THEN + DO K = 1,SIZE(SrvD%y%TStC(j)%Mesh) + IF (SrvD%y%TStC(j)%Mesh(K)%Committed) THEN + SrvD%y%TStC(j)%Mesh(K)%RemapFlag = .FALSE. + SrvD%Input(1)%TStC(j)%Mesh(K)%RemapFlag = .FALSE. + END IF + ENDDO + END IF + enddo + ENDIF + + IF ( ALLOCATED(SrvD%y%BStC) ) THEN + do j=1,size(SrvD%y%BStC) + IF ( ALLOCATED(SrvD%y%BStC(j)%Mesh) ) THEN + DO K = 1,SIZE(SrvD%y%BStC(j)%Mesh) + IF (SrvD%y%BStC(j)%Mesh(K)%Committed) THEN + SrvD%y%BStC(j)%Mesh(K)%RemapFlag = .FALSE. + SrvD%Input(1)%BStC(j)%Mesh(K)%RemapFlag = .FALSE. + END IF + END DO + END IF + enddo + ENDIF + + IF ( ALLOCATED(SrvD%y%SStC) ) THEN + do j=1,size(SrvD%y%SStC) + IF ( ALLOCATED(SrvD%y%SStC(j)%Mesh) ) THEN + DO K = 1,SIZE(SrvD%y%SStC(j)%Mesh) + IF (SrvD%y%SStC(j)%Mesh(K)%Committed) THEN + SrvD%y%SStC(j)%Mesh(K)%RemapFlag = .FALSE. + SrvD%Input(1)%SStC(j)%Mesh(K)%RemapFlag = .FALSE. + END IF + END DO + END IF + enddo + ENDIF + END IF - ! HydroDyn IF ( p_FAST%CompHydro == Module_HD ) THEN @@ -3904,6 +4265,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M INTEGER :: K, i ! loop counters + INTEGER :: j ! loop counter for StC instance INTEGER :: NumBl ! number of blades INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMSg2 @@ -3937,7 +4299,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M RETURN END IF - DO K=1,NumBl + DO K=1,NumBl CALL MeshMapCreate( ED%y%BladeRootMotion(K), BD%Input(1,k)%RootMotion, MeshMapData%ED_P_2_BD_P(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_BD_BladeRootMotion('//TRIM(Num2LStr(K))//')' ) CALL MeshMapCreate( BD%y(k)%ReactionForce, ED%Input(1)%HubPtLoad, MeshMapData%BD_P_2_ED_P(K), ErrStat2, ErrMsg2 ) @@ -3951,36 +4313,157 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M RETURN END IF - DO K=1,NumBl + DO K=1,NumBl CALL MeshMapCreate( ED%y%HubPtMotion, BD%Input(1,k)%HubMotion, MeshMapData%ED_P_2_BD_P_Hub(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_BD_HubMotion('//TRIM(Num2LStr(K))//')' ) END DO END IF - + + IF ( p_FAST%CompServo == Module_SrvD ) THEN !------------------------- -! ElastoDyn <-> ServoDyn +! ServoDyn <-> ElastoDyn !------------------------- - - IF ( SrvD%Input(1)%NTMD%Mesh%Committed ) THEN ! ED-SrvD - - CALL MeshMapCreate( ED%y%NacelleMotion, SrvD%Input(1)%NTMD%Mesh, MeshMapData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_NacelleMotion' ) - CALL MeshMapCreate( SrvD%y%NTMD%Mesh, ED%Input(1)%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_NacelleLoads' ) - - END IF - - IF ( SrvD%Input(1)%TTMD%Mesh%Committed ) THEN ! ED-SrvD - - CALL MeshMapCreate( ED%y%TowerLn2Mesh, SrvD%Input(1)%TTMD%Mesh, MeshMapData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_TowerMotion' ) - CALL MeshMapCreate( SrvD%y%TTMD%Mesh, ED%Input(1)%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_TowerLoad' ) - - END IF - + ! Nacelle TMD + IF ( ALLOCATED(SrvD%Input(1)%NStC) ) THEN + j=size(SrvD%Input(1)%NStC) + ALLOCATE( MeshMapData%ED_P_2_SrvD_P_N(j), MeshMapData%SrvD_P_2_ED_P_N(j), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_P_2_SrvD_P_N and MeshMapData%SrvD_P_2_ED_P_N.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%NStC) + IF ( ALLOCATED(SrvD%Input(1)%NStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%NStC(j)%Mesh(1)%Committed ) THEN + CALL MeshMapCreate( ED%y%NacelleMotion, SrvD%Input(1)%NStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_N(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_NacelleMotion' ) + CALL MeshMapCreate( SrvD%y%NStC(j)%Mesh(1), ED%Input(1)%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_NacelleLoads' ) + ENDIF + END IF + enddo + END IF + + ! Tower TMD + IF ( ALLOCATED(SrvD%Input(1)%TStC) ) THEN + j=size(SrvD%Input(1)%TStC) + ALLOCATE( MeshMapData%ED_L_2_SrvD_P_T(j), MeshMapData%SrvD_P_2_ED_P_T(j), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_SrvD_P_T and MeshMapData%SrvD_P_2_ED_P_T.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%TStC) + IF ( ALLOCATED(SrvD%Input(1)%TStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%TStC(j)%Mesh(1)%Committed ) THEN + CALL MeshMapCreate( ED%y%TowerLn2Mesh, SrvD%Input(1)%TStC(j)%Mesh(1), MeshMapData%ED_L_2_SrvD_P_T(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_TowerMotion' ) + CALL MeshMapCreate( SrvD%y%TStC(j)%Mesh(1), ED%Input(1)%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_TowerLoad' ) + CALL MeshCopy ( ED%Input(1)%TowerPtLoads, MeshMapData%u_ED_TowerPtLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_TowerPtLoads' ) + ENDIF + END IF + enddo + ENDIF + +!------------------------- +! ServoDyn <-> Blades +!------------------------- + IF ( ALLOCATED(SrvD%Input(1)%BStC) ) THEN + IF ( p_FAST%CompElast == Module_ED ) then ! ElastoDyn Blades + j=size(SrvD%Input(1)%BStC) + ALLOCATE( MeshMapData%ED_L_2_SrvD_P_B(j,NumBl), MeshMapData%SrvD_P_2_ED_P_B(j,NumBl), MeshMapData%u_ED_BladePtLoads(NumBl), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_SrvD_P_B and MeshMapData%SrvD_P_2_ED_P_B and MeshMapData%u_ED_BladePtLoads.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%BStC) + DO K = 1,NumBl + IF ( SrvD%Input(1)%BStC(j)%Mesh(K)%Committed ) THEN + CALL MeshMapCreate( ED%y%BladeLn2Mesh(K), SrvD%Input(1)%BStC(j)%Mesh(K), MeshMapData%ED_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_L_2_SrvD_P_B' ) + CALL MeshMapCreate( SrvD%y%BStC(j)%Mesh(K), ED%Input(1)%BladePtLoads(K), MeshMapData%SrvD_P_2_ED_P_B(j,K), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_2_ED_P_B' ) + CALL MeshCopy ( ED%Input(1)%BladePtLoads(K), MeshMapData%u_ED_BladePtLoads(K), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_BladePtLoads('//trim(num2lstr(j))//','//trim(num2lstr(k))//')' ) + END IF + ENDDO + enddo + ELSEIF ( p_FAST%CompElast == Module_BD ) THEN ! BeamDyn Blades + j=size(SrvD%Input(1)%BStC) + ALLOCATE( MeshMapData%BD_L_2_SrvD_P_B(j,NumBl), MeshMapData%SrvD_P_2_BD_P_B(j,NumBl), MeshMapData%u_BD_DistrLoad(NumBl), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%BD_L_2_SrvD_P_B and MeshMapData%SrvD_P_2_BD_P_B and MeshMapData%u_BD_DistrLoad.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%BStC) + DO K = 1,NumBl + IF ( SrvD%Input(1)%BStC(j)%Mesh(K)%Committed ) THEN + CALL MeshMapCreate( BD%y(k)%BldMotion, SrvD%Input(1)%BStC(j)%Mesh(K), MeshMapData%BD_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BD_L_2_SrvD_P_B' ) + CALL MeshMapCreate( SrvD%y%BStC(j)%Mesh(K), BD%Input(1,k)%DistrLoad, MeshMapData%SrvD_P_2_BD_P_B(j,K), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_2_BD_P_B' ) + CALL MeshCopy ( BD%Input(1,k)%DistrLoad, MeshMapData%u_BD_DistrLoad(k), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_BD_DistrLoad('//trim(num2lstr(k))//')' ) + END IF + ENDDO + enddo + ENDIF + ENDIF + +!------------------------- +! ServoDyn <-> Platform +!------------------------- + IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN + IF ( p_FAST%CompSub /= Module_SD ) THEN ! all of these get mapped to ElastoDyn ! (offshore floating with rigid substructure) + j=size(SrvD%Input(1)%SStC) + ALLOCATE( MeshMapData%SrvD_P_P_2_ED_P(j), MeshMapData%ED_P_2_SrvD_P_P(j), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SrvD_P_P_2_ED_P and MeshMapData%ED_P_2_SrvD_P_P.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%SStC) + IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN ! Single point per SStC instance + ! ServoDyn SStC point mesh to/from ElastoDyn point mesh + CALL MeshMapCreate( PlatformMotion, SrvD%Input(1)%SStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_SrvD_P_P' ) + CALL MeshMapCreate( SrvD%y%SStC(j)%Mesh(1), PlatformLoads, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_P_2_ED_P' ) + ENDIF + ENDIF + enddo + ELSE ! SubDyn is used + j=size(SrvD%Input(1)%SStC) + ALLOCATE( MeshMapData%SrvD_P_P_2_SD_P(j), MeshMapData%SD_P_2_SrvD_P_P(j), STAT=ErrStat2 ) + IF ( ErrStat2 /= 0 ) THEN + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SrvD_P_P_2_SD_P and MeshMapData%SD_P_2_SrvD_P_P.', & + ErrStat, ErrMsg, RoutineName ) + RETURN + END IF + do j=1,size(SrvD%Input(1)%SStC) + IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN ! Single point per SStC instance + ! ServoDyn SStC point mesh to/from SubDyn point mesh + CALL MeshMapCreate( SrvD%y%SStC(j)%Mesh(1), SD%Input(1)%LMesh, MeshMapData%SrvD_P_P_2_SD_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_P_2_SD_P' ) + CALL MeshMapCreate( SD%y%y2Mesh, SrvD%Input(1)%SStC(j)%Mesh(1), MeshMapData%SD_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SD_P_2_SrvD_P_P' ) + ENDIF + ENDIF + enddo + ENDIF + ENDIF + ENDIF + + + !------------------------- ! ElastoDyn <-> AeroDyn14 !------------------------- @@ -4022,7 +4505,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M RETURN END IF - ! Blade meshes: (allocate two mapping data structures to number of blades, then allocate data inside the structures) + ! Blade meshes: (allocate two mapping data structures to number of blades, then allocate data inside the structures) ALLOCATE( MeshMapData%BDED_L_2_AD_L_B(NumBl), MeshMapData%AD_L_2_BDED_B(NumBl), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%BDED_L_2_AD_L_B and MeshMapData%AD_L_2_BDED_B.', & @@ -4031,42 +4514,52 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M END IF - + !------------------------- ! ElastoDyn <-> AeroDyn !------------------------- ! blade root meshes DO K=1,NumBl - CALL MeshMapCreate( ED%y%BladeRootMotion(K), AD%Input(1)%BladeRootMotion(K), MeshMapData%ED_P_2_AD_P_R(K), ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( ED%y%BladeRootMotion(K), AD%Input(1)%rotors(1)%BladeRootMotion(K), MeshMapData%ED_P_2_AD_P_R(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_RootMotion('//TRIM(Num2LStr(K))//')' ) END DO ! Hub point mesh - CALL MeshMapCreate( ED%y%HubPtMotion, AD%Input(1)%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( ED%y%HubPtMotion, AD%Input(1)%rotors(1)%HubMotion, MeshMapData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_HubMotion' ) ! Tower mesh: - IF ( AD%Input(1)%TowerMotion%Committed ) THEN - CALL MeshMapCreate( ED%y%TowerLn2Mesh, AD%Input(1)%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) + IF ( AD%Input(1)%rotors(1)%TowerMotion%Committed ) THEN + CALL MeshMapCreate( ED%y%TowerLn2Mesh, AD%Input(1)%rotors(1)%TowerMotion, MeshMapData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_TowerMotion' ) - IF ( AD%y%TowerLoad%Committed ) THEN - CALL MeshMapCreate( AD%y%TowerLoad, ED%Input(1)%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2 ) + IF ( AD%y%rotors(1)%TowerLoad%Committed ) THEN + CALL MeshMapCreate( AD%y%rotors(1)%TowerLoad, ED%Input(1)%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_ED_TowerLoad' ) END IF END IF + + ! Nacelle mesh: + IF ( AD%Input(1)%rotors(1)%NacelleMotion%Committed ) THEN + CALL MeshMapCreate( ED%y%NacelleMotion, AD%Input(1)%rotors(1)%NacelleMotion, MeshMapData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_NacelleMotion' ) + CALL MeshMapCreate( AD%y%rotors(1)%NacelleLoad, ED%Input(1)%NacelleLoads, MeshMapData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_ED_NacelleLoads' ) + + CALL MeshCopy( ED%Input(1)%NacelleLoads, MeshMapData%u_ED_NacelleLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_NacelleLoads' ) + END IF - IF ( p_FAST%CompElast == Module_ED ) then ! Blade meshes: DO K=1,NumBl - CALL MeshMapCreate( ED%y%BladeLn2Mesh(K), AD%Input(1)%BladeMotion(K), MeshMapData%BDED_L_2_AD_L_B(K), ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( ED%y%BladeLn2Mesh(K), AD%Input(1)%rotors(1)%BladeMotion(K), MeshMapData%BDED_L_2_AD_L_B(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_BladeMotion('//TRIM(Num2LStr(K))//')' ) - CALL MeshMapCreate( AD%y%BladeLoad(K), ED%Input(1)%BladePtLoads(K), MeshMapData%AD_L_2_BDED_B(K), ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( AD%y%rotors(1)%BladeLoad(K), ED%Input(1)%BladePtLoads(K), MeshMapData%AD_L_2_BDED_B(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_ED_BladeLoad('//TRIM(Num2LStr(K))//')' ) END DO @@ -4078,9 +4571,9 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M ! connect AD mesh with BeamDyn DO K=1,NumBl - CALL MeshMapCreate( BD%y(k)%BldMotion, AD%Input(1)%BladeMotion(K), MeshMapData%BDED_L_2_AD_L_B(K), ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( BD%y(k)%BldMotion, AD%Input(1)%rotors(1)%BladeMotion(K), MeshMapData%BDED_L_2_AD_L_B(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BD_2_AD_BladeMotion('//TRIM(Num2LStr(K))//')' ) - CALL MeshMapCreate( AD%y%BladeLoad(K), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(K), ErrStat2, ErrMsg2 ) + CALL MeshMapCreate( AD%y%rotors(1)%BladeLoad(K), BD%Input(1,k)%DistrLoad, MeshMapData%AD_L_2_BDED_B(K), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_BD_BladeLoad('//TRIM(Num2LStr(K))//')' ) END DO @@ -4345,7 +4838,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M IF ( p_FAST%CompSub /= Module_None .OR. (p_FAST%CompElast == Module_BD .and. BD_Solve_Option1) .or. p_FAST%CompMooring == Module_Orca) THEN !.OR. p_FAST%CompHydro == Module_HD ) THEN CALL Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED%Input(1)%PlatformPtMesh, SD%Input(1)%TPMesh, SD%Input(1)%LMesh, & HD%Input(1)%Morison%Mesh, HD%Input(1)%WAMITMesh, & - ED%Input(1)%HubPtLoad, BD%Input(1,:), Orca%Input(1)%PtfmMesh, ExtPtfm%Input(1)%PtfmMesh, ErrStat2, ErrMsg2) + ED%Input(1)%HubPtLoad, BD%Input(1,:), Orca%Input(1)%PtfmMesh, ExtPtfm%Input(1)%PtfmMesh, SrvD%Input(1)%SStC, ErrStat2, ErrMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ELSEIF ( p_FAST%CompHydro == Module_HD ) THEN CALL AllocAry( MeshMapData%Jacobian_Opt1, SizeJac_ED_HD, SizeJac_ED_HD, 'Jacobian for Ptfm-HD coupling', ErrStat2, ErrMsg2 ) @@ -4380,7 +4873,10 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh_2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh_2' ) - + + CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh_3, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh_3' ) + IF ( p_FAST%CompElast == Module_BD ) THEN @@ -4407,16 +4903,16 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M CALL MeshCopy ( SD%Input(1)%TPMesh, MeshMapData%u_SD_TPMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_TPMesh' ) - IF ( p_FAST%CompHydro == Module_HD ) THEN - + IF ( p_FAST%CompHydro == Module_HD .or. ( p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD%Input(1)%SStC) )) THEN CALL MeshCopy ( SD%Input(1)%LMesh, MeshMapData%u_SD_LMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_LMesh' ) - - CALL MeshCopy ( SD%Input(1)%LMesh, MeshMapData%u_SD_LMesh_2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_LMesh_2' ) - END IF - + + IF ( p_FAST%CompHydro == Module_HD .or. ( p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD%Input(1)%SStC) )) THEN + CALL MeshCopy ( SD%Input(1)%LMesh, MeshMapData%u_SD_LMesh_2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_LMesh_2' ) + ENDIF + ELSE IF ( p_FAST%CompSub == Module_ExtPtfm ) THEN CALL MeshCopy ( ExtPtfm%Input(1)%PtfmMesh, MeshMapData%u_ExtPtfm_PtfmMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) @@ -4446,6 +4942,12 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M END IF + ELSEIF ( p_FAST%CompSub /= Module_SD ) THEN ! Platform loads from SrvD Structural control (TMDs) if not SD + IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN ! Platform TMD loads + CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh' ) + ENDIF + END IF @@ -4537,7 +5039,7 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca !> Solve option 2 (modules without direct feedthrough): - CALL SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, n_t_global < 0, WriteThisStep) + CALL SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, n_t_global < 0, WriteThisStep) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) #ifdef OUTPUT_MASS_MATRIX @@ -4555,7 +5057,7 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca !> transfer ED outputs to other modules used in option 1: CALL Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, ED%y, HD%Input(1), SD%Input(1), ExtPtfm%Input(1), & MAPp%Input(1), FEAM%Input(1), MD%Input(1), & - Orca%Input(1), BD%Input(1,:), MeshMapData, ErrStat2, ErrMsg2 ) + Orca%Input(1), BD%Input(1,:), SrvD%Input(1), MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF ( p_FAST%CompSub == Module_SD .and. p_FAST%CompHydro == Module_HD ) THEN @@ -4576,7 +5078,7 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca END IF !> Solve option 1 (rigorous solve on loads/accelerations) - CALL SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) + CALL SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, SrvD, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4606,7 +5108,7 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca END IF IF ( p_FAST%CompInflow == Module_IfW ) THEN - CALL IfW_InputSolve( p_FAST, m_FAST, IfW%Input(:), IfW%p, AD14%Input(1), AD%Input(1), AD%OtherSt(1), ED%y, ErrStat2, ErrMsg2 ) + CALL IfW_InputSolve( p_FAST, m_FAST, IfW%Input(1), IfW%p, AD14%Input(1), AD%Input(1), AD%OtherSt(this_state), ED%y, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ELSE IF ( p_FAST%CompInflow == Module_OpFM ) THEN ! OpenFOAM is the driver and it sets these inputs outside of this solve; the OpenFOAM inputs and outputs thus don't change @@ -4618,7 +5120,7 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca IF ( p_FAST%CompServo == Module_SrvD ) THEN - CALL SrvD_InputSolve( p_FAST, m_FAST, SrvD%Input(1), ED%y, IfW%y, OpFM%y, BD%y, MeshmapData, ErrStat2, ErrMsg2 ) + CALL SrvD_InputSolve( p_FAST, m_FAST, SrvD%Input(1), ED%y, IfW%y, OpFM%y, BD%y, SD%y, MeshmapData, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF @@ -4639,7 +5141,7 @@ END SUBROUTINE CalcOutputs_And_SolveForInputs !---------------------------------------------------------------------------------------------------------------------------------- !> This routine implements the "option 1" solve for all inputs with direct links to HD, SD, ExtPtfm, MAP, OrcaFlex interface, and the ED !! platform reference point. Also in solve option 1 are the BD-ED blade root coupling. -SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg, WriteThisStep ) +SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, SrvD, MeshMapData, ErrStat, ErrMsg, WriteThisStep ) !............................................................................................................................... REAL(DbKi) , intent(in ) :: this_time !< The current simulation time (actual or time of prediction) INTEGER(IntKi) , intent(in ) :: this_state !< Index into the state array (current or predicted states) @@ -4649,7 +5151,7 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data - !TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD ! ServoDyn data + TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD ! ServoDyn data !TYPE(AeroDyn14_Data), INTENT(INOUT) :: AD14 ! AeroDyn14 data TYPE(HydroDyn_Data), INTENT(INOUT) :: HD !< HydroDyn data TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data @@ -4720,7 +5222,18 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, END DO END IF - + + + ! the Structural control (TMD) from ServoDyn requires recalculating SrvD if we are using it. While it uses accelerations, + ! the masses involved are small enough compared to the platform that we don't need to account for them in the jacobian + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(SrvD%Input(1)%SStC) ) THEN + ! need loads from SrvD%y%SStC%Mesh + CALL SrvD_CalcOutput( this_time, SrvD%Input(1), SrvD%p, SrvD%x(this_state), SrvD%xd(this_state), SrvD%z(this_state), & + SrvD%OtherSt(this_state), SrvD%y, SrvD%m, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF + + IF (ErrStat >= AbortErrLev) RETURN IF ( p_FAST%CompSub /= Module_None .OR. (p_FAST%CompElast == Module_BD .and. BD_Solve_Option1) .OR. p_FAST%CompMooring == Module_Orca ) THEN !.OR. p_FAST%CompHydro == Module_HD ) THEN @@ -4737,6 +5250,7 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, , MD%Input(1), MD%y & , IceF%Input(1), IceF%y & , IceD%Input(1,:), IceD%y & ! bjj: I don't really want to make temp copies of input types. perhaps we should pass the whole Input() structure? (likewise for BD)... + , SrvD%Input(1), SrvD%y & , MeshMapData , ErrStat2, ErrMsg2, WriteThisStep ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4746,7 +5260,7 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, CALL ED_HD_InputOutputSolve( this_time, p_FAST, calcJacobian & , ED%Input(1), ED%p, ED%x(this_state), ED%xd(this_state), ED%z(this_state), ED%OtherSt(this_state), ED%y, ED%m & , HD%Input(1), HD%p, HD%x(this_state), HD%xd(this_state), HD%z(this_state), HD%OtherSt(this_state), HD%y, HD%m & - , MAPp%Input(1), MAPp%y, FEAM%Input(1), FEAM%y, MD%Input(1), MD%y & + , MAPp%Input(1), MAPp%y, FEAM%Input(1), FEAM%y, MD%Input(1), MD%y, SrvD%Input(1), SrvD%y & , MeshMapData , ErrStat2, ErrMsg2, WriteThisStep ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4807,6 +5321,19 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, END DO END IF + + + ! Map motions for ServodDyn Structural control (TMD) if used. + IF ( p_FAST%CompServo == Module_SrvD ) THEN + IF ( p_FAST%CompSub /= Module_SD ) THEN + call Transfer_ED_to_SStC( SrvD%Input(1), ED%y, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ELSEIF ( p_FAST%CompSub == Module_SD ) THEN + call Transfer_SD_to_SStC( SrvD%Input(1), SD%y, MeshMapData, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + END IF + #ifdef DEBUG_MESH_TRANSFER_ICE CALL WrScr('********************************************************') @@ -4844,7 +5371,6 @@ SUBROUTINE SolveOption2a_Inp2BD(this_time, this_state, p_FAST, m_FAST, ED, BD, A TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data TYPE(InflowWind_Data), INTENT(INOUT) :: IfW !< InflowWind data TYPE(OpenFOAM_Data), INTENT(INOUT) :: OpFM !< OpenFOAM data - TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules @@ -4873,7 +5399,7 @@ SUBROUTINE SolveOption2a_Inp2BD(this_time, this_state, p_FAST, m_FAST, ED, BD, A CALL Transfer_ED_to_BD(ED%y, BD%Input(1,:), MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName ) END IF - + END SUBROUTINE SolveOption2a_Inp2BD !---------------------------------------------------------------------------------------------------------------------------------- @@ -4939,7 +5465,7 @@ SUBROUTINE SolveOption2b_Inp2IfW(this_time, this_state, p_FAST, m_FAST, ED, BD, IF (p_FAST%CompInflow == Module_IfW) THEN ! must be done after ED_CalcOutput and before AD_CalcOutput and SrvD - CALL IfW_InputSolve( p_FAST, m_FAST, IfW%Input(:), IfW%p, AD14%Input(1), AD%Input(1), AD%OtherSt(1), ED%y, ErrStat2, ErrMsg2 ) + CALL IfW_InputSolve( p_FAST, m_FAST, IfW%Input(1), IfW%p, AD14%Input(1), AD%Input(1), AD%OtherSt(this_state), ED%y, ErrStat2, ErrMsg2 ) ! do we want this to be curr states CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) !ELSE IF ( p_FAST%CompInflow == Module_OpFM ) THEN ! ! OpenFOAM is the driver and it computes outputs outside of this solve; the OpenFOAM inputs and outputs thus don't change @@ -4948,12 +5474,12 @@ SUBROUTINE SolveOption2b_Inp2IfW(this_time, this_state, p_FAST, m_FAST, ED, BD, ! CALL OpFM_SetInputs( p_FAST, AD14%p, AD14%Input(1), AD14%y, AD%Input(1), AD%y, ED%y, SrvD%y, OpFM, ErrStat2, ErrMsg2 ) ! CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - + END SUBROUTINE SolveOption2b_Inp2IfW !---------------------------------------------------------------------------------------------------------------------------------- !> This routine implements the first part of the "option 2" solve for inputs that apply to AeroDyn and ServoDyn. -SUBROUTINE SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat, ErrMsg, WriteThisStep) +SUBROUTINE SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SD, SrvD, IfW, OpFM, MeshMapData, ErrStat, ErrMsg, WriteThisStep) REAL(DbKi) , intent(in ) :: this_time !< The current simulation time (actual or time of prediction) INTEGER(IntKi) , intent(in ) :: this_state !< Index into the state array (current or predicted states) @@ -4962,12 +5488,12 @@ SUBROUTINE SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data + TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data TYPE(AeroDyn14_Data), INTENT(INOUT) :: AD14 !< AeroDyn14 data TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data TYPE(InflowWind_Data), INTENT(INOUT) :: IfW !< InflowWind data TYPE(OpenFOAM_Data), INTENT(INOUT) :: OpFM !< OpenFOAM data - TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules @@ -5008,27 +5534,27 @@ SUBROUTINE SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, CALL AD14_InputSolve_IfW( p_FAST, AD14%Input(1), IfW%y, OpFM%y, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ELSE IF ( p_FAST%CompAero == Module_AD ) THEN CALL AD_InputSolve_IfW( p_FAST, AD%Input(1), IfW%y, OpFM%y, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - + + IF ( p_FAST%CompServo == Module_SrvD ) THEN - CALL SrvD_InputSolve( p_FAST, m_FAST, SrvD%Input(1), ED%y, IfW%y, OpFM%y, BD%y, MeshMapData, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SrvD_InputSolve( p_FAST, m_FAST, SrvD%Input(1), ED%y, IfW%y, OpFM%y, BD%y, SD%y, MeshMapData, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF END SUBROUTINE SolveOption2c_Inp2AD_SrvD !---------------------------------------------------------------------------------------------------------------------------------- !> This routine implements the "option 2" solve for all inputs without direct links to HD, SD, MAP, or the ED platform reference !! point. -SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat, ErrMsg, firstCall, WriteThisStep) +SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SD, SrvD, IfW, OpFM, MeshMapData, ErrStat, ErrMsg, firstCall, WriteThisStep) !............................................................................................................................... LOGICAL , intent(in ) :: firstCall !< flag to determine how to call ServoDyn (a hack) REAL(DbKi) , intent(in ) :: this_time !< The current simulation time (actual or time of prediction) @@ -5039,6 +5565,7 @@ SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data + TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data TYPE(AeroDyn14_Data), INTENT(INOUT) :: AD14 !< AeroDyn14 data TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data @@ -5075,7 +5602,7 @@ SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, CALL SolveOption2b_Inp2IfW(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! call IfW's CalcOutput; transfer wind-inflow inputs to AD; compute all of SrvD inputs: - CALL SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) + CALL SolveOption2c_Inp2AD_SrvD(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, SD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! ELSE ! these subroutines are called in the AdvanceStates routine before BD, IfW, AD, and SrvD states are updated. This gives a more accurate solution that would otherwise require a correction step. END IF @@ -5102,6 +5629,7 @@ SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, END IF + IF ( p_FAST%CompInflow == Module_OpFM ) THEN ! OpenFOAM is the driver and it computes outputs outside of this solve; the OpenFOAM inputs and outputs thus don't change ! in this scenario until OpenFOAM takes another step **this is a source of error, but it is the way the OpenFOAM-FAST7 coupling @@ -5118,14 +5646,14 @@ SUBROUTINE SolveOption2(this_time, this_state, p_FAST, m_FAST, ED, BD, AD14, AD, CALL ED_InputSolve( p_FAST, ED%Input(1), ED%y, AD14%p, AD14%y, AD%y, SrvD%y, AD%Input(1), SrvD%Input(1), MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL BD_InputSolve( p_FAST, BD, AD%y, AD%Input(1), ED%y, MeshMapData, ErrStat2, ErrMsg2 ) + CALL BD_InputSolve( p_FAST, BD, AD%y, AD%Input(1), ED%y, SrvD%y, SrvD%Input(1), MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END SUBROUTINE SolveOption2 !---------------------------------------------------------------------------------------------------------------------------------- -!> This routines advances the states of each module +!> This routines advances the states of each module SUBROUTINE FAST_AdvanceStates( t_initial, n_t_global, p_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & - MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg, WriteThisStep ) + MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg, WriteThisStep ) REAL(DbKi), INTENT(IN ) :: t_initial !< initial simulation time (almost always 0) INTEGER(IntKi), INTENT(IN ) :: n_t_global !< integer time step @@ -5260,7 +5788,7 @@ SUBROUTINE FAST_AdvanceStates( t_initial, n_t_global, p_FAST, m_FAST, ED, BD, Sr ! because AeroDyn DBEMT states depend heavily on getting inputs correct, we are overwriting its inputs with updated inflow outputs here - CALL SolveOption2c_Inp2AD_SrvD(t_global_next, STATE_PRED, p_FAST, m_FAST, ED, BD, AD14, AD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) + CALL SolveOption2c_Inp2AD_SrvD(t_global_next, STATE_PRED, p_FAST, m_FAST, ED, BD, AD14, AD, SD, SrvD, IfW, OpFM, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! AeroDyn: get predicted states @@ -5299,10 +5827,6 @@ SUBROUTINE FAST_AdvanceStates( t_initial, n_t_global, p_FAST, m_FAST, ED, BD, Sr CALL AD_UpdateStates( t_module, n_t_module, AD%Input, AD%InputTimes, AD%p, AD%x(STATE_PRED), & AD%xd(STATE_PRED), AD%z(STATE_PRED), AD%OtherSt(STATE_PRED), AD%m, ErrStat2, ErrMsg2 ) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - ! We don't want to extrapolate any values for the WakeLocations (those are exactly calculated) - if (allocated(AD%OtherSt(STATE_PRED)%WakeLocationPoints)) then - AD%OtherSt(STATE_CURR)%WakeLocationPoints = AD%OtherSt(STATE_PRED)%WakeLocationPoints - endif END DO !j_ss END IF @@ -5569,23 +6093,18 @@ SUBROUTINE FAST_ExtrapInterpMods( t_global_next, p_FAST, m_FAST, ED, BD, SrvD, A ErrMsg = "" ! ElastoDyn - !write(*,*) 'ED%Input(1)%PLATFORMPTMESH%Force', ED%Input(1)%PLATFORMPTMESH%Force - !write(*,*) 'ED%Input(2)%PLATFORMPTMESH%Force', ED%Input(2)%PLATFORMPTMESH%Force - !write(*,*) 'ED%Input(3)%PLATFORMPTMESH%Force', ED%Input(3)%PLATFORMPTMESH%Force CALL ED_Input_ExtrapInterp(ED%Input, ED%InputTimes, ED%u, t_global_next, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName ) - !write(*,*) 'ED%u%PLATFORMPTMESH%Force', ED%u%PLATFORMPTMESH%Force + DO j = p_FAST%InterpOrder, 1, -1 CALL ED_CopyInput (ED%Input(j), ED%Input(j+1), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName ) ED%InputTimes(j+1) = ED%InputTimes(j) - !ED_OutputTimes(j+1) = ED_OutputTimes(j) END DO CALL ED_CopyInput (ED%u, ED%Input(1), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName ) ED%InputTimes(1) = t_global_next - !ED_OutputTimes(1) = t_global_next ! BeamDyn diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90 index 7b59d0e63b..784842dad3 100644 --- a/modules/openfast-library/src/FAST_Subs.f90 +++ b/modules/openfast-library/src/FAST_Subs.f90 @@ -23,6 +23,7 @@ MODULE FAST_Subs USE FAST_Solver USE FAST_Linear + USE SC_DataEx IMPLICIT NONE @@ -38,36 +39,36 @@ SUBROUTINE FAST_InitializeAll_T( t_initial, TurbID, Turbine, ErrStat, ErrMsg, In TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine !< all data for one instance of a turbine INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - CHARACTER(*), OPTIONAL,INTENT(IN ) :: InFile !< A CHARACTER string containing the name of the primary FAST input file (if not present, we'll get it from the command line) + CHARACTER(*), OPTIONAL,INTENT(IN ) :: InFile !< A CHARACTER string containing the name of the primary FAST input file (if not present, we'll get it from the command line) TYPE(FAST_ExternInitType),OPTIONAL,INTENT(IN ) :: ExternInitData !< Initialization input data from an external source (Simulink) - - Turbine%TurbID = TurbID - - + + Turbine%TurbID = TurbID + + IF (PRESENT(InFile)) THEN IF (PRESENT(ExternInitData)) THEN CALL FAST_InitializeAll( t_initial, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & - Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC,& + Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC_DX,& Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg, InFile, ExternInitData ) - ELSE + ELSE CALL FAST_InitializeAll( t_initial, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & - Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC, & + Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC_DX, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg, InFile ) END IF ELSE CALL FAST_InitializeAll( t_initial, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & - Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC, & + Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC_DX, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) END IF - - + + END SUBROUTINE FAST_InitializeAll_T !---------------------------------------------------------------------------------------------------------------------------------- !> Routine to call Init routine for each module. This routine sets all of the init input data for each module. -SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, SC, HD, SD, ExtPtfm, & +SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, SC_DX, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg, InFile, ExternInitData ) use ElastoDyn_Parameters, only: Method_RK4 @@ -76,7 +77,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, TYPE(FAST_ParameterType), INTENT(INOUT) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -84,7 +85,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data TYPE(InflowWind_Data), INTENT(INOUT) :: IfW !< InflowWind data TYPE(OpenFOAM_Data), INTENT(INOUT) :: OpFM !< OpenFOAM data - TYPE(SuperController_Data), INTENT(INOUT) :: SC !< SuperController data + TYPE(SCDataEx_Data), INTENT(INOUT) :: SC_DX !< SuperController exchange data TYPE(HydroDyn_Data), INTENT(INOUT) :: HD !< HydroDyn data TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data TYPE(ExtPtfm_Data), INTENT(INOUT) :: ExtPtfm !< ExtPtfm_MCKF data @@ -92,23 +93,23 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, TYPE(FEAMooring_Data), INTENT(INOUT) :: FEAM !< FEAMooring data TYPE(MoorDyn_Data), INTENT(INOUT) :: MD !< Data for the MoorDyn module TYPE(OrcaFlex_Data), INTENT(INOUT) :: Orca !< OrcaFlex interface data - + TYPE(IceFloe_Data), INTENT(INOUT) :: IceF !< IceFloe data TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None CHARACTER(*), OPTIONAL, INTENT(IN ) :: InFile !< A CHARACTER string containing the name of the primary FAST input file (if not present, we'll get it from the command line) - + TYPE(FAST_ExternInitType), OPTIONAL, INTENT(IN) :: ExternInitData !< Initialization input data from an external source (Simulink) - - ! local variables + + ! local variables CHARACTER(1024) :: InputFile !< A CHARACTER string containing the name of the primary FAST input file TYPE(FAST_InitData) :: Init !< Initialization data for all modules - + REAL(ReKi) :: AirDens ! air density for initialization/normalization of OpenFOAM data REAL(DbKi) :: dt_IceD ! tmp dt variable to ensure IceDyn doesn't specify different dt values for different legs (IceDyn instances) REAL(DbKi) :: dt_BD ! tmp dt variable to ensure BeamDyn doesn't specify different dt values for different instances @@ -118,32 +119,35 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, INTEGER(IntKi) :: k ! blade loop counter logical :: CallStart - CHARACTER(ErrMsgLen) :: ErrMsg2 - - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_InitializeAll' + INTEGER(IntKi) :: NumBl + CHARACTER(ErrMsgLen) :: ErrMsg2 + + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_InitializeAll' + + !.......... ErrStat = ErrID_None ErrMsg = "" - + y_FAST%UnSum = -1 ! set the summary file unit to -1 to indicate it's not open y_FAST%UnOu = -1 ! set the text output file unit to -1 to indicate it's not open y_FAST%UnGra = -1 ! set the binary graphics output file unit to -1 to indicate it's not open - + p_FAST%WrVTK = VTK_Unknown ! set this so that we can potentially output VTK information on initialization error p_FAST%VTK_tWidth = 1 ! initialize in case of error before reading the full file p_FAST%n_VTKTime = 1 ! initialize in case of error before reading the full file y_FAST%VTK_LastWaveIndx = 1 ! Start looking for wave data at the first index - y_FAST%VTK_count = 0 ! first VTK file has 0 as output + y_FAST%VTK_count = 0 ! first VTK file has 0 as output y_FAST%n_Out = 0 ! set the number of ouptut channels to 0 to indicate there's nothing to write to the binary file - p_FAST%ModuleInitialized = .FALSE. ! (array initialization) no modules are initialized + p_FAST%ModuleInitialized = .FALSE. ! (array initialization) no modules are initialized ! Get the current time CALL DATE_AND_TIME ( Values=m_FAST%StrtTime ) ! Let's time the whole simulation CALL CPU_TIME ( m_FAST%UsrTime1 ) ! Initial time (this zeros the start time when used as a MATLAB function) m_FAST%UsrTime1 = MAX( 0.0_ReKi, m_FAST%UsrTime1 ) ! CPU_TIME: If a meaningful time cannot be returned, a processor-dependent negative value is returned - + m_FAST%t_global = t_initial - 20. ! initialize this to a number < t_initial for error message in ProgAbort m_FAST%calcJacobian = .TRUE. ! we need to calculate the Jacobian @@ -152,76 +156,80 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, ! p_FAST%CheckHSSBrTrqC = .false. y_FAST%Lin%WindSpeed = 0.0_ReKi - + if (present(ExternInitData)) then CallStart = .not. ExternInitData%FarmIntegration ! .and. ExternInitData%TurbineID == 1 - if (ExternInitData%TurbineID > 0) p_FAST%TDesc = 'T'//trim(num2lstr(ExternInitData%TurbineID)) + if (ExternInitData%TurbineID > 0) p_FAST%TDesc = 'T'//trim(num2lstr(ExternInitData%TurbineID)) else CallStart = .true. end if - - + + ! Init NWTC_Library, display copyright and version information: if (CallStart) then AbortErrLev = ErrID_Fatal ! Until we read otherwise from the FAST input file, we abort only on FATAL errors CALL FAST_ProgStart( FAST_Ver ) p_FAST%WrSttsTime = .TRUE. else - ! if we don't call the start data (e.g., from FAST.Farm), we won't override AbortErrLev either + ! if we don't call the start data (e.g., from FAST.Farm), we won't override AbortErrLev either CALL DispNVD( FAST_Ver ) p_FAST%WrSttsTime = .FALSE. end if - + IF (PRESENT(InFile)) THEN p_FAST%UseDWM = .FALSE. InputFile = InFile ELSE - CALL GetInputFileName(InputFile,p_FAST%UseDWM,ErrStat2,ErrMsg2) + CALL GetInputFileName(InputFile,p_FAST%UseDWM,ErrStat2,ErrMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF END IF - + ! ... Open and read input files ... ! also, set turbine reference position for graphics output + p_FAST%UseSC = .FALSE. if (PRESENT(ExternInitData)) then p_FAST%TurbinePos = ExternInitData%TurbinePos - + if( (ExternInitData%NumSC2CtrlGlob .gt. 0) .or. (ExternInitData%NumSC2Ctrl .gt. 0) .or. (ExternInitData%NumCtrl2SC .gt. 0)) then + p_FAST%UseSC = .TRUE. + end if + if (ExternInitData%FarmIntegration) then ! we're integrating with FAST.Farm - CALL FAST_Init( p_FAST, m_FAST, y_FAST, t_initial, InputFile, ErrStat2, ErrMsg2, ExternInitData%TMax, OverrideAbortLev=.false., RootName=ExternInitData%RootName ) + CALL FAST_Init( p_FAST, m_FAST, y_FAST, t_initial, InputFile, ErrStat2, ErrMsg2, ExternInitData%TMax, OverrideAbortLev=.false., RootName=ExternInitData%RootName ) else - CALL FAST_Init( p_FAST, m_FAST, y_FAST, t_initial, InputFile, ErrStat2, ErrMsg2, ExternInitData%TMax, ExternInitData%TurbineID ) ! We have the name of the input file and the simulation length from somewhere else (e.g. Simulink) + CALL FAST_Init( p_FAST, m_FAST, y_FAST, t_initial, InputFile, ErrStat2, ErrMsg2, ExternInitData%TMax, ExternInitData%TurbineID ) ! We have the name of the input file and the simulation length from somewhere else (e.g. Simulink) end if - + else p_FAST%TurbinePos = 0.0_ReKi CALL FAST_Init( p_FAST, m_FAST, y_FAST, t_initial, InputFile, ErrStat2, ErrMsg2 ) ! We have the name of the input file from somewhere else (e.g. Simulink) end if - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF - - - !............................................................................................................................... - - p_FAST%dt_module = p_FAST%dt ! initialize time steps for each module + + + !............................................................................................................................... + + p_FAST%dt_module = p_FAST%dt ! initialize time steps for each module ! ........................ ! initialize ElastoDyn (must be done first) ! ........................ - + ALLOCATE( ED%Input( p_FAST%InterpOrder+1 ), ED%InputTimes( p_FAST%InterpOrder+1 ),STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating ED%Input and ED%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN END IF - + Init%InData_ED%Linearize = p_FAST%Linearize Init%InData_ED%InputFile = p_FAST%EDFile IF ( p_FAST%CompAero == Module_AD14 ) THEN @@ -229,30 +237,30 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, ELSE Init%InData_ED%ADInputFile = "" END IF - + Init%InData_ED%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_ED)) Init%InData_ED%CompElast = p_FAST%CompElast == Module_ED CALL ED_Init( Init%InData_ED, ED%Input(1), ED%p, ED%x(STATE_CURR), ED%xd(STATE_CURR), ED%z(STATE_CURR), ED%OtherSt(STATE_CURR), & ED%y, ED%m, p_FAST%dt_module( MODULE_ED ), Init%OutData_ED, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_ED) = .TRUE. CALL SetModuleSubstepTime(Module_ED, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + ! bjj: added this check per jmj; perhaps it would be better in ElastoDyn, but I'll leave it here for now: IF ( p_FAST%TurbineType == Type_Offshore_Floating ) THEN IF ( ED%p%TowerBsHt < 0.0_ReKi .AND. .NOT. EqualRealNos( ED%p%TowerBsHt, 0.0_ReKi ) ) THEN CALL SetErrStat(ErrID_Fatal,"ElastoDyn TowerBsHt must not be negative for floating offshore systems.",ErrStat,ErrMsg,RoutineName) - END IF - END IF + END IF + END IF allocate( y_FAST%Lin%Modules(MODULE_ED)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(ED).", ErrStat, ErrMsg, RoutineName ) else - + if (allocated(Init%OutData_ED%LinNames_y)) call move_alloc(Init%OutData_ED%LinNames_y,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%Names_y) if (allocated(Init%OutData_ED%LinNames_x)) call move_alloc(Init%OutData_ED%LinNames_x,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%Names_x) if (allocated(Init%OutData_ED%LinNames_u)) call move_alloc(Init%OutData_ED%LinNames_u,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%Names_u) @@ -261,7 +269,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_ED%DerivOrder_x)) call move_alloc(Init%OutData_ED%DerivOrder_x,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%DerivOrder_x) if (allocated(Init%OutData_ED%RotFrame_u)) call move_alloc(Init%OutData_ED%RotFrame_u,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%RotFrame_u) if (allocated(Init%OutData_ED%IsLoad_u )) call move_alloc(Init%OutData_ED%IsLoad_u ,y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%IsLoad_u ) - + if (allocated(Init%OutData_ED%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%NumOutputs = size(Init%OutData_ED%WriteOutputHdr) end if @@ -269,6 +277,9 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL Cleanup() RETURN END IF + + NumBl = Init%OutData_ED%NumBl + if (p_FAST%CalcSteady) then if ( EqualRealNos(Init%OutData_ED%RotSpeed, 0.0_ReKi) ) then @@ -279,13 +290,13 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, p_FAST%TrimCase = TrimCase_none end if end if - - + + ! ........................ - ! initialize BeamDyn + ! initialize BeamDyn ! ........................ - IF ( p_FAST%CompElast == Module_BD ) THEN - p_FAST%nBeams = Init%OutData_ED%NumBl ! initialize number of BeamDyn instances = number of blades + IF ( p_FAST%CompElast == Module_BD ) THEN + p_FAST%nBeams = Init%OutData_ED%NumBl ! initialize number of BeamDyn instances = number of blades ELSE p_FAST%nBeams = 0 END IF @@ -295,8 +306,8 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL SetErrStat(ErrID_Fatal,"Error allocating BD%Input and BD%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - + END IF + ALLOCATE( BD%x( p_FAST%nBeams,2), & BD%xd( p_FAST%nBeams,2), & BD%z( p_FAST%nBeams,2), & @@ -306,28 +317,28 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, BD%y( p_FAST%nBeams ), & BD%m( p_FAST%nBeams ), & Init%OutData_BD(p_FAST%nBeams ), & - STAT = ErrStat2 ) + STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating BeamDyn state, input, and output data.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - + END IF + IF (p_FAST%CompElast == Module_BD) THEN Init%InData_BD%DynamicSolve = .TRUE. ! FAST can only couple to BeamDyn when dynamic solve is used. Init%InData_BD%Linearize = p_FAST%Linearize Init%InData_BD%gravity = (/ 0.0_ReKi, 0.0_ReKi, -Init%OutData_ED%Gravity /) ! "Gravitational acceleration" m/s^2 - + ! now initialize BeamDyn for all beams dt_BD = p_FAST%dt_module( MODULE_BD ) - + Init%InData_BD%HubPos = ED%y%HubPtMotion%Position(:,1) Init%InData_BD%HubRot = ED%y%HubPtMotion%RefOrientation(:,:,1) - + p_FAST%BD_OutputSibling = .true. - + allocate( y_FAST%Lin%Modules(MODULE_BD)%Instance(p_FAST%nBeams), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(BD).", ErrStat, ErrMsg, RoutineName ) @@ -337,61 +348,64 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, DO k=1,p_FAST%nBeams Init%InData_BD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_BD))//TRIM( Num2LStr(k) ) - - + + Init%InData_BD%InputFile = p_FAST%BDBldFile(k) - + Init%InData_BD%GlbPos = ED%y%BladeRootMotion(k)%Position(:,1) ! {:} - - "Initial Position Vector of the local blade coordinate system" Init%InData_BD%GlbRot = ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) ! {:}{:} - - "Initial direction cosine matrix of the local blade coordinate system" - + Init%InData_BD%RootDisp = ED%y%BladeRootMotion(k)%TranslationDisp(:,1) ! {:} - - "Initial root displacement" Init%InData_BD%RootOri = ED%y%BladeRootMotion(k)%Orientation(:,:,1) ! {:}{:} - - "Initial root orientation" - Init%InData_BD%RootVel(1:3) = ED%y%BladeRootMotion(k)%TranslationVel(:,1) ! {:} - - "Initial root velocities and angular veolcities" - Init%InData_BD%RootVel(4:6) = ED%y%BladeRootMotion(k)%RotationVel(:,1) ! {:} - - "Initial root velocities and angular veolcities" - + Init%InData_BD%RootVel(1:3) = ED%y%BladeRootMotion(k)%TranslationVel(:,1) ! {:} - - "Initial root velocities and angular veolcities" + Init%InData_BD%RootVel(4:6) = ED%y%BladeRootMotion(k)%RotationVel(:,1) ! {:} - - "Initial root velocities and angular veolcities" + CALL BD_Init( Init%InData_BD, BD%Input(1,k), BD%p(k), BD%x(k,STATE_CURR), BD%xd(k,STATE_CURR), BD%z(k,STATE_CURR), & BD%OtherSt(k,STATE_CURR), BD%y(k), BD%m(k), dt_BD, Init%OutData_BD(k), ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + !bjj: we're going to force this to have the same timestep because I don't want to have to deal with n BD modules with n timesteps. IF ( k == 1 ) THEN p_FAST%dt_module( MODULE_BD ) = dt_BD - + p_FAST%ModuleInitialized(Module_BD) = .TRUE. ! this really should be once per BD instance, but BD doesn't care so I won't go through the effort to track this CALL SetModuleSubstepTime(Module_BD, p_FAST, y_FAST, ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ELSEIF ( .NOT. EqualRealNos( p_FAST%dt_module( MODULE_BD ),dt_BD )) THEN CALL SetErrStat(ErrID_Fatal,"All instances of BeamDyn (one per blade) must have the same time step.",ErrStat,ErrMsg,RoutineName) END IF ! We're going to do fewer computations if the BD input and output meshes that couple to AD are siblings: if (BD%p(k)%BldMotionNodeLoc /= BD_MESH_QP) p_FAST%BD_OutputSibling = .false. - + if (ErrStat>=AbortErrLev) exit !exit this loop so we don't get p_FAST%nBeams of the same errors - if (allocated(Init%OutData_BD(k)%LinNames_y)) call move_alloc(Init%OutData_BD(k)%LinNames_y, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_y ) - if (allocated(Init%OutData_BD(k)%LinNames_x)) call move_alloc(Init%OutData_BD(k)%LinNames_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_x ) - if (allocated(Init%OutData_BD(k)%LinNames_u)) call move_alloc(Init%OutData_BD(k)%LinNames_u, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_u ) - if (allocated(Init%OutData_BD(k)%RotFrame_y)) call move_alloc(Init%OutData_BD(k)%RotFrame_y, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_y ) - if (allocated(Init%OutData_BD(k)%RotFrame_x)) call move_alloc(Init%OutData_BD(k)%RotFrame_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_x ) - if (allocated(Init%OutData_BD(k)%RotFrame_u)) call move_alloc(Init%OutData_BD(k)%RotFrame_u, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_u ) - if (allocated(Init%OutData_BD(k)%IsLoad_u )) call move_alloc(Init%OutData_BD(k)%IsLoad_u , y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%IsLoad_u ) - if (allocated(Init%OutData_BD(k)%DerivOrder_x )) call move_alloc(Init%OutData_BD(k)%DerivOrder_x , y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%DerivOrder_x ) + if (size(y_FAST%Lin%Modules(MODULE_BD)%Instance) >= k) then ! for aero maps, we only use the first instance: + if (allocated(Init%OutData_BD(k)%LinNames_y)) call move_alloc(Init%OutData_BD(k)%LinNames_y, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_y ) + if (allocated(Init%OutData_BD(k)%LinNames_x)) call move_alloc(Init%OutData_BD(k)%LinNames_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_x ) + if (allocated(Init%OutData_BD(k)%LinNames_u)) call move_alloc(Init%OutData_BD(k)%LinNames_u, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%Names_u ) + if (allocated(Init%OutData_BD(k)%RotFrame_y)) call move_alloc(Init%OutData_BD(k)%RotFrame_y, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_y ) + if (allocated(Init%OutData_BD(k)%RotFrame_x)) call move_alloc(Init%OutData_BD(k)%RotFrame_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_x ) + if (allocated(Init%OutData_BD(k)%RotFrame_u)) call move_alloc(Init%OutData_BD(k)%RotFrame_u, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_u ) + if (allocated(Init%OutData_BD(k)%IsLoad_u )) call move_alloc(Init%OutData_BD(k)%IsLoad_u , y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%IsLoad_u ) + if (allocated(Init%OutData_BD(k)%DerivOrder_x)) call move_alloc(Init%OutData_BD(k)%DerivOrder_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%DerivOrder_x ) - if (allocated(Init%OutData_BD(k)%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%NumOutputs = size(Init%OutData_BD(k)%WriteOutputHdr) + if (allocated(Init%OutData_BD(k)%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%NumOutputs = size(Init%OutData_BD(k)%WriteOutputHdr) + end if END DO - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - - END IF + END IF + END IF + + ! ........................ - ! initialize AeroDyn + ! initialize AeroDyn ! ........................ ALLOCATE( AD14%Input( p_FAST%InterpOrder+1 ), AD14%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -399,138 +413,152 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL Cleanup() RETURN END IF - + ALLOCATE( AD%Input( p_FAST%InterpOrder+1 ), AD%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating AD%Input and AD%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN END IF - - + + IF ( p_FAST%CompAero == Module_AD14 ) THEN - + CALL AD_SetInitInput(Init%InData_AD14, Init%OutData_ED, ED%y, p_FAST, ErrStat2, ErrMsg2) ! set the values in Init%InData_AD14 CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + CALL AD14_Init( Init%InData_AD14, AD14%Input(1), AD14%p, AD14%x(STATE_CURR), AD14%xd(STATE_CURR), AD14%z(STATE_CURR), & AD14%OtherSt(STATE_CURR), AD14%y, AD14%m, p_FAST%dt_module( MODULE_AD14 ), Init%OutData_AD14, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - p_FAST%ModuleInitialized(Module_AD14) = .TRUE. + p_FAST%ModuleInitialized(Module_AD14) = .TRUE. CALL SetModuleSubstepTime(Module_AD14, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - ! bjj: this really shouldn't be in the FAST glue code, but I'm going to put this check here so people don't use an invalid model + + ! bjj: this really shouldn't be in the FAST glue code, but I'm going to put this check here so people don't use an invalid model ! and send me emails to debug numerical issues in their results. IF ( AD14%p%TwrProps%PJM_Version .AND. p_FAST%TurbineType == Type_Offshore_Floating ) THEN CALL SetErrStat(ErrID_Fatal,'AeroDyn v14 tower influence model "NEWTOWER" is invalid for models of floating offshore turbines.',ErrStat,ErrMsg,RoutineName) - END IF - + END IF + AirDens = Init%OutData_AD14%AirDens - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - + END IF + ELSEIF ( p_FAST%CompAero == Module_AD ) THEN + + allocate(Init%InData_AD%rotors(1), stat=errStat) + if (errStat/=0) then + call SetErrStat( ErrID_Fatal, 'Allocating rotors', errStat, errMsg, RoutineName ) + call Cleanup() + return + end if + + Init%InData_AD%rotors(1)%NumBlades = NumBl ! set initialization data for AD - CALL AllocAry( Init%InData_AD%BladeRootPosition, 3, Init%OutData_ED%NumBl, 'Init%InData_AD%BladeRootPosition', errStat2, ErrMsg2) + CALL AllocAry( Init%InData_AD%rotors(1)%BladeRootPosition, 3, Init%InData_AD%rotors(1)%NumBlades, 'Init%InData_AD%BladeRootPosition', errStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL AllocAry( Init%InData_AD%BladeRootOrientation,3, 3, Init%OutData_ED%NumBl, 'Init%InData_AD%BladeRootOrientation', errStat2, ErrMsg2) + CALL AllocAry( Init%InData_AD%rotors(1)%BladeRootOrientation,3, 3, Init%InData_AD%rotors(1)%NumBlades, 'Init%InData_AD%BladeRootOrientation', errStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF - Init%InData_AD%Gravity = Init%OutData_ED%Gravity + Init%InData_AD%Gravity = Init%OutData_ED%Gravity Init%InData_AD%Linearize = p_FAST%Linearize Init%InData_AD%InputFile = p_FAST%AeroFile - Init%InData_AD%NumBlades = Init%OutData_ED%NumBl Init%InData_AD%RootName = p_FAST%OutFileRoot - Init%InData_AD%HubPosition = ED%y%HubPtMotion%Position(:,1) - Init%InData_AD%HubOrientation = ED%y%HubPtMotion%RefOrientation(:,:,1) - do k=1,Init%OutData_ED%NumBl - Init%InData_AD%BladeRootPosition(:,k) = ED%y%BladeRootMotion(k)%Position(:,1) - Init%InData_AD%BladeRootOrientation(:,:,k) = ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) - end do - + Init%InData_AD%rotors(1)%HubPosition = ED%y%HubPtMotion%Position(:,1) + Init%InData_AD%rotors(1)%HubOrientation = ED%y%HubPtMotion%RefOrientation(:,:,1) + Init%InData_AD%rotors(1)%NacelleOrientation = ED%y%NacelleMotion%RefOrientation(:,:,1) + + do k=1,NumBl + Init%InData_AD%rotors(1)%BladeRootPosition(:,k) = ED%y%BladeRootMotion(k)%Position(:,1) + Init%InData_AD%rotors(1)%BladeRootOrientation(:,:,k) = ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) + end do + + CALL AD_Init( Init%InData_AD, AD%Input(1), AD%p, AD%x(STATE_CURR), AD%xd(STATE_CURR), AD%z(STATE_CURR), & AD%OtherSt(STATE_CURR), AD%y, AD%m, p_FAST%dt_module( MODULE_AD ), Init%OutData_AD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - p_FAST%ModuleInitialized(Module_AD) = .TRUE. + p_FAST%ModuleInitialized(Module_AD) = .TRUE. CALL SetModuleSubstepTime(Module_AD, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + allocate( y_FAST%Lin%Modules(MODULE_AD)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(AD).", ErrStat, ErrMsg, RoutineName ) else - if (allocated(Init%OutData_AD%LinNames_u )) call move_alloc(Init%OutData_AD%LinNames_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_u ) - if (allocated(Init%OutData_AD%LinNames_y )) call move_alloc(Init%OutData_AD%LinNames_y ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_y ) - if (allocated(Init%OutData_AD%LinNames_x )) call move_alloc(Init%OutData_AD%LinNames_x ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_x ) - if (allocated(Init%OutData_AD%RotFrame_u )) call move_alloc(Init%OutData_AD%RotFrame_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_u ) - if (allocated(Init%OutData_AD%RotFrame_y )) call move_alloc(Init%OutData_AD%RotFrame_y ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_y ) - if (allocated(Init%OutData_AD%RotFrame_x )) call move_alloc(Init%OutData_AD%RotFrame_x ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_x ) - if (allocated(Init%OutData_AD%IsLoad_u )) call move_alloc(Init%OutData_AD%IsLoad_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%IsLoad_u ) - if (allocated(Init%OutData_AD%DerivOrder_x)) call move_alloc(Init%OutData_AD%DerivOrder_x,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%DerivOrder_x ) - - if (allocated(Init%OutData_AD%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%NumOutputs = size(Init%OutData_AD%WriteOutputHdr) + if (allocated(Init%OutData_AD%rotors(1)%LinNames_u )) call move_alloc(Init%OutData_AD%rotors(1)%LinNames_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_u ) + if (allocated(Init%OutData_AD%rotors(1)%LinNames_y )) call move_alloc(Init%OutData_AD%rotors(1)%LinNames_y ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_y ) + if (allocated(Init%OutData_AD%rotors(1)%LinNames_x )) call move_alloc(Init%OutData_AD%rotors(1)%LinNames_x ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%Names_x ) + if (allocated(Init%OutData_AD%rotors(1)%RotFrame_u )) call move_alloc(Init%OutData_AD%rotors(1)%RotFrame_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_u ) + if (allocated(Init%OutData_AD%rotors(1)%RotFrame_y )) call move_alloc(Init%OutData_AD%rotors(1)%RotFrame_y ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_y ) + if (allocated(Init%OutData_AD%rotors(1)%RotFrame_x )) call move_alloc(Init%OutData_AD%rotors(1)%RotFrame_x ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%RotFrame_x ) + if (allocated(Init%OutData_AD%rotors(1)%IsLoad_u )) call move_alloc(Init%OutData_AD%rotors(1)%IsLoad_u ,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%IsLoad_u ) + if (allocated(Init%OutData_AD%rotors(1)%DerivOrder_x)) call move_alloc(Init%OutData_AD%rotors(1)%DerivOrder_x,y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%DerivOrder_x ) + + if (allocated(Init%OutData_AD%rotors(1)%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%NumOutputs = size(Init%OutData_AD%rotors(1)%WriteOutputHdr) end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF - AirDens = Init%OutData_AD%AirDens + AirDens = Init%OutData_AD%rotors(1)%AirDens ELSE AirDens = 0.0_ReKi END IF ! CompAero - - + + ! ........................ ! initialize InflowWind - ! ........................ + ! ........................ ALLOCATE( IfW%Input( p_FAST%InterpOrder+1 ), IfW%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating IfW%Input and IfW%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN END IF - + IF ( p_FAST%CompInflow == Module_IfW ) THEN - + Init%InData_IfW%Linearize = p_FAST%Linearize Init%InData_IfW%InputFileName = p_FAST%InflowFile Init%InData_IfW%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IfW)) Init%InData_IfW%UseInputFile = .TRUE. - - Init%InData_IfW%NumWindPoints = 0 + Init%InData_IfW%FixedWindFileRootName = .FALSE. + + Init%InData_IfW%NumWindPoints = 0 IF ( p_FAST%CompServo == Module_SrvD ) Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + 1 IF ( p_FAST%CompAero == Module_AD14 ) THEN - Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + Init%OutData_ED%NumBl * AD14%Input(1)%InputMarkers(1)%NNodes + AD14%Input(1)%Twr_InputMarkers%NNodes + Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + NumBl * AD14%Input(1)%InputMarkers(1)%NNodes + AD14%Input(1)%Twr_InputMarkers%NNodes ELSEIF ( p_FAST%CompAero == Module_AD ) THEN - Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + AD%Input(1)%TowerMotion%NNodes - DO k=1,Init%OutData_ED%NumBl - Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + AD%Input(1)%BladeMotion(k)%NNodes + Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + AD%Input(1)%rotors(1)%TowerMotion%NNodes + DO k=1,NumBl + Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + AD%Input(1)%rotors(1)%BladeMotion(k)%NNodes END DO if (allocated(AD%OtherSt(STATE_CURR)%WakeLocationPoints)) then Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + size(AD%OtherSt(STATE_CURR)%WakeLocationPoints,DIM=2) end if + Init%InData_IfW%NumWindPoints = Init%InData_IfW%NumWindPoints + AD%Input(1)%rotors(1)%NacelleMotion%NNodes ! 1 point + END IF - - ! lidar + + ! lidar Init%InData_IfW%lidar%Tmax = p_FAST%TMax - Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1) - + Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1) + IF ( PRESENT(ExternInitData) ) THEN Init%InData_IfW%Use4Dext = ExternInitData%FarmIntegration @@ -539,25 +567,25 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, Init%InData_IfW%FDext%delta = ExternInitData%windGrid_delta Init%InData_IfW%FDext%pZero = ExternInitData%windGrid_pZero end if - + ! bjj: these lidar inputs should come from an InflowWind input file; I'm hard coding them here for now - Init%InData_IfW%lidar%SensorType = ExternInitData%SensorType - Init%InData_IfW%lidar%LidRadialVel = ExternInitData%LidRadialVel - Init%InData_IfW%lidar%RotorApexOffsetPos = 0.0 + Init%InData_IfW%lidar%SensorType = ExternInitData%SensorType + Init%InData_IfW%lidar%LidRadialVel = ExternInitData%LidRadialVel + Init%InData_IfW%lidar%RotorApexOffsetPos = 0.0 Init%InData_IfW%lidar%NumPulseGate = 0 ELSE Init%InData_IfW%lidar%SensorType = SensorType_None Init%InData_IfW%Use4Dext = .false. END IF - + CALL InflowWind_Init( Init%InData_IfW, IfW%Input(1), IfW%p, IfW%x(STATE_CURR), IfW%xd(STATE_CURR), IfW%z(STATE_CURR), & IfW%OtherSt(STATE_CURR), IfW%y, IfW%m, p_FAST%dt_module( MODULE_IfW ), Init%OutData_IfW, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - p_FAST%ModuleInitialized(Module_IfW) = .TRUE. + p_FAST%ModuleInitialized(Module_IfW) = .TRUE. CALL SetModuleSubstepTime(Module_IfW, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + allocate( y_FAST%Lin%Modules(MODULE_IfW)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(IfW).", ErrStat, ErrMsg, RoutineName ) @@ -571,23 +599,21 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_IfW%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_IfW)%Instance(1)%NumOutputs = size(Init%OutData_IfW%WriteOutputHdr) y_FAST%Lin%WindSpeed = Init%OutData_IfW%WindFileInfo%MWS end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - + END IF + ELSEIF ( p_FAST%CompInflow == Module_OpFM ) THEN - + IF ( PRESENT(ExternInitData) ) THEN - Init%InData_OpFM%NumSC2Ctrl = ExternInitData%NumSC2Ctrl - Init%InData_OpFM%NumCtrl2SC = ExternInitData%NumCtrl2SC Init%InData_OpFM%NumActForcePtsBlade = ExternInitData%NumActForcePtsBlade - Init%InData_OpFM%NumActForcePtsTower = ExternInitData%NumActForcePtsTower + Init%InData_OpFM%NumActForcePtsTower = ExternInitData%NumActForcePtsTower ELSE CALL SetErrStat( ErrID_Fatal, 'OpenFOAM integration can be used only with external input data (not the stand-alone executable).', ErrStat, ErrMsg, RoutineName ) CALL Cleanup() - RETURN + RETURN END IF Init%InData_OpFM%BladeLength = Init%OutData_ED%BladeLength Init%InData_OpFM%TowerHeight = Init%OutData_ED%TowerHeight @@ -604,57 +630,60 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, ! set up the data structures for integration with OpenFOAM CALL Init_OpFM( Init%InData_OpFM, p_FAST, AirDens, AD14%Input(1), AD%Input(1), Init%OutData_AD, AD%y, ED%y, OpFM, Init%OutData_OpFM, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - + END IF + !bjj: fix me!!! to do Init%OutData_IfW%WindFileInfo%MWS = 0.0_ReKi - + ELSE Init%OutData_IfW%WindFileInfo%MWS = 0.0_ReKi END IF ! CompInflow - + ! ........................ ! initialize SuperController - ! ........................ + ! ........................ IF ( PRESENT(ExternInitData) ) THEN - Init%InData_SC%NumSC2Ctrl = ExternInitData%NumSC2Ctrl - Init%InData_SC%NumCtrl2SC = ExternInitData%NumCtrl2SC - ELSE - Init%InData_SC%NumSC2Ctrl = 0 - Init%InData_SC%NumCtrl2SC = 0 + ! set up the data structures for integration with supercontroller + IF ( p_FAST%UseSC ) THEN + CALL SC_DX_Init( ExternInitData%NumSC2CtrlGlob, ExternInitData%NumSC2Ctrl, ExternInitData%NumCtrl2SC, SC_DX, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + ELSE + SC_DX%u%c_obj%toSC_Len = 0 + SC_DX%u%c_obj%toSC = C_NULL_PTR + SC_DX%y%c_obj%fromSC_Len = 0 + SC_DX%y%c_obj%fromSC = C_NULL_PTR + SC_DX%y%c_obj%fromSCglob_Len = 0 + SC_DX%y%c_obj%fromSCglob = C_NULL_PTR + END IF END IF - - ! set up the data structures for integration with supercontroller - CALL Init_SC( Init%InData_SC, SC, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF ! ........................ ! some checks for AeroDyn14's Dynamic Inflow with Mean Wind Speed from InflowWind: ! (DO NOT COPY THIS CODE!) ! bjj: AeroDyn14 should not need this rule of thumb; it should check the instantaneous values when the code runs - ! ........................ - + ! ........................ + IF ( p_FAST%CompAero == Module_AD14 ) THEN - IF (AD14%p%DynInfl) THEN + IF (AD14%p%DynInfl) THEN IF ( Init%OutData_IfW%WindFileInfo%MWS < 8.0 ) THEN CALL SetErrStat(ErrID_Fatal,'AeroDyn v14 "DYNINFL" InfModel is invalid for models with wind speeds less than 8 m/s.',ErrStat,ErrMsg,RoutineName) !CALL SetErrStat(ErrID_Info,'Estimated average inflow wind speed is less than 8 m/s. Dynamic Inflow will be turned off.',ErrStat,ErrMess,RoutineName ) END IF - END IF + END IF END IF - - + + ! ........................ - ! initialize ServoDyn + ! initialize ServoDyn ! ........................ ALLOCATE( SrvD%Input( p_FAST%InterpOrder+1 ), SrvD%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -662,14 +691,18 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL Cleanup() RETURN END IF - + IF ( p_FAST%CompServo == Module_SrvD ) THEN Init%InData_SrvD%InputFile = p_FAST%ServoFile Init%InData_SrvD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_SrvD)) - Init%InData_SrvD%NumBl = Init%OutData_ED%NumBl - Init%InData_SrvD%gravity = Init%OutData_ED%gravity - Init%InData_SrvD%r_N_O_G = ED%Input(1)%NacelleLoads%Position(:,1) - Init%InData_SrvD%r_TwrBase = Init%OutData_ED%TwrBasePos + Init%InData_SrvD%NumBl = NumBl + Init%InData_SrvD%Gravity = (/ 0.0_ReKi, 0.0_ReKi, -Init%OutData_ED%Gravity /) ! "Gravitational acceleration vector" m/s^2 + Init%InData_SrvD%NacPosition(1:3) = ED%Input(1)%NacelleLoads%Position(1:3,1) + Init%InData_SrvD%NacOrientation(1:3,1:3) = ED%Input(1)%NacelleLoads%RefOrientation(1:3,1:3,1) ! R8Ki + Init%InData_SrvD%TwrBasePos = Init%OutData_ED%TwrBasePos + Init%InData_SrvD%TwrBaseOrient = Init%OutData_ED%TwrBaseOrient ! R8Ki + Init%InData_SrvD%PlatformPos(1:3) = ED%y%PlatformPtMesh%Position(1:3,1) + Init%InData_SrvD%PlatformOrient(1:3,1:3) = ED%y%PlatformPtMesh%Orientation(1:3,1:3,1) ! R8Ki Init%InData_SrvD%TMax = p_FAST%TMax Init%InData_SrvD%AirDens = AirDens Init%InData_SrvD%AvgWindSpeed = Init%OutData_IfW%WindFileInfo%MWS @@ -677,15 +710,58 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, Init%InData_SrvD%TrimCase = p_FAST%TrimCase Init%InData_SrvD%TrimGain = p_FAST%TrimGain Init%InData_SrvD%RotSpeedRef = Init%OutData_ED%RotSpeed + + CALL AllocAry( Init%InData_SrvD%BladeRootPosition, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootPosition', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL AllocAry( Init%InData_SrvD%BladeRootOrientation,3, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootOrientation', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + do k=1,Init%OutData_ED%NumBl + Init%InData_SrvD%BladeRootPosition(:,k) = ED%y%BladeRootMotion(k)%Position(:,1) + Init%InData_SrvD%BladeRootOrientation(:,:,k) = ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) + enddo + IF ( PRESENT(ExternInitData) ) THEN + Init%InData_SrvD%NumSC2CtrlGlob = ExternInitData%NumSC2CtrlGlob + IF ( (Init%InData_SrvD%NumSC2CtrlGlob > 0) ) THEN + CALL AllocAry( Init%InData_SrvD%fromSCGlob, Init%InData_SrvD%NumSC2CtrlGlob, 'Init%InData_SrvD%fromSCGlob', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + do i=1,Init%InData_SrvD%NumSC2CtrlGlob + Init%InData_SrvD%fromSCGlob(i) = ExternInitData%fromSCGlob(i) + end do + END IF + Init%InData_SrvD%NumSC2Ctrl = ExternInitData%NumSC2Ctrl + IF ( (Init%InData_SrvD%NumSC2Ctrl > 0) ) THEN + CALL AllocAry( Init%InData_SrvD%fromSC, Init%InData_SrvD%NumSC2Ctrl, 'Init%InData_SrvD%fromSC', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + do i=1,Init%InData_SrvD%NumSC2Ctrl + Init%InData_SrvD%fromSC(i) = ExternInitData%fromSC(i) + end do + END IF + Init%InData_SrvD%NumCtrl2SC = ExternInitData%NumCtrl2SC + ELSE + Init%InData_SrvD%NumSC2CtrlGlob = 0 Init%InData_SrvD%NumSC2Ctrl = 0 Init%InData_SrvD%NumCtrl2SC = 0 - END IF - + END IF + CALL AllocAry(Init%InData_SrvD%BlPitchInit, Init%OutData_ED%NumBl, 'BlPitchInit', ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -706,7 +782,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) !! initialize SrvD%y%ElecPwr and SrvD%y%GenTq because they are one timestep different (used as input for the next step)? - + allocate( y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(SrvD).", ErrStat, ErrMsg, RoutineName ) @@ -719,51 +795,51 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_SrvD%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%NumOutputs = size(Init%OutData_SrvD%WriteOutputHdr) end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF - + ! ........................ ! some checks for AeroDyn and ElastoDyn inputs with the high-speed shaft brake hack in ElastoDyn: ! (DO NOT COPY THIS CODE!) - ! ........................ + ! ........................ ! bjj: this is a hack to get high-speed shaft braking in FAST v8 - + IF ( Init%OutData_SrvD%UseHSSBrake ) THEN IF ( p_FAST%CompAero == Module_AD14 ) THEN IF ( AD14%p%DYNINFL ) THEN CALL SetErrStat(ErrID_Fatal,'AeroDyn v14 "DYNINFL" InfModel is invalid for models with high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) END IF END IF - + IF ( ED%p%method == Method_RK4 ) THEN ! bjj: should be using ElastoDyn's Method_ABM4 Method_AB4 parameters CALL SetErrStat(ErrID_Fatal,'ElastoDyn must use the AB4 or ABM4 integration method to implement high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) ENDIF END IF ! Init%OutData_SrvD%UseHSSBrake - - + + END IF ! ........................ ! set some VTK parameters required before HydroDyn init (so we can get wave elevations for visualization) ! ........................ - + ! get wave elevation data for visualization - if ( p_FAST%WrVTK > VTK_None ) then + if ( p_FAST%WrVTK > VTK_None ) then call SetVTKParameters_B4HD(p_FAST, Init%OutData_ED, Init%InData_HD, BD, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF end if - - + + ! ........................ - ! initialize HydroDyn + ! initialize HydroDyn ! ........................ ALLOCATE( HD%Input( p_FAST%InterpOrder+1 ), HD%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -771,7 +847,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL Cleanup() RETURN END IF - + IF ( p_FAST%CompHydro == Module_HD ) THEN Init%InData_HD%Gravity = Init%OutData_ED%Gravity @@ -781,19 +857,19 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, Init%InData_HD%TMax = p_FAST%TMax Init%InData_HD%hasIce = p_FAST%CompIce /= Module_None Init%InData_HD%Linearize = p_FAST%Linearize - + ! if wave field needs an offset, modify these values (added at request of SOWFA developers): - Init%InData_HD%PtfmLocationX = p_FAST%TurbinePos(1) + Init%InData_HD%PtfmLocationX = p_FAST%TurbinePos(1) Init%InData_HD%PtfmLocationY = p_FAST%TurbinePos(2) - + CALL HydroDyn_Init( Init%InData_HD, HD%Input(1), HD%p, HD%x(STATE_CURR), HD%xd(STATE_CURR), HD%z(STATE_CURR), & HD%OtherSt(STATE_CURR), HD%y, HD%m, p_FAST%dt_module( MODULE_HD ), Init%OutData_HD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_HD) = .TRUE. CALL SetModuleSubstepTime(Module_HD, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + allocate( y_FAST%Lin%Modules(MODULE_HD)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(HD).", ErrStat, ErrMsg, RoutineName ) @@ -806,11 +882,11 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_HD%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_HD)%Instance(1)%NumOutputs = size(Init%OutData_HD%WriteOutputHdr) end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF END IF ! CompHydro ! ........................ @@ -829,9 +905,9 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL Cleanup() RETURN END IF - + IF ( p_FAST%CompSub == Module_SD ) THEN - + IF ( p_FAST%CompHydro == Module_HD ) THEN Init%InData_SD%WtrDpth = Init%OutData_HD%WtrDpth ELSE @@ -850,7 +926,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL SD_Init( Init%InData_SD, SD%Input(1), SD%p, SD%x(STATE_CURR), SD%xd(STATE_CURR), SD%z(STATE_CURR), & SD%OtherSt(STATE_CURR), SD%y, SD%m, p_FAST%dt_module( MODULE_SD ), Init%OutData_SD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_SD) = .TRUE. CALL SetModuleSubstepTime(Module_SD, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -873,19 +949,19 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF ELSE IF ( p_FAST%CompSub == Module_ExtPtfm ) THEN Init%InData_ExtPtfm%InputFile = p_FAST%SubFile Init%InData_ExtPtfm%RootName = trim(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_ExtPtfm)) Init%InData_ExtPtfm%Linearize = p_FAST%Linearize Init%InData_ExtPtfm%PtfmRefzt = ED%p%PtfmRefzt ! Required - + CALL ExtPtfm_Init( Init%InData_ExtPtfm, ExtPtfm%Input(1), ExtPtfm%p, & ExtPtfm%x(STATE_CURR), ExtPtfm%xd(STATE_CURR), ExtPtfm%z(STATE_CURR), ExtPtfm%OtherSt(STATE_CURR), & ExtPtfm%y, ExtPtfm%m, p_FAST%dt_module( MODULE_ExtPtfm ), Init%OutData_ExtPtfm, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(MODULE_ExtPtfm) = .TRUE. CALL SetModuleSubstepTime(MODULE_ExtPtfm, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) @@ -904,16 +980,16 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_ExtPtfm%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_ExtPtfm)%Instance(1)%NumOutputs = size(Init%OutData_ExtPtfm%WriteOutputHdr) if (allocated(Init%OutData_ExtPtfm%DerivOrder_x)) call move_alloc(Init%OutData_ExtPtfm%DerivOrder_x,y_FAST%Lin%Modules(MODULE_ExtPtfm)%Instance(1)%DerivOrder_x) end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - + END IF + END IF ! ------------------------------ - ! initialize CompMooring modules + ! initialize CompMooring modules ! ------------------------------ ALLOCATE( MAPp%Input( p_FAST%InterpOrder+1 ), MAPp%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -926,49 +1002,49 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL SetErrStat(ErrID_Fatal,"Error allocating MD%Input and MD%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF + END IF ALLOCATE( FEAM%Input( p_FAST%InterpOrder+1 ), FEAM%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating FEAM%Input and FEAM%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF + END IF ALLOCATE( Orca%Input( p_FAST%InterpOrder+1 ), Orca%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating Orca%Input and Orca%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - + END IF + ! ........................ - ! initialize MAP + ! initialize MAP ! ........................ IF (p_FAST%CompMooring == Module_MAP) THEN !bjj: until we modify this, MAP requires HydroDyn to be used. (perhaps we could send air density from AeroDyn or something...) - + CALL WrScr(NewLine) !bjj: I'm printing two blank lines here because MAP seems to be writing over the last line on the screen. - -! Init%InData_MAP%rootname = p_FAST%OutFileRoot ! Output file name + +! Init%InData_MAP%rootname = p_FAST%OutFileRoot ! Output file name Init%InData_MAP%gravity = Init%OutData_ED%Gravity ! This need to be according to g used in ElastoDyn Init%InData_MAP%sea_density = Init%OutData_HD%WtrDens ! This needs to be set according to seawater density in HydroDyn Init%InData_MAP%depth = Init%OutData_HD%WtrDpth ! This need to be set according to the water depth in HydroDyn - + ! differences for MAP++ - Init%InData_MAP%file_name = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. - Init%InData_MAP%summary_file_name = TRIM(p_FAST%OutFileRoot)//'.MAP.sum' ! Output file name + Init%InData_MAP%file_name = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. + Init%InData_MAP%summary_file_name = TRIM(p_FAST%OutFileRoot)//'.MAP.sum' ! Output file name Init%InData_MAP%depth = -Init%OutData_HD%WtrDpth ! This need to be set according to the water depth in HydroDyn - - Init%InData_MAP%LinInitInp%Linearize = p_FAST%Linearize - + + Init%InData_MAP%LinInitInp%Linearize = p_FAST%Linearize + CALL MAP_Init( Init%InData_MAP, MAPp%Input(1), MAPp%p, MAPp%x(STATE_CURR), MAPp%xd(STATE_CURR), MAPp%z(STATE_CURR), MAPp%OtherSt, & MAPp%y, p_FAST%dt_module( MODULE_MAP ), Init%OutData_MAP, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_MAP) = .TRUE. CALL SetModuleSubstepTime(Module_MAP, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + allocate( y_FAST%Lin%Modules(Module_MAP)%Instance(1), stat=ErrStat2) if (ErrStat2 /= 0 ) then call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(MAP).", ErrStat, ErrMsg, RoutineName ) @@ -979,79 +1055,79 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(Init%OutData_MAP%WriteOutputHdr)) y_FAST%Lin%Modules(Module_MAP)%Instance(1)%NumOutputs = size(Init%OutData_MAP%WriteOutputHdr) end if - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF ! ........................ - ! initialize MoorDyn + ! initialize MoorDyn ! ........................ ELSEIF (p_FAST%CompMooring == Module_MD) THEN - - Init%InData_MD%FileName = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. + + Init%InData_MD%FileName = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. Init%InData_MD%RootName = p_FAST%OutFileRoot - + Init%InData_MD%PtfmInit = Init%OutData_ED%PlatformPos !ED%x(STATE_CURR)%QT(1:6) ! initial position of the platform !bjj: this should come from Init%OutData_ED, not x_ED - Init%InData_MD%g = Init%OutData_ED%Gravity ! This need to be according to g used in ElastoDyn - Init%InData_MD%rhoW = Init%OutData_HD%WtrDens ! This needs to be set according to seawater density in HydroDyn + Init%InData_MD%g = Init%OutData_ED%Gravity ! This need to be according to g used in ElastoDyn + Init%InData_MD%rhoW = Init%OutData_HD%WtrDens ! This needs to be set according to seawater density in HydroDyn Init%InData_MD%WtrDepth = Init%OutData_HD%WtrDpth ! This need to be set according to the water depth in HydroDyn - + CALL MD_Init( Init%InData_MD, MD%Input(1), MD%p, MD%x(STATE_CURR), MD%xd(STATE_CURR), MD%z(STATE_CURR), & MD%OtherSt(STATE_CURR), MD%y, MD%m, p_FAST%dt_module( MODULE_MD ), Init%OutData_MD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_MD) = .TRUE. CALL SetModuleSubstepTime(Module_MD, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN END IF ! ........................ - ! initialize FEAM + ! initialize FEAM ! ........................ ELSEIF (p_FAST%CompMooring == Module_FEAM) THEN - - Init%InData_FEAM%InputFile = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. + + Init%InData_FEAM%InputFile = p_FAST%MooringFile ! This needs to be set according to what is in the FAST input file. Init%InData_FEAM%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_FEAM)) - + Init%InData_FEAM%PtfmInit = Init%OutData_ED%PlatformPos !ED%x(STATE_CURR)%QT(1:6) ! initial position of the platform !bjj: this should come from Init%OutData_ED, not x_ED - Init%InData_FEAM%NStepWave = 1 ! an arbitrary number > 0 (to set the size of the wave data, which currently contains all zero values) - Init%InData_FEAM%gravity = Init%OutData_ED%Gravity ! This need to be according to g used in ElastoDyn - Init%InData_FEAM%WtrDens = Init%OutData_HD%WtrDens ! This needs to be set according to seawater density in HydroDyn + Init%InData_FEAM%NStepWave = 1 ! an arbitrary number > 0 (to set the size of the wave data, which currently contains all zero values) + Init%InData_FEAM%gravity = Init%OutData_ED%Gravity ! This need to be according to g used in ElastoDyn + Init%InData_FEAM%WtrDens = Init%OutData_HD%WtrDens ! This needs to be set according to seawater density in HydroDyn ! Init%InData_FEAM%depth = Init%OutData_HD%WtrDpth ! This need to be set according to the water depth in HydroDyn - + CALL FEAM_Init( Init%InData_FEAM, FEAM%Input(1), FEAM%p, FEAM%x(STATE_CURR), FEAM%xd(STATE_CURR), FEAM%z(STATE_CURR), & FEAM%OtherSt(STATE_CURR), FEAM%y, FEAM%m, p_FAST%dt_module( MODULE_FEAM ), Init%OutData_FEAM, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_FEAM) = .TRUE. CALL SetModuleSubstepTime(Module_FEAM, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF ! ........................ - ! initialize OrcaFlex Interface + ! initialize OrcaFlex Interface ! ........................ ELSEIF (p_FAST%CompMooring == Module_Orca) THEN - + Init%InData_Orca%InputFile = p_FAST%MooringFile Init%InData_Orca%RootName = p_FAST%OutFileRoot - Init%InData_Orca%TMax = p_FAST%TMax - + Init%InData_Orca%TMax = p_FAST%TMax + CALL Orca_Init( Init%InData_Orca, Orca%Input(1), Orca%p, Orca%x(STATE_CURR), Orca%xd(STATE_CURR), Orca%z(STATE_CURR), Orca%OtherSt(STATE_CURR), & Orca%y, Orca%m, p_FAST%dt_module( MODULE_Orca ), Init%OutData_Orca, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(MODULE_Orca) = .TRUE. CALL SetModuleSubstepTime(MODULE_Orca, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN @@ -1059,32 +1135,32 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, END IF ! ------------------------------ - ! initialize CompIce modules + ! initialize CompIce modules ! ------------------------------ ALLOCATE( IceF%Input( p_FAST%InterpOrder+1 ), IceF%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating IceF%Input and IceF%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - + END IF + ! We need this to be allocated (else we have issues passing nonallocated arrays and using the first index of Input(), - ! but we don't need the space of IceD_MaxLegs if we're not using it. - IF ( p_FAST%CompIce /= Module_IceD ) THEN + ! but we don't need the space of IceD_MaxLegs if we're not using it. + IF ( p_FAST%CompIce /= Module_IceD ) THEN IceDim = 1 ELSE IceDim = IceD_MaxLegs END IF - + ! because there may be multiple instances of IceDyn, we'll allocate arrays for that here - ! we could allocate these after + ! we could allocate these after ALLOCATE( IceD%Input( p_FAST%InterpOrder+1, IceDim ), IceD%InputTimes( p_FAST%InterpOrder+1, IceDim ), STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating IceD%Input and IceD%InputTimes.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - + END IF + ALLOCATE( IceD%x( IceDim,2), & IceD%xd( IceDim,2), & IceD%z( IceDim,2), & @@ -1093,89 +1169,89 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, IceD%u( IceDim ), & IceD%y( IceDim ), & IceD%m( IceDim ), & - STAT = ErrStat2 ) + STAT = ErrStat2 ) IF (ErrStat2 /= 0) THEN CALL SetErrStat(ErrID_Fatal,"Error allocating IceD state, input, and output data.",ErrStat,ErrMsg,RoutineName) CALL Cleanup() RETURN - END IF - - + END IF + + ! ........................ - ! initialize IceFloe + ! initialize IceFloe ! ........................ IF ( p_FAST%CompIce == Module_IceF ) THEN - + Init%InData_IceF%InputFile = p_FAST%IceFile - Init%InData_IceF%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceF)) + Init%InData_IceF%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceF)) Init%InData_IceF%simLength = p_FAST%TMax !bjj: IceFloe stores this as single-precision (ReKi) TMax is DbKi Init%InData_IceF%MSL2SWL = Init%OutData_HD%MSL2SWL Init%InData_IceF%gravity = Init%OutData_ED%Gravity - + CALL IceFloe_Init( Init%InData_IceF, IceF%Input(1), IceF%p, IceF%x(STATE_CURR), IceF%xd(STATE_CURR), IceF%z(STATE_CURR), & IceF%OtherSt(STATE_CURR), IceF%y, IceF%m, p_FAST%dt_module( MODULE_IceF ), Init%OutData_IceF, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_IceF) = .TRUE. CALL SetModuleSubstepTime(Module_IceF, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF + END IF ! ........................ - ! initialize IceDyn + ! initialize IceDyn ! ........................ - ELSEIF ( p_FAST%CompIce == Module_IceD ) THEN - + ELSEIF ( p_FAST%CompIce == Module_IceD ) THEN + Init%InData_IceD%InputFile = p_FAST%IceFile - Init%InData_IceD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceD))//'1' - Init%InData_IceD%MSL2SWL = Init%OutData_HD%MSL2SWL - Init%InData_IceD%WtrDens = Init%OutData_HD%WtrDens + Init%InData_IceD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceD))//'1' + Init%InData_IceD%MSL2SWL = Init%OutData_HD%MSL2SWL + Init%InData_IceD%WtrDens = Init%OutData_HD%WtrDens Init%InData_IceD%gravity = Init%OutData_ED%Gravity Init%InData_IceD%TMax = p_FAST%TMax Init%InData_IceD%LegNum = 1 - + CALL IceD_Init( Init%InData_IceD, IceD%Input(1,1), IceD%p(1), IceD%x(1,STATE_CURR), IceD%xd(1,STATE_CURR), IceD%z(1,STATE_CURR), & IceD%OtherSt(1,STATE_CURR), IceD%y(1), IceD%m(1), p_FAST%dt_module( MODULE_IceD ), Init%OutData_IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + p_FAST%ModuleInitialized(Module_IceD) = .TRUE. CALL SetModuleSubstepTime(Module_IceD, p_FAST, y_FAST, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + ! now initialize IceD for additional legs (if necessary) dt_IceD = p_FAST%dt_module( MODULE_IceD ) - p_FAST%numIceLegs = Init%OutData_IceD%numLegs - + p_FAST%numIceLegs = Init%OutData_IceD%numLegs + IF (p_FAST%numIceLegs > IceD_MaxLegs) THEN CALL SetErrStat(ErrID_Fatal,'IceDyn-FAST coupling is supported for up to '//TRIM(Num2LStr(IceD_MaxLegs))//' legs, but ' & //TRIM(Num2LStr(p_FAST%numIceLegs))//' legs were specified.',ErrStat,ErrMsg,RoutineName) END IF - + DO i=2,p_FAST%numIceLegs ! basically, we just need IceDyn to set up its meshes for inputs/outputs and possibly initial values for states Init%InData_IceD%LegNum = i - Init%InData_IceD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceD))//TRIM(Num2LStr(i)) - + Init%InData_IceD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_IceD))//TRIM(Num2LStr(i)) + CALL IceD_Init( Init%InData_IceD, IceD%Input(1,i), IceD%p(i), IceD%x(i,STATE_CURR), IceD%xd(i,STATE_CURR), IceD%z(i,STATE_CURR), & IceD%OtherSt(i,STATE_CURR), IceD%y(i), IceD%m(i), dt_IceD, Init%OutData_IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + !bjj: we're going to force this to have the same timestep because I don't want to have to deal with n IceD modules with n timesteps. IF (.NOT. EqualRealNos( p_FAST%dt_module( MODULE_IceD ),dt_IceD )) THEN CALL SetErrStat(ErrID_Fatal,"All instances of IceDyn (one per support-structure leg) must be the same",ErrStat,ErrMsg,RoutineName) END IF END DO - + IF (ErrStat >= AbortErrLev) THEN CALL Cleanup() RETURN - END IF - - END IF - + END IF + + END IF + ! ........................ ! Set up output for glue code (must be done after all modules are initialized so we have their WriteOutput information) @@ -1201,7 +1277,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, ErrStat = ErrID_None ErrMsg = "" END IF - + ! ------------------------------------------------------------------------- ! Initialize for linearization: ! ------------------------------------------------------------------------- @@ -1209,27 +1285,27 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, ! NOTE: In the following call, we use Init%OutData_AD%BladeProps(1)%NumBlNds as the number of aero nodes on EACH blade, which ! is consistent with the current AD implementation, but if AD changes this, then it must be handled here, too! if (p_FAST%CompAero == MODULE_AD) then - call Init_Lin(p_FAST, y_FAST, m_FAST, AD, ED, Init%OutData_ED%NumBl, Init%OutData_AD%BladeProps(1)%NumBlNds, ErrStat2, ErrMsg2) + call Init_Lin(p_FAST, y_FAST, m_FAST, AD, ED, NumBl, Init%OutData_AD%rotors(1)%BladeProps(1)%NumBlNds, ErrStat2, ErrMsg2) else - call Init_Lin(p_FAST, y_FAST, m_FAST, AD, ED, Init%OutData_ED%NumBl, -1, ErrStat2, ErrMsg2) + call Init_Lin(p_FAST, y_FAST, m_FAST, AD, ED, NumBl, -1, ErrStat2, ErrMsg2) endif call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) then call Cleanup() return - end if + end if end if - - + + ! ------------------------------------------------------------------------- ! Initialize data for VTK output ! ------------------------------------------------------------------------- if ( p_FAST%WrVTK > VTK_None ) then - call SetVTKParameters(p_FAST, Init%OutData_ED, Init%OutData_AD, Init%InData_HD, Init%OutData_HD, ED, BD, AD, HD, ErrStat2, ErrMsg2) + call SetVTKParameters(p_FAST, Init%OutData_ED, Init%OutData_AD, Init%InData_HD, Init%OutData_HD, ED, BD, AD, HD, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) end if - + ! ------------------------------------------------------------------------- ! Write initialization data to FAST summary file: ! ------------------------------------------------------------------------- @@ -1237,35 +1313,35 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, CALL FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) endif - - + + ! ------------------------------------------------------------------------- ! other misc variables initialized here: ! ------------------------------------------------------------------------- - + m_FAST%t_global = t_initial - - ! Initialize external inputs for first step - if ( p_FAST%CompServo == MODULE_SrvD ) then + + ! Initialize external inputs for first step + if ( p_FAST%CompServo == MODULE_SrvD ) then m_FAST%ExternInput%GenTrq = SrvD%Input(1)%ExternalGenTrq !0.0_ReKi m_FAST%ExternInput%ElecPwr = SrvD%Input(1)%ExternalElecPwr m_FAST%ExternInput%YawPosCom = SrvD%Input(1)%ExternalYawPosCom m_FAST%ExternInput%YawRateCom = SrvD%Input(1)%ExternalYawRateCom m_FAST%ExternInput%HSSBrFrac = SrvD%Input(1)%ExternalHSSBrFrac - + do i=1,SIZE(SrvD%Input(1)%ExternalBlPitchCom) m_FAST%ExternInput%BlPitchCom(i) = SrvD%Input(1)%ExternalBlPitchCom(i) - end do + end do end if - + m_FAST%ExternInput%LidarFocus = 1.0_ReKi ! make this non-zero (until we add the initial position in the InflowWind input file) - - + + !............................................................................................................................... ! Destroy initializion data - !............................................................................................................................... + !............................................................................................................................... CALL Cleanup() - + CONTAINS SUBROUTINE Cleanup() !............................................................................................................................... @@ -1273,7 +1349,7 @@ SUBROUTINE Cleanup() !............................................................................................................................... CALL FAST_DestroyInitData( Init, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + END SUBROUTINE Cleanup END SUBROUTINE FAST_InitializeAll @@ -1286,19 +1362,19 @@ FUNCTION GetVersion(ThisProgVer) TYPE(ProgDesc), INTENT( IN ) :: ThisProgVer !< program name/date/version description CHARACTER(1024) :: GetVersion !< String containing a description of the compiled precision. - + CHARACTER(200) :: git_commit - + GetVersion = TRIM(GetNVD(ThisProgVer))//', compiled' IF ( Cmpl4SFun ) THEN ! FAST has been compiled as an S-Function for Simulink GetVersion = TRIM(GetVersion)//' as a DLL S-Function for Simulink' ELSEIF ( Cmpl4LV ) THEN ! FAST has been compiled as a DLL for Labview GetVersion = TRIM(GetVersion)//' as a DLL for LabVIEW' - ENDIF - + ENDIF + GetVersion = TRIM(GetVersion)//' as a '//TRIM(Num2LStr(BITS_IN_ADDR))//'-bit application using' - + ! determine precision IF ( ReKi == SiKi ) THEN ! Single precision @@ -1308,7 +1384,7 @@ FUNCTION GetVersion(ThisProgVer) ELSE ! Unknown precision GetVersion = TRIM(GetVersion)//' unknown' ENDIF - + ! GetVersion = TRIM(GetVersion)//' precision with '//OS_Desc GetVersion = TRIM(GetVersion)//' precision' @@ -1325,14 +1401,14 @@ END FUNCTION GetVersion !! displays the copyright notice, and displays some version information (including addressing scheme and precision). SUBROUTINE FAST_ProgStart(ThisProgVer) TYPE(ProgDesc), INTENT(IN) :: ThisProgVer !< program name/date/version description - + ! ... Initialize NWTC Library (open console, set pi constants) ... ! sets the pi constants, open console for output, etc... CALL NWTC_Init( ProgNameIN=ThisProgVer%Name, EchoLibVer=.FALSE. ) - + ! Display the copyright notice CALL DispCopyrightLicense( ThisProgVer%Name ) - + CALL DispCompileRuntimeInfo END SUBROUTINE FAST_ProgStart @@ -1344,30 +1420,30 @@ SUBROUTINE GetInputFileName(InputFile,UseDWM,ErrStat,ErrMsg) LOGICAL, INTENT(OUT) :: UseDWM !< whether the last argument from the command line is "DWM" INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message - + INTEGER(IntKi) :: ErrStat2 ! local error stat CHARACTER(1024) :: LastArg ! A second command-line argument that will allow DWM module to be used in AeroDyn - + ErrStat = ErrID_None ErrMsg = '' - + UseDWM = .FALSE. ! by default, we're not going to use the DWM module InputFile = "" ! initialize to empty string to make sure it's input from the command line CALL CheckArgs( InputFile, ErrStat2, LastArg ) ! if ErrStat2 /= ErrID_None, we'll ignore and deal with the problem when we try to read the input file - + IF (LEN_TRIM(InputFile) == 0) THEN ! no input file was specified ErrStat = ErrID_Fatal ErrMsg = 'The required input file was not specified on the command line.' RETURN - END IF - + END IF + IF (LEN_TRIM(LastArg) > 0) THEN ! see if DWM was specified as the second option CALL Conv2UC( LastArg ) IF ( TRIM(LastArg) == "DWM" ) THEN UseDWM = .TRUE. END IF - END IF - + END IF + END SUBROUTINE GetInputFileName !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine checks for command-line arguments, gets the root name of the input files @@ -1395,31 +1471,31 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, !CHARACTER(1024) :: DirName ! A CHARACTER string containing the path of the current working directory - LOGICAL :: OverrideAbortErrLev + LOGICAL :: OverrideAbortErrLev CHARACTER(*), PARAMETER :: RoutineName = "FAST_Init" - + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - + ! Initialize some variables ErrStat = ErrID_None ErrMsg = '' - + IF (PRESENT(OverrideAbortLev)) THEN OverrideAbortErrLev = OverrideAbortLev ELSE OverrideAbortErrLev = .true. END IF - - + + !............................................................................................................................... ! Set the root name of the output files based on the input file name !............................................................................................................................... - + if (present(RootName)) then p%OutFileRoot = RootName - else + else ! Determine the root name of the primary file (will be used for output files) CALL GetRoot( InputFile, p%OutFileRoot ) IF ( Cmpl4SFun ) p%OutFileRoot = TRIM( p%OutFileRoot )//'.SFunc' @@ -1428,19 +1504,21 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, p%OutFileRoot = TRIM( p%OutFileRoot )//'.T'//TRIM(Num2LStr(TurbID)) END IF END IF - + end if p%VTK_OutFileRoot = p%OutFileRoot !initialize this here in case of error before it is set later - - + + !............................................................................................................................... ! Initialize the module name/date/version info: !............................................................................................................................... - DO i=1,NumModules + y_FAST%Module_Ver( Module_Glue ) = FAST_Ver + + DO i=2,NumModules y_FAST%Module_Ver(i)%Date = 'unknown date' y_FAST%Module_Ver(i)%Ver = 'unknown version' - END DO + END DO y_FAST%Module_Ver( Module_IfW )%Name = 'InflowWind' y_FAST%Module_Ver( Module_OpFM )%Name = 'OpenFOAM integration' y_FAST%Module_Ver( Module_ED )%Name = 'ElastoDyn' @@ -1458,6 +1536,7 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, y_FAST%Module_Ver( Module_IceF )%Name = 'IceFloe' y_FAST%Module_Ver( Module_IceD )%Name = 'IceDyn' + y_FAST%Module_Abrev( Module_Glue ) = 'FAST' y_FAST%Module_Abrev( Module_IfW ) = 'IfW' y_FAST%Module_Abrev( Module_OpFM ) = 'OpFM' y_FAST%Module_Abrev( Module_ED ) = 'ED' @@ -1473,16 +1552,16 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, y_FAST%Module_Abrev( Module_MD ) = 'MD' y_FAST%Module_Abrev( Module_Orca ) = 'Orca' y_FAST%Module_Abrev( Module_IceF ) = 'IceF' - y_FAST%Module_Abrev( Module_IceD ) = 'IceD' - + y_FAST%Module_Abrev( Module_IceD ) = 'IceD' + p%n_substeps = 1 ! number of substeps for between modules and global/FAST time p%BD_OutputSibling = .false. - + !............................................................................................................................... ! Read the primary file for the glue code: !............................................................................................................................... CALL FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! make sure some linearization variables are consistant if (.not. p%Linearize) p%CalcSteady = .false. @@ -1495,18 +1574,18 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, p%TMax = TMax !p%TMax = MAX( TMax, p%TMax ) END IF - + IF ( ErrStat >= AbortErrLev ) RETURN p%KMax = 1 ! after more checking, we may put this in the input file... !IF (p%CompIce == Module_IceF) p%KMax = 2 p%SizeJac_Opt1 = 0 ! initialize this vector to zero; after we figure out what size the ED/SD/HD/BD meshes are, we'll fill this - + p%numIceLegs = 0 ! initialize number of support-structure legs in contact with ice (IceDyn will set this later) - + p%nBeams = 0 ! initialize number of BeamDyn instances (will be set later) - + ! determine what kind of turbine we're modeling: IF ( p%CompHydro == Module_HD ) THEN IF ( p%CompSub == Module_SD ) THEN @@ -1518,11 +1597,11 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, p%TurbineType = Type_Offshore_Floating ELSEIF ( p%CompSub == Module_ExtPtfm ) THEN p%TurbineType = Type_Offshore_Fixed - ELSE + ELSE p%TurbineType = Type_LandBased - END IF - - + END IF + + p%n_TMax_m1 = CEILING( ( (p%TMax - t_initial) / p%DT ) ) - 1 ! We're going to go from step 0 to n_TMax (thus the -1 here) if (p%TMax < 1.0_DbKi) then ! log10(0) gives floating point divide-by-zero error @@ -1530,19 +1609,19 @@ SUBROUTINE FAST_Init( p, m_FAST, y_FAST, t_initial, InputFile, ErrStat, ErrMsg, else p%TChanLen = max( MinChanLen, int(log10(p%TMax))+7 ) end if - p%OutFmt_t = 'F'//trim(num2lstr( p%TChanLen ))//'.4' ! 'F10.4' - + p%OutFmt_t = 'F'//trim(num2lstr( p%TChanLen ))//'.4' ! 'F10.4' + !............................................................................................................................... ! Do some error checking on the inputs (validation): - !............................................................................................................................... - call ValidateInputData(p, m_FAST, ErrStat2, ErrMsg2) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + !............................................................................................................................... + call ValidateInputData(p, m_FAST, ErrStat2, ErrMsg2) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + - IF ( ErrStat >= AbortErrLev ) RETURN - - + + RETURN END SUBROUTINE FAST_Init !---------------------------------------------------------------------------------------------------------------------------------- @@ -1555,16 +1634,16 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message REAL(DbKi) :: TmpTime ! A temporary variable for error checking - + INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName='ValidateInputData' - + ErrStat = ErrID_None ErrMsg = "" - - + + IF ( p%TMax < 0.0_DbKi ) THEN CALL SetErrStat( ErrID_Fatal, 'TMax must not be a negative number.', ErrStat, ErrMsg, RoutineName ) ELSE IF ( p%TMax < p%TStart ) THEN @@ -1576,7 +1655,7 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) if (p%CompMooring==MODULE_Orca) CALL SetErrStat( ErrID_Fatal, 'Restart capability for OrcaFlexInterface is not supported. Set ChkptTime larger than TMax.', ErrStat, ErrMsg, RoutineName ) ! also check for other features that aren't supported with restart (like ServoDyn's user-defined control routines) END IF - + IF ( p%DT <= 0.0_DbKi ) THEN CALL SetErrStat( ErrID_Fatal, 'DT must be greater than 0.', ErrStat, ErrMsg, RoutineName ) ELSE ! Test DT and TMax to ensure numerical stability -- HINT: see the use of OnePlusEps @@ -1592,7 +1671,7 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) IF ( p%WrTxtOutFile .and. p%FmtWidth < MinChanLen ) CALL SetErrStat( ErrID_Warn, 'OutFmt produces a column width of '// & TRIM(Num2LStr(p%FmtWidth))//'), which may be too small.', ErrStat, ErrMsg, RoutineName ) - + IF ( p%WrTxtOutFile .AND. p%TChanLen > ChanLen ) THEN ! ( p%TMax > 9999.999_DbKi ) CALL SetErrStat( ErrID_Warn, 'TMax is too large for a '//trim(num2lstr(ChanLen))//'-character time column in text tabular (time-marching) output files.'// & ' Postprocessors with this limitation may not work.', ErrStat, ErrMsg, RoutineName ) @@ -1603,8 +1682,8 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) IF ( p%n_SttsTime < 1_IntKi ) CALL SetErrStat( ErrID_Fatal, 'SttsTime must be greater than 0 seconds.', ErrStat, ErrMsg, RoutineName ) IF ( p%n_ChkptTime < 1_IntKi ) CALL SetErrStat( ErrID_Fatal, 'ChkptTime must be greater than 0 seconds.', ErrStat, ErrMsg, RoutineName ) IF ( p%KMax < 1_IntKi ) CALL SetErrStat( ErrID_Fatal, 'KMax must be greater than 0.', ErrStat, ErrMsg, RoutineName ) - - IF (p%CompElast == Module_Unknown) CALL SetErrStat( ErrID_Fatal, 'CompElast must be 1 (ElastoDyn) or 2 (BeamDyn).', ErrStat, ErrMsg, RoutineName ) + + IF (p%CompElast == Module_Unknown) CALL SetErrStat( ErrID_Fatal, 'CompElast must be 1 (ElastoDyn) or 2 (BeamDyn).', ErrStat, ErrMsg, RoutineName ) IF (p%CompAero == Module_Unknown) CALL SetErrStat( ErrID_Fatal, 'CompAero must be 0 (None), 1 (AeroDyn14), or 2 (AeroDyn).', ErrStat, ErrMsg, RoutineName ) IF (p%CompServo == Module_Unknown) CALL SetErrStat( ErrID_Fatal, 'CompServo must be 0 (None) or 1 (ServoDyn).', ErrStat, ErrMsg, RoutineName ) IF (p%CompHydro == Module_Unknown) CALL SetErrStat( ErrID_Fatal, 'CompHydro must be 0 (None) or 1 (HydroDyn).', ErrStat, ErrMsg, RoutineName ) @@ -1624,7 +1703,7 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) IF (p%CompSub == Module_ExtPtfm) CALL SetErrStat( ErrID_Fatal, 'HydroDyn cannot be used if ExtPtfm_MCKF is used. Set CompHydro = 0 or CompSub < 2 in the FAST input file.', ErrStat, ErrMsg, RoutineName ) END IF - + IF (p%CompIce == Module_IceF) THEN IF (p%CompSub /= Module_SD) CALL SetErrStat( ErrID_Fatal, 'SubDyn must be used when IceFloe is used. Set CompSub > 0 or CompIce = 0 in the FAST input file.', ErrStat, ErrMsg, RoutineName ) IF (p%CompHydro /= Module_HD) CALL SetErrStat( ErrID_Fatal, 'HydroDyn must be used when IceFloe is used. Set CompHydro > 0 or CompIce = 0 in the FAST input file.', ErrStat, ErrMsg, RoutineName ) @@ -1632,9 +1711,9 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) IF (p%CompSub /= Module_SD) CALL SetErrStat( ErrID_Fatal, 'SubDyn must be used when IceDyn is used. Set CompSub > 0 or CompIce = 0 in the FAST input file.', ErrStat, ErrMsg, RoutineName ) IF (p%CompHydro /= Module_HD) CALL SetErrStat( ErrID_Fatal, 'HydroDyn must be used when IceDyn is used. Set CompHydro > 0 or CompIce = 0 in the FAST input file.', ErrStat, ErrMsg, RoutineName ) END IF - + IF (p%CompElast == Module_BD .and. p%CompAero == Module_AD14 ) CALL SetErrStat( ErrID_Fatal, 'AeroDyn14 cannot be used when BeamDyn is used. Change CompAero or CompElast in the FAST input file.', ErrStat, ErrMsg, RoutineName ) - + ! IF ( p%InterpOrder < 0 .OR. p%InterpOrder > 2 ) THEN IF ( p%InterpOrder < 1 .OR. p%InterpOrder > 2 ) THEN CALL SetErrStat( ErrID_Fatal, 'InterpOrder must be 1 or 2.', ErrStat, ErrMsg, RoutineName ) ! 5/13/14 bjj: MAS and JMJ compromise for certain integrators is that InterpOrder cannot be 0 @@ -1643,9 +1722,9 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) IF ( p%NumCrctn < 0_IntKi ) THEN CALL SetErrStat( ErrID_Fatal, 'NumCrctn must be 0 or greater.', ErrStat, ErrMsg, RoutineName ) - END IF - - + END IF + + if ( p%WrVTK == VTK_Unknown ) then call SetErrStat(ErrID_Fatal, 'WrVTK must be 0 (none), 1 (initialization only), 2 (animation), or 3 (mode shapes).', ErrStat, ErrMsg, RoutineName) else @@ -1653,25 +1732,25 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) call SetErrStat(ErrID_Fatal, 'VTK_type must be 1 (surfaces), 2 (basic meshes:lines/points), or 3 (all meshes).', ErrStat, ErrMsg, RoutineName) ! note I'm not going to write that 4 (old) is an option end if - + if (p%WrVTK == VTK_ModeShapes .and. .not. p%Linearize) then call SetErrStat(ErrID_Fatal, 'WrVTK cannot be 3 (mode shapes) when Linearize is false. (Mode shapes require linearization analysis.)', ErrStat, ErrMsg, RoutineName) end if end if - + if (p%Linearize) then - + if (p%CalcSteady) then if (p%NLinTimes < 1) call SetErrStat(ErrID_Fatal,'NLinTimes must be at least 1 for linearization analysis.',ErrStat, ErrMsg, RoutineName) if (p%TrimCase /= TrimCase_yaw .and. p%TrimCase /= TrimCase_torque .and. p%TrimCase /= TrimCase_pitch) then call SetErrStat(ErrID_Fatal,'TrimCase must be either 1, 2, or 3.',ErrStat, ErrMsg, RoutineName) end if - + if (p%TrimTol <= epsilon(p%TrimTol)) call SetErrStat(ErrID_Fatal,'TrimTol must be larger than '//trim(num2lstr(epsilon(p%TrimTol)))//'.',ErrStat, ErrMsg, RoutineName) if (p%Twr_Kdmp < 0.0_ReKi) call SetErrStat(ErrID_Fatal,'Twr_Kdmp must not be negative.',ErrStat, ErrMsg, RoutineName) if (p%Bld_Kdmp < 0.0_ReKi) call SetErrStat(ErrID_Fatal,'Bld_Kdmp must not be negative.',ErrStat, ErrMsg, RoutineName) else - + if (.not. allocated(m_FAST%Lin%LinTimes)) then call SetErrStat(ErrID_Fatal, 'NLinTimes must be at least 1 for linearization analysis.',ErrStat, ErrMsg, RoutineName) else @@ -1681,22 +1760,22 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) do i=2,p%NLinTimes if (m_FAST%Lin%LinTimes(i) <= m_FAST%Lin%LinTimes(i-1)) call SetErrStat(ErrID_Fatal,'LinTimes must be unique values entered in increasing order.',ErrStat, ErrMsg, RoutineName) end do - + if (m_FAST%Lin%LinTimes(p%NLinTimes) > p%TMax) call SetErrStat(ErrID_Info, 'Tmax is less than the last linearization time. Linearization analysis will not be performed after TMax.',ErrStat, ErrMsg, RoutineName) end if - + end if - + if (p%LinInputs < LIN_NONE .or. p%LinInputs > LIN_ALL) call SetErrStat(ErrID_Fatal,'LinInputs must be 0, 1, or 2.',ErrStat, ErrMsg, RoutineName) if (p%LinOutputs < LIN_NONE .or. p%LinOutputs > LIN_ALL) call SetErrStat(ErrID_Fatal,'LinOutputs must be 0, 1, or 2.',ErrStat, ErrMsg, RoutineName) - + if (p%LinOutJac) then if ( p%LinInputs /= LIN_ALL .or. p%LinOutputs /= LIN_ALL) then call SetErrStat(ErrID_Info,'LinOutJac can be used only when LinInputs=LinOutputs=2.',ErrStat, ErrMsg, RoutineName) p%LinOutJac = .false. end if end if - + ! now, make sure we haven't asked for any modules that we can't yet linearize: if (p%CompInflow == MODULE_OpFM) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for the OpenFOAM coupling.',ErrStat, ErrMsg, RoutineName) if (p%CompAero == MODULE_AD14) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for the AeroDyn v14 module.',ErrStat, ErrMsg, RoutineName) @@ -1704,17 +1783,17 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) if (p%CompSub /= MODULE_None .and. p%CompSub /= MODULE_SD ) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for the ExtPtfm_MCKF substructure module.',ErrStat, ErrMsg, RoutineName) if (p%CompMooring /= MODULE_None .and. p%CompMooring /= MODULE_MAP) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for the FEAMooring or MoorDyn mooring modules.',ErrStat, ErrMsg, RoutineName) if (p%CompIce /= MODULE_None) call SetErrStat(ErrID_Fatal,'Linearization is not implemented for any of the ice loading modules.',ErrStat, ErrMsg, RoutineName) - + end if - - + + if ( p%TurbineType /= Type_LandBased .and. .not. EqualRealNos(p%TurbinePos(3), 0.0_SiKi) ) then call SetErrStat(ErrID_Fatal, 'Height of turbine location, TurbinePos(3), must be 0 for offshore turbines.', ErrStat, ErrMsg, RoutineName) end if !............................................................................................................................... - ! temporary check on p_FAST%DT_out + ! temporary check on p_FAST%DT_out IF ( .NOT. EqualRealNos( p%DT_out, p%DT ) ) THEN IF ( p%DT_out < p%DT ) THEN @@ -1723,8 +1802,8 @@ SUBROUTINE ValidateInputData(p, m_FAST, ErrStat, ErrMsg) CALL SetErrStat( ErrID_Fatal, 'DT_out must be an integer multiple of DT.', ErrStat, ErrMsg, RoutineName ) END IF END IF - - + + END SUBROUTINE ValidateInputData !---------------------------------------------------------------------------------------------------------------------------------- @@ -1756,9 +1835,9 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) y_FAST%FileDescLines(1) = 'Predictions were generated on '//CurDate()//' at '//CurTime()//' using '//TRIM(GetVersion(FAST_Ver)) y_FAST%FileDescLines(2) = 'linked with ' //' '//TRIM(GetNVD(NWTC_Ver )) ! we'll get the rest of the linked modules in the section below y_FAST%FileDescLines(3) = 'Description from the FAST input file: '//TRIM(p_FAST%FTitle) - + !...................................................... - ! We'll fill out the rest of FileDescLines(2), + ! We'll fill out the rest of FileDescLines(2), ! and save the module version info for later use, too: !...................................................... @@ -1766,32 +1845,32 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_ED ) )) IF ( p_FAST%CompElast == Module_BD ) THEN - y_FAST%Module_Ver( Module_BD ) = Init%OutData_BD(1)%Ver ! call copy routine for this type if it every uses dynamic memory - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_BD ))) - END IF - - + y_FAST%Module_Ver( Module_BD ) = Init%OutData_BD(1)%Ver ! call copy routine for this type if it every uses dynamic memory + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_BD ))) + END IF + + IF ( p_FAST%CompInflow == Module_IfW ) THEN - y_FAST%Module_Ver( Module_IfW ) = Init%OutData_IfW%Ver ! call copy routine for this type if it every uses dynamic memory - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_IfW ))) + y_FAST%Module_Ver( Module_IfW ) = Init%OutData_IfW%Ver ! call copy routine for this type if it every uses dynamic memory + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_IfW ))) ELSEIF ( p_FAST%CompInflow == Module_OpFM ) THEN - y_FAST%Module_Ver( Module_OpFM ) = Init%OutData_OpFM%Ver ! call copy routine for this type if it every uses dynamic memory - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_OpFM ))) - END IF - + y_FAST%Module_Ver( Module_OpFM ) = Init%OutData_OpFM%Ver ! call copy routine for this type if it every uses dynamic memory + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_OpFM ))) + END IF + IF ( p_FAST%CompAero == Module_AD14 ) THEN - y_FAST%Module_Ver( Module_AD14 ) = Init%OutData_AD14%Ver - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_AD14 ) )) + y_FAST%Module_Ver( Module_AD14 ) = Init%OutData_AD14%Ver + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_AD14 ) )) ELSEIF ( p_FAST%CompAero == Module_AD ) THEN - y_FAST%Module_Ver( Module_AD ) = Init%OutData_AD%Ver - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_AD ) )) + y_FAST%Module_Ver( Module_AD ) = Init%OutData_AD%Ver + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_AD ) )) END IF IF ( p_FAST%CompServo == Module_SrvD ) THEN y_FAST%Module_Ver( Module_SrvD ) = Init%OutData_SrvD%Ver y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_SrvD ))) END IF - + IF ( p_FAST%CompHydro == Module_HD ) THEN y_FAST%Module_Ver( Module_HD ) = Init%OutData_HD%Ver y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_HD ))) @@ -1817,34 +1896,33 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) ELSEIF ( p_FAST%CompMooring == Module_Orca ) THEN y_FAST%Module_Ver( Module_Orca ) = Init%OutData_Orca%Ver y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_Orca))) - END IF - + END IF + IF ( p_FAST%CompIce == Module_IceF ) THEN y_FAST%Module_Ver( Module_IceF ) = Init%OutData_IceF%Ver y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_IceF ))) ELSEIF ( p_FAST%CompIce == Module_IceD ) THEN y_FAST%Module_Ver( Module_IceD ) = Init%OutData_IceD%Ver - y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_IceD ))) - END IF - + y_FAST%FileDescLines(2) = TRIM(y_FAST%FileDescLines(2) ) //'; '//TRIM(GetNVD(y_FAST%Module_Ver( Module_IceD ))) + END IF + !...................................................... ! Set the number of output columns from each module !...................................................... y_FAST%numOuts = 0 ! Inintialize entire array - - - !y_FAST%numOuts(Module_InfW) = 3 !hack for now: always output 3 wind speeds at hub-height IF ( ALLOCATED( Init%OutData_IfW%WriteOutputHdr ) ) y_FAST%numOuts(Module_IfW) = SIZE(Init%OutData_IfW%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_OpFM%WriteOutputHdr ) ) y_FAST%numOuts(Module_OpFM) = SIZE(Init%OutData_OpFM%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_ED%WriteOutputHdr ) ) y_FAST%numOuts(Module_ED) = SIZE(Init%OutData_ED%WriteOutputHdr) do i=1,p_FAST%nBeams IF ( ALLOCATED( Init%OutData_BD(i)%WriteOutputHdr) ) y_FAST%numOuts(Module_BD) = y_FAST%numOuts(Module_BD) + SIZE(Init%OutData_BD(i)%WriteOutputHdr) -end do +end do !ad14 doesn't have outputs: y_FAST%numOuts(Module_AD14) = 0 - IF ( ALLOCATED( Init%OutData_AD%WriteOutputHdr ) ) y_FAST%numOuts(Module_AD) = SIZE(Init%OutData_AD%WriteOutputHdr) + IF ( ALLOCATED( Init%OutData_AD%rotors)) then + IF ( ALLOCATED( Init%OutData_AD%rotors(1)%WriteOutputHdr)) y_FAST%numOuts(Module_AD) = SIZE(Init%OutData_AD%rotors(1)%WriteOutputHdr) + ENDIF IF ( ALLOCATED( Init%OutData_SrvD%WriteOutputHdr ) ) y_FAST%numOuts(Module_SrvD) = SIZE(Init%OutData_SrvD%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_HD%WriteOutputHdr ) ) y_FAST%numOuts(Module_HD) = SIZE(Init%OutData_HD%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_SD%WriteOutputHdr ) ) y_FAST%numOuts(Module_SD) = SIZE(Init%OutData_SD%WriteOutputHdr) @@ -1854,22 +1932,28 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) IF ( ALLOCATED( Init%OutData_MD%WriteOutputHdr ) ) y_FAST%numOuts(Module_MD) = SIZE(Init%OutData_MD%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_Orca%WriteOutputHdr ) ) y_FAST%numOuts(Module_Orca) = SIZE(Init%OutData_Orca%WriteOutputHdr) IF ( ALLOCATED( Init%OutData_IceF%WriteOutputHdr ) ) y_FAST%numOuts(Module_IceF) = SIZE(Init%OutData_IceF%WriteOutputHdr) - IF ( ALLOCATED( Init%OutData_IceD%WriteOutputHdr ) ) y_FAST%numOuts(Module_IceD) = SIZE(Init%OutData_IceD%WriteOutputHdr)*p_FAST%numIceLegs - + IF ( ALLOCATED( Init%OutData_IceD%WriteOutputHdr ) ) y_FAST%numOuts(Module_IceD) = SIZE(Init%OutData_IceD%WriteOutputHdr)*p_FAST%numIceLegs + !...................................................... ! Initialize the output channel names and units !...................................................... - NumOuts = 1 + SUM( y_FAST%numOuts ) + y_FAST%numOuts(Module_Glue) = 1 ! time + + + NumOuts = SUM( y_FAST%numOuts ) CALL AllocAry( y_FAST%ChannelNames,NumOuts, 'ChannelNames', ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) RETURN CALL AllocAry( y_FAST%ChannelUnits,NumOuts, 'ChannelUnits', ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) RETURN + ! Glue outputs: y_FAST%ChannelNames(1) = 'Time' y_FAST%ChannelUnits(1) = '(s)' - indxNext = 2 + + indxNext = y_FAST%numOuts(Module_Glue) + 1 + DO i=1,y_FAST%numOuts(Module_IfW) !InflowWind y_FAST%ChannelNames(indxNext) = Init%OutData_IfW%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_IfW%WriteOutputUnt(i) @@ -1880,100 +1964,100 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) y_FAST%ChannelNames(indxNext) = Init%OutData_OpFM%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_OpFM%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_ED) !ElastoDyn y_FAST%ChannelNames(indxNext) = Init%OutData_ED%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_ED%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO IF ( y_FAST%numOuts(Module_BD) > 0_IntKi ) THEN !BeamDyn do i=1,p_FAST%nBeams - if ( allocated(Init%OutData_BD(i)%WriteOutputHdr) ) then - do j=1,size(Init%OutData_BD(i)%WriteOutputHdr) + if ( allocated(Init%OutData_BD(i)%WriteOutputHdr) ) then + do j=1,size(Init%OutData_BD(i)%WriteOutputHdr) y_FAST%ChannelNames(indxNext) = 'B'//TRIM(Num2Lstr(i))//trim(Init%OutData_BD(i)%WriteOutputHdr(j)) y_FAST%ChannelUnits(indxNext) = Init%OutData_BD(i)%WriteOutputUnt(j) indxNext = indxNext + 1 - end do ! j - end if - end do + end do ! j + end if + end do END IF - - - ! none for AeroDyn14 - + + + ! none for AeroDyn14 + DO i=1,y_FAST%numOuts(Module_AD) !AeroDyn - y_FAST%ChannelNames(indxNext) = Init%OutData_AD%WriteOutputHdr(i) - y_FAST%ChannelUnits(indxNext) = Init%OutData_AD%WriteOutputUnt(i) + y_FAST%ChannelNames(indxNext) = Init%OutData_AD%rotors(1)%WriteOutputHdr(i) + y_FAST%ChannelUnits(indxNext) = Init%OutData_AD%rotors(1)%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO - + END DO + DO i=1,y_FAST%numOuts(Module_SrvD) !ServoDyn y_FAST%ChannelNames(indxNext) = Init%OutData_SrvD%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_SrvD%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_HD) !HydroDyn y_FAST%ChannelNames(indxNext) = Init%OutData_HD%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_HD%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_SD) !SubDyn y_FAST%ChannelNames(indxNext) = Init%OutData_SD%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_SD%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_ExtPtfm) !ExtPtfm_MCKF y_FAST%ChannelNames(indxNext) = Init%OutData_ExtPtfm%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_ExtPtfm%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO - + END DO + DO i=1,y_FAST%numOuts(Module_MAP) !MAP y_FAST%ChannelNames(indxNext) = Init%OutData_MAP%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_MAP%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO - + END DO + DO i=1,y_FAST%numOuts(Module_MD) !MoorDyn y_FAST%ChannelNames(indxNext) = Init%OutData_MD%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_MD%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_FEAM) !FEAMooring y_FAST%ChannelNames(indxNext) = Init%OutData_FEAM%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_FEAM%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO + END DO DO i=1,y_FAST%numOuts(Module_Orca) !OrcaFlex y_FAST%ChannelNames(indxNext) = Init%OutData_Orca%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_Orca%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO - + END DO + DO i=1,y_FAST%numOuts(Module_IceF) !IceFloe y_FAST%ChannelNames(indxNext) = Init%OutData_IceF%WriteOutputHdr(i) y_FAST%ChannelUnits(indxNext) = Init%OutData_IceF%WriteOutputUnt(i) indxNext = indxNext + 1 - END DO - + END DO + IF ( y_FAST%numOuts(Module_IceD) > 0_IntKi ) THEN !IceDyn - DO I=1,p_FAST%numIceLegs - DO J=1,SIZE(Init%OutData_IceD%WriteOutputHdr) + DO I=1,p_FAST%numIceLegs + DO J=1,SIZE(Init%OutData_IceD%WriteOutputHdr) y_FAST%ChannelNames(indxNext) =TRIM(Init%OutData_IceD%WriteOutputHdr(J))//'L'//TRIM(Num2Lstr(I)) !bjj: do we want this "Lx" at the end? y_FAST%ChannelUnits(indxNext) = Init%OutData_IceD%WriteOutputUnt(J) indxNext = indxNext + 1 END DO ! J END DO ! I - END IF - - + END IF + + !...................................................... ! Open the text output file and print the headers !...................................................... @@ -1990,7 +2074,7 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) if (p_FAST%FmtWidth < y_FAST%ActualChanLen) then y_FAST%OutFmt_a = trim(y_FAST%OutFmt_a)//','//trim(num2lstr(y_FAST%ActualChanLen - p_FAST%FmtWidth))//'x' end if - + CALL GetNewUnit( y_FAST%UnOu, ErrStat, ErrMsg ) IF ( ErrStat >= AbortErrLev ) RETURN @@ -2017,7 +2101,7 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) CALL WrFileNR ( y_FAST%UnOu, p_FAST%Delim//trim(y_FAST%ChannelNames(I)) ) ENDDO ! I else - + CALL WrFileNR ( y_FAST%UnOu, y_FAST%ChannelNames(1)(1:p_FAST%TChanLen) ) ! first one is time, with a special format DO I=2,NumOuts @@ -2032,14 +2116,14 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) !...................................................... if (p_FAST%Delim /= " ") then - + CALL WrFileNR ( y_FAST%UnOu, trim(y_FAST%ChannelUnits(1)) ) DO I=2,NumOuts CALL WrFileNR ( y_FAST%UnOu, p_FAST%Delim//trim(y_FAST%ChannelUnits(I)) ) ENDDO ! I else - + CALL WrFileNR ( y_FAST%UnOu, y_FAST%ChannelUnits(1)(1:p_FAST%TChanLen) ) DO I=2,NumOuts @@ -2059,14 +2143,14 @@ SUBROUTINE FAST_InitOutput( p_FAST, y_FAST, Init, ErrStat, ErrMsg ) ! calculate the size of the array of outputs we need to store y_FAST%NOutSteps = CEILING ( (p_FAST%TMax - p_FAST%TStart) / p_FAST%DT_OUT ) + 1 - CALL AllocAry( y_FAST%AllOutData, NumOuts-1, y_FAST%NOutSteps, 'AllOutData', ErrStat, ErrMsg ) - y_FAST%AllOutData = 0.0_ReKi + CALL AllocAry( y_FAST%AllOutData, NumOuts-1, y_FAST%NOutSteps, 'AllOutData', ErrStat, ErrMsg ) ! this does not include the time channel IF ( ErrStat >= AbortErrLev ) RETURN + y_FAST%AllOutData = 0.0_ReKi IF ( p_FAST%WrBinMod == FileFmtID_WithTime ) THEN ! we store the entire time array CALL AllocAry( y_FAST%TimeData, y_FAST%NOutSteps, 'TimeData', ErrStat, ErrMsg ) IF ( ErrStat >= AbortErrLev ) RETURN - ELSE + ELSE CALL AllocAry( y_FAST%TimeData, 2_IntKi, 'TimeData', ErrStat, ErrMsg ) IF ( ErrStat >= AbortErrLev ) RETURN @@ -2116,7 +2200,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CHARACTER(30) :: Line ! string for default entry in input file CHARACTER(*), PARAMETER :: RoutineName = 'FAST_ReadPrimaryFile' - + ! Initialize some variables: UnEc = -1 @@ -2136,7 +2220,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if @@ -2152,14 +2236,14 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if CALL ReadStr( UnIn, InputFile, p%FTitle, 'FTitle', 'File Header: File Description (line 2)', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if @@ -2168,7 +2252,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if @@ -2177,7 +2261,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if @@ -2191,7 +2275,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( UnEc > 0 ) WRITE (UnEc,'(/,A,/)') 'Data from '//TRIM(FAST_Ver%Name)//' primary input file "'//TRIM( InputFile )//'":' @@ -2200,7 +2284,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS IF (ErrStat2 /= 0_IntKi ) THEN CALL SetErrStat( ErrID_Fatal, 'Error rewinding file "'//TRIM(InputFile)//'".',ErrStat,ErrMsg,RoutineName) call cleanup() - RETURN + RETURN END IF END DO @@ -2216,7 +2300,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2,ErrStat,ErrMsg,RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF (OverrideAbortErrLev) THEN @@ -2236,39 +2320,39 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS RETURN END SELECT END IF - + ! TMax - Total run time (s): CALL ReadVar( UnIn, InputFile, p%TMax, "TMax", "Total run time (s)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! DT - Recommended module time step (s): CALL ReadVar( UnIn, InputFile, p%DT, "DT", "Recommended module time step (s)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + if ( EqualRealNos(p%DT, 0.0_DbKi) ) then ! add a fatal error here because we're going to divide by DT later in this routine: CALL SetErrStat( ErrID_Fatal, 'DT cannot be zero.', ErrStat, ErrMsg, RoutineName) call cleanup() return end if - - + + ! InterpOrder - Interpolation order for inputs and outputs {0=nearest neighbor ,1=linear, 2=quadratic} CALL ReadVar( UnIn, InputFile, p%InterpOrder, "InterpOrder", "Interpolation order "//& "for inputs and outputs {0=nearest neighbor ,1=linear, 2=quadratic} (-)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! NumCrctn - Number of predictor-corrector iterations {1=explicit calculation, i.e., no corrections} @@ -2277,7 +2361,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! DT_UJac - Time between calls to get Jacobians (s) @@ -2285,7 +2369,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! UJacSclFact - Scaling factor used in Jacobians (-) @@ -2293,15 +2377,15 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + !---------------------- FEATURE SWITCHES AND FLAGS -------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: Feature Switches and Flags', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! CompElast - Compute structural dynamics (switch) {1=ElastoDyn; 2=ElastoDyn + BeamDyn for blades}: @@ -2309,28 +2393,28 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompElast == 1 ) THEN + IF ( p%CompElast == 1 ) THEN p%CompElast = Module_ED ELSEIF ( p%CompElast == 2 ) THEN p%CompElast = Module_BD ELSE p%CompElast = Module_Unknown END IF - + ! CompInflow - inflow wind velocities (switch) {0=still air; 1=InflowWind}: CALL ReadVar( UnIn, InputFile, p%CompInflow, "CompInflow", "inflow wind velocities (switch) {0=still air; 1=InflowWind}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompInflow == 0 ) THEN + IF ( p%CompInflow == 0 ) THEN p%CompInflow = Module_NONE ELSEIF ( p%CompInflow == 1 ) THEN p%CompInflow = Module_IfW @@ -2345,11 +2429,11 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompAero == 0 ) THEN + IF ( p%CompAero == 0 ) THEN p%CompAero = Module_NONE ELSEIF ( p%CompAero == 1 ) THEN p%CompAero = Module_AD14 @@ -2364,46 +2448,46 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompServo == 0 ) THEN + IF ( p%CompServo == 0 ) THEN p%CompServo = Module_NONE ELSEIF ( p%CompServo == 1 ) THEN p%CompServo = Module_SrvD ELSE p%CompServo = Module_Unknown END IF - - + + ! CompHydro - Compute hydrodynamic loads (switch) {0=None; 1=HydroDyn}: CALL ReadVar( UnIn, InputFile, p%CompHydro, "CompHydro", "Compute hydrodynamic loads (switch) {0=None; 1=HydroDyn}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompHydro == 0 ) THEN + IF ( p%CompHydro == 0 ) THEN p%CompHydro = Module_NONE ELSEIF ( p%CompHydro == 1 ) THEN p%CompHydro = Module_HD ELSE p%CompHydro = Module_Unknown END IF - + ! CompSub - Compute sub-structural dynamics (switch) {0=None; 1=SubDyn; 2=ExtPtfm_MCKF}: CALL ReadVar( UnIn, InputFile, p%CompSub, "CompSub", "Compute sub-structural dynamics (switch) {0=None; 1=SubDyn}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompSub == 0 ) THEN + IF ( p%CompSub == 0 ) THEN p%CompSub = Module_NONE ELSEIF ( p%CompSub == 1 ) THEN p%CompSub = Module_SD @@ -2412,17 +2496,17 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS ELSE p%CompSub = Module_Unknown END IF - + ! CompMooring - Compute mooring line dynamics (flag): CALL ReadVar( UnIn, InputFile, p%CompMooring, "CompMooring", "Compute mooring system (switch) {0=None; 1=MAP; 2=FEAMooring; 3=MoorDyn; 4=OrcaFlex}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompMooring == 0 ) THEN + IF ( p%CompMooring == 0 ) THEN p%CompMooring = Module_NONE ELSEIF ( p%CompMooring == 1 ) THEN p%CompMooring = Module_MAP @@ -2431,21 +2515,21 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS ELSEIF ( p%CompMooring == 3 ) THEN p%CompMooring = Module_MD ELSEIF ( p%CompMooring == 4 ) THEN - p%CompMooring = Module_Orca + p%CompMooring = Module_Orca ELSE p%CompMooring = Module_Unknown - END IF - + END IF + ! CompIce - Compute ice loads (switch) {0=None; 1=IceFloe}: CALL ReadVar( UnIn, InputFile, p%CompIce, "CompIce", "Compute ice loads (switch) {0=None; 1=IceFloe}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%CompIce == 0 ) THEN + IF ( p%CompIce == 0 ) THEN p%CompIce = Module_NONE ELSEIF ( p%CompIce == 1 ) THEN p%CompIce = Module_IceF @@ -2454,14 +2538,14 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS ELSE p%CompIce = Module_Unknown END IF - + !---------------------- INPUT FILES --------------------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: Input Files', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! EDFile - Name of file containing ElastoDyn input parameters (-): @@ -2469,7 +2553,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%EDFile ) ) p%EDFile = TRIM(PriPath)//TRIM(p%EDFile) @@ -2479,17 +2563,17 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%BDBldFile(i) ) ) p%BDBldFile(i) = TRIM(PriPath)//TRIM(p%BDBldFile(i)) END DO - + ! InflowFile - Name of file containing inflow wind input parameters (-): CALL ReadVar( UnIn, InputFile, p%InflowFile, "InflowFile", "Name of file containing inflow wind input parameters (-)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%InflowFile ) ) p%InflowFile = TRIM(PriPath)//TRIM(p%InflowFile) @@ -2498,7 +2582,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%AeroFile ) ) p%AeroFile = TRIM(PriPath)//TRIM(p%AeroFile) @@ -2507,7 +2591,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%ServoFile ) ) p%ServoFile = TRIM(PriPath)//TRIM(p%ServoFile) @@ -2516,7 +2600,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%HydroFile ) ) p%HydroFile = TRIM(PriPath)//TRIM(p%HydroFile) @@ -2525,7 +2609,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%SubFile ) ) p%SubFile = TRIM(PriPath)//TRIM(p%SubFile) @@ -2534,26 +2618,26 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%MooringFile ) ) p%MooringFile = TRIM(PriPath)//TRIM(p%MooringFile) - + ! IceFile - Name of file containing ice input parameters (-): CALL ReadVar( UnIn, InputFile, p%IceFile, "IceFile", "Name of file containing ice input parameters (-)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( PathIsRelative( p%IceFile ) ) p%IceFile = TRIM(PriPath)//TRIM(p%IceFile) - - + + !---------------------- OUTPUT -------------------------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: Output', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! SumPrint - Print summary data to .sum (flag): @@ -2561,7 +2645,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! SttsTime - Amount of time between screen status messages (s): @@ -2569,12 +2653,12 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + IF (TmpTime > p%TMax) THEN p%n_SttsTime = HUGE(p%n_SttsTime) - ELSE + ELSE p%n_SttsTime = NINT( TmpTime / p%DT ) END IF @@ -2583,26 +2667,26 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + IF (TmpTime > p%TMax) THEN p%n_ChkptTime = HUGE(p%n_ChkptTime) - ELSE + ELSE p%n_ChkptTime = NINT( TmpTime / p%DT ) END IF - + ! DT_Out - Time step for tabular output (s): CALL ReadVar( UnIn, InputFile, Line, "DT_Out", "Time step for tabular output (s)", ErrStat2, ErrMsg2, UnEc) !CALL ReadVar( UnIn, InputFile, p%DT_Out, "DT_Out", "Time step for tabular output (s)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + CALL Conv2UC( Line ) - IF ( INDEX(Line, "DEFAULT" ) == 1 ) THEN + IF ( INDEX(Line, "DEFAULT" ) == 1 ) THEN p%DT_Out = p%DT ELSE ! If it's not "default", read this variable; otherwise use the value in p%DT @@ -2611,18 +2695,18 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if END IF - + p%n_DT_Out = NINT( p%DT_Out / p%DT ) - + ! TStart - Time to begin tabular output (s): CALL ReadVar( UnIn, InputFile, p%TStart, "TStart", "Time to begin tabular output (s)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if @@ -2653,7 +2737,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS ! convert integer to binary representation of which file formats to generate: p%WrTxtOutFile = mod(OutFileFmt,2) == 1 - + OutFileFmt = OutFileFmt / 2 ! integer division p%WrBinOutFile = mod(OutFileFmt,2) == 1 @@ -2678,13 +2762,13 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS call cleanup() return end if - + ! TabDelim - Use tab delimiters in text tabular output file? (flag): CALL ReadVar( UnIn, InputFile, TabDelim, "TabDelim", "Use tab delimiters in text tabular output file? (flag)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if IF ( TabDelim ) THEN @@ -2698,52 +2782,52 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + !---------------------- LINEARIZATION ----------------------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: Linearization', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! Linearize - Linearization analysis (flag) CALL ReadVar( UnIn, InputFile, p%Linearize, "Linearize", "Linearization analysis (flag)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN - end if - - + RETURN + end if + + ! CalcSteady - Calculate a steady-state periodic operating point before linearization? [unused if Linearize=False] (flag) CALL ReadVar( UnIn, InputFile, p%CalcSteady, "CalcSteady", "Calculate a steady-state periodic operating point before linearization? (flag)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! TrimCase - Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True] (-) - CALL ReadVar( UnIn, InputFile, p%TrimCase, "TrimCase", "Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} (-)", ErrStat2, ErrMsg2, UnEc) + CALL ReadVar( UnIn, InputFile, p%TrimCase, "TrimCase", "Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} (-)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! TrimTol - Tolerance for the rotational speed convergence [used only if CalcSteady=True] (-) CALL ReadVar( UnIn, InputFile, p%TrimTol, "TrimTol", "Tolerance for the rotational speed convergence (-)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! TrimGain - Proportional gain for the rotational speed error (>0) [used only if CalcSteady=True] (rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque) CALL ReadVar( UnIn, InputFile, p%TrimGain, "TrimGain", "Proportional gain for the rotational speed error (>0) (rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! Twr_Kdmp - Damping factor for the tower [used only if CalcSteady=True] (N/(m/s)) CALL ReadVar( UnIn, InputFile, p%Twr_Kdmp, "Twr_Kdmp", "Damping factor for the tower (N/(m/s))", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! Bld_Kdmp - Damping factor for the blades [used only if CalcSteady=True] (N/(m/s)) CALL ReadVar( UnIn, InputFile, p%Bld_Kdmp, "Bld_Kdmp", "Damping factor for the blades (N/(m/s))", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + if ( ErrStat >= AbortErrLev ) then call cleanup() RETURN @@ -2761,7 +2845,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS p%CalcSteady = .false. p%NLinTimes = 0 end if - + ! LinTimes - Times to linearize (s) [1 to NLinTimes] if (.not. p%CalcSteady .and. p%NLinTimes >= 1 ) then call AllocAry( m_FAST%Lin%LinTimes, p%NLinTimes, 'LinTimes', ErrStat2, ErrMsg2 ) @@ -2770,7 +2854,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS call cleanup() RETURN end if - + CALL ReadAry( UnIn, InputFile, m_FAST%Lin%LinTimes, p%NLinTimes, "LinTimes", "Times to linearize (s) [1 to NLinTimes]", ErrStat2, ErrMsg2, UnEc) else CALL ReadCom( UnIn, InputFile, 'Times to linearize (s) [1 to NLinTimes] ', ErrStat2, ErrMsg2, UnEc ) @@ -2780,13 +2864,13 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS call cleanup() RETURN end if - + ! LinInputs - Include inputs in linearization (switch) {0=none; 1=standard; 2=all module inputs (debug)} CALL ReadVar( UnIn, InputFile, p%LinInputs, "LinInputs", "Include inputs in linearization (switch) {0=none; 1=standard; 2=all module inputs (debug)}", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! LinOutputs - Include outputs in linearization (switch) (0=none; 1=from OutList(s); 2=all module outputs (debug)) @@ -2794,7 +2878,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! LinOutJac - Include full Jacabians in linearization output (for debug) (flag) @@ -2802,23 +2886,23 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! LinOutMod - Write module-level linearization output files in addition to output for full system? (flag) CALL ReadVar( UnIn, InputFile, p%LinOutMod, "LinOutMod", "Write module-level linearization output files in addition to output for full system? (flag)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + !---------------------- VISUALIZATION ----------------------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: Visualization', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if ! WrVTK - VTK Visualization data output: (switch) {0=none; 1=initialization data only; 2=animation; 3=mode shapes}: @@ -2826,23 +2910,23 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - - IF ( p%WrVTK < 0 .OR. p%WrVTK > 3 ) THEN + + IF ( p%WrVTK < 0 .OR. p%WrVTK > 3 ) THEN p%WrVTK = VTK_Unknown END IF - + ! VTK_Type - Type of VTK visualization data: (switch) {1=surfaces; 2=basic meshes (lines/points); 3=all meshes (debug)}: CALL ReadVar( UnIn, InputFile, p%VTK_Type, "VTK_Type", "Type of VTK visualization data: (1=surfaces; 2=basic meshes (lines/points); 3=all meshes)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - + ! immediately convert to values used inside the code: - IF ( p%VTK_Type == 0 ) THEN + IF ( p%VTK_Type == 0 ) THEN p%VTK_Type = VTK_None ELSEIF ( p%VTK_Type == 1 ) THEN p%VTK_Type = VTK_Surf @@ -2855,44 +2939,44 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS ELSE p%VTK_Type = VTK_Unknown END IF - + !! equivalent: - !IF ( p%VTK_Type < 0 .OR. p%VTK_Type > 4 ) THEN + !IF ( p%VTK_Type < 0 .OR. p%VTK_Type > 4 ) THEN ! p%VTK_Type = VTK_Unknown !END IF - + ! VTK_fields - Write mesh fields to VTK data files? (flag) {true/false}: CALL ReadVar( UnIn, InputFile, p%VTK_fields, "VTK_fields", "Write mesh fields to VTK data files? (flag)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - - ! VTK_fps - Frame rate for VTK output (frames per second) {will use closest integer multiple of DT} + + ! VTK_fps - Frame rate for VTK output (frames per second) {will use closest integer multiple of DT} CALL ReadVar( UnIn, InputFile, p%VTK_fps, "VTK_fps", "Frame rate for VTK output(fps)", ErrStat2, ErrMsg2, UnEc) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if ( ErrStat >= AbortErrLev ) then call cleanup() - RETURN + RETURN end if - - + + ! convert frames-per-second to seconds per sample: if ( EqualRealNos(p%VTK_fps, 0.0_DbKi) ) then TmpTime = p%TMax + p%DT else TmpTime = 1.0_DbKi / p%VTK_fps end if - - ! now save the number of time steps between VTK file output: + + ! now save the number of time steps between VTK file output: IF (p%WrVTK == VTK_ModeShapes) THEN p%n_VTKTime = 1 ELSE IF (TmpTime > p%TMax) THEN p%n_VTKTime = HUGE(p%n_VTKTime) ELSE p%n_VTKTime = NINT( TmpTime / p%DT ) - ! I'll warn if p%n_VTKTime*p%DT is not TmpTime + ! I'll warn if p%n_VTKTime*p%DT is not TmpTime IF (p%WrVTK == VTK_Animate) THEN TmpRate = p%n_VTKTime*p%DT if (.not. EqualRealNos(TmpRate, TmpTime)) then @@ -2900,7 +2984,7 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS trim(num2lstr(1.0_DbKi/TmpRate))//' fps, the closest rate possible.',ErrStat,ErrMsg,RoutineName) end if END IF - + END IF call cleanup() @@ -2910,12 +2994,12 @@ SUBROUTINE FAST_ReadPrimaryFile( InputFile, p, m_FAST, OverrideAbortErrLev, ErrS !............................................................................................................................... subroutine cleanup() CLOSE( UnIn ) - IF ( UnEc > 0 ) CLOSE ( UnEc ) + IF ( UnEc > 0 ) CLOSE ( UnEc ) end subroutine cleanup !............................................................................................................................... END SUBROUTINE FAST_ReadPrimaryFile !---------------------------------------------------------------------------------------------------------------------------------- -!> This subroutine sets up some of the information needed for plotting VTK surfaces. It initializes only the data needed before +!> This subroutine sets up some of the information needed for plotting VTK surfaces. It initializes only the data needed before !! HD initialization. (HD needs some of this data so it can return the wave elevation data we want.) SUBROUTINE SetVTKParameters_B4HD(p_FAST, InitOutData_ED, InitInData_HD, BD, ErrStat, ErrMsg) @@ -2926,38 +3010,38 @@ SUBROUTINE SetVTKParameters_B4HD(p_FAST, InitOutData_ED, InitInData_HD, BD, ErrS INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + REAL(SiKi) :: BladeLength, Width, WidthBy2 - REAL(SiKi) :: dx, dy + REAL(SiKi) :: dx, dy INTEGER(IntKi) :: i, j, n INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SetVTKParameters_B4HD' - - + + ErrStat = ErrID_None ErrMsg = "" - + ! Get radius for ground (blade length + hub radius): - if ( p_FAST%CompElast == Module_BD ) then + if ( p_FAST%CompElast == Module_BD ) then BladeLength = TwoNorm(BD%y(1)%BldMotion%Position(:,1) - BD%y(1)%BldMotion%Position(:,BD%y(1)%BldMotion%Nnodes)) else - BladeLength = InitOutData_ED%BladeLength + BladeLength = InitOutData_ED%BladeLength end if p_FAST%VTK_Surface%HubRad = InitOutData_ED%HubRad p_FAST%VTK_Surface%GroundRad = BladeLength + p_FAST%VTK_Surface%HubRad !........................................................................................................ ! We don't use the rest of this routine for stick-figure output - if (p_FAST%VTK_Type /= VTK_Surf) return + if (p_FAST%VTK_Type /= VTK_Surf) return !........................................................................................................ - + ! initialize wave elevation data: if ( p_FAST%CompHydro == Module_HD ) then - + p_FAST%VTK_surface%NWaveElevPts(1) = 25 p_FAST%VTK_surface%NWaveElevPts(2) = 25 - + call allocAry( InitInData_HD%WaveElevXY, 2, p_FAST%VTK_surface%NWaveElevPts(1)*p_FAST%VTK_surface%NWaveElevPts(2), 'WaveElevXY', ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if (ErrStat >= AbortErrLev) return @@ -2965,7 +3049,7 @@ SUBROUTINE SetVTKParameters_B4HD(p_FAST, InitOutData_ED, InitInData_HD, BD, ErrS Width = p_FAST%VTK_Surface%GroundRad * VTK_GroundFactor dx = Width / (p_FAST%VTK_surface%NWaveElevPts(1) - 1) dy = Width / (p_FAST%VTK_surface%NWaveElevPts(2) - 1) - + WidthBy2 = Width / 2.0_SiKi n = 1 do i=1,p_FAST%VTK_surface%NWaveElevPts(1) @@ -2975,10 +3059,10 @@ SUBROUTINE SetVTKParameters_B4HD(p_FAST, InitOutData_ED, InitInData_HD, BD, ErrS n = n+1 end do end do - + end if - - + + END SUBROUTINE SetVTKParameters_B4HD !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets up the information needed for plotting VTK surfaces. @@ -2996,8 +3080,8 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - REAL(SiKi) :: RefPoint(3), RefLengths(2) - REAL(SiKi) :: x, y + REAL(SiKi) :: RefPoint(3), RefLengths(2) + REAL(SiKi) :: x, y REAL(SiKi) :: TwrDiam_top, TwrDiam_base, TwrRatio, TwrLength INTEGER(IntKi) :: topNode, baseNode INTEGER(IntKi) :: NumBl, k @@ -3005,22 +3089,22 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SetVTKParameters' - - + + ErrStat = ErrID_None ErrMsg = "" - + ! get the name of the output directory for vtk files (in a subdirectory called "vtk" of the output directory), and ! create the VTK directory if it does not exist - + call GetPath ( p_FAST%OutFileRoot, p_FAST%VTK_OutFileRoot, vtkroot ) ! the returned p_FAST%VTK_OutFileRoot includes a file separator character at the end p_FAST%VTK_OutFileRoot = trim(p_FAST%VTK_OutFileRoot) // 'vtk' - + call MKDIR( trim(p_FAST%VTK_OutFileRoot) ) p_FAST%VTK_OutFileRoot = trim( p_FAST%VTK_OutFileRoot ) // PathSep // trim(vtkroot) - - + + ! calculate the number of digits in 'y_FAST%NOutSteps' (Maximum number of output steps to be written) ! this will be used to pad the write-out step in the VTK filename with zeros in calls to MeshWrVTK() if (p_FAST%WrVTK == VTK_ModeShapes .AND. p_FAST%VTK_modes%VTKLinTim==1) then @@ -3029,56 +3113,56 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H else p_FAST%VTK_tWidth = CEILING( log10( real(p_FAST%n_TMax_m1+1, ReKi) / p_FAST%n_VTKTime ) ) + 1 end if - + ! determine number of blades NumBl = InitOutData_ED%NumBl ! initialize the vtk data - p_FAST%VTK_Surface%NumSectors = 25 + p_FAST%VTK_Surface%NumSectors = 25 ! NOTE: we set p_FAST%VTK_Surface%GroundRad and p_FAST%VTK_Surface%HubRad in SetVTKParameters_B4HD - - + + ! write the ground or seabed reference polygon: RefPoint = p_FAST%TurbinePos if (p_FAST%CompHydro == MODULE_HD) then RefLengths = p_FAST%VTK_Surface%GroundRad*VTK_GroundFactor/2.0_SiKi - + ! note that p_FAST%TurbinePos(3) must be 0 for offshore turbines - RefPoint(3) = p_FAST%TurbinePos(3) - InitOutData_HD%WtrDpth - call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.SeabedSurface', ErrStat2, ErrMsg2 ) - - RefPoint(3) = p_FAST%TurbinePos(3) - InitOutData_HD%MSL2SWL - call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.StillWaterSurface', ErrStat2, ErrMsg2 ) + RefPoint(3) = p_FAST%TurbinePos(3) - InitOutData_HD%WtrDpth + call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.SeabedSurface', ErrStat2, ErrMsg2 ) + + RefPoint(3) = p_FAST%TurbinePos(3) - InitOutData_HD%MSL2SWL + call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.StillWaterSurface', ErrStat2, ErrMsg2 ) else RefLengths = p_FAST%VTK_Surface%GroundRad !array = scalar - call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.GroundSurface', ErrStat2, ErrMsg2 ) + call WrVTK_Ground ( RefPoint, RefLengths, trim(p_FAST%VTK_OutFileRoot) // '.GroundSurface', ErrStat2, ErrMsg2 ) end if - - + + !........................................................................................................ ! We don't use the rest of this routine for stick-figure output - if (p_FAST%VTK_Type /= VTK_Surf) return + if (p_FAST%VTK_Type /= VTK_Surf) return !........................................................................................................ - + ! we're going to create a box using these dimensions y = ED%y%HubPtMotion%Position(3, 1) - ED%y%NacelleMotion%Position(3, 1) x = TwoNorm( ED%y%HubPtMotion%Position(1:2,1) - ED%y%NacelleMotion%Position(1:2,1) ) - p_FAST%VTK_Surface%HubRad - + p_FAST%VTK_Surface%NacelleBox(:,1) = (/ -x, y, 0.0_SiKi /) - p_FAST%VTK_Surface%NacelleBox(:,2) = (/ x, y, 0.0_SiKi /) + p_FAST%VTK_Surface%NacelleBox(:,2) = (/ x, y, 0.0_SiKi /) p_FAST%VTK_Surface%NacelleBox(:,3) = (/ x, -y, 0.0_SiKi /) - p_FAST%VTK_Surface%NacelleBox(:,4) = (/ -x, -y, 0.0_SiKi /) + p_FAST%VTK_Surface%NacelleBox(:,4) = (/ -x, -y, 0.0_SiKi /) p_FAST%VTK_Surface%NacelleBox(:,5) = (/ -x, -y, 2*y /) - p_FAST%VTK_Surface%NacelleBox(:,6) = (/ x, -y, 2*y /) + p_FAST%VTK_Surface%NacelleBox(:,6) = (/ x, -y, 2*y /) p_FAST%VTK_Surface%NacelleBox(:,7) = (/ x, y, 2*y /) - p_FAST%VTK_Surface%NacelleBox(:,8) = (/ -x, y, 2*y /) - + p_FAST%VTK_Surface%NacelleBox(:,8) = (/ -x, y, 2*y /) + !....................... ! tapered tower !....................... - + CALL AllocAry(p_FAST%VTK_Surface%TowerRad,ED%y%TowerLn2Mesh%NNodes,'VTK_Surface%TowerRad',ErrStat2,ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3089,15 +3173,15 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H TwrRatio = TwrLength / 87.6_SiKi ! use ratio of the tower length to the length of the 5MW tower TwrDiam_top = 3.87*TwrRatio TwrDiam_base = 6.0*TwrRatio - + TwrRatio = 0.5 * (TwrDiam_top - TwrDiam_base) / TwrLength do k=1,ED%y%TowerLn2Mesh%NNodes - TwrLength = TwoNorm( ED%y%TowerLn2Mesh%position(:,k) - ED%y%TowerLn2Mesh%position(:,baseNode) ) + TwrLength = TwoNorm( ED%y%TowerLn2Mesh%position(:,k) - ED%y%TowerLn2Mesh%position(:,baseNode) ) p_FAST%VTK_Surface%TowerRad(k) = 0.5*TwrDiam_Base + TwrRatio*TwrLength end do - - + + !....................... ! blade surfaces !....................... @@ -3106,12 +3190,12 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H call setErrStat(ErrID_Fatal,'Error allocating VTK_Surface%BladeShape.',ErrStat,ErrMsg,RoutineName) return end if - + IF ( p_FAST%CompAero == Module_AD ) THEN ! These meshes may have airfoil data associated with nodes... - IF (ALLOCATED(InitOutData_AD%BladeShape)) THEN + IF (ALLOCATED(InitOutData_AD%rotors(1)%BladeShape)) THEN do k=1,NumBl - call move_alloc( InitOutData_AD%BladeShape(k)%AirfoilCoords, p_FAST%VTK_Surface%BladeShape(k)%AirfoilCoords ) + call move_alloc( InitOutData_AD%rotors(1)%BladeShape(k)%AirfoilCoords, p_FAST%VTK_Surface%BladeShape(k)%AirfoilCoords ) end do ELSE #ifndef USE_DEFAULT_BLADE_SURFACE @@ -3121,67 +3205,67 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H ELSE call setErrStat(ErrID_Fatal,'Cannot do surface visualization without using AeroDyn.',ErrStat,ErrMsg,RoutineName) return - END IF + END IF #else ! AD used without airfoil coordinates specified rootNode = 1 DO K=1,NumBl - tipNode = AD%Input(1)%BladeMotion(K)%NNodes - cylNode = min(3,AD%Input(1)%BladeMotion(K)%Nnodes) + tipNode = AD%Input(1)%rotors(1)%BladeMotion(K)%NNodes + cylNode = min(3,AD%Input(1)%rotors(1)%BladeMotion(K)%Nnodes) - call SetVTKDefaultBladeParams(AD%Input(1)%BladeMotion(K), p_FAST%VTK_Surface%BladeShape(K), tipNode, rootNode, cylNode, ErrStat2, ErrMsg2) + call SetVTKDefaultBladeParams(AD%Input(1)%rotors(1)%BladeMotion(K), p_FAST%VTK_Surface%BladeShape(K), tipNode, rootNode, cylNode, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) RETURN - END DO + END DO END IF - + ELSE IF ( p_FAST%CompElast == Module_BD ) THEN - rootNode = 1 - DO K=1,NumBl + rootNode = 1 + DO K=1,NumBl tipNode = BD%y(k)%BldMotion%NNodes cylNode = min(3,BD%y(k)%BldMotion%NNodes) - + call SetVTKDefaultBladeParams(BD%y(k)%BldMotion, p_FAST%VTK_Surface%BladeShape(K), tipNode, rootNode, cylNode, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) RETURN - END DO + END DO ELSE - DO K=1,NumBl - rootNode = ED%y%BladeLn2Mesh(K)%NNodes + DO K=1,NumBl + rootNode = ED%y%BladeLn2Mesh(K)%NNodes tipNode = ED%y%BladeLn2Mesh(K)%NNodes-1 cylNode = min(2,ED%y%BladeLn2Mesh(K)%NNodes) - + call SetVTKDefaultBladeParams(ED%y%BladeLn2Mesh(K), p_FAST%VTK_Surface%BladeShape(K), tipNode, rootNode, cylNode, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) RETURN - END DO - END IF -#endif - - + END DO + END IF +#endif + + !....................... - ! wave elevation + ! wave elevation !....................... !bjj: interpolate here instead of each time step? if ( allocated(InitOutData_HD%WaveElevSeries) ) then call move_alloc( InitInData_HD%WaveElevXY, p_FAST%VTK_Surface%WaveElevXY ) call move_alloc( InitOutData_HD%WaveElevSeries, p_FAST%VTK_Surface%WaveElev ) - + ! put the following lines in loops to avoid stack-size issues: do k=1,size(p_FAST%VTK_Surface%WaveElevXY,2) p_FAST%VTK_Surface%WaveElevXY(:,k) = p_FAST%VTK_Surface%WaveElevXY(:,k) + p_FAST%TurbinePos(1:2) end do - + ! note that p_FAST%TurbinePos(3) must be 0 for offshore turbines !do k=1,size(p_FAST%VTK_Surface%WaveElev,2) ! p_FAST%VTK_Surface%WaveElev(:,k) = p_FAST%VTK_Surface%WaveElev(:,k) + p_FAST%TurbinePos(3) ! not sure this is really accurate if p_FAST%TurbinePos(3) is non-zero !end do - + end if - + !....................... ! morison surfaces !....................... @@ -3191,7 +3275,7 @@ SUBROUTINE SetVTKParameters(p_FAST, InitOutData_ED, InitOutData_AD, InitInData_H ! call move_alloc(InitOutData_HD%Morison%Morison_Rad, p_FAST%VTK_Surface%MorisonRad) END IF - + END SUBROUTINE SetVTKParameters !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine comes up with some default airfoils for blade surfaces for a given blade mesh, M. @@ -3205,36 +3289,36 @@ SUBROUTINE SetVTKDefaultBladeParams(M, BladeShape, tipNode, rootNode, cylNode, E INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + REAL(SiKi) :: bladeLength, chord, pitchAxis - REAL(SiKi) :: bladeLengthFract, bladeLengthFract2, ratio, posLength ! temporary quantities - REAL(SiKi) :: cylinderLength, x, y, angle + REAL(SiKi) :: bladeLengthFract, bladeLengthFract2, ratio, posLength ! temporary quantities + REAL(SiKi) :: cylinderLength, x, y, angle INTEGER(IntKi) :: i, j INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SetVTKDefaultBladeParams' - + !Note: jmj does not like this default option integer, parameter :: N = 66 - - ! default airfoil shape coordinates; uses S809 values from http://wind.nrel.gov/airfoils/Shapes/S809_Shape.html: + + ! default airfoil shape coordinates; uses S809 values from http://wind.nrel.gov/airfoils/Shapes/S809_Shape.html: real, parameter, dimension(N) :: xc=(/ 1.0,0.996203,0.98519,0.967844,0.945073,0.917488,0.885293,0.848455,0.80747,0.763042,0.715952,0.667064,0.617331,0.56783,0.519832,0.474243,0.428461,0.382612,0.33726,0.29297,0.250247,0.209576,0.171409,0.136174,0.104263,0.076035,0.051823,0.03191,0.01659,0.006026,0.000658,0.000204,0.0,0.000213,0.001045,0.001208,0.002398,0.009313,0.02323,0.04232,0.065877,0.093426,0.124111,0.157653,0.193738,0.231914,0.271438,0.311968,0.35337,0.395329,0.438273,0.48192,0.527928,0.576211,0.626092,0.676744,0.727211,0.776432,0.823285,0.86663,0.905365,0.938474,0.965086,0.984478,0.996141,1.0 /) real, parameter, dimension(N) :: yc=(/ 0.0,0.000487,0.002373,0.00596,0.011024,0.017033,0.023458,0.03028,0.037766,0.045974,0.054872,0.064353,0.074214,0.084095,0.093268,0.099392,0.10176,0.10184,0.10007,0.096703,0.091908,0.085851,0.078687,0.07058,0.061697,0.052224,0.042352,0.032299,0.02229,0.012615,0.003723,0.001942,-0.00002,-0.001794,-0.003477,-0.003724,-0.005266,-0.011499,-0.020399,-0.030269,-0.040821,-0.051923,-0.063082,-0.07373,-0.083567,-0.092442,-0.099905,-0.105281,-0.108181,-0.108011,-0.104552,-0.097347,-0.086571,-0.073979,-0.060644,-0.047441,-0.0351,-0.024204,-0.015163,-0.008204,-0.003363,-0.000487,0.000743,0.000775,0.00029,0.0 /) call AllocAry(BladeShape%AirfoilCoords, 2, N, M%NNodes, 'BladeShape%AirfoilCoords', ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) IF (ErrStat >= AbortErrLev) RETURN - + ! Chord length and pitch axis location are given by scaling law bladeLength = TwoNorm( M%position(:,tipNode) - M%Position(:,rootNode) ) cylinderLength = TwoNorm( M%Position(:,cylNode) - M%Position(:,rootNode) ) bladeLengthFract = 0.22*bladeLength bladeLengthFract2 = bladeLength-bladeLengthFract != 0.78*bladeLength - + DO i=1,M%Nnodes posLength = TwoNorm( M%Position(:,i) - M%Position(:,rootNode) ) - + IF (posLength .LE. bladeLengthFract) THEN ratio = posLength/bladeLengthFract chord = (0.06 + 0.02*ratio)*bladeLength @@ -3243,51 +3327,51 @@ SUBROUTINE SetVTKDefaultBladeParams(M, BladeShape, tipNode, rootNode, cylNode, E chord = (0.08 - 0.06*(posLength-bladeLengthFract)/bladeLengthFract2)*bladeLength pitchAxis = 0.375 END IF - - IF (posLength .LE. cylinderLength) THEN + + IF (posLength .LE. cylinderLength) THEN ! create a cylinder for this node - + chord = chord/2.0_SiKi - + DO j=1,N ! normalized x,y coordinates for airfoil x = yc(j) y = xc(j) - 0.5 - + angle = ATAN2( y, x) - + ! x,y coordinates for cylinder BladeShape%AirfoilCoords(1,j,i) = chord*COS(angle) ! x (note that "chord" is really representing chord/2 here) BladeShape%AirfoilCoords(2,j,i) = chord*SIN(angle) ! y (note that "chord" is really representing chord/2 here) - END DO - + END DO + ELSE ! create an airfoil for this node - - DO j=1,N + + DO j=1,N ! normalized x,y coordinates for airfoil, assuming an upwind turbine x = yc(j) y = xc(j) - pitchAxis - + ! x,y coordinates for airfoil BladeShape%AirfoilCoords(1,j,i) = chord*x - BladeShape%AirfoilCoords(2,j,i) = chord*y + BladeShape%AirfoilCoords(2,j,i) = chord*y END DO - + END IF - + END DO ! nodes on mesh - + END SUBROUTINE SetVTKDefaultBladeParams !---------------------------------------------------------------------------------------------------------------------------------- !> This routine writes the ground or seabed reference surface information in VTK format. !! see VTK file information format for XML, here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf SUBROUTINE WrVTK_Ground ( RefPoint, HalfLengths, FileRootName, ErrStat, ErrMsg ) - + REAL(SiKi), INTENT(IN) :: RefPoint(3) !< reference point (plane will be created around it) REAL(SiKi), INTENT(IN) :: HalfLengths(2) !< half of the X-Y lengths of plane surrounding RefPoint CHARACTER(*), INTENT(IN) :: FileRootName !< Name of the file to write the output in (excluding extension) - + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Indicates whether an error occurred (see NWTC_Library) CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message associated with the ErrStat @@ -3299,50 +3383,50 @@ SUBROUTINE WrVTK_Ground ( RefPoint, HalfLengths, FileRootName, ErrStat, ErrMsg ) INTEGER(IntKi), parameter :: NumberOfPoints = 4 INTEGER(IntKi), parameter :: NumberOfLines = 0 INTEGER(IntKi), parameter :: NumberOfPolys = 1 - - INTEGER(IntKi) :: ErrStat2 + + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*),PARAMETER :: RoutineName = 'WrVTK_Ground' - + ErrStat = ErrID_None ErrMsg = "" - + !................................................................. ! write the data that potentially changes each time step: !................................................................. - + ! PolyData (.vtp) - Serial vtkPolyData (unstructured) file FileName = TRIM(FileRootName)//'.vtp' - - call WrVTK_header( FileName, NumberOfPoints, NumberOfLines, NumberOfPolys, Un, ErrStat2, ErrMsg2 ) + + call WrVTK_header( FileName, NumberOfPoints, NumberOfLines, NumberOfPolys, Un, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) if (ErrStat >= AbortErrLev) return - -! points (nodes, augmented with NumSegments): + +! points (nodes, augmented with NumSegments): WRITE(Un,'(A)') ' ' WRITE(Un,'(A)') ' ' - + WRITE(Un,VTK_AryFmt) RefPoint(1) + HalfLengths(1) , RefPoint(2) + HalfLengths(2), RefPoint(3) WRITE(Un,VTK_AryFmt) RefPoint(1) + HalfLengths(1) , RefPoint(2) - HalfLengths(2), RefPoint(3) WRITE(Un,VTK_AryFmt) RefPoint(1) - HalfLengths(1) , RefPoint(2) - HalfLengths(2), RefPoint(3) WRITE(Un,VTK_AryFmt) RefPoint(1) - HalfLengths(1) , RefPoint(2) + HalfLengths(2), RefPoint(3) - + WRITE(Un,'(A)') ' ' WRITE(Un,'(A)') ' ' - - - WRITE(Un,'(A)') ' ' - WRITE(Un,'(A)') ' ' - WRITE(Un,'('//trim(num2lstr(NumberOfPoints))//'(i7))') (ix, ix=0,NumberOfPoints-1) - WRITE(Un,'(A)') ' ' - - WRITE(Un,'(A)') ' ' + + + WRITE(Un,'(A)') ' ' + WRITE(Un,'(A)') ' ' + WRITE(Un,'('//trim(num2lstr(NumberOfPoints))//'(i7))') (ix, ix=0,NumberOfPoints-1) + WRITE(Un,'(A)') ' ' + + WRITE(Un,'(A)') ' ' WRITE(Un,'(i7)') NumberOfPoints WRITE(Un,'(A)') ' ' - WRITE(Un,'(A)') ' ' - - call WrVTK_footer( Un ) - + WRITE(Un,'(A)') ' ' + + call WrVTK_footer( Un ) + END SUBROUTINE WrVTK_Ground !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets up the information needed to initialize AeroDyn, then initializes AeroDyn @@ -3365,17 +3449,17 @@ SUBROUTINE AD_SetInitInput(InitInData_AD14, InitOutData_ED, y_ED, p_FAST, ErrSta ErrStat = ErrID_None ErrMsg = "" - - + + ! Set up the AeroDyn parameters InitInData_AD14%ADFileName = p_FAST%AeroFile InitInData_AD14%OutRootName = p_FAST%OutFileRoot - InitInData_AD14%WrSumFile = p_FAST%SumPrint + InitInData_AD14%WrSumFile = p_FAST%SumPrint InitInData_AD14%NumBl = InitOutData_ED%NumBl InitInData_AD14%UseDWM = p_FAST%UseDWM - + InitInData_AD14%DWM%IfW%InputFileName = p_FAST%InflowFile - + ! Hub position and orientation (relative here, but does not need to be) InitInData_AD14%TurbineComponents%Hub%Position(:) = y_ED%HubPtMotion14%Position(:,1) - y_ED%HubPtMotion14%Position(:,1) ! bjj: was 0; mesh was changed by adding p_ED%HubHt to 3rd component @@ -3400,18 +3484,18 @@ SUBROUTINE AD_SetInitInput(InitInData_AD14, InitOutData_ED, y_ED, p_FAST, ErrSta InitInData_AD14%TurbineComponents%Blade(K)%Position = y_ED%BladeRootMotion14%Position(:,K) InitInData_AD14%TurbineComponents%Blade(K)%Orientation = y_ED%BladeRootMotion14%RefOrientation(:,:,K) InitInData_AD14%TurbineComponents%Blade(K)%TranslationVel = 0.0_ReKi ! bjj: we don't need this field - InitInData_AD14%TurbineComponents%Blade(K)%RotationVel = 0.0_ReKi ! bjj: we don't need this field + InitInData_AD14%TurbineComponents%Blade(K)%RotationVel = 0.0_ReKi ! bjj: we don't need this field END DO - + ! Blade length IF (p_FAST%CompElast == Module_ED) THEN ! note, we can't get here if we're using BeamDyn.... InitInData_AD14%TurbineComponents%BladeLength = InitOutData_ED%BladeLength END IF - - + + ! Tower mesh ( here only because we currently need line2 meshes to contain the same nodes/elements ) - + InitInData_AD14%NumTwrNodes = y_ED%TowerLn2Mesh%NNodes - 2 IF (.NOT. ALLOCATED( InitInData_AD14%TwrNodeLocs ) ) THEN ALLOCATE( InitInData_AD14%TwrNodeLocs( 3, InitInData_AD14%NumTwrNodes ), STAT = ErrStat ) @@ -3422,20 +3506,20 @@ SUBROUTINE AD_SetInitInput(InitInData_AD14, InitOutData_ED, y_ED, p_FAST, ErrSta ELSE ErrStat = ErrID_None END IF - END IF - + END IF + IF ( InitInData_AD14%NumTwrNodes > 0 ) THEN InitInData_AD14%TwrNodeLocs = y_ED%TowerLn2Mesh%Position(:,1:InitInData_AD14%NumTwrNodes) ! ED has extra nodes at beginning and top and bottom of tower END IF - - ! hub height + + ! hub height InitInData_AD14%HubHt = InitOutData_ED%HubHt - + RETURN END SUBROUTINE AD_SetInitInput !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine sets the number of subcycles (substeps) for modules at initialization, checking to make sure that their requested +!> This routine sets the number of subcycles (substeps) for modules at initialization, checking to make sure that their requested !! time step is valid. SUBROUTINE SetModuleSubstepTime(ModuleID, p_FAST, y_FAST, ErrStat, ErrMsg) INTEGER(IntKi), INTENT(IN ) :: ModuleID !< ID of the module to check time step and set @@ -3444,10 +3528,10 @@ SUBROUTINE SetModuleSubstepTime(ModuleID, p_FAST, y_FAST, ErrStat, ErrMsg) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ErrStat = ErrID_None - ErrMsg = "" - + ErrMsg = "" + IF ( EqualRealNos( p_FAST%dt_module( ModuleID ), p_FAST%dt ) ) THEN p_FAST%n_substeps(ModuleID) = 1 ELSE @@ -3459,7 +3543,7 @@ SUBROUTINE SetModuleSubstepTime(ModuleID, p_FAST, y_FAST, ErrStat, ErrMsg) ELSE ! calculate the number of subcycles: p_FAST%n_substeps(ModuleID) = NINT( p_FAST%dt / p_FAST%dt_module( ModuleID ) ) - + ! let's make sure THE module DT is an exact integer divisor of the global (FAST) time step: IF ( .NOT. EqualRealNos( p_FAST%dt, p_FAST%dt_module( ModuleID ) * p_FAST%n_substeps(ModuleID) ) ) THEN ErrStat = ErrID_Fatal @@ -3467,13 +3551,13 @@ SUBROUTINE SetModuleSubstepTime(ModuleID, p_FAST, y_FAST, ErrStat, ErrMsg) TRIM(Num2LStr(p_FAST%dt_module( ModuleID )))// & " s) must be an integer divisor of the FAST time step ("//TRIM(Num2LStr(p_FAST%dt))//" s)." END IF - + END IF - END IF - + END IF + RETURN - -END SUBROUTINE SetModuleSubstepTime + +END SUBROUTINE SetModuleSubstepTime !---------------------------------------------------------------------------------------------------------------------------------- !> This writes data to the FAST summary file. SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) @@ -3493,7 +3577,7 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) CHARACTER(200) :: DescStr ! temporary string to write text CHARACTER(*), PARAMETER :: NotUsedTxt = " [not called]" ! text written if a module is not called CHARACTER(ChanLen) :: ChanTxt(2) ! temp strings to help with formatting with unknown ChanLen size - + ! Get a unit number and open the file: CALL GetNewUnit( y_FAST%UnSum, ErrStat, ErrMsg ) @@ -3518,40 +3602,40 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) DescStr = GetNVD( y_FAST%Module_Ver( Module_BD ) ) IF ( p_FAST%CompElast /= Module_BD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_IfW ) ) IF ( p_FAST%CompInflow /= Module_IfW ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + ! I'm not going to write the openfoam module info to the summary file !DescStr = GetNVD( y_FAST%Module_Ver( Module_OpFM ) ) !IF ( p_FAST%CompInflow /= Module_OpFM ) DescStr = TRIM(DescStr)//NotUsedTxt !WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_AD14 ) ) IF ( p_FAST%CompAero /= Module_AD14 ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_AD ) ) IF ( p_FAST%CompAero /= Module_AD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_SrvD ) ) IF ( p_FAST%CompServo /= Module_SrvD ) DescStr = TRIM(DescStr)//NotUsedTxt - WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) + DescStr = GetNVD( y_FAST%Module_Ver( Module_HD ) ) IF ( p_FAST%CompHydro /= Module_HD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_SD ) ) IF ( p_FAST%CompSub /= Module_SD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_ExtPtfm ) ) IF ( p_FAST%CompSub /= Module_ExtPtfm ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_MAP ) ) IF ( p_FAST%CompMooring /= Module_MAP ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) @@ -3559,26 +3643,26 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) DescStr = GetNVD( y_FAST%Module_Ver( Module_FEAM ) ) IF ( p_FAST%CompMooring /= Module_FEAM ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_MD ) ) IF ( p_FAST%CompMooring /= Module_MD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_Orca ) ) IF ( p_FAST%CompMooring /= Module_Orca ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_IceF ) ) IF ( p_FAST%CompIce /= Module_IceF ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - + DescStr = GetNVD( y_FAST%Module_Ver( Module_IceD ) ) IF ( p_FAST%CompIce /= Module_IceD ) DescStr = TRIM(DescStr)//NotUsedTxt WRITE (y_FAST%UnSum,Fmt) TRIM( DescStr ) - - + + !.......................... Information from FAST input File ...................................... -! OTHER information we could print here: +! OTHER information we could print here: ! current working directory ! output file root name ! output file time step @@ -3594,14 +3678,14 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) DescStr = 'Modeling a floating offshore turbine' CASE DEFAULT ! This should never happen DescStr="" - END SELECT + END SELECT WRITE(y_FAST%UnSum,'(//A)') TRIM(DescStr) WRITE (y_FAST%UnSum,'(A)' ) 'Description from the FAST input file: ' WRITE (y_FAST%UnSum,'(2X,A)') TRIM(p_FAST%FTitle) !.......................... Requested Features ................................................... - + SELECT CASE ( p_FAST%InterpOrder ) CASE (0) DescStr = ' (nearest neighbor)' @@ -3609,30 +3693,30 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) DescStr = ' (linear)' CASE (2) DescStr = ' (quadratic)' - CASE DEFAULT + CASE DEFAULT DescStr = ' ( )' - END SELECT - + END SELECT + WRITE(y_FAST%UnSum,'(/A,I1,A)' ) 'Interpolation order for input/output time histories: ', p_FAST%InterpOrder, TRIM(DescStr) WRITE(y_FAST%UnSum,'( A,I2)' ) 'Number of correction iterations: ', p_FAST%NumCrctn - - + + !.......................... Information About Coupling ................................................... - + IF ( ALLOCATED( MeshMapData%Jacobian_Opt1 ) ) then ! we're using option 1 - + IF ( p_FAST%CompSub /= Module_None .OR. p_FAST%CompElast == Module_BD .OR. p_FAST%CompMooring == Module_Orca ) THEN ! SubDyn-BeamDyn-HydroDyn-ElastoDyn-ExtPtfm - DescStr = 'ElastoDyn, SubDyn, HydroDyn, OrcaFlex, ExtPtfm_MCKF, and/or BeamDyn' + DescStr = 'ElastoDyn, SubDyn, HydroDyn, OrcaFlex, ExtPtfm_MCKF, and/or BeamDyn' ELSE ! IF ( p_FAST%CompHydro == Module_HD ) THEN DescStr = "ElastoDyn to HydroDyn" END IF - + WRITE(y_FAST%UnSum,'( A,I6)' ) 'Number of rows in Jacobian matrix used for coupling '//TRIM(DescStr)//': ', & SIZE(MeshMapData%Jacobian_Opt1, 1) END IF !.......................... Time step information: ................................................... - + WRITE (y_FAST%UnSum,'(//,2X,A)') " Requested Time Steps " WRITE (y_FAST%UnSum, '(2X,A)') "-------------------------------------------------" Fmt = '(2X,A17,2X,A15,2X,A13)' @@ -3640,7 +3724,7 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) WRITE (y_FAST%UnSum, Fmt ) "-----------------", "---------------", "-------------" Fmt = '(2X,A17,2X,'//TRIM(p_FAST%OutFmt)//',:,T37,2X,I8,:,A)' WRITE (y_FAST%UnSum, Fmt ) "FAST (glue code) ", p_FAST%DT - DO Module_Number=1,NumModules + DO Module_Number=2,NumModules ! assumes glue-code is module number 1 (i.e., MODULE_Glue == 1) IF (p_FAST%ModuleInitialized(Module_Number)) THEN WRITE (y_FAST%UnSum, Fmt ) y_FAST%Module_Ver(Module_Number)%Name, p_FAST%DT_module(Module_Number), p_FAST%n_substeps(Module_Number) END IF @@ -3652,9 +3736,9 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) END IF IF (p_FAST%WrVTK == VTK_Animate) THEN - + TmpRate = p_FAST%DT*p_FAST%n_VTKTime - + IF ( p_FAST%n_VTKTime == 1_IntKi ) THEN WRITE (y_FAST%UnSum, Fmt ) "VTK output files ", p_FAST%DT, 1_IntKi ! we'll write "1" instead of "1^-1" ELSE @@ -3673,7 +3757,7 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) WRITE (y_FAST%UnSum, Fmt ) "Frame rate", 1.0_DbKi/TmpRate, " fps" END IF - + !.......................... Requested Output Channels ............................................ WRITE (y_FAST%UnSum,'(//,2X,A)') " Requested Channels in FAST Output File(s) " @@ -3686,25 +3770,22 @@ SUBROUTINE FAST_WrSum( p_FAST, y_FAST, MeshMapData, ErrStat, ErrMsg ) WRITE (y_FAST%UnSum, Fmt ) "------", ChanTxt, "------------" Fmt = '(4X,I4,2(2X,A'//TRIM(num2lstr(ChanLen))//'),2X,A)' - I = 1 - WRITE (y_FAST%UnSum, Fmt ) I, y_FAST%ChannelNames(I), y_FAST%ChannelUnits(I), TRIM(FAST_Ver%Name) - - + I = 0 DO Module_Number = 1,NumModules DO J = 1,y_FAST%numOuts( Module_Number ) I = I + 1 WRITE (y_FAST%UnSum, Fmt ) I, y_FAST%ChannelNames(I), y_FAST%ChannelUnits(I), TRIM(y_FAST%Module_Ver( Module_Number )%Name) END DO END DO - - + + !.......................... End of Summary File ............................................ - + ! bjj: note that I'm not closing the summary file here, though at the present time we don't write to this file again. ! In the future, we may want to write additional information to this file during the simulation. ! bjj 4/21/2015: closing the file now because of restart. If it needs to be open later, we can change it again. - - CLOSE( y_FAST%UnSum ) + + CLOSE( y_FAST%UnSum ) y_FAST%UnSum = -1 END SUBROUTINE FAST_WrSum @@ -3713,8 +3794,8 @@ END SUBROUTINE FAST_WrSum !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! TIME-STEP SOLVER ROUTINES (includes initialization after first call to calcOutput at t=0) !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -!> Routine that calls FAST_Solution0 for one instance of a Turbine data structure. This is a separate subroutine so that the FAST -!! driver programs do not need to change or operate on the individual module level. +!> Routine that calls FAST_Solution0 for one instance of a Turbine data structure. This is a separate subroutine so that the FAST +!! driver programs do not need to change or operate on the individual module level. SUBROUTINE FAST_Solution0_T(Turbine, ErrStat, ErrMsg) TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine !< all data for one instance of a turbine @@ -3722,21 +3803,21 @@ SUBROUTINE FAST_Solution0_T(Turbine, ErrStat, ErrMsg) CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - CALL FAST_Solution0(Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & - Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, & + CALL FAST_Solution0(Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & + Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC_DX,& Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) - + END SUBROUTINE FAST_Solution0_T !---------------------------------------------------------------------------------------------------------------------------------- !> Routine that calls CalcOutput for the first time of the simulation (at t=0). After the initial solve, data arrays are initialized. -SUBROUTINE FAST_Solution0(p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & +SUBROUTINE FAST_Solution0(p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, SC_DX, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg ) TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -3744,6 +3825,7 @@ SUBROUTINE FAST_Solution0(p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, O TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data TYPE(InflowWind_Data), INTENT(INOUT) :: IfW !< InflowWind data TYPE(OpenFOAM_Data), INTENT(INOUT) :: OpFM !< OpenFOAM data + TYPE(SCDataEx_Data), INTENT(INOUT) :: SC_DX !< Supercontroller exchange data TYPE(HydroDyn_Data), INTENT(INOUT) :: HD !< HydroDyn data TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data TYPE(ExtPtfm_Data), INTENT(INOUT) :: ExtPtfm !< ExtPtfm_MCKF data @@ -3755,87 +3837,91 @@ SUBROUTINE FAST_Solution0(p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, O TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables INTEGER(IntKi), PARAMETER :: n_t_global = -1 ! loop counter INTEGER(IntKi), PARAMETER :: n_t_global_next = 0 ! loop counter REAL(DbKi) :: t_initial ! next simulation time (t_global_next) - + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Solution0' - + !NOTE: m_FAST%t_global is t_initial in this routine - + ErrStat = ErrID_None ErrMsg = "" - + t_initial = m_FAST%t_global ! which is used in place of t_global_next y_FAST%WriteThisStep = NeedWriteOutput(n_t_global_next, t_initial, p_FAST) IF (p_FAST%WrSttsTime) then CALL SimStatus_FirstTime( m_FAST%TiLstPrn, m_FAST%PrevClockTime, m_FAST%SimStrtTime, m_FAST%UsrTime2, t_initial, p_FAST%TMax, p_FAST%TDesc ) END IF - + ! Solve input-output relations; this section of code corresponds to Eq. (35) in Gasmi et al. (2013) ! This code will be specific to the underlying modules - + ! the initial ServoDyn and IfW/Lidar inputs from Simulink: - IF ( p_FAST%CompServo == Module_SrvD ) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, SrvD%Input(1) ) - IF ( p_FAST%CompInflow == Module_IfW ) CALL IfW_SetExternalInputs( IfW%p, m_FAST, ED%y, IfW%Input(1) ) + IF ( p_FAST%CompServo == Module_SrvD ) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, SrvD%Input(1) ) + IF ( p_FAST%CompInflow == Module_IfW ) CALL IfW_SetExternalInputs( IfW%p, m_FAST, ED%y, IfW%Input(1) ) CALL CalcOutputs_And_SolveForInputs( n_t_global, t_initial, STATE_CURR, m_FAST%calcJacobian, m_FAST%NextJacCalcTime, & p_FAST, m_FAST, y_FAST%WriteThisStep, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + + if (p_FAST%UseSC ) then + call SC_DX_SetInputs(p_FAST, SrvD%y, SC_DX, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + end if + !---------------------------------------------------------------------------------------- ! Check to see if we should output data this time step: !---------------------------------------------------------------------------------------- - CALL WriteOutputToFile(n_t_global_next, t_initial, p_FAST, y_FAST, ED, BD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2) + CALL WriteOutputToFile(n_t_global_next, t_initial, p_FAST, y_FAST, ED, BD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! turn off VTK output when if (p_FAST%WrVTK == VTK_InitOnly) then ! Write visualization data for initialization (and also note that we're ignoring any errors that occur doing so) - call WriteVTK(t_initial, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) - - end if + call WriteVTK(t_initial, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) + + end if + - !............... - ! Copy values of these initial guesses for interpolation/extrapolation and + ! Copy values of these initial guesses for interpolation/extrapolation and ! initialize predicted states for j_pc loop (use MESH_NEWCOPY here so we can use MESH_UPDATE copy later) !............... - + ! Initialize Input-Output arrays for interpolation/extrapolation: CALL FAST_InitIOarrays( m_FAST%t_global, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + END SUBROUTINE FAST_Solution0 !---------------------------------------------------------------------------------------------------------------------------------- !> This routine initializes the input and output arrays stored for extrapolation. They are initialized after the first input-output solve so that the first -!! extrapolations are used with values from the solution, not just initial guesses. It also creates new copies of the state variables, which need to +!! extrapolations are used with values from the solution, not just initial guesses. It also creates new copies of the state variables, which need to !! be stored for the predictor-corrector loop. SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, ErrStat, ErrMsg ) - REAL(DbKi), INTENT(IN ) :: t_initial !< start time of the simulation + REAL(DbKi), INTENT(IN ) :: t_initial !< start time of the simulation TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(IN ) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(IN ) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -3851,7 +3937,7 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A TYPE(OrcaFlex_Data), INTENT(INOUT) :: Orca !< OrcaFlex interface data TYPE(IceFloe_Data), INTENT(INOUT) :: IceF !< IceFloe data TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -3859,21 +3945,20 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A INTEGER(IntKi) :: i, j, k ! loop counters INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_InitIOarrays' - - + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_InitIOarrays' + + ErrStat = ErrID_None ErrMsg = "" - + ! We fill ED%InputTimes with negative times, but the ED%Input values are identical for each of those times; this allows ! us to use, e.g., quadratic interpolation that effectively acts as a zeroth-order extrapolation and first-order extrapolation ! for the first and second time steps. (The interpolation order in the ExtrapInput routines are determined as ! order = SIZE(ED%Input) - + DO j = 1, p_FAST%InterpOrder + 1 ED%InputTimes(j) = t_initial - (j - 1) * p_FAST%dt - !ED_OutputTimes(j) = t_initial - (j - 1) * dt END DO DO j = 2, p_FAST%InterpOrder + 1 @@ -3882,22 +3967,22 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL ED_CopyInput (ED%Input(1), ED%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL ED_CopyContState (ED%x( STATE_CURR), ED%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ED_CopyDiscState (ED%xd(STATE_CURR), ED%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL ED_CopyDiscState (ED%xd(STATE_CURR), ED%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ED_CopyConstrState (ED%z( STATE_CURR), ED%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ED_CopyOtherState (ED%OtherSt( STATE_CURR), ED%OtherSt( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - - IF (p_FAST%CompElast == Module_BD ) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + + IF (p_FAST%CompElast == Module_BD ) THEN DO k = 1,p_FAST%nBeams - + ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 BD%InputTimes(j,k) = t_initial - (j - 1) * p_FAST%dt @@ -3908,27 +3993,27 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL BD_CopyInput (BD%Input(1,k), BD%u(k), MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ! Initialize predicted states for j_pc loop: CALL BD_CopyContState (BD%x( k,STATE_CURR), BD%x( k,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL BD_CopyDiscState (BD%xd(k,STATE_CURR), BD%xd(k,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL BD_CopyDiscState (BD%xd(k,STATE_CURR), BD%xd(k,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL BD_CopyConstrState (BD%z( k,STATE_CURR), BD%z( k,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL BD_CopyOtherState (BD%OtherSt( k,STATE_CURR), BD%OtherSt( k,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + END DO ! nBeams - - END IF ! CompElast - - - IF ( p_FAST%CompServo == Module_SrvD ) THEN + + END IF ! CompElast + + + IF ( p_FAST%CompServo == Module_SrvD ) THEN ! Initialize Input-Output arrays for interpolation/extrapolation: - + DO j = 1, p_FAST%InterpOrder + 1 SrvD%InputTimes(j) = t_initial - (j - 1) * p_FAST%dt !SrvD_OutputTimes(j) = t_initial - (j - 1) * dt @@ -3940,21 +4025,21 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL SrvD_CopyInput (SrvD%Input(1), SrvD%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL SrvD_CopyContState (SrvD%x( STATE_CURR), SrvD%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SrvD_CopyDiscState (SrvD%xd(STATE_CURR), SrvD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL SrvD_CopyDiscState (SrvD%xd(STATE_CURR), SrvD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL SrvD_CopyConstrState (SrvD%z( STATE_CURR), SrvD%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL SrvD_CopyOtherState( SrvD%OtherSt(STATE_CURR), SrvD%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF ! CompServo - - - IF ( p_FAST%CompAero == Module_AD14 ) THEN + + + IF ( p_FAST%CompAero == Module_AD14 ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -3972,43 +4057,43 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A ! Initialize predicted states for j_pc loop: CALL AD14_CopyContState (AD14%x( STATE_CURR), AD14%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD14_CopyDiscState (AD14%xd(STATE_CURR), AD14%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL AD14_CopyDiscState (AD14%xd(STATE_CURR), AD14%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AD14_CopyConstrState (AD14%z( STATE_CURR), AD14%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AD14_CopyOtherState( AD14%OtherSt(STATE_CURR), AD14%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - ELSEIF ( p_FAST%CompAero == Module_AD ) THEN + ELSEIF ( p_FAST%CompAero == Module_AD ) THEN ! Copy values for interpolation/extrapolation: - + DO j = 1, p_FAST%InterpOrder + 1 AD%InputTimes(j) = t_initial - (j - 1) * p_FAST%dt END DO - + DO j = 2, p_FAST%InterpOrder + 1 CALL AD_CopyInput (AD%Input(1), AD%Input(j), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL AD_CopyInput (AD%Input(1), AD%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + + ! Initialize predicted states for j_pc loop: CALL AD_CopyContState(AD%x(STATE_CURR), AD%x(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD_CopyDiscState(AD%xd(STATE_CURR), AD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL AD_CopyDiscState(AD%xd(STATE_CURR), AD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AD_CopyConstrState(AD%z(STATE_CURR), AD%z(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AD_CopyOtherState(AD%OtherSt(STATE_CURR), AD%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - END IF ! CompAero == Module_AD - - - - IF ( p_FAST%CompInflow == Module_IfW ) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + END IF ! CompAero == Module_AD + + + + IF ( p_FAST%CompInflow == Module_IfW ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4027,17 +4112,17 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A ! Initialize predicted states for j_pc loop: CALL InflowWind_CopyContState (IfW%x( STATE_CURR), IfW%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL InflowWind_CopyDiscState (IfW%xd(STATE_CURR), IfW%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL InflowWind_CopyDiscState (IfW%xd(STATE_CURR), IfW%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL InflowWind_CopyConstrState (IfW%z( STATE_CURR), IfW%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL InflowWind_CopyOtherState( IfW%OtherSt(STATE_CURR), IfW%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF ! CompInflow == Module_IfW - - - IF ( p_FAST%CompHydro == Module_HD ) THEN + END IF ! CompInflow == Module_IfW + + + IF ( p_FAST%CompHydro == Module_HD ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 HD%InputTimes(j) = t_initial - (j - 1) * p_FAST%dt @@ -4055,17 +4140,17 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A ! Initialize predicted states for j_pc loop: CALL HydroDyn_CopyContState (HD%x( STATE_CURR), HD%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL HydroDyn_CopyDiscState (HD%xd(STATE_CURR), HD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL HydroDyn_CopyDiscState (HD%xd(STATE_CURR), HD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL HydroDyn_CopyConstrState (HD%z( STATE_CURR), HD%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL HydroDyn_CopyOtherState( HD%OtherSt(STATE_CURR), HD%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF !CompHydro - - - IF (p_FAST%CompSub == Module_SD ) THEN + + + IF (p_FAST%CompSub == Module_SD ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4078,20 +4163,20 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL SD_CopyInput (SD%Input(1), SD%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ! Initialize predicted states for j_pc loop: CALL SD_CopyContState (SD%x( STATE_CURR), SD%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SD_CopyDiscState (SD%xd(STATE_CURR), SD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL SD_CopyDiscState (SD%xd(STATE_CURR), SD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL SD_CopyConstrState (SD%z( STATE_CURR), SD%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL SD_CopyOtherState( SD%OtherSt(STATE_CURR), SD%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - ELSE IF (p_FAST%CompSub == Module_ExtPtfm ) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ELSE IF (p_FAST%CompSub == Module_ExtPtfm ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4103,22 +4188,22 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL ExtPtfm_CopyInput (ExtPtfm%Input(1), ExtPtfm%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ! Initialize predicted states for j_pc loop: CALL ExtPtfm_CopyContState (ExtPtfm%x( STATE_CURR), ExtPtfm%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ExtPtfm_CopyDiscState (ExtPtfm%xd(STATE_CURR), ExtPtfm%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL ExtPtfm_CopyDiscState (ExtPtfm%xd(STATE_CURR), ExtPtfm%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ExtPtfm_CopyConstrState (ExtPtfm%z( STATE_CURR), ExtPtfm%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ExtPtfm_CopyOtherState( ExtPtfm%OtherSt(STATE_CURR), ExtPtfm%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF ! CompSub - - - IF (p_FAST%CompMooring == Module_MAP) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF ! CompSub + + + IF (p_FAST%CompMooring == Module_MAP) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4132,20 +4217,20 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL MAP_CopyInput (MAPp%Input(1), MAPp%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL MAP_CopyContState (MAPp%x( STATE_CURR), MAPp%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL MAP_CopyDiscState (MAPp%xd(STATE_CURR), MAPp%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL MAP_CopyDiscState (MAPp%xd(STATE_CURR), MAPp%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL MAP_CopyConstrState (MAPp%z( STATE_CURR), MAPp%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF ( p_FAST%n_substeps( MODULE_MAP ) > 1 ) THEN CALL MAP_CopyOtherState( MAPp%OtherSt, MAPp%OtherSt_old, MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF - - ELSEIF (p_FAST%CompMooring == Module_MD) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF + + ELSEIF (p_FAST%CompMooring == Module_MD) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4159,18 +4244,18 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL MD_CopyInput (MD%Input(1), MD%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL MD_CopyContState (MD%x( STATE_CURR), MD%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL MD_CopyDiscState (MD%xd(STATE_CURR), MD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL MD_CopyDiscState (MD%xd(STATE_CURR), MD%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL MD_CopyConstrState (MD%z( STATE_CURR), MD%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL MD_CopyOtherState( MD%OtherSt(STATE_CURR), MD%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - ELSEIF (p_FAST%CompMooring == Module_FEAM) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ELSEIF (p_FAST%CompMooring == Module_FEAM) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4184,18 +4269,18 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL FEAM_CopyInput (FEAM%Input(1), FEAM%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL FEAM_CopyContState (FEAM%x( STATE_CURR), FEAM%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL FEAM_CopyDiscState (FEAM%xd(STATE_CURR), FEAM%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL FEAM_CopyDiscState (FEAM%xd(STATE_CURR), FEAM%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL FEAM_CopyConstrState (FEAM%z( STATE_CURR), FEAM%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL FEAM_CopyOtherState( FEAM%OtherSt(STATE_CURR), FEAM%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - ELSEIF (p_FAST%CompMooring == Module_Orca) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ELSEIF (p_FAST%CompMooring == Module_Orca) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4208,20 +4293,20 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A END DO CALL Orca_CopyInput (Orca%Input(1), Orca%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! Initialize predicted states for j_pc loop: CALL Orca_CopyContState (Orca%x( STATE_CURR), Orca%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL Orca_CopyDiscState (Orca%xd(STATE_CURR), Orca%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL Orca_CopyDiscState (Orca%xd(STATE_CURR), Orca%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL Orca_CopyConstrState (Orca%z( STATE_CURR), Orca%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL Orca_CopyOtherState( Orca%OtherSt(STATE_CURR), Orca%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF ! CompMooring - - - IF (p_FAST%CompIce == Module_IceF ) THEN + + + IF (p_FAST%CompIce == Module_IceF ) THEN ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 @@ -4234,23 +4319,23 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL IceFloe_CopyInput (IceF%Input(1), IceF%u, MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ! Initialize predicted states for j_pc loop: CALL IceFloe_CopyContState (IceF%x( STATE_CURR), IceF%x( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL IceFloe_CopyDiscState (IceF%xd(STATE_CURR), IceF%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL IceFloe_CopyDiscState (IceF%xd(STATE_CURR), IceF%xd(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceFloe_CopyConstrState (IceF%z( STATE_CURR), IceF%z( STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceFloe_CopyOtherState( IceF%OtherSt(STATE_CURR), IceF%OtherSt(STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - ELSEIF (p_FAST%CompIce == Module_IceD ) THEN + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ELSEIF (p_FAST%CompIce == Module_IceD ) THEN DO i = 1,p_FAST%numIceLegs - + ! Copy values for interpolation/extrapolation: DO j = 1, p_FAST%InterpOrder + 1 IceD%InputTimes(j,i) = t_initial - (j - 1) * p_FAST%dt @@ -4262,28 +4347,28 @@ SUBROUTINE FAST_InitIOarrays( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, A CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO CALL IceD_CopyInput (IceD%Input(1,i), IceD%u(i), MESH_NEWCOPY, Errstat2, ErrMsg2) ! do this to initialize meshes/allocatable arrays for output of ExtrapInterp routine - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + + ! Initialize predicted states for j_pc loop: CALL IceD_CopyContState (IceD%x( i,STATE_CURR), IceD%x( i,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL IceD_CopyDiscState (IceD%xd(i,STATE_CURR), IceD%xd(i,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) + CALL IceD_CopyDiscState (IceD%xd(i,STATE_CURR), IceD%xd(i,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceD_CopyConstrState (IceD%z( i,STATE_CURR), IceD%z( i,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceD_CopyOtherState( IceD%OtherSt(i,STATE_CURR), IceD%OtherSt(i,STATE_PRED), MESH_NEWCOPY, Errstat2, ErrMsg2) - CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL SetErrStat( Errstat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END DO ! numIceLegs - - END IF ! CompIce - - + + END IF ! CompIce + + END SUBROUTINE FAST_InitIOarrays !---------------------------------------------------------------------------------------------------------------------------------- !> Routine that calls FAST_Solution for one instance of a Turbine data structure. This is a separate subroutine so that the FAST -!! driver programs do not need to change or operate on the individual module level. +!! driver programs do not need to change or operate on the individual module level. SUBROUTINE FAST_Solution_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg ) REAL(DbKi), INTENT(IN ) :: t_initial !< initial time @@ -4291,16 +4376,16 @@ SUBROUTINE FAST_Solution_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg ) TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine !< all data for one instance of a turbine INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - CALL FAST_Solution(t_initial, n_t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & - Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, & + + CALL FAST_Solution(t_initial, n_t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & + Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%SC_DX, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & - Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) - + Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) + END SUBROUTINE FAST_Solution_T !---------------------------------------------------------------------------------------------------------------------------------- !> This routine takes data from n_t_global and gets values at n_t_global + 1 -SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & +SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, SC_DX, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg ) REAL(DbKi), INTENT(IN ) :: t_initial !< initial time @@ -4309,7 +4394,7 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -4317,6 +4402,7 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, TYPE(AeroDyn_Data), INTENT(INOUT) :: AD !< AeroDyn data TYPE(InflowWind_Data), INTENT(INOUT) :: IfW !< InflowWind data TYPE(OpenFOAM_Data), INTENT(INOUT) :: OpFM !< OpenFOAM data + TYPE(SCDataEx_Data), INTENT(INOUT) :: SC_DX !< Supercontroller Exchange data TYPE(HydroDyn_Data), INTENT(INOUT) :: HD !< HydroDyn data TYPE(SubDyn_Data), INTENT(INOUT) :: SD !< SubDyn data TYPE(ExtPtfm_Data), INTENT(INOUT) :: ExtPtfm !< ExtPtfm_MCKF data @@ -4328,66 +4414,73 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables REAL(DbKi) :: t_global_next ! next simulation time (m_FAST%t_global + p_FAST%dt) INTEGER(IntKi) :: n_t_global_next ! n_t_global + 1 - INTEGER(IntKi) :: j_pc ! predictor-corrector loop counter - INTEGER(IntKi) :: NumCorrections ! number of corrections for this time step + INTEGER(IntKi) :: j_pc ! predictor-corrector loop counter + INTEGER(IntKi) :: NumCorrections ! number of corrections for this time step INTEGER(IntKi), parameter :: MaxCorrections = 20 ! maximum number of corrections allowed LOGICAL :: WriteThisStep ! Whether WriteOutput values will be printed - + INTEGER(IntKi) :: I, k ! generic loop counters !REAL(ReKi) :: ControlInputGuess ! value of controller inputs - - + + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Solution' - ErrStat = ErrID_None - ErrMsg = "" - + ErrStat = ErrID_None + ErrMsg = "" + ErrStat2 = ErrID_None + ErrMsg2 = "" + n_t_global_next = n_t_global+1 t_global_next = t_initial + n_t_global_next*p_FAST%DT ! = m_FAST%t_global + p_FAST%dt - + y_FAST%WriteThisStep = NeedWriteOutput(n_t_global_next, t_global_next, p_FAST) !! determine if the Jacobian should be calculated this time IF ( m_FAST%calcJacobian ) THEN ! this was true (possibly at initialization), so we'll advance the time for the next calculation of the Jacobian - + if (p_FAST%CompMooring == Module_Orca .and. n_t_global < 5) then m_FAST%NextJacCalcTime = m_FAST%t_global + p_FAST%DT ! the jacobian calculated with OrcaFlex at t=0 is incorrect, but is okay on the 2nd step (it's not okay for OrcaFlex version 10, so I increased this to 5) else m_FAST%NextJacCalcTime = m_FAST%t_global + p_FAST%DT_UJac end if - + END IF - + ! set number of corrections to be used for this time step: IF ( p_FAST%CompElast == Module_BD ) THEN ! BD accelerations have fewer spikes with these corrections on the first several time steps if (n_t_global > 2) then ! this 2 should probably be related to p_FAST%InterpOrder NumCorrections = p_FAST%NumCrctn elseif (n_t_global == 0) then NumCorrections = max(p_FAST%NumCrctn,16) - else + else NumCorrections = max(p_FAST%NumCrctn,1) end if ELSE NumCorrections = p_FAST%NumCrctn - END IF - + END IF + ! the ServoDyn inputs from Simulink are for t, not t+dt, so we're going to overwrite the inputs from ! the previous step before we extrapolate these inputs: - IF ( p_FAST%CompServo == Module_SrvD ) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, SrvD%Input(1) ) - + IF ( p_FAST%CompServo == Module_SrvD ) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, SrvD%Input(1) ) + + IF ( p_FAST%UseSC ) THEN + CALL SC_DX_SetOutputs(p_FAST, SrvD%Input(1), SC_DX, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - !! ## Step 1.a: Extrapolate Inputs + !! ## Step 1.a: Extrapolate Inputs !! !! gives predicted values at t+dt !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -4395,43 +4488,43 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, MAPp, FEAM, MD, Orca, IceF, IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + !! predictor-corrector loop: j_pc = 0 do while (j_pc <= NumCorrections) WriteThisStep = y_FAST%WriteThisStep .AND. j_pc==NumCorrections - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !! ## Step 1.b: Advance states (yield state and constraint values at t_global_next) !! !! STATE_CURR values of x, xd, z, and OtherSt contain values at m_FAST%t_global; !! STATE_PRED values contain values at t_global_next. !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + CALL FAST_AdvanceStates( t_initial, n_t_global, p_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & - MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep ) + MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2, WriteThisStep ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - !! ## Step 1.c: Input-Output Solve + !! ## Step 1.c: Input-Output Solve !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! save predicted inputs for comparison with corrected value later !IF (p_FAST%CheckHSSBrTrqC) THEN ! ControlInputGuess = ED%Input(1)%HSSBrTrqC !END IF - + CALL CalcOutputs_And_SolveForInputs( n_t_global, t_global_next, STATE_PRED, m_FAST%calcJacobian, m_FAST%NextJacCalcTime, & p_FAST, m_FAST, WriteThisStep, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - !! ## Step 2: Correct (continue in loop) + !! ## Step 2: Correct (continue in loop) !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ j_pc = j_pc + 1 - ! ! Check if the predicted inputs were significantly different than the corrected inputs + ! ! Check if the predicted inputs were significantly different than the corrected inputs ! ! (values before and after CalcOutputs_And_SolveForInputs) !if (j_pc > NumCorrections) then ! @@ -4447,32 +4540,37 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, !end if enddo ! j_pc - + + if (p_FAST%UseSC ) then + call SC_DX_SetInputs(p_FAST, SrvD%y, SC_DX, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + end if + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !! ## Step 3: Save all final variables (advance to next time) !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + !---------------------------------------------------------------------------------------- !! copy the final predicted states from step t_global_next to actual states for that step !---------------------------------------------------------------------------------------- - + ! ElastoDyn: copy final predictions to actual states CALL ED_CopyContState (ED%x( STATE_PRED), ED%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ED_CopyDiscState (ED%xd(STATE_PRED), ED%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL ED_CopyDiscState (ED%xd(STATE_PRED), ED%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ED_CopyConstrState (ED%z( STATE_PRED), ED%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL ED_CopyConstrState (ED%z( STATE_PRED), ED%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ED_CopyOtherState (ED%OtherSt( STATE_PRED), ED%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL ED_CopyOtherState (ED%OtherSt( STATE_PRED), ED%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + + ! BeamDyn: copy final predictions to actual states IF ( p_FAST%CompElast == Module_BD ) THEN DO k=1,p_FAST%nBeams CALL BD_CopyContState (BD%x( k,STATE_PRED), BD%x( k,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL BD_CopyDiscState (BD%xd(k,STATE_PRED), BD%xd(k,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL BD_CopyDiscState (BD%xd(k,STATE_PRED), BD%xd(k,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL BD_CopyConstrState (BD%z( k,STATE_PRED), BD%z( k,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4481,73 +4579,73 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, END DO END IF - - ! AeroDyn: copy final predictions to actual states; copy current outputs to next + + ! AeroDyn: copy final predictions to actual states; copy current outputs to next IF ( p_FAST%CompAero == Module_AD14 ) THEN CALL AD14_CopyContState (AD14%x( STATE_PRED), AD14%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD14_CopyDiscState (AD14%xd(STATE_PRED), AD14%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD14_CopyDiscState (AD14%xd(STATE_PRED), AD14%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD14_CopyConstrState (AD14%z( STATE_PRED), AD14%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD14_CopyConstrState (AD14%z( STATE_PRED), AD14%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD14_CopyOtherState (AD14%OtherSt(STATE_PRED), AD14%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD14_CopyOtherState (AD14%OtherSt(STATE_PRED), AD14%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ELSEIF ( p_FAST%CompAero == Module_AD ) THEN CALL AD_CopyContState (AD%x( STATE_PRED), AD%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD_CopyDiscState (AD%xd(STATE_PRED), AD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD_CopyDiscState (AD%xd(STATE_PRED), AD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD_CopyConstrState (AD%z( STATE_PRED), AD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD_CopyConstrState (AD%z( STATE_PRED), AD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL AD_CopyOtherState (AD%OtherSt(STATE_PRED), AD%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL AD_CopyOtherState (AD%OtherSt(STATE_PRED), AD%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - - ! InflowWind: copy final predictions to actual states; copy current outputs to next + + + ! InflowWind: copy final predictions to actual states; copy current outputs to next IF ( p_FAST%CompInflow == Module_IfW ) THEN CALL InflowWind_CopyContState (IfW%x( STATE_PRED), IfW%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL InflowWind_CopyDiscState (IfW%xd(STATE_PRED), IfW%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL InflowWind_CopyDiscState (IfW%xd(STATE_PRED), IfW%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL InflowWind_CopyConstrState (IfW%z( STATE_PRED), IfW%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL InflowWind_CopyConstrState (IfW%z( STATE_PRED), IfW%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL InflowWind_CopyOtherState (IfW%OtherSt( STATE_PRED), IfW%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL InflowWind_CopyOtherState (IfW%OtherSt( STATE_PRED), IfW%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - - ! ServoDyn: copy final predictions to actual states; copy current outputs to next + + + ! ServoDyn: copy final predictions to actual states; copy current outputs to next IF ( p_FAST%CompServo == Module_SrvD ) THEN CALL SrvD_CopyContState (SrvD%x( STATE_PRED), SrvD%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SrvD_CopyDiscState (SrvD%xd(STATE_PRED), SrvD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL SrvD_CopyDiscState (SrvD%xd(STATE_PRED), SrvD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SrvD_CopyConstrState (SrvD%z( STATE_PRED), SrvD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL SrvD_CopyConstrState (SrvD%z( STATE_PRED), SrvD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SrvD_CopyOtherState (SrvD%OtherSt( STATE_PRED), SrvD%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL SrvD_CopyOtherState (SrvD%OtherSt( STATE_PRED), SrvD%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - + + ! HydroDyn: copy final predictions to actual states - IF ( p_FAST%CompHydro == Module_HD ) THEN + IF ( p_FAST%CompHydro == Module_HD ) THEN CALL HydroDyn_CopyContState (HD%x( STATE_PRED), HD%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL HydroDyn_CopyDiscState (HD%xd(STATE_PRED), HD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL HydroDyn_CopyDiscState (HD%xd(STATE_PRED), HD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL HydroDyn_CopyConstrState (HD%z( STATE_PRED), HD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL HydroDyn_CopyOtherState (HD%OtherSt(STATE_PRED), HD%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - + + ! SubDyn: copy final predictions to actual states IF ( p_FAST%CompSub == Module_SD ) THEN CALL SD_CopyContState (SD%x( STATE_PRED), SD%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL SD_CopyDiscState (SD%xd(STATE_PRED), SD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL SD_CopyDiscState (SD%xd(STATE_PRED), SD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL SD_CopyConstrState (SD%z( STATE_PRED), SD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4556,20 +4654,20 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, ELSE IF ( p_FAST%CompSub == Module_ExtPtfm ) THEN CALL ExtPtfm_CopyContState (ExtPtfm%x( STATE_PRED), ExtPtfm%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL ExtPtfm_CopyDiscState (ExtPtfm%xd(STATE_PRED), ExtPtfm%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL ExtPtfm_CopyDiscState (ExtPtfm%xd(STATE_PRED), ExtPtfm%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ExtPtfm_CopyConstrState (ExtPtfm%z( STATE_PRED), ExtPtfm%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ExtPtfm_CopyOtherState (ExtPtfm%OtherSt(STATE_PRED), ExtPtfm%OtherSt(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - + + ! MAP: copy final predictions to actual states IF (p_FAST%CompMooring == Module_MAP) THEN CALL MAP_CopyContState (MAPp%x( STATE_PRED), MAPp%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL MAP_CopyDiscState (MAPp%xd(STATE_PRED), MAPp%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL MAP_CopyDiscState (MAPp%xd(STATE_PRED), MAPp%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL MAP_CopyConstrState (MAPp%z( STATE_PRED), MAPp%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4578,7 +4676,7 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, ELSEIF (p_FAST%CompMooring == Module_MD) THEN CALL MD_CopyContState (MD%x( STATE_PRED), MD%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL MD_CopyDiscState (MD%xd(STATE_PRED), MD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL MD_CopyDiscState (MD%xd(STATE_PRED), MD%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL MD_CopyConstrState (MD%z( STATE_PRED), MD%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4587,7 +4685,7 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, ELSEIF (p_FAST%CompMooring == Module_FEAM) THEN CALL FEAM_CopyContState (FEAM%x( STATE_PRED), FEAM%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL FEAM_CopyDiscState (FEAM%xd(STATE_PRED), FEAM%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL FEAM_CopyDiscState (FEAM%xd(STATE_PRED), FEAM%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL FEAM_CopyConstrState (FEAM%z( STATE_PRED), FEAM%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4596,19 +4694,19 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, ELSEIF (p_FAST%CompMooring == Module_Orca) THEN CALL Orca_CopyContState (Orca%x( STATE_PRED), Orca%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL Orca_CopyDiscState (Orca%xd(STATE_PRED), Orca%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL Orca_CopyDiscState (Orca%xd(STATE_PRED), Orca%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL Orca_CopyConstrState (Orca%z( STATE_PRED), Orca%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL Orca_CopyOtherState (Orca%OtherSt( STATE_PRED), Orca%OtherSt( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - + ! IceFloe: copy final predictions to actual states IF ( p_FAST%CompIce == Module_IceF ) THEN CALL IceFloe_CopyContState (IceF%x( STATE_PRED), IceF%x( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL IceFloe_CopyDiscState (IceF%xd(STATE_PRED), IceF%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL IceFloe_CopyDiscState (IceF%xd(STATE_PRED), IceF%xd(STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceFloe_CopyConstrState (IceF%z( STATE_PRED), IceF%z( STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4618,7 +4716,7 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, DO i=1,p_FAST%numIceLegs CALL IceD_CopyContState (IceD%x( i,STATE_PRED), IceD%x( i,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - CALL IceD_CopyDiscState (IceD%xd(i,STATE_PRED), IceD%xd(i,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) + CALL IceD_CopyDiscState (IceD%xd(i,STATE_PRED), IceD%xd(i,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL IceD_CopyConstrState (IceD%z( i,STATE_PRED), IceD%z( i,STATE_CURR), MESH_UPDATECOPY, Errstat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -4627,16 +4725,16 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, END DO END IF - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - !! We've advanced everything to the next time step: - !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - !! update the global time - - m_FAST%t_global = t_global_next - - + !! We've advanced everything to the next time step: + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + !! update the global time + + m_FAST%t_global = t_global_next + + !---------------------------------------------------------------------------------------- !! Check to see if we should output data this time step: !---------------------------------------------------------------------------------------- @@ -4647,15 +4745,15 @@ SUBROUTINE FAST_Solution(t_initial, n_t_global, p_FAST, y_FAST, m_FAST, ED, BD, !---------------------------------------------------------------------------------------- !! Display simulation status every SttsTime-seconds (i.e., n_SttsTime steps): - !---------------------------------------------------------------------------------------- - + !---------------------------------------------------------------------------------------- + IF (p_FAST%WrSttsTime) then IF ( MOD( n_t_global_next, p_FAST%n_SttsTime ) == 0 ) THEN CALL SimStatus( m_FAST%TiLstPrn, m_FAST%PrevClockTime, m_FAST%t_global, p_FAST%TMax, p_FAST%TDesc ) ENDIF ENDIF - + END SUBROUTINE FAST_Solution !---------------------------------------------------------------------------------------------------------------------------------- ! ROUTINES TO OUTPUT WRITE DATA TO FILE AT EACH REQUSTED TIME STEP @@ -4664,7 +4762,7 @@ FUNCTION NeedWriteOutput(n_t_global, t_global, p_FAST) INTEGER(IntKi), INTENT(IN ) :: n_t_global !< Current global time step REAL(DbKi), INTENT(IN ) :: t_global !< Current global time TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST !< Parameters for the glue code - + LOGICAL :: NeedWriteOutput !< Function result; if true, WriteOutput values are needed on this time step IF ( t_global >= p_FAST%TStart ) THEN ! note that if TStart isn't an multiple of DT_out, we will not necessarially start output to the file at TStart @@ -4675,8 +4773,8 @@ FUNCTION NeedWriteOutput(n_t_global, t_global, p_FAST) END FUNCTION NeedWriteOutput !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine determines if it's time to write to the output files--based on a previous call to fast_subs::needwriteoutput--, and -!! calls the routine to write to the files with the output data. It should be called after all the output solves for a given time +!> This routine determines if it's time to write to the output files--based on a previous call to fast_subs::needwriteoutput--, and +!! calls the routine to write to the files with the output data. It should be called after all the output solves for a given time !! have been completed, and assumes y_FAST\%WriteThisStep has been set. SUBROUTINE WriteOutputToFile(n_t_global, t_global, p_FAST, y_FAST, ED, BD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & SrvD, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat, ErrMsg) @@ -4709,39 +4807,38 @@ SUBROUTINE WriteOutputToFile(n_t_global, t_global, p_FAST, y_FAST, ED, BD, AD14, CHARACTER(*), PARAMETER :: RoutineName = 'WriteOutputToFile' - + ErrStat = ErrID_None ErrMsg = "" - + ! Write time-series channel data - + !y_FAST%WriteThisStep = NeedWriteOutput(n_t_global, t_global, p_FAST) IF ( y_FAST%WriteThisStep ) THEN ! Generate glue-code output file - CALL WrOutputLine( t_global, p_FAST, y_FAST, IfW%y%WriteOutput, OpFM%y%WriteOutput, ED%y%WriteOutput, & - AD%y%WriteOutput, SrvD%y%WriteOutput, HD%y%WriteOutput, SD%y%WriteOutput, ExtPtfm%y%WriteOutput, MAPp%y%WriteOutput, & + AD%y, SrvD%y%WriteOutput, HD%y%WriteOutput, SD%y%WriteOutput, ExtPtfm%y%WriteOutput, MAPp%y%WriteOutput, & FEAM%y%WriteOutput, MD%y%WriteOutput, Orca%y%WriteOutput, IceF%y%WriteOutput, IceD%y, BD%y, ErrStat, ErrMsg ) ENDIF - + ! Write visualization data (and also note that we're ignoring any errors that occur doing so) IF ( p_FAST%WrVTK == VTK_Animate ) THEN IF ( MOD( n_t_global, p_FAST%n_VTKTime ) == 0 ) THEN call WriteVTK(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) END IF END IF - - + + END SUBROUTINE WriteOutputToFile !---------------------------------------------------------------------------------------------------------------------------------- !> This routine writes the module output to the primary output file(s). -SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutput, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput,& +SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, y_AD, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput,& MAPOutput, FEAMOutput, MDOutput, OrcaOutput, IceFOutput, y_IceD, y_BD, ErrStat, ErrMsg) IMPLICIT NONE - + ! Passed variables REAL(DbKi), INTENT(IN) :: t !< Current simulation time, in seconds TYPE(FAST_ParameterType), INTENT(IN) :: p_FAST !< Glue-code simulation parameters @@ -4751,7 +4848,7 @@ SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADO REAL(ReKi), INTENT(IN) :: IfWOutput (:) !< InflowWind WriteOutput values REAL(ReKi), INTENT(IN) :: OpFMOutput (:) !< OpenFOAM WriteOutput values REAL(ReKi), INTENT(IN) :: EDOutput (:) !< ElastoDyn WriteOutput values - REAL(ReKi), INTENT(IN) :: ADOutput (:) !< AeroDyn WriteOutput values + TYPE(AD_OutputType), INTENT(IN) :: y_AD !< AeroDyn outputs (WriteOutput values are subset of allocated Rotors) REAL(ReKi), INTENT(IN) :: SrvDOutput (:) !< ServoDyn WriteOutput values REAL(ReKi), INTENT(IN) :: HDOutput (:) !< HydroDyn WriteOutput values REAL(ReKi), INTENT(IN) :: SDOutput (:) !< SubDyn WriteOutput values @@ -4777,7 +4874,7 @@ SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADO ErrStat = ErrID_None ErrMsg = '' - CALL FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutput, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput, & + CALL FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, y_AD, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput, & MAPOutput, FEAMOutput, MDOutput, OrcaOutput, IceFOutput, y_IceD, y_BD, OutputAry) IF (p_FAST%WrTxtOutFile) THEN @@ -4793,7 +4890,7 @@ SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADO ! write the individual module output (convert to SiKi if necessary, so that we don't need to print so many digits in the exponent) CALL WrNumAryFileNR ( y_FAST%UnOu, REAL(OutputAry,SiKi), Frmt, ErrStat, ErrMsg ) !IF ( ErrStat >= AbortErrLev ) RETURN - + ! write a new line (advance to the next line) WRITE (y_FAST%UnOu,'()') @@ -4820,8 +4917,8 @@ SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADO ! store individual module data y_FAST%AllOutData(:, y_FAST%n_Out) = OutputAry - - END IF + + END IF END IF @@ -4829,24 +4926,24 @@ SUBROUTINE WrOutputLine( t, p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADO END SUBROUTINE WrOutputLine !---------------------------------------------------------------------------------------------------------------------------------- !> Routine that calls FillOutputAry for one instance of a Turbine data structure. This is a separate subroutine so that the FAST -!! driver programs do not need to change or operate on the individual module level. (Called from Simulink interface.) +!! driver programs do not need to change or operate on the individual module level. (Called from Simulink interface.) SUBROUTINE FillOutputAry_T(Turbine, Outputs) - + TYPE(FAST_TurbineType), INTENT(IN ) :: Turbine !< all data for one instance of a turbine - REAL(ReKi), INTENT( OUT) :: Outputs(:) !< single array of output - + REAL(ReKi), INTENT( OUT) :: Outputs(:) !< single array of output + CALL FillOutputAry(Turbine%p_FAST, Turbine%y_FAST, Turbine%IfW%y%WriteOutput, Turbine%OpFM%y%WriteOutput, & - Turbine%ED%y%WriteOutput, Turbine%AD%y%WriteOutput, Turbine%SrvD%y%WriteOutput, & + Turbine%ED%y%WriteOutput, Turbine%AD%y, Turbine%SrvD%y%WriteOutput, & Turbine%HD%y%WriteOutput, Turbine%SD%y%WriteOutput, Turbine%ExtPtfm%y%WriteOutput, Turbine%MAP%y%WriteOutput, & Turbine%FEAM%y%WriteOutput, Turbine%MD%y%WriteOutput, Turbine%Orca%y%WriteOutput, & - Turbine%IceF%y%WriteOutput, Turbine%IceD%y, Turbine%BD%y, Outputs) - -END SUBROUTINE FillOutputAry_T + Turbine%IceF%y%WriteOutput, Turbine%IceD%y, Turbine%BD%y, Outputs) + +END SUBROUTINE FillOutputAry_T !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine concatenates all of the WriteOutput values from the module Output into one array to be written to the FAST +!> This routine concatenates all of the WriteOutput values from the module Output into one array to be written to the FAST !! output file. -SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutput, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput, & +SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, y_AD, SrvDOutput, HDOutput, SDOutput, ExtPtfmOutput, & MAPOutput, FEAMOutput, MDOutput, OrcaOutput, IceFOutput, y_IceD, y_BD, OutputAry) TYPE(FAST_ParameterType), INTENT(IN) :: p_FAST !< Glue-code simulation parameters @@ -4855,7 +4952,7 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp REAL(ReKi), INTENT(IN) :: IfWOutput (:) !< InflowWind WriteOutput values REAL(ReKi), INTENT(IN) :: OpFMOutput (:) !< OpenFOAM WriteOutput values REAL(ReKi), INTENT(IN) :: EDOutput (:) !< ElastoDyn WriteOutput values - REAL(ReKi), INTENT(IN) :: ADOutput (:) !< AeroDyn WriteOutput values + TYPE(AD_OutputType), INTENT(IN) :: y_AD !< AeroDyn outputs (WriteOutput values are subset of allocated Rotors) REAL(ReKi), INTENT(IN) :: SrvDOutput (:) !< ServoDyn WriteOutput values REAL(ReKi), INTENT(IN) :: HDOutput (:) !< HydroDyn WriteOutput values REAL(ReKi), INTENT(IN) :: SDOutput (:) !< SubDyn WriteOutput values @@ -4868,17 +4965,23 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp TYPE(IceD_OutputType), INTENT(IN) :: y_IceD (:) !< IceDyn outputs (WriteOutput values are subset) TYPE(BD_OutputType), INTENT(IN) :: y_BD (:) !< BeamDyn outputs (WriteOutput values are subset) - REAL(ReKi), INTENT(OUT) :: OutputAry(:) !< single array of output - + REAL(ReKi), INTENT(OUT) :: OutputAry(:) !< single array of output + INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: indxLast ! The index of the last row value to be written to AllOutData for this time step (column). INTEGER(IntKi) :: indxNext ! The index of the next row value to be written to AllOutData for this time step (column). - - + + ! store individual module data into one array for output indxLast = 0 indxNext = 1 + + IF (y_FAST%numOuts(Module_Glue) > 1) THEN ! if we output more than just the time channel.... + indxLast = indxNext + SIZE(y_FAST%DriverWriteOutput) - 1 + OutputAry(indxNext:indxLast) = y_FAST%DriverWriteOutput + indxNext = IndxLast + 1 + END IF IF ( y_FAST%numOuts(Module_IfW) > 0 ) THEN indxLast = indxNext + SIZE(IfWOutput) - 1 @@ -4895,20 +4998,24 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp OutputAry(indxNext:indxLast) = EDOutput indxNext = IndxLast + 1 END IF - + IF ( y_FAST%numOuts(Module_BD) > 0 ) THEN do i=1,SIZE(y_BD) indxLast = indxNext + SIZE(y_BD(i)%WriteOutput) - 1 OutputAry(indxNext:indxLast) = y_BD(i)%WriteOutput indxNext = IndxLast + 1 + end do + END IF + + IF ( y_FAST%numOuts(Module_AD) > 0 ) THEN + do i=1,SIZE(y_AD%Rotors) + if (allocated(y_AD%Rotors(i)%WriteOutput)) then + indxLast = indxNext + SIZE(y_AD%Rotors(i)%WriteOutput) - 1 + OutputAry(indxNext:indxLast) = y_AD%Rotors(i)%WriteOutput + indxNext = IndxLast + 1 + endif end do END IF - - IF ( y_FAST%numOuts(Module_AD) > 0 ) THEN - indxLast = indxNext + SIZE(ADOutput) - 1 - OutputAry(indxNext:indxLast) = ADOutput - indxNext = IndxLast + 1 - END IF IF ( y_FAST%numOuts(Module_SrvD) > 0 ) THEN indxLast = indxNext + SIZE(SrvDOutput) - 1 @@ -4931,7 +5038,7 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp OutputAry(indxNext:indxLast) = ExtPtfmOutput indxNext = IndxLast + 1 END IF - + IF ( y_FAST%numOuts(Module_MAP) > 0 ) THEN indxLast = indxNext + SIZE(MAPOutput) - 1 OutputAry(indxNext:indxLast) = MAPOutput @@ -4949,7 +5056,7 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp OutputAry(indxNext:indxLast) = OrcaOutput indxNext = IndxLast + 1 END IF - + IF ( y_FAST%numOuts(Module_IceF) > 0 ) THEN indxLast = indxNext + SIZE(IceFOutput) - 1 OutputAry(indxNext:indxLast) = IceFOutput @@ -4959,9 +5066,9 @@ SUBROUTINE FillOutputAry(p_FAST, y_FAST, IfWOutput, OpFMOutput, EDOutput, ADOutp indxLast = indxNext + SIZE(y_IceD(i)%WriteOutput) - 1 OutputAry(indxNext:indxLast) = y_IceD(i)%WriteOutput indxNext = IndxLast + 1 - END DO - END IF - + END DO + END IF + END SUBROUTINE FillOutputAry !---------------------------------------------------------------------------------------------------------------------------------- SUBROUTINE WriteVTK(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) @@ -5000,14 +5107,14 @@ SUBROUTINE WriteVTK(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM CALL WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) ELSE IF (p_FAST%VTK_Type==VTK_Old) THEN CALL WriteInputMeshesToFile( ED%Input(1), AD%Input(1), SD%Input(1), HD%Input(1), MAPp%Input(1), BD%Input(1,:), TRIM(p_FAST%OutFileRoot)//'.InputMeshes.bin', ErrStat2, ErrMsg2) - CALL WriteMotionMeshesToFile(t_global, ED%y, SD%Input(1), SD%y, HD%Input(1), MAPp%Input(1), BD%y, BD%Input(1,:), y_FAST%UnGra, ErrStat2, ErrMsg2, TRIM(p_FAST%OutFileRoot)//'.gra') + CALL WriteMotionMeshesToFile(t_global, ED%y, SD%Input(1), SD%y, HD%Input(1), MAPp%Input(1), BD%y, BD%Input(1,:), y_FAST%UnGra, ErrStat2, ErrMsg2, TRIM(p_FAST%OutFileRoot)//'.gra') !unOut = -1 !CALL MeshWrBin ( unOut, AD%y%BladeLoad(2), ErrStat2, ErrMsg2, 'AD_2_ED_loads.bin'); IF (ErrStat2 /= ErrID_None) CALL WrScr(TRIM(ErrMsg2)) !CALL MeshWrBin ( unOut, ED%Input(1)%BladePtLoads(2),ErrStat2, ErrMsg2, 'AD_2_ED_loads.bin'); IF (ErrStat2 /= ErrID_None) CALL WrScr(TRIM(ErrMsg2)) !CALL MeshMapWrBin( unOut, AD%y%BladeLoad(2), ED%Input(1)%BladePtLoads(2), MeshMapData%AD_L_2_BDED_B(2), ErrStat2, ErrMsg2, 'AD_2_ED_loads.bin' ); IF (ErrStat2 /= ErrID_None) CALL WrScr(TRIM(ErrMsg2)) !close( unOut ) END IF - + y_FAST%VTK_count = y_FAST%VTK_count + 1 END SUBROUTINE WriteVTK @@ -5039,38 +5146,39 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H logical :: outputFields ! flag to determine if we want to output the HD mesh fields INTEGER(IntKi) :: NumBl, k + INTEGER(IntKi) :: j ! counter for StC instance at location INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMSg2 CHARACTER(*), PARAMETER :: RoutineName = 'WrVTK_AllMeshes' - - + + NumBl = 0 if (allocated(ED%y%BladeRootMotion)) then NumBl = SIZE(ED%y%BladeRootMotion) end if - - - + + + ! I'm first going to just put all of the meshes that get mapped together, then decide if we're going to print/plot them all - + ! ElastoDyn if (allocated(ED%Input)) then - + ! ElastoDyn outputs (motions) - DO K=1,NumBl + DO K=1,NumBl !%BladeLn2Mesh(K) used only when not BD (see below) call MeshWrVTK(p_FAST%TurbinePos, ED%y%BladeRootMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.ED_BladeRootMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) END DO - - call MeshWrVTK(p_FAST%TurbinePos, ED%y%TowerLn2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_TowerLn2Mesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + + call MeshWrVTK(p_FAST%TurbinePos, ED%y%TowerLn2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_TowerLn2Mesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ! these will get output with their sibling input meshes !call MeshWrVTK(p_FAST%TurbinePos, ED%y%HubPtMotion, trim(p_FAST%VTK_OutFileRoot)//'.ED_HubPtMotion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) !call MeshWrVTK(p_FAST%TurbinePos, ED%y%NacelleMotion, trim(p_FAST%VTK_OutFileRoot)//'.ED_NacelleMotion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) !call MeshWrVTK(p_FAST%TurbinePos, ED%y%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_PlatformPtMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - + ! ElastoDyn inputs (loads) ! %BladePtLoads used only when not BD (see below) call MeshWrVTK(p_FAST%TurbinePos, ED%Input(1)%TowerPtLoads, trim(p_FAST%VTK_OutFileRoot)//'.ED_TowerPtLoads', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, ED%y%TowerLn2Mesh ) @@ -5078,18 +5186,18 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H call MeshWrVTK(p_FAST%TurbinePos, ED%Input(1)%NacelleLoads, trim(p_FAST%VTK_OutFileRoot)//'.ED_Nacelle' ,y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, ED%y%NacelleMotion ) call MeshWrVTK(p_FAST%TurbinePos, ED%Input(1)%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_PlatformPtMesh', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, ED%y%PlatformPtMesh ) end if - - + + ! BeamDyn IF ( p_FAST%CompElast == Module_BD .and. allocated(BD%Input) .and. allocated(BD%y)) THEN - - do K=1,NumBl + + do K=1,NumBl ! BeamDyn inputs !call MeshWrVTK(p_FAST%TurbinePos, BD%Input(1,k)%RootMotion, trim(p_FAST%VTK_OutFileRoot)//'.BD_RootMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) call MeshWrVTK(p_FAST%TurbinePos, BD%Input(1,k)%HubMotion, trim(p_FAST%VTK_OutFileRoot)//'.BD_HubMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end do if (allocated(MeshMapData%y_BD_BldMotion_4Loads)) then - do K=1,NumBl + do K=1,NumBl call MeshWrVTK(p_FAST%TurbinePos, BD%Input(1,k)%DistrLoad, trim(p_FAST%VTK_OutFileRoot)//'.BD_DistrLoad'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, MeshMapData%y_BD_BldMotion_4Loads(k) ) ! skipping PointLoad end do @@ -5099,58 +5207,90 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H ! skipping PointLoad end do end if - + do K=1,NumBl ! BeamDyn outputs call MeshWrVTK(p_FAST%TurbinePos, BD%y(k)%ReactionForce, trim(p_FAST%VTK_OutFileRoot)//'.BD_ReactionForce_RootMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, BD%Input(1,k)%RootMotion ) - end do - + end do + if (.not. p_FAST%BD_OutputSibling) then !otherwise this mesh has been put with the DistrLoad mesh do K=1,NumBl ! BeamDyn outputs call MeshWrVTK(p_FAST%TurbinePos, BD%y(k)%BldMotion, trim(p_FAST%VTK_OutFileRoot)//'.BD_BldMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end do end if - - + + ELSE if (p_FAST%CompElast == Module_ED .and. allocated(ED%Input)) then ! ElastoDyn - DO K=1,NumBl + DO K=1,NumBl call MeshWrVTK(p_FAST%TurbinePos, ED%y%BladeLn2Mesh(K), trim(p_FAST%VTK_OutFileRoot)//'.ED_BladeLn2Mesh_motion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) call MeshWrVTK(p_FAST%TurbinePos, ED%Input(1)%BladePtLoads(K), trim(p_FAST%VTK_OutFileRoot)//'.ED_BladePtLoads'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, ED%y%BladeLn2Mesh(K) ) - END DO + END DO END IF - + ! ServoDyn if (allocated(SrvD%Input)) then - IF ( SrvD%Input(1)%NTMD%Mesh%Committed ) THEN - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%NTMD%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NTMD_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%NTMD%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NTMD', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%TTMD%Mesh ) - END IF - IF ( SrvD%Input(1)%TTMD%Mesh%Committed ) THEN - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%TTMD%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TTMD_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%TTMD%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TTMD', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%TTMD%Mesh ) - END IF + IF ( ALLOCATED(SrvD%Input(1)%NStC) ) THEN + do j=1,size(SrvD%Input(1)%NStC) + IF ( ALLOCATED(SrvD%Input(1)%NStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%NStC(j)%Mesh(1)%Committed ) THEN + !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%NStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NStC_Motion'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%NStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%NStC(j)%Mesh(1) ) + END IF + ENDIF + enddo + ENDIF + IF ( ALLOCATED(SrvD%Input(1)%TStC) ) THEN + do j=1,size(SrvD%Input(1)%TStC) + IF ( ALLOCATED(SrvD%Input(1)%TStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%TStC(j)%Mesh(1)%Committed ) THEN + !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%TStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%TStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%TStC(j)%Mesh(1) ) + ENDIF + ENDIF + enddo + ENDIF + IF ( ALLOCATED(SrvD%Input(1)%BStC) ) THEN + do j=1,size(SrvD%Input(1)%BStC) + IF ( ALLOCATED(SrvD%Input(1)%BStC(j)%Mesh) ) THEN + DO K=1,size(SrvD%Input(1)%BStC(j)%Mesh) + !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%BStC(j)%Mesh(k), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_BStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%BStC(j)%Mesh(k), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_BStC'//trim(num2lstr(j))//'B'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%BStC(j)%Mesh(k) ) + ENDDO + END IF + enddo + ENDIF + IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN + do j=1,size(SrvD%Input(1)%SStC) + IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN + IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN + !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%SStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_SStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%SStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_SStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%SStC(j)%Mesh(1) ) + ENDIF + ENDIF + enddo + ENDIF end if ! AeroDyn IF ( p_FAST%CompAero == Module_AD .and. allocated(AD%Input)) THEN - if (allocated(AD%Input(1)%BladeRootMotion)) then + if (allocated(AD%Input(1)%rotors(1)%BladeRootMotion)) then DO K=1,NumBl - call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%BladeRootMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_BladeRootMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%rotors(1)%BladeRootMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_BladeRootMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) !call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%BladeMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_BladeMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - END DO + END DO - call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%HubMotion, trim(p_FAST%VTK_OutFileRoot)//'.AD_HubMotion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) + call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%rotors(1)%HubMotion, trim(p_FAST%VTK_OutFileRoot)//'.AD_HubMotion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) !call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%TowerMotion, trim(p_FAST%VTK_OutFileRoot)//'.AD_TowerMotion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) DO K=1,NumBl - call MeshWrVTK(p_FAST%TurbinePos, AD%y%BladeLoad(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_Blade'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%BladeMotion(k) ) + call MeshWrVTK(p_FAST%TurbinePos, AD%y%rotors(1)%BladeLoad(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_Blade'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%rotors(1)%BladeMotion(k) ) END DO - call MeshWrVTK(p_FAST%TurbinePos, AD%y%TowerLoad, trim(p_FAST%VTK_OutFileRoot)//'.AD_Tower', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%TowerMotion ) + call MeshWrVTK(p_FAST%TurbinePos, AD%y%rotors(1)%TowerLoad, trim(p_FAST%VTK_OutFileRoot)//'.AD_Tower', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%rotors(1)%TowerMotion ) end if @@ -5158,7 +5298,7 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H if (allocated(AD%m%FVW_u)) then if (allocated(AD%m%FVW_u(1)%WingsMesh)) then DO K=1,NumBl - call MeshWrVTK(p_FAST%TurbinePos, AD%m%FVW_u(1)%WingsMesh(k), trim(p_FAST%VTK_OutFileRoot)//'.FVW_WingsMesh'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%BladeMotion(k) ) + call MeshWrVTK(p_FAST%TurbinePos, AD%m%FVW_u(1)%WingsMesh(k), trim(p_FAST%VTK_OutFileRoot)//'.FVW_WingsMesh'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, AD%Input(1)%rotors(1)%BladeMotion(k) ) !call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%BladeMotion(K), trim(p_FAST%OutFileRoot)//'.AD_BladeMotion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2 ) END DO ! Free wake @@ -5186,71 +5326,71 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H call MeshWrVTK(p_FAST%TurbinePos, HD%y%Morison%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.HD_Morison', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, HD%Input(1)%Morison%Mesh ) endif END IF - -! SubDyn + +! SubDyn IF ( p_FAST%CompSub == Module_SD .and. allocated(SD%Input)) THEN !call MeshWrVTK(p_FAST%TurbinePos, SD%Input(1)%TPMesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_TPMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) call MeshWrVTK(p_FAST%TurbinePos, SD%Input(1)%LMesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_LMesh_y2Mesh', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SD%y%y2Mesh ) - + call MeshWrVTK(p_FAST%TurbinePos, SD%y%y1Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_y1Mesh_TPMesh', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SD%Input(1)%TPMesh ) !call MeshWrVTK(p_FAST%TurbinePos, SD%y%y2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_y2Mesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ELSE IF ( p_FAST%CompSub == Module_ExtPtfm .and. allocated(ExtPtfm%Input)) THEN call MeshWrVTK(p_FAST%TurbinePos, ExtPtfm%y%PtfmMesh, trim(p_FAST%VTK_OutFileRoot)//'.ExtPtfm', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, ExtPtfm%Input(1)%PtfmMesh ) - END IF - + END IF + ! MAP IF ( p_FAST%CompMooring == Module_MAP ) THEN if (allocated(MAPp%Input)) then call MeshWrVTK(p_FAST%TurbinePos, MAPp%y%PtFairleadLoad, trim(p_FAST%VTK_OutFileRoot)//'.MAP_PtFairlead', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, MAPp%Input(1)%PtFairDisplacement ) !call MeshWrVTK(p_FAST%TurbinePos, MAPp%Input(1)%PtFairDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MAP_PtFair_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end if - -! MoorDyn + +! MoorDyn ELSEIF ( p_FAST%CompMooring == Module_MD ) THEN if (allocated(MD%Input)) then call MeshWrVTK(p_FAST%TurbinePos, MD%y%PtFairleadLoad, trim(p_FAST%VTK_OutFileRoot)//'.MD_PtFairlead', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, MD%Input(1)%PtFairleadDisplacement ) !call MeshWrVTK(p_FAST%TurbinePos, MD%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MD_PtFair_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end if - -! FEAMooring + +! FEAMooring ELSEIF ( p_FAST%CompMooring == Module_FEAM ) THEN if (allocated(FEAM%Input)) then call MeshWrVTK(p_FAST%TurbinePos, FEAM%y%PtFairleadLoad, trim(p_FAST%VTK_OutFileRoot)//'.FEAM_PtFairlead', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, FEAM%Input(1)%PtFairleadDisplacement ) !call MeshWrVTK(p_FAST%TurbinePos, FEAM%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.FEAM_PtFair_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end if - -! Orca + +! Orca ELSEIF ( p_FAST%CompMooring == Module_Orca ) THEN if (allocated(Orca%Input)) then call MeshWrVTK(p_FAST%TurbinePos, Orca%y%PtfmMesh, trim(p_FAST%VTK_OutFileRoot)//'.Orca_PtfmMesh', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Orca%Input(1)%PtfmMesh ) !call MeshWrVTK(p_FAST%TurbinePos, Orca%Input(1)%PtfmMesh, trim(p_FAST%VTK_OutFileRoot)//'.Orca_PtfmMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end if END IF - - -! IceFloe + + +! IceFloe IF ( p_FAST%CompIce == Module_IceF ) THEN if (allocated(IceF%Input)) then call MeshWrVTK(p_FAST%TurbinePos, IceF%y%iceMesh, trim(p_FAST%VTK_OutFileRoot)//'.IceF_iceMesh', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, IceF%Input(1)%iceMesh ) !call MeshWrVTK(p_FAST%TurbinePos, IceF%Input(1)%iceMesh, trim(p_FAST%VTK_OutFileRoot)//'.IceF_iceMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) end if - + ! IceDyn ELSEIF ( p_FAST%CompIce == Module_IceD ) THEN if (allocated(IceD%Input)) then - + DO k = 1,p_FAST%numIceLegs call MeshWrVTK(p_FAST%TurbinePos, IceD%y(k)%PointMesh, trim(p_FAST%VTK_OutFileRoot)//'.IceD_PointMesh'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, IceD%Input(1,k)%PointMesh ) !call MeshWrVTK(p_FAST%TurbinePos, IceD%Input(1,k)%PointMesh, trim(p_FAST%VTK_OutFileRoot)//'.IceD_PointMesh_motion'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) END DO end if - + END IF - - -END SUBROUTINE WrVTK_AllMeshes + + +END SUBROUTINE WrVTK_AllMeshes !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine writes a minimal subset of meshes (enough to visualize the turbine) to VTK-formatted files. It doesn't bother with +!> This routine writes a minimal subset of meshes (enough to visualize the turbine) to VTK-formatted files. It doesn't bother with !! returning an error code. SUBROUTINE WrVTK_BasicMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) @@ -5285,29 +5425,29 @@ SUBROUTINE WrVTK_BasicMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, NumBl = SIZE(ED%y%BladeRootMotion) end if - + ! Blades IF ( p_FAST%CompAero == Module_AD ) THEN ! These meshes may have airfoil data associated with nodes... DO K=1,NumBl - call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%BladeMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_Blade'//trim(num2lstr(k)), & - y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Sib=AD%y%BladeLoad(K) ) + call MeshWrVTK(p_FAST%TurbinePos, AD%Input(1)%rotors(1)%BladeMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.AD_Blade'//trim(num2lstr(k)), & + y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Sib=AD%y%rotors(1)%BladeLoad(K) ) END DO ELSE IF ( p_FAST%CompElast == Module_BD ) THEN - DO K=1,NumBl + DO K=1,NumBl call MeshWrVTK(p_FAST%TurbinePos, BD%y(k)%BldMotion, trim(p_FAST%VTK_OutFileRoot)//'.BD_BldMotion'//trim(num2lstr(k)), & y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - END DO + END DO ELSE IF ( p_FAST%CompElast == Module_ED ) THEN - DO K=1,NumBl + DO K=1,NumBl call MeshWrVTK(p_FAST%TurbinePos, ED%y%BladeLn2Mesh(K), trim(p_FAST%VTK_OutFileRoot)//'.ED_BladeLn2Mesh_motion'//trim(num2lstr(k)), & y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - END DO - END IF - + END DO + END IF + ! Nacelle call MeshWrVTK(p_FAST%TurbinePos, ED%y%NacelleMotion, trim(p_FAST%VTK_OutFileRoot)//'.ED_Nacelle', y_FAST%VTK_count, & p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Sib=ED%Input(1)%NacelleLoads ) - + ! Hub call MeshWrVTK(p_FAST%TurbinePos, ED%y%HubPtMotion, trim(p_FAST%VTK_OutFileRoot)//'.ED_Hub', y_FAST%VTK_count, & p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Sib=ED%Input(1)%HubPtLoad ) @@ -5315,30 +5455,30 @@ SUBROUTINE WrVTK_BasicMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, call MeshWrVTK(p_FAST%TurbinePos, ED%y%TowerLn2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_TowerLn2Mesh_motion', & y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - - -! Substructure + + +! Substructure ! call MeshWrVTK(p_FAST%TurbinePos, ED%y%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_PlatformPtMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ! IF ( p_FAST%CompSub == Module_SD ) THEN ! call MeshWrVTK(p_FAST%TurbinePos, SD%Input(1)%TPMesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_TPMesh_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ! call MeshWrVTK(p_FAST%TurbinePos, SD%y%y2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_y2Mesh_motion', y_FAST%VTK_count, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) -! END IF - - IF ( p_FAST%CompHydro == Module_HD ) THEN - +! END IF + + IF ( p_FAST%CompHydro == Module_HD ) THEN + if (p_FAST%CompSub == Module_NONE) then call MeshWrVTK(p_FAST%TurbinePos, HD%y%WAMITMesh, trim(p_FAST%VTK_OutFileRoot)//'.HD_AllHdroOrigin', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, HD%Input(1)%WAMITMesh ) outputFields = .false. - else + else OutputFields = p_FAST%VTK_fields end if !TODO: Fix for Visualization GJH 4/23/20 call MeshWrVTK(p_FAST%TurbinePos, HD%Input(1)%Morison%Mesh, trim(p_FAST%VTK_OutFileRoot)//'.HD_Morison', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, Sib=HD%y%Morison%Mesh ) END IF - - -! Mooring Lines? + + +! Mooring Lines? ! IF ( p_FAST%CompMooring == Module_MAP ) THEN ! call MeshWrVTK(p_FAST%TurbinePos, MAPp%Input(1)%PtFairDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MAP_PtFair_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ! ELSEIF ( p_FAST%CompMooring == Module_MD ) THEN @@ -5346,11 +5486,11 @@ SUBROUTINE WrVTK_BasicMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, ! ELSEIF ( p_FAST%CompMooring == Module_FEAM ) THEN ! call MeshWrVTK(p_FAST%TurbinePos, FEAM%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'FEAM_PtFair_motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) ! END IF - - -END SUBROUTINE WrVTK_BasicMeshes + + +END SUBROUTINE WrVTK_BasicMeshes !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine writes a minimal subset of meshes with surfaces to VTK-formatted files. It doesn't bother with +!> This routine writes a minimal subset of meshes with surfaces to VTK-formatted files. It doesn't bother with !! returning an error code. SUBROUTINE WrVTK_Surfaces(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) use FVW_IO, only: WrVTK_FVW @@ -5388,57 +5528,57 @@ SUBROUTINE WrVTK_Surfaces(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW end if ! Ground (written at initialization) - + ! Wave elevation if ( allocated( p_FAST%VTK_Surface%WaveElev ) ) call WrVTK_WaveElev( t_global, p_FAST, y_FAST, HD) - + ! Nacelle call MeshWrVTK_PointSurface (p_FAST%TurbinePos, ED%y%NacelleMotion, trim(p_FAST%VTK_OutFileRoot)//'.NacelleSurface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth , verts = p_FAST%VTK_Surface%NacelleBox, Sib=ED%Input(1)%NacelleLoads ) - - + + ! Hub call MeshWrVTK_PointSurface (p_FAST%TurbinePos, ED%y%HubPtMotion, trim(p_FAST%VTK_OutFileRoot)//'.HubSurface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth , & NumSegments=p_FAST%VTK_Surface%NumSectors, radius=p_FAST%VTK_Surface%HubRad, Sib=ED%Input(1)%HubPtLoad ) - + ! Tower motions call MeshWrVTK_Ln2Surface (p_FAST%TurbinePos, ED%y%TowerLn2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.TowerSurface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, p_FAST%VTK_Surface%NumSectors, p_FAST%VTK_Surface%TowerRad ) - + ! Blades IF ( p_FAST%CompAero == Module_AD ) THEN ! These meshes may have airfoil data associated with nodes... DO K=1,NumBl - call MeshWrVTK_Ln2Surface (p_FAST%TurbinePos, AD%Input(1)%BladeMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.Blade'//trim(num2lstr(k))//'Surface', & + call MeshWrVTK_Ln2Surface (p_FAST%TurbinePos, AD%Input(1)%rotors(1)%BladeMotion(K), trim(p_FAST%VTK_OutFileRoot)//'.Blade'//trim(num2lstr(k))//'Surface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth , verts=p_FAST%VTK_Surface%BladeShape(K)%AirfoilCoords & - ,Sib=AD%y%BladeLoad(k) ) + ,Sib=AD%y%rotors(1)%BladeLoad(k) ) END DO ELSE IF ( p_FAST%CompElast == Module_BD ) THEN - DO K=1,NumBl + DO K=1,NumBl call MeshWrVTK_Ln2Surface (p_FAST%TurbinePos, BD%y(k)%BldMotion, trim(p_FAST%VTK_OutFileRoot)//'.Blade'//trim(num2lstr(k))//'Surface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth , verts=p_FAST%VTK_Surface%BladeShape(K)%AirfoilCoords ) - END DO + END DO ELSE IF ( p_FAST%CompElast == Module_ED ) THEN - DO K=1,NumBl + DO K=1,NumBl call MeshWrVTK_Ln2Surface (p_FAST%TurbinePos, ED%y%BladeLn2Mesh(K), trim(p_FAST%VTK_OutFileRoot)//'.Blade'//trim(num2lstr(k))//'Surface', & y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth , verts=p_FAST%VTK_Surface%BladeShape(K)%AirfoilCoords ) - END DO - END IF + END DO + END IF ! Free wake if (allocated(AD%m%FVW_u)) then if (allocated(AD%m%FVW_u(1)%WingsMesh)) then call WrVTK_FVW(AD%p%FVW, AD%x(1)%FVW, AD%z(1)%FVW, AD%m%FVW, trim(p_FAST%VTK_OutFileRoot)//'.FVW', y_FAST%VTK_count, p_FAST%VTK_tWidth, bladeFrame=.FALSE.) ! bladeFrame==.FALSE. to output in global coords - end if - end if + end if + end if + - ! Platform ! call MeshWrVTK_PointSurface (p_FAST%TurbinePos, ED%y%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.PlatformSurface', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2, Radius = p_FAST%VTK_Surface%GroundRad ) - - -! Substructure -! call MeshWrVTK(p_FAST%TurbinePos, ED%y%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_PlatformPtMesh_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) + + +! Substructure +! call MeshWrVTK(p_FAST%TurbinePos, ED%y%PlatformPtMesh, trim(p_FAST%VTK_OutFileRoot)//'.ED_PlatformPtMesh_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) ! IF ( p_FAST%CompSub == Module_SD ) THEN ! call MeshWrVTK(p_FAST%TurbinePos, SD%Input(1)%TPMesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_TPMesh_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) ! call MeshWrVTK(p_FAST%TurbinePos, SD%y%y2Mesh, trim(p_FAST%VTK_OutFileRoot)//'.SD_y2Mesh_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) @@ -5460,20 +5600,20 @@ SUBROUTINE WrVTK_Surfaces(t_global, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW ! Mooring Lines? ! IF ( p_FAST%CompMooring == Module_MAP ) THEN -! call MeshWrVTK(p_FAST%TurbinePos, MAPp%Input(1)%PtFairDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MAP_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) +! call MeshWrVTK(p_FAST%TurbinePos, MAPp%Input(1)%PtFairDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MAP_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) ! ELSEIF ( p_FAST%CompMooring == Module_MD ) THEN -! call MeshWrVTK(p_FAST%TurbinePos, MD%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MD_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) +! call MeshWrVTK(p_FAST%TurbinePos, MD%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'.MD_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) ! ELSEIF ( p_FAST%CompMooring == Module_FEAM ) THEN -! call MeshWrVTK(p_FAST%TurbinePos, FEAM%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'FEAM_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) +! call MeshWrVTK(p_FAST%TurbinePos, FEAM%Input(1)%PtFairleadDisplacement, trim(p_FAST%VTK_OutFileRoot)//'FEAM_PtFair_motion', y_FAST%VTK_count, OutputFields, ErrStat2, ErrMsg2 ) ! END IF - - + + if (p_FAST%VTK_fields) then call WrVTK_BasicMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) end if - - -END SUBROUTINE WrVTK_Surfaces + + +END SUBROUTINE WrVTK_Surfaces !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine writes the wave elevation data for a given time step SUBROUTINE WrVTK_WaveElev(t_global, p_FAST, y_FAST, HD) @@ -5489,76 +5629,76 @@ SUBROUTINE WrVTK_WaveElev(t_global, p_FAST, y_FAST, HD) INTEGER(IntKi) :: n, iy, ix ! loop counters REAL(SiKi) :: t CHARACTER(1024) :: FileName - INTEGER(IntKi) :: NumberOfPoints + INTEGER(IntKi) :: NumberOfPoints INTEGER(IntKi), parameter :: NumberOfLines = 0 INTEGER(IntKi) :: NumberOfPolys CHARACTER(1024) :: Tstr - INTEGER(IntKi) :: ErrStat2 + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*),PARAMETER :: RoutineName = 'WrVTK_WaveElev' - + NumberOfPoints = size(p_FAST%VTK_surface%WaveElevXY,2) ! I'm going to make triangles for now. we should probably just make this a structured file at some point NumberOfPolys = ( p_FAST%VTK_surface%NWaveElevPts(1) - 1 ) * & ( p_FAST%VTK_surface%NWaveElevPts(2) - 1 ) * 2 - + !................................................................. ! write the data that potentially changes each time step: !................................................................. ! construct the string for the zero-padded VTK write-out step write(Tstr, '(i' // trim(Num2LStr(p_FAST%VTK_tWidth)) //'.'// trim(Num2LStr(p_FAST%VTK_tWidth)) // ')') y_FAST%VTK_count - + ! PolyData (.vtp) - Serial vtkPolyData (unstructured) file FileName = TRIM(p_FAST%VTK_OutFileRoot)//'.WaveSurface.'//TRIM(Tstr)//'.vtp' - - call WrVTK_header( FileName, NumberOfPoints, NumberOfLines, NumberOfPolys, Un, ErrStat2, ErrMsg2 ) + + call WrVTK_header( FileName, NumberOfPoints, NumberOfLines, NumberOfPolys, Un, ErrStat2, ErrMsg2 ) if (ErrStat2 >= AbortErrLev) return - -! points (nodes, augmented with NumSegments): + +! points (nodes, augmented with NumSegments): WRITE(Un,'(A)') ' ' WRITE(Un,'(A)') ' ' ! I'm not going to interpolate in time; I'm just going to get the index of the closest wave time value t = REAL(t_global,SiKi) call GetWaveElevIndx( t, HD%p%WaveTime, y_FAST%VTK_LastWaveIndx ) - + n = 1 do ix=1,p_FAST%VTK_surface%NWaveElevPts(1) - do iy=1,p_FAST%VTK_surface%NWaveElevPts(2) - WRITE(Un,VTK_AryFmt) p_FAST%VTK_surface%WaveElevXY(:,n), p_FAST%VTK_surface%WaveElev(y_FAST%VTK_LastWaveIndx,n) + do iy=1,p_FAST%VTK_surface%NWaveElevPts(2) + WRITE(Un,VTK_AryFmt) p_FAST%VTK_surface%WaveElevXY(:,n), p_FAST%VTK_surface%WaveElev(y_FAST%VTK_LastWaveIndx,n) n = n+1 end do end do - + WRITE(Un,'(A)') ' ' WRITE(Un,'(A)') ' ' - - - WRITE(Un,'(A)') ' ' - WRITE(Un,'(A)') ' ' - + + + WRITE(Un,'(A)') ' ' + WRITE(Un,'(A)') ' ' + do ix=1,p_FAST%VTK_surface%NWaveElevPts(1)-1 do iy=1,p_FAST%VTK_surface%NWaveElevPts(2)-1 n = p_FAST%VTK_surface%NWaveElevPts(1)*(ix-1)+iy - 1 ! points start at 0 - + WRITE(Un,'(3(i7))') n, n+1, n+p_FAST%VTK_surface%NWaveElevPts(2) WRITE(Un,'(3(i7))') n+1, n+1+p_FAST%VTK_surface%NWaveElevPts(2), n+p_FAST%VTK_surface%NWaveElevPts(2) - + end do - end do - WRITE(Un,'(A)') ' ' - - WRITE(Un,'(A)') ' ' + end do + WRITE(Un,'(A)') ' ' + + WRITE(Un,'(A)') ' ' do n=1,NumberOfPolys WRITE(Un,'(i7)') 3*n - end do + end do WRITE(Un,'(A)') ' ' - WRITE(Un,'(A)') ' ' - - call WrVTK_footer( Un ) - -END SUBROUTINE WrVTK_WaveElev + WRITE(Un,'(A)') ' ' + + call WrVTK_footer( Un ) + +END SUBROUTINE WrVTK_WaveElev !---------------------------------------------------------------------------------------------------------------------------------- !> This function returns the index, Ind, of the XAry closest to XValIn, where XAry is assumed to be periodic. It starts !! searching at the value of Ind from a previous step. @@ -5571,18 +5711,18 @@ SUBROUTINE GetWaveElevIndx( XValIn, XAry, Ind ) REAL(SiKi), INTENT(IN) :: XAry (:) !< Array of X values to be interpolated. REAL(SiKi), INTENT(IN) :: XValIn !< X value to be found - + INTEGER :: AryLen ! Length of the arrays. REAL(SiKi) :: XVal !< X to be found (wrapped/periodic) - - + + AryLen = size(XAry) - + ! Wrap XValIn into the range XAry(1) to XAry(AryLen) XVal = MOD(XValIn, XAry(AryLen)) - - + + ! Let's check the limits first. IF ( XVal <= XAry(1) ) THEN @@ -5593,9 +5733,9 @@ SUBROUTINE GetWaveElevIndx( XValIn, XAry, Ind ) RETURN ELSE ! Set the Ind to the first index if we are at the beginning of XAry - IF ( XVal <= XAry(2) ) THEN + IF ( XVal <= XAry(2) ) THEN Ind = 1 - END IF + END IF END IF @@ -5614,7 +5754,7 @@ SUBROUTINE GetWaveElevIndx( XValIn, XAry, Ind ) Ind = Ind + 1 ELSE - + ! XAry(Ind) <= XVal < XAry(Ind+1) ! this would make it the "closest" node, but I'm not going to worry about that for visualization purposes !if ( XVal > (XAry(Ind+1) + XAry(Ind))/2.0_SiKi ) Ind = Ind + 1 @@ -5626,10 +5766,10 @@ SUBROUTINE GetWaveElevIndx( XValIn, XAry, Ind ) END DO RETURN -END SUBROUTINE GetWaveElevIndx +END SUBROUTINE GetWaveElevIndx !---------------------------------------------------------------------------------------------------------------------------------- !> This routine writes Input Mesh information to a binary file (for debugging). It both opens and closes the file. -SUBROUTINE WriteInputMeshesToFile(u_ED, u_AD, u_SD, u_HD, u_MAP, u_BD, FileName, ErrStat, ErrMsg) +SUBROUTINE WriteInputMeshesToFile(u_ED, u_AD, u_SD, u_HD, u_MAP, u_BD, FileName, ErrStat, ErrMsg) TYPE(ED_InputType), INTENT(IN) :: u_ED !< ElastoDyn inputs TYPE(AD_InputType), INTENT(IN) :: u_AD !< AeroDyn inputs TYPE(SD_InputType), INTENT(IN) :: u_SD !< SubDyn inputs @@ -5646,7 +5786,7 @@ SUBROUTINE WriteInputMeshesToFile(u_ED, u_AD, u_SD, u_HD, u_MAP, u_BD, FileName, INTEGER(B4Ki) :: NumBl ! Open the binary output file: - unOut=-1 + unOut=-1 CALL GetNewUnit( unOut, ErrStat, ErrMsg ) CALL OpenBOutFile ( unOut, TRIM(FileName), ErrStat, ErrMsg ) IF (ErrStat /= ErrID_None) RETURN @@ -5658,13 +5798,13 @@ SUBROUTINE WriteInputMeshesToFile(u_ED, u_AD, u_SD, u_HD, u_MAP, u_BD, FileName, WRITE( unOut, IOSTAT=ErrStat ) File_ID ! Add how many blade meshes there are: - NumBl = SIZE(u_ED%BladePtLoads,1) ! Note that NumBl is B4Ki + NumBl = SIZE(u_ED%BladePtLoads,1) ! Note that NumBl is B4Ki WRITE( unOut, IOSTAT=ErrStat ) NumBl - + ! Add all of the input meshes: DO K_local = 1,NumBl CALL MeshWrBin( unOut, u_ED%BladePtLoads(K_local), ErrStat, ErrMsg ) - END DO + END DO CALL MeshWrBin( unOut, u_ED%TowerPtLoads, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, u_ED%PlatformPtMesh, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, u_SD%TPMesh, ErrStat, ErrMsg ) @@ -5673,31 +5813,31 @@ SUBROUTINE WriteInputMeshesToFile(u_ED, u_AD, u_SD, u_HD, u_MAP, u_BD, FileName, CALL MeshWrBin( unOut, u_HD%WAMITMesh, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, u_MAP%PtFairDisplacement, ErrStat, ErrMsg ) ! Add how many BD blade meshes there are: - NumBl = SIZE(u_BD,1) ! Note that NumBl is B4Ki + NumBl = SIZE(u_BD,1) ! Note that NumBl is B4Ki WRITE( unOut, IOSTAT=ErrStat ) NumBl - + DO K_local = 1,NumBl CALL MeshWrBin( unOut, u_BD(K_local)%RootMotion, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, u_BD(K_local)%DistrLoad, ErrStat, ErrMsg ) - END DO - + END DO + ! Add how many AD blade meshes there are: - NumBl = SIZE(u_AD%BladeMotion,1) ! Note that NumBl is B4Ki + NumBl = SIZE(u_AD%rotors(1)%BladeMotion,1) ! Note that NumBl is B4Ki WRITE( unOut, IOSTAT=ErrStat ) NumBl - + DO K_local = 1,NumBl - CALL MeshWrBin( unOut, u_AD%BladeMotion(k_local), ErrStat, ErrMsg ) + CALL MeshWrBin( unOut, u_AD%rotors(1)%BladeMotion(k_local), ErrStat, ErrMsg ) END DO ! Close the file CLOSE(unOut) - -END SUBROUTINE WriteInputMeshesToFile + +END SUBROUTINE WriteInputMeshesToFile !---------------------------------------------------------------------------------------------------------------------------------- !> This routine writes motion mesh data to a binary file (for rudimentary visualization and debugging). If unOut < 0, a new file !! will be opened for writing (FileName). It is up to the caller of this routine to close the file. -SUBROUTINE WriteMotionMeshesToFile(time, y_ED, u_SD, y_SD, u_HD, u_MAP, y_BD, u_BD, UnOut, ErrStat, ErrMsg, FileName) - REAL(DbKi), INTENT(IN) :: time !< current simulation time +SUBROUTINE WriteMotionMeshesToFile(time, y_ED, u_SD, y_SD, u_HD, u_MAP, y_BD, u_BD, UnOut, ErrStat, ErrMsg, FileName) + REAL(DbKi), INTENT(IN) :: time !< current simulation time TYPE(ED_OutputType), INTENT(IN) :: y_ED !< ElastoDyn outputs TYPE(SD_InputType), INTENT(IN) :: u_SD !< SubDyn inputs TYPE(SD_OutputType), INTENT(IN) :: y_SD !< SubDyn outputs @@ -5707,46 +5847,46 @@ SUBROUTINE WriteMotionMeshesToFile(time, y_ED, u_SD, y_SD, u_HD, u_MAP, y_BD, u_ TYPE(BD_InputType), INTENT(IN) :: u_BD(:) !< BeamDyn inputs INTEGER(IntKi) , INTENT(INOUT) :: unOut !< Unit number to write where this info should be written. If unOut < 0, a new file will be opened and the opened unit number will be returned. CHARACTER(*), INTENT(IN) :: FileName !< If unOut < 0, FileName will be opened for writing this mesh information. - + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT(OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - + + REAL(R8Ki) :: t - + INTEGER(IntKi) :: K_local INTEGER(B4Ki), PARAMETER :: File_ID = 101 INTEGER(B4Ki) :: NumBl - + t = time ! convert to 8-bytes if necessary (DbKi might not be R8Ki) - + ! note that I'm not doing anything with the errors here, so it won't tell ! you there was a problem writing the data unless it was the last call. - - + + ! Open the binary output file and write a header: if (unOut<0) then CALL GetNewUnit( unOut, ErrStat, ErrMsg ) - + CALL OpenBOutFile ( unOut, TRIM(FileName), ErrStat, ErrMsg ) IF (ErrStat /= ErrID_None) RETURN - + ! Add a file identification number (in case we ever have to change this): WRITE( unOut, IOSTAT=ErrStat ) File_ID - + ! Add how many blade meshes there are: - NumBl = SIZE(y_ED%BladeLn2Mesh,1) ! Note that NumBl is B4Ki + NumBl = SIZE(y_ED%BladeLn2Mesh,1) ! Note that NumBl is B4Ki WRITE( unOut, IOSTAT=ErrStat ) NumBl - NumBl = SIZE(y_BD,1) ! Note that NumBl is B4Ki + NumBl = SIZE(y_BD,1) ! Note that NumBl is B4Ki WRITE( unOut, IOSTAT=ErrStat ) NumBl end if - - WRITE( unOut, IOSTAT=ErrStat ) t - + + WRITE( unOut, IOSTAT=ErrStat ) t + ! Add all of the meshes with motions: DO K_local = 1,SIZE(y_ED%BladeLn2Mesh,1) CALL MeshWrBin( unOut, y_ED%BladeLn2Mesh(K_local), ErrStat, ErrMsg ) - END DO + END DO CALL MeshWrBin( unOut, y_ED%TowerLn2Mesh, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, y_ED%PlatformPtMesh, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, u_SD%TPMesh, ErrStat, ErrMsg ) @@ -5757,24 +5897,24 @@ SUBROUTINE WriteMotionMeshesToFile(time, y_ED, u_SD, y_SD, u_HD, u_MAP, y_BD, u_ DO K_local = 1,SIZE(y_BD,1) CALL MeshWrBin( unOut, u_BD(K_local)%RootMotion, ErrStat, ErrMsg ) CALL MeshWrBin( unOut, y_BD(K_local)%BldMotion, ErrStat, ErrMsg ) - END DO - - ! + END DO + + ! ! ! Close the file !CLOSE(unOut) - ! -END SUBROUTINE WriteMotionMeshesToFile + ! +END SUBROUTINE WriteMotionMeshesToFile !---------------------------------------------------------------------------------------------------------------------------------- - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -! Linerization routines +! Linerization routines !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -!> Routine that calls FAST_Linearize_T for an array of Turbine data structures if the linearization flag is set for each individual turbine. +!> Routine that calls FAST_Linearize_T for an array of Turbine data structures if the linearization flag is set for each individual turbine. SUBROUTINE FAST_Linearize_Tary(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) REAL(DbKi), INTENT(IN ) :: t_initial !< initial simulation time (almost always 0) - INTEGER(IntKi), INTENT(IN ) :: n_t_global !< integer time step + INTEGER(IntKi), INTENT(IN ) :: n_t_global !< integer time step TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine(:) !< all data for one instance of a turbine INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -5783,30 +5923,30 @@ SUBROUTINE FAST_Linearize_Tary(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) INTEGER(IntKi) :: i_turb, NumTurbines INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Linearize_Tary' - - - NumTurbines = SIZE(Turbine) + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Linearize_Tary' + + + NumTurbines = SIZE(Turbine) ErrStat = ErrID_None ErrMsg = "" - + DO i_turb = 1,NumTurbines - + CALL FAST_Linearize_T(t_initial, n_t_global, Turbine(i_turb), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - + END DO - - + + END SUBROUTINE FAST_Linearize_Tary !---------------------------------------------------------------------------------------------------------------------------------- !> Routine that performs lineaization at an operating point for a turbine. This is a separate subroutine so that the FAST -!! driver programs do not need to change or operate on the individual module level. +!! driver programs do not need to change or operate on the individual module level. SUBROUTINE FAST_Linearize_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) REAL(DbKi), INTENT(IN ) :: t_initial !< initial simulation time (almost always 0) - INTEGER(IntKi), INTENT(IN ) :: n_t_global !< integer time step + INTEGER(IntKi), INTENT(IN ) :: n_t_global !< integer time step TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine !< all data for one instance of a turbine INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -5819,47 +5959,47 @@ SUBROUTINE FAST_Linearize_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Linearize_T' - + ErrStat = ErrID_None ErrMsg = "" - + if ( .not. Turbine%p_FAST%Linearize ) return - + if (.not. Turbine%p_FAST%CalcSteady) then - + if ( Turbine%m_FAST%Lin%NextLinTimeIndx <= Turbine%p_FAST%NLinTimes ) then !bjj: maybe this logic should go in FAST_Linearize_OP??? - + next_lin_time = Turbine%m_FAST%Lin%LinTimes( Turbine%m_FAST%Lin%NextLinTimeIndx ) t_global = t_initial + n_t_global*Turbine%p_FAST%dt - + if ( EqualRealNos( t_global, next_lin_time ) .or. t_global > next_lin_time ) then - + CALL FAST_Linearize_OP(t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD, Turbine%IfW, Turbine%OpFM, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & - Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat2, ErrMsg2 ) + Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - + if (Turbine%p_FAST%WrVTK == VTK_ModeShapes) then if (Turbine%m_FAST%Lin%NextLinTimeIndx > Turbine%p_FAST%NLinTimes) call WrVTKCheckpoint() end if - + end if end if - + else ! CalcSteady t_global = t_initial + n_t_global*Turbine%p_FAST%dt - + call FAST_CalcSteady( n_t_global, t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, Turbine%ED, Turbine%BD, Turbine%SrvD, & Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, & Turbine%Orca, Turbine%IceF, Turbine%IceD, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) if (Turbine%m_FAST%Lin%FoundSteady) then - + do iLinTime=1,Turbine%p_FAST%NLinTimes t_global = Turbine%m_FAST%Lin%LinTimes(iLinTime) @@ -5867,7 +6007,7 @@ SUBROUTINE FAST_Linearize_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) Turbine%AD, Turbine%IfW, Turbine%OpFM, Turbine%HD, Turbine%SD, Turbine%ExtPtfm, & Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, Turbine%IceF, Turbine%IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + if (Turbine%p_FAST%DT_UJac < Turbine%p_FAST%TMax) then Turbine%m_FAST%calcJacobian = .true. Turbine%m_FAST%NextJacCalcTime = t_global @@ -5882,72 +6022,72 @@ SUBROUTINE FAST_Linearize_T(t_initial, n_t_global, Turbine, ErrStat, ErrMsg) CALL FAST_Linearize_OP(t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD, Turbine%IfW, Turbine%OpFM, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & - Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat2, ErrMsg2 ) + Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - + end do if (Turbine%p_FAST%WrVTK == VTK_ModeShapes) CALL WrVTKCheckpoint() - + end if - + end if return - + contains subroutine WrVTKCheckpoint() ! we are creating a checkpoint file for each turbine, so setting NumTurbines=1 in the file CALL FAST_CreateCheckpoint_T(t_initial, Turbine%p_FAST%n_TMax_m1+1, 1, Turbine, TRIM(Turbine%p_FAST%OutFileRoot)//'.ModeShapeVTK', ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) end subroutine WrVTKCheckpoint -END SUBROUTINE FAST_Linearize_T +END SUBROUTINE FAST_Linearize_T !---------------------------------------------------------------------------------------------------------------------------------- - + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! PROGRAM EXIT ROUTINES !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !> Routine that calls ExitThisProgram for one instance of a Turbine data structure. This is a separate subroutine so that the FAST -!! driver programs do not need to change or operate on the individual module level. +!! driver programs do not need to change or operate on the individual module level. !! This routine should be called from glue code only (e.g., FAST_Prog.f90). It should not be called in any of these driver routines. SUBROUTINE ExitThisProgram_T( Turbine, ErrLevel_in, StopTheProgram, ErrLocMsg, SkipRunTimeMsg ) - + TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine !< Data for one turbine instance INTEGER(IntKi), INTENT(IN) :: ErrLevel_in !< Error level when Error == .TRUE. (required when Error is .TRUE.) LOGICAL, INTENT(IN) :: StopTheProgram !< flag indicating if the program should end (false if there are more turbines to end) CHARACTER(*), OPTIONAL, INTENT(IN) :: ErrLocMsg !< an optional message describing the location of the error LOGICAL, OPTIONAL, INTENT(IN) :: SkipRunTimeMsg !< an optional message describing run-time stats - + LOGICAL :: SkipRunTimes - + IF (PRESENT(SkipRunTimeMsg)) THEN SkipRunTimes = SkipRunTimeMsg ELSE SkipRunTimes = .FALSE. END IF - - + + IF (PRESENT(ErrLocMsg)) THEN - + CALL ExitThisProgram( Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrLevel_in, StopTheProgram, ErrLocMsg, SkipRunTimes ) - - ELSE - + + ELSE + CALL ExitThisProgram( Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & Turbine%ED, Turbine%BD, Turbine%SrvD, Turbine%AD14, Turbine%AD, Turbine%IfW, Turbine%OpFM, & Turbine%HD, Turbine%SD, Turbine%ExtPtfm, Turbine%MAP, Turbine%FEAM, Turbine%MD, Turbine%Orca, & Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrLevel_in, StopTheProgram, SkipRunTimeMsg=SkipRunTimes ) - + END IF END SUBROUTINE ExitThisProgram_T !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine is called when FAST exits. It calls all the modules' end routines and cleans up variables declared in the !! main program. If there was an error, it also aborts. Otherwise, it prints the run times and performs a normal exit. -!! This routine should not be called from glue code (e.g., FAST_Prog.f90) or ExitThisProgram_T only. It should not be called in any +!! This routine should not be called from glue code (e.g., FAST_Prog.f90) or ExitThisProgram_T only. It should not be called in any !! of these driver routines. SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrLevel_in, StopTheProgram, ErrLocMsg, SkipRunTimeMsg ) @@ -5957,7 +6097,7 @@ SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, TYPE(FAST_ParameterType), INTENT(INOUT) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -5983,35 +6123,35 @@ SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, LOGICAL, OPTIONAL, INTENT(IN) :: SkipRunTimeMsg !< an optional message describing run-time stats - ! Local variables: + ! Local variables: INTEGER(IntKi) :: ErrorLevel LOGICAL :: PrintRunTimes - + INTEGER(IntKi) :: ErrStat2 ! Error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message CHARACTER(1224) :: SimMsg ! optional message to print about where the error took place in the simulation - - CHARACTER(*), PARAMETER :: RoutineName = 'ExitThisProgram' - - + + CHARACTER(*), PARAMETER :: RoutineName = 'ExitThisProgram' + + ErrorLevel = ErrLevel_in - + ! for debugging, let's output the meshes and all of their fields IF ( ErrorLevel >= AbortErrLev .AND. p_FAST%WrVTK > VTK_None) THEN p_FAST%VTK_OutFileRoot = trim(p_FAST%VTK_OutFileRoot)//'.DebugError' p_FAST%VTK_fields = .true. CALL WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) end if - - - + + + ! End all modules CALL FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, ErrStat2, ErrMsg2 ) IF (ErrStat2 /= ErrID_None) THEN CALL WrScr( NewLine//RoutineName//':'//TRIM(ErrMsg2)//NewLine ) ErrorLevel = MAX(ErrorLevel,ErrStat2) END IF - + ! Destroy all data associated with FAST variables: CALL FAST_DestroyAll( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, OpFM, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, IceF, IceD, MeshMapData, ErrStat2, ErrMsg2 ) @@ -6020,33 +6160,33 @@ SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, ErrorLevel = MAX(ErrorLevel,ErrStat2) END IF - + !............................................................................................................................ ! Set exit error code if there was an error; !............................................................................................................................ IF ( ErrorLevel >= AbortErrLev ) THEN - + IF (PRESENT(ErrLocMsg)) THEN SimMsg = ErrLocMsg ELSE SimMsg = 'after the simulation completed' END IF - + IF (y_FAST%UnSum > 0) THEN CLOSE(y_FAST%UnSum) y_FAST%UnSum = -1 END IF - SimMsg = 'FAST encountered an error '//TRIM(SimMsg)//'.'//NewLine//' Simulation error level: '//TRIM(GetErrStr(ErrorLevel)) + SimMsg = TRIM(FAST_Ver%Name)//' encountered an error '//TRIM(SimMsg)//'.'//NewLine//' Simulation error level: '//TRIM(GetErrStr(ErrorLevel)) if (StopTheProgram) then CALL ProgAbort( trim(SimMsg), TrapErrors=.FALSE., TimeWait=3._ReKi ) ! wait 3 seconds (in case they double-clicked and got an error) else CALL WrScr(trim(SimMsg)) end if - + END IF - + !............................................................................................................................ ! Write simulation times and stop !............................................................................................................................ @@ -6055,7 +6195,7 @@ SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, else PrintRunTimes = .true. end if - + IF (p_FAST%WrSttsTime .and. PrintRunTimes) THEN CALL RunTimes( m_FAST%StrtTime, m_FAST%UsrTime1, m_FAST%SimStrtTime, m_FAST%UsrTime2, m_FAST%t_global, UnSum=y_FAST%UnSum, DescStrIn=p_FAST%TDesc ) END IF @@ -6068,9 +6208,9 @@ SUBROUTINE ExitThisProgram( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, #if (defined COMPILE_SIMULINK || defined COMPILE_LABVIEW) ! for Simulink, this may not be a normal stop. It might call this after an error in the model. CALL WrScr( NewLine//' '//TRIM(FAST_Ver%Name)//' completed.'//NewLine ) -#else +#else CALL NormStop( ) -#endif +#endif end if @@ -6116,20 +6256,20 @@ SUBROUTINE FAST_EndOutput( p_FAST, y_FAST, m_FAST, ErrStat, ErrMsg ) ! Close the text tabular output file and summary file (if opened) !------------------------------------------------------------------------------------------------- IF (y_FAST%UnOu > 0) THEN ! I/O unit number for the tabular output file - CLOSE( y_FAST%UnOu ) + CLOSE( y_FAST%UnOu ) y_FAST%UnOu = -1 END IF - + IF (y_FAST%UnSum > 0) THEN ! I/O unit number for the tabular output file - CLOSE( y_FAST%UnSum ) + CLOSE( y_FAST%UnSum ) y_FAST%UnSum = -1 END IF IF (y_FAST%UnGra > 0) THEN ! I/O unit number for the graphics output file - CLOSE( y_FAST%UnGra ) + CLOSE( y_FAST%UnGra ) y_FAST%UnGra = -1 END IF - + !------------------------------------------------------------------------------------------------- ! Deallocate arrays !------------------------------------------------------------------------------------------------- @@ -6149,7 +6289,7 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD TYPE(FAST_ParameterType), INTENT(INOUT) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -6165,25 +6305,25 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD TYPE(OrcaFlex_Data), INTENT(INOUT) :: Orca !< OrcaFlex interface data TYPE(IceFloe_Data), INTENT(INOUT) :: IceF !< IceFloe data TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables INTEGER(IntKi) :: i, k ! loop counter - + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FAST_EndMods' - + !............................................................................................................................... ! End all modules (and write binary FAST output file) !............................................................................................................................... ErrStat = ErrID_None ErrMsg = "" - - + + CALL FAST_EndOutput( p_FAST, y_FAST, m_FAST, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -6194,16 +6334,16 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD END IF IF ( p_FAST%ModuleInitialized(Module_BD) ) THEN - - DO k=1,p_FAST%nBeams + + DO k=1,p_FAST%nBeams CALL BD_End(BD%Input(1,k), BD%p(k), BD%x(k,STATE_CURR), BD%xd(k,STATE_CURR), BD%z(k,STATE_CURR), & BD%OtherSt(k,STATE_CURR), BD%y(k), BD%m(k), ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO - - END IF - - + + END IF + + IF ( p_FAST%ModuleInitialized(Module_AD14) ) THEN CALL AD14_End( AD14%Input(1), AD14%p, AD14%x(STATE_CURR), AD14%xd(STATE_CURR), AD14%z(STATE_CURR), & AD14%OtherSt(STATE_CURR), AD14%y, AD14%m, ErrStat2, ErrMsg2 ) @@ -6211,15 +6351,15 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD ELSEIF ( p_FAST%ModuleInitialized(Module_AD) ) THEN CALL AD_End( AD%Input(1), AD%p, AD%x(STATE_CURR), AD%xd(STATE_CURR), AD%z(STATE_CURR), & AD%OtherSt(STATE_CURR), AD%y, AD%m, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END IF - + IF ( p_FAST%ModuleInitialized(Module_IfW) ) THEN CALL InflowWind_End( IfW%Input(1), IfW%p, IfW%x(STATE_CURR), IfW%xd(STATE_CURR), IfW%z(STATE_CURR), IfW%OtherSt(STATE_CURR), & IfW%y, IfW%m, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - END IF - + END IF + IF ( p_FAST%ModuleInitialized(Module_SrvD) ) THEN CALL SrvD_End( SrvD%Input(1), SrvD%p, SrvD%x(STATE_CURR), SrvD%xd(STATE_CURR), SrvD%z(STATE_CURR), SrvD%OtherSt(STATE_CURR), & SrvD%y, SrvD%m, ErrStat2, ErrMsg2 ) @@ -6241,7 +6381,7 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD ExtPtfm%OtherSt(STATE_CURR), ExtPtfm%y, ExtPtfm%m, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END IF - + IF ( p_FAST%ModuleInitialized(Module_MAP) ) THEN CALL MAP_End( MAPp%Input(1), MAPp%p, MAPp%x(STATE_CURR), MAPp%xd(STATE_CURR), MAPp%z(STATE_CURR), MAPp%OtherSt, & MAPp%y, ErrStat2, ErrMsg2) @@ -6259,21 +6399,21 @@ SUBROUTINE FAST_EndMods( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, HD Orca%y, Orca%m, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END IF - + IF ( p_FAST%ModuleInitialized(Module_IceF) ) THEN CALL IceFloe_End(IceF%Input(1), IceF%p, IceF%x(STATE_CURR), IceF%xd(STATE_CURR), IceF%z(STATE_CURR), & IceF%OtherSt(STATE_CURR), IceF%y, IceF%m, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ELSEIF ( p_FAST%ModuleInitialized(Module_IceD) ) THEN - - DO i=1,p_FAST%numIceLegs + + DO i=1,p_FAST%numIceLegs CALL IceD_End(IceD%Input(1,i), IceD%p(i), IceD%x(i,STATE_CURR), IceD%xd(i,STATE_CURR), IceD%z(i,STATE_CURR), & IceD%OtherSt(i,STATE_CURR), IceD%y(i), IceD%m(i), ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) END DO - - END IF - + + END IF + END SUBROUTINE FAST_EndMods !---------------------------------------------------------------------------------------------------------------------------------- !> This routine calls the destroy routines for each module. (It is basically a duplicate of FAST_DestroyTurbineType().) @@ -6283,7 +6423,7 @@ SUBROUTINE FAST_DestroyAll( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, TYPE(FAST_ParameterType), INTENT(INOUT) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -6302,115 +6442,115 @@ SUBROUTINE FAST_DestroyAll( p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD14, AD, IfW, TYPE(IceDyn_Data), INTENT(INOUT) :: IceD !< All the IceDyn data used in time-step loop TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroyAll' - + ! ------------------------------------------------------------------------- ! Deallocate/Destroy structures associated with mesh mapping ! ------------------------------------------------------------------------- ErrStat = ErrID_None ErrMsg = "" - - - ! FAST + + + ! FAST CALL FAST_DestroyParam( p_FAST, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL FAST_DestroyOutputFileType( y_FAST, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL FAST_DestroyMisc( m_FAST, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + ! ElastoDyn CALL FAST_DestroyElastoDyn_Data( ED, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! BeamDyn CALL FAST_DestroyBeamDyn_Data( BD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! ServoDyn CALL FAST_DestroyServoDyn_Data( SrvD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! AeroDyn14 CALL FAST_DestroyAeroDyn14_Data( AD14, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ! AeroDyn CALL FAST_DestroyAeroDyn_Data( AD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! InflowWind CALL FAST_DestroyInflowWind_Data( IfW, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! OpenFOAM CALL FAST_DestroyOpenFOAM_Data( OpFM, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! HydroDyn CALL FAST_DestroyHydroDyn_Data( HD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! SubDyn CALL FAST_DestroySubDyn_Data( SD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! ExtPtfm CALL FAST_DestroyExtPtfm_Data( ExtPtfm, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - - ! MAP + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + + ! MAP CALL FAST_DestroyMAP_Data( MAPp, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - ! FEAMooring + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! FEAMooring CALL FAST_DestroyFEAMooring_Data( FEAM, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - ! MoorDyn + ! MoorDyn CALL FAST_DestroyMoorDyn_Data( MD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - ! Orca + ! Orca CALL FAST_DestroyOrcaFlex_Data( Orca, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! IceFloe CALL FAST_DestroyIceFloe_Data( IceF, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + ! IceDyn CALL FAST_DestroyIceDyn_Data( IceD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ! Module (Mesh) Mapping data CALL FAST_DestroyModuleMapType( MeshMapData, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - - + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + + END SUBROUTINE FAST_DestroyAll !---------------------------------------------------------------------------------------------------------------------------------- - - + + !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! CHECKPOINT/RESTART ROUTINES !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -!> Routine that calls FAST_CreateCheckpoint_T for an array of Turbine data structures. +!> Routine that calls FAST_CreateCheckpoint_T for an array of Turbine data structures. SUBROUTINE FAST_CreateCheckpoint_Tary(t_initial, n_t_global, Turbine, CheckpointRoot, ErrStat, ErrMsg) REAL(DbKi), INTENT(IN ) :: t_initial !< initial time @@ -6426,17 +6566,17 @@ SUBROUTINE FAST_CreateCheckpoint_Tary(t_initial, n_t_global, Turbine, Checkpoint INTEGER :: Unit INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CreateCheckpoint_Tary' - - - NumTurbines = SIZE(Turbine) + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CreateCheckpoint_Tary' + + + NumTurbines = SIZE(Turbine) ErrStat = ErrID_None ErrMsg = "" - + ! TRIM(CheckpointRoot)//'.'//TRIM(Num2LStr(Turbine%TurbID))// - + !! This allows us to put all the turbine data in one file. - Unit = -1 + Unit = -1 DO i_turb = 1,NumTurbines CALL FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine(i_turb), CheckpointRoot, ErrStat2, ErrMsg2, Unit ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -6444,13 +6584,13 @@ SUBROUTINE FAST_CreateCheckpoint_Tary(t_initial, n_t_global, Turbine, Checkpoint if (Unit > 0) close(Unit) RETURN end if - + END DO - - + + END SUBROUTINE FAST_CreateCheckpoint_Tary !---------------------------------------------------------------------------------------------------------------------------------- -!> Routine that packs all of the data from one turbine instance into arrays and writes checkpoint files. If Unit is present and +!> Routine that packs all of the data from one turbine instance into arrays and writes checkpoint files. If Unit is present and !! greater than 0, it will append the data to an already open file. Otherwise, it opens a new file and writes header information !! before writing the turbine data to the file. SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, CheckpointRoot, ErrStat, ErrMsg, Unit ) @@ -6465,28 +6605,28 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, CHARACTER(*), INTENT(IN ) :: CheckpointRoot !< Rootname of checkpoint file INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - INTEGER(IntKi), OPTIONAL, INTENT(INOUT) :: Unit !< unit number for output file - + INTEGER(IntKi), OPTIONAL, INTENT(INOUT) :: Unit !< unit number for output file + ! local variables: REAL(ReKi), ALLOCATABLE :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE :: IntKiBuf(:) - - INTEGER(B4Ki) :: ArraySizes(3) - - INTEGER(IntKi) :: unOut ! unit number for output file + + INTEGER(B4Ki) :: ArraySizes(3) + + INTEGER(IntKi) :: unOut ! unit number for output file INTEGER(IntKi) :: old_avrSwap1 ! previous value of avrSwap(1) !hack for Bladed DLL checkpoint/restore INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CreateCheckpoint_T' - + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CreateCheckpoint_T' + CHARACTER(1024) :: FileName ! Name of the (output) checkpoint file CHARACTER(1024) :: DLLFileName ! Name of the (output) checkpoint file - + ! init error status ErrStat = ErrID_None ErrMsg = "" - + ! Get the arrays of data to be stored in the output file CALL FAST_PackTurbineType( ReKiBuf, DbKiBuf, IntKiBuf, Turbine, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -6494,9 +6634,9 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, call cleanup() RETURN end if - - - ArraySizes = 0 + + + ArraySizes = 0 IF ( ALLOCATED(ReKiBuf) ) ArraySizes(1) = SIZE(ReKiBuf) IF ( ALLOCATED(DbKiBuf) ) ArraySizes(2) = SIZE(DbKiBuf) IF ( ALLOCATED(IntKiBuf) ) ArraySizes(3) = SIZE(IntKiBuf) @@ -6504,12 +6644,12 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, FileName = TRIM(CheckpointRoot)//'.chkp' DLLFileName = TRIM(CheckpointRoot)//'.dll.chkp' - unOut=-1 + unOut=-1 IF (PRESENT(Unit)) unOut = Unit - + IF ( unOut < 0 ) THEN - CALL GetNewUnit( unOut, ErrStat2, ErrMsg2 ) + CALL GetNewUnit( unOut, ErrStat2, ErrMsg2 ) CALL OpenBOutFile ( unOut, FileName, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) if (ErrStat >= AbortErrLev ) then @@ -6518,10 +6658,10 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, CLOSE(unOut) unOut = -1 END IF - + RETURN end if - + ! checkpoint file header: WRITE (unOut, IOSTAT=ErrStat2) INT(ReKi ,B4Ki) ! let's make sure we've got the correct number of bytes for reals on restart. WRITE (unOut, IOSTAT=ErrStat2) INT(DbKi ,B4Ki) ! let's make sure we've got the correct number of bytes for doubles on restart. @@ -6530,39 +6670,39 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, WRITE (unOut, IOSTAT=ErrStat2) NumTurbines ! Number of turbines WRITE (unOut, IOSTAT=ErrStat2) t_initial ! initial time WRITE (unOut, IOSTAT=ErrStat2) n_t_global ! current time step - + END IF - - + + ! data from current turbine at time step: WRITE (unOut, IOSTAT=ErrStat2) ArraySizes ! Number of reals, doubles, and integers written to file WRITE (unOut, IOSTAT=ErrStat2) ReKiBuf ! Packed reals WRITE (unOut, IOSTAT=ErrStat2) DbKiBuf ! Packed doubles WRITE (unOut, IOSTAT=ErrStat2) IntKiBuf ! Packed integers - - + + IF ( ALLOCATED(ReKiBuf) ) DEALLOCATE(ReKiBuf) IF ( ALLOCATED(DbKiBuf) ) DEALLOCATE(DbKiBuf) IF ( ALLOCATED(IntKiBuf) ) DEALLOCATE(IntKiBuf) - + !CALL FAST_CreateCheckpoint(t_initial, n_t_global, Turbine%p_FAST, Turbine%y_FAST, Turbine%m_FAST, & ! Turbine%ED, Turbine%SrvD, Turbine%AD, Turbine%IfW, & ! Turbine%HD, Turbine%SD, Turbine%MAP, Turbine%FEAM, Turbine%MD, & - ! Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) - - + ! Turbine%IceF, Turbine%IceD, Turbine%MeshMapData, ErrStat, ErrMsg ) + + IF (Turbine%TurbID == NumTurbines .OR. .NOT. PRESENT(Unit)) THEN CLOSE(unOut) unOut = -1 END IF - + IF (PRESENT(Unit)) Unit = unOut - + ! A hack to pack Bladed-style DLL data IF (Turbine%SrvD%p%UseBladedInterface) THEN if (Turbine%SrvD%m%dll_data%avrSWAP( 1) > 0 ) then ! store value to be overwritten - old_avrSwap1 = Turbine%SrvD%m%dll_data%avrSWAP( 1) + old_avrSwap1 = Turbine%SrvD%m%dll_data%avrSWAP( 1) FileName = Turbine%SrvD%m%dll_data%DLL_InFile ! overwrite values: Turbine%SrvD%m%dll_data%DLL_InFile = DLLFileName @@ -6577,25 +6717,25 @@ SUBROUTINE FAST_CreateCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, Turbine%SrvD%m%dll_data%avrSWAP(50) = REAL( LEN_TRIM(FileName) ) +1 ! No. of characters in the "INFILE" argument (-) (we add one for the C NULL CHARACTER) Turbine%SrvD%m%dll_data%avrSWAP( 1) = old_avrSwap1 Turbine%SrvD%m%dll_data%SimStatus = Turbine%SrvD%m%dll_data%avrSWAP( 1) - end if + end if END IF - + call cleanup() - + contains subroutine cleanup() IF ( ALLOCATED(ReKiBuf) ) DEALLOCATE(ReKiBuf) IF ( ALLOCATED(DbKiBuf) ) DEALLOCATE(DbKiBuf) - IF ( ALLOCATED(IntKiBuf) ) DEALLOCATE(IntKiBuf) - end subroutine cleanup + IF ( ALLOCATED(IntKiBuf) ) DEALLOCATE(IntKiBuf) + end subroutine cleanup END SUBROUTINE FAST_CreateCheckpoint_T !---------------------------------------------------------------------------------------------------------------------------------- -!> Routine that calls FAST_RestoreFromCheckpoint_T for an array of Turbine data structures. +!> Routine that calls FAST_RestoreFromCheckpoint_T for an array of Turbine data structures. SUBROUTINE FAST_RestoreFromCheckpoint_Tary(t_initial, n_t_global, Turbine, CheckpointRoot, ErrStat, ErrMsg ) REAL(DbKi), INTENT(IN ) :: t_initial !< initial time (for comparing with time from checkpoint file) INTEGER(IntKi), INTENT( OUT) :: n_t_global !< loop counter - TYPE(FAST_TurbineType), INTENT( OUT) :: Turbine(:) !< all data for one instance of a turbine + TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine(:) !< all data for one instance of a turbine !intent(INOUT) instead of (IN) to attempt to avoid memory warnings in gnu compilers CHARACTER(*), INTENT(IN ) :: CheckpointRoot !< Rootname of checkpoint file INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -6608,18 +6748,18 @@ SUBROUTINE FAST_RestoreFromCheckpoint_Tary(t_initial, n_t_global, Turbine, Check INTEGER :: Unit INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreFromCheckpoint_Tary' - - - NumTurbines = SIZE(Turbine) + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreFromCheckpoint_Tary' + + + NumTurbines = SIZE(Turbine) ErrStat = ErrID_None ErrMsg = "" - + ! Init NWTC_Library, display copyright and version information: CALL FAST_ProgStart( FAST_Ver ) - + ! Restore data from checkpoint file - Unit = -1 + Unit = -1 DO i_turb = 1,NumTurbines CALL FAST_RestoreFromCheckpoint_T(t_initial_out, n_t_global, NumTurbines_out, Turbine(i_turb), CheckpointRoot, ErrStat2, ErrMsg2, Unit ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -6630,11 +6770,11 @@ SUBROUTINE FAST_RestoreFromCheckpoint_Tary(t_initial, n_t_global, Turbine, Check END DO CALL WrScr( ' Restarting simulation at '//TRIM(Num2LStr(n_t_global*Turbine(1)%p_FAST%DT))//' seconds.' ) - - + + END SUBROUTINE FAST_RestoreFromCheckpoint_Tary !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine is the inverse of FAST_CreateCheckpoint_T. It reads data from a checkpoint file and populates data structures for +!> This routine is the inverse of FAST_CreateCheckpoint_T. It reads data from a checkpoint file and populates data structures for !! the turbine instance. SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turbine, CheckpointRoot, ErrStat, ErrMsg, Unit ) USE BladedInterface, ONLY: CallBladedDLL ! Hack for Bladed-style DLL @@ -6647,45 +6787,45 @@ SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turb CHARACTER(*), INTENT(IN ) :: CheckpointRoot !< Rootname of checkpoint file INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - INTEGER(IntKi), OPTIONAL, INTENT(INOUT) :: Unit !< unit number for output file - + INTEGER(IntKi), OPTIONAL, INTENT(INOUT) :: Unit !< unit number for output file + ! local variables: REAL(ReKi), ALLOCATABLE :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE :: IntKiBuf(:) - - INTEGER(B4Ki) :: ArraySizes(3) - - INTEGER(IntKi) :: unIn ! unit number for input file + + INTEGER(B4Ki) :: ArraySizes(3) + + INTEGER(IntKi) :: unIn ! unit number for input file INTEGER(IntKi) :: old_avrSwap1 ! previous value of avrSwap(1) !hack for Bladed DLL checkpoint/restore INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreFromCheckpoint_T' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreFromCheckpoint_T' CHARACTER(1024) :: FileName ! Name of the (input) checkpoint file CHARACTER(1024) :: DLLFileName ! Name of the (input) checkpoint file - + ErrStat=ErrID_None ErrMsg="" - + FileName = TRIM(CheckpointRoot)//'.chkp' DLLFileName = TRIM(CheckpointRoot)//'.dll.chkp' - ! FileName = TRIM(CheckpointRoot)//'.cp' - unIn=-1 + ! FileName = TRIM(CheckpointRoot)//'.cp' + unIn=-1 IF (PRESENT(Unit)) unIn = Unit - + IF ( unIn < 0 ) THEN - + CALL GetNewUnit( unIn, ErrStat2, ErrMsg2 ) - + CALL OpenBInpFile ( unIn, FileName, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev ) RETURN - + ! checkpoint file header: READ (unIn, IOSTAT=ErrStat2) ArraySizes ! let's make sure we've got the correct number of bytes for reals, doubles, and integers on restart. - + IF ( ArraySizes(1) /= ReKi ) CALL SetErrStat(ErrID_Fatal,"ReKi on restart is different than when checkpoint file was created.",ErrStat,ErrMsg,RoutineName) IF ( ArraySizes(2) /= DbKi ) CALL SetErrStat(ErrID_Fatal,"DbKi on restart is different than when checkpoint file was created.",ErrStat,ErrMsg,RoutineName) IF ( ArraySizes(3) /= IntKi ) CALL SetErrStat(ErrID_Fatal,"IntKi on restart is different than when checkpoint file was created.",ErrStat,ErrMsg,RoutineName) @@ -6695,75 +6835,75 @@ SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turb IF (PRESENT(Unit)) Unit = unIn RETURN END IF - + READ (unIn, IOSTAT=ErrStat2) AbortErrLev READ (unIn, IOSTAT=ErrStat2) NumTurbines ! Number of turbines READ (unIn, IOSTAT=ErrStat2) t_initial ! initial time READ (unIn, IOSTAT=ErrStat2) n_t_global ! current time step - + END IF - + ! in case the Turbine data structure isn't empty on entry of this routine: - call FAST_DestroyTurbineType( Turbine, ErrStat2, ErrMsg2 ) - + call FAST_DestroyTurbineType( Turbine, ErrStat2, ErrMsg2 ) + ! data from current time step: READ (unIn, IOSTAT=ErrStat2) ArraySizes ! Number of reals, doubles, and integers written to file - + ALLOCATE(ReKiBuf( ArraySizes(1)), STAT=ErrStat2) IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not allocate ReKiBuf", ErrStat, ErrMsg, RoutineName ) ALLOCATE(DbKiBuf( ArraySizes(2)), STAT=ErrStat2) IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not allocate DbKiBuf", ErrStat, ErrMsg, RoutineName ) ALLOCATE(IntKiBuf(ArraySizes(3)), STAT=ErrStat2) IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not allocate IntKiBuf", ErrStat, ErrMsg, RoutineName ) - + ! Read the packed arrays IF (ErrStat < AbortErrLev) THEN - + READ (unIn, IOSTAT=ErrStat2) ReKiBuf ! Packed reals - IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read ReKiBuf", ErrStat, ErrMsg, RoutineName ) + IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read ReKiBuf", ErrStat, ErrMsg, RoutineName ) READ (unIn, IOSTAT=ErrStat2) DbKiBuf ! Packed doubles - IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read DbKiBuf", ErrStat, ErrMsg, RoutineName ) + IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read DbKiBuf", ErrStat, ErrMsg, RoutineName ) READ (unIn, IOSTAT=ErrStat2) IntKiBuf ! Packed integers - IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read IntKiBuf", ErrStat, ErrMsg, RoutineName ) - + IF (ErrStat2 /=0) CALL SetErrStat(ErrID_Fatal, "Could not read IntKiBuf", ErrStat, ErrMsg, RoutineName ) + END IF - + ! Put the arrays back in the data types IF (ErrStat < AbortErrLev) THEN CALL FAST_UnpackTurbineType( ReKiBuf, DbKiBuf, IntKiBuf, Turbine, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - - ! close file if necessary (do this after unpacking turbine data, so that TurbID is set) + + + ! close file if necessary (do this after unpacking turbine data, so that TurbID is set) IF (Turbine%TurbID == NumTurbines .OR. .NOT. PRESENT(Unit)) THEN CLOSE(unIn) unIn = -1 END IF - + IF (PRESENT(Unit)) Unit = unIn - - + + IF ( ALLOCATED(ReKiBuf) ) DEALLOCATE(ReKiBuf) IF ( ALLOCATED(DbKiBuf) ) DEALLOCATE(DbKiBuf) - IF ( ALLOCATED(IntKiBuf) ) DEALLOCATE(IntKiBuf) - - + IF ( ALLOCATED(IntKiBuf) ) DEALLOCATE(IntKiBuf) + + ! A sort-of hack to restore MAP DLL data (in particular Turbine%MAP%OtherSt%C_Obj%object) ! these must be the same variables that are used in MAP_Init because they get allocated in the DLL and ! destroyed in MAP_End (also, inside the DLL) IF (Turbine%p_FAST%CompMooring == Module_MAP) THEN CALL MAP_Restart( Turbine%MAP%Input(1), Turbine%MAP%p, Turbine%MAP%x(STATE_CURR), Turbine%MAP%xd(STATE_CURR), & - Turbine%MAP%z(STATE_CURR), Turbine%MAP%OtherSt, Turbine%MAP%y, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Turbine%MAP%z(STATE_CURR), Turbine%MAP%OtherSt, Turbine%MAP%y, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - - + + ! A hack to restore Bladed-style DLL data if (Turbine%SrvD%p%UseBladedInterface) then if (Turbine%SrvD%m%dll_data%avrSWAP( 1) > 0 ) then ! this isn't allocated if UseBladedInterface is FALSE ! store value to be overwritten - old_avrSwap1 = Turbine%SrvD%m%dll_data%avrSWAP( 1) + old_avrSwap1 = Turbine%SrvD%m%dll_data%avrSWAP( 1) FileName = Turbine%SrvD%m%dll_data%DLL_InFile ! overwrite values before calling DLL: Turbine%SrvD%m%dll_data%DLL_InFile = DLLFileName @@ -6771,18 +6911,18 @@ SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turb Turbine%SrvD%m%dll_data%avrSWAP( 1) = GH_DISCON_STATUS_RESTARTING Turbine%SrvD%m%dll_data%SimStatus = Turbine%SrvD%m%dll_data%avrSWAP( 1) CALL CallBladedDLL(Turbine%SrvD%Input(1), Turbine%SrvD%p, Turbine%SrvD%m%dll_data, ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ! put values back: Turbine%SrvD%m%dll_data%DLL_InFile = FileName Turbine%SrvD%m%dll_data%avrSWAP(50) = REAL( LEN_TRIM(FileName) ) +1 ! No. of characters in the "INFILE" argument (-) (we add one for the C NULL CHARACTER) Turbine%SrvD%m%dll_data%avrSWAP( 1) = old_avrSwap1 Turbine%SrvD%m%dll_data%SimStatus = Turbine%SrvD%m%dll_data%avrSWAP( 1) - end if - end if - + end if + end if + ! deal with sibling meshes here: ! (ignoring for now; they are not going to be siblings on restart) - + ! deal with files that were open: IF (Turbine%p_FAST%WrTxtOutFile) THEN CALL OpenFunkFileAppend ( Turbine%y_FAST%UnOu, TRIM(Turbine%p_FAST%OutFileRoot)//'.out', ErrStat2, ErrMsg2) @@ -6792,17 +6932,17 @@ SUBROUTINE FAST_RestoreFromCheckpoint_T(t_initial, n_t_global, NumTurbines, Turb WRITE(Turbine%y_FAST%UnOu, '()') END IF ! (ignoring for now; will have fort.x files if any were open [though I printed a warning about not outputting binary files earlier]) - + END SUBROUTINE FAST_RestoreFromCheckpoint_T !---------------------------------------------------------------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------------------------------------- -!> Routine that calls FAST_RestoreForVTKModeShape_T for an array of Turbine data structures. +!> Routine that calls FAST_RestoreForVTKModeShape_T for an array of Turbine data structures. SUBROUTINE FAST_RestoreForVTKModeShape_Tary(t_initial, Turbine, InputFileName, ErrStat, ErrMsg ) REAL(DbKi), INTENT(IN ) :: t_initial !< initial time (for comparing with time from checkpoint file) - TYPE(FAST_TurbineType), INTENT( OUT) :: Turbine(:) !< all data for one instance of a turbine + TYPE(FAST_TurbineType), INTENT(INOUT) :: Turbine(:) !< all data for one instance of a turbine !intent(INOUT) instead of (IN) to attempt to avoid memory warnings in gnu compilers CHARACTER(*), INTENT(IN ) :: InputFileName !< Name of the input file INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -6814,8 +6954,8 @@ SUBROUTINE FAST_RestoreForVTKModeShape_Tary(t_initial, Turbine, InputFileName, E INTEGER(IntKi) :: ErrStat2 ! local error status CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreForVTKModeShape_Tary' - - + + ErrStat = ErrID_None ErrMsg = "" @@ -6824,12 +6964,12 @@ SUBROUTINE FAST_RestoreForVTKModeShape_Tary(t_initial, Turbine, InputFileName, E call SetErrStat(ErrID_Fatal, "Mode-shape visualization is not available for multiple turbines.", ErrStat, ErrMsg, RoutineName) return end if - + CALL ReadModeShapeFile( Turbine(1)%p_FAST, trim(InputFileName), ErrStat2, ErrMsg2, checkpointOnly=.true. ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) if (ErrStat >= AbortErrLev) return - + CALL FAST_RestoreFromCheckpoint_Tary( t_initial, n_t_global, Turbine, trim(Turbine(1)%p_FAST%VTK_modes%CheckpointRoot), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) @@ -6839,7 +6979,7 @@ SUBROUTINE FAST_RestoreForVTKModeShape_Tary(t_initial, Turbine, InputFileName, E call SetErrStat(ErrID_Fatal, "Mode-shape visualization requires a checkpoint file from a simulation with linearization analysis, but NLinTimes is 0.", ErrStat, ErrMsg, RoutineName) return end if - + CALL FAST_RestoreForVTKModeShape_T(t_initial, Turbine(i_turb)%p_FAST, Turbine(i_turb)%y_FAST, Turbine(i_turb)%m_FAST, & Turbine(i_turb)%ED, Turbine(i_turb)%BD, Turbine(i_turb)%SrvD, Turbine(i_turb)%AD14, Turbine(i_turb)%AD, Turbine(i_turb)%IfW, Turbine(i_turb)%OpFM, & Turbine(i_turb)%HD, Turbine(i_turb)%SD, Turbine(i_turb)%ExtPtfm, Turbine(i_turb)%MAP, Turbine(i_turb)%FEAM, Turbine(i_turb)%MD, Turbine(i_turb)%Orca, & @@ -6847,7 +6987,7 @@ SUBROUTINE FAST_RestoreForVTKModeShape_Tary(t_initial, Turbine, InputFileName, E CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END DO - + END SUBROUTINE FAST_RestoreForVTKModeShape_Tary !---------------------------------------------------------------------------------------------------------------------------------- @@ -6860,7 +7000,7 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, TYPE(FAST_ParameterType), INTENT(INOUT) :: p_FAST !< Parameters for the glue code TYPE(FAST_OutputFileType),INTENT(INOUT) :: y_FAST !< Output variables for the glue code TYPE(FAST_MiscVarType), INTENT(INOUT) :: m_FAST !< Miscellaneous variables - + TYPE(ElastoDyn_Data), INTENT(INOUT) :: ED !< ElastoDyn data TYPE(BeamDyn_Data), INTENT(INOUT) :: BD !< BeamDyn data TYPE(ServoDyn_Data), INTENT(INOUT) :: SrvD !< ServoDyn data @@ -6880,21 +7020,21 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, TYPE(FAST_ModuleMapType), INTENT(INOUT) :: MeshMapData !< Data for mapping between modules CHARACTER(*), INTENT(IN ) :: InputFileName !< Name of the input file - + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables REAL(DbKi) :: dt ! time REAL(DbKi) :: tprime ! time - INTEGER(IntKi) :: nt - + INTEGER(IntKi) :: nt + INTEGER(IntKi) :: iLinTime ! generic loop counters INTEGER(IntKi) :: it ! generic loop counters INTEGER(IntKi) :: iMode ! generic loop counters INTEGER(IntKi) :: ModeNo ! mode number INTEGER(IntKi) :: NLinTimes - + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'FAST_RestoreForVTKModeShape_T' @@ -6903,31 +7043,31 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, ErrStat = ErrID_None ErrMsg = "" - + CALL ReadModeShapeFile( p_FAST, trim(InputFileName), ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - if (ErrStat >= AbortErrLev) return - + if (ErrStat >= AbortErrLev) return + call ReadModeShapeMatlabFile( p_FAST, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) if (ErrStat >= AbortErrLev ) return - + y_FAST%WriteThisStep = .true. y_FAST%UnSum = -1 - + NLinTimes = min( p_FAST%VTK_modes%VTKNLinTimes, size(p_FAST%VTK_modes%x_eig_magnitude,2), p_FAST%NLinTimes ) VTK_RootName = p_FAST%VTK_OutFileRoot - + select case (p_FAST%VTK_modes%VTKLinTim) case (1) - + do iMode = 1,p_FAST%VTK_modes%VTKLinModes ModeNo = p_FAST%VTK_modes%VTKModes(iMode) - + call GetTimeConstants(p_FAST%VTK_modes%DampedFreq_Hz(ModeNo), p_FAST%VTK_fps, nt, dt, p_FAST%VTK_tWidth ) if (nt > 500) cycle - + p_FAST%VTK_OutFileRoot = trim(VTK_RootName)//'.Mode'//trim(num2lstr(ModeNo)) y_FAST%VTK_count = 1 ! we are skipping the reference meshes by starting at 1 do iLinTime = 1,NLinTimes @@ -6957,15 +7097,15 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, end do ! iLinTime end do ! iMode - + case (2) - + do iMode = 1,p_FAST%VTK_modes%VTKLinModes ModeNo = p_FAST%VTK_modes%VTKModes(iMode) call GetTimeConstants(p_FAST%VTK_modes%DampedFreq_Hz(ModeNo), p_FAST%VTK_fps, nt, dt, p_FAST%VTK_tWidth ) if (nt > 500) cycle - + do iLinTime = 1,NLinTimes p_FAST%VTK_OutFileRoot = trim(VTK_RootName)//'.Mode'//trim(num2lstr(ModeNo))//'.LinTime'//trim(num2lstr(iLinTime)) y_FAST%VTK_count = 1 ! we are skipping the reference meshes by starting at 1 @@ -6974,14 +7114,14 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, m_FAST%calcJacobian = .true. m_FAST%NextJacCalcTime = m_FAST%Lin%LinTimes(iLinTime) end if - + do it = 1,nt tprime = (it-1)*dt - + call SetOperatingPoint(iLinTime, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, AD, IfW, OpFM, HD, SD, ExtPtfm, & MAPp, FEAM, MD, Orca, IceF, IceD, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! set perturbation of states based on x_eig magnitude and phase call PerturbOP(tprime, iLinTime, ModeNo, p_FAST, y_FAST, ED, BD, SrvD, AD, IfW, OpFM, HD, SD, ExtPtfm, MAPp, FEAM, MD, Orca, & IceF, IceD, ErrStat2, ErrMsg2 ) @@ -6996,13 +7136,13 @@ SUBROUTINE FAST_RestoreForVTKModeShape_T(t_initial, p_FAST, y_FAST, m_FAST, ED, call WriteVTK(m_FAST%Lin%LinTimes(iLinTime)+tprime, p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, HD, SD, ExtPtfm, SrvD, MAPp, FEAM, MD, Orca, IceF, IceD) end do - - + + end do ! iLinTime end do ! iMode - + end select - + END SUBROUTINE FAST_RestoreForVTKModeShape_T !---------------------------------------------------------------------------------------------------------------------------------- SUBROUTINE GetTimeConstants(DampedFreq_Hz, VTK_fps, nt, dt, VTK_tWidth ) @@ -7011,43 +7151,43 @@ SUBROUTINE GetTimeConstants(DampedFreq_Hz, VTK_fps, nt, dt, VTK_tWidth ) INTEGER(IntKi), INTENT( OUT) :: nt !< number of steps REAL(DbKi), INTENT( OUT) :: dt !< time step INTEGER(IntKi), INTENT( OUT) :: VTK_tWidth - + REAL(DbKi) :: cycle_time ! time for one cycle of mode INTEGER(IntKi) :: NCycles INTEGER(IntKi), PARAMETER :: MinFrames = 5 - + if (DampedFreq_Hz <= 0.0_DbKi) then nt = huge(nt) dt = epsilon(dt) VTK_tWidth = 1 return end if - + nt = 1 NCycles = 0 do while (nt= AbortErrLev) RETURN - + ! Process the requested data records of this file. CALL WrScr ( NewLine//' =======================================================' ) @@ -7077,26 +7217,26 @@ SUBROUTINE ReadModeShapeMatlabFile(p_FAST, ErrStat, ErrMsg) IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading FileType from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN - ENDIF + ENDIF READ (UnIn, IOSTAT=ErrStat2) nModes ! number of modes in the file IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading nModes from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN - ENDIF + ENDIF READ (UnIn, IOSTAT=ErrStat2) nStates ! number of states in the file IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading nStates from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN - ENDIF + ENDIF READ (UnIn, IOSTAT=ErrStat2) NLinTimes ! number of linearization times / azimuths in the file IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading NLinTimes from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN - ENDIF - + ENDIF + ALLOCATE( p_FAST%VTK_Modes%NaturalFreq_Hz(nModes), & p_FAST%VTK_Modes%DampingRatio( nModes), & p_FAST%VTK_Modes%DampedFreq_Hz( nModes), STAT=ErrStat2 ) @@ -7105,13 +7245,13 @@ SUBROUTINE ReadModeShapeMatlabFile(p_FAST, ErrStat, ErrMsg) RETURN ENDIF - + READ(UnIn, IOSTAT=ErrStat2) p_FAST%VTK_Modes%NaturalFreq_Hz ! read entire array IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading NaturalFreq_Hz array from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN ENDIF - + READ(UnIn, IOSTAT=ErrStat2) p_FAST%VTK_Modes%DampingRatio ! read entire array IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading DampingRatio array from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) @@ -7123,29 +7263,29 @@ SUBROUTINE ReadModeShapeMatlabFile(p_FAST, ErrStat, ErrMsg) CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading DampedFreq_Hz array from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN ENDIF - + if (nModes < p_FAST%VTK_Modes%VTKLinModes) CALL SetErrStat(ErrID_Severe,'Number of modes requested exceeds the number of modes in the linearization analysis file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName) if (NLinTimes /= p_FAST%NLinTimes) CALL SetErrStat(ErrID_Severe,'Number of times linearization was performed is not the same as the number of linearization times in the linearization analysis file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName) - - + + !Let's read only the number of modes we need to use nModes = min( nModes, p_FAST%VTK_Modes%VTKLinModes ) - + ALLOCATE( p_FAST%VTK_Modes%x_eig_magnitude(nStates, NLinTimes, nModes), & p_FAST%VTK_Modes%x_eig_phase( nStates, NLinTimes, nModes), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Error allocating arrays to read from file.', ErrStat, ErrMsg, RoutineName ) RETURN ENDIF - + do iMode = 1,nModes - + READ(UnIn, IOSTAT=ErrStat2) p_FAST%VTK_Modes%x_eig_magnitude(:,:,iMode) ! read data for one mode IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading x_eig_magnitude from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) RETURN ENDIF - + READ(UnIn, IOSTAT=ErrStat2) p_FAST%VTK_Modes%x_eig_phase(:,:,iMode) ! read data for one mode IF ( ErrStat2 /= 0 ) THEN CALL SetErrStat ( ErrID_Fatal, 'Fatal error reading x_eig_phase from file "'//TRIM( p_FAST%VTK_modes%MatlabFileName )//'".', ErrStat, ErrMsg, RoutineName ) @@ -7162,12 +7302,12 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None LOGICAL, OPTIONAL, INTENT(IN ) :: checkpointOnly !< Whether to return after reading checkpoint file name - + ! local variables INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'ReadModeShapeFile' - + CHARACTER(1024) :: PriPath ! Path name of the primary file INTEGER(IntKi) :: i INTEGER(IntKi) :: UnIn @@ -7179,38 +7319,38 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) UnEc = -1 CALL GetPath( InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. - + ! Open data file. CALL GetNewUnit( UnIn, ErrStat2, ErrMsg2 ) CALL OpenFInpFile ( UnIn, InputFile, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - - + + CALL ReadCom( UnIn, InputFile, 'File header: (line 1)', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL ReadCom( UnIn, InputFile, 'File header: (line 2)', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + !----------- FILE NAMES ---------------------------------------------------- CALL ReadCom( UnIn, InputFile, 'Section Header: File Names', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%CheckpointRoot, 'CheckpointRoot', 'Name of the checkpoint file written by FAST when linearization data was produced', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + IF ( PathIsRelative( p_FAST%VTK_modes%CheckpointRoot ) ) p_FAST%VTK_modes%CheckpointRoot = TRIM(PriPath)//TRIM(p_FAST%VTK_modes%CheckpointRoot) - + if (present(checkpointOnly)) then if (checkpointOnly) then call cleanup() return end if end if - - + + CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%MatlabFileName, 'MatlabFileName', 'Name of the file with eigenvectors written by Matlab', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF ( ErrStat >= AbortErrLev ) THEN @@ -7218,15 +7358,15 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) RETURN END IF IF ( PathIsRelative( p_FAST%VTK_modes%MatlabFileName ) ) p_FAST%VTK_modes%MatlabFileName = TRIM(PriPath)//TRIM(p_FAST%VTK_modes%MatlabFileName) - + !----------- VISUALIZATION OPTIONS ------------------------------------------ - + CALL ReadCom( UnIn, InputFile, 'Section Header: Visualization Options', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%VTKLinModes, 'VTKLinModes', 'Number of modes to visualize', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + if (p_FAST%VTK_modes%VTKLinModes <= 0) CALL SetErrStat( ErrID_Fatal, "VTKLinModes must be a positive number.", ErrStat, ErrMsg, RoutineName ) @@ -7235,7 +7375,7 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) RETURN end if - + call AllocAry( p_FAST%VTK_modes%VTKModes, p_FAST%VTK_modes%VTKLinModes, 'VTKModes', ErrStat2, ErrMsg2) call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) if ( ErrStat >= AbortErrLev ) then @@ -7244,7 +7384,7 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) end if p_FAST%VTK_modes%VTKModes = -1 - + CALL ReadAry( UnIn, InputFile, p_FAST%VTK_modes%VTKModes, p_FAST%VTK_modes%VTKLinModes, 'VTKModes', 'List of modes to visualize', ErrStat2, ErrMsg2, UnEc ) ! note that we don't check the ErrStat here; if the user entered fewer than p_FAST%VTK_modes%VTKLinModes values, we will use the ! last entry to fill in remaining values. @@ -7264,22 +7404,22 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%VTKLinScale, 'VTKLinScale', 'Mode shape visualization scaling factor', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%VTKLinTim, 'VTKLinTim', 'Switch to make one animation for all LinTimes together (1) or separate animations for each LinTimes(2)', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL ReadVar( UnIn, InputFile, VTKLinTimes1, 'VTKLinTimes1', 'If VTKLinTim=2, visualize modes at LinTimes(1) only?', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + CALL ReadVar( UnIn, InputFile, p_FAST%VTK_modes%VTKLinPhase, 'VTKLinPhase', 'Phase when making one animation for all LinTimes together (used only when VTKLinTim=1)', ErrStat2, ErrMsg2, UnEc ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + ! overwrite these based on inputs: - + if (p_FAST%VTK_modes%VTKLinTim == 2) then p_FAST%VTK_modes%VTKLinPhase = 0 ! "Phase when making one animation for all LinTimes together (used only when VTKLinTim=1)" - - + if (VTKLinTimes1) then p_FAST%VTK_modes%VTKNLinTimes = 1 else @@ -7288,7 +7428,7 @@ SUBROUTINE ReadModeShapeFile(p_FAST, InputFile, ErrStat, ErrMsg, checkpointOnly) else p_FAST%VTK_modes%VTKNLinTimes = p_FAST%NLinTimes end if - + contains SUBROUTINE Cleanup() IF (UnIn > 0) CLOSE(UnIn) diff --git a/modules/openfast-library/src/FAST_Types.f90 b/modules/openfast-library/src/FAST_Types.f90 index 60c5d07915..e1951d296f 100644 --- a/modules/openfast-library/src/FAST_Types.f90 +++ b/modules/openfast-library/src/FAST_Types.f90 @@ -33,7 +33,7 @@ MODULE FAST_Types !--------------------------------------------------------------------------------------------------------------------------------- USE ElastoDyn_Types USE BeamDyn_Types -USE TMD_Types +USE StrucCtrl_Types USE ServoDyn_Types USE IfW_UniformWind_Types USE IfW_FFWind_Base_Types @@ -66,7 +66,7 @@ MODULE FAST_Types USE HydroDyn_Types USE IceFloe_Types USE OpenFOAM_Types -USE SuperController_Types +USE SCDataEx_Types USE IceDyn_Types USE FEAMooring_Types USE MAP_Fortran_Types @@ -78,23 +78,24 @@ MODULE FAST_Types IMPLICIT NONE INTEGER(IntKi), PUBLIC, PARAMETER :: Module_Unknown = -1 ! Unknown [-] INTEGER(IntKi), PUBLIC, PARAMETER :: Module_None = 0 ! No module selected [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IfW = 1 ! InflowWind [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_OpFM = 2 ! OpenFOAM [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_ED = 3 ! ElastoDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_BD = 4 ! BeamDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_AD14 = 5 ! AeroDyn14 [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_AD = 6 ! AeroDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_SrvD = 7 ! ServoDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_HD = 8 ! HydroDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_SD = 9 ! SubDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_ExtPtfm = 10 ! External Platform Loading MCKF [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_MAP = 11 ! MAP (Mooring Analysis Program) [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_FEAM = 12 ! FEAMooring [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_MD = 13 ! MoorDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_Orca = 14 ! OrcaFlex integration (HD/Mooring) [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IceF = 15 ! IceFloe [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IceD = 16 ! IceDyn [-] - INTEGER(IntKi), PUBLIC, PARAMETER :: NumModules = 16 ! The number of modules available in FAST [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_Glue = 1 ! Glue code [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IfW = 2 ! InflowWind [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_OpFM = 3 ! OpenFOAM [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_ED = 4 ! ElastoDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_BD = 5 ! BeamDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_AD14 = 6 ! AeroDyn14 [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_AD = 7 ! AeroDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_SrvD = 8 ! ServoDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_HD = 9 ! HydroDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_SD = 10 ! SubDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_ExtPtfm = 11 ! External Platform Loading MCKF [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_MAP = 12 ! MAP (Mooring Analysis Program) [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_FEAM = 13 ! FEAMooring [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_MD = 14 ! MoorDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_Orca = 15 ! OrcaFlex integration (HD/Mooring) [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IceF = 16 ! IceFloe [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: Module_IceD = 17 ! IceDyn [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: NumModules = 17 ! The number of modules available in FAST [-] INTEGER(IntKi), PUBLIC, PARAMETER :: MaxNBlades = 3 ! Maximum number of blades allowed on a turbine [-] INTEGER(IntKi), PUBLIC, PARAMETER :: IceD_MaxLegs = 4 ! because I don't know how many legs there are before calling IceD_Init and I don't want to copy the data because of sibling mesh issues, I'm going to allocate IceD based on this number [-] ! ========= FAST_VTK_BLSurfaceType ======= @@ -210,6 +211,7 @@ MODULE FAST_Types LOGICAL :: LinOutJac !< Include full Jacabians in linearization output (for debug) (flag) [unused if Linearize=False; used only if LinInputs=LinOutputs=2] [-] LOGICAL :: LinOutMod !< Write module-level linearization output files in addition to output for full system? (flag) [unused if Linearize=False] [-] TYPE(FAST_VTK_ModeShapeType) :: VTK_modes !< Data for VTK mode-shape visualization [-] + LOGICAL :: UseSC !< Use Supercontroller [-] INTEGER(IntKi) :: Lin_NumMods !< number of modules in the linearization [-] INTEGER(IntKi) , DIMENSION(NumModules) :: Lin_ModOrder !< indices that determine which order the modules are in the glue-code linearization matrix [-] INTEGER(IntKi) :: LinInterpOrder !< Interpolation order for CalcSteady solution [-] @@ -370,6 +372,7 @@ MODULE FAST_Types INTEGER(IntKi) :: ActualChanLen !< width of the column headers output in the text and/or binary file [-] CHARACTER(30) :: OutFmt_a !< Format used for text tabular output (except time); combines OutFmt with delim and appropriate spaces [-] TYPE(FAST_LinStateSave) :: op !< operating points of states and inputs for VTK output of mode shapes [-] + REAL(ReKi) , DIMENSION(1:5) :: DriverWriteOutput !< pitch and tsr for current aero map case, plus error, number of iterations, wind speed [-] END TYPE FAST_OutputFileType ! ======================= ! ========= IceDyn_Data ======= @@ -488,12 +491,12 @@ MODULE FAST_Types TYPE(OpFM_MiscVarType) :: m !< Parameters [-] END TYPE OpenFOAM_Data ! ======================= -! ========= SuperController_Data ======= - TYPE, PUBLIC :: SuperController_Data - TYPE(SC_InputType) :: u !< System inputs [-] - TYPE(SC_OutputType) :: y !< System outputs [-] - TYPE(SC_ParameterType) :: p !< System parameters [-] - END TYPE SuperController_Data +! ========= SCDataEx_Data ======= + TYPE, PUBLIC :: SCDataEx_Data + TYPE(SC_DX_InputType) :: u !< System inputs [-] + TYPE(SC_DX_OutputType) :: y !< System outputs [-] + TYPE(SC_DX_ParameterType) :: p !< System parameters [-] + END TYPE SCDataEx_Data ! ======================= ! ========= SubDyn_Data ======= TYPE, PUBLIC :: SubDyn_Data @@ -633,13 +636,23 @@ MODULE FAST_Types TYPE(MeshMapType) :: HD_M_P_2_SD_P !< Map HydroDyn Morison Point to SubDyn y2Mesh Point [-] TYPE(MeshMapType) :: SD_P_2_HD_W_P !< Map SubDyn y2Mesh Point to HydroDyn WAMIT Point [-] TYPE(MeshMapType) :: HD_W_P_2_SD_P !< Map HydroDyn WAMIT Point to SubDyn y2Mesh Point [-] - TYPE(MeshMapType) :: ED_P_2_SrvD_P_N !< Map ElastoDyn Nacelle point mesh to ServoDyn/TMD point mesh [-] - TYPE(MeshMapType) :: SrvD_P_2_ED_P_N !< Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle [-] - TYPE(MeshMapType) :: ED_L_2_SrvD_P_T !< Map ElastoDyn tower line2 mesh to ServoDyn/TTMD point mesh [-] - TYPE(MeshMapType) :: SrvD_P_2_ED_P_T !< Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_SrvD_P_N !< Map ElastoDyn Nacelle point mesh to ServoDyn/NStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_2_ED_P_N !< Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_L_2_SrvD_P_T !< Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_2_ED_P_T !< Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: ED_L_2_SrvD_P_B !< Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: SrvD_P_2_ED_P_B !< Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BD_L_2_SrvD_P_B !< Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: SrvD_P_2_BD_P_B !< Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_P_2_ED_P !< Map ServoDyn platform point mesh load to ElastoDyn point load mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_SrvD_P_P !< Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_P_2_SD_P !< Map ServoDyn platform point mesh load to SubDyn point load mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SD_P_2_SrvD_P_P !< Map SubDyn platform point mesh motion to ServoDyn/SStC point mesh [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: BDED_L_2_AD_L_B !< Map ElastoDyn BladeLn2Mesh point meshes OR BeamDyn BldMotion line2 meshes to AeroDyn14 InputMarkers OR AeroDyn BladeMotion line2 meshes [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: AD_L_2_BDED_B !< Map AeroDyn14 InputMarkers or AeroDyn BladeLoad line2 meshes to ElastoDyn BladePtLoad point meshes or BeamDyn BldMotion line2 meshes [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: BD_L_2_BD_L !< Map BeamDyn BldMotion output meshes to locations on the BD input DistrLoad mesh stored in MeshMapType%y_BD_BldMotion_4Loads (BD input and output meshes are not siblings and in fact have nodes at different locations [-] + TYPE(MeshMapType) :: ED_P_2_AD_P_N !< Map ElastoDyn Nacelle point motion mesh to AeroDyn Nacelle point motion mesh [-] + TYPE(MeshMapType) :: AD_P_2_ED_P_N !< Map AeroDyn Nacelle point load mesh to ElastoDyn nacelle point load mesh [-] TYPE(MeshMapType) :: ED_L_2_AD_L_T !< Map ElastoDyn TowerLn2Mesh line2 mesh to AeroDyn14 Twr_InputMarkers or AeroDyn TowerMotion line2 mesh [-] TYPE(MeshMapType) :: AD_L_2_ED_P_T !< Map AeroDyn14 Twr_InputMarkers or AeroDyn TowerLoad line2 mesh to ElastoDyn TowerPtLoads point mesh [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_AD_P_R !< Map ElastoDyn BladeRootMotion point meshes to AeroDyn BladeRootMotion point meshes [-] @@ -651,8 +664,12 @@ MODULE FAST_Types REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Jacobian_Opt1 !< Stored Jacobian in ED_HD_InputOutputSolve or FullOpt1_InputOutputSolve [-] INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: Jacobian_pivot !< Pivot array used for LU decomposition of Jacobian_Opt1 [-] INTEGER(IntKi) , DIMENSION(:,:), ALLOCATABLE :: Jac_u_indx !< matrix to help fill/pack the u vector in computing the jacobian [-] + TYPE(MeshType) :: u_ED_NacelleLoads !< copy of ED input mesh [-] TYPE(MeshType) :: u_ED_PlatformPtMesh !< copy of ED input mesh [-] TYPE(MeshType) :: u_ED_PlatformPtMesh_2 !< copy of ED input mesh (used only for temporary storage) [-] + TYPE(MeshType) :: u_ED_PlatformPtMesh_3 !< copy of ED input mesh (used only for temporary storage) [-] + TYPE(MeshType) :: u_ED_TowerPtloads !< copy of ED input mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: u_ED_BladePtLoads !< copy of ED input mesh [-] TYPE(MeshType) :: u_SD_TPMesh !< copy of SD input mesh [-] TYPE(MeshType) :: u_SD_LMesh !< copy of SD input mesh [-] TYPE(MeshType) :: u_SD_LMesh_2 !< copy of SD input mesh (used only for temporary storage) [-] @@ -662,6 +679,7 @@ MODULE FAST_Types TYPE(MeshType) :: u_ED_HubPtLoad_2 !< copy of ED input mesh [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: u_BD_RootMotion !< copy of BD input meshes [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: y_BD_BldMotion_4Loads !< BD blade motion output at locations on DistrLoad input meshes [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: u_BD_Distrload !< copy of BD DistrLoad input meshes [-] TYPE(MeshType) :: u_Orca_PtfmMesh !< copy of Orca PtfmMesh input mesh [-] TYPE(MeshType) :: u_ExtPtfm_PtfmMesh !< copy of ExtPtfm_MCKF PtfmMesh input mesh [-] END TYPE FAST_ModuleMapType @@ -677,6 +695,21 @@ MODULE FAST_Types REAL(ReKi) , DIMENSION(1:3) :: LidarFocus !< lidar focus (relative to lidar location) [m] END TYPE FAST_ExternInputType ! ======================= +! ========= FAST_MiscVarType ======= + TYPE, PUBLIC :: FAST_MiscVarType + REAL(DbKi) :: TiLstPrn !< The simulation time of the last print (to file) [(s)] + REAL(DbKi) :: t_global !< Current simulation time (for global/FAST simulation) [(s)] + REAL(DbKi) :: NextJacCalcTime !< Time between calculating Jacobians in the HD-ED and SD-ED simulations [(s)] + REAL(ReKi) :: PrevClockTime !< Clock time at start of simulation in seconds [(s)] + REAL(ReKi) :: UsrTime1 !< User CPU time for simulation initialization [(s)] + REAL(ReKi) :: UsrTime2 !< User CPU time for simulation (without intialization) [(s)] + INTEGER(IntKi) , DIMENSION(1:8) :: StrtTime !< Start time of simulation (including intialization) [-] + INTEGER(IntKi) , DIMENSION(1:8) :: SimStrtTime !< Start time of simulation (after initialization) [-] + LOGICAL :: calcJacobian !< Should we calculate Jacobians in Option 1? [(flag)] + TYPE(FAST_ExternInputType) :: ExternInput !< external input values [-] + TYPE(FAST_MiscLinType) :: Lin !< misc data for linearization analysis [-] + END TYPE FAST_MiscVarType +! ======================= ! ========= FAST_InitData ======= TYPE, PUBLIC :: FAST_InitData TYPE(ED_InitInputType) :: InData_ED !< ED Initialization input data [-] @@ -711,25 +744,8 @@ MODULE FAST_Types TYPE(IceFloe_InitOutputType) :: OutData_IceF !< IceF Initialization output data [-] TYPE(IceD_InitInputType) :: InData_IceD !< IceD Initialization input data [-] TYPE(IceD_InitOutputType) :: OutData_IceD !< IceD Initialization output data (each instance will have the same output channels) [-] - TYPE(SC_InitInputType) :: InData_SC !< SC Initialization input data [-] - TYPE(SC_InitOutputType) :: OutData_SC !< SC Initialization output data [-] END TYPE FAST_InitData ! ======================= -! ========= FAST_MiscVarType ======= - TYPE, PUBLIC :: FAST_MiscVarType - REAL(DbKi) :: TiLstPrn !< The simulation time of the last print (to file) [(s)] - REAL(DbKi) :: t_global !< Current simulation time (for global/FAST simulation) [(s)] - REAL(DbKi) :: NextJacCalcTime !< Time between calculating Jacobians in the HD-ED and SD-ED simulations [(s)] - REAL(ReKi) :: PrevClockTime !< Clock time at start of simulation in seconds [(s)] - REAL(ReKi) :: UsrTime1 !< User CPU time for simulation initialization [(s)] - REAL(ReKi) :: UsrTime2 !< User CPU time for simulation (without intialization) [(s)] - INTEGER(IntKi) , DIMENSION(1:8) :: StrtTime !< Start time of simulation (including intialization) [-] - INTEGER(IntKi) , DIMENSION(1:8) :: SimStrtTime !< Start time of simulation (after initialization) [-] - LOGICAL :: calcJacobian !< Should we calculate Jacobians in Option 1? [(flag)] - TYPE(FAST_ExternInputType) :: ExternInput !< external input values [-] - TYPE(FAST_MiscLinType) :: Lin !< misc data for linearization analysis [-] - END TYPE FAST_MiscVarType -! ======================= ! ========= FAST_ExternInitType ======= TYPE, PUBLIC :: FAST_ExternInitType REAL(DbKi) :: Tmax = -1 !< External code specified Tmax [s] @@ -737,8 +753,11 @@ MODULE FAST_Types LOGICAL :: LidRadialVel !< TRUE => return radial component, FALSE => return 'x' direction estimate [-] INTEGER(IntKi) :: TurbineID = 0 !< ID number for turbine (used to create output file naming convention) [-] REAL(ReKi) , DIMENSION(1:3) :: TurbinePos !< Initial position of turbine base (origin used in future for graphics) [m] - INTEGER(IntKi) :: NumSC2Ctrl !< number of controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2Ctrl !< number of turbine specific controller inputs [from supercontroller] [-] INTEGER(IntKi) :: NumCtrl2SC !< number of controller outputs [to supercontroller] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSCGlob !< Initial global inputs to the controller [from the supercontroller] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< Initial turbine specific inputs to the controller [from the supercontroller] [-] LOGICAL :: FarmIntegration = .false. !< whether this is called from FAST.Farm (or another program that doesn't want FAST to call all of the init stuff first) [-] INTEGER(IntKi) , DIMENSION(1:4) :: windGrid_n !< number of grid points in the x, y, z, and t directions for IfW [-] REAL(ReKi) , DIMENSION(1:4) :: windGrid_delta !< size between 2 consecutive grid points in each grid direction for IfW [m,m,m,s] @@ -762,7 +781,7 @@ MODULE FAST_Types TYPE(AeroDyn14_Data) :: AD14 !< Data for the AeroDyn14 module [-] TYPE(InflowWind_Data) :: IfW !< Data for InflowWind module [-] TYPE(OpenFOAM_Data) :: OpFM !< Data for OpenFOAM integration module [-] - TYPE(SuperController_Data) :: SC !< Data for SuperController integration module [-] + TYPE(SCDataEx_Data) :: SC_DX !< Data for SuperController integration module [-] TYPE(HydroDyn_Data) :: HD !< Data for the HydroDyn module [-] TYPE(SubDyn_Data) :: SD !< Data for the SubDyn module [-] TYPE(MAP_Data) :: MAP !< Data for the MAP (Mooring Analysis Program) module [-] @@ -2162,6 +2181,7 @@ SUBROUTINE FAST_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg CALL FAST_Copyvtk_modeshapetype( SrcParamData%VTK_modes, DstParamData%VTK_modes, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + DstParamData%UseSC = SrcParamData%UseSC DstParamData%Lin_NumMods = SrcParamData%Lin_NumMods DstParamData%Lin_ModOrder = SrcParamData%Lin_ModOrder DstParamData%LinInterpOrder = SrcParamData%LinInterpOrder @@ -2323,6 +2343,7 @@ SUBROUTINE FAST_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Int_BufSz = Int_BufSz + 1 ! UseSC Int_BufSz = Int_BufSz + 1 ! Lin_NumMods Int_BufSz = Int_BufSz + SIZE(InData%Lin_ModOrder) ! Lin_ModOrder Int_BufSz = Int_BufSz + 1 ! LinInterpOrder @@ -2599,6 +2620,8 @@ SUBROUTINE FAST_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseSC, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%Lin_NumMods Int_Xferred = Int_Xferred + 1 DO i1 = LBOUND(InData%Lin_ModOrder,1), UBOUND(InData%Lin_ModOrder,1) @@ -2918,6 +2941,8 @@ SUBROUTINE FAST_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%UseSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseSC) + Int_Xferred = Int_Xferred + 1 OutData%Lin_NumMods = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 i1_l = LBOUND(OutData%Lin_ModOrder,1) @@ -15236,6 +15261,7 @@ SUBROUTINE FAST_CopyOutputFileType( SrcOutputFileTypeData, DstOutputFileTypeData CALL FAST_Copylinstatesave( SrcOutputFileTypeData%op, DstOutputFileTypeData%op, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + DstOutputFileTypeData%DriverWriteOutput = SrcOutputFileTypeData%DriverWriteOutput END SUBROUTINE FAST_CopyOutputFileType SUBROUTINE FAST_DestroyOutputFileType( OutputFileTypeData, ErrStat, ErrMsg ) @@ -15388,6 +15414,7 @@ SUBROUTINE FAST_PackOutputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Re_BufSz = Re_BufSz + SIZE(InData%DriverWriteOutput) ! DriverWriteOutput IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -15608,6 +15635,10 @@ SUBROUTINE FAST_PackOutputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + DO i1 = LBOUND(InData%DriverWriteOutput,1), UBOUND(InData%DriverWriteOutput,1) + ReKiBuf(Re_Xferred) = InData%DriverWriteOutput(i1) + Re_Xferred = Re_Xferred + 1 + END DO END SUBROUTINE FAST_PackOutputFileType SUBROUTINE FAST_UnPackOutputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -15887,6 +15918,12 @@ SUBROUTINE FAST_UnPackOutputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSt IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + i1_l = LBOUND(OutData%DriverWriteOutput,1) + i1_u = UBOUND(OutData%DriverWriteOutput,1) + DO i1 = LBOUND(OutData%DriverWriteOutput,1), UBOUND(OutData%DriverWriteOutput,1) + OutData%DriverWriteOutput(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END SUBROUTINE FAST_UnPackOutputFileType SUBROUTINE FAST_CopyIceDyn_Data( SrcIceDyn_DataData, DstIceDyn_DataData, CtrlCode, ErrStat, ErrMsg ) @@ -26090,9 +26127,9 @@ SUBROUTINE FAST_UnPackOpenFOAM_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END SUBROUTINE FAST_UnPackOpenFOAM_Data - SUBROUTINE FAST_CopySuperController_Data( SrcSuperController_DataData, DstSuperController_DataData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SuperController_Data), INTENT(IN) :: SrcSuperController_DataData - TYPE(SuperController_Data), INTENT(INOUT) :: DstSuperController_DataData + SUBROUTINE FAST_CopySCDataEx_Data( SrcSCDataEx_DataData, DstSCDataEx_DataData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SCDataEx_Data), INTENT(IN) :: SrcSCDataEx_DataData + TYPE(SCDataEx_Data), INTENT(INOUT) :: DstSCDataEx_DataData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -26100,40 +26137,40 @@ SUBROUTINE FAST_CopySuperController_Data( SrcSuperController_DataData, DstSuperC INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopySuperController_Data' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopySCDataEx_Data' ! ErrStat = ErrID_None ErrMsg = "" - CALL SC_CopyInput( SrcSuperController_DataData%u, DstSuperController_DataData%u, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SC_DX_CopyInput( SrcSCDataEx_DataData%u, DstSCDataEx_DataData%u, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL SC_CopyOutput( SrcSuperController_DataData%y, DstSuperController_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SC_DX_CopyOutput( SrcSCDataEx_DataData%y, DstSCDataEx_DataData%y, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL SC_CopyParam( SrcSuperController_DataData%p, DstSuperController_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SC_DX_CopyParam( SrcSCDataEx_DataData%p, DstSCDataEx_DataData%p, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE FAST_CopySuperController_Data + END SUBROUTINE FAST_CopySCDataEx_Data - SUBROUTINE FAST_DestroySuperController_Data( SuperController_DataData, ErrStat, ErrMsg ) - TYPE(SuperController_Data), INTENT(INOUT) :: SuperController_DataData + SUBROUTINE FAST_DestroySCDataEx_Data( SCDataEx_DataData, ErrStat, ErrMsg ) + TYPE(SCDataEx_Data), INTENT(INOUT) :: SCDataEx_DataData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroySuperController_Data' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroySCDataEx_Data' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL SC_DestroyInput( SuperController_DataData%u, ErrStat, ErrMsg ) - CALL SC_DestroyOutput( SuperController_DataData%y, ErrStat, ErrMsg ) - CALL SC_DestroyParam( SuperController_DataData%p, ErrStat, ErrMsg ) - END SUBROUTINE FAST_DestroySuperController_Data + CALL SC_DX_DestroyInput( SCDataEx_DataData%u, ErrStat, ErrMsg ) + CALL SC_DX_DestroyOutput( SCDataEx_DataData%y, ErrStat, ErrMsg ) + CALL SC_DX_DestroyParam( SCDataEx_DataData%p, ErrStat, ErrMsg ) + END SUBROUTINE FAST_DestroySCDataEx_Data - SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE FAST_PackSCDataEx_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SuperController_Data), INTENT(IN) :: InData + TYPE(SCDataEx_Data), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -26148,7 +26185,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackSuperController_Data' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackSCDataEx_Data' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -26166,7 +26203,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er Int_BufSz = 0 ! Allocate buffers for subtypes, if any (we'll get sizes from these) Int_BufSz = Int_BufSz + 3 ! u: size of buffers for each call to pack subtype - CALL SC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, .TRUE. ) ! u + CALL SC_DX_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, .TRUE. ) ! u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26183,7 +26220,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er DEALLOCATE(Int_Buf) END IF Int_BufSz = Int_BufSz + 3 ! y: size of buffers for each call to pack subtype - CALL SC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y + CALL SC_DX_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, .TRUE. ) ! y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26200,7 +26237,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er DEALLOCATE(Int_Buf) END IF Int_BufSz = Int_BufSz + 3 ! p: size of buffers for each call to pack subtype - CALL SC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p + CALL SC_DX_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, .TRUE. ) ! p CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26243,7 +26280,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er Db_Xferred = 1 Int_Xferred = 1 - CALL SC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, OnlySize ) ! u + CALL SC_DX_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u, ErrStat2, ErrMsg2, OnlySize ) ! u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26271,7 +26308,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y + CALL SC_DX_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y, ErrStat2, ErrMsg2, OnlySize ) ! y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26299,7 +26336,7 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p + CALL SC_DX_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%p, ErrStat2, ErrMsg2, OnlySize ) ! p CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26327,13 +26364,13 @@ SUBROUTINE FAST_PackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Indata, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE FAST_PackSuperController_Data + END SUBROUTINE FAST_PackSCDataEx_Data - SUBROUTINE FAST_UnPackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE FAST_UnPackSCDataEx_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SuperController_Data), INTENT(INOUT) :: OutData + TYPE(SCDataEx_Data), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -26344,7 +26381,7 @@ SUBROUTINE FAST_UnPackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, INTEGER(IntKi) :: i INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackSuperController_Data' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackSCDataEx_Data' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -26388,7 +26425,7 @@ SUBROUTINE FAST_UnPackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u, ErrStat2, ErrMsg2 ) ! u + CALL SC_DX_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u, ErrStat2, ErrMsg2 ) ! u CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26428,7 +26465,7 @@ SUBROUTINE FAST_UnPackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y + CALL SC_DX_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y, ErrStat2, ErrMsg2 ) ! y CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -26468,14 +26505,14 @@ SUBROUTINE FAST_UnPackSuperController_Data( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p + CALL SC_DX_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%p, ErrStat2, ErrMsg2 ) ! p CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE FAST_UnPackSuperController_Data + END SUBROUTINE FAST_UnPackSCDataEx_Data SUBROUTINE FAST_CopySubDyn_Data( SrcSubDyn_DataData, DstSubDyn_DataData, CtrlCode, ErrStat, ErrMsg ) TYPE(SubDyn_Data), INTENT(INOUT) :: SrcSubDyn_DataData @@ -35883,18 +35920,214 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%HD_W_P_2_SD_P, DstModuleMapTypeData%HD_W_P_2_SD_P, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_N, DstModuleMapTypeData%ED_P_2_SrvD_P_N, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN + ALLOCATE(DstModuleMapTypeData%ED_P_2_SrvD_P_N(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_SrvD_P_N.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1), UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_N(i1), DstModuleMapTypeData%ED_P_2_SrvD_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_N(i1), DstModuleMapTypeData%SrvD_P_2_ED_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_N, DstModuleMapTypeData%SrvD_P_2_ED_P_N, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN + ALLOCATE(DstModuleMapTypeData%ED_L_2_SrvD_P_T(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_SrvD_P_T.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_SrvD_P_T(i1), DstModuleMapTypeData%ED_L_2_SrvD_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_SrvD_P_T, DstModuleMapTypeData%ED_L_2_SrvD_P_T, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_T(i1), DstModuleMapTypeData%SrvD_P_2_ED_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_T, DstModuleMapTypeData%SrvD_P_2_ED_P_T, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%ED_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), DstModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), DstModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%BD_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BD_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2), UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1), UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), DstModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2), UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), DstModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1), UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_P_2_ED_P(i1), DstModuleMapTypeData%SrvD_P_P_2_ED_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN + ALLOCATE(DstModuleMapTypeData%ED_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1), UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_P(i1), DstModuleMapTypeData%ED_P_2_SrvD_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN + ALLOCATE(DstModuleMapTypeData%SrvD_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1), UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_P_2_SD_P(i1), DstModuleMapTypeData%SrvD_P_P_2_SD_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SD_P_2_SrvD_P_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SD_P_2_SrvD_P_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SD_P_2_SrvD_P_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SD_P_2_SrvD_P_P)) THEN + ALLOCATE(DstModuleMapTypeData%SD_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SD_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SD_P_2_SrvD_P_P,1), UBOUND(SrcModuleMapTypeData%SD_P_2_SrvD_P_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SD_P_2_SrvD_P_P(i1), DstModuleMapTypeData%SD_P_2_SrvD_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF IF (ALLOCATED(SrcModuleMapTypeData%BDED_L_2_AD_L_B)) THEN i1_l = LBOUND(SrcModuleMapTypeData%BDED_L_2_AD_L_B,1) i1_u = UBOUND(SrcModuleMapTypeData%BDED_L_2_AD_L_B,1) @@ -35943,6 +36176,12 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_AD_P_N, DstModuleMapTypeData%ED_P_2_AD_P_N, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%AD_P_2_ED_P_N, DstModuleMapTypeData%AD_P_2_ED_P_N, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_AD_L_T, DstModuleMapTypeData%ED_L_2_AD_L_T, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN @@ -36046,12 +36285,37 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C END IF DstModuleMapTypeData%Jac_u_indx = SrcModuleMapTypeData%Jac_u_indx ENDIF + CALL MeshCopy( SrcModuleMapTypeData%u_ED_NacelleLoads, DstModuleMapTypeData%u_ED_NacelleLoads, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN CALL MeshCopy( SrcModuleMapTypeData%u_ED_PlatformPtMesh, DstModuleMapTypeData%u_ED_PlatformPtMesh, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN CALL MeshCopy( SrcModuleMapTypeData%u_ED_PlatformPtMesh_2, DstModuleMapTypeData%u_ED_PlatformPtMesh_2, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN + CALL MeshCopy( SrcModuleMapTypeData%u_ED_PlatformPtMesh_3, DstModuleMapTypeData%u_ED_PlatformPtMesh_3, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL MeshCopy( SrcModuleMapTypeData%u_ED_TowerPtloads, DstModuleMapTypeData%u_ED_TowerPtloads, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcModuleMapTypeData%u_ED_BladePtLoads)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_ED_BladePtLoads,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_ED_BladePtLoads,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_ED_BladePtLoads)) THEN + ALLOCATE(DstModuleMapTypeData%u_ED_BladePtLoads(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_ED_BladePtLoads.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%u_ED_BladePtLoads,1), UBOUND(SrcModuleMapTypeData%u_ED_BladePtLoads,1) + CALL MeshCopy( SrcModuleMapTypeData%u_ED_BladePtLoads(i1), DstModuleMapTypeData%u_ED_BladePtLoads(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF CALL MeshCopy( SrcModuleMapTypeData%u_SD_TPMesh, DstModuleMapTypeData%u_SD_TPMesh, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN @@ -36104,6 +36368,22 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%u_BD_Distrload)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_BD_Distrload,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_BD_Distrload,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_BD_Distrload)) THEN + ALLOCATE(DstModuleMapTypeData%u_BD_Distrload(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_BD_Distrload.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%u_BD_Distrload,1), UBOUND(SrcModuleMapTypeData%u_BD_Distrload,1) + CALL MeshCopy( SrcModuleMapTypeData%u_BD_Distrload(i1), DstModuleMapTypeData%u_BD_Distrload(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF CALL MeshCopy( SrcModuleMapTypeData%u_Orca_PtfmMesh, DstModuleMapTypeData%u_Orca_PtfmMesh, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -36155,10 +36435,86 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%HD_M_P_2_SD_P, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SD_P_2_HD_W_P, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%HD_W_P_2_SD_P, ErrStat, ErrMsg ) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_N, ErrStat, ErrMsg ) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_N, ErrStat, ErrMsg ) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_SrvD_P_T, ErrStat, ErrMsg ) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_T, ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_N,1), UBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_N,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_N(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%ED_P_2_SrvD_P_N) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_N,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_N,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_N(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_N) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_T,1), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_T,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_SrvD_P_T(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%ED_L_2_SrvD_P_T) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_T,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_T,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_T(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_T) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,2), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,1), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(ModuleMapTypeData%ED_L_2_SrvD_P_B) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,2), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_B) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,2), UBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,1), UBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(ModuleMapTypeData%BD_L_2_SrvD_P_B) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,2), UBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,1), UBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_2_BD_P_B) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_P_2_ED_P,1), UBOUND(ModuleMapTypeData%SrvD_P_P_2_ED_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_P_2_ED_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_P_2_ED_P) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_P,1), UBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%ED_P_2_SrvD_P_P) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_P_2_SD_P,1), UBOUND(ModuleMapTypeData%SrvD_P_P_2_SD_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_P_2_SD_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SrvD_P_P_2_SD_P) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SD_P_2_SrvD_P_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SD_P_2_SrvD_P_P,1), UBOUND(ModuleMapTypeData%SD_P_2_SrvD_P_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SD_P_2_SrvD_P_P(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SD_P_2_SrvD_P_P) +ENDIF IF (ALLOCATED(ModuleMapTypeData%BDED_L_2_AD_L_B)) THEN DO i1 = LBOUND(ModuleMapTypeData%BDED_L_2_AD_L_B,1), UBOUND(ModuleMapTypeData%BDED_L_2_AD_L_B,1) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BDED_L_2_AD_L_B(i1), ErrStat, ErrMsg ) @@ -36177,6 +36533,8 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) ENDDO DEALLOCATE(ModuleMapTypeData%BD_L_2_BD_L) ENDIF + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_AD_P_N, ErrStat, ErrMsg ) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%AD_P_2_ED_P_N, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_AD_L_T, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%AD_L_2_ED_P_T, ErrStat, ErrMsg ) IF (ALLOCATED(ModuleMapTypeData%ED_P_2_AD_P_R)) THEN @@ -36209,8 +36567,17 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) IF (ALLOCATED(ModuleMapTypeData%Jac_u_indx)) THEN DEALLOCATE(ModuleMapTypeData%Jac_u_indx) ENDIF + CALL MeshDestroy( ModuleMapTypeData%u_ED_NacelleLoads, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh_2, ErrStat, ErrMsg ) + CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh_3, ErrStat, ErrMsg ) + CALL MeshDestroy( ModuleMapTypeData%u_ED_TowerPtloads, ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%u_ED_BladePtLoads)) THEN +DO i1 = LBOUND(ModuleMapTypeData%u_ED_BladePtLoads,1), UBOUND(ModuleMapTypeData%u_ED_BladePtLoads,1) + CALL MeshDestroy( ModuleMapTypeData%u_ED_BladePtLoads(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%u_ED_BladePtLoads) +ENDIF CALL MeshDestroy( ModuleMapTypeData%u_SD_TPMesh, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_SD_LMesh, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_SD_LMesh_2, ErrStat, ErrMsg ) @@ -36229,6 +36596,12 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%y_BD_BldMotion_4Loads(i1), ErrStat, ErrMsg ) ENDDO DEALLOCATE(ModuleMapTypeData%y_BD_BldMotion_4Loads) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%u_BD_Distrload)) THEN +DO i1 = LBOUND(ModuleMapTypeData%u_BD_Distrload,1), UBOUND(ModuleMapTypeData%u_BD_Distrload,1) + CALL MeshDestroy( ModuleMapTypeData%u_BD_Distrload(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%u_BD_Distrload) ENDIF CALL MeshDestroy( ModuleMapTypeData%u_Orca_PtfmMesh, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ExtPtfm_PtfmMesh, ErrStat, ErrMsg ) @@ -36594,8 +36967,12 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Int_BufSz = Int_BufSz + 1 ! ED_P_2_SrvD_P_N allocated yes/no + IF ( ALLOCATED(InData%ED_P_2_SrvD_P_N) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_SrvD_P_N upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_P_2_SrvD_P_N,1), UBOUND(InData%ED_P_2_SrvD_P_N,1) Int_BufSz = Int_BufSz + 3 ! ED_P_2_SrvD_P_N: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_N + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -36611,8 +36988,14 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_N allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_2_ED_P_N) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_2_ED_P_N upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_N,1), UBOUND(InData%SrvD_P_2_ED_P_N,1) Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_N: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_N + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -36628,8 +37011,14 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! ED_L_2_SrvD_P_T allocated yes/no + IF ( ALLOCATED(InData%ED_L_2_SrvD_P_T) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_L_2_SrvD_P_T upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_L_2_SrvD_P_T,1), UBOUND(InData%ED_L_2_SrvD_P_T,1) Int_BufSz = Int_BufSz + 3 ! ED_L_2_SrvD_P_T: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_SrvD_P_T + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_SrvD_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -36645,8 +37034,14 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_T allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_2_ED_P_T) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_2_ED_P_T upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_T,1), UBOUND(InData%SrvD_P_2_ED_P_T,1) Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_T: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_T + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -36662,6 +37057,200 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! ED_L_2_SrvD_P_B allocated yes/no + IF ( ALLOCATED(InData%ED_L_2_SrvD_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! ED_L_2_SrvD_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%ED_L_2_SrvD_P_B,2), UBOUND(InData%ED_L_2_SrvD_P_B,2) + DO i1 = LBOUND(InData%ED_L_2_SrvD_P_B,1), UBOUND(InData%ED_L_2_SrvD_P_B,1) + Int_BufSz = Int_BufSz + 3 ! ED_L_2_SrvD_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_SrvD_P_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ED_L_2_SrvD_P_B + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ED_L_2_SrvD_P_B + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ED_L_2_SrvD_P_B + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_B allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_2_ED_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! SrvD_P_2_ED_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%SrvD_P_2_ED_P_B,2), UBOUND(InData%SrvD_P_2_ED_P_B,2) + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_B,1), UBOUND(InData%SrvD_P_2_ED_P_B,1) + Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_ED_P_B + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_ED_P_B + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_ED_P_B + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! BD_L_2_SrvD_P_B allocated yes/no + IF ( ALLOCATED(InData%BD_L_2_SrvD_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BD_L_2_SrvD_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BD_L_2_SrvD_P_B,2), UBOUND(InData%BD_L_2_SrvD_P_B,2) + DO i1 = LBOUND(InData%BD_L_2_SrvD_P_B,1), UBOUND(InData%BD_L_2_SrvD_P_B,1) + Int_BufSz = Int_BufSz + 3 ! BD_L_2_SrvD_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BD_L_2_SrvD_P_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BD_L_2_SrvD_P_B + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BD_L_2_SrvD_P_B + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BD_L_2_SrvD_P_B + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_BD_P_B allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_2_BD_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! SrvD_P_2_BD_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%SrvD_P_2_BD_P_B,2), UBOUND(InData%SrvD_P_2_BD_P_B,2) + DO i1 = LBOUND(InData%SrvD_P_2_BD_P_B,1), UBOUND(InData%SrvD_P_2_BD_P_B,1) + Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_BD_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_BD_P_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_BD_P_B + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_BD_P_B + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_BD_P_B + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_P_2_ED_P allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_P_2_ED_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_P_2_ED_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SrvD_P_P_2_ED_P,1), UBOUND(InData%SrvD_P_P_2_ED_P,1) + Int_BufSz = Int_BufSz + 3 ! SrvD_P_P_2_ED_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_P_2_ED_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_P_2_ED_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_P_2_ED_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_P_2_ED_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! ED_P_2_SrvD_P_P allocated yes/no + IF ( ALLOCATED(InData%ED_P_2_SrvD_P_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_SrvD_P_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_P_2_SrvD_P_P,1), UBOUND(InData%ED_P_2_SrvD_P_P,1) + Int_BufSz = Int_BufSz + 3 ! ED_P_2_SrvD_P_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_SrvD_P_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_SrvD_P_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_SrvD_P_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SrvD_P_P_2_SD_P allocated yes/no + IF ( ALLOCATED(InData%SrvD_P_P_2_SD_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_P_2_SD_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SrvD_P_P_2_SD_P,1), UBOUND(InData%SrvD_P_P_2_SD_P,1) + Int_BufSz = Int_BufSz + 3 ! SrvD_P_P_2_SD_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_P_2_SD_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_P_2_SD_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_P_2_SD_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_P_2_SD_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SD_P_2_SrvD_P_P allocated yes/no + IF ( ALLOCATED(InData%SD_P_2_SrvD_P_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SD_P_2_SrvD_P_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SD_P_2_SrvD_P_P,1), UBOUND(InData%SD_P_2_SrvD_P_P,1) + Int_BufSz = Int_BufSz + 3 ! SD_P_2_SrvD_P_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SD_P_2_SrvD_P_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SD_P_2_SrvD_P_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SD_P_2_SrvD_P_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SD_P_2_SrvD_P_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF Int_BufSz = Int_BufSz + 1 ! BDED_L_2_AD_L_B allocated yes/no IF ( ALLOCATED(InData%BDED_L_2_AD_L_B) ) THEN Int_BufSz = Int_BufSz + 2*1 ! BDED_L_2_AD_L_B upper/lower bounds for each dimension @@ -36731,6 +37320,40 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END IF END DO END IF + Int_BufSz = Int_BufSz + 3 ! ED_P_2_AD_P_N: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_AD_P_N + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_AD_P_N + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_AD_P_N + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_AD_P_N + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! AD_P_2_ED_P_N: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2, .TRUE. ) ! AD_P_2_ED_P_N + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! AD_P_2_ED_P_N + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! AD_P_2_ED_P_N + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! AD_P_2_ED_P_N + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF Int_BufSz = Int_BufSz + 3 ! ED_L_2_AD_L_T: size of buffers for each call to pack subtype CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_AD_L_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -36900,6 +37523,23 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + 2*2 ! Jac_u_indx upper/lower bounds for each dimension Int_BufSz = Int_BufSz + SIZE(InData%Jac_u_indx) ! Jac_u_indx END IF + Int_BufSz = Int_BufSz + 3 ! u_ED_NacelleLoads: size of buffers for each call to pack subtype + CALL MeshPack( InData%u_ED_NacelleLoads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_NacelleLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_ED_NacelleLoads + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_ED_NacelleLoads + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_ED_NacelleLoads + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF Int_BufSz = Int_BufSz + 3 ! u_ED_PlatformPtMesh: size of buffers for each call to pack subtype CALL MeshPack( InData%u_ED_PlatformPtMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_PlatformPtMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -36934,6 +37574,63 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Int_BufSz = Int_BufSz + 3 ! u_ED_PlatformPtMesh_3: size of buffers for each call to pack subtype + CALL MeshPack( InData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_PlatformPtMesh_3 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_ED_PlatformPtMesh_3 + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_ED_PlatformPtMesh_3 + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_ED_PlatformPtMesh_3 + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! u_ED_TowerPtloads: size of buffers for each call to pack subtype + CALL MeshPack( InData%u_ED_TowerPtloads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_TowerPtloads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_ED_TowerPtloads + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_ED_TowerPtloads + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_ED_TowerPtloads + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! u_ED_BladePtLoads allocated yes/no + IF ( ALLOCATED(InData%u_ED_BladePtLoads) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! u_ED_BladePtLoads upper/lower bounds for each dimension + DO i1 = LBOUND(InData%u_ED_BladePtLoads,1), UBOUND(InData%u_ED_BladePtLoads,1) + Int_BufSz = Int_BufSz + 3 ! u_ED_BladePtLoads: size of buffers for each call to pack subtype + CALL MeshPack( InData%u_ED_BladePtLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_BladePtLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_ED_BladePtLoads + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_ED_BladePtLoads + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_ED_BladePtLoads + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF Int_BufSz = Int_BufSz + 3 ! u_SD_TPMesh: size of buffers for each call to pack subtype CALL MeshPack( InData%u_SD_TPMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_SD_TPMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -37098,6 +37795,29 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, DEALLOCATE(Int_Buf) END IF END DO + END IF + Int_BufSz = Int_BufSz + 1 ! u_BD_Distrload allocated yes/no + IF ( ALLOCATED(InData%u_BD_Distrload) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! u_BD_Distrload upper/lower bounds for each dimension + DO i1 = LBOUND(InData%u_BD_Distrload,1), UBOUND(InData%u_BD_Distrload,1) + Int_BufSz = Int_BufSz + 3 ! u_BD_Distrload: size of buffers for each call to pack subtype + CALL MeshPack( InData%u_BD_Distrload(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_BD_Distrload + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_BD_Distrload + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_BD_Distrload + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_BD_Distrload + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO END IF Int_BufSz = Int_BufSz + 3 ! u_Orca_PtfmMesh: size of buffers for each call to pack subtype CALL MeshPack( InData%u_Orca_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_Orca_PtfmMesh @@ -37703,35 +38423,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_N - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + IF ( .NOT. ALLOCATED(InData%ED_P_2_SrvD_P_N) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_SrvD_P_N,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_SrvD_P_N,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_N + DO i1 = LBOUND(InData%ED_P_2_SrvD_P_N,1), UBOUND(InData%ED_P_2_SrvD_P_N,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37759,35 +38462,20 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_SrvD_P_T - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_N) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_N,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_N,1) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_T + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_N,1), UBOUND(InData%SrvD_P_2_ED_P_N,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37815,18 +38503,20 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%BDED_L_2_AD_L_B) ) THEN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%ED_L_2_SrvD_P_T) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BDED_L_2_AD_L_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BDED_L_2_AD_L_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_T,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_T,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BDED_L_2_AD_L_B,1), UBOUND(InData%BDED_L_2_AD_L_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BDED_L_2_AD_L_B(i1), ErrStat2, ErrMsg2, OnlySize ) ! BDED_L_2_AD_L_B + DO i1 = LBOUND(InData%ED_L_2_SrvD_P_T,1), UBOUND(InData%ED_L_2_SrvD_P_T,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_SrvD_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37856,18 +38546,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%AD_L_2_BDED_B) ) THEN + IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_T) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%AD_L_2_BDED_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AD_L_2_BDED_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_T,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_T,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%AD_L_2_BDED_B,1), UBOUND(InData%AD_L_2_BDED_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L_2_BDED_B(i1), ErrStat2, ErrMsg2, OnlySize ) ! AD_L_2_BDED_B + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_T,1), UBOUND(InData%SrvD_P_2_ED_P_T,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37897,18 +38587,22 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%BD_L_2_BD_L) ) THEN + IF ( .NOT. ALLOCATED(InData%ED_L_2_SrvD_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_BD_L,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_BD_L,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_B,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BD_L_2_BD_L,1), UBOUND(InData%BD_L_2_BD_L,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_BD_L(i1), ErrStat2, ErrMsg2, OnlySize ) ! BD_L_2_BD_L + DO i2 = LBOUND(InData%ED_L_2_SrvD_P_B,2), UBOUND(InData%ED_L_2_SrvD_P_B,2) + DO i1 = LBOUND(InData%ED_L_2_SrvD_P_B,1), UBOUND(InData%ED_L_2_SrvD_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_SrvD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37937,36 +38631,24 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END DO END IF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_AD_L_T - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_B) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_B,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_B,2) + Int_Xferred = Int_Xferred + 2 - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, OnlySize ) ! AD_L_2_ED_P_T + DO i2 = LBOUND(InData%SrvD_P_2_ED_P_B,2), UBOUND(InData%SrvD_P_2_ED_P_B,2) + DO i1 = LBOUND(InData%SrvD_P_2_ED_P_B,1), UBOUND(InData%SrvD_P_2_ED_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -37994,18 +38676,25 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%ED_P_2_AD_P_R) ) THEN + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BD_L_2_SrvD_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_AD_P_R,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_AD_P_R,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_SrvD_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_SrvD_P_B,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_SrvD_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_SrvD_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%ED_P_2_AD_P_R,1), UBOUND(InData%ED_P_2_AD_P_R,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_R(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_AD_P_R + DO i2 = LBOUND(InData%BD_L_2_SrvD_P_B,2), UBOUND(InData%BD_L_2_SrvD_P_B,2) + DO i1 = LBOUND(InData%BD_L_2_SrvD_P_B,1), UBOUND(InData%BD_L_2_SrvD_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BD_L_2_SrvD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38034,8 +38723,24 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END DO END IF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_AD_P_H + IF ( .NOT. ALLOCATED(InData%SrvD_P_2_BD_P_B) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_BD_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_BD_P_B,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_BD_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_BD_P_B,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%SrvD_P_2_BD_P_B,2), UBOUND(InData%SrvD_P_2_BD_P_B,2) + DO i1 = LBOUND(InData%SrvD_P_2_BD_P_B,1), UBOUND(InData%SrvD_P_2_BD_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_BD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38063,7 +38768,21 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%IceF_P_2_SD_P, ErrStat2, ErrMsg2, OnlySize ) ! IceF_P_2_SD_P + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SrvD_P_P_2_ED_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_P_2_ED_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_P_2_ED_P,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SrvD_P_P_2_ED_P,1), UBOUND(InData%SrvD_P_P_2_ED_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38091,7 +38810,20 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_IceF_P, ErrStat2, ErrMsg2, OnlySize ) ! SD_P_2_IceF_P + END DO + END IF + IF ( .NOT. ALLOCATED(InData%ED_P_2_SrvD_P_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_SrvD_P_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_SrvD_P_P,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ED_P_2_SrvD_P_P,1), UBOUND(InData%ED_P_2_SrvD_P_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38119,18 +38851,20 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%IceD_P_2_SD_P) ) THEN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SrvD_P_P_2_SD_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%IceD_P_2_SD_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IceD_P_2_SD_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_P_2_SD_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_P_2_SD_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%IceD_P_2_SD_P,1), UBOUND(InData%IceD_P_2_SD_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%IceD_P_2_SD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! IceD_P_2_SD_P + DO i1 = LBOUND(InData%SrvD_P_P_2_SD_P,1), UBOUND(InData%SrvD_P_P_2_SD_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38160,18 +38894,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SD_P_2_IceD_P) ) THEN + IF ( .NOT. ALLOCATED(InData%SD_P_2_SrvD_P_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SD_P_2_IceD_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SD_P_2_IceD_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SD_P_2_SrvD_P_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SD_P_2_SrvD_P_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SD_P_2_IceD_P,1), UBOUND(InData%SD_P_2_IceD_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_IceD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SD_P_2_IceD_P + DO i1 = LBOUND(InData%SD_P_2_SrvD_P_P,1), UBOUND(InData%SD_P_2_SrvD_P_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SD_P_2_SrvD_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38201,62 +38935,100 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%Jacobian_Opt1) ) THEN + IF ( .NOT. ALLOCATED(InData%BDED_L_2_AD_L_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_Opt1,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_Opt1,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_Opt1,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_Opt1,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BDED_L_2_AD_L_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BDED_L_2_AD_L_B,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%Jacobian_Opt1,2), UBOUND(InData%Jacobian_Opt1,2) - DO i1 = LBOUND(InData%Jacobian_Opt1,1), UBOUND(InData%Jacobian_Opt1,1) - ReKiBuf(Re_Xferred) = InData%Jacobian_Opt1(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO + DO i1 = LBOUND(InData%BDED_L_2_AD_L_B,1), UBOUND(InData%BDED_L_2_AD_L_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BDED_L_2_AD_L_B(i1), ErrStat2, ErrMsg2, OnlySize ) ! BDED_L_2_AD_L_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - IF ( .NOT. ALLOCATED(InData%Jacobian_pivot) ) THEN + IF ( .NOT. ALLOCATED(InData%AD_L_2_BDED_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_pivot,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_pivot,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%AD_L_2_BDED_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%AD_L_2_BDED_B,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%Jacobian_pivot,1), UBOUND(InData%Jacobian_pivot,1) - IntKiBuf(Int_Xferred) = InData%Jacobian_pivot(i1) - Int_Xferred = Int_Xferred + 1 - END DO + DO i1 = LBOUND(InData%AD_L_2_BDED_B,1), UBOUND(InData%AD_L_2_BDED_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L_2_BDED_B(i1), ErrStat2, ErrMsg2, OnlySize ) ! AD_L_2_BDED_B + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - IF ( .NOT. ALLOCATED(InData%Jac_u_indx) ) THEN + IF ( .NOT. ALLOCATED(InData%BD_L_2_BD_L) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_BD_L,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_BD_L,1) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%Jac_u_indx,2), UBOUND(InData%Jac_u_indx,2) - DO i1 = LBOUND(InData%Jac_u_indx,1), UBOUND(InData%Jac_u_indx,1) - IntKiBuf(Int_Xferred) = InData%Jac_u_indx(i1,i2) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF - CALL MeshPack( InData%u_ED_PlatformPtMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh + DO i1 = LBOUND(InData%BD_L_2_BD_L,1), UBOUND(InData%BD_L_2_BD_L,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_BD_L(i1), ErrStat2, ErrMsg2, OnlySize ) ! BD_L_2_BD_L CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38284,7 +39056,9 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_ED_PlatformPtMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh_2 + END DO + END IF + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_AD_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38312,7 +39086,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_SD_TPMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_TPMesh + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2, OnlySize ) ! AD_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38340,7 +39114,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_SD_LMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_LMesh + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_AD_L_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38368,7 +39142,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_SD_LMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_LMesh_2 + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, OnlySize ) ! AD_L_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38396,7 +39170,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_HD_M_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_HD_M_Mesh + IF ( .NOT. ALLOCATED(InData%ED_P_2_AD_P_R) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_AD_P_R,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_AD_P_R,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ED_P_2_AD_P_R,1), UBOUND(InData%ED_P_2_AD_P_R,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_R(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_AD_P_R CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38424,7 +39209,9 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_HD_W_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_HD_W_Mesh + END DO + END IF + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_AD_P_H CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38452,7 +39239,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_ED_HubPtLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_HubPtLoad + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%IceF_P_2_SD_P, ErrStat2, ErrMsg2, OnlySize ) ! IceF_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38480,7 +39267,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_ED_HubPtLoad_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_HubPtLoad_2 + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_IceF_P, ErrStat2, ErrMsg2, OnlySize ) ! SD_P_2_IceF_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38508,18 +39295,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%u_BD_RootMotion) ) THEN + IF ( .NOT. ALLOCATED(InData%IceD_P_2_SD_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BD_RootMotion,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BD_RootMotion,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%IceD_P_2_SD_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%IceD_P_2_SD_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%u_BD_RootMotion,1), UBOUND(InData%u_BD_RootMotion,1) - CALL MeshPack( InData%u_BD_RootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_BD_RootMotion + DO i1 = LBOUND(InData%IceD_P_2_SD_P,1), UBOUND(InData%IceD_P_2_SD_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%IceD_P_2_SD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! IceD_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38549,18 +39336,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%y_BD_BldMotion_4Loads) ) THEN + IF ( .NOT. ALLOCATED(InData%SD_P_2_IceD_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%y_BD_BldMotion_4Loads,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_BD_BldMotion_4Loads,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SD_P_2_IceD_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SD_P_2_IceD_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%y_BD_BldMotion_4Loads,1), UBOUND(InData%y_BD_BldMotion_4Loads,1) - CALL MeshPack( InData%y_BD_BldMotion_4Loads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! y_BD_BldMotion_4Loads + DO i1 = LBOUND(InData%SD_P_2_IceD_P,1), UBOUND(InData%SD_P_2_IceD_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SD_P_2_IceD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SD_P_2_IceD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38590,7 +39377,62 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - CALL MeshPack( InData%u_Orca_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_Orca_PtfmMesh + IF ( .NOT. ALLOCATED(InData%Jacobian_Opt1) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_Opt1,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_Opt1,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_Opt1,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_Opt1,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Jacobian_Opt1,2), UBOUND(InData%Jacobian_Opt1,2) + DO i1 = LBOUND(InData%Jacobian_Opt1,1), UBOUND(InData%Jacobian_Opt1,1) + ReKiBuf(Re_Xferred) = InData%Jacobian_Opt1(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Jacobian_pivot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jacobian_pivot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jacobian_pivot,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Jacobian_pivot,1), UBOUND(InData%Jacobian_pivot,1) + IntKiBuf(Int_Xferred) = InData%Jacobian_pivot(i1) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Jac_u_indx) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Jac_u_indx,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Jac_u_indx,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Jac_u_indx,2), UBOUND(InData%Jac_u_indx,2) + DO i1 = LBOUND(InData%Jac_u_indx,1), UBOUND(InData%Jac_u_indx,1) + IntKiBuf(Int_Xferred) = InData%Jac_u_indx(i1,i2) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + CALL MeshPack( InData%u_ED_NacelleLoads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_NacelleLoads CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38618,7 +39460,7 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MeshPack( InData%u_ExtPtfm_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ExtPtfm_PtfmMesh + CALL MeshPack( InData%u_ED_PlatformPtMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38646,244 +39488,550 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE FAST_PackModuleMapType + CALL MeshPack( InData%u_ED_PlatformPtMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(FAST_ModuleMapType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackModuleMapType' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_BD_P not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_P_2_BD_P)) DEALLOCATE(OutData%ED_P_2_BD_P) - ALLOCATE(OutData%ED_P_2_BD_P(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_BD_P.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%ED_P_2_BD_P,1), UBOUND(OutData%ED_P_2_BD_P,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_BD_P(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_BD_P + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh_3 CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_P_2_ED_P not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BD_P_2_ED_P)) DEALLOCATE(OutData%BD_P_2_ED_P) - ALLOCATE(OutData%BD_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%BD_P_2_ED_P,1), UBOUND(OutData%BD_P_2_ED_P,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_P_2_ED_P(i1), ErrStat2, ErrMsg2 ) ! BD_P_2_ED_P + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_ED_TowerPtloads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_TowerPtloads CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_BD_P_Hub not allocated + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%u_ED_BladePtLoads) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_ED_BladePtLoads,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_ED_BladePtLoads,1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_P_2_BD_P_Hub)) DEALLOCATE(OutData%ED_P_2_BD_P_Hub) - ALLOCATE(OutData%ED_P_2_BD_P_Hub(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_BD_P_Hub.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%ED_P_2_BD_P_Hub,1), UBOUND(OutData%ED_P_2_BD_P_Hub,1) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_BD_P_Hub(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_BD_P_Hub + + DO i1 = LBOUND(InData%u_ED_BladePtLoads,1), UBOUND(InData%u_ED_BladePtLoads,1) + CALL MeshPack( InData%u_ED_BladePtLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_BladePtLoads CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF END DO END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_PRP_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_PRP_P + CALL MeshPack( InData%u_SD_TPMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_TPMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_SD_LMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_LMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_SD_LMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_SD_LMesh_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_HD_M_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_HD_M_Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_HD_W_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_HD_W_Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_ED_HubPtLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_HubPtLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_ED_HubPtLoad_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_HubPtLoad_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%u_BD_RootMotion) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BD_RootMotion,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BD_RootMotion,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%u_BD_RootMotion,1), UBOUND(InData%u_BD_RootMotion,1) + CALL MeshPack( InData%u_BD_RootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_BD_RootMotion + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%y_BD_BldMotion_4Loads) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%y_BD_BldMotion_4Loads,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_BD_BldMotion_4Loads,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%y_BD_BldMotion_4Loads,1), UBOUND(InData%y_BD_BldMotion_4Loads,1) + CALL MeshPack( InData%y_BD_BldMotion_4Loads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! y_BD_BldMotion_4Loads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%u_BD_Distrload) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BD_Distrload,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BD_Distrload,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%u_BD_Distrload,1), UBOUND(InData%u_BD_Distrload,1) + CALL MeshPack( InData%u_BD_Distrload(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_BD_Distrload + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL MeshPack( InData%u_Orca_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_Orca_PtfmMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL MeshPack( InData%u_ExtPtfm_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ExtPtfm_PtfmMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE FAST_PackModuleMapType + + SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FAST_ModuleMapType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackModuleMapType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_BD_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ED_P_2_BD_P)) DEALLOCATE(OutData%ED_P_2_BD_P) + ALLOCATE(OutData%ED_P_2_BD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_BD_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ED_P_2_BD_P,1), UBOUND(OutData%ED_P_2_BD_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -38917,13 +40065,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_W_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_W_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_BD_P(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_BD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_P_2_ED_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BD_P_2_ED_P)) DEALLOCATE(OutData%BD_P_2_ED_P) + ALLOCATE(OutData%BD_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BD_P_2_ED_P,1), UBOUND(OutData%BD_P_2_ED_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -38957,13 +40121,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_W_P_2_ED_P, ErrStat2, ErrMsg2 ) ! HD_W_P_2_ED_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_P_2_ED_P(i1), ErrStat2, ErrMsg2 ) ! BD_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_BD_P_Hub not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ED_P_2_BD_P_Hub)) DEALLOCATE(OutData%ED_P_2_BD_P_Hub) + ALLOCATE(OutData%ED_P_2_BD_P_Hub(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_BD_P_Hub.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ED_P_2_BD_P_Hub,1), UBOUND(OutData%ED_P_2_BD_P_Hub,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -38997,13 +40177,15 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_M_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_M_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_BD_P_Hub(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_BD_P_Hub CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39037,7 +40219,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_M_P_2_ED_P, ErrStat2, ErrMsg2 ) ! HD_M_P_2_ED_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_PRP_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_PRP_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39077,7 +40259,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_Mooring_P, ErrStat2, ErrMsg2 ) ! ED_P_2_Mooring_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_W_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_W_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39117,7 +40299,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%Mooring_P_2_ED_P, ErrStat2, ErrMsg2 ) ! Mooring_P_2_ED_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_W_P_2_ED_P, ErrStat2, ErrMsg2 ) ! HD_W_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39157,7 +40339,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_Mooring_P, ErrStat2, ErrMsg2 ) ! SD_P_2_Mooring_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_HD_M_P, ErrStat2, ErrMsg2 ) ! ED_P_2_HD_M_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39197,7 +40379,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%Mooring_P_2_SD_P, ErrStat2, ErrMsg2 ) ! Mooring_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_M_P_2_ED_P, ErrStat2, ErrMsg2 ) ! HD_M_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39237,7 +40419,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SD_TP, ErrStat2, ErrMsg2 ) ! ED_P_2_SD_TP + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_Mooring_P, ErrStat2, ErrMsg2 ) ! ED_P_2_Mooring_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39277,7 +40459,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_TP_2_ED_P, ErrStat2, ErrMsg2 ) ! SD_TP_2_ED_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%Mooring_P_2_ED_P, ErrStat2, ErrMsg2 ) ! Mooring_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39317,7 +40499,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_HD_M_P, ErrStat2, ErrMsg2 ) ! SD_P_2_HD_M_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_Mooring_P, ErrStat2, ErrMsg2 ) ! SD_P_2_Mooring_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39357,7 +40539,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_M_P_2_SD_P, ErrStat2, ErrMsg2 ) ! HD_M_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%Mooring_P_2_SD_P, ErrStat2, ErrMsg2 ) ! Mooring_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39397,7 +40579,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_HD_W_P, ErrStat2, ErrMsg2 ) ! SD_P_2_HD_W_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SD_TP, ErrStat2, ErrMsg2 ) ! ED_P_2_SD_TP CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39437,7 +40619,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_W_P_2_SD_P, ErrStat2, ErrMsg2 ) ! HD_W_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_TP_2_ED_P, ErrStat2, ErrMsg2 ) ! SD_TP_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39477,7 +40659,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_N + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_HD_M_P, ErrStat2, ErrMsg2 ) ! SD_P_2_HD_M_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39517,7 +40699,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_N + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_M_P_2_SD_P, ErrStat2, ErrMsg2 ) ! HD_M_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39557,7 +40739,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) ! ED_L_2_SrvD_P_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_HD_W_P, ErrStat2, ErrMsg2 ) ! SD_P_2_HD_W_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39597,27 +40779,27 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%HD_W_P_2_SD_P, ErrStat2, ErrMsg2 ) ! HD_W_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BDED_L_2_AD_L_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_SrvD_P_N not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BDED_L_2_AD_L_B)) DEALLOCATE(OutData%BDED_L_2_AD_L_B) - ALLOCATE(OutData%BDED_L_2_AD_L_B(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_P_2_SrvD_P_N)) DEALLOCATE(OutData%ED_P_2_SrvD_P_N) + ALLOCATE(OutData%ED_P_2_SrvD_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BDED_L_2_AD_L_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_SrvD_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BDED_L_2_AD_L_B,1), UBOUND(OutData%BDED_L_2_AD_L_B,1) + DO i1 = LBOUND(OutData%ED_P_2_SrvD_P_N,1), UBOUND(OutData%ED_P_2_SrvD_P_N,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39651,7 +40833,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BDED_L_2_AD_L_B(i1), ErrStat2, ErrMsg2 ) ! BDED_L_2_AD_L_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39660,20 +40842,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AD_L_2_BDED_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_N not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%AD_L_2_BDED_B)) DEALLOCATE(OutData%AD_L_2_BDED_B) - ALLOCATE(OutData%AD_L_2_BDED_B(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SrvD_P_2_ED_P_N)) DEALLOCATE(OutData%SrvD_P_2_ED_P_N) + ALLOCATE(OutData%SrvD_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AD_L_2_BDED_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%AD_L_2_BDED_B,1), UBOUND(OutData%AD_L_2_BDED_B,1) + DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_N,1), UBOUND(OutData%SrvD_P_2_ED_P_N,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39707,7 +40889,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_L_2_BDED_B(i1), ErrStat2, ErrMsg2 ) ! AD_L_2_BDED_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39716,20 +40898,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_L_2_BD_L not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_SrvD_P_T not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BD_L_2_BD_L)) DEALLOCATE(OutData%BD_L_2_BD_L) - ALLOCATE(OutData%BD_L_2_BD_L(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_L_2_SrvD_P_T)) DEALLOCATE(OutData%ED_L_2_SrvD_P_T) + ALLOCATE(OutData%ED_L_2_SrvD_P_T(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_L_2_BD_L.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_SrvD_P_T.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BD_L_2_BD_L,1), UBOUND(OutData%BD_L_2_BD_L,1) + DO i1 = LBOUND(OutData%ED_L_2_SrvD_P_T,1), UBOUND(OutData%ED_L_2_SrvD_P_T,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39763,7 +40945,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_L_2_BD_L(i1), ErrStat2, ErrMsg2 ) ! BD_L_2_BD_L + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2 ) ! ED_L_2_SrvD_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39772,6 +40954,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_T not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SrvD_P_2_ED_P_T)) DEALLOCATE(OutData%SrvD_P_2_ED_P_T) + ALLOCATE(OutData%SrvD_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_T,1), UBOUND(OutData%SrvD_P_2_ED_P_T,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39805,13 +41001,33 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) ! ED_L_2_AD_L_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_SrvD_P_B not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ED_L_2_SrvD_P_B)) DEALLOCATE(OutData%ED_L_2_SrvD_P_B) + ALLOCATE(OutData%ED_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%ED_L_2_SrvD_P_B,2), UBOUND(OutData%ED_L_2_SrvD_P_B,2) + DO i1 = LBOUND(OutData%ED_L_2_SrvD_P_B,1), UBOUND(OutData%ED_L_2_SrvD_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39845,27 +41061,34 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2 ) ! AD_L_2_ED_P_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! ED_L_2_SrvD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_AD_P_R not allocated + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_B not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_P_2_AD_P_R)) DEALLOCATE(OutData%ED_P_2_AD_P_R) - ALLOCATE(OutData%ED_P_2_AD_P_R(i1_l:i1_u),STAT=ErrStat2) + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SrvD_P_2_ED_P_B)) DEALLOCATE(OutData%SrvD_P_2_ED_P_B) + ALLOCATE(OutData%SrvD_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_AD_P_R.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%ED_P_2_AD_P_R,1), UBOUND(OutData%ED_P_2_AD_P_R,1) + DO i2 = LBOUND(OutData%SrvD_P_2_ED_P_B,2), UBOUND(OutData%SrvD_P_2_ED_P_B,2) + DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_B,1), UBOUND(OutData%SrvD_P_2_ED_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39899,7 +41122,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_AD_P_R(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_AD_P_R + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -39907,7 +41130,26 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO + END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_L_2_SrvD_P_B not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BD_L_2_SrvD_P_B)) DEALLOCATE(OutData%BD_L_2_SrvD_P_B) + ALLOCATE(OutData%BD_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%BD_L_2_SrvD_P_B,2), UBOUND(OutData%BD_L_2_SrvD_P_B,2) + DO i1 = LBOUND(OutData%BD_L_2_SrvD_P_B,1), UBOUND(OutData%BD_L_2_SrvD_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39941,13 +41183,34 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) ! ED_P_2_AD_P_H + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! BD_L_2_SrvD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_BD_P_B not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SrvD_P_2_BD_P_B)) DEALLOCATE(OutData%SrvD_P_2_BD_P_B) + ALLOCATE(OutData%SrvD_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%SrvD_P_2_BD_P_B,2), UBOUND(OutData%SrvD_P_2_BD_P_B,2) + DO i1 = LBOUND(OutData%SrvD_P_2_BD_P_B,1), UBOUND(OutData%SrvD_P_2_BD_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -39981,13 +41244,30 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%IceF_P_2_SD_P, ErrStat2, ErrMsg2 ) ! IceF_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! SrvD_P_2_BD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_P_2_ED_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SrvD_P_P_2_ED_P)) DEALLOCATE(OutData%SrvD_P_P_2_ED_P) + ALLOCATE(OutData%SrvD_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SrvD_P_P_2_ED_P,1), UBOUND(OutData%SrvD_P_P_2_ED_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40021,27 +41301,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_IceF_P, ErrStat2, ErrMsg2 ) ! SD_P_2_IceF_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IceD_P_2_SD_P not allocated + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_SrvD_P_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%IceD_P_2_SD_P)) DEALLOCATE(OutData%IceD_P_2_SD_P) - ALLOCATE(OutData%IceD_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_P_2_SrvD_P_P)) DEALLOCATE(OutData%ED_P_2_SrvD_P_P) + ALLOCATE(OutData%ED_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IceD_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%IceD_P_2_SD_P,1), UBOUND(OutData%IceD_P_2_SD_P,1) + DO i1 = LBOUND(OutData%ED_P_2_SrvD_P_P,1), UBOUND(OutData%ED_P_2_SrvD_P_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40075,7 +41357,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%IceD_P_2_SD_P(i1), ErrStat2, ErrMsg2 ) ! IceD_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40084,20 +41366,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SD_P_2_IceD_P not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_P_2_SD_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SD_P_2_IceD_P)) DEALLOCATE(OutData%SD_P_2_IceD_P) - ALLOCATE(OutData%SD_P_2_IceD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SrvD_P_P_2_SD_P)) DEALLOCATE(OutData%SrvD_P_P_2_SD_P) + ALLOCATE(OutData%SrvD_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SD_P_2_IceD_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SD_P_2_IceD_P,1), UBOUND(OutData%SD_P_2_IceD_P,1) + DO i1 = LBOUND(OutData%SrvD_P_P_2_SD_P,1), UBOUND(OutData%SrvD_P_P_2_SD_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40131,7 +41413,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_IceD_P(i1), ErrStat2, ErrMsg2 ) ! SD_P_2_IceD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40140,70 +41422,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jacobian_Opt1 not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Jacobian_Opt1)) DEALLOCATE(OutData%Jacobian_Opt1) - ALLOCATE(OutData%Jacobian_Opt1(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jacobian_Opt1.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%Jacobian_Opt1,2), UBOUND(OutData%Jacobian_Opt1,2) - DO i1 = LBOUND(OutData%Jacobian_Opt1,1), UBOUND(OutData%Jacobian_Opt1,1) - OutData%Jacobian_Opt1(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jacobian_pivot not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SD_P_2_SrvD_P_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Jacobian_pivot)) DEALLOCATE(OutData%Jacobian_pivot) - ALLOCATE(OutData%Jacobian_pivot(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SD_P_2_SrvD_P_P)) DEALLOCATE(OutData%SD_P_2_SrvD_P_P) + ALLOCATE(OutData%SD_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jacobian_pivot.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SD_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%Jacobian_pivot,1), UBOUND(OutData%Jacobian_pivot,1) - OutData%Jacobian_pivot(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jac_u_indx not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Jac_u_indx)) DEALLOCATE(OutData%Jac_u_indx) - ALLOCATE(OutData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%Jac_u_indx,2), UBOUND(OutData%Jac_u_indx,2) - DO i1 = LBOUND(OutData%Jac_u_indx,1), UBOUND(OutData%Jac_u_indx,1) - OutData%Jac_u_indx(i1,i2) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - END DO - END IF + DO i1 = LBOUND(OutData%SD_P_2_SrvD_P_P,1), UBOUND(OutData%SD_P_2_SrvD_P_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40237,13 +41469,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_ED_PlatformPtMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2 ) ! SD_P_2_SrvD_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BDED_L_2_AD_L_B not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BDED_L_2_AD_L_B)) DEALLOCATE(OutData%BDED_L_2_AD_L_B) + ALLOCATE(OutData%BDED_L_2_AD_L_B(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BDED_L_2_AD_L_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BDED_L_2_AD_L_B,1), UBOUND(OutData%BDED_L_2_AD_L_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40277,13 +41525,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_ED_PlatformPtMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh_2 + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BDED_L_2_AD_L_B(i1), ErrStat2, ErrMsg2 ) ! BDED_L_2_AD_L_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! AD_L_2_BDED_B not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%AD_L_2_BDED_B)) DEALLOCATE(OutData%AD_L_2_BDED_B) + ALLOCATE(OutData%AD_L_2_BDED_B(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%AD_L_2_BDED_B.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%AD_L_2_BDED_B,1), UBOUND(OutData%AD_L_2_BDED_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40317,13 +41581,29 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_SD_TPMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_TPMesh + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_L_2_BDED_B(i1), ErrStat2, ErrMsg2 ) ! AD_L_2_BDED_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_L_2_BD_L not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BD_L_2_BD_L)) DEALLOCATE(OutData%BD_L_2_BD_L) + ALLOCATE(OutData%BD_L_2_BD_L(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_L_2_BD_L.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BD_L_2_BD_L,1), UBOUND(OutData%BD_L_2_BD_L,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40357,13 +41637,15 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_SD_LMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_LMesh + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_L_2_BD_L(i1), ErrStat2, ErrMsg2 ) ! BD_L_2_BD_L CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40397,7 +41679,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_SD_LMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_LMesh_2 + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2 ) ! ED_P_2_AD_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40437,7 +41719,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_HD_M_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_HD_M_Mesh + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) ! AD_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40477,7 +41759,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_HD_W_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_HD_W_Mesh + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_AD_L_T, ErrStat2, ErrMsg2 ) ! ED_L_2_AD_L_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40517,13 +41799,27 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_ED_HubPtLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_HubPtLoad + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2 ) ! AD_L_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_AD_P_R not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ED_P_2_AD_P_R)) DEALLOCATE(OutData%ED_P_2_AD_P_R) + ALLOCATE(OutData%ED_P_2_AD_P_R(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_AD_P_R.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ED_P_2_AD_P_R,1), UBOUND(OutData%ED_P_2_AD_P_R,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40557,27 +41853,15 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_ED_HubPtLoad_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_HubPtLoad_2 + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_AD_P_R(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_AD_P_R CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_BD_RootMotion not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%u_BD_RootMotion)) DEALLOCATE(OutData%u_BD_RootMotion) - ALLOCATE(OutData%u_BD_RootMotion(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_BD_RootMotion.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%u_BD_RootMotion,1), UBOUND(OutData%u_BD_RootMotion,1) + END DO + END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40611,29 +41895,875 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_BD_RootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_BD_RootMotion + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_AD_P_H, ErrStat2, ErrMsg2 ) ! ED_P_2_AD_P_H CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_BD_BldMotion_4Loads not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%y_BD_BldMotion_4Loads)) DEALLOCATE(OutData%y_BD_BldMotion_4Loads) - ALLOCATE(OutData%y_BD_BldMotion_4Loads(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_BD_BldMotion_4Loads.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%y_BD_BldMotion_4Loads,1), UBOUND(OutData%y_BD_BldMotion_4Loads,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%IceF_P_2_SD_P, ErrStat2, ErrMsg2 ) ! IceF_P_2_SD_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_IceF_P, ErrStat2, ErrMsg2 ) ! SD_P_2_IceF_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! IceD_P_2_SD_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%IceD_P_2_SD_P)) DEALLOCATE(OutData%IceD_P_2_SD_P) + ALLOCATE(OutData%IceD_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%IceD_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%IceD_P_2_SD_P,1), UBOUND(OutData%IceD_P_2_SD_P,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%IceD_P_2_SD_P(i1), ErrStat2, ErrMsg2 ) ! IceD_P_2_SD_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SD_P_2_IceD_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SD_P_2_IceD_P)) DEALLOCATE(OutData%SD_P_2_IceD_P) + ALLOCATE(OutData%SD_P_2_IceD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SD_P_2_IceD_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SD_P_2_IceD_P,1), UBOUND(OutData%SD_P_2_IceD_P,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SD_P_2_IceD_P(i1), ErrStat2, ErrMsg2 ) ! SD_P_2_IceD_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jacobian_Opt1 not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Jacobian_Opt1)) DEALLOCATE(OutData%Jacobian_Opt1) + ALLOCATE(OutData%Jacobian_Opt1(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jacobian_Opt1.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Jacobian_Opt1,2), UBOUND(OutData%Jacobian_Opt1,2) + DO i1 = LBOUND(OutData%Jacobian_Opt1,1), UBOUND(OutData%Jacobian_Opt1,1) + OutData%Jacobian_Opt1(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jacobian_pivot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Jacobian_pivot)) DEALLOCATE(OutData%Jacobian_pivot) + ALLOCATE(OutData%Jacobian_pivot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jacobian_pivot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Jacobian_pivot,1), UBOUND(OutData%Jacobian_pivot,1) + OutData%Jacobian_pivot(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Jac_u_indx not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Jac_u_indx)) DEALLOCATE(OutData%Jac_u_indx) + ALLOCATE(OutData%Jac_u_indx(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Jac_u_indx.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Jac_u_indx,2), UBOUND(OutData%Jac_u_indx,2) + DO i1 = LBOUND(OutData%Jac_u_indx,1), UBOUND(OutData%Jac_u_indx,1) + OutData%Jac_u_indx(i1,i2) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_NacelleLoads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_NacelleLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_PlatformPtMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_PlatformPtMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh_3 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_TowerPtloads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_TowerPtloads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_ED_BladePtLoads not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_ED_BladePtLoads)) DEALLOCATE(OutData%u_ED_BladePtLoads) + ALLOCATE(OutData%u_ED_BladePtLoads(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_ED_BladePtLoads.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_ED_BladePtLoads,1), UBOUND(OutData%u_ED_BladePtLoads,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_BladePtLoads(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_BladePtLoads + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_SD_TPMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_TPMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_SD_LMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_LMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_SD_LMesh_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_SD_LMesh_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_HD_M_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_HD_M_Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_HD_W_Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_HD_W_Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_HubPtLoad, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_HubPtLoad + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ED_HubPtLoad_2, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_HubPtLoad_2 + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_BD_RootMotion not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_BD_RootMotion)) DEALLOCATE(OutData%u_BD_RootMotion) + ALLOCATE(OutData%u_BD_RootMotion(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_BD_RootMotion.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_BD_RootMotion,1), UBOUND(OutData%u_BD_RootMotion,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_BD_RootMotion(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_BD_RootMotion + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_BD_BldMotion_4Loads not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%y_BD_BldMotion_4Loads)) DEALLOCATE(OutData%y_BD_BldMotion_4Loads) + ALLOCATE(OutData%y_BD_BldMotion_4Loads(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_BD_BldMotion_4Loads.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%y_BD_BldMotion_4Loads,1), UBOUND(OutData%y_BD_BldMotion_4Loads,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40676,6 +42806,603 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_BD_Distrload not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_BD_Distrload)) DEALLOCATE(OutData%u_BD_Distrload) + ALLOCATE(OutData%u_BD_Distrload(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_BD_Distrload.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_BD_Distrload,1), UBOUND(OutData%u_BD_Distrload,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_BD_Distrload(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_BD_Distrload + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_Orca_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_Orca_PtfmMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%u_ExtPtfm_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ExtPtfm_PtfmMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE FAST_UnPackModuleMapType + + SUBROUTINE FAST_CopyExternInputType( SrcExternInputTypeData, DstExternInputTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FAST_ExternInputType), INTENT(IN) :: SrcExternInputTypeData + TYPE(FAST_ExternInputType), INTENT(INOUT) :: DstExternInputTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopyExternInputType' +! + ErrStat = ErrID_None + ErrMsg = "" + DstExternInputTypeData%GenTrq = SrcExternInputTypeData%GenTrq + DstExternInputTypeData%ElecPwr = SrcExternInputTypeData%ElecPwr + DstExternInputTypeData%YawPosCom = SrcExternInputTypeData%YawPosCom + DstExternInputTypeData%YawRateCom = SrcExternInputTypeData%YawRateCom + DstExternInputTypeData%BlPitchCom = SrcExternInputTypeData%BlPitchCom + DstExternInputTypeData%HSSBrFrac = SrcExternInputTypeData%HSSBrFrac + DstExternInputTypeData%LidarFocus = SrcExternInputTypeData%LidarFocus + END SUBROUTINE FAST_CopyExternInputType + + SUBROUTINE FAST_DestroyExternInputType( ExternInputTypeData, ErrStat, ErrMsg ) + TYPE(FAST_ExternInputType), INTENT(INOUT) :: ExternInputTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroyExternInputType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE FAST_DestroyExternInputType + + SUBROUTINE FAST_PackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FAST_ExternInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackExternInputType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! GenTrq + Re_BufSz = Re_BufSz + 1 ! ElecPwr + Re_BufSz = Re_BufSz + 1 ! YawPosCom + Re_BufSz = Re_BufSz + 1 ! YawRateCom + Re_BufSz = Re_BufSz + SIZE(InData%BlPitchCom) ! BlPitchCom + Re_BufSz = Re_BufSz + 1 ! HSSBrFrac + Re_BufSz = Re_BufSz + SIZE(InData%LidarFocus) ! LidarFocus + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%GenTrq + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%ElecPwr + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%YawPosCom + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%YawRateCom + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%BlPitchCom,1), UBOUND(InData%BlPitchCom,1) + ReKiBuf(Re_Xferred) = InData%BlPitchCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO + ReKiBuf(Re_Xferred) = InData%HSSBrFrac + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%LidarFocus,1), UBOUND(InData%LidarFocus,1) + ReKiBuf(Re_Xferred) = InData%LidarFocus(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END SUBROUTINE FAST_PackExternInputType + + SUBROUTINE FAST_UnPackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FAST_ExternInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackExternInputType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%GenTrq = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%ElecPwr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%YawPosCom = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%YawRateCom = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%BlPitchCom,1) + i1_u = UBOUND(OutData%BlPitchCom,1) + DO i1 = LBOUND(OutData%BlPitchCom,1), UBOUND(OutData%BlPitchCom,1) + OutData%BlPitchCom(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%HSSBrFrac = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%LidarFocus,1) + i1_u = UBOUND(OutData%LidarFocus,1) + DO i1 = LBOUND(OutData%LidarFocus,1), UBOUND(OutData%LidarFocus,1) + OutData%LidarFocus(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END SUBROUTINE FAST_UnPackExternInputType + + SUBROUTINE FAST_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(FAST_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(FAST_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" + DstMiscData%TiLstPrn = SrcMiscData%TiLstPrn + DstMiscData%t_global = SrcMiscData%t_global + DstMiscData%NextJacCalcTime = SrcMiscData%NextJacCalcTime + DstMiscData%PrevClockTime = SrcMiscData%PrevClockTime + DstMiscData%UsrTime1 = SrcMiscData%UsrTime1 + DstMiscData%UsrTime2 = SrcMiscData%UsrTime2 + DstMiscData%StrtTime = SrcMiscData%StrtTime + DstMiscData%SimStrtTime = SrcMiscData%SimStrtTime + DstMiscData%calcJacobian = SrcMiscData%calcJacobian + CALL FAST_Copyexterninputtype( SrcMiscData%ExternInput, DstMiscData%ExternInput, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + CALL FAST_Copymisclintype( SrcMiscData%Lin, DstMiscData%Lin, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE FAST_CopyMisc + + SUBROUTINE FAST_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(FAST_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL FAST_Destroyexterninputtype( MiscData%ExternInput, ErrStat, ErrMsg ) + CALL FAST_Destroymisclintype( MiscData%Lin, ErrStat, ErrMsg ) + END SUBROUTINE FAST_DestroyMisc + + SUBROUTINE FAST_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(FAST_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! TiLstPrn + Db_BufSz = Db_BufSz + 1 ! t_global + Db_BufSz = Db_BufSz + 1 ! NextJacCalcTime + Re_BufSz = Re_BufSz + 1 ! PrevClockTime + Re_BufSz = Re_BufSz + 1 ! UsrTime1 + Re_BufSz = Re_BufSz + 1 ! UsrTime2 + Int_BufSz = Int_BufSz + SIZE(InData%StrtTime) ! StrtTime + Int_BufSz = Int_BufSz + SIZE(InData%SimStrtTime) ! SimStrtTime + Int_BufSz = Int_BufSz + 1 ! calcJacobian + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! ExternInput: size of buffers for each call to pack subtype + CALL FAST_Packexterninputtype( Re_Buf, Db_Buf, Int_Buf, InData%ExternInput, ErrStat2, ErrMsg2, .TRUE. ) ! ExternInput + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ExternInput + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ExternInput + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ExternInput + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 3 ! Lin: size of buffers for each call to pack subtype + CALL FAST_Packmisclintype( Re_Buf, Db_Buf, Int_Buf, InData%Lin, ErrStat2, ErrMsg2, .TRUE. ) ! Lin + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Lin + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Lin + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Lin + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%TiLstPrn + Db_Xferred = Db_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%t_global + Db_Xferred = Db_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%NextJacCalcTime + Db_Xferred = Db_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%PrevClockTime + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%UsrTime1 + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%UsrTime2 + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%StrtTime,1), UBOUND(InData%StrtTime,1) + IntKiBuf(Int_Xferred) = InData%StrtTime(i1) + Int_Xferred = Int_Xferred + 1 + END DO + DO i1 = LBOUND(InData%SimStrtTime,1), UBOUND(InData%SimStrtTime,1) + IntKiBuf(Int_Xferred) = InData%SimStrtTime(i1) + Int_Xferred = Int_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = TRANSFER(InData%calcJacobian, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + CALL FAST_Packexterninputtype( Re_Buf, Db_Buf, Int_Buf, InData%ExternInput, ErrStat2, ErrMsg2, OnlySize ) ! ExternInput + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL FAST_Packmisclintype( Re_Buf, Db_Buf, Int_Buf, InData%Lin, ErrStat2, ErrMsg2, OnlySize ) ! Lin + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE FAST_PackMisc + + SUBROUTINE FAST_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(FAST_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%TiLstPrn = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%t_global = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%NextJacCalcTime = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%PrevClockTime = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%UsrTime1 = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%UsrTime2 = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%StrtTime,1) + i1_u = UBOUND(OutData%StrtTime,1) + DO i1 = LBOUND(OutData%StrtTime,1), UBOUND(OutData%StrtTime,1) + OutData%StrtTime(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + i1_l = LBOUND(OutData%SimStrtTime,1) + i1_u = UBOUND(OutData%SimStrtTime,1) + DO i1 = LBOUND(OutData%SimStrtTime,1), UBOUND(OutData%SimStrtTime,1) + OutData%SimStrtTime(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + OutData%calcJacobian = TRANSFER(IntKiBuf(Int_Xferred), OutData%calcJacobian) + Int_Xferred = Int_Xferred + 1 Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40709,7 +43436,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_Orca_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_Orca_PtfmMesh + CALL FAST_Unpackexterninputtype( Re_Buf, Db_Buf, Int_Buf, OutData%ExternInput, ErrStat2, ErrMsg2 ) ! ExternInput CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40749,189 +43476,14 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MeshUnpack( OutData%u_ExtPtfm_PtfmMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ExtPtfm_PtfmMesh + CALL FAST_Unpackmisclintype( Re_Buf, Db_Buf, Int_Buf, OutData%Lin, ErrStat2, ErrMsg2 ) ! Lin CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE FAST_UnPackModuleMapType - - SUBROUTINE FAST_CopyExternInputType( SrcExternInputTypeData, DstExternInputTypeData, CtrlCode, ErrStat, ErrMsg ) - TYPE(FAST_ExternInputType), INTENT(IN) :: SrcExternInputTypeData - TYPE(FAST_ExternInputType), INTENT(INOUT) :: DstExternInputTypeData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopyExternInputType' -! - ErrStat = ErrID_None - ErrMsg = "" - DstExternInputTypeData%GenTrq = SrcExternInputTypeData%GenTrq - DstExternInputTypeData%ElecPwr = SrcExternInputTypeData%ElecPwr - DstExternInputTypeData%YawPosCom = SrcExternInputTypeData%YawPosCom - DstExternInputTypeData%YawRateCom = SrcExternInputTypeData%YawRateCom - DstExternInputTypeData%BlPitchCom = SrcExternInputTypeData%BlPitchCom - DstExternInputTypeData%HSSBrFrac = SrcExternInputTypeData%HSSBrFrac - DstExternInputTypeData%LidarFocus = SrcExternInputTypeData%LidarFocus - END SUBROUTINE FAST_CopyExternInputType - - SUBROUTINE FAST_DestroyExternInputType( ExternInputTypeData, ErrStat, ErrMsg ) - TYPE(FAST_ExternInputType), INTENT(INOUT) :: ExternInputTypeData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroyExternInputType' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE FAST_DestroyExternInputType - - SUBROUTINE FAST_PackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(FAST_ExternInputType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackExternInputType' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! GenTrq - Re_BufSz = Re_BufSz + 1 ! ElecPwr - Re_BufSz = Re_BufSz + 1 ! YawPosCom - Re_BufSz = Re_BufSz + 1 ! YawRateCom - Re_BufSz = Re_BufSz + SIZE(InData%BlPitchCom) ! BlPitchCom - Re_BufSz = Re_BufSz + 1 ! HSSBrFrac - Re_BufSz = Re_BufSz + SIZE(InData%LidarFocus) ! LidarFocus - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%GenTrq - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%ElecPwr - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%YawPosCom - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%YawRateCom - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%BlPitchCom,1), UBOUND(InData%BlPitchCom,1) - ReKiBuf(Re_Xferred) = InData%BlPitchCom(i1) - Re_Xferred = Re_Xferred + 1 - END DO - ReKiBuf(Re_Xferred) = InData%HSSBrFrac - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%LidarFocus,1), UBOUND(InData%LidarFocus,1) - ReKiBuf(Re_Xferred) = InData%LidarFocus(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE FAST_PackExternInputType - - SUBROUTINE FAST_UnPackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(FAST_ExternInputType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackExternInputType' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%GenTrq = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%ElecPwr = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%YawPosCom = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%YawRateCom = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%BlPitchCom,1) - i1_u = UBOUND(OutData%BlPitchCom,1) - DO i1 = LBOUND(OutData%BlPitchCom,1), UBOUND(OutData%BlPitchCom,1) - OutData%BlPitchCom(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - OutData%HSSBrFrac = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%LidarFocus,1) - i1_u = UBOUND(OutData%LidarFocus,1) - DO i1 = LBOUND(OutData%LidarFocus,1), UBOUND(OutData%LidarFocus,1) - OutData%LidarFocus(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE FAST_UnPackExternInputType + END SUBROUTINE FAST_UnPackMisc SUBROUTINE FAST_CopyInitData( SrcInitDataData, DstInitDataData, CtrlCode, ErrStat, ErrMsg ) TYPE(FAST_InitData), INTENT(INOUT) :: SrcInitDataData @@ -41057,12 +43609,6 @@ SUBROUTINE FAST_CopyInitData( SrcInitDataData, DstInitDataData, CtrlCode, ErrSta CALL IceD_CopyInitOutput( SrcInitDataData%OutData_IceD, DstInitDataData%OutData_IceD, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL SC_CopyInitInput( SrcInitDataData%InData_SC, DstInitDataData%InData_SC, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL SC_CopyInitOutput( SrcInitDataData%OutData_SC, DstInitDataData%OutData_SC, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN END SUBROUTINE FAST_CopyInitData SUBROUTINE FAST_DestroyInitData( InitDataData, ErrStat, ErrMsg ) @@ -41111,8 +43657,6 @@ SUBROUTINE FAST_DestroyInitData( InitDataData, ErrStat, ErrMsg ) CALL IceFloe_DestroyInitOutput( InitDataData%OutData_IceF, ErrStat, ErrMsg ) CALL IceD_DestroyInitInput( InitDataData%InData_IceD, ErrStat, ErrMsg ) CALL IceD_DestroyInitOutput( InitDataData%OutData_IceD, ErrStat, ErrMsg ) - CALL SC_DestroyInitInput( InitDataData%InData_SC, ErrStat, ErrMsg ) - CALL SC_DestroyInitOutput( InitDataData%OutData_SC, ErrStat, ErrMsg ) END SUBROUTINE FAST_DestroyInitData SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -41701,40 +44245,6 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! InData_SC: size of buffers for each call to pack subtype - CALL SC_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SC, ErrStat2, ErrMsg2, .TRUE. ) ! InData_SC - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! InData_SC - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! InData_SC - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! InData_SC - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! OutData_SC: size of buffers for each call to pack subtype - CALL SC_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SC, ErrStat2, ErrMsg2, .TRUE. ) ! OutData_SC - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! OutData_SC - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! OutData_SC - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! OutData_SC - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -41846,132 +44356,18 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%OutData_BD) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%OutData_BD,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutData_BD,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%OutData_BD,1), UBOUND(InData%OutData_BD,1) - CALL BD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_BD(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutData_BD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END DO - END IF - CALL SrvD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SrvD, ErrStat2, ErrMsg2, OnlySize ) ! InData_SrvD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL SrvD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SrvD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_SrvD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL AD14_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_AD14, ErrStat2, ErrMsg2, OnlySize ) ! InData_AD14 - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL AD14_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_AD14, ErrStat2, ErrMsg2, OnlySize ) ! OutData_AD14 + IF ( .NOT. ALLOCATED(InData%OutData_BD) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutData_BD,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutData_BD,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutData_BD,1), UBOUND(InData%OutData_BD,1) + CALL BD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_BD(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutData_BD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41999,7 +44395,9 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL AD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_AD, ErrStat2, ErrMsg2, OnlySize ) ! InData_AD + END DO + END IF + CALL SrvD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SrvD, ErrStat2, ErrMsg2, OnlySize ) ! InData_SrvD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42027,7 +44425,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL AD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_AD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_AD + CALL SrvD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SrvD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_SrvD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42055,7 +44453,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL InflowWind_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IfW, ErrStat2, ErrMsg2, OnlySize ) ! InData_IfW + CALL AD14_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_AD14, ErrStat2, ErrMsg2, OnlySize ) ! InData_AD14 CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42083,7 +44481,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL InflowWind_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IfW, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IfW + CALL AD14_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_AD14, ErrStat2, ErrMsg2, OnlySize ) ! OutData_AD14 CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42111,7 +44509,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL OpFM_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_OpFM, ErrStat2, ErrMsg2, OnlySize ) ! InData_OpFM + CALL AD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_AD, ErrStat2, ErrMsg2, OnlySize ) ! InData_AD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42139,7 +44537,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL OpFM_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_OpFM, ErrStat2, ErrMsg2, OnlySize ) ! OutData_OpFM + CALL AD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_AD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_AD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42167,7 +44565,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL HydroDyn_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_HD, ErrStat2, ErrMsg2, OnlySize ) ! InData_HD + CALL InflowWind_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IfW, ErrStat2, ErrMsg2, OnlySize ) ! InData_IfW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42195,7 +44593,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL HydroDyn_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_HD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_HD + CALL InflowWind_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IfW, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IfW CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42223,7 +44621,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SD, ErrStat2, ErrMsg2, OnlySize ) ! InData_SD + CALL OpFM_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_OpFM, ErrStat2, ErrMsg2, OnlySize ) ! InData_OpFM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42251,7 +44649,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_SD + CALL OpFM_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_OpFM, ErrStat2, ErrMsg2, OnlySize ) ! OutData_OpFM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42279,7 +44677,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL ExtPtfm_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_ExtPtfm, ErrStat2, ErrMsg2, OnlySize ) ! InData_ExtPtfm + CALL HydroDyn_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_HD, ErrStat2, ErrMsg2, OnlySize ) ! InData_HD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42307,7 +44705,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL ExtPtfm_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_ExtPtfm, ErrStat2, ErrMsg2, OnlySize ) ! OutData_ExtPtfm + CALL HydroDyn_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_HD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_HD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42335,7 +44733,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MAP_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_MAP, ErrStat2, ErrMsg2, OnlySize ) ! InData_MAP + CALL SD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SD, ErrStat2, ErrMsg2, OnlySize ) ! InData_SD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42363,7 +44761,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MAP_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_MAP, ErrStat2, ErrMsg2, OnlySize ) ! OutData_MAP + CALL SD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_SD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42391,7 +44789,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL FEAM_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_FEAM, ErrStat2, ErrMsg2, OnlySize ) ! InData_FEAM + CALL ExtPtfm_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_ExtPtfm, ErrStat2, ErrMsg2, OnlySize ) ! InData_ExtPtfm CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42419,7 +44817,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL FEAM_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_FEAM, ErrStat2, ErrMsg2, OnlySize ) ! OutData_FEAM + CALL ExtPtfm_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_ExtPtfm, ErrStat2, ErrMsg2, OnlySize ) ! OutData_ExtPtfm CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42447,7 +44845,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_MD, ErrStat2, ErrMsg2, OnlySize ) ! InData_MD + CALL MAP_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_MAP, ErrStat2, ErrMsg2, OnlySize ) ! InData_MAP CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42475,7 +44873,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL MD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_MD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_MD + CALL MAP_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_MAP, ErrStat2, ErrMsg2, OnlySize ) ! OutData_MAP CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42503,7 +44901,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL Orca_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_Orca, ErrStat2, ErrMsg2, OnlySize ) ! InData_Orca + CALL FEAM_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_FEAM, ErrStat2, ErrMsg2, OnlySize ) ! InData_FEAM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42531,7 +44929,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL Orca_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_Orca, ErrStat2, ErrMsg2, OnlySize ) ! OutData_Orca + CALL FEAM_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_FEAM, ErrStat2, ErrMsg2, OnlySize ) ! OutData_FEAM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42559,7 +44957,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL IceFloe_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IceF, ErrStat2, ErrMsg2, OnlySize ) ! InData_IceF + CALL MD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_MD, ErrStat2, ErrMsg2, OnlySize ) ! InData_MD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42587,7 +44985,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL IceFloe_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IceF, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IceF + CALL MD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_MD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_MD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42615,7 +45013,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL IceD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IceD, ErrStat2, ErrMsg2, OnlySize ) ! InData_IceD + CALL Orca_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_Orca, ErrStat2, ErrMsg2, OnlySize ) ! InData_Orca CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42643,7 +45041,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL IceD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IceD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IceD + CALL Orca_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_Orca, ErrStat2, ErrMsg2, OnlySize ) ! OutData_Orca CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42671,7 +45069,7 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SC_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_SC, ErrStat2, ErrMsg2, OnlySize ) ! InData_SC + CALL IceFloe_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IceF, ErrStat2, ErrMsg2, OnlySize ) ! InData_IceF CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -42699,7 +45097,63 @@ SUBROUTINE FAST_PackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL SC_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_SC, ErrStat2, ErrMsg2, OnlySize ) ! OutData_SC + CALL IceFloe_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IceF, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IceF + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL IceD_PackInitInput( Re_Buf, Db_Buf, Int_Buf, InData%InData_IceD, ErrStat2, ErrMsg2, OnlySize ) ! InData_IceD + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + CALL IceD_PackInitOutput( Re_Buf, Db_Buf, Int_Buf, InData%OutData_IceD, ErrStat2, ErrMsg2, OnlySize ) ! OutData_IceD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43605,167 +46059,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MAP_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_MAP, ErrStat2, ErrMsg2 ) ! InData_MAP - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MAP_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_MAP, ErrStat2, ErrMsg2 ) ! OutData_MAP - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL FEAM_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_FEAM, ErrStat2, ErrMsg2 ) ! InData_FEAM - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL FEAM_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_FEAM, ErrStat2, ErrMsg2 ) ! OutData_FEAM - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MD_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_MD, ErrStat2, ErrMsg2 ) ! InData_MD + CALL MAP_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_MAP, ErrStat2, ErrMsg2 ) ! InData_MAP CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43805,7 +46099,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL MD_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_MD, ErrStat2, ErrMsg2 ) ! OutData_MD + CALL MAP_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_MAP, ErrStat2, ErrMsg2 ) ! OutData_MAP CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43845,7 +46139,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL Orca_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_Orca, ErrStat2, ErrMsg2 ) ! InData_Orca + CALL FEAM_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_FEAM, ErrStat2, ErrMsg2 ) ! InData_FEAM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43885,7 +46179,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL Orca_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_Orca, ErrStat2, ErrMsg2 ) ! OutData_Orca + CALL FEAM_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_FEAM, ErrStat2, ErrMsg2 ) ! OutData_FEAM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43925,7 +46219,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL IceFloe_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_IceF, ErrStat2, ErrMsg2 ) ! InData_IceF + CALL MD_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_MD, ErrStat2, ErrMsg2 ) ! InData_MD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -43965,7 +46259,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL IceFloe_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_IceF, ErrStat2, ErrMsg2 ) ! OutData_IceF + CALL MD_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_MD, ErrStat2, ErrMsg2 ) ! OutData_MD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -44005,7 +46299,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL IceD_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_IceD, ErrStat2, ErrMsg2 ) ! InData_IceD + CALL Orca_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_Orca, ErrStat2, ErrMsg2 ) ! InData_Orca CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -44045,7 +46339,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL IceD_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_IceD, ErrStat2, ErrMsg2 ) ! OutData_IceD + CALL Orca_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_Orca, ErrStat2, ErrMsg2 ) ! OutData_Orca CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -44085,7 +46379,7 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SC_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_SC, ErrStat2, ErrMsg2 ) ! InData_SC + CALL IceFloe_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_IceF, ErrStat2, ErrMsg2 ) ! InData_IceF CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -44125,299 +46419,13 @@ SUBROUTINE FAST_UnPackInitData( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SC_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_SC, ErrStat2, ErrMsg2 ) ! OutData_SC + CALL IceFloe_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_IceF, ErrStat2, ErrMsg2 ) ! OutData_IceF CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE FAST_UnPackInitData - - SUBROUTINE FAST_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) - TYPE(FAST_MiscVarType), INTENT(IN) :: SrcMiscData - TYPE(FAST_MiscVarType), INTENT(INOUT) :: DstMiscData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CopyMisc' -! - ErrStat = ErrID_None - ErrMsg = "" - DstMiscData%TiLstPrn = SrcMiscData%TiLstPrn - DstMiscData%t_global = SrcMiscData%t_global - DstMiscData%NextJacCalcTime = SrcMiscData%NextJacCalcTime - DstMiscData%PrevClockTime = SrcMiscData%PrevClockTime - DstMiscData%UsrTime1 = SrcMiscData%UsrTime1 - DstMiscData%UsrTime2 = SrcMiscData%UsrTime2 - DstMiscData%StrtTime = SrcMiscData%StrtTime - DstMiscData%SimStrtTime = SrcMiscData%SimStrtTime - DstMiscData%calcJacobian = SrcMiscData%calcJacobian - CALL FAST_Copyexterninputtype( SrcMiscData%ExternInput, DstMiscData%ExternInput, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL FAST_Copymisclintype( SrcMiscData%Lin, DstMiscData%Lin, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE FAST_CopyMisc - - SUBROUTINE FAST_DestroyMisc( MiscData, ErrStat, ErrMsg ) - TYPE(FAST_MiscVarType), INTENT(INOUT) :: MiscData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_DestroyMisc' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL FAST_Destroyexterninputtype( MiscData%ExternInput, ErrStat, ErrMsg ) - CALL FAST_Destroymisclintype( MiscData%Lin, ErrStat, ErrMsg ) - END SUBROUTINE FAST_DestroyMisc - - SUBROUTINE FAST_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(FAST_MiscVarType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_PackMisc' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Db_BufSz = Db_BufSz + 1 ! TiLstPrn - Db_BufSz = Db_BufSz + 1 ! t_global - Db_BufSz = Db_BufSz + 1 ! NextJacCalcTime - Re_BufSz = Re_BufSz + 1 ! PrevClockTime - Re_BufSz = Re_BufSz + 1 ! UsrTime1 - Re_BufSz = Re_BufSz + 1 ! UsrTime2 - Int_BufSz = Int_BufSz + SIZE(InData%StrtTime) ! StrtTime - Int_BufSz = Int_BufSz + SIZE(InData%SimStrtTime) ! SimStrtTime - Int_BufSz = Int_BufSz + 1 ! calcJacobian - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! ExternInput: size of buffers for each call to pack subtype - CALL FAST_Packexterninputtype( Re_Buf, Db_Buf, Int_Buf, InData%ExternInput, ErrStat2, ErrMsg2, .TRUE. ) ! ExternInput - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! ExternInput - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! ExternInput - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! ExternInput - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! Lin: size of buffers for each call to pack subtype - CALL FAST_Packmisclintype( Re_Buf, Db_Buf, Int_Buf, InData%Lin, ErrStat2, ErrMsg2, .TRUE. ) ! Lin - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! Lin - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! Lin - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! Lin - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DbKiBuf(Db_Xferred) = InData%TiLstPrn - Db_Xferred = Db_Xferred + 1 - DbKiBuf(Db_Xferred) = InData%t_global - Db_Xferred = Db_Xferred + 1 - DbKiBuf(Db_Xferred) = InData%NextJacCalcTime - Db_Xferred = Db_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%PrevClockTime - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%UsrTime1 - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%UsrTime2 - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%StrtTime,1), UBOUND(InData%StrtTime,1) - IntKiBuf(Int_Xferred) = InData%StrtTime(i1) - Int_Xferred = Int_Xferred + 1 - END DO - DO i1 = LBOUND(InData%SimStrtTime,1), UBOUND(InData%SimStrtTime,1) - IntKiBuf(Int_Xferred) = InData%SimStrtTime(i1) - Int_Xferred = Int_Xferred + 1 - END DO - IntKiBuf(Int_Xferred) = TRANSFER(InData%calcJacobian, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - CALL FAST_Packexterninputtype( Re_Buf, Db_Buf, Int_Buf, InData%ExternInput, ErrStat2, ErrMsg2, OnlySize ) ! ExternInput - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL FAST_Packmisclintype( Re_Buf, Db_Buf, Int_Buf, InData%Lin, ErrStat2, ErrMsg2, OnlySize ) ! Lin - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE FAST_PackMisc - - SUBROUTINE FAST_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(FAST_MiscVarType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_UnPackMisc' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%TiLstPrn = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - OutData%t_global = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - OutData%NextJacCalcTime = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - OutData%PrevClockTime = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%UsrTime1 = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%UsrTime2 = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%StrtTime,1) - i1_u = UBOUND(OutData%StrtTime,1) - DO i1 = LBOUND(OutData%StrtTime,1), UBOUND(OutData%StrtTime,1) - OutData%StrtTime(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - i1_l = LBOUND(OutData%SimStrtTime,1) - i1_u = UBOUND(OutData%SimStrtTime,1) - DO i1 = LBOUND(OutData%SimStrtTime,1), UBOUND(OutData%SimStrtTime,1) - OutData%SimStrtTime(i1) = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - END DO - OutData%calcJacobian = TRANSFER(IntKiBuf(Int_Xferred), OutData%calcJacobian) - Int_Xferred = Int_Xferred + 1 Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -44451,7 +46459,7 @@ SUBROUTINE FAST_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FAST_Unpackexterninputtype( Re_Buf, Db_Buf, Int_Buf, OutData%ExternInput, ErrStat2, ErrMsg2 ) ! ExternInput + CALL IceD_UnpackInitInput( Re_Buf, Db_Buf, Int_Buf, OutData%InData_IceD, ErrStat2, ErrMsg2 ) ! InData_IceD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -44491,14 +46499,14 @@ SUBROUTINE FAST_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FAST_Unpackmisclintype( Re_Buf, Db_Buf, Int_Buf, OutData%Lin, ErrStat2, ErrMsg2 ) ! Lin + CALL IceD_UnpackInitOutput( Re_Buf, Db_Buf, Int_Buf, OutData%OutData_IceD, ErrStat2, ErrMsg2 ) ! OutData_IceD CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE FAST_UnPackMisc + END SUBROUTINE FAST_UnPackInitData SUBROUTINE FAST_CopyExternInitType( SrcExternInitTypeData, DstExternInitTypeData, CtrlCode, ErrStat, ErrMsg ) TYPE(FAST_ExternInitType), INTENT(IN) :: SrcExternInitTypeData @@ -44520,8 +46528,33 @@ SUBROUTINE FAST_CopyExternInitType( SrcExternInitTypeData, DstExternInitTypeData DstExternInitTypeData%LidRadialVel = SrcExternInitTypeData%LidRadialVel DstExternInitTypeData%TurbineID = SrcExternInitTypeData%TurbineID DstExternInitTypeData%TurbinePos = SrcExternInitTypeData%TurbinePos + DstExternInitTypeData%NumSC2CtrlGlob = SrcExternInitTypeData%NumSC2CtrlGlob DstExternInitTypeData%NumSC2Ctrl = SrcExternInitTypeData%NumSC2Ctrl DstExternInitTypeData%NumCtrl2SC = SrcExternInitTypeData%NumCtrl2SC +IF (ALLOCATED(SrcExternInitTypeData%fromSCGlob)) THEN + i1_l = LBOUND(SrcExternInitTypeData%fromSCGlob,1) + i1_u = UBOUND(SrcExternInitTypeData%fromSCGlob,1) + IF (.NOT. ALLOCATED(DstExternInitTypeData%fromSCGlob)) THEN + ALLOCATE(DstExternInitTypeData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstExternInitTypeData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstExternInitTypeData%fromSCGlob = SrcExternInitTypeData%fromSCGlob +ENDIF +IF (ALLOCATED(SrcExternInitTypeData%fromSC)) THEN + i1_l = LBOUND(SrcExternInitTypeData%fromSC,1) + i1_u = UBOUND(SrcExternInitTypeData%fromSC,1) + IF (.NOT. ALLOCATED(DstExternInitTypeData%fromSC)) THEN + ALLOCATE(DstExternInitTypeData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstExternInitTypeData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstExternInitTypeData%fromSC = SrcExternInitTypeData%fromSC +ENDIF DstExternInitTypeData%FarmIntegration = SrcExternInitTypeData%FarmIntegration DstExternInitTypeData%windGrid_n = SrcExternInitTypeData%windGrid_n DstExternInitTypeData%windGrid_delta = SrcExternInitTypeData%windGrid_delta @@ -44540,6 +46573,12 @@ SUBROUTINE FAST_DestroyExternInitType( ExternInitTypeData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" +IF (ALLOCATED(ExternInitTypeData%fromSCGlob)) THEN + DEALLOCATE(ExternInitTypeData%fromSCGlob) +ENDIF +IF (ALLOCATED(ExternInitTypeData%fromSC)) THEN + DEALLOCATE(ExternInitTypeData%fromSC) +ENDIF END SUBROUTINE FAST_DestroyExternInitType SUBROUTINE FAST_PackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -44582,8 +46621,19 @@ SUBROUTINE FAST_PackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + 1 ! LidRadialVel Int_BufSz = Int_BufSz + 1 ! TurbineID Re_BufSz = Re_BufSz + SIZE(InData%TurbinePos) ! TurbinePos + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + Int_BufSz = Int_BufSz + 1 ! fromSCGlob allocated yes/no + IF ( ALLOCATED(InData%fromSCGlob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCGlob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCGlob) ! fromSCGlob + END IF + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF Int_BufSz = Int_BufSz + 1 ! FarmIntegration Int_BufSz = Int_BufSz + SIZE(InData%windGrid_n) ! windGrid_n Re_BufSz = Re_BufSz + SIZE(InData%windGrid_delta) ! windGrid_delta @@ -44630,10 +46680,42 @@ SUBROUTINE FAST_PackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ReKiBuf(Re_Xferred) = InData%TurbinePos(i1) Re_Xferred = Re_Xferred + 1 END DO + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumCtrl2SC Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%fromSCGlob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCGlob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCGlob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCGlob,1), UBOUND(InData%fromSCGlob,1) + ReKiBuf(Re_Xferred) = InData%fromSCGlob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF IntKiBuf(Int_Xferred) = TRANSFER(InData%FarmIntegration, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 DO i1 = LBOUND(InData%windGrid_n,1), UBOUND(InData%windGrid_n,1) @@ -44699,10 +46781,48 @@ SUBROUTINE FAST_UnPackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSt OutData%TurbinePos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCGlob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCGlob)) DEALLOCATE(OutData%fromSCGlob) + ALLOCATE(OutData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCGlob,1), UBOUND(OutData%fromSCGlob,1) + OutData%fromSCGlob(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF OutData%FarmIntegration = TRANSFER(IntKiBuf(Int_Xferred), OutData%FarmIntegration) Int_Xferred = Int_Xferred + 1 i1_l = LBOUND(OutData%windGrid_n,1) @@ -44781,7 +46901,7 @@ SUBROUTINE FAST_CopyTurbineType( SrcTurbineTypeData, DstTurbineTypeData, CtrlCod CALL FAST_Copyopenfoam_data( SrcTurbineTypeData%OpFM, DstTurbineTypeData%OpFM, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL FAST_Copysupercontroller_data( SrcTurbineTypeData%SC, DstTurbineTypeData%SC, CtrlCode, ErrStat2, ErrMsg2 ) + CALL FAST_Copyscdataex_data( SrcTurbineTypeData%SC_DX, DstTurbineTypeData%SC_DX, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN CALL FAST_Copyhydrodyn_data( SrcTurbineTypeData%HD, DstTurbineTypeData%HD, CtrlCode, ErrStat2, ErrMsg2 ) @@ -44833,7 +46953,7 @@ SUBROUTINE FAST_DestroyTurbineType( TurbineTypeData, ErrStat, ErrMsg ) CALL FAST_Destroyaerodyn14_data( TurbineTypeData%AD14, ErrStat, ErrMsg ) CALL FAST_Destroyinflowwind_data( TurbineTypeData%IfW, ErrStat, ErrMsg ) CALL FAST_Destroyopenfoam_data( TurbineTypeData%OpFM, ErrStat, ErrMsg ) - CALL FAST_Destroysupercontroller_data( TurbineTypeData%SC, ErrStat, ErrMsg ) + CALL FAST_Destroyscdataex_data( TurbineTypeData%SC_DX, ErrStat, ErrMsg ) CALL FAST_Destroyhydrodyn_data( TurbineTypeData%HD, ErrStat, ErrMsg ) CALL FAST_Destroysubdyn_data( TurbineTypeData%SD, ErrStat, ErrMsg ) CALL FAST_Destroymap_data( TurbineTypeData%MAP, ErrStat, ErrMsg ) @@ -45069,20 +47189,20 @@ SUBROUTINE FAST_PackTurbineType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! SC: size of buffers for each call to pack subtype - CALL FAST_Packsupercontroller_data( Re_Buf, Db_Buf, Int_Buf, InData%SC, ErrStat2, ErrMsg2, .TRUE. ) ! SC + Int_BufSz = Int_BufSz + 3 ! SC_DX: size of buffers for each call to pack subtype + CALL FAST_Packscdataex_data( Re_Buf, Db_Buf, Int_Buf, InData%SC_DX, ErrStat2, ErrMsg2, .TRUE. ) ! SC_DX CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SC + IF(ALLOCATED(Re_Buf)) THEN ! SC_DX Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SC + IF(ALLOCATED(Db_Buf)) THEN ! SC_DX Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SC + IF(ALLOCATED(Int_Buf)) THEN ! SC_DX Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF @@ -45576,7 +47696,7 @@ SUBROUTINE FAST_PackTurbineType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL FAST_Packsupercontroller_data( Re_Buf, Db_Buf, Int_Buf, InData%SC, ErrStat2, ErrMsg2, OnlySize ) ! SC + CALL FAST_Packscdataex_data( Re_Buf, Db_Buf, Int_Buf, InData%SC_DX, ErrStat2, ErrMsg2, OnlySize ) ! SC_DX CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -46359,7 +48479,7 @@ SUBROUTINE FAST_UnPackTurbineType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL FAST_Unpacksupercontroller_data( Re_Buf, Db_Buf, Int_Buf, OutData%SC, ErrStat2, ErrMsg2 ) ! SC + CALL FAST_Unpackscdataex_data( Re_Buf, Db_Buf, Int_Buf, OutData%SC_DX, ErrStat2, ErrMsg2 ) ! SC_DX CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN diff --git a/modules/openfoam/src/OpenFOAM.f90 b/modules/openfoam/src/OpenFOAM.f90 index 807f2644ba..a45b1d5259 100644 --- a/modules/openfoam/src/OpenFOAM.f90 +++ b/modules/openfoam/src/OpenFOAM.f90 @@ -82,11 +82,11 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, CALL SetErrStat(ErrID_Fatal, 'Error AeroDyn14 is not supported yet with different number of velocity and force actuator nodes', ErrStat, ErrMsg, RoutineName) RETURN ELSEIF ( p_FAST%CompAero == Module_AD ) THEN ! AeroDyn 15 needs these velocities - OpFM%p%NumBl = SIZE( u_AD%BladeMotion, 1 ) + OpFM%p%NumBl = SIZE( u_AD%rotors(1)%BladeMotion, 1 ) - OpFM%p%NnodesVel = OpFM%p%NnodesVel + y_AD%TowerLoad%NNodes ! tower nodes (if any) + OpFM%p%NnodesVel = OpFM%p%NnodesVel + y_AD%rotors(1)%TowerLoad%NNodes ! tower nodes (if any) DO k=1,OpFM%p%NumBl - OpFM%p%NnodesVel = OpFM%p%NnodesVel + u_AD%BladeMotion(k)%NNodes ! blade nodes + OpFM%p%NnodesVel = OpFM%p%NnodesVel + u_AD%rotors(1)%BladeMotion(k)%NNodes ! blade nodes END DO END IF @@ -96,7 +96,7 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, OpFM%p%NnodesForce = 1 + OpFM%p%NumBl * InitInp%NumActForcePtsBlade OpFM%p%BladeLength = InitInp%BladeLength - if ( y_AD%TowerLoad%NNodes > 0 ) then + if ( y_AD%rotors(1)%TowerLoad%NNodes > 0 ) then OpFM%p%NMappings = OpFM%p%NumBl + 1 OpFM%p%TowerHeight = InitInp%TowerHeight OpFM%p%TowerBaseHeight = InitInp%TowerBaseHeight @@ -131,12 +131,6 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, CALL AllocPAry( OpFM%u%momentz, OpFM%p%NnodesForce, 'momentz', ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AllocPAry( OpFM%u%forceNodesChord, OpFM%p%NnodesForce, 'forceNodesChord', ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - IF (InitInp%NumCtrl2SC > 0) THEN - CALL AllocPAry( OpFM%u%SuperController, InitInp%NumCtrl2SC, 'u%SuperController', ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF - IF (ErrStat >= AbortErrLev) RETURN ! make sure the C versions are synced with these arrays @@ -157,11 +151,6 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, OpFM%u%c_obj%momenty_Len = OpFM%p%NnodesForce; OpFM%u%c_obj%momenty = C_LOC( OpFM%u%momenty(1) ) OpFM%u%c_obj%momentz_Len = OpFM%p%NnodesForce; OpFM%u%c_obj%momentz = C_LOC( OpFM%u%momentz(1) ) OpFM%u%c_obj%forceNodesChord_Len = OpFM%p%NnodesForce; OpFM%u%c_obj%forceNodesChord = C_LOC( OpFM%u%forceNodesChord(1) ) - if (InitInp%NumCtrl2SC > 0) then - OpFM%u%c_obj%SuperController_Len = InitInp%NumCtrl2SC - OpFM%u%c_obj%SuperController = C_LOC( OpFM%u%SuperController(1) ) - OpFM%u%SuperController = 0.0_ReKi - end if ! initialize the arrays: call OpFM_CreateActForceBladeTowerNodes(OpFM%p, ErrStat2, ErrMsg2) !Creates the blade and tower nodes in radial and tower height co-ordinates @@ -205,7 +194,7 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, ELSEIF (p_FAST%CompElast == Module_BD ) THEN ! call MeshMapCreate( BD%y(k)%BldMotion, OpFM%m%ActForceMotions(k), OpFM%m%Line2_to_Line2_Motions(k), ErrStat2, ErrMsg2 ); END IF - call MeshMapCreate( y_AD%BladeLoad(k), OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2 ); + call MeshMapCreate( y_AD%rotors(1)%BladeLoad(k), OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2 ); call MeshMapCreate( OpFM%m%ActForceMotions(k), OpFM%m%ActForceMotionsPoints(k), OpFM%m%Line2_to_Point_Motions(k), ErrStat2, ErrMsg2 ); call MeshMapCreate( OpFM%m%ActForceLoads(k), OpFM%m%ActForceLoadsPoints(k), OpFM%m%Line2_to_Point_Loads(k), ErrStat2, ErrMsg2 ); @@ -216,8 +205,8 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, call MeshMapCreate( y_ED%TowerLn2Mesh, OpFM%m%ActForceMotions(k), OpFM%m%Line2_to_Line2_Motions(k), ErrStat2, ErrMsg2 ); call MeshMapCreate( OpFM%m%ActForceMotions(k), OpFM%m%ActForceMotionsPoints(k), OpFM%m%Line2_to_Point_Motions(k), ErrStat2, ErrMsg2 ); - if ( y_AD%TowerLoad%nnodes > 0 ) then ! we can have an input mesh on the tower without having an output mesh. - call MeshMapCreate( y_AD%TowerLoad, OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2 ); + if ( y_AD%rotors(1)%TowerLoad%nnodes > 0 ) then ! we can have an input mesh on the tower without having an output mesh. + call MeshMapCreate( y_AD%rotors(1)%TowerLoad, OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2 ); call MeshMapCreate( OpFM%m%ActForceLoads(k), OpFM%m%ActForceLoadsPoints(k), OpFM%m%Line2_to_Point_Loads(k), ErrStat2, ErrMsg2 ); ! OpFM%m%ActForceLoads(k)%RemapFlag = .false. end if @@ -235,10 +224,6 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, CALL AllocPAry( OpFM%y%u, OpFM%p%NnodesVel, 'u', ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AllocPAry( OpFM%y%v, OpFM%p%NnodesVel, 'v', ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) CALL AllocPAry( OpFM%y%w, OpFM%p%NnodesVel, 'w', ErrStat2, ErrMsg2 ); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - if (InitInp%NumSC2Ctrl > 0) then - CALL AllocPAry( OpFM%y%SuperController, InitInp%NumSC2Ctrl, 'y%SuperController', ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - end if IF (ErrStat >= AbortErrLev) RETURN @@ -247,12 +232,6 @@ SUBROUTINE Init_OpFM( InitInp, p_FAST, AirDens, u_AD14, u_AD, initOut_AD, y_AD, OpFM%y%c_obj%v_Len = OpFM%p%NnodesVel; OpFM%y%c_obj%v = C_LOC( OpFM%y%v(1) ) OpFM%y%c_obj%w_Len = OpFM%p%NnodesVel; OpFM%y%c_obj%w = C_LOC( OpFM%y%w(1) ) - if (InitInp%NumSC2Ctrl > 0) then - OpFM%y%c_obj%SuperController_Len = InitInp%NumSC2Ctrl - OpFM%y%c_obj%SuperController = C_LOC( OpFM%y%SuperController(1) ) - end if - - !............................................................................................ ! Define initialization-routine output (including writeOutput array) here: @@ -309,11 +288,6 @@ SUBROUTINE OpFM_SetInputs( p_FAST, p_AD14, u_AD14, y_AD14, u_AD, y_AD, y_ED, y_S call SetOpFMForces(p_FAST, p_AD14, u_AD14, y_AD14, u_AD, y_AD, y_ED, OpFM, ErrStat2, ErrMsg2) call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - ! set SuperController inputs - if (p_FAST%CompServo == Module_SrvD) then - if (allocated(y_SrvD%SuperController).and. associated(OpFM%u%SuperController)) OpFM%u%SuperController = y_SrvD%SuperController - end if - END SUBROUTINE OpFM_SetInputs !---------------------------------------------------------------------------------------------------------------------------------- @@ -344,24 +318,24 @@ SUBROUTINE SetOpFMPositions(p_FAST, u_AD14, u_AD, y_ED, OpFM) ! blade nodes - DO K = 1,SIZE(u_AD%BladeMotion) - DO J = 1,u_AD%BladeMotion(k)%Nnodes + DO K = 1,SIZE(u_AD%rotors(1)%BladeMotion) + DO J = 1,u_AD%rotors(1)%BladeMotion(k)%Nnodes Node = Node + 1 - OpFM%u%pxVel(Node) = u_AD%BladeMotion(k)%TranslationDisp(1,j) + u_AD%BladeMotion(k)%Position(1,j) - OpFM%u%pyVel(Node) = u_AD%BladeMotion(k)%TranslationDisp(2,j) + u_AD%BladeMotion(k)%Position(2,j) - OpFM%u%pzVel(Node) = u_AD%BladeMotion(k)%TranslationDisp(3,j) + u_AD%BladeMotion(k)%Position(3,j) + OpFM%u%pxVel(Node) = u_AD%rotors(1)%BladeMotion(k)%TranslationDisp(1,j) + u_AD%rotors(1)%BladeMotion(k)%Position(1,j) + OpFM%u%pyVel(Node) = u_AD%rotors(1)%BladeMotion(k)%TranslationDisp(2,j) + u_AD%rotors(1)%BladeMotion(k)%Position(2,j) + OpFM%u%pzVel(Node) = u_AD%rotors(1)%BladeMotion(k)%TranslationDisp(3,j) + u_AD%rotors(1)%BladeMotion(k)%Position(3,j) END DO !J = 1,p%BldNodes ! Loop through the blade nodes / elements END DO !K = 1,p%NumBl if (OpFM%p%NMappings .gt. OpFM%p%NumBl) then ! tower nodes - DO J=1,u_AD%TowerMotion%nnodes + DO J=1,u_AD%rotors(1)%TowerMotion%nnodes Node = Node + 1 - OpFM%u%pxVel(Node) = u_AD%TowerMotion%TranslationDisp(1,J) + u_AD%TowerMotion%Position(1,J) - OpFM%u%pyVel(Node) = u_AD%TowerMotion%TranslationDisp(2,J) + u_AD%TowerMotion%Position(2,J) - OpFM%u%pzVel(Node) = u_AD%TowerMotion%TranslationDisp(3,J) + u_AD%TowerMotion%Position(3,J) + OpFM%u%pxVel(Node) = u_AD%rotors(1)%TowerMotion%TranslationDisp(1,J) + u_AD%rotors(1)%TowerMotion%Position(1,J) + OpFM%u%pyVel(Node) = u_AD%rotors(1)%TowerMotion%TranslationDisp(2,J) + u_AD%rotors(1)%TowerMotion%Position(2,J) + OpFM%u%pzVel(Node) = u_AD%rotors(1)%TowerMotion%TranslationDisp(3,J) + u_AD%rotors(1)%TowerMotion%Position(3,J) END DO end if @@ -496,11 +470,11 @@ SUBROUTINE SetOpFMForces(p_FAST, p_AD14, u_AD14, y_AD14, u_AD, y_AD, y_ED, OpFM, #ifdef DEBUG_OPENFOAM DO J = 1,u_AD%BladeMotion(k)%NNodes - write(aerodynForcesFile,*) u_AD%BladeMotion(k)%TranslationDisp(1,j) + u_AD%BladeMotion(k)%Position(1,j), ', ', u_AD%BladeMotion(k)%TranslationDisp(2,j) + u_AD%BladeMotion(k)%Position(2,j), ', ', u_AD%BladeMotion(k)%TranslationDisp(3,j) + u_AD%BladeMotion(k)%Position(3,j), ', ', OpFM%y%u(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%v(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%w(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', y_AD%BladeLoad(k)%Force(1,j), ', ', y_AD%BladeLoad(k)%Force(2,j), ', ', y_AD%BladeLoad(k)%Force(2,j) + write(aerodynForcesFile,*) u_AD%BladeMotion(k)%TranslationDisp(1,j) + u_AD%BladeMotion(k)%Position(1,j), ', ', u_AD%BladeMotion(k)%TranslationDisp(2,j) + u_AD%BladeMotion(k)%Position(2,j), ', ', u_AD%BladeMotion(k)%TranslationDisp(3,j) + u_AD%BladeMotion(k)%Position(3,j), ', ', OpFM%y%u(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%v(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%w(1 + (k-1)*u_AD%BladeMotion(k)%NNodes + j), ', ', y_AD%rotors(1)%BladeLoad(k)%Force(1,j), ', ', y_AD%rotors(1)%BladeLoad(k)%Force(2,j), ', ', y_AD%rotors(1)%BladeLoad(k)%Force(2,j) END DO #endif - call Transfer_Line2_to_Line2( y_AD%BladeLoad(k), OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), OpFM%m%ActForceMotions(k) ) + call Transfer_Line2_to_Line2( y_AD%rotors(1)%BladeLoad(k), OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%BladeMotion(k), OpFM%m%ActForceMotions(k) ) call Transfer_Line2_to_Point( OpFM%m%ActForceLoads(k), OpFM%m%ActForceLoadsPoints(k), OpFM%m%Line2_to_Point_Loads(k), ErrStat2, ErrMsg2, OpFM%m%ActForceMotions(k), OpFM%m%ActForceMotionsPoints(k) ) DO J = 1, OpFM%p%NnodesForceBlade @@ -528,12 +502,12 @@ SUBROUTINE SetOpFMForces(p_FAST, p_AD14, u_AD14, y_AD14, u_AD, y_AD, y_ED, OpFM, DO K = OpFM%p%NumBl+1,OpFM%p%NMappings #ifdef DEBUG_OPENFOAM - DO J = 1,u_AD%TowerMotion%NNodes - write(aerodynForcesFile,*) u_AD%TowerMotion%TranslationDisp(1,j) + u_AD%TowerMotion%Position(1,j), ', ', u_AD%TowerMotion%TranslationDisp(2,j) + u_AD%TowerMotion%Position(2,j), ', ', u_AD%TowerMotion%TranslationDisp(3,j) + u_AD%TowerMotion%Position(3,j), ', ', OpFM%y%u(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%v(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%w(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', y_AD%TowerLoad%Force(1,j), ', ', y_AD%TowerLoad%Force(2,j), ', ', y_AD%TowerLoad%Force(2,j) + DO J = 1,u_AD%rotors(1)%TowerMotion%NNodes + write(aerodynForcesFile,*) u_AD%rotors(1)%TowerMotion%TranslationDisp(1,j) + u_AD%rotors(1)%TowerMotion%Position(1,j), ', ', u_AD%rotors(1)%TowerMotion%TranslationDisp(2,j) + u_AD%rotors(1)%TowerMotion%Position(2,j), ', ', u_AD%TowerMotion%TranslationDisp(3,j) + u_AD%TowerMotion%Position(3,j), ', ', OpFM%y%u(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%v(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', OpFM%y%w(1 + OpFM%p%NumBl*u_AD%BladeMotion(k)%NNodes + j), ', ', y_AD%rotors(1)%TowerLoad%Force(1,j), ', ', y_AD%rotors(1)%TowerLoad%Force(2,j), ', ', y_AD%rotors(1)%TowerLoad%Force(2,j) END DO #endif - call Transfer_Line2_to_Line2( y_AD%TowerLoad, OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2, u_AD%TowerMotion, OpFM%m%ActForceMotions(k) ) + call Transfer_Line2_to_Line2( y_AD%rotors(1)%TowerLoad, OpFM%m%ActForceLoads(k), OpFM%m%Line2_to_Line2_Loads(k), ErrStat2, ErrMsg2, u_AD%rotors(1)%TowerMotion, OpFM%m%ActForceMotions(k) ) call Transfer_Line2_to_Point( OpFM%m%ActForceLoads(k), OpFM%m%ActForceLoadsPoints(k), OpFM%m%Line2_to_Point_Loads(k), ErrStat2, ErrMsg2, OpFM%m%ActForceMotions(k), OpFM%m%ActForceMotionsPoints(k) ) DO J=1,OpFM%p%NnodesForceTower @@ -1164,19 +1138,19 @@ SUBROUTINE OpFM_InterpolateForceNodesChord(InitOut_AD, p_OpFM, u_OpFM, ErrStat, ! The blades first do k = 1, p_OpFM%NumBl ! Calculate the chord at the force nodes based on interpolation - nNodesBladeProps = SIZE(InitOut_AD%BladeProps(k)%BlChord) + nNodesBladeProps = SIZE(InitOut_AD%rotors(1)%BladeProps(k)%BlChord) DO I=1,p_OpFM%NnodesForceBlade Node = Node + 1 do jLower = 1, (nNodesBladeProps - 1) - if ( (InitOut_AD%BladeProps(k)%BlSpn(jLower) - p_OpFM%forceBldRnodes(I))*(InitOut_AD%BladeProps(k)%BlSpn(jLower+1) - p_OpFM%forceBldRnodes(I)) .le. 0 ) then + if ( (InitOut_AD%rotors(1)%BladeProps(k)%BlSpn(jLower) - p_OpFM%forceBldRnodes(I))*(InitOut_AD%rotors(1)%BladeProps(k)%BlSpn(jLower+1) - p_OpFM%forceBldRnodes(I)) .le. 0 ) then exit endif enddo if (jLower .lt. nNodesBladeProps) then - rInterp = (p_OpFM%forceBldRnodes(I) - InitOut_AD%BladeProps(k)%BlSpn(jLower))/(InitOut_AD%BladeProps(k)%BlSpn(jLower+1)-InitOut_AD%BladeProps(k)%BlSpn(jLower)) ! The location of this force node in (0,1) co-ordinates between the jLower and jLower+1 nodes - u_OpFM%forceNodesChord(Node) = InitOut_AD%BladeProps(k)%BlChord(jLower) + rInterp * (InitOut_AD%BladeProps(k)%BlChord(jLower+1) - InitOut_AD%BladeProps(k)%BlChord(jLower)) + rInterp = (p_OpFM%forceBldRnodes(I) - InitOut_AD%rotors(1)%BladeProps(k)%BlSpn(jLower))/(InitOut_AD%rotors(1)%BladeProps(k)%BlSpn(jLower+1)-InitOut_AD%rotors(1)%BladeProps(k)%BlSpn(jLower)) ! The location of this force node in (0,1) co-ordinates between the jLower and jLower+1 nodes + u_OpFM%forceNodesChord(Node) = InitOut_AD%rotors(1)%BladeProps(k)%BlChord(jLower) + rInterp * (InitOut_AD%rotors(1)%BladeProps(k)%BlChord(jLower+1) - InitOut_AD%rotors(1)%BladeProps(k)%BlChord(jLower)) else - u_OpFM%forceNodesChord(Node) = InitOut_AD%BladeProps(k)%BlChord(nNodesBladeProps) !Work around for when the last node of the actuator mesh is slightly outside of the Aerodyn blade properties. Surprisingly this is not an issue with the tower. + u_OpFM%forceNodesChord(Node) = InitOut_AD%rotors(1)%BladeProps(k)%BlChord(nNodesBladeProps) !Work around for when the last node of the actuator mesh is slightly outside of the Aerodyn blade properties. Surprisingly this is not an issue with the tower. end if END DO @@ -1186,20 +1160,20 @@ SUBROUTINE OpFM_InterpolateForceNodesChord(InitOut_AD, p_OpFM, u_OpFM, ErrStat, ! The tower now do k = p_OpFM%NumBl+1,p_OpFM%NMappings - nNodesTowerProps = SIZE(InitOut_AD%TwrElev) + nNodesTowerProps = SIZE(InitOut_AD%rotors(1)%TwrElev) ! Calculate the chord at the force nodes based on interpolation DO I=1,p_OpFM%NnodesForceTower Node = Node + 1 do jLower = 1, (nNodesTowerProps - 1) - if ( (InitOut_AD%TwrElev(jLower) - p_OpFM%forceTwrHnodes(I)-p_OpFM%TowerBaseHeight)*(InitOut_AD%TwrElev(jLower+1) - p_OpFM%forceTwrHnodes(I)-p_OpFM%TowerBaseHeight) .le. 0) then + if ( (InitOut_AD%rotors(1)%TwrElev(jLower) - p_OpFM%forceTwrHnodes(I)-p_OpFM%TowerBaseHeight)*(InitOut_AD%rotors(1)%TwrElev(jLower+1) - p_OpFM%forceTwrHnodes(I)-p_OpFM%TowerBaseHeight) .le. 0) then exit endif enddo if (jLower .lt. nNodesTowerProps) then - rInterp = (p_OpFM%forceTwrHnodes(I)+p_OpFM%TowerBaseHeight - InitOut_AD%TwrElev(jLower))/(InitOut_AD%TwrElev(jLower+1)-InitOut_AD%TwrElev(jLower)) ! The location of this force node in (0,1) co-ordinates between the jLower and jLower+1 nodes - u_OpFM%forceNodesChord(Node) = InitOut_AD%TwrDiam(jLower) + rInterp * (InitOut_AD%TwrDiam(jLower+1) - InitOut_AD%TwrDiam(jLower)) + rInterp = (p_OpFM%forceTwrHnodes(I)+p_OpFM%TowerBaseHeight - InitOut_AD%rotors(1)%TwrElev(jLower))/(InitOut_AD%rotors(1)%TwrElev(jLower+1)-InitOut_AD%rotors(1)%TwrElev(jLower)) ! The location of this force node in (0,1) co-ordinates between the jLower and jLower+1 nodes + u_OpFM%forceNodesChord(Node) = InitOut_AD%rotors(1)%TwrDiam(jLower) + rInterp * (InitOut_AD%rotors(1)%TwrDiam(jLower+1) - InitOut_AD%rotors(1)%TwrDiam(jLower)) else - u_OpFM%forceNodesChord(Node) = InitOut_AD%TwrDiam(nNodesTowerProps) !Work around for when the last node of the actuator mesh is slightly outside of the Aerodyn tower properties. + u_OpFM%forceNodesChord(Node) = InitOut_AD%rotors(1)%TwrDiam(nNodesTowerProps) !Work around for when the last node of the actuator mesh is slightly outside of the Aerodyn tower properties. end if END DO end do diff --git a/modules/openfoam/src/OpenFOAM_Registry.txt b/modules/openfoam/src/OpenFOAM_Registry.txt index f714a11e5c..bb1e5a0f0a 100644 --- a/modules/openfoam/src/OpenFOAM_Registry.txt +++ b/modules/openfoam/src/OpenFOAM_Registry.txt @@ -11,9 +11,7 @@ include Registry_NWTC_Library.txt # ..... OpenFOAM_InitInputType data ....................................................................................................... -typedef OpenFOAM/OpFM InitInputType IntKi NumSC2Ctrl - - - "number of controller inputs [from supercontroller]" - -typedef ^ ^ IntKi NumCtrl2SC - - - "number of controller outputs [to supercontroller]" - -typedef ^ ^ IntKi NumActForcePtsBlade - - - "number of actuator line force points in blade" - +typedef OpenFOAM/OpFM InitInputType IntKi NumActForcePtsBlade - - - "number of actuator line force points in blade" - typedef ^ ^ IntKi NumActForcePtsTower - - - "number of actuator line force points in tower" - typedef ^ ^ ReKi StructBldRNodes {:} - - "Radius to structural model analysis nodes relative to hub" typedef ^ ^ ReKi StructTwrHNodes {:} - - "Location of variable-spaced structural model tower nodes (relative to the tower rigid base height)" @@ -75,11 +73,9 @@ typedef ^ InputType ReKi momentx {:} - - "normalized x moment at actuator force typedef ^ InputType ReKi momenty {:} - - "normalized y moment at actuator force nodes" "Nm/kg/m^3" typedef ^ InputType ReKi momentz {:} - - "normalized z moment at actuator force nodes" "Nm/kg/m^3" typedef ^ InputType ReKi forceNodesChord {:} - - "chord distribution at the actuator force nodes" "m" -typedef ^ InputType ReKi SuperController {:} - - "inputs to the super controller (from the turbine controller)" - # ..... OpenFOAM_OutputType data ....................................................................................................... typedef OpenFOAM/OpFM OutputType ReKi u {:} - - "U-component wind speed (in the X-direction) at interface nodes" m/s typedef ^ OutputType ReKi v {:} - - "V-component wind speed (in the Y-direction) at interface nodes" m/s typedef ^ OutputType ReKi w {:} - - "W-component wind speed (in the Z-direction) at interface nodes" m/s -typedef ^ OutputType ReKi SuperController {:} - - "outputs of the super controller (to the turbine controller)" - typedef ^ OutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" diff --git a/modules/openfoam/src/OpenFOAM_Types.f90 b/modules/openfoam/src/OpenFOAM_Types.f90 index d613cd232a..cea50b0c4a 100644 --- a/modules/openfoam/src/OpenFOAM_Types.f90 +++ b/modules/openfoam/src/OpenFOAM_Types.f90 @@ -37,8 +37,6 @@ MODULE OpenFOAM_Types ! ========= OpFM_InitInputType_C ======= TYPE, BIND(C) :: OpFM_InitInputType_C TYPE(C_PTR) :: object = C_NULL_PTR - INTEGER(KIND=C_INT) :: NumSC2Ctrl - INTEGER(KIND=C_INT) :: NumCtrl2SC INTEGER(KIND=C_INT) :: NumActForcePtsBlade INTEGER(KIND=C_INT) :: NumActForcePtsTower TYPE(C_ptr) :: StructBldRNodes = C_NULL_PTR @@ -51,8 +49,6 @@ MODULE OpenFOAM_Types END TYPE OpFM_InitInputType_C TYPE, PUBLIC :: OpFM_InitInputType TYPE( OpFM_InitInputType_C ) :: C_obj - INTEGER(IntKi) :: NumSC2Ctrl !< number of controller inputs [from supercontroller] [-] - INTEGER(IntKi) :: NumCtrl2SC !< number of controller outputs [to supercontroller] [-] INTEGER(IntKi) :: NumActForcePtsBlade !< number of actuator line force points in blade [-] INTEGER(IntKi) :: NumActForcePtsTower !< number of actuator line force points in tower [-] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: StructBldRNodes => NULL() !< Radius to structural model analysis nodes relative to hub [-] @@ -164,8 +160,6 @@ MODULE OpenFOAM_Types INTEGER(C_int) :: momentz_Len = 0 TYPE(C_ptr) :: forceNodesChord = C_NULL_PTR INTEGER(C_int) :: forceNodesChord_Len = 0 - TYPE(C_ptr) :: SuperController = C_NULL_PTR - INTEGER(C_int) :: SuperController_Len = 0 END TYPE OpFM_InputType_C TYPE, PUBLIC :: OpFM_InputType TYPE( OpFM_InputType_C ) :: C_obj @@ -186,7 +180,6 @@ MODULE OpenFOAM_Types REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: momenty => NULL() !< normalized y moment at actuator force nodes [Nm/kg/m^3] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: momentz => NULL() !< normalized z moment at actuator force nodes [Nm/kg/m^3] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: forceNodesChord => NULL() !< chord distribution at the actuator force nodes [m] - REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: SuperController => NULL() !< inputs to the super controller (from the turbine controller) [-] END TYPE OpFM_InputType ! ======================= ! ========= OpFM_OutputType_C ======= @@ -198,8 +191,6 @@ MODULE OpenFOAM_Types INTEGER(C_int) :: v_Len = 0 TYPE(C_ptr) :: w = C_NULL_PTR INTEGER(C_int) :: w_Len = 0 - TYPE(C_ptr) :: SuperController = C_NULL_PTR - INTEGER(C_int) :: SuperController_Len = 0 TYPE(C_ptr) :: WriteOutput = C_NULL_PTR INTEGER(C_int) :: WriteOutput_Len = 0 END TYPE OpFM_OutputType_C @@ -208,7 +199,6 @@ MODULE OpenFOAM_Types REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: u => NULL() !< U-component wind speed (in the X-direction) at interface nodes [m/s] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: v => NULL() !< V-component wind speed (in the Y-direction) at interface nodes [m/s] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: w => NULL() !< W-component wind speed (in the Z-direction) at interface nodes [m/s] - REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: SuperController => NULL() !< outputs of the super controller (to the turbine controller) [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: WriteOutput !< Data to be written to an output file: see WriteOutputHdr for names of each variable [see WriteOutputUnt] END TYPE OpFM_OutputType ! ======================= @@ -228,10 +218,6 @@ SUBROUTINE OpFM_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, Err ! ErrStat = ErrID_None ErrMsg = "" - DstInitInputData%NumSC2Ctrl = SrcInitInputData%NumSC2Ctrl - DstInitInputData%C_obj%NumSC2Ctrl = SrcInitInputData%C_obj%NumSC2Ctrl - DstInitInputData%NumCtrl2SC = SrcInitInputData%NumCtrl2SC - DstInitInputData%C_obj%NumCtrl2SC = SrcInitInputData%C_obj%NumCtrl2SC DstInitInputData%NumActForcePtsBlade = SrcInitInputData%NumActForcePtsBlade DstInitInputData%C_obj%NumActForcePtsBlade = SrcInitInputData%C_obj%NumActForcePtsBlade DstInitInputData%NumActForcePtsTower = SrcInitInputData%NumActForcePtsTower @@ -332,8 +318,6 @@ SUBROUTINE OpFM_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl - Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC Int_BufSz = Int_BufSz + 1 ! NumActForcePtsBlade Int_BufSz = Int_BufSz + 1 ! NumActForcePtsTower Int_BufSz = Int_BufSz + 1 ! StructBldRNodes allocated yes/no @@ -378,10 +362,6 @@ SUBROUTINE OpFM_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumCtrl2SC - Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumActForcePtsBlade Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumActForcePtsTower @@ -451,12 +431,6 @@ SUBROUTINE OpFM_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%C_obj%NumSC2Ctrl = OutData%NumSC2Ctrl - OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%C_obj%NumCtrl2SC = OutData%NumCtrl2SC OutData%NumActForcePtsBlade = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%C_obj%NumActForcePtsBlade = OutData%NumActForcePtsBlade @@ -531,8 +505,6 @@ SUBROUTINE OpFM_C2Fary_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointe ELSE SkipPointers_local = .false. END IF - InitInputData%NumSC2Ctrl = InitInputData%C_obj%NumSC2Ctrl - InitInputData%NumCtrl2SC = InitInputData%C_obj%NumCtrl2SC InitInputData%NumActForcePtsBlade = InitInputData%C_obj%NumActForcePtsBlade InitInputData%NumActForcePtsTower = InitInputData%C_obj%NumActForcePtsTower @@ -573,8 +545,6 @@ SUBROUTINE OpFM_F2C_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ELSE SkipPointers_local = .false. END IF - InitInputData%C_obj%NumSC2Ctrl = InitInputData%NumSC2Ctrl - InitInputData%C_obj%NumCtrl2SC = InitInputData%NumCtrl2SC InitInputData%C_obj%NumActForcePtsBlade = InitInputData%NumActForcePtsBlade InitInputData%C_obj%NumActForcePtsTower = InitInputData%NumActForcePtsTower @@ -2953,21 +2923,6 @@ SUBROUTINE OpFM_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg DstInputData%c_obj%forceNodesChord = C_LOC( DstInputData%forceNodesChord(i1_l) ) END IF DstInputData%forceNodesChord = SrcInputData%forceNodesChord -ENDIF -IF (ASSOCIATED(SrcInputData%SuperController)) THEN - i1_l = LBOUND(SrcInputData%SuperController,1) - i1_u = UBOUND(SrcInputData%SuperController,1) - IF (.NOT. ASSOCIATED(DstInputData%SuperController)) THEN - ALLOCATE(DstInputData%SuperController(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%SuperController.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DstInputData%c_obj%SuperController_Len = SIZE(DstInputData%SuperController) - IF (DstInputData%c_obj%SuperController_Len > 0) & - DstInputData%c_obj%SuperController = C_LOC( DstInputData%SuperController(i1_l) ) - END IF - DstInputData%SuperController = SrcInputData%SuperController ENDIF END SUBROUTINE OpFM_CopyInput @@ -3081,12 +3036,6 @@ SUBROUTINE OpFM_DestroyInput( InputData, ErrStat, ErrMsg ) InputData%forceNodesChord => NULL() InputData%C_obj%forceNodesChord = C_NULL_PTR InputData%C_obj%forceNodesChord_Len = 0 -ENDIF -IF (ASSOCIATED(InputData%SuperController)) THEN - DEALLOCATE(InputData%SuperController) - InputData%SuperController => NULL() - InputData%C_obj%SuperController = C_NULL_PTR - InputData%C_obj%SuperController_Len = 0 ENDIF END SUBROUTINE OpFM_DestroyInput @@ -3210,11 +3159,6 @@ SUBROUTINE OpFM_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 2*1 ! forceNodesChord upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%forceNodesChord) ! forceNodesChord END IF - Int_BufSz = Int_BufSz + 1 ! SuperController allocated yes/no - IF ( ASSOCIATED(InData%SuperController) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SuperController upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SuperController) ! SuperController - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3499,21 +3443,6 @@ SUBROUTINE OpFM_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ASSOCIATED(InData%SuperController) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SuperController,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SuperController,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%SuperController,1), UBOUND(InData%SuperController,1) - ReKiBuf(Re_Xferred) = InData%SuperController(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE OpFM_PackInput SUBROUTINE OpFM_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -3900,27 +3829,6 @@ SUBROUTINE OpFM_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SuperController not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ASSOCIATED(OutData%SuperController)) DEALLOCATE(OutData%SuperController) - ALLOCATE(OutData%SuperController(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SuperController.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - OutData%c_obj%SuperController_Len = SIZE(OutData%SuperController) - IF (OutData%c_obj%SuperController_Len > 0) & - OutData%c_obj%SuperController = C_LOC( OutData%SuperController(i1_l) ) - DO i1 = LBOUND(OutData%SuperController,1), UBOUND(OutData%SuperController,1) - OutData%SuperController(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE OpFM_UnPackInput SUBROUTINE OpFM_C2Fary_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) @@ -4091,15 +3999,6 @@ SUBROUTINE OpFM_C2Fary_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) CALL C_F_POINTER(InputData%C_obj%forceNodesChord, InputData%forceNodesChord, (/InputData%C_obj%forceNodesChord_Len/)) END IF END IF - - ! -- SuperController Input Data fields - IF ( .NOT. SkipPointers_local ) THEN - IF ( .NOT. C_ASSOCIATED( InputData%C_obj%SuperController ) ) THEN - NULLIFY( InputData%SuperController ) - ELSE - CALL C_F_POINTER(InputData%C_obj%SuperController, InputData%SuperController, (/InputData%C_obj%SuperController_Len/)) - END IF - END IF END SUBROUTINE OpFM_C2Fary_CopyInput SUBROUTINE OpFM_F2C_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) @@ -4321,18 +4220,6 @@ SUBROUTINE OpFM_F2C_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) InputData%c_obj%forceNodesChord = C_LOC( InputData%forceNodesChord( LBOUND(InputData%forceNodesChord,1) ) ) END IF END IF - - ! -- SuperController Input Data fields - IF ( .NOT. SkipPointers_local ) THEN - IF ( .NOT. ASSOCIATED(InputData%SuperController)) THEN - InputData%c_obj%SuperController_Len = 0 - InputData%c_obj%SuperController = C_NULL_PTR - ELSE - InputData%c_obj%SuperController_Len = SIZE(InputData%SuperController) - IF (InputData%c_obj%SuperController_Len > 0) & - InputData%c_obj%SuperController = C_LOC( InputData%SuperController( LBOUND(InputData%SuperController,1) ) ) - END IF - END IF END SUBROUTINE OpFM_F2C_CopyInput SUBROUTINE OpFM_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) @@ -4395,21 +4282,6 @@ SUBROUTINE OpFM_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, Err END IF DstOutputData%w = SrcOutputData%w ENDIF -IF (ASSOCIATED(SrcOutputData%SuperController)) THEN - i1_l = LBOUND(SrcOutputData%SuperController,1) - i1_u = UBOUND(SrcOutputData%SuperController,1) - IF (.NOT. ASSOCIATED(DstOutputData%SuperController)) THEN - ALLOCATE(DstOutputData%SuperController(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%SuperController.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DstOutputData%c_obj%SuperController_Len = SIZE(DstOutputData%SuperController) - IF (DstOutputData%c_obj%SuperController_Len > 0) & - DstOutputData%c_obj%SuperController = C_LOC( DstOutputData%SuperController(i1_l) ) - END IF - DstOutputData%SuperController = SrcOutputData%SuperController -ENDIF IF (ALLOCATED(SrcOutputData%WriteOutput)) THEN i1_l = LBOUND(SrcOutputData%WriteOutput,1) i1_u = UBOUND(SrcOutputData%WriteOutput,1) @@ -4451,12 +4323,6 @@ SUBROUTINE OpFM_DestroyOutput( OutputData, ErrStat, ErrMsg ) OutputData%C_obj%w = C_NULL_PTR OutputData%C_obj%w_Len = 0 ENDIF -IF (ASSOCIATED(OutputData%SuperController)) THEN - DEALLOCATE(OutputData%SuperController) - OutputData%SuperController => NULL() - OutputData%C_obj%SuperController = C_NULL_PTR - OutputData%C_obj%SuperController_Len = 0 -ENDIF IF (ALLOCATED(OutputData%WriteOutput)) THEN DEALLOCATE(OutputData%WriteOutput) ENDIF @@ -4512,11 +4378,6 @@ SUBROUTINE OpFM_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 2*1 ! w upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%w) ! w END IF - Int_BufSz = Int_BufSz + 1 ! SuperController allocated yes/no - IF ( ASSOCIATED(InData%SuperController) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SuperController upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SuperController) ! SuperController - END IF Int_BufSz = Int_BufSz + 1 ! WriteOutput allocated yes/no IF ( ALLOCATED(InData%WriteOutput) ) THEN Int_BufSz = Int_BufSz + 2*1 ! WriteOutput upper/lower bounds for each dimension @@ -4596,21 +4457,6 @@ SUBROUTINE OpFM_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ASSOCIATED(InData%SuperController) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SuperController,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SuperController,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%SuperController,1), UBOUND(InData%SuperController,1) - ReKiBuf(Re_Xferred) = InData%SuperController(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF IF ( .NOT. ALLOCATED(InData%WriteOutput) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -4718,27 +4564,6 @@ SUBROUTINE OpFM_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SuperController not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ASSOCIATED(OutData%SuperController)) DEALLOCATE(OutData%SuperController) - ALLOCATE(OutData%SuperController(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SuperController.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - OutData%c_obj%SuperController_Len = SIZE(OutData%SuperController) - IF (OutData%c_obj%SuperController_Len > 0) & - OutData%c_obj%SuperController = C_LOC( OutData%SuperController(i1_l) ) - DO i1 = LBOUND(OutData%SuperController,1), UBOUND(OutData%SuperController,1) - OutData%SuperController(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) - Re_Xferred = Re_Xferred + 1 - END DO - END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutput not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -4801,15 +4626,6 @@ SUBROUTINE OpFM_C2Fary_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) CALL C_F_POINTER(OutputData%C_obj%w, OutputData%w, (/OutputData%C_obj%w_Len/)) END IF END IF - - ! -- SuperController Output Data fields - IF ( .NOT. SkipPointers_local ) THEN - IF ( .NOT. C_ASSOCIATED( OutputData%C_obj%SuperController ) ) THEN - NULLIFY( OutputData%SuperController ) - ELSE - CALL C_F_POINTER(OutputData%C_obj%SuperController, OutputData%SuperController, (/OutputData%C_obj%SuperController_Len/)) - END IF - END IF END SUBROUTINE OpFM_C2Fary_CopyOutput SUBROUTINE OpFM_F2C_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) @@ -4863,18 +4679,6 @@ SUBROUTINE OpFM_F2C_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) OutputData%c_obj%w = C_LOC( OutputData%w( LBOUND(OutputData%w,1) ) ) END IF END IF - - ! -- SuperController Output Data fields - IF ( .NOT. SkipPointers_local ) THEN - IF ( .NOT. ASSOCIATED(OutputData%SuperController)) THEN - OutputData%c_obj%SuperController_Len = 0 - OutputData%c_obj%SuperController = C_NULL_PTR - ELSE - OutputData%c_obj%SuperController_Len = SIZE(OutputData%SuperController) - IF (OutputData%c_obj%SuperController_Len > 0) & - OutputData%c_obj%SuperController = C_LOC( OutputData%SuperController( LBOUND(OutputData%SuperController,1) ) ) - END IF - END IF END SUBROUTINE OpFM_F2C_CopyOutput @@ -5073,12 +4877,6 @@ SUBROUTINE OpFM_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg b = -(u1%forceNodesChord(i1) - u2%forceNodesChord(i1)) u_out%forceNodesChord(i1) = u1%forceNodesChord(i1) + b * ScaleFactor END DO -END IF ! check if allocated -IF (ASSOCIATED(u_out%SuperController) .AND. ASSOCIATED(u1%SuperController)) THEN - DO i1 = LBOUND(u_out%SuperController,1),UBOUND(u_out%SuperController,1) - b = -(u1%SuperController(i1) - u2%SuperController(i1)) - u_out%SuperController(i1) = u1%SuperController(i1) + b * ScaleFactor - END DO END IF ! check if allocated END SUBROUTINE OpFM_Input_ExtrapInterp1 @@ -5255,13 +5053,6 @@ SUBROUTINE OpFM_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er c = ( (t(2)-t(3))*u1%forceNodesChord(i1) + t(3)*u2%forceNodesChord(i1) - t(2)*u3%forceNodesChord(i1) ) * scaleFactor u_out%forceNodesChord(i1) = u1%forceNodesChord(i1) + b + c * t_out END DO -END IF ! check if allocated -IF (ASSOCIATED(u_out%SuperController) .AND. ASSOCIATED(u1%SuperController)) THEN - DO i1 = LBOUND(u_out%SuperController,1),UBOUND(u_out%SuperController,1) - b = (t(3)**2*(u1%SuperController(i1) - u2%SuperController(i1)) + t(2)**2*(-u1%SuperController(i1) + u3%SuperController(i1)))* scaleFactor - c = ( (t(2)-t(3))*u1%SuperController(i1) + t(3)*u2%SuperController(i1) - t(2)*u3%SuperController(i1) ) * scaleFactor - u_out%SuperController(i1) = u1%SuperController(i1) + b + c * t_out - END DO END IF ! check if allocated END SUBROUTINE OpFM_Input_ExtrapInterp2 @@ -5378,12 +5169,6 @@ SUBROUTINE OpFM_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMs y_out%w(i1) = y1%w(i1) + b * ScaleFactor END DO END IF ! check if allocated -IF (ASSOCIATED(y_out%SuperController) .AND. ASSOCIATED(y1%SuperController)) THEN - DO i1 = LBOUND(y_out%SuperController,1),UBOUND(y_out%SuperController,1) - b = -(y1%SuperController(i1) - y2%SuperController(i1)) - y_out%SuperController(i1) = y1%SuperController(i1) + b * ScaleFactor - END DO -END IF ! check if allocated IF (ALLOCATED(y_out%WriteOutput) .AND. ALLOCATED(y1%WriteOutput)) THEN DO i1 = LBOUND(y_out%WriteOutput,1),UBOUND(y_out%WriteOutput,1) b = -(y1%WriteOutput(i1) - y2%WriteOutput(i1)) @@ -5468,13 +5253,6 @@ SUBROUTINE OpFM_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, E y_out%w(i1) = y1%w(i1) + b + c * t_out END DO END IF ! check if allocated -IF (ASSOCIATED(y_out%SuperController) .AND. ASSOCIATED(y1%SuperController)) THEN - DO i1 = LBOUND(y_out%SuperController,1),UBOUND(y_out%SuperController,1) - b = (t(3)**2*(y1%SuperController(i1) - y2%SuperController(i1)) + t(2)**2*(-y1%SuperController(i1) + y3%SuperController(i1)))* scaleFactor - c = ( (t(2)-t(3))*y1%SuperController(i1) + t(3)*y2%SuperController(i1) - t(2)*y3%SuperController(i1) ) * scaleFactor - y_out%SuperController(i1) = y1%SuperController(i1) + b + c * t_out - END DO -END IF ! check if allocated IF (ALLOCATED(y_out%WriteOutput) .AND. ALLOCATED(y1%WriteOutput)) THEN DO i1 = LBOUND(y_out%WriteOutput,1),UBOUND(y_out%WriteOutput,1) b = (t(3)**2*(y1%WriteOutput(i1) - y2%WriteOutput(i1)) + t(2)**2*(-y1%WriteOutput(i1) + y3%WriteOutput(i1)))* scaleFactor diff --git a/modules/openfoam/src/OpenFOAM_Types.h b/modules/openfoam/src/OpenFOAM_Types.h index d113c4099a..a66d6e905d 100644 --- a/modules/openfoam/src/OpenFOAM_Types.h +++ b/modules/openfoam/src/OpenFOAM_Types.h @@ -22,8 +22,6 @@ typedef struct OpFM_InitInputType { void * object ; - int NumSC2Ctrl ; - int NumCtrl2SC ; int NumActForcePtsBlade ; int NumActForcePtsTower ; float * StructBldRNodes ; int StructBldRNodes_Len ; @@ -83,14 +81,12 @@ float * momenty ; int momenty_Len ; float * momentz ; int momentz_Len ; float * forceNodesChord ; int forceNodesChord_Len ; - float * SuperController ; int SuperController_Len ; } OpFM_InputType_t ; typedef struct OpFM_OutputType { void * object ; float * u ; int u_Len ; float * v ; int v_Len ; float * w ; int w_Len ; - float * SuperController ; int SuperController_Len ; float * WriteOutput ; int WriteOutput_Len ; } OpFM_OutputType_t ; typedef struct OpFM_UserData { diff --git a/modules/servodyn/CMakeLists.txt b/modules/servodyn/CMakeLists.txt index a02b4400e6..5dd7f191d5 100644 --- a/modules/servodyn/CMakeLists.txt +++ b/modules/servodyn/CMakeLists.txt @@ -15,31 +15,33 @@ # if (GENERATE_TYPES) - generate_f90_types(src/TMD_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/TMD_Types.f90) + generate_f90_types(src/StrucCtrl_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/StrucCtrl_Types.f90) generate_f90_types(src/ServoDyn_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/ServoDyn_Types.f90) endif() -set(SD_SOURCES +set(SrvD_SOURCES src/BladedInterface.f90 src/UserSubs.f90 src/PitchCntrl_ACH.f90 - src/TMD.f90 + src/StrucCtrl.f90 src/UserVSCont_KP.f90 src/ServoDyn.f90 - src/TMD_Types.f90 + src/ServoDyn_IO.f90 + src/StrucCtrl_Types.f90 src/ServoDyn_Types.f90 ) -add_library(servodynlib ${SD_SOURCES}) +add_library(servodynlib ${SrvD_SOURCES}) target_link_libraries(servodynlib nwtclibs) add_executable(servodyn_driver src/ServoDyn_Driver.f90) target_link_libraries(servodyn_driver servodynlib nwtclibs ${CMAKE_DL_LIBS}) -add_executable(TMD src/TMD_Driver.f90) -target_link_libraries(TMD servodynlib nwtclibs ${CMAKE_DL_LIBS}) +# The Structural Control driver is currently not functional, so commenting this temporarily +# add_executable(strucctrl_driver src/StrucCtrl_Driver.f90) +# target_link_libraries(strucctrl_driver servodynlib nwtclibs ${CMAKE_DL_LIBS}) -install(TARGETS servodynlib servodyn_driver TMD +install(TARGETS servodynlib servodyn_driver # strucctrl_driver EXPORT "${CMAKE_PROJECT_NAME}Libraries" RUNTIME DESTINATION bin LIBRARY DESTINATION lib diff --git a/modules/servodyn/src/BladedInterface.f90 b/modules/servodyn/src/BladedInterface.f90 index 8fd332cdec..a27aa0fbc9 100644 --- a/modules/servodyn/src/BladedInterface.f90 +++ b/modules/servodyn/src/BladedInterface.f90 @@ -19,84 +19,86 @@ !********************************************************************************************************************************** MODULE BladedInterface - USE NWTC_Library - + USE NWTC_Library + USE ServoDyn_Types - + USE, INTRINSIC :: ISO_C_Binding - + IMPLICIT NONE TYPE(ProgDesc), PARAMETER :: BladedInterface_Ver = ProgDesc( 'ServoDyn Interface for Bladed Controllers', 'using '//TRIM(OS_Desc), '' ) - - + + !> Definition of the DLL Interface (from Bladed): !! Note that aviFAIL and avcMSG should be used as INTENT(OUT), but I'm defining them INTENT(INOUT) just in case the compiler decides to reinitialize something that's INTENT(OUT) - + ABSTRACT INTERFACE SUBROUTINE BladedDLL_Legacy_Procedure ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C) USE, INTRINSIC :: ISO_C_Binding - - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) !< DATA + + REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) !< DATA INTEGER(C_INT), INTENT(INOUT) :: aviFAIL !< FLAG (Status set in DLL and returned to simulation code) CHARACTER(KIND=C_CHAR), INTENT(IN) :: accINFILE (*) !< INFILE CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcOUTNAME(*) !< OUTNAME (in:Simulation RootName; out:Name:Units; of logging channels) - CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) !< MESSAGE (Message from DLL to simulation code [ErrMsg]) + CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) !< MESSAGE (Message from DLL to simulation code [ErrMsg]) END SUBROUTINE BladedDLL_Legacy_Procedure - - SUBROUTINE BladedDLL_SC_Procedure ( avrSWAP, from_SC, to_SC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C) + + SUBROUTINE BladedDLL_SC_Procedure ( avrSWAP, from_SCglob, from_SC, to_SC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C) USE, INTRINSIC :: ISO_C_Binding - - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) !< DATA - REAL(C_FLOAT), INTENT(IN ) :: from_SC (*) !< DATA from the supercontroller + + REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) !< DATA + REAL(C_FLOAT), INTENT(IN ) :: from_SCglob (*) !< DATA (global) from the supercontroller + REAL(C_FLOAT), INTENT(IN ) :: from_SC (*) !< DATA (turbine specific) from the supercontroller REAL(C_FLOAT), INTENT(INOUT) :: to_SC (*) !< DATA to the supercontroller INTEGER(C_INT), INTENT(INOUT) :: aviFAIL !< FLAG (Status set in DLL and returned to simulation code) CHARACTER(KIND=C_CHAR), INTENT(IN) :: accINFILE (*) !< INFILE CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcOUTNAME(*) !< OUTNAME (Simulation RootName) - CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) !< MESSAGE (Message from DLL to simulation code [ErrMsg]) + CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) !< MESSAGE (Message from DLL to simulation code [ErrMsg]) END SUBROUTINE BladedDLL_SC_Procedure - + FUNCTION BladedDLL_CONTROLLER_Procedure ( turbine_id ) BIND (C) ! from Bladed 4.8 API USE, INTRINSIC :: ISO_C_Binding - + ! INTEGER(C_SIZE_T), VALUE, INTENT(IN ) :: turbine_id ! pointer (address) of data from Bladed or ENFAST that is required to be used in ExternalControllerApi.dll (as written in Bladed's API) TYPE(C_PTR), VALUE, INTENT(IN ) :: turbine_id ! pointer (address) of data from Bladed or ENFAST that is required to be used in ExternalControllerApi.dll (using standard Fortran nomenclature for ISO C BINDING) INTEGER(C_INT) :: BladedDLL_CONTROLLER_Procedure ! an integer determining the status of the call (see aviFAIL) - + END FUNCTION BladedDLL_CONTROLLER_Procedure END INTERFACE - - -#ifdef STATIC_DLL_LOAD + + +#ifdef STATIC_DLL_LOAD INTERFACE - -#ifdef LOAD_SUPERCONTROLLER - SUBROUTINE DISCON ( avrSWAP, from_SC, to_SC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C, NAME='DISCON') -#else - SUBROUTINE DISCON ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C, NAME='DISCON') -#endif + +#ifdef LOAD_SUPERCONTROLLER + SUBROUTINE DISCON ( avrSWAP, from_SCglob, from_SC, to_SC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C, NAME='DISCON') +#else + SUBROUTINE DISCON ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C, NAME='DISCON') +#endif USE, INTRINSIC :: ISO_C_Binding - - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) ! DATA -#ifdef LOAD_SUPERCONTROLLER - REAL(C_FLOAT), INTENT(IN ) :: from_SC (*) ! DATA from the supercontroller + + REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) ! DATA +#ifdef LOAD_SUPERCONTROLLER + REAL(C_FLOAT), INTENT(IN ) :: from_SCglob (*) ! DATA (global) from the supercontroller + REAL(C_FLOAT), INTENT(IN ) :: from_SC (*) ! DATA (turbine specific) from the supercontroller REAL(C_FLOAT), INTENT(INOUT) :: to_SC (*) ! DATA to the supercontroller -#endif +#endif INTEGER(C_INT), INTENT(INOUT) :: aviFAIL ! FLAG (Status set in DLL and returned to simulation code) CHARACTER(KIND=C_CHAR), INTENT(IN) :: accINFILE (*) ! INFILE CHARACTER(KIND=C_CHAR), INTENT(IN) :: avcOUTNAME(*) ! OUTNAME (Simulation RootName) - CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) ! MESSAGE (Message from DLL to simulation code [ErrMsg]) + CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcMSG (*) ! MESSAGE (Message from DLL to simulation code [ErrMsg]) END SUBROUTINE DISCON - END INTERFACE + END INTERFACE #endif ! Some constants for the Interface: - + INTEGER(IntKi), PARAMETER :: R_v36 = 85 !< Start of below-rated torque-speed look-up table (record no.) for Bladed version 3.6 INTEGER(IntKi), PARAMETER :: R_v4 = 145 !< Start of below-rated torque-speed look-up table (record no.) for Bladed version 3.8 - 4.2 INTEGER(IntKi), PARAMETER :: R_v43 = 165 !< Start of below-rated torque-speed look-up table (record no.) for Bladed version 4.3 and later @@ -108,18 +110,18 @@ END SUBROUTINE DISCON INTEGER(IntKi), PARAMETER :: MaxLoggingChannels = 300 #endif - !! GH_DISCON_SIMULATION_STATUS - Flag returned by simulation from GetSimulationStatus. Descriptions taken from the user manual. - INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_FINALISING = -1 ! Final call at the end of the simulation. - INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_INITIALISING = 0 ! First call at time zero. + !! GH_DISCON_SIMULATION_STATUS - Flag returned by simulation from GetSimulationStatus. Descriptions taken from the user manual. + INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_FINALISING = -1 ! Final call at the end of the simulation. + INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_INITIALISING = 0 ! First call at time zero. INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_DISCRETE_STEP = 1 ! Simulation discrete timestep. INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_CHECKPOINT = -8 ! Create a checkpoint file (extension to GH DISCON documentation) INTEGER(IntKi), PARAMETER :: GH_DISCON_STATUS_RESTARTING = -9 ! Restart step (extension to GH DISCON documentation) - !! GH_DISCON_PITCH_CONTROL - Flag to specify whether the pitch is controlled collectively or individually. - INTEGER(IntKi), PARAMETER :: GH_DISCON_PITCH_CONTROL_COLLECTIVE = 0 ! Pitch is controlled collectively - use GetCollectivePitchAngle and SetDemandedCollectivePitchAngle. - INTEGER(IntKi), PARAMETER :: GH_DISCON_PITCH_CONTROL_INDIVIDUAL = 1 ! Pitch is controlled on each blade individually - use GetPitchAngle and SetDemandedPitchAngle. - !! GH_DISCON_YAW_CONTROL - Flag to represent whether the yaw is controlled by rate or torque. - INTEGER(IntKi), PARAMETER :: GH_DISCON_YAW_CONTROL_RATE = 0 ! Uses the yaw rate demand to control yaw. - INTEGER(IntKi), PARAMETER :: GH_DISCON_YAW_CONTROL_TORQUE = 1 ! Uses the yaw torque demand to control yaw. + !! GH_DISCON_PITCH_CONTROL - Flag to specify whether the pitch is controlled collectively or individually. + INTEGER(IntKi), PARAMETER :: GH_DISCON_PITCH_CONTROL_COLLECTIVE = 0 ! Pitch is controlled collectively - use GetCollectivePitchAngle and SetDemandedCollectivePitchAngle. + INTEGER(IntKi), PARAMETER :: GH_DISCON_PITCH_CONTROL_INDIVIDUAL = 1 ! Pitch is controlled on each blade individually - use GetPitchAngle and SetDemandedPitchAngle. + !! GH_DISCON_YAW_CONTROL - Flag to represent whether the yaw is controlled by rate or torque. + INTEGER(IntKi), PARAMETER :: GH_DISCON_YAW_CONTROL_RATE = 0 ! Uses the yaw rate demand to control yaw. + INTEGER(IntKi), PARAMETER :: GH_DISCON_YAW_CONTROL_TORQUE = 1 ! Uses the yaw torque demand to control yaw. CONTAINS !================================================================================================================================== @@ -139,12 +141,12 @@ SUBROUTINE CallBladedDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) TYPE(C_PTR) :: turbine_id TYPE(BladedDLLType), POINTER :: dll_data_PTR ! pointer to data type containing the inputs for the Bladed DLL interface - + if (p%UseLegacyInterface) then if (present(ChannelNameUnit)) then - call CallBladedLegacyDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) + call CallBladedLegacyDLL ( u, u%fromSCglob, u%fromSC, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) else - call CallBladedLegacyDLL ( u, p, dll_data, ErrStat, ErrMsg ) + call CallBladedLegacyDLL ( u, u%fromSCglob, u%fromSC, p, dll_data, ErrStat, ErrMsg ) end if else @@ -153,17 +155,17 @@ SUBROUTINE CallBladedDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) else ProcedureIndex = 1 ! normal call to CONTROLLER end if - + CALL C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(ProcedureIndex), DLL_CONTROLLER) dll_data_PTR => dll_data turbine_id = C_LOC(dll_data_PTR) aviFAIL = DLL_CONTROLLER ( turbine_id ) - + ! these values are set in the controller: ErrStat = dll_data%ErrStat ErrMsg = dll_data%ErrMsg - + ! but we must also check the return value from the controller function (i'd think they would be the same) IF ( aviFAIL /= 0 ) THEN @@ -172,13 +174,13 @@ SUBROUTINE CallBladedDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) ELSE ! error ErrStat = ErrID_Fatal END IF - + END IF - + IF (ErrStat /= ErrID_None) THEN ErrMsg = trim(p%DLL_Trgt%ProcName(ProcedureIndex))//trim(ErrMsg) END IF - + end if if ( dll_data%SimStatus == GH_DISCON_STATUS_FINALISING ) then @@ -186,14 +188,16 @@ SUBROUTINE CallBladedDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) else dll_data%SimStatus = GH_DISCON_STATUS_DISCRETE_STEP end if - + END SUBROUTINE CallBladedDLL !================================================================================================================================== -SUBROUTINE CallBladedLegacyDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) +SUBROUTINE CallBladedLegacyDLL ( u, filt_fromSCglob, filt_fromSC, p, dll_data, ErrStat, ErrMsg, ChannelNameUnit ) ! Passed Variables: TYPE(SrvD_InputType), INTENT(IN ) :: u ! System inputs TYPE(SrvD_ParameterType), INTENT(IN ) :: p ! Parameters - TYPE(BladedDLLType), INTENT(INOUT) :: dll_data ! data type containing the avrSWAP, accINFILE, and avcOUTNAME arrays + REAL(SiKi), INTENT(IN ) :: filt_fromSCglob (*) ! Filtered global input from Supercontroller to ServoDyn + REAL(SiKi), INTENT(IN ) :: filt_fromSC (*) ! Filtered turbine specific input from Supercontroller to ServoDyn + TYPE(BladedDLLType), INTENT(INOUT) :: dll_data ! data type containing the avrSWAP, accINFILE, and avcOUTNAME arrays !REAL(SiKi), INTENT(INOUT) :: avrSWAP (*) ! The swap array, used to pass data to, and receive data from, the DLL controller. !INTEGER(B1Ki), INTENT(IN ) :: accINFILE (*) ! The address of the first record of an array of 1-byte CHARACTERs giving the name of the parameter input file, 'DISCON.IN'. !INTEGER(B1Ki), INTENT(INOUT) :: avcOUTNAME(*) ! The address of the first record of an array of 1-byte CHARACTERS giving the simulation run name without extension. @@ -209,56 +213,55 @@ SUBROUTINE CallBladedLegacyDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUni CHARACTER(KIND=C_CHAR) :: accINFILE(LEN_TRIM(dll_data%DLL_InFile)+1) ! INFILE CHARACTER(KIND=C_CHAR) :: avcOUTNAME(p%avcOUTNAME_LEN) ! OUTNAME (in: Simulation RootName; out: string for logging channels Name:Units;) CHARACTER(KIND=C_CHAR) :: avcMSG(LEN(ErrMsg)+1) ! MESSAGE (Message from DLL to simulation code [ErrMsg]) - + PROCEDURE(BladedDLL_Legacy_Procedure), POINTER :: DLL_Legacy_Subroutine ! The address of the (legacy DISCON) procedure in the Bladed DLL PROCEDURE(BladedDLL_SC_Procedure), POINTER :: DLL_SC_Subroutine ! The address of the supercontroller procedure in the Bladed DLL - - ! initialize aviFAIL + ! initialize aviFAIL aviFAIL = 0 ! bjj, this won't necessarially work if aviFAIL is INTENT(OUT) in DLL_Procedure()--could be undefined??? - + !Convert to C-type characters: the "C_NULL_CHAR" converts the Fortran string to a C-type string (i.e., adds //CHAR(0) to the end) - + avcOUTNAME = TRANSFER( TRIM(dll_data%RootName)//C_NULL_CHAR, avcOUTNAME ) accINFILE = TRANSFER( TRIM(dll_data%DLL_InFile)//C_NULL_CHAR, accINFILE ) avcMSG = TRANSFER( C_NULL_CHAR, avcMSG ) !bjj this is intent(out), so we shouldn't have to do this, but, to be safe... - + #ifdef STATIC_DLL_LOAD - ! if we're statically loading the library (i.e., OpenFOAM), we can just call DISCON(); + ! if we're statically loading the library (i.e., OpenFOAM), we can just call DISCON(); ! I'll leave some options for whether the supercontroller is being used #ifdef LOAD_SUPERCONTROLLER - CALL DISCON( dll_data%avrSWAP, u%SuperController, dll_data%SCoutput, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) + CALL DISCON( dll_data%avrSWAP, filt_fromSCglob, filt_fromSC, dll_data%toSC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) #else CALL DISCON( dll_data%avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) #endif #else - IF ( ALLOCATED(dll_data%SCoutput) ) THEN + IF ( p%UseSC ) THEN ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): - CALL C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(1), DLL_SC_Subroutine) - CALL DLL_SC_Subroutine ( dll_data%avrSWAP, u%SuperController, dll_data%SCoutput, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) - + CALL C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(1), DLL_SC_Subroutine) + CALL DLL_SC_Subroutine ( dll_data%avrSWAP, filt_fromSCglob, filt_fromSC, dll_data%toSC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) + ELSE ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): - CALL C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(1), DLL_Legacy_Subroutine) - CALL DLL_Legacy_Subroutine ( dll_data%avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) + CALL C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(1), DLL_Legacy_Subroutine) + CALL DLL_Legacy_Subroutine ( dll_data%avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) END IF - + #endif - + IF ( aviFAIL /= 0 ) THEN ErrMsg = TRANSFER(avcMSG,ErrMsg) !convert C character array to Fortran string - CALL RemoveNullChar( ErrMsg ) - + CALL RemoveNullChar( ErrMsg ) + IF ( aviFAIL > 0 ) THEN ErrStat = ErrID_Info ELSE ErrStat = ErrID_Fatal END IF - + ELSE ErrStat = ErrID_None ErrMsg = '' @@ -268,16 +271,17 @@ SUBROUTINE CallBladedLegacyDLL ( u, p, dll_data, ErrStat, ErrMsg, ChannelNameUni ChannelNameUnit = TRANSFER(avcOUTNAME,ChannelNameUnit) !convert C character array to Fortran string CALL RemoveNullChar( ChannelNameUnit ) END IF - + RETURN END SUBROUTINE CallBladedLegacyDLL !================================================================================================================================== !> This routine initializes variables used in the Bladed DLL interface. -SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, ErrMsg) - +SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, ErrMsg) + TYPE(SrvD_InputType), INTENT(INOUT) :: u !< An initial guess for the input; input mesh must be defined TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Initial misc (optimization) variables + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states TYPE(SrvD_OutputType), INTENT(INOUT) :: y !< Initial system outputs (outputs are not calculated; !! only the output mesh is initialized) TYPE(SrvD_InputFile), INTENT(INOUT) :: InputFileData !< Data stored in the module's input file @@ -285,26 +289,26 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - - ! Define all the parameters for the Bladed Interface - !IF (ALLOCATED(y%SuperController)) THEN + + ! Define all the parameters for the Bladed Interface + !IF (ALLOCATED(y%toSC)) THEN ! InputFileData%DLL_ProcName = 'DISCON_SC' ! The name of the procedure in the DLL that will be called. !ELSE ! InputFileData%DLL_ProcName = 'DISCON' ! The name of the procedure in the DLL that will be called. !END IF - + ErrStat = ErrID_None ErrMsg= '' - + CALL DispNVD( BladedInterface_Ver ) ! Display the version of this interface - - p%UseLegacyInterface = InputFileData%UseLegacyInterface + + p%UseLegacyInterface = .TRUE. !InputFileData%UseLegacyInterface m%dll_data%Ptch_Cntrl = InputFileData%Ptch_Cntrl m%dll_data%Gain_OM = InputFileData%Gain_OM ! Optimal mode gain (Nm/(rad/s)^2) @@ -321,25 +325,25 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err p%NacYaw_North = InputFileData%NacYaw_North ! Reference yaw angle of the nacelle when the upwind end points due North (rad) m%dll_data%DLL_NumTrq = InputFileData%DLL_NumTrq ! No. of points in torque-speed look-up table: 0 = none and use the optimal mode PARAMETERs instead, nonzero = ignore the optimal mode PARAMETERs by setting Record 16 to 0.0 (-) - + m%dll_data%DLL_InFile = InputFileData%DLL_InFile m%dll_data%RootName = p%RootName p%avcOUTNAME_LEN = max( LEN_TRIM(m%dll_data%RootName), MaxLoggingChannels*2*(1+ChanLen) ) + 1 ! = max( size of input, size of output ) + c_null_char - + m%dll_data%DLL_DT = InputFileData%DLL_DT ! Communication interval (sec) p%DLL_n = NINT( m%dll_data%DLL_DT / p%DT ) IF ( .NOT. EqualRealNos( p%DLL_n * p%DT, m%dll_data%DLL_DT ) ) THEN CALL CheckError( ErrID_Fatal, 'DLL_DT must be an integer multiple of DT.' ) END IF - IF ( m%dll_data%DLL_DT < EPSILON( m%dll_data%DLL_DT ) ) THEN + IF ( m%dll_data%DLL_DT < EPSILON( m%dll_data%DLL_DT ) ) THEN CALL CheckError( ErrID_Fatal, 'DLL_DT must be larger than zero.' ) END IF - p%DLL_Ramp = InputFileData%DLL_Ramp + p%DLL_Ramp = InputFileData%DLL_Ramp p%BlAlpha = exp( -TwoPi*p%DT*InputFileData%BPCutoff ) !used only for the DLL - - if (InputFileData%BPCutoff < EPSILON( InputFileData%BPCutoff )) CALL CheckError( ErrID_Fatal, 'BPCutoff must be greater than 0.') - + + if (InputFileData%BPCutoff < EPSILON( InputFileData%BPCutoff )) CALL CheckError( ErrID_Fatal, 'BPCutoff must be greater than 0.') + IF ( m%dll_data%Ptch_Cntrl /= GH_DISCON_PITCH_CONTROL_INDIVIDUAL .AND. m%dll_data%Ptch_Cntrl /= GH_DISCON_PITCH_CONTROL_COLLECTIVE ) THEN CALL CheckError( ErrID_Fatal, 'Ptch_Cntrl must be 0 (collective) or 1 (individual).') RETURN @@ -351,7 +355,7 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err CALL CheckError(ErrStat2,ErrMsg2) IF ( m%dll_data%DLL_NumTrq < 0_IntKi ) THEN - CALL CheckError( ErrID_Fatal, 'DLL_NumTrq must not be less than zero.') + CALL CheckError( ErrID_Fatal, 'DLL_NumTrq must not be less than zero.') ELSEIF ( m%dll_data%DLL_NumTrq > 0 ) THEN m%dll_data%Gain_OM = 0.0 ! 0.0 indicates that torque-speed table look-up is selected @@ -360,23 +364,23 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err END IF IF ( ErrStat >= AbortErrLev ) RETURN - - + + ! Set status flag and initialize avrSWAP: m%dll_data%SimStatus = GH_DISCON_STATUS_INITIALISING - + CALL AllocAry( m%dll_data%avrSwap, R+(2*m%dll_data%DLL_NumTrq)-1 + MaxLoggingChannels, 'avrSwap', ErrStat2, ErrMsg2 ) CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN m%dll_data%avrSWAP = 0.0 - IF (ALLOCATED(y%SuperController)) THEN - CALL AllocAry( m%dll_data%SCoutput, SIZE(y%SuperController), 'm%dll_data%SuperController', ErrStat2, ErrMsg2 ) + IF (ALLOCATED(y%toSC)) THEN + CALL AllocAry( m%dll_data%toSC, SIZE(y%toSC), 'm%dll_data%toSC', ErrStat2, ErrMsg2 ) CALL CheckError( ErrStat2, ErrMsg2 ) IF (ErrStat >= AbortErrLev) RETURN - m%dll_data%SCoutput = 0.0_SiKi + m%dll_data%toSC = 0.0_SiKi END IF - + ! Initialize dll data stored in OtherState m%dll_data%initialized = .FALSE. @@ -407,11 +411,11 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err p%UseLegacyInterface = .true. ! Bladed checks for the legacy version if it can't find the CONTROLL function in the DLL, so that's what we'll have to do, too end if end if - + if (p%UseLegacyInterface) then p%DLL_Trgt%ProcName = "" ! initialize all procedures to empty so we try to load only one p%DLL_Trgt%ProcName(1) = InputFileData%DLL_ProcName - + CALL LoadDynamicLib ( p%DLL_Trgt, ErrStat2, ErrMsg2 ) CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN @@ -422,18 +426,18 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err !-------------------------------------- p%NumOuts_DLL = 0 #ifdef LOAD_DLL_TWICE_FOR_LOGGING_CHANNELS - CALL GetBladedLoggingChannels(u,p,m, ErrStat2, ErrMsg2) ! this calls the DLL, but we don't have the correct inputs for a time step, so we'll close the DLL and start it again + CALL GetBladedLoggingChannels(u,p,xd,m, ErrStat2, ErrMsg2) ! this calls the DLL, but we don't have the correct inputs for a time step, so we'll close the DLL and start it again CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN - + ! close and reload library here... - ! (if the DLL could be guaranteed to not do anything with the + ! (if the DLL could be guaranteed to not do anything with the ! inputs on the initial step, we could avoid this this part) - + CALL BladedInterface_End(u, p, m, ErrStat2, ErrMsg2) CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN - + CALL LoadDynamicLib ( p%DLL_Trgt, ErrStat2, ErrMsg2 ) CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN @@ -443,7 +447,7 @@ SUBROUTINE BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat, Err #endif -CONTAINS +CONTAINS !............................................................................................................................... SUBROUTINE CheckError(ErrID,Msg) ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev @@ -470,24 +474,25 @@ SUBROUTINE CheckError(ErrID,Msg) IF ( ErrStat >= AbortErrLev ) THEN p%UseBladedInterface = .FALSE. END IF - + END IF - END SUBROUTINE CheckError + END SUBROUTINE CheckError END SUBROUTINE BladedInterface_Init !================================================================================================================================== -SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) - +SUBROUTINE GetBladedLoggingChannels(u,p, xd, m, ErrStat, ErrMsg) + TYPE(SrvD_InputType), INTENT(IN ) :: u !< An initial guess for the input; input mesh must be defined TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Initial misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables - + INTEGER(IntKi) :: StartIndx ! starting index used to parse name/unit from Bladed DLL INTEGER(IntKi) :: Indx ! index used to parse name/unit from Bladed DLL INTEGER(IntKi) :: i ! The error status code @@ -495,22 +500,21 @@ SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) CHARACTER( p%avcOUTNAME_LEN ) :: LoggingChannelStr ! The error message, if an error occurred CHARACTER(*), PARAMETER :: RoutineName = "GetBladedLoggingChannels" - CALL Fill_CONTROL_vars( 0.0_DbKi, u, p, LEN(ErrMsg), m%dll_data ) - + if (p%UseLegacyInterface) then - + CALL CallBladedDLL(u, p, m%dll_data, ErrStat, ErrMsg, LoggingChannelStr) IF ( ErrStat >= AbortErrLev ) RETURN - + p%NumOuts_DLL = NINT( m%dll_data%avrSWAP(65) ) ! number of channels returned for logging - + ALLOCATE ( m%dll_data%LogChannels_OutParam(p%NumOuts_DLL) , STAT=ErrStat2 ) IF ( ErrStat2 /= 0_IntKi ) THEN CALL SetErrStat( ErrID_Fatal,"Error allocating memory for the Bladed DLL logging channels name array.", ErrStat, ErrMsg, RoutineName ) RETURN ENDIF - + ALLOCATE( m%dll_data%LogChannels(p%NumOuts_DLL), STAT=ErrStat2 ) IF ( ErrStat2 /= 0_IntKi ) THEN CALL SetErrStat( ErrID_Fatal,"Error allocating memory for the Bladed DLL logging channels array.", ErrStat, ErrMsg, RoutineName ) @@ -527,13 +531,13 @@ SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) StartIndx = 1 do i=1,p%NumOuts_DLL - + ! parse the channel name indx = StartIndx + INDEX( LoggingChannelStr(StartIndx:), ':' ) - 1 if (indx > len(LoggingChannelStr) .or. indx < 1) then call SetErrStat( ErrID_Severe,"Error getting logging channel name.", ErrStat, ErrMsg, RoutineName ) endif - + m%dll_data%LogChannels_OutParam(I)%Name = LoggingChannelStr(StartIndx:indx-1) StartIndx = indx + 1 @@ -546,12 +550,12 @@ SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) m%dll_data%LogChannels_OutParam(I)%Units = LoggingChannelStr(StartIndx:indx-1) StartIndx = indx + 1 end do - + !todo: make sure trim(m%dll_data%LogChannels_OutParam(i)%Name) does not contain spaces; replace with '_' if necessary - + else - - + + ALLOCATE( m%dll_data%LogChannels( MaxLoggingChannels), & m%dll_data%LogChannels_OutParam(MaxLoggingChannels), STAT=ErrStat2 ) IF ( ErrStat2 /= 0_IntKi ) THEN @@ -561,12 +565,12 @@ SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) CALL CallBladedDLL(u, p, m%dll_data, ErrStat, ErrMsg) IF ( ErrStat >= AbortErrLev ) RETURN - + p%NumOuts_DLL = m%dll_data%NumLogChannels ! set this as a parameter in case the DLL changes the value during the simulation - + end if - - + + ! convert Bladed-allowed unit specifiers to actual units do i=1,p%NumOuts_DLL select case (m%dll_data%LogChannels_OutParam(I)%Units) @@ -637,25 +641,26 @@ SUBROUTINE GetBladedLoggingChannels(u,p,m, ErrStat, ErrMsg) case('VI') m%dll_data%LogChannels_OutParam(I)%Units = 'VA' end select - + end do END SUBROUTINE GetBladedLoggingChannels !================================================================================================================================== !> This routine calls the DLL for the final time (if it was previously called), and frees the dynamic library. -SUBROUTINE BladedInterface_End(u, p, m, ErrStat, ErrMsg) - +SUBROUTINE BladedInterface_End(u, p, m, xd, ErrStat, ErrMsg) + TYPE(SrvD_InputType), INTENT(IN ) :: u !< System inputs TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< misc (optimization) variables + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! local variables: INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - + ! call DLL final time, but skip if we've never called it if (allocated(m%dll_data%avrSWAP)) then IF ( m%dll_data%SimStatus /= GH_DISCON_STATUS_INITIALISING ) THEN @@ -664,36 +669,37 @@ SUBROUTINE BladedInterface_End(u, p, m, ErrStat, ErrMsg) CALL CallBladedDLL(u, p, m%dll_data, ErrStat, ErrMsg) END IF end if - + CALL FreeDynamicLib( p%DLL_Trgt, ErrStat2, ErrMsg2 ) ! this doesn't do anything #ifdef STATIC_DLL_LOAD because p%DLL_Trgt is 0 (NULL) IF (ErrStat2 /= ErrID_None) THEN ErrStat = MAX(ErrStat, ErrStat2) ErrMsg = TRIM(ErrMsg)//NewLine//TRIM(ErrMsg2) END IF - + END SUBROUTINE BladedInterface_End !================================================================================================================================== !> This routine sets the AVRswap array, calls the routine from the BladedDLL, and sets the outputs from the call to be used as !! necessary in the main ServoDyn CalcOutput routine. -SUBROUTINE BladedInterface_CalcOutput(t, u, p, m, ErrStat, ErrMsg) +SUBROUTINE BladedInterface_CalcOutput(t, u, p, m, xd, ErrStat, ErrMsg) REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< misc (optimization) variables + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! local variables: INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred character(*), parameter :: RoutineName = 'BladedInterface_CalcOutput' - - ! Initialize error values: + + ! Initialize error values: ErrStat = ErrID_None ErrMsg= '' - - + + ! Set the input values of the avrSWAP array: CALL Fill_CONTROL_vars( t, u, p, LEN(ErrMsg), m%dll_data ) @@ -713,20 +719,20 @@ SUBROUTINE BladedInterface_CalcOutput(t, u, p, m, ErrStat, ErrMsg) CALL WrNumAryFileNR ( 59, m%dll_data%avrSWAP,'1x,ES15.6E2', ErrStat2, ErrMsg2 ) write(59,'()') #endif - + ! Get the output values from the avrSWAP array: - + CALL CheckDLLReturnValues( p, m%dll_data, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - + END SUBROUTINE BladedInterface_CalcOutput !================================================================================================================================== -!> This routine fills the avrSWAP array with its inputs, as described in Appendices A and B of the Bladed User Manual of Bladed +!> This routine fills the avrSWAP array with its inputs, as described in Appendices A and B of the Bladed User Manual of Bladed !! version 3.81. SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) !SUBROUTINE Fill_avrSWAP( StatFlag, t, u, p, ErrMsgSz, dll_data ) !.................................................................................................................................. - + ! INTEGER(IntKi), INTENT(IN ) :: StatFlag ! Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-) REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t @@ -736,11 +742,11 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) ! local variables: INTEGER(IntKi) :: I ! Loop counter - + !> The following are values ServoDyn sends to the Bladed DLL. !! For variables returned from the DLL, see bladedinterface::retrieve_avrswap. dll_data%avrSWAP( 1) = dll_data%SimStatus - !> * Record 1: Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-) + !> * Record 1: Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-) dll_data%avrSWAP( 2) = REAL(t, SiKi) !> * Record 2: Current time (sec) [t in single precision] dll_data%avrSWAP( 3) = dll_data%DLL_DT !> * Record 3: Communication interval (sec) [in FAST v7 this was \f$ y\_SrvD\%AllOuts(Time) - LastTime \f$, but is now the SrvD DLL_DT parameter] dll_data%avrSWAP( 4) = u%BlPitch(1) !> * Record 4: Blade 1 pitch angle (rad) [SrvD input] @@ -754,7 +760,7 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) dll_data%avrSWAP(12) = 0.0 !> * Record 12: Current demanded pitch rate (rad/s) [always zero for ServoDyn] dll_data%avrSWAP(13) = dll_data%GenPwr_Dem !> * Record 13: Demanded power (W) [SrvD GenPwr_Dem parameter from input file] dll_data%avrSWAP(14) = u%RotPwr !> * Record 14: Measured shaft power (W) [SrvD input] - dll_data%avrSWAP(15) = dll_data%ElecPwr_prev !> * Record 15: Measured electrical power output (W) [SrvD calculation from previous step; should technically be a state] + dll_data%avrSWAP(15) = dll_data%ElecPwr_prev !> * Record 15: Measured electrical power output (W) [SrvD calculation from previous step; should technically be a state] dll_data%avrSWAP(16) = dll_data%Gain_OM !> * Record 16: Optimal mode gain (Nm/(rad/s)^2) [if torque-speed table look-up not selected in input file, use SrvD Gain_OM parameter, otherwise use 0 (already overwritten in Init routine)] dll_data%avrSWAP(17) = dll_data%GenSpd_MinOM !> * Record 17: Minimum generator speed (rad/s) [SrvD GenSpd_MinOM parameter] dll_data%avrSWAP(18) = dll_data%GenSpd_MaxOM !> * Record 18: Optimal mode maximum speed (rad/s) [SrvD GenSpd_MaxOMp arameter] @@ -762,7 +768,7 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) dll_data%avrSWAP(20) = u%HSS_Spd !> * Record 20: Measured generator speed (rad/s) [SrvD input] dll_data%avrSWAP(21) = u%RotSpeed !> * Record 21: Measured rotor speed (rad/s) [SrvD input] dll_data%avrSWAP(22) = dll_data%GenTrq_Dem !> * Record 22: Demanded generator torque above rated (Nm) [SrvD GenTrq_Dem parameter from input file] -!bjj: this assumes it is the value at the previous step; but we actually want the output GenTrq... +!bjj: this assumes it is the value at the previous step; but we actually want the output GenTrq... dll_data%avrSWAP(23) = dll_data%GenTrq_prev !> * Record 23: Measured generator torque (Nm) [SrvD calculation from previous step; should technically be a state] dll_data%avrSWAP(24) = u%YawErr !> * Record 24: Measured yaw error (rad) [SrvD input] IF ( dll_data%DLL_NumTrq == 0 ) THEN ! Torque-speed table look-up not selected @@ -773,7 +779,7 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) dll_data%avrSWAP(26) = dll_data%DLL_NumTrq !> * Record 26: No. of points in torque-speed look-up table (-) [SrvD DLL_NumTrq parameter] dll_data%avrSWAP(27) = u%HorWindV !> * Record 27: Hub wind speed (m/s) [SrvD input] dll_data%avrSWAP(28) = dll_data%Ptch_Cntrl !> * Record 28: Pitch control: 0 = collective, 1 = individual (-) [SrvD Ptch_Cntrl parameter] - dll_data%avrSWAP(29) = dll_data%Yaw_Cntrl !> * Record 29: Yaw control: 0 = yaw rate control, 1 = yaw torque control (-) [must be 0 for ServoDyn] + dll_data%avrSWAP(29) = dll_data%Yaw_Cntrl !> * Record 29: Yaw control: 0 = yaw rate control, 1 = yaw torque control (-) [must be 0 for ServoDyn] !^^^ bjj: maybe torque control can be used in ServoDyn? can we specifiy yaw torque control? dll_data%avrSWAP(30) = u%RootMyc(1) !> * Record 30: Blade 1 root out-of-plane bending moment (Nm) [SrvD input] dll_data%avrSWAP(31) = u%RootMyc(2) !> * Record 31: Blade 2 root out-of-plane bending moment (Nm) [SrvD input] @@ -819,44 +825,44 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) ! Record 81 is the variable slip current demand; both input and output [see Retrieve_avrSWAP()] ! variable slip current demand is ignored; instead, the generator torque demand from Record 47 is used dll_data%avrSWAP(82) = u%NcIMURAxs !> * Record 82: Nacelle roll acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system - dll_data%avrSWAP(83) = u%NcIMURAys !> * Record 83: Nacelle nodding acceleration (rad/s^2) [SrvD input] + dll_data%avrSWAP(83) = u%NcIMURAys !> * Record 83: Nacelle nodding acceleration (rad/s^2) [SrvD input] dll_data%avrSWAP(84) = u%NcIMURAzs !> * Record 84: Nacelle yaw acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system - - + + ! Records 92-94 are outputs [see Retrieve_avrSWAP()] - + ! these two "inputs" are actually customizations for a particular DLL dll_data%avrSWAP(95) = p%AirDens !> * Record 95: Reserved (SrvD customization: set to SrvD AirDens parameter) dll_data%avrSWAP(96) = p%AvgWindSpeed !> * Record 96: Reserved (SrvD customization: set to SrvD AvgWindSpeed parameter) - + ! Record 98 is output [see Retrieve_avrSWAP()] dll_data%avrSWAP(98) = 0 !> * Record 98: set to 0 - + ! Records 102-104 are outputs [see Retrieve_avrSWAP()] ! Records 107-108 are outputs [see Retrieve_avrSWAP()] dll_data%avrSWAP(109) = u%LSSTipMxa ! or u%LSShftMxs !> * Record 109: Shaft torque (=hub Mx for clockwise rotor) (Nm) [SrvD input] dll_data%avrSWAP(117) = 0 !> * Record 117: Controller state [always set to 0] - - !> * Records \f$R\f$ through \f$R + 2*DLL\_NumTrq - 1\f$: torque-speed look-up table elements. + + !> * Records \f$R\f$ through \f$R + 2*DLL\_NumTrq - 1\f$: torque-speed look-up table elements. DO I = 1,dll_data%DLL_NumTrq ! Loop through all torque-speed look-up table elements dll_data%avrSWAP( R + (2*I) - 2 ) = dll_data%GenSpd_TLU(I) !> + Records \f$R, R+2, R+4, \dots, R + 2*DLL\_NumTrq - 2\f$: Generator speed look-up table elements (rad/s) dll_data%avrSWAP( R + (2*I) - 1 ) = dll_data%GenTrq_TLU(I) !> + Records \f$R+1, R+3, R+5, \dots, R + 2*DLL\_NumTrq - 1\f$: Generator torque look-up table elements (Nm) ENDDO - + !> * Records 120-129: User-defined variables 1-10; ignored in ServoDyn -! Records 130-142 are outputs [see Retrieve_avrSWAP()] +! Records 130-142 are outputs [see Retrieve_avrSWAP()] ! Records L1 and onward are outputs [see Retrieve_avrSWAP()] - - - + + + RETURN - + END SUBROUTINE Fill_avrSWAP !================================================================================================================================== -!> This routine fills the dll_data variables that are used in the non-legacy version of the Bladed DLL interface with inputs, +!> This routine fills the dll_data variables that are used in the non-legacy version of the Bladed DLL interface with inputs, !! as described in Appendices A and B of the Bladed User Manual of Bladed version 4.8. SUBROUTINE Fill_CONTROL_vars( t, u, p, ErrMsgSz, dll_data ) @@ -882,19 +888,22 @@ SUBROUTINE Fill_CONTROL_vars( t, u, p, ErrMsgSz, dll_data ) dll_data%ShaftBrakeStatusBinaryFlag = 0 ! no brakes deployed dll_data%HSSBrDeployed = .false. - dll_data%PrevBlPitch(1:p%NumBl) = p%BlPitchInit - dll_data%BlPitchCom(1:p%NumBl) = p%BlPitchInit + dll_data%PrevBlPitch(:) = 0.0_ReKi ! Harcoded to size 3 + dll_data%BlPitchCom(:) = 0.0_ReKi ! Harcoded to size 3 + dll_data%BlAirfoilCom(:)= 0.0_ReKi ! Harcoded to size 3 + dll_data%PrevBlPitch(1:p%NumBl) = p%BlPitchInit(1:p%NumBl) + dll_data%BlPitchCom(1:p%NumBl) = p%BlPitchInit(1:p%NumBl) end if - + call Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) ! we'll set the avrSWAP variable, for the legacy version of the DLL, too. - + !> The following are values ServoDyn sends to the Bladed DLL. !! For variables returned from the DLL, see bladedinterface::retrieve_control_vars. - + dll_data%ErrMsg = '' dll_data%ErrStat = ErrID_None dll_data%OverrideYawRateWithTorque = .false. - + dll_data%CurrentTime = t ! Current time (sec) dll_data%BlPitchInput(1:p%NumBl) = u%BlPitch(1:p%NumBl) ! current blade pitch (input) dll_data%YawAngleFromNorth = u%YawAngle - p%NacYaw_North ! Nacelle yaw angle from North (rad) @@ -922,13 +931,13 @@ SUBROUTINE Fill_CONTROL_vars( t, u, p, ErrMsgSz, dll_data ) dll_data%RootMxc = u%RootMxc ! Blade root in-plane bending moment (Nm) [SrvD input] END SUBROUTINE Fill_CONTROL_vars -!================================================================================================================================== -!> This routine retrieves the DLL return values from the avrSWAP array, as described in Appendices A and B of the Bladed User +!================================================================================================================================== +!> This routine retrieves the DLL return values from the avrSWAP array, as described in Appendices A and B of the Bladed User !! Manual of Bladed version 3.81. SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) !SUBROUTINE Retrieve_avrSWAP( p, dll_data ) !.................................................................................................................................. - + TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters TYPE(BladedDLLType), INTENT(INOUT) :: dll_data !< data for the Bladed DLL INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -937,28 +946,28 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) ! local variables: INTEGER(IntKi) :: K ! Loop counter CHARACTER(*), PARAMETER :: RoutineName = 'Retrieve_avrSWAP' - - + + ! Initialize ErrStat and ErrMsg ErrStat = ErrID_None - ErrMsg = '' - - !> The following are values the Bladed DLL sends to ServoDyn. Whether or not ServoDyn uses the values in CalcOutput (servodyn::srvd_calcoutput) + ErrMsg = '' + + !> The following are values the Bladed DLL sends to ServoDyn. Whether or not ServoDyn uses the values in CalcOutput (servodyn::srvd_calcoutput) !! and/or UpdateStates (servodyn::srvd_updatestates) is determined by other parameters set in the ServoDyn input file. !! For variables sent to the DLL, see bladedinterface::fill_avrswap. - - + + !! Load control demands (commands) out of the avrSWAP array according to !! Appendix A of the Bladed User Manual: !> * Record 35: Generator contactor (-) [sent to DLL at the next call] dll_data%GenState = NINT( dll_data%avrSWAP(35) ) ! Generator contactor (-) - - -!> * Record 36: Shaft brake status (-) [sent to DLL at the next call; anything other than 0 or 1 is an error] + + +!> * Record 36: Shaft brake status (-) [sent to DLL at the next call; anything other than 0 or 1 is an error] !dll_data%HSSBrFrac = dll_data%avrSWAP(36) ! Shaft brake status (-) dll_data%ShaftBrakeStatusBinaryFlag = NINT(dll_data%avrSWAP(36)) - + !! Records 38-40 are reserved !> * Record 41: demanded yaw actuator torque [this output is ignored since record 29 is set to 0 by ServoDyn indicating yaw rate control] dll_data%YawTorqueDemand = dll_data%avrSWAP(41) @@ -972,7 +981,7 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) ELSE !IF ( p%Ptch_Cntrl == GH_DISCON_PITCH_CONTROL_COLLECTIVE ) THEN ! Collective pitch control !> * Record 45: Demanded pitch angle (Collective pitch) (rad) - dll_data%BlPitchCom = dll_data%avrSWAP(45) ! Demanded pitch angle (Collective pitch) (rad) + dll_data%BlPitchCom(:) = dll_data%avrSWAP(45) ! Demanded pitch angle (Collective pitch) (rad) !> * Record 46, demanded pitch rate (Collective pitch), is ingored since record 10 is set to 0 by ServoDyn indicating pitch position actuator @@ -980,10 +989,10 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) dll_data%GenTrq = dll_data%avrSWAP(47) !> * Record 47: Demanded generator torque (Nm) dll_data%YawRateCom = dll_data%avrSWAP(48) !> * Record 48: Demanded nacelle yaw rate (rad/s) - - + + !> * Record 55: Pitch override [anything other than 0 is an error in ServoDyn] - IF ( NINT( dll_data%avrSWAP(55) ) /= 0 ) THEN + IF ( NINT( dll_data%avrSWAP(55) ) /= 0 ) THEN ! Pitch override requested by DLL; abort program CALL SetErrStat( ErrID_Severe, 'Built-in pitch override unsupported. Set avrSWAP(55) to 0 in '// & TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) @@ -1004,7 +1013,7 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) !> * Record 65: Number of variables returned for logging [anything greater than MaxLoggingChannels is an error] IF ( NINT( dll_data%avrSWAP(65) ) > MaxLoggingChannels ) THEN - + ! Return variables for logging requested by DLL; abort program CALL SetErrStat( ErrID_Fatal, 'Return variables exceed maximum number allowed. Set avrSWAP(65) to a number no larger than '// & trim(num2lstr(MaxLoggingChannels))//' in '//TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) @@ -1014,13 +1023,13 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) !> * Record 72, the generator start-up resistance, is ignored !> * Record 79, the request for loads, is ignored; instead, the blade, hub, and yaw bearing loads are always passed to the DLL as if Record 79 was set to 4 !> * Records 80-81, the variable-slip current demand inputs, are ignored; instead, the generator torque demand from Record 47 is used - + !> * Records 92-94: allow the control to change the wind inflow input; NOT ALLOWED in ServoDyn !> * Record 98: Safety system number to activate; not used in ServoDyn !> * Records 102-104: Yaw control/stiffness/damping; ignored in ServoDyn - if (dll_data%avrSWAP(102)==4) then + if (dll_data%avrSWAP(102)==4) then dll_data%OverrideYawRateWithTorque = .true. elseif (dll_data%avrSWAP(102)==0) then dll_data%OverrideYawRateWithTorque = .false. @@ -1029,12 +1038,12 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) CALL SetErrStat( ErrID_Severe, 'Invalid yaw control flag. Set avrSWAP(102) to 0 or 4 in '// & TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) end if - + !> * Record 107: Brake torque demand (used only when avrSWAP(36) is 16) if (dll_data%ShaftBrakeStatusBinaryFlag == 16) then dll_data%HSSBrTrqDemand = dll_data%avrSWAP(107) end if - + !> * Record 108: Yaw brake torque demand; ignored in ServoDyn !> * Records 120-129: User-defined variables 1-10; ignored in ServoDyn @@ -1048,27 +1057,27 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) !> * Records 130-142: Reserved !> * L1: variables for logging output; - + do k=1,p%NumOuts_DLL dll_data%LogChannels(k) = dll_data%avrSWAP( NINT(dll_data%avrSWAP(63))+k-1 ) end do - + END SUBROUTINE Retrieve_avrSWAP !================================================================================================================================== !> This routine checks that the values returned to FAST from the controller DLL (from either version of the interface) are valid SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) - + TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters TYPE(BladedDLLType), INTENT(INOUT) :: dll_data !< data for the Bladed DLL INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'CheckDLLReturnValues' - + ! Initialize ErrStat and ErrMsg ErrStat = ErrID_None - ErrMsg = '' + ErrMsg = '' if (p%UseLegacyInterface) then CALL Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) @@ -1076,7 +1085,7 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) end if - IF ( ( dll_data%GenState /= 0_IntKi ) .AND. ( dll_data%GenState /= 1_IntKi ) ) THEN + IF ( ( dll_data%GenState /= 0_IntKi ) .AND. ( dll_data%GenState /= 1_IntKi ) ) THEN ! Generator contactor indicates something other than off or main; abort program if (p%UseLegacyInterface) then CALL SetErrStat( ErrID_Fatal, 'Only off and main generators supported. Set avrSWAP(35) to 0 or 1 in '//TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) @@ -1085,7 +1094,7 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) end if END IF - + SELECT CASE (dll_data%ShaftBrakeStatusBinaryFlag) CASE (0) @@ -1099,7 +1108,7 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) dll_data%HSSBrTrqDemand = 0.0_ReKi else ! apply a linear ramp up to the maximum value - IF ( dll_data%CurrentTime < dll_data%TimeHSSBrFullyDeployed ) THEN + IF ( dll_data%CurrentTime < dll_data%TimeHSSBrFullyDeployed ) THEN dll_data%HSSBrTrqDemand = ( dll_data%CurrentTime - dll_data%TimeHSSBrDeployed )/p%HSSBrDT * p%HSSBrTqF ELSE ! Full braking torque dll_data%HSSBrTrqDemand = p%HSSBrTqF @@ -1110,7 +1119,7 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) ! do we need to check that dll_data%HSSBrTrqDemand is set properly???? CASE DEFAULT dll_data%HSSBrDeployed = .false. - + ! Fatal issue: shaft brake status specified incorrectly if (p%UseLegacyInterface) then CALL SetErrStat( ErrID_Fatal, 'Shaft brake status set improperly. Set avrSWAP(36) to 0, 1, or 16 in '// & @@ -1120,7 +1129,7 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) TRIM(p%DLL_Trgt%FileName)//'.', ErrStat, ErrMsg, RoutineName) end if END SELECT - + END SUBROUTINE CheckDLLReturnValues !================================================================================================================================== END MODULE BladedInterface diff --git a/modules/servodyn/src/ServoDyn.f90 b/modules/servodyn/src/ServoDyn.f90 index ac0fd59c83..615d6d17a2 100644 --- a/modules/servodyn/src/ServoDyn.f90 +++ b/modules/servodyn/src/ServoDyn.f90 @@ -17,13 +17,14 @@ ! limitations under the License. ! !********************************************************************************************************************************** -!> Control and electrical drive dynamics module for FAST +!> Control and electrical drive dynamics module for FAST MODULE ServoDyn USE ServoDyn_Types USE NWTC_Library USE BladedInterface - USE TMD + USE StrucCtrl + USE ServoDyn_IO USE UserVSCont_KP ! <- module not in the FAST Framework! USE PitchCntrl_ACH ! <- module not in the FAST Framework! @@ -34,7 +35,7 @@ MODULE ServoDyn PRIVATE TYPE(ProgDesc), PARAMETER :: SrvD_Ver = ProgDesc( 'ServoDyn', '', '' ) - + #ifdef COMPILE_SIMULINK LOGICAL, PARAMETER, PUBLIC :: Cmpl4SFun = .TRUE. ! Is the module being compiled as an S-Function for Simulink? #else @@ -51,105 +52,28 @@ MODULE ServoDyn INTEGER, PARAMETER :: Indx_u_Yaw = 1 INTEGER, PARAMETER :: Indx_u_YawRate = 2 INTEGER, PARAMETER :: Indx_u_HSS_Spd = 3 - + INTEGER, PARAMETER, PUBLIC :: SrvD_Indx_Y_BlPitchCom(3) = (/1,2,3/) INTEGER, PARAMETER, PUBLIC :: SrvD_Indx_Y_YawMom = 4 INTEGER, PARAMETER, PUBLIC :: SrvD_Indx_Y_GenTrq = 5 INTEGER, PARAMETER, PUBLIC :: SrvD_Indx_Y_ElecPwr = 6 INTEGER, PARAMETER, PUBLIC :: SrvD_Indx_Y_WrOutput = 6 ! last non-writeoutput variable -! =================================================================================================== -! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" -! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these -! lines should be modified in the Matlab script and/or Excel worksheet as necessary. -! =================================================================================================== -! This code was generated by Write_ChckOutLst.m at 05-Nov-2015 09:57:49. - - - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - - ! Indices for computing output channels: - ! NOTES: - ! (1) These parameters are in the order stored in "OutListParameters.xlsx" - ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter - - ! Time: - - INTEGER(IntKi), PARAMETER :: Time = 0 - - - ! Pitch Control: - - INTEGER(IntKi), PARAMETER :: BlPitchC1 = 1 - INTEGER(IntKi), PARAMETER :: BlPitchC2 = 2 - INTEGER(IntKi), PARAMETER :: BlPitchC3 = 3 - - - ! Generator and Torque Control: - - INTEGER(IntKi), PARAMETER :: GenTq = 4 - INTEGER(IntKi), PARAMETER :: GenPwr = 5 - - - ! High Speed Shaft Brake: - - INTEGER(IntKi), PARAMETER :: HSSBrTqC = 6 - - - ! Nacelle Yaw Control: - - INTEGER(IntKi), PARAMETER :: YawMomCom = 7 - - - ! Nacelle Tuned Mass Damper (TMD): - - INTEGER(IntKi), PARAMETER :: NTMD_XQ = 8 - INTEGER(IntKi), PARAMETER :: NTMD_XQD = 9 - INTEGER(IntKi), PARAMETER :: NTMD_YQ = 10 - INTEGER(IntKi), PARAMETER :: NTMD_YQD = 11 - - - ! Tower Tuned Mass Damper (TMD): - - INTEGER(IntKi), PARAMETER :: TTMD_XQ = 12 - INTEGER(IntKi), PARAMETER :: TTMD_XQD = 13 - INTEGER(IntKi), PARAMETER :: TTMD_YQ = 14 - INTEGER(IntKi), PARAMETER :: TTMD_YQD = 15 - - ! Airfoil Control (might be used for flap actuation): - - INTEGER(IntKi), PARAMETER :: BlAirFlC1 = 16 - INTEGER(IntKi), PARAMETER :: BlAirFlC2 = 17 - INTEGER(IntKi), PARAMETER :: BlAirFlC3 = 18 - - ! The maximum number of output channels which can be output by the code. - INTEGER(IntKi), PARAMETER :: MaxOutPts = 18 - -!End of code generated by Matlab script -! =================================================================================================== - - INTEGER(IntKi), PARAMETER :: BlPitchC (3) = (/ BlPitchC1, BlPitchC2, BlPitchC3 /) - INTEGER(IntKi), PARAMETER :: BlAirfoilC (3) = (/ BlAirFlC1, BlAirFlC2, BlAirFlC3 /) - -!bjj: added parameters here (after the "(/ /)" above) so VS2010 doesn't get so confused with the previous statement. ! Parameters for type of control - + INTEGER(IntKi), PARAMETER :: ControlMode_NONE = 0 !< The (ServoDyn-universal) control code for not using a particular type of control INTEGER(IntKi), PARAMETER :: ControlMode_SIMPLE = 1 !< The (ServoDyn-universal) control code for obtaining the control values from a simple built-in controller INTEGER(IntKi), PARAMETER :: ControlMode_ADVANCED = 2 !< The (ServoDyn-universal) control code for not using the control values from an advanced built-in controller (or just a different simple model?) INTEGER(IntKi), PARAMETER :: ControlMode_USER = 3 !< The (ServoDyn-universal) control code for obtaining the control values from a user-defined routine INTEGER(IntKi), PARAMETER :: ControlMode_EXTERN = 4 !< The (ServoDyn-universal) control code for obtaining the control values from Simulink or Labivew INTEGER(IntKi), PARAMETER :: ControlMode_DLL = 5 !< The (ServoDyn-universal) control code for obtaining the control values from a Bladed-Style dynamic-link library - + INTEGER(IntKi), PARAMETER, PUBLIC :: TrimCase_none = 0 INTEGER(IntKi), PARAMETER, PUBLIC :: TrimCase_yaw = 1 INTEGER(IntKi), PARAMETER, PUBLIC :: TrimCase_torque = 2 INTEGER(IntKi), PARAMETER, PUBLIC :: TrimCase_pitch = 3 - + ! ..... Public Subroutines ................................................................................................... PUBLIC :: SrvD_Init ! Initialization routine @@ -175,8 +99,8 @@ MODULE ServoDyn ! (Xd), and constraint-state (Z) equations all with respect to the constraint ! states (z) PUBLIC :: SrvD_GetOP ! Routine to pack the operating point values (for linearization) into arrays - - + + CONTAINS !---------------------------------------------------------------------------------------------------------------------------------- !> This routine is called at the start of the simulation to perform initialization steps. @@ -207,14 +131,19 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! local variables + character(1024) :: PriPath ! Path name of the primary file + type(FileInfoType) :: FileInfo_In !< The derived type for holding the full input file for parsing -- we may pass this in the future TYPE(SrvD_InputFile) :: InputFileData ! Data stored in the module's input file - TYPE(TMD_InitInputType) :: TMD_InitInp ! data to initialize TMD module - TYPE(TMD_InitOutputType) :: TMD_InitOut ! data from TMD module initialization (not used) + TYPE(StC_InitInputType) :: StC_InitInp ! data to initialize StC module + TYPE(StC_InitOutputType) :: StC_InitOut ! data from StC module initialization (not used) INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: j ! loop counter + INTEGER(IntKi) :: K ! loop counter INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + character(*), parameter :: RoutineName = 'SrvD_Init' + ! Initialize variables @@ -222,7 +151,7 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ErrStat = ErrID_None ErrMsg = "" - + ! Initialize the NWTC Subroutine Library CALL NWTC_Init( EchoLibVer=.FALSE. ) @@ -230,149 +159,162 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! Display the module information CALL DispNVD( SrvD_Ver ) + CALL GetPath( InitInp%InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. - !............................................................................................ + !............................................................................................ ! Read the input file and validate the data - ! (note p%NumBl and p%RootName must be set first!) - !............................................................................................ + ! (note p%NumBl and p%RootName must be set first!) + !............................................................................................ p%RootName = InitInp%Rootname ! FAST adds the '.SrvD' before calling this module p%NumBl = InitInp%NumBl - CALL SrvD_ReadInput( InitInp, InputFileData, Interval, p%RootName, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - + if (InitInp%UseInputFile) then + ! Read the entire input file, minus any comment lines, into the FileInfo_In + ! data structure in memory for further processing. + call ProcessComFile( InitInp%InputFile, FileInfo_In, ErrStat2, ErrMsg2 ) + else + ! put passed string info into the FileInfo_In -- FileInfo structure + call NWTC_Library_CopyFileInfoType( InitInp%PassedPrimaryInputData, FileInfo_In, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + endif + if (Failed()) return; + + ! For diagnostic purposes, the following can be used to display the contents + ! of the FileInfo_In data structure. + ! call Print_FileInfo_Struct( CU, FileInfo_In ) ! CU is the screen -- different number on different systems. + + ! Parse the FileInfo_In structure of data from the inputfile into the InitInp%InputFile structure + CALL ParseInputFileInfo( PriPath, InitInp%InputFile, TRIM(InitInp%RootName), FileInfo_In, InputFileData, Interval, ErrStat2, ErrMsg2 ) + if (Failed()) return; + CALL ValidatePrimaryData( InitInp, InputFileData, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; - if ( (InitInp%NumCtrl2SC > 0 .and. InitInp%NumCtrl2SC <= 0) .or. & - (InitInp%NumSC2Ctrl <= 0 .and. InitInp%NumSC2Ctrl > 0) ) then - call CheckError( ErrID_Fatal, "If supercontroller is used, there must be at least one supercontroller input and one supercontroller output." ) - return - end if - !............................................................................................ ! Define parameters here: !............................................................................................ CALL SrvD_SetParameters( InputFileData, p, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - !p%DT = Interval + if (Failed()) return; ! Set and verify BlPitchInit, which comes from InitInputData (not the inputfiledata) CALL AllocAry( p%BlPitchInit, p%NumBl, 'BlPitchInit', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; p%BlPitchInit = InitInp%BlPitchInit IF ( ANY( p%BlPitchInit <= -pi ) .OR. ANY( p%BlPitchInit > pi ) ) THEN - CALL CheckError( ErrID_Fatal, 'BlPitchInit must be in the range (-pi,pi] radians (i.e., (-180,180] degrees).' ) - IF (ErrStat >= AbortErrLev) RETURN + call SetErrStat( ErrID_Fatal, 'BlPitchInit must be in the range (-pi,pi] radians (i.e., (-180,180] degrees).',ErrStat,ErrMsg,RoutineName) + call Cleanup() END IF !............................................................................................ ! Define initial system states here: !............................................................................................ - x%DummyContState = 0.0_ReKi + x%DummyContState = 0.0_ReKi z%DummyConstrState = 0.0_ReKi - + CALL AllocAry( m%xd_BlPitchFilter, p%NumBl, 'BlPitchFilter', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - m%xd_BlPitchFilter = p%BlPitchInit + if (Failed()) return; + m%xd_BlPitchFilter = p%BlPitchInit !....................... ! Other states for pitch maneuver !....................... CALL AllocAry( OtherState%BegPitMan, p%NumBl, 'BegPitMan', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%BegPitMan = .false. ! Pitch maneuvers didn't actually start, yet CALL AllocAry( OtherState%BlPitchI, p%NumBl, 'BlPitchI', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%BlPitchI = 0.0_ReKi - + CALL AllocAry( OtherState%TPitManE, p%NumBl, 'TPitManE', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%TPitManE = 0.0_DbKi !....................... ! Other states for yaw maneuver - !....................... - OtherState%BegYawMan = .false. ! Yaw maneuver didn't actually start, yet + !....................... + OtherState%BegYawMan = .false. ! Yaw maneuver didn't actually start, yet OtherState%NacYawI = 0.0_ReKi OtherState%TYawManE = 0.0_ReKi - + !....................... ! other states for torque control: - !....................... + !....................... OtherState%Off4Good = .false. ! generator is not off for good ! is the generator online at initialization? IF ( p%GenTiStr .and. p%TimGenOn <= 0.0_ReKi ) THEN ! Start-up of generator determined by time, TimGenOn OtherState%GenOnLine = .true. ELSE - OtherState%GenOnLine = .false. + OtherState%GenOnLine = .false. END IF - - + + !............................................................................................ ! Define initial guess for the system inputs here: !............................................................................................ CALL AllocAry( u%BlPitch, p%NumBl, 'BlPitch', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; CALL AllocAry( u%ExternalBlPitchCom, p%NumBl, 'ExternalBlPitchCom', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; - IF (InitInp%NumSC2Ctrl > 0 .and. p%UseBladedInterface) THEN - CALL AllocAry( u%SuperController, InitInp%NumSC2Ctrl, 'u%SuperController', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - u%SuperController = 0.0_SiKi + IF ( (InitInp%NumSC2CtrlGlob > 0) .or. (InitInp%NumSC2Ctrl > 0) .or. (InitInp%NumCtrl2SC > 0) ) THEN + p%UseSC = .TRUE. + ElSE + p%UseSC = .FALSE. END IF - - - u%BlPitch = p%BlPitchInit + + IF (p%UseBladedInterface) THEN + CALL AllocAry( u%fromSC, InitInp%NumSC2Ctrl, 'u%fromSC', ErrStat2, ErrMsg2 ) + if (Failed()) return; + if (InitInp%NumSC2Ctrl > 0 ) then + u%fromSC = InitInp%fromSC + end if + END IF + + IF (p%UseBladedInterface) THEN + CALL AllocAry( u%fromSCglob, InitInp%NumSC2CtrlGlob, 'u%fromSCglob', ErrStat2, ErrMsg2 ) + if (Failed()) return; + if (InitInp%NumSC2CtrlGlob > 0) then + u%fromSCglob = InitInp%fromSCGlob + end if + END IF + + u%BlPitch = p%BlPitchInit(1:p%NumBl) u%Yaw = p%YawNeut u%YawRate = 0.0 - + u%LSS_Spd = 0.0 u%HSS_Spd = 0.0 u%RotSpeed = 0.0 - + u%ExternalYawPosCom = p%YawNeut u%ExternalYawRateCom = 0. - u%ExternalBlPitchCom = p%BlPitchInit + u%ExternalBlPitchCom = p%BlPitchInit(1:p%NumBl) u%ExternalGenTrq = 0. u%ExternalElecPwr = 0. u%ExternalHSSBrFrac = 0. - + u%TwrAccel = 0. - u%YawErr = 0. + u%YawErr = 0. u%WindDir = 0. - + !Inputs for the Bladed Interface: - u%RootMyc = 0. + u%RootMyc(:) = 0. ! Hardcoded to 3 u%YawBrTAxp = 0. u%YawBrTAyp = 0. u%LSSTipPxa = 0. - u%RootMxc = 0. + u%RootMxc(:)= 0. ! Hardcoded to 3 u%LSSTipMxa = 0. u%LSSTipMya = 0. u%LSSTipMza = 0. u%LSSTipMys = 0. u%LSSTipMzs = 0. u%YawBrMyn = 0. - u%YawBrMzn = 0. + u%YawBrMzn = 0. u%NcIMURAxs = 0. u%NcIMURAys = 0. u%NcIMURAzs = 0. @@ -386,46 +328,39 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! Define system output initializations (set up mesh) here: !............................................................................................ CALL AllocAry( y%BlPitchCom, p%NumBl, 'BlPitchCom', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; ! Commanded Airfoil UserProp for blade. Must be same units as given in AD15 airfoil tables ! This is passed to AD15 to be interpolated with the airfoil table userprop column CALL AllocAry( y%BlAirfoilCom, p%NumBl, 'BlAirfoilCom', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - y%BlAirfoilCom = 0.0_ReKi + if (Failed()) return; + y%BlAirfoilCom = 0.0_ReKi ! tip brakes - this may be added back, later, so we'll keep these here for now CALL AllocAry( y%TBDrCon, p%NumBl, 'TBDrCon', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; + - IF (InitInp%NumCtrl2SC > 0 .and. p%UseBladedInterface) THEN - CALL AllocAry( y%SuperController, InitInp%NumCtrl2SC, 'y%SuperController', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - y%SuperController = 0.0_SiKi + CALL AllocAry( y%toSC, InitInp%NumCtrl2SC, 'y%SuperController', ErrStat2, ErrMsg2 ) + if (Failed()) return; + y%toSC = 0.0_SiKi END IF - - + + !............................................................................................ ! tip brakes - this may be added back, later, so we'll keep these here for now - !............................................................................................ + !............................................................................................ CALL AllocAry( OtherState%BegTpBr, p%NumBl, 'BegTpBr', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%BegTpBr = .FALSE. - + CALL AllocAry( OtherState%TTpBrDp, p%NumBl, 'TTpBrDp', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%TTpBrDp = HUGE(OtherState%TTpBrDp) !basically never deploy them. Eventually this will be added back? CALL AllocAry( OtherState%TTpBrFl, p%NumBl, 'TTpBrFl', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; OtherState%TTpBrFl = HUGE(OtherState%TTpBrFl) !basically never deploy them. Eventually this will be added back? !OtherState%TTpBrFl = InputFileData%TTpBrFl + p%TpBrDT @@ -433,29 +368,28 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO !............................................................................................ ! yaw control integrated command angle !............................................................................................ - OtherState%YawPosComInt = p%YawNeut - - + OtherState%YawPosComInt = p%YawNeut + + !............................................................................................ ! If you want to choose your own rate instead of using what the glue code suggests, tell the glue code the rate at which ! this module must be called here: !............................................................................................ - Interval = p%DT - + Interval = p%DT + !............................................................................................ ! After we've set up all the data for everything else, we'll call the routines to initialize the Bladed Interface ! (it requires initial guesses for input/output) !............................................................................................ - + IF ( p%UseBladedInterface ) THEN p%AirDens = InitInp%AirDens p%AvgWindSpeed = InitInp%AvgWindSpeed - - CALL BladedInterface_Init(u, p, m, y, InputFileData, InitInp, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + + CALL BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat2, ErrMsg2 ) + if (Failed()) return; m%LastTimeCalled = - m%dll_data%DLL_DT ! we'll initialize the last time the DLL was called as -1 DLL_DT. m%LastTimeFiltered = - p%DT ! we'll initialize the last time the DLL was filtered as -1 DT. @@ -466,56 +400,28 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO p%DLL_Trgt%FileName = "" p%DLL_Trgt%ProcName = "" - - END IF - - - !............................................................................................ - ! Initialize the TMD module for Nacelle: - !............................................................................................ - IF (p%CompNTMD) THEN - - TMD_InitInp%InputFile = InputFileData%NTMDfile - TMD_InitInp%RootName = TRIM(p%RootName)//'.NTMD' - TMD_InitInp%Gravity = InitInp%gravity - TMD_InitInp%r_N_O_G = InitInp%r_N_O_G - - CALL TMD_Init( TMD_InitInp, u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, y%NTMD, m%NTMD, Interval, TMD_InitOut, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - - IF (.NOT. EqualRealNos( Interval, p%DT ) ) THEN - CALL CheckError( ErrID_Fatal, "Nacelle TMD time step differs from SrvD time step." ) - RETURN - END IF - + END IF - + + !............................................................................................ - ! Initialize the TMD module for tower: + ! Setup and initialize the StC submodule (possibly multiple instances at each location) !............................................................................................ - IF (p%CompTTMD) THEN - - TMD_InitInp%InputFile = InputFileData%TTMDfile - TMD_InitInp%RootName = TRIM(p%RootName)//'.TTMD' - TMD_InitInp%Gravity = InitInp%gravity - TMD_InitInp%r_N_O_G = InitInp%r_TwrBase - - CALL TMD_Init( TMD_InitInp, u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, y%TTMD, m%TTMD, Interval, TMD_InitOut, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - - IF (.NOT. EqualRealNos( Interval, p%DT ) ) THEN - CALL CheckError( ErrID_Fatal, "Tower TMD time step differs from SrvD time step." ) - RETURN - END IF - - END IF - - - + call StC_Nacelle_Setup(InitInp,p,InputFileData,u%NStC,p%NStC,x%NStC,xd%NStC,z%NStC,OtherState%NStC,y%NStC,m%NStC,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_Tower_Setup(InitInp,p,InputFileData,u%TStC,p%TStC,x%TStC,xd%TStC,z%TStC,OtherState%TStC,y%TStC,m%TStC,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_Blade_Setup(InitInp,p,InputFileData,u%BStC,p%BStC,x%BStC,xd%BStC,z%BStC,OtherState%BStC,y%BStC,m%BStC,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_S_Setup(InitInp,p,InputFileData,u%SStC,p%SStC,x%SStC,xd%SStC,z%SStC,OtherState%SStC,y%SStC,m%SStC,ErrStat2,ErrMsg2) + if (Failed()) return; + + !............................................................................................ - ! Set Init outputs for linearization (after TMD, in case we ever add the TMD to the linearization features): + ! Set Init outputs for linearization (after StrucCtrl, in case we ever add the StrucCtrl to the linearization features): !............................................................................................ xd%CtrlOffset = 0.0_ReKi ! initialize before first use with TrimCase in linearization p%TrimCase = InitInp%TrimCase @@ -523,25 +429,23 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO p%RotSpeedRef = InitInp%RotSpeedRef if (InitInp%Linearize) then - - ! If the module does allow linearization, return the appropriate Jacobian row/column names here: - ! Allocate and set these variables: InitOut%LinNames_y, InitOut%LinNames_x, InitOut%LinNames_xd, InitOut%LinNames_z, InitOut%LinNames_u - + + ! If the module does allow linearization, return the appropriate Jacobian row/column names here: + ! Allocate and set these variables: InitOut%LinNames_y, InitOut%LinNames_x, InitOut%LinNames_xd, InitOut%LinNames_z, InitOut%LinNames_u + CALL AllocAry( InitOut%RotFrame_y, SrvD_Indx_Y_WrOutput+p%NumOuts, 'RotFrame_y', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; CALL AllocAry( InitOut%LinNames_y, SrvD_Indx_Y_WrOutput+p%NumOuts, 'LinNames_y', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; - do i=1,size(SrvD_Indx_Y_BlPitchCom) + do i=1,size(SrvD_Indx_Y_BlPitchCom) ! NOTE: potentially limit to NumBl InitOut%LinNames_y(SrvD_Indx_Y_BlPitchCom(i)) = 'BlPitchCom('//trim(num2lstr(i))//'), rad' - InitOut%RotFrame_y(SrvD_Indx_Y_BlPitchCom(i)) = .true. + InitOut%RotFrame_y(SrvD_Indx_Y_BlPitchCom(i)) = .true. end do InitOut%LinNames_y(SrvD_Indx_Y_YawMom) = 'YawMom, Nm' InitOut%RotFrame_y(SrvD_Indx_Y_YawMom) = .false. - + InitOut%LinNames_y(SrvD_Indx_Y_GenTrq) = 'GenTrq, Nm' InitOut%RotFrame_y(SrvD_Indx_Y_GenTrq) = .false. @@ -552,19 +456,16 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO InitOut%LinNames_y(i+SrvD_Indx_Y_WrOutput) = trim(p%OutParam(i)%Name)//', '//p%OutParam(i)%Units InitOut%RotFrame_y(i+SrvD_Indx_Y_WrOutput) = ANY( p%OutParam(i)%Indx == BlPitchC ) ! the only WriteOutput values in the rotating frame are BlPitch commands end do - - + + CALL AllocAry( InitOut%RotFrame_u, 3, 'RotFrame_u', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; CALL AllocAry( InitOut%IsLoad_u, 3, 'IsLoad_u', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; CALL AllocAry( InitOut%LinNames_u, 3, 'LinNames_u', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; InitOut%LinNames_u(Indx_u_Yaw ) = 'Yaw, rad' InitOut%LinNames_u(Indx_u_YawRate) = 'YawRate, rad/s' @@ -583,88 +484,381 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! Define initialization-routine output here: !............................................................................................ CALL AllocAry( y%WriteOutput, p%NumOuts+p%NumOuts_DLL, 'WriteOutput', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; y%WriteOutput = 0 CALL AllocAry( InitOut%WriteOutputHdr, p%NumOuts+p%NumOuts_DLL, 'WriteOutputHdr', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; CALL AllocAry( InitOut%WriteOutputUnt, p%NumOuts+p%NumOuts_DLL, 'WriteOutputUnt', ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; do i=1,p%NumOuts InitOut%WriteOutputHdr(i) = p%OutParam(i)%Name InitOut%WriteOutputUnt(i) = p%OutParam(i)%Units end do - + j=p%NumOuts do i=1,p%NumOuts_DLL j = j + 1 InitOut%WriteOutputHdr(j) = m%dll_data%LogChannels_OutParam(i)%Name InitOut%WriteOutputUnt(j) = m%dll_data%LogChannels_OutParam(i)%Units end do - + InitOut%Ver = SrvD_Ver - + InitOut%UseHSSBrake = (p%HSSBrMode /= ControlMode_None .AND. p%THSSBrDp < InitInp%TMax) .or. p%HSSBrMode == ControlMode_DLL - + IF ( p%UseBladedInterface .OR. InitOut%UseHSSBrake ) THEN InitOut%CouplingScheme = ExplicitLoose - ! CALL CheckError( ErrID_Info, 'The external dynamic-link library option being used in ServoDyn '& - ! //'requires an explicit-loose coupling scheme.' ) + ! CALL SetErrStat( ErrID_Info, 'The external dynamic-link library option being used in ServoDyn '& + ! //'requires an explicit-loose coupling scheme.',ErrStat,ErrMsg,RoutineName ) ELSE InitOut%CouplingScheme = ExplicitLoose END IF - - + + !............................................................................................ ! Clean up the local variables: !............................................................................................ CALL SrvD_DestroyInputFile( InputFileData, ErrStat2, ErrMsg2 ) - CALL TMD_DestroyInitInput(TMD_InitInp, ErrStat2, ErrMsg2 ) - CALL TMD_DestroyInitOutput(TMD_InitOut, ErrStat2, ErrMsg2 ) - - RETURN - -CONTAINS - !............................................................................................................................... - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev - !............................................................................................................................... - - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) - - INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) - CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ - - IF ( ErrID /= ErrID_None ) THEN - - IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'SrvD_Init:'//TRIM(Msg) - ErrStat = MAX(ErrStat, ErrID) - - !......................................................................................................................... - ! Clean up if we're going to return on error: close files, deallocate local arrays - !......................................................................................................................... - IF ( ErrStat >= AbortErrLev ) THEN - CALL SrvD_DestroyInputFile(InputFileData, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyInitInput(TMD_InitInp, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyInitOutput(TMD_InitOut, ErrStat3, ErrMsg3 ) - END IF + RETURN - END IF +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + subroutine Cleanup() ! Ignore any errors here + CALL SrvD_DestroyInputFile(InputFileData, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + end subroutine Cleanup +END SUBROUTINE SrvD_Init +!---------------------------------------------------------------------------------------------------------------------------------- - END SUBROUTINE CheckError !---------------------------------------------------------------------------------------------------------------------------------- -END SUBROUTINE SrvD_Init +!> This routine sets the data structures for the structural control (StC) module -- Nacelle Instances +subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) + type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine + type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters + TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters + type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states + type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states + type(StC_ConstraintStateType), allocatable,intent( out) :: z(:) !< Initial guess of the constraint states + type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states + type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; + type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Counter for the instances + real(DbKi) :: Interval !< Coupling interval in seconds from StC + type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module + type(StC_InitOutputType) :: StC_InitOut !< data from StC module initialization (not currently used) + character(*), parameter :: RoutineName = 'StC_Nacelle_Setup' + + ErrStat = ErrID_None + ErrMsg = "" + + if (SrvD_p%NumNStC > 0_IntKi) then + allocate(u(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + allocate(p(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; + allocate(x(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; + allocate(xd(SrvD_p%NumNStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; + allocate(z(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, z') ) return; + allocate(OtherState(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; + allocate(y(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; + allocate(m(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + + do j=1,SrvD_p%NumNStC + StC_InitInp%InputFile = InputFileData%NStCfiles(j) + StC_InitInp%RootName = TRIM(SrvD_p%RootName)//'.NStC' + StC_InitInp%Gravity = SrvD_InitInp%gravity + StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Nacelle + Interval = SrvD_p%DT ! Pass the ServoDyn DT + + CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitPosition(:,1) = SrvD_InitInp%NacPosition + StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%NacOrientation + + CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & + CALL SetErrStat( ErrID_Fatal, "Nacelle StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + if (Failed()) return; + + call Cleanup() + enddo + endif +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + logical function AllErr(Msg) + character(*), intent(in) :: Msg + if(ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, Msg, ErrStat, ErrMsg, RoutineName ) + endif + AllErr = ErrStat >= AbortErrLev + if (AllErr) call Cleanup() + end function AllErr + subroutine Cleanup() ! Ignore any errors here + CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + end subroutine Cleanup +end subroutine StC_Nacelle_Setup +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the data structures for the structural control (StC) module -- Tower instances +subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) + type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine + type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters + TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters + type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states + type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states + type(StC_ConstraintStateType), allocatable,intent( out) :: z(:) !< Initial guess of the constraint states + type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states + type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; + type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Counter for the instances + real(DbKi) :: Interval !< Coupling interval in seconds from StC + type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module + type(StC_InitOutputType) :: StC_InitOut !< data from StC module initialization (not currently used) + character(*), parameter :: RoutineName = 'StC_Tower_Setup' + + ErrStat = ErrID_None + ErrMsg = "" + + if (SrvD_p%NumTStC > 0_IntKi) then + allocate(u(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + allocate(p(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; + allocate(x(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; + allocate(xd(SrvD_p%NumTStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; + allocate(z(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, z') ) return; + allocate(OtherState(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; + allocate(y(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; + allocate(m(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + + do j=1,SrvD_p%NumTStC + StC_InitInp%InputFile = InputFileData%TStCfiles(j) + StC_InitInp%RootName = TRIM(SrvD_p%RootName)//'.TStC' + StC_InitInp%Gravity = SrvD_InitInp%gravity + StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Tower + Interval = SrvD_p%DT ! Pass the ServoDyn DT + + CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitPosition(:,1) = SrvD_InitInp%TwrBasePos + StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%TwrBaseOrient + + CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & + CALL SetErrStat( ErrID_Fatal, "Tower StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + if (Failed()) return; + + call Cleanup() + enddo + endif +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + logical function AllErr(Msg) + character(*), intent(in) :: Msg + if(ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, Msg, ErrStat, ErrMsg, RoutineName ) + endif + AllErr = ErrStat >= AbortErrLev + if (AllErr) call Cleanup() + end function AllErr + subroutine Cleanup() ! Ignore any errors here + CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + end subroutine Cleanup +end subroutine StC_Tower_Setup +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the data structures for the structural control (StC) module -- Blade instances +subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) + type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine + type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters + TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters + type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states + type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states + type(StC_ConstraintStateType), allocatable,intent( out) :: z(:) !< Initial guess of the constraint states + type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states + type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; + type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Counter for the instances + integer(IntKi) :: k ! Counter for the blade + real(DbKi) :: Interval !< Coupling interval in seconds from StC + type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module + type(StC_InitOutputType) :: StC_InitOut !< data from StC module initialization (not currently used) + character(*), parameter :: RoutineName = 'StC_Blade_Setup' + + ErrStat = ErrID_None + ErrMsg = "" + + if (SrvD_p%NumBStC > 0_IntKi) then + allocate(u(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + allocate(p(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; + allocate(x(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; + allocate(xd(SrvD_p%NumBStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; + allocate(z(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, z') ) return; + allocate(OtherState(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; + allocate(y(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; + allocate(m(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + + do j=1,SrvD_p%NumBStC + StC_InitInp%InputFile = InputFileData%BStCfiles(j) + StC_InitInp%RootName = TRIM(SrvD_p%RootName)//'.BStC' + StC_InitInp%Gravity = SrvD_InitInp%gravity + StC_InitInp%NumMeshPts = SrvD_p%NumBl ! p%NumBl points for blades + Interval = SrvD_p%DT ! Pass the ServoDyn DT + + CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; + do k=1,StC_InitInp%NumMeshPts + StC_InitInp%InitPosition(:,k) = SrvD_InitInp%BladeRootPosition(:,k) + StC_InitInp%InitOrientation(:,:,k) = SrvD_InitInp%BladeRootOrientation(:,:,k) + enddo + + CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & + CALL SetErrStat( ErrID_Fatal, "Blade StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + if (Failed()) return; + + call Cleanup() + enddo + endif +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + logical function AllErr(Msg) + character(*), intent(in) :: Msg + if(ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, Msg, ErrStat, ErrMsg, RoutineName ) + endif + AllErr = ErrStat >= AbortErrLev + if (AllErr) call Cleanup() + end function AllErr + subroutine Cleanup() ! Ignore any errors here + CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + end subroutine Cleanup +end subroutine StC_Blade_Setup +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the data structures for the structural control (StC) module -- hydrodynamics platform instances +subroutine StC_S_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) + type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine + type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters + TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters + type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states + type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states + type(StC_ConstraintStateType), allocatable,intent( out) :: z(:) !< Initial guess of the constraint states + type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states + type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; + type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: j ! Counter for the instances + real(DbKi) :: Interval !< Coupling interval in seconds from StC + type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module + type(StC_InitOutputType) :: StC_InitOut !< data from StC module initialization (not currently used) + character(*), parameter :: RoutineName = 'StC_S_Setup' + + ErrStat = ErrID_None + ErrMsg = "" + + if (SrvD_p%NumSStC > 0_IntKi) then + allocate(u(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + allocate(p(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; + allocate(x(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; + allocate(xd(SrvD_p%NumSStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; + allocate(z(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, z') ) return; + allocate(OtherState(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; + allocate(y(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; + allocate(m(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + + do j=1,SrvD_p%NumSStC + StC_InitInp%InputFile = InputFileData%SStCfiles(j) + StC_InitInp%RootName = TRIM(SrvD_p%RootName)//'.SStC' + StC_InitInp%Gravity = SrvD_InitInp%gravity + StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Platform + Interval = SrvD_p%DT ! Pass the ServoDyn DT + + CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitPosition(1:3,1) = SrvD_InitInp%PlatformPos(1:3) + StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%PlatformOrient + + CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & + CALL SetErrStat( ErrID_Fatal, "Platform StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + if (Failed()) return; + + call Cleanup() + enddo + endif +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + logical function AllErr(Msg) + character(*), intent(in) :: Msg + if(ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, Msg, ErrStat, ErrMsg, RoutineName ) + endif + AllErr = ErrStat >= AbortErrLev + if (AllErr) call Cleanup() + end function AllErr + subroutine Cleanup() ! Ignore any errors here + CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) + CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + end subroutine Cleanup +end subroutine StC_S_Setup + !---------------------------------------------------------------------------------------------------------------------------------- !> This routine is called at the end of the simulation. SUBROUTINE SrvD_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) @@ -681,65 +875,63 @@ SUBROUTINE SrvD_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - - ! Initialize ErrStat - - ErrStat = ErrID_None - ErrMsg = "" + integer(IntKi) :: j ! loop counter for instance of StC at location ! Place any last minute operations or calculations here: - IF ( p%UseBladedInterface ) THEN - CALL BladedInterface_End(u, p, m, ErrStat, ErrMsg ) + CALL BladedInterface_End(u, p, m, xd, ErrStat, ErrMsg ) END IF - IF (p%CompNTMD) THEN - CALL TMD_End( u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, y%NTMD, m%NTMD, ErrStat, ErrMsg ) - END IF - - IF (p%CompTTMD) THEN - CALL TMD_End( u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, y%TTMD, m%TTMD, ErrStat, ErrMsg ) - END IF - - - ! Close files here: - + ! StrucCtrl -- since all StC data is stored in SrvD types, we don't technically need to call StC_End directly + if (allocated(u%NStC)) then + do j=1,p%NumNStC ! Nacelle + call StC_End( u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), y%NStC(j), m%NStC(j), ErrStat, ErrMsg ) + enddo + endif + if (allocated(u%TStC)) then + do j=1,p%NumTStC ! Tower + call StC_End( u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), y%TStC(j), m%TStC(j), ErrStat, ErrMsg ) + enddo + endif + if (allocated(u%BStC)) then + do j=1,p%NumBStC ! Blades + call StC_End( u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), y%BStC(j), m%BStC(j), ErrStat, ErrMsg ) + enddo + endif + if (allocated(u%SStC)) then + do j=1,p%NumSStC ! Platform + call StC_End( u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), y%SStC(j), m%SStC(j), ErrStat, ErrMsg ) + enddo + endif - ! Destroy the input data: + ! Destroy the input data: CALL SrvD_DestroyInput( u, ErrStat, ErrMsg ) - ! Destroy the parameter data: - CALL SrvD_DestroyParam( p, ErrStat, ErrMsg ) - ! Destroy the state data: - CALL SrvD_DestroyContState( x, ErrStat, ErrMsg ) CALL SrvD_DestroyDiscState( xd, ErrStat, ErrMsg ) CALL SrvD_DestroyConstrState( z, ErrStat, ErrMsg ) CALL SrvD_DestroyOtherState( OtherState, ErrStat, ErrMsg ) - ! Destroy the misc var data: - CALL SrvD_DestroyMisc( m, ErrStat, ErrMsg ) - - ! Destroy the output data: + ! Destroy the output data: CALL SrvD_DestroyOutput( y, ErrStat, ErrMsg ) - - + ! We are ignoring any errors from destroying data + ErrStat = ErrID_None + ErrMsg = "" END SUBROUTINE SrvD_End !---------------------------------------------------------------------------------------------------------------------------------- -!> This is a loose coupling routine for solving constraint states, integrating continuous states, and updating discrete and other +!> This is a loose coupling routine for solving constraint states, integrating continuous states, and updating discrete and other !! states. Continuous, constraint, discrete, and other states are updated to values at t + Interval. SUBROUTINE SrvD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -762,183 +954,198 @@ SUBROUTINE SrvD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! Local variables - TYPE(TMD_InputType),ALLOCATABLE :: u(:) ! Inputs at t + TYPE(StC_InputType),ALLOCATABLE :: u(:) ! Inputs at t INTEGER(IntKi) :: i ! loop counter + INTEGER(IntKi) :: j ! loop counter for StC instance of type INTEGER(IntKi) :: order TYPE(SrvD_InputType) :: u_interp ! interpolated input ! Local variables: - - + + INTEGER(IntKi) :: ErrStat2 ! Error status of the operation (occurs after initial error) CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UpdateStates' REAL(DbKi) :: t_next - + ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" !............................................................................................................................... - ! update states in TMD submodule, if necessary: + ! update states in StrucCtrl submodule, if necessary: !............................................................................................................................... - - ! Convert Inputs(i)%NTMD and/or Inputs(i)%TTMD to u(:) - IF (p%CompNTMD .OR. p%CompTTMD) THEN - + + IF ((p%NumNStC + p%NumTStC + p%NumBStC + p%NumSStC) > 0_IntKi) THEN order = SIZE(Inputs) - ALLOCATE(u(order), STAT=ErrStat2) - IF(ErrStat2 /= 0) THEN - CALL SetErrStat( ErrID_Fatal, 'Could not allocate TMD input array, u', ErrStat, ErrMsg, RoutineName ) - CALL Cleanup() - RETURN - END IF - - ! Nacelle TMD - IF (p%CompNTMD) THEN - - DO i=1,order - CALL TMD_CopyInput( Inputs(i)%NTMD, u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END DO - - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - - CALL TMD_UpdateStates( t, n, u, InputTimes, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, m%NTMD, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - ! destroy these for the next call to TMD_UpdateStates (reset for tower TMD) - DO i=1,SIZE(u) - CALL TMD_DestroyInput(u(i), ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - END DO - - END IF - - - ! Tower TMD - IF (p%CompTTMD) THEN - - DO i=1,order - CALL TMD_CopyInput( Inputs(i)%TTMD, u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END DO - - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - - CALL TMD_UpdateStates( t, n, u, InputTimes, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, m%TTMD, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - END IF - - END IF + allocate(u(order), STAT=ErrStat2) + if (ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, 'Could not allocate StrucCtrl input array, u', ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; + endif + ENDIF - + + ! Nacelle StrucCtrl + do j=1,p%NumNStC + do i=1,order + call StC_CopyInput( Inputs(i)%NStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + call StC_UpdateStates( t, n, u, InputTimes, p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) + do i=1,SIZE(u) + call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) + if (Failed()) return; + enddo + enddo + + + ! Tower StrucCtrl + do j=1,p%NumTStC + do i=1,order + call StC_CopyInput( Inputs(i)%TStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + call StC_UpdateStates( t, n, u, InputTimes, p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) + do i=1,SIZE(u) + call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) + if (Failed()) return; + enddo + enddo + + + ! Blade StrucCtrl + do j=1,p%NumBStC + do i=1,order + call StC_CopyInput( Inputs(i)%BStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + call StC_UpdateStates( t, n, u, InputTimes, p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) + do i=1,SIZE(u) + call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) + if (Failed()) return; + enddo + enddo + + + ! Platform StrucCtrl + do j=1,p%NumSStC + do i=1,order + call StC_CopyInput( Inputs(i)%SStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + call StC_UpdateStates( t, n, u, InputTimes, p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) + do i=1,SIZE(u) + call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) + if (Failed()) return; + enddo + enddo + + !............................................................................................................................... ! get inputs at t: - !............................................................................................................................... + !............................................................................................................................... CALL SrvD_CopyInput( Inputs(1), u_interp, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF + if (Failed()) return; CALL SrvD_Input_ExtrapInterp( Inputs, InputTimes, u_interp, t, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; !............................................................................................................................... ! update discrete states: - !............................................................................................................................... + !............................................................................................................................... ! 1. Get appropriate value of input for the filter in discrete states (this works only for the DLL at this point, so we're going to move it there) ! 2. Update control offset for trim solutions CALL SrvD_UpdateDiscState( t, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; !............................................................................................................................... ! get inputs at t+dt: - !............................................................................................................................... + !............................................................................................................................... t_next = t+p%dt - + CALL SrvD_Input_ExtrapInterp( Inputs, InputTimes, u_interp, t_next, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; IF (p%UseBladedInterface) THEN CALL DLL_controller_call(t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF + if (Failed()) return; END IF - - !............................................................................................................................... + + !............................................................................................................................... ! update remaining states to values at t+dt: - !............................................................................................................................... - + !............................................................................................................................... + ! Torque control: CALL Torque_UpdateStates( t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + if (Failed()) return; ! Pitch control: CALL Pitch_UpdateStates( t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; ! Yaw control: CALL Yaw_UpdateStates( t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; ! Tip brake control: CALL TipBrake_UpdateStates( t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - - + if (Failed()) return; !................................................................... ! Compute ElecPwr and GenTrq for controller (and DLL needs this saved): !................................................................... IF ( OtherState%GenOnLine .and. .not. OtherState%Off4Good ) THEN ! Generator is on line. CALL CalculateTorque( t, u_interp, p, m, m%dll_data%GenTrq_prev, m%dll_data%ElecPwr_prev, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF + if (Failed()) return; ELSE ! Generator is off line. m%dll_data%GenTrq_prev = 0.0_ReKi m%dll_data%ElecPwr_prev = 0.0_ReKi ENDIF - !............................................................................................................................... + !............................................................................................................................... CALL Cleanup() - + RETURN - + CONTAINS + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed SUBROUTINE Cleanup() - + IF (ALLOCATED(u)) THEN DO i=1,SIZE(u) - CALL TMD_DestroyInput(u(i), ErrStat2, ErrMsg2) + CALL StC_DestroyInput(u(i), ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) END DO DEALLOCATE(u) - END IF - + END IF + CALL SrvD_DestroyInput(u_interp, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + END SUBROUTINE Cleanup - + END SUBROUTINE SrvD_UpdateStates !---------------------------------------------------------------------------------------------------------------------------------- !> Routine for deciding if Bladed-style DLL controller should be called @@ -956,7 +1163,7 @@ SUBROUTINE DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'DLL_controller_call' @@ -968,8 +1175,8 @@ SUBROUTINE DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ErrMsg = "" ! we should be calling this routine ONLY when the following statement is true: - !IF ( p%UseBladedInterface ) THEN - + !IF ( p%UseBladedInterface ) THEN + IF ( .NOT. EqualRealNos( t - m%dll_data%DLL_DT, m%LastTimeCalled ) ) THEN IF (m%FirstWarn) THEN IF ( EqualRealNos( p%DT, m%dll_data%DLL_DT ) ) THEN ! This must be because we're doing a correction step or calling multiple times per time step @@ -983,17 +1190,17 @@ SUBROUTINE DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg m%FirstWarn = .FALSE. END IF ELSE - m%dll_data%PrevBlPitch(1:p%NumBl) = m%dll_data%BlPitchCom ! used for linear ramp of delayed signal + m%dll_data%PrevBlPitch(1:p%NumBl) = m%dll_data%BlPitchCom(1:p%NumBl) ! used for linear ramp of delayed signal m%LastTimeCalled = t - CALL BladedInterface_CalcOutput( t, u, p, m, ErrStat2, ErrMsg2 ) + CALL BladedInterface_CalcOutput( t, u, p, m, xd, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - + m%dll_data%initialized = .true. END IF - + !END IF - + END SUBROUTINE DLL_controller_call !---------------------------------------------------------------------------------------------------------------------------------- !> Routine for computing outputs, used in both loose and tight coupling. @@ -1017,29 +1224,37 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg REAL(ReKi) :: AllOuts(0:MaxOutPts) ! All the the available output channels INTEGER(IntKi) :: I ! Generic loop index INTEGER(IntKi) :: K ! Blade index + INTEGER(IntKi) :: J ! Structural control instance at location INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CalcOutput' - + ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" - IF (p%CompNTMD) THEN - CALL TMD_CalcOutput( t, u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, y%NTMD, m%NTMD, ErrStat2, ErrMsg2 ) + ! StrucCtrl + do j=1,p%NumNStC ! Nacelle + CALL StC_CalcOutput( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), y%NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF - - IF (p%CompTTMD) THEN - CALL TMD_CalcOutput( t, u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, y%TTMD, m%TTMD, ErrStat2, ErrMsg2 ) + enddo + do j=1,p%NumTStC ! Tower + CALL StC_CalcOutput( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), y%TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF - + enddo + do j=1,p%NumBStC ! Blades + CALL StC_CalcOutput( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), y%BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + enddo + do j=1,p%NumSStC ! Platform + CALL StC_CalcOutput( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), y%SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + enddo !............................................................................................................................... ! Get the demanded values from the external Bladed dynamic link library, if necessary: - !............................................................................................................................... + !............................................................................................................................... IF ( p%UseBladedInterface ) THEN ! Initialize the DLL controller in CalcOutput ONLY if it hasn't already been initialized in SrvD_UpdateStates @@ -1047,91 +1262,64 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg CALL DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) END IF - + ! Commanded Airfoil UserProp for blade (must be same units as given in AD15 airfoil tables) ! This is passed to AD15 to be interpolated with the airfoil table userprop column ! (might be used for airfoil flap angles for example) y%BlAirfoilCom(1:p%NumBl) = m%dll_data%BlAirfoilCom(1:p%NumBl) - - IF (ALLOCATED(y%SuperController)) THEN - y%SuperController = m%dll_data%SCoutput + + IF (ALLOCATED(y%toSC)) THEN + y%toSC = m%dll_data%toSC END IF - + END IF - - !............................................................................................................................... + + !............................................................................................................................... ! Compute the outputs - !............................................................................................................................... + !............................................................................................................................... ! Torque control: - CALL Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) ! calculates ElecPwr, which Pitch_CalcOutput will use in the user pitch routine + CALL Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) ! calculates ElecPwr, which Pitch_CalcOutput will use in the user pitch routine CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN ! Pitch control: - CALL Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, y%BlPitchCom, y%ElecPwr, m, ErrStat2, ErrMsg2 ) + CALL Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, y%BlPitchCom, y%ElecPwr, m, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - ! Yaw control: - CALL Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m,ErrStat2, ErrMsg2 ) + ! Yaw control: + CALL Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m,ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - ! Tip brake control: - CALL TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) + ! Tip brake control: + CALL TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN - - !............................................................................................................................... - ! Calculate all of the available output channels: - !............................................................................................................................... - ! This is overwriting the values if it was called from UpdateStates, but they - ! should be the same and this sets the values if we called the DLL above. - m%dll_data%ElecPwr_prev = y%ElecPwr - m%dll_data%GenTrq_prev = y%GenTrq - - !............................................................................................................................... - ! Calculate all of the available output channels: - !............................................................................................................................... -! AllOuts(Time) = t - - AllOuts(GenTq) = 0.001*y%GenTrq - AllOuts(GenPwr) = 0.001*y%ElecPwr - AllOuts(HSSBrTqC)= 0.001*y%HSSBrTrqC - - DO K=1,p%NumBl - AllOuts( BlPitchC(K) ) = y%BlPitchCom(K)*R2D - AllOuts( BlAirfoilC(K) ) = y%BlAirfoilCom(K) - END DO - AllOuts(YawMomCom) = -0.001*y%YawMom - - AllOuts(NTMD_XQ ) = x%NTMD%tmd_x(1) - AllOuts(NTMD_XQD) = x%NTMD%tmd_x(2) - AllOuts(NTMD_YQ ) = x%NTMD%tmd_x(3) - AllOuts(NTMD_YQD) = x%NTMD%tmd_x(4) - - AllOuts(TTMD_XQ ) = x%TTMD%tmd_x(1) - AllOuts(TTMD_XQD) = x%TTMD%tmd_x(2) - AllOuts(TTMD_YQ ) = x%TTMD%tmd_x(3) - AllOuts(TTMD_YQD) = x%TTMD%tmd_x(4) - !............................................................................................................................... ! Place the selected output channels into the WriteOutput(:) array with the proper sign: !............................................................................................................................... + + AllOuts=0.0_ReKi - DO I = 1,p%NumOuts ! Loop through all selected output channels + call Set_SrvD_Outs( p, y, m, AllOuts ) + if (p%NumNStC>0) call Set_NStC_Outs( p, x%NStC, m%NStC, y%NStC, AllOuts ) + if (p%NumTStC>0) call Set_TStC_Outs( p, x%TStC, m%TStC, y%TStC, AllOuts ) + if (p%NumBStC>0) call Set_BStC_Outs( p, x%BStC, m%BStC, y%BStC, AllOuts ) + if (p%NumSStC>0) call Set_SStC_Outs( p, x%SStC, m%SStC, y%SStC, AllOuts ) + + DO I = 1,p%NumOuts ! Loop through all selected output channels y%WriteOutput(I) = p%OutParam(I)%SignM * AllOuts( p%OutParam(I)%Indx ) - ENDDO ! I - All selected output channels - + DO I = 1,p%NumOuts_DLL ! Loop through all DLL logging channels y%WriteOutput(I+p%NumOuts) = m%dll_data%LogChannels( I ) ENDDO - + RETURN END SUBROUTINE SrvD_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- @@ -1152,7 +1340,10 @@ SUBROUTINE SrvD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrS CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CalcContStateDeriv' - + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + integer(IntKi) :: j ! Index to instance of StC for location + ! Initialize ErrStat ErrStat = ErrID_None @@ -1163,14 +1354,24 @@ SUBROUTINE SrvD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrS dxdt%DummyContState = 0.0_ReKi - IF (p%CompNTMD) THEN - CALL TMD_CalcContStateDeriv( t, u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, m%NTMD, dxdt%NTMD, ErrStat, ErrMsg ) - END IF + ! StrucCtrl + do j=1,p%NumNStC ! Nacelle + CALL StC_CalcContStateDeriv( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), dxdt%NStC(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + enddo + do j=1,p%NumTStC ! Tower + CALL StC_CalcContStateDeriv( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), dxdt%TStC(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + enddo + do j=1,p%NumBStC ! Blade + CALL StC_CalcContStateDeriv( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), dxdt%BStC(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + enddo + do j=1,p%NumSStC ! Platform + CALL StC_CalcContStateDeriv( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), dxdt%SStC(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + enddo - IF (p%CompTTMD) THEN - CALL TMD_CalcContStateDeriv( t, u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, m%TTMD, dxdt%TTMD, ErrStat, ErrMsg ) - END IF - END SUBROUTINE SrvD_CalcContStateDeriv !---------------------------------------------------------------------------------------------------------------------------------- @@ -1191,13 +1392,15 @@ SUBROUTINE SrvD_UpdateDiscState( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrM CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UpdateDiscState' - + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + integer(IntKi) :: j ! Index to instance of StC for location + ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" - select case (p%TrimCase) case (TrimCase_yaw) xd%CtrlOffset = xd%CtrlOffset + (u%RotSpeed - p%RotSpeedRef) * sign(p%TrimGain, p%YawNeut + xd%CtrlOffset) @@ -1206,36 +1409,40 @@ SUBROUTINE SrvD_UpdateDiscState( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrM ! case default ! xd%CtrlOffset = 0.0_ReKi ! same as initialized value end select - !xd%BlPitchFilter = p%BlAlpha * xd%BlPitchFilter + (1.0_ReKi - p%BlAlpha) * u%BlPitch - + !if ( p%PCMode == ControlMode_DLL ) then ! if ( p%DLL_Ramp ) then - ! temp = (t - m%LastTimeCalled) / m%dll_data%DLL_DT + ! temp = (t - m%LastTimeCalled) / m%dll_data%DLL_DT ! temp = m%dll_data%PrevBlPitch(1:p%NumBl) + & ! temp * ( m%dll_data%BlPitchCom(1:p%NumBl) - m%dll_data%PrevBlPitch(1:p%NumBl) ) ! else ! temp = m%dll_data%BlPitchCom(1:p%NumBl) ! end if - ! + ! ! xd%BlPitchFilter = p%BlAlpha * xd%BlPitchFilter + (1.0_ReKi - p%BlAlpha) * temp !else - ! + ! !end if - - - ! ! Update discrete states here: - !IF (p%CompNTMD) THEN - ! CALL TMD_UpdateDiscState( t, u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, m%NTMD, ErrStat, ErrMsg ) - !END IF - - ! ! Update discrete states here: - !IF (p%CompTTMD) THEN - ! CALL TMD_UpdateDiscState( t, u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, m%TTMD, ErrStat, ErrMsg ) - !END IF - + ! Update discrete states for StrucCtrl --- StC does not currently support this +! do j=1,p%NumNStC ! Nacelle +! CALL StC_UpdateDiscState( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumTStC ! tower +! CALL StC_UpdateDiscState( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumBStC ! Blade +! CALL StC_UpdateDiscState( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumSStC ! Platform +! CALL StC_UpdateDiscState( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo END SUBROUTINE SrvD_UpdateDiscState !---------------------------------------------------------------------------------------------------------------------------------- @@ -1257,26 +1464,36 @@ SUBROUTINE SrvD_CalcConstrStateResidual( t, u, p, x, xd, z, OtherState, m, z_res CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CalcConstrStateResidual' + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + integer(IntKi) :: j ! Index to instance of StC for location - ! Initialize ErrStat - - ErrStat = ErrID_None - ErrMsg = "" + ! Initialize ErrStat - - ! Solve for the constraint states here: + ErrStat = ErrID_None + ErrMsg = "" - !IF (p%CompNTMD) THEN - ! CALL TMD_CalcConstrStateResidual( t, u%NTMD, p%NTMD, x%NTMD, xd%NTMD, z%NTMD, OtherState%NTMD, m%NTMD, z_residual%NTMD, ErrStat, ErrMsg ) - !END IF - !IF (p%CompTTMD) THEN - ! CALL TMD_CalcConstrStateResidual( t, u%TTMD, p%TTMD, x%TTMD, xd%TTMD, z%TTMD, OtherState%TTMD, m%TTMD, z_residual%TTMD, ErrStat, ErrMsg ) - !END IF - - z_residual%DummyConstrState = 0.0_ReKi + ! Solve for the constraint states for StrucCtrl --- StC does not currently support this +! do j=1,p%NumNStC ! Nacelle +! CALL StC_CalcConstrStateResidual( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), z_residual%NStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumTStC ! Tower +! CALL StC_CalcConstrStateResidual( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), z_residual%TStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumBStC ! Blade +! CALL StC_CalcConstrStateResidual( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), z_residual%BStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo +! do j=1,p%NumSStC ! Platform +! CALL StC_CalcConstrStateResidual( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), z_residual%SStC(j), ErrStat, ErrMsg ) +! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) +! enddo + + z_residual%DummyConstrState = 0.0_ReKi - END SUBROUTINE SrvD_CalcConstrStateResidual @@ -1296,8 +1513,8 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point TYPE(SrvD_OutputType), INTENT(IN ) :: y !< Output (change to inout if a mesh copy is required); - !! Output fields are not used by this routine, but type is - !! available here so that mesh parameter information (i.e., + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., !! connectivity) does not have to be recalculated for dYdu. TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -1306,7 +1523,7 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er !! (Y) with respect to the inputs (u) [intent in to avoid deallocation] REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXdu(:,:) !< Partial derivatives of continuous state !! functions (X) with respect to inputs (u) [intent in to avoid deallocation] - REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXddu(:,:) !< Partial derivatives of discrete state + REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dXddu(:,:) !< Partial derivatives of discrete state !! functions (Xd) with respect to inputs (u) [intent in to avoid deallocation] REAL(R8Ki), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: dZdu(:,:) !< Partial derivatives of constraint state !! functions (Z) with respect to inputs (u) [intent in to avoid deallocation] @@ -1319,18 +1536,18 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_JacobianPInput' - + ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = '' - + ! Calculate the partial derivative of the output functions (Y) with respect to the inputs (u) here: IF ( PRESENT( dYdu ) ) THEN - - !> \f{equation}{ \frac{\partial Y}{\partial u} = \begin{bmatrix} + + !> \f{equation}{ \frac{\partial Y}{\partial u} = \begin{bmatrix} !! \frac{\partial Y_{BlPitchCom_1}}{\partial u_{Yaw}} & \frac{\partial Y_{BlPitchCom_1}}{\partial u_{YawRate}} & \frac{\partial Y_{BlPitchCom_1}}{\partial u_{HSS\_Spd}} \\ !! \frac{\partial Y_{BlPitchCom_2}}{\partial u_{Yaw}} & \frac{\partial Y_{BlPitchCom_2}}{\partial u_{YawRate}} & \frac{\partial Y_{BlPitchCom_2}}{\partial u_{HSS\_Spd}} \\ !! \frac{\partial Y_{BlPitchCom_3}}{\partial u_{Yaw}} & \frac{\partial Y_{BlPitchCom_3}}{\partial u_{YawRate}} & \frac{\partial Y_{BlPitchCom_3}}{\partial u_{HSS\_Spd}} \\ @@ -1338,7 +1555,7 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er !! \frac{\partial Y_{GenTrq}}{\partial u_{Yaw}} & \frac{\partial Y_{GenTrq}}{\partial u_{YawRate}} & \frac{\partial Y_{GenTrq}}{\partial u_{HSS\_Spd}} \\ !! \frac{\partial Y_{ElecPwr}}{\partial u_{Yaw}} & \frac{\partial Y_{ElecPwr}}{\partial u_{YawRate}} & \frac{\partial Y_{ElecPwr}}{\partial u_{HSS\_Spd}} \\ !! \frac{\partial Y_{WriteOutput_i}}{\partial u_{Yaw}} & \frac{\partial Y_{WriteOutput_i}}{\partial u_{YawRate}} & \frac{\partial Y_{WriteOutput_i}}{\partial u_{HSS\_Spd}} \end{bmatrix} - !! = \begin{bmatrix} + !! = \begin{bmatrix} !! 0 & 0 & 0 \\ !! 0 & 0 & 0 \\ !! 0 & 0 & 0 \\ @@ -1346,18 +1563,18 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er !! 0 & 0 & \frac{\partial Y_{GenTrq}}{\partial u_{HSS\_Spd}} \\ !! 0 & 0 & \frac{\partial Y_{ElecPwr}}{\partial u_{HSS\_Spd}} \\ !! \frac{\partial Y_{WriteOutput_i}}{\partial u_{Yaw}} & \frac{\partial Y_{WriteOutput_i}}{\partial u_{YawRate}} & \frac{\partial Y_{WriteOutput_i}}{\partial u_{HSS\_Spd}} \end{bmatrix} - !!\f} + !!\f} + - ! Note this is similiar to SrvD_CalcOutput - + if (.not. allocated(dYdu)) then call allocAry(dYdu, SrvD_Indx_Y_WrOutput+p%NumOuts, 3, 'dYdu', ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) end if dYdu = 0.0_R8Ki - - + + ! ! Torque control: !> Compute !> \f$ \frac{\partial Y_{GenTrq}}{\partial u_{HSS\_Spd}} \f$ and @@ -1367,34 +1584,34 @@ SUBROUTINE SrvD_JacobianPInput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er dYdu(SrvD_Indx_Y_GenTrq, Indx_u_HSS_Spd) = GenTrq_du dYdu(SrvD_Indx_Y_ElecPwr,Indx_u_HSS_Spd) = ElecPwr_du - + ! Pitch control: !> \f$ \frac{\partial Y_{BlPitchCom_k}}{\partial u} = 0 \f$ - - ! Yaw control: + + ! Yaw control: !> \f$ \frac{\partial Y_{YawMom}}{\partial u_{Yaw}} = -p\%YawSpr \f$ dYdu(SrvD_Indx_Y_YawMom,Indx_u_Yaw) = -p%YawSpr ! from Yaw_CalcOutput !> \f$ \frac{\partial Y_{YawMom}}{\partial u_{YawRate}} = -p\%YawDamp \f$ dYdu(SrvD_Indx_Y_YawMom,Indx_u_YawRate) = -p%YawDamp ! from Yaw_CalcOutput - - !......................................................................................................................... + + !......................................................................................................................... ! Calculate all of the available output channels (because they repeat for the derivative) here: - !......................................................................................................................... + !......................................................................................................................... AllOuts = 0.0_R8Ki ! all variables not specified below are zeros (either constant or disabled): - + AllOuts(:, GenTq) = 0.001_R8Ki*dYdu(SrvD_Indx_Y_GenTrq,:) AllOuts(:, GenPwr) = 0.001_R8Ki*dYdu(SrvD_Indx_Y_ElecPwr,:) AllOuts(:, YawMomCom) = -0.001_R8Ki*dYdu(SrvD_Indx_Y_YawMom,:) - - !............................................................................................................................... + + !............................................................................................................................... ! Place the selected output channels into the WriteOutput(:) portion of the jacobian with the proper sign: - !............................................................................................................................... - - DO I = 1,p%NumOuts ! Loop through all selected output channels - dYdu(I+SrvD_Indx_Y_WrOutput,:) = p%OutParam(I)%SignM * AllOuts( :, p%OutParam(I)%Indx ) + !............................................................................................................................... + + DO I = 1,p%NumOuts ! Loop through all selected output channels + dYdu(I+SrvD_Indx_Y_WrOutput,:) = p%OutParam(I)%SignM * AllOuts( :, p%OutParam(I)%Indx ) ENDDO ! I - All selected output channels - + END IF IF ( PRESENT( dXdu ) ) THEN @@ -1426,8 +1643,8 @@ SUBROUTINE SrvD_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point TYPE(SrvD_OutputType), INTENT(IN ) :: y !< Output (change to inout if a mesh copy is required); - !! Output fields are not used by this routine, but type is - !! available here so that mesh parameter information (i.e., + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., !! connectivity) does not have to be recalculated for dYdx. TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -1503,8 +1720,8 @@ SUBROUTINE SrvD_JacobianPDiscState( t, u, p, x, xd, z, OtherState, y, m, ErrStat TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point TYPE(SrvD_OutputType), INTENT(IN ) :: y !< Output (change to inout if a mesh copy is required); - !! Output fields are not used by this routine, but type is - !! available here so that mesh parameter information (i.e., + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., !! connectivity) does not have to be recalculated for dYdxd. TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -1578,8 +1795,8 @@ SUBROUTINE SrvD_JacobianPConstrState( t, u, p, x, xd, z, OtherState, y, m, ErrSt TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at operating point TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at operating point TYPE(SrvD_OutputType), INTENT(IN ) :: y !< Output (change to inout if a mesh copy is required); - !! Output fields are not used by this routine, but type is - !! available here so that mesh parameter information (i.e., + !! Output fields are not used by this routine, but type is + !! available here so that mesh parameter information (i.e., !! connectivity) does not have to be recalculated for dYdz. TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -1660,12 +1877,12 @@ SUBROUTINE SrvD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_o REAL(ReKi), ALLOCATABLE, OPTIONAL, INTENT(INOUT) :: z_op(:) !< values of linearized constraint states - INTEGER(IntKi) :: i + INTEGER(IntKi) :: i INTEGER(IntKi) :: ErrStat2 ! Error status of the operation (occurs after initial error) CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_GetOP' - - + + ! Initialize ErrStat ErrStat = ErrID_None @@ -1673,784 +1890,70 @@ SUBROUTINE SrvD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_o !.......................................... IF ( PRESENT( u_op ) ) THEN - + if (.not. allocated(u_op)) then CALL AllocAry( u_op, 3, 'u_op', ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) IF (ErrStat >= AbortErrLev) RETURN end if - + u_op(Indx_u_Yaw ) = u%Yaw u_op(Indx_u_YawRate) = u%YawRate - u_op(Indx_u_HSS_Spd) = u%HSS_Spd - - END IF - - !.......................................... - IF ( PRESENT( y_op ) ) THEN - - if (.not. allocated(y_op)) then - CALL AllocAry( y_op, SrvD_Indx_Y_WrOutput+p%NumOuts, 'y_op', ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN - end if - - - do i=1,size(SrvD_Indx_Y_BlPitchCom) - y_op(SrvD_Indx_Y_BlPitchCom(i)) = y%BlPitchCom(i) - end do - y_op(SrvD_Indx_Y_YawMom) = y%YawMom - y_op(SrvD_Indx_Y_GenTrq) = y%GenTrq - y_op(SrvD_Indx_Y_ElecPwr) = y%ElecPwr - do i=1,p%NumOuts - y_op(i+SrvD_Indx_Y_WrOutput) = y%WriteOutput(i) - end do - - END IF - - IF ( PRESENT( x_op ) ) THEN - - END IF - - IF ( PRESENT( dx_op ) ) THEN - - END IF - - IF ( PRESENT( xd_op ) ) THEN - - END IF - - IF ( PRESENT( z_op ) ) THEN - - END IF - -END SUBROUTINE SrvD_GetOP -!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - - -!---------------------------------------------------------------------------------------------------------------------------------- -!> This subroutine reads the input file and stores all the data in the SrvD_InputFile structure. -!! It does not perform data validation. -SUBROUTINE SrvD_ReadInput( InitInp, InputFileData, Default_DT, OutFileRoot, ErrStat, ErrMsg ) -!.................................................................................................................................. - - ! Passed variables - TYPE(SrvD_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine - REAL(DbKi), INTENT(IN) :: Default_DT !< The default DT (from glue code) - - CHARACTER(*), INTENT(IN) :: OutFileRoot !< The rootname of all the output files written by this routine. - - TYPE(SrvD_InputFile), INTENT(OUT) :: InputFileData !< Data stored in the module's input file - - INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code - CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred - - ! local variables - - INTEGER(IntKi) :: UnEcho ! Unit number for the echo file - INTEGER(IntKi) :: ErrStat2 ! The error status code - CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_ReadInput' - - ! initialize values: - - ErrStat = ErrID_None - ErrMsg = '' - - InputFileData%DT = Default_DT ! the glue code's suggested DT for the module (may be overwritten in ReadPrimaryFile()) - - ! get the primary/platform input-file data - - CALL ReadPrimaryFile( InitInp, InputFileData, OutFileRoot, UnEcho, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF ( ErrStat >= AbortErrLev ) THEN - IF ( UnEcho > 0 ) CLOSE( UnEcho ) - RETURN - END IF - - - - ! we may need to read additional files here (e.g., Bladed Interface) - - - ! close any echo file that was opened - - IF ( UnEcho > 0 ) CLOSE( UnEcho ) - - -END SUBROUTINE SrvD_ReadInput -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine reads in the primary ServoDyn input file and places the values it reads in the InputFileData structure. -!! It opens and prints to an echo file if requested. -SUBROUTINE ReadPrimaryFile( InitInp, InputFileData, OutFileRoot, UnEc, ErrStat, ErrMsg ) -!.................................................................................................................................. - - IMPLICIT NONE - - ! Passed variables - INTEGER(IntKi), INTENT(OUT) :: UnEc !< I/O unit for echo file. If > 0, file is open for writing. - INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status - - TYPE(SrvD_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine - CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message - CHARACTER(*), INTENT(IN) :: OutFileRoot !< The rootname of the echo file, possibly opened in this routine - - TYPE(SrvD_InputFile), INTENT(INOUT) :: InputFileData !< All the data in the ServoDyn input file - - ! Local variables: - REAL(ReKi) :: TmpRAry(2) ! A temporary array to read a table from the input file - INTEGER(IntKi) :: I ! loop counter - INTEGER(IntKi) :: UnIn ! Unit number for reading file - - INTEGER(IntKi) :: ErrStat2, IOS ! Temporary Error status - LOGICAL :: Echo ! Determines if an echo file should be written - CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message - CHARACTER(1024) :: PriPath ! Path name of the primary file - CHARACTER(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents - CHARACTER(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") - CHARACTER(*), PARAMETER :: RoutineName = 'ReadPrimaryFile' - - - - ! Initialize some variables: - ErrStat = ErrID_None - ErrMsg = "" - - UnEc = -1 - Echo = .FALSE. - CALL GetPath( InitInp%InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. - - - CALL AllocAry( InputFileData%OutList, MaxOutPts, "ServoDyn Input File's Outlist", ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Get an available unit number for the file. - - CALL GetNewUnit( UnIn, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Open the Primary input file. - - CALL OpenFInpFile ( UnIn, InitInp%InputFile, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Read the lines up/including to the "Echo" simulation control variable - ! If echo is FALSE, don't write these lines to the echo file. - ! If Echo is TRUE, rewind and write on the second try. - - I = 1 !set the number of times we've read the file - DO - !-------------------------- HEADER --------------------------------------------- - - CALL ReadCom( UnIn, InitInp%InputFile, 'File header: Module Version (line 1)', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadStr( UnIn, InitInp%InputFile, FTitle, 'FTitle', 'File Header: File Description (line 2)', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - !---------------------- SIMULATION CONTROL -------------------------------------- - - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Simulation Control', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! Echo - Echo input to ".ech". - - CALL ReadVar( UnIn, InitInp%InputFile, Echo, 'Echo', 'Echo switch', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - IF (.NOT. Echo .OR. I > 1) EXIT !exit this loop - - ! Otherwise, open the echo file, then rewind the input file and echo everything we've read - - I = I + 1 ! make sure we do this only once (increment counter that says how many times we've read this file) - - CALL OpenEcho ( UnEc, TRIM(OutFileRoot)//'.ech', ErrStat2, ErrMsg2, SrvD_Ver ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - IF ( UnEc > 0 ) WRITE (UnEc,'(/,A,/)') 'Data from '//TRIM(SrvD_Ver%Name)//' primary input file "'//TRIM( InitInp%InputFile )//'":' - - REWIND( UnIn, IOSTAT=ErrStat2 ) - IF (ErrStat2 /= 0_IntKi ) THEN - CALL CheckError( ErrID_Fatal, 'Error rewinding file "'//TRIM(InitInp%InputFile)//'".' ) - RETURN - END IF - - END DO - - IF (NWTC_VerboseLevel == NWTC_Verbose) THEN - CALL WrScr( ' Heading of the '//TRIM(SrvD_Ver%Name)//' input file: ' ) - CALL WrScr( ' '//TRIM( FTitle ) ) - END IF - - - ! DT - Communication interval for controllers (s): - CALL ReadVar( UnIn, InitInp%InputFile, Line, "DT", "Communication interval for controllers (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - CALL Conv2UC( Line ) - IF ( INDEX(Line, "DEFAULT" ) /= 1 ) THEN ! If it's not "default", read this variable; otherwise use the value already stored in InputFileData%DT - READ( Line, *, IOSTAT=IOS) InputFileData%DT - CALL CheckIOS ( IOS, InitInp%InputFile, 'DT', NumType, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2, ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - END IF - - - !---------------------- PITCH CONTROL ------------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Pitch Control', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! PCMode - Pitch control mode (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%PCMode, "PCMode", "Pitch control mode (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TPCOn - Time to enable active pitch control [unused when PCMode=0] (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TPCOn, "TPCOn", "Time to enable active pitch control (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TPitManS - Time to start override pitch maneuver for blade (K) and end standard pitch control (s): - CALL ReadAryLines( UnIn, InitInp%InputFile, InputFileData%TPitManS, SIZE(InputFileData%TPitManS), "TPitManS", & - "Time to start override pitch maneuver for blade K and end standard pitch control (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! PitManRat - Pitch rates at which override pitch maneuvers head toward final pitch angles (degrees/s) (read in deg/s and converted to radians/s here): - CALL ReadAryLines( UnIn, InitInp%InputFile, InputFileData%PitManRat, SIZE(InputFileData%PitManRat), "PitManRat", "Pitch rates at which override pitch maneuvers head toward final pitch angles (deg/s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%PitManRat = InputFileData%PitManRat*D2R - - ! BlPitchF - Blade (K) final pitch for pitch maneuvers (deg) (read from file in degrees and converted to radians here): - CALL ReadAryLines( UnIn, InitInp%InputFile, InputFileData%BlPitchF, SIZE(InputFileData%BlPitchF), "BlPitchF", "Blade K final pitch for pitch maneuvers (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%BlPitchF = InputFileData%BlPitchF*D2R - - - !---------------------- GENERATOR AND TORQUE CONTROL ---------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Generator and Torque Control', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! VSContrl - Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from routine UserVSCont, 4: user-defined from Simulink/LabVIEW} (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%VSContrl, "VSContrl", "Variable-speed control mode (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! GenModel - Generator model {1: simple, 2: Thevenin, 3: user-defined from routine UserGen} [used only when VSContrl=0] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenModel, "GenModel", "Generator model {1: simple, 2: Thevenin, 3: user-defined from routine UserGen} [used only when VSContrl=0] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! GenEff - Generator efficiency [ignored by the Thevenin and user-defined generator models] (%) (read in percent and converted to a fraction here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenEff, "GenEff", "Generator efficiency [ignored by the Thevenin and user-defined generator models] (%)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%GenEff = InputFileData%GenEff*0.01 - - ! GenTiStr - Method to start the generator {T: timed using TimGenOn, F: generator speed using SpdGenOn} (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenTiStr, "GenTiStr", "Method to start the generator {T: timed using TimGenOn, F: generator speed using SpdGenOn} (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! GenTiStp - Method to stop the generator {T: timed using TimGenOf, F: when generator power = 0} (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenTiStp, "GenTiStp", "Method to stop the generator {T: timed using TimGenOf, F: when generator power = 0} (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! SpdGenOn - Generator speed to turn on the generator for a startup (HSS speed) [used only when GenTiStr=False] (rpm) (read in rpm and converted to rad/sec here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SpdGenOn, "SpdGenOn", "Generator speed to turn on the generator for a startup (HSS speed) [used only when GenTiStr=False] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%SpdGenOn = InputFileData%SpdGenOn*RPM2RPS - - ! TimGenOn - Time to turn on the generator for a startup [used only when GenTiStr=True] (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TimGenOn, "TimGenOn", "Time to turn on the generator for a startup [used only when GenTiStr=True] (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TimGenOf - Time to turn off the generator [used only when GenTiStp=True] (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TimGenOf, "TimGenOf", "Time to turn off the generator [used only when GenTiStp=True] (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- SIMPLE VARIABLE-SPEED TORQUE CONTROL -------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Simple Variable-Speed Torque Control', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! VS_RtGnSp - Rated generator speed for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (rpm) (read in rpm and converted to rad/sec here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%VS_RtGnSp, "VS_RtGnSp", "Rated generator speed for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%VS_RtGnSp = InputFileData%VS_RtGnSp*RPM2RPS - - ! VS_RtTq - Rated generator torque/constant generator torque in Region 3 for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (N-m): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%VS_RtTq, "VS_RtTq", "Rated generator torque/constant generator torque in Region 3 for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (N-m)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! VS_Rgn2K - Generator torque constant in Region 2 for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (N-m/rpm^2) (read in N-m/rpm^2 and converted to N-m/(rad/s)^2 here: - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%VS_Rgn2K, "VS_Rgn2K", "Generator torque constant in Region 2 for simple variable-speed generator control (HSS side) [used only when VSContrl=1] (N-m/rpm^2)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%VS_Rgn2K = InputFileData%VS_Rgn2K/( RPM2RPS**2 ) - - ! VS_SlPc - Rated generator slip percentage in Region 2 1/2 for simple variable-speed generator control [used only when VSContrl=1] (%) (read in percent and converted to a fraction here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%VS_SlPc, "VS_SlPc", "Rated generator slip percentage in Region 2 1/2 for simple variable-speed generator control [used only when VSContrl=1] (%)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%VS_SlPc = InputFileData%VS_SlPc*.01 - - !---------------------- SIMPLE INDUCTION GENERATOR ------------------------------ - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Simple Induction Generator', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! SIG_SlPc - Rated generator slip percentage [used only when VSContrl=0 and GenModel=1] (%) (read in percent and converted to a fraction here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SIG_SlPc, "SIG_SlPc", "Rated generator slip percentage [used only when VSContrl=0 and GenModel=1] (%)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%SIG_SlPc = InputFileData%SIG_SlPc*.01 - - ! SIG_SySp - Synchronous (zero-torque) generator speed [used only when VSContrl=0 and GenModel=1] (rpm) (read in rpm and convert to rad/sec here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SIG_SySp, "SIG_SySp", "Synchronous (zero-torque) generator speed [used only when VSContrl=0 and GenModel=1] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%SIG_SySp = InputFileData%SIG_SySp*RPM2RPS - - - ! SIG_RtTq - Rated torque [used only when VSContrl=0 and GenModel=1] (N-m): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SIG_RtTq, "SIG_RtTq", "Rated torque [used only when VSContrl=0 and GenModel=1] (N-m)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! SIG_PORt - Pull-out ratio (Tpullout/Trated) [used only when VSContrl=0 and GenModel=1] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SIG_PORt, "SIG_PORt", "Pull-out ratio (Tpullout/Trated) [used only when VSContrl=0 and GenModel=1] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- THEVENIN-EQUIVALENT INDUCTION GENERATOR ----------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Thevenin-Equivalent Induction Generator', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_Freq - Line frequency [50 or 60] [used only when VSContrl=0 and GenModel=2] (Hz): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_Freq, "TEC_Freq", "Line frequency [50 or 60] [used only when VSContrl=0 and GenModel=2] (Hz)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_NPol - Number of poles [even integer > 0] [used only when VSContrl=0 and GenModel=2] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_NPol, "TEC_NPol", "Number of poles [even integer > 0] [used only when VSContrl=0 and GenModel=2] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_SRes - Stator resistance [used only when VSContrl=0 and GenModel=2] (ohms): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_SRes, "TEC_SRes", "Stator resistance [used only when VSContrl=0 and GenModel=2] (ohms)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_RRes - Rotor resistance [used only when VSContrl=0 and GenModel=2] (ohms): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_RRes, "TEC_RRes", "Rotor resistance [used only when VSContrl=0 and GenModel=2] (ohms)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_VLL - Line-to-line RMS voltage [used only when VSContrl=0 and GenModel=2] (volts): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_VLL, "TEC_VLL", "Line-to-line RMS voltage [used only when VSContrl=0 and GenModel=2] (volts)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_SLR - Stator leakage reactance [used only when VSContrl=0 and GenModel=2] (ohms): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_SLR, "TEC_SLR", "Stator leakage reactance [used only when VSContrl=0 and GenModel=2] (ohms)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_RLR - Rotor leakage reactance [used only when VSContrl=0 and GenModel=2] (ohms): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_RLR, "TEC_RLR", "Rotor leakage reactance [used only when VSContrl=0 and GenModel=2] (ohms)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TEC_MR - Magnetizing reactance [used only when VSContrl=0 and GenModel=2] (ohms): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TEC_MR, "TEC_MR", "Magnetizing reactance [used only when VSContrl=0 and GenModel=2] (ohms)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- HIGH-SPEED SHAFT BRAKE ---------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: High-Speed Shaft Brake', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! HSSBrMode - HSS brake model {0: none, 1: simple, 3: user-defined from routine UserHSSBr, 4: user-defined from LabVIEW} (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%HSSBrMode, "HSSBrMode", "HSS brake model {0: none, 1: simple, 3: user-defined from routine UserHSSBr, 4: user-defined from LabVIEW} (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! THSSBrDp - Time to initiate deployment of the HSS brake (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%THSSBrDp, "THSSBrDp", "Time to initiate deployment of the HSS brake (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! HSSBrDT - Time for HSS-brake to reach full deployment once initiated [used only when HSSBrMode=1] (sec): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%HSSBrDT, "HSSBrDT", "Time for HSS-brake to reach full deployment once initiated [used only when HSSBrMode=1] (sec)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! HSSBrTqF - Fully deployed HSS-brake torque (N-m): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%HSSBrTqF, "HSSBrTqF", "Fully deployed HSS-brake torque (N-m)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- YAW CONTROL --------------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Yaw Control', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! YCMode - Yaw control mode {0: none, 3: user-defined from routine UserYawCont, 4: user-defined from Simulink/LabVIEW} (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%YCMode, "YCMode", "Yaw control mode (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TYCOn - Time to enable active yaw control [unused when YCMode=0] (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TYCOn, "TYCOn", "Time to enable active yaw control [unused when YCMode=0] (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! YawNeut - Neutral yaw position--yaw spring force is zero at this yaw (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%YawNeut, "YawNeut", "Neutral yaw position--yaw spring force is zero at this yaw (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%YawNeut = InputFileData%YawNeut*D2R - - ! YawSpr - Nacelle-yaw spring constant (N-m/rad): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%YawSpr, "YawSpr", "Nacelle-yaw spring constant (N-m/rad)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! YawDamp - Nacelle-yaw constant (N-m/(rad/s)): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%YawDamp, "YawDamp", "Nacelle-yaw constant (N-m/(rad/s))", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TYawManS - Time to start override yaw maneuver and end standard yaw control (s): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TYawManS, "TYawManS", "Time to start override yaw maneuver and end standard yaw control (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! YawManRat - Yaw maneuver rate (in absolute value) (deg/s) (read in degrees/second and converted to radians/second here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%YawManRat, "YawManRat", "Yaw maneuver rate (in absolute value) (deg/s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%YawManRat = InputFileData%YawManRat*D2R - - ! NacYawF - Final yaw angle for override yaw maneuvers (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%NacYawF, "NacYawF", "Final yaw angle for override yaw maneuvers (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%NacYawF = InputFileData%NacYawF*D2R - - - !---------------------- TUNED MASS DAMPER ---------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Tuned Mass Damper', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! CompNTMD - Compute nacelle tuned mass damper {true/false} (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%CompNTMD, "CompNTMD", "Compute nacelle tuned mass damper {true/false} (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! NTMDfile - Name of the file for nacelle tuned mass damper (quoted string) [unused when CompNTMD is false]: - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%NTMDfile, "NTMDfile", "Name of the file for nacelle tuned mass dampe [unused when CompNTMD is false] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - IF ( PathIsRelative( InputFileData%NTMDfile ) ) InputFileData%NTMDfile = TRIM(PriPath)//TRIM(InputFileData%NTMDfile) - - ! CompTTMD - Compute tower tuned mass damper {true/false} (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%CompTTMD, "CompTTMD", "Compute tower tuned mass damper {true/false} (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TTMDfile - Name of the file for nacelle tuned mass damper (quoted string) [unused when CompNTMD is false]: - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TTMDfile, "TTMDfile", "Name of the file for tower tuned mass dampe [unused when CompTTMD is false] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - IF ( PathIsRelative( InputFileData%TTMDfile ) ) InputFileData%TTMDfile = TRIM(PriPath)//TRIM(InputFileData%TTMDfile) - - - !---------------------- BLADED INTERFACE ---------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Bladed Interface', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - InputFileData%UseLegacyInterface = .true. + u_op(Indx_u_HSS_Spd) = u%HSS_Spd - ! DLL_FileName - Name of the Bladed DLL [used only with DLL Interface] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DLL_FileName, "DLL_FileName", "Name/location of the external library {.dll [Windows]} in the Bladed-DLL format [used only with DLL Interface] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - IF ( PathIsRelative( InputFileData%DLL_FileName ) ) InputFileData%DLL_FileName = TRIM(PriPath)//TRIM(InputFileData%DLL_FileName) - - ! DLL_InFile - Name of input file used in DLL [used only with DLL Interface] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DLL_InFile, "DLL_InFile", "Name of input file used in DLL [used only with DLL Interface] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - IF ( PathIsRelative( InputFileData%DLL_InFile ) ) InputFileData%DLL_InFile = TRIM(PriPath)//TRIM(InputFileData%DLL_InFile) - - ! DLL_ProcName - Name of procedure to be called in DLL [used only with DLL Interface] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DLL_ProcName, "DLL_ProcName", "Name of procedure to be called in DLL [used only with DLL Interface] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! DLL_DT - Communication interval for dynamic library (s): - InputFileData%DLL_DT = InputFileData%DT - CALL ReadVar( UnIn, InitInp%InputFile, Line, "DLL_DT", "Communication interval for dynamic library (s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - CALL Conv2UC( Line ) - IF ( INDEX(Line, "DEFAULT" ) /= 1 ) THEN ! If it's not "default", read this variable; otherwise use the value already stored in InputFileData%DLL_DT - READ( Line, *, IOSTAT=IOS) InputFileData%DLL_DT - CALL CheckIOS ( IOS, InitInp%InputFile, 'DLL_DT', NumType, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2, ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - END IF - - ! DLL_Ramp - Whether a linear ramp should be used between DLL_DT time steps [introduces time shift when true] (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DLL_Ramp, "DLL_Ramp", "Whether a linear ramp should be used between DLL_DT time steps [introduces time shift when true]", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! BPCutoff - Cuttoff frequency for low-pass filter on blade pitch (Hz): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%BPCutoff, "BPCutoff", "Cuttoff frequency for low-pass filter on blade pitch (Hz)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! NacYaw_North - Reference yaw angle of the nacelle when the upwind end points due North (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%NacYaw_North, "NacYaw_North", "Reference yaw angle of the nacelle when the upwind end points due North (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%NacYaw_North = InputFileData%NacYaw_North*D2R - - ! Ptch_Cntrl - Record 28: Use individual pitch control {0: collective pitch; 1: individual pitch control} [used only with DLL Interface] (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Ptch_Cntrl, "Ptch_Cntrl", "Record 28: Use individual pitch control {0: collective pitch; 1: individual pitch control} [used only with DLL Interface] (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! Ptch_SetPnt - Record 5: Below-rated pitch angle set-point [used only with DLL Interface] (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Ptch_SetPnt, "Ptch_SetPnt", "Record 5: Below-rated pitch angle set-point [used only with DLL Interface] (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%Ptch_SetPnt = InputFileData%Ptch_SetPnt*D2R - - ! Ptch_Min - Record 6: Minimum pitch angle [used only with DLL Interface] (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Ptch_Min, "Ptch_Min", "Record 6: Minimum pitch angle [used only with DLL Interface] (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%Ptch_Min = InputFileData%Ptch_Min*D2R - - ! Ptch_Max - Record 7: Maximum pitch angle [used only with DLL Interface] (deg) (read from file in degrees and converted to radians here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Ptch_Max, "Ptch_Max", "Record 7: Maximum pitch angle [used only with DLL Interface] (deg)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%Ptch_Max = InputFileData%Ptch_Max*D2R - - ! PtchRate_Min - Record 8: Minimum pitch rate (most negative value allowed) [used only with DLL Interface] (deg/s) (read from file in deg/s and converted to rad/s here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%PtchRate_Min, "PtchRate_Min", "Record 8: Minimum pitch rate (most negative value allowed) [used only with DLL Interface] (deg/s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%PtchRate_Min = InputFileData%PtchRate_Min*D2R - - ! PtchRate_Max - Record 9: Maximum pitch rate [used only with DLL Interface] (deg/s) (read from file in deg/s and converted to rad/s here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%PtchRate_Max, "PtchRate_Max", "Record 9: Maximum pitch rate [used only with DLL Interface] (deg/s)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%PtchRate_Max = InputFileData%PtchRate_Max*D2R - - ! Gain_OM - Record 16: Optimal mode gain [used only with DLL Interface] (Nm/(rad/s)^2): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Gain_OM, "Gain_OM", "Record 16: Optimal mode gain [used only with DLL Interface] (Nm/(rad/s)^2)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! GenSpd_MinOM - Record 17: Minimum generator speed [used only with DLL Interface] (rpm) (read from file in rpm and converted to rad/s here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenSpd_MinOM, "GenSpd_MinOM", "Record 17: Minimum generator speed [used only with DLL Interface] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%GenSpd_MinOM = InputFileData%GenSpd_MinOM*RPM2RPS - - ! GenSpd_MaxOM - Record 18: Optimal mode maximum speed [used only with DLL Interface] (rpm) (read from file in rpm and converted to rad/s here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenSpd_MaxOM, "GenSpd_MaxOM", "Record 18: Optimal mode maximum speed [used only with DLL Interface] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%GenSpd_MaxOM = InputFileData%GenSpd_MaxOM*RPM2RPS - - ! GenSpd_Dem - Record 19: Demanded generator speed above rated [used only with DLL Interface] (rpm) (read from file in rpm and converted to rad/s here): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenSpd_Dem, "GenSpd_Dem", "Record 19: Demanded generator speed above rated [used only with DLL Interface] (rpm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - InputFileData%GenSpd_Dem = InputFileData%GenSpd_Dem*RPM2RPS - - ! GenTrq_Dem - Record 22: Demanded generator torque above rated [used only with DLL Interface] (Nm): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenTrq_Dem, "GenTrq_Dem", "Record 22: Demanded generator torque above rated [used only with DLL Interface] (Nm)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! GenPwr_Dem - Record 13: Demanded power [used only with DLL Interface] (W): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%GenPwr_Dem, "GenPwr_Dem", "Record 13: Demanded power [used only with DLL Interface] (W)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- BLADED INTERFACE TORQUE-SPEED LOOK-UP TABLE ------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Bladed Interface Torque-Speed Look-Up Table', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! DLL_NumTrq - Record 26: No. of points in torque-speed look-up table {0 = none and use the optimal mode PARAMETERs instead, nonzero = ignore the optimal mode PARAMETERs by setting Gain_OM (Record 16) to 0.0} (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DLL_NumTrq, "DLL_NumTrq", "Record 26: No. of points in torque-speed look-up table {0 = none and use the optimal mode PARAMETERs instead, nonzero = ignore the optimal mode PARAMETERs by setting Gain_OM (Record 16) to 0.0} (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - IF ( InputFileData%DLL_NumTrq > 0 ) THEN - CALL AllocAry( InputFileData%GenSpd_TLU, InputFileData%DLL_NumTrq, 'GenSpd_TLU', ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL AllocAry( InputFileData%GenTrq_TLU, InputFileData%DLL_NumTrq, 'GenTrq_TLU',ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN END IF + + !.......................................... + IF ( PRESENT( y_op ) ) THEN + + if (.not. allocated(y_op)) then + CALL AllocAry( y_op, SrvD_Indx_Y_WrOutput+p%NumOuts, 'y_op', ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) RETURN + end if - CALL ReadCom( UnIn, InitInp%InputFile, 'Table Header: Bladed Interface Torque-Speed Look-Up Table', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadCom( UnIn, InitInp%InputFile, 'Table Units: Bladed Interface Torque-Speed Look-Up Table', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - DO I=1,InputFileData%DLL_NumTrq - - CALL ReadAry( UnIn, InitInp%InputFile, TmpRAry, 2_IntKi, 'Line'//TRIM(Num2LStr(I)), 'Bladed Interface Torque-Speed Look-Up Table', & - ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - InputFileData%GenSpd_TLU( I) = TmpRAry(1)*RPM2RPS ! GenSpd_TLU - Records R:2:R+2*DLL_NumTrq-2: Generator speed values in look-up table (rpm) (read from file in rpm and converted to rad/s here) - InputFileData%GenTrq_TLU(I) = TmpRAry(2) ! GenTrq_TLU - Records R+1:2:R+2*DLL_NumTrq-1: Generator torque values in look-up table (Nm) - - END DO - - - !---------------------- OUTPUT -------------------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: Output', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! SumPrint - Print summary data to .sum (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%SumPrint, "SumPrint", "Print summary data to .sum (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! OutFile - Switch to determine where output will be placed: (1: in module output file only; 2: in glue code output file only; 3: both) (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%OutFile, "OutFile", "Switch to determine where output will be placed: {1: in module output file only; 2: in glue code output file only; 3: both} (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! ! OutFileFmt - Format for module tabular (time-marching) output: (1: text file [.out], 2: binary file [.outb], 3: both): - !CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%OutFileFmt, "OutFileFmt", "Format for module tabular (time-marching) output: (1: text file [.out], 2: binary file [.outb], 3: both)", ErrStat2, ErrMsg2, UnEc) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - ! TabDelim - Flag to cause tab-delimited text output (delimited by space otherwise) (flag): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%TabDelim, "TabDelim", "Flag to cause tab-delimited text output (delimited by space otherwise) (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! OutFmt - Format used for module's text tabult output (except time); resulting field should be 10 characters (-): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%OutFmt, "OutFmt", "Format used for module's text tabular output (except time); resulting field should be 10 characters (-)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! Tstart - Time to start module's tabular output (seconds): - CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%Tstart, "Tstart", "Time to start module's tabular output (seconds)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - ! - ! ! DecFact - Decimation factor for module's tabular output (1=output every step) (-): - !CALL ReadVar( UnIn, InitInp%InputFile, InputFileData%DecFact, "DecFact", "Decimation factor for module's tabular output (1=output every step) (-)", ErrStat2, ErrMsg2, UnEc) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- OUTLIST -------------------------------------------- - CALL ReadCom( UnIn, InitInp%InputFile, 'Section Header: OutList', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! OutList - List of user-requested output channels (-): - CALL ReadOutputList ( UnIn, InitInp%InputFile, InputFileData%OutList, InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc ) ! Routine in NWTC Subroutine Library - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- END OF FILE ----------------------------------------- - - CLOSE ( UnIn ) - RETURN + + do i=1,size(SrvD_Indx_Y_BlPitchCom) ! Note: Potentially limit to NumBl + if (i<=p%NumBl) then + y_op(SrvD_Indx_Y_BlPitchCom(i)) = y%BlPitchCom(i) + else + y_op(SrvD_Indx_Y_BlPitchCom(i)) = 0.0_ReKI + endif + end do + y_op(SrvD_Indx_Y_YawMom) = y%YawMom + y_op(SrvD_Indx_Y_GenTrq) = y%GenTrq + y_op(SrvD_Indx_Y_ElecPwr) = y%ElecPwr + do i=1,p%NumOuts + y_op(i+SrvD_Indx_Y_WrOutput) = y%WriteOutput(i) + end do + END IF -CONTAINS - !............................................................................................................................... - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level - !............................................................................................................................... + IF ( PRESENT( x_op ) ) THEN - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) + END IF + IF ( PRESENT( dx_op ) ) THEN - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ + END IF - IF ( ErrID /= ErrID_None ) THEN + IF ( PRESENT( xd_op ) ) THEN - CALL setErrStat(ErrID,Msg,ErrStat,ErrMsg,RoutineName) + END IF - !......................................................................................................................... - ! Clean up if we're going to return on error: close file, deallocate local arrays - !......................................................................................................................... - IF ( ErrStat >= AbortErrLev ) THEN - CLOSE( UnIn ) -! IF ( UnEc > 0 ) CLOSE ( UnEc ) - END IF + IF ( PRESENT( z_op ) ) THEN - END IF + END IF +END SUBROUTINE SrvD_GetOP +!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - END SUBROUTINE CheckError - !............................................................................................................................... -END SUBROUTINE ReadPrimaryFile !---------------------------------------------------------------------------------------------------------------------------------- !> This routine validates the inputs from the primary input file. SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) !.................................................................................................................................. - + ! Passed variables: TYPE(SrvD_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine @@ -2458,33 +1961,35 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message - + ! local variables INTEGER(IntKi) :: K ! Blade number CHARACTER(*), PARAMETER :: RoutineName = 'ValidatePrimaryData' INTEGER(IntKi) :: ErrStat2 !< Error status CHARACTER(ErrMsgLen) :: ErrMsg2 !< temporary Error message if ErrStat /= ErrID_None - + ErrStat = ErrID_None ErrMsg = '' - + CALL Pitch_ValidateData() CALL Yaw_ValidateData() CALL TipBrake_ValidateData() CALL Torque_ValidateData() CALL HSSBr_ValidateData() - +!FIXME: add validation for StC inputs +! CALL StC_ValidateData() + ! Checks for linearization: if ( InitInp%Linearize ) then - + if ( InputFileData%PCMode /= ControlMode_NONE ) & call SetErrStat(ErrID_Fatal,"PCMode must be 0 for linearization.",ErrStat,ErrMsg,RoutineName) if ( InputFileData%VSContrl /= ControlMode_NONE .and. InputFileData%VSContrl /= ControlMode_SIMPLE ) & call SetErrStat(ErrID_Fatal,"VSContrl must be 0 or 1 for linearization.",ErrStat,ErrMsg,RoutineName) if ( InputFileData%GenModel /= ControlMode_SIMPLE .and. InputFileData%GenModel /= ControlMode_ADVANCED ) & call SetErrStat(ErrID_Fatal,"GenModel must be 1 or 2 for linearization.",ErrStat,ErrMsg,RoutineName) - + if ( .not. InputFileData%GenTiStr ) & call SetErrStat(ErrID_Fatal,"GenTiStr must be TRUE for linearization.",ErrStat,ErrMsg,RoutineName) if ( .not. InputFileData%GenTiStp ) & @@ -2495,8 +2000,8 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) if (InputFileData%YCMode /= ControlMode_NONE) & call SetErrStat(ErrID_Fatal,"YCMode must be 0 for linearization.",ErrStat,ErrMsg,RoutineName) - if (InputFileData%CompNTMD .or. InputFileData%CompTTMD) & - call SetErrStat(ErrID_Fatal,"TMD module is not currently allowed in linearization. CompNTMD and CompTTMD must be FALSE.",ErrStat,ErrMsg,RoutineName) + if ((InputFileData%NumNStC + InputFileData%NumTStC + InputFileData%NumBStC + InputFileData%NumSStC) > 0_IntKi) & + call SetErrStat(ErrID_Fatal,"StrucCtrl module is not currently allowed in linearization. NumNStC, NumTStC, NumBStC, and NumSStC must all be ZERO.",ErrStat,ErrMsg,RoutineName) if (InitInp%TrimCase /= TrimCase_none) then if (InitInp%TrimCase /= TrimCase_yaw .and. InitInp%TrimCase /= TrimCase_torque .and. InitInp%TrimCase /= TrimCase_pitch) then @@ -2507,8 +2012,8 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) end if end if - - + + ! this code was in FASTSimulink.f90 in FAST v7: IF (Cmpl4SFun) THEN !warn if ServoDyn isn't going to use the inputs from the Simulink interface IF (InputFileData%YCMode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Yaw angle and rate are not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) @@ -2516,35 +2021,35 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) IF (InputFileData%VSContrl /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Generator torque and power are not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) IF (InputFileData%HSSBrMode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'HSS brake is not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) END IF - + RETURN - + CONTAINS !------------------------------------------------------------------------------------------------------------------------------- !> This routine performs the checks on inputs for the pitch controller. SUBROUTINE Pitch_ValidateData( ) !............................................................................................................................... - + ! Check that the requested pitch control modes are valid: - + IF ( .NOT. Cmpl4SFun .AND. .NOT. Cmpl4LV ) THEN - + IF ( InputFileData%PCMode == ControlMode_EXTERN ) THEN CALL SetErrStat( ErrID_Fatal, 'PCMode can equal '//TRIM(Num2LStr(ControlMode_EXTERN))//' only when ServoDyn is interfaced with Simulink or LabVIEW.'// & - ' Set PCMode to 0, 3, or 5 or interface ServoDyn with Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) + ' Set PCMode to 0, 3, or 5 or interface ServoDyn with Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) END IF - + END IF - - + + IF ( InputFileData%PCMode /= ControlMode_NONE .and. InputFileData%PCMode /= ControlMode_USER ) THEN IF ( InputFileData%PCMode /= ControlMode_EXTERN .and. InputFileData%PCMode /= ControlMode_DLL ) & CALL SetErrStat( ErrID_Fatal, 'PCMode must be 0, 3, 4, or 5.', ErrStat, ErrMsg, RoutineName ) ENDIF - + ! Time that pitch control is enabled: - + IF ( InputFileData%TPCOn < 0.0_DbKi ) THEN CALL SetErrStat( ErrID_Fatal, 'TPCOn must not be negative.', ErrStat, ErrMsg, RoutineName ) ENDIF @@ -2552,55 +2057,55 @@ SUBROUTINE Pitch_ValidateData( ) ! Make sure the number of blades in the simulation doesn't exceed 3: IF ( InitInp%NumBl > SIZE(InputFileData%TPitManS,1) ) CALL SetErrStat( ErrID_Fatal, 'Number of blades exceeds input values.', ErrStat, ErrMsg, RoutineName ) - + ! Check the pitch-maneuver start times and rates: - + DO K=1,MIN(InitInp%NumBl,SIZE(InputFileData%TPitManS)) - + IF ( InputFileData%TPitManS(K) < 0.0_DbKi ) & - CALL SetErrStat( ErrID_Fatal, 'TPitManS('//TRIM( Num2LStr( K ) )//') must not be negative.', ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( ErrID_Fatal, 'TPitManS('//TRIM( Num2LStr( K ) )//') must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( EqualRealNos( InputFileData%PitManRat(K), 0.0_ReKi ) ) & CALL SetErrStat( ErrID_Fatal, 'PitManRat('//TRIM( Num2LStr(K) )//') must not be 0.', ErrStat, ErrMsg, RoutineName ) - ENDDO ! K - - + ENDDO ! K + + !??? IF ( ANY( p%BlPitchInit <= -pi ) .OR. ANY( p%BlPitchInit > pi ) ) THEN ! CALL SetErrStat( ErrID_Fatal, 'BlPitchInit('//TRIM( Num2LStr( K ) )//') must be in the range (-pi,pi] radians (i.e., (-180,180] degrees).' , ErrStat, ErrMsg, RoutineName ) - - - + + + END SUBROUTINE Pitch_ValidateData !------------------------------------------------------------------------------------------------------------------------------- !> This routine performs the checks on inputs for the yaw controller. SUBROUTINE Yaw_ValidateData( ) !............................................................................................................................... - + ! checks for yaw control mode: IF ( InputFileData%YCMode /= ControlMode_NONE .and. InputFileData%YCMode /= ControlMode_USER ) THEN IF ( InputFileData%YCMode /= ControlMode_DLL .and. InputFileData%YCMode /= ControlMode_EXTERN ) & CALL SetErrStat( ErrID_Fatal, 'YCMode must be 0, 3, 4 or 5.', ErrStat, ErrMsg, RoutineName ) ENDIF - - ! Some special checks based on whether inputs will come from external source (e.g., Simulink, LabVIEW) + + ! Some special checks based on whether inputs will come from external source (e.g., Simulink, LabVIEW) IF ( .NOT. Cmpl4SFun .AND. .NOT. Cmpl4LV ) THEN - + IF ( InputFileData%YCMode == ControlMode_EXTERN ) THEN CALL SetErrStat( ErrID_Fatal, 'YCMode can equal '//TRIM(Num2LStr(ControlMode_EXTERN))//' only when ServoDyn is interfaced with Simulink or LabVIEW.'// & - ' Set YCMode to 0, 3, or 5 or interface ServoDyn with Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) + ' Set YCMode to 0, 3, or 5 or interface ServoDyn with Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) END IF - + END IF - + ! Check the start time to enable yaw control mode: - + IF ( InputFileData%TYCOn < 0.0_DbKi ) THEN CALL SetErrStat( ErrID_Fatal, 'TYCOn must not be negative.', ErrStat, ErrMsg, RoutineName ) ENDIF - - + + ! Check the nacelle-yaw-maneuver start times and rates: IF ( InputFileData%TYawManS < 0.0_DbKi ) CALL SetErrStat( ErrID_Fatal, 'TYawManS must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( EqualRealNos( InputFileData%YawManRat, 0.0_ReKi ) ) CALL SetErrStat( ErrID_Fatal, 'YawManRat must not be 0.', ErrStat, ErrMsg, RoutineName ) @@ -2611,52 +2116,52 @@ SUBROUTINE Yaw_ValidateData( ) IF ( InputFileData%YawSpr < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'YawSpr must not be negative.' , ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%YawDamp < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'YawDamp must not be negative.', ErrStat, ErrMsg, RoutineName ) - + ! Check the neutral position: IF ( InputFileData%YawNeut <= -pi .OR. InputFileData%YawNeut > pi ) & CALL SetErrStat( ErrID_Fatal, 'YawNeut must be in the range (-pi, pi] radians (i.e., (-180,180] degrees).', ErrStat, ErrMsg, RoutineName ) - - + + END SUBROUTINE Yaw_ValidateData !------------------------------------------------------------------------------------------------------------------------------- !> This routine performs the checks on inputs for the tip brakes. SUBROUTINE TipBrake_ValidateData( ) !............................................................................................................................... - + !IF ( TBDrConN < 0.0 ) CALL ProgAbort ( ' TBDrConN must not be negative.' ) !IF ( TBDrConD < TBDrConN ) CALL ProgAbort( ' TBDrConD must not be less than TBDrConN.' ) !IF ( p%TpBrDT < 0.0_DbKi ) CALL ProgAbort ( ' TpBrDT must not be negative.' ) - - + + !DO K=1,MIN(InitInp%NumBl,SIZE(InputFileData%TTpBrDp)) ! IF ( InputFileData%TTpBrDp(K) < 0.0_DbKi ) & ! CALL SetErrStat( ErrID_Fatal, 'TTpBrDp(' //TRIM( Num2LStr( K ) )//') must not be negative.', ErrStat, ErrMsg, RoutineName ) ! IF ( InputFileData%TBDepISp(K) < 0.0_DbKi ) & - ! CALL SetErrStat( ErrID_Fatal, 'TBDepISp('//TRIM( Num2LStr( K ) )//') must not be negative.', ErrStat, ErrMsg, RoutineName ) - !ENDDO ! K - - + ! CALL SetErrStat( ErrID_Fatal, 'TBDepISp('//TRIM( Num2LStr( K ) )//') must not be negative.', ErrStat, ErrMsg, RoutineName ) + !ENDDO ! K + + END SUBROUTINE TipBrake_ValidateData !------------------------------------------------------------------------------------------------------------------------------- !> This routine performs the checks on inputs for the torque controller. SUBROUTINE Torque_ValidateData( ) !............................................................................................................................... IF ( .NOT. Cmpl4SFun .AND. .NOT. Cmpl4LV ) THEN - + IF ( InputFileData%VSContrl == ControlMode_EXTERN ) THEN CALL SetErrStat( ErrID_Fatal, 'VSContrl can equal '//TRIM(Num2LStr(ControlMode_EXTERN))//' only when ServoDyn is interfaced with Simulink or LabVIEW.'// & ' Set VSContrl to 0, 1, 3, or 5 or interface ServoDyn with Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) END IF END IF - - - ! checks for generator and torque control: + + + ! checks for generator and torque control: IF ( InputFileData%VSContrl /= ControlMode_NONE .and. & InputFileData%VSContrl /= ControlMode_SIMPLE .AND. InputFileData%VSContrl /= ControlMode_USER ) THEN IF ( InputFileData%VSContrl /= ControlMode_DLL .AND. InputFileData%VSContrl /=ControlMode_EXTERN ) & CALL SetErrStat( ErrID_Fatal, 'VSContrl must be either 0, 1, 3, 4, or 5.', ErrStat, ErrMsg, RoutineName ) ENDIF - + IF ( InputFileData%SpdGenOn < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'SpdGenOn must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%TimGenOn < 0.0_DbKi ) CALL SetErrStat( ErrID_Fatal, 'TimGenOn must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%TimGenOf < 0.0_DbKi ) CALL SetErrStat( ErrID_Fatal, 'TimGenOf must not be negative.', ErrStat, ErrMsg, RoutineName ) @@ -2664,9 +2169,9 @@ SUBROUTINE Torque_ValidateData( ) IF ( InputFileData%GenEff < 0.0_ReKi .OR. InputFileData%GenEff > 1.0_ReKi ) THEN CALL SetErrStat( ErrID_Fatal, 'GenEff must be in the range [0, 1] (i.e., [0, 100] percent)', ErrStat, ErrMsg, RoutineName ) END IF - - - ! checks for variable-speed torque control: + + + ! checks for variable-speed torque control: IF ( InputFileData%VSContrl == ControlMode_SIMPLE ) THEN IF ( InputFileData%VS_RtGnSp <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'VS_RtGnSp must be greater than zero.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%VS_RtTq < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'VS_RtTq must not be negative.', ErrStat, ErrMsg, RoutineName ) @@ -2674,21 +2179,21 @@ SUBROUTINE Torque_ValidateData( ) IF ( InputFileData%VS_Rgn2K*InputFileData%VS_RtGnSp**2 > InputFileData%VS_RtTq ) & CALL SetErrStat( ErrID_Fatal, 'VS_Rgn2K*VS_RtGnSp^2 must not be greater than VS_RtTq.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%VS_SlPc <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'VS_SlPc must be greater than zero.', ErrStat, ErrMsg, RoutineName ) - - ! checks for generator models (VSControl == 0): + + ! checks for generator models (VSControl == 0): ELSE IF ( InputFileData%VSContrl == ControlMode_NONE ) THEN - + IF ( InputFileData%GenModel /= ControlMode_SIMPLE .AND. InputFileData%GenModel /= ControlMode_ADVANCED .AND. InputFileData%GenModel /= ControlMode_USER ) THEN CALL SetErrStat( ErrID_Fatal, 'GenModel must be either 1, 2, or 3.', ErrStat, ErrMsg, RoutineName ) - ENDIF - - ! checks for simple induction generator (VSControl=0 & GenModel=1): + ENDIF + + ! checks for simple induction generator (VSControl=0 & GenModel=1): IF ( InputFileData%GenModel == ControlMode_SIMPLE ) THEN IF ( InputFileData%SIG_SlPc <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'SIG_SlPc must be greater than zero.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%SIG_SySp <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'SIG_SySp must be greater than zero.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%SIG_RtTq <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'SIG_RtTq must be greater than zero.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%SIG_PORt < 1.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'SIG_PORt must not be less than 1.' , ErrStat, ErrMsg, RoutineName ) - + ! checks for Thevenin-equivalent induction generator (VSControl=0 & GenModel=2): ELSE IF ( InputFileData%GenModel == ControlMode_ADVANCED ) THEN IF ( InputFileData%TEC_Freq <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'TEC_Freq must be greater than zero.', ErrStat, ErrMsg, RoutineName ) @@ -2700,34 +2205,34 @@ SUBROUTINE Torque_ValidateData( ) IF ( InputFileData%TEC_SLR <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'TEC_SLR must be greater than zero.' , ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%TEC_RLR <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'TEC_RLR must be greater than zero.' , ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%TEC_MR <= 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'TEC_MR must be greater than zero.' , ErrStat, ErrMsg, RoutineName ) - END IF - + END IF + END IF - + END SUBROUTINE Torque_ValidateData !------------------------------------------------------------------------------------------------------------------------------- - !> This routine performs the checks on inputs for the high-speed shaft brake. + !> This routine performs the checks on inputs for the high-speed shaft brake. SUBROUTINE HSSBr_ValidateData( ) - + ! Some special checks based on whether inputs will come from external source (e.g., Simulink, LabVIEW) IF ( .NOT. Cmpl4SFun .AND. .NOT. Cmpl4LV ) THEN - + IF ( InputFileData%HSSBrMode == ControlMode_EXTERN ) THEN CALL SetErrStat( ErrID_Fatal, 'HSSBrMode can be '//TRIM(Num2LStr(ControlMode_EXTERN))//' only when implemented in Simulink or LabVIEW.', ErrStat, ErrMsg, RoutineName ) ENDIF - + END IF - ! checks for high-speed shaft brake: + ! checks for high-speed shaft brake: IF ( InputFileData%HSSBrMode /= ControlMode_NONE .and. & InputFileData%HSSBrMode /= ControlMode_SIMPLE .and. InputFileData%HSSBrMode /= ControlMode_USER ) THEN - IF ( InputFileData%HSSBrMode /= ControlMode_DLL .and. InputFileData%HSSBrMode /= ControlMode_EXTERN ) & + IF ( InputFileData%HSSBrMode /= ControlMode_DLL .and. InputFileData%HSSBrMode /= ControlMode_EXTERN ) & CALL SetErrStat( ErrID_Fatal, 'HSSBrMode must be 0, 1, 3, 4, or 5.', ErrStat, ErrMsg, RoutineName ) END IF IF ( InputFileData%THSSBrDp < 0.0_DbKi ) CALL SetErrStat( ErrID_Fatal, 'THSSBrDp must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%HSSBrDT < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'HSSBrDT must not be negative.', ErrStat, ErrMsg, RoutineName ) IF ( InputFileData%HSSBrTqF < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'HSSBrTqF must not be negative.', ErrStat, ErrMsg, RoutineName ) - + END SUBROUTINE HSSBr_ValidateData !------------------------------------------------------------------------------------------------------------------------------- END SUBROUTINE ValidatePrimaryData @@ -2746,13 +2251,13 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) REAL(ReKi) :: SIG_RtSp ! Rated speed REAL(ReKi) :: TEC_K1 ! K1 term for Thevenin-equivalent circuit REAL(ReKi) :: TEC_K2 ! K2 term for Thevenin-equivalent circuit - - INTEGER(IntKi) :: ErrStat2 ! Temporary error ID + + INTEGER(IntKi) :: ErrStat2 ! Temporary error ID CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary message describing error CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_SetParameters' - + ! Initialize variables ErrStat = ErrID_None @@ -2760,22 +2265,23 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%DT = InputFileData%DT - + !............................................. ! Pitch control parameters !............................................. - + p%PCMode = InputFileData%PCMode - p%TPCOn = InputFileData%TPCOn + p%TPCOn = InputFileData%TPCOn - CALL AllocAry( p%TPitManS, p%NumBl, 'TPitManS', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL AllocAry( p%BlPitchF, p%NumBl, 'BlPitchF', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL AllocAry( p%PitManRat, p%NumBl, 'PitManRat', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL AllocAry( p%TPitManS, p%NumBl, 'TPitManS', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); p%TPitManS =0.0_DbKi + CALL AllocAry( p%BlPitchF, p%NumBl, 'BlPitchF', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); p%BlPitchF =0.0_ReKi + CALL AllocAry( p%PitManRat, p%NumBl, 'PitManRat', ErrStat2, ErrMsg2 ); CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); p%PitManRat=0.0_ReKi IF (ErrStat >= AbortErrLev) RETURN - p%TPitManS = InputFileData%TPitManS(1:p%NumBl) - p%BlPitchF = InputFileData%BlPitchF(1:p%NumBl) - p%PitManRat = InputFileData%PitManRat(1:p%NumBl) + + p%TPitManS = InputFileData%TPitManS( 1:min(p%NumBl,size(InputFileData%TPitManS))) + p%BlPitchF = InputFileData%BlPitchF( 1:min(p%NumBl,size(InputFileData%BlPitchF))) + p%PitManRat = InputFileData%PitManRat(1:min(p%NumBl,size(InputFileData%PitManRat))) !............................................. ! Set generator and torque control parameters: @@ -2788,13 +2294,13 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%SpdGenOn = InputFileData%SpdGenOn p%TimGenOn = InputFileData%TimGenOn p%TimGenOf = InputFileData%TimGenOf - - + + p%THSSBrFl = InputFileData%THSSBrDp + InputFileData%HSSBrDT ! Time at which shaft brake is fully deployed - - SELECT CASE ( p%VSContrl ) + + SELECT CASE ( p%VSContrl ) CASE ( ControlMode_NONE ) ! None - + IF ( p%GenModel == ControlMode_SIMPLE ) THEN ! Simple induction generator SIG_RtSp = InputFileData%SIG_SySp*( 1.0 + InputFileData%SIG_SlPc ) ! Rated speed @@ -2806,7 +2312,7 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) ELSEIF ( p%GenModel == ControlMode_ADVANCED ) THEN ! Thevenin-equivalent induction generator ComDenom = InputFileData%TEC_SRes**2 + ( InputFileData%TEC_SLR + InputFileData%TEC_MR )**2 ! common denominator used in many of the following equations - + p%TEC_Re1 = InputFileData%TEC_SRes*( InputFileData%TEC_MR**2 )/ComDenom ! Thevenin's equivalent stator resistance (ohms) p%TEC_Xe1 = InputFileData%TEC_MR*( InputFileData%TEC_SRes**2 + InputFileData%TEC_SLR* & ( InputFileData%TEC_SLR + InputFileData%TEC_MR) )/ComDenom ! Thevenin's equivalent stator leakage reactance (ohms) @@ -2826,10 +2332,10 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%TEC_VLL = InputFileData%TEC_VLL ENDIF - - + + CASE ( ControlMode_SIMPLE ) ! Simple variable-speed control - + p%VS_SySp = InputFileData%VS_RtGnSp/( 1.0 + InputFileData%VS_SlPc ) ! Synchronous speed of region 2 1/2 induction generator. IF ( InputFileData%VS_SlPc < SQRT(EPSILON(InputFileData%VS_SlPc) ) ) THEN ! We don't have a region 2 so we'll use VS_TrGnSp = VS_RtGnSp p%VS_Slope = 9999.9 @@ -2843,21 +2349,21 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) / ( 2.0*InputFileData%VS_Rgn2K ) ! Transitional generator speed between regions 2 and 2 1/2. ENDIF END IF - + p%VS_Rgn2K = InputFileData%VS_Rgn2K p%VS_RtGnSp = InputFileData%VS_RtGnSp p%VS_RtTq = InputFileData%VS_RtTq - - END SELECT - + + END SELECT + !............................................. ! High-speed shaft brake parameters - !............................................. + !............................................. p%HSSBrMode = InputFileData%HSSBrMode p%THSSBrDp = InputFileData%THSSBrDp p%HSSBrDT = InputFileData%HSSBrDT p%HSSBrTqF = InputFileData%HSSBrTqF - + !............................................. ! Nacelle-yaw control parameters !............................................. @@ -2867,62 +2373,64 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%YawSpr = InputFileData%YawSpr p%YawDamp = InputFileData%YawDamp - p%TYawManS = InputFileData%TYawManS - p%NacYawF = InputFileData%NacYawF + p%TYawManS = InputFileData%TYawManS + p%NacYawF = InputFileData%NacYawF p%YawManRat = InputFileData%YawManRat ! we change the sign of this variable later - + !............................................. ! tip-brake parameters (not used in this version) !............................................. CALL AllocAry( p%TBDepISp, p%NumBl, 'TBDepISp', ErrStat2, ErrMsg2 ) ! Deployment-initiation speed for the tip brakes CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - + IF (ErrStat >= AbortErrLev) RETURN + p%TBDepISp = HUGE(p%TBDepISp) ! Deployment-initiation speed for the tip brakes: basically never deploy them. Eventually this will be added back? !p%TBDepISp = InputFileData%TBDepISp*RPM2RPS p%TpBrDT = HUGE(p%TpBrDT) ! Time for tip brakes to reach full deployment, once deployed p%TBDrConN = 0.0_ReKi ! tip-drag constant during normal operation p%TBDrConD = 0.0_ReKi ! tip-drag constant during fully deployed operation - - + + !............................................. ! Tuned-mass damper parameters !............................................. - p%CompNTMD = InputFileData%CompNTMD - p%CompTTMD = InputFileData%CompTTMD - + p%NumBStC = InputFileData%NumBStC + p%NumNStC = InputFileData%NumNStC + p%NumTStC = InputFileData%NumTStC + p%NumSStC = InputFileData%NumSStC + !............................................. ! Determine if the BladedDLL should be called !............................................. - + IF ( p%PCMode == ControlMode_DLL .OR. & - p%YCMode == ControlMode_DLL .OR. & + p%YCMode == ControlMode_DLL .OR. & p%VSContrl == ControlMode_DLL .OR. & p%HSSBrMode == ControlMode_DLL ) THEN - - p%UseBladedInterface = .TRUE. - + + p%UseBladedInterface = .TRUE. + ELSE - p%UseBladedInterface = .FALSE. + p%UseBladedInterface = .FALSE. END IF - + !............................................. ! Parameters for file output (not including Bladed DLL logging outputs) !............................................. p%NumOuts = InputFileData%NumOuts p%NumOuts_DLL = 0 ! set to zero and overwritten if/when the DLL uses it - + CALL SetOutParam(InputFileData%OutList, p, ErrStat2, ErrMsg2 ) ! requires: p%NumOuts, p%NumBl; sets: p%OutParam. CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - + IF (ErrStat >= AbortErrLev) RETURN + IF ( InputFileData%TabDelim ) THEN p%Delim = TAB ELSE p%Delim = ' ' - END IF - + END IF + END SUBROUTINE SrvD_SetParameters !---------------------------------------------------------------------------------------------------------------------------------- @@ -2942,8 +2450,8 @@ SUBROUTINE Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables REAL(ReKi) :: YawPosCom ! Commanded yaw angle from user-defined routines, rad. REAL(ReKi) :: YawRateCom ! Commanded yaw rate from user-defined routines, rad/s. REAL(ReKi) :: YawPosComInt ! Integrated yaw commanded (from DLL), rad @@ -2958,7 +2466,7 @@ SUBROUTINE Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg !................................................................... IF ( OtherState%BegYawMan ) THEN ! Override yaw maneuver is occuring. - + IF ( t >= OtherState%TYawManE ) THEN ! Override yaw maneuver has ended; yaw command is fixed at NacYawF YawPosCom = p%NacYawF @@ -2966,39 +2474,39 @@ SUBROUTINE Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ELSE ! Override yaw maneuver in linear ramp - ! Increment the command yaw and rate using YawManRat + ! Increment the command yaw and rate using YawManRat YawRateCom = SIGN( p%YawManRat, p%NacYawF - OtherState%NacYawI ) ! Modify the sign of p%YawManRat based on the direction of the yaw maneuever YawPosCom = OtherState%NacYawI + YawRateCom*( t - p%TYawManS ) ENDIF - + ELSE - + if (p%YCMode == ControlMode_DLL) then if (m%dll_data%Yaw_Cntrl == GH_DISCON_YAW_CONTROL_TORQUE .or. m%dll_data%OverrideYawRateWithTorque) then - + y%YawMom = m%dll_data%YawTorqueDemand return end if end if - + !................................................................... ! Calculate standard yaw position and rate commands: !................................................................... YawPosComInt = OtherState%YawPosComInt ! get state value. We don't update the state here. CALL CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, YawPosComInt, ErrStat, ErrMsg) - + END IF !................................................................... ! Calculate the yaw moment: !................................................................... - + y%YawMom = - p%YawSpr *( u%Yaw - YawPosCom ) & ! {-f(qd,q,t)}SpringYaw - p%YawDamp*( u%YawRate - YawRateCom ) ! {-f(qd,q,t)}DampYaw; - - + + !................................................................... ! Apply trim case for linearization: ! prescribed yaw will be wrong in this case..... @@ -3006,8 +2514,8 @@ SUBROUTINE Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg if (p%TrimCase==TrimCase_yaw) then y%YawMom = y%YawMom + xd%CtrlOffset * p%YawSpr end if - - + + END SUBROUTINE Yaw_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- !> Routine that calculates standard yaw position and rate commands: YawPosCom and YawRateCom. @@ -3030,18 +2538,18 @@ SUBROUTINE CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, YawPosComInt, ! Calculate standard yaw position and rate commands: !................................................................... - + IF ( t >= p%TYCOn .AND. p%YCMode /= ControlMode_NONE ) THEN ! Time now to enable active yaw control. SELECT CASE ( p%YCMode ) ! Which yaw control mode are we using? (we already took care of ControlMode_None) - + CASE ( ControlMode_SIMPLE ) ! Simple ... BJJ: THIS will be NEW - + CASE ( ControlMode_USER ) ! User-defined from routine UserYawCont(). - - CALL UserYawCont ( u%Yaw, u%YawRate, u%WindDir, u%YawErr, p%NumBl, t, p%DT, p%RootName, YawPosCom, YawRateCom ) + + CALL UserYawCont ( u%Yaw, u%YawRate, u%WindDir, u%YawErr, p%NumBl, t, p%DT, p%RootName, YawPosCom, YawRateCom ) CASE ( ControlMode_EXTERN ) ! User-defined from Simulink or LabVIEW @@ -3049,26 +2557,26 @@ SUBROUTINE CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, YawPosComInt, YawRateCom = u%ExternalYawRateCom CASE ( ControlMode_DLL ) ! User-defined yaw control from Bladed-style DLL - + YawPosComInt = YawPosComInt + m%dll_data%YawRateCom*p%DT ! Integrated yaw position YawPosCom = YawPosComInt !bjj: was this: LastYawPosCom + YawRateCom*( ZTime - LastTime ) YawRateCom = m%dll_data%YawRateCom - + if (m%dll_data%OverrideYawRateWithTorque .or. m%dll_data%Yaw_Cntrl == GH_DISCON_YAW_CONTROL_TORQUE) then call SetErrStat(ErrID_Fatal, "Unable to calculate yaw rate control because yaw torque control (or override) was requested from DLL.", ErrStat, ErrMsg, "CalculateStandardYaw") return end if - + END SELECT ELSE ! Do not control yaw, maintain initial (neutral) yaw angles - + YawPosCom = p%YawNeut YawRateCom = 0.0_ReKi - ENDIF - + ENDIF + END SUBROUTINE CalculateStandardYaw !---------------------------------------------------------------------------------------------------------------------------------- !> This routine updates the other states associated with the yaw controller: BegYawMan, NacYawI, and TYawManE. @@ -3089,12 +2597,12 @@ SUBROUTINE Yaw_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables REAL(ReKi) :: YawPosCom ! Commanded yaw angle from user-defined routines, rad. REAL(ReKi) :: YawRateCom ! Commanded yaw rate from user-defined routines, rad/s. REAL(ReKi) :: YawManRat ! Yaw maneuver rate, rad/s - + ! Initialize ErrStat @@ -3112,10 +2620,10 @@ SUBROUTINE Yaw_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) IF ( .not. OtherState%BegYawMan ) THEN ! Override yaw maneuver is just beginning (possibly again). CALL CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, OtherState%YawPosComInt, ErrStat, ErrMsg) - + OtherState%NacYawI = YawPosCom !bjj: was u%Yaw ! Store the initial (current) yaw, at the start of the yaw maneuver YawManRat = SIGN( p%YawManRat, p%NacYawF - OtherState%NacYawI ) ! Modify the sign of YawManRat based on the direction of the yaw maneuever - OtherState%TYawManE = p%TYawManS + ( p%NacYawF - OtherState%NacYawI ) / YawManRat ! Calculate the end time of the override yaw maneuver + OtherState%TYawManE = p%TYawManS + ( p%NacYawF - OtherState%NacYawI ) / YawManRat ! Calculate the end time of the override yaw maneuver OtherState%BegYawMan = .TRUE. ! Let's remember when we stored this these values @@ -3127,10 +2635,10 @@ SUBROUTINE Yaw_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) ! Update OtherState%YawPosComInt: !................................................................... CALL CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, OtherState%YawPosComInt, ErrStat, ErrMsg) - + ENDIF - - + + END SUBROUTINE Yaw_UpdateStates !---------------------------------------------------------------------------------------------------------------------------------- !> Routine for computing the pitch output: blade pitch commands. This routine is used in both loose and tight coupling. @@ -3150,13 +2658,13 @@ SUBROUTINE Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, BlPitchCom, ElecPwr, TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables REAL(ReKi) :: factor REAL(ReKi) :: PitManRat INTEGER(IntKi) :: K ! counter for blades - + ! Initialize ErrStat @@ -3167,28 +2675,28 @@ SUBROUTINE Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, BlPitchCom, ElecPwr, !................................................................... ! Calculate standard pitch position and rate commands: !................................................................... - ! Control pitch if requested: - + ! Control pitch if requested: + IF ( t >= p%TPCOn .AND. p%PCMode /= ControlMode_NONE ) THEN ! Time now to enable active pitch control. SELECT CASE ( p%PCMode ) ! Which pitch control mode are we using? CASE ( ControlMode_SIMPLE ) ! Simple, built-in pitch-control routine. - + ! bjj: add this! - + CASE ( ControlMode_USER ) ! User-defined from routine PitchCntrl(). CALL PitchCntrl ( u%BlPitch, ElecPwr, u%LSS_Spd, u%TwrAccel, p%NumBl, t, p%DT, p%RootName, BlPitchCom ) CASE ( ControlMode_EXTERN ) ! User-defined from Simulink or LabVIEW. - BlPitchCom = u%ExternalBlPitchCom ! copy entire array + BlPitchCom = u%ExternalBlPitchCom(1:p%NumBl) CASE ( ControlMode_DLL ) ! User-defined pitch control from Bladed-style DLL - - + + if (p%DLL_Ramp) then factor = (t - m%LastTimeCalled) / m%dll_data%DLL_DT BlPitchCom = m%dll_data%PrevBlPitch(1:p%NumBl) + & @@ -3196,15 +2704,15 @@ SUBROUTINE Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, BlPitchCom, ElecPwr, else BlPitchCom = m%dll_data%BlPitchCom(1:p%NumBl) end if - + ! update the filter state once per time step IF ( EqualRealNos( t - p%DT, m%LastTimeFiltered ) ) THEN m%xd_BlPitchFilter = p%BlAlpha * m%xd_BlPitchFilter + (1.0_ReKi - p%BlAlpha) * BlPitchCom m%LastTimeFiltered = t END IF - + BlPitchCom = p%BlAlpha * m%xd_BlPitchFilter + (1.0_ReKi - p%BlAlpha) * BlPitchCom - + END SELECT ELSE ! Do not control pitch yet, maintain initial pitch angles. @@ -3224,31 +2732,31 @@ SUBROUTINE Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, BlPitchCom, ElecPwr, IF ( OtherState%BegPitMan(K) ) THEN ! Override pitch maneuver is occuring for this blade. - + IF ( t >= OtherState%TPitManE(K) ) THEN ! Override pitch maneuver has ended, blade is locked at BlPitchF. BlPitchCom(K) = p%BlPitchF(K) - ELSE + ELSE PitManRat = SIGN( p%PitManRat(K), p%BlPitchF(K) - OtherState%BlPitchI(K) ) ! Modify the sign of PitManRat based on the direction of the pitch maneuever BlPitchCom(K) = OtherState%BlPitchI(K) + PitManRat*( t - p%TPitManS(K) ) ! Increment the blade pitch using PitManRat - - END IF - + + END IF + ENDIF - - - ENDDO ! K - blades - + + + ENDDO ! K - blades + !................................................................... ! Apply trim case for linearization: !................................................................... if (p%TrimCase==TrimCase_pitch) then BlPitchCom = BlPitchCom + xd%CtrlOffset end if - - + + END SUBROUTINE Pitch_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- !> This routine updates the continuous and other states associated with the pitch controller: BegPitMan, BlPitchI, and TPitManE. @@ -3269,12 +2777,12 @@ SUBROUTINE Pitch_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables REAL(ReKi) :: PitManRat INTEGER(IntKi) :: K ! counter for blades - + ! Initialize ErrStat @@ -3297,174 +2805,19 @@ SUBROUTINE Pitch_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg OtherState%BlPitchI (K) = u%BlPitch(K) ! Store the initial (current) pitch, at the start of the pitch maneuver. PitManRat = SIGN( p%PitManRat(K), p%BlPitchF(K) - OtherState%BlPitchI(K) ) ! Modify the sign of PitManRat based on the direction of the pitch maneuever - OtherState%TPitManE (K) = p%TPitManS(K) + ( p%BlPitchF(K) - OtherState%BlPitchI(K) )/PitManRat ! Calculate the end time of the override pitch maneuver - + OtherState%TPitManE (K) = p%TPitManS(K) + ( p%BlPitchF(K) - OtherState%BlPitchI(K) )/PitManRat ! Calculate the end time of the override pitch maneuver + OtherState%BegPitMan(K) = .TRUE. ENDIF - - ENDIF - - ENDDO ! K - blades - - -END SUBROUTINE Pitch_UpdateStates -!---------------------------------------------------------------------------------------------------------------------------------- - -!---------------------------------------------------------------------------------------------------------------------------------- -!********************************************************************************************************************************** -! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" -! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these -! lines should be modified in the Matlab script and/or Excel worksheet as necessary. -! This code was generated by Write_ChckOutLst.m at 05-Nov-2015 09:57:49. -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine checks to see if any requested output channel names (stored in the OutList(:)) are invalid. It returns a -!! warning if any of the channels are not available outputs from the module. -!! It assigns the settings for OutParam(:) (i.e, the index, name, and units of the output channels, WriteOutput(:)). -!! the sign is set to 0 if the channel is invalid. -!! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. -SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) -!.................................................................................................................................. - - IMPLICIT NONE - - ! Passed variables - - CHARACTER(ChanLen), INTENT(IN) :: OutList(:) ! The list out user-requested outputs - TYPE(SrvD_ParameterType), INTENT(INOUT) :: p ! The module parameters - INTEGER(IntKi), INTENT(OUT) :: ErrStat ! The error status code - CHARACTER(*), INTENT(OUT) :: ErrMsg ! The error message, if an error occurred - - ! Local variables - INTEGER :: ErrStat2 ! temporary (local) error status - INTEGER :: I ! Generic loop-counting index - INTEGER :: INDX ! Index for valid arrays - - LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) - LOGICAL :: InvalidOutput(0:MaxOutPts) ! This array determines if the output channel is valid for this configuration - CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) - CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam" - - CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(22) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically - "BLAIRFLC1","BLAIRFLC2","BLAIRFLC3","BLFLAP1 ","BLFLAP2 ","BLFLAP3 ","BLPITCHC1", & - "BLPITCHC2","BLPITCHC3","GENPWR ","GENTQ ","HSSBRTQC ","NTMD_XQ ","NTMD_XQD ", & - "NTMD_YQ ","NTMD_YQD ","TTMD_XQ ","TTMD_XQD ","TTMD_YQ ","TTMD_YQD ","YAWMOM ", & - "YAWMOMCOM"/) - INTEGER(IntKi), PARAMETER :: ParamIndxAry(22) = (/ & ! This lists the index into AllOuts(:) of the allowed parameters ValidParamAry(:) - BlAirFlC1 , BlAirFlC2 , BlAirFlC3 , BlAirFlC1 , BlAirFlC2 , BlAirFlC3 , BlPitchC1 , & - BlPitchC2 , BlPitchC3 , GenPwr , GenTq , HSSBrTqC , NTMD_XQ , NTMD_XQD , & - NTMD_YQ , NTMD_YQD , TTMD_XQ , TTMD_XQD , TTMD_YQ , TTMD_YQD , YawMomCom , & - YawMomCom /) - CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(22) = (/ & ! This lists the units corresponding to the allowed parameters - "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ","(deg) ", & - "(deg) ","(deg) ","(kW) ","(kN-m) ","(kN-m) ","(m) ","(m/s) ", & - "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ","(kN-m) ", & - "(kN-m) "/) - - - ! Initialize values - ErrStat = ErrID_None - ErrMsg = "" - InvalidOutput = .FALSE. - - - ! Determine which inputs are not valid - - InvalidOutput(BlAirFlC3) = ( p%NumBl < 3 ) - InvalidOutput( BlPitchC3) = ( p%NumBl < 3 ) - InvalidOutput( NTMD_XQ) = ( .not. p%CompNTMD ) - InvalidOutput( NTMD_XQD) = ( .not. p%CompNTMD ) - InvalidOutput( NTMD_YQ) = ( .not. p%CompNTMD ) - InvalidOutput( NTMD_YQD) = ( .not. p%CompNTMD ) - InvalidOutput( TTMD_XQ) = ( .not. p%CompTTMD ) - InvalidOutput( TTMD_XQD) = ( .not. p%CompTTMD ) - InvalidOutput( TTMD_YQ) = ( .not. p%CompTTMD ) - InvalidOutput( TTMD_YQD) = ( .not. p%CompTTMD ) - - - !------------------------------------------------------------------------------------------------- - ! Allocate and set index, name, and units for the output channels - ! If a selected output channel is not available in this module, set error flag. - !------------------------------------------------------------------------------------------------- - - ALLOCATE ( p%OutParam(0:p%NumOuts) , STAT=ErrStat2 ) - IF ( ErrStat2 /= 0_IntKi ) THEN - CALL SetErrStat( ErrID_Fatal,"Error allocating memory for the ServoDyn OutParam array.", ErrStat, ErrMsg, RoutineName ) - RETURN - ENDIF - - ! Set index, name, and units for the time output channel: - - p%OutParam(0)%Indx = Time - p%OutParam(0)%Name = "Time" ! OutParam(0) is the time channel by default. - p%OutParam(0)%Units = "(s)" - p%OutParam(0)%SignM = 1 - - - ! Set index, name, and units for all of the output channels. - ! If a selected output channel is not available by this module set ErrStat = ErrID_Warn. - - DO I = 1,p%NumOuts - - p%OutParam(I)%Name = OutList(I) - OutListTmp = OutList(I) - - ! Reverse the sign (+/-) of the output channel if the user prefixed the - ! channel name with a "-", "_", "m", or "M" character indicating "minus". - - - CheckOutListAgain = .FALSE. - - IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN - p%OutParam(I)%SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched. - OutListTmp = OutListTmp(2:) - ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name) - CheckOutListAgain = .TRUE. - p%OutParam(I)%SignM = 1 - ELSE - p%OutParam(I)%SignM = 1 - END IF - - CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case - - - Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) - - - ! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1) - - IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again - p%OutParam(I)%SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched. - OutListTmp = OutListTmp(2:) - - Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) - END IF - - - IF ( Indx > 0 ) THEN ! we found the channel name - p%OutParam(I)%Indx = ParamIndxAry(Indx) - IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings - p%OutParam(I)%Units = "INVALID" - p%OutParam(I)%SignM = 0 - ELSE - p%OutParam(I)%Units = ParamUnitsAry(Indx) ! it's a valid output - END IF - ELSE ! this channel isn't valid - p%OutParam(I)%Indx = Time ! pick any valid channel (I just picked "Time" here because it's universal) - p%OutParam(I)%Units = "INVALID" - p%OutParam(I)%SignM = 0 ! multiply all results by zero + ENDIF - CALL SetErrStat(ErrID_Fatal, TRIM(p%OutParam(I)%Name)//" is not an available output channel.",ErrStat,ErrMsg,RoutineName) - END IF + ENDDO ! K - blades - END DO - RETURN -END SUBROUTINE SetOutParam +END SUBROUTINE Pitch_UpdateStates !---------------------------------------------------------------------------------------------------------------------------------- -!End of code generated by Matlab script -!********************************************************************************************************************************** !---------------------------------------------------------------------------------------------------------------------------------- !> Routine for computing the tip-brake output: TBDrCon. This routine is used in both loose and tight coupling. @@ -3483,8 +2836,8 @@ SUBROUTINE TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables INTEGER(IntKi) :: K ! counter for blades @@ -3497,9 +2850,9 @@ SUBROUTINE TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er !................................................................... ! Calculate standard tip brake commands: !................................................................... - + DO K = 1,p%NumBl - + IF ( OtherState%BegTpBr(K) ) THEN ! The tip brakes have been deployed. y%TBDrCon(K) = p%TBDrConN + ( p%TBDrConD - p%TBDrConN ) * TBFract( t, OtherState%TTpBrDp(K), OtherState%TTpBrFl(K) ) @@ -3509,8 +2862,8 @@ SUBROUTINE TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, Er y%TBDrCon(K) = p%TBDrConN ENDIF - - END DO + + END DO !returns TBDrCon, or N and D part of ElastoDyn, return 0<=TBFrac<=1, consistant with other controllers END SUBROUTINE TipBrake_CalcOutput @@ -3534,8 +2887,8 @@ FUNCTION TBFract( t, BrakStrt, BrakEnd ) REAL(DbKi) :: TmpVar ! A temporary variable - - + + IF ( t <= BrakStrt ) THEN TBFract = 0.0 @@ -3572,8 +2925,8 @@ SUBROUTINE TipBrake_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, Err TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables + + ! local variables INTEGER(IntKi) :: K ! counter for blades @@ -3586,9 +2939,9 @@ SUBROUTINE TipBrake_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, Err !................................................................... ! Determine if tip brakes should be deployed: !................................................................... - + DO K = 1,p%NumBl - + IF ( .not. OtherState%BegTpBr(k) ) THEN ! The tip brakes have not been deployed yet IF ( u%RotSpeed >= p%TBDepISp(K) ) THEN ! The tip brakes deploy due to speed @@ -3598,10 +2951,10 @@ SUBROUTINE TipBrake_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, Err OtherState%TTpBrFl(K) = t + p%TpBrDT ! time fully deployed (100%) ENDIF - + END IF - - END DO + + END DO END SUBROUTINE TipBrake_UpdateStates !------------------------------------------------------------------------------------------------------------------------------- @@ -3624,7 +2977,7 @@ SUBROUTINE Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! Local variables: - REAL(ReKi) :: HSSBrFrac ! Fraction of full braking torque {0 (off) <= HSSBrFrac <= 1 (full)} (-) + REAL(ReKi) :: HSSBrFrac ! Fraction of full braking torque {0 (off) <= HSSBrFrac <= 1 (full)} (-) @@ -3633,11 +2986,11 @@ SUBROUTINE Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ErrMsg = '' - + !................................................................................. ! Calculate generator torque (y%GenTrq) and electrical power (y%ElecPwr): !................................................................................. - + IF ( OtherState%GenOnLine .and. .not. OtherState%Off4Good ) THEN ! Generator is on line. CALL CalculateTorque( t, u, p, m, y%GenTrq, y%ElecPwr, ErrStat, ErrMsg ) if (ErrStat >= AbortErrLev) return @@ -3673,11 +3026,11 @@ SUBROUTINE Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM SELECT CASE ( p%HSSBrMode ) ! Which HSS brake model are we using? - + CASE ( ControlMode_NONE) ! None - + HSSBrFrac = 0.0_ReKi - + CASE ( ControlMode_SIMPLE ) ! Simple built-in HSS brake model with linear ramp. IF ( t < p%THSSBrFl ) THEN ! Linear ramp @@ -3699,7 +3052,7 @@ SUBROUTINE Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM !!!CASE ( ControlMode_DLL ) ! User-defined HSS brake model from Bladed-style DLL !!! !!! HSSBrFrac = 1.0_ReKi ! just a placeholder, since it never reaches this case - + CASE ( ControlMode_EXTERN ) ! HSS brake model from LabVIEW. HSSBrFrac = u%ExternalHSSBrFrac @@ -3707,22 +3060,22 @@ SUBROUTINE Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ENDSELECT HSSBrFrac = MAX( MIN( HSSBrFrac, 1.0_ReKi ), 0.0_ReKi ) ! make sure we didn't get outside the acceptable range: 0 (off) <= HSSBrFrac <= 1 (full) - + ENDIF - + ! Calculate the magnitude of HSS brake torque: !y%HSSBrTrqC = SIGN( HSSBrFrac*p%HSSBrTqF, u%HSS_Spd ) ! Scale the full braking torque by the brake torque fraction and make sure the brake torque resists motion. y%HSSBrTrqC = HSSBrFrac*p%HSSBrTqF ! Scale the full braking torque by the brake torque fraction (don't worry about the sign here). - + END IF - + ! to avoid issues with ElastoDyn extrapolating between +/- p%HSSBrTqF, we're going to make this output always positive y%HSSBrTrqC = ABS(y%HSSBrTrqC) - + RETURN - + END SUBROUTINE Torque_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- !> This routine updates the other states of the torque control: GenOnLine, and Off4Good @@ -3744,7 +3097,7 @@ SUBROUTINE Torque_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMs INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! Local variables: REAL(ReKi) :: GenTrq !< generator torque REAL(ReKi) :: ElecPwr !< electrical power @@ -3758,7 +3111,7 @@ SUBROUTINE Torque_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMs ! See if the generator is on line. IF ( .not. OtherState%Off4Good ) THEN - + ! The generator is either on-line or has never been turned online. IF ( OtherState%GenOnLine ) THEN ! The generator is on-line. @@ -3789,18 +3142,18 @@ SUBROUTINE Torque_UpdateStates( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMs ! Lets turn the generator offline for good if ( GenTiStp = .FALSE. ) .AND. ( ElecPwr <= 0.0 ): IF ( ( .NOT. p%GenTiStp ) ) then - - CALL CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) + + CALL CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) if (ErrStat >= AbortErrLev) return - + IF ( ElecPwr <= 0.0_ReKi ) THEN ! Shut-down of generator determined by generator power = 0 OtherState%Off4Good = .true. END IF - + END IF ENDIF - + END SUBROUTINE Torque_UpdateStates !---------------------------------------------------------------------------------------------------------------------------------- !> This routine calculates the drive-train torque (GenTrq, ElecPwr) assuming the generator is on. @@ -3811,7 +3164,7 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - + REAL(ReKi), INTENT( OUT) :: GenTrq !< generator torque command REAL(ReKi), INTENT( OUT) :: ElecPwr !< electrical power INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -3822,16 +3175,16 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) COMPLEX(ReKi) :: Current1 ! Current passing through the stator (amps) COMPLEX(ReKi) :: Current2 ! Current passing through the rotor (amps) COMPLEX(ReKi) :: Currentm ! Magnitizing current (amps) - + REAL(ReKi) :: ComDenom ! Common denominator of variables used in the TEC model REAL(ReKi) :: PwrLossS ! Power loss in the stator (watts) REAL(ReKi) :: PwrLossR ! Power loss in the rotor (watts) REAL(ReKi) :: PwrMech ! Mechanical power (watts) REAL(ReKi) :: Slip ! Generator slip REAL(ReKi) :: SlipRat ! Generator slip ratio - + REAL(ReKi) :: S2 ! SlipRat**2 - + character(*), parameter :: RoutineName = 'CalculateTorque' ! Initialize variables @@ -3840,7 +3193,7 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) GenTrq = 0.0_ReKi ElecPwr = 0.0_ReKi - + ! Are we doing simple variable-speed control, or using a generator model? @@ -3861,7 +3214,7 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) ELSE GenTrq = Slip*p%SIG_Slop ENDIF - + ElecPwr = CalculateElecPwr( GenTrq, u, p ) @@ -3876,19 +3229,19 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) ! trying to refactor so we don't divide by SlipRat, which may be 0 ! jmj tells me I need not worry about ComDenom being zero because these equations behave nicely S2 = SlipRat**2 - - ComDenom = ( SlipRat*p%TEC_Re1 - p%TEC_RRes )**2 + (SlipRat*( p%TEC_Xe1 + p%TEC_RLR ))**2 + + ComDenom = ( SlipRat*p%TEC_Re1 - p%TEC_RRes )**2 + (SlipRat*( p%TEC_Xe1 + p%TEC_RLR ))**2 Current2 = CMPLX( p%TEC_V1a*SlipRat*( SlipRat*p%TEC_Re1 - p%TEC_RRes )/ComDenom , & - -p%TEC_V1a*S2 *( p%TEC_Xe1 + p%TEC_RLR )/ComDenom ) - Currentm = CMPLX( 0.0_ReKi , -p%TEC_V1a/p%TEC_MR ) + -p%TEC_V1a*S2 *( p%TEC_Xe1 + p%TEC_RLR )/ComDenom ) + Currentm = CMPLX( 0.0_ReKi , -p%TEC_V1a/p%TEC_MR ) Current1 = Current2 + Currentm - + PwrLossS = 3.0*( ( ABS( Current1 ) )**2 )*p%TEC_SRes PwrLossR = 3.0*( ( ABS( Current2 ) )**2 )*p%TEC_RRes - + PwrMech = GenTrq*u%HSS_Spd ElecPwr = PwrMech - PwrLossS - PwrLossR - + CASE ( ControlMode_USER ) ! User-defined generator model. @@ -3907,9 +3260,9 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) call SetErrStat( ErrID_Fatal, "u%HSS_Spd is negative. Simple variable-speed control model "//& "is not valid for motoring situations.", ErrStat, ErrMsg, RoutineName) return - end if + end if end if - + ! Compute the generator torque, which depends on which region we are in: IF ( u%HSS_Spd >= p%VS_RtGnSp ) THEN ! We are in region 3 - torque is constant @@ -3932,21 +3285,21 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) CALL UserVSCont ( u%HSS_Spd, u%LSS_Spd, p%NumBl, t, p%DT, p%GenEff, 0.0_ReKi, p%RootName, GenTrq, ElecPwr ) CASE ( ControlMode_DLL ) ! User-defined variable-speed control from Bladed-style DLL - + ! bjj: I believe this is how the old logic worked, but perhaps now we can be more clever about checking if the generator is off - - IF ( m%dll_data%GenState /= 0_IntKi ) THEN ! generator is on - + + IF ( m%dll_data%GenState /= 0_IntKi ) THEN ! generator is on + GenTrq = m%dll_data%GenTrq ElecPwr = CalculateElecPwr( GenTrq, u, p ) - + ELSE ! generator is off - + GenTrq = 0.0_ReKi ElecPwr = 0.0_ReKi - + END IF - + CASE ( ControlMode_EXTERN ) ! User-defined variable-speed control from Simulink or LabVIEW. GenTrq = u%ExternalGenTrq @@ -3962,18 +3315,18 @@ SUBROUTINE CalculateTorque( t, u, p, m, GenTrq, ElecPwr, ErrStat, ErrMsg ) ElecPwr = 0.0_ReKi ENDIF - + END SUBROUTINE CalculateTorque !---------------------------------------------------------------------------------------------------------------------------------- !> This routine calculates the electrical power (ElecPwr) after the electrical generator torque (GenTrq) has been calculated. FUNCTION CalculateElecPwr( GenTrq, u, p ) !............................................................................................................................... -REAL(ReKi), INTENT(IN) :: GenTrq !< generator torque computed at t +REAL(ReKi), INTENT(IN) :: GenTrq !< generator torque computed at t TYPE(SrvD_InputType), INTENT(IN) :: u !< Inputs at t TYPE(SrvD_ParameterType), INTENT(IN) :: p !< Parameters - + REAL(ReKi) :: CalculateElecPwr !< The result of this function - + !! The generator efficiency is either additive for motoring, !! or subtractive for generating power. @@ -3981,8 +3334,8 @@ FUNCTION CalculateElecPwr( GenTrq, u, p ) CalculateElecPwr = GenTrq * u%HSS_Spd * p%GenEff ELSE CalculateElecPwr = GenTrq * u%HSS_Spd / p%GenEff - ENDIF - + ENDIF + END FUNCTION CalculateElecPwr !---------------------------------------------------------------------------------------------------------------------------------- !> This routine calculates the partials with respect to inputs of the drive-train torque outputs: GenTrq and ElecPwr @@ -4002,16 +3355,16 @@ SUBROUTINE Torque_JacobianPInput( t, u, p, x, xd, z, OtherState, m, GenTrq_du, E INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - + ! Initialize variables ErrStat = ErrID_None ErrMsg = '' - + !................................................................................. ! Calculate generator torque (y%GenTrq) and electrical power (y%ElecPwr): !................................................................................. - + IF ( OtherState%GenOnLine .and. .not. OtherState%Off4Good ) THEN ! Generator is on line. CALL CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, ErrMsg ) if (ErrStat >= AbortErrLev) return @@ -4020,14 +3373,14 @@ SUBROUTINE Torque_JacobianPInput( t, u, p, x, xd, z, OtherState, m, GenTrq_du, E ElecPwr_du = 0.0_R8Ki ENDIF - + !................................................................................. ! Calculate the fraction of applied HSS-brake torque, HSSBrFrac: !................................................................................. ! we're ignorming HSSBrFrac in linearization - + RETURN - + END SUBROUTINE Torque_JacobianPInput !---------------------------------------------------------------------------------------------------------------------------------- !> This routine calculates jacobians (with respect to u%HSS_Spd) of the drive-train torque (GenTrq, ElecPwr) assuming the generator is on. @@ -4038,7 +3391,7 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - + REAL(R8Ki), INTENT( OUT) :: GenTrq_du !< partial generator torque / partial u%HSS_Spd REAL(R8Ki), INTENT( OUT) :: ElecPwr_du !< partialelectrical power / partial u%HSS_Spd INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation @@ -4050,21 +3403,21 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, REAL(R8Ki) :: Current1_i, Current1_i_du ! Current passing through the stator (amps) and its derivative w.r.t. u%HSS_Spd REAL(R8Ki) :: Current2_r, Current2_r_du ! Current passing through the rotor (amps) and its derivative w.r.t. u%HSS_Spd REAL(R8Ki) :: Current2_i, Current2_i_du ! Current passing through the rotor (amps) and its derivative w.r.t. u%HSS_Spd - + REAL(R8Ki) :: GenTrq ! generator torque - + REAL(R8Ki) :: ComDenom, ComDenom_du ! temporary variable (common denominator) - REAL(R8Ki) :: PwrLossS_du ! Power loss in the stator (watts) and its derivative w.r.t. u%HSS_Spd - REAL(R8Ki) :: PwrLossR_du ! Power loss in the rotor (watts) and its derivative w.r.t. u%HSS_Spd + REAL(R8Ki) :: PwrLossS_du ! Power loss in the stator (watts) and its derivative w.r.t. u%HSS_Spd + REAL(R8Ki) :: PwrLossR_du ! Power loss in the rotor (watts) and its derivative w.r.t. u%HSS_Spd REAL(R8Ki) :: PwrMech_du ! partial derivative of Mechanical power (watts) w.r.t. u%HSS_Spd REAL(R8Ki) :: Slip ! Generator slip REAL(R8Ki) :: SlipRat ! Generator slip ratio - + REAL(R8Ki) :: A, B, dAdu, dBdu REAL(R8Ki) :: SlipRat_du ! temporary variables for computing derivatives - + !REAL(ReKi) :: S2 ! SlipRat**2 - + character(*), parameter :: RoutineName = 'CalculateTorqueJacobian' ! Initialize variables @@ -4073,7 +3426,7 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, GenTrq_du = 0.0_R8Ki ElecPwr_du = 0.0_R8Ki - + ! Are we doing simple variable-speed control, or using a generator model? @@ -4097,70 +3450,70 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, ENDIF ! Calculate the electrical powerF - ! As generator: ElecPwr = GenTrq * u%HSS_Spd * m%GenEff - ! As motor: ElecPwr = GenTrq * u%HSS_Spd / m%GenEff + ! As generator: ElecPwr = GenTrq * u%HSS_Spd * m%GenEff + ! As motor: ElecPwr = GenTrq * u%HSS_Spd / m%GenEff IF ( GenTrq >= 0.0_R8Ki ) THEN - !ElecPwr = GenTrq * u%HSS_Spd * p%GenEff + !ElecPwr = GenTrq * u%HSS_Spd * p%GenEff ElecPwr_du = (GenTrq_du * u%HSS_Spd + GenTrq) * p%GenEff ELSE - !ElecPwr = GenTrq * u%HSS_Spd / p%GenEff - ElecPwr_du = (GenTrq_du * u%HSS_Spd + GenTrq) / p%GenEff + !ElecPwr = GenTrq * u%HSS_Spd / p%GenEff + ElecPwr_du = (GenTrq_du * u%HSS_Spd + GenTrq) / p%GenEff ENDIF - + CASE ( ControlMode_ADVANCED ) ! Thevenin-equivalent generator model. - + SlipRat = ( u%HSS_Spd - p%TEC_SySp )/p%TEC_SySp SlipRat_du = 1.0_R8Ki / p%TEC_SySp - + A = p%TEC_A0*(p%TEC_VLL**2)*SlipRat B = p%TEC_C0 + p%TEC_C1*SlipRat + p%TEC_C2*(SlipRat**2) dAdu = p%TEC_A0*(p%TEC_VLL**2)*SlipRat_du dBdu = p%TEC_C1*SlipRat_du + 2.0_R8Ki*p%TEC_C2*SlipRat*SlipRat_du - + GenTrq = A / B GenTrq_du = dAdu / B - A/B**2 * dBdu - + A = SlipRat*p%TEC_Re1 - p%TEC_RRes B = SlipRat*( p%TEC_Xe1 + p%TEC_RLR ) dAdu = SlipRat_du * p%TEC_Re1 dBdu = SlipRat_du * (p%TEC_Xe1 + p%TEC_RLR) - - ComDenom = A**2 + B**2 + + ComDenom = A**2 + B**2 ComDenom_du = 2.0_R8Ki * A * dAdu + 2.0_R8Ki * B * dBdu - - + + A = SlipRat**2*p%TEC_Re1 - SlipRat*p%TEC_RRes dAdu = 2.0_R8Ki * SlipRat * SlipRat_du * p%TEC_Re1 - SlipRat_du * p%TEC_RRes Current2_r = p%TEC_V1a*A/ComDenom Current2_r_du = p%TEC_V1a*(dAdu/ComDenom - A/ComDenom**2 * ComDenom_du) - + Current2_i = -p%TEC_V1a*( p%TEC_Xe1 + p%TEC_RLR )*SlipRat**2/ComDenom Current2_i_du = -p%TEC_V1a*( p%TEC_Xe1 + p%TEC_RLR ) * ( 2.0_R8Ki*SlipRat*SlipRat_du / ComDenom - SlipRat**2/(ComDenom**2) * ComDenom_du) - + Current1_r = Current2_r - Current1_i = Current2_i - p%TEC_V1a/p%TEC_MR + Current1_i = Current2_i - p%TEC_V1a/p%TEC_MR Current1_r_du = Current2_r_du Current1_i_du = Current2_i_du - + !PwrLossS = 3.0*( Current1_r**2 + Current1_i**2 )*p%TEC_SRes PwrLossS_du = 3.0_R8Ki*p%TEC_SRes*( 2.0_R8Ki*Current1_r*Current1_r_du + 2.0_R8Ki*Current1_i*Current1_i_du ) - + !PwrLossR = 3.0*( Current2_r**2 + Current2_i**2 )*p%TEC_RRes PwrLossR_du = 3.0_R8Ki*p%TEC_RRes*( 2.0_R8Ki*Current2_r*Current2_r_du + 2.0_R8Ki*Current2_i*Current2_i_du ) - + !PwrMech = GenTrq*u%HSS_Spd PwrMech_du = GenTrq_du * u%HSS_Spd + GenTrq - + !ElecPwr = PwrMech - PwrLossS - PwrLossR - ElecPwr_du = PwrMech_du - PwrLossS_du - PwrLossR_du - + ElecPwr_du = PwrMech_du - PwrLossS_du - PwrLossR_du + CASE ( ControlMode_USER ) ! User-defined generator model. ! we should not get here (initialization should have caught this issue) - + GenTrq_du = 0.0_R8Ki ElecPwr_du = 0.0_R8Ki @@ -4175,9 +3528,9 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, call SetErrStat( ErrID_Fatal, "u%HSS_Spd is negative. Simple variable-speed control model "//& "is not valid for motoring situations.", ErrStat, ErrMsg, RoutineName) return - end if + end if end if - + ! Compute the generator torque, which depends on which region we are in: IF ( u%HSS_Spd >= p%VS_RtGnSp ) THEN ! We are in region 3 - torque is constant @@ -4189,24 +3542,24 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, ELSE ! We are in region 2 1/2 - simple induction generator transition region GenTrq = p%VS_Slope*( u%HSS_Spd - p%VS_SySp ) GenTrq_du = p%VS_Slope - ENDIF - + ENDIF + ! It's not possible to motor using this control scheme, so the generator efficiency is always subtractive. ElecPwr_du = (GenTrq_du * u%HSS_Spd + GenTrq) * p%GenEff - + CASE ( ControlMode_USER , & ! User-defined variable-speed control for routine UserVSCont(). - ControlMode_DLL , & ! User-defined variable-speed control from Bladed-style DLL + ControlMode_DLL , & ! User-defined variable-speed control from Bladed-style DLL ControlMode_EXTERN ) ! User-defined variable-speed control from Simulink or LabVIEW. - + ! we should not get here (initialization should have caught this issue) - + GenTrq_du = 0.0_R8Ki ElecPwr_du = 0.0_R8Ki END SELECT - + END SUBROUTINE CalculateTorqueJacobian !---------------------------------------------------------------------------------------------------------------------------------- diff --git a/modules/servodyn/src/ServoDyn_Driver.f90 b/modules/servodyn/src/ServoDyn_Driver.f90 index 7ba7135f3f..3d9734eaa5 100644 --- a/modules/servodyn/src/ServoDyn_Driver.f90 +++ b/modules/servodyn/src/ServoDyn_Driver.f90 @@ -89,18 +89,46 @@ PROGRAM SrvD_Driver InitInData%RootName = OutFile(1:(len_trim(OutFile)-4)) InitInData%NumBl = 3 InitInData%gravity = 9.81 !m/s^2 - InitInData%r_N_O_G = (/ 90.0, 0.0, 0.0 /) ! m, position of nacelle (for NTMD) - InitInData%r_TwrBase = (/ 0.0, 0.0, 0.0 /) ! m, position of tower base (for TTMD) +!FIXME: why are these hard coded!!!? + ! StrucCtrl nacelle position + InitInData%NacPosition = (/ 90.0, 0.0, 0.0 /) ! m, position of nacelle (for NStC) + InitInData%NacOrientation= 0.0_R8Ki + do j=1,3 + InitInData%NacOrientation(j,j) = 1.0_R8Ki + enddo + ! StrucCtrl tower + InitInData%TwrBasePos = (/ 0.0, 0.0, 0.0 /) ! m, position of tower base (for TStC) + InitInData%TwrBaseOrient = 0.0_R8Ki + do j=1,3 + InitInData%TwrBaseOrient(j,j) = 1.0_R8Ki + enddo + ! StrucCtrl single blade + call AllocAry(InitInData%BladeRootPosition, 3,1, 'InitInData%BladeRootPosition', ErrStat,ErrMsg) + IF ( ErrStat /= ErrID_None ) THEN + CALL WrScr( ErrMsg ) + IF (ErrStat >= AbortErrLev) call ProgAbort('') + END IF + call AllocAry(InitInData%BladeRootOrientation, 3,3,1, 'InitInData%BladeRootOrientation',ErrStat,ErrMsg) + IF ( ErrStat /= ErrID_None ) THEN + CALL WrScr( ErrMsg ) + IF (ErrStat >= AbortErrLev) call ProgAbort('') + END IF + InitInData%BladeRootPosition(1:3,1) = (/ 0.0, 0.0, 0.0 /) ! m, position of blade root (for BStC) + InitInData%BladeRootOrientation = 0.0_R8Ki + do j=1,3 + InitInData%BladeRootOrientation(j,j,1) = 1.0_R8Ki + enddo InitInData%TMax = 10.0 !s InitInData%AirDens = 1.225 !kg/m^3 InitInData%AvgWindSpeed = 10.0 !m/s InitInData%Linearize = .false. - InitInData%NumSC2Ctrl = 0 - InitInData%NumCtrl2SC = 0 + InitInData%NumSC2Ctrl = 0 ! SuperController + InitInData%NumCtrl2SC = 0 ! SuperController CALL AllocAry(InitInData%BlPitchInit, InitInData%NumBl, 'BlPitchInit', ErrStat, ErrMsg) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) + IF (ErrStat >= AbortErrLev) call ProgAbort('') END IF InitInData%BlPitchInit = 5.0*pi/180.0 ! radians diff --git a/modules/servodyn/src/ServoDyn_IO.f90 b/modules/servodyn/src/ServoDyn_IO.f90 new file mode 100644 index 0000000000..b9e01b6e7f --- /dev/null +++ b/modules/servodyn/src/ServoDyn_IO.f90 @@ -0,0 +1,2306 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2013-2016 National Renewable Energy Laboratory +! +! This file is part of FAST's Controls and Electrical Drive Module, "ServoDyn". +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +!> Control and electrical drive dynamics module for FAST +MODULE ServoDyn_IO + + USE ServoDyn_Types + USE NWTC_Library + USE StrucCtrl_Types + + + IMPLICIT NONE + + +! =================================================================================================== +! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" +! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these +! lines should be modified in the Matlab script and/or Excel worksheet as necessary. +! =================================================================================================== +! This code was generated by Write_ChckOutLst.m at 04-Feb-2021 08:42:27. + + + ! Parameters related to output length (number of characters allowed in the output data headers): + + INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 + + + ! Indices for computing output channels: + ! NOTES: + ! (1) These parameters are in the order stored in "OutListParameters.xlsx" + ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter + + ! Time: + + INTEGER(IntKi), PARAMETER :: Time = 0 + + + ! Airfoil control: + + INTEGER(IntKi), PARAMETER :: BlAirFlC1 = 1 + INTEGER(IntKi), PARAMETER :: BlAirFlC2 = 2 + INTEGER(IntKi), PARAMETER :: BlAirFlC3 = 3 + + + ! Pitch Control: + + INTEGER(IntKi), PARAMETER :: BlPitchC1 = 4 + INTEGER(IntKi), PARAMETER :: BlPitchC2 = 5 + INTEGER(IntKi), PARAMETER :: BlPitchC3 = 6 + + + ! Generator and Torque Control: + + INTEGER(IntKi), PARAMETER :: GenTq = 7 + INTEGER(IntKi), PARAMETER :: GenPwr = 8 + + + ! High Speed Shaft Brake: + + INTEGER(IntKi), PARAMETER :: HSSBrTqC = 9 + + + ! Nacelle Yaw Control: + + INTEGER(IntKi), PARAMETER :: YawMomCom = 10 + + + ! Nacelle Structural Control (StC): + + INTEGER(IntKi), PARAMETER :: NStC1_XQ = 11 + INTEGER(IntKi), PARAMETER :: NStC1_XQD = 12 + INTEGER(IntKi), PARAMETER :: NStC1_YQ = 13 + INTEGER(IntKi), PARAMETER :: NStC1_YQD = 14 + INTEGER(IntKi), PARAMETER :: NStC1_ZQ = 15 + INTEGER(IntKi), PARAMETER :: NStC1_ZQD = 16 + INTEGER(IntKi), PARAMETER :: NStC1_Fxi = 17 + INTEGER(IntKi), PARAMETER :: NStC1_Fyi = 18 + INTEGER(IntKi), PARAMETER :: NStC1_Fzi = 19 + INTEGER(IntKi), PARAMETER :: NStC1_Mxi = 20 + INTEGER(IntKi), PARAMETER :: NStC1_Myi = 21 + INTEGER(IntKi), PARAMETER :: NStC1_Mzi = 22 + INTEGER(IntKi), PARAMETER :: NStC1_Fxl = 23 + INTEGER(IntKi), PARAMETER :: NStC1_Fyl = 24 + INTEGER(IntKi), PARAMETER :: NStC1_Fzl = 25 + INTEGER(IntKi), PARAMETER :: NStC1_Mxl = 26 + INTEGER(IntKi), PARAMETER :: NStC1_Myl = 27 + INTEGER(IntKi), PARAMETER :: NStC1_Mzl = 28 + INTEGER(IntKi), PARAMETER :: NStC2_XQ = 29 + INTEGER(IntKi), PARAMETER :: NStC2_XQD = 30 + INTEGER(IntKi), PARAMETER :: NStC2_YQ = 31 + INTEGER(IntKi), PARAMETER :: NStC2_YQD = 32 + INTEGER(IntKi), PARAMETER :: NStC2_ZQ = 33 + INTEGER(IntKi), PARAMETER :: NStC2_ZQD = 34 + INTEGER(IntKi), PARAMETER :: NStC2_Fxi = 35 + INTEGER(IntKi), PARAMETER :: NStC2_Fyi = 36 + INTEGER(IntKi), PARAMETER :: NStC2_Fzi = 37 + INTEGER(IntKi), PARAMETER :: NStC2_Mxi = 38 + INTEGER(IntKi), PARAMETER :: NStC2_Myi = 39 + INTEGER(IntKi), PARAMETER :: NStC2_Mzi = 40 + INTEGER(IntKi), PARAMETER :: NStC2_Fxl = 41 + INTEGER(IntKi), PARAMETER :: NStC2_Fyl = 42 + INTEGER(IntKi), PARAMETER :: NStC2_Fzl = 43 + INTEGER(IntKi), PARAMETER :: NStC2_Mxl = 44 + INTEGER(IntKi), PARAMETER :: NStC2_Myl = 45 + INTEGER(IntKi), PARAMETER :: NStC2_Mzl = 46 + INTEGER(IntKi), PARAMETER :: NStC3_XQ = 47 + INTEGER(IntKi), PARAMETER :: NStC3_XQD = 48 + INTEGER(IntKi), PARAMETER :: NStC3_YQ = 49 + INTEGER(IntKi), PARAMETER :: NStC3_YQD = 50 + INTEGER(IntKi), PARAMETER :: NStC3_ZQ = 51 + INTEGER(IntKi), PARAMETER :: NStC3_ZQD = 52 + INTEGER(IntKi), PARAMETER :: NStC3_Fxi = 53 + INTEGER(IntKi), PARAMETER :: NStC3_Fyi = 54 + INTEGER(IntKi), PARAMETER :: NStC3_Fzi = 55 + INTEGER(IntKi), PARAMETER :: NStC3_Mxi = 56 + INTEGER(IntKi), PARAMETER :: NStC3_Myi = 57 + INTEGER(IntKi), PARAMETER :: NStC3_Mzi = 58 + INTEGER(IntKi), PARAMETER :: NStC3_Fxl = 59 + INTEGER(IntKi), PARAMETER :: NStC3_Fyl = 60 + INTEGER(IntKi), PARAMETER :: NStC3_Fzl = 61 + INTEGER(IntKi), PARAMETER :: NStC3_Mxl = 62 + INTEGER(IntKi), PARAMETER :: NStC3_Myl = 63 + INTEGER(IntKi), PARAMETER :: NStC3_Mzl = 64 + INTEGER(IntKi), PARAMETER :: NStC4_XQ = 65 + INTEGER(IntKi), PARAMETER :: NStC4_XQD = 66 + INTEGER(IntKi), PARAMETER :: NStC4_YQ = 67 + INTEGER(IntKi), PARAMETER :: NStC4_YQD = 68 + INTEGER(IntKi), PARAMETER :: NStC4_ZQ = 69 + INTEGER(IntKi), PARAMETER :: NStC4_ZQD = 70 + INTEGER(IntKi), PARAMETER :: NStC4_Fxi = 71 + INTEGER(IntKi), PARAMETER :: NStC4_Fyi = 72 + INTEGER(IntKi), PARAMETER :: NStC4_Fzi = 73 + INTEGER(IntKi), PARAMETER :: NStC4_Mxi = 74 + INTEGER(IntKi), PARAMETER :: NStC4_Myi = 75 + INTEGER(IntKi), PARAMETER :: NStC4_Mzi = 76 + INTEGER(IntKi), PARAMETER :: NStC4_Fxl = 77 + INTEGER(IntKi), PARAMETER :: NStC4_Fyl = 78 + INTEGER(IntKi), PARAMETER :: NStC4_Fzl = 79 + INTEGER(IntKi), PARAMETER :: NStC4_Mxl = 80 + INTEGER(IntKi), PARAMETER :: NStC4_Myl = 81 + INTEGER(IntKi), PARAMETER :: NStC4_Mzl = 82 + + + ! Tower Structural Control (StC): + + INTEGER(IntKi), PARAMETER :: TStC1_XQ = 83 + INTEGER(IntKi), PARAMETER :: TStC1_XQD = 84 + INTEGER(IntKi), PARAMETER :: TStC1_YQ = 85 + INTEGER(IntKi), PARAMETER :: TStC1_YQD = 86 + INTEGER(IntKi), PARAMETER :: TStC1_ZQ = 87 + INTEGER(IntKi), PARAMETER :: TStC1_ZQD = 88 + INTEGER(IntKi), PARAMETER :: TStC1_Fxi = 89 + INTEGER(IntKi), PARAMETER :: TStC1_Fyi = 90 + INTEGER(IntKi), PARAMETER :: TStC1_Fzi = 91 + INTEGER(IntKi), PARAMETER :: TStC1_Mxi = 92 + INTEGER(IntKi), PARAMETER :: TStC1_Myi = 93 + INTEGER(IntKi), PARAMETER :: TStC1_Mzi = 94 + INTEGER(IntKi), PARAMETER :: TStC1_Fxl = 95 + INTEGER(IntKi), PARAMETER :: TStC1_Fyl = 96 + INTEGER(IntKi), PARAMETER :: TStC1_Fzl = 97 + INTEGER(IntKi), PARAMETER :: TStC1_Mxl = 98 + INTEGER(IntKi), PARAMETER :: TStC1_Myl = 99 + INTEGER(IntKi), PARAMETER :: TStC1_Mzl = 100 + INTEGER(IntKi), PARAMETER :: TStC2_XQ = 101 + INTEGER(IntKi), PARAMETER :: TStC2_XQD = 102 + INTEGER(IntKi), PARAMETER :: TStC2_YQ = 103 + INTEGER(IntKi), PARAMETER :: TStC2_YQD = 104 + INTEGER(IntKi), PARAMETER :: TStC2_ZQ = 105 + INTEGER(IntKi), PARAMETER :: TStC2_ZQD = 106 + INTEGER(IntKi), PARAMETER :: TStC2_Fxi = 107 + INTEGER(IntKi), PARAMETER :: TStC2_Fyi = 108 + INTEGER(IntKi), PARAMETER :: TStC2_Fzi = 109 + INTEGER(IntKi), PARAMETER :: TStC2_Mxi = 110 + INTEGER(IntKi), PARAMETER :: TStC2_Myi = 111 + INTEGER(IntKi), PARAMETER :: TStC2_Mzi = 112 + INTEGER(IntKi), PARAMETER :: TStC2_Fxl = 113 + INTEGER(IntKi), PARAMETER :: TStC2_Fyl = 114 + INTEGER(IntKi), PARAMETER :: TStC2_Fzl = 115 + INTEGER(IntKi), PARAMETER :: TStC2_Mxl = 116 + INTEGER(IntKi), PARAMETER :: TStC2_Myl = 117 + INTEGER(IntKi), PARAMETER :: TStC2_Mzl = 118 + INTEGER(IntKi), PARAMETER :: TStC3_XQ = 119 + INTEGER(IntKi), PARAMETER :: TStC3_XQD = 120 + INTEGER(IntKi), PARAMETER :: TStC3_YQ = 121 + INTEGER(IntKi), PARAMETER :: TStC3_YQD = 122 + INTEGER(IntKi), PARAMETER :: TStC3_ZQ = 123 + INTEGER(IntKi), PARAMETER :: TStC3_ZQD = 124 + INTEGER(IntKi), PARAMETER :: TStC3_Fxi = 125 + INTEGER(IntKi), PARAMETER :: TStC3_Fyi = 126 + INTEGER(IntKi), PARAMETER :: TStC3_Fzi = 127 + INTEGER(IntKi), PARAMETER :: TStC3_Mxi = 128 + INTEGER(IntKi), PARAMETER :: TStC3_Myi = 129 + INTEGER(IntKi), PARAMETER :: TStC3_Mzi = 130 + INTEGER(IntKi), PARAMETER :: TStC3_Fxl = 131 + INTEGER(IntKi), PARAMETER :: TStC3_Fyl = 132 + INTEGER(IntKi), PARAMETER :: TStC3_Fzl = 133 + INTEGER(IntKi), PARAMETER :: TStC3_Mxl = 134 + INTEGER(IntKi), PARAMETER :: TStC3_Myl = 135 + INTEGER(IntKi), PARAMETER :: TStC3_Mzl = 136 + INTEGER(IntKi), PARAMETER :: TStC4_XQ = 137 + INTEGER(IntKi), PARAMETER :: TStC4_XQD = 138 + INTEGER(IntKi), PARAMETER :: TStC4_YQ = 139 + INTEGER(IntKi), PARAMETER :: TStC4_YQD = 140 + INTEGER(IntKi), PARAMETER :: TStC4_ZQ = 141 + INTEGER(IntKi), PARAMETER :: TStC4_ZQD = 142 + INTEGER(IntKi), PARAMETER :: TStC4_Fxi = 143 + INTEGER(IntKi), PARAMETER :: TStC4_Fyi = 144 + INTEGER(IntKi), PARAMETER :: TStC4_Fzi = 145 + INTEGER(IntKi), PARAMETER :: TStC4_Mxi = 146 + INTEGER(IntKi), PARAMETER :: TStC4_Myi = 147 + INTEGER(IntKi), PARAMETER :: TStC4_Mzi = 148 + INTEGER(IntKi), PARAMETER :: TStC4_Fxl = 149 + INTEGER(IntKi), PARAMETER :: TStC4_Fyl = 150 + INTEGER(IntKi), PARAMETER :: TStC4_Fzl = 151 + INTEGER(IntKi), PARAMETER :: TStC4_Mxl = 152 + INTEGER(IntKi), PARAMETER :: TStC4_Myl = 153 + INTEGER(IntKi), PARAMETER :: TStC4_Mzl = 154 + + + ! Blade Structural Control (StC): + + INTEGER(IntKi), PARAMETER :: BStC1_B1_XQ = 155 + INTEGER(IntKi), PARAMETER :: BStC1_B1_XQD = 156 + INTEGER(IntKi), PARAMETER :: BStC1_B1_YQ = 157 + INTEGER(IntKi), PARAMETER :: BStC1_B1_YQD = 158 + INTEGER(IntKi), PARAMETER :: BStC1_B1_ZQ = 159 + INTEGER(IntKi), PARAMETER :: BStC1_B1_ZQD = 160 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fxi = 161 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fyi = 162 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fzi = 163 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Mxi = 164 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Myi = 165 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Mzi = 166 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fxl = 167 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fyl = 168 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Fzl = 169 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Mxl = 170 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Myl = 171 + INTEGER(IntKi), PARAMETER :: BStC1_B1_Mzl = 172 + INTEGER(IntKi), PARAMETER :: BStC2_B1_XQ = 173 + INTEGER(IntKi), PARAMETER :: BStC2_B1_XQD = 174 + INTEGER(IntKi), PARAMETER :: BStC2_B1_YQ = 175 + INTEGER(IntKi), PARAMETER :: BStC2_B1_YQD = 176 + INTEGER(IntKi), PARAMETER :: BStC2_B1_ZQ = 177 + INTEGER(IntKi), PARAMETER :: BStC2_B1_ZQD = 178 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fxi = 179 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fyi = 180 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fzi = 181 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Mxi = 182 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Myi = 183 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Mzi = 184 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fxl = 185 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fyl = 186 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Fzl = 187 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Mxl = 188 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Myl = 189 + INTEGER(IntKi), PARAMETER :: BStC2_B1_Mzl = 190 + INTEGER(IntKi), PARAMETER :: BStC3_B1_XQ = 191 + INTEGER(IntKi), PARAMETER :: BStC3_B1_XQD = 192 + INTEGER(IntKi), PARAMETER :: BStC3_B1_YQ = 193 + INTEGER(IntKi), PARAMETER :: BStC3_B1_YQD = 194 + INTEGER(IntKi), PARAMETER :: BStC3_B1_ZQ = 195 + INTEGER(IntKi), PARAMETER :: BStC3_B1_ZQD = 196 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fxi = 197 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fyi = 198 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fzi = 199 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Mxi = 200 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Myi = 201 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Mzi = 202 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fxl = 203 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fyl = 204 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Fzl = 205 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Mxl = 206 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Myl = 207 + INTEGER(IntKi), PARAMETER :: BStC3_B1_Mzl = 208 + INTEGER(IntKi), PARAMETER :: BStC4_B1_XQ = 209 + INTEGER(IntKi), PARAMETER :: BStC4_B1_XQD = 210 + INTEGER(IntKi), PARAMETER :: BStC4_B1_YQ = 211 + INTEGER(IntKi), PARAMETER :: BStC4_B1_YQD = 212 + INTEGER(IntKi), PARAMETER :: BStC4_B1_ZQ = 213 + INTEGER(IntKi), PARAMETER :: BStC4_B1_ZQD = 214 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fxi = 215 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fyi = 216 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fzi = 217 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Mxi = 218 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Myi = 219 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Mzi = 220 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fxl = 221 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fyl = 222 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Fzl = 223 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Mxl = 224 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Myl = 225 + INTEGER(IntKi), PARAMETER :: BStC4_B1_Mzl = 226 + INTEGER(IntKi), PARAMETER :: BStC1_B2_XQ = 227 + INTEGER(IntKi), PARAMETER :: BStC1_B2_XQD = 228 + INTEGER(IntKi), PARAMETER :: BStC1_B2_YQ = 229 + INTEGER(IntKi), PARAMETER :: BStC1_B2_YQD = 230 + INTEGER(IntKi), PARAMETER :: BStC1_B2_ZQ = 231 + INTEGER(IntKi), PARAMETER :: BStC1_B2_ZQD = 232 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fxi = 233 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fyi = 234 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fzi = 235 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Mxi = 236 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Myi = 237 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Mzi = 238 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fxl = 239 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fyl = 240 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Fzl = 241 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Mxl = 242 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Myl = 243 + INTEGER(IntKi), PARAMETER :: BStC1_B2_Mzl = 244 + INTEGER(IntKi), PARAMETER :: BStC2_B2_XQ = 245 + INTEGER(IntKi), PARAMETER :: BStC2_B2_XQD = 246 + INTEGER(IntKi), PARAMETER :: BStC2_B2_YQ = 247 + INTEGER(IntKi), PARAMETER :: BStC2_B2_YQD = 248 + INTEGER(IntKi), PARAMETER :: BStC2_B2_ZQ = 249 + INTEGER(IntKi), PARAMETER :: BStC2_B2_ZQD = 250 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fxi = 251 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fyi = 252 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fzi = 253 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Mxi = 254 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Myi = 255 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Mzi = 256 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fxl = 257 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fyl = 258 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Fzl = 259 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Mxl = 260 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Myl = 261 + INTEGER(IntKi), PARAMETER :: BStC2_B2_Mzl = 262 + INTEGER(IntKi), PARAMETER :: BStC3_B2_XQ = 263 + INTEGER(IntKi), PARAMETER :: BStC3_B2_XQD = 264 + INTEGER(IntKi), PARAMETER :: BStC3_B2_YQ = 265 + INTEGER(IntKi), PARAMETER :: BStC3_B2_YQD = 266 + INTEGER(IntKi), PARAMETER :: BStC3_B2_ZQ = 267 + INTEGER(IntKi), PARAMETER :: BStC3_B2_ZQD = 268 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fxi = 269 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fyi = 270 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fzi = 271 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Mxi = 272 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Myi = 273 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Mzi = 274 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fxl = 275 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fyl = 276 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Fzl = 277 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Mxl = 278 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Myl = 279 + INTEGER(IntKi), PARAMETER :: BStC3_B2_Mzl = 280 + INTEGER(IntKi), PARAMETER :: BStC4_B2_XQ = 281 + INTEGER(IntKi), PARAMETER :: BStC4_B2_XQD = 282 + INTEGER(IntKi), PARAMETER :: BStC4_B2_YQ = 283 + INTEGER(IntKi), PARAMETER :: BStC4_B2_YQD = 284 + INTEGER(IntKi), PARAMETER :: BStC4_B2_ZQ = 285 + INTEGER(IntKi), PARAMETER :: BStC4_B2_ZQD = 286 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fxi = 287 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fyi = 288 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fzi = 289 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Mxi = 290 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Myi = 291 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Mzi = 292 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fxl = 293 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fyl = 294 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Fzl = 295 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Mxl = 296 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Myl = 297 + INTEGER(IntKi), PARAMETER :: BStC4_B2_Mzl = 298 + INTEGER(IntKi), PARAMETER :: BStC1_B3_XQ = 299 + INTEGER(IntKi), PARAMETER :: BStC1_B3_XQD = 300 + INTEGER(IntKi), PARAMETER :: BStC1_B3_YQ = 301 + INTEGER(IntKi), PARAMETER :: BStC1_B3_YQD = 302 + INTEGER(IntKi), PARAMETER :: BStC1_B3_ZQ = 303 + INTEGER(IntKi), PARAMETER :: BStC1_B3_ZQD = 304 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fxi = 305 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fyi = 306 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fzi = 307 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Mxi = 308 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Myi = 309 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Mzi = 310 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fxl = 311 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fyl = 312 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Fzl = 313 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Mxl = 314 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Myl = 315 + INTEGER(IntKi), PARAMETER :: BStC1_B3_Mzl = 316 + INTEGER(IntKi), PARAMETER :: BStC2_B3_XQ = 317 + INTEGER(IntKi), PARAMETER :: BStC2_B3_XQD = 318 + INTEGER(IntKi), PARAMETER :: BStC2_B3_YQ = 319 + INTEGER(IntKi), PARAMETER :: BStC2_B3_YQD = 320 + INTEGER(IntKi), PARAMETER :: BStC2_B3_ZQ = 321 + INTEGER(IntKi), PARAMETER :: BStC2_B3_ZQD = 322 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fxi = 323 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fyi = 324 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fzi = 325 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Mxi = 326 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Myi = 327 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Mzi = 328 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fxl = 329 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fyl = 330 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Fzl = 331 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Mxl = 332 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Myl = 333 + INTEGER(IntKi), PARAMETER :: BStC2_B3_Mzl = 334 + INTEGER(IntKi), PARAMETER :: BStC3_B3_XQ = 335 + INTEGER(IntKi), PARAMETER :: BStC3_B3_XQD = 336 + INTEGER(IntKi), PARAMETER :: BStC3_B3_YQ = 337 + INTEGER(IntKi), PARAMETER :: BStC3_B3_YQD = 338 + INTEGER(IntKi), PARAMETER :: BStC3_B3_ZQ = 339 + INTEGER(IntKi), PARAMETER :: BStC3_B3_ZQD = 340 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fxi = 341 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fyi = 342 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fzi = 343 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Mxi = 344 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Myi = 345 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Mzi = 346 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fxl = 347 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fyl = 348 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Fzl = 349 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Mxl = 350 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Myl = 351 + INTEGER(IntKi), PARAMETER :: BStC3_B3_Mzl = 352 + INTEGER(IntKi), PARAMETER :: BStC4_B3_XQ = 353 + INTEGER(IntKi), PARAMETER :: BStC4_B3_XQD = 354 + INTEGER(IntKi), PARAMETER :: BStC4_B3_YQ = 355 + INTEGER(IntKi), PARAMETER :: BStC4_B3_YQD = 356 + INTEGER(IntKi), PARAMETER :: BStC4_B3_ZQ = 357 + INTEGER(IntKi), PARAMETER :: BStC4_B3_ZQD = 358 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fxi = 359 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fyi = 360 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fzi = 361 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Mxi = 362 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Myi = 363 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Mzi = 364 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fxl = 365 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fyl = 366 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Fzl = 367 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Mxl = 368 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Myl = 369 + INTEGER(IntKi), PARAMETER :: BStC4_B3_Mzl = 370 + INTEGER(IntKi), PARAMETER :: BStC1_B4_XQ = 371 + INTEGER(IntKi), PARAMETER :: BStC1_B4_XQD = 372 + INTEGER(IntKi), PARAMETER :: BStC1_B4_YQ = 373 + INTEGER(IntKi), PARAMETER :: BStC1_B4_YQD = 374 + INTEGER(IntKi), PARAMETER :: BStC1_B4_ZQ = 375 + INTEGER(IntKi), PARAMETER :: BStC1_B4_ZQD = 376 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fxi = 377 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fyi = 378 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fzi = 379 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Mxi = 380 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Myi = 381 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Mzi = 382 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fxl = 383 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fyl = 384 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Fzl = 385 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Mxl = 386 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Myl = 387 + INTEGER(IntKi), PARAMETER :: BStC1_B4_Mzl = 388 + INTEGER(IntKi), PARAMETER :: BStC2_B4_XQ = 389 + INTEGER(IntKi), PARAMETER :: BStC2_B4_XQD = 390 + INTEGER(IntKi), PARAMETER :: BStC2_B4_YQ = 391 + INTEGER(IntKi), PARAMETER :: BStC2_B4_YQD = 392 + INTEGER(IntKi), PARAMETER :: BStC2_B4_ZQ = 393 + INTEGER(IntKi), PARAMETER :: BStC2_B4_ZQD = 394 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fxi = 395 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fyi = 396 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fzi = 397 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Mxi = 398 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Myi = 399 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Mzi = 400 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fxl = 401 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fyl = 402 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Fzl = 403 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Mxl = 404 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Myl = 405 + INTEGER(IntKi), PARAMETER :: BStC2_B4_Mzl = 406 + INTEGER(IntKi), PARAMETER :: BStC3_B4_XQ = 407 + INTEGER(IntKi), PARAMETER :: BStC3_B4_XQD = 408 + INTEGER(IntKi), PARAMETER :: BStC3_B4_YQ = 409 + INTEGER(IntKi), PARAMETER :: BStC3_B4_YQD = 410 + INTEGER(IntKi), PARAMETER :: BStC3_B4_ZQ = 411 + INTEGER(IntKi), PARAMETER :: BStC3_B4_ZQD = 412 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fxi = 413 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fyi = 414 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fzi = 415 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Mxi = 416 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Myi = 417 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Mzi = 418 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fxl = 419 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fyl = 420 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Fzl = 421 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Mxl = 422 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Myl = 423 + INTEGER(IntKi), PARAMETER :: BStC3_B4_Mzl = 424 + INTEGER(IntKi), PARAMETER :: BStC4_B4_XQ = 425 + INTEGER(IntKi), PARAMETER :: BStC4_B4_XQD = 426 + INTEGER(IntKi), PARAMETER :: BStC4_B4_YQ = 427 + INTEGER(IntKi), PARAMETER :: BStC4_B4_YQD = 428 + INTEGER(IntKi), PARAMETER :: BStC4_B4_ZQ = 429 + INTEGER(IntKi), PARAMETER :: BStC4_B4_ZQD = 430 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fxi = 431 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fyi = 432 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fzi = 433 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Mxi = 434 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Myi = 435 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Mzi = 436 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fxl = 437 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fyl = 438 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Fzl = 439 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Mxl = 440 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Myl = 441 + INTEGER(IntKi), PARAMETER :: BStC4_B4_Mzl = 442 + + + ! Substructure Structural Control (StC): + + INTEGER(IntKi), PARAMETER :: SStC1_XQ = 443 + INTEGER(IntKi), PARAMETER :: SStC1_XQD = 444 + INTEGER(IntKi), PARAMETER :: SStC1_YQ = 445 + INTEGER(IntKi), PARAMETER :: SStC1_YQD = 446 + INTEGER(IntKi), PARAMETER :: SStC1_ZQ = 447 + INTEGER(IntKi), PARAMETER :: SStC1_ZQD = 448 + INTEGER(IntKi), PARAMETER :: SStC1_Fxi = 449 + INTEGER(IntKi), PARAMETER :: SStC1_Fyi = 450 + INTEGER(IntKi), PARAMETER :: SStC1_Fzi = 451 + INTEGER(IntKi), PARAMETER :: SStC1_Mxi = 452 + INTEGER(IntKi), PARAMETER :: SStC1_Myi = 453 + INTEGER(IntKi), PARAMETER :: SStC1_Mzi = 454 + INTEGER(IntKi), PARAMETER :: SStC1_Fxl = 455 + INTEGER(IntKi), PARAMETER :: SStC1_Fyl = 456 + INTEGER(IntKi), PARAMETER :: SStC1_Fzl = 457 + INTEGER(IntKi), PARAMETER :: SStC1_Mxl = 458 + INTEGER(IntKi), PARAMETER :: SStC1_Myl = 459 + INTEGER(IntKi), PARAMETER :: SStC1_Mzl = 460 + INTEGER(IntKi), PARAMETER :: SStC2_XQ = 461 + INTEGER(IntKi), PARAMETER :: SStC2_XQD = 462 + INTEGER(IntKi), PARAMETER :: SStC2_YQ = 463 + INTEGER(IntKi), PARAMETER :: SStC2_YQD = 464 + INTEGER(IntKi), PARAMETER :: SStC2_ZQ = 465 + INTEGER(IntKi), PARAMETER :: SStC2_ZQD = 466 + INTEGER(IntKi), PARAMETER :: SStC2_Fxi = 467 + INTEGER(IntKi), PARAMETER :: SStC2_Fyi = 468 + INTEGER(IntKi), PARAMETER :: SStC2_Fzi = 469 + INTEGER(IntKi), PARAMETER :: SStC2_Mxi = 470 + INTEGER(IntKi), PARAMETER :: SStC2_Myi = 471 + INTEGER(IntKi), PARAMETER :: SStC2_Mzi = 472 + INTEGER(IntKi), PARAMETER :: SStC2_Fxl = 473 + INTEGER(IntKi), PARAMETER :: SStC2_Fyl = 474 + INTEGER(IntKi), PARAMETER :: SStC2_Fzl = 475 + INTEGER(IntKi), PARAMETER :: SStC2_Mxl = 476 + INTEGER(IntKi), PARAMETER :: SStC2_Myl = 477 + INTEGER(IntKi), PARAMETER :: SStC2_Mzl = 478 + INTEGER(IntKi), PARAMETER :: SStC3_XQ = 479 + INTEGER(IntKi), PARAMETER :: SStC3_XQD = 480 + INTEGER(IntKi), PARAMETER :: SStC3_YQ = 481 + INTEGER(IntKi), PARAMETER :: SStC3_YQD = 482 + INTEGER(IntKi), PARAMETER :: SStC3_ZQ = 483 + INTEGER(IntKi), PARAMETER :: SStC3_ZQD = 484 + INTEGER(IntKi), PARAMETER :: SStC3_Fxi = 485 + INTEGER(IntKi), PARAMETER :: SStC3_Fyi = 486 + INTEGER(IntKi), PARAMETER :: SStC3_Fzi = 487 + INTEGER(IntKi), PARAMETER :: SStC3_Mxi = 488 + INTEGER(IntKi), PARAMETER :: SStC3_Myi = 489 + INTEGER(IntKi), PARAMETER :: SStC3_Mzi = 490 + INTEGER(IntKi), PARAMETER :: SStC3_Fxl = 491 + INTEGER(IntKi), PARAMETER :: SStC3_Fyl = 492 + INTEGER(IntKi), PARAMETER :: SStC3_Fzl = 493 + INTEGER(IntKi), PARAMETER :: SStC3_Mxl = 494 + INTEGER(IntKi), PARAMETER :: SStC3_Myl = 495 + INTEGER(IntKi), PARAMETER :: SStC3_Mzl = 496 + INTEGER(IntKi), PARAMETER :: SStC4_XQ = 497 + INTEGER(IntKi), PARAMETER :: SStC4_XQD = 498 + INTEGER(IntKi), PARAMETER :: SStC4_YQ = 499 + INTEGER(IntKi), PARAMETER :: SStC4_YQD = 500 + INTEGER(IntKi), PARAMETER :: SStC4_ZQ = 501 + INTEGER(IntKi), PARAMETER :: SStC4_ZQD = 502 + INTEGER(IntKi), PARAMETER :: SStC4_Fxi = 503 + INTEGER(IntKi), PARAMETER :: SStC4_Fyi = 504 + INTEGER(IntKi), PARAMETER :: SStC4_Fzi = 505 + INTEGER(IntKi), PARAMETER :: SStC4_Mxi = 506 + INTEGER(IntKi), PARAMETER :: SStC4_Myi = 507 + INTEGER(IntKi), PARAMETER :: SStC4_Mzi = 508 + INTEGER(IntKi), PARAMETER :: SStC4_Fxl = 509 + INTEGER(IntKi), PARAMETER :: SStC4_Fyl = 510 + INTEGER(IntKi), PARAMETER :: SStC4_Fzl = 511 + INTEGER(IntKi), PARAMETER :: SStC4_Mxl = 512 + INTEGER(IntKi), PARAMETER :: SStC4_Myl = 513 + INTEGER(IntKi), PARAMETER :: SStC4_Mzl = 514 + + + ! The maximum number of output channels which can be output by the code. + INTEGER(IntKi), PARAMETER :: MaxOutPts = 514 + +!End of code generated by Matlab script +! =================================================================================================== + INTEGER(IntKi), PARAMETER :: BlPitchC (3) = (/ BlPitchC1, BlPitchC2, BlPitchC3 /) + INTEGER(IntKi), PARAMETER :: BlAirfoilC (3) = (/ BlAirFlC1, BlAirFlC2, BlAirFlC3 /) + + ! Structural Control outputs -- these arrays simplify the output a little. The MaxBlOuts and MaxStC + ! must be set according to what is in the OutListParameters and auto + ! generated code above. + INTEGER(IntKi), PARAMETER :: MaxBlOuts = 4 ! maximum number of blades that we can output for + INTEGER(IntKi), PARAMETER :: MaxStC = 4 ! maximum number of StC outputs of type + ! StC nacelle outputs -- maximum of 4 for now. Expand if more needed + INTEGER(IntKi), PARAMETER :: NStC_XQ(MaxStC) = (/ NStC1_XQ, NStC2_XQ, NStC3_XQ, NStC4_XQ /) + INTEGER(IntKi), PARAMETER :: NStC_XQD(MaxStC) = (/ NStC1_XQD, NStC2_XQD, NStC3_XQD, NStC4_XQD /) + INTEGER(IntKi), PARAMETER :: NStC_YQ(MaxStC) = (/ NStC1_YQ, NStC2_YQ, NStC3_YQ, NStC4_YQ /) + INTEGER(IntKi), PARAMETER :: NStC_YQD(MaxStC) = (/ NStC1_YQD, NStC2_YQD, NStC3_YQD, NStC4_YQD /) + INTEGER(IntKi), PARAMETER :: NStC_ZQ(MaxStC) = (/ NStC1_ZQ, NStC2_ZQ, NStC3_ZQ, NStC4_ZQ /) + INTEGER(IntKi), PARAMETER :: NStC_ZQD(MaxStC) = (/ NStC1_ZQD, NStC2_ZQD, NStC3_ZQD, NStC4_ZQD /) + INTEGER(IntKi), PARAMETER :: NStC_Fxi(MaxStC) = (/ NStC1_Fxi, NStC2_Fxi, NStC3_Fxi, NStC4_Fxi /) + INTEGER(IntKi), PARAMETER :: NStC_Fyi(MaxStC) = (/ NStC1_Fyi, NStC2_Fyi, NStC3_Fyi, NStC4_Fyi /) + INTEGER(IntKi), PARAMETER :: NStC_Fzi(MaxStC) = (/ NStC1_Fzi, NStC2_Fzi, NStC3_Fzi, NStC4_Fzi /) + INTEGER(IntKi), PARAMETER :: NStC_Mxi(MaxStC) = (/ NStC1_Mxi, NStC2_Mxi, NStC3_Mxi, NStC4_Mxi /) + INTEGER(IntKi), PARAMETER :: NStC_Myi(MaxStC) = (/ NStC1_Myi, NStC2_Myi, NStC3_Myi, NStC4_Myi /) + INTEGER(IntKi), PARAMETER :: NStC_Mzi(MaxStC) = (/ NStC1_Mzi, NStC2_Mzi, NStC3_Mzi, NStC4_Mzi /) + INTEGER(IntKi), PARAMETER :: NStC_Fxl(MaxStC) = (/ NStC1_Fxl, NStC2_Fxl, NStC3_Fxl, NStC4_Fxl /) + INTEGER(IntKi), PARAMETER :: NStC_Fyl(MaxStC) = (/ NStC1_Fyl, NStC2_Fyl, NStC3_Fyl, NStC4_Fyl /) + INTEGER(IntKi), PARAMETER :: NStC_Fzl(MaxStC) = (/ NStC1_Fzl, NStC2_Fzl, NStC3_Fzl, NStC4_Fzl /) + INTEGER(IntKi), PARAMETER :: NStC_Mxl(MaxStC) = (/ NStC1_Mxl, NStC2_Mxl, NStC3_Mxl, NStC4_Mxl /) + INTEGER(IntKi), PARAMETER :: NStC_Myl(MaxStC) = (/ NStC1_Myl, NStC2_Myl, NStC3_Myl, NStC4_Myl /) + INTEGER(IntKi), PARAMETER :: NStC_Mzl(MaxStC) = (/ NStC1_Mzl, NStC2_Mzl, NStC3_Mzl, NStC4_Mzl /) + ! StC tower outputs -- maximum of 4 for now. Expand if more needed + INTEGER(IntKi), PARAMETER :: TStC_XQ(MaxStC) = (/ TStC1_XQ, TStC2_XQ, TStC3_XQ, TStC4_XQ /) + INTEGER(IntKi), PARAMETER :: TStC_XQD(MaxStC) = (/ TStC1_XQD, TStC2_XQD, TStC3_XQD, TStC4_XQD /) + INTEGER(IntKi), PARAMETER :: TStC_YQ(MaxStC) = (/ TStC1_YQ, TStC2_YQ, TStC3_YQ, TStC4_YQ /) + INTEGER(IntKi), PARAMETER :: TStC_YQD(MaxStC) = (/ TStC1_YQD, TStC2_YQD, TStC3_YQD, TStC4_YQD /) + INTEGER(IntKi), PARAMETER :: TStC_ZQ(MaxStC) = (/ TStC1_ZQ, TStC2_ZQ, TStC3_ZQ, TStC4_ZQ /) + INTEGER(IntKi), PARAMETER :: TStC_ZQD(MaxStC) = (/ TStC1_ZQD, TStC2_ZQD, TStC3_ZQD, TStC4_ZQD /) + INTEGER(IntKi), PARAMETER :: TStC_Fxi(MaxStC) = (/ TStC1_Fxi, TStC2_Fxi, TStC3_Fxi, TStC4_Fxi /) + INTEGER(IntKi), PARAMETER :: TStC_Fyi(MaxStC) = (/ TStC1_Fyi, TStC2_Fyi, TStC3_Fyi, TStC4_Fyi /) + INTEGER(IntKi), PARAMETER :: TStC_Fzi(MaxStC) = (/ TStC1_Fzi, TStC2_Fzi, TStC3_Fzi, TStC4_Fzi /) + INTEGER(IntKi), PARAMETER :: TStC_Mxi(MaxStC) = (/ TStC1_Mxi, TStC2_Mxi, TStC3_Mxi, TStC4_Mxi /) + INTEGER(IntKi), PARAMETER :: TStC_Myi(MaxStC) = (/ TStC1_Myi, TStC2_Myi, TStC3_Myi, TStC4_Myi /) + INTEGER(IntKi), PARAMETER :: TStC_Mzi(MaxStC) = (/ TStC1_Mzi, TStC2_Mzi, TStC3_Mzi, TStC4_Mzi /) + INTEGER(IntKi), PARAMETER :: TStC_Fxl(MaxStC) = (/ TStC1_Fxl, TStC2_Fxl, TStC3_Fxl, TStC4_Fxl /) + INTEGER(IntKi), PARAMETER :: TStC_Fyl(MaxStC) = (/ TStC1_Fyl, TStC2_Fyl, TStC3_Fyl, TStC4_Fyl /) + INTEGER(IntKi), PARAMETER :: TStC_Fzl(MaxStC) = (/ TStC1_Fzl, TStC2_Fzl, TStC3_Fzl, TStC4_Fzl /) + INTEGER(IntKi), PARAMETER :: TStC_Mxl(MaxStC) = (/ TStC1_Mxl, TStC2_Mxl, TStC3_Mxl, TStC4_Mxl /) + INTEGER(IntKi), PARAMETER :: TStC_Myl(MaxStC) = (/ TStC1_Myl, TStC2_Myl, TStC3_Myl, TStC4_Myl /) + INTEGER(IntKi), PARAMETER :: TStC_Mzl(MaxStC) = (/ TStC1_Mzl, TStC2_Mzl, TStC3_Mzl, TStC4_Mzl /) + ! StC blade outputs -- maximum of 4 for now. Expand if more needed + INTEGER(IntKi), PARAMETER :: BStC_XQ(MaxStC,MaxBlOuts) = reshape((/ & + BStC1_B1_XQ, BStC2_B1_XQ, BStC3_B1_XQ, BStC4_B1_XQ, & + BStC1_B2_XQ, BStC2_B2_XQ, BStC3_B2_XQ, BStC4_B2_XQ, & + BStC1_B3_XQ, BStC2_B3_XQ, BStC3_B3_XQ, BStC4_B3_XQ, & + BStC1_B4_XQ, BStC2_B4_XQ, BStC3_B4_XQ, BStC4_B4_XQ /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_XQD(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_XQD, BStC2_B1_XQD, BStC3_B1_XQD, BStC4_B1_XQD, & + BStC1_B2_XQD, BStC2_B2_XQD, BStC3_B2_XQD, BStC4_B2_XQD, & + BStC1_B3_XQD, BStC2_B3_XQD, BStC3_B3_XQD, BStC4_B3_XQD, & + BStC1_B4_XQD, BStC2_B4_XQD, BStC3_B4_XQD, BStC4_B4_XQD /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_YQ(MaxStC,MaxBlOuts) = reshape((/ & + BStC1_B1_YQ, BStC2_B1_YQ, BStC3_B1_YQ, BStC4_B1_YQ, & + BStC1_B2_YQ, BStC2_B2_YQ, BStC3_B2_YQ, BStC4_B2_YQ, & + BStC1_B3_YQ, BStC2_B3_YQ, BStC3_B3_YQ, BStC4_B3_YQ, & + BStC1_B4_YQ, BStC2_B4_YQ, BStC3_B4_YQ, BStC4_B4_YQ /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_YQD(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_YQD, BStC2_B1_YQD, BStC3_B1_YQD, BStC4_B1_YQD, & + BStC1_B2_YQD, BStC2_B2_YQD, BStC3_B2_YQD, BStC4_B2_YQD, & + BStC1_B3_YQD, BStC2_B3_YQD, BStC3_B3_YQD, BStC4_B3_YQD, & + BStC1_B4_YQD, BStC2_B4_YQD, BStC3_B4_YQD, BStC4_B4_YQD /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_ZQ(MaxStC,MaxBlOuts) = reshape((/ & + BStC1_B1_ZQ, BStC2_B1_ZQ, BStC3_B1_ZQ, BStC4_B1_ZQ, & + BStC1_B2_ZQ, BStC2_B2_ZQ, BStC3_B2_ZQ, BStC4_B2_ZQ, & + BStC1_B3_ZQ, BStC2_B3_ZQ, BStC3_B3_ZQ, BStC4_B3_ZQ, & + BStC1_B4_ZQ, BStC2_B4_ZQ, BStC3_B4_ZQ, BStC4_B4_ZQ /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_ZQD(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_ZQD, BStC2_B1_ZQD, BStC3_B1_ZQD, BStC4_B1_ZQD, & + BStC1_B2_ZQD, BStC2_B2_ZQD, BStC3_B2_ZQD, BStC4_B2_ZQD, & + BStC1_B3_ZQD, BStC2_B3_ZQD, BStC3_B3_ZQD, BStC4_B3_ZQD, & + BStC1_B4_ZQD, BStC2_B4_ZQD, BStC3_B4_ZQD, BStC4_B4_ZQD /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fxi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fxi, BStC2_B1_Fxi, BStC3_B1_Fxi, BStC4_B1_Fxi, & + BStC1_B2_Fxi, BStC2_B2_Fxi, BStC3_B2_Fxi, BStC4_B2_Fxi, & + BStC1_B3_Fxi, BStC2_B3_Fxi, BStC3_B3_Fxi, BStC4_B3_Fxi, & + BStC1_B4_Fxi, BStC2_B4_Fxi, BStC3_B4_Fxi, BStC4_B4_Fxi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fyi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fyi, BStC2_B1_Fyi, BStC3_B1_Fyi, BStC4_B1_Fyi, & + BStC1_B2_Fyi, BStC2_B2_Fyi, BStC3_B2_Fyi, BStC4_B2_Fyi, & + BStC1_B3_Fyi, BStC2_B3_Fyi, BStC3_B3_Fyi, BStC4_B3_Fyi, & + BStC1_B4_Fyi, BStC2_B4_Fyi, BStC3_B4_Fyi, BStC4_B4_Fyi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fzi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fzi, BStC2_B1_Fzi, BStC3_B1_Fzi, BStC4_B1_Fzi, & + BStC1_B2_Fzi, BStC2_B2_Fzi, BStC3_B2_Fzi, BStC4_B2_Fzi, & + BStC1_B3_Fzi, BStC2_B3_Fzi, BStC3_B3_Fzi, BStC4_B3_Fzi, & + BStC1_B4_Fzi, BStC2_B4_Fzi, BStC3_B4_Fzi, BStC4_B4_Fzi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Mxi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Mxi, BStC2_B1_Mxi, BStC3_B1_Mxi, BStC4_B1_Mxi, & + BStC1_B2_Mxi, BStC2_B2_Mxi, BStC3_B2_Mxi, BStC4_B2_Mxi, & + BStC1_B3_Mxi, BStC2_B3_Mxi, BStC3_B3_Mxi, BStC4_B3_Mxi, & + BStC1_B4_Mxi, BStC2_B4_Mxi, BStC3_B4_Mxi, BStC4_B4_Mxi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Myi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Myi, BStC2_B1_Myi, BStC3_B1_Myi, BStC4_B1_Myi, & + BStC1_B2_Myi, BStC2_B2_Myi, BStC3_B2_Myi, BStC4_B2_Myi, & + BStC1_B3_Myi, BStC2_B3_Myi, BStC3_B3_Myi, BStC4_B3_Myi, & + BStC1_B4_Myi, BStC2_B4_Myi, BStC3_B4_Myi, BStC4_B4_Myi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Mzi(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Mzi, BStC2_B1_Mzi, BStC3_B1_Mzi, BStC4_B1_Mzi, & + BStC1_B2_Mzi, BStC2_B2_Mzi, BStC3_B2_Mzi, BStC4_B2_Mzi, & + BStC1_B3_Mzi, BStC2_B3_Mzi, BStC3_B3_Mzi, BStC4_B3_Mzi, & + BStC1_B4_Mzi, BStC2_B4_Mzi, BStC3_B4_Mzi, BStC4_B4_Mzi /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fxl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fxl, BStC2_B1_Fxl, BStC3_B1_Fxl, BStC4_B1_Fxl, & + BStC1_B2_Fxl, BStC2_B2_Fxl, BStC3_B2_Fxl, BStC4_B2_Fxl, & + BStC1_B3_Fxl, BStC2_B3_Fxl, BStC3_B3_Fxl, BStC4_B3_Fxl, & + BStC1_B4_Fxl, BStC2_B4_Fxl, BStC3_B4_Fxl, BStC4_B4_Fxl /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fyl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fyl, BStC2_B1_Fyl, BStC3_B1_Fyl, BStC4_B1_Fyl, & + BStC1_B2_Fyl, BStC2_B2_Fyl, BStC3_B2_Fyl, BStC4_B2_Fyl, & + BStC1_B3_Fyl, BStC2_B3_Fyl, BStC3_B3_Fyl, BStC4_B3_Fyl, & + BStC1_B1_Fyl, BStC2_B1_Fyl, BStC3_B1_Fyl, BStC4_B1_Fyl /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Fzl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Fzl, BStC2_B1_Fzl, BStC3_B1_Fzl, BStC4_B1_Fzl, & + BStC1_B2_Fzl, BStC2_B2_Fzl, BStC3_B2_Fzl, BStC4_B2_Fzl, & + BStC1_B3_Fzl, BStC2_B3_Fzl, BStC3_B3_Fzl, BStC4_B3_Fzl, & + BStC1_B4_Fzl, BStC2_B4_Fzl, BStC3_B4_Fzl, BStC4_B4_Fzl /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Mxl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Mxl, BStC2_B1_Mxl, BStC3_B1_Mxl, BStC4_B1_Mxl, & + BStC1_B2_Mxl, BStC2_B2_Mxl, BStC3_B2_Mxl, BStC4_B2_Mxl, & + BStC1_B3_Mxl, BStC2_B3_Mxl, BStC3_B3_Mxl, BStC4_B3_Mxl, & + BStC1_B4_Mxl, BStC2_B4_Mxl, BStC3_B4_Mxl, BStC4_B4_Mxl /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Myl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Myl, BStC2_B1_Myl, BStC3_B1_Myl, BStC4_B1_Myl, & + BStC1_B2_Myl, BStC2_B2_Myl, BStC3_B2_Myl, BStC4_B2_Myl, & + BStC1_B3_Myl, BStC2_B3_Myl, BStC3_B3_Myl, BStC4_B3_Myl, & + BStC1_B4_Myl, BStC2_B4_Myl, BStC3_B4_Myl, BStC4_B4_Myl /),(/4,MaxBlOuts/)) + INTEGER(IntKi), PARAMETER :: BStC_Mzl(MaxStC,MaxBlOuts)= reshape((/ & + BStC1_B1_Mzl, BStC2_B1_Mzl, BStC3_B1_Mzl, BStC4_B1_Mzl, & + BStC1_B2_Mzl, BStC2_B2_Mzl, BStC3_B2_Mzl, BStC4_B2_Mzl, & + BStC1_B3_Mzl, BStC2_B3_Mzl, BStC3_B3_Mzl, BStC4_B3_Mzl, & + BStC1_B4_Mzl, BStC2_B4_Mzl, BStC3_B4_Mzl, BStC4_B4_Mzl /),(/4,MaxBlOuts/)) + ! StC Platform outputs -- maximum of 4 for now. Expand if more needed + INTEGER(IntKi), PARAMETER :: SStC_XQ(MaxStC) = (/ SStC1_XQ, SStC2_XQ, SStC3_XQ, SStC4_XQ /) + INTEGER(IntKi), PARAMETER :: SStC_XQD(MaxStC) = (/ SStC1_XQD, SStC2_XQD, SStC3_XQD, SStC4_XQD /) + INTEGER(IntKi), PARAMETER :: SStC_YQ(MaxStC) = (/ SStC1_YQ, SStC2_YQ, SStC3_YQ, SStC4_YQ /) + INTEGER(IntKi), PARAMETER :: SStC_YQD(MaxStC) = (/ SStC1_YQD, SStC2_YQD, SStC3_YQD, SStC4_YQD /) + INTEGER(IntKi), PARAMETER :: SStC_ZQ(MaxStC) = (/ SStC1_ZQ, SStC2_ZQ, SStC3_ZQ, SStC4_ZQ /) + INTEGER(IntKi), PARAMETER :: SStC_ZQD(MaxStC) = (/ SStC1_ZQD, SStC2_ZQD, SStC3_ZQD, SStC4_ZQD /) + INTEGER(IntKi), PARAMETER :: SStC_Fxi(MaxStC) = (/ SStC1_Fxi, SStC2_Fxi, SStC3_Fxi, SStC4_Fxi /) + INTEGER(IntKi), PARAMETER :: SStC_Fyi(MaxStC) = (/ SStC1_Fyi, SStC2_Fyi, SStC3_Fyi, SStC4_Fyi /) + INTEGER(IntKi), PARAMETER :: SStC_Fzi(MaxStC) = (/ SStC1_Fzi, SStC2_Fzi, SStC3_Fzi, SStC4_Fzi /) + INTEGER(IntKi), PARAMETER :: SStC_Mxi(MaxStC) = (/ SStC1_Mxi, SStC2_Mxi, SStC3_Mxi, SStC4_Mxi /) + INTEGER(IntKi), PARAMETER :: SStC_Myi(MaxStC) = (/ SStC1_Myi, SStC2_Myi, SStC3_Myi, SStC4_Myi /) + INTEGER(IntKi), PARAMETER :: SStC_Mzi(MaxStC) = (/ SStC1_Mzi, SStC2_Mzi, SStC3_Mzi, SStC4_Mzi /) + INTEGER(IntKi), PARAMETER :: SStC_Fxl(MaxStC) = (/ SStC1_Fxl, SStC2_Fxl, SStC3_Fxl, SStC4_Fxl /) + INTEGER(IntKi), PARAMETER :: SStC_Fyl(MaxStC) = (/ SStC1_Fyl, SStC2_Fyl, SStC3_Fyl, SStC4_Fyl /) + INTEGER(IntKi), PARAMETER :: SStC_Fzl(MaxStC) = (/ SStC1_Fzl, SStC2_Fzl, SStC3_Fzl, SStC4_Fzl /) + INTEGER(IntKi), PARAMETER :: SStC_Mxl(MaxStC) = (/ SStC1_Mxl, SStC2_Mxl, SStC3_Mxl, SStC4_Mxl /) + INTEGER(IntKi), PARAMETER :: SStC_Myl(MaxStC) = (/ SStC1_Myl, SStC2_Myl, SStC3_Myl, SStC4_Myl /) + INTEGER(IntKi), PARAMETER :: SStC_Mzl(MaxStC) = (/ SStC1_Mzl, SStC2_Mzl, SStC3_Mzl, SStC4_Mzl /) + + + +CONTAINS +!--------------------------- +subroutine Set_SrvD_Outs( p, y, m, AllOuts ) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(SrvD_OutputType), intent(in ) :: y !< Outputs computed at Time + type(SrvD_MiscVarType), intent(inout) :: m !< Misc (optimization) variables + real(ReKi), intent(inout) :: AllOuts(0:MaxOutPts) ! All the the available output channels + integer :: K + + !............................................................................................................................... + ! Calculate all of the available output channels: + !............................................................................................................................... + ! This is overwriting the values if it was called from UpdateStates, but they + ! should be the same and this sets the values if we called the DLL above. + m%dll_data%ElecPwr_prev = y%ElecPwr + m%dll_data%GenTrq_prev = y%GenTrq + + !............................................................................................................................... + ! Calculate all of the available output channels: + !............................................................................................................................... +! AllOuts(Time) = t + + AllOuts(GenTq) = 0.001*y%GenTrq + AllOuts(GenPwr) = 0.001*y%ElecPwr + AllOuts(HSSBrTqC)= 0.001*y%HSSBrTrqC + + DO K=1,p%NumBl + AllOuts( BlPitchC(K) ) = y%BlPitchCom(K)*R2D + AllOuts( BlAirfoilC(K) ) = y%BlAirfoilCom(K) + END DO + + AllOuts(YawMomCom) = -0.001*y%YawMom + +end subroutine Set_SrvD_Outs +!--------------------------- +subroutine Set_NStC_Outs( p_SrvD, x, m, y, AllOuts ) ! Nacelle + type(SrvD_ParameterType), intent(in ) :: p_SrvD !< Parameters + type(StC_ContinuousStateType), allocatable,intent(in ) :: x(:) !< Continuous states at t + type(StC_MiscVarType), allocatable,intent(in ) :: m(:) !< Misc (optimization) variables + type(StC_OutputType), allocatable,intent(in ) :: y(:) !< Outputs computed at Time + real(ReKi), intent(inout) :: AllOuts(0:MaxOutPts) ! All the the available output channels + integer :: i,j + j=1 + if (allocated(x) .and. allocated(m) .and. allocated(y)) then + do i=1,min(p_SrvD%NumNStC,MaxStC) ! in case we have more Nacelle StCs than the outputs are set for + AllOuts(NStC_XQ( i)) = x(i)%StC_x(1,1) ! x + AllOuts(NStC_XQD(i)) = x(i)%StC_x(2,1) ! x-dot + AllOuts(NStC_YQ( i)) = x(i)%StC_x(3,1) ! y + AllOuts(NStC_YQD(i)) = x(i)%StC_x(4,1) ! y-dot + AllOuts(NStC_ZQ( i)) = x(i)%StC_x(5,1) ! z + AllOuts(NStC_ZQD(i)) = x(i)%StC_x(6,1) ! z-dot + AllOuts(NStC_Fxi(i)) = 0.001*y(i)%Mesh(j)%Force(1,1) ! only one mesh per NStC instance + AllOuts(NStC_Fyi(i)) = 0.001*y(i)%Mesh(j)%Force(2,1) ! only one mesh per NStC instance + AllOuts(NStC_Fzi(i)) = 0.001*y(i)%Mesh(j)%Force(3,1) ! only one mesh per NStC instance + AllOuts(NStC_Mxi(i)) = 0.001*y(i)%Mesh(j)%Moment(1,1) ! only one mesh per NStC instance + AllOuts(NStC_Myi(i)) = 0.001*y(i)%Mesh(j)%Moment(2,1) ! only one mesh per NStC instance + AllOuts(NStC_Mzi(i)) = 0.001*y(i)%Mesh(j)%Moment(3,1) ! only one mesh per NStC instance + AllOuts(NStC_Fxl(i)) = 0.001*m(i)%F_P(1,j) + AllOuts(NStC_Fyl(i)) = 0.001*m(i)%F_P(2,j) + AllOuts(NStC_Fzl(i)) = 0.001*m(i)%F_P(3,j) + AllOuts(NStC_Mxl(i)) = 0.001*m(i)%M_P(1,j) + AllOuts(NStC_Myl(i)) = 0.001*m(i)%M_P(2,j) + AllOuts(NStC_Mzl(i)) = 0.001*m(i)%M_P(3,j) + enddo + endif +end subroutine Set_NStC_Outs +!--------------------------- +subroutine Set_TStC_Outs( p_SrvD, x, m, y, AllOuts ) ! Tower + type(SrvD_ParameterType), intent(in ) :: p_SrvD !< Parameters + type(StC_ContinuousStateType), allocatable,intent(in ) :: x(:) !< Continuous states at t + type(StC_MiscVarType), allocatable,intent(in ) :: m(:) !< Misc (optimization) variables + type(StC_OutputType), allocatable,intent(in ) :: y(:) !< Outputs computed at Time + real(ReKi), intent(inout) :: AllOuts(0:MaxOutPts) ! All the the available output channels + integer :: i,j + j=1 + if (allocated(x) .and. allocated(m) .and. allocated(y)) then + do i=1,min(p_SrvD%NumTStC,MaxStC) ! in case we have more Nacelle StCs than the outputs are set for + AllOuts(TStC_XQ( i)) = x(i)%StC_x(1,1) ! x + AllOuts(TStC_XQD(i)) = x(i)%StC_x(2,1) ! x-dot + AllOuts(TStC_YQ( i)) = x(i)%StC_x(3,1) ! y + AllOuts(TStC_YQD(i)) = x(i)%StC_x(4,1) ! y-dot + AllOuts(TStC_ZQ( i)) = x(i)%StC_x(5,1) ! z + AllOuts(TStC_ZQD(i)) = x(i)%StC_x(6,1) ! z-dot + AllOuts(TStC_Fxi(i)) = 0.001*y(i)%Mesh(j)%Force(1,1) ! only one mesh per TStC instance + AllOuts(TStC_Fyi(i)) = 0.001*y(i)%Mesh(j)%Force(2,1) ! only one mesh per TStC instance + AllOuts(TStC_Fzi(i)) = 0.001*y(i)%Mesh(j)%Force(3,1) ! only one mesh per TStC instance + AllOuts(TStC_Mxi(i)) = 0.001*y(i)%Mesh(j)%Moment(1,1) ! only one mesh per TStC instance + AllOuts(TStC_Myi(i)) = 0.001*y(i)%Mesh(j)%Moment(2,1) ! only one mesh per TStC instance + AllOuts(TStC_Mzi(i)) = 0.001*y(i)%Mesh(j)%Moment(3,1) ! only one mesh per TStC instance + AllOuts(TStC_Fxl(i)) = 0.001*m(i)%F_P(1,j) + AllOuts(TStC_Fyl(i)) = 0.001*m(i)%F_P(2,j) + AllOuts(TStC_Fzl(i)) = 0.001*m(i)%F_P(3,j) + AllOuts(TStC_Mxl(i)) = 0.001*m(i)%M_P(1,j) + AllOuts(TStC_Myl(i)) = 0.001*m(i)%M_P(2,j) + AllOuts(TStC_Mzl(i)) = 0.001*m(i)%M_P(3,j) + enddo + endif +end subroutine Set_TStC_Outs +!--------------------------- +subroutine Set_BStC_Outs( p_SrvD, x, m, y, AllOuts ) ! Blades + type(SrvD_ParameterType), intent(in ) :: p_SrvD !< Parameters + type(StC_ContinuousStateType), allocatable,intent(in ) :: x(:) !< Continuous states at t + type(StC_MiscVarType), allocatable,intent(in ) :: m(:) !< Misc (optimization) variables + type(StC_OutputType), allocatable,intent(in ) :: y(:) !< Outputs computed at Time + real(ReKi), intent(inout) :: AllOuts(0:MaxOutPts) ! All the the available output channels + integer :: i,j + if (allocated(x) .and. allocated(m) .and. allocated(y)) then + do j=1,min(p_SrvD%NumBl,MaxBlOuts) + do i=1,min(p_SrvD%NumBStC,MaxStC) ! in case we have more Nacelle StCs than the outputs are set for + AllOuts(BStC_XQ( i,j)) = x(i)%StC_x(1,j) ! x + AllOuts(BStC_XQD(i,j)) = x(i)%StC_x(2,j) ! x-dot + AllOuts(BStC_YQ( i,j)) = x(i)%StC_x(3,j) ! y + AllOuts(BStC_YQD(i,j)) = x(i)%StC_x(4,j) ! y-dot + AllOuts(BStC_ZQ( i,j)) = x(i)%StC_x(5,j) ! z + AllOuts(BStC_ZQD(i,j)) = x(i)%StC_x(6,j) ! z-dot + AllOuts(BStC_Fxi(i,j)) = 0.001*y(i)%Mesh(j)%Force(1,1) ! only one mesh per BStC instance + AllOuts(BStC_Fyi(i,j)) = 0.001*y(i)%Mesh(j)%Force(2,1) ! only one mesh per BStC instance + AllOuts(BStC_Fzi(i,j)) = 0.001*y(i)%Mesh(j)%Force(3,1) ! only one mesh per BStC instance + AllOuts(BStC_Mxi(i,j)) = 0.001*y(i)%Mesh(j)%Moment(1,1) ! only one mesh per BStC instance + AllOuts(BStC_Myi(i,j)) = 0.001*y(i)%Mesh(j)%Moment(2,1) ! only one mesh per BStC instance + AllOuts(BStC_Mzi(i,j)) = 0.001*y(i)%Mesh(j)%Moment(3,1) ! only one mesh per BStC instance + AllOuts(BStC_Fxl(i,j)) = 0.001*m(i)%F_P(1,j) + AllOuts(BStC_Fyl(i,j)) = 0.001*m(i)%F_P(2,j) + AllOuts(BStC_Fzl(i,j)) = 0.001*m(i)%F_P(3,j) + AllOuts(BStC_Mxl(i,j)) = 0.001*m(i)%M_P(1,j) + AllOuts(BStC_Myl(i,j)) = 0.001*m(i)%M_P(2,j) + AllOuts(BStC_Mzl(i,j)) = 0.001*m(i)%M_P(3,j) + enddo + enddo + endif +end subroutine Set_BStC_Outs +!--------------------------- +subroutine Set_SStC_Outs( p_SrvD, x, m, y, AllOuts ) ! Platform + type(SrvD_ParameterType), intent(in ) :: p_SrvD !< Parameters + type(StC_ContinuousStateType), allocatable,intent(in ) :: x(:) !< Continuous states at t + type(StC_MiscVarType), allocatable,intent(in ) :: m(:) !< Misc (optimization) variables + type(StC_OutputType), allocatable,intent(in ) :: y(:) !< Outputs computed at Time + real(ReKi), intent(inout) :: AllOuts(0:MaxOutPts) ! All the the available output channels + integer :: i,j + j=1 + if (allocated(x) .and. allocated(m) .and. allocated(y)) then + do i=1,min(p_SrvD%NumSStC,MaxStC) ! in case we have more Nacelle StCs than the outputs are set for + AllOuts(SStC_XQ( i)) = x(i)%StC_x(1,1) ! x + AllOuts(SStC_XQD(i)) = x(i)%StC_x(2,1) ! x-dot + AllOuts(SStC_YQ( i)) = x(i)%StC_x(3,1) ! y + AllOuts(SStC_YQD(i)) = x(i)%StC_x(4,1) ! y-dot + AllOuts(SStC_ZQ( i)) = x(i)%StC_x(5,1) ! z + AllOuts(SStC_ZQD(i)) = x(i)%StC_x(6,1) ! z-dot + AllOuts(SStC_Fxi(i)) = 0.001*y(i)%Mesh(j)%Force(1,1) ! only one mesh per SStC instance + AllOuts(SStC_Fyi(i)) = 0.001*y(i)%Mesh(j)%Force(2,1) ! only one mesh per SStC instance + AllOuts(SStC_Fzi(i)) = 0.001*y(i)%Mesh(j)%Force(3,1) ! only one mesh per SStC instance + AllOuts(SStC_Mxi(i)) = 0.001*y(i)%Mesh(j)%Moment(1,1) ! only one mesh per SStC instance + AllOuts(SStC_Myi(i)) = 0.001*y(i)%Mesh(j)%Moment(2,1) ! only one mesh per SStC instance + AllOuts(SStC_Mzi(i)) = 0.001*y(i)%Mesh(j)%Moment(3,1) ! only one mesh per SStC instance + AllOuts(SStC_Fxl(i)) = 0.001*m(i)%F_P(1,j) + AllOuts(SStC_Fyl(i)) = 0.001*m(i)%F_P(2,j) + AllOuts(SStC_Fzl(i)) = 0.001*m(i)%F_P(3,j) + AllOuts(SStC_Mxl(i)) = 0.001*m(i)%M_P(1,j) + AllOuts(SStC_Myl(i)) = 0.001*m(i)%M_P(2,j) + AllOuts(SStC_Mzl(i)) = 0.001*m(i)%M_P(3,j) + enddo + endif +end subroutine Set_SStC_Outs +!--------------------------- + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine parses the input file and stores all the data in the SrvD_InputFile structure. +!! It does not perform data validation. +subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, InputFileData, Default_DT, ErrStat, ErrMsg ) + + implicit none + + ! Passed variables + character(*), intent(in ) :: PriPath ! Path name of the primary file + character(*), intent(in ) :: InputFile !< Name of the file containing the primary input data + character(*), intent(in ) :: OutFileRoot !< The rootname of the echo file, possibly opened in this routine + type(SrvD_InputFile), intent( out) :: InputFileData !< All the data in the StrucCtrl input file + type(FileInfoType), intent(in ) :: FileInfo_In !< The derived type for holding the file information. + real(DbKi), intent(in ) :: Default_DT !< The default DT (from glue code) + integer(IntKi), intent( out) :: ErrStat !< Error status + character(ErrMsgLen), intent( out) :: ErrMsg !< Error message + + ! Local variables: + integer(IntKi) :: i !< generic counter + character(20) :: TmpChr !< Temporary char array + integer(IntKi) :: UnEcho + integer(IntKi) :: ErrStat2 !< Temporary Error status + character(ErrMsgLen) :: ErrMsg2 !< Temporary Error message + integer(IntKi) :: CurLine !< current entry in FileInfo_In%Lines array + real(ReKi) :: TmpRe2(2) !< temporary 2 number array for reading values in + character(*), parameter :: RoutineName = 'ParseInputFileInfo' + + + ! Initialization + ErrStat = ErrID_None + ErrMsg = "" + UnEcho = -1 ! Echo file unit. >0 when used + + call AllocAry( InputFileData%OutList, MaxOutPts, "ServoDyn Input File's Outlist", ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! Give verbose info on what we are reading + if (NWTC_VerboseLevel == NWTC_Verbose) THEN + call WrScr( ' Heading of the ServoDyn input file: ' ) + call WrScr( ' '//trim( FileInfo_In%Lines(2) ) ) + end if + + !------------------------------------------------------------------------------------------------- + ! General settings + !------------------------------------------------------------------------------------------------- + CurLine = 4 ! Skip the first three lines as they are known to be header lines and separators + call ParseVar( FileInfo_In, CurLine, 'Echo', InputFileData%Echo, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + if ( InputFileData%Echo ) then + CALL OpenEcho ( UnEcho, TRIM(OutFileRoot)//'.ech', ErrStat2, ErrMsg2 ) + if (Failed()) return; + WRITE(UnEcho, '(A)') 'Echo file for ServoDyn input file: '//trim(InputFile) + ! Write the first three lines into the echo file + WRITE(UnEcho, '(A)') FileInfo_In%Lines(1) + WRITE(UnEcho, '(A)') FileInfo_In%Lines(2) + WRITE(UnEcho, '(A)') FileInfo_In%Lines(3) + + CurLine = 4 + call ParseVar( FileInfo_In, CurLine, 'Echo', InputFileData%Echo, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return + endif + + ! DT - Communication interval for controllers (s) (or "default") + call ParseVarWDefault ( FileInfo_In, CurLine, 'DT', InputFileData%DT, Default_DT, ErrStat2, ErrMsg2, UnEcho ) + + + !---------------------- PITCH CONTROL ------------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! PCMode (switch) - Pitch control mode { 0: none + ! 3: user-defined from routine PitchCntrl, + ! 4: user-defined from Simulink/Labview + ! 5: user-defined from Bladed-style DLL} (switch) + call ParseVar( FileInfo_In, CurLine, 'PCMode', InputFileData%PCMode, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TPCOn - Time to enable active pitch control (s) [unused when PCMode=0] + call ParseVar( FileInfo_In, CurLine, 'TPCOn', InputFileData%TPCOn, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + ! TPitManS - Time to start override pitch maneuver for blade 1 and end standard pitch control (s) + do i=1,size(InputFileData%TPitManS) + TmpChr='TPitManS('//trim(Num2LStr(i))//')' + call ParseVar( FileInfo_In, CurLine, trim(TmpChr), InputFileData%TPitManS(i), ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + enddo + + ! PitManRat - Pitch rate at which override pitch maneuver heads toward final pitch angle for blade 1 (deg/s) + do i=1,size(InputFileData%PitManRat) + TmpChr='PitManRat('//trim(Num2LStr(i))//')' + call ParseVar( FileInfo_In, CurLine, trim(TmpChr), InputFileData%PitManRat(i), ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + enddo + InputFileData%PitManRat = InputFileData%PitManRat*D2R + + ! BlPitchF - Blade 1 final pitch for pitch maneuvers (degrees) + do i=1,size(InputFileData%BlPitchF) + TmpChr='BlPitchF('//trim(Num2LStr(i))//')' + call ParseVar( FileInfo_In, CurLine, trim(TmpChr), InputFileData%BlPitchF(i), ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + enddo + InputFileData%BlPitchF = InputFileData%BlPitchF*D2R + + + !---------------------- GENERATOR AND TORQUE CONTROL ---------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! VSContrl (switch) - Variable-speed control mode { + ! 0: none + ! 1: simple VS, + ! 3: user-defined from routine UserVSCont, + ! 4: user-defined from Simulink/Labview, + ! 5: user-defined from Bladed-style DLL} + call ParseVar( FileInfo_In, CurLine, 'VSContrl', InputFileData%VSContrl, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! GenModel - Generator model {1: simple, 2: Thevenin, 3: user-defined from routine UserGen} (switch) [used only when VSContrl=0] + call ParseVar( FileInfo_In, CurLine, 'GenModel', InputFileData%GenModel, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! GenEff - Generator efficiency [ignored by the Thevenin and user-defined generator models] ( + call ParseVar( FileInfo_In, CurLine, 'GenEff', InputFileData%GenEff, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%GenEff = InputFileData%GenEff*0.01 + ! GenTiStr - Method to start the generator {T: timed using TimGenOn, F: generator speed using SpdGenOn} (flag) + call ParseVar( FileInfo_In, CurLine, 'GenTiStr', InputFileData%GenTiStr, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! GenTiStp - Method to stop the generator {T: timed using TimGenOf, F: when generator power = 0} (flag) + call ParseVar( FileInfo_In, CurLine, 'GenTiStp', InputFileData%GenTiStp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! SpdGenOn - Generator speed to turn on the generator for a startup (HSS speed) (rpm) [used only when GenTiStr=False] + call ParseVar( FileInfo_In, CurLine, 'SpdGenOn', InputFileData%SpdGenOn, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%SpdGenOn = InputFileData%SpdGenOn*RPM2RPS + ! TimGenOn - Time to turn on the generator for a startup (s) [used only when GenTiStr=True] + call ParseVar( FileInfo_In, CurLine, 'TimGenOn', InputFileData%TimGenOn, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TimGenOf - Time to turn off the generator (s) [used only when GenTiStp=True] + call ParseVar( FileInfo_In, CurLine, 'TimGenOf', InputFileData%TimGenOf, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + !---------------------- SIMPLE VARIABLE-SPEED TORQUE CONTROL -------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! VS_RtGnSp - Rated generator speed for simple variable-speed generator control (HSS side) (rpm) [used only when VSContrl=1] + call ParseVar( FileInfo_In, CurLine, 'VS_RtGnSp', InputFileData%VS_RtGnSp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%VS_RtGnSp = InputFileData%VS_RtGnSp*RPM2RPS + ! VS_RtTq - Rated generator torque/constant generator torque in Region 3 for simple variable-speed generator control (HSS side) (N-m) [used only when VSContrl=1] + call ParseVar( FileInfo_In, CurLine, 'VS_RtTq', InputFileData%VS_RtTq, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! VS_Rgn2K - Generator torque constant in Region 2 for simple variable-speed generator control (HSS side) (N-m/rpm^2) [used only when VSContrl=1] + call ParseVar( FileInfo_In, CurLine, 'VS_Rgn2K', InputFileData%VS_Rgn2K, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%VS_Rgn2K = InputFileData%VS_Rgn2K/( RPM2RPS**2 ) + ! VS_SlPc - Rated generator slip percentage in Region 2 1/2 for simple variable-speed generator control ( + call ParseVar( FileInfo_In, CurLine, 'VS_SlPc', InputFileData%VS_SlPc, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%VS_SlPc = InputFileData%VS_SlPc*.01 + + + !---------------------- SIMPLE INDUCTION GENERATOR ------------------------------ + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! SIG_SlPc - Rated generator slip percentage ( + call ParseVar( FileInfo_In, CurLine, 'SIG_SlPc', InputFileData%SIG_SlPc, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%SIG_SlPc = InputFileData%SIG_SlPc*.01 + ! SIG_SySp - Synchronous (zero-torque) generator speed (rpm) [used only when VSContrl=0 and GenModel=1] + call ParseVar( FileInfo_In, CurLine, 'SIG_SySp', InputFileData%SIG_SySp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%SIG_SySp = InputFileData%SIG_SySp*RPM2RPS + ! SIG_RtTq - Rated torque (N-m) [used only when VSContrl=0 and GenModel=1] + call ParseVar( FileInfo_In, CurLine, 'SIG_RtTq', InputFileData%SIG_RtTq, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! SIG_PORt - Pull-out ratio (Tpullout/Trated) (-) [used only when VSContrl=0 and GenModel=1] + call ParseVar( FileInfo_In, CurLine, 'SIG_PORt', InputFileData%SIG_PORt, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + !---------------------- THEVENIN-EQUIVALENT INDUCTION GENERATOR ----------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! TEC_Freq - Line frequency [50 or 60] (Hz) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_Freq', InputFileData%TEC_Freq, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_NPol - Number of poles [even integer > 0] (-) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_NPol', InputFileData%TEC_NPol, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_SRes - Stator resistance (ohms) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_SRes', InputFileData%TEC_SRes, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_RRes - Rotor resistance (ohms) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_RRes', InputFileData%TEC_RRes, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_VLL - Line-to-line RMS voltage (volts) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_VLL', InputFileData%TEC_VLL, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_SLR - Stator leakage reactance (ohms) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_SLR', InputFileData%TEC_SLR, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_RLR - Rotor leakage reactance (ohms) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_RLR', InputFileData%TEC_RLR, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TEC_MR - Magnetizing reactance (ohms) [used only when VSContrl=0 and GenModel=2] + call ParseVar( FileInfo_In, CurLine, 'TEC_MR', InputFileData%TEC_MR, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + !---------------------- HIGH-SPEED SHAFT BRAKE ---------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! HSSBrMode (switch) - HSS brake model { + ! 0: none, + ! 1: simple, + ! 3: user-defined from routine UserHSSBr, + ! 4: user-defined from Simulink/Labview, + ! 5: user-defined from Bladed-style DLL} + call ParseVar( FileInfo_In, CurLine, 'HSSBrMode', InputFileData%HSSBrMode, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! THSSBrDp - Time to initiate deployment of the HSS brake (s) + call ParseVar( FileInfo_In, CurLine, 'THSSBrDp', InputFileData%THSSBrDp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! HSSBrDT - Time for HSS-brake to reach full deployment once initiated (sec) [used only when HSSBrMode=1] + call ParseVar( FileInfo_In, CurLine, 'HSSBrDT', InputFileData%HSSBrDT, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! HSSBrTqF - Fully deployed HSS-brake torque (N-m) + call ParseVar( FileInfo_In, CurLine, 'HSSBrTqF', InputFileData%HSSBrTqF, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + !---------------------- YAW CONTROL --------------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! YCMode (switch) - Yaw control mode { + ! 0: none, + ! 3: user-defined from routine UserYawCont, + ! 4: user-defined from Simulink/Labview, + ! 5: user-defined from Bladed-style DLL} + call ParseVar( FileInfo_In, CurLine, 'YCMode', InputFileData%YCMode, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TYCOn - Time to enable active yaw control (s) [unused when YCMode=0] + call ParseVar( FileInfo_In, CurLine, 'TYCOn', InputFileData%TYCOn, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! YawNeut - Neutral yaw position--yaw spring force is zero at this yaw (degrees) + call ParseVar( FileInfo_In, CurLine, 'YawNeut', InputFileData%YawNeut, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%YawNeut = InputFileData%YawNeut*D2R + ! YawSpr - Nacelle-yaw spring constant (N-m/rad) + call ParseVar( FileInfo_In, CurLine, 'YawSpr', InputFileData%YawSpr, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! YawDamp - Nacelle-yaw damping constant (N-m/(rad/s)) + call ParseVar( FileInfo_In, CurLine, 'YawDamp', InputFileData%YawDamp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TYawManS - Time to start override yaw maneuver and end standard yaw control (s) + call ParseVar( FileInfo_In, CurLine, 'TYawManS', InputFileData%TYawManS, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! YawManRat - Yaw maneuver rate (in absolute value) (deg/s) + call ParseVar( FileInfo_In, CurLine, 'YawManRat', InputFileData%YawManRat, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%YawManRat = InputFileData%YawManRat*D2R + ! NacYawF - Final yaw angle for override yaw maneuvers (degrees) + call ParseVar( FileInfo_In, CurLine, 'NacYawF', InputFileData%NacYawF, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%NacYawF = InputFileData%NacYawF*D2R + + + !---------------------- TUNED MASS DAMPER ---------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! NumBStC - Number of blade structural controllers (integer) + call ParseVar( FileInfo_In, CurLine, 'NumBStC', InputFileData%NumBStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! BStCfiles - Name of the files for blade structural controllers (quoted strings) [unused when NumBStC==0] + call AllocAry( InputFileData%BStCfiles, InputFileData%NumBStC, 'BStCfile', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call ParseAry( FileInfo_In, CurLine, 'BStCfile', InputFileData%BStCfiles, InputFileData%NumBStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + do i=1,InputFileData%NumBStC + if ( PathIsRelative( InputFileData%BStCfiles(i) ) ) InputFileData%BStCfiles(i) = TRIM(PriPath)//TRIM(InputFileData%BStCfiles(i)) + enddo + + ! NumNStC - Number of nacelle structural controllers (integer) + call ParseVar( FileInfo_In, CurLine, 'NumNStC', InputFileData%NumNStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! NStCfiles - Name of the files for nacelle structural controllers (quoted strings) [unused when NumNStC==0] + call AllocAry( InputFileData%NStCfiles, InputFileData%NumNStC, 'NStCfile', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call ParseAry( FileInfo_In, CurLine, 'NStCfile', InputFileData%NStCfiles, InputFileData%NumNStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + do i=1,InputFileData%NumNStC + if ( PathIsRelative( InputFileData%NStCfiles(i) ) ) InputFileData%NStCfiles(i) = TRIM(PriPath)//TRIM(InputFileData%NStCfiles(i)) + enddo + + ! NumTStC - Number of tower structural controllers (integer) + call ParseVar( FileInfo_In, CurLine, 'NumTStC', InputFileData%NumTStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TStCfiles - Name of the files for tower structural controllers (quoted strings) [unused when NumTStC==0] + call AllocAry( InputFileData%TStCfiles, InputFileData%NumTStC, 'TStCfile', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call ParseAry( FileInfo_In, CurLine, 'TStCfile', InputFileData%TStCfiles, InputFileData%NumTStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + do i=1,InputFileData%NumTStC + if ( PathIsRelative( InputFileData%TStCfiles(i) ) ) InputFileData%TStCfiles(i) = TRIM(PriPath)//TRIM(InputFileData%TStCfiles(i)) + enddo + + ! NumSStC - Number of platform structural controllers (integer) + call ParseVar( FileInfo_In, CurLine, 'NumSStC', InputFileData%NumSStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! SStCfiles - Name of the files for blade structural controllers (quoted strings) [unused when NumSStC==0] + call AllocAry( InputFileData%SStCfiles, InputFileData%NumSStC, 'SStCfile', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call ParseAry( FileInfo_In, CurLine, 'SStCfile', InputFileData%SStCfiles, InputFileData%NumSStC, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + do i=1,InputFileData%NumSStC + if ( PathIsRelative( InputFileData%SStCfiles(i) ) ) InputFileData%SStCfiles(i) = TRIM(PriPath)//TRIM(InputFileData%SStCfiles(i)) + enddo + + + !---------------------- BLADED INTERFACE ---------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! DLL_FileName - Name/location of the dynamic library {.dll [Windows] or .so [Linux]} in the Bladed-DLL format (-) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'DLL_FileName', InputFileData%DLL_FileName, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + IF ( PathIsRelative( InputFileData%DLL_FileName ) ) InputFileData%DLL_FileName = TRIM(PriPath)//TRIM(InputFileData%DLL_FileName) + ! DLL_InFile - Name of input file sent to the DLL (-) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'DLL_InFile', InputFileData%DLL_InFile, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + IF ( PathIsRelative( InputFileData%DLL_InFile ) ) InputFileData%DLL_InFile = TRIM(PriPath)//TRIM(InputFileData%DLL_InFile) + ! DLL_ProcName - Name of procedure in DLL to be called (-) [case sensitive; used only with DLL Interface] + call ParseVar( FileInfo_In, CurLine, 'DLL_ProcName', InputFileData%DLL_ProcName, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! DLL_DT - Communication interval for dynamic library (s) (or "default") [used only with Bladed Interface] + call ParseVarWDefault( FileInfo_In, CurLine, 'DLL_DT', InputFileData%DLL_DT, InputFileData%DT, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! DLL_Ramp - Whether a linear ramp should be used between DLL_DT time steps [introduces time shift when true] (flag) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'DLL_Ramp', InputFileData%DLL_Ramp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! BPCutoff - Cuttoff frequency for low-pass filter on blade pitch from DLL (Hz) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'BPCutoff', InputFileData%BPCutoff, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! NacYaw_North - Reference yaw angle of the nacelle when the upwind end points due North (deg) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'NacYaw_North', InputFileData%NacYaw_North, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%NacYaw_North = InputFileData%NacYaw_North*D2R + ! Ptch_Cntrl - Record 28: Use individual pitch control {0: collective pitch; 1: individual pitch control} (switch) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'Ptch_Cntrl', InputFileData%Ptch_Cntrl, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! Ptch_SetPnt - Record 5: Below-rated pitch angle set-point (deg) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'Ptch_SetPnt', InputFileData%Ptch_SetPnt, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%Ptch_SetPnt = InputFileData%Ptch_SetPnt*D2R + ! Ptch_Min - Record 6: Minimum pitch angle (deg) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'Ptch_Min', InputFileData%Ptch_Min, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%Ptch_Min = InputFileData%Ptch_Min*D2R + ! Ptch_Max - Record 7: Maximum pitch angle (deg) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'Ptch_Max', InputFileData%Ptch_Max, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%Ptch_Max = InputFileData%Ptch_Max*D2R + ! PtchRate_Min - Record 8: Minimum pitch rate (most negative value allowed) (deg/s) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'PtchRate_Min', InputFileData%PtchRate_Min, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%PtchRate_Min = InputFileData%PtchRate_Min*D2R + ! PtchRate_Max - Record 9: Maximum pitch rate (deg/s) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'PtchRate_Max', InputFileData%PtchRate_Max, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%PtchRate_Max = InputFileData%PtchRate_Max*D2R + ! Gain_OM - Record 16: Optimal mode gain (Nm/(rad/s)^2) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'Gain_OM', InputFileData%Gain_OM, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! GenSpd_MinOM - Record 17: Minimum generator speed (rpm) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'GenSpd_MinOM', InputFileData%GenSpd_MinOM, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%GenSpd_MinOM = InputFileData%GenSpd_MinOM*RPM2RPS + ! GenSpd_MaxOM - Record 18: Optimal mode maximum speed (rpm) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'GenSpd_MaxOM', InputFileData%GenSpd_MaxOM, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%GenSpd_MaxOM = InputFileData%GenSpd_MaxOM*RPM2RPS + ! GenSpd_Dem - Record 19: Demanded generator speed above rated (rpm) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'GenSpd_Dem', InputFileData%GenSpd_Dem, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%GenSpd_Dem = InputFileData%GenSpd_Dem*RPM2RPS + ! GenTrq_Dem - Record 22: Demanded generator torque above rated (Nm) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'GenTrq_Dem', InputFileData%GenTrq_Dem, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! GenPwr_Dem - Record 13: Demanded power (W) [used only with Bladed Interface] + call ParseVar( FileInfo_In, CurLine, 'GenPwr_Dem', InputFileData%GenPwr_Dem, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + !---------------------- BLADED INTERFACE TORQUE-SPEED LOOK-UP TABLE ------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! NKInpSt - Number of spring force input stations + call ParseVar( FileInfo_In, CurLine, 'DLL_NumTrq', InputFileData%DLL_NumTrq, ErrStat2, ErrMsg2, UnEcho) + if (Failed()) return + ! Section break -- GenSpd_TLU GenTrq_TLU + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') ' Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') ' Table Units: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + if (InputFileData%DLL_NumTrq > 0) then + CALL AllocAry( InputFileData%GenSpd_TLU, InputFileData%DLL_NumTrq, 'GenSpd_TLU', ErrStat2, ErrMsg2 ) + if (Failed()) return; + CALL AllocAry( InputFileData%GenTrq_TLU, InputFileData%DLL_NumTrq, 'GenTrq_TLU',ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! TABLE read + do i=1,InputFileData%DLL_NumTrq + call ParseAry ( FileInfo_In, CurLine, 'Coordinates', TmpRe2, 2, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%GenSpd_TLU(i) = TmpRe2(1)*RPM2RPS ! GenSpd_TLU - Records R:2:R+2*DLL_NumTrq-2: Generator speed values in look-up table (rpm) (read from file in rpm and converted to rad/s here) + InputFileData%GenTrq_TLU(i) = TmpRe2(2) ! GenTrq_TLU - Records R+1:2:R+2*DLL_NumTrq-1: Generator torque values in look-up table (Nm) + enddo + endif + + + + !---------------------- OUTPUT -------------------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! SumPrint - Print summary data to .sum (flag) (currently unused) + call ParseVar( FileInfo_In, CurLine, 'SumPrint', InputFileData%SumPrint, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! OutFile - Switch to determine where output will be placed: {1: in module output file only; 2: in glue code output file only; 3: both} (currently unused) + call ParseVar( FileInfo_In, CurLine, 'OutFile', InputFileData%OutFile, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + !PLACEHOLDER: OutFileFmt - Format for module tabular (time-marching) output: (1: text file [.out], 2: binary file [.outb], 3: both): + ! TabDelim - Use tab delimiters in text tabular output file? (flag) (currently unused) + call ParseVar( FileInfo_In, CurLine, 'TabDelim', InputFileData%TabDelim, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! OutFmt - Format used for text tabular output (except time). Resulting field should be 10 characters. (quoted string) (currently unused) + call ParseVar( FileInfo_In, CurLine, 'OutFmt', InputFileData%OutFmt, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! TStart - Time to begin tabular output (s) (currently unused) + call ParseVar( FileInfo_In, CurLine, 'TStart', InputFileData%TStart, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + !PLACEHOLDER: DecFact - Decimation factor for module's tabular output (1=output every step) (-): + + !---------------------- OUTLIST -------------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, & + InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + + call Cleanup() + return + +contains + !------------------------------------------------------------------------------------------------- + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + ! This fixes a strange compile issue with gfortran 9.1.0 on Mac where the CurLine and ErrStat end up sharing stack + ! space due to the -fstack_reuse="all" is set for any optimization. Can workaround with -fstack_reuse="none", but + ! have not found any other viable workaround other than using CurLine here in the Failed function + CurLine = CurLine + if (Failed) call Cleanup() + end function Failed + !------------------------------------------------------------------------------------------------- + subroutine Cleanup() + if (UnEcho > -1_IntKi) CLOSE( UnEcho ) + end subroutine Cleanup +end subroutine ParseInputFileInfo +!---------------------------------------------------------------------------------------------------------------------------------- + + + +!********************************************************************************************************************************** +! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" +! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these +! lines should be modified in the Matlab script and/or Excel worksheet as necessary. +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine checks to see if any requested output channel names (stored in the OutList(:)) are invalid. It returns a +!! warning if any of the channels are not available outputs from the module. +!! It assigns the settings for OutParam(:) (i.e, the index, name, and units of the output channels, WriteOutput(:)). +!! the sign is set to 0 if the channel is invalid. +!! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. +!! +!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 04-Feb-2021 08:42:27. +SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) +!.................................................................................................................................. + + IMPLICIT NONE + + ! Passed variables + + CHARACTER(ChanLen), INTENT(IN) :: OutList(:) !< The list out user-requested outputs + TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< The module parameters + INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code + CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred + + ! Local variables + + INTEGER :: ErrStat2 ! temporary (local) error status + INTEGER :: I ! Generic loop-counting index + INTEGER :: J ! Generic loop-counting index + INTEGER :: INDX ! Index for valid arrays + + LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) + LOGICAL :: InvalidOutput(0:MaxOutPts) ! This array determines if the output channel is valid for this configuration + CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) + CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam" + + CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(518) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically + "BLAIRFLC1 ","BLAIRFLC2 ","BLAIRFLC3 ","BLFLAP1 ","BLFLAP2 ","BLFLAP3 ", & + "BLPITCHC1 ","BLPITCHC2 ","BLPITCHC3 ","BSTC1_B1_FXI","BSTC1_B1_FXL","BSTC1_B1_FYI", & + "BSTC1_B1_FYL","BSTC1_B1_FZI","BSTC1_B1_FZL","BSTC1_B1_MXI","BSTC1_B1_MXL","BSTC1_B1_MYI", & + "BSTC1_B1_MYL","BSTC1_B1_MZI","BSTC1_B1_MZL","BSTC1_B1_XQ ","BSTC1_B1_XQD","BSTC1_B1_YQ ", & + "BSTC1_B1_YQD","BSTC1_B1_ZQ ","BSTC1_B1_ZQD","BSTC1_B2_FXI","BSTC1_B2_FXL","BSTC1_B2_FYI", & + "BSTC1_B2_FYL","BSTC1_B2_FZI","BSTC1_B2_FZL","BSTC1_B2_MXI","BSTC1_B2_MXL","BSTC1_B2_MYI", & + "BSTC1_B2_MYL","BSTC1_B2_MZI","BSTC1_B2_MZL","BSTC1_B2_XQ ","BSTC1_B2_XQD","BSTC1_B2_YQ ", & + "BSTC1_B2_YQD","BSTC1_B2_ZQ ","BSTC1_B2_ZQD","BSTC1_B3_FXI","BSTC1_B3_FXL","BSTC1_B3_FYI", & + "BSTC1_B3_FYL","BSTC1_B3_FZI","BSTC1_B3_FZL","BSTC1_B3_MXI","BSTC1_B3_MXL","BSTC1_B3_MYI", & + "BSTC1_B3_MYL","BSTC1_B3_MZI","BSTC1_B3_MZL","BSTC1_B3_XQ ","BSTC1_B3_XQD","BSTC1_B3_YQ ", & + "BSTC1_B3_YQD","BSTC1_B3_ZQ ","BSTC1_B3_ZQD","BSTC1_B4_FXI","BSTC1_B4_FXL","BSTC1_B4_FYI", & + "BSTC1_B4_FYL","BSTC1_B4_FZI","BSTC1_B4_FZL","BSTC1_B4_MXI","BSTC1_B4_MXL","BSTC1_B4_MYI", & + "BSTC1_B4_MYL","BSTC1_B4_MZI","BSTC1_B4_MZL","BSTC1_B4_XQ ","BSTC1_B4_XQD","BSTC1_B4_YQ ", & + "BSTC1_B4_YQD","BSTC1_B4_ZQ ","BSTC1_B4_ZQD","BSTC2_B1_FXI","BSTC2_B1_FXL","BSTC2_B1_FYI", & + "BSTC2_B1_FYL","BSTC2_B1_FZI","BSTC2_B1_FZL","BSTC2_B1_MXI","BSTC2_B1_MXL","BSTC2_B1_MYI", & + "BSTC2_B1_MYL","BSTC2_B1_MZI","BSTC2_B1_MZL","BSTC2_B1_XQ ","BSTC2_B1_XQD","BSTC2_B1_YQ ", & + "BSTC2_B1_YQD","BSTC2_B1_ZQ ","BSTC2_B1_ZQD","BSTC2_B2_FXI","BSTC2_B2_FXL","BSTC2_B2_FYI", & + "BSTC2_B2_FYL","BSTC2_B2_FZI","BSTC2_B2_FZL","BSTC2_B2_MXI","BSTC2_B2_MXL","BSTC2_B2_MYI", & + "BSTC2_B2_MYL","BSTC2_B2_MZI","BSTC2_B2_MZL","BSTC2_B2_XQ ","BSTC2_B2_XQD","BSTC2_B2_YQ ", & + "BSTC2_B2_YQD","BSTC2_B2_ZQ ","BSTC2_B2_ZQD","BSTC2_B3_FXI","BSTC2_B3_FXL","BSTC2_B3_FYI", & + "BSTC2_B3_FYL","BSTC2_B3_FZI","BSTC2_B3_FZL","BSTC2_B3_MXI","BSTC2_B3_MXL","BSTC2_B3_MYI", & + "BSTC2_B3_MYL","BSTC2_B3_MZI","BSTC2_B3_MZL","BSTC2_B3_XQ ","BSTC2_B3_XQD","BSTC2_B3_YQ ", & + "BSTC2_B3_YQD","BSTC2_B3_ZQ ","BSTC2_B3_ZQD","BSTC2_B4_FXI","BSTC2_B4_FXL","BSTC2_B4_FYI", & + "BSTC2_B4_FYL","BSTC2_B4_FZI","BSTC2_B4_FZL","BSTC2_B4_MXI","BSTC2_B4_MXL","BSTC2_B4_MYI", & + "BSTC2_B4_MYL","BSTC2_B4_MZI","BSTC2_B4_MZL","BSTC2_B4_XQ ","BSTC2_B4_XQD","BSTC2_B4_YQ ", & + "BSTC2_B4_YQD","BSTC2_B4_ZQ ","BSTC2_B4_ZQD","BSTC3_B1_FXI","BSTC3_B1_FXL","BSTC3_B1_FYI", & + "BSTC3_B1_FYL","BSTC3_B1_FZI","BSTC3_B1_FZL","BSTC3_B1_MXI","BSTC3_B1_MXL","BSTC3_B1_MYI", & + "BSTC3_B1_MYL","BSTC3_B1_MZI","BSTC3_B1_MZL","BSTC3_B1_XQ ","BSTC3_B1_XQD","BSTC3_B1_YQ ", & + "BSTC3_B1_YQD","BSTC3_B1_ZQ ","BSTC3_B1_ZQD","BSTC3_B2_FXI","BSTC3_B2_FXL","BSTC3_B2_FYI", & + "BSTC3_B2_FYL","BSTC3_B2_FZI","BSTC3_B2_FZL","BSTC3_B2_MXI","BSTC3_B2_MXL","BSTC3_B2_MYI", & + "BSTC3_B2_MYL","BSTC3_B2_MZI","BSTC3_B2_MZL","BSTC3_B2_XQ ","BSTC3_B2_XQD","BSTC3_B2_YQ ", & + "BSTC3_B2_YQD","BSTC3_B2_ZQ ","BSTC3_B2_ZQD","BSTC3_B3_FXI","BSTC3_B3_FXL","BSTC3_B3_FYI", & + "BSTC3_B3_FYL","BSTC3_B3_FZI","BSTC3_B3_FZL","BSTC3_B3_MXI","BSTC3_B3_MXL","BSTC3_B3_MYI", & + "BSTC3_B3_MYL","BSTC3_B3_MZI","BSTC3_B3_MZL","BSTC3_B3_XQ ","BSTC3_B3_XQD","BSTC3_B3_YQ ", & + "BSTC3_B3_YQD","BSTC3_B3_ZQ ","BSTC3_B3_ZQD","BSTC3_B4_FXI","BSTC3_B4_FXL","BSTC3_B4_FYI", & + "BSTC3_B4_FYL","BSTC3_B4_FZI","BSTC3_B4_FZL","BSTC3_B4_MXI","BSTC3_B4_MXL","BSTC3_B4_MYI", & + "BSTC3_B4_MYL","BSTC3_B4_MZI","BSTC3_B4_MZL","BSTC3_B4_XQ ","BSTC3_B4_XQD","BSTC3_B4_YQ ", & + "BSTC3_B4_YQD","BSTC3_B4_ZQ ","BSTC3_B4_ZQD","BSTC4_B1_FXI","BSTC4_B1_FXL","BSTC4_B1_FYI", & + "BSTC4_B1_FYL","BSTC4_B1_FZI","BSTC4_B1_FZL","BSTC4_B1_MXI","BSTC4_B1_MXL","BSTC4_B1_MYI", & + "BSTC4_B1_MYL","BSTC4_B1_MZI","BSTC4_B1_MZL","BSTC4_B1_XQ ","BSTC4_B1_XQD","BSTC4_B1_YQ ", & + "BSTC4_B1_YQD","BSTC4_B1_ZQ ","BSTC4_B1_ZQD","BSTC4_B2_FXI","BSTC4_B2_FXL","BSTC4_B2_FYI", & + "BSTC4_B2_FYL","BSTC4_B2_FZI","BSTC4_B2_FZL","BSTC4_B2_MXI","BSTC4_B2_MXL","BSTC4_B2_MYI", & + "BSTC4_B2_MYL","BSTC4_B2_MZI","BSTC4_B2_MZL","BSTC4_B2_XQ ","BSTC4_B2_XQD","BSTC4_B2_YQ ", & + "BSTC4_B2_YQD","BSTC4_B2_ZQ ","BSTC4_B2_ZQD","BSTC4_B3_FXI","BSTC4_B3_FXL","BSTC4_B3_FYI", & + "BSTC4_B3_FYL","BSTC4_B3_FZI","BSTC4_B3_FZL","BSTC4_B3_MXI","BSTC4_B3_MXL","BSTC4_B3_MYI", & + "BSTC4_B3_MYL","BSTC4_B3_MZI","BSTC4_B3_MZL","BSTC4_B3_XQ ","BSTC4_B3_XQD","BSTC4_B3_YQ ", & + "BSTC4_B3_YQD","BSTC4_B3_ZQ ","BSTC4_B3_ZQD","BSTC4_B4_FXI","BSTC4_B4_FXL","BSTC4_B4_FYI", & + "BSTC4_B4_FYL","BSTC4_B4_FZI","BSTC4_B4_FZL","BSTC4_B4_MXI","BSTC4_B4_MXL","BSTC4_B4_MYI", & + "BSTC4_B4_MYL","BSTC4_B4_MZI","BSTC4_B4_MZL","BSTC4_B4_XQ ","BSTC4_B4_XQD","BSTC4_B4_YQ ", & + "BSTC4_B4_YQD","BSTC4_B4_ZQ ","BSTC4_B4_ZQD","GENPWR ","GENTQ ","HSSBRTQC ", & + "NSTC1_FXI ","NSTC1_FXL ","NSTC1_FYI ","NSTC1_FYL ","NSTC1_FZI ","NSTC1_FZL ", & + "NSTC1_MXI ","NSTC1_MXL ","NSTC1_MYI ","NSTC1_MYL ","NSTC1_MZI ","NSTC1_MZL ", & + "NSTC1_XQ ","NSTC1_XQD ","NSTC1_YQ ","NSTC1_YQD ","NSTC1_ZQ ","NSTC1_ZQD ", & + "NSTC2_FXI ","NSTC2_FXL ","NSTC2_FYI ","NSTC2_FYL ","NSTC2_FZI ","NSTC2_FZL ", & + "NSTC2_MXI ","NSTC2_MXL ","NSTC2_MYI ","NSTC2_MYL ","NSTC2_MZI ","NSTC2_MZL ", & + "NSTC2_XQ ","NSTC2_XQD ","NSTC2_YQ ","NSTC2_YQD ","NSTC2_ZQ ","NSTC2_ZQD ", & + "NSTC3_FXI ","NSTC3_FXL ","NSTC3_FYI ","NSTC3_FYL ","NSTC3_FZI ","NSTC3_FZL ", & + "NSTC3_MXI ","NSTC3_MXL ","NSTC3_MYI ","NSTC3_MYL ","NSTC3_MZI ","NSTC3_MZL ", & + "NSTC3_XQ ","NSTC3_XQD ","NSTC3_YQ ","NSTC3_YQD ","NSTC3_ZQ ","NSTC3_ZQD ", & + "NSTC4_FXI ","NSTC4_FXL ","NSTC4_FYI ","NSTC4_FYL ","NSTC4_FZI ","NSTC4_FZL ", & + "NSTC4_MXI ","NSTC4_MXL ","NSTC4_MYI ","NSTC4_MYL ","NSTC4_MZI ","NSTC4_MZL ", & + "NSTC4_XQ ","NSTC4_XQD ","NSTC4_YQ ","NSTC4_YQD ","NSTC4_ZQ ","NSTC4_ZQD ", & + "SSTC1_FXI ","SSTC1_FXL ","SSTC1_FYI ","SSTC1_FYL ","SSTC1_FZI ","SSTC1_FZL ", & + "SSTC1_MXI ","SSTC1_MXL ","SSTC1_MYI ","SSTC1_MYL ","SSTC1_MZI ","SSTC1_MZL ", & + "SSTC1_XQ ","SSTC1_XQD ","SSTC1_YQ ","SSTC1_YQD ","SSTC1_ZQ ","SSTC1_ZQD ", & + "SSTC2_FXI ","SSTC2_FXL ","SSTC2_FYI ","SSTC2_FYL ","SSTC2_FZI ","SSTC2_FZL ", & + "SSTC2_MXI ","SSTC2_MXL ","SSTC2_MYI ","SSTC2_MYL ","SSTC2_MZI ","SSTC2_MZL ", & + "SSTC2_XQ ","SSTC2_XQD ","SSTC2_YQ ","SSTC2_YQD ","SSTC2_ZQ ","SSTC2_ZQD ", & + "SSTC3_FXI ","SSTC3_FXL ","SSTC3_FYI ","SSTC3_FYL ","SSTC3_FZI ","SSTC3_FZL ", & + "SSTC3_MXI ","SSTC3_MXL ","SSTC3_MYI ","SSTC3_MYL ","SSTC3_MZI ","SSTC3_MZL ", & + "SSTC3_XQ ","SSTC3_XQD ","SSTC3_YQ ","SSTC3_YQD ","SSTC3_ZQ ","SSTC3_ZQD ", & + "SSTC4_FXI ","SSTC4_FXL ","SSTC4_FYI ","SSTC4_FYL ","SSTC4_FZI ","SSTC4_FZL ", & + "SSTC4_MXI ","SSTC4_MXL ","SSTC4_MYI ","SSTC4_MYL ","SSTC4_MZI ","SSTC4_MZL ", & + "SSTC4_XQ ","SSTC4_XQD ","SSTC4_YQ ","SSTC4_YQD ","SSTC4_ZQ ","SSTC4_ZQD ", & + "TSTC1_FXI ","TSTC1_FXL ","TSTC1_FYI ","TSTC1_FYL ","TSTC1_FZI ","TSTC1_FZL ", & + "TSTC1_MXI ","TSTC1_MXL ","TSTC1_MYI ","TSTC1_MYL ","TSTC1_MZI ","TSTC1_MZL ", & + "TSTC1_XQ ","TSTC1_XQD ","TSTC1_YQ ","TSTC1_YQD ","TSTC1_ZQ ","TSTC1_ZQD ", & + "TSTC2_FXI ","TSTC2_FXL ","TSTC2_FYI ","TSTC2_FYL ","TSTC2_FZI ","TSTC2_FZL ", & + "TSTC2_MXI ","TSTC2_MXL ","TSTC2_MYI ","TSTC2_MYL ","TSTC2_MZI ","TSTC2_MZL ", & + "TSTC2_XQ ","TSTC2_XQD ","TSTC2_YQ ","TSTC2_YQD ","TSTC2_ZQ ","TSTC2_ZQD ", & + "TSTC3_FXI ","TSTC3_FXL ","TSTC3_FYI ","TSTC3_FYL ","TSTC3_FZI ","TSTC3_FZL ", & + "TSTC3_MXI ","TSTC3_MXL ","TSTC3_MYI ","TSTC3_MYL ","TSTC3_MZI ","TSTC3_MZL ", & + "TSTC3_XQ ","TSTC3_XQD ","TSTC3_YQ ","TSTC3_YQD ","TSTC3_ZQ ","TSTC3_ZQD ", & + "TSTC4_FXI ","TSTC4_FXL ","TSTC4_FYI ","TSTC4_FYL ","TSTC4_FZI ","TSTC4_FZL ", & + "TSTC4_MXI ","TSTC4_MXL ","TSTC4_MYI ","TSTC4_MYL ","TSTC4_MZI ","TSTC4_MZL ", & + "TSTC4_XQ ","TSTC4_XQD ","TSTC4_YQ ","TSTC4_YQD ","TSTC4_ZQ ","TSTC4_ZQD ", & + "YAWMOM ","YAWMOMCOM "/) + INTEGER(IntKi), PARAMETER :: ParamIndxAry(518) = (/ & ! This lists the index into AllOuts(:) of the allowed parameters ValidParamAry(:) + BlAirFlC1 , BlAirFlC2 , BlAirFlC3 , BlAirFlC1 , BlAirFlC2 , BlAirFlC3 , & + BlPitchC1 , BlPitchC2 , BlPitchC3 , BStC1_B1_Fxi , BStC1_B1_Fxl , BStC1_B1_Fyi , & + BStC1_B1_Fyl , BStC1_B1_Fzi , BStC1_B1_Fzl , BStC1_B1_Mxi , BStC1_B1_Mxl , BStC1_B1_Myi , & + BStC1_B1_Myl , BStC1_B1_Mzi , BStC1_B1_Mzl , BStC1_B1_XQ , BStC1_B1_XQD , BStC1_B1_YQ , & + BStC1_B1_YQD , BStC1_B1_ZQ , BStC1_B1_ZQD , BStC1_B2_Fxi , BStC1_B2_Fxl , BStC1_B2_Fyi , & + BStC1_B2_Fyl , BStC1_B2_Fzi , BStC1_B2_Fzl , BStC1_B2_Mxi , BStC1_B2_Mxl , BStC1_B2_Myi , & + BStC1_B2_Myl , BStC1_B2_Mzi , BStC1_B2_Mzl , BStC1_B2_XQ , BStC1_B2_XQD , BStC1_B2_YQ , & + BStC1_B2_YQD , BStC1_B2_ZQ , BStC1_B2_ZQD , BStC1_B3_Fxi , BStC1_B3_Fxl , BStC1_B3_Fyi , & + BStC1_B3_Fyl , BStC1_B3_Fzi , BStC1_B3_Fzl , BStC1_B3_Mxi , BStC1_B3_Mxl , BStC1_B3_Myi , & + BStC1_B3_Myl , BStC1_B3_Mzi , BStC1_B3_Mzl , BStC1_B3_XQ , BStC1_B3_XQD , BStC1_B3_YQ , & + BStC1_B3_YQD , BStC1_B3_ZQ , BStC1_B3_ZQD , BStC1_B4_Fxi , BStC1_B4_Fxl , BStC1_B4_Fyi , & + BStC1_B4_Fyl , BStC1_B4_Fzi , BStC1_B4_Fzl , BStC1_B4_Mxi , BStC1_B4_Mxl , BStC1_B4_Myi , & + BStC1_B4_Myl , BStC1_B4_Mzi , BStC1_B4_Mzl , BStC1_B4_XQ , BStC1_B4_XQD , BStC1_B4_YQ , & + BStC1_B4_YQD , BStC1_B4_ZQ , BStC1_B4_ZQD , BStC2_B1_Fxi , BStC2_B1_Fxl , BStC2_B1_Fyi , & + BStC2_B1_Fyl , BStC2_B1_Fzi , BStC2_B1_Fzl , BStC2_B1_Mxi , BStC2_B1_Mxl , BStC2_B1_Myi , & + BStC2_B1_Myl , BStC2_B1_Mzi , BStC2_B1_Mzl , BStC2_B1_XQ , BStC2_B1_XQD , BStC2_B1_YQ , & + BStC2_B1_YQD , BStC2_B1_ZQ , BStC2_B1_ZQD , BStC2_B2_Fxi , BStC2_B2_Fxl , BStC2_B2_Fyi , & + BStC2_B2_Fyl , BStC2_B2_Fzi , BStC2_B2_Fzl , BStC2_B2_Mxi , BStC2_B2_Mxl , BStC2_B2_Myi , & + BStC2_B2_Myl , BStC2_B2_Mzi , BStC2_B2_Mzl , BStC2_B2_XQ , BStC2_B2_XQD , BStC2_B2_YQ , & + BStC2_B2_YQD , BStC2_B2_ZQ , BStC2_B2_ZQD , BStC2_B3_Fxi , BStC2_B3_Fxl , BStC2_B3_Fyi , & + BStC2_B3_Fyl , BStC2_B3_Fzi , BStC2_B3_Fzl , BStC2_B3_Mxi , BStC2_B3_Mxl , BStC2_B3_Myi , & + BStC2_B3_Myl , BStC2_B3_Mzi , BStC2_B3_Mzl , BStC2_B3_XQ , BStC2_B3_XQD , BStC2_B3_YQ , & + BStC2_B3_YQD , BStC2_B3_ZQ , BStC2_B3_ZQD , BStC2_B4_Fxi , BStC2_B4_Fxl , BStC2_B4_Fyi , & + BStC2_B4_Fyl , BStC2_B4_Fzi , BStC2_B4_Fzl , BStC2_B4_Mxi , BStC2_B4_Mxl , BStC2_B4_Myi , & + BStC2_B4_Myl , BStC2_B4_Mzi , BStC2_B4_Mzl , BStC2_B4_XQ , BStC2_B4_XQD , BStC2_B4_YQ , & + BStC2_B4_YQD , BStC2_B4_ZQ , BStC2_B4_ZQD , BStC3_B1_Fxi , BStC3_B1_Fxl , BStC3_B1_Fyi , & + BStC3_B1_Fyl , BStC3_B1_Fzi , BStC3_B1_Fzl , BStC3_B1_Mxi , BStC3_B1_Mxl , BStC3_B1_Myi , & + BStC3_B1_Myl , BStC3_B1_Mzi , BStC3_B1_Mzl , BStC3_B1_XQ , BStC3_B1_XQD , BStC3_B1_YQ , & + BStC3_B1_YQD , BStC3_B1_ZQ , BStC3_B1_ZQD , BStC3_B2_Fxi , BStC3_B2_Fxl , BStC3_B2_Fyi , & + BStC3_B2_Fyl , BStC3_B2_Fzi , BStC3_B2_Fzl , BStC3_B2_Mxi , BStC3_B2_Mxl , BStC3_B2_Myi , & + BStC3_B2_Myl , BStC3_B2_Mzi , BStC3_B2_Mzl , BStC3_B2_XQ , BStC3_B2_XQD , BStC3_B2_YQ , & + BStC3_B2_YQD , BStC3_B2_ZQ , BStC3_B2_ZQD , BStC3_B3_Fxi , BStC3_B3_Fxl , BStC3_B3_Fyi , & + BStC3_B3_Fyl , BStC3_B3_Fzi , BStC3_B3_Fzl , BStC3_B3_Mxi , BStC3_B3_Mxl , BStC3_B3_Myi , & + BStC3_B3_Myl , BStC3_B3_Mzi , BStC3_B3_Mzl , BStC3_B3_XQ , BStC3_B3_XQD , BStC3_B3_YQ , & + BStC3_B3_YQD , BStC3_B3_ZQ , BStC3_B3_ZQD , BStC3_B4_Fxi , BStC3_B4_Fxl , BStC3_B4_Fyi , & + BStC3_B4_Fyl , BStC3_B4_Fzi , BStC3_B4_Fzl , BStC3_B4_Mxi , BStC3_B4_Mxl , BStC3_B4_Myi , & + BStC3_B4_Myl , BStC3_B4_Mzi , BStC3_B4_Mzl , BStC3_B4_XQ , BStC3_B4_XQD , BStC3_B4_YQ , & + BStC3_B4_YQD , BStC3_B4_ZQ , BStC3_B4_ZQD , BStC4_B1_Fxi , BStC4_B1_Fxl , BStC4_B1_Fyi , & + BStC4_B1_Fyl , BStC4_B1_Fzi , BStC4_B1_Fzl , BStC4_B1_Mxi , BStC4_B1_Mxl , BStC4_B1_Myi , & + BStC4_B1_Myl , BStC4_B1_Mzi , BStC4_B1_Mzl , BStC4_B1_XQ , BStC4_B1_XQD , BStC4_B1_YQ , & + BStC4_B1_YQD , BStC4_B1_ZQ , BStC4_B1_ZQD , BStC4_B2_Fxi , BStC4_B2_Fxl , BStC4_B2_Fyi , & + BStC4_B2_Fyl , BStC4_B2_Fzi , BStC4_B2_Fzl , BStC4_B2_Mxi , BStC4_B2_Mxl , BStC4_B2_Myi , & + BStC4_B2_Myl , BStC4_B2_Mzi , BStC4_B2_Mzl , BStC4_B2_XQ , BStC4_B2_XQD , BStC4_B2_YQ , & + BStC4_B2_YQD , BStC4_B2_ZQ , BStC4_B2_ZQD , BStC4_B3_Fxi , BStC4_B3_Fxl , BStC4_B3_Fyi , & + BStC4_B3_Fyl , BStC4_B3_Fzi , BStC4_B3_Fzl , BStC4_B3_Mxi , BStC4_B3_Mxl , BStC4_B3_Myi , & + BStC4_B3_Myl , BStC4_B3_Mzi , BStC4_B3_Mzl , BStC4_B3_XQ , BStC4_B3_XQD , BStC4_B3_YQ , & + BStC4_B3_YQD , BStC4_B3_ZQ , BStC4_B3_ZQD , BStC4_B4_Fxi , BStC4_B4_Fxl , BStC4_B4_Fyi , & + BStC4_B4_Fyl , BStC4_B4_Fzi , BStC4_B4_Fzl , BStC4_B4_Mxi , BStC4_B4_Mxl , BStC4_B4_Myi , & + BStC4_B4_Myl , BStC4_B4_Mzi , BStC4_B4_Mzl , BStC4_B4_XQ , BStC4_B4_XQD , BStC4_B4_YQ , & + BStC4_B4_YQD , BStC4_B4_ZQ , BStC4_B4_ZQD , GenPwr , GenTq , HSSBrTqC , & + NStC1_Fxi , NStC1_Fxl , NStC1_Fyi , NStC1_Fyl , NStC1_Fzi , NStC1_Fzl , & + NStC1_Mxi , NStC1_Mxl , NStC1_Myi , NStC1_Myl , NStC1_Mzi , NStC1_Mzl , & + NStC1_XQ , NStC1_XQD , NStC1_YQ , NStC1_YQD , NStC1_ZQ , NStC1_ZQD , & + NStC2_Fxi , NStC2_Fxl , NStC2_Fyi , NStC2_Fyl , NStC2_Fzi , NStC2_Fzl , & + NStC2_Mxi , NStC2_Mxl , NStC2_Myi , NStC2_Myl , NStC2_Mzi , NStC2_Mzl , & + NStC2_XQ , NStC2_XQD , NStC2_YQ , NStC2_YQD , NStC2_ZQ , NStC2_ZQD , & + NStC3_Fxi , NStC3_Fxl , NStC3_Fyi , NStC3_Fyl , NStC3_Fzi , NStC3_Fzl , & + NStC3_Mxi , NStC3_Mxl , NStC3_Myi , NStC3_Myl , NStC3_Mzi , NStC3_Mzl , & + NStC3_XQ , NStC3_XQD , NStC3_YQ , NStC3_YQD , NStC3_ZQ , NStC3_ZQD , & + NStC4_Fxi , NStC4_Fxl , NStC4_Fyi , NStC4_Fyl , NStC4_Fzi , NStC4_Fzl , & + NStC4_Mxi , NStC4_Mxl , NStC4_Myi , NStC4_Myl , NStC4_Mzi , NStC4_Mzl , & + NStC4_XQ , NStC4_XQD , NStC4_YQ , NStC4_YQD , NStC4_ZQ , NStC4_ZQD , & + SStC1_Fxi , SStC1_Fxl , SStC1_Fyi , SStC1_Fyl , SStC1_Fzi , SStC1_Fzl , & + SStC1_Mxi , SStC1_Mxl , SStC1_Myi , SStC1_Myl , SStC1_Mzi , SStC1_Mzl , & + SStC1_XQ , SStC1_XQD , SStC1_YQ , SStC1_YQD , SStC1_ZQ , SStC1_ZQD , & + SStC2_Fxi , SStC2_Fxl , SStC2_Fyi , SStC2_Fyl , SStC2_Fzi , SStC2_Fzl , & + SStC2_Mxi , SStC2_Mxl , SStC2_Myi , SStC2_Myl , SStC2_Mzi , SStC2_Mzl , & + SStC2_XQ , SStC2_XQD , SStC2_YQ , SStC2_YQD , SStC2_ZQ , SStC2_ZQD , & + SStC3_Fxi , SStC3_Fxl , SStC3_Fyi , SStC3_Fyl , SStC3_Fzi , SStC3_Fzl , & + SStC3_Mxi , SStC3_Mxl , SStC3_Myi , SStC3_Myl , SStC3_Mzi , SStC3_Mzl , & + SStC3_XQ , SStC3_XQD , SStC3_YQ , SStC3_YQD , SStC3_ZQ , SStC3_ZQD , & + SStC4_Fxi , SStC4_Fxl , SStC4_Fyi , SStC4_Fyl , SStC4_Fzi , SStC4_Fzl , & + SStC4_Mxi , SStC4_Mxl , SStC4_Myi , SStC4_Myl , SStC4_Mzi , SStC4_Mzl , & + SStC4_XQ , SStC4_XQD , SStC4_YQ , SStC4_YQD , SStC4_ZQ , SStC4_ZQD , & + TStC1_Fxi , TStC1_Fxl , TStC1_Fyi , TStC1_Fyl , TStC1_Fzi , TStC1_Fzl , & + TStC1_Mxi , TStC1_Mxl , TStC1_Myi , TStC1_Myl , TStC1_Mzi , TStC1_Mzl , & + TStC1_XQ , TStC1_XQD , TStC1_YQ , TStC1_YQD , TStC1_ZQ , TStC1_ZQD , & + TStC2_Fxi , TStC2_Fxl , TStC2_Fyi , TStC2_Fyl , TStC2_Fzi , TStC2_Fzl , & + TStC2_Mxi , TStC2_Mxl , TStC2_Myi , TStC2_Myl , TStC2_Mzi , TStC2_Mzl , & + TStC2_XQ , TStC2_XQD , TStC2_YQ , TStC2_YQD , TStC2_ZQ , TStC2_ZQD , & + TStC3_Fxi , TStC3_Fxl , TStC3_Fyi , TStC3_Fyl , TStC3_Fzi , TStC3_Fzl , & + TStC3_Mxi , TStC3_Mxl , TStC3_Myi , TStC3_Myl , TStC3_Mzi , TStC3_Mzl , & + TStC3_XQ , TStC3_XQD , TStC3_YQ , TStC3_YQD , TStC3_ZQ , TStC3_ZQD , & + TStC4_Fxi , TStC4_Fxl , TStC4_Fyi , TStC4_Fyl , TStC4_Fzi , TStC4_Fzl , & + TStC4_Mxi , TStC4_Mxl , TStC4_Myi , TStC4_Myl , TStC4_Mzi , TStC4_Mzl , & + TStC4_XQ , TStC4_XQD , TStC4_YQ , TStC4_YQD , TStC4_ZQ , TStC4_ZQD , & + YawMomCom , YawMomCom /) + CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(518) = (/ & ! This lists the units corresponding to the allowed parameters + "(-) ","(-) ","(-) ","(-) ","(-) ","(-) ", & + "(deg) ","(deg) ","(deg) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kN) ","(kN) ","(kN) ", & + "(kN) ","(kN) ","(kN) ","(kN-m)","(kN-m)","(kN-m)", & + "(kN-m)","(kN-m)","(kN-m)","(m) ","(m/s) ","(m) ", & + "(m/s) ","(m) ","(m/s) ","(kW) ","(kN-m)","(kN-m)", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN) ","(kN) ","(kN) ","(kN) ","(kN) ","(kN) ", & + "(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)","(kN-m)", & + "(m) ","(m/s) ","(m) ","(m/s) ","(m) ","(m/s) ", & + "(kN-m)","(kN-m)"/) + + + ! Initialize values + ErrStat = ErrID_None + ErrMsg = "" + InvalidOutput = .FALSE. + + + ! Determine which inputs are not valid + + InvalidOutput( BlAirFlC3) = ( p%NumBl < 3 ) + InvalidOutput( BlPitchC3) = ( p%NumBl < 3 ) + InvalidOutput( NStC1_XQ) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_XQD) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_YQ) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_YQD) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_ZQ) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_ZQD) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fxi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fyi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fzi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Mxi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Myi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Mzi) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fxl) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fyl) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Fzl) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Mxl) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Myl) = ( p%NumNStC<1 ) + InvalidOutput( NStC1_Mzl) = ( p%NumNStC<1 ) + InvalidOutput( NStC2_XQ) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_XQD) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_YQ) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_YQD) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_ZQ) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_ZQD) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fxi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fyi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fzi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Mxi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Myi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Mzi) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fxl) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fyl) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Fzl) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Mxl) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Myl) = ( p%NumNStC<2 ) + InvalidOutput( NStC2_Mzl) = ( p%NumNStC<2 ) + InvalidOutput( NStC3_XQ) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_XQD) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_YQ) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_YQD) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_ZQ) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_ZQD) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fxi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fyi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fzi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Mxi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Myi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Mzi) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fxl) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fyl) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Fzl) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Mxl) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Myl) = ( p%NumNStC<3 ) + InvalidOutput( NStC3_Mzl) = ( p%NumNStC<3 ) + InvalidOutput( NStC4_XQ) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_XQD) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_YQ) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_YQD) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_ZQ) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_ZQD) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fxi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fyi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fzi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Mxi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Myi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Mzi) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fxl) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fyl) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Fzl) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Mxl) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Myl) = ( p%NumNStC<4 ) + InvalidOutput( NStC4_Mzl) = ( p%NumNStC<4 ) + InvalidOutput( TStC1_XQ) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_XQD) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_YQ) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_YQD) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_ZQ) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_ZQD) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fxi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fyi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fzi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Mxi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Myi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Mzi) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fxl) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fyl) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Fzl) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Mxl) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Myl) = ( p%NumTStC<1 ) + InvalidOutput( TStC1_Mzl) = ( p%NumTStC<1 ) + InvalidOutput( TStC2_XQ) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_XQD) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_YQ) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_YQD) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_ZQ) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_ZQD) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fxi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fyi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fzi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Mxi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Myi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Mzi) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fxl) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fyl) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Fzl) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Mxl) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Myl) = ( p%NumTStC<2 ) + InvalidOutput( TStC2_Mzl) = ( p%NumTStC<2 ) + InvalidOutput( TStC3_XQ) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_XQD) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_YQ) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_YQD) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_ZQ) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_ZQD) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fxi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fyi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fzi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Mxi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Myi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Mzi) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fxl) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fyl) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Fzl) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Mxl) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Myl) = ( p%NumTStC<3 ) + InvalidOutput( TStC3_Mzl) = ( p%NumTStC<3 ) + InvalidOutput( TStC4_XQ) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_XQD) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_YQ) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_YQD) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_ZQ) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_ZQD) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fxi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fyi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fzi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Mxi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Myi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Mzi) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fxl) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fyl) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Fzl) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Mxl) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Myl) = ( p%NumTStC<4 ) + InvalidOutput( TStC4_Mzl) = ( p%NumTStC<4 ) + InvalidOutput( BStC1_B1_XQ) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_XQD) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput( BStC1_B1_YQ) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_YQD) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput( BStC1_B1_ZQ) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_ZQD) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fxi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fyi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fzi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Mxi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Myi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Mzi) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fxl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fyl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Fzl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Mxl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Myl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput(BStC1_B1_Mzl) = ( p%NumBStC<1 .or. p%NumBl<1 ) + InvalidOutput( BStC2_B1_XQ) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_XQD) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput( BStC2_B1_YQ) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_YQD) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput( BStC2_B1_ZQ) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_ZQD) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fxi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fyi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fzi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Mxi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Myi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Mzi) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fxl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fyl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Fzl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Mxl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Myl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput(BStC2_B1_Mzl) = ( p%NumBStC<2 .or. p%NumBl<1 ) + InvalidOutput( BStC3_B1_XQ) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_XQD) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput( BStC3_B1_YQ) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_YQD) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput( BStC3_B1_ZQ) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_ZQD) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fxi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fyi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fzi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Mxi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Myi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Mzi) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fxl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fyl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Fzl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Mxl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Myl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput(BStC3_B1_Mzl) = ( p%NumBStC<3 .or. p%NumBl<1 ) + InvalidOutput( BStC4_B1_XQ) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_XQD) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput( BStC4_B1_YQ) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_YQD) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput( BStC4_B1_ZQ) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_ZQD) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fxi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fyi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fzi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Mxi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Myi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Mzi) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fxl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fyl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Fzl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Mxl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Myl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput(BStC4_B1_Mzl) = ( p%NumBStC<4 .or. p%NumBl<1 ) + InvalidOutput( BStC1_B2_XQ) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_XQD) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput( BStC1_B2_YQ) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_YQD) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput( BStC1_B2_ZQ) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_ZQD) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fxi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fyi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fzi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Mxi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Myi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Mzi) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fxl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fyl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Fzl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Mxl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Myl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput(BStC1_B2_Mzl) = ( p%NumBStC<1 .or. p%NumBl<2 ) + InvalidOutput( BStC2_B2_XQ) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_XQD) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput( BStC2_B2_YQ) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_YQD) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput( BStC2_B2_ZQ) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_ZQD) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fxi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fyi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fzi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Mxi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Myi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Mzi) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fxl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fyl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Fzl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Mxl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Myl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput(BStC2_B2_Mzl) = ( p%NumBStC<2 .or. p%NumBl<2 ) + InvalidOutput( BStC3_B2_XQ) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_XQD) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput( BStC3_B2_YQ) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_YQD) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput( BStC3_B2_ZQ) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_ZQD) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fxi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fyi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fzi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Mxi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Myi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Mzi) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fxl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fyl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Fzl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Mxl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Myl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput(BStC3_B2_Mzl) = ( p%NumBStC<3 .or. p%NumBl<2 ) + InvalidOutput( BStC4_B2_XQ) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_XQD) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput( BStC4_B2_YQ) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_YQD) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput( BStC4_B2_ZQ) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_ZQD) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fxi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fyi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fzi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Mxi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Myi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Mzi) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fxl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fyl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Fzl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Mxl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Myl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput(BStC4_B2_Mzl) = ( p%NumBStC<4 .or. p%NumBl<2 ) + InvalidOutput( BStC1_B3_XQ) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_XQD) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput( BStC1_B3_YQ) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_YQD) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput( BStC1_B3_ZQ) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_ZQD) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fxi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fyi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fzi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Mxi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Myi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Mzi) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fxl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fyl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Fzl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Mxl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Myl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput(BStC1_B3_Mzl) = ( p%NumBStC<1 .or. p%NumBl<3 ) + InvalidOutput( BStC2_B3_XQ) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_XQD) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput( BStC2_B3_YQ) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_YQD) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput( BStC2_B3_ZQ) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_ZQD) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fxi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fyi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fzi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Mxi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Myi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Mzi) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fxl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fyl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Fzl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Mxl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Myl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput(BStC2_B3_Mzl) = ( p%NumBStC<2 .or. p%NumBl<3 ) + InvalidOutput( BStC3_B3_XQ) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_XQD) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput( BStC3_B3_YQ) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_YQD) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput( BStC3_B3_ZQ) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_ZQD) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fxi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fyi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fzi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Mxi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Myi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Mzi) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fxl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fyl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Fzl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Mxl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Myl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput(BStC3_B3_Mzl) = ( p%NumBStC<3 .or. p%NumBl<3 ) + InvalidOutput( BStC4_B3_XQ) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_XQD) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput( BStC4_B3_YQ) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_YQD) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput( BStC4_B3_ZQ) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_ZQD) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fxi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fyi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fzi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Mxi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Myi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Mzi) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fxl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fyl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Fzl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Mxl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Myl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput(BStC4_B3_Mzl) = ( p%NumBStC<4 .or. p%NumBl<3 ) + InvalidOutput( BStC1_B4_XQ) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_XQD) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput( BStC1_B4_YQ) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_YQD) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput( BStC1_B4_ZQ) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_ZQD) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fxi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fyi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fzi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Mxi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Myi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Mzi) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fxl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fyl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Fzl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Mxl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Myl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput(BStC1_B4_Mzl) = ( p%NumBStC<1 .or. p%NumBl<4 ) + InvalidOutput( BStC2_B4_XQ) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_XQD) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput( BStC2_B4_YQ) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_YQD) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput( BStC2_B4_ZQ) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_ZQD) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fxi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fyi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fzi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Mxi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Myi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Mzi) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fxl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fyl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Fzl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Mxl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Myl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput(BStC2_B4_Mzl) = ( p%NumBStC<2 .or. p%NumBl<4 ) + InvalidOutput( BStC3_B4_XQ) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_XQD) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput( BStC3_B4_YQ) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_YQD) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput( BStC3_B4_ZQ) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_ZQD) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fxi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fyi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fzi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Mxi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Myi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Mzi) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fxl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fyl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Fzl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Mxl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Myl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput(BStC3_B4_Mzl) = ( p%NumBStC<3 .or. p%NumBl<4 ) + InvalidOutput( BStC4_B4_XQ) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_XQD) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput( BStC4_B4_YQ) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_YQD) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput( BStC4_B4_ZQ) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_ZQD) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fxi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fyi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fzi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Mxi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Myi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Mzi) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fxl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fyl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Fzl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Mxl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Myl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput(BStC4_B4_Mzl) = ( p%NumBStC<4 .or. p%NumBl<4 ) + InvalidOutput( SStC1_XQ) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_XQD) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_YQ) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_YQD) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_ZQ) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_ZQD) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fxi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fyi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fzi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Mxi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Myi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Mzi) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fxl) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fyl) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Fzl) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Mxl) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Myl) = ( p%NumSStC<1 ) + InvalidOutput( SStC1_Mzl) = ( p%NumSStC<1 ) + InvalidOutput( SStC2_XQ) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_XQD) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_YQ) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_YQD) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_ZQ) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_ZQD) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fxi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fyi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fzi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Mxi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Myi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Mzi) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fxl) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fyl) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Fzl) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Mxl) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Myl) = ( p%NumSStC<2 ) + InvalidOutput( SStC2_Mzl) = ( p%NumSStC<2 ) + InvalidOutput( SStC3_XQ) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_XQD) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_YQ) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_YQD) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_ZQ) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_ZQD) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fxi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fyi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fzi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Mxi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Myi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Mzi) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fxl) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fyl) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Fzl) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Mxl) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Myl) = ( p%NumSStC<3 ) + InvalidOutput( SStC3_Mzl) = ( p%NumSStC<3 ) + InvalidOutput( SStC4_XQ) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_XQD) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_YQ) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_YQD) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_ZQ) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_ZQD) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fxi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fyi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fzi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Mxi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Myi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Mzi) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fxl) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fyl) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Fzl) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Mxl) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Myl) = ( p%NumSStC<4 ) + InvalidOutput( SStC4_Mzl) = ( p%NumSStC<4 ) + + + !------------------------------------------------------------------------------------------------- + ! Allocate and set index, name, and units for the output channels + ! If a selected output channel is not available in this module, set error flag. + !------------------------------------------------------------------------------------------------- + + ALLOCATE ( p%OutParam(0:p%NumOuts) , STAT=ErrStat2 ) + IF ( ErrStat2 /= 0_IntKi ) THEN + CALL SetErrStat( ErrID_Fatal,"Error allocating memory for the ServoDyn OutParam array.", ErrStat, ErrMsg, RoutineName ) + RETURN + ENDIF + + ! Set index, name, and units for the time output channel: + + p%OutParam(0)%Indx = Time + p%OutParam(0)%Name = "Time" ! OutParam(0) is the time channel by default. + p%OutParam(0)%Units = "(s)" + p%OutParam(0)%SignM = 1 + + + ! Set index, name, and units for all of the output channels. + ! If a selected output channel is not available by this module set ErrStat = ErrID_Warn. + + DO I = 1,p%NumOuts + + p%OutParam(I)%Name = OutList(I) + OutListTmp = OutList(I) + + ! Reverse the sign (+/-) of the output channel if the user prefixed the + ! channel name with a "-", "_", "m", or "M" character indicating "minus". + + + CheckOutListAgain = .FALSE. + + IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN + p%OutParam(I)%SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name) + CheckOutListAgain = .TRUE. + p%OutParam(I)%SignM = 1 + ELSE + p%OutParam(I)%SignM = 1 + END IF + + CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case + + + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) + + + ! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1) + + IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again + p%OutParam(I)%SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) + END IF + + + IF ( Indx > 0 ) THEN ! we found the channel name + IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings + p%OutParam(I)%Indx = 0 ! pick any valid channel (I just picked "Time=0" here because it's universal) + p%OutParam(I)%Units = "INVALID" + p%OutParam(I)%SignM = 0 + ELSE + p%OutParam(I)%Indx = ParamIndxAry(Indx) + p%OutParam(I)%Units = ParamUnitsAry(Indx) ! it's a valid output + END IF + ELSE ! this channel isn't valid + p%OutParam(I)%Indx = 0 ! pick any valid channel (I just picked "Time=0" here because it's universal) + p%OutParam(I)%Units = "INVALID" + p%OutParam(I)%SignM = 0 ! multiply all results by zero + + CALL SetErrStat(ErrID_Fatal, TRIM(p%OutParam(I)%Name)//" is not an available output channel.",ErrStat,ErrMsg,RoutineName) + END IF + + END DO + + RETURN +END SUBROUTINE SetOutParam +!---------------------------------------------------------------------------------------------------------------------------------- +!End of code generated by Matlab script +!********************************************************************************************************************************** +END MODULE ServoDyn_IO +!********************************************************************************************************************************** diff --git a/modules/servodyn/src/ServoDyn_Registry.txt b/modules/servodyn/src/ServoDyn_Registry.txt index a157ab73e6..527552d2ff 100644 --- a/modules/servodyn/src/ServoDyn_Registry.txt +++ b/modules/servodyn/src/ServoDyn_Registry.txt @@ -12,7 +12,7 @@ # ...... Include files (definitions from NWTC Library) ............................................................................ include Registry_NWTC_Library.txt -usefrom TMD_Registry.txt +usefrom StrucCtrl_Registry.txt # ..... Initialization data ....................................................................................................... # Define inputs that the initialization routine may need here: @@ -21,17 +21,30 @@ typedef ^ InitInputType Logical Linearize - .FALSE. - "Flag that tells this modu typedef ^ InitInputType IntKi NumBl - - - "Number of blades on the turbine" - typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - typedef ^ InitInputType ReKi BlPitchInit {:} - - "Initial blade pitch" - -typedef ^ InitInputType ReKi Gravity - - - "Gravitational acceleration" m/s^2 -typedef ^ InitInputType ReKi r_N_O_G {3} - - "nacelle origin for setting up mesh" m -typedef ^ InitInputType ReKi r_TwrBase {3} - - "tower base origin for setting up mesh" m +typedef ^ InitInputType ReKi Gravity {3} - - "Gravitational acceleration vector" m/s^2 +typedef ^ InitInputType ReKi NacPosition {3} - - "nacelle origin for setting up mesh" m +typedef ^ InitInputType R8Ki NacOrientation {3}{3} - - "nacelle orientation for setting up mesh" - +typedef ^ InitInputType ReKi TwrBasePos {3} - - "tower base origin for setting up mesh" m +typedef ^ InitInputType R8Ki TwrBaseOrient {3}{3} - - "tower base orientation for setting up mesh" m +typedef ^ InitInputType ReKi PlatformPos {3} - - "platform origin for setting up mesh" m +typedef ^ InitInputType R8Ki PlatformOrient {3}{3} - - "platform orientation for setting up mesh" m typedef ^ InitInputType DbKi Tmax - - - "max time from glue code" s typedef ^ InitInputType ReKi AvgWindSpeed - - - "average wind speed for the simulation" m/s typedef ^ InitInputType ReKi AirDens - - - "air density" kg/m^3 -typedef ^ InitInputType IntKi NumSC2Ctrl - - - "number of controller inputs [from supercontroller]" - +typedef ^ InitInputType IntKi NumSC2CtrlGlob - - - "number of global controller inputs [from supercontroller]" - +typedef ^ InitInputType IntKi NumSC2Ctrl - - - "number of turbine specific controller inputs [from supercontroller]" - typedef ^ InitInputType IntKi NumCtrl2SC - - - "number of controller outputs [to supercontroller]" - typedef ^ InitInputType IntKi TrimCase - - - "Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True]" - typedef ^ InitInputType ReKi TrimGain - - - "Proportional gain for the rotational speed error (>0) [used only if TrimCase>0]" "rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque" typedef ^ InitInputType ReKi RotSpeedRef - - - "Reference rotor speed" "rad/s" +typedef ^ InitInputType ReKi BladeRootPosition {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki BladeRootOrientation {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - +typedef ^ InitInputType LOGICAL UseInputFile - .TRUE. - "read input from input file" - +typedef ^ InitInputType FileInfoType PassedPrimaryInputData - - - "Primary input file as FileInfoType (set by driver/glue code)" - +#ADD in the TMD submodule input file passing here +typedef ^ InitInputType ReKi fromSCGlob {:} - - "Initial global inputs to the controller [from the supercontroller]" - +typedef ^ InitInputType ReKi fromSC {:} - - "Initial turbine specific inputs to the controller [from the supercontroller]" - + # Define outputs from the initialization routine here: typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - @@ -49,6 +62,7 @@ typedef ^ InitOutputType LOGICAL IsLoad_u {:} - - # This is data defined in the Input File for this module (or could otherwise be passed in) # ..... Primary Input file data ........................................................................................................... typedef ServoDyn/SrvD SrvD_InputFile DbKi DT - - - "Communication interval for controllers" s +typedef ^ SrvD_InputFile LOGICAL Echo - - - "Echo the input file out" - typedef ^ SrvD_InputFile IntKi PCMode - - - "Pitch control mode" - typedef ^ SrvD_InputFile DbKi TPCOn - - - "Time to enable active pitch control [unused when PCMode=0]" s typedef ^ SrvD_InputFile DbKi TPitManS 3 - - "Time to start override pitch maneuver for blade (K) and end standard pitch control" s @@ -122,10 +136,15 @@ typedef ^ SrvD_InputFile IntKi DLL_NumTrq - - - "Record 26: No. of points in tor typedef ^ SrvD_InputFile ReKi GenSpd_TLU {:} - - "Records R:2:R+2*DLL_NumTrq-2: Generator speed values in look-up table [used only with DLL Interface]" rad/s typedef ^ SrvD_InputFile ReKi GenTrq_TLU {:} - - "Records R+1:2:R+2*DLL_NumTrq-1: Generator torque values in look-up table [used only with DLL Interface]" Nm typedef ^ SrvD_InputFile LOGICAL UseLegacyInterface - - - "Flag that determines if the legacy Bladed interface is (legacy=DISCON with avrSWAP instead of CONTROLLER)" - -typedef ^ SrvD_InputFile LOGICAL CompNTMD - - - "Compute nacelle tuned mass damper {true/false}" - -typedef ^ SrvD_InputFile CHARACTER(1024) NTMDfile - - - "File for nacelle tuned mass damper (quoted string)" - -typedef ^ SrvD_InputFile LOGICAL CompTTMD - - - "Compute tower tuned mass damper {true/false}" - -typedef ^ SrvD_InputFile CHARACTER(1024) TTMDfile - - - "File for tower tuned mass damper (quoted string)" - + +typedef ^ SrvD_InputFile IntKi NumBStC - - - "Number of blade structural controllers (integer)" - +typedef ^ SrvD_InputFile CHARACTER(1024) BStCfiles {:} - - "Name of the files for blade structural controllers (quoted strings) [unused when NumBStC==0]" - +typedef ^ SrvD_InputFile IntKi NumNStC - - - "Number of nacelle structural controllers (integer)" - +typedef ^ SrvD_InputFile CHARACTER(1024) NStCfiles {:} - - "Name of the files for nacelle structural controllers (quoted strings) [unused when NumNStC==0]" - +typedef ^ SrvD_InputFile IntKi NumTStC - - - "Number of tower structural controllers (integer)" - +typedef ^ SrvD_InputFile CHARACTER(1024) TStCfiles {:} - - "Name of the files for tower structural controllers (quoted strings) [unused when NumTStC==0]" - +typedef ^ SrvD_InputFile IntKi NumSStC - - - "Number of substructure structural controllers (integer)" - +typedef ^ SrvD_InputFile CHARACTER(1024) SStCfiles {:} - - "Name of the files for subtructure structural controllers (quoted strings) [unused when NumSStC==0]" - # ..... Data for using Bladed DLLs ....................................................................................................... typedef ^ BladedDLLType SiKi avrSWAP {:} - - "The swap array: used to pass data to and from the DLL controller" "see Bladed DLL documentation" @@ -138,7 +157,7 @@ typedef ^ BladedDLLType ReKi PrevBlPitch 3 - - "Previously commanded blade pitch typedef ^ BladedDLLType ReKi BlAirfoilCom 3 - - "Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables)" - typedef ^ BladedDLLType ReKi ElecPwr_prev - - - "Electrical power (from previous step), sent to Bladed DLL" W typedef ^ BladedDLLType ReKi GenTrq_prev - - - "Electrical generator torque (from previous step), sent to Bladed DLL" N-m -typedef ^ BladedDLLType SiKi SCoutput {:} - - "controller output to supercontroller" - +typedef ^ BladedDLLType SiKi toSC {:} - - "controller output to supercontroller" - typedef ^ BladedDLLType logical initialized - - - "flag that determines if DLL has been called (for difference between CalcOutput and UpdateStates)" - typedef ^ BladedDLLType INTEGER NumLogChannels - - - "number of log channels from controller" - typedef ^ BladedDLLType OutParmType LogChannels_OutParam {:} - - "Names and units (and other characteristics) of logging outputs from DLL" - @@ -202,19 +221,25 @@ typedef ^ BladedDLLType IntKi Yaw_Cntrl - - - "Yaw control: 0 = rate; 1 = torqu # ..... States .................................................................................................................... # Define continuous (differentiable) states here: typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - -typedef ^ ContinuousStateType TMD_ContinuousStateType NTMD - - - "TMD module states - nacelle" - -typedef ^ ContinuousStateType TMD_ContinuousStateType TTMD - - - "TMD module states - tower" - +typedef ^ ContinuousStateType StC_ContinuousStateType BStC {:} - - "StC module states - blade" - +typedef ^ ContinuousStateType StC_ContinuousStateType NStC {:} - - "StC module states - nacelle" - +typedef ^ ContinuousStateType StC_ContinuousStateType TStC {:} - - "StC module states - tower" - +typedef ^ ContinuousStateType StC_ContinuousStateType SStC {:} - - "StC module inputs - substructure" - # Define discrete (nondifferentiable) states here: typedef ^ DiscreteStateType ReKi CtrlOffset - - - "Controller offset parameter" N-m #typedef ^ DiscreteStateType ReKi BlPitchFilter {:} - - "blade pitch filter" - -typedef ^ DiscreteStateType TMD_DiscreteStateType NTMD - - - "TMD module states - nacelle" - -typedef ^ DiscreteStateType TMD_DiscreteStateType TTMD - - - "TMD module states - tower" - +typedef ^ DiscreteStateType StC_DiscreteStateType BStC {:} - - "StC module states - blade" - +typedef ^ DiscreteStateType StC_DiscreteStateType NStC {:} - - "StC module states - nacelle" - +typedef ^ DiscreteStateType StC_DiscreteStateType TStC {:} - - "StC module states - tower" - +typedef ^ DiscreteStateType StC_DiscreteStateType SStC {:} - - "StC module inputs - substructure" - # Define constraint states here: typedef ^ ConstraintStateType ReKi DummyConstrState - - - "Remove this variable if you have constraint states" - -typedef ^ ConstraintStateType TMD_ConstraintStateType NTMD - - - "TMD module states - nacelle" - -typedef ^ ConstraintStateType TMD_ConstraintStateType TTMD - - - "TMD module states - tower" - +typedef ^ ConstraintStateType StC_ConstraintStateType BStC {:} - - "StC module states - blade" - +typedef ^ ConstraintStateType StC_ConstraintStateType NStC {:} - - "StC module states - nacelle" - +typedef ^ ConstraintStateType StC_ConstraintStateType TStC {:} - - "StC module states - tower" - +typedef ^ ConstraintStateType StC_ConstraintStateType SStC {:} - - "StC module inputs - substructure" - # Define "other" states (e.g. logical states) here: # other states for pitch maneuver: @@ -233,9 +258,11 @@ typedef ^ OtherStateType DbKi TTpBrFl {:} - - "Times at which tip brakes are ful # other states for generator on/off: typedef ^ OtherStateType Logical Off4Good - - - "Is the generator offline for rest of simulation?" - typedef ^ OtherStateType Logical GenOnLine - - - "Is the generator online?" - -# other states for TMD sub-module: -typedef ^ OtherStateType TMD_OtherStateType NTMD - - - "TMD module states - nacelle" - -typedef ^ OtherStateType TMD_OtherStateType TTMD - - - "TMD module states - tower" - +# other states for StC sub-module: +typedef ^ OtherStateType StC_OtherStateType BStC {:} - - "StC module states - blade" - +typedef ^ OtherStateType StC_OtherStateType NStC {:} - - "StC module states - nacelle" - +typedef ^ OtherStateType StC_OtherStateType TStC {:} - - "StC module states - tower" - +typedef ^ OtherStateType StC_OtherStateType SStC {:} - - "StC module inputs - substructure" - # ..... Misc Variables ................................................................................................................ typedef ^ MiscVarType DbKi LastTimeCalled - - - "last time the CalcOutput/Bladed DLL was called" s @@ -243,8 +270,10 @@ typedef ^ MiscVarType BladedDLLType dll_data - - - "data used for Bladed DLL" - typedef ^ MiscVarType logical FirstWarn - - - "Whether or not this is the first warning about the DLL being called without Explicit-Loose coupling." - typedef ^ MiscVarType DbKi LastTimeFiltered - - - "last time the CalcOutput/Bladed DLL was filtered" s typedef ^ MiscVarType ReKi xd_BlPitchFilter {:} - - "blade pitch filter" - -typedef ^ MiscVarType TMD_MiscVarType NTMD - - - "TMD module misc vars - nacelle" - -typedef ^ MiscVarType TMD_MiscVarType TTMD - - - "TMD module misc vars - tower" - +typedef ^ MiscVarType StC_MiscVarType BStC {:} - - "StC module misc vars - blade" - +typedef ^ MiscVarType StC_MiscVarType NStC {:} - - "StC module misc vars - nacelle" - +typedef ^ MiscVarType StC_MiscVarType TStC {:} - - "StC module misc vars - tower" - +typedef ^ MiscVarType StC_MiscVarType SStC {:} - - "StC module misc vars - substructure" - # ..... Parameters ................................................................................................................ # Define parameters here: @@ -310,8 +339,10 @@ typedef ^ ParameterType ReKi TBDepISp {:} - - "Deployment-initiation speed for t typedef ^ ParameterType ReKi TBDrConN - - - "Tip-brake drag constant during normal operation, Cd*Area" typedef ^ ParameterType ReKi TBDrConD - - - "Tip-brake drag constant during fully-deployed operation, Cd*Area" typedef ^ ParameterType IntKi NumBl - - - "Number of blades on the turbine" - -typedef ^ ParameterType LOGICAL CompNTMD - - - "Compute nacelle tuned mass damper {true/false}" - -typedef ^ ParameterType LOGICAL CompTTMD - - - "Compute tower tuned mass damper {true/false}" - +typedef ^ ParameterType IntKi NumBStC - - - "Number of blade structural controllers (integer)" - +typedef ^ ParameterType IntKi NumNStC - - - "Number of nacelle structural controllers (integer)" - +typedef ^ ParameterType IntKi NumTStC - - - "Number of tower structural controllers (integer)" - +typedef ^ ParameterType IntKi NumSStC - - - "Number of substructure structural controllers (integer)" - # parameters for output typedef ^ ParameterType IntKi NumOuts - - - "Number of parameters in the output list (number of outputs requested)" - typedef ^ ParameterType IntKi NumOuts_DLL - - - "Number of logging channels output from the DLL (set at initialization)" - @@ -334,8 +365,11 @@ typedef ^ ParameterType IntKi TrimCase - - - "Controller parameter to be trimmed typedef ^ ParameterType ReKi TrimGain - - - "Proportional gain for the rotational speed error (>0) [used only if TrimCase>0]" "rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque" typedef ^ ParameterType ReKi RotSpeedRef - - - "Reference rotor speed" "rad/s" # parameters for other modules: -typedef ^ ParameterType TMD_ParameterType NTMD - - - "TMD module parameters - nacelle" - -typedef ^ ParameterType TMD_ParameterType TTMD - - - "TMD module parameters - tower" - +typedef ^ ParameterType StC_ParameterType BStC {:} - - "StC module parameters - blade" - +typedef ^ ParameterType StC_ParameterType NStC {:} - - "StC module parameters - nacelle" - +typedef ^ ParameterType StC_ParameterType TStC {:} - - "StC module parameters - tower" - +typedef ^ ParameterType StC_ParameterType SStC {:} - - "StC module parameters - substructure" - +typedef ^ ParameterType LOGICAL UseSC - - - "Supercontroller on/off flag" - # ..... Inputs .................................................................................................................... # Define inputs that are not on this mesh here: @@ -372,9 +406,13 @@ typedef ^ InputType ReKi NcIMURAzs - - - "Nacelle inertial measurement unit angu typedef ^ InputType ReKi RotPwr - - - "Rotor power (this is equivalent to the low-speed shaft power)" W typedef ^ InputType ReKi HorWindV - - - "Horizontal hub-height wind velocity magnitude" m/s typedef ^ InputType ReKi YawAngle - - 2pi "Estimate of yaw (nacelle + platform)" radians -typedef ^ InputType TMD_InputType NTMD - - - "TMD module inputs - nacelle" - -typedef ^ InputType TMD_InputType TTMD - - - "TMD module inputs - tower" - -typedef ^ InputType SiKi SuperController {:} - - "A swap array: used to pass input data to the DLL controller from the supercontroller" - +typedef ^ InputType StC_InputType BStC {:} - - "StC module inputs - blade" - +typedef ^ InputType StC_InputType NStC {:} - - "StC module inputs - nacelle" - +typedef ^ InputType StC_InputType TStC {:} - - "StC module inputs - tower" - +typedef ^ InputType StC_InputType SStC {:} - - "StC module inputs - substructure" - +typedef ^ InputType SiKi fromSC {:} - - "A swap array: used to pass turbine specific input data to the DLL controller from the supercontroller" - +typedef ^ InputType SiKi fromSCglob {:} - - "A swap array: used to pass global input data to the DLL controller from the supercontroller" - +typedef ^ InputType SiKi Lidar {:} - - "A swap array: used to pass input data to the DLL controller from the Lidar" - # ..... Outputs ................................................................................................................... # Define outputs that are contained on the mesh here: @@ -388,7 +426,9 @@ typedef ^ OutputType ReKi GenTrq - - - "Electrical generator torque" N-m typedef ^ OutputType ReKi HSSBrTrqC - - - "Commanded HSS brake torque" N-m typedef ^ OutputType ReKi ElecPwr - - - "Electrical power" W typedef ^ OutputType ReKi TBDrCon {:} - - "Instantaneous tip-brake drag constant, Cd*Area" -typedef ^ OutputType TMD_OutputType NTMD - - - "TMD module outputs - nacelle" - -typedef ^ OutputType TMD_OutputType TTMD - - - "TMD module outputs - tower" - -typedef ^ OutputType SiKi SuperController {:} - - "A swap array: used to pass output data from the DLL controller to the supercontroller" - - +typedef ^ OutputType StC_OutputType BStC {:} - - "StC module outputs - blade" - +typedef ^ OutputType StC_OutputType NStC {:} - - "StC module outputs - nacelle" - +typedef ^ OutputType StC_OutputType TStC {:} - - "StC module outputs - tower" - +typedef ^ OutputType StC_OutputType SStC {:} - - "StC module outputs - substructure" - +typedef ^ OutputType SiKi toSC {:} - - "A swap array: used to pass output data from the DLL controller to the supercontroller" - +typedef ^ OutputType SiKi Lidar {:} - - "A swap array: used to pass output data from the DLL controller to the Lidar" - diff --git a/modules/servodyn/src/ServoDyn_Types.f90 b/modules/servodyn/src/ServoDyn_Types.f90 index 0b23dfb3b4..0f4a7b28ef 100644 --- a/modules/servodyn/src/ServoDyn_Types.f90 +++ b/modules/servodyn/src/ServoDyn_Types.f90 @@ -31,7 +31,7 @@ !! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. MODULE ServoDyn_Types !--------------------------------------------------------------------------------------------------------------------------------- -USE TMD_Types +USE StrucCtrl_Types USE NWTC_Library IMPLICIT NONE ! ========= SrvD_InitInputType ======= @@ -41,17 +41,28 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: NumBl !< Number of blades on the turbine [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: BlPitchInit !< Initial blade pitch [-] - REAL(ReKi) :: Gravity !< Gravitational acceleration [m/s^2] - REAL(ReKi) , DIMENSION(1:3) :: r_N_O_G !< nacelle origin for setting up mesh [m] - REAL(ReKi) , DIMENSION(1:3) :: r_TwrBase !< tower base origin for setting up mesh [m] + REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] + REAL(ReKi) , DIMENSION(1:3) :: NacPosition !< nacelle origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: NacOrientation !< nacelle orientation for setting up mesh [-] + REAL(ReKi) , DIMENSION(1:3) :: TwrBasePos !< tower base origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseOrient !< tower base orientation for setting up mesh [m] + REAL(ReKi) , DIMENSION(1:3) :: PlatformPos !< platform origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: PlatformOrient !< platform orientation for setting up mesh [m] REAL(DbKi) :: Tmax !< max time from glue code [s] REAL(ReKi) :: AvgWindSpeed !< average wind speed for the simulation [m/s] REAL(ReKi) :: AirDens !< air density [kg/m^3] - INTEGER(IntKi) :: NumSC2Ctrl !< number of controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2Ctrl !< number of turbine specific controller inputs [from supercontroller] [-] INTEGER(IntKi) :: NumCtrl2SC !< number of controller outputs [to supercontroller] [-] INTEGER(IntKi) :: TrimCase !< Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True] [-] REAL(ReKi) :: TrimGain !< Proportional gain for the rotational speed error (>0) [used only if TrimCase>0] [rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque] REAL(ReKi) :: RotSpeedRef !< Reference rotor speed [rad/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BladeRootPosition !< X-Y-Z reference position of each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: BladeRootOrientation !< DCM reference orientation of blade roots (3x3 x NumBlades) [-] + LOGICAL :: UseInputFile = .TRUE. !< read input from input file [-] + TYPE(FileInfoType) :: PassedPrimaryInputData !< Primary input file as FileInfoType (set by driver/glue code) [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSCGlob !< Initial global inputs to the controller [from the supercontroller] [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< Initial turbine specific inputs to the controller [from the supercontroller] [-] END TYPE SrvD_InitInputType ! ======================= ! ========= SrvD_InitOutputType ======= @@ -71,6 +82,7 @@ MODULE ServoDyn_Types ! ========= SrvD_InputFile ======= TYPE, PUBLIC :: SrvD_InputFile REAL(DbKi) :: DT !< Communication interval for controllers [s] + LOGICAL :: Echo !< Echo the input file out [-] INTEGER(IntKi) :: PCMode !< Pitch control mode [-] REAL(DbKi) :: TPCOn !< Time to enable active pitch control [unused when PCMode=0] [s] REAL(DbKi) , DIMENSION(1:3) :: TPitManS !< Time to start override pitch maneuver for blade (K) and end standard pitch control [s] @@ -142,10 +154,14 @@ MODULE ServoDyn_Types REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: GenSpd_TLU !< Records R:2:R+2*DLL_NumTrq-2: Generator speed values in look-up table [used only with DLL Interface] [rad/s] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: GenTrq_TLU !< Records R+1:2:R+2*DLL_NumTrq-1: Generator torque values in look-up table [used only with DLL Interface] [Nm] LOGICAL :: UseLegacyInterface !< Flag that determines if the legacy Bladed interface is (legacy=DISCON with avrSWAP instead of CONTROLLER) [-] - LOGICAL :: CompNTMD !< Compute nacelle tuned mass damper {true/false} [-] - CHARACTER(1024) :: NTMDfile !< File for nacelle tuned mass damper (quoted string) [-] - LOGICAL :: CompTTMD !< Compute tower tuned mass damper {true/false} [-] - CHARACTER(1024) :: TTMDfile !< File for tower tuned mass damper (quoted string) [-] + INTEGER(IntKi) :: NumBStC !< Number of blade structural controllers (integer) [-] + CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: BStCfiles !< Name of the files for blade structural controllers (quoted strings) [unused when NumBStC==0] [-] + INTEGER(IntKi) :: NumNStC !< Number of nacelle structural controllers (integer) [-] + CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: NStCfiles !< Name of the files for nacelle structural controllers (quoted strings) [unused when NumNStC==0] [-] + INTEGER(IntKi) :: NumTStC !< Number of tower structural controllers (integer) [-] + CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: TStCfiles !< Name of the files for tower structural controllers (quoted strings) [unused when NumTStC==0] [-] + INTEGER(IntKi) :: NumSStC !< Number of substructure structural controllers (integer) [-] + CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: SStCfiles !< Name of the files for subtructure structural controllers (quoted strings) [unused when NumSStC==0] [-] END TYPE SrvD_InputFile ! ======================= ! ========= BladedDLLType ======= @@ -160,7 +176,7 @@ MODULE ServoDyn_Types REAL(ReKi) , DIMENSION(1:3) :: BlAirfoilCom !< Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables) [-] REAL(ReKi) :: ElecPwr_prev !< Electrical power (from previous step), sent to Bladed DLL [W] REAL(ReKi) :: GenTrq_prev !< Electrical generator torque (from previous step), sent to Bladed DLL [N-m] - REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: SCoutput !< controller output to supercontroller [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< controller output to supercontroller [-] LOGICAL :: initialized !< flag that determines if DLL has been called (for difference between CalcOutput and UpdateStates) [-] INTEGER(IntKi) :: NumLogChannels !< number of log channels from controller [-] TYPE(OutParmType) , DIMENSION(:), ALLOCATABLE :: LogChannels_OutParam !< Names and units (and other characteristics) of logging outputs from DLL [-] @@ -223,22 +239,28 @@ MODULE ServoDyn_Types ! ========= SrvD_ContinuousStateType ======= TYPE, PUBLIC :: SrvD_ContinuousStateType REAL(ReKi) :: DummyContState !< Remove this variable if you have continuous states [-] - TYPE(TMD_ContinuousStateType) :: NTMD !< TMD module states - nacelle [-] - TYPE(TMD_ContinuousStateType) :: TTMD !< TMD module states - tower [-] + TYPE(StC_ContinuousStateType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module states - blade [-] + TYPE(StC_ContinuousStateType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module states - nacelle [-] + TYPE(StC_ContinuousStateType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module states - tower [-] + TYPE(StC_ContinuousStateType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] END TYPE SrvD_ContinuousStateType ! ======================= ! ========= SrvD_DiscreteStateType ======= TYPE, PUBLIC :: SrvD_DiscreteStateType REAL(ReKi) :: CtrlOffset !< Controller offset parameter [N-m] - TYPE(TMD_DiscreteStateType) :: NTMD !< TMD module states - nacelle [-] - TYPE(TMD_DiscreteStateType) :: TTMD !< TMD module states - tower [-] + TYPE(StC_DiscreteStateType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module states - blade [-] + TYPE(StC_DiscreteStateType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module states - nacelle [-] + TYPE(StC_DiscreteStateType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module states - tower [-] + TYPE(StC_DiscreteStateType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] END TYPE SrvD_DiscreteStateType ! ======================= ! ========= SrvD_ConstraintStateType ======= TYPE, PUBLIC :: SrvD_ConstraintStateType REAL(ReKi) :: DummyConstrState !< Remove this variable if you have constraint states [-] - TYPE(TMD_ConstraintStateType) :: NTMD !< TMD module states - nacelle [-] - TYPE(TMD_ConstraintStateType) :: TTMD !< TMD module states - tower [-] + TYPE(StC_ConstraintStateType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module states - blade [-] + TYPE(StC_ConstraintStateType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module states - nacelle [-] + TYPE(StC_ConstraintStateType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module states - tower [-] + TYPE(StC_ConstraintStateType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] END TYPE SrvD_ConstraintStateType ! ======================= ! ========= SrvD_OtherStateType ======= @@ -255,8 +277,10 @@ MODULE ServoDyn_Types REAL(DbKi) , DIMENSION(:), ALLOCATABLE :: TTpBrFl !< Times at which tip brakes are fully deployed [s] LOGICAL :: Off4Good !< Is the generator offline for rest of simulation? [-] LOGICAL :: GenOnLine !< Is the generator online? [-] - TYPE(TMD_OtherStateType) :: NTMD !< TMD module states - nacelle [-] - TYPE(TMD_OtherStateType) :: TTMD !< TMD module states - tower [-] + TYPE(StC_OtherStateType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module states - blade [-] + TYPE(StC_OtherStateType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module states - nacelle [-] + TYPE(StC_OtherStateType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module states - tower [-] + TYPE(StC_OtherStateType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] END TYPE SrvD_OtherStateType ! ======================= ! ========= SrvD_MiscVarType ======= @@ -266,8 +290,10 @@ MODULE ServoDyn_Types LOGICAL :: FirstWarn !< Whether or not this is the first warning about the DLL being called without Explicit-Loose coupling. [-] REAL(DbKi) :: LastTimeFiltered !< last time the CalcOutput/Bladed DLL was filtered [s] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: xd_BlPitchFilter !< blade pitch filter [-] - TYPE(TMD_MiscVarType) :: NTMD !< TMD module misc vars - nacelle [-] - TYPE(TMD_MiscVarType) :: TTMD !< TMD module misc vars - tower [-] + TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module misc vars - blade [-] + TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module misc vars - nacelle [-] + TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module misc vars - tower [-] + TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module misc vars - substructure [-] END TYPE SrvD_MiscVarType ! ======================= ! ========= SrvD_ParameterType ======= @@ -333,8 +359,10 @@ MODULE ServoDyn_Types REAL(ReKi) :: TBDrConN !< Tip-brake drag constant during normal operation, Cd*Area [-] REAL(ReKi) :: TBDrConD !< Tip-brake drag constant during fully-deployed operation, Cd*Area [-] INTEGER(IntKi) :: NumBl !< Number of blades on the turbine [-] - LOGICAL :: CompNTMD !< Compute nacelle tuned mass damper {true/false} [-] - LOGICAL :: CompTTMD !< Compute tower tuned mass damper {true/false} [-] + INTEGER(IntKi) :: NumBStC !< Number of blade structural controllers (integer) [-] + INTEGER(IntKi) :: NumNStC !< Number of nacelle structural controllers (integer) [-] + INTEGER(IntKi) :: NumTStC !< Number of tower structural controllers (integer) [-] + INTEGER(IntKi) :: NumSStC !< Number of substructure structural controllers (integer) [-] INTEGER(IntKi) :: NumOuts !< Number of parameters in the output list (number of outputs requested) [-] INTEGER(IntKi) :: NumOuts_DLL !< Number of logging channels output from the DLL (set at initialization) [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] @@ -353,8 +381,11 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: TrimCase !< Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True] [-] REAL(ReKi) :: TrimGain !< Proportional gain for the rotational speed error (>0) [used only if TrimCase>0] [rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque] REAL(ReKi) :: RotSpeedRef !< Reference rotor speed [rad/s] - TYPE(TMD_ParameterType) :: NTMD !< TMD module parameters - nacelle [-] - TYPE(TMD_ParameterType) :: TTMD !< TMD module parameters - tower [-] + TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module parameters - blade [-] + TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module parameters - nacelle [-] + TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module parameters - tower [-] + TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module parameters - substructure [-] + LOGICAL :: UseSC !< Supercontroller on/off flag [-] END TYPE SrvD_ParameterType ! ======================= ! ========= SrvD_InputType ======= @@ -392,9 +423,13 @@ MODULE ServoDyn_Types REAL(ReKi) :: RotPwr !< Rotor power (this is equivalent to the low-speed shaft power) [W] REAL(ReKi) :: HorWindV !< Horizontal hub-height wind velocity magnitude [m/s] REAL(ReKi) :: YawAngle !< Estimate of yaw (nacelle + platform) [radians] - TYPE(TMD_InputType) :: NTMD !< TMD module inputs - nacelle [-] - TYPE(TMD_InputType) :: TTMD !< TMD module inputs - tower [-] - REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: SuperController !< A swap array: used to pass input data to the DLL controller from the supercontroller [-] + TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module inputs - blade [-] + TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module inputs - nacelle [-] + TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module inputs - tower [-] + TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< A swap array: used to pass turbine specific input data to the DLL controller from the supercontroller [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSCglob !< A swap array: used to pass global input data to the DLL controller from the supercontroller [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: Lidar !< A swap array: used to pass input data to the DLL controller from the Lidar [-] END TYPE SrvD_InputType ! ======================= ! ========= SrvD_OutputType ======= @@ -407,9 +442,12 @@ MODULE ServoDyn_Types REAL(ReKi) :: HSSBrTrqC !< Commanded HSS brake torque [N-m] REAL(ReKi) :: ElecPwr !< Electrical power [W] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TBDrCon !< Instantaneous tip-brake drag constant, Cd*Area [-] - TYPE(TMD_OutputType) :: NTMD !< TMD module outputs - nacelle [-] - TYPE(TMD_OutputType) :: TTMD !< TMD module outputs - tower [-] - REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: SuperController !< A swap array: used to pass output data from the DLL controller to the supercontroller [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module outputs - blade [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module outputs - nacelle [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module outputs - tower [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module outputs - substructure [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< A swap array: used to pass output data from the DLL controller to the supercontroller [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: Lidar !< A swap array: used to pass output data from the DLL controller to the Lidar [-] END TYPE SrvD_OutputType ! ======================= CONTAINS @@ -422,6 +460,8 @@ SUBROUTINE SrvD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, Err ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyInitInput' @@ -445,16 +485,79 @@ SUBROUTINE SrvD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, Err DstInitInputData%BlPitchInit = SrcInitInputData%BlPitchInit ENDIF DstInitInputData%Gravity = SrcInitInputData%Gravity - DstInitInputData%r_N_O_G = SrcInitInputData%r_N_O_G - DstInitInputData%r_TwrBase = SrcInitInputData%r_TwrBase + DstInitInputData%NacPosition = SrcInitInputData%NacPosition + DstInitInputData%NacOrientation = SrcInitInputData%NacOrientation + DstInitInputData%TwrBasePos = SrcInitInputData%TwrBasePos + DstInitInputData%TwrBaseOrient = SrcInitInputData%TwrBaseOrient + DstInitInputData%PlatformPos = SrcInitInputData%PlatformPos + DstInitInputData%PlatformOrient = SrcInitInputData%PlatformOrient DstInitInputData%Tmax = SrcInitInputData%Tmax DstInitInputData%AvgWindSpeed = SrcInitInputData%AvgWindSpeed DstInitInputData%AirDens = SrcInitInputData%AirDens + DstInitInputData%NumSC2CtrlGlob = SrcInitInputData%NumSC2CtrlGlob DstInitInputData%NumSC2Ctrl = SrcInitInputData%NumSC2Ctrl DstInitInputData%NumCtrl2SC = SrcInitInputData%NumCtrl2SC DstInitInputData%TrimCase = SrcInitInputData%TrimCase DstInitInputData%TrimGain = SrcInitInputData%TrimGain DstInitInputData%RotSpeedRef = SrcInitInputData%RotSpeedRef +IF (ALLOCATED(SrcInitInputData%BladeRootPosition)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootPosition,1) + i1_u = UBOUND(SrcInitInputData%BladeRootPosition,1) + i2_l = LBOUND(SrcInitInputData%BladeRootPosition,2) + i2_u = UBOUND(SrcInitInputData%BladeRootPosition,2) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootPosition)) THEN + ALLOCATE(DstInitInputData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%BladeRootPosition = SrcInitInputData%BladeRootPosition +ENDIF +IF (ALLOCATED(SrcInitInputData%BladeRootOrientation)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootOrientation,1) + i1_u = UBOUND(SrcInitInputData%BladeRootOrientation,1) + i2_l = LBOUND(SrcInitInputData%BladeRootOrientation,2) + i2_u = UBOUND(SrcInitInputData%BladeRootOrientation,2) + i3_l = LBOUND(SrcInitInputData%BladeRootOrientation,3) + i3_u = UBOUND(SrcInitInputData%BladeRootOrientation,3) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootOrientation)) THEN + ALLOCATE(DstInitInputData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%BladeRootOrientation = SrcInitInputData%BladeRootOrientation +ENDIF + DstInitInputData%UseInputFile = SrcInitInputData%UseInputFile + CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcInitInputData%fromSCGlob)) THEN + i1_l = LBOUND(SrcInitInputData%fromSCGlob,1) + i1_u = UBOUND(SrcInitInputData%fromSCGlob,1) + IF (.NOT. ALLOCATED(DstInitInputData%fromSCGlob)) THEN + ALLOCATE(DstInitInputData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%fromSCGlob = SrcInitInputData%fromSCGlob +ENDIF +IF (ALLOCATED(SrcInitInputData%fromSC)) THEN + i1_l = LBOUND(SrcInitInputData%fromSC,1) + i1_u = UBOUND(SrcInitInputData%fromSC,1) + IF (.NOT. ALLOCATED(DstInitInputData%fromSC)) THEN + ALLOCATE(DstInitInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%fromSC = SrcInitInputData%fromSC +ENDIF END SUBROUTINE SrvD_CopyInitInput SUBROUTINE SrvD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) @@ -468,6 +571,19 @@ SUBROUTINE SrvD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) ErrMsg = "" IF (ALLOCATED(InitInputData%BlPitchInit)) THEN DEALLOCATE(InitInputData%BlPitchInit) +ENDIF +IF (ALLOCATED(InitInputData%BladeRootPosition)) THEN + DEALLOCATE(InitInputData%BladeRootPosition) +ENDIF +IF (ALLOCATED(InitInputData%BladeRootOrientation)) THEN + DEALLOCATE(InitInputData%BladeRootOrientation) +ENDIF + CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) +IF (ALLOCATED(InitInputData%fromSCGlob)) THEN + DEALLOCATE(InitInputData%fromSCGlob) +ENDIF +IF (ALLOCATED(InitInputData%fromSC)) THEN + DEALLOCATE(InitInputData%fromSC) ENDIF END SUBROUTINE SrvD_DestroyInitInput @@ -515,17 +631,61 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + 2*1 ! BlPitchInit upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%BlPitchInit) ! BlPitchInit END IF - Re_BufSz = Re_BufSz + 1 ! Gravity - Re_BufSz = Re_BufSz + SIZE(InData%r_N_O_G) ! r_N_O_G - Re_BufSz = Re_BufSz + SIZE(InData%r_TwrBase) ! r_TwrBase + Re_BufSz = Re_BufSz + SIZE(InData%Gravity) ! Gravity + Re_BufSz = Re_BufSz + SIZE(InData%NacPosition) ! NacPosition + Db_BufSz = Db_BufSz + SIZE(InData%NacOrientation) ! NacOrientation + Re_BufSz = Re_BufSz + SIZE(InData%TwrBasePos) ! TwrBasePos + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseOrient) ! TwrBaseOrient + Re_BufSz = Re_BufSz + SIZE(InData%PlatformPos) ! PlatformPos + Db_BufSz = Db_BufSz + SIZE(InData%PlatformOrient) ! PlatformOrient Db_BufSz = Db_BufSz + 1 ! Tmax Re_BufSz = Re_BufSz + 1 ! AvgWindSpeed Re_BufSz = Re_BufSz + 1 ! AirDens + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC Int_BufSz = Int_BufSz + 1 ! TrimCase Re_BufSz = Re_BufSz + 1 ! TrimGain Re_BufSz = Re_BufSz + 1 ! RotSpeedRef + Int_BufSz = Int_BufSz + 1 ! BladeRootPosition allocated yes/no + IF ( ALLOCATED(InData%BladeRootPosition) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BladeRootPosition upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BladeRootPosition) ! BladeRootPosition + END IF + Int_BufSz = Int_BufSz + 1 ! BladeRootOrientation allocated yes/no + IF ( ALLOCATED(InData%BladeRootOrientation) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! BladeRootOrientation upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%BladeRootOrientation) ! BladeRootOrientation + END IF + Int_BufSz = Int_BufSz + 1 ! UseInputFile + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! PassedPrimaryInputData: size of buffers for each call to pack subtype + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, .TRUE. ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! PassedPrimaryInputData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! PassedPrimaryInputData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! PassedPrimaryInputData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! fromSCGlob allocated yes/no + IF ( ALLOCATED(InData%fromSCGlob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCGlob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCGlob) ! fromSCGlob + END IF + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -580,22 +740,48 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 END DO END IF - ReKiBuf(Re_Xferred) = InData%Gravity - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%r_N_O_G,1), UBOUND(InData%r_N_O_G,1) - ReKiBuf(Re_Xferred) = InData%r_N_O_G(i1) + DO i1 = LBOUND(InData%Gravity,1), UBOUND(InData%Gravity,1) + ReKiBuf(Re_Xferred) = InData%Gravity(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%NacPosition,1), UBOUND(InData%NacPosition,1) + ReKiBuf(Re_Xferred) = InData%NacPosition(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i2 = LBOUND(InData%NacOrientation,2), UBOUND(InData%NacOrientation,2) + DO i1 = LBOUND(InData%NacOrientation,1), UBOUND(InData%NacOrientation,1) + DbKiBuf(Db_Xferred) = InData%NacOrientation(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + DO i1 = LBOUND(InData%TwrBasePos,1), UBOUND(InData%TwrBasePos,1) + ReKiBuf(Re_Xferred) = InData%TwrBasePos(i1) Re_Xferred = Re_Xferred + 1 END DO - DO i1 = LBOUND(InData%r_TwrBase,1), UBOUND(InData%r_TwrBase,1) - ReKiBuf(Re_Xferred) = InData%r_TwrBase(i1) + DO i2 = LBOUND(InData%TwrBaseOrient,2), UBOUND(InData%TwrBaseOrient,2) + DO i1 = LBOUND(InData%TwrBaseOrient,1), UBOUND(InData%TwrBaseOrient,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + DO i1 = LBOUND(InData%PlatformPos,1), UBOUND(InData%PlatformPos,1) + ReKiBuf(Re_Xferred) = InData%PlatformPos(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i2 = LBOUND(InData%PlatformOrient,2), UBOUND(InData%PlatformOrient,2) + DO i1 = LBOUND(InData%PlatformOrient,1), UBOUND(InData%PlatformOrient,1) + DbKiBuf(Db_Xferred) = InData%PlatformOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO DbKiBuf(Db_Xferred) = InData%Tmax Db_Xferred = Db_Xferred + 1 ReKiBuf(Re_Xferred) = InData%AvgWindSpeed Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%AirDens Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumCtrl2SC @@ -606,6 +792,111 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%RotSpeedRef Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BladeRootPosition) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootPosition,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootPosition,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootPosition,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootPosition,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%BladeRootPosition,2), UBOUND(InData%BladeRootPosition,2) + DO i1 = LBOUND(InData%BladeRootPosition,1), UBOUND(InData%BladeRootPosition,1) + ReKiBuf(Re_Xferred) = InData%BladeRootPosition(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BladeRootOrientation) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%BladeRootOrientation,3), UBOUND(InData%BladeRootOrientation,3) + DO i2 = LBOUND(InData%BladeRootOrientation,2), UBOUND(InData%BladeRootOrientation,2) + DO i1 = LBOUND(InData%BladeRootOrientation,1), UBOUND(InData%BladeRootOrientation,1) + DbKiBuf(Db_Xferred) = InData%BladeRootOrientation(i1,i2,i3) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseInputFile, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, OnlySize ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF ( .NOT. ALLOCATED(InData%fromSCGlob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCGlob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCGlob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCGlob,1), UBOUND(InData%fromSCGlob,1) + ReKiBuf(Re_Xferred) = InData%fromSCGlob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF END SUBROUTINE SrvD_PackInitInput SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -622,6 +913,8 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackInitInput' @@ -665,26 +958,68 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = Re_Xferred + 1 END DO END IF - OutData%Gravity = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%r_N_O_G,1) - i1_u = UBOUND(OutData%r_N_O_G,1) - DO i1 = LBOUND(OutData%r_N_O_G,1), UBOUND(OutData%r_N_O_G,1) - OutData%r_N_O_G(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%Gravity,1) + i1_u = UBOUND(OutData%Gravity,1) + DO i1 = LBOUND(OutData%Gravity,1), UBOUND(OutData%Gravity,1) + OutData%Gravity(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - i1_l = LBOUND(OutData%r_TwrBase,1) - i1_u = UBOUND(OutData%r_TwrBase,1) - DO i1 = LBOUND(OutData%r_TwrBase,1), UBOUND(OutData%r_TwrBase,1) - OutData%r_TwrBase(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%NacPosition,1) + i1_u = UBOUND(OutData%NacPosition,1) + DO i1 = LBOUND(OutData%NacPosition,1), UBOUND(OutData%NacPosition,1) + OutData%NacPosition(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%NacOrientation,1) + i1_u = UBOUND(OutData%NacOrientation,1) + i2_l = LBOUND(OutData%NacOrientation,2) + i2_u = UBOUND(OutData%NacOrientation,2) + DO i2 = LBOUND(OutData%NacOrientation,2), UBOUND(OutData%NacOrientation,2) + DO i1 = LBOUND(OutData%NacOrientation,1), UBOUND(OutData%NacOrientation,1) + OutData%NacOrientation(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + i1_l = LBOUND(OutData%TwrBasePos,1) + i1_u = UBOUND(OutData%TwrBasePos,1) + DO i1 = LBOUND(OutData%TwrBasePos,1), UBOUND(OutData%TwrBasePos,1) + OutData%TwrBasePos(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%TwrBaseOrient,1) + i1_u = UBOUND(OutData%TwrBaseOrient,1) + i2_l = LBOUND(OutData%TwrBaseOrient,2) + i2_u = UBOUND(OutData%TwrBaseOrient,2) + DO i2 = LBOUND(OutData%TwrBaseOrient,2), UBOUND(OutData%TwrBaseOrient,2) + DO i1 = LBOUND(OutData%TwrBaseOrient,1), UBOUND(OutData%TwrBaseOrient,1) + OutData%TwrBaseOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + i1_l = LBOUND(OutData%PlatformPos,1) + i1_u = UBOUND(OutData%PlatformPos,1) + DO i1 = LBOUND(OutData%PlatformPos,1), UBOUND(OutData%PlatformPos,1) + OutData%PlatformPos(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%PlatformOrient,1) + i1_u = UBOUND(OutData%PlatformOrient,1) + i2_l = LBOUND(OutData%PlatformOrient,2) + i2_u = UBOUND(OutData%PlatformOrient,2) + DO i2 = LBOUND(OutData%PlatformOrient,2), UBOUND(OutData%PlatformOrient,2) + DO i1 = LBOUND(OutData%PlatformOrient,1), UBOUND(OutData%PlatformOrient,1) + OutData%PlatformOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO OutData%Tmax = DbKiBuf(Db_Xferred) Db_Xferred = Db_Xferred + 1 OutData%AvgWindSpeed = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%AirDens = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) @@ -695,6 +1030,135 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = Re_Xferred + 1 OutData%RotSpeedRef = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootPosition not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootPosition)) DEALLOCATE(OutData%BladeRootPosition) + ALLOCATE(OutData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%BladeRootPosition,2), UBOUND(OutData%BladeRootPosition,2) + DO i1 = LBOUND(OutData%BladeRootPosition,1), UBOUND(OutData%BladeRootPosition,1) + OutData%BladeRootPosition(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootOrientation not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootOrientation)) DEALLOCATE(OutData%BladeRootOrientation) + ALLOCATE(OutData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%BladeRootOrientation,3), UBOUND(OutData%BladeRootOrientation,3) + DO i2 = LBOUND(OutData%BladeRootOrientation,2), UBOUND(OutData%BladeRootOrientation,2) + DO i1 = LBOUND(OutData%BladeRootOrientation,1), UBOUND(OutData%BladeRootOrientation,1) + OutData%BladeRootOrientation(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + OutData%UseInputFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseInputFile) + Int_Xferred = Int_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackfileinfotype( Re_Buf, Db_Buf, Int_Buf, OutData%PassedPrimaryInputData, ErrStat2, ErrMsg2 ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCGlob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCGlob)) DEALLOCATE(OutData%fromSCGlob) + ALLOCATE(OutData%fromSCGlob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCGlob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCGlob,1), UBOUND(OutData%fromSCGlob,1) + OutData%fromSCGlob(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF END SUBROUTINE SrvD_UnPackInitInput SUBROUTINE SrvD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) @@ -1323,6 +1787,7 @@ SUBROUTINE SrvD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, Err ErrStat = ErrID_None ErrMsg = "" DstInputFileData%DT = SrcInputFileData%DT + DstInputFileData%Echo = SrcInputFileData%Echo DstInputFileData%PCMode = SrcInputFileData%PCMode DstInputFileData%TPCOn = SrcInputFileData%TPCOn DstInputFileData%TPitManS = SrcInputFileData%TPitManS @@ -1427,10 +1892,58 @@ SUBROUTINE SrvD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, Err DstInputFileData%GenTrq_TLU = SrcInputFileData%GenTrq_TLU ENDIF DstInputFileData%UseLegacyInterface = SrcInputFileData%UseLegacyInterface - DstInputFileData%CompNTMD = SrcInputFileData%CompNTMD - DstInputFileData%NTMDfile = SrcInputFileData%NTMDfile - DstInputFileData%CompTTMD = SrcInputFileData%CompTTMD - DstInputFileData%TTMDfile = SrcInputFileData%TTMDfile + DstInputFileData%NumBStC = SrcInputFileData%NumBStC +IF (ALLOCATED(SrcInputFileData%BStCfiles)) THEN + i1_l = LBOUND(SrcInputFileData%BStCfiles,1) + i1_u = UBOUND(SrcInputFileData%BStCfiles,1) + IF (.NOT. ALLOCATED(DstInputFileData%BStCfiles)) THEN + ALLOCATE(DstInputFileData%BStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%BStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%BStCfiles = SrcInputFileData%BStCfiles +ENDIF + DstInputFileData%NumNStC = SrcInputFileData%NumNStC +IF (ALLOCATED(SrcInputFileData%NStCfiles)) THEN + i1_l = LBOUND(SrcInputFileData%NStCfiles,1) + i1_u = UBOUND(SrcInputFileData%NStCfiles,1) + IF (.NOT. ALLOCATED(DstInputFileData%NStCfiles)) THEN + ALLOCATE(DstInputFileData%NStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%NStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%NStCfiles = SrcInputFileData%NStCfiles +ENDIF + DstInputFileData%NumTStC = SrcInputFileData%NumTStC +IF (ALLOCATED(SrcInputFileData%TStCfiles)) THEN + i1_l = LBOUND(SrcInputFileData%TStCfiles,1) + i1_u = UBOUND(SrcInputFileData%TStCfiles,1) + IF (.NOT. ALLOCATED(DstInputFileData%TStCfiles)) THEN + ALLOCATE(DstInputFileData%TStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%TStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%TStCfiles = SrcInputFileData%TStCfiles +ENDIF + DstInputFileData%NumSStC = SrcInputFileData%NumSStC +IF (ALLOCATED(SrcInputFileData%SStCfiles)) THEN + i1_l = LBOUND(SrcInputFileData%SStCfiles,1) + i1_u = UBOUND(SrcInputFileData%SStCfiles,1) + IF (.NOT. ALLOCATED(DstInputFileData%SStCfiles)) THEN + ALLOCATE(DstInputFileData%SStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%SStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%SStCfiles = SrcInputFileData%SStCfiles +ENDIF END SUBROUTINE SrvD_CopyInputFile SUBROUTINE SrvD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) @@ -1450,6 +1963,18 @@ SUBROUTINE SrvD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(InputFileData%GenTrq_TLU)) THEN DEALLOCATE(InputFileData%GenTrq_TLU) +ENDIF +IF (ALLOCATED(InputFileData%BStCfiles)) THEN + DEALLOCATE(InputFileData%BStCfiles) +ENDIF +IF (ALLOCATED(InputFileData%NStCfiles)) THEN + DEALLOCATE(InputFileData%NStCfiles) +ENDIF +IF (ALLOCATED(InputFileData%TStCfiles)) THEN + DEALLOCATE(InputFileData%TStCfiles) +ENDIF +IF (ALLOCATED(InputFileData%SStCfiles)) THEN + DEALLOCATE(InputFileData%SStCfiles) ENDIF END SUBROUTINE SrvD_DestroyInputFile @@ -1489,6 +2014,7 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Db_BufSz = 0 Int_BufSz = 0 Db_BufSz = Db_BufSz + 1 ! DT + Int_BufSz = Int_BufSz + 1 ! Echo Int_BufSz = Int_BufSz + 1 ! PCMode Db_BufSz = Db_BufSz + 1 ! TPCOn Db_BufSz = Db_BufSz + SIZE(InData%TPitManS) ! TPitManS @@ -1572,10 +2098,30 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_BufSz = Re_BufSz + SIZE(InData%GenTrq_TLU) ! GenTrq_TLU END IF Int_BufSz = Int_BufSz + 1 ! UseLegacyInterface - Int_BufSz = Int_BufSz + 1 ! CompNTMD - Int_BufSz = Int_BufSz + 1*LEN(InData%NTMDfile) ! NTMDfile - Int_BufSz = Int_BufSz + 1 ! CompTTMD - Int_BufSz = Int_BufSz + 1*LEN(InData%TTMDfile) ! TTMDfile + Int_BufSz = Int_BufSz + 1 ! NumBStC + Int_BufSz = Int_BufSz + 1 ! BStCfiles allocated yes/no + IF ( ALLOCATED(InData%BStCfiles) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStCfiles upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%BStCfiles)*LEN(InData%BStCfiles) ! BStCfiles + END IF + Int_BufSz = Int_BufSz + 1 ! NumNStC + Int_BufSz = Int_BufSz + 1 ! NStCfiles allocated yes/no + IF ( ALLOCATED(InData%NStCfiles) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStCfiles upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%NStCfiles)*LEN(InData%NStCfiles) ! NStCfiles + END IF + Int_BufSz = Int_BufSz + 1 ! NumTStC + Int_BufSz = Int_BufSz + 1 ! TStCfiles allocated yes/no + IF ( ALLOCATED(InData%TStCfiles) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStCfiles upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%TStCfiles)*LEN(InData%TStCfiles) ! TStCfiles + END IF + Int_BufSz = Int_BufSz + 1 ! NumSStC + Int_BufSz = Int_BufSz + 1 ! SStCfiles allocated yes/no + IF ( ALLOCATED(InData%SStCfiles) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStCfiles upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%SStCfiles)*LEN(InData%SStCfiles) ! SStCfiles + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -1605,6 +2151,8 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM DbKiBuf(Db_Xferred) = InData%DT Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%Echo, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%PCMode Int_Xferred = Int_Xferred + 1 DbKiBuf(Db_Xferred) = InData%TPCOn @@ -1802,18 +2350,82 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM END IF IntKiBuf(Int_Xferred) = TRANSFER(InData%UseLegacyInterface, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompNTMD, IntKiBuf(1)) + IntKiBuf(Int_Xferred) = InData%NumBStC Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%NTMDfile) - IntKiBuf(Int_Xferred) = ICHAR(InData%NTMDfile(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompTTMD, IntKiBuf(1)) + IF ( .NOT. ALLOCATED(InData%BStCfiles) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%TTMDfile) - IntKiBuf(Int_Xferred) = ICHAR(InData%TTMDfile(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStCfiles,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStCfiles,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStCfiles,1), UBOUND(InData%BStCfiles,1) + DO I = 1, LEN(InData%BStCfiles) + IntKiBuf(Int_Xferred) = ICHAR(InData%BStCfiles(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumNStC + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%NStCfiles) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStCfiles,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStCfiles,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStCfiles,1), UBOUND(InData%NStCfiles,1) + DO I = 1, LEN(InData%NStCfiles) + IntKiBuf(Int_Xferred) = ICHAR(InData%NStCfiles(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumTStC + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%TStCfiles) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStCfiles,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStCfiles,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStCfiles,1), UBOUND(InData%TStCfiles,1) + DO I = 1, LEN(InData%TStCfiles) + IntKiBuf(Int_Xferred) = ICHAR(InData%TStCfiles(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumSStC + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%SStCfiles) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStCfiles,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStCfiles,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStCfiles,1), UBOUND(InData%SStCfiles,1) + DO I = 1, LEN(InData%SStCfiles) + IntKiBuf(Int_Xferred) = ICHAR(InData%SStCfiles(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF END SUBROUTINE SrvD_PackInputFile SUBROUTINE SrvD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -1845,6 +2457,8 @@ SUBROUTINE SrvD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Xferred = 1 OutData%DT = DbKiBuf(Db_Xferred) Db_Xferred = Db_Xferred + 1 + OutData%Echo = TRANSFER(IntKiBuf(Int_Xferred), OutData%Echo) + Int_Xferred = Int_Xferred + 1 OutData%PCMode = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%TPCOn = DbKiBuf(Db_Xferred) @@ -2057,18 +2671,94 @@ SUBROUTINE SrvD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E END IF OutData%UseLegacyInterface = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseLegacyInterface) Int_Xferred = Int_Xferred + 1 - OutData%CompNTMD = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompNTMD) + OutData%NumBStC = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%NTMDfile) - OutData%NTMDfile(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%CompTTMD = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompTTMD) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStCfiles not allocated Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%TTMDfile) - OutData%TTMDfile(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStCfiles)) DEALLOCATE(OutData%BStCfiles) + ALLOCATE(OutData%BStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStCfiles,1), UBOUND(OutData%BStCfiles,1) + DO I = 1, LEN(OutData%BStCfiles) + OutData%BStCfiles(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%NumNStC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStCfiles not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStCfiles)) DEALLOCATE(OutData%NStCfiles) + ALLOCATE(OutData%NStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStCfiles,1), UBOUND(OutData%NStCfiles,1) + DO I = 1, LEN(OutData%NStCfiles) + OutData%NStCfiles(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%NumTStC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStCfiles not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStCfiles)) DEALLOCATE(OutData%TStCfiles) + ALLOCATE(OutData%TStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStCfiles,1), UBOUND(OutData%TStCfiles,1) + DO I = 1, LEN(OutData%TStCfiles) + OutData%TStCfiles(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%NumSStC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStCfiles not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStCfiles)) DEALLOCATE(OutData%SStCfiles) + ALLOCATE(OutData%SStCfiles(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStCfiles.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStCfiles,1), UBOUND(OutData%SStCfiles,1) + DO I = 1, LEN(OutData%SStCfiles) + OutData%SStCfiles(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF END SUBROUTINE SrvD_UnPackInputFile SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, CtrlCode, ErrStat, ErrMsg ) @@ -2107,17 +2797,17 @@ SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, C DstBladedDLLTypeData%BlAirfoilCom = SrcBladedDLLTypeData%BlAirfoilCom DstBladedDLLTypeData%ElecPwr_prev = SrcBladedDLLTypeData%ElecPwr_prev DstBladedDLLTypeData%GenTrq_prev = SrcBladedDLLTypeData%GenTrq_prev -IF (ALLOCATED(SrcBladedDLLTypeData%SCoutput)) THEN - i1_l = LBOUND(SrcBladedDLLTypeData%SCoutput,1) - i1_u = UBOUND(SrcBladedDLLTypeData%SCoutput,1) - IF (.NOT. ALLOCATED(DstBladedDLLTypeData%SCoutput)) THEN - ALLOCATE(DstBladedDLLTypeData%SCoutput(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcBladedDLLTypeData%toSC)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%toSC,1) + i1_u = UBOUND(SrcBladedDLLTypeData%toSC,1) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%toSC)) THEN + ALLOCATE(DstBladedDLLTypeData%toSC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%SCoutput.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%toSC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstBladedDLLTypeData%SCoutput = SrcBladedDLLTypeData%SCoutput + DstBladedDLLTypeData%toSC = SrcBladedDLLTypeData%toSC ENDIF DstBladedDLLTypeData%initialized = SrcBladedDLLTypeData%initialized DstBladedDLLTypeData%NumLogChannels = SrcBladedDLLTypeData%NumLogChannels @@ -2249,8 +2939,8 @@ SUBROUTINE SrvD_DestroyBladedDLLType( BladedDLLTypeData, ErrStat, ErrMsg ) IF (ALLOCATED(BladedDLLTypeData%avrSWAP)) THEN DEALLOCATE(BladedDLLTypeData%avrSWAP) ENDIF -IF (ALLOCATED(BladedDLLTypeData%SCoutput)) THEN - DEALLOCATE(BladedDLLTypeData%SCoutput) +IF (ALLOCATED(BladedDLLTypeData%toSC)) THEN + DEALLOCATE(BladedDLLTypeData%toSC) ENDIF IF (ALLOCATED(BladedDLLTypeData%LogChannels_OutParam)) THEN DO i1 = LBOUND(BladedDLLTypeData%LogChannels_OutParam,1), UBOUND(BladedDLLTypeData%LogChannels_OutParam,1) @@ -2321,10 +3011,10 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Re_BufSz = Re_BufSz + SIZE(InData%BlAirfoilCom) ! BlAirfoilCom Re_BufSz = Re_BufSz + 1 ! ElecPwr_prev Re_BufSz = Re_BufSz + 1 ! GenTrq_prev - Int_BufSz = Int_BufSz + 1 ! SCoutput allocated yes/no - IF ( ALLOCATED(InData%SCoutput) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SCoutput upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SCoutput) ! SCoutput + Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no + IF ( ALLOCATED(InData%toSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC END IF Int_BufSz = Int_BufSz + 1 ! initialized Int_BufSz = Int_BufSz + 1 ! NumLogChannels @@ -2488,18 +3178,18 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%GenTrq_prev Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%SCoutput) ) THEN + IF ( .NOT. ALLOCATED(InData%toSC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SCoutput,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SCoutput,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%toSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%toSC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SCoutput,1), UBOUND(InData%SCoutput,1) - ReKiBuf(Re_Xferred) = InData%SCoutput(i1) + DO i1 = LBOUND(InData%toSC,1), UBOUND(InData%toSC,1) + ReKiBuf(Re_Xferred) = InData%toSC(i1) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -2795,21 +3485,21 @@ SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Re_Xferred = Re_Xferred + 1 OutData%GenTrq_prev = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SCoutput not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SCoutput)) DEALLOCATE(OutData%SCoutput) - ALLOCATE(OutData%SCoutput(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%toSC)) DEALLOCATE(OutData%toSC) + ALLOCATE(OutData%toSC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SCoutput.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%toSC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SCoutput,1), UBOUND(OutData%SCoutput,1) - OutData%SCoutput(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + DO i1 = LBOUND(OutData%toSC,1), UBOUND(OutData%toSC,1) + OutData%toSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -3069,6 +3759,7 @@ SUBROUTINE SrvD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, Err CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyContState' @@ -3076,12 +3767,70 @@ SUBROUTINE SrvD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, Err ErrStat = ErrID_None ErrMsg = "" DstContStateData%DummyContState = SrcContStateData%DummyContState - CALL TMD_CopyContState( SrcContStateData%NTMD, DstContStateData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcContStateData%BStC)) THEN + i1_l = LBOUND(SrcContStateData%BStC,1) + i1_u = UBOUND(SrcContStateData%BStC,1) + IF (.NOT. ALLOCATED(DstContStateData%BStC)) THEN + ALLOCATE(DstContStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%BStC,1), UBOUND(SrcContStateData%BStC,1) + CALL StC_CopyContState( SrcContStateData%BStC(i1), DstContStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%NStC)) THEN + i1_l = LBOUND(SrcContStateData%NStC,1) + i1_u = UBOUND(SrcContStateData%NStC,1) + IF (.NOT. ALLOCATED(DstContStateData%NStC)) THEN + ALLOCATE(DstContStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%NStC,1), UBOUND(SrcContStateData%NStC,1) + CALL StC_CopyContState( SrcContStateData%NStC(i1), DstContStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%TStC)) THEN + i1_l = LBOUND(SrcContStateData%TStC,1) + i1_u = UBOUND(SrcContStateData%TStC,1) + IF (.NOT. ALLOCATED(DstContStateData%TStC)) THEN + ALLOCATE(DstContStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%TStC,1), UBOUND(SrcContStateData%TStC,1) + CALL StC_CopyContState( SrcContStateData%TStC(i1), DstContStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyContState( SrcContStateData%TTMD, DstContStateData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%SStC)) THEN + i1_l = LBOUND(SrcContStateData%SStC,1) + i1_u = UBOUND(SrcContStateData%SStC,1) + IF (.NOT. ALLOCATED(DstContStateData%SStC)) THEN + ALLOCATE(DstContStateData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%SStC,1), UBOUND(SrcContStateData%SStC,1) + CALL StC_CopyContState( SrcContStateData%SStC(i1), DstContStateData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF END SUBROUTINE SrvD_CopyContState SUBROUTINE SrvD_DestroyContState( ContStateData, ErrStat, ErrMsg ) @@ -3093,8 +3842,30 @@ SUBROUTINE SrvD_DestroyContState( ContStateData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" - CALL TMD_DestroyContState( ContStateData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyContState( ContStateData%TTMD, ErrStat, ErrMsg ) +IF (ALLOCATED(ContStateData%BStC)) THEN +DO i1 = LBOUND(ContStateData%BStC,1), UBOUND(ContStateData%BStC,1) + CALL StC_DestroyContState( ContStateData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%BStC) +ENDIF +IF (ALLOCATED(ContStateData%NStC)) THEN +DO i1 = LBOUND(ContStateData%NStC,1), UBOUND(ContStateData%NStC,1) + CALL StC_DestroyContState( ContStateData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%NStC) +ENDIF +IF (ALLOCATED(ContStateData%TStC)) THEN +DO i1 = LBOUND(ContStateData%TStC,1), UBOUND(ContStateData%TStC,1) + CALL StC_DestroyContState( ContStateData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%TStC) +ENDIF +IF (ALLOCATED(ContStateData%SStC)) THEN +DO i1 = LBOUND(ContStateData%SStC,1), UBOUND(ContStateData%SStC,1) + CALL StC_DestroyContState( ContStateData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ContStateData%SStC) +ENDIF END SUBROUTINE SrvD_DestroyContState SUBROUTINE SrvD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -3133,41 +3904,99 @@ SUBROUTINE SrvD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Db_BufSz = 0 Int_BufSz = 0 Re_BufSz = Re_BufSz + 1 ! DummyContState + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3197,7 +4026,18 @@ SUBROUTINE SrvD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ReKiBuf(Re_Xferred) = InData%DummyContState Re_Xferred = Re_Xferred + 1 - CALL TMD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3225,7 +4065,20 @@ SUBROUTINE SrvD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3253,255 +4106,20 @@ SUBROUTINE SrvD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE SrvD_PackContState + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE SrvD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SrvD_ContinuousStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackContState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyContState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL TMD_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL TMD_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE SrvD_UnPackContState - - SUBROUTINE SrvD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SrvD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData - TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyDiscState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstDiscStateData%CtrlOffset = SrcDiscStateData%CtrlOffset - CALL TMD_CopyDiscState( SrcDiscStateData%NTMD, DstDiscStateData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyDiscState( SrcDiscStateData%TTMD, DstDiscStateData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE SrvD_CopyDiscState - - SUBROUTINE SrvD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) - TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: DiscStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyDiscState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL TMD_DestroyDiscState( DiscStateData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyDiscState( DiscStateData%TTMD, ErrStat, ErrMsg ) - END SUBROUTINE SrvD_DestroyDiscState - - SUBROUTINE SrvD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SrvD_DiscreteStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_PackDiscState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! CtrlOffset - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! NTMD - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! TTMD - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%CtrlOffset - Re_Xferred = Re_Xferred + 1 - CALL TMD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3529,7 +4147,20 @@ SUBROUTINE SrvD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackContState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3557,13 +4188,15 @@ SUBROUTINE SrvD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END SUBROUTINE SrvD_PackDiscState + END DO + END IF + END SUBROUTINE SrvD_PackContState - SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE SrvD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: OutData + TYPE(SrvD_ContinuousStateType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -3572,9 +4205,10 @@ SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackDiscState' + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackContState' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -3585,8 +4219,22 @@ SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%CtrlOffset = ReKiBuf(Re_Xferred) + OutData%DummyContState = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3620,13 +4268,29 @@ SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3660,53 +4324,944 @@ SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE SrvD_UnPackDiscState - - SUBROUTINE SrvD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SrvD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData - TYPE(SrvD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyConstrState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState - CALL TMD_CopyConstrState( SrcConstrStateData%NTMD, DstConstrStateData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyConstrState( SrcConstrStateData%TTMD, DstConstrStateData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE SrvD_CopyConstrState - - SUBROUTINE SrvD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) - TYPE(SrvD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyConstrState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL TMD_DestroyConstrState( ConstrStateData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyConstrState( ConstrStateData%TTMD, ErrStat, ErrMsg ) - END SUBROUTINE SrvD_DestroyConstrState - - SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackContState( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE SrvD_UnPackContState + + SUBROUTINE SrvD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SrvD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstDiscStateData%CtrlOffset = SrcDiscStateData%CtrlOffset +IF (ALLOCATED(SrcDiscStateData%BStC)) THEN + i1_l = LBOUND(SrcDiscStateData%BStC,1) + i1_u = UBOUND(SrcDiscStateData%BStC,1) + IF (.NOT. ALLOCATED(DstDiscStateData%BStC)) THEN + ALLOCATE(DstDiscStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%BStC,1), UBOUND(SrcDiscStateData%BStC,1) + CALL StC_CopyDiscState( SrcDiscStateData%BStC(i1), DstDiscStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcDiscStateData%NStC)) THEN + i1_l = LBOUND(SrcDiscStateData%NStC,1) + i1_u = UBOUND(SrcDiscStateData%NStC,1) + IF (.NOT. ALLOCATED(DstDiscStateData%NStC)) THEN + ALLOCATE(DstDiscStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%NStC,1), UBOUND(SrcDiscStateData%NStC,1) + CALL StC_CopyDiscState( SrcDiscStateData%NStC(i1), DstDiscStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcDiscStateData%TStC)) THEN + i1_l = LBOUND(SrcDiscStateData%TStC,1) + i1_u = UBOUND(SrcDiscStateData%TStC,1) + IF (.NOT. ALLOCATED(DstDiscStateData%TStC)) THEN + ALLOCATE(DstDiscStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%TStC,1), UBOUND(SrcDiscStateData%TStC,1) + CALL StC_CopyDiscState( SrcDiscStateData%TStC(i1), DstDiscStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcDiscStateData%SStC)) THEN + i1_l = LBOUND(SrcDiscStateData%SStC,1) + i1_u = UBOUND(SrcDiscStateData%SStC,1) + IF (.NOT. ALLOCATED(DstDiscStateData%SStC)) THEN + ALLOCATE(DstDiscStateData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcDiscStateData%SStC,1), UBOUND(SrcDiscStateData%SStC,1) + CALL StC_CopyDiscState( SrcDiscStateData%SStC(i1), DstDiscStateData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE SrvD_CopyDiscState + + SUBROUTINE SrvD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(DiscStateData%BStC)) THEN +DO i1 = LBOUND(DiscStateData%BStC,1), UBOUND(DiscStateData%BStC,1) + CALL StC_DestroyDiscState( DiscStateData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%BStC) +ENDIF +IF (ALLOCATED(DiscStateData%NStC)) THEN +DO i1 = LBOUND(DiscStateData%NStC,1), UBOUND(DiscStateData%NStC,1) + CALL StC_DestroyDiscState( DiscStateData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%NStC) +ENDIF +IF (ALLOCATED(DiscStateData%TStC)) THEN +DO i1 = LBOUND(DiscStateData%TStC,1), UBOUND(DiscStateData%TStC,1) + CALL StC_DestroyDiscState( DiscStateData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%TStC) +ENDIF +IF (ALLOCATED(DiscStateData%SStC)) THEN +DO i1 = LBOUND(DiscStateData%SStC,1), UBOUND(DiscStateData%SStC,1) + CALL StC_DestroyDiscState( DiscStateData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(DiscStateData%SStC) +ENDIF + END SUBROUTINE SrvD_DestroyDiscState + + SUBROUTINE SrvD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SrvD_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! CtrlOffset + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! TStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! TStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! TStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%CtrlOffset + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackDiscState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE SrvD_PackDiscState + + SUBROUTINE SrvD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SrvD_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%CtrlOffset = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackDiscState( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE SrvD_UnPackDiscState + + SUBROUTINE SrvD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SrvD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(SrvD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState +IF (ALLOCATED(SrcConstrStateData%BStC)) THEN + i1_l = LBOUND(SrcConstrStateData%BStC,1) + i1_u = UBOUND(SrcConstrStateData%BStC,1) + IF (.NOT. ALLOCATED(DstConstrStateData%BStC)) THEN + ALLOCATE(DstConstrStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%BStC,1), UBOUND(SrcConstrStateData%BStC,1) + CALL StC_CopyConstrState( SrcConstrStateData%BStC(i1), DstConstrStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcConstrStateData%NStC)) THEN + i1_l = LBOUND(SrcConstrStateData%NStC,1) + i1_u = UBOUND(SrcConstrStateData%NStC,1) + IF (.NOT. ALLOCATED(DstConstrStateData%NStC)) THEN + ALLOCATE(DstConstrStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%NStC,1), UBOUND(SrcConstrStateData%NStC,1) + CALL StC_CopyConstrState( SrcConstrStateData%NStC(i1), DstConstrStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcConstrStateData%TStC)) THEN + i1_l = LBOUND(SrcConstrStateData%TStC,1) + i1_u = UBOUND(SrcConstrStateData%TStC,1) + IF (.NOT. ALLOCATED(DstConstrStateData%TStC)) THEN + ALLOCATE(DstConstrStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%TStC,1), UBOUND(SrcConstrStateData%TStC,1) + CALL StC_CopyConstrState( SrcConstrStateData%TStC(i1), DstConstrStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcConstrStateData%SStC)) THEN + i1_l = LBOUND(SrcConstrStateData%SStC,1) + i1_u = UBOUND(SrcConstrStateData%SStC,1) + IF (.NOT. ALLOCATED(DstConstrStateData%SStC)) THEN + ALLOCATE(DstConstrStateData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstConstrStateData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcConstrStateData%SStC,1), UBOUND(SrcConstrStateData%SStC,1) + CALL StC_CopyConstrState( SrcConstrStateData%SStC(i1), DstConstrStateData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE SrvD_CopyConstrState + + SUBROUTINE SrvD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(SrvD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ConstrStateData%BStC)) THEN +DO i1 = LBOUND(ConstrStateData%BStC,1), UBOUND(ConstrStateData%BStC,1) + CALL StC_DestroyConstrState( ConstrStateData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%BStC) +ENDIF +IF (ALLOCATED(ConstrStateData%NStC)) THEN +DO i1 = LBOUND(ConstrStateData%NStC,1), UBOUND(ConstrStateData%NStC,1) + CALL StC_DestroyConstrState( ConstrStateData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%NStC) +ENDIF +IF (ALLOCATED(ConstrStateData%TStC)) THEN +DO i1 = LBOUND(ConstrStateData%TStC,1), UBOUND(ConstrStateData%TStC,1) + CALL StC_DestroyConstrState( ConstrStateData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%TStC) +ENDIF +IF (ALLOCATED(ConstrStateData%SStC)) THEN +DO i1 = LBOUND(ConstrStateData%SStC,1), UBOUND(ConstrStateData%SStC,1) + CALL StC_DestroyConstrState( ConstrStateData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ConstrStateData%SStC) +ENDIF + END SUBROUTINE SrvD_DestroyConstrState + + SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) TYPE(SrvD_ConstraintStateType), INTENT(IN) :: InData @@ -3741,41 +5296,99 @@ SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er Db_BufSz = 0 Int_BufSz = 0 Re_BufSz = Re_BufSz + 1 ! DummyConstrState + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3805,7 +5418,100 @@ SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er ReKiBuf(Re_Xferred) = InData%DummyConstrState Re_Xferred = Re_Xferred + 1 - CALL TMD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3833,7 +5539,20 @@ SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackConstrState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -3861,6 +5580,8 @@ SUBROUTINE SrvD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Er ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + END DO + END IF END SUBROUTINE SrvD_PackConstrState SUBROUTINE SrvD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -3876,6 +5597,7 @@ SUBROUTINE SrvD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackConstrState' @@ -3891,6 +5613,132 @@ SUBROUTINE SrvD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Xferred = 1 OutData%DummyConstrState = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3924,13 +5772,29 @@ SUBROUTINE SrvD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -3964,13 +5828,15 @@ SUBROUTINE SrvD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackConstrState( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF END SUBROUTINE SrvD_UnPackConstrState SUBROUTINE SrvD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) @@ -4066,12 +5932,70 @@ SUBROUTINE SrvD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ENDIF DstOtherStateData%Off4Good = SrcOtherStateData%Off4Good DstOtherStateData%GenOnLine = SrcOtherStateData%GenOnLine - CALL TMD_CopyOtherState( SrcOtherStateData%NTMD, DstOtherStateData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcOtherStateData%BStC)) THEN + i1_l = LBOUND(SrcOtherStateData%BStC,1) + i1_u = UBOUND(SrcOtherStateData%BStC,1) + IF (.NOT. ALLOCATED(DstOtherStateData%BStC)) THEN + ALLOCATE(DstOtherStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%BStC,1), UBOUND(SrcOtherStateData%BStC,1) + CALL StC_CopyOtherState( SrcOtherStateData%BStC(i1), DstOtherStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcOtherStateData%NStC)) THEN + i1_l = LBOUND(SrcOtherStateData%NStC,1) + i1_u = UBOUND(SrcOtherStateData%NStC,1) + IF (.NOT. ALLOCATED(DstOtherStateData%NStC)) THEN + ALLOCATE(DstOtherStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%NStC,1), UBOUND(SrcOtherStateData%NStC,1) + CALL StC_CopyOtherState( SrcOtherStateData%NStC(i1), DstOtherStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcOtherStateData%TStC)) THEN + i1_l = LBOUND(SrcOtherStateData%TStC,1) + i1_u = UBOUND(SrcOtherStateData%TStC,1) + IF (.NOT. ALLOCATED(DstOtherStateData%TStC)) THEN + ALLOCATE(DstOtherStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%TStC,1), UBOUND(SrcOtherStateData%TStC,1) + CALL StC_CopyOtherState( SrcOtherStateData%TStC(i1), DstOtherStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyOtherState( SrcOtherStateData%TTMD, DstOtherStateData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcOtherStateData%SStC)) THEN + i1_l = LBOUND(SrcOtherStateData%SStC,1) + i1_u = UBOUND(SrcOtherStateData%SStC,1) + IF (.NOT. ALLOCATED(DstOtherStateData%SStC)) THEN + ALLOCATE(DstOtherStateData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOtherStateData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOtherStateData%SStC,1), UBOUND(SrcOtherStateData%SStC,1) + CALL StC_CopyOtherState( SrcOtherStateData%SStC(i1), DstOtherStateData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF END SUBROUTINE SrvD_CopyOtherState SUBROUTINE SrvD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) @@ -4101,8 +6025,30 @@ SUBROUTINE SrvD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) IF (ALLOCATED(OtherStateData%TTpBrFl)) THEN DEALLOCATE(OtherStateData%TTpBrFl) ENDIF - CALL TMD_DestroyOtherState( OtherStateData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyOtherState( OtherStateData%TTMD, ErrStat, ErrMsg ) +IF (ALLOCATED(OtherStateData%BStC)) THEN +DO i1 = LBOUND(OtherStateData%BStC,1), UBOUND(OtherStateData%BStC,1) + CALL StC_DestroyOtherState( OtherStateData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%BStC) +ENDIF +IF (ALLOCATED(OtherStateData%NStC)) THEN +DO i1 = LBOUND(OtherStateData%NStC,1), UBOUND(OtherStateData%NStC,1) + CALL StC_DestroyOtherState( OtherStateData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%NStC) +ENDIF +IF (ALLOCATED(OtherStateData%TStC)) THEN +DO i1 = LBOUND(OtherStateData%TStC,1), UBOUND(OtherStateData%TStC,1) + CALL StC_DestroyOtherState( OtherStateData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%TStC) +ENDIF +IF (ALLOCATED(OtherStateData%SStC)) THEN +DO i1 = LBOUND(OtherStateData%SStC,1), UBOUND(OtherStateData%SStC,1) + CALL StC_DestroyOtherState( OtherStateData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OtherStateData%SStC) +ENDIF END SUBROUTINE SrvD_DestroyOtherState SUBROUTINE SrvD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -4176,41 +6122,99 @@ SUBROUTINE SrvD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err END IF Int_BufSz = Int_BufSz + 1 ! Off4Good Int_BufSz = Int_BufSz + 1 ! GenOnLine + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4306,41 +6310,134 @@ SUBROUTINE SrvD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err Int_Xferred = Int_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%TTpBrDp) ) THEN + IF ( .NOT. ALLOCATED(InData%TTpBrDp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TTpBrDp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TTpBrDp,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TTpBrDp,1), UBOUND(InData%TTpBrDp,1) + DbKiBuf(Db_Xferred) = InData%TTpBrDp(i1) + Db_Xferred = Db_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TTpBrFl) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TTpBrFl,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TTpBrFl,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TTpBrFl,1), UBOUND(InData%TTpBrFl,1) + DbKiBuf(Db_Xferred) = InData%TTpBrFl(i1) + Db_Xferred = Db_Xferred + 1 + END DO + END IF + IntKiBuf(Int_Xferred) = TRANSFER(InData%Off4Good, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%GenOnLine, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TTpBrDp,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TTpBrDp,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TTpBrDp,1), UBOUND(InData%TTpBrDp,1) - DbKiBuf(Db_Xferred) = InData%TTpBrDp(i1) - Db_Xferred = Db_Xferred + 1 - END DO + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - IF ( .NOT. ALLOCATED(InData%TTpBrFl) ) THEN + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TTpBrFl,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TTpBrFl,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TTpBrFl,1), UBOUND(InData%TTpBrFl,1) - DbKiBuf(Db_Xferred) = InData%TTpBrFl(i1) - Db_Xferred = Db_Xferred + 1 - END DO - END IF - IntKiBuf(Int_Xferred) = TRANSFER(InData%Off4Good, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%GenOnLine, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - CALL TMD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4368,7 +6465,20 @@ SUBROUTINE SrvD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackOtherState( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4396,6 +6506,8 @@ SUBROUTINE SrvD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Err ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + END DO + END IF END SUBROUTINE SrvD_PackOtherState SUBROUTINE SrvD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -4545,6 +6657,132 @@ SUBROUTINE SrvD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Xferred = Int_Xferred + 1 OutData%GenOnLine = TRANSFER(IntKiBuf(Int_Xferred), OutData%GenOnLine) Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4578,13 +6816,29 @@ SUBROUTINE SrvD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4618,13 +6872,15 @@ SUBROUTINE SrvD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackOtherState( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF END SUBROUTINE SrvD_UnPackOtherState SUBROUTINE SrvD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) @@ -4660,12 +6916,70 @@ SUBROUTINE SrvD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) END IF DstMiscData%xd_BlPitchFilter = SrcMiscData%xd_BlPitchFilter ENDIF - CALL TMD_CopyMisc( SrcMiscData%NTMD, DstMiscData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcMiscData%BStC)) THEN + i1_l = LBOUND(SrcMiscData%BStC,1) + i1_u = UBOUND(SrcMiscData%BStC,1) + IF (.NOT. ALLOCATED(DstMiscData%BStC)) THEN + ALLOCATE(DstMiscData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%BStC,1), UBOUND(SrcMiscData%BStC,1) + CALL StC_CopyMisc( SrcMiscData%BStC(i1), DstMiscData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%NStC)) THEN + i1_l = LBOUND(SrcMiscData%NStC,1) + i1_u = UBOUND(SrcMiscData%NStC,1) + IF (.NOT. ALLOCATED(DstMiscData%NStC)) THEN + ALLOCATE(DstMiscData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%NStC,1), UBOUND(SrcMiscData%NStC,1) + CALL StC_CopyMisc( SrcMiscData%NStC(i1), DstMiscData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%TStC)) THEN + i1_l = LBOUND(SrcMiscData%TStC,1) + i1_u = UBOUND(SrcMiscData%TStC,1) + IF (.NOT. ALLOCATED(DstMiscData%TStC)) THEN + ALLOCATE(DstMiscData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%TStC,1), UBOUND(SrcMiscData%TStC,1) + CALL StC_CopyMisc( SrcMiscData%TStC(i1), DstMiscData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyMisc( SrcMiscData%TTMD, DstMiscData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%SStC)) THEN + i1_l = LBOUND(SrcMiscData%SStC,1) + i1_u = UBOUND(SrcMiscData%SStC,1) + IF (.NOT. ALLOCATED(DstMiscData%SStC)) THEN + ALLOCATE(DstMiscData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%SStC,1), UBOUND(SrcMiscData%SStC,1) + CALL StC_CopyMisc( SrcMiscData%SStC(i1), DstMiscData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF END SUBROUTINE SrvD_CopyMisc SUBROUTINE SrvD_DestroyMisc( MiscData, ErrStat, ErrMsg ) @@ -4681,8 +6995,30 @@ SUBROUTINE SrvD_DestroyMisc( MiscData, ErrStat, ErrMsg ) IF (ALLOCATED(MiscData%xd_BlPitchFilter)) THEN DEALLOCATE(MiscData%xd_BlPitchFilter) ENDIF - CALL TMD_DestroyMisc( MiscData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyMisc( MiscData%TTMD, ErrStat, ErrMsg ) +IF (ALLOCATED(MiscData%BStC)) THEN +DO i1 = LBOUND(MiscData%BStC,1), UBOUND(MiscData%BStC,1) + CALL StC_DestroyMisc( MiscData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%BStC) +ENDIF +IF (ALLOCATED(MiscData%NStC)) THEN +DO i1 = LBOUND(MiscData%NStC,1), UBOUND(MiscData%NStC,1) + CALL StC_DestroyMisc( MiscData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%NStC) +ENDIF +IF (ALLOCATED(MiscData%TStC)) THEN +DO i1 = LBOUND(MiscData%TStC,1), UBOUND(MiscData%TStC,1) + CALL StC_DestroyMisc( MiscData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%TStC) +ENDIF +IF (ALLOCATED(MiscData%SStC)) THEN +DO i1 = LBOUND(MiscData%SStC,1), UBOUND(MiscData%SStC,1) + CALL StC_DestroyMisc( MiscData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%SStC) +ENDIF END SUBROUTINE SrvD_DestroyMisc SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -4727,59 +7063,117 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! dll_data + IF(ALLOCATED(Re_Buf)) THEN ! dll_data + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! dll_data + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! dll_data + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! FirstWarn + Db_BufSz = Db_BufSz + 1 ! LastTimeFiltered + Int_BufSz = Int_BufSz + 1 ! xd_BlPitchFilter allocated yes/no + IF ( ALLOCATED(InData%xd_BlPitchFilter) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! xd_BlPitchFilter upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xd_BlPitchFilter) ! xd_BlPitchFilter + END IF + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! dll_data + IF(ALLOCATED(Db_Buf)) THEN ! NStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! dll_data + IF(ALLOCATED(Int_Buf)) THEN ! NStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! FirstWarn - Db_BufSz = Db_BufSz + 1 ! LastTimeFiltered - Int_BufSz = Int_BufSz + 1 ! xd_BlPitchFilter allocated yes/no - IF ( ALLOCATED(InData%xd_BlPitchFilter) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! xd_BlPitchFilter upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%xd_BlPitchFilter) ! xd_BlPitchFilter + END DO END IF - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4856,7 +7250,141 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Re_Xferred = Re_Xferred + 1 END DO END IF - CALL TMD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -4884,65 +7412,171 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + END SUBROUTINE SrvD_PackMisc + + SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%LastTimeCalled = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SrvD_Unpackbladeddlltype( Re_Buf, Db_Buf, Int_Buf, OutData%dll_data, ErrStat2, ErrMsg2 ) ! dll_data + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%FirstWarn = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn) + Int_Xferred = Int_Xferred + 1 + OutData%LastTimeFiltered = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xd_BlPitchFilter not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xd_BlPitchFilter)) DEALLOCATE(OutData%xd_BlPitchFilter) + ALLOCATE(OutData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%xd_BlPitchFilter,1), UBOUND(OutData%xd_BlPitchFilter,1) + OutData%xd_BlPitchFilter(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE SrvD_PackMisc - - SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SrvD_MiscVarType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackMisc' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%LastTimeCalled = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -4976,35 +7610,29 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SrvD_Unpackbladeddlltype( Re_Buf, Db_Buf, Int_Buf, OutData%dll_data, ErrStat2, ErrMsg2 ) ! dll_data + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - OutData%FirstWarn = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn) - Int_Xferred = Int_Xferred + 1 - OutData%LastTimeFiltered = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xd_BlPitchFilter not allocated + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%xd_BlPitchFilter)) DEALLOCATE(OutData%xd_BlPitchFilter) - ALLOCATE(OutData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%xd_BlPitchFilter,1), UBOUND(OutData%xd_BlPitchFilter,1) - OutData%xd_BlPitchFilter(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -5038,13 +7666,29 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -5078,13 +7722,15 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF END SUBROUTINE SrvD_UnPackMisc SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) @@ -5218,8 +7864,10 @@ SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%TBDrConN = SrcParamData%TBDrConN DstParamData%TBDrConD = SrcParamData%TBDrConD DstParamData%NumBl = SrcParamData%NumBl - DstParamData%CompNTMD = SrcParamData%CompNTMD - DstParamData%CompTTMD = SrcParamData%CompTTMD + DstParamData%NumBStC = SrcParamData%NumBStC + DstParamData%NumNStC = SrcParamData%NumNStC + DstParamData%NumTStC = SrcParamData%NumTStC + DstParamData%NumSStC = SrcParamData%NumSStC DstParamData%NumOuts = SrcParamData%NumOuts DstParamData%NumOuts_DLL = SrcParamData%NumOuts_DLL DstParamData%RootName = SrcParamData%RootName @@ -5253,12 +7901,71 @@ SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%TrimCase = SrcParamData%TrimCase DstParamData%TrimGain = SrcParamData%TrimGain DstParamData%RotSpeedRef = SrcParamData%RotSpeedRef - CALL TMD_CopyParam( SrcParamData%NTMD, DstParamData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcParamData%BStC)) THEN + i1_l = LBOUND(SrcParamData%BStC,1) + i1_u = UBOUND(SrcParamData%BStC,1) + IF (.NOT. ALLOCATED(DstParamData%BStC)) THEN + ALLOCATE(DstParamData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%BStC,1), UBOUND(SrcParamData%BStC,1) + CALL StC_CopyParam( SrcParamData%BStC(i1), DstParamData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcParamData%NStC)) THEN + i1_l = LBOUND(SrcParamData%NStC,1) + i1_u = UBOUND(SrcParamData%NStC,1) + IF (.NOT. ALLOCATED(DstParamData%NStC)) THEN + ALLOCATE(DstParamData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%NStC,1), UBOUND(SrcParamData%NStC,1) + CALL StC_CopyParam( SrcParamData%NStC(i1), DstParamData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcParamData%TStC)) THEN + i1_l = LBOUND(SrcParamData%TStC,1) + i1_u = UBOUND(SrcParamData%TStC,1) + IF (.NOT. ALLOCATED(DstParamData%TStC)) THEN + ALLOCATE(DstParamData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%TStC,1), UBOUND(SrcParamData%TStC,1) + CALL StC_CopyParam( SrcParamData%TStC(i1), DstParamData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyParam( SrcParamData%TTMD, DstParamData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcParamData%SStC)) THEN + i1_l = LBOUND(SrcParamData%SStC,1) + i1_u = UBOUND(SrcParamData%SStC,1) + IF (.NOT. ALLOCATED(DstParamData%SStC)) THEN + ALLOCATE(DstParamData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcParamData%SStC,1), UBOUND(SrcParamData%SStC,1) + CALL StC_CopyParam( SrcParamData%SStC(i1), DstParamData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + DstParamData%UseSC = SrcParamData%UseSC END SUBROUTINE SrvD_CopyParam SUBROUTINE SrvD_DestroyParam( ParamData, ErrStat, ErrMsg ) @@ -5292,8 +7999,30 @@ SUBROUTINE SrvD_DestroyParam( ParamData, ErrStat, ErrMsg ) DEALLOCATE(ParamData%OutParam) ENDIF CALL FreeDynamicLib( ParamData%DLL_Trgt, ErrStat, ErrMsg ) - CALL TMD_DestroyParam( ParamData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyParam( ParamData%TTMD, ErrStat, ErrMsg ) +IF (ALLOCATED(ParamData%BStC)) THEN +DO i1 = LBOUND(ParamData%BStC,1), UBOUND(ParamData%BStC,1) + CALL StC_DestroyParam( ParamData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%BStC) +ENDIF +IF (ALLOCATED(ParamData%NStC)) THEN +DO i1 = LBOUND(ParamData%NStC,1), UBOUND(ParamData%NStC,1) + CALL StC_DestroyParam( ParamData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%NStC) +ENDIF +IF (ALLOCATED(ParamData%TStC)) THEN +DO i1 = LBOUND(ParamData%TStC,1), UBOUND(ParamData%TStC,1) + CALL StC_DestroyParam( ParamData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%TStC) +ENDIF +IF (ALLOCATED(ParamData%SStC)) THEN +DO i1 = LBOUND(ParamData%SStC,1), UBOUND(ParamData%SStC,1) + CALL StC_DestroyParam( ParamData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ParamData%SStC) +ENDIF END SUBROUTINE SrvD_DestroyParam SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -5412,8 +8141,10 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_BufSz = Re_BufSz + 1 ! TBDrConN Re_BufSz = Re_BufSz + 1 ! TBDrConD Int_BufSz = Int_BufSz + 1 ! NumBl - Int_BufSz = Int_BufSz + 1 ! CompNTMD - Int_BufSz = Int_BufSz + 1 ! CompTTMD + Int_BufSz = Int_BufSz + 1 ! NumBStC + Int_BufSz = Int_BufSz + 1 ! NumNStC + Int_BufSz = Int_BufSz + 1 ! NumTStC + Int_BufSz = Int_BufSz + 1 ! NumSStC Int_BufSz = Int_BufSz + 1 ! NumOuts Int_BufSz = Int_BufSz + 1 ! NumOuts_DLL Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName @@ -5471,40 +8202,99 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 1 ! TrimCase Re_BufSz = Re_BufSz + 1 ! TrimGain Re_BufSz = Re_BufSz + 1 ! RotSpeedRef - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! UseSC IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -5719,30 +8509,131 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumBl Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompNTMD, IntKiBuf(1)) + IntKiBuf(Int_Xferred) = InData%NumBStC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumNStC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumTStC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSStC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumOuts + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumOuts_DLL + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%OutParam) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%OutParam,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutParam,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) + CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutParam + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + DO I = 1, LEN(InData%Delim) + IntKiBuf(Int_Xferred) = ICHAR(InData%Delim(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseBladedInterface, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseLegacyInterface, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + CALL DLLTypePack( InData%DLL_Trgt, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! DLL_Trgt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%DLL_Ramp, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%CompTTMD, IntKiBuf(1)) + ReKiBuf(Re_Xferred) = InData%BlAlpha + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%DLL_n Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumOuts + IntKiBuf(Int_Xferred) = InData%avcOUTNAME_LEN Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumOuts_DLL + ReKiBuf(Re_Xferred) = InData%NacYaw_North + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AvgWindSpeed + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AirDens + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%TrimCase Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%RootName) - IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( .NOT. ALLOCATED(InData%OutParam) ) THEN + ReKiBuf(Re_Xferred) = InData%TrimGain + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%RotSpeedRef + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%OutParam,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%OutParam,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%OutParam,1), UBOUND(InData%OutParam,1) - CALL NWTC_Library_Packoutparmtype( Re_Buf, Db_Buf, Int_Buf, InData%OutParam(i1), ErrStat2, ErrMsg2, OnlySize ) ! OutParam + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5772,15 +8663,18 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF - DO I = 1, LEN(InData%Delim) - IntKiBuf(Int_Xferred) = ICHAR(InData%Delim(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = TRANSFER(InData%UseBladedInterface, IntKiBuf(1)) + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%UseLegacyInterface, IntKiBuf(1)) + ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - CALL DLLTypePack( InData%DLL_Trgt, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! DLL_Trgt + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5808,27 +8702,20 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IntKiBuf(Int_Xferred) = TRANSFER(InData%DLL_Ramp, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%BlAlpha - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%DLL_n - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%avcOUTNAME_LEN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%NacYaw_North - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%AvgWindSpeed - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%AirDens - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TrimCase + ELSE + IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TrimGain - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%RotSpeedRef - Re_Xferred = Re_Xferred + 1 - CALL TMD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5856,7 +8743,20 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackParam( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -5884,6 +8784,10 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + END DO + END IF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseSC, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE SrvD_PackParam SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -6115,9 +9019,13 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 OutData%NumBl = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - OutData%CompNTMD = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompNTMD) + OutData%NumBStC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumNStC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumTStC = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - OutData%CompTTMD = TRANSFER(IntKiBuf(Int_Xferred), OutData%CompTTMD) + OutData%NumSStC = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%NumOuts = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 @@ -6251,6 +9159,132 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 OutData%RotSpeedRef = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6284,13 +9318,29 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6324,13 +9374,17 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackParam( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + OutData%UseSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseSC) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE SrvD_UnPackParam SUBROUTINE SrvD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) @@ -6403,23 +9457,105 @@ SUBROUTINE SrvD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg DstInputData%RotPwr = SrcInputData%RotPwr DstInputData%HorWindV = SrcInputData%HorWindV DstInputData%YawAngle = SrcInputData%YawAngle - CALL TMD_CopyInput( SrcInputData%NTMD, DstInputData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcInputData%BStC)) THEN + i1_l = LBOUND(SrcInputData%BStC,1) + i1_u = UBOUND(SrcInputData%BStC,1) + IF (.NOT. ALLOCATED(DstInputData%BStC)) THEN + ALLOCATE(DstInputData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%BStC,1), UBOUND(SrcInputData%BStC,1) + CALL StC_CopyInput( SrcInputData%BStC(i1), DstInputData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%NStC)) THEN + i1_l = LBOUND(SrcInputData%NStC,1) + i1_u = UBOUND(SrcInputData%NStC,1) + IF (.NOT. ALLOCATED(DstInputData%NStC)) THEN + ALLOCATE(DstInputData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%NStC,1), UBOUND(SrcInputData%NStC,1) + CALL StC_CopyInput( SrcInputData%NStC(i1), DstInputData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%TStC)) THEN + i1_l = LBOUND(SrcInputData%TStC,1) + i1_u = UBOUND(SrcInputData%TStC,1) + IF (.NOT. ALLOCATED(DstInputData%TStC)) THEN + ALLOCATE(DstInputData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%TStC,1), UBOUND(SrcInputData%TStC,1) + CALL StC_CopyInput( SrcInputData%TStC(i1), DstInputData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyInput( SrcInputData%TTMD, DstInputData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%SStC)) THEN + i1_l = LBOUND(SrcInputData%SStC,1) + i1_u = UBOUND(SrcInputData%SStC,1) + IF (.NOT. ALLOCATED(DstInputData%SStC)) THEN + ALLOCATE(DstInputData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%SStC,1), UBOUND(SrcInputData%SStC,1) + CALL StC_CopyInput( SrcInputData%SStC(i1), DstInputData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcInputData%SuperController)) THEN - i1_l = LBOUND(SrcInputData%SuperController,1) - i1_u = UBOUND(SrcInputData%SuperController,1) - IF (.NOT. ALLOCATED(DstInputData%SuperController)) THEN - ALLOCATE(DstInputData%SuperController(i1_l:i1_u),STAT=ErrStat2) + ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%fromSC)) THEN + i1_l = LBOUND(SrcInputData%fromSC,1) + i1_u = UBOUND(SrcInputData%fromSC,1) + IF (.NOT. ALLOCATED(DstInputData%fromSC)) THEN + ALLOCATE(DstInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%fromSC = SrcInputData%fromSC +ENDIF +IF (ALLOCATED(SrcInputData%fromSCglob)) THEN + i1_l = LBOUND(SrcInputData%fromSCglob,1) + i1_u = UBOUND(SrcInputData%fromSCglob,1) + IF (.NOT. ALLOCATED(DstInputData%fromSCglob)) THEN + ALLOCATE(DstInputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%fromSCglob = SrcInputData%fromSCglob +ENDIF +IF (ALLOCATED(SrcInputData%Lidar)) THEN + i1_l = LBOUND(SrcInputData%Lidar,1) + i1_u = UBOUND(SrcInputData%Lidar,1) + IF (.NOT. ALLOCATED(DstInputData%Lidar)) THEN + ALLOCATE(DstInputData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%SuperController.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%SuperController = SrcInputData%SuperController + DstInputData%Lidar = SrcInputData%Lidar ENDIF END SUBROUTINE SrvD_CopyInput @@ -6435,13 +9571,41 @@ SUBROUTINE SrvD_DestroyInput( InputData, ErrStat, ErrMsg ) IF (ALLOCATED(InputData%BlPitch)) THEN DEALLOCATE(InputData%BlPitch) ENDIF -IF (ALLOCATED(InputData%ExternalBlPitchCom)) THEN - DEALLOCATE(InputData%ExternalBlPitchCom) +IF (ALLOCATED(InputData%ExternalBlPitchCom)) THEN + DEALLOCATE(InputData%ExternalBlPitchCom) +ENDIF +IF (ALLOCATED(InputData%BStC)) THEN +DO i1 = LBOUND(InputData%BStC,1), UBOUND(InputData%BStC,1) + CALL StC_DestroyInput( InputData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%BStC) +ENDIF +IF (ALLOCATED(InputData%NStC)) THEN +DO i1 = LBOUND(InputData%NStC,1), UBOUND(InputData%NStC,1) + CALL StC_DestroyInput( InputData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%NStC) +ENDIF +IF (ALLOCATED(InputData%TStC)) THEN +DO i1 = LBOUND(InputData%TStC,1), UBOUND(InputData%TStC,1) + CALL StC_DestroyInput( InputData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%TStC) +ENDIF +IF (ALLOCATED(InputData%SStC)) THEN +DO i1 = LBOUND(InputData%SStC,1), UBOUND(InputData%SStC,1) + CALL StC_DestroyInput( InputData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%SStC) +ENDIF +IF (ALLOCATED(InputData%fromSC)) THEN + DEALLOCATE(InputData%fromSC) ENDIF - CALL TMD_DestroyInput( InputData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyInput( InputData%TTMD, ErrStat, ErrMsg ) -IF (ALLOCATED(InputData%SuperController)) THEN - DEALLOCATE(InputData%SuperController) +IF (ALLOCATED(InputData%fromSCglob)) THEN + DEALLOCATE(InputData%fromSCglob) +ENDIF +IF (ALLOCATED(InputData%Lidar)) THEN + DEALLOCATE(InputData%Lidar) ENDIF END SUBROUTINE SrvD_DestroyInput @@ -6521,45 +9685,113 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_BufSz = Re_BufSz + 1 ! RotPwr Re_BufSz = Re_BufSz + 1 ! HorWindV Re_BufSz = Re_BufSz + 1 ! YawAngle + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! SuperController allocated yes/no - IF ( ALLOCATED(InData%SuperController) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SuperController upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SuperController) ! SuperController + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF + Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no + IF ( ALLOCATED(InData%fromSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob + END IF + Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no + IF ( ALLOCATED(InData%Lidar) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) @@ -6684,7 +9916,100 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%YawAngle Re_Xferred = Re_Xferred + 1 - CALL TMD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6712,7 +10037,20 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -6740,18 +10078,50 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%SuperController) ) THEN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) + ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SuperController,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SuperController,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SuperController,1), UBOUND(InData%SuperController,1) - ReKiBuf(Re_Xferred) = InData%SuperController(i1) + DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) + ReKiBuf(Re_Xferred) = InData%Lidar(i1) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -6864,32 +10234,158 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs OutData%RootMxc(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - OutData%LSSTipMxa = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%LSSTipMya = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%LSSTipMza = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%LSSTipMys = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%LSSTipMzs = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%YawBrMyn = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%YawBrMzn = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%NcIMURAxs = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%NcIMURAys = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%NcIMURAzs = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%RotPwr = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%HorWindV = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%YawAngle = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 + OutData%LSSTipMxa = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%LSSTipMya = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%LSSTipMza = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%LSSTipMys = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%LSSTipMzs = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%YawBrMyn = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%YawBrMzn = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%NcIMURAxs = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%NcIMURAys = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%NcIMURAzs = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%RotPwr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%HorWindV = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%YawAngle = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6923,13 +10419,29 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -6963,28 +10475,66 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SuperController not allocated + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) + ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) + OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SuperController)) DEALLOCATE(OutData%SuperController) - ALLOCATE(OutData%SuperController(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) + ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SuperController.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SuperController,1), UBOUND(OutData%SuperController,1) - OutData%SuperController(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) + OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -7057,23 +10607,93 @@ SUBROUTINE SrvD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, Err END IF DstOutputData%TBDrCon = SrcOutputData%TBDrCon ENDIF - CALL TMD_CopyOutput( SrcOutputData%NTMD, DstOutputData%NTMD, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcOutputData%BStC)) THEN + i1_l = LBOUND(SrcOutputData%BStC,1) + i1_u = UBOUND(SrcOutputData%BStC,1) + IF (.NOT. ALLOCATED(DstOutputData%BStC)) THEN + ALLOCATE(DstOutputData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%BStC,1), UBOUND(SrcOutputData%BStC,1) + CALL StC_CopyOutput( SrcOutputData%BStC(i1), DstOutputData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%NStC)) THEN + i1_l = LBOUND(SrcOutputData%NStC,1) + i1_u = UBOUND(SrcOutputData%NStC,1) + IF (.NOT. ALLOCATED(DstOutputData%NStC)) THEN + ALLOCATE(DstOutputData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%NStC,1), UBOUND(SrcOutputData%NStC,1) + CALL StC_CopyOutput( SrcOutputData%NStC(i1), DstOutputData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%TStC)) THEN + i1_l = LBOUND(SrcOutputData%TStC,1) + i1_u = UBOUND(SrcOutputData%TStC,1) + IF (.NOT. ALLOCATED(DstOutputData%TStC)) THEN + ALLOCATE(DstOutputData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%TStC,1), UBOUND(SrcOutputData%TStC,1) + CALL StC_CopyOutput( SrcOutputData%TStC(i1), DstOutputData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL TMD_CopyOutput( SrcOutputData%TTMD, DstOutputData%TTMD, CtrlCode, ErrStat2, ErrMsg2 ) + ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%SStC)) THEN + i1_l = LBOUND(SrcOutputData%SStC,1) + i1_u = UBOUND(SrcOutputData%SStC,1) + IF (.NOT. ALLOCATED(DstOutputData%SStC)) THEN + ALLOCATE(DstOutputData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%SStC,1), UBOUND(SrcOutputData%SStC,1) + CALL StC_CopyOutput( SrcOutputData%SStC(i1), DstOutputData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcOutputData%SuperController)) THEN - i1_l = LBOUND(SrcOutputData%SuperController,1) - i1_u = UBOUND(SrcOutputData%SuperController,1) - IF (.NOT. ALLOCATED(DstOutputData%SuperController)) THEN - ALLOCATE(DstOutputData%SuperController(i1_l:i1_u),STAT=ErrStat2) + ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%toSC)) THEN + i1_l = LBOUND(SrcOutputData%toSC,1) + i1_u = UBOUND(SrcOutputData%toSC,1) + IF (.NOT. ALLOCATED(DstOutputData%toSC)) THEN + ALLOCATE(DstOutputData%toSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%toSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%toSC = SrcOutputData%toSC +ENDIF +IF (ALLOCATED(SrcOutputData%Lidar)) THEN + i1_l = LBOUND(SrcOutputData%Lidar,1) + i1_u = UBOUND(SrcOutputData%Lidar,1) + IF (.NOT. ALLOCATED(DstOutputData%Lidar)) THEN + ALLOCATE(DstOutputData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%SuperController.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstOutputData%SuperController = SrcOutputData%SuperController + DstOutputData%Lidar = SrcOutputData%Lidar ENDIF END SUBROUTINE SrvD_CopyOutput @@ -7098,10 +10718,35 @@ SUBROUTINE SrvD_DestroyOutput( OutputData, ErrStat, ErrMsg ) IF (ALLOCATED(OutputData%TBDrCon)) THEN DEALLOCATE(OutputData%TBDrCon) ENDIF - CALL TMD_DestroyOutput( OutputData%NTMD, ErrStat, ErrMsg ) - CALL TMD_DestroyOutput( OutputData%TTMD, ErrStat, ErrMsg ) -IF (ALLOCATED(OutputData%SuperController)) THEN - DEALLOCATE(OutputData%SuperController) +IF (ALLOCATED(OutputData%BStC)) THEN +DO i1 = LBOUND(OutputData%BStC,1), UBOUND(OutputData%BStC,1) + CALL StC_DestroyOutput( OutputData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%BStC) +ENDIF +IF (ALLOCATED(OutputData%NStC)) THEN +DO i1 = LBOUND(OutputData%NStC,1), UBOUND(OutputData%NStC,1) + CALL StC_DestroyOutput( OutputData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%NStC) +ENDIF +IF (ALLOCATED(OutputData%TStC)) THEN +DO i1 = LBOUND(OutputData%TStC,1), UBOUND(OutputData%TStC,1) + CALL StC_DestroyOutput( OutputData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%TStC) +ENDIF +IF (ALLOCATED(OutputData%SStC)) THEN +DO i1 = LBOUND(OutputData%SStC,1), UBOUND(OutputData%SStC,1) + CALL StC_DestroyOutput( OutputData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%SStC) +ENDIF +IF (ALLOCATED(OutputData%toSC)) THEN + DEALLOCATE(OutputData%toSC) +ENDIF +IF (ALLOCATED(OutputData%Lidar)) THEN + DEALLOCATE(OutputData%Lidar) ENDIF END SUBROUTINE SrvD_DestroyOutput @@ -7164,45 +10809,108 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 2*1 ! TBDrCon upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%TBDrCon) ! TBDrCon END IF + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! NTMD: size of buffers for each call to pack subtype - CALL TMD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, .TRUE. ) ! NTMD + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NTMD + IF(ALLOCATED(Re_Buf)) THEN ! TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NTMD + IF(ALLOCATED(Db_Buf)) THEN ! TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NTMD + IF(ALLOCATED(Int_Buf)) THEN ! TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! TTMD: size of buffers for each call to pack subtype - CALL TMD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, .TRUE. ) ! TTMD + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TTMD + IF(ALLOCATED(Re_Buf)) THEN ! SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TTMD + IF(ALLOCATED(Db_Buf)) THEN ! SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TTMD + IF(ALLOCATED(Int_Buf)) THEN ! SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! SuperController allocated yes/no - IF ( ALLOCATED(InData%SuperController) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SuperController upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%SuperController) ! SuperController + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no + IF ( ALLOCATED(InData%toSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC + END IF + Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no + IF ( ALLOCATED(InData%Lidar) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) @@ -7246,60 +10954,153 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%BlPitchCom) ) THEN + IF ( .NOT. ALLOCATED(InData%BlPitchCom) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlPitchCom,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlPitchCom,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BlPitchCom,1), UBOUND(InData%BlPitchCom,1) + ReKiBuf(Re_Xferred) = InData%BlPitchCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BlAirfoilCom) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BlAirfoilCom,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlAirfoilCom,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BlAirfoilCom,1), UBOUND(InData%BlAirfoilCom,1) + ReKiBuf(Re_Xferred) = InData%BlAirfoilCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + ReKiBuf(Re_Xferred) = InData%YawMom + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%GenTrq + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%HSSBrTrqC + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%ElecPwr + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%TBDrCon) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TBDrCon,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TBDrCon,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TBDrCon,1), UBOUND(InData%TBDrCon,1) + ReKiBuf(Re_Xferred) = InData%TBDrCon(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlPitchCom,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlPitchCom,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BlPitchCom,1), UBOUND(InData%BlPitchCom,1) - ReKiBuf(Re_Xferred) = InData%BlPitchCom(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%BlAirfoilCom) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BlAirfoilCom,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BlAirfoilCom,1) - Int_Xferred = Int_Xferred + 2 + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - DO i1 = LBOUND(InData%BlAirfoilCom,1), UBOUND(InData%BlAirfoilCom,1) - ReKiBuf(Re_Xferred) = InData%BlAirfoilCom(i1) - Re_Xferred = Re_Xferred + 1 - END DO + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF - ReKiBuf(Re_Xferred) = InData%YawMom - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%GenTrq - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%HSSBrTrqC - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%ElecPwr - Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%TBDrCon) ) THEN + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TBDrCon,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TBDrCon,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TBDrCon,1), UBOUND(InData%TBDrCon,1) - ReKiBuf(Re_Xferred) = InData%TBDrCon(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - CALL TMD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NTMD, ErrStat2, ErrMsg2, OnlySize ) ! NTMD + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7327,7 +11128,20 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - CALL TMD_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TTMD, ErrStat2, ErrMsg2, OnlySize ) ! TTMD + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7355,18 +11169,35 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%SuperController) ) THEN + END DO + END IF + IF ( .NOT. ALLOCATED(InData%toSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%toSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%toSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%toSC,1), UBOUND(InData%toSC,1) + ReKiBuf(Re_Xferred) = InData%toSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SuperController,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SuperController,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SuperController,1), UBOUND(InData%SuperController,1) - ReKiBuf(Re_Xferred) = InData%SuperController(i1) + DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) + ReKiBuf(Re_Xferred) = InData%Lidar(i1) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -7479,6 +11310,132 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7512,13 +11469,29 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%NTMD, ErrStat2, ErrMsg2 ) ! NTMD + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7552,28 +11525,48 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL TMD_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%TTMD, ErrStat2, ErrMsg2 ) ! TTMD + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SuperController not allocated + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SuperController)) DEALLOCATE(OutData%SuperController) - ALLOCATE(OutData%SuperController(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%toSC)) DEALLOCATE(OutData%toSC) + ALLOCATE(OutData%toSC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SuperController.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%toSC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SuperController,1), UBOUND(OutData%SuperController,1) - OutData%SuperController(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + DO i1 = LBOUND(OutData%toSC,1), UBOUND(OutData%toSC,1) + OutData%toSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) + ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) + OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) Re_Xferred = Re_Xferred + 1 END DO END IF @@ -7745,14 +11738,46 @@ SUBROUTINE SrvD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg b = -(u1%HorWindV - u2%HorWindV) u_out%HorWindV = u1%HorWindV + b * ScaleFactor CALL Angles_ExtrapInterp( u1%YawAngle, u2%YawAngle, tin, u_out%YawAngle, tin_out ) - CALL TMD_Input_ExtrapInterp1( u1%NTMD, u2%NTMD, tin, u_out%NTMD, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(u_out%BStC) .AND. ALLOCATED(u1%BStC)) THEN + DO i1 = LBOUND(u_out%BStC,1),UBOUND(u_out%BStC,1) + CALL StC_Input_ExtrapInterp1( u1%BStC(i1), u2%BStC(i1), tin, u_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%NStC) .AND. ALLOCATED(u1%NStC)) THEN + DO i1 = LBOUND(u_out%NStC,1),UBOUND(u_out%NStC,1) + CALL StC_Input_ExtrapInterp1( u1%NStC(i1), u2%NStC(i1), tin, u_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%TStC) .AND. ALLOCATED(u1%TStC)) THEN + DO i1 = LBOUND(u_out%TStC,1),UBOUND(u_out%TStC,1) + CALL StC_Input_ExtrapInterp1( u1%TStC(i1), u2%TStC(i1), tin, u_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL TMD_Input_ExtrapInterp1( u1%TTMD, u2%TTMD, tin, u_out%TTMD, tin_out, ErrStat2, ErrMsg2 ) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%SStC) .AND. ALLOCATED(u1%SStC)) THEN + DO i1 = LBOUND(u_out%SStC,1),UBOUND(u_out%SStC,1) + CALL StC_Input_ExtrapInterp1( u1%SStC(i1), u2%SStC(i1), tin, u_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(u_out%SuperController) .AND. ALLOCATED(u1%SuperController)) THEN - DO i1 = LBOUND(u_out%SuperController,1),UBOUND(u_out%SuperController,1) - b = -(u1%SuperController(i1) - u2%SuperController(i1)) - u_out%SuperController(i1) = u1%SuperController(i1) + b * ScaleFactor + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%fromSC) .AND. ALLOCATED(u1%fromSC)) THEN + DO i1 = LBOUND(u_out%fromSC,1),UBOUND(u_out%fromSC,1) + b = -(u1%fromSC(i1) - u2%fromSC(i1)) + u_out%fromSC(i1) = u1%fromSC(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%fromSCglob) .AND. ALLOCATED(u1%fromSCglob)) THEN + DO i1 = LBOUND(u_out%fromSCglob,1),UBOUND(u_out%fromSCglob,1) + b = -(u1%fromSCglob(i1) - u2%fromSCglob(i1)) + u_out%fromSCglob(i1) = u1%fromSCglob(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%Lidar) .AND. ALLOCATED(u1%Lidar)) THEN + DO i1 = LBOUND(u_out%Lidar,1),UBOUND(u_out%Lidar,1) + b = -(u1%Lidar(i1) - u2%Lidar(i1)) + u_out%Lidar(i1) = u1%Lidar(i1) + b * ScaleFactor END DO END IF ! check if allocated END SUBROUTINE SrvD_Input_ExtrapInterp1 @@ -7909,15 +11934,49 @@ SUBROUTINE SrvD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er c = ( (t(2)-t(3))*u1%HorWindV + t(3)*u2%HorWindV - t(2)*u3%HorWindV ) * scaleFactor u_out%HorWindV = u1%HorWindV + b + c * t_out CALL Angles_ExtrapInterp( u1%YawAngle, u2%YawAngle, u3%YawAngle, tin, u_out%YawAngle, tin_out ) - CALL TMD_Input_ExtrapInterp2( u1%NTMD, u2%NTMD, u3%NTMD, tin, u_out%NTMD, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(u_out%BStC) .AND. ALLOCATED(u1%BStC)) THEN + DO i1 = LBOUND(u_out%BStC,1),UBOUND(u_out%BStC,1) + CALL StC_Input_ExtrapInterp2( u1%BStC(i1), u2%BStC(i1), u3%BStC(i1), tin, u_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%NStC) .AND. ALLOCATED(u1%NStC)) THEN + DO i1 = LBOUND(u_out%NStC,1),UBOUND(u_out%NStC,1) + CALL StC_Input_ExtrapInterp2( u1%NStC(i1), u2%NStC(i1), u3%NStC(i1), tin, u_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL TMD_Input_ExtrapInterp2( u1%TTMD, u2%TTMD, u3%TTMD, tin, u_out%TTMD, tin_out, ErrStat2, ErrMsg2 ) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%TStC) .AND. ALLOCATED(u1%TStC)) THEN + DO i1 = LBOUND(u_out%TStC,1),UBOUND(u_out%TStC,1) + CALL StC_Input_ExtrapInterp2( u1%TStC(i1), u2%TStC(i1), u3%TStC(i1), tin, u_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%SStC) .AND. ALLOCATED(u1%SStC)) THEN + DO i1 = LBOUND(u_out%SStC,1),UBOUND(u_out%SStC,1) + CALL StC_Input_ExtrapInterp2( u1%SStC(i1), u2%SStC(i1), u3%SStC(i1), tin, u_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(u_out%SuperController) .AND. ALLOCATED(u1%SuperController)) THEN - DO i1 = LBOUND(u_out%SuperController,1),UBOUND(u_out%SuperController,1) - b = (t(3)**2*(u1%SuperController(i1) - u2%SuperController(i1)) + t(2)**2*(-u1%SuperController(i1) + u3%SuperController(i1)))* scaleFactor - c = ( (t(2)-t(3))*u1%SuperController(i1) + t(3)*u2%SuperController(i1) - t(2)*u3%SuperController(i1) ) * scaleFactor - u_out%SuperController(i1) = u1%SuperController(i1) + b + c * t_out + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%fromSC) .AND. ALLOCATED(u1%fromSC)) THEN + DO i1 = LBOUND(u_out%fromSC,1),UBOUND(u_out%fromSC,1) + b = (t(3)**2*(u1%fromSC(i1) - u2%fromSC(i1)) + t(2)**2*(-u1%fromSC(i1) + u3%fromSC(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%fromSC(i1) + t(3)*u2%fromSC(i1) - t(2)*u3%fromSC(i1) ) * scaleFactor + u_out%fromSC(i1) = u1%fromSC(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%fromSCglob) .AND. ALLOCATED(u1%fromSCglob)) THEN + DO i1 = LBOUND(u_out%fromSCglob,1),UBOUND(u_out%fromSCglob,1) + b = (t(3)**2*(u1%fromSCglob(i1) - u2%fromSCglob(i1)) + t(2)**2*(-u1%fromSCglob(i1) + u3%fromSCglob(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%fromSCglob(i1) + t(3)*u2%fromSCglob(i1) - t(2)*u3%fromSCglob(i1) ) * scaleFactor + u_out%fromSCglob(i1) = u1%fromSCglob(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%Lidar) .AND. ALLOCATED(u1%Lidar)) THEN + DO i1 = LBOUND(u_out%Lidar,1),UBOUND(u_out%Lidar,1) + b = (t(3)**2*(u1%Lidar(i1) - u2%Lidar(i1)) + t(2)**2*(-u1%Lidar(i1) + u3%Lidar(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%Lidar(i1) + t(3)*u2%Lidar(i1) - t(2)*u3%Lidar(i1) ) * scaleFactor + u_out%Lidar(i1) = u1%Lidar(i1) + b + c * t_out END DO END IF ! check if allocated END SUBROUTINE SrvD_Input_ExtrapInterp2 @@ -8048,14 +12107,40 @@ SUBROUTINE SrvD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMs y_out%TBDrCon(i1) = y1%TBDrCon(i1) + b * ScaleFactor END DO END IF ! check if allocated - CALL TMD_Output_ExtrapInterp1( y1%NTMD, y2%NTMD, tin, y_out%NTMD, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%BStC) .AND. ALLOCATED(y1%BStC)) THEN + DO i1 = LBOUND(y_out%BStC,1),UBOUND(y_out%BStC,1) + CALL StC_Output_ExtrapInterp1( y1%BStC(i1), y2%BStC(i1), tin, y_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL TMD_Output_ExtrapInterp1( y1%TTMD, y2%TTMD, tin, y_out%TTMD, tin_out, ErrStat2, ErrMsg2 ) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%NStC) .AND. ALLOCATED(y1%NStC)) THEN + DO i1 = LBOUND(y_out%NStC,1),UBOUND(y_out%NStC,1) + CALL StC_Output_ExtrapInterp1( y1%NStC(i1), y2%NStC(i1), tin, y_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%TStC) .AND. ALLOCATED(y1%TStC)) THEN + DO i1 = LBOUND(y_out%TStC,1),UBOUND(y_out%TStC,1) + CALL StC_Output_ExtrapInterp1( y1%TStC(i1), y2%TStC(i1), tin, y_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%SStC) .AND. ALLOCATED(y1%SStC)) THEN + DO i1 = LBOUND(y_out%SStC,1),UBOUND(y_out%SStC,1) + CALL StC_Output_ExtrapInterp1( y1%SStC(i1), y2%SStC(i1), tin, y_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(y_out%SuperController) .AND. ALLOCATED(y1%SuperController)) THEN - DO i1 = LBOUND(y_out%SuperController,1),UBOUND(y_out%SuperController,1) - b = -(y1%SuperController(i1) - y2%SuperController(i1)) - y_out%SuperController(i1) = y1%SuperController(i1) + b * ScaleFactor + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%toSC) .AND. ALLOCATED(y1%toSC)) THEN + DO i1 = LBOUND(y_out%toSC,1),UBOUND(y_out%toSC,1) + b = -(y1%toSC(i1) - y2%toSC(i1)) + y_out%toSC(i1) = y1%toSC(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN + DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) + b = -(y1%Lidar(i1) - y2%Lidar(i1)) + y_out%Lidar(i1) = y1%Lidar(i1) + b * ScaleFactor END DO END IF ! check if allocated END SUBROUTINE SrvD_Output_ExtrapInterp1 @@ -8153,15 +12238,42 @@ SUBROUTINE SrvD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, E y_out%TBDrCon(i1) = y1%TBDrCon(i1) + b + c * t_out END DO END IF ! check if allocated - CALL TMD_Output_ExtrapInterp2( y1%NTMD, y2%NTMD, y3%NTMD, tin, y_out%NTMD, tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%BStC) .AND. ALLOCATED(y1%BStC)) THEN + DO i1 = LBOUND(y_out%BStC,1),UBOUND(y_out%BStC,1) + CALL StC_Output_ExtrapInterp2( y1%BStC(i1), y2%BStC(i1), y3%BStC(i1), tin, y_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - CALL TMD_Output_ExtrapInterp2( y1%TTMD, y2%TTMD, y3%TTMD, tin, y_out%TTMD, tin_out, ErrStat2, ErrMsg2 ) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%NStC) .AND. ALLOCATED(y1%NStC)) THEN + DO i1 = LBOUND(y_out%NStC,1),UBOUND(y_out%NStC,1) + CALL StC_Output_ExtrapInterp2( y1%NStC(i1), y2%NStC(i1), y3%NStC(i1), tin, y_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%TStC) .AND. ALLOCATED(y1%TStC)) THEN + DO i1 = LBOUND(y_out%TStC,1),UBOUND(y_out%TStC,1) + CALL StC_Output_ExtrapInterp2( y1%TStC(i1), y2%TStC(i1), y3%TStC(i1), tin, y_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%SStC) .AND. ALLOCATED(y1%SStC)) THEN + DO i1 = LBOUND(y_out%SStC,1),UBOUND(y_out%SStC,1) + CALL StC_Output_ExtrapInterp2( y1%SStC(i1), y2%SStC(i1), y3%SStC(i1), tin, y_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) -IF (ALLOCATED(y_out%SuperController) .AND. ALLOCATED(y1%SuperController)) THEN - DO i1 = LBOUND(y_out%SuperController,1),UBOUND(y_out%SuperController,1) - b = (t(3)**2*(y1%SuperController(i1) - y2%SuperController(i1)) + t(2)**2*(-y1%SuperController(i1) + y3%SuperController(i1)))* scaleFactor - c = ( (t(2)-t(3))*y1%SuperController(i1) + t(3)*y2%SuperController(i1) - t(2)*y3%SuperController(i1) ) * scaleFactor - y_out%SuperController(i1) = y1%SuperController(i1) + b + c * t_out + ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%toSC) .AND. ALLOCATED(y1%toSC)) THEN + DO i1 = LBOUND(y_out%toSC,1),UBOUND(y_out%toSC,1) + b = (t(3)**2*(y1%toSC(i1) - y2%toSC(i1)) + t(2)**2*(-y1%toSC(i1) + y3%toSC(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%toSC(i1) + t(3)*y2%toSC(i1) - t(2)*y3%toSC(i1) ) * scaleFactor + y_out%toSC(i1) = y1%toSC(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN + DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) + b = (t(3)**2*(y1%Lidar(i1) - y2%Lidar(i1)) + t(2)**2*(-y1%Lidar(i1) + y3%Lidar(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%Lidar(i1) + t(3)*y2%Lidar(i1) - t(2)*y3%Lidar(i1) ) * scaleFactor + y_out%Lidar(i1) = y1%Lidar(i1) + b + c * t_out END DO END IF ! check if allocated END SUBROUTINE SrvD_Output_ExtrapInterp2 diff --git a/modules/servodyn/src/StrucCtrl.f90 b/modules/servodyn/src/StrucCtrl.f90 new file mode 100644 index 0000000000..cbcc7d4722 --- /dev/null +++ b/modules/servodyn/src/StrucCtrl.f90 @@ -0,0 +1,2208 @@ +!********************************************************************************************************************************** +! WLaCava (WGL), Matt Lackner (MAL), Meghan Glade (MEG), and Semyung Park (SP) +! Tuned Mass Damper Module +!********************************************************************************************************************************** +MODULE StrucCtrl + + USE StrucCtrl_Types + USE NWTC_Library + + IMPLICIT NONE + + PRIVATE + + + TYPE(ProgDesc), PARAMETER :: StC_Ver = ProgDesc( 'StrucCtrl', '', '' ) + + + + + ! ..... Public Subroutines ................................................................................................... + + PUBLIC :: StC_Init ! Initialization routine + PUBLIC :: StC_End ! Ending routine (includes clean up) + + PUBLIC :: StC_UpdateStates ! Loose coupling routine for solving for constraint states, integrating + ! continuous states, and updating discrete states + PUBLIC :: StC_CalcOutput ! Routine for computing outputs + + ! PUBLIC :: StC_CalcConstrStateResidual ! Tight coupling routine for returning the constraint state residual + PUBLIC :: StC_CalcContStateDeriv ! Tight coupling routine for computing derivatives of continuous states + + !PUBLIC :: StC_UpdateDiscState ! Tight coupling routine for updating discrete states + + !PUBLIC :: StC_JacobianPInput ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- + ! ! (Xd), and constraint-state (Z) equations all with respect to the inputs (u) + !PUBLIC :: StC_JacobianPContState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- + ! ! (Xd), and constraint-state (Z) equations all with respect to the continuous + ! ! states (x) + !PUBLIC :: StC_JacobianPDiscState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- + ! ! (Xd), and constraint-state (Z) equations all with respect to the discrete + ! ! states (xd) + !PUBLIC :: StC_JacobianPConstrState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- + ! (Xd), and constraint-state (Z) equations all with respect to the constraint + ! states (z) + + + INTEGER(IntKi), PRIVATE, PARAMETER :: ControlMode_NONE = 0 !< The (StC-universal) control code for not using a particular type of control + + INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Indept = 1 !< independent DOFs + INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Omni = 2 !< omni-directional + INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_TLCD = 3 !< tuned liquid column dampers !MEG & SP + INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Prescribed = 4 !< prescribed force series + + INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Semi = 1 !< semi-active control + INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Active = 2 !< active control + + INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_vel = 1 !< 1: velocity-based ground hook control; + INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_invVel = 2 !< 2: Inverse velocity-based ground hook control + INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_disp = 3 !< 3: displacement-based ground hook control + INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_Ph_FF = 4 !< 4: Phase difference Algorithm with Friction Force + INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_Ph_DF = 5 !< 5: Phase difference Algorithm with Damping Force + + integer(IntKi), private, parameter :: PRESCRIBED_FORCE_GLOBAL = 1_IntKi !< Prescribed forces are in global coords + integer(IntKi), private, parameter :: PRESCRIBED_FORCE_LOCAL = 2_IntKi !< Prescribed forces are in local coords + +CONTAINS +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the start of the simulation to perform initialization steps. +!! The parameters are set here and not changed during the simulation. +!! The initial states and initial guess for the input are defined. +SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(StC_InitInputType), INTENT(INOUT) :: InitInp !< Input data for initialization routine. + TYPE(StC_InputType), INTENT( OUT) :: u !< An initial guess for the input; input mesh must be defined + TYPE(StC_ParameterType), INTENT( OUT) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT( OUT) :: x !< Initial continuous states + TYPE(StC_DiscreteStateType), INTENT( OUT) :: xd !< Initial discrete states + TYPE(StC_ConstraintStateType), INTENT( OUT) :: z !< Initial guess of the constraint states + TYPE(StC_OtherStateType), INTENT( OUT) :: OtherState !< Initial other states + TYPE(StC_OutputType), INTENT(INOUT) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + TYPE(StC_MiscVarType), INTENT( OUT) :: m !< Misc (optimization) variables + REAL(DbKi), INTENT(INOUT) :: Interval !< Coupling interval in seconds: the rate that + !! (1) StC_UpdateStates() is called in loose coupling & + !! (2) StC_UpdateDiscState() is called in tight coupling. + !! Input is the suggested time from the glue code; + !! Output is the actual coupling interval that will be used + !! by the glue code. + TYPE(StC_InitOutputType), INTENT( OUT) :: InitOut !< Output for initialization routine + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + + ! Local variables + INTEGER(IntKi) :: NumOuts + TYPE(StC_InputFile) :: InputFileData ! Data stored in the module's input file + INTEGER(IntKi) :: i_pt ! Generic counter for mesh point + REAL(ReKi), allocatable, dimension(:,:) :: PositionP + REAL(ReKi), allocatable, dimension(:,:) :: PositionGlobal + REAL(R8Ki), allocatable, dimension(:,:,:) :: OrientationP + + type(FileInfoType) :: FileInfo_In !< The derived type for holding the full input file for parsing -- we may pass this in the future + type(FileInfoType) :: FileInfo_In_PrescribeFrc !< The derived type for holding the prescribed forces input file for parsing -- we may pass this in the future + character(1024) :: PriPath !< Primary path + integer(IntKi) :: UnEcho + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message + + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Init' + + ! Initialize ErrStat + + ErrStat = ErrID_None + ErrMsg = '' + NumOuts = 0 + UnEcho = -1 ! will be > 0 if echo file is opened + + InitOut%dummyInitOut = 0.0_SiKi ! initialize this so compiler doesn't warn about un-set intent(out) variables + + ! Initialize the NWTC Subroutine Library + CALL NWTC_Init( EchoLibVer=.FALSE. ) + + ! Display the module information + CALL DispNVD( StC_Ver ) + !............................................................................................ + ! Read the input file and validate the data + !............................................................................................ + + CALL GetPath( InitInp%InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. + + if (InitInp%UseInputFile) then + ! Read the entire input file, minus any comment lines, into the FileInfo_In + ! data structure in memory for further processing. + call ProcessComFile( InitInp%InputFile, FileInfo_In, ErrStat2, ErrMsg2 ) + else + ! put passed string info into the FileInfo_In -- FileInfo structure + call NWTC_Library_CopyFileInfoType( InitInp%PassedPrimaryInputData, FileInfo_In, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + endif + if (Failed()) return; + + ! For diagnostic purposes, the following can be used to display the contents + ! of the FileInfo_In data structure. + !call Print_FileInfo_Struct( CU, FileInfo_In ) ! CU is the screen -- different number on different systems. + + ! Parse the FileInfo_In structure of data from the inputfile into the InitInp%InputFile structure + CALL StC_ParseInputFileInfo( PriPath, InitInp%InputFile, TRIM(InitInp%RootName), FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! Using the InputFileData structure, check that it makes sense + CALL StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! read in the prescribed forces file + if ( InputFileData%StC_DOF_MODE == DOFMode_Prescribed ) then + if (InitInp%UseInputFile_PrescribeFrc) then + ! Read the entire input file, minus any comment lines, into the FileInfo_In + ! data structure in memory for further processing. + call ProcessComFile( InputFileData%PrescribedForcesFile, FileInfo_In_PrescribeFrc, ErrStat2, ErrMsg2 ) + else + ! put passed string info into the FileInfo_In -- FileInfo structure + call NWTC_Library_CopyFileInfoType( InitInp%PassedPrescribeFrcData, FileInfo_In_PrescribeFrc, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + endif + if (Failed()) return; + ! For diagnostic purposes, the following can be used to display the contents + ! of the FileInfo_In data structure. + !call Print_FileInfo_Struct( CU, FileInfo_In_PrescribeFrc ) ! CU is the screen -- different number on different systems. + ! Parse the FileInfo_In_PrescribeFrc structure of data from the inputfile into the InitInp%InputFile structure + CALL StC_ParseTimeSeriesFileInfo( InputFileData%PrescribedForcesFile, FileInfo_In_PrescribeFrc, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) + if (Failed()) return; + endif + + !............................................................................................ + ! Define parameters here: + !............................................................................................ + CALL StC_SetParameters( InputFileData, InitInp, p, Interval, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + !............................................................................................ + ! Define initial system states here: + !............................................................................................ + + xd%DummyDiscState = 0 + z%DummyConstrState = 0 + + ! Initialize other states here: + OtherState%DummyOtherState = 0 + + call Init_Misc( p, m, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + + ! Allocate continuous states (x) + call AllocAry(x%StC_x, 6, p%NumMeshPts, 'x%StC_x', ErrStat2,ErrMsg2) + if (Failed()) return; + + ! Define initial guess for the system states here: + do i_pt=1,p%NumMeshPts + x%StC_x(1,i_pt) = InputFileData%StC_X_DSP + x%StC_x(2,i_pt) = 0 + x%StC_x(3,i_pt) = InputFileData%StC_Y_DSP + x%StC_x(4,i_pt) = 0 + x%StC_x(5,i_pt) = InputFileData%StC_Z_DSP + x%StC_x(6,i_pt) = 0 + enddo + + + ! set positions and orientations for tuned mass dampers's + call AllocAry(PositionP, 3, p%NumMeshPts, 'PositionP', ErrStat2,ErrMsg2); if (Failed()) return; + call AllocAry(PositionGlobal, 3, p%NumMeshPts, 'PositionGlobal', ErrStat2,ErrMsg2); if (Failed()) return; + call AllocAry(OrientationP, 3, 3, p%NumMeshPts, 'OrientationP', ErrStat2,ErrMsg2); if (Failed()) return; + + ! Set the initial positions and orietantions for each point + do i_pt = 1,p%NumMeshPts + PositionP(:,i_pt) = (/ InputFileData%StC_P_X, InputFileData%StC_P_Y, InputFileData%StC_P_Z /) + OrientationP(:,:,i_pt) = InitInp%InitOrientation(:,:,i_pt) + PositionGlobal(:,i_pt) = InitInp%InitPosition(:,i_pt) + real( matmul(PositionP(:,i_pt),OrientationP(:,:,i_pt)), ReKi) + enddo + + ! Define system output initializations (set up mesh) here: + ! Create the input and output meshes associated with lumped loads + + ALLOCATE (u%Mesh(p%NumMeshPts), STAT=ErrStat2) + IF (ErrStat2/=0) THEN + CALL SetErrStat(ErrID_Fatal,"Error allocating u%Mesh.",ErrStat,ErrMsg,RoutineName) + CALL Cleanup() + RETURN + END IF + ALLOCATE (y%Mesh(p%NumMeshPts), STAT=ErrStat2) + IF (ErrStat2/=0) THEN + CALL SetErrStat(ErrID_Fatal,"Error allocating y%Mesh.",ErrStat,ErrMsg,RoutineName) + CALL Cleanup() + RETURN + END IF + + ! Create Mesh(i_pt) + DO i_pt = 1,p%NumMeshPts + + CALL MeshCreate( BlankMesh = u%Mesh(i_pt) & + ,IOS = COMPONENT_INPUT & + ,Nnodes = 1 & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,TranslationDisp = .TRUE. & + ,Orientation = .TRUE. & + ,TranslationVel = .TRUE. & + ,RotationVel = .TRUE. & + ,TranslationAcc = .TRUE. & + ,RotationAcc = .TRUE.) + if (Failed()) return; + + + ! Create the node on the mesh + ! make position node at point P (rest position of tuned mass dampers, somewhere above the yaw bearing) + CALL MeshPositionNode ( u%Mesh(i_pt),1, PositionGlobal(:,i_pt), ErrStat2, ErrMsg2, OrientationP(:,:,i_pt) ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + + ! Create the mesh element + CALL MeshConstructElement ( u%Mesh(i_pt) & + , ELEMENT_POINT & + , ErrStat2 & + , ErrMsg2 & + , 1 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + CALL MeshCommit ( u%Mesh(i_pt) & + , ErrStat2 & + , ErrMsg2 ) + if (Failed()) return; + + CALL MeshCopy ( SrcMesh = u%Mesh(i_pt) & + ,DestMesh = y%Mesh(i_pt) & + ,CtrlCode = MESH_SIBLING & + ,IOS = COMPONENT_OUTPUT & + ,ErrStat = ErrStat2 & + ,ErrMess = ErrMsg2 & + ,Force = .TRUE. & + ,Moment = .TRUE. ) + + if (Failed()) return; + + u%Mesh(i_pt)%RemapFlag = .TRUE. + y%Mesh(i_pt)%RemapFlag = .TRUE. + enddo + + + !bjj: removed for now; output handled in ServoDyn + !IF (NumOuts > 0) THEN + ! ALLOCATE( y%WriteOutput(NumOuts), STAT = ErrStat ) + ! IF ( ErrStat/= 0 ) THEN + ! CALL SetErrStat(ErrID_Fatal,'Error allocating output array.',ErrStat,ErrMsg,'StC_Init') + ! CALL Cleanup() + ! RETURN + ! END IF + ! y%WriteOutput = 0 + ! + ! ! Define initialization-routine output here: + ! ALLOCATE( InitOut%WriteOutputHdr(NumOuts), InitOut%WriteOutputUnt(NumOuts), STAT = ErrStat ) + ! IF ( ErrStat/= 0 ) THEN + ! CALL SetErrStat(ErrID_Fatal,'Error allocating output header and units arrays.',ErrStat,ErrMsg,'StC_Init') + ! CALL Cleanup() + ! RETURN + ! END IF + ! + ! DO i=1,NumOuts + ! InitOut%WriteOutputHdr(i) = "Heading"//trim(num2lstr(i)) + ! InitOut%WriteOutputUnt(i) = "(-)" + ! END DO + ! + !END IF + + !bjj: need to initialize headers/units + + ! Set the interval value to tell ServoDyn we are using (we don't actually change this in StC) + Interval = p%DT + + call cleanup() +!................................ +CONTAINS + subroutine Init_Misc( p, m, ErrStat, ErrMsg ) + type(StC_ParameterType),intent(in ) :: p !< Parameters + type(StC_MiscVarType), intent(inout) :: m !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat ! The error identifier (ErrStat) + character(ErrMsgLen), intent( out) :: ErrMsg ! The error message (ErrMsg) + + ! Accelerations, velocities, and resultant forces -- used in all tuned mass calcs (so we don't reallocate all the time) + ! Note: these variables had been allocated multiple places before and sometimes passed between routines. So + ! they have been moved into MiscVars so that we don so we don't reallocate all the time + call AllocAry(m%a_G , 3, p%NumMeshPts,'a_G' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%rdisp_P, 3, p%NumMeshPts,'rdisp_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%rdot_P , 3, p%NumMeshPts,'rdot_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%rddot_P, 3, p%NumMeshPts,'rddot_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%omega_P, 3, p%NumMeshPts,'omega_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%alpha_P, 3, p%NumMeshPts,'alpha_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%Acc , 3, p%NumMeshPts,'Acc' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; ! Summed accelerations + ! Note: the following two were added to misc so that we have the option of outputting the forces and moments + ! from each tuned mass system at some later point + call AllocAry(m%F_P , 3, p%NumMeshPts,'F_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + call AllocAry(m%M_P , 3, p%NumMeshPts,'M_P' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; + + ! External and stop forces + ! Note: these variables had been allocated multiple places before and sometimes passed between routines. So + ! they have been moved into MiscVars so that we don so we don't reallocate all the time. + call AllocAry(m%F_stop , 3, p%NumMeshPts, 'F_stop' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_stop = 0.0_ReKi + call AllocAry(m%F_ext , 3, p%NumMeshPts, 'F_ext' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_ext = 0.0_ReKi + call AllocAry(m%F_fr , 3, p%NumMeshPts, 'F_fr' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_fr = 0.0_ReKi + call AllocAry(m%C_ctrl , 3, p%NumMeshPts, 'C_ctrl' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%C_ctrl = 0.0_ReKi + call AllocAry(m%C_Brake, 3, p%NumMeshPts, 'C_Brake', ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%C_Brake = 0.0_ReKi + call AllocAry(m%F_table, 3, p%NumMeshPts, 'F_table', ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_table = 0.0_ReKi + call AllocAry(m%F_k , 3, p%NumMeshPts, 'F_k' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_k = 0.0_ReKi + + ! indexing + m%PrescribedInterpIdx = 0_IntKi ! index tracker for PrescribedForce option + + end subroutine Init_Misc + !......................................... + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'StC_Init' ) + Failed = ErrStat >= AbortErrLev + if (Failed) call cleanup() + end function Failed + !......................................... + SUBROUTINE cleanup() + if (UnEcho > 0) close(UnEcho) ! Close echo file + if (allocated(PositionP )) deallocate(PositionP ) + if (allocated(PositionGlobal)) deallocate(PositionGlobal) + if (allocated(OrientationP )) deallocate(OrientationP ) + CALL StC_DestroyInputFile( InputFileData, ErrStat2, ErrMsg2) ! Ignore warnings here. + END SUBROUTINE cleanup +!......................................... +END SUBROUTINE StC_Init +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the end of the simulation. +SUBROUTINE StC_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(StC_InputType), INTENT(INOUT) :: u !< System inputs + TYPE(StC_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states + TYPE(StC_DiscreteStateType), INTENT(INOUT) :: xd !< Discrete states + TYPE(StC_ConstraintStateType), INTENT(INOUT) :: z !< Constraint states + TYPE(StC_OtherStateType), INTENT(INOUT) :: OtherState !< Other states + TYPE(StC_OutputType), INTENT(INOUT) :: y !< System outputs + TYPE(StC_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + + ! Initialize ErrStat + + ErrStat = ErrID_None + ErrMsg = "" + + + ! Place any last minute operations or calculations here: + + + + ! Write the StrucCtrl-level output file data if the user requested module-level output + ! and the current time has advanced since the last stored time step. + + + + ! Close files here: + + + ! Destroy the input data: + + CALL StC_DestroyInput( u, ErrStat, ErrMsg ) + + + ! Destroy the parameter data: + + CALL StC_DestroyParam( p, ErrStat, ErrMsg ) + + + ! Destroy the state data: + + CALL StC_DestroyContState( x, ErrStat, ErrMsg ) + CALL StC_DestroyDiscState( xd, ErrStat, ErrMsg ) + CALL StC_DestroyConstrState( z, ErrStat, ErrMsg ) + CALL StC_DestroyOtherState( OtherState, ErrStat, ErrMsg ) + + CALL StC_DestroyMisc( m, ErrStat, ErrMsg ) + + ! Destroy the output data: + + CALL StC_DestroyOutput( y, ErrStat, ErrMsg ) + +END SUBROUTINE StC_End +!---------------------------------------------------------------------------------------------------------------------------------- +!> Loose coupling routine for solving constraint states, integrating continuous states, and updating discrete states. +!! Continuous, constraint, and discrete states are updated to values at t + Interval. +SUBROUTINE StC_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + INTEGER(IntKi), INTENT(IN ) :: n !< Current step of the simulation: t = n*Interval + TYPE(StC_InputType), INTENT(INOUT) :: Inputs(:) !< Inputs at InputTimes + REAL(DbKi), INTENT(IN ) :: InputTimes(:) !< Times in seconds associated with Inputs + TYPE(StC_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: x !< Input: Continuous states at t; + !! Output: Continuous states at t + Interval + TYPE(StC_DiscreteStateType), INTENT(INOUT) :: xd !< Input: Discrete states at t; + !! Output: Discrete states at t + Interval + TYPE(StC_ConstraintStateType), INTENT(INOUT) :: z !< Input: Constraint states at t; + !! Output: Constraint states at t + Interval + TYPE(StC_OtherStateType), INTENT(INOUT) :: OtherState !< Input: Other states at t; + !! Output: Other states at t + Interval + TYPE(StC_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! Local variables + !INTEGER :: I ! Generic loop counter + !TYPE(StC_ContinuousStateType) :: dxdt ! Continuous state derivatives at t + !TYPE(StC_DiscreteStateType) :: xd_t ! Discrete states at t (copy) + !TYPE(StC_ConstraintStateType) :: z_Residual ! Residual of the constraint state functions (Z) + !TYPE(StC_InputType) :: u ! Instantaneous inputs + !INTEGER(IntKi) :: ErrStat2 ! Error status of the operation (secondary error) + !CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None + !INTEGER :: nTime ! number of inputs + + + IF ( p%StC_DOF_MODE /= DOFMode_Prescribed ) THEN + CALL StC_RK4( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) + ENDIF + +END SUBROUTINE StC_UpdateStates +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations: +!! +!! Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). +!! Define constants k1, k2, k3, and k4 as +!! k1 = dt * f(t , x_t ) +!! k2 = dt * f(t + dt/2 , x_t + k1/2 ) +!! k3 = dt * f(t + dt/2 , x_t + k2/2 ), and +!! k4 = dt * f(t + dt , x_t + k3 ). +!! Then the continuous states at t = t + dt are +!! x_(t+dt) = x_t + k1/6 + k2/3 + k3/3 + k4/6 + O(dt^5) +!! +!! For details, see: +!! Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Runge-Kutta Method" and "Adaptive Step Size Control for +!! Runge-Kutta." Sections 16.1 and 16.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: +!! Cambridge University Press, pp. 704-716, 1992. +SUBROUTINE StC_RK4( t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + INTEGER(IntKi), INTENT(IN ) :: n !< time step number + TYPE(StC_InputType), INTENT(INOUT) :: u(:) !< Inputs at t (out only for mesh record-keeping in ExtrapInterp routine) + REAL(DbKi), INTENT(IN ) :: utimes(:) !< times of input + TYPE(StC_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states at t on input at t + dt on output + TYPE(StC_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(StC_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t (possibly a guess) + TYPE(StC_OtherStateType), INTENT(INOUT) :: OtherState !< Other states at t + TYPE(StC_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables + + TYPE(StC_ContinuousStateType) :: xdot ! time derivatives of continuous states + TYPE(StC_ContinuousStateType) :: k1 ! RK4 constant; see above + TYPE(StC_ContinuousStateType) :: k2 ! RK4 constant; see above + TYPE(StC_ContinuousStateType) :: k3 ! RK4 constant; see above + TYPE(StC_ContinuousStateType) :: k4 ! RK4 constant; see above + + TYPE(StC_ContinuousStateType) :: x_tmp ! Holds temporary modification to x + TYPE(StC_InputType) :: u_interp ! interpolated value of inputs + integer(IntKi) :: i_pt ! Generic counter for mesh point + + INTEGER(IntKi) :: ErrStat2 ! local error status + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message (ErrMsg) + + + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + + CALL StC_CopyContState( x, k1, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + CALL StC_CopyContState( x, k2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + CALL StC_CopyContState( x, k3, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + CALL StC_CopyContState( x, k4, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + CALL StC_CopyContState( x, x_tmp, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + CALL StC_CopyInput( u(1), u_interp, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + ! interpolate u to find u_interp = u(t) + CALL StC_Input_ExtrapInterp( u, utimes, u_interp, t, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + ! find xdot at t + CALL StC_CalcContStateDeriv( t, u_interp, p, x, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + do i_pt=1,p%NumMeshPts + k1%StC_x(:,i_pt) = p%dt * xdot%StC_x(:,i_pt) + x_tmp%StC_x(:,i_pt) = x%StC_x(:,i_pt) + 0.5 * k1%StC_x(:,i_pt) + enddo + + + ! interpolate u to find u_interp = u(t + dt/2) + CALL StC_Input_ExtrapInterp(u, utimes, u_interp, t+0.5*p%dt, ErrStat2, ErrMsg2) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + ! find xdot at t + dt/2 + CALL StC_CalcContStateDeriv( t + 0.5*p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + do i_pt=1,p%NumMeshPts + k2%StC_x(:,i_pt) = p%dt * xdot%StC_x(:,i_pt) + x_tmp%StC_x(:,i_pt) = x%StC_x(:,i_pt) + 0.5 * k2%StC_x(:,i_pt) + enddo + + + ! find xdot at t + dt/2 + CALL StC_CalcContStateDeriv( t + 0.5*p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + do i_pt=1,p%NumMeshPts + k3%StC_x(:,i_pt) = p%dt * xdot%StC_x(:,i_pt) + x_tmp%StC_x(:,i_pt) = x%StC_x(:,i_pt) + k3%StC_x(:,i_pt) + enddo + + + ! interpolate u to find u_interp = u(t + dt) + CALL StC_Input_ExtrapInterp(u, utimes, u_interp, t + p%dt, ErrStat2, ErrMsg2) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + ! find xdot at t + dt + CALL StC_CalcContStateDeriv( t + p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + + do i_pt=1,p%NumMeshPts + k4%StC_x(:,i_pt) = p%dt * xdot%StC_x(:,i_pt) + x%StC_x(:,i_pt) = x%StC_x(:,i_pt) + ( k1%StC_x(:,i_pt) + 2. * k2%StC_x(:,i_pt) + 2. * k3%StC_x(:,i_pt) + k4%StC_x(:,i_pt) ) / 6. + ! x%StC_dxdt = x%StC_dxdt + ( k1%StC_dxdt + 2. * k2%StC_dxdt + 2. * k3%StC_dxdt + k4%StC_dxdt ) / 6. + enddo + + ! clean up local variables: + CALL ExitThisRoutine( ) + +CONTAINS + !............................................................................................................................... + SUBROUTINE ExitThisRoutine() + ! This subroutine destroys all the local variables + !............................................................................................................................... + + ! local variables + INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) + CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) + + + CALL StC_DestroyContState( xdot, ErrStat3, ErrMsg3 ) + CALL StC_DestroyContState( k1, ErrStat3, ErrMsg3 ) + CALL StC_DestroyContState( k2, ErrStat3, ErrMsg3 ) + CALL StC_DestroyContState( k3, ErrStat3, ErrMsg3 ) + CALL StC_DestroyContState( k4, ErrStat3, ErrMsg3 ) + CALL StC_DestroyContState( x_tmp, ErrStat3, ErrMsg3 ) + + CALL StC_DestroyInput( u_interp, ErrStat3, ErrMsg3 ) + + END SUBROUTINE ExitThisRoutine + !............................................................................................................................... + SUBROUTINE CheckError(ErrID,Msg) + ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev + !............................................................................................................................... + + ! Passed arguments + INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) + CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) + + ! local variables + INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) + CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) + + !............................................................................................................................ + ! Set error status/message; + !............................................................................................................................ + + IF ( ErrID /= ErrID_None ) THEN + + IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine + ErrMsg = TRIM(ErrMsg)//'StC_RK4:'//TRIM(Msg) + ErrStat = MAX(ErrStat,ErrID) + + !......................................................................................................................... + ! Clean up if we're going to return on error: close files, deallocate local arrays + !......................................................................................................................... + + IF ( ErrStat >= AbortErrLev ) CALL ExitThisRoutine( ) + + + END IF + + END SUBROUTINE CheckError + +END SUBROUTINE StC_RK4 +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing outputs, used in both loose and tight coupling. +SUBROUTINE StC_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds + TYPE(StC_InputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(StC_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(StC_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time + TYPE(StC_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time + TYPE(StC_OtherStateType), INTENT(IN ) :: OtherState !< Other states at Time + TYPE(StC_OutputType), INTENT(INOUT) :: y !< Outputs computed at Time (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + TYPE(StC_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables for force calcualtions in X-DOF, Y-DOF, and XY-DOF + real(ReKi), dimension(3) :: F_X_P + real(ReKi), dimension(3) :: F_Y_P + real(ReKi), dimension(3) :: F_Z_P + real(ReKi), dimension(3) :: F_XY_P + + ! NOTE: the following two sets of variables could likely be combined into arrays + ! that could be more easily used with array functions like MATMUL, cross_product, + ! dot_product etc. + ! Fore-aft TLCD reactionary forces !MEG & SP + Real(ReKi) :: F_x_tlcd_WR_N + Real(ReKi) :: F_y_tlcd_WR_N + Real(ReKi) :: F_x_tlcd_WL_N + Real(ReKi) :: F_y_tlcd_WL_N + Real(ReKi) :: F_y_tlcd_WH_N + Real(ReKi) :: F_z_tlcd_WH_N + + ! Side-side orthogonal TLCD reactionary forces !MEG & SP + Real(ReKi) :: F_x_otlcd_WB_N + Real(ReKi) :: F_y_otlcd_WB_N + Real(ReKi) :: F_x_otlcd_WF_N + Real(ReKi) :: F_y_otlcd_WF_N + Real(ReKi) :: F_x_otlcd_WH_N + Real(ReKi) :: F_z_otlcd_WH_N + + TYPE(StC_ContinuousStateType) :: dxdt ! first time derivative of continuous states + + integer(IntKi) :: i,j !< generic counter + integer(IntKi) :: i_pt ! Generic counter for mesh point + + ! Local error handling + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + + + ErrStat = ErrID_None + ErrMsg = "" + + + ! Compute accelerations and velocities in local coordinates + do i_pt=1,p%NumMeshPts + m%a_G(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),p%Gravity) + m%rdisp_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationDisp(:,1)) ! for ground StC_GroundHookDamp + m%rdot_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationVel(:,1)) ! for ground StC_GroundHookDamp + m%rddot_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationAcc(:,1)) + m%omega_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%RotationVel(:,1)) + m%alpha_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%RotationAcc(:,1)) + enddo + + + ! calculate the derivative, only to get updated values of m, which are used in the equations below + CALL StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, ErrStat2, ErrMsg2 ); if (Failed()) return; + + + IF (p%StC_DOF_MODE == ControlMode_None) THEN + do i_pt=1,p%NumMeshPts + y%Mesh(i_pt)%Force(:,1) = 0.0_ReKi + y%Mesh(i_pt)%Moment(:,1) = 0.0_ReKi + m%F_P(1:3,i_pt) = 0.0_ReKi + m%M_P(1:3,i_pt) = 0.0_ReKi + enddo + ELSEIF (p%StC_DOF_MODE == DOFMode_Indept) THEN + + ! StrucCtrl external forces of dependent degrees: + do i_pt=1,p%NumMeshPts + F_X_P(2) = - p%M_X * ( m%a_G(2,i_pt) - m%rddot_P(2,i_pt) - (m%alpha_P(3,i_pt) + m%omega_P(1,i_pt)*m%omega_P(2,i_pt))*x%StC_x(1,i_pt) - 2*m%omega_P(3,i_pt)*x%StC_x(2,i_pt) ) + F_X_P(3) = - p%M_X * ( m%a_G(3,i_pt) - m%rddot_P(3,i_pt) + (m%alpha_P(2,i_pt) - m%omega_P(1,i_pt)*m%omega_P(3,i_pt))*x%StC_x(1,i_pt) + 2*m%omega_P(2,i_pt)*x%StC_x(2,i_pt) ) + + F_Y_P(1) = - p%M_Y * ( m%a_G(1,i_pt) - m%rddot_P(1,i_pt) + (m%alpha_P(3,i_pt) - m%omega_P(1,i_pt)*m%omega_P(2,i_pt))*x%StC_x(3,i_pt) + 2*m%omega_P(3,i_pt)*x%StC_x(4,i_pt) ) + F_Y_P(3) = - p%M_Y * ( m%a_G(3,i_pt) - m%rddot_P(3,i_pt) - (m%alpha_P(1,i_pt) + m%omega_P(2,i_pt)*m%omega_P(3,i_pt))*x%StC_x(3,i_pt) - 2*m%omega_P(1,i_pt)*x%StC_x(4,i_pt) ) + + F_Z_P(1) = - p%M_Z * ( m%a_G(1,i_pt) - m%rddot_P(1,i_pt) - (m%alpha_P(2,i_pt) + m%omega_P(1,i_pt)*m%omega_P(3,i_pt))*x%StC_x(5,i_pt) - 2*m%omega_P(2,i_pt)*x%StC_x(6,i_pt) ) + F_Z_P(2) = - p%M_Z * ( m%a_G(2,i_pt) - m%rddot_P(2,i_pt) + (m%alpha_P(1,i_pt) - m%omega_P(2,i_pt)*m%omega_P(3,i_pt))*x%StC_x(5,i_pt) + 2*m%omega_P(1,i_pt)*x%StC_x(6,i_pt) ) + + ! inertial contributions from mass of tuned mass dampers and acceleration of point + ! forces and moments in local coordinates + m%F_P(1,i_pt) = p%K_X * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_Y_P(1) - F_Z_P(1) + m%F_table(1,i_pt) + m%F_P(2,i_pt) = p%K_Y * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_X_P(2) - F_Z_P(2) + m%F_table(2,i_pt) + m%F_P(3,i_pt) = p%K_Z * x%StC_x(5,i_pt) + m%C_ctrl(3,i_pt) * x%StC_x(6,i_pt) + m%C_Brake(3,i_pt) * x%StC_x(6,i_pt) - m%F_stop(3,i_pt) - m%F_ext(3,i_pt) - m%F_fr(3,i_pt) - F_X_P(3) - F_Y_P(3) + m%F_table(3,i_pt) + + m%M_P(1,i_pt) = - F_Y_P(3) * x%StC_x(3,i_pt) + F_Z_P(2) * x%StC_x(5,i_pt) + m%M_P(2,i_pt) = F_X_P(3) * x%StC_x(1,i_pt) - F_Z_P(1) * x%StC_x(5,i_pt) + m%M_P(3,i_pt) = - F_X_P(2) * x%StC_x(1,i_pt) + F_Y_P(1) * x%StC_x(3,i_pt) ! NOTE signs match document, but are changed from prior value + + ! forces and moments in global coordinates + y%Mesh(i_pt)%Force(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)),m%F_P(1:3,i_pt)),ReKi) + y%Mesh(i_pt)%Moment(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)),m%M_P(1:3,i_pt)),ReKi) + enddo + + ELSE IF (p%StC_DOF_MODE == DOFMode_Omni) THEN + + !note: m%F_k is computed earlier in StC_CalcContStateDeriv + + ! StrucCtrl external forces of dependent degrees: + do i_pt=1,p%NumMeshPts + F_XY_P(1) = 0 + F_XY_P(2) = 0 + F_XY_P(3) = - p%M_XY * ( m%a_G(3,i_pt) - m%rddot_P(3,i_pt) & + - (m%alpha_P(1,i_pt) + m%omega_P(2,i_pt)*m%omega_P(3,i_pt))*x%StC_x(3,i_pt) & + + (m%alpha_P(2,i_pt) - m%omega_P(1,i_pt)*m%omega_P(3,i_pt))*x%StC_x(1,i_pt) & + - 2*m%omega_P(1,i_pt)*x%StC_x(4,i_pt) & + + 2*m%omega_P(2,i_pt)*x%StC_x(2,i_pt) ) + + ! inertial contributions from mass of tuned mass dampers and acceleration of point + ! forces and moments in local coordinates + m%F_P(1,i_pt) = p%K_X * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_XY_P(1) + m%F_table(1,i_pt)*(m%F_k(1,i_pt)) + m%F_P(2,i_pt) = p%K_Y * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_XY_P(2) + m%F_table(2,i_pt)*(m%F_k(2,i_pt)) + m%F_P(3,i_pt) = - F_XY_P(3) + + m%M_P(1,i_pt) = - F_XY_P(3) * x%StC_x(3,i_pt) + m%M_P(2,i_pt) = F_XY_P(3) * x%StC_x(1,i_pt) + m%M_P(3,i_pt) = - F_XY_P(1) * x%StC_x(3,i_pt) + F_XY_P(2) * x%StC_x(1,i_pt) + + ! forces and moments in global coordinates + y%Mesh(i_pt)%Force(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)),m%F_P(1:3,i_pt)),ReKi) + y%Mesh(i_pt)%Moment(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)),m%M_P(1:3,i_pt)),ReKi) + enddo + + ELSE IF (p%StC_DOF_MODE == DOFMode_TLCD) THEN + + do i_pt=1,p%NumMeshPts + !fore-aft TLCD external forces of dependent degrees + F_x_tlcd_WR_N = p%rho_X*p%area_X*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt))*( & + m%rddot_P(1,i_pt) & + +2*m%omega_P(2,i_pt)*x%StC_x(2,i_pt) & + +m%alpha_P(2,i_pt)*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) & + -m%omega_P(2,i_pt)*m%omega_P(2,i_pt)*p%B_X*.5 & + -m%omega_P(3,i_pt)*m%omega_P(3,i_pt)*p%B_X*.5 & + +m%omega_P(3,i_pt)*m%omega_P(1,i_pt)*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) & + -m%a_G(1,i_pt) ) + F_y_tlcd_WR_N = p%rho_X*p%area_X*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt))*( & + m%rddot_P(2,i_pt) & + -2*m%omega_P(1,i_pt)*x%StC_x(2,i_pt) & + +m%alpha_P(3,i_pt)*p%B_X*.5 & + -m%alpha_P(1,i_pt)*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) & + +m%omega_P(3,i_pt)*m%omega_P(2,i_pt)*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) & + +m%omega_P(1,i_pt)*m%omega_P(2,i_pt)*p%B_X*.5 & + -m%a_G(2,i_pt) ) + F_x_tlcd_WL_N = p%rho_X*p%area_X*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt))*( & + m%rddot_P(1,i_pt) & + -2*m%omega_P(2,i_pt)*x%StC_x(2,i_pt) & + +m%alpha_P(2,i_pt)*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) & + +m%omega_P(2,i_pt)*m%omega_P(2,i_pt)*p%B_X*.5 & + +m%omega_P(3,i_pt)*m%omega_P(3,i_pt)*p%B_X*.5 & + +m%omega_P(3,i_pt)*m%omega_P(1,i_pt)*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) & + -m%a_G(1,i_pt) ) + F_y_tlcd_WL_N = p%rho_X*p%area_X*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt))*( & + m%rddot_P(2,i_pt) & + +2*m%omega_P(1,i_pt)*x%StC_x(2,i_pt) & + -m%alpha_P(3,i_pt)*p%B_X*.5 & + -m%alpha_P(1,i_pt)*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) & + +m%omega_P(3,i_pt)*m%omega_P(2,i_pt)*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) & + -m%omega_P(1,i_pt)*m%omega_P(2,i_pt)*p%B_X*.5 & + -m%a_G(2,i_pt) ) + F_y_tlcd_WH_N = p%rho_X*p%area_X/p%area_ratio_X*p%B_X*( & + m%rddot_P(2,i_pt) & + +2*m%omega_P(3,i_pt)*p%area_ratio_X*x%StC_x(2,i_pt) & + -m%a_G(2,i_pt) ) + F_z_tlcd_WH_N = p%rho_X*p%area_X/p%area_ratio_X*p%B_X*( & + m%rddot_P(3,i_pt) & + -2*m%omega_P(2,i_pt)*p%area_ratio_X*x%StC_x(2,i_pt) & + -m%a_G(3,i_pt) ) + + !side-to-side TLCD external forces of dependent degrees + F_x_otlcd_WB_N = p%rho_Y*p%area_Y*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt))*( & + m%rddot_P(1,i_pt) & + +2*m%omega_P(2,i_pt)*x%StC_x(4,i_pt) & + +m%alpha_P(2,i_pt)*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) & + +m%alpha_P(3,i_pt)*p%B_Y/2-m%omega_P(2,i_pt)*m%omega_P(1,i_pt)*p%B_Y/2 & + +m%omega_P(3,i_pt)*m%omega_P(1,i_pt)*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) & + -m%a_G(1,i_pt) ) + F_y_otlcd_WB_N = p%rho_Y*p%area_Y*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt))*( & + m%rddot_P(2,i_pt) & + -2*m%omega_P(1,i_pt)*x%StC_x(4,i_pt) & + -m%alpha_P(1,i_pt)*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) & + +m%omega_P(3,i_pt)*m%omega_P(2,i_pt)*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) & + +m%omega_P(3,i_pt)*m%omega_P(3,i_pt)*p%B_Y/2 & + +m%omega_P(1,i_pt)*m%omega_P(1,i_pt)*p%B_Y/2 & + -m%a_G(2,i_pt) ) + F_x_otlcd_WF_N = p%rho_Y*p%area_Y*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt))*( & + m%rddot_P(1,i_pt) & + -2*m%omega_P(2,i_pt)*x%StC_x(4,i_pt) & + +m%alpha_P(2,i_pt)*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) & + -m%alpha_P(2,i_pt)*p%B_Y/2 & + +m%omega_P(2,i_pt)*m%omega_P(1,i_pt)*p%B_Y/2 & + +m%omega_P(3,i_pt)*m%omega_P(1,i_pt)*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) & + -m%a_G(1,i_pt) ) + F_y_otlcd_WF_N = p%rho_Y*p%area_Y*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt))*( & + m%rddot_P(2,i_pt) & + +2*m%omega_P(1,i_pt)*x%StC_x(4,i_pt) & + -m%alpha_P(1,i_pt)*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) & + +m%omega_P(3,i_pt)*m%omega_P(2,i_pt)*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) & + -m%omega_P(3,i_pt)*m%omega_P(3,i_pt)*p%B_Y/2 & + -m%omega_P(1,i_pt)*m%omega_P(1,i_pt)*p%B_Y/2 & + -m%a_G(2,i_pt) ) + F_x_otlcd_WH_N = p%rho_Y*p%area_Y/p%area_ratio_Y*p%B_Y*( & + m%rddot_P(1,i_pt) & + -2*m%omega_P(3,i_pt)*p%area_ratio_Y*x%StC_x(4,i_pt) & + -m%a_G(1,i_pt) ) + F_z_otlcd_WH_N = p%rho_Y*p%area_Y/p%area_ratio_Y*p%B_Y*( & + m%rddot_P(3,i_pt) & + +2*m%omega_P(1,i_pt)*p%area_ratio_Y*x%StC_x(4,i_pt) & + -m%a_G(3,i_pt) ) + + ! forces and moments in local coordinates (from fore-aft and side-to-side TLCDs) + m%F_P(1,i_pt) = -F_x_tlcd_WR_N - F_x_tlcd_WL_N - p%rho_X*(p%area_X/p%area_ratio_X)*p%B_X*dxdt%StC_x(2,i_pt)*p%area_ratio_X + F_x_otlcd_WB_N + F_x_otlcd_WF_N + F_x_otlcd_WH_N + m%F_P(2,i_pt) = +F_y_tlcd_WR_N + F_y_tlcd_WL_N - p%rho_Y*(p%area_Y/p%area_ratio_Y)*p%B_Y*dxdt%StC_x(4,i_pt)*p%area_ratio_Y + F_y_tlcd_WH_N - F_y_otlcd_WB_N - F_y_otlcd_WF_N + m%F_P(3,i_pt) = -F_z_tlcd_WH_N - F_z_otlcd_WH_N + + m%M_P(1,i_pt) = F_y_tlcd_WR_N*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) + F_y_tlcd_WL_N*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) - F_y_otlcd_WB_N*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) - F_y_otlcd_WF_N*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) + m%M_P(2,i_pt) = -F_x_tlcd_WR_N*((p%L_X-p%B_X)/2+x%StC_x(1,i_pt)) - F_x_tlcd_WL_N*((p%L_X-p%B_X)/2-x%StC_x(1,i_pt)) + F_x_otlcd_WB_N*((p%L_Y-p%B_Y)/2+x%StC_x(3,i_pt)) + F_x_otlcd_WF_N*((p%L_Y-p%B_Y)/2-x%StC_x(3,i_pt)) + m%M_P(3,i_pt) = F_y_tlcd_WR_N*p%B_X*.5 - F_y_tlcd_WL_N*p%B_X*.5 + F_x_otlcd_WB_N*p%B_Y*.5 - F_x_otlcd_WF_N*p%B_Y*.5 + + ! forces and moments in global coordinates + y%Mesh(i_pt)%Force(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)), m%F_P(1:3,i_pt)),ReKi) + y%Mesh(i_pt)%Moment(:,1) = real(matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)), m%M_P(1:3,i_pt)),ReKi) + enddo + ELSEIF ( p%StC_DOF_MODE == DOFMode_Prescribed ) THEN + ! Note that the prescribed force is applied the same to all Mesh pts + ! that are passed into this instance of the StC + do i=1,3 + ! Get interpolated force -- this is not in any particular coordinate system yet + m%F_P(i,:) = InterpStp( real(Time,ReKi), p%StC_PrescribedForce(1,:),p%StC_PrescribedForce(i+1,:),m%PrescribedInterpIdx, size(p%StC_PrescribedForce,2)) + ! Get interpolated moment -- this is not in any particular coordinate system yet + m%M_P(i,:) = InterpStp( real(Time,ReKi), p%StC_PrescribedForce(1,:),p%StC_PrescribedForce(i+4,:),m%PrescribedInterpIdx, size(p%StC_PrescribedForce,2)) + enddo + if (p%PrescribedForcesCoordSys == PRESCRIBED_FORCE_GLOBAL) then + ! Global coords + do i_pt=1,p%NumMeshPts + y%Mesh(i_pt)%Force(1:3,1) = m%F_P(1:3,i_pt) + y%Mesh(i_pt)%Moment(1:3,1) = m%M_P(1:3,i_pt) + enddo + elseif (p%PrescribedForcesCoordSys == PRESCRIBED_FORCE_LOCAL) then + ! local coords + do i_pt=1,p%NumMeshPts + y%Mesh(i_pt)%Force(1:3,1) = matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)), m%F_P(1:3,i_pt)) + y%Mesh(i_pt)%Moment(1:3,1) = matmul(transpose(u%Mesh(i_pt)%Orientation(:,:,1)), m%M_P(1:3,i_pt)) + enddo + endif + END IF + + call CleanUp() + +CONTAINS + subroutine CleanUp() + call StC_DestroyContState(dxdt,ErrStat2,ErrMsg2) !Ignore error status + end subroutine CleanUp + logical function Failed() + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'StC_CalcOutput') + Failed = ErrStat >= AbortErrLev + if (Failed) call CleanUp() + end function Failed +END SUBROUTINE StC_CalcOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Tight coupling routine for computing derivatives of continuous states +SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds + TYPE(StC_InputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(StC_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(StC_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time + TYPE(StC_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time + TYPE(StC_OtherStateType), INTENT(IN ) :: OtherState !< Other states at Time + TYPE(StC_ContinuousStateType), INTENT( OUT) :: dxdt !< Continuous state derivatives at Time + TYPE(StC_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + REAL(ReKi), dimension(3) :: K ! tuned mass damper stiffness + Real(ReKi) :: denom ! denominator for omni-direction factors + integer(IntKi) :: i_pt ! Generic counter for mesh point + + ! Local error handling + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + + + call AllocAry(dxdt%StC_x,6, p%NumMeshPts,'dxdt%StC_x', ErrStat2,ErrMsg2); if (Failed()) return; + + ! compute stop force (m%F_stop) + IF (p%Use_F_TBL) THEN + m%F_stop = 0.0_ReKi + ELSE + CALL StC_CalcStopForce(x,p,m%F_stop) + END IF + + ! Compute stiffness + IF (p%Use_F_TBL) THEN ! use stiffness table + CALL SpringForceExtrapInterp(x,p,m%F_table,ErrStat2,ErrMsg2); if (Failed()) return; + K = 0.0_ReKi + ELSE ! use preset values + K(1) = p%K_X + K(2) = p%K_Y + K(3) = p%K_Z + END IF + + + ! Compute accelerations and velocities in local coordinates + do i_pt=1,p%NumMeshPts + m%a_G(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),p%Gravity) + m%rdisp_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationDisp(:,1)) ! for ground StC_GroundHookDamp + m%rdot_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationVel(:,1)) ! for ground StC_GroundHookDamp + m%rddot_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%TranslationAcc(:,1)) + m%omega_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%RotationVel(:,1)) + m%alpha_P(:,i_pt) = matmul(u%Mesh(i_pt)%Orientation(:,:,1),u%Mesh(i_pt)%RotationAcc(:,1)) + enddo + + ! NOTE: m%F_stop and m%F_table are calculated earlier + IF (p%StC_DOF_MODE == ControlMode_None) THEN + do i_pt=1,p%NumMeshPts + ! Aggregate acceleration terms + m%Acc(1:3,i_pt) = 0.0_ReKi + enddo + + ELSEIF (p%StC_DOF_MODE == DOFMode_Indept) THEN + + do i_pt=1,p%NumMeshPts + ! Aggregate acceleration terms + m%Acc(1,i_pt) = - m%rddot_P(1,i_pt) + m%a_G(1,i_pt) + 1 / p%M_X * ( m%F_ext(1,i_pt) + m%F_stop(1,i_pt) - m%F_table(1,i_pt) ) + m%Acc(2,i_pt) = - m%rddot_P(2,i_pt) + m%a_G(2,i_pt) + 1 / p%M_Y * ( m%F_ext(2,i_pt) + m%F_stop(2,i_pt) - m%F_table(2,i_pt) ) + m%Acc(3,i_pt) = - m%rddot_P(3,i_pt) + m%a_G(3,i_pt) + 1 / p%M_Z * ( m%F_ext(3,i_pt) + m%F_stop(3,i_pt) - m%F_table(3,i_pt) ) + enddo + + ELSE IF (p%StC_DOF_MODE == DOFMode_Omni) THEN + + do i_pt=1,p%NumMeshPts + denom = SQRT(x%StC_x(1,i_pt)**2+x%StC_x(3,i_pt)**2) + IF ( EqualRealNos( denom, 0.0_ReKi) ) THEN + m%F_k(1,i_pt) = 0.0 + m%F_k(2,i_pt) = 0.0 + ELSE + m%F_k(1,i_pt) = x%StC_x(1,i_pt)/denom + m%F_k(2,i_pt) = x%StC_x(3,i_pt)/denom + END IF + m%F_k(3,i_pt) = 0.0 + + ! Aggregate acceleration terms + m%Acc(1,i_pt) = - m%rddot_P(1,i_pt) + m%a_G(1,i_pt) + 1 / p%M_XY * ( m%F_ext(1,i_pt) + m%F_stop(1,i_pt) - m%F_table(1,i_pt)*(m%F_k(1,i_pt)) ) + m%Acc(2,i_pt) = - m%rddot_P(2,i_pt) + m%a_G(2,i_pt) + 1 / p%M_XY * ( m%F_ext(2,i_pt) + m%F_stop(2,i_pt) - m%F_table(2,i_pt)*(m%F_k(2,i_pt)) ) + m%Acc(3,i_pt) = 0.0_ReKi + enddo + + ENDIF + + + ! Compute the first time derivatives, dxdt%StC_x(1) and dxdt%StC_x(3), of the continuous states,: + ! Compute elements 1 and 3 of dxdt%StC_x so that we can compute m%C_ctrl,m%C_Brake, and m%F_fr in StC_GroundHookDamp if necessary + IF (p%StC_DOF_MODE == ControlMode_None) THEN + + dxdt%StC_x = 0.0_ReKi ! Whole array + + ELSE + + IF (p%StC_DOF_MODE == DOFMode_Indept .AND. .NOT. p%StC_X_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(1,i_pt) = 0.0_ReKi + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(1,i_pt) = x%StC_x(2,i_pt) + enddo + END IF + + IF (p%StC_DOF_MODE == DOFMode_Indept .AND. .NOT. p%StC_Y_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(3,i_pt) = 0.0_ReKi + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(3,i_pt) = x%StC_x(4,i_pt) + enddo + END IF + + IF (p%StC_DOF_MODE == DOFMode_Indept .AND. .NOT. p%StC_Z_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(5,i_pt) = 0.0_ReKi + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(5,i_pt) = x%StC_x(6,i_pt) + enddo + END IF + + ENDIF + + + ! compute damping for dxdt%StC_x(2), dxdt%StC_x(4), and dxdt%StC_x(6) + IF (p%StC_CMODE == ControlMode_None) THEN + m%C_ctrl(1,:) = p%C_X + m%C_ctrl(2,:) = p%C_Y + m%C_ctrl(3,:) = p%C_Z + + m%C_Brake = 0.0_ReKi + m%F_fr = 0.0_ReKi + ELSE IF (p%StC_CMODE == CMODE_Semi) THEN ! ground hook control + CALL StC_GroundHookDamp(dxdt,x,u,p,m%rdisp_P,m%rdot_P,m%C_ctrl,m%C_Brake,m%F_fr) + END IF + + + ! Compute the first time derivatives, dxdt%StC_x(2), dxdt%StC_x(4), and dxdt%StC_x(6), of the continuous states,: + IF (p%StC_DOF_MODE == DOFMode_Indept) THEN + + IF (p%StC_X_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1) / p%M_X) * x%StC_x(1,i_pt) & + - ( m%C_ctrl( 1,i_pt)/p%M_X ) * x%StC_x(2,i_pt) & + - ( m%C_Brake(1,i_pt)/p%M_X ) * x%StC_x(2,i_pt) & + + m%Acc(1,i_pt) + m%F_fr(1,i_pt) / p%M_X + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(2,i_pt) = 0.0_ReKi + enddo + END IF + IF (p%StC_Y_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2) / p%M_Y) * x%StC_x(3,i_pt) & + - ( m%C_ctrl( 2,i_pt)/p%M_Y ) * x%StC_x(4,i_pt) & + - ( m%C_Brake(2,i_pt)/p%M_Y ) * x%StC_x(4,i_pt) & + + m%Acc(2,i_pt) + m%F_fr(2,i_pt) / p%M_Y + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(4,i_pt) = 0.0_ReKi + enddo + END IF + IF (p%StC_Z_DOF) THEN + do i_pt=1,p%NumMeshPts + dxdt%StC_x(6,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(2,i_pt)**2 - K(3) / p%M_Z) * x%StC_x(5,i_pt) & + - ( m%C_ctrl( 3,i_pt)/p%M_Z ) * x%StC_x(6,i_pt) & + - ( m%C_Brake(3,i_pt)/p%M_Z ) * x%StC_x(6,i_pt) & + + m%Acc(3,i_pt) + m%F_fr(3,i_pt) / p%M_Z + enddo + ELSE + do i_pt=1,p%NumMeshPts + dxdt%StC_x(6,i_pt) = 0.0_ReKi + enddo + END IF + + ELSE IF (p%StC_DOF_MODE == DOFMode_Omni) THEN ! Only includes X and Y + ! Compute the first time derivatives of the continuous states of Omnidirectional tuned masse damper mode by sm 2015-0904 + do i_pt=1,p%NumMeshPts + dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1) / p%M_XY) * x%StC_x(1,i_pt) & + - ( m%C_ctrl( 1,i_pt)/p%M_XY ) * x%StC_x(2,i_pt) & + - ( m%C_Brake(1,i_pt)/p%M_XY ) * x%StC_x(2,i_pt) & + + m%Acc(1,i_pt) + 1/p%M_XY * ( m%F_fr(1,i_pt) ) & + - ( m%omega_P(1,i_pt)*m%omega_P(2,i_pt) - m%alpha_P(3,i_pt) ) * x%StC_x(3,i_pt) & + +2 * m%omega_P(3,i_pt) * x%StC_x(4,i_pt) + dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2) / p%M_XY) * x%StC_x(3,i_pt) & + - ( m%C_ctrl( 2,i_pt)/p%M_XY ) * x%StC_x(4,i_pt) & + - ( m%C_Brake(2,i_pt)/p%M_XY ) * x%StC_x(4,i_pt) & + + m%Acc(2,i_pt) + 1/p%M_XY * ( m%F_fr(2,i_pt) ) & + - ( m%omega_P(1,i_pt)*m%omega_P(2,i_pt) + m%alpha_P(3,i_pt) ) * x%StC_x(1,i_pt) & + -2 * m%omega_P(3,i_pt) * x%StC_x(2,i_pt) + dxdt%StC_x(6,i_pt) = 0.0_ReKi ! Z is off + enddo + + ELSE IF (p%StC_DOF_MODE == DOFMode_TLCD) THEN !MEG & SP + ! Compute the first time derivatives of the continuous states of TLCD mode + do i_pt=1,p%NumMeshPts + dxdt%StC_x(2,i_pt) = (2*p%rho_X*p%area_X*x%StC_x(1,i_pt)*m%rddot_P(3,i_pt) & + +p%rho_X*p%area_X*p%B_X*m%alpha_P(2,i_pt)*((p%L_X-p%B_X)/2) & + -p%rho_X*p%area_X*p%B_X*m%omega_P(1,i_pt)*m%omega_P(3,i_pt)*((p%L_X-p%B_X)/2) & + +2*p%rho_X*p%area_X*m%omega_P(1,i_pt)*m%omega_P(1,i_pt)*x%StC_x(1,i_pt)*(p%L_X-p%B_X) & + +2*p%rho_X*p%area_X*m%omega_P(2,i_pt)*m%omega_P(2,i_pt)*x%StC_x(1,i_pt)*(p%L_X-p%B_X) & + +2*p%rho_X*p%area_X*x%StC_x(1,i_pt)*m%a_G(3,i_pt) & + -p%rho_X*p%area_X*p%B_X*m%rddot_P(1,i_pt) & + +p%rho_X*p%area_X*p%B_X*m%a_G(1,i_pt) & + -.5*p%rho_X*p%area_X*p%headLossCoeff_X*p%area_ratio_X*p%area_ratio_X*x%StC_x(2,i_pt) & + *ABS(x%StC_x(2,i_pt)))/(p%rho_X*p%area_X*(p%L_X-p%B_X+p%area_ratio_X*p%B_X)) + dxdt%StC_x(4,i_pt) = (2*p%rho_Y*p%area_Y*x%StC_x(3,i_pt)*m%rddot_P(3,i_pt) & + +p%rho_Y*p%area_Y*p%B_Y*m%alpha_P(1,i_pt)*((p%L_Y-p%B_Y)/2) & + -p%rho_Y*p%area_Y*p%B_Y*m%omega_P(2,i_pt)*m%omega_P(3,i_pt)*((p%L_Y-p%B_Y)/2) & + +2*p%rho_Y*p%area_Y*x%StC_x(3,i_pt)*m%omega_P(1,i_pt)*m%omega_P(1,i_pt)*(p%L_Y-p%B_Y) & + +2*p%rho_Y*p%area_Y*x%StC_x(3,i_pt)*m%omega_P(2,i_pt)*m%omega_P(2,i_pt)*(p%L_Y-p%B_Y) & + +2*p%rho_Y*p%area_Y*x%StC_x(3,i_pt)*m%a_G(3,i_pt)-p%rho_Y*p%area_Y*p%B_Y*m%rddot_P(2,i_pt)& + +p%rho_Y*p%area_Y*p%B_Y*m%a_G(2,i_pt) & + -.5*p%rho_Y*p%area_Y*p%headLossCoeff_Y*p%area_ratio_Y*p%area_ratio_Y*x%StC_x(4,i_pt) & + *ABS(x%StC_x(4,i_pt)))/(p%rho_Y*p%area_Y*(p%L_Y-p%B_Y+p%area_ratio_Y*p%B_Y)) + dxdt%StC_x(6,i_pt) = 0.0_ReKi ! Z is off + enddo + + END IF + + call CleanUp() + return + +CONTAINS + subroutine CleanUp() + end subroutine CleanUp + logical function Failed() + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'StC_CalcContStateDeriv') + Failed = ErrStat >= AbortErrLev + if (Failed) call CleanUp() + end function Failed +END SUBROUTINE StC_CalcContStateDeriv +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE StC_CalcStopForce(x,p,F_stop) + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(StC_ParameterType), INTENT(IN ) :: p !< Parameters + Real(ReKi), dimension(:,:), INTENT(INOUT) :: F_stop !< stop forces + ! local variables + Real(ReKi), dimension(3) :: F_SK !stop spring forces + Real(ReKi), dimension(3) :: F_SD !stop damping forces + INTEGER(IntKi) :: i ! counter + INTEGER(IntKi) :: i_pt ! counter for mesh points + INTEGER(IntKi) :: j ! counter for index into x%StC_x + do i_pt=1,p%NumMeshPts + DO i=1,3 ! X, Y, and Z + j=2*(i-1)+1 + IF ( x%StC_x(j,i_pt) > p%P_SP(i) ) THEN + F_SK(i) = p%K_S(i) *( p%P_SP(i) - x%StC_x(j,i_pt) ) + ELSEIF ( x%StC_x(j,i_pt) < p%N_SP(i) ) THEN + F_SK(i) = p%K_S(i) * ( p%N_SP(i) - x%StC_x(j,i_pt) ) + ELSE + F_SK(i) = 0.0_ReKi + ENDIF + IF ( (x%StC_x(j,i_pt) > p%P_SP(i)) .AND. (x%StC_x(j+1,i_pt) > 0) ) THEN + F_SD(i) = -p%C_S(i) *( x%StC_x(j+1,i_pt) ) + ELSEIF ( (x%StC_x(j,i_pt) < p%N_SP(i)) .AND. (x%StC_x(j+1,i_pt) < 0) ) THEN + F_SD(i) = -p%C_S(i) *( x%StC_x(j+1,i_pt) ) + ELSE + F_SD(i) = 0.0_ReKi + ENDIF + F_stop(i,i_pt) = F_SK(i) + F_SD(i) + END DO + enddo +END SUBROUTINE StC_CalcStopForce +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE StC_GroundHookDamp(dxdt,x,u,p,rdisp_P,rdot_P,C_ctrl,C_Brake,F_fr) + TYPE(StC_ContinuousStateType), INTENT(IN ) :: dxdt !< Derivative of continuous states at Time (needs elements 1 and 3 only) + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(StC_InputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(StC_ParameterType), INTENT(IN) :: p !< The module's parameter data + REAL(ReKi), dimension(:,:), INTENT(IN ) :: rdisp_P !< translational displacement in local coordinates + REAL(ReKi), dimension(:,:), INTENT(IN ) :: rdot_P !< translational velocity in local coordinates + REAL(ReKi), dimension(:,:), INTENT(INOUT) :: C_ctrl !< extrapolated/interpolated stiffness values + REAL(ReKi), dimension(:,:), INTENT(INOUT) :: C_Brake !< extrapolated/interpolated stiffness values + REAL(ReKi), dimension(:,:), INTENT(INOUT) :: F_fr !< Friction forces + INTEGER(IntKi) :: i_pt !< generic counter for mesh points + + + do i_pt=1,p%NumMeshPts + IF (p%StC_CMODE == CMODE_Semi .AND. p%StC_SA_MODE == SA_CMODE_GH_vel) THEN ! velocity-based ground hook control with high damping for braking + + !X + IF (dxdt%StC_x(1,i_pt) * rdot_P(1,i_pt) <= 0 ) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ELSE + C_ctrl(1,i_pt) = p%StC_X_C_LOW + END IF + + !Brake X + IF ( (x%StC_x(1,i_pt) > p%P_SP(1)-0.2) .AND. (x%StC_x(2,i_pt) > 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE IF ( (x%StC_x(1,i_pt) < p%N_SP(1)+0.2) .AND. (x%StC_x(2,i_pt) < 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE + C_Brake(1,i_pt) = 0 + END IF + + + ! Y + IF (dxdt%StC_x(3,i_pt) * rdot_P(2,i_pt) <= 0 ) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ELSE + C_ctrl(2,i_pt) = p%StC_Y_C_LOW + END IF + + !Brake Y + IF ( (x%StC_x(3,i_pt) > p%P_SP(2)-0.2) .AND. (x%StC_x(4,i_pt) > 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(2)+0.2) .AND. (x%StC_x(4,i_pt) < 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE + C_Brake(2,i_pt) = 0 + END IF + + + ! Z + IF (dxdt%StC_x(5,i_pt) * rdot_P(3,i_pt) <= 0 ) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ELSE + C_ctrl(3,i_pt) = p%StC_Z_C_LOW + END IF + + !Brake Z + IF ( (x%StC_x(5,i_pt) > p%P_SP(3)-0.2) .AND. (x%StC_x(6,i_pt) > 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE IF ( (x%StC_x(5,i_pt) < p%N_SP(3)+0.2) .AND. (x%StC_x(6,i_pt) < 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE + C_Brake(3,i_pt) = 0 + END IF + + ELSE IF (p%StC_CMODE == CMODE_Semi .AND. p%StC_SA_MODE == SA_CMODE_GH_invVel) THEN ! Inverse velocity-based ground hook control with high damping for braking + + ! X + IF (dxdt%StC_x(1,i_pt) * rdot_P(1,i_pt) >= 0 ) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ELSE + C_ctrl(1,i_pt) = p%StC_X_C_LOW + END IF + + !Brake X + IF ( (x%StC_x(1,i_pt) > p%P_SP(1)-0.2) .AND. (x%StC_x(2,i_pt) > 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE IF ( (x%StC_x(1,i_pt) < p%N_SP(1)+0.2) .AND. (x%StC_x(2,i_pt) < 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE + C_Brake(1,i_pt) = 0 + END IF + + ! Y + IF (dxdt%StC_x(3,i_pt) * rdot_P(2,i_pt) >= 0 ) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ELSE + C_ctrl(2,i_pt) = p%StC_Y_C_LOW + END IF + + !Brake Y + IF ( (x%StC_x(3,i_pt) > p%P_SP(2)-0.2) .AND. (x%StC_x(4,i_pt) > 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(2)+0.2) .AND. (x%StC_x(4,i_pt) < 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE + C_Brake(2,i_pt) = 0 + END IF + + ! Z + IF (dxdt%StC_x(5,i_pt) * rdot_P(3,i_pt) >= 0 ) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ELSE + C_ctrl(3,i_pt) = p%StC_Z_C_LOW + END IF + + !Brake Z + IF ( (x%StC_x(5,i_pt) > p%P_SP(3)-0.2) .AND. (x%StC_x(6,i_pt) > 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE IF ( (x%StC_x(5,i_pt) < p%N_SP(3)+0.2) .AND. (x%StC_x(6,i_pt) < 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE + C_Brake(3,i_pt) = 0 + END IF + + ELSE IF (p%StC_CMODE == CMODE_Semi .AND. p%StC_SA_MODE == SA_CMODE_GH_disp) THEN ! displacement-based ground hook control with high damping for braking + + ! X + IF (dxdt%StC_x(1,i_pt) * rdisp_P(1,i_pt) <= 0 ) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ELSE + C_ctrl(1,i_pt) = p%StC_X_C_LOW + END IF + + !Brake X + IF ( (x%StC_x(1,i_pt) > p%P_SP(1)-0.2) .AND. (x%StC_x(2,i_pt) > 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE IF ( (x%StC_x(1,i_pt) < p%N_SP(1)+0.2) .AND. (x%StC_x(2,i_pt) < 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE + C_Brake(1,i_pt) = 0 + END IF + + ! Y + IF (dxdt%StC_x(3,i_pt) * rdisp_P(2,i_pt) <= 0 ) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ELSE + C_ctrl(2,i_pt) = p%StC_Y_C_LOW + END IF + + !Brake Y + IF ( (x%StC_x(3,i_pt) > p%P_SP(2)-0.2) .AND. (x%StC_x(4,i_pt) > 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(2)+0.2) .AND. (x%StC_x(4,i_pt) < 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE + C_Brake(2,i_pt) = 0 + END IF + + ! Z + IF (dxdt%StC_x(5,i_pt) * rdisp_P(3,i_pt) <= 0 ) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ELSE + C_ctrl(3,i_pt) = p%StC_Z_C_LOW + END IF + + !Brake Z + IF ( (x%StC_x(5,i_pt) > p%P_SP(3)-0.2) .AND. (x%StC_x(6,i_pt) > 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(3)+0.2) .AND. (x%StC_x(6,i_pt) < 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE + C_Brake(3,i_pt) = 0 + END IF + + ELSE IF (p%StC_CMODE == CMODE_Semi .AND. p%StC_SA_MODE == SA_CMODE_Ph_FF) THEN ! Phase Difference Algorithm with Friction Force + ! X + ! (a) + IF (rdisp_P(1,i_pt) > 0 .AND. rdot_P(1,i_pt) < 0 .AND. x%StC_x(1,i_pt) > 0 .AND. dxdt%StC_x(1,i_pt) < 0) THEN + F_fr(1,i_pt) = p%StC_X_C_HIGH + ! (b) + ELSE IF (rdisp_P(1,i_pt) < 0 .AND. rdot_P(1,i_pt) > 0 .AND. x%StC_x(1,i_pt) < 0 .AND. dxdt%StC_x(1,i_pt) > 0) THEN + F_fr(1,i_pt) = -p%StC_X_C_HIGH + ! (c) + ELSE IF (rdisp_P(1,i_pt) < 0 .AND. rdot_P(1,i_pt) < 0 .AND. x%StC_x(1,i_pt) > 0 .AND. dxdt%StC_x(1,i_pt) > 0) THEN + F_fr(1,i_pt) = -p%StC_X_C_HIGH + ELSE IF (rdisp_P(1,i_pt) > 0 .AND. rdot_P(1,i_pt) > 0 .AND. x%StC_x(1,i_pt) < 0 .AND. dxdt%StC_x(1,i_pt) < 0) THEN + F_fr(1,i_pt) = p%StC_X_C_HIGH + ELSE + F_fr(1,i_pt) = p%StC_X_C_LOW + END IF + + !Brake X + IF ( (x%StC_x(1,i_pt) > p%P_SP(1)-0.2) .AND. (x%StC_x(2,i_pt) > 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE IF ( (x%StC_x(1,i_pt) < p%N_SP(1)+0.2) .AND. (x%StC_x(2,i_pt) < 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE + C_Brake(1,i_pt) = 0 + END IF + + ! Y + ! (a) + IF (rdisp_P(2,i_pt) > 0 .AND. rdot_P(2,i_pt) < 0 .AND. x%StC_x(3,i_pt) > 0 .AND. dxdt%StC_x(3,i_pt) < 0) THEN + F_fr(2,i_pt) = p%StC_Y_C_HIGH + ! (b) + ELSE IF (rdisp_P(2,i_pt) < 0 .AND. rdot_P(2,i_pt) > 0 .AND. x%StC_x(3,i_pt) < 0 .AND. dxdt%StC_x(3,i_pt) > 0) THEN + F_fr(2,i_pt) = -p%StC_Y_C_HIGH + ! (c) + ELSE IF (rdisp_P(2,i_pt) < 0 .AND. rdot_P(2,i_pt) < 0 .AND. x%StC_x(3,i_pt) > 0 .AND. dxdt%StC_x(3,i_pt) > 0) THEN + F_fr(2,i_pt) = -p%StC_Y_C_HIGH + ELSE IF (rdisp_P(2,i_pt) > 0 .AND. rdot_P(2,i_pt) > 0 .AND. x%StC_x(3,i_pt) < 0 .AND. dxdt%StC_x(3,i_pt) < 0) THEN + F_fr(2,i_pt) = p%StC_Y_C_HIGH + ELSE + F_fr(2,i_pt) = p%StC_Y_C_LOW + END IF + + !Brake Y + IF ( (x%StC_x(3,i_pt) > p%P_SP(2)-0.2) .AND. (x%StC_x(4,i_pt) > 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(2)+0.2) .AND. (x%StC_x(4,i_pt) < 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE + C_Brake(2,i_pt) = 0 + END IF + + ! Z + ! (a) + IF (rdisp_P(3,i_pt) > 0 .AND. rdot_P(3,i_pt) < 0 .AND. x%StC_x(5,i_pt) > 0 .AND. dxdt%StC_x(5,i_pt) < 0) THEN + F_fr(3,i_pt) = p%StC_Z_C_HIGH + ! (b) + ELSE IF (rdisp_P(3,i_pt) < 0 .AND. rdot_P(3,i_pt) > 0 .AND. x%StC_x(5,i_pt) < 0 .AND. dxdt%StC_x(5,i_pt) > 0) THEN + F_fr(3,i_pt) = -p%StC_Z_C_HIGH + ! (c) + ELSE IF (rdisp_P(3,i_pt) < 0 .AND. rdot_P(3,i_pt) < 0 .AND. x%StC_x(5,i_pt) > 0 .AND. dxdt%StC_x(5,i_pt) > 0) THEN + F_fr(3,i_pt) = -p%StC_Z_C_HIGH + ELSE IF (rdisp_P(3,i_pt) > 0 .AND. rdot_P(3,i_pt) > 0 .AND. x%StC_x(5,i_pt) < 0 .AND. dxdt%StC_x(5,i_pt) < 0) THEN + F_fr(3,i_pt) = p%StC_Z_C_HIGH + ELSE + F_fr(3,i_pt) = p%StC_Z_C_LOW + END IF + + !Brake Z + IF ( (x%StC_x(5,i_pt) > p%P_SP(3)-0.2) .AND. (x%StC_x(6,i_pt) > 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE IF ( (x%StC_x(5,i_pt) < p%N_SP(3)+0.2) .AND. (x%StC_x(6,i_pt) < 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE + C_Brake(3,i_pt) = 0 + END IF + + ELSE IF (p%StC_CMODE == CMODE_Semi .AND. p%StC_SA_MODE == SA_CMODE_Ph_DF) THEN ! Phase Difference Algorithm with Damping On/Off + ! X + ! (a) + IF (rdisp_P(1,i_pt) > 0 .AND. rdot_P(1,i_pt) < 0 .AND. x%StC_x(1,i_pt) > 0 .AND. dxdt%StC_x(1,i_pt) < 0) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ! (b) + ELSE IF (rdisp_P(1,i_pt) < 0 .AND. rdot_P(1,i_pt) > 0 .AND. x%StC_x(1,i_pt) < 0 .AND. dxdt%StC_x(1,i_pt) > 0) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ! (c) + ELSE IF (rdisp_P(1,i_pt) < 0 .AND. rdot_P(1,i_pt) < 0 .AND. x%StC_x(1,i_pt) > 0 .AND. dxdt%StC_x(1,i_pt) > 0) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ELSE IF (rdisp_P(1,i_pt) > 0 .AND. rdot_P(1,i_pt) > 0 .AND. x%StC_x(1,i_pt) < 0 .AND. dxdt%StC_x(1,i_pt) < 0) THEN + C_ctrl(1,i_pt) = p%StC_X_C_HIGH + ELSE + C_ctrl(1,i_pt) = p%StC_X_C_LOW + END IF + + !Brake X + IF ( (x%StC_x(1,i_pt) > p%P_SP(1)-0.2) .AND. (x%StC_x(2,i_pt) > 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE IF ( (x%StC_x(1,i_pt) < p%N_SP(1)+0.2) .AND. (x%StC_x(2,i_pt) < 0) ) THEN + C_Brake(1,i_pt) = p%StC_X_C_BRAKE + ELSE + C_Brake(1,i_pt) = 0 + END IF + + ! Y + ! (a) + IF (rdisp_P(2,i_pt) > 0 .AND. rdot_P(2,i_pt) < 0 .AND. x%StC_x(3,i_pt) > 0 .AND. dxdt%StC_x(3,i_pt) < 0) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ! (b) + ELSE IF (rdisp_P(2,i_pt) < 0 .AND. rdot_P(2,i_pt) > 0 .AND. x%StC_x(3,i_pt) < 0 .AND. dxdt%StC_x(3,i_pt) > 0) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ! (c) + ELSE IF (rdisp_P(2,i_pt) < 0 .AND. rdot_P(2,i_pt) < 0 .AND. x%StC_x(3,i_pt) > 0 .AND. dxdt%StC_x(3,i_pt) > 0) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ELSE IF (rdisp_P(2,i_pt) > 0 .AND. rdot_P(2,i_pt) > 0 .AND. x%StC_x(3,i_pt) < 0 .AND. dxdt%StC_x(3,i_pt) < 0) THEN + C_ctrl(2,i_pt) = p%StC_Y_C_HIGH + ELSE + C_ctrl(2,i_pt) = p%StC_Y_C_LOW + END IF + + !Brake Y + IF ( (x%StC_x(3,i_pt) > p%P_SP(2)-0.2) .AND. (x%StC_x(4,i_pt) > 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE IF ( (x%StC_x(3,i_pt) < p%N_SP(2)+0.2) .AND. (x%StC_x(4,i_pt) < 0) ) THEN + C_Brake(2,i_pt) = p%StC_Y_C_BRAKE + ELSE + C_Brake(2,i_pt) = 0 + END IF + + ! Z + ! (a) + IF (rdisp_P(3,i_pt) > 0 .AND. rdot_P(3,i_pt) < 0 .AND. x%StC_x(5,i_pt) > 0 .AND. dxdt%StC_x(5,i_pt) < 0) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ! (b) + ELSE IF (rdisp_P(3,i_pt) < 0 .AND. rdot_P(3,i_pt) > 0 .AND. x%StC_x(5,i_pt) < 0 .AND. dxdt%StC_x(5,i_pt) > 0) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ! (c) + ELSE IF (rdisp_P(3,i_pt) < 0 .AND. rdot_P(3,i_pt) < 0 .AND. x%StC_x(5,i_pt) > 0 .AND. dxdt%StC_x(5,i_pt) > 0) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ELSE IF (rdisp_P(3,i_pt) > 0 .AND. rdot_P(3,i_pt) > 0 .AND. x%StC_x(5,i_pt) < 0 .AND. dxdt%StC_x(5,i_pt) < 0) THEN + C_ctrl(3,i_pt) = p%StC_Z_C_HIGH + ELSE + C_ctrl(3,i_pt) = p%StC_Z_C_LOW + END IF + + !Brake Z + IF ( (x%StC_x(5,i_pt) > p%P_SP(3)-0.2) .AND. (x%StC_x(6,i_pt) > 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE IF ( (x%StC_x(5,i_pt) < p%N_SP(3)+0.2) .AND. (x%StC_x(6,i_pt) < 0) ) THEN + C_Brake(3,i_pt) = p%StC_Z_C_BRAKE + ELSE + C_Brake(3,i_pt) = 0 + END IF + + END IF + enddo + + +END SUBROUTINE StC_GroundHookDamp +!---------------------------------------------------------------------------------------------------------------------------------- +!> Extrapolate or interpolate stiffness value based on stiffness table. +SUBROUTINE SpringForceExtrapInterp(x, p, F_table,ErrStat,ErrMsg) + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(StC_ParameterType), INTENT(IN) :: p !< The module's parameter data + REAL(ReKi), dimension(:,:), INTENT(INOUT) :: F_table !< extrapolated/interpolated stiffness values + + INTEGER(IntKi), INTENT(OUT) :: ErrStat ! The error status code + CHARACTER(*), INTENT(OUT) :: ErrMsg ! The error message, if an error occurred + + ! local variables + INTEGER(IntKi) :: ErrStat2 ! error status + INTEGER(IntKi) :: I ! Loop counter + INTEGER(IntKi), DIMENSION(3) :: J = (/1, 3, 5/) ! Index to StC_x for TMD displacement in each dimension + INTEGER(IntKi) :: M ! location of closest table position + INTEGER(IntKi) :: Nrows ! Number of rows in F_TBL + REAL(ReKi) :: Slope ! + REAL(ReKi) :: DX ! + REAL(ReKi) :: Disp(3) ! Current displacement + REAL(ReKi), ALLOCATABLE :: TmpRAry(:) + INTEGER(IntKi) :: i_pt !< generic counter for mesh point + + ErrStat = ErrID_None + ErrMsg = '' + + Nrows = SIZE(p%F_TBL,1) + ALLOCATE(TmpRAry(Nrows),STAT=ErrStat2) + + do i_pt=1,p%NumMeshPts + + IF (p%StC_DOF_MODE == DOFMode_Indept .OR. p%StC_DOF_MODE == DOFMode_Omni) THEN + IF (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal,'Error allocating temp array.',ErrStat,ErrMsg,'SpringForceExtrapInterp') + RETURN + END IF + + IF (p%StC_DOF_MODE == DOFMode_Indept) THEN + DO I = 1,3 + Disp(I) = x%StC_x(J(I),i_pt) + END DO + ELSE !IF (p%StC_DOF_MODE == DOFMode_Omni) THEN ! Only X and Y + Disp = SQRT(x%StC_x(1,i_pt)**2+x%StC_x(3,i_pt)**2) ! constant assignment to vector + END IF + + + DO I = 1,3 + TmpRAry = p%F_TBL(:,J(I))-Disp(I) + TmpRAry = ABS(TmpRAry) + M = MINLOC(TmpRAry,1) + + !interpolate + IF ( (Disp(I) > p%F_TBL(M,J(I)) .AND. M /= Nrows) .OR. (Disp(I) < p%F_TBL(M,J(I)) .AND. M == 1) ) THEN + ! for displacements higher than the closest table value or lower than the lower bound + Slope = ( p%F_TBL(M+1,J(I)+1) - p%F_TBL(M,J(I)+1) ) / ( p%F_TBL(M+1,J(I)) - p%F_TBL(M,J(I)) ) + + ELSE IF ( (Disp(I) < p%F_TBL(M,J(I)) .AND. M /= 1 ) .OR. (Disp(I) > p%F_TBL(M,J(I)) .AND. M == Nrows) ) THEN ! lower + ! for displacements lower than the closest table value or higher than the upper bound + Slope = ( p%F_TBL(M,J(I)+1) - p%F_TBL(M-1,J(I)+1) ) / ( p%F_TBL(M,J(I)) - p%F_TBL(M-1,J(I)) ) + + ELSE ! equal + Slope = 0 + END IF + + F_table(I,i_pt) = p%F_TBL(M,J(I)+1) + Slope * ( Disp(I) - p%F_TBL(M,J(I)) ) + + END DO + + END IF + enddo ! Loop over p%NumMeshPts + + DEALLOCATE(TmpRAry) + +END SUBROUTINE SpringForceExtrapInterp +!---------------------------------------------------------------------------------------------------------------------------------- +!> Parse the inputfile info stored in FileInfo_In. +SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, FileInfo_In, InputFileData, UnEcho, ErrStat, ErrMsg ) + + implicit none + + ! Passed variables + character(*), intent(in ) :: PriPath !< primary path + CHARACTER(*), intent(in ) :: InputFile !< Name of the file containing the primary input data + CHARACTER(*), intent(in ) :: RootName !< The rootname of the echo file, possibly opened in this routine + type(StC_InputFile), intent(inout) :: InputFileData !< All the data in the StrucCtrl input file + type(FileInfoType), intent(in ) :: FileInfo_In !< The derived type for holding the file information. + integer(IntKi), intent( out) :: UnEcho !< The local unit number for this module's echo file + integer(IntKi), intent( out) :: ErrStat !< Error status + CHARACTER(ErrMsgLen), intent( out) :: ErrMsg !< Error message + + ! Local variables: + integer(IntKi) :: i !< generic counter + integer(IntKi) :: ErrStat2 !< Temporary Error status + character(ErrMsgLen) :: ErrMsg2 !< Temporary Error message + integer(IntKi) :: CurLine !< current entry in FileInfo_In%Lines array + real(ReKi) :: TmpRe6(6) !< temporary 6 number array for reading values in + + + ! Initialization + ErrStat = 0 + ErrMsg = "" + UnEcho = -1 ! Echo file unit. >0 when used + + + !------------------------------------------------------------------------------------------------- + ! General settings + !------------------------------------------------------------------------------------------------- + + CurLine = 4 ! Skip the first three lines as they are known to be header lines and separators + call ParseVar( FileInfo_In, CurLine, 'Echo', InputFileData%Echo, ErrStat2, ErrMsg2 ) + if (Failed()) return; + + if ( InputFileData%Echo ) then + CALL OpenEcho ( UnEcho, TRIM(RootName)//'.ech', ErrStat2, ErrMsg2 ) + if (Failed()) return; + WRITE(UnEcho, '(A)') 'Echo file for StructCtrl input file: '//trim(InputFile) + ! Write the first three lines into the echo file + WRITE(UnEcho, '(A)') FileInfo_In%Lines(1) + WRITE(UnEcho, '(A)') FileInfo_In%Lines(2) + WRITE(UnEcho, '(A)') FileInfo_In%Lines(3) + + CurLine = 4 + call ParseVar( FileInfo_In, CurLine, 'Echo', InputFileData%Echo, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return + endif + + !------------------------------------------------------------------------------------------------- + ! StC DEGREES OF FREEDOM + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! DOF mode (switch) { 0: No StC or TLCD DOF; + ! 1: StC_X_DOF, StC_Y_DOF, and/or StC_Z_DOF (three independent StC DOFs); + ! 2: StC_XY_DOF (Omni-Directional StC); + ! 3: TLCD; + ! 4: Prescribed force/moment time series} + call ParseVar( FileInfo_In, Curline, 'StC_DOF_MODE', InputFileData%StC_DOF_MODE, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! DOF on or off for StC X (flag) [Used only when StC_DOF_MODE=1] + call ParseVar( FileInfo_In, Curline, 'StC_X_DOF', InputFileData%StC_X_DOF, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! DOF on or off for StC Y (flag) [Used only when StC_DOF_MODE=1] + call ParseVar( FileInfo_In, Curline, 'StC_Y_DOF', InputFileData%StC_Y_DOF, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! DOF on or off for StC Z (flag) [Used only when StC_DOF_MODE=1] + call ParseVar( FileInfo_In, Curline, 'StC_Z_DOF', InputFileData%StC_Z_DOF, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + + !------------------------------------------------------------------------------------------------- + ! StC LOCATION [relative to the reference origin of component attached to] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! At rest X position of StC(s) (m) [relative to reference origin of the component] + call ParseVar( FileInfo_In, Curline, 'StC_P_X', InputFileData%StC_P_X, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! At rest Y position of StC(s) (m) [relative to reference origin of the component] + call ParseVar( FileInfo_In, Curline, 'StC_P_Y', InputFileData%StC_P_Y, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! At rest Z position of StC(s) (m) [relative to reference origin of the component] + call ParseVar( FileInfo_In, Curline, 'StC_P_Z', InputFileData%StC_P_Z, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! StC INITIAL CONDITIONS [used only when StC_DOF_MODE=1 or 2] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! StC X initial displacement (m) [relative to at rest position] + call ParseVar( FileInfo_In, Curline, 'StC_X_DSP', InputFileData%StC_X_DSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Y initial displacement (m) [relative to at rest position] + call ParseVar( FileInfo_In, Curline, 'StC_Y_DSP', InputFileData%StC_Y_DSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_DSP', InputFileData%StC_Z_DSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! StC CONFIGURATION [used only when StC_DOF_MODE=1 or 2] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! Positive stop position (maximum X mass displacement) (m) + call ParseVar( FileInfo_In, Curline, 'StC_X_PSP', InputFileData%StC_X_PSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Negative stop position (minimum X mass displacement) (m) + call ParseVar( FileInfo_In, Curline, 'StC_X_NSP', InputFileData%StC_X_NSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Positive stop position (maximum Y mass displacement) (m) + call ParseVar( FileInfo_In, Curline, 'StC_Y_PSP', InputFileData%StC_Y_PSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Negative stop position (minimum Y mass displacement) (m) + call ParseVar( FileInfo_In, Curline, 'StC_Y_NSP', InputFileData%StC_Y_NSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Positive stop position (maximum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_PSP', InputFileData%StC_Z_PSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Negative stop position (minimum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_NSP', InputFileData%StC_Z_NSP, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! StC MASS, STIFFNESS, & DAMPING [used only when StC_DOF_MODE=1 or 2] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! StC X mass (kg) [must equal StC_Y_M for StC_DOF_MODE = 2] + call ParseVar( FileInfo_In, Curline, 'StC_X_M', InputFileData%StC_X_M, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Y mass (kg) [must equal StC_X_M for StC_DOF_MODE = 2] + call ParseVar( FileInfo_In, Curline, 'StC_Y_M', InputFileData%StC_Y_M, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Z mass (kg) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_M', InputFileData%StC_Z_M, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Z mass (kg) [used only when StC_DOF_MODE=2] + call ParseVar( FileInfo_In, Curline, 'StC_XY_M', InputFileData%StC_XY_M, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC X stiffness (N/m) + call ParseVar( FileInfo_In, Curline, 'StC_X_K', InputFileData%StC_X_K, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Y stiffness (N/m) + call ParseVar( FileInfo_In, Curline, 'StC_Y_K', InputFileData%StC_Y_K, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_K', InputFileData%StC_Z_K, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC X damping (N/(m/s)) + call ParseVar( FileInfo_In, Curline, 'StC_X_C', InputFileData%StC_X_C, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Y damping (N/(m/s)) + call ParseVar( FileInfo_In, Curline, 'StC_Y_C', InputFileData%StC_Y_C, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! StC Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_C', InputFileData%StC_Z_C, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring X stiffness (N/m) + call ParseVar( FileInfo_In, Curline, 'StC_X_KS', InputFileData%StC_X_KS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring Y stiffness (N/m) + call ParseVar( FileInfo_In, Curline, 'StC_Y_KS', InputFileData%StC_Y_KS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_KS', InputFileData%StC_Z_KS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring X damping (N/(m/s)) + call ParseVar( FileInfo_In, Curline, 'StC_X_CS', InputFileData%StC_X_CS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring Y damping (N/(m/s)) + call ParseVar( FileInfo_In, Curline, 'StC_Y_CS', InputFileData%StC_Y_CS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + ! Stop spring Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_CS', InputFileData%StC_Z_CS, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! StC USER-DEFINED SPRING FORCES [used only when StC_DOF_MODE=1 or 2] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! Use spring force from user-defined table (flag) + call ParseVar( FileInfo_In, Curline, 'Use_F_TBL', InputFileData%Use_F_TBL, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; + + ! NKInpSt - Number of spring force input stations + call ParseVar( FileInfo_In, CurLine, 'NKInpSt', InputFileData%NKInpSt, ErrStat2, ErrMsg2, UnEcho) + if (Failed()) return + + ! Section break -- X K_X Y K_Y Z K_Z + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') '#TABLE: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') ' Table Header: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') ' Table Units: '//FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + if (InputFileData%NKInpSt > 0) then + CALL AllocAry( InputFileData%F_TBL, InputFileData%NKInpSt, 6, 'F_TBL', ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! TABLE read + do i=1,InputFileData%NKInpSt + call ParseAry ( FileInfo_In, CurLine, 'Coordinates', TmpRe6, 6, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%F_TBL(i,1) = TmpRe6(1) ! X + InputFileData%F_TBL(i,2) = TmpRe6(2) ! K_X + InputFileData%F_TBL(i,3) = TmpRe6(3) ! Y + InputFileData%F_TBL(i,4) = TmpRe6(4) ! K_Y + InputFileData%F_TBL(i,5) = TmpRe6(5) ! Z + InputFileData%F_TBL(i,6) = TmpRe6(6) ! K_Z + enddo + endif + + + !------------------------------------------------------------------------------------------------- + ! StructCtrl CONTROL [used only when StC_DOF_MODE=1 or 2] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + call ParseVar( FileInfo_In, Curline, 'StC_CMODE', InputFileData%StC_CMODE, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Semi-Active control mode { + ! 1: velocity-based ground hook control; + ! 2: Inverse velocity-based ground hook control; + ! 3: displacement-based ground hook control; + ! 4: Phase difference Algorithm with Friction Force; + ! 5: Phase difference Algorithm with Damping Force} (-) + call ParseVar( FileInfo_In, Curline, 'StC_SA_MODE', InputFileData%StC_SA_MODE, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC X high damping for ground hook control + call ParseVar( FileInfo_In, Curline, 'StC_X_C_HIGH', InputFileData%StC_X_C_HIGH, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC X low damping for ground hook control + call ParseVar( FileInfo_In, Curline, 'StC_X_C_LOW', InputFileData%StC_X_C_LOW, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Y high damping for ground hook control + call ParseVar( FileInfo_In, Curline, 'StC_Y_C_HIGH', InputFileData%StC_Y_C_HIGH, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Y low damping for ground hook control + call ParseVar( FileInfo_In, Curline, 'StC_Y_C_LOW', InputFileData%StC_Y_C_LOW, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Z high damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_C_HIGH', InputFileData%StC_Z_C_HIGH, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Z low damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_C_LOW', InputFileData%StC_Z_C_LOW, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC X high damping for braking the StC (Don't use it now. should be zero) + call ParseVar( FileInfo_In, Curline, 'StC_X_C_BRAKE', InputFileData%StC_X_C_BRAKE, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Y high damping for braking the StC (Don't use it now. should be zero) + call ParseVar( FileInfo_In, Curline, 'StC_Y_C_BRAKE', InputFileData%StC_Y_C_BRAKE, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! StC Z high damping for braking the StC (Don't use it now. should be zero) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_C_BRAKE', InputFileData%StC_Z_C_BRAKE, ErrStat2, ErrMsg2 ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! TLCD [used only when StC_DOF_MODE=3] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! X TLCD total length (m) + call ParseVar( FileInfo_In, Curline, 'L_X', InputFileData%L_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! X TLCD horizontal length (m) + call ParseVar( FileInfo_In, Curline, 'B_X', InputFileData%B_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! X TLCD cross-sectional area of vertical column (m^2) + call ParseVar( FileInfo_In, Curline, 'area_X', InputFileData%area_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + call ParseVar( FileInfo_In, Curline, 'area_ratio_X', InputFileData%area_ratio_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! X TLCD head loss coeff (-) + call ParseVar( FileInfo_In, Curline, 'headLossCoeff_X', InputFileData%headLossCoeff_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! X TLCD liquid density (kg/m^3) + call ParseVar( FileInfo_In, Curline, 'rho_X', InputFileData%rho_X, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD total length (m) + call ParseVar( FileInfo_In, Curline, 'L_Y', InputFileData%L_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD horizontal length (m) + call ParseVar( FileInfo_In, Curline, 'B_Y', InputFileData%B_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD cross-sectional area of vertical column (m^2) + call ParseVar( FileInfo_In, Curline, 'area_Y', InputFileData%area_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) + call ParseVar( FileInfo_In, Curline, 'area_ratio_Y', InputFileData%area_ratio_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD head loss coeff (-) + call ParseVar( FileInfo_In, Curline, 'headLossCoeff_Y', InputFileData%headLossCoeff_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Y TLCD liquid density (kg/m^3) + call ParseVar( FileInfo_In, Curline, 'rho_Y', InputFileData%rho_Y, ErrStat2, ErrMsg2 ) + If (Failed()) return; + + !------------------------------------------------------------------------------------------------- + ! PRESCRIBED TIME SERIES [used only when StC_DOF_MODE=4] + !------------------------------------------------------------------------------------------------- + + ! Section break + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + + ! Prescribed forces coordinate system + call ParseVar( FileInfo_In, Curline, 'PrescribedForcesCoordSys', InputFileData%PrescribedForcesCoordSys, ErrStat2, ErrMsg2 ) + If (Failed()) return; + ! Prescribed input time series + call ParseVar( FileInfo_In, Curline, 'PrescribedForcesFile', InputFileData%PrescribedForcesFile, ErrStat2, ErrMsg2 ) + if (Failed()) return; + if ( PathIsRelative( InputFileData%PrescribedForcesFile ) ) InputFileData%PrescribedForcesFile = TRIM(PriPath)//TRIM(InputFileData%PrescribedForcesFile) + + +CONTAINS + !------------------------------------------------------------------------------------------------- + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'StC_ParseInputFileInfo' ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + !------------------------------------------------------------------------------------------------- + SUBROUTINE Cleanup() + if (UnEcho > -1_IntKi) CLOSE( UnEcho ) + END SUBROUTINE Cleanup + !------------------------------------------------------------------------------------------------- +END SUBROUTINE StC_ParseInputFileInfo + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine checks the data handed in. If all is good, no errors reported. +subroutine StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat, ErrMsg ) + TYPE(StC_InputFile), INTENT(IN) :: InputFileData !< Data stored in the module's input file + TYPE(StC_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine. + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< The error status code + CHARACTER(ErrMsgLen), INTENT( OUT) :: ErrMsg !< The error message, if an error occurred + + CHARACTER(*), PARAMETER :: RoutineName = 'StC_ValidatePrimaryData' + + ! Initialize variables + ErrStat = ErrID_None + ErrMsg = '' + + ! Check DOF modes + IF ( InputFileData%StC_DOF_MODE /= ControlMode_None .and. & + InputFileData%StC_DOF_MODE /= DOFMode_Indept .and. & + InputFileData%StC_DOF_MODE /= DOFMode_Omni .and. & + InputFileData%StC_DOF_MODE /= DOFMode_TLCD .and. & + InputFileData%StC_DOF_MODE /= DOFMode_Prescribed) & + CALL SetErrStat( ErrID_Fatal, 'DOF mode (StC_DOF_MODE) must be 0 (no DOF), 1 (two independent DOFs), or 2 (omni-directional), or 3 (TLCD), or 4 (prescribed force time-series).', ErrStat, ErrMsg, RoutineName ) + + ! Check control modes + IF ( InputFileData%StC_CMODE /= ControlMode_None .and. InputFileData%StC_CMODE /= CMODE_Semi ) & + CALL SetErrStat( ErrID_Fatal, 'Control mode (StC_CMode) must be 0 (none) or 1 (semi-active) in this version of StrucCtrl.', ErrStat, ErrMsg, RoutineName ) +! IF ( InputFileData%StC_CMODE /= ControlMode_None .and. InputFileData%StC_CMODE /= CMODE_Semi .and. InputFileData%StC_CMODE /= CMODE_Active) & +! CALL SetErrStat( ErrID_Fatal, 'Control mode (StC_CMode) must be 0 (none), 1 (semi-active), or 2 (active).', ErrStat, ErrMsg, RoutineName ) + + IF ( InputFileData%StC_SA_MODE /= SA_CMODE_GH_vel .and. & + InputFileData%StC_SA_MODE /= SA_CMODE_GH_invVel .and. & + InputFileData%StC_SA_MODE /= SA_CMODE_GH_disp .and. & + InputFileData%StC_SA_MODE /= SA_CMODE_Ph_FF .and. & + InputFileData%StC_SA_MODE /= SA_CMODE_Ph_DF ) then + CALL SetErrStat( ErrID_Fatal, 'Semi-active control mode (StC_SA_MODE) must be 1 (velocity-based ground hook control), '// & + '2 (inverse velocity-based ground hook control), 3 (displacement-based ground hook control), '// & + '4 (phase difference algorithm with friction force), or 5 (phase difference algorithm with damping force).', ErrStat, ErrMsg, RoutineName ) + END IF + + ! Prescribed forces + if (InputFileData%StC_DOF_MODE == DOFMode_Prescribed) then + if (InputFileData%PrescribedForcesCoordSys /= PRESCRIBED_FORCE_GLOBAL .and. InputFileData%PrescribedForcesCoordSys /= PRESCRIBED_FORCE_LOCAL) then + call SetErrStat( ErrID_Fatal, 'PrescribedForcesCoordSys must be '//trim(Num2LStr(PRESCRIBED_FORCE_GLOBAL))// & + ' (Global) or '//trim(Num2LStr(PRESCRIBED_FORCE_LOCAL))//' (local)', ErrStat, ErrMsg, RoutineName ) + endif + endif + + + ! Check masses make some kind of sense + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_X_DOF .and. (InputFileData%StC_X_M <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_X_M must be > 0 when StC_X_DOF is enabled', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_X_DOF .and. (InputFileData%StC_X_K <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_X_K must be > 0 when StC_X_DOF is enabled', ErrStat,ErrMsg,RoutineName) + + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Y_DOF .and. (InputFileData%StC_Y_M <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_Y_M must be > 0 when StC_Y_DOF is enabled', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Y_DOF .and. (InputFileData%StC_Y_K <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_Y_K must be > 0 when StC_Y_DOF is enabled', ErrStat,ErrMsg,RoutineName) + + if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_XY_M <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_XY_M must be > 0 when DOF mode 2 (omni-directional) is used', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_X_K <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_X_K must be > 0 when DOF mode 2 (omni-directional) is used', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_Y_K <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_Y_K must be > 0 when DOF mode 2 (omni-directional) is used', ErrStat,ErrMsg,RoutineName) + + ! Sanity checks for the TLCD option +!FIXME: add some sanity checks here + +end subroutine StC_ValidatePrimaryData +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine sets the parameters, based on the data stored in InputFileData. +SUBROUTINE StC_SetParameters( InputFileData, InitInp, p, Interval, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(StC_InputFile), INTENT(IN ) :: InputFileData !< Data stored in the module's input file + TYPE(StC_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine. + TYPE(StC_ParameterType), INTENT(INOUT) :: p !< The module's parameter data + REAL(DbKi), INTENT(IN ) :: Interval !< Coupling interval in seconds: the rate that + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< The error status code + CHARACTER(ErrMsgLen), INTENT( OUT) :: ErrMsg !< The error message, if an error occurred + + ! Local variables + INTEGER(IntKi) :: ErrStat2 ! Temporary error ID + CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary message describing error + CHARACTER(*), PARAMETER :: RoutineName = 'StC_SetParameters' + + + ! Initialize variables + ErrStat = ErrID_None + ErrMsg = '' + + ! Filenames + p%RootName = TRIM(InitInp%RootName) ! Already includes NStC, TStC, or BStC + + ! Constants + p%DT = Interval + p%Gravity = InitInp%Gravity ! Gravity vector pointed in negative global Z-axis (/0,0,-g/) + p%NumMeshPts = InitInp%NumMeshPts + + ! DOF controls + p%StC_DOF_MODE = InputFileData%StC_DOF_MODE + + !p%DT = InputFileData%DT + !p%RootName = 'StC' + ! DOFs + + p%StC_X_DOF = InputFileData%StC_X_DOF + p%StC_Y_DOF = InputFileData%StC_Y_DOF + p%StC_Z_DOF = InputFileData%StC_Z_DOF + + ! StC X parameters + p%M_X = InputFileData%StC_X_M + p%K_X = InputFileData%StC_X_K + p%C_X = InputFileData%StC_X_C + + ! StC Y parameters + p%M_Y = InputFileData%StC_Y_M + p%K_Y = InputFileData%StC_Y_K + p%C_Y = InputFileData%StC_Y_C + + ! StC Z parameters + p%M_Z = InputFileData%StC_Z_M + p%K_Z = InputFileData%StC_Z_K + p%C_Z = InputFileData%StC_Z_C + + ! StC Omni parameters + p%M_XY = InputFileData%StC_XY_M + + ! Fore-Aft TLCD Parameters ! MEG & SP + p%L_X = InputFileData%L_X + p%B_X = InputFileData%B_X + p%area_X = InputFileData%area_X + p%area_ratio_X = InputFileData%area_ratio_X + p%headLossCoeff_X = InputFileData%headLossCoeff_X + p%rho_X = InputFileData%rho_X + + !Side-Side TLCD Parameters + p%L_Y = InputFileData%L_Y + p%B_Y = InputFileData%B_Y + p%area_Y = InputFileData%area_Y + p%area_ratio_Y = InputFileData%area_ratio_Y + p%headLossCoeff_Y = InputFileData%headLossCoeff_Y + p%rho_Y = InputFileData%rho_Y ! MEG & SP + + ! vector parameters + ! stop positions + p%P_SP(1) = InputFileData%StC_X_PSP + p%P_SP(2) = InputFileData%StC_Y_PSP + p%P_SP(3) = InputFileData%StC_Z_PSP + p%N_SP(1) = InputFileData%StC_X_NSP + p%N_SP(2) = InputFileData%StC_Y_NSP + p%N_SP(3) = InputFileData%StC_Z_NSP + ! stop force stiffness + p%K_S(1) = InputFileData%StC_X_KS + p%K_S(2) = InputFileData%StC_Y_KS + p%K_S(3) = InputFileData%StC_Z_KS + ! stop force damping + p%C_S(1) = InputFileData%StC_X_CS + p%C_S(2) = InputFileData%StC_Y_CS + p%C_S(3) = InputFileData%StC_Z_CS + + ! ground hook control damping files + p%StC_CMODE = InputFileData%StC_CMODE + p%StC_SA_MODE = InputFileData%StC_SA_MODE + p%StC_X_C_HIGH = InputFileData%StC_X_C_HIGH + p%StC_X_C_LOW = InputFileData%StC_X_C_LOW + p%StC_Y_C_HIGH = InputFileData%StC_Y_C_HIGH + p%StC_Y_C_LOW = InputFileData%StC_Y_C_LOW + p%StC_Z_C_HIGH = InputFileData%StC_Z_C_HIGH + p%StC_Z_C_LOW = InputFileData%StC_Z_C_LOW + p%StC_X_C_BRAKE = InputFileData%StC_X_C_BRAKE + p%StC_Y_C_BRAKE = InputFileData%StC_Y_C_BRAKE + p%StC_Z_C_BRAKE = InputFileData%StC_Z_C_BRAKE + + ! User Defined Stiffness Table + p%Use_F_TBL = InputFileData%Use_F_TBL + call AllocAry(p%F_TBL,SIZE(InputFiledata%F_TBL,1),SIZE(InputFiledata%F_TBL,2),'F_TBL', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); if (ErrStat >= ErrID_Fatal) return + + p%F_TBL = InputFileData%F_TBL; + + ! Prescribed forces + p%PrescribedForcesCoordSys = InputFileData%PrescribedForcesCoordSys + if (allocated(InputFileData%StC_PrescribedForce)) then + call AllocAry( p%StC_PrescribedForce, size(InputFileData%StC_PrescribedForce,1), size(InputFileData%StC_PrescribedForce,2),"Array of force data", ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); if (ErrStat >= ErrID_Fatal) return + p%StC_PrescribedForce = InputFileData%StC_PrescribedForce + endif + +END SUBROUTINE StC_SetParameters + + +subroutine StC_ParseTimeSeriesFileInfo( InputFile, FileInfo_In, InputFileData, UnEcho, ErrStat, ErrMsg ) + + implicit none + + ! Passed variables + CHARACTER(*), intent(in ) :: InputFile !< Name of the file containing the primary input data + type(StC_InputFile), intent(inout) :: InputFileData !< All the data in the StrucCtrl input file + type(FileInfoType), intent(in ) :: FileInfo_In !< The derived type for holding the file information. + integer(IntKi), intent(inout) :: UnEcho !< The local unit number for this module's echo file + integer(IntKi), intent( out) :: ErrStat !< Error status + CHARACTER(ErrMsgLen), intent( out) :: ErrMsg !< Error message + + ! Local variables: + integer(IntKi) :: i !< generic counter + integer(IntKi) :: ErrStat2 !< Temporary Error status + character(ErrMsgLen) :: ErrMsg2 !< Temporary Error message + integer(IntKi) :: CurLine !< current entry in FileInfo_In%Lines array + real(ReKi) :: TmpRe7(7) !< temporary 7 number array for reading values in + character(*), parameter :: RoutineName='StC_ParseTimeSeriesFileInfo' + + ! Initialization of subroutine + ErrMsg = '' + ErrMsg2 = '' + ErrStat = ErrID_None + ErrStat2 = ErrID_None + + ! This file should only contain a table. Header lines etc should be commented out. Any blank lines at the + ! end get removed by the ProcessCom + call AllocAry( InputFileData%StC_PrescribedForce, 7, FileInfo_In%NumLines, "Array of force data", ErrStat2, ErrMsg2 ) + if (Failed()) return; + + ! Loop over all table lines. Expecting 7 colunns + CurLine=1 + do i=1,FileInfo_In%NumLines + call ParseAry ( FileInfo_In, CurLine, 'Coordinates', TmpRe7, 7, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%StC_PrescribedForce(1:7,i) = TmpRe7 + enddo + +contains + !------------------------------------------------------------------------------------------------- + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + end function Failed +end subroutine StC_ParseTimeSeriesFileInfo + +!---------------------------------------------------------------------------------------------------------------------------------- +END MODULE StrucCtrl +!********************************************************************************************************************************** diff --git a/modules/servodyn/src/TMD_Driver.f90 b/modules/servodyn/src/StrucCtrl_Driver.f90 similarity index 88% rename from modules/servodyn/src/TMD_Driver.f90 rename to modules/servodyn/src/StrucCtrl_Driver.f90 index 179a729d42..885491d1b9 100644 --- a/modules/servodyn/src/TMD_Driver.f90 +++ b/modules/servodyn/src/StrucCtrl_Driver.f90 @@ -1,11 +1,11 @@ !********************************************************************************************************************************* -! TMD_Driver: This code tests the template modules +! StrucCtrl_Driver: This code tests the template modules !.................................................................................................................................. ! LICENSING ! Copyright (C) 2014 William La Cava & Matt Lackner, UMass Amherst ! Copyright (C) 2012 National Renewable Energy Laboratory ! -! This file is part of TMD. +! This file is part of StrucCtrl. ! ! Licensed under the Apache License, Version 2.0 (the "License"); ! you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ module read_file_module ! this module reads in external nacelle data for testing the module. USE NWTC_Library - USE TMD_Types + USE StrucCtrl_Types implicit none contains @@ -99,7 +99,7 @@ SUBROUTINE CheckError(ErrID,Msg) IF ( ErrID /= ErrID_None ) THEN IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'TMD_ReadInput:'//TRIM(Msg) + ErrMsg = TRIM(ErrMsg)//'StC_ReadInput:'//TRIM(Msg) ErrStat = MAX(ErrStat, ErrID) !......................................................................................................................... @@ -132,7 +132,7 @@ SUBROUTINE ReadAngPosFile( InputFile, APvec, NumSteps, UnEc, ErrStat, ErrMsg ) CHARACTER(*), INTENT(IN) :: InputFile ! Name of the file containing the primary input data CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message - !TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the TMD input file + !TYPE(StC_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the StC input file Real(ReKi), dimension(9, NumSteps), intent(inout) :: APvec ! Local variables: REAL(ReKi) :: TmpRAry9(9) ! Temporary variable to read table from file @@ -243,7 +243,7 @@ SUBROUTINE ReadAngVelFile( InputFile, AVvec, NumSteps, UnEc, ErrStat, ErrMsg ) CHARACTER(*), INTENT(IN) :: InputFile ! Name of the file containing the primary input data CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message - !TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the TMD input file + !TYPE(StC_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the StC input file Real(ReKi), dimension(3,NumSteps), intent(inout) :: AVvec ! Local variables: REAL(ReKi) :: TmpRAry3(3) ! Temporary variable to read table from file @@ -353,7 +353,7 @@ SUBROUTINE ReadAngAccelFile( InputFile, AAvec, NumSteps, UnEc, ErrStat, ErrMsg ) CHARACTER(*), INTENT(IN) :: InputFile ! Name of the file containing the primary input data CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message - !TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the TMD input file + !TYPE(StC_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the StC input file Real(ReKi), dimension(3,NumSteps), intent(inout) :: AAvec ! Local variables: REAL(ReKi) :: TmpRAry3(3) ! Temporary variable to read table from file @@ -462,7 +462,7 @@ SUBROUTINE ReadAccelFile( InputFile, LAvec, NumSteps, UnEc, ErrStat, ErrMsg ) CHARACTER(*), INTENT(IN) :: InputFile ! Name of the file containing the primary input data CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message - !TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the TMD input file + !TYPE(StC_InputFile), INTENT(INOUT) :: InputFileData ! All the data in the StC input file Real(ReKi), dimension(3,NumSteps), intent(inout) :: LAvec ! Local variables: REAL(ReKi) :: TmpRAry3(3) ! Temporary variable to read table from file @@ -560,7 +560,7 @@ END SUBROUTINE ReadAccelFile !----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE TMD_OpenOutputFile(OutputFile,UnIn,ErrStat,ErrMsg) +SUBROUTINE StC_OpenOutputFile(OutputFile,UnIn,ErrStat,ErrMsg) ! This routine is called by the driver, not this module. CHARACTER(1024), Intent(IN) :: OutputFile ! Name of the file containing the primary input data INTEGER(IntKi), INTENT(OUT) :: UnIn ! Unit number for writing file @@ -571,7 +571,7 @@ SUBROUTINE TMD_OpenOutputFile(OutputFile,UnIn,ErrStat,ErrMsg) ErrStat = ErrID_None ErrMsg = '' - !OutputFile = 'TMD_Output_Data.txt' + !OutputFile = 'StC_Output_Data.txt' !Fmt = "F10.2))/" CALL GetNewUnit( UnIn, ErrStat, ErrMsg ) @@ -582,27 +582,27 @@ SUBROUTINE TMD_OpenOutputFile(OutputFile,UnIn,ErrStat,ErrMsg) ! Open the output file. CALL OpenFOutFile ( UnIn, OutputFile, ErrStat, ErrMsg ) - Header1 = "-------------- TMD Output ------------------------------" + Header1 = "-------------- StrucCtrl Output ------------------------------" Header2 = "x dxdt y dydt fx fy fz mx my mz" WRITE( UnIn, *, IOSTAT=ErrStat ) TRIM(Header1) WRITE( UnIn, *, IOSTAT=ErrStat ) TRIM(Header2) -END SUBROUTINE TMD_OpenOutputFile +END SUBROUTINE StC_OpenOutputFile !----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE TMD_CloseOutputFile(Un) +SUBROUTINE StC_CloseOutputFile(Un) ! This routine is called by the driver, not this module. INTEGER(IntKi), INTENT(IN) :: Un ! Unit number for writing file CLOSE ( Un ) -END SUBROUTINE TMD_CloseOutputFile +END SUBROUTINE StC_CloseOutputFile !----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE TMD_WriteOutputFile( x, y, UnIn, ErrStat, ErrMsg ) +SUBROUTINE StC_WriteOutputFile( x, y, UnIn, ErrStat, ErrMsg ) ! This routine is called by the driver, not this module. -! write output file with TMD states and forces. +! write output file with StC states and forces. - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x ! Continuous states at Time - TYPE(TMD_OutputType), INTENT(IN ) :: y ! state outputs + TYPE(StC_ContinuousStateType), INTENT(IN ) :: x ! Continuous states at Time + TYPE(StC_OutputType), INTENT(IN ) :: y ! state outputs INTEGER(IntKi), INTENT(IN) :: UnIn ! Unit number for writing file INTEGER(IntKi), INTENT(OUT) :: ErrStat ! Temporary error ID CHARACTER(*), INTENT(OUT) :: ErrMsg ! Temporary message describing error @@ -611,18 +611,23 @@ SUBROUTINE TMD_WriteOutputFile( x, y, UnIn, ErrStat, ErrMsg ) CHARACTER(1024) :: Fmt !text format REAL(ReKi), dimension(10) :: OutAry INTEGER(IntKi) :: i + INTEGER(IntKi) :: i_pt ! index into mesh point ErrStat = ErrID_None ErrMsg = '' +!FIXME: allow different sizes for StC_x second dimension -- loop over i_pt +!FIXME: allow for different size meshes -- loop over i_pt + i_pt=1 + ! create output array DO i=1,4 - OutAry(i) = x%tmd_x(i) + OutAry(i) = x%StC_x(i,i_pt) END DO DO i=5,7 - OutAry(i) = y%Mesh%Force(i-4,1) + OutAry(i) = y%Mesh(i_pt)%Force(i-4,1) END DO DO i=8,10 - OutAry(i) = y%Mesh%Moment(i-7,1) + OutAry(i) = y%Mesh(i_pt)%Moment(i-7,1) END DO !Write output Fmt = '(10(1x,F10.2))' @@ -631,45 +636,45 @@ SUBROUTINE TMD_WriteOutputFile( x, y, UnIn, ErrStat, ErrMsg ) CALL WrScr('Error '//TRIM(Num2LStr(ErrStat))//' writing matrix in WrMatrix1R4().') RETURN END IF - !CALL WrMatrix( x%tmd_x, UnIn, Fmt ) + !CALL WrMatrix( x%StC_x, UnIn, Fmt ) -END SUBROUTINE TMD_WriteOutputFile +END SUBROUTINE StC_WriteOutputFile !----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- end module read_file_module -PROGRAM TestTemplate +PROGRAM StrucCtrl_Driver USE NWTC_Library - USE TMD - USE TMD_Types + USE StrucCtrl + USE StrucCtrl_Types USE read_file_module IMPLICIT NONE - INTEGER(IntKi), PARAMETER :: NumInp = 2 ! Number of inputs sent to TMD_UpdateStates + INTEGER(IntKi), PARAMETER :: NumInp = 2 ! Number of inputs sent to StC_UpdateStates INTEGER(IntKi), PARAMETER :: NumSteps = 100 ! Number of time steps ! Program variables REAL(DbKi) :: Time ! Variable for storing time, in seconds REAL(DbKi) :: TimeInterval ! Interval between time steps, in seconds REAL(DbKi) :: InputTime(NumInp) ! Variable for storing time associated with inputs, in seconds - TYPE(TMD_InitInputType) :: InitInData ! Input data for initialization - TYPE(TMD_InitOutputType) :: InitOutData ! Output data from initialization + TYPE(StC_InitInputType) :: InitInData ! Input data for initialization + TYPE(StC_InitOutputType) :: InitOutData ! Output data from initialization - TYPE(TMD_ContinuousStateType) :: x ! Continuous states - TYPE(TMD_DiscreteStateType) :: xd ! Discrete states - TYPE(TMD_ConstraintStateType) :: z ! Constraint states - TYPE(TMD_ConstraintStateType) :: Z_residual ! Residual of the constraint state functions (Z) - TYPE(TMD_OtherStateType) :: OtherState ! Other states - TYPE(TMD_MiscVarType) :: m ! misc variables + TYPE(StC_ContinuousStateType) :: x ! Continuous states + TYPE(StC_DiscreteStateType) :: xd ! Discrete states + TYPE(StC_ConstraintStateType) :: z ! Constraint states + TYPE(StC_ConstraintStateType) :: Z_residual ! Residual of the constraint state functions (Z) + TYPE(StC_OtherStateType) :: OtherState ! Other states + TYPE(StC_MiscVarType) :: m ! misc variables - TYPE(TMD_ParameterType) :: p ! Parameters - TYPE(TMD_InputType) :: u(NumInp) ! System inputs - TYPE(TMD_OutputType) :: y ! System outputs + TYPE(StC_ParameterType) :: p ! Parameters + TYPE(StC_InputType) :: u(NumInp) ! System inputs + TYPE(StC_OutputType) :: y ! System outputs - TYPE(TMD_ContinuousStateType) :: dxdt ! First time derivatives of the continuous states + TYPE(StC_ContinuousStateType) :: dxdt ! First time derivatives of the continuous states integer(IntKi) :: UnOut !output data file number @@ -688,18 +693,24 @@ PROGRAM TestTemplate Real(ReKi), dimension(3,NumSteps) :: AAvec Real(ReKi), dimension(3,NumSteps) :: LAvec CHARACTER(1024) :: OutputName !text file output + + integer(IntKi) :: i_pt ! index counter to points !............................................................................................................................... ! Routines called in initialization !............................................................................................................................... ! Populate the InitInData data structure here: - ! input file with TMD settings - InitInData%InputFile = 'TMD_Input_test.dat' + ! input file with StC settings + InitInData%InputFile = 'StC_Input_test.dat' ! gravity InitInData%Gravity = 9.80665 - ! nacelle origin - InitInData%r_N_O_G(1) = 0 - InitInData%r_N_O_G(2) = 0 - InitInData%r_N_O_G(3) = 0 + ! StC origin and orientation + call AllocAry(InitInData%InitPosition, 3, 1, 'InitPosition', ErrStat,ErrMsg) + call AllocAry(InitInData%InitOrientation, 3, 3, 1, 'InitOrientation', ErrStat,ErrMsg) + InitInData%InitPosition(1:3,1) = (/ 0.0_ReKi, 0.0_ReKi, 0.0_ReKi /) + InitInData%InitOrientation = 0.0_R8Ki + do i=1,3 + InitInData%InitOrientation(i,i,1) = 1.0_R8Ki + enddo ! Set the driver's request for time interval here: @@ -707,33 +718,36 @@ PROGRAM TestTemplate ! Initialize the module - CALL TMD_Init( InitInData, u(1), p, x, xd, z, OtherState, y, m, TimeInterval, InitOutData, ErrStat, ErrMsg ) + CALL StC_Init( InitInData, u(1), p, x, xd, z, OtherState, y, m, TimeInterval, InitOutData, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary IF (ErrStat >= AbortErrLev) CALL ProgAbort( ErrMsg ) CALL WrScr( ErrMsg ) END IF - CALL TMD_CopyInput( u(1), u(2), MESH_NEWCOPY, ErrStat, ErrMsg ) + CALL StC_CopyInput( u(1), u(2), MESH_NEWCOPY, ErrStat, ErrMsg ) ! read in nacelle data from file CALL U_ReadInput(APvec,AVvec,AAvec,LAvec, NumSteps, ErrStat, ErrMsg ) ! Destroy initialization data - CALL TMD_DestroyInitInput( InitInData, ErrStat, ErrMsg ) - CALL TMD_DestroyInitOutput( InitOutData, ErrStat, ErrMsg ) + CALL StC_DestroyInitInput( InitInData, ErrStat, ErrMsg ) + CALL StC_DestroyInitOutput( InitOutData, ErrStat, ErrMsg ) !............................................................................................................................... ! Routines called in loose coupling -- the glue code may implement this in various ways !.................................................................................................... ! setup the output file: - OutputName = 'TMD_Output_Data.txt' - CALL TMD_OpenOutputFile(OutputName,UnOut,ErrStat,ErrMsg) + OutputName = 'StC_Output_Data.txt' + CALL StC_OpenOutputFile(OutputName,UnOut,ErrStat,ErrMsg) ! run simulation - + + !FIXME: allow for more than one point? + i_pt = 1 ! index counter of number of points we are simulating + DO n = 0,NumSteps-1 count=1 ! Modify u (likely from the outputs of another module or a set of test conditions) here: IF (n>0) THEN - CALL TMD_CopyInput( u(2), u(1), MESH_UPDATECOPY, ErrStat, ErrMsg ) + CALL StC_CopyInput( u(2), u(1), MESH_UPDATECOPY, ErrStat, ErrMsg ) ! u(1) = u(2) ! save past input as first element in input vector END IF i=1 @@ -741,12 +755,12 @@ PROGRAM TestTemplate ! setup input mesh with data from nacelle positions: do i = 1,3 do j=1,3 - u(2)%Mesh%Orientation(i,j,1) = APvec(count,n+1) + u(2)%Mesh(i_pt)%Orientation(i,j,1) = APvec(count,n+1) count = count+1 end do - u(2)%Mesh%RotationVel(i,1) = AVvec(i,n+1) - u(2)%Mesh%RotationAcc(i,1) = AAvec(i,n+1) - u(2)%Mesh%TranslationAcc(i,1) = LAvec(i,n+1) + u(2)%Mesh(i_pt)%RotationVel(i,1) = AVvec(i,n+1) + u(2)%Mesh(i_pt)%RotationAcc(i,1) = AAvec(i,n+1) + u(2)%Mesh(i_pt)%TranslationAcc(i,1) = LAvec(i,n+1) end do if (n==0) then InputTime(1) = 0 @@ -759,21 +773,21 @@ PROGRAM TestTemplate ! Calculate outputs at n - CALL TMD_CalcOutput( Time, u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) + CALL StC_CalcOutput( Time, u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary CALL WrScr( ErrMsg ) END IF ! Get state variables at next step: INPUT at step n, OUTPUT at step n + 1 - CALL TMD_UpdateStates( Time, n, u, InputTime, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) + CALL StC_UpdateStates( Time, n, u, InputTime, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary CALL WrScr( ErrMsg ) END IF ! write outputs to file - CALL TMD_WriteOutputFile(x, y, UnOut,ErrStat,ErrMsg) + CALL StC_WriteOutputFile(x, y, UnOut,ErrStat,ErrMsg) END DO ! close the output file -CALL TMD_CloseOutputFile(UnOut) +CALL StC_CloseOutputFile(UnOut) !............................................................................................................................... ! Routines called in tight coupling -- time marching only !............................................................................................................................... @@ -783,7 +797,7 @@ PROGRAM TestTemplate ! ! u = ! ! Update constraint states at Time ! ! DO - ! !CALL TMD_CalcConstrStateResidual( Time, u(1), p, x, xd, z, OtherState, Z_residual, ErrStat, ErrMsg ) + ! !CALL StC_CalcConstrStateResidual( Time, u(1), p, x, xd, z, OtherState, Z_residual, ErrStat, ErrMsg ) ! ! ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! ! CALL WrScr( ErrMsg ) @@ -791,20 +805,20 @@ PROGRAM TestTemplate ! ! z = ! ! END DO ! ! Calculate the outputs at Time - ! CALL TMD_CalcOutput( Time, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) + ! CALL StC_CalcOutput( Time, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) ! ! IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! CALL WrScr( ErrMsg ) ! END IF ! ! Calculate the continuous state derivatives at Time - ! CALL TMD_CalcContStateDeriv( Time, u(1), p, x, xd, z, OtherState, dxdt, ErrStat, ErrMsg ) + ! CALL StC_CalcContStateDeriv( Time, u(1), p, x, xd, z, OtherState, dxdt, ErrStat, ErrMsg ) ! ! IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! CALL WrScr( ErrMsg ) ! END IF ! ! Update the discrete state from step n to step n+1 ! ! Note that the discrete states must be updated only at the TimeInterval defined in initialization - ! !CALL TMD_UpdateDiscState( Time, n, u(1), p, x, xd, z, OtherState, ErrStat, ErrMsg ) + ! !CALL StC_UpdateDiscState( Time, n, u(1), p, x, xd, z, OtherState, ErrStat, ErrMsg ) ! ! ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! ! CALL WrScr( ErrMsg ) @@ -812,13 +826,13 @@ PROGRAM TestTemplate ! ! Driver should integrate (update) continuous states here: ! !x = function of dxdt, x ! ! Jacobians required: - ! !CALL TMD_JacobianPInput( Time, u(1), p, x, xd, z, OtherState, dYdu=dYdu, dZdu=dZdu, ErrStat=ErrStat, ErrMsg=ErrMsg ) + ! !CALL StC_JacobianPInput( Time, u(1), p, x, xd, z, OtherState, dYdu=dYdu, dZdu=dZdu, ErrStat=ErrStat, ErrMsg=ErrMsg ) ! ! ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! ! CALL WrScr( ErrMsg ) ! !END IF ! ! - ! !CALL TMD_JacobianPConstrState( Time, u(1), p, x, xd, z, OtherState, dYdz=dYdz, dZdz=dZdz, & + ! !CALL StC_JacobianPConstrState( Time, u(1), p, x, xd, z, OtherState, dYdz=dYdz, dZdz=dZdz, & ! !ErrStat=ErrStat, ErrMsg=ErrMsg ) ! ! ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary @@ -826,13 +840,13 @@ PROGRAM TestTemplate ! !END IF !END DO ! Destroy Z_residual and dxdt because they are not necessary anymore - CALL TMD_DestroyConstrState( Z_residual, ErrStat, ErrMsg ) + CALL StC_DestroyConstrState( Z_residual, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary CALL WrScr( ErrMsg ) END IF - CALL TMD_DestroyContState( dxdt, ErrStat, ErrMsg ) + CALL StC_DestroyContState( dxdt, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary CALL WrScr( ErrMsg ) @@ -841,24 +855,24 @@ PROGRAM TestTemplate !............................................................................................................................... ! Jacobian routines called in tight coupling !............................................................................................................................... - !CALL TMD_JacobianPInput( Time, u(1), p, x, xd, z, OtherState, dYdu, dXdu, dXddu, dZdu, ErrStat, ErrMsg ) + !CALL StC_JacobianPInput( Time, u(1), p, x, xd, z, OtherState, dYdu, dXdu, dXddu, dZdu, ErrStat, ErrMsg ) ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary !END IF ! - !CALL TMD_JacobianPContState( Time, u(1), p, x, xd, z, OtherState, dYdx, dXdx, dXddx, dZdx, ErrStat, ErrMsg ) + !CALL StC_JacobianPContState( Time, u(1), p, x, xd, z, OtherState, dYdx, dXdx, dXddx, dZdx, ErrStat, ErrMsg ) ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! CALL WrScr( ErrMsg ) !END IF ! - !CALL TMD_JacobianPDiscState( Time, u(1), p, x, xd, z, OtherState, dYdxd, dXdxd, dXddxd, dZdxd, ErrStat, ErrMsg ) + !CALL StC_JacobianPDiscState( Time, u(1), p, x, xd, z, OtherState, dYdxd, dXdxd, dXddxd, dZdxd, ErrStat, ErrMsg ) ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! CALL WrScr( ErrMsg ) !END IF ! - !CALL TMD_JacobianPConstrState( Time, u(1), p, x, xd, z, OtherState, dYdz, dXdz, dXddz, dZdz, ErrStat, ErrMsg ) + !CALL StC_JacobianPConstrState( Time, u(1), p, x, xd, z, OtherState, dYdz, dXdz, dXddz, dZdz, ErrStat, ErrMsg ) ! !IF ( ErrStat /= ErrID_None ) THEN ! Check if there was an error and do something about it if necessary ! CALL WrScr( ErrMsg ) @@ -866,7 +880,7 @@ PROGRAM TestTemplate !............................................................................................................................... ! Routines to pack data (to restart later) !............................................................................................................................... - !CALL TMD_Pack(Re_SaveAry, Db_SaveAry, Int_SaveAry, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg) + !CALL StC_Pack(Re_SaveAry, Db_SaveAry, Int_SaveAry, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) @@ -874,7 +888,7 @@ PROGRAM TestTemplate !............................................................................................................................... ! Routine to terminate program execution !............................................................................................................................... - CALL TMD_End( u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) + CALL StC_End( u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) @@ -882,7 +896,7 @@ PROGRAM TestTemplate !............................................................................................................................... ! Routines to retreive packed data (unpack for restart) !............................................................................................................................... - !CALL TMD_Unpack( Re_SaveAry, Db_SaveAry, Int_SaveAry, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) + !CALL StC_Unpack( Re_SaveAry, Db_SaveAry, Int_SaveAry, u(1), p, x, xd, z, OtherState, y, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) @@ -896,13 +910,13 @@ PROGRAM TestTemplate IF ( ALLOCATED( Re_SaveAry ) ) DEALLOCATE( Re_SaveAry ) IF ( ALLOCATED( Db_SaveAry ) ) DEALLOCATE( Db_SaveAry ) IF ( ALLOCATED( Int_SaveAry ) ) DEALLOCATE( Int_SaveAry ) - ! CALL TMD_DestroyPartialOutputPInput ( ) ! Jacobian Routine not yet implemented + ! CALL StC_DestroyPartialOutputPInput ( ) ! Jacobian Routine not yet implemented !............................................................................................................................... ! Routine to terminate program execution (again) !............................................................................................................................... - CALL TMD_End( u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) + CALL StC_End( u(1), p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) END IF -END PROGRAM TestTemplate \ No newline at end of file +END PROGRAM StrucCtrl_Driver diff --git a/modules/servodyn/src/StrucCtrl_Registry.txt b/modules/servodyn/src/StrucCtrl_Registry.txt new file mode 100644 index 0000000000..d28e73612e --- /dev/null +++ b/modules/servodyn/src/StrucCtrl_Registry.txt @@ -0,0 +1,189 @@ +################################################################################################################################### +# Registry for StrucCtrl in the FAST Modularization Framework +# This Registry file is used to create MODULE StrucCtrl_Types, which contains all of the user-defined types needed in StrucCtrl. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# Entries are of the form +# keyword +# +# Use ^ as a shortcut for the value from the previous line. +################################################################################################################################### +include Registry_NWTC_Library.txt + +# ..... Input File data ....................................................................................................... +typedef StrucCtrl/StC StC_InputFile CHARACTER(1024) StCFileName - - - "Name of the input file; remove if there is no file" - +typedef ^ ^ LOGICAL Echo - - - "Echo input file to echo file" - +typedef ^ ^ INTEGER StC_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} " - +typedef ^ ^ INTEGER StC_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - +typedef ^ ^ INTEGER StC_DOF_MODE - - - "DOF mode {0: NO StC_DOF; 1: StC_X_DOF and StC_Y_DOF; 2: StC_XY_DOF; 3: TLCD; 4: Prescribed force/moment time series}" - +typedef ^ ^ LOGICAL StC_X_DOF - - - "DOF on or off" - +typedef ^ ^ LOGICAL StC_Y_DOF - - - "DOF on or off" - +typedef ^ ^ LOGICAL StC_Z_DOF - - - "DOF on or off" - +typedef ^ ^ ReKi StC_X_DSP - - - "StC_X initial displacement" m +typedef ^ ^ ReKi StC_Y_DSP - - - "StC_Y initial displacement" m +typedef ^ ^ ReKi StC_Z_DSP - - - "StC_Z initial displacement" m +typedef ^ ^ ReKi StC_X_M - - - "StC X mass" kg +typedef ^ ^ ReKi StC_Y_M - - - "StC Y mass" kg +typedef ^ ^ ReKi StC_Z_M - - - "StC Z mass" kg +typedef ^ ^ ReKi StC_XY_M - - - "StC XY mass" kg +typedef ^ ^ ReKi StC_X_K - - - "StC X stiffness" "N/m" +typedef ^ ^ ReKi StC_Y_K - - - "StC Y stiffness" "N/m" +typedef ^ ^ ReKi StC_Z_K - - - "StC Y stiffness" "N/m" +typedef ^ ^ ReKi StC_X_C - - - "StC X damping" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C - - - "StC Y damping" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C - - - "StC Z damping" "N/(m/s)" +typedef ^ ^ ReKi StC_X_PSP - - - "Positive stop position (maximum X mass displacement)" m +typedef ^ ^ ReKi StC_X_NSP - - - "Negative stop position (minimum X mass displacement)" m +typedef ^ ^ ReKi StC_Y_PSP - - - "Positive stop position (maximum Y mass displacement)" m +typedef ^ ^ ReKi StC_Y_NSP - - - "Negative stop position (minimum Y mass displacement)" m +typedef ^ ^ ReKi StC_Z_PSP - - - "Positive stop position (maximum Z mass displacement)" m +typedef ^ ^ ReKi StC_Z_NSP - - - "Negative stop position (minimum Z mass displacement)" m +typedef ^ ^ ReKi StC_X_KS - - - "Stop spring X stiffness" "N/m" +typedef ^ ^ ReKi StC_X_CS - - - "Stop spring X damping" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_KS - - - "Stop spring Y stiffness" "N/m" +typedef ^ ^ ReKi StC_Y_CS - - - "Stop spring Y damping" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_KS - - - "Stop spring Z stiffness [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE]" "N/m" +typedef ^ ^ ReKi StC_Z_CS - - - "Stop spring Z damping [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE]" "N/(m/s)" +typedef ^ ^ ReKi StC_P_X - - - "StC X initial displacement (m) [relative to at rest position]" m +typedef ^ ^ ReKi StC_P_Y - - - "StC Y initial displacement (m) [relative to at rest position]" m +typedef ^ ^ ReKi StC_P_Z - - - "StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE]" m +typedef ^ ^ ReKi StC_X_C_HIGH - - - "StC X high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_X_C_LOW - - - "StC X low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_HIGH - - - "StC Y high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_LOW - - - "StC Y low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_HIGH - - - "StC Z high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_LOW - - - "StC Z low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_X_C_BRAKE - - - "StC X high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_BRAKE - - - "StC Y high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_BRAKE - - - "StC Z high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi L_X - - - "X TLCD total length" m +typedef ^ ^ ReKi B_X - - - "X TLCD horizontal length" m +typedef ^ ^ ReKi area_X - - - "X TLCD cross-sectional area of vertical column" "m^2" +typedef ^ ^ ReKi area_ratio_X - - - "X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area)" - +typedef ^ ^ ReKi headLossCoeff_X - - - "X TLCD head loss coeff" - +typedef ^ ^ ReKi rho_X - - - "X TLCD liquid density" "kg/m^3" +typedef ^ ^ ReKi L_Y - - - "Y TLCD total length" m +typedef ^ ^ ReKi B_Y - - - "Y TLCD horizontal length" m +typedef ^ ^ ReKi area_Y - - - "Side-Side TLCD cross-sectional area of vertical column" m +typedef ^ ^ ReKi area_ratio_Y - - - "Side-Side TLCD cross-sectional area ratio (vertical column area divided by horizontal column area)" - +typedef ^ ^ ReKi headLossCoeff_Y - - - "Side-Side TLCD head loss coeff" - +typedef ^ ^ ReKi rho_Y - - - "Side-Side TLCD liquid density" "kg/m^3" +typedef ^ ^ LOGICAL USE_F_TBL - - - "use spring force from user-defined table (flag)" - +typedef ^ ^ IntKi NKInpSt - - - "Number of input spring force rows in table" - +typedef ^ ^ CHARACTER(1024) StC_F_TBL_FILE - - - "user-defined spring table filename" - +typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" +typedef ^ ^ IntKi PrescribedForcesCoordSys - - - "Prescribed forces coordinate system {0: global; 1: local}" - +typedef ^ ^ CHARACTER(1024) PrescribedForcesFile - - - "Prescribed force time-series filename" - +typedef ^ ^ ReKi StC_PrescribedForce {:}{:} - - "StC prescribed force time-series info" "(s,N,N-m)" +# ..... Initialization data ....................................................................................................... +# Define inputs that the initialization routine may need here: +# e.g., the name of the input file, the file root name, etc. +typedef StrucCtrl/StC InitInputType CHARACTER(1024) InputFile - - - "Name of the input file; remove if there is no file" - +typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - +typedef ^ ^ ReKi Gravity {3} - - "Gravitational acceleration vector" "m/s^2" +typedef ^ InitInputType IntKi NumMeshPts - - - "Number of mesh points" - +typedef ^ InitInputType ReKi InitPosition {:}{:} - - "X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki InitOrientation {:}{:}{:} - - "DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades)" - +typedef ^ InitInputType LOGICAL UseInputFile - .TRUE. - "Read from the input file. If false, must parse the string info passed" - +typedef ^ InitInputType FileInfoType PassedPrimaryInputData - - - "Primary input file as FileInfoType (set by driver/glue code)" - +typedef ^ InitInputType LOGICAL UseInputFile_PrescribeFrc - .TRUE. - "Read from the input file. If false, must parse the string info passed" - +typedef ^ InitInputType FileInfoType PassedPrescribeFrcData - - - "Prescribed forces input file as FileInfoType (set by driver/glue code)" - + + +# Define outputs from the initialization routine here: +typedef ^ InitOutputType SiKi DummyInitOut - - - "dummy init output" - +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - +#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:}- - "Units of the output-to-file channels" - + +# ..... States .................................................................................................................... +# Define continuous (differentiable) states here: +typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - +typedef ^ ContinuousStateType ReKi StC_x {:}{:} - - "Continuous States -- StrucCtrl x" - +typedef ^ ContinuousStateType ReKi StC_xdot {:}{:} - - "Continuous States -- StrucCtrl xdot" - +# Define discrete (nondifferentiable) states here: +typedef ^ DiscreteStateType ReKi DummyDiscState - - - "Remove this variable if you have discrete states" - +# Define constraint states here: +typedef ^ ConstraintStateType ReKi DummyConstrState - - - "Remove this variable if you have constraint states" - +# Define any other states (e.g. logical states): +typedef ^ OtherStateType Reki DummyOtherState - - - "Remove this variable if you have other/logical states" - + +# Define any misc data used only for efficiency purposes (indices for searching in an array, copies of previous calculations of output +# at a given time, etc.) or other data that do not depend on time +typedef ^ MiscVarType Reki F_stop {:}{:} - - "Stop forces" - +typedef ^ MiscVarType ReKi F_ext {:}{:} - - "External forces (user defined)" - +typedef ^ MiscVarType ReKi F_fr {:}{:} - - "Friction forces" - +typedef ^ MiscVarType ReKi C_ctrl {:}{:} - - "Controlled Damping (On/Off)" - +typedef ^ MiscVarType ReKi C_Brake {:}{:} - - "Braking Damping" - +typedef ^ MiscVarType ReKi F_table {:}{:} - - "Tabled Stiffness" - +typedef ^ MiscVarType ReKi F_k {:}{:} - - "Factor for x and y-component stiffness force" - +typedef ^ MiscVarType ReKi a_G {:}{:} - - "Gravitational acceleration vector, local coordinates for point" m/s^2 +typedef ^ MiscVarType ReKi rdisp_P {:}{:} - - "Translational displacement vector, local coordinates for point" m +typedef ^ MiscVarType ReKi rdot_P {:}{:} - - "Translational velocity vector, local coordinates for point" m/s +typedef ^ MiscVarType ReKi rddot_P {:}{:} - - "Translational acceleration vector, local coordinates for point" m/s^2 +typedef ^ MiscVarType ReKi omega_P {:}{:} - - "Rotational velocity vector, local coordinates for point" rad/s +typedef ^ MiscVarType ReKi alpha_P {:}{:} - - "Rotational aceeleration vector, local coordinates for point" rad/s^2 +typedef ^ MiscVarType ReKi F_P {:}{:} - - "StC force vector, local coordinates for point" N +typedef ^ MiscVarType ReKi M_P {:}{:} - - "StC moment vector, local coordinates for point" N-m +typedef ^ MiscVarType ReKi Acc {:}{:} - - "StC aggregated acceleration in X,Y local coordinates for point" m/s^2 +typedef ^ MiscVarType IntKi PrescribedInterpIdx - - - "Index for interpolation of Prescribed force array" - + + +# ..... Parameters ................................................................................................................ +# Define parameters here: +# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: +typedef ^ ParameterType DbKi DT - - - "Time step for cont. state integration & disc. state update" seconds +typedef ^ ^ CHARACTER(1024) RootName - - - "RootName for writing output files" - +typedef ^ ^ INTEGER StC_DOF_MODE - - - "DOF mode {0: NO StC_DOF; 1: StC_X_DOF and StC_Y_DOF; 2: StC_XY_DOF; 3: TLCD; 4: Prescribed force/moment time series}" - +typedef ^ ^ LOGICAL StC_X_DOF - - - "DOF on or off" - +typedef ^ ^ LOGICAL StC_Y_DOF - - - "DOF on or off" - +typedef ^ ^ LOGICAL StC_Z_DOF - - - "DOF on or off" - +typedef ^ ^ ReKi M_X - - - "StC mass" kg +typedef ^ ^ ReKi M_Y - - - "StC mass" kg +typedef ^ ^ ReKi M_Z - - - "StC mass" kg +typedef ^ ^ ReKi M_XY - - - "StCXY mass" kg +typedef ^ ^ ReKi K_X - - - "StC stiffness" "N/m" +typedef ^ ^ ReKi K_Y - - - "StC stiffness" "N/m" +typedef ^ ^ ReKi K_Z - - - "StC stiffness" "N/m" +typedef ^ ^ ReKi C_X - - - "StC damping" "N/(m/s)" +typedef ^ ^ ReKi C_Y - - - "StC damping" "N/(m/s)" +typedef ^ ^ ReKi C_Z - - - "StC damping" "N/(m/s)" +typedef ^ ^ ReKi K_S {3} - - "StC stop stiffness" "N/m" +typedef ^ ^ ReKi C_S {3} - - "StC stop damping" "N/(m/s)" +typedef ^ ^ ReKi P_SP {3} - - "Positive stop position (maximum mass displacement)" m +typedef ^ ^ ReKi N_SP {3} - - "Negative stop position (minimum X mass displacement)" m +typedef ^ ^ ReKi Gravity {3} - - "Gravitational acceleration vector" "m/s^2" +typedef ^ ^ INTEGER StC_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} " - +typedef ^ ^ INTEGER StC_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - +typedef ^ ^ ReKi StC_X_C_HIGH - - - "StC X high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_X_C_LOW - - - "StC X low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_HIGH - - - "StC Y high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_LOW - - - "StC Y low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_HIGH - - - "StC Z high damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_LOW - - - "StC Z low damping for ground hook control" "N/(m/s)" +typedef ^ ^ ReKi StC_X_C_BRAKE - - - "StC X high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi StC_Y_C_BRAKE - - - "StC Y high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi StC_Z_C_BRAKE - - - "StC Y high damping for braking the StC" "N/(m/s)" +typedef ^ ^ ReKi L_X - - - "X TLCD total length" m +typedef ^ ^ ReKi B_X - - - "X TLCD horizontal length" m +typedef ^ ^ ReKi area_X - - - "X TLCD cross-sectional area of vertical column" "m^2" +typedef ^ ^ ReKi area_ratio_X - - - "X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area)" - +typedef ^ ^ ReKi headLossCoeff_X - - - "X TLCD head loss coeff" - +typedef ^ ^ ReKi rho_X - - - "X TLCD liquid density" "kg/m^3" +typedef ^ ^ ReKi L_Y - - - "Y TLCD total length" m +typedef ^ ^ ReKi B_Y - - - "Y TLCD horizontal length" m +typedef ^ ^ ReKi area_Y - - - "Side-Side TLCD cross-sectional area of vertical column" m +typedef ^ ^ ReKi area_ratio_Y - - - "Side-Side TLCD cross-sectional area ratio (vertical column area divided by horizontal column area)" - +typedef ^ ^ ReKi headLossCoeff_Y - - - "Side-Side TLCD head loss coeff" - +typedef ^ ^ ReKi rho_Y - - - "Side-Side TLCD liquid density" "kg/m^3" +typedef ^ ^ LOGICAL Use_F_TBL - - - "use spring force from user-defined table (flag)" - +typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" +typedef ^ ParameterType IntKi NumMeshPts - - - "Number of mesh points" - +typedef ^ ^ IntKi PrescribedForcesCoordSys - - - "Prescribed forces coordinate system {0: global; 1: local}" - +typedef ^ ^ ReKi StC_PrescribedForce {:}{:} - - "StC prescribed force time-series info" "(s,N,N-m)" +# ..... Inputs .................................................................................................................... +# Define inputs that are contained on the mesh here: +typedef ^ InputType MeshType Mesh {:} - - "Displacements at the StC reference point(s) P in the inertial frame" - +# ..... Outputs ................................................................................................................... +# Define outputs that are contained on the mesh here: +typedef ^ OutputType MeshType Mesh {:} - - "Loads at the StC reference points in the inertial frame" - +# Define outputs that are not on this mesh here: +#typedef ^ OutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" diff --git a/modules/servodyn/src/StrucCtrl_Types.f90 b/modules/servodyn/src/StrucCtrl_Types.f90 new file mode 100644 index 0000000000..6e56561efa --- /dev/null +++ b/modules/servodyn/src/StrucCtrl_Types.f90 @@ -0,0 +1,4723 @@ +!STARTOFREGISTRYGENERATEDFILE 'StrucCtrl_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! StrucCtrl_Types +!................................................................................................................................. +! This file is part of StrucCtrl. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in StrucCtrl. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE StrucCtrl_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE NWTC_Library +IMPLICIT NONE +! ========= StC_InputFile ======= + TYPE, PUBLIC :: StC_InputFile + CHARACTER(1024) :: StCFileName !< Name of the input file; remove if there is no file [-] + LOGICAL :: Echo !< Echo input file to echo file [-] + INTEGER(IntKi) :: StC_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} [-] + INTEGER(IntKi) :: StC_SA_MODE !< Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} [-] + INTEGER(IntKi) :: StC_DOF_MODE !< DOF mode {0: NO StC_DOF; 1: StC_X_DOF and StC_Y_DOF; 2: StC_XY_DOF; 3: TLCD; 4: Prescribed force/moment time series} [-] + LOGICAL :: StC_X_DOF !< DOF on or off [-] + LOGICAL :: StC_Y_DOF !< DOF on or off [-] + LOGICAL :: StC_Z_DOF !< DOF on or off [-] + REAL(ReKi) :: StC_X_DSP !< StC_X initial displacement [m] + REAL(ReKi) :: StC_Y_DSP !< StC_Y initial displacement [m] + REAL(ReKi) :: StC_Z_DSP !< StC_Z initial displacement [m] + REAL(ReKi) :: StC_X_M !< StC X mass [kg] + REAL(ReKi) :: StC_Y_M !< StC Y mass [kg] + REAL(ReKi) :: StC_Z_M !< StC Z mass [kg] + REAL(ReKi) :: StC_XY_M !< StC XY mass [kg] + REAL(ReKi) :: StC_X_K !< StC X stiffness [N/m] + REAL(ReKi) :: StC_Y_K !< StC Y stiffness [N/m] + REAL(ReKi) :: StC_Z_K !< StC Y stiffness [N/m] + REAL(ReKi) :: StC_X_C !< StC X damping [N/(m/s)] + REAL(ReKi) :: StC_Y_C !< StC Y damping [N/(m/s)] + REAL(ReKi) :: StC_Z_C !< StC Z damping [N/(m/s)] + REAL(ReKi) :: StC_X_PSP !< Positive stop position (maximum X mass displacement) [m] + REAL(ReKi) :: StC_X_NSP !< Negative stop position (minimum X mass displacement) [m] + REAL(ReKi) :: StC_Y_PSP !< Positive stop position (maximum Y mass displacement) [m] + REAL(ReKi) :: StC_Y_NSP !< Negative stop position (minimum Y mass displacement) [m] + REAL(ReKi) :: StC_Z_PSP !< Positive stop position (maximum Z mass displacement) [m] + REAL(ReKi) :: StC_Z_NSP !< Negative stop position (minimum Z mass displacement) [m] + REAL(ReKi) :: StC_X_KS !< Stop spring X stiffness [N/m] + REAL(ReKi) :: StC_X_CS !< Stop spring X damping [N/(m/s)] + REAL(ReKi) :: StC_Y_KS !< Stop spring Y stiffness [N/m] + REAL(ReKi) :: StC_Y_CS !< Stop spring Y damping [N/(m/s)] + REAL(ReKi) :: StC_Z_KS !< Stop spring Z stiffness [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] [N/m] + REAL(ReKi) :: StC_Z_CS !< Stop spring Z damping [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] [N/(m/s)] + REAL(ReKi) :: StC_P_X !< StC X initial displacement (m) [relative to at rest position] [m] + REAL(ReKi) :: StC_P_Y !< StC Y initial displacement (m) [relative to at rest position] [m] + REAL(ReKi) :: StC_P_Z !< StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] [m] + REAL(ReKi) :: StC_X_C_HIGH !< StC X high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_X_C_LOW !< StC X low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Y_C_HIGH !< StC Y high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Y_C_LOW !< StC Y low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Z_C_HIGH !< StC Z high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Z_C_LOW !< StC Z low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_X_C_BRAKE !< StC X high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: StC_Y_C_BRAKE !< StC Y high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: StC_Z_C_BRAKE !< StC Z high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: L_X !< X TLCD total length [m] + REAL(ReKi) :: B_X !< X TLCD horizontal length [m] + REAL(ReKi) :: area_X !< X TLCD cross-sectional area of vertical column [m^2] + REAL(ReKi) :: area_ratio_X !< X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) [-] + REAL(ReKi) :: headLossCoeff_X !< X TLCD head loss coeff [-] + REAL(ReKi) :: rho_X !< X TLCD liquid density [kg/m^3] + REAL(ReKi) :: L_Y !< Y TLCD total length [m] + REAL(ReKi) :: B_Y !< Y TLCD horizontal length [m] + REAL(ReKi) :: area_Y !< Side-Side TLCD cross-sectional area of vertical column [m] + REAL(ReKi) :: area_ratio_Y !< Side-Side TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) [-] + REAL(ReKi) :: headLossCoeff_Y !< Side-Side TLCD head loss coeff [-] + REAL(ReKi) :: rho_Y !< Side-Side TLCD liquid density [kg/m^3] + LOGICAL :: USE_F_TBL !< use spring force from user-defined table (flag) [-] + INTEGER(IntKi) :: NKInpSt !< Number of input spring force rows in table [-] + CHARACTER(1024) :: StC_F_TBL_FILE !< user-defined spring table filename [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_TBL !< user-defined spring force [N] + INTEGER(IntKi) :: PrescribedForcesCoordSys !< Prescribed forces coordinate system {0: global; 1: local} [-] + CHARACTER(1024) :: PrescribedForcesFile !< Prescribed force time-series filename [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_PrescribedForce !< StC prescribed force time-series info [(s,N,N-m)] + END TYPE StC_InputFile +! ======================= +! ========= StC_InitInputType ======= + TYPE, PUBLIC :: StC_InitInputType + CHARACTER(1024) :: InputFile !< Name of the input file; remove if there is no file [-] + CHARACTER(1024) :: RootName !< RootName for writing output files [-] + REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] + INTEGER(IntKi) :: NumMeshPts !< Number of mesh points [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: InitPosition !< X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: InitOrientation !< DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades) [-] + LOGICAL :: UseInputFile = .TRUE. !< Read from the input file. If false, must parse the string info passed [-] + TYPE(FileInfoType) :: PassedPrimaryInputData !< Primary input file as FileInfoType (set by driver/glue code) [-] + LOGICAL :: UseInputFile_PrescribeFrc = .TRUE. !< Read from the input file. If false, must parse the string info passed [-] + TYPE(FileInfoType) :: PassedPrescribeFrcData !< Prescribed forces input file as FileInfoType (set by driver/glue code) [-] + END TYPE StC_InitInputType +! ======================= +! ========= StC_InitOutputType ======= + TYPE, PUBLIC :: StC_InitOutputType + REAL(SiKi) :: DummyInitOut !< dummy init output [-] + END TYPE StC_InitOutputType +! ======================= +! ========= StC_ContinuousStateType ======= + TYPE, PUBLIC :: StC_ContinuousStateType + REAL(ReKi) :: DummyContState !< Remove this variable if you have continuous states [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_x !< Continuous States -- StrucCtrl x [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_xdot !< Continuous States -- StrucCtrl xdot [-] + END TYPE StC_ContinuousStateType +! ======================= +! ========= StC_DiscreteStateType ======= + TYPE, PUBLIC :: StC_DiscreteStateType + REAL(ReKi) :: DummyDiscState !< Remove this variable if you have discrete states [-] + END TYPE StC_DiscreteStateType +! ======================= +! ========= StC_ConstraintStateType ======= + TYPE, PUBLIC :: StC_ConstraintStateType + REAL(ReKi) :: DummyConstrState !< Remove this variable if you have constraint states [-] + END TYPE StC_ConstraintStateType +! ======================= +! ========= StC_OtherStateType ======= + TYPE, PUBLIC :: StC_OtherStateType + REAL(ReKi) :: DummyOtherState !< Remove this variable if you have other/logical states [-] + END TYPE StC_OtherStateType +! ======================= +! ========= StC_MiscVarType ======= + TYPE, PUBLIC :: StC_MiscVarType + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_stop !< Stop forces [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_ext !< External forces (user defined) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_fr !< Friction forces [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: C_ctrl !< Controlled Damping (On/Off) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: C_Brake !< Braking Damping [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_table !< Tabled Stiffness [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_k !< Factor for x and y-component stiffness force [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: a_G !< Gravitational acceleration vector, local coordinates for point [m/s^2] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: rdisp_P !< Translational displacement vector, local coordinates for point [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: rdot_P !< Translational velocity vector, local coordinates for point [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: rddot_P !< Translational acceleration vector, local coordinates for point [m/s^2] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: omega_P !< Rotational velocity vector, local coordinates for point [rad/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: alpha_P !< Rotational aceeleration vector, local coordinates for point [rad/s^2] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_P !< StC force vector, local coordinates for point [N] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: M_P !< StC moment vector, local coordinates for point [N-m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Acc !< StC aggregated acceleration in X,Y local coordinates for point [m/s^2] + INTEGER(IntKi) :: PrescribedInterpIdx !< Index for interpolation of Prescribed force array [-] + END TYPE StC_MiscVarType +! ======================= +! ========= StC_ParameterType ======= + TYPE, PUBLIC :: StC_ParameterType + REAL(DbKi) :: DT !< Time step for cont. state integration & disc. state update [seconds] + CHARACTER(1024) :: RootName !< RootName for writing output files [-] + INTEGER(IntKi) :: StC_DOF_MODE !< DOF mode {0: NO StC_DOF; 1: StC_X_DOF and StC_Y_DOF; 2: StC_XY_DOF; 3: TLCD; 4: Prescribed force/moment time series} [-] + LOGICAL :: StC_X_DOF !< DOF on or off [-] + LOGICAL :: StC_Y_DOF !< DOF on or off [-] + LOGICAL :: StC_Z_DOF !< DOF on or off [-] + REAL(ReKi) :: M_X !< StC mass [kg] + REAL(ReKi) :: M_Y !< StC mass [kg] + REAL(ReKi) :: M_Z !< StC mass [kg] + REAL(ReKi) :: M_XY !< StCXY mass [kg] + REAL(ReKi) :: K_X !< StC stiffness [N/m] + REAL(ReKi) :: K_Y !< StC stiffness [N/m] + REAL(ReKi) :: K_Z !< StC stiffness [N/m] + REAL(ReKi) :: C_X !< StC damping [N/(m/s)] + REAL(ReKi) :: C_Y !< StC damping [N/(m/s)] + REAL(ReKi) :: C_Z !< StC damping [N/(m/s)] + REAL(ReKi) , DIMENSION(1:3) :: K_S !< StC stop stiffness [N/m] + REAL(ReKi) , DIMENSION(1:3) :: C_S !< StC stop damping [N/(m/s)] + REAL(ReKi) , DIMENSION(1:3) :: P_SP !< Positive stop position (maximum mass displacement) [m] + REAL(ReKi) , DIMENSION(1:3) :: N_SP !< Negative stop position (minimum X mass displacement) [m] + REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] + INTEGER(IntKi) :: StC_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} [-] + INTEGER(IntKi) :: StC_SA_MODE !< Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} [-] + REAL(ReKi) :: StC_X_C_HIGH !< StC X high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_X_C_LOW !< StC X low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Y_C_HIGH !< StC Y high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Y_C_LOW !< StC Y low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Z_C_HIGH !< StC Z high damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_Z_C_LOW !< StC Z low damping for ground hook control [N/(m/s)] + REAL(ReKi) :: StC_X_C_BRAKE !< StC X high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: StC_Y_C_BRAKE !< StC Y high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: StC_Z_C_BRAKE !< StC Y high damping for braking the StC [N/(m/s)] + REAL(ReKi) :: L_X !< X TLCD total length [m] + REAL(ReKi) :: B_X !< X TLCD horizontal length [m] + REAL(ReKi) :: area_X !< X TLCD cross-sectional area of vertical column [m^2] + REAL(ReKi) :: area_ratio_X !< X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) [-] + REAL(ReKi) :: headLossCoeff_X !< X TLCD head loss coeff [-] + REAL(ReKi) :: rho_X !< X TLCD liquid density [kg/m^3] + REAL(ReKi) :: L_Y !< Y TLCD total length [m] + REAL(ReKi) :: B_Y !< Y TLCD horizontal length [m] + REAL(ReKi) :: area_Y !< Side-Side TLCD cross-sectional area of vertical column [m] + REAL(ReKi) :: area_ratio_Y !< Side-Side TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) [-] + REAL(ReKi) :: headLossCoeff_Y !< Side-Side TLCD head loss coeff [-] + REAL(ReKi) :: rho_Y !< Side-Side TLCD liquid density [kg/m^3] + LOGICAL :: Use_F_TBL !< use spring force from user-defined table (flag) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_TBL !< user-defined spring force [N] + INTEGER(IntKi) :: NumMeshPts !< Number of mesh points [-] + INTEGER(IntKi) :: PrescribedForcesCoordSys !< Prescribed forces coordinate system {0: global; 1: local} [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_PrescribedForce !< StC prescribed force time-series info [(s,N,N-m)] + END TYPE StC_ParameterType +! ======================= +! ========= StC_InputType ======= + TYPE, PUBLIC :: StC_InputType + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: Mesh !< Displacements at the StC reference point(s) P in the inertial frame [-] + END TYPE StC_InputType +! ======================= +! ========= StC_OutputType ======= + TYPE, PUBLIC :: StC_OutputType + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: Mesh !< Loads at the StC reference points in the inertial frame [-] + END TYPE StC_OutputType +! ======================= +CONTAINS + SUBROUTINE StC_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_InputFile), INTENT(IN) :: SrcInputFileData + TYPE(StC_InputFile), INTENT(INOUT) :: DstInputFileData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInputFile' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInputFileData%StCFileName = SrcInputFileData%StCFileName + DstInputFileData%Echo = SrcInputFileData%Echo + DstInputFileData%StC_CMODE = SrcInputFileData%StC_CMODE + DstInputFileData%StC_SA_MODE = SrcInputFileData%StC_SA_MODE + DstInputFileData%StC_DOF_MODE = SrcInputFileData%StC_DOF_MODE + DstInputFileData%StC_X_DOF = SrcInputFileData%StC_X_DOF + DstInputFileData%StC_Y_DOF = SrcInputFileData%StC_Y_DOF + DstInputFileData%StC_Z_DOF = SrcInputFileData%StC_Z_DOF + DstInputFileData%StC_X_DSP = SrcInputFileData%StC_X_DSP + DstInputFileData%StC_Y_DSP = SrcInputFileData%StC_Y_DSP + DstInputFileData%StC_Z_DSP = SrcInputFileData%StC_Z_DSP + DstInputFileData%StC_X_M = SrcInputFileData%StC_X_M + DstInputFileData%StC_Y_M = SrcInputFileData%StC_Y_M + DstInputFileData%StC_Z_M = SrcInputFileData%StC_Z_M + DstInputFileData%StC_XY_M = SrcInputFileData%StC_XY_M + DstInputFileData%StC_X_K = SrcInputFileData%StC_X_K + DstInputFileData%StC_Y_K = SrcInputFileData%StC_Y_K + DstInputFileData%StC_Z_K = SrcInputFileData%StC_Z_K + DstInputFileData%StC_X_C = SrcInputFileData%StC_X_C + DstInputFileData%StC_Y_C = SrcInputFileData%StC_Y_C + DstInputFileData%StC_Z_C = SrcInputFileData%StC_Z_C + DstInputFileData%StC_X_PSP = SrcInputFileData%StC_X_PSP + DstInputFileData%StC_X_NSP = SrcInputFileData%StC_X_NSP + DstInputFileData%StC_Y_PSP = SrcInputFileData%StC_Y_PSP + DstInputFileData%StC_Y_NSP = SrcInputFileData%StC_Y_NSP + DstInputFileData%StC_Z_PSP = SrcInputFileData%StC_Z_PSP + DstInputFileData%StC_Z_NSP = SrcInputFileData%StC_Z_NSP + DstInputFileData%StC_X_KS = SrcInputFileData%StC_X_KS + DstInputFileData%StC_X_CS = SrcInputFileData%StC_X_CS + DstInputFileData%StC_Y_KS = SrcInputFileData%StC_Y_KS + DstInputFileData%StC_Y_CS = SrcInputFileData%StC_Y_CS + DstInputFileData%StC_Z_KS = SrcInputFileData%StC_Z_KS + DstInputFileData%StC_Z_CS = SrcInputFileData%StC_Z_CS + DstInputFileData%StC_P_X = SrcInputFileData%StC_P_X + DstInputFileData%StC_P_Y = SrcInputFileData%StC_P_Y + DstInputFileData%StC_P_Z = SrcInputFileData%StC_P_Z + DstInputFileData%StC_X_C_HIGH = SrcInputFileData%StC_X_C_HIGH + DstInputFileData%StC_X_C_LOW = SrcInputFileData%StC_X_C_LOW + DstInputFileData%StC_Y_C_HIGH = SrcInputFileData%StC_Y_C_HIGH + DstInputFileData%StC_Y_C_LOW = SrcInputFileData%StC_Y_C_LOW + DstInputFileData%StC_Z_C_HIGH = SrcInputFileData%StC_Z_C_HIGH + DstInputFileData%StC_Z_C_LOW = SrcInputFileData%StC_Z_C_LOW + DstInputFileData%StC_X_C_BRAKE = SrcInputFileData%StC_X_C_BRAKE + DstInputFileData%StC_Y_C_BRAKE = SrcInputFileData%StC_Y_C_BRAKE + DstInputFileData%StC_Z_C_BRAKE = SrcInputFileData%StC_Z_C_BRAKE + DstInputFileData%L_X = SrcInputFileData%L_X + DstInputFileData%B_X = SrcInputFileData%B_X + DstInputFileData%area_X = SrcInputFileData%area_X + DstInputFileData%area_ratio_X = SrcInputFileData%area_ratio_X + DstInputFileData%headLossCoeff_X = SrcInputFileData%headLossCoeff_X + DstInputFileData%rho_X = SrcInputFileData%rho_X + DstInputFileData%L_Y = SrcInputFileData%L_Y + DstInputFileData%B_Y = SrcInputFileData%B_Y + DstInputFileData%area_Y = SrcInputFileData%area_Y + DstInputFileData%area_ratio_Y = SrcInputFileData%area_ratio_Y + DstInputFileData%headLossCoeff_Y = SrcInputFileData%headLossCoeff_Y + DstInputFileData%rho_Y = SrcInputFileData%rho_Y + DstInputFileData%USE_F_TBL = SrcInputFileData%USE_F_TBL + DstInputFileData%NKInpSt = SrcInputFileData%NKInpSt + DstInputFileData%StC_F_TBL_FILE = SrcInputFileData%StC_F_TBL_FILE +IF (ALLOCATED(SrcInputFileData%F_TBL)) THEN + i1_l = LBOUND(SrcInputFileData%F_TBL,1) + i1_u = UBOUND(SrcInputFileData%F_TBL,1) + i2_l = LBOUND(SrcInputFileData%F_TBL,2) + i2_u = UBOUND(SrcInputFileData%F_TBL,2) + IF (.NOT. ALLOCATED(DstInputFileData%F_TBL)) THEN + ALLOCATE(DstInputFileData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%F_TBL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%F_TBL = SrcInputFileData%F_TBL +ENDIF + DstInputFileData%PrescribedForcesCoordSys = SrcInputFileData%PrescribedForcesCoordSys + DstInputFileData%PrescribedForcesFile = SrcInputFileData%PrescribedForcesFile +IF (ALLOCATED(SrcInputFileData%StC_PrescribedForce)) THEN + i1_l = LBOUND(SrcInputFileData%StC_PrescribedForce,1) + i1_u = UBOUND(SrcInputFileData%StC_PrescribedForce,1) + i2_l = LBOUND(SrcInputFileData%StC_PrescribedForce,2) + i2_u = UBOUND(SrcInputFileData%StC_PrescribedForce,2) + IF (.NOT. ALLOCATED(DstInputFileData%StC_PrescribedForce)) THEN + ALLOCATE(DstInputFileData%StC_PrescribedForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%StC_PrescribedForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%StC_PrescribedForce = SrcInputFileData%StC_PrescribedForce +ENDIF + END SUBROUTINE StC_CopyInputFile + + SUBROUTINE StC_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) + TYPE(StC_InputFile), INTENT(INOUT) :: InputFileData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInputFile' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputFileData%F_TBL)) THEN + DEALLOCATE(InputFileData%F_TBL) +ENDIF +IF (ALLOCATED(InputFileData%StC_PrescribedForce)) THEN + DEALLOCATE(InputFileData%StC_PrescribedForce) +ENDIF + END SUBROUTINE StC_DestroyInputFile + + SUBROUTINE StC_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_InputFile), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInputFile' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1*LEN(InData%StCFileName) ! StCFileName + Int_BufSz = Int_BufSz + 1 ! Echo + Int_BufSz = Int_BufSz + 1 ! StC_CMODE + Int_BufSz = Int_BufSz + 1 ! StC_SA_MODE + Int_BufSz = Int_BufSz + 1 ! StC_DOF_MODE + Int_BufSz = Int_BufSz + 1 ! StC_X_DOF + Int_BufSz = Int_BufSz + 1 ! StC_Y_DOF + Int_BufSz = Int_BufSz + 1 ! StC_Z_DOF + Re_BufSz = Re_BufSz + 1 ! StC_X_DSP + Re_BufSz = Re_BufSz + 1 ! StC_Y_DSP + Re_BufSz = Re_BufSz + 1 ! StC_Z_DSP + Re_BufSz = Re_BufSz + 1 ! StC_X_M + Re_BufSz = Re_BufSz + 1 ! StC_Y_M + Re_BufSz = Re_BufSz + 1 ! StC_Z_M + Re_BufSz = Re_BufSz + 1 ! StC_XY_M + Re_BufSz = Re_BufSz + 1 ! StC_X_K + Re_BufSz = Re_BufSz + 1 ! StC_Y_K + Re_BufSz = Re_BufSz + 1 ! StC_Z_K + Re_BufSz = Re_BufSz + 1 ! StC_X_C + Re_BufSz = Re_BufSz + 1 ! StC_Y_C + Re_BufSz = Re_BufSz + 1 ! StC_Z_C + Re_BufSz = Re_BufSz + 1 ! StC_X_PSP + Re_BufSz = Re_BufSz + 1 ! StC_X_NSP + Re_BufSz = Re_BufSz + 1 ! StC_Y_PSP + Re_BufSz = Re_BufSz + 1 ! StC_Y_NSP + Re_BufSz = Re_BufSz + 1 ! StC_Z_PSP + Re_BufSz = Re_BufSz + 1 ! StC_Z_NSP + Re_BufSz = Re_BufSz + 1 ! StC_X_KS + Re_BufSz = Re_BufSz + 1 ! StC_X_CS + Re_BufSz = Re_BufSz + 1 ! StC_Y_KS + Re_BufSz = Re_BufSz + 1 ! StC_Y_CS + Re_BufSz = Re_BufSz + 1 ! StC_Z_KS + Re_BufSz = Re_BufSz + 1 ! StC_Z_CS + Re_BufSz = Re_BufSz + 1 ! StC_P_X + Re_BufSz = Re_BufSz + 1 ! StC_P_Y + Re_BufSz = Re_BufSz + 1 ! StC_P_Z + Re_BufSz = Re_BufSz + 1 ! StC_X_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_X_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_X_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! L_X + Re_BufSz = Re_BufSz + 1 ! B_X + Re_BufSz = Re_BufSz + 1 ! area_X + Re_BufSz = Re_BufSz + 1 ! area_ratio_X + Re_BufSz = Re_BufSz + 1 ! headLossCoeff_X + Re_BufSz = Re_BufSz + 1 ! rho_X + Re_BufSz = Re_BufSz + 1 ! L_Y + Re_BufSz = Re_BufSz + 1 ! B_Y + Re_BufSz = Re_BufSz + 1 ! area_Y + Re_BufSz = Re_BufSz + 1 ! area_ratio_Y + Re_BufSz = Re_BufSz + 1 ! headLossCoeff_Y + Re_BufSz = Re_BufSz + 1 ! rho_Y + Int_BufSz = Int_BufSz + 1 ! USE_F_TBL + Int_BufSz = Int_BufSz + 1 ! NKInpSt + Int_BufSz = Int_BufSz + 1*LEN(InData%StC_F_TBL_FILE) ! StC_F_TBL_FILE + Int_BufSz = Int_BufSz + 1 ! F_TBL allocated yes/no + IF ( ALLOCATED(InData%F_TBL) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_TBL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_TBL) ! F_TBL + END IF + Int_BufSz = Int_BufSz + 1 ! PrescribedForcesCoordSys + Int_BufSz = Int_BufSz + 1*LEN(InData%PrescribedForcesFile) ! PrescribedForcesFile + Int_BufSz = Int_BufSz + 1 ! StC_PrescribedForce allocated yes/no + IF ( ALLOCATED(InData%StC_PrescribedForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StC_PrescribedForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StC_PrescribedForce) ! StC_PrescribedForce + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DO I = 1, LEN(InData%StCFileName) + IntKiBuf(Int_Xferred) = ICHAR(InData%StCFileName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = TRANSFER(InData%Echo, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%StC_CMODE + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%StC_SA_MODE + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%StC_DOF_MODE + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_X_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_Y_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_Z_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_DSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_DSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_DSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_M + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_M + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_M + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_XY_M + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_K + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_K + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_K + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_PSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_NSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_PSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_NSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_PSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_NSP + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_KS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_CS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_KS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_CS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_KS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_CS + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_P_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_P_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_P_Z + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%L_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%B_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_ratio_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%headLossCoeff_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%rho_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%L_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%B_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_ratio_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%headLossCoeff_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%rho_Y + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%USE_F_TBL, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NKInpSt + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%StC_F_TBL_FILE) + IntKiBuf(Int_Xferred) = ICHAR(InData%StC_F_TBL_FILE(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%F_TBL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_TBL,2), UBOUND(InData%F_TBL,2) + DO i1 = LBOUND(InData%F_TBL,1), UBOUND(InData%F_TBL,1) + ReKiBuf(Re_Xferred) = InData%F_TBL(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = InData%PrescribedForcesCoordSys + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%PrescribedForcesFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%PrescribedForcesFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( .NOT. ALLOCATED(InData%StC_PrescribedForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_PrescribedForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_PrescribedForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_PrescribedForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_PrescribedForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StC_PrescribedForce,2), UBOUND(InData%StC_PrescribedForce,2) + DO i1 = LBOUND(InData%StC_PrescribedForce,1), UBOUND(InData%StC_PrescribedForce,1) + ReKiBuf(Re_Xferred) = InData%StC_PrescribedForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_PackInputFile + + SUBROUTINE StC_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_InputFile), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInputFile' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + DO I = 1, LEN(OutData%StCFileName) + OutData%StCFileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%Echo = TRANSFER(IntKiBuf(Int_Xferred), OutData%Echo) + Int_Xferred = Int_Xferred + 1 + OutData%StC_CMODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_SA_MODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_DOF_MODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_X_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_X_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%StC_Y_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_Y_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%StC_Z_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_Z_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%StC_X_DSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_DSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_DSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_M = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_M = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_M = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_XY_M = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_K = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_K = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_K = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_PSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_NSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_PSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_NSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_PSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_NSP = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_KS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_CS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_KS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_CS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_KS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_CS = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_P_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_P_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_P_Z = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%L_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%B_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_ratio_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%headLossCoeff_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%rho_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%L_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%B_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_ratio_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%headLossCoeff_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%rho_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%USE_F_TBL = TRANSFER(IntKiBuf(Int_Xferred), OutData%USE_F_TBL) + Int_Xferred = Int_Xferred + 1 + OutData%NKInpSt = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%StC_F_TBL_FILE) + OutData%StC_F_TBL_FILE(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_TBL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_TBL)) DEALLOCATE(OutData%F_TBL) + ALLOCATE(OutData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_TBL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_TBL,2), UBOUND(OutData%F_TBL,2) + DO i1 = LBOUND(OutData%F_TBL,1), UBOUND(OutData%F_TBL,1) + OutData%F_TBL(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%PrescribedForcesCoordSys = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(OutData%PrescribedForcesFile) + OutData%PrescribedForcesFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_PrescribedForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_PrescribedForce)) DEALLOCATE(OutData%StC_PrescribedForce) + ALLOCATE(OutData%StC_PrescribedForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_PrescribedForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StC_PrescribedForce,2), UBOUND(OutData%StC_PrescribedForce,2) + DO i1 = LBOUND(OutData%StC_PrescribedForce,1), UBOUND(OutData%StC_PrescribedForce,1) + OutData%StC_PrescribedForce(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_UnPackInputFile + + SUBROUTINE StC_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(StC_InitInputType), INTENT(INOUT) :: DstInitInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInitInputData%InputFile = SrcInitInputData%InputFile + DstInitInputData%RootName = SrcInitInputData%RootName + DstInitInputData%Gravity = SrcInitInputData%Gravity + DstInitInputData%NumMeshPts = SrcInitInputData%NumMeshPts +IF (ALLOCATED(SrcInitInputData%InitPosition)) THEN + i1_l = LBOUND(SrcInitInputData%InitPosition,1) + i1_u = UBOUND(SrcInitInputData%InitPosition,1) + i2_l = LBOUND(SrcInitInputData%InitPosition,2) + i2_u = UBOUND(SrcInitInputData%InitPosition,2) + IF (.NOT. ALLOCATED(DstInitInputData%InitPosition)) THEN + ALLOCATE(DstInitInputData%InitPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%InitPosition = SrcInitInputData%InitPosition +ENDIF +IF (ALLOCATED(SrcInitInputData%InitOrientation)) THEN + i1_l = LBOUND(SrcInitInputData%InitOrientation,1) + i1_u = UBOUND(SrcInitInputData%InitOrientation,1) + i2_l = LBOUND(SrcInitInputData%InitOrientation,2) + i2_u = UBOUND(SrcInitInputData%InitOrientation,2) + i3_l = LBOUND(SrcInitInputData%InitOrientation,3) + i3_u = UBOUND(SrcInitInputData%InitOrientation,3) + IF (.NOT. ALLOCATED(DstInitInputData%InitOrientation)) THEN + ALLOCATE(DstInitInputData%InitOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitOrientation.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%InitOrientation = SrcInitInputData%InitOrientation +ENDIF + DstInitInputData%UseInputFile = SrcInitInputData%UseInputFile + CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstInitInputData%UseInputFile_PrescribeFrc = SrcInitInputData%UseInputFile_PrescribeFrc + CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrescribeFrcData, DstInitInputData%PassedPrescribeFrcData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE StC_CopyInitInput + + SUBROUTINE StC_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(StC_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InitInputData%InitPosition)) THEN + DEALLOCATE(InitInputData%InitPosition) +ENDIF +IF (ALLOCATED(InitInputData%InitOrientation)) THEN + DEALLOCATE(InitInputData%InitOrientation) +ENDIF + CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) + CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrescribeFrcData, ErrStat, ErrMsg ) + END SUBROUTINE StC_DestroyInitInput + + SUBROUTINE StC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1*LEN(InData%InputFile) ! InputFile + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Re_BufSz = Re_BufSz + SIZE(InData%Gravity) ! Gravity + Int_BufSz = Int_BufSz + 1 ! NumMeshPts + Int_BufSz = Int_BufSz + 1 ! InitPosition allocated yes/no + IF ( ALLOCATED(InData%InitPosition) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitPosition upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitPosition) ! InitPosition + END IF + Int_BufSz = Int_BufSz + 1 ! InitOrientation allocated yes/no + IF ( ALLOCATED(InData%InitOrientation) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! InitOrientation upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%InitOrientation) ! InitOrientation + END IF + Int_BufSz = Int_BufSz + 1 ! UseInputFile + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! PassedPrimaryInputData: size of buffers for each call to pack subtype + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, .TRUE. ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! PassedPrimaryInputData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! PassedPrimaryInputData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! PassedPrimaryInputData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! UseInputFile_PrescribeFrc + Int_BufSz = Int_BufSz + 3 ! PassedPrescribeFrcData: size of buffers for each call to pack subtype + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrescribeFrcData, ErrStat2, ErrMsg2, .TRUE. ) ! PassedPrescribeFrcData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! PassedPrescribeFrcData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! PassedPrescribeFrcData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! PassedPrescribeFrcData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DO I = 1, LEN(InData%InputFile) + IntKiBuf(Int_Xferred) = ICHAR(InData%InputFile(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO i1 = LBOUND(InData%Gravity,1), UBOUND(InData%Gravity,1) + ReKiBuf(Re_Xferred) = InData%Gravity(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%NumMeshPts + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%InitPosition) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitPosition,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitPosition,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitPosition,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitPosition,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitPosition,2), UBOUND(InData%InitPosition,2) + DO i1 = LBOUND(InData%InitPosition,1), UBOUND(InData%InitPosition,1) + ReKiBuf(Re_Xferred) = InData%InitPosition(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitOrientation) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%InitOrientation,3), UBOUND(InData%InitOrientation,3) + DO i2 = LBOUND(InData%InitOrientation,2), UBOUND(InData%InitOrientation,2) + DO i1 = LBOUND(InData%InitOrientation,1), UBOUND(InData%InitOrientation,1) + DbKiBuf(Db_Xferred) = InData%InitOrientation(i1,i2,i3) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseInputFile, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrimaryInputData, ErrStat2, ErrMsg2, OnlySize ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%UseInputFile_PrescribeFrc, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + CALL NWTC_Library_Packfileinfotype( Re_Buf, Db_Buf, Int_Buf, InData%PassedPrescribeFrcData, ErrStat2, ErrMsg2, OnlySize ) ! PassedPrescribeFrcData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE StC_PackInitInput + + SUBROUTINE StC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: i3, i3_l, i3_u ! bounds (upper/lower) for an array dimension 3 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + DO I = 1, LEN(OutData%InputFile) + OutData%InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + i1_l = LBOUND(OutData%Gravity,1) + i1_u = UBOUND(OutData%Gravity,1) + DO i1 = LBOUND(OutData%Gravity,1), UBOUND(OutData%Gravity,1) + OutData%Gravity(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%NumMeshPts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitPosition not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitPosition)) DEALLOCATE(OutData%InitPosition) + ALLOCATE(OutData%InitPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitPosition,2), UBOUND(OutData%InitPosition,2) + DO i1 = LBOUND(OutData%InitPosition,1), UBOUND(OutData%InitPosition,1) + OutData%InitPosition(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitOrientation not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitOrientation)) DEALLOCATE(OutData%InitOrientation) + ALLOCATE(OutData%InitOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitOrientation.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%InitOrientation,3), UBOUND(OutData%InitOrientation,3) + DO i2 = LBOUND(OutData%InitOrientation,2), UBOUND(OutData%InitOrientation,2) + DO i1 = LBOUND(OutData%InitOrientation,1), UBOUND(OutData%InitOrientation,1) + OutData%InitOrientation(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + OutData%UseInputFile = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseInputFile) + Int_Xferred = Int_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackfileinfotype( Re_Buf, Db_Buf, Int_Buf, OutData%PassedPrimaryInputData, ErrStat2, ErrMsg2 ) ! PassedPrimaryInputData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%UseInputFile_PrescribeFrc = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseInputFile_PrescribeFrc) + Int_Xferred = Int_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackfileinfotype( Re_Buf, Db_Buf, Int_Buf, OutData%PassedPrescribeFrcData, ErrStat2, ErrMsg2 ) ! PassedPrescribeFrcData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE StC_UnPackInitInput + + SUBROUTINE StC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(StC_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInitOutputData%DummyInitOut = SrcInitOutputData%DummyInitOut + END SUBROUTINE StC_CopyInitOutput + + SUBROUTINE StC_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(StC_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE StC_DestroyInitOutput + + SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyInitOut + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyInitOut + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_PackInitOutput + + SUBROUTINE StC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyInitOut = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_UnPackInitOutput + + SUBROUTINE StC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstContStateData%DummyContState = SrcContStateData%DummyContState +IF (ALLOCATED(SrcContStateData%StC_x)) THEN + i1_l = LBOUND(SrcContStateData%StC_x,1) + i1_u = UBOUND(SrcContStateData%StC_x,1) + i2_l = LBOUND(SrcContStateData%StC_x,2) + i2_u = UBOUND(SrcContStateData%StC_x,2) + IF (.NOT. ALLOCATED(DstContStateData%StC_x)) THEN + ALLOCATE(DstContStateData%StC_x(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%StC_x.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstContStateData%StC_x = SrcContStateData%StC_x +ENDIF +IF (ALLOCATED(SrcContStateData%StC_xdot)) THEN + i1_l = LBOUND(SrcContStateData%StC_xdot,1) + i1_u = UBOUND(SrcContStateData%StC_xdot,1) + i2_l = LBOUND(SrcContStateData%StC_xdot,2) + i2_u = UBOUND(SrcContStateData%StC_xdot,2) + IF (.NOT. ALLOCATED(DstContStateData%StC_xdot)) THEN + ALLOCATE(DstContStateData%StC_xdot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%StC_xdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstContStateData%StC_xdot = SrcContStateData%StC_xdot +ENDIF + END SUBROUTINE StC_CopyContState + + SUBROUTINE StC_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ContStateData%StC_x)) THEN + DEALLOCATE(ContStateData%StC_x) +ENDIF +IF (ALLOCATED(ContStateData%StC_xdot)) THEN + DEALLOCATE(ContStateData%StC_xdot) +ENDIF + END SUBROUTINE StC_DestroyContState + + SUBROUTINE StC_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyContState + Int_BufSz = Int_BufSz + 1 ! StC_x allocated yes/no + IF ( ALLOCATED(InData%StC_x) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StC_x upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StC_x) ! StC_x + END IF + Int_BufSz = Int_BufSz + 1 ! StC_xdot allocated yes/no + IF ( ALLOCATED(InData%StC_xdot) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StC_xdot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StC_xdot) ! StC_xdot + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyContState + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%StC_x) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_x,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_x,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_x,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_x,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StC_x,2), UBOUND(InData%StC_x,2) + DO i1 = LBOUND(InData%StC_x,1), UBOUND(InData%StC_x,1) + ReKiBuf(Re_Xferred) = InData%StC_x(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StC_xdot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_xdot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_xdot,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_xdot,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_xdot,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StC_xdot,2), UBOUND(InData%StC_xdot,2) + DO i1 = LBOUND(InData%StC_xdot,1), UBOUND(InData%StC_xdot,1) + ReKiBuf(Re_Xferred) = InData%StC_xdot(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_PackContState + + SUBROUTINE StC_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyContState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_x not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_x)) DEALLOCATE(OutData%StC_x) + ALLOCATE(OutData%StC_x(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_x.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StC_x,2), UBOUND(OutData%StC_x,2) + DO i1 = LBOUND(OutData%StC_x,1), UBOUND(OutData%StC_x,1) + OutData%StC_x(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_xdot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_xdot)) DEALLOCATE(OutData%StC_xdot) + ALLOCATE(OutData%StC_xdot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_xdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StC_xdot,2), UBOUND(OutData%StC_xdot,2) + DO i1 = LBOUND(OutData%StC_xdot,1), UBOUND(OutData%StC_xdot,1) + OutData%StC_xdot(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_UnPackContState + + SUBROUTINE StC_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(StC_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstDiscStateData%DummyDiscState = SrcDiscStateData%DummyDiscState + END SUBROUTINE StC_CopyDiscState + + SUBROUTINE StC_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(StC_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE StC_DestroyDiscState + + SUBROUTINE StC_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyDiscState + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyDiscState + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_PackDiscState + + SUBROUTINE StC_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyDiscState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_UnPackDiscState + + SUBROUTINE StC_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(StC_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState + END SUBROUTINE StC_CopyConstrState + + SUBROUTINE StC_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(StC_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE StC_DestroyConstrState + + SUBROUTINE StC_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_ConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackConstrState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyConstrState + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyConstrState + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_PackConstrState + + SUBROUTINE StC_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_ConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackConstrState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyConstrState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_UnPackConstrState + + SUBROUTINE StC_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(StC_OtherStateType), INTENT(INOUT) :: DstOtherStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyOtherState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstOtherStateData%DummyOtherState = SrcOtherStateData%DummyOtherState + END SUBROUTINE StC_CopyOtherState + + SUBROUTINE StC_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(StC_OtherStateType), INTENT(INOUT) :: OtherStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyOtherState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE StC_DestroyOtherState + + SUBROUTINE StC_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_OtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackOtherState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyOtherState + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyOtherState + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_PackOtherState + + SUBROUTINE StC_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_OtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackOtherState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyOtherState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE StC_UnPackOtherState + + SUBROUTINE StC_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(StC_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcMiscData%F_stop)) THEN + i1_l = LBOUND(SrcMiscData%F_stop,1) + i1_u = UBOUND(SrcMiscData%F_stop,1) + i2_l = LBOUND(SrcMiscData%F_stop,2) + i2_u = UBOUND(SrcMiscData%F_stop,2) + IF (.NOT. ALLOCATED(DstMiscData%F_stop)) THEN + ALLOCATE(DstMiscData%F_stop(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_stop.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_stop = SrcMiscData%F_stop +ENDIF +IF (ALLOCATED(SrcMiscData%F_ext)) THEN + i1_l = LBOUND(SrcMiscData%F_ext,1) + i1_u = UBOUND(SrcMiscData%F_ext,1) + i2_l = LBOUND(SrcMiscData%F_ext,2) + i2_u = UBOUND(SrcMiscData%F_ext,2) + IF (.NOT. ALLOCATED(DstMiscData%F_ext)) THEN + ALLOCATE(DstMiscData%F_ext(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_ext.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_ext = SrcMiscData%F_ext +ENDIF +IF (ALLOCATED(SrcMiscData%F_fr)) THEN + i1_l = LBOUND(SrcMiscData%F_fr,1) + i1_u = UBOUND(SrcMiscData%F_fr,1) + i2_l = LBOUND(SrcMiscData%F_fr,2) + i2_u = UBOUND(SrcMiscData%F_fr,2) + IF (.NOT. ALLOCATED(DstMiscData%F_fr)) THEN + ALLOCATE(DstMiscData%F_fr(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_fr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_fr = SrcMiscData%F_fr +ENDIF +IF (ALLOCATED(SrcMiscData%C_ctrl)) THEN + i1_l = LBOUND(SrcMiscData%C_ctrl,1) + i1_u = UBOUND(SrcMiscData%C_ctrl,1) + i2_l = LBOUND(SrcMiscData%C_ctrl,2) + i2_u = UBOUND(SrcMiscData%C_ctrl,2) + IF (.NOT. ALLOCATED(DstMiscData%C_ctrl)) THEN + ALLOCATE(DstMiscData%C_ctrl(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%C_ctrl.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%C_ctrl = SrcMiscData%C_ctrl +ENDIF +IF (ALLOCATED(SrcMiscData%C_Brake)) THEN + i1_l = LBOUND(SrcMiscData%C_Brake,1) + i1_u = UBOUND(SrcMiscData%C_Brake,1) + i2_l = LBOUND(SrcMiscData%C_Brake,2) + i2_u = UBOUND(SrcMiscData%C_Brake,2) + IF (.NOT. ALLOCATED(DstMiscData%C_Brake)) THEN + ALLOCATE(DstMiscData%C_Brake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%C_Brake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%C_Brake = SrcMiscData%C_Brake +ENDIF +IF (ALLOCATED(SrcMiscData%F_table)) THEN + i1_l = LBOUND(SrcMiscData%F_table,1) + i1_u = UBOUND(SrcMiscData%F_table,1) + i2_l = LBOUND(SrcMiscData%F_table,2) + i2_u = UBOUND(SrcMiscData%F_table,2) + IF (.NOT. ALLOCATED(DstMiscData%F_table)) THEN + ALLOCATE(DstMiscData%F_table(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_table.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_table = SrcMiscData%F_table +ENDIF +IF (ALLOCATED(SrcMiscData%F_k)) THEN + i1_l = LBOUND(SrcMiscData%F_k,1) + i1_u = UBOUND(SrcMiscData%F_k,1) + i2_l = LBOUND(SrcMiscData%F_k,2) + i2_u = UBOUND(SrcMiscData%F_k,2) + IF (.NOT. ALLOCATED(DstMiscData%F_k)) THEN + ALLOCATE(DstMiscData%F_k(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_k.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_k = SrcMiscData%F_k +ENDIF +IF (ALLOCATED(SrcMiscData%a_G)) THEN + i1_l = LBOUND(SrcMiscData%a_G,1) + i1_u = UBOUND(SrcMiscData%a_G,1) + i2_l = LBOUND(SrcMiscData%a_G,2) + i2_u = UBOUND(SrcMiscData%a_G,2) + IF (.NOT. ALLOCATED(DstMiscData%a_G)) THEN + ALLOCATE(DstMiscData%a_G(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%a_G.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%a_G = SrcMiscData%a_G +ENDIF +IF (ALLOCATED(SrcMiscData%rdisp_P)) THEN + i1_l = LBOUND(SrcMiscData%rdisp_P,1) + i1_u = UBOUND(SrcMiscData%rdisp_P,1) + i2_l = LBOUND(SrcMiscData%rdisp_P,2) + i2_u = UBOUND(SrcMiscData%rdisp_P,2) + IF (.NOT. ALLOCATED(DstMiscData%rdisp_P)) THEN + ALLOCATE(DstMiscData%rdisp_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rdisp_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rdisp_P = SrcMiscData%rdisp_P +ENDIF +IF (ALLOCATED(SrcMiscData%rdot_P)) THEN + i1_l = LBOUND(SrcMiscData%rdot_P,1) + i1_u = UBOUND(SrcMiscData%rdot_P,1) + i2_l = LBOUND(SrcMiscData%rdot_P,2) + i2_u = UBOUND(SrcMiscData%rdot_P,2) + IF (.NOT. ALLOCATED(DstMiscData%rdot_P)) THEN + ALLOCATE(DstMiscData%rdot_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rdot_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rdot_P = SrcMiscData%rdot_P +ENDIF +IF (ALLOCATED(SrcMiscData%rddot_P)) THEN + i1_l = LBOUND(SrcMiscData%rddot_P,1) + i1_u = UBOUND(SrcMiscData%rddot_P,1) + i2_l = LBOUND(SrcMiscData%rddot_P,2) + i2_u = UBOUND(SrcMiscData%rddot_P,2) + IF (.NOT. ALLOCATED(DstMiscData%rddot_P)) THEN + ALLOCATE(DstMiscData%rddot_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%rddot_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%rddot_P = SrcMiscData%rddot_P +ENDIF +IF (ALLOCATED(SrcMiscData%omega_P)) THEN + i1_l = LBOUND(SrcMiscData%omega_P,1) + i1_u = UBOUND(SrcMiscData%omega_P,1) + i2_l = LBOUND(SrcMiscData%omega_P,2) + i2_u = UBOUND(SrcMiscData%omega_P,2) + IF (.NOT. ALLOCATED(DstMiscData%omega_P)) THEN + ALLOCATE(DstMiscData%omega_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%omega_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%omega_P = SrcMiscData%omega_P +ENDIF +IF (ALLOCATED(SrcMiscData%alpha_P)) THEN + i1_l = LBOUND(SrcMiscData%alpha_P,1) + i1_u = UBOUND(SrcMiscData%alpha_P,1) + i2_l = LBOUND(SrcMiscData%alpha_P,2) + i2_u = UBOUND(SrcMiscData%alpha_P,2) + IF (.NOT. ALLOCATED(DstMiscData%alpha_P)) THEN + ALLOCATE(DstMiscData%alpha_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%alpha_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%alpha_P = SrcMiscData%alpha_P +ENDIF +IF (ALLOCATED(SrcMiscData%F_P)) THEN + i1_l = LBOUND(SrcMiscData%F_P,1) + i1_u = UBOUND(SrcMiscData%F_P,1) + i2_l = LBOUND(SrcMiscData%F_P,2) + i2_u = UBOUND(SrcMiscData%F_P,2) + IF (.NOT. ALLOCATED(DstMiscData%F_P)) THEN + ALLOCATE(DstMiscData%F_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%F_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%F_P = SrcMiscData%F_P +ENDIF +IF (ALLOCATED(SrcMiscData%M_P)) THEN + i1_l = LBOUND(SrcMiscData%M_P,1) + i1_u = UBOUND(SrcMiscData%M_P,1) + i2_l = LBOUND(SrcMiscData%M_P,2) + i2_u = UBOUND(SrcMiscData%M_P,2) + IF (.NOT. ALLOCATED(DstMiscData%M_P)) THEN + ALLOCATE(DstMiscData%M_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%M_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%M_P = SrcMiscData%M_P +ENDIF +IF (ALLOCATED(SrcMiscData%Acc)) THEN + i1_l = LBOUND(SrcMiscData%Acc,1) + i1_u = UBOUND(SrcMiscData%Acc,1) + i2_l = LBOUND(SrcMiscData%Acc,2) + i2_u = UBOUND(SrcMiscData%Acc,2) + IF (.NOT. ALLOCATED(DstMiscData%Acc)) THEN + ALLOCATE(DstMiscData%Acc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Acc.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Acc = SrcMiscData%Acc +ENDIF + DstMiscData%PrescribedInterpIdx = SrcMiscData%PrescribedInterpIdx + END SUBROUTINE StC_CopyMisc + + SUBROUTINE StC_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(StC_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(MiscData%F_stop)) THEN + DEALLOCATE(MiscData%F_stop) +ENDIF +IF (ALLOCATED(MiscData%F_ext)) THEN + DEALLOCATE(MiscData%F_ext) +ENDIF +IF (ALLOCATED(MiscData%F_fr)) THEN + DEALLOCATE(MiscData%F_fr) +ENDIF +IF (ALLOCATED(MiscData%C_ctrl)) THEN + DEALLOCATE(MiscData%C_ctrl) +ENDIF +IF (ALLOCATED(MiscData%C_Brake)) THEN + DEALLOCATE(MiscData%C_Brake) +ENDIF +IF (ALLOCATED(MiscData%F_table)) THEN + DEALLOCATE(MiscData%F_table) +ENDIF +IF (ALLOCATED(MiscData%F_k)) THEN + DEALLOCATE(MiscData%F_k) +ENDIF +IF (ALLOCATED(MiscData%a_G)) THEN + DEALLOCATE(MiscData%a_G) +ENDIF +IF (ALLOCATED(MiscData%rdisp_P)) THEN + DEALLOCATE(MiscData%rdisp_P) +ENDIF +IF (ALLOCATED(MiscData%rdot_P)) THEN + DEALLOCATE(MiscData%rdot_P) +ENDIF +IF (ALLOCATED(MiscData%rddot_P)) THEN + DEALLOCATE(MiscData%rddot_P) +ENDIF +IF (ALLOCATED(MiscData%omega_P)) THEN + DEALLOCATE(MiscData%omega_P) +ENDIF +IF (ALLOCATED(MiscData%alpha_P)) THEN + DEALLOCATE(MiscData%alpha_P) +ENDIF +IF (ALLOCATED(MiscData%F_P)) THEN + DEALLOCATE(MiscData%F_P) +ENDIF +IF (ALLOCATED(MiscData%M_P)) THEN + DEALLOCATE(MiscData%M_P) +ENDIF +IF (ALLOCATED(MiscData%Acc)) THEN + DEALLOCATE(MiscData%Acc) +ENDIF + END SUBROUTINE StC_DestroyMisc + + SUBROUTINE StC_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! F_stop allocated yes/no + IF ( ALLOCATED(InData%F_stop) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_stop upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_stop) ! F_stop + END IF + Int_BufSz = Int_BufSz + 1 ! F_ext allocated yes/no + IF ( ALLOCATED(InData%F_ext) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_ext upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_ext) ! F_ext + END IF + Int_BufSz = Int_BufSz + 1 ! F_fr allocated yes/no + IF ( ALLOCATED(InData%F_fr) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_fr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_fr) ! F_fr + END IF + Int_BufSz = Int_BufSz + 1 ! C_ctrl allocated yes/no + IF ( ALLOCATED(InData%C_ctrl) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! C_ctrl upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%C_ctrl) ! C_ctrl + END IF + Int_BufSz = Int_BufSz + 1 ! C_Brake allocated yes/no + IF ( ALLOCATED(InData%C_Brake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! C_Brake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%C_Brake) ! C_Brake + END IF + Int_BufSz = Int_BufSz + 1 ! F_table allocated yes/no + IF ( ALLOCATED(InData%F_table) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_table upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_table) ! F_table + END IF + Int_BufSz = Int_BufSz + 1 ! F_k allocated yes/no + IF ( ALLOCATED(InData%F_k) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_k upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_k) ! F_k + END IF + Int_BufSz = Int_BufSz + 1 ! a_G allocated yes/no + IF ( ALLOCATED(InData%a_G) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! a_G upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%a_G) ! a_G + END IF + Int_BufSz = Int_BufSz + 1 ! rdisp_P allocated yes/no + IF ( ALLOCATED(InData%rdisp_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! rdisp_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rdisp_P) ! rdisp_P + END IF + Int_BufSz = Int_BufSz + 1 ! rdot_P allocated yes/no + IF ( ALLOCATED(InData%rdot_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! rdot_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rdot_P) ! rdot_P + END IF + Int_BufSz = Int_BufSz + 1 ! rddot_P allocated yes/no + IF ( ALLOCATED(InData%rddot_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! rddot_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%rddot_P) ! rddot_P + END IF + Int_BufSz = Int_BufSz + 1 ! omega_P allocated yes/no + IF ( ALLOCATED(InData%omega_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! omega_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%omega_P) ! omega_P + END IF + Int_BufSz = Int_BufSz + 1 ! alpha_P allocated yes/no + IF ( ALLOCATED(InData%alpha_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! alpha_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%alpha_P) ! alpha_P + END IF + Int_BufSz = Int_BufSz + 1 ! F_P allocated yes/no + IF ( ALLOCATED(InData%F_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_P) ! F_P + END IF + Int_BufSz = Int_BufSz + 1 ! M_P allocated yes/no + IF ( ALLOCATED(InData%M_P) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! M_P upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%M_P) ! M_P + END IF + Int_BufSz = Int_BufSz + 1 ! Acc allocated yes/no + IF ( ALLOCATED(InData%Acc) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Acc upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Acc) ! Acc + END IF + Int_BufSz = Int_BufSz + 1 ! PrescribedInterpIdx + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%F_stop) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_stop,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_stop,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_stop,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_stop,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_stop,2), UBOUND(InData%F_stop,2) + DO i1 = LBOUND(InData%F_stop,1), UBOUND(InData%F_stop,1) + ReKiBuf(Re_Xferred) = InData%F_stop(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%F_ext) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_ext,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_ext,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_ext,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_ext,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_ext,2), UBOUND(InData%F_ext,2) + DO i1 = LBOUND(InData%F_ext,1), UBOUND(InData%F_ext,1) + ReKiBuf(Re_Xferred) = InData%F_ext(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%F_fr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_fr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_fr,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_fr,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_fr,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_fr,2), UBOUND(InData%F_fr,2) + DO i1 = LBOUND(InData%F_fr,1), UBOUND(InData%F_fr,1) + ReKiBuf(Re_Xferred) = InData%F_fr(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%C_ctrl) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%C_ctrl,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%C_ctrl,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%C_ctrl,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%C_ctrl,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%C_ctrl,2), UBOUND(InData%C_ctrl,2) + DO i1 = LBOUND(InData%C_ctrl,1), UBOUND(InData%C_ctrl,1) + ReKiBuf(Re_Xferred) = InData%C_ctrl(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%C_Brake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%C_Brake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%C_Brake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%C_Brake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%C_Brake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%C_Brake,2), UBOUND(InData%C_Brake,2) + DO i1 = LBOUND(InData%C_Brake,1), UBOUND(InData%C_Brake,1) + ReKiBuf(Re_Xferred) = InData%C_Brake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%F_table) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_table,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_table,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_table,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_table,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_table,2), UBOUND(InData%F_table,2) + DO i1 = LBOUND(InData%F_table,1), UBOUND(InData%F_table,1) + ReKiBuf(Re_Xferred) = InData%F_table(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%F_k) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_k,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_k,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_k,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_k,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_k,2), UBOUND(InData%F_k,2) + DO i1 = LBOUND(InData%F_k,1), UBOUND(InData%F_k,1) + ReKiBuf(Re_Xferred) = InData%F_k(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%a_G) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%a_G,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%a_G,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%a_G,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%a_G,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%a_G,2), UBOUND(InData%a_G,2) + DO i1 = LBOUND(InData%a_G,1), UBOUND(InData%a_G,1) + ReKiBuf(Re_Xferred) = InData%a_G(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rdisp_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rdisp_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rdisp_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rdisp_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rdisp_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%rdisp_P,2), UBOUND(InData%rdisp_P,2) + DO i1 = LBOUND(InData%rdisp_P,1), UBOUND(InData%rdisp_P,1) + ReKiBuf(Re_Xferred) = InData%rdisp_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rdot_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rdot_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rdot_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rdot_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rdot_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%rdot_P,2), UBOUND(InData%rdot_P,2) + DO i1 = LBOUND(InData%rdot_P,1), UBOUND(InData%rdot_P,1) + ReKiBuf(Re_Xferred) = InData%rdot_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%rddot_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rddot_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rddot_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%rddot_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%rddot_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%rddot_P,2), UBOUND(InData%rddot_P,2) + DO i1 = LBOUND(InData%rddot_P,1), UBOUND(InData%rddot_P,1) + ReKiBuf(Re_Xferred) = InData%rddot_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%omega_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%omega_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%omega_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%omega_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%omega_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%omega_P,2), UBOUND(InData%omega_P,2) + DO i1 = LBOUND(InData%omega_P,1), UBOUND(InData%omega_P,1) + ReKiBuf(Re_Xferred) = InData%omega_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%alpha_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%alpha_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%alpha_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%alpha_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%alpha_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%alpha_P,2), UBOUND(InData%alpha_P,2) + DO i1 = LBOUND(InData%alpha_P,1), UBOUND(InData%alpha_P,1) + ReKiBuf(Re_Xferred) = InData%alpha_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%F_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_P,2), UBOUND(InData%F_P,2) + DO i1 = LBOUND(InData%F_P,1), UBOUND(InData%F_P,1) + ReKiBuf(Re_Xferred) = InData%F_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%M_P) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%M_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M_P,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%M_P,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%M_P,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%M_P,2), UBOUND(InData%M_P,2) + DO i1 = LBOUND(InData%M_P,1), UBOUND(InData%M_P,1) + ReKiBuf(Re_Xferred) = InData%M_P(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Acc) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Acc,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Acc,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Acc,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Acc,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Acc,2), UBOUND(InData%Acc,2) + DO i1 = LBOUND(InData%Acc,1), UBOUND(InData%Acc,1) + ReKiBuf(Re_Xferred) = InData%Acc(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = InData%PrescribedInterpIdx + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE StC_PackMisc + + SUBROUTINE StC_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_stop not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_stop)) DEALLOCATE(OutData%F_stop) + ALLOCATE(OutData%F_stop(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_stop.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_stop,2), UBOUND(OutData%F_stop,2) + DO i1 = LBOUND(OutData%F_stop,1), UBOUND(OutData%F_stop,1) + OutData%F_stop(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_ext not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_ext)) DEALLOCATE(OutData%F_ext) + ALLOCATE(OutData%F_ext(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_ext.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_ext,2), UBOUND(OutData%F_ext,2) + DO i1 = LBOUND(OutData%F_ext,1), UBOUND(OutData%F_ext,1) + OutData%F_ext(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_fr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_fr)) DEALLOCATE(OutData%F_fr) + ALLOCATE(OutData%F_fr(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_fr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_fr,2), UBOUND(OutData%F_fr,2) + DO i1 = LBOUND(OutData%F_fr,1), UBOUND(OutData%F_fr,1) + OutData%F_fr(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! C_ctrl not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%C_ctrl)) DEALLOCATE(OutData%C_ctrl) + ALLOCATE(OutData%C_ctrl(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%C_ctrl.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%C_ctrl,2), UBOUND(OutData%C_ctrl,2) + DO i1 = LBOUND(OutData%C_ctrl,1), UBOUND(OutData%C_ctrl,1) + OutData%C_ctrl(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! C_Brake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%C_Brake)) DEALLOCATE(OutData%C_Brake) + ALLOCATE(OutData%C_Brake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%C_Brake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%C_Brake,2), UBOUND(OutData%C_Brake,2) + DO i1 = LBOUND(OutData%C_Brake,1), UBOUND(OutData%C_Brake,1) + OutData%C_Brake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_table not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_table)) DEALLOCATE(OutData%F_table) + ALLOCATE(OutData%F_table(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_table.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_table,2), UBOUND(OutData%F_table,2) + DO i1 = LBOUND(OutData%F_table,1), UBOUND(OutData%F_table,1) + OutData%F_table(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_k not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_k)) DEALLOCATE(OutData%F_k) + ALLOCATE(OutData%F_k(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_k.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_k,2), UBOUND(OutData%F_k,2) + DO i1 = LBOUND(OutData%F_k,1), UBOUND(OutData%F_k,1) + OutData%F_k(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! a_G not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%a_G)) DEALLOCATE(OutData%a_G) + ALLOCATE(OutData%a_G(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%a_G.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%a_G,2), UBOUND(OutData%a_G,2) + DO i1 = LBOUND(OutData%a_G,1), UBOUND(OutData%a_G,1) + OutData%a_G(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rdisp_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rdisp_P)) DEALLOCATE(OutData%rdisp_P) + ALLOCATE(OutData%rdisp_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rdisp_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%rdisp_P,2), UBOUND(OutData%rdisp_P,2) + DO i1 = LBOUND(OutData%rdisp_P,1), UBOUND(OutData%rdisp_P,1) + OutData%rdisp_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rdot_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rdot_P)) DEALLOCATE(OutData%rdot_P) + ALLOCATE(OutData%rdot_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rdot_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%rdot_P,2), UBOUND(OutData%rdot_P,2) + DO i1 = LBOUND(OutData%rdot_P,1), UBOUND(OutData%rdot_P,1) + OutData%rdot_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! rddot_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%rddot_P)) DEALLOCATE(OutData%rddot_P) + ALLOCATE(OutData%rddot_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%rddot_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%rddot_P,2), UBOUND(OutData%rddot_P,2) + DO i1 = LBOUND(OutData%rddot_P,1), UBOUND(OutData%rddot_P,1) + OutData%rddot_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! omega_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%omega_P)) DEALLOCATE(OutData%omega_P) + ALLOCATE(OutData%omega_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%omega_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%omega_P,2), UBOUND(OutData%omega_P,2) + DO i1 = LBOUND(OutData%omega_P,1), UBOUND(OutData%omega_P,1) + OutData%omega_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! alpha_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%alpha_P)) DEALLOCATE(OutData%alpha_P) + ALLOCATE(OutData%alpha_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%alpha_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%alpha_P,2), UBOUND(OutData%alpha_P,2) + DO i1 = LBOUND(OutData%alpha_P,1), UBOUND(OutData%alpha_P,1) + OutData%alpha_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_P)) DEALLOCATE(OutData%F_P) + ALLOCATE(OutData%F_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_P,2), UBOUND(OutData%F_P,2) + DO i1 = LBOUND(OutData%F_P,1), UBOUND(OutData%F_P,1) + OutData%F_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! M_P not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%M_P)) DEALLOCATE(OutData%M_P) + ALLOCATE(OutData%M_P(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%M_P.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%M_P,2), UBOUND(OutData%M_P,2) + DO i1 = LBOUND(OutData%M_P,1), UBOUND(OutData%M_P,1) + OutData%M_P(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Acc not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Acc)) DEALLOCATE(OutData%Acc) + ALLOCATE(OutData%Acc(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Acc.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Acc,2), UBOUND(OutData%Acc,2) + DO i1 = LBOUND(OutData%Acc,1), UBOUND(OutData%Acc,1) + OutData%Acc(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%PrescribedInterpIdx = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE StC_UnPackMisc + + SUBROUTINE StC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_ParameterType), INTENT(IN) :: SrcParamData + TYPE(StC_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%DT = SrcParamData%DT + DstParamData%RootName = SrcParamData%RootName + DstParamData%StC_DOF_MODE = SrcParamData%StC_DOF_MODE + DstParamData%StC_X_DOF = SrcParamData%StC_X_DOF + DstParamData%StC_Y_DOF = SrcParamData%StC_Y_DOF + DstParamData%StC_Z_DOF = SrcParamData%StC_Z_DOF + DstParamData%M_X = SrcParamData%M_X + DstParamData%M_Y = SrcParamData%M_Y + DstParamData%M_Z = SrcParamData%M_Z + DstParamData%M_XY = SrcParamData%M_XY + DstParamData%K_X = SrcParamData%K_X + DstParamData%K_Y = SrcParamData%K_Y + DstParamData%K_Z = SrcParamData%K_Z + DstParamData%C_X = SrcParamData%C_X + DstParamData%C_Y = SrcParamData%C_Y + DstParamData%C_Z = SrcParamData%C_Z + DstParamData%K_S = SrcParamData%K_S + DstParamData%C_S = SrcParamData%C_S + DstParamData%P_SP = SrcParamData%P_SP + DstParamData%N_SP = SrcParamData%N_SP + DstParamData%Gravity = SrcParamData%Gravity + DstParamData%StC_CMODE = SrcParamData%StC_CMODE + DstParamData%StC_SA_MODE = SrcParamData%StC_SA_MODE + DstParamData%StC_X_C_HIGH = SrcParamData%StC_X_C_HIGH + DstParamData%StC_X_C_LOW = SrcParamData%StC_X_C_LOW + DstParamData%StC_Y_C_HIGH = SrcParamData%StC_Y_C_HIGH + DstParamData%StC_Y_C_LOW = SrcParamData%StC_Y_C_LOW + DstParamData%StC_Z_C_HIGH = SrcParamData%StC_Z_C_HIGH + DstParamData%StC_Z_C_LOW = SrcParamData%StC_Z_C_LOW + DstParamData%StC_X_C_BRAKE = SrcParamData%StC_X_C_BRAKE + DstParamData%StC_Y_C_BRAKE = SrcParamData%StC_Y_C_BRAKE + DstParamData%StC_Z_C_BRAKE = SrcParamData%StC_Z_C_BRAKE + DstParamData%L_X = SrcParamData%L_X + DstParamData%B_X = SrcParamData%B_X + DstParamData%area_X = SrcParamData%area_X + DstParamData%area_ratio_X = SrcParamData%area_ratio_X + DstParamData%headLossCoeff_X = SrcParamData%headLossCoeff_X + DstParamData%rho_X = SrcParamData%rho_X + DstParamData%L_Y = SrcParamData%L_Y + DstParamData%B_Y = SrcParamData%B_Y + DstParamData%area_Y = SrcParamData%area_Y + DstParamData%area_ratio_Y = SrcParamData%area_ratio_Y + DstParamData%headLossCoeff_Y = SrcParamData%headLossCoeff_Y + DstParamData%rho_Y = SrcParamData%rho_Y + DstParamData%Use_F_TBL = SrcParamData%Use_F_TBL +IF (ALLOCATED(SrcParamData%F_TBL)) THEN + i1_l = LBOUND(SrcParamData%F_TBL,1) + i1_u = UBOUND(SrcParamData%F_TBL,1) + i2_l = LBOUND(SrcParamData%F_TBL,2) + i2_u = UBOUND(SrcParamData%F_TBL,2) + IF (.NOT. ALLOCATED(DstParamData%F_TBL)) THEN + ALLOCATE(DstParamData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%F_TBL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%F_TBL = SrcParamData%F_TBL +ENDIF + DstParamData%NumMeshPts = SrcParamData%NumMeshPts + DstParamData%PrescribedForcesCoordSys = SrcParamData%PrescribedForcesCoordSys +IF (ALLOCATED(SrcParamData%StC_PrescribedForce)) THEN + i1_l = LBOUND(SrcParamData%StC_PrescribedForce,1) + i1_u = UBOUND(SrcParamData%StC_PrescribedForce,1) + i2_l = LBOUND(SrcParamData%StC_PrescribedForce,2) + i2_u = UBOUND(SrcParamData%StC_PrescribedForce,2) + IF (.NOT. ALLOCATED(DstParamData%StC_PrescribedForce)) THEN + ALLOCATE(DstParamData%StC_PrescribedForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%StC_PrescribedForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%StC_PrescribedForce = SrcParamData%StC_PrescribedForce +ENDIF + END SUBROUTINE StC_CopyParam + + SUBROUTINE StC_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(StC_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%F_TBL)) THEN + DEALLOCATE(ParamData%F_TBL) +ENDIF +IF (ALLOCATED(ParamData%StC_PrescribedForce)) THEN + DEALLOCATE(ParamData%StC_PrescribedForce) +ENDIF + END SUBROUTINE StC_DestroyParam + + SUBROUTINE StC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! DT + Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName + Int_BufSz = Int_BufSz + 1 ! StC_DOF_MODE + Int_BufSz = Int_BufSz + 1 ! StC_X_DOF + Int_BufSz = Int_BufSz + 1 ! StC_Y_DOF + Int_BufSz = Int_BufSz + 1 ! StC_Z_DOF + Re_BufSz = Re_BufSz + 1 ! M_X + Re_BufSz = Re_BufSz + 1 ! M_Y + Re_BufSz = Re_BufSz + 1 ! M_Z + Re_BufSz = Re_BufSz + 1 ! M_XY + Re_BufSz = Re_BufSz + 1 ! K_X + Re_BufSz = Re_BufSz + 1 ! K_Y + Re_BufSz = Re_BufSz + 1 ! K_Z + Re_BufSz = Re_BufSz + 1 ! C_X + Re_BufSz = Re_BufSz + 1 ! C_Y + Re_BufSz = Re_BufSz + 1 ! C_Z + Re_BufSz = Re_BufSz + SIZE(InData%K_S) ! K_S + Re_BufSz = Re_BufSz + SIZE(InData%C_S) ! C_S + Re_BufSz = Re_BufSz + SIZE(InData%P_SP) ! P_SP + Re_BufSz = Re_BufSz + SIZE(InData%N_SP) ! N_SP + Re_BufSz = Re_BufSz + SIZE(InData%Gravity) ! Gravity + Int_BufSz = Int_BufSz + 1 ! StC_CMODE + Int_BufSz = Int_BufSz + 1 ! StC_SA_MODE + Re_BufSz = Re_BufSz + 1 ! StC_X_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_X_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_HIGH + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_LOW + Re_BufSz = Re_BufSz + 1 ! StC_X_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! StC_Y_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! StC_Z_C_BRAKE + Re_BufSz = Re_BufSz + 1 ! L_X + Re_BufSz = Re_BufSz + 1 ! B_X + Re_BufSz = Re_BufSz + 1 ! area_X + Re_BufSz = Re_BufSz + 1 ! area_ratio_X + Re_BufSz = Re_BufSz + 1 ! headLossCoeff_X + Re_BufSz = Re_BufSz + 1 ! rho_X + Re_BufSz = Re_BufSz + 1 ! L_Y + Re_BufSz = Re_BufSz + 1 ! B_Y + Re_BufSz = Re_BufSz + 1 ! area_Y + Re_BufSz = Re_BufSz + 1 ! area_ratio_Y + Re_BufSz = Re_BufSz + 1 ! headLossCoeff_Y + Re_BufSz = Re_BufSz + 1 ! rho_Y + Int_BufSz = Int_BufSz + 1 ! Use_F_TBL + Int_BufSz = Int_BufSz + 1 ! F_TBL allocated yes/no + IF ( ALLOCATED(InData%F_TBL) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! F_TBL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%F_TBL) ! F_TBL + END IF + Int_BufSz = Int_BufSz + 1 ! NumMeshPts + Int_BufSz = Int_BufSz + 1 ! PrescribedForcesCoordSys + Int_BufSz = Int_BufSz + 1 ! StC_PrescribedForce allocated yes/no + IF ( ALLOCATED(InData%StC_PrescribedForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StC_PrescribedForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StC_PrescribedForce) ! StC_PrescribedForce + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%DT + Db_Xferred = Db_Xferred + 1 + DO I = 1, LEN(InData%RootName) + IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + IntKiBuf(Int_Xferred) = InData%StC_DOF_MODE + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_X_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_Y_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_Z_DOF, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%M_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%M_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%M_Z + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%M_XY + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%K_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%K_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%K_Z + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_Z + Re_Xferred = Re_Xferred + 1 + DO i1 = LBOUND(InData%K_S,1), UBOUND(InData%K_S,1) + ReKiBuf(Re_Xferred) = InData%K_S(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%C_S,1), UBOUND(InData%C_S,1) + ReKiBuf(Re_Xferred) = InData%C_S(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%P_SP,1), UBOUND(InData%P_SP,1) + ReKiBuf(Re_Xferred) = InData%P_SP(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%N_SP,1), UBOUND(InData%N_SP,1) + ReKiBuf(Re_Xferred) = InData%N_SP(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%Gravity,1), UBOUND(InData%Gravity,1) + ReKiBuf(Re_Xferred) = InData%Gravity(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IntKiBuf(Int_Xferred) = InData%StC_CMODE + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%StC_SA_MODE + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_HIGH + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_LOW + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_X_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Y_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_C_BRAKE + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%L_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%B_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_ratio_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%headLossCoeff_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%rho_X + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%L_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%B_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%area_ratio_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%headLossCoeff_Y + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%rho_Y + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%Use_F_TBL, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%F_TBL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%F_TBL,2), UBOUND(InData%F_TBL,2) + DO i1 = LBOUND(InData%F_TBL,1), UBOUND(InData%F_TBL,1) + ReKiBuf(Re_Xferred) = InData%F_TBL(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IntKiBuf(Int_Xferred) = InData%NumMeshPts + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%PrescribedForcesCoordSys + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%StC_PrescribedForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_PrescribedForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_PrescribedForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_PrescribedForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_PrescribedForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StC_PrescribedForce,2), UBOUND(InData%StC_PrescribedForce,2) + DO i1 = LBOUND(InData%StC_PrescribedForce,1), UBOUND(InData%StC_PrescribedForce,1) + ReKiBuf(Re_Xferred) = InData%StC_PrescribedForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_PackParam + + SUBROUTINE StC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DT = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + DO I = 1, LEN(OutData%RootName) + OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%StC_DOF_MODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_X_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_X_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%StC_Y_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_Y_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%StC_Z_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_Z_DOF) + Int_Xferred = Int_Xferred + 1 + OutData%M_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%M_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%M_Z = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%M_XY = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%K_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%K_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%K_Z = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_Z = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + i1_l = LBOUND(OutData%K_S,1) + i1_u = UBOUND(OutData%K_S,1) + DO i1 = LBOUND(OutData%K_S,1), UBOUND(OutData%K_S,1) + OutData%K_S(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%C_S,1) + i1_u = UBOUND(OutData%C_S,1) + DO i1 = LBOUND(OutData%C_S,1), UBOUND(OutData%C_S,1) + OutData%C_S(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%P_SP,1) + i1_u = UBOUND(OutData%P_SP,1) + DO i1 = LBOUND(OutData%P_SP,1), UBOUND(OutData%P_SP,1) + OutData%P_SP(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%N_SP,1) + i1_u = UBOUND(OutData%N_SP,1) + DO i1 = LBOUND(OutData%N_SP,1), UBOUND(OutData%N_SP,1) + OutData%N_SP(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%Gravity,1) + i1_u = UBOUND(OutData%Gravity,1) + DO i1 = LBOUND(OutData%Gravity,1), UBOUND(OutData%Gravity,1) + OutData%Gravity(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + OutData%StC_CMODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_SA_MODE = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StC_X_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_HIGH = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_LOW = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_X_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Y_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%StC_Z_C_BRAKE = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%L_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%B_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_ratio_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%headLossCoeff_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%rho_X = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%L_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%B_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%area_ratio_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%headLossCoeff_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%rho_Y = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Use_F_TBL = TRANSFER(IntKiBuf(Int_Xferred), OutData%Use_F_TBL) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_TBL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%F_TBL)) DEALLOCATE(OutData%F_TBL) + ALLOCATE(OutData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_TBL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%F_TBL,2), UBOUND(OutData%F_TBL,2) + DO i1 = LBOUND(OutData%F_TBL,1), UBOUND(OutData%F_TBL,1) + OutData%F_TBL(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%NumMeshPts = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%PrescribedForcesCoordSys = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_PrescribedForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_PrescribedForce)) DEALLOCATE(OutData%StC_PrescribedForce) + ALLOCATE(OutData%StC_PrescribedForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_PrescribedForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StC_PrescribedForce,2), UBOUND(OutData%StC_PrescribedForce,2) + DO i1 = LBOUND(OutData%StC_PrescribedForce,1), UBOUND(OutData%StC_PrescribedForce,1) + OutData%StC_PrescribedForce(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_UnPackParam + + SUBROUTINE StC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_InputType), INTENT(INOUT) :: SrcInputData + TYPE(StC_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInputData%Mesh)) THEN + i1_l = LBOUND(SrcInputData%Mesh,1) + i1_u = UBOUND(SrcInputData%Mesh,1) + IF (.NOT. ALLOCATED(DstInputData%Mesh)) THEN + ALLOCATE(DstInputData%Mesh(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Mesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcInputData%Mesh,1), UBOUND(SrcInputData%Mesh,1) + CALL MeshCopy( SrcInputData%Mesh(i1), DstInputData%Mesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE StC_CopyInput + + SUBROUTINE StC_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(StC_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputData%Mesh)) THEN +DO i1 = LBOUND(InputData%Mesh,1), UBOUND(InputData%Mesh,1) + CALL MeshDestroy( InputData%Mesh(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%Mesh) +ENDIF + END SUBROUTINE StC_DestroyInput + + SUBROUTINE StC_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Mesh allocated yes/no + IF ( ALLOCATED(InData%Mesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Mesh upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%Mesh,1), UBOUND(InData%Mesh,1) + Int_BufSz = Int_BufSz + 3 ! Mesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Mesh + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Mesh + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Mesh + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%Mesh) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Mesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Mesh,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Mesh,1), UBOUND(InData%Mesh,1) + CALL MeshPack( InData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE StC_PackInput + + SUBROUTINE StC_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Mesh not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Mesh)) DEALLOCATE(OutData%Mesh) + ALLOCATE(OutData%Mesh(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Mesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Mesh,1), UBOUND(OutData%Mesh,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE StC_UnPackInput + + SUBROUTINE StC_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_OutputType), INTENT(INOUT) :: SrcOutputData + TYPE(StC_OutputType), INTENT(INOUT) :: DstOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOutputData%Mesh)) THEN + i1_l = LBOUND(SrcOutputData%Mesh,1) + i1_u = UBOUND(SrcOutputData%Mesh,1) + IF (.NOT. ALLOCATED(DstOutputData%Mesh)) THEN + ALLOCATE(DstOutputData%Mesh(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Mesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcOutputData%Mesh,1), UBOUND(SrcOutputData%Mesh,1) + CALL MeshCopy( SrcOutputData%Mesh(i1), DstOutputData%Mesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE StC_CopyOutput + + SUBROUTINE StC_DestroyOutput( OutputData, ErrStat, ErrMsg ) + TYPE(StC_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OutputData%Mesh)) THEN +DO i1 = LBOUND(OutputData%Mesh,1), UBOUND(OutputData%Mesh,1) + CALL MeshDestroy( OutputData%Mesh(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(OutputData%Mesh) +ENDIF + END SUBROUTINE StC_DestroyOutput + + SUBROUTINE StC_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_OutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Mesh allocated yes/no + IF ( ALLOCATED(InData%Mesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Mesh upper/lower bounds for each dimension + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + DO i1 = LBOUND(InData%Mesh,1), UBOUND(InData%Mesh,1) + Int_BufSz = Int_BufSz + 3 ! Mesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Mesh + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Mesh + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Mesh + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%Mesh) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Mesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Mesh,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Mesh,1), UBOUND(InData%Mesh,1) + CALL MeshPack( InData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE StC_PackOutput + + SUBROUTINE StC_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_OutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Mesh not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Mesh)) DEALLOCATE(OutData%Mesh) + ALLOCATE(OutData%Mesh(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Mesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Mesh,1), UBOUND(OutData%Mesh,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%Mesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! Mesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE StC_UnPackOutput + + + SUBROUTINE StC_Input_ExtrapInterp(u, t, u_out, t_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time +! values of u (which has values associated with times in t). Order of the interpolation is given by the size of u +! +! expressions below based on either +! +! f(t) = a +! f(t) = a + b * t, or +! f(t) = a + b * t + c * t**2 +! +! where a, b and c are determined as the solution to +! f(t1) = u1, f(t2) = u2, f(t3) = u3 (as appropriate) +! +!.................................................................................................................................. + + TYPE(StC_InputType), INTENT(INOUT) :: u(:) ! Input at t1 > t2 > t3 + REAL(DbKi), INTENT(IN ) :: t(:) ! Times associated with the Inputs + TYPE(StC_InputType), INTENT(INOUT) :: u_out ! Input at tin_out + REAL(DbKi), INTENT(IN ) :: t_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + INTEGER(IntKi) :: order ! order of polynomial fit (max 2) + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Input_ExtrapInterp' + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + if ( size(t) .ne. size(u)) then + CALL SetErrStat(ErrID_Fatal,'size(t) must equal size(u)',ErrStat,ErrMsg,RoutineName) + RETURN + endif + order = SIZE(u) - 1 + IF ( order .eq. 0 ) THEN + CALL StC_CopyInput(u(1), u_out, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE IF ( order .eq. 1 ) THEN + CALL StC_Input_ExtrapInterp1(u(1), u(2), t, u_out, t_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE IF ( order .eq. 2 ) THEN + CALL StC_Input_ExtrapInterp2(u(1), u(2), u(3), t, u_out, t_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE + CALL SetErrStat(ErrID_Fatal,'size(u) must be less than 4 (order must be less than 3).',ErrStat,ErrMsg,RoutineName) + RETURN + ENDIF + END SUBROUTINE StC_Input_ExtrapInterp + + + SUBROUTINE StC_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time +! values of u (which has values associated with times in t). Order of the interpolation is 1. +! +! f(t) = a + b * t, or +! +! where a and b are determined as the solution to +! f(t1) = u1, f(t2) = u2 +! +!.................................................................................................................................. + + TYPE(StC_InputType), INTENT(INOUT) :: u1 ! Input at t1 > t2 + TYPE(StC_InputType), INTENT(INOUT) :: u2 ! Input at t2 + REAL(DbKi), INTENT(IN ) :: tin(2) ! Times associated with the Inputs + TYPE(StC_InputType), INTENT(INOUT) :: u_out ! Input at tin_out + REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + REAL(DbKi) :: t(2) ! Times associated with the Inputs + REAL(DbKi) :: t_out ! Time to which to be extrap/interpd + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Input_ExtrapInterp1' + REAL(DbKi) :: b ! temporary for extrapolation/interpolation + REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i1 ! dim1 counter variable for arrays + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + ! we'll subtract a constant from the times to resolve some + ! numerical issues when t gets large (and to simplify the equations) + t = tin - tin(1) + t_out = tin_out - tin(1) + + IF ( EqualRealNos( t(1), t(2) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + + ScaleFactor = t_out / t(2) +IF (ALLOCATED(u_out%Mesh) .AND. ALLOCATED(u1%Mesh)) THEN + DO i1 = LBOUND(u_out%Mesh,1),UBOUND(u_out%Mesh,1) + CALL MeshExtrapInterp1(u1%Mesh(i1), u2%Mesh(i1), tin, u_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated + END SUBROUTINE StC_Input_ExtrapInterp1 + + + SUBROUTINE StC_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time +! values of u (which has values associated with times in t). Order of the interpolation is 2. +! +! expressions below based on either +! +! f(t) = a + b * t + c * t**2 +! +! where a, b and c are determined as the solution to +! f(t1) = u1, f(t2) = u2, f(t3) = u3 +! +!.................................................................................................................................. + + TYPE(StC_InputType), INTENT(INOUT) :: u1 ! Input at t1 > t2 > t3 + TYPE(StC_InputType), INTENT(INOUT) :: u2 ! Input at t2 > t3 + TYPE(StC_InputType), INTENT(INOUT) :: u3 ! Input at t3 + REAL(DbKi), INTENT(IN ) :: tin(3) ! Times associated with the Inputs + TYPE(StC_InputType), INTENT(INOUT) :: u_out ! Input at tin_out + REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + REAL(DbKi) :: t(3) ! Times associated with the Inputs + REAL(DbKi) :: t_out ! Time to which to be extrap/interpd + INTEGER(IntKi) :: order ! order of polynomial fit (max 2) + REAL(DbKi) :: b ! temporary for extrapolation/interpolation + REAL(DbKi) :: c ! temporary for extrapolation/interpolation + REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Input_ExtrapInterp2' + INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i1 ! dim1 counter variable for arrays + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + ! we'll subtract a constant from the times to resolve some + ! numerical issues when t gets large (and to simplify the equations) + t = tin - tin(1) + t_out = tin_out - tin(1) + + IF ( EqualRealNos( t(1), t(2) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + ELSE IF ( EqualRealNos( t(2), t(3) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(2) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + ELSE IF ( EqualRealNos( t(1), t(3) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + + ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) +IF (ALLOCATED(u_out%Mesh) .AND. ALLOCATED(u1%Mesh)) THEN + DO i1 = LBOUND(u_out%Mesh,1),UBOUND(u_out%Mesh,1) + CALL MeshExtrapInterp2(u1%Mesh(i1), u2%Mesh(i1), u3%Mesh(i1), tin, u_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated + END SUBROUTINE StC_Input_ExtrapInterp2 + + + SUBROUTINE StC_Output_ExtrapInterp(y, t, y_out, t_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time +! values of y (which has values associated with times in t). Order of the interpolation is given by the size of y +! +! expressions below based on either +! +! f(t) = a +! f(t) = a + b * t, or +! f(t) = a + b * t + c * t**2 +! +! where a, b and c are determined as the solution to +! f(t1) = y1, f(t2) = y2, f(t3) = y3 (as appropriate) +! +!.................................................................................................................................. + + TYPE(StC_OutputType), INTENT(INOUT) :: y(:) ! Output at t1 > t2 > t3 + REAL(DbKi), INTENT(IN ) :: t(:) ! Times associated with the Outputs + TYPE(StC_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out + REAL(DbKi), INTENT(IN ) :: t_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + INTEGER(IntKi) :: order ! order of polynomial fit (max 2) + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Output_ExtrapInterp' + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + if ( size(t) .ne. size(y)) then + CALL SetErrStat(ErrID_Fatal,'size(t) must equal size(y)',ErrStat,ErrMsg,RoutineName) + RETURN + endif + order = SIZE(y) - 1 + IF ( order .eq. 0 ) THEN + CALL StC_CopyOutput(y(1), y_out, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE IF ( order .eq. 1 ) THEN + CALL StC_Output_ExtrapInterp1(y(1), y(2), t, y_out, t_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE IF ( order .eq. 2 ) THEN + CALL StC_Output_ExtrapInterp2(y(1), y(2), y(3), t, y_out, t_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ELSE + CALL SetErrStat(ErrID_Fatal,'size(y) must be less than 4 (order must be less than 3).',ErrStat,ErrMsg,RoutineName) + RETURN + ENDIF + END SUBROUTINE StC_Output_ExtrapInterp + + + SUBROUTINE StC_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time +! values of y (which has values associated with times in t). Order of the interpolation is 1. +! +! f(t) = a + b * t, or +! +! where a and b are determined as the solution to +! f(t1) = y1, f(t2) = y2 +! +!.................................................................................................................................. + + TYPE(StC_OutputType), INTENT(INOUT) :: y1 ! Output at t1 > t2 + TYPE(StC_OutputType), INTENT(INOUT) :: y2 ! Output at t2 + REAL(DbKi), INTENT(IN ) :: tin(2) ! Times associated with the Outputs + TYPE(StC_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out + REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + REAL(DbKi) :: t(2) ! Times associated with the Outputs + REAL(DbKi) :: t_out ! Time to which to be extrap/interpd + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Output_ExtrapInterp1' + REAL(DbKi) :: b ! temporary for extrapolation/interpolation + REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i1 ! dim1 counter variable for arrays + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + ! we'll subtract a constant from the times to resolve some + ! numerical issues when t gets large (and to simplify the equations) + t = tin - tin(1) + t_out = tin_out - tin(1) + + IF ( EqualRealNos( t(1), t(2) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + + ScaleFactor = t_out / t(2) +IF (ALLOCATED(y_out%Mesh) .AND. ALLOCATED(y1%Mesh)) THEN + DO i1 = LBOUND(y_out%Mesh,1),UBOUND(y_out%Mesh,1) + CALL MeshExtrapInterp1(y1%Mesh(i1), y2%Mesh(i1), tin, y_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated + END SUBROUTINE StC_Output_ExtrapInterp1 + + + SUBROUTINE StC_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, ErrMsg ) +! +! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time +! values of y (which has values associated with times in t). Order of the interpolation is 2. +! +! expressions below based on either +! +! f(t) = a + b * t + c * t**2 +! +! where a, b and c are determined as the solution to +! f(t1) = y1, f(t2) = y2, f(t3) = y3 +! +!.................................................................................................................................. + + TYPE(StC_OutputType), INTENT(INOUT) :: y1 ! Output at t1 > t2 > t3 + TYPE(StC_OutputType), INTENT(INOUT) :: y2 ! Output at t2 > t3 + TYPE(StC_OutputType), INTENT(INOUT) :: y3 ! Output at t3 + REAL(DbKi), INTENT(IN ) :: tin(3) ! Times associated with the Outputs + TYPE(StC_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out + REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! local variables + REAL(DbKi) :: t(3) ! Times associated with the Outputs + REAL(DbKi) :: t_out ! Time to which to be extrap/interpd + INTEGER(IntKi) :: order ! order of polynomial fit (max 2) + REAL(DbKi) :: b ! temporary for extrapolation/interpolation + REAL(DbKi) :: c ! temporary for extrapolation/interpolation + REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation + INTEGER(IntKi) :: ErrStat2 ! local errors + CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors + CHARACTER(*), PARAMETER :: RoutineName = 'StC_Output_ExtrapInterp2' + INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i1 ! dim1 counter variable for arrays + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + ! we'll subtract a constant from the times to resolve some + ! numerical issues when t gets large (and to simplify the equations) + t = tin - tin(1) + t_out = tin_out - tin(1) + + IF ( EqualRealNos( t(1), t(2) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + ELSE IF ( EqualRealNos( t(2), t(3) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(2) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + ELSE IF ( EqualRealNos( t(1), t(3) ) ) THEN + CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + + ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) +IF (ALLOCATED(y_out%Mesh) .AND. ALLOCATED(y1%Mesh)) THEN + DO i1 = LBOUND(y_out%Mesh,1),UBOUND(y_out%Mesh,1) + CALL MeshExtrapInterp2(y1%Mesh(i1), y2%Mesh(i1), y3%Mesh(i1), tin, y_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated + END SUBROUTINE StC_Output_ExtrapInterp2 + +END MODULE StrucCtrl_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/servodyn/src/TMD.f90 b/modules/servodyn/src/TMD.f90 deleted file mode 100644 index df29a5426d..0000000000 --- a/modules/servodyn/src/TMD.f90 +++ /dev/null @@ -1,1692 +0,0 @@ -!********************************************************************************************************************************** -! WLaCava (WGL) and Matt Lackner (MAL) -! Tuned Mass Damper Module -!********************************************************************************************************************************** -MODULE TMD - - USE TMD_Types - USE NWTC_Library - - IMPLICIT NONE - - PRIVATE - - - TYPE(ProgDesc), PARAMETER :: TMD_Ver = ProgDesc( 'TMD', '', '' ) - - - - - ! ..... Public Subroutines ................................................................................................... - - PUBLIC :: TMD_Init ! Initialization routine - PUBLIC :: TMD_End ! Ending routine (includes clean up) - - PUBLIC :: TMD_UpdateStates ! Loose coupling routine for solving for constraint states, integrating - ! continuous states, and updating discrete states - PUBLIC :: TMD_CalcOutput ! Routine for computing outputs - - ! PUBLIC :: TMD_CalcConstrStateResidual ! Tight coupling routine for returning the constraint state residual - PUBLIC :: TMD_CalcContStateDeriv ! Tight coupling routine for computing derivatives of continuous states - - !PUBLIC :: TMD_UpdateDiscState ! Tight coupling routine for updating discrete states - - !PUBLIC :: TMD_JacobianPInput ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- - ! ! (Xd), and constraint-state (Z) equations all with respect to the inputs (u) - !PUBLIC :: TMD_JacobianPContState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- - ! ! (Xd), and constraint-state (Z) equations all with respect to the continuous - ! ! states (x) - !PUBLIC :: TMD_JacobianPDiscState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- - ! ! (Xd), and constraint-state (Z) equations all with respect to the discrete - ! ! states (xd) - !PUBLIC :: TMD_JacobianPConstrState ! Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- - ! (Xd), and constraint-state (Z) equations all with respect to the constraint - ! states (z) - - - INTEGER(IntKi), PRIVATE, PARAMETER :: ControlMode_NONE = 0 !< The (TMD-universal) control code for not using a particular type of control - - INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Indept = 1 !< independent DOFs - INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Omni = 2 !< omni-directional - - INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Semi = 1 !< semi-active control - INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Active = 2 !< active control - - INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_vel = 1 !< 1: velocity-based ground hook control; - INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_invVel = 2 !< 2: Inverse velocity-based ground hook control - INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_disp = 3 !< 3: displacement-based ground hook control - INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_Ph_FF = 4 !< 4: Phase difference Algorithm with Friction Force - INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_Ph_DF = 5 !< 5: Phase difference Algorithm with Damping Force - - -CONTAINS -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine is called at the start of the simulation to perform initialization steps. -!! The parameters are set here and not changed during the simulation. -!! The initial states and initial guess for the input are defined. -SUBROUTINE TMD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg ) -!.................................................................................................................................. - - TYPE(TMD_InitInputType), INTENT(INOUT) :: InitInp !< Input data for initialization routine. - TYPE(TMD_InputType), INTENT( OUT) :: u !< An initial guess for the input; input mesh must be defined - TYPE(TMD_ParameterType), INTENT( OUT) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT( OUT) :: x !< Initial continuous states - TYPE(TMD_DiscreteStateType), INTENT( OUT) :: xd !< Initial discrete states - TYPE(TMD_ConstraintStateType), INTENT( OUT) :: z !< Initial guess of the constraint states - TYPE(TMD_OtherStateType), INTENT( OUT) :: OtherState !< Initial other states - TYPE(TMD_OutputType), INTENT(INOUT) :: y !< Initial system outputs (outputs are not calculated; - !! only the output mesh is initialized) - TYPE(TMD_MiscVarType), INTENT( OUT) :: m !< Misc (optimization) variables - REAL(DbKi), INTENT(INOUT) :: Interval !< Coupling interval in seconds: the rate that - !! (1) TMD_UpdateStates() is called in loose coupling & - !! (2) TMD_UpdateDiscState() is called in tight coupling. - !! Input is the suggested time from the glue code; - !! Output is the actual coupling interval that will be used - !! by the glue code. - TYPE(TMD_InitOutputType), INTENT( OUT) :: InitOut !< Output for initialization routine - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - - ! Local variables - INTEGER(IntKi) :: NumOuts - TYPE(TMD_InputFile) :: InputFileData ! Data stored in the module's input file - - INTEGER(IntKi) :: UnEcho ! Unit number for the echo file - INTEGER(IntKi) :: ErrStat2 ! local error status - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message - - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Init' - - ! Initialize ErrStat - - ErrStat = ErrID_None - ErrMsg = '' - NumOuts = 0 - - InitOut%dummyInitOut = 0.0_SiKi ! initialize this so compiler doesn't warn about un-set intent(out) variables - - ! Initialize the NWTC Subroutine Library - CALL NWTC_Init( EchoLibVer=.FALSE. ) - - ! Display the module information - CALL DispNVD( TMD_Ver ) - - !............................................................................................ - ! Read the input file and validate the data - ! (note p%RootName must be set first!) - !............................................................................................ - p%RootName = TRIM(InitInp%RootName)//'.TMD' ! all of the output file names from this module will end with '.TMD' - - - CALL TMD_ReadInput( InitInp%InputFile, InputFileData, Interval, p%RootName, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - - - !CALL ValidatePrimaryData( InputFileData, InitInp%NumBl, ErrStat2, ErrMsg2 ) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF (ErrStat >= AbortErrLev) RETURN - - IF ( InputFileData%TMD_DOF_MODE /= ControlMode_None .and. InputFileData%TMD_DOF_MODE /= DOFMode_Indept .and. InputFileData%TMD_DOF_MODE /= DOFMode_Omni ) & - CALL SetErrStat( ErrID_Fatal, 'DOF mode (TMD_DOF_MODE) must be 0 (no DOF), 1 (two independent DOFs), or 2 (omni-directional).', ErrStat, ErrMsg, RoutineName ) - - IF ( InputFileData%TMD_CMODE /= ControlMode_None .and. InputFileData%TMD_CMODE /= CMODE_Semi ) & - CALL SetErrStat( ErrID_Fatal, 'Control mode (TMD_CMode) must be 0 (none) or 1 (semi-active) in this version of TMD.', ErrStat, ErrMsg, RoutineName ) -! IF ( InputFileData%TMD_CMODE /= ControlMode_None .and. InputFileData%TMD_CMODE /= CMODE_Semi .and. InputFileData%TMD_CMODE /= CMODE_Active) & -! CALL SetErrStat( ErrID_Fatal, 'Control mode (TMD_CMode) must be 0 (none), 1 (semi-active), or 2 (active).', ErrStat, ErrMsg, RoutineName ) - - IF ( InputFileData%TMD_SA_MODE /= SA_CMODE_GH_vel .and. & - InputFileData%TMD_SA_MODE /= SA_CMODE_GH_invVel .and. & - InputFileData%TMD_SA_MODE /= SA_CMODE_GH_disp .and. & - InputFileData%TMD_SA_MODE /= SA_CMODE_Ph_FF .and. & - InputFileData%TMD_SA_MODE /= SA_CMODE_Ph_DF ) then - CALL SetErrStat( ErrID_Fatal, 'Semi-active control mode (TMD_SA_MODE) must be 1 (velocity-based ground hook control), '// & - '2 (inverse velocity-based ground hook control), 3 (displacement-based ground hook control), '// & - '4 (phase difference algorithm with friction force), or 5 (phase difference algorithm with damping force).', ErrStat, ErrMsg, RoutineName ) - END IF - - - !............................................................................................ - ! Define parameters here: - !............................................................................................ - CALL TMD_SetParameters( InputFileData, p, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF (ErrStat >= AbortErrLev) RETURN - - p%DT = Interval - p%Gravity = InitInp%Gravity - ! Destroy the local initialization data - !CALL CleanUp() - - !............................................................................................ - ! Define initial system states here: - !............................................................................................ - ! Define initial system states here: - - xd%DummyDiscState = 0 - z%DummyConstrState = 0 - - ! Initialize other states here: - OtherState%DummyOtherState = 0 - - ! misc variables: external and stop forces - m%F_ext = 0.0_ReKi ! whole array initializaton - m%F_stop = 0.0_ReKi ! whole array initializaton - m%F_fr = 0.0_ReKi ! whole array initialization - m%C_ctrl = 0.0_ReKi ! whole array initialization - m%C_Brake = 0.0_ReKi ! whole array initialization - m%F_table = 0.0_ReKi ! whole array initialization - - ! Define initial guess for the system inputs here: - x%tmd_x(1) = p%X_DSP - x%tmd_x(2) = 0 - x%tmd_x(3) = p%Y_DSP - x%tmd_x(4) = 0 - - - ! Define system output initializations (set up mesh) here: - ! Create the input and output meshes associated with lumped loads - - CALL MeshCreate( BlankMesh = u%Mesh & - ,IOS = COMPONENT_INPUT & - ,Nnodes = 1 & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 & - ,TranslationDisp = .TRUE. & - ,Orientation = .TRUE. & - ,TranslationVel = .TRUE. & - ,RotationVel = .TRUE. & - ,TranslationAcc = .TRUE. & - ,RotationAcc = .TRUE.) - - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF ( ErrStat >= AbortErrLev ) THEN - CALL Cleanup() - RETURN - END IF - - ! Create the node on the mesh - - - ! make position node at point P (rest position of TMDs, somewhere above the yaw bearing) - CALL MeshPositionNode (u%Mesh & - , 1 & - , (/InitInp%r_N_O_G(1)+InputFileData%TMD_P_X, InitInp%r_N_O_G(2)+InputFileData%TMD_P_Y, InitInp%r_N_O_G(3)+InputFileData%TMD_P_Z/) & - , ErrStat2 & - , ErrMsg2 ) - - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - - ! Create the mesh element - CALL MeshConstructElement ( u%Mesh & - , ELEMENT_POINT & - , ErrStat2 & - , ErrMsg2 & - , 1 & - ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - - CALL MeshCommit ( u%Mesh & - , ErrStat2 & - , ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF ( ErrStat >= AbortErrLev ) THEN - CALL Cleanup() - RETURN - END IF - - - CALL MeshCopy ( SrcMesh = u%Mesh & - ,DestMesh = y%Mesh & - ,CtrlCode = MESH_SIBLING & - ,IOS = COMPONENT_OUTPUT & - ,ErrStat = ErrStat2 & - ,ErrMess = ErrMsg2 & - ,Force = .TRUE. & - ,Moment = .TRUE. ) - - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF ( ErrStat >= AbortErrLev ) THEN - CALL Cleanup() - RETURN - END IF - - - u%Mesh%RemapFlag = .TRUE. - y%Mesh%RemapFlag = .TRUE. - - !bjj: removed for now; output handled in ServoDyn - !IF (NumOuts > 0) THEN - ! ALLOCATE( y%WriteOutput(NumOuts), STAT = ErrStat ) - ! IF ( ErrStat/= 0 ) THEN - ! CALL SetErrStat(ErrID_Fatal,'Error allocating output array.',ErrStat,ErrMsg,'TMD_Init') - ! CALL Cleanup() - ! RETURN - ! END IF - ! y%WriteOutput = 0 - ! - ! ! Define initialization-routine output here: - ! ALLOCATE( InitOut%WriteOutputHdr(NumOuts), InitOut%WriteOutputUnt(NumOuts), STAT = ErrStat ) - ! IF ( ErrStat/= 0 ) THEN - ! CALL SetErrStat(ErrID_Fatal,'Error allocating output header and units arrays.',ErrStat,ErrMsg,'TMD_Init') - ! CALL Cleanup() - ! RETURN - ! END IF - ! - ! DO i=1,NumOuts - ! InitOut%WriteOutputHdr(i) = "Heading"//trim(num2lstr(i)) - ! InitOut%WriteOutputUnt(i) = "(-)" - ! END DO - ! - !END IF - - !bjj: need to initialize headers/units - - ! If you want to choose your own rate instead of using what the glue code suggests, tell the glue code the rate at which - ! this module must be called here: - !Interval = p%DT - - call cleanup() - -!................................ -CONTAINS - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev - !............................................................................................................................... - - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) - - - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ - - IF ( ErrID /= ErrID_None ) THEN - - IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'TMD_Init:'//TRIM(Msg) - ErrStat = MAX(ErrStat, ErrID) - - !......................................................................................................................... - ! Clean up if we're going to return on error: close files, deallocate local arrays - !......................................................................................................................... - IF ( ErrStat >= AbortErrLev ) THEN - call cleanup() - END IF - - END IF - - - END SUBROUTINE CheckError -!......................................... - SUBROUTINE cleanup() - - IF ( UnEcho > 0 ) CLOSE( UnEcho ) - - CALL TMD_DestroyInputFile( InputFileData, ErrStat2, ErrMsg2) - - END SUBROUTINE cleanup -!......................................... -END SUBROUTINE TMD_Init -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine is called at the end of the simulation. -SUBROUTINE TMD_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) -!.................................................................................................................................. - - TYPE(TMD_InputType), INTENT(INOUT) :: u !< System inputs - TYPE(TMD_ParameterType), INTENT(INOUT) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states - TYPE(TMD_DiscreteStateType), INTENT(INOUT) :: xd !< Discrete states - TYPE(TMD_ConstraintStateType), INTENT(INOUT) :: z !< Constraint states - TYPE(TMD_OtherStateType), INTENT(INOUT) :: OtherState !< Other states - TYPE(TMD_OutputType), INTENT(INOUT) :: y !< System outputs - TYPE(TMD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - - ! Initialize ErrStat - - ErrStat = ErrID_None - ErrMsg = "" - - - ! Place any last minute operations or calculations here: - - - - ! Write the TMD-level output file data if the user requested module-level output - ! and the current time has advanced since the last stored time step. - - - - ! Close files here: - - - ! Destroy the input data: - - CALL TMD_DestroyInput( u, ErrStat, ErrMsg ) - - - ! Destroy the parameter data: - - CALL TMD_DestroyParam( p, ErrStat, ErrMsg ) - - - ! Destroy the state data: - - CALL TMD_DestroyContState( x, ErrStat, ErrMsg ) - CALL TMD_DestroyDiscState( xd, ErrStat, ErrMsg ) - CALL TMD_DestroyConstrState( z, ErrStat, ErrMsg ) - CALL TMD_DestroyOtherState( OtherState, ErrStat, ErrMsg ) - - CALL TMD_DestroyMisc( m, ErrStat, ErrMsg ) - - ! Destroy the output data: - - CALL TMD_DestroyOutput( y, ErrStat, ErrMsg ) - -END SUBROUTINE TMD_End -!---------------------------------------------------------------------------------------------------------------------------------- -!> Loose coupling routine for solving constraint states, integrating continuous states, and updating discrete states. -!! Continuous, constraint, and discrete states are updated to values at t + Interval. -SUBROUTINE TMD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) -!.................................................................................................................................. - - REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds - INTEGER(IntKi), INTENT(IN ) :: n !< Current step of the simulation: t = n*Interval - TYPE(TMD_InputType), INTENT(INOUT) :: Inputs(:) !< Inputs at InputTimes - REAL(DbKi), INTENT(IN ) :: InputTimes(:) !< Times in seconds associated with Inputs - TYPE(TMD_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: x !< Input: Continuous states at t; - !! Output: Continuous states at t + Interval - TYPE(TMD_DiscreteStateType), INTENT(INOUT) :: xd !< Input: Discrete states at t; - !! Output: Discrete states at t + Interval - TYPE(TMD_ConstraintStateType), INTENT(INOUT) :: z !< Input: Constraint states at t; - !! Output: Constraint states at t + Interval - TYPE(TMD_OtherStateType), INTENT(INOUT) :: OtherState !< Input: Other states at t; - !! Output: Other states at t + Interval - TYPE(TMD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! Local variables - !INTEGER :: I ! Generic loop counter - !TYPE(TMD_ContinuousStateType) :: dxdt ! Continuous state derivatives at t - !TYPE(TMD_DiscreteStateType) :: xd_t ! Discrete states at t (copy) - !TYPE(TMD_ConstraintStateType) :: z_Residual ! Residual of the constraint state functions (Z) - !TYPE(TMD_InputType) :: u ! Instantaneous inputs - !INTEGER(IntKi) :: ErrStat2 ! Error status of the operation (secondary error) - !CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None - !INTEGER :: nTime ! number of inputs - - - CALL TMD_RK4( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) - -END SUBROUTINE TMD_UpdateStates -!---------------------------------------------------------------------------------------------------------------------------------- -!> This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations: -!! -!! Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). -!! Define constants k1, k2, k3, and k4 as -!! k1 = dt * f(t , x_t ) -!! k2 = dt * f(t + dt/2 , x_t + k1/2 ) -!! k3 = dt * f(t + dt/2 , x_t + k2/2 ), and -!! k4 = dt * f(t + dt , x_t + k3 ). -!! Then the continuous states at t = t + dt are -!! x_(t+dt) = x_t + k1/6 + k2/3 + k3/3 + k4/6 + O(dt^5) -!! -!! For details, see: -!! Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Runge-Kutta Method" and "Adaptive Step Size Control for -!! Runge-Kutta." Sections 16.1 and 16.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: -!! Cambridge University Press, pp. 704-716, 1992. -SUBROUTINE TMD_RK4( t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) -!.................................................................................................................................. - - REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds - INTEGER(IntKi), INTENT(IN ) :: n !< time step number - TYPE(TMD_InputType), INTENT(INOUT) :: u(:) !< Inputs at t (out only for mesh record-keeping in ExtrapInterp routine) - REAL(DbKi), INTENT(IN ) :: utimes(:) !< times of input - TYPE(TMD_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states at t on input at t + dt on output - TYPE(TMD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t - TYPE(TMD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t (possibly a guess) - TYPE(TMD_OtherStateType), INTENT(INOUT) :: OtherState !< Other states at t - TYPE(TMD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables - - TYPE(TMD_ContinuousStateType) :: xdot ! time derivatives of continuous states - TYPE(TMD_ContinuousStateType) :: k1 ! RK4 constant; see above - TYPE(TMD_ContinuousStateType) :: k2 ! RK4 constant; see above - TYPE(TMD_ContinuousStateType) :: k3 ! RK4 constant; see above - TYPE(TMD_ContinuousStateType) :: k4 ! RK4 constant; see above - TYPE(TMD_ContinuousStateType) :: x_tmp ! Holds temporary modification to x - TYPE(TMD_InputType) :: u_interp ! interpolated value of inputs - - INTEGER(IntKi) :: ErrStat2 ! local error status - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local error message (ErrMsg) - - ! Initialize ErrStat - - ErrStat = ErrID_None - ErrMsg = "" - - CALL TMD_CopyContState( x, k1, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - CALL TMD_CopyContState( x, k2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - CALL TMD_CopyContState( x, k3, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - CALL TMD_CopyContState( x, k4, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - CALL TMD_CopyContState( x, x_tmp, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - - CALL TMD_CopyInput( u(1), u_interp, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! interpolate u to find u_interp = u(t) - CALL TMD_Input_ExtrapInterp( u, utimes, u_interp, t, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! find xdot at t - CALL TMD_CalcContStateDeriv( t, u_interp, p, x, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - k1%tmd_x = p%dt * xdot%tmd_x - - x_tmp%tmd_x = x%tmd_x + 0.5 * k1%tmd_x - - ! interpolate u to find u_interp = u(t + dt/2) - CALL TMD_Input_ExtrapInterp(u, utimes, u_interp, t+0.5*p%dt, ErrStat2, ErrMsg2) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! find xdot at t + dt/2 - CALL TMD_CalcContStateDeriv( t + 0.5*p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - k2%tmd_x = p%dt * xdot%tmd_x - - x_tmp%tmd_x = x%tmd_x + 0.5 * k2%tmd_x - - ! find xdot at t + dt/2 - CALL TMD_CalcContStateDeriv( t + 0.5*p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - k3%tmd_x = p%dt * xdot%tmd_x - - x_tmp%tmd_x = x%tmd_x + k3%tmd_x - - ! interpolate u to find u_interp = u(t + dt) - CALL TMD_Input_ExtrapInterp(u, utimes, u_interp, t + p%dt, ErrStat2, ErrMsg2) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! find xdot at t + dt - CALL TMD_CalcContStateDeriv( t + p%dt, u_interp, p, x_tmp, xd, z, OtherState, m, xdot, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - k4%tmd_x = p%dt * xdot%tmd_x - - x%tmd_x = x%tmd_x + ( k1%tmd_x + 2. * k2%tmd_x + 2. * k3%tmd_x + k4%tmd_x ) / 6. - ! x%tmd_dxdt = x%tmd_dxdt + ( k1%tmd_dxdt + 2. * k2%tmd_dxdt + 2. * k3%tmd_dxdt + k4%tmd_dxdt ) / 6. - - ! clean up local variables: - CALL ExitThisRoutine( ) - -CONTAINS - !............................................................................................................................... - SUBROUTINE ExitThisRoutine() - ! This subroutine destroys all the local variables - !............................................................................................................................... - - ! local variables - INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) - CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) - - - CALL TMD_DestroyContState( xdot, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyContState( k1, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyContState( k2, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyContState( k3, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyContState( k4, ErrStat3, ErrMsg3 ) - CALL TMD_DestroyContState( x_tmp, ErrStat3, ErrMsg3 ) - - CALL TMD_DestroyInput( u_interp, ErrStat3, ErrMsg3 ) - - END SUBROUTINE ExitThisRoutine - !............................................................................................................................... - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev - !............................................................................................................................... - - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) - - ! local variables - INTEGER(IntKi) :: ErrStat3 ! The error identifier (ErrStat) - CHARACTER(ErrMsgLen) :: ErrMsg3 ! The error message (ErrMsg) - - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ - - IF ( ErrID /= ErrID_None ) THEN - - IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'TMD_RK4:'//TRIM(Msg) - ErrStat = MAX(ErrStat,ErrID) - - !......................................................................................................................... - ! Clean up if we're going to return on error: close files, deallocate local arrays - !......................................................................................................................... - - IF ( ErrStat >= AbortErrLev ) CALL ExitThisRoutine( ) - - - END IF - - END SUBROUTINE CheckError - -END SUBROUTINE TMD_RK4 -!---------------------------------------------------------------------------------------------------------------------------------- -!> Routine for computing outputs, used in both loose and tight coupling. -SUBROUTINE TMD_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) -!.................................................................................................................................. - - REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds - TYPE(TMD_InputType), INTENT(IN ) :: u !< Inputs at Time - TYPE(TMD_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time - TYPE(TMD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time - TYPE(TMD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time - TYPE(TMD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at Time - TYPE(TMD_OutputType), INTENT(INOUT) :: y !< Outputs computed at Time (Input only so that mesh con- - !! nectivity information does not have to be recalculated) - TYPE(TMD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - - ! local variables - REAL(ReKi), dimension(3) :: a_G_O - REAL(ReKi), dimension(3) :: a_G_N - REAL(ReKi), dimension(3) :: F_P_N - REAL(ReKi), dimension(3) :: M_P_N - !nacelle movement in local coordinates - Real(ReKi), dimension(3) :: r_ddot_P_N - Real(ReKi), dimension(3) :: omega_N_O_N - Real(ReKi), dimension(3) :: alpha_N_O_N - !dependent accelerations - Real(ReKi) :: F_x_tmdY_P_N - Real(ReKi) :: F_z_tmdY_P_N - Real(ReKi) :: F_y_tmdX_P_N - Real(ReKi) :: F_z_tmdX_P_N - - Real(ReKi) :: F_x_tmdXY_P_N - Real(ReKi) :: F_z_tmdXY_P_N - Real(ReKi) :: F_y_tmdXY_P_N - - TYPE(TMD_ContinuousStateType) :: dxdt ! first time derivative of continuous states - - - ErrStat = ErrID_None - ErrMsg = "" - ! gravity vector in global coordinates - a_G_O (1) = 0 - a_G_O (2) = 0 - a_G_O (3) = -p%Gravity - - ! Compute nacelle and gravitational acceleration in nacelle coordinates - a_G_N = matmul(u%Mesh%Orientation(:,:,1),a_G_O) - r_ddot_P_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%TranslationAcc(:,1)) - omega_N_O_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%RotationVel(:,1)) - alpha_N_O_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%RotationAcc(:,1)) - - ! calculate the derivative, only to get updated values of m, which are used in the equations below - CALL TMD_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg ) - - IF (p%TMD_DOF_MODE == ControlMode_None .OR. p%TMD_DOF_MODE == DOFMode_Indept) THEN - - ! tmd external forces of dependent degrees: - F_x_tmdY_P_N = - p%M_Y * (a_G_N(1) - r_ddot_P_N(1) + (alpha_N_O_N(3) - omega_N_O_N(1)*omega_N_O_N(2))*x%tmd_x(3) + 2*omega_N_O_N(3)*x%tmd_x(4)) - F_z_tmdY_P_N = - p%M_Y * (a_G_N(3) - r_ddot_P_N(3) - (alpha_N_O_N(1) + omega_N_O_N(2)*omega_N_O_N(3))*x%tmd_x(3) - 2*omega_N_O_N(1)*x%tmd_x(4)) - - F_y_tmdX_P_N = - p%M_X *( a_G_N(2) - r_ddot_P_N(2) - (alpha_N_O_N(3) + omega_N_O_N(1)*omega_N_O_N(2))*x%tmd_x(1) - 2*omega_N_O_N(3)*x%tmd_x(2)) - F_z_tmdX_P_N = - p%M_X * (a_G_N(3) - r_ddot_P_N(3) + (alpha_N_O_N(2) - omega_N_O_N(1)*omega_N_O_N(3))*x%tmd_x(1) + 2*omega_N_O_N(2)*x%tmd_x(2)) - - ! forces in local coordinates - F_P_N(1) = p%K_X * x%tmd_x(1) + m%C_ctrl(1) * x%tmd_x(2) + m%C_Brake(1) * x%tmd_x(2) - m%F_stop(1) - m%F_ext(1) - m%F_fr(1) - F_x_tmdY_P_N + m%F_table(1) - F_P_N(2) = p%K_Y * x%tmd_x(3) + m%C_ctrl(2) * x%tmd_x(4) + m%C_Brake(2) * x%tmd_x(4) - m%F_stop(2) - m%F_ext(2) - m%F_fr(2) - F_y_tmdX_P_N + m%F_table(2) - F_P_N(3) = - F_z_tmdX_P_N - F_z_tmdY_P_N - - ! inertial contributions from mass of TMDs and acceleration of nacelle - ! forces in global coordinates - y%Mesh%Force(:,1) = matmul(transpose(u%Mesh%Orientation(:,:,1)),F_P_N) - - ! Moments on nacelle in local coordinates - M_P_N(1) = - F_z_tmdY_P_N * x%tmd_x(3) - M_P_N(2) = F_z_tmdX_P_N * x%tmd_x(1) - M_P_N(3) = (- F_x_tmdY_P_N) * x%tmd_x(3) + (F_y_tmdX_P_N) * x%tmd_x(1) - - ! moments in global coordinates - y%Mesh%Moment(:,1) = matmul(transpose(u%Mesh%Orientation(:,:,1)),M_P_N) - - ELSE IF (p%TMD_DOF_MODE == DOFMode_Omni) THEN - - !note: m%F_k_x and m%F_k_y are computed earlier in TMD_CalcContStateDeriv - - ! tmd external forces of dependent degrees: - F_x_tmdXY_P_N = 0 - F_y_tmdXY_P_N = 0 - F_z_tmdXY_P_N = - p%M_XY * (a_G_N(3) - r_ddot_P_N(3) - (alpha_N_O_N(1) + omega_N_O_N(2)*omega_N_O_N(3))*x%tmd_x(3) + (alpha_N_O_N(2) - omega_N_O_N(1)*omega_N_O_N(3))*x%tmd_x(1) - 2*omega_N_O_N(1)*x%tmd_x(4) + 2*omega_N_O_N(2)*x%tmd_x(2)) - - ! forces in local coordinates - F_P_N(1) = p%K_X * x%tmd_x(1) + m%C_ctrl(1) * x%tmd_x(2) + m%C_Brake(1) * x%tmd_x(2) - m%F_stop(1) - m%F_ext(1) - m%F_fr(1) - F_x_tmdXY_P_N + m%F_table(1)*(m%F_k_x) - F_P_N(2) = p%K_Y * x%tmd_x(3) + m%C_ctrl(2) * x%tmd_x(4) + m%C_Brake(2) * x%tmd_x(4) - m%F_stop(2) - m%F_ext(2) - m%F_fr(2) - F_y_tmdXY_P_N + m%F_table(2)*(m%F_k_y) - F_P_N(3) = - F_z_tmdXY_P_N - - ! inertial contributions from mass of TMDs and acceleration of nacelle - ! forces in global coordinates - y%Mesh%Force(:,1) = matmul(transpose(u%Mesh%Orientation(:,:,1)),F_P_N) - - ! Moments on nacelle in local coordinates - M_P_N(1) = - F_z_tmdXY_P_N * x%tmd_x(3) - M_P_N(2) = F_z_tmdXY_P_N * x%tmd_x(1) - M_P_N(3) = (- F_x_tmdXY_P_N) * x%tmd_x(3) + (F_y_tmdXY_P_N) * x%tmd_x(1) - - ! moments in global coordinates - y%Mesh%Moment(:,1) = matmul(transpose(u%Mesh%Orientation(:,:,1)),M_P_N) - - END IF - -END SUBROUTINE TMD_CalcOutput -!---------------------------------------------------------------------------------------------------------------------------------- -!> Tight coupling routine for computing derivatives of continuous states -SUBROUTINE TMD_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg ) -!.................................................................................................................................. - - REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds - TYPE(TMD_InputType), INTENT(IN ) :: u !< Inputs at Time - TYPE(TMD_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time - TYPE(TMD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time - TYPE(TMD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time - TYPE(TMD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at Time - TYPE(TMD_ContinuousStateType), INTENT( OUT) :: dxdt !< Continuous state derivatives at Time - TYPE(TMD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables - INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - ! local variables - REAL(ReKi), dimension(3) :: a_G_O - REAL(ReKi), dimension(3) :: a_G_N - REAL(ReKi), dimension(3) :: rddot_N_N - REAL(ReKi), dimension(3) :: omega_P_N ! angular velocity of nacelle transformed to nacelle orientation - Real(ReKi), dimension(3) :: alpha_P_N - - REAL(ReKi) :: B_X - REAL(ReKi) :: B_Y - REAL(ReKi), dimension(2) :: K ! tmd stiffness - Real(ReKi) :: denom ! denominator for omni-direction factors - - - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - - ! compute stop force (m%F_stop) - IF (p%Use_F_TBL) THEN - m%F_stop = 0.0_ReKi - ELSE - CALL TMD_CalcStopForce(x,p,m%F_stop) - END IF - - ! Compute stiffness - IF (p%Use_F_TBL) THEN ! use stiffness table - CALL SpringForceExtrapInterp(x,p,m%F_table) - K = 0.0_ReKi - ELSE ! use preset values - K(1) = p%K_X - K(2) = p%K_Y - END IF - - ! gravity vector in global coordinates - a_G_O (1) = 0 - a_G_O (2) = 0 - a_G_O (3) = -p%Gravity - - ! Compute nacelle and gravitational acceleration in nacelle coordinates - a_G_N = matmul(u%Mesh%Orientation(:,:,1),a_G_O) - rddot_N_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%TranslationAcc(:,1)) - omega_P_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%RotationVel(:,1)) - alpha_P_N = matmul(u%Mesh%Orientation(:,:,1),u%Mesh%RotationAcc(:,1)) - - ! NOTE: m%F_stop and m%F_table are calculated earlier - IF (p%TMD_DOF_MODE == ControlMode_None) THEN - ! Compute inputs - B_X = - rddot_N_N(1) + a_G_N(1) + 1 / p%M_X * ( m%F_ext(1) + m%F_stop(1) - m%F_table(1) ) - B_Y = - rddot_N_N(2) + a_G_N(2) + 1 / p%M_Y * ( m%F_ext(2) + m%F_stop(2) - m%F_table(2) ) - ELSE IF (p%TMD_DOF_MODE == DOFMode_Indept) THEN - ! Compute inputs - B_X = - rddot_N_N(1) + a_G_N(1) + 1 / p%M_X * ( m%F_ext(1) + m%F_stop(1) - m%F_table(1) ) - B_Y = - rddot_N_N(2) + a_G_N(2) + 1 / p%M_Y * ( m%F_ext(2) + m%F_stop(2) - m%F_table(2) ) - ELSE IF (p%TMD_DOF_MODE == DOFMode_Omni) THEN - - denom = SQRT(x%tmd_x(1)**2+x%tmd_x(3)**2) - IF ( EqualRealNos( denom, 0.0_ReKi) ) THEN - m%F_k_x = 0.0 - m%F_k_y = 0.0 - ELSE - m%F_k_x = x%tmd_x(1)/denom - m%F_k_y = x%tmd_x(3)/denom - END IF - - B_X = - rddot_N_N(1) + a_G_N(1) + 1 / p%M_XY * ( m%F_ext(1) + m%F_stop(1) - m%F_table(1)*(m%F_k_x) ) - B_Y = - rddot_N_N(2) + a_G_N(2) + 1 / p%M_XY * ( m%F_ext(2) + m%F_stop(2) - m%F_table(2)*(m%F_k_y) ) - END IF - - - ! Compute the first time derivatives, dxdt%tmd_x(1) and dxdt%tmd_x(3), of the continuous states,: - ! Compute elements 1 and 3 of dxdt%tmd_x so that we can compute m%C_ctrl,m%C_Brake, and m%F_fr in TMD_GroundHookDamp if necessary - IF (p%TMD_DOF_MODE == ControlMode_None) THEN - - dxdt%tmd_x = 0.0_ReKi ! Whole array - - ELSE - - IF (p%TMD_DOF_MODE == DOFMode_Indept .AND. .NOT. p%TMD_X_DOF) THEN - dxdt%tmd_x(1) = 0.0_ReKi - ELSE - dxdt%tmd_x(1) = x%tmd_x(2) - END IF - - IF (p%TMD_DOF_MODE == DOFMode_Indept .AND. .NOT. p%TMD_Y_DOF) THEN - dxdt%tmd_x(3) = 0.0_ReKi - ELSE - dxdt%tmd_x(3) = x%tmd_x(4) - END IF - - END IF - - - ! compute damping for dxdt%tmd_x(2) and dxdt%tmd_x(4) - IF (p%TMD_CMODE == ControlMode_None) THEN - m%C_ctrl(1) = p%C_X - m%C_ctrl(2) = p%C_Y - - m%C_Brake = 0.0_ReKi - m%F_fr = 0.0_ReKi - ELSE IF (p%TMD_CMODE == CMODE_Semi) THEN ! ground hook control - CALL TMD_GroundHookDamp(dxdt,x,u,p,m%C_ctrl,m%C_Brake,m%F_fr) - END IF - - - ! Compute the first time derivatives, dxdt%tmd_x(2) and dxdt%tmd_x(4), of the continuous states,: - IF (p%TMD_DOF_MODE == DOFMode_Indept) THEN - - IF (p%TMD_X_DOF) THEN - dxdt%tmd_x(2) = (omega_P_N(2)**2 + omega_P_N(3)**2 - K(1) / p%M_X) * x%tmd_x(1) - ( m%C_ctrl(1)/p%M_X ) * x%tmd_x(2) - ( m%C_Brake(1)/p%M_X ) * x%tmd_x(2) + B_X + m%F_fr(1) / p%M_X - ELSE - dxdt%tmd_x(2) = 0.0_ReKi - END IF - IF (p%TMD_Y_DOF) THEN - dxdt%tmd_x(4) = (omega_P_N(1)**2 + omega_P_N(3)**2 - K(2) / p%M_Y) * x%tmd_x(3) - ( m%C_ctrl(2)/p%M_Y ) * x%tmd_x(4) - ( m%C_Brake(2)/p%M_Y ) * x%tmd_x(4) + B_Y + m%F_fr(2) / p%M_Y - ELSE - dxdt%tmd_x(4) = 0.0_ReKi - END IF - - ELSE IF (p%TMD_DOF_MODE == DOFMode_Omni) THEN - ! Compute the first time derivatives of the continuous states of Omnidirectional TMD mode by sm 2015-0904 - dxdt%tmd_x(2) = (omega_P_N(2)**2 + omega_P_N(3)**2 - K(1) / p%M_XY) * x%tmd_x(1) - ( m%C_ctrl(1)/p%M_XY ) * x%tmd_x(2) - ( m%C_Brake(1)/p%M_XY ) * x%tmd_x(2) + B_X + 1 / p%M_XY * ( m%F_fr(1) ) - ( omega_P_N(1)*omega_P_N(2) - alpha_P_N(3) ) * x%tmd_x(3) + 2 * omega_P_N(3) * x%tmd_x(4) - dxdt%tmd_x(4) = (omega_P_N(1)**2 + omega_P_N(3)**2 - K(2) / p%M_XY) * x%tmd_x(3) - ( m%C_ctrl(2)/p%M_XY ) * x%tmd_x(4) - ( m%C_Brake(2)/p%M_XY ) * x%tmd_x(4) + B_Y + 1 / p%M_XY * ( m%F_fr(2) ) - ( omega_P_N(1)*omega_P_N(2) + alpha_P_N(3) ) * x%tmd_x(1) - 2 * omega_P_N(3) * x%tmd_x(2) - END IF - - -END SUBROUTINE TMD_CalcContStateDeriv -!---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE TMD_CalcStopForce(x,p,F_stop) - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time - TYPE(TMD_ParameterType), INTENT(IN ) :: p !< Parameters - Real(ReKi), dimension(2), INTENT(INOUT) :: F_stop !< stop forces -! local variables - Real(ReKi), dimension(2) :: F_SK !stop spring forces - Real(ReKi), dimension(2) :: F_SD !stop damping forces - INTEGER(IntKi) :: i ! counter - INTEGER(IntKi) :: j = 1! counter - j=1 - DO i=1,2 - IF (j < 5) THEN - IF ( x%tmd_x(j) > p%P_SP(i) ) THEN - F_SK(i) = p%K_S(i) *( p%P_SP(i) - x%tmd_x(j) ) - ELSEIF ( x%tmd_x(j) < p%N_SP(i) ) THEN - F_SK(i) = p%K_S(i) * ( p%N_SP(i) - x%tmd_x(j) ) - ELSE - F_SK(i) = 0.0_ReKi - ENDIF - IF ( (x%tmd_x(j) > p%P_SP(i)) .AND. (x%tmd_x(j+1) > 0) ) THEN - F_SD(i) = -p%C_S(i) *( x%tmd_x(j+1) ) - ELSEIF ( (x%tmd_x(j) < p%N_SP(i)) .AND. (x%tmd_x(j+1) < 0) ) THEN - F_SD(i) = -p%C_S(i) *( x%tmd_x(j+1) ) - ELSE - F_SD(i) = 0.0_ReKi - ENDIF - F_stop(i) = F_SK(i) + F_SD(i) - j = j+2 - END IF -END DO -END SUBROUTINE TMD_CalcStopForce -!---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE TMD_GroundHookDamp(dxdt,x,u,p,C_ctrl,C_Brake,F_fr) - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: dxdt !< Derivative of continuous states at Time (needs elements 1 and 3 only) - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time - TYPE(TMD_InputType), INTENT(IN ) :: u !< Inputs at Time - TYPE(TMD_ParameterType), INTENT(IN) :: p !< The module's parameter data - REAL(ReKi), dimension(2), INTENT(INOUT) :: C_ctrl !< extrapolated/interpolated stiffness values - REAL(ReKi), dimension(2), INTENT(INOUT) :: C_Brake !< extrapolated/interpolated stiffness values - REAL(ReKi), dimension(2), INTENT(INOUT) :: F_fr !< Friction forces - - IF (p%TMD_CMODE == CMODE_Semi .AND. p%TMD_SA_MODE == SA_CMODE_GH_vel) THEN ! velocity-based ground hook control with high damping for braking - - !X - IF (dxdt%tmd_x(1) * u%Mesh%TranslationVel(1,1) <= 0 ) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ELSE - C_ctrl(1) = p%TMD_X_C_LOW - END IF - - !Brake X - IF ( (x%tmd_x(1) > p%P_SP(1)-0.2) .AND. (x%tmd_x(2) > 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE IF ( (x%tmd_x(1) < p%N_SP(1)+0.2) .AND. (x%tmd_x(2) < 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE - C_Brake(1) = 0 - END IF - - - ! Y - IF (dxdt%tmd_x(3) * u%Mesh%TranslationVel(2,1) <= 0 ) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ELSE - C_ctrl(2) = p%TMD_Y_C_LOW - END IF - - !Brake Y - IF ( (x%tmd_x(3) > p%P_SP(2)-0.2) .AND. (x%tmd_x(4) > 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE IF ( (x%tmd_x(3) < p%N_SP(2)+0.2) .AND. (x%tmd_x(4) < 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE - C_Brake(2) = 0 - END IF - - ELSE IF (p%TMD_CMODE == CMODE_Semi .AND. p%TMD_SA_MODE == SA_CMODE_GH_invVel) THEN ! Inverse velocity-based ground hook control with high damping for braking - - ! X - IF (dxdt%tmd_x(1) * u%Mesh%TranslationVel(1,1) >= 0 ) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ELSE - C_ctrl(1) = p%TMD_X_C_LOW - END IF - - !Brake X - IF ( (x%tmd_x(1) > p%P_SP(1)-0.2) .AND. (x%tmd_x(2) > 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE IF ( (x%tmd_x(1) < p%N_SP(1)+0.2) .AND. (x%tmd_x(2) < 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE - C_Brake(1) = 0 - END IF - - ! Y - IF (dxdt%tmd_x(3) * u%Mesh%TranslationVel(2,1) >= 0 ) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ELSE - C_ctrl(2) = p%TMD_Y_C_LOW - END IF - - !Brake Y - IF ( (x%tmd_x(3) > p%P_SP(2)-0.2) .AND. (x%tmd_x(4) > 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE IF ( (x%tmd_x(3) < p%N_SP(2)+0.2) .AND. (x%tmd_x(4) < 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE - C_Brake(2) = 0 - END IF - - ELSE IF (p%TMD_CMODE == CMODE_Semi .AND. p%TMD_SA_MODE == SA_CMODE_GH_disp) THEN ! displacement-based ground hook control with high damping for braking - - ! X - IF (dxdt%tmd_x(1) * u%Mesh%TranslationDisp(1,1) <= 0 ) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ELSE - C_ctrl(1) = p%TMD_X_C_LOW - END IF - - !Brake X - IF ( (x%tmd_x(1) > p%P_SP(1)-0.2) .AND. (x%tmd_x(2) > 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE IF ( (x%tmd_x(1) < p%N_SP(1)+0.2) .AND. (x%tmd_x(2) < 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE - C_Brake(1) = 0 - END IF - - ! Y - IF (dxdt%tmd_x(3) * u%Mesh%TranslationDisp(2,1) <= 0 ) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ELSE - C_ctrl(2) = p%TMD_Y_C_LOW - END IF - - !Brake Y - IF ( (x%tmd_x(3) > p%P_SP(2)-0.2) .AND. (x%tmd_x(4) > 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE IF ( (x%tmd_x(3) < p%N_SP(2)+0.2) .AND. (x%tmd_x(4) < 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE - C_Brake(2) = 0 - END IF - - ELSE IF (p%TMD_CMODE == CMODE_Semi .AND. p%TMD_SA_MODE == SA_CMODE_Ph_FF) THEN ! Phase Difference Algorithm with Friction Force - ! X - ! (a) - IF (u%Mesh%TranslationDisp(1,1) > 0 .AND. u%Mesh%TranslationVel(1,1) < 0 .AND. x%tmd_x(1) > 0 .AND. dxdt%tmd_x(1) < 0) THEN - F_fr(1) = p%TMD_X_C_HIGH - ! (b) - ELSE IF (u%Mesh%TranslationDisp(1,1) < 0 .AND. u%Mesh%TranslationVel(1,1) > 0 .AND. x%tmd_x(1) < 0 .AND. dxdt%tmd_x(1) > 0) THEN - F_fr(1) = -p%TMD_X_C_HIGH - ! (c) - ELSE IF (u%Mesh%TranslationDisp(1,1) < 0 .AND. u%Mesh%TranslationVel(1,1) < 0 .AND. x%tmd_x(1) > 0 .AND. dxdt%tmd_x(1) > 0) THEN - F_fr(1) = -p%TMD_X_C_HIGH - ELSE IF (u%Mesh%TranslationDisp(1,1) > 0 .AND. u%Mesh%TranslationVel(1,1) > 0 .AND. x%tmd_x(1) < 0 .AND. dxdt%tmd_x(1) < 0) THEN - F_fr(1) = p%TMD_X_C_HIGH - ELSE - F_fr(1) = p%TMD_X_C_LOW - END IF - - !Brake X - IF ( (x%tmd_x(1) > p%P_SP(1)-0.2) .AND. (x%tmd_x(2) > 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE IF ( (x%tmd_x(1) < p%N_SP(1)+0.2) .AND. (x%tmd_x(2) < 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE - C_Brake(1) = 0 - END IF - - ! Y - ! (a) - IF (u%Mesh%TranslationDisp(2,1) > 0 .AND. u%Mesh%TranslationVel(2,1) < 0 .AND. x%tmd_x(3) > 0 .AND. dxdt%tmd_x(3) < 0) THEN - F_fr(2) = p%TMD_Y_C_HIGH - ! (b) - ELSE IF (u%Mesh%TranslationDisp(2,1) < 0 .AND. u%Mesh%TranslationVel(2,1) > 0 .AND. x%tmd_x(3) < 0 .AND. dxdt%tmd_x(3) > 0) THEN - F_fr(2) = -p%TMD_Y_C_HIGH - ! (c) - ELSE IF (u%Mesh%TranslationDisp(2,1) < 0 .AND. u%Mesh%TranslationVel(2,1) < 0 .AND. x%tmd_x(3) > 0 .AND. dxdt%tmd_x(3) > 0) THEN - F_fr(2) = -p%TMD_Y_C_HIGH - ELSE IF (u%Mesh%TranslationDisp(2,1) > 0 .AND. u%Mesh%TranslationVel(2,1) > 0 .AND. x%tmd_x(3) < 0 .AND. dxdt%tmd_x(3) < 0) THEN - F_fr(2) = p%TMD_Y_C_HIGH - ELSE - F_fr(2) = p%TMD_Y_C_LOW - END IF - - !Brake Y - IF ( (x%tmd_x(3) > p%P_SP(2)-0.2) .AND. (x%tmd_x(4) > 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE IF ( (x%tmd_x(3) < p%N_SP(2)+0.2) .AND. (x%tmd_x(4) < 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE - C_Brake(2) = 0 - END IF - - ELSE IF (p%TMD_CMODE == CMODE_Semi .AND. p%TMD_SA_MODE == SA_CMODE_Ph_DF) THEN ! Phase Difference Algorithm with Damping On/Off - ! X - ! (a) - IF (u%Mesh%TranslationDisp(1,1) > 0 .AND. u%Mesh%TranslationVel(1,1) < 0 .AND. x%tmd_x(1) > 0 .AND. dxdt%tmd_x(1) < 0) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ! (b) - ELSE IF (u%Mesh%TranslationDisp(1,1) < 0 .AND. u%Mesh%TranslationVel(1,1) > 0 .AND. x%tmd_x(1) < 0 .AND. dxdt%tmd_x(1) > 0) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ! (c) - ELSE IF (u%Mesh%TranslationDisp(1,1) < 0 .AND. u%Mesh%TranslationVel(1,1) < 0 .AND. x%tmd_x(1) > 0 .AND. dxdt%tmd_x(1) > 0) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ELSE IF (u%Mesh%TranslationDisp(1,1) > 0 .AND. u%Mesh%TranslationVel(1,1) > 0 .AND. x%tmd_x(1) < 0 .AND. dxdt%tmd_x(1) < 0) THEN - C_ctrl(1) = p%TMD_X_C_HIGH - ELSE - C_ctrl(1) = p%TMD_X_C_LOW - END IF - - !Brake X - IF ( (x%tmd_x(1) > p%P_SP(1)-0.2) .AND. (x%tmd_x(2) > 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE IF ( (x%tmd_x(1) < p%N_SP(1)+0.2) .AND. (x%tmd_x(2) < 0) ) THEN - C_Brake(1) = p%TMD_X_C_BRAKE - ELSE - C_Brake(1) = 0 - END IF - - ! Y - ! (a) - IF (u%Mesh%TranslationDisp(2,1) > 0 .AND. u%Mesh%TranslationVel(2,1) < 0 .AND. x%tmd_x(3) > 0 .AND. dxdt%tmd_x(3) < 0) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ! (b) - ELSE IF (u%Mesh%TranslationDisp(2,1) < 0 .AND. u%Mesh%TranslationVel(2,1) > 0 .AND. x%tmd_x(3) < 0 .AND. dxdt%tmd_x(3) > 0) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ! (c) - ELSE IF (u%Mesh%TranslationDisp(2,1) < 0 .AND. u%Mesh%TranslationVel(2,1) < 0 .AND. x%tmd_x(3) > 0 .AND. dxdt%tmd_x(3) > 0) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ELSE IF (u%Mesh%TranslationDisp(2,1) > 0 .AND. u%Mesh%TranslationVel(2,1) > 0 .AND. x%tmd_x(3) < 0 .AND. dxdt%tmd_x(3) < 0) THEN - C_ctrl(2) = p%TMD_Y_C_HIGH - ELSE - C_ctrl(2) = p%TMD_Y_C_LOW - END IF - - !Brake Y - IF ( (x%tmd_x(3) > p%P_SP(2)-0.2) .AND. (x%tmd_x(4) > 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE IF ( (x%tmd_x(3) < p%N_SP(2)+0.2) .AND. (x%tmd_x(4) < 0) ) THEN - C_Brake(2) = p%TMD_Y_C_BRAKE - ELSE - C_Brake(2) = 0 - END IF - -END IF - - -END SUBROUTINE TMD_GroundHookDamp -!---------------------------------------------------------------------------------------------------------------------------------- -!> Extrapolate or interpolate stiffness value based on stiffness table. -SUBROUTINE SpringForceExtrapInterp(x, p, F_table) - TYPE(TMD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time - TYPE(TMD_ParameterType), INTENT(IN) :: p !< The module's parameter data - REAL(ReKi), dimension(2), INTENT(INOUT) :: F_table !< extrapolated/interpolated stiffness values - - !INTEGER(IntKi), INTENT(OUT) :: ErrStat ! The error status code - !CHARACTER(*), INTENT(OUT) :: ErrMsg ! The error message, if an error occurred - - ! local variables - INTEGER(IntKi) :: ErrStat2 ! error status - INTEGER(IntKi) :: I ! Loop counter - INTEGER(IntKi), DIMENSION(2) :: J = (/1, 3/) ! Loop counter - INTEGER(IntKi) :: M ! location of closest table position - INTEGER(IntKi) :: Nrows ! Number of rows in F_TBL - REAL(ReKi) :: Slope ! - REAL(ReKi) :: DX ! - REAL(ReKi) :: Disp(2) ! Current displacement - REAL(ReKi), ALLOCATABLE :: TmpRAry(:) - - IF (p%TMD_DOF_MODE == DOFMode_Indept .OR. p%TMD_DOF_MODE == DOFMode_Omni) THEN - Nrows = SIZE(p%F_TBL,1) - ALLOCATE(TmpRAry(Nrows),STAT=ErrStat2) - IF (ErrStat2 /= 0) then - CALL WrScr('Error allocating temp array. TMD stiffness results may be inaccurate.') - RETURN - END IF - - IF (p%TMD_DOF_MODE == DOFMode_Indept) THEN - DO I = 1,2 - Disp(I) = x%tmd_x(J(I)) - END DO - ELSE !IF (p%TMD_DOF_MODE == DOFMode_Omni) THEN - Disp = SQRT(x%tmd_x(1)**2+x%tmd_x(3)**2) ! constant assignment to vector - END IF - - DO I = 1,2 - TmpRAry = p%F_TBL(:,J(I))-Disp(I) - TmpRAry = ABS(TmpRAry) - M = MINLOC(TmpRAry,1) - - !interpolate - IF ( (Disp(I) > p%F_TBL(M,J(I)) .AND. M /= Nrows) .OR. (Disp(I) < p%F_TBL(M,J(I)) .AND. M == 1) ) THEN - ! for displacements higher than the closest table value or lower than the lower bound - Slope = ( p%F_TBL(M+1,J(I)+1) - p%F_TBL(M,J(I)+1) ) / ( p%F_TBL(M+1,J(I)) - p%F_TBL(M,J(I)) ) - - ELSE IF ( (Disp(I) < p%F_TBL(M,J(I)) .AND. M /= 1 ) .OR. (Disp(I) > p%F_TBL(M,J(I)) .AND. M == Nrows) ) THEN ! lower - ! for displacements lower than the closest table value or higher than the upper bound - Slope = ( p%F_TBL(M,J(I)+1) - p%F_TBL(M-1,J(I)+1) ) / ( p%F_TBL(M,J(I)) - p%F_TBL(M-1,J(I)) ) - - ELSE ! equal - Slope = 0 - END IF - - F_table(I) = p%F_TBL(M,J(I)+1) + Slope * ( Disp(I) - p%F_TBL(M,J(I)) ) - - END DO - - DEALLOCATE(TmpRAry) - - END IF - -END SUBROUTINE SpringForceExtrapInterp -!---------------------------------------------------------------------------------------------------------------------------------- -!> This subroutine reads the input file and stores all the data in the TMD_InputFile structure. -!! It does not perform data validation. -SUBROUTINE TMD_ReadInput( InputFileName, InputFileData, Default_DT, OutFileRoot, ErrStat, ErrMsg ) -!.................................................................................................................................. - - ! Passed variables - REAL(DbKi), INTENT(IN) :: Default_DT !< The default DT (from glue code) - - CHARACTER(*), INTENT(IN) :: InputFileName !< Name of the input file - CHARACTER(*), INTENT(IN) :: OutFileRoot !< The rootname of all the output files written by this routine. - - TYPE(TMD_InputFile), INTENT(OUT) :: InputFileData !< Data stored in the module's input file - - INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code - CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred - - ! local variables - - INTEGER(IntKi) :: UnEcho ! Unit number for the echo file - INTEGER(IntKi) :: ErrStat2 ! The error status code - CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - - ! initialize values: - - ErrStat = ErrID_None - ErrMsg = "" - - ! InputFileData%DT = Default_DT ! the glue code's suggested DT for the module (may be overwritten in ReadPrimaryFile()) - - ! get the primary/platform input-file data - - CALL ReadPrimaryFile( InputFileName, InputFileData, OutFileRoot, UnEcho, ErrStat2, ErrMsg2 ) - CALL CheckError(ErrStat2,ErrMsg2) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! we may need to read additional files here - - - ! close any echo file that was opened - - IF ( UnEcho > 0 ) CLOSE( UnEcho ) - -CONTAINS - !............................................................................................................................... - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level and cleans up if the error is >= AbortErrLev - !............................................................................................................................... - - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) - - - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ - - IF ( ErrID /= ErrID_None ) THEN - - IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'TMD_ReadInput:'//TRIM(Msg) - ErrStat = MAX(ErrStat, ErrID) - - !......................................................................................................................... - ! Clean up if we're going to return on error: close files, deallocate local arrays - !......................................................................................................................... - IF ( ErrStat >= AbortErrLev ) THEN - IF ( UnEcho > 0 ) CLOSE( UnEcho ) - END IF - - END IF - - - END SUBROUTINE CheckError - -END SUBROUTINE TMD_ReadInput -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine reads in the primary ServoDyn input file and places the values it reads in the InputFileData structure. -!! It opens and prints to an echo file if requested. -SUBROUTINE ReadPrimaryFile( InputFile, InputFileData, OutFileRoot, UnEc, ErrStat, ErrMsg ) -!.................................................................................................................................. - - IMPLICIT NONE - - ! Passed variables - INTEGER(IntKi), INTENT(OUT) :: UnEc !< I/O unit for echo file. If > 0, file is open for writing. - INTEGER(IntKi), INTENT(OUT) :: ErrStat !< Error status - - CHARACTER(*), INTENT(IN) :: InputFile !< Name of the file containing the primary input data - CHARACTER(*), INTENT(OUT) :: ErrMsg !< Error message - CHARACTER(*), INTENT(IN) :: OutFileRoot !< The rootname of the echo file, possibly opened in this routine - - TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData !< All the data in the TMD input file - - ! Local variables: - REAL(ReKi) :: TmpRAry(4) ! A temporary array to read a table from the input file - INTEGER(IntKi) :: I ! loop counter - INTEGER(IntKi) :: UnIn ! Unit number for reading file - - INTEGER(IntKi) :: ErrStat2 ! Temporary Error status - LOGICAL :: Echo ! Determines if an echo file should be written - CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message - CHARACTER(1024) :: PriPath ! Path name of the primary file - CHARACTER(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents - INTEGER(IntKi) :: NKInpSt ! Number of stiffness input stations in user table - INTEGER(IntKi) :: NInputCols ! Number of columns in user-defined stiffness table - - - ! Initialize some variables: - ErrStat = ErrID_None - ErrMsg = "" - - UnEc = -1 - Echo = .FALSE. - CALL GetPath( InputFile, PriPath ) ! Input files will be relative to the path where the primary input file is located. - - - !CALL AllocAry( InputFileData%OutList, MaxOutPts, "ServoDyn Input File's Outlist", ErrStat2, ErrMsg2 ) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Get an available unit number for the file. - - CALL GetNewUnit( UnIn, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Open the Primary input file. - - CALL OpenFInpFile ( UnIn, InputFile, ErrStat2, ErrMsg2 ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - ! Read the lines up/including to the "Echo" simulation control variable - ! If echo is FALSE, don't write these lines to the echo file. - ! If Echo is TRUE, rewind and write on the second try. - - I = 1 !set the number of times we've read the file - ! DO - !-------------------------- HEADER --------------------------------------------- - - CALL ReadCom( UnIn, InputFile, 'File header: Module Version (line 1)', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadStr( UnIn, InputFile, FTitle, 'FTitle', 'File Header: File Description (line 2)', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !------------------ TMD DEGREES OF FREEDOM ----------------------------- - CALL ReadCom( UnIn, InputFile, 'Section Header: TMD DEGREES OF FREEDOM', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_DOF_MODE: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_DOF_MODE, "TMD_DOF_MODE", "DOF mode {0: NO TMD_DOF; 1: TMD_X_DOF and TMD_Y_DOF; 2: TMD_XY_DOF} ", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_DOF: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_DOF, "TMD_X_DOF", "DOF on or off", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_Y_DOF: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_DOF, "TMD_Y_DOF", "DOF on or off", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !------------------ TMD INITIAL CONDITIONS ----------------------------- - CALL ReadCom( UnIn, InputFile, 'Section Header: TMD INITIAL CONDITIONS', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_DSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_DSP, "TMD_X_DSP", "TMD_X initial displacement", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_Y_DSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_DSP, "TMD_Y_DSP", "TMD_Y initial displacement", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - !------------------ TMD CONFIGURATION ----------------------------- - CALL ReadCom( UnIn, InputFile, 'Section Header: TMD CONFIGURATION', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_P_X: - CALL ReadVar(UnIn,InputFile,InputFileData%TMD_P_X,"TMD_P_X","at rest position of TMDs (X)",ErrStat2,ErrMsg2,UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_P_Y: - CALL ReadVar(UnIn,InputFile,InputFileData%TMD_P_Y,"TMD_P_Y","at rest position of TMDs (Y)",ErrStat2,ErrMsg2,UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_P_Z: - CALL ReadVar(UnIn,InputFile,InputFileData%TMD_P_Z,"TMD_P_Z","at rest position of TMDs (Z)",ErrStat2,ErrMsg2,UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_DWSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_DWSP, "TMD_X_DWSP", "DW stop position (maximum X mass displacement)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_UWSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_UWSP, "TMD_X_UWSP", "UW stop position (minimum X mass displacement)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_PLSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_PLSP, "TMD_Y_PLSP", "positive lateral stop position (maximum Y mass displacement)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_NLSP: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_NLSP, "TMD_Y_NLSP", "negative lateral stop position (minimum Y mass displacement)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - !------------------ TMD MASS, STIFFNESS, & DAMPING ----------------------------- - CALL ReadCom( UnIn, InputFile, 'Section Header: TMD MASS, STIFFNESS, & DAMPING', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_X_M: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_M, "TMD_X_M", "X TMD mass", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_M: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_M, "TMD_Y_M", "Y TMD mass", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_XY_M: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_XY_M, "TMD_XY_M", "XY TMD mass", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_X_K: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_K, "TMD_X_K", "X TMD stiffness", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_K: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_K, "TMD_Y_K", "Y TMD stiffness", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_X_C: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_C, "TMD_X_C", "X TMD damping", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_C: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_C, "TMD_Y_C", "Y TMD damping", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_X_KS: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_KS, "TMD_X_KS", "X stop spring stiffness", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_KS: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_KS, "TMD_Y_KS", "Y stop spring stiffness", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_X_CS: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_CS, "TMD_X_CS", "X stop spring damping", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_Y_CS: - CALL ReadVar(UnIn,InputFile,InputFileData%TMD_Y_CS,"TMD_Y_CS","Y stop spring damping",ErrStat2,ErrMsg2,UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! -------------- TMD USER-DEFINED STIFFNESS --------------------------------- - - ! Skip the comment lines. - - CALL ReadCom ( UnIn, InputFile, 'Section Header: TMD USER-DEFINED SPRING FORCE', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! Use_F_TBL - CALL ReadVar( UnIn, InputFile, InputFileData%Use_F_TBL, "Use_F_TBL", "use spring force from user-defined table (flag)", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! NKInpSt - CALL ReadVar( UnIn, InputFile, NKInpSt, "NKInpSt", "number of spring force input stations", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadCom ( UnIn, InputFile, 'Section Header: TMD SPRING FORCE TABLE', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadCom ( UnIn, InputFile, 'spring force table column names', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - CALL ReadCom ( UnIn, InputFile, 'spring force table column units', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! Read the table. - - NInputCols = 4 - - ! allocate data for F_TBL - ALLOCATE (InputFileData%F_TBL(NKInpSt,NInputCols)) - - DO I=1,NKInpSt - - CALL ReadAry( UnIn, InputFile, TmpRAry, NInputCols, 'Line'//TRIM(Num2LStr(I)), 'TMD Spring force Properties', & - ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - InputFileData%F_TBL(I,1) = TmpRAry(1) ! X - InputFileData%F_TBL(I,2) = TmpRAry(2) ! K_X - InputFileData%F_TBL(I,3) = TmpRAry(3) ! Y - InputFileData%F_TBL(I,4) = TmpRAry(4) ! K_Y - - - ENDDO ! I - !------------------ TMD CONTROL ----------------------------- - CALL ReadCom( UnIn, InputFile, 'Section Header: TMD CONTROL', ErrStat2, ErrMsg2, UnEc ) - CALL CheckError( ErrStat2, ErrMsg2 ) - - ! TMD_CMODE: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_CMODE, "TMD_CMODE", "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} ", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_SA_MODE: - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_SA_MODE, "TMD_SA_MODE", "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} ", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_C_HIGH - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_C_HIGH, "TMD_X_C_HIGH", "TMD X high damping for ground hook control", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_C_LOW - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_C_LOW, "TMD_X_C_LOW", "TMD X low damping for ground hook control", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_Y_C_HIGH - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_C_HIGH, "TMD_Y_C_HIGH", "TMD Y high damping for ground hook control", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_Y_C_HIGH - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_C_LOW, "TMD_Y_C_LOW", "TMD Y high damping for ground hook control", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_X_C_BRAKE - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_X_C_BRAKE, "TMD_X_C_BRAKE", "TMD X high damping for braking the TMDX", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - ! TMD_Y_C_BRAKE - CALL ReadVar( UnIn, InputFile, InputFileData%TMD_Y_C_BRAKE, "TMD_Y_C_BRAKE", "TMD Y high damping for braking the TMDY", ErrStat2, ErrMsg2, UnEc) - CALL CheckError( ErrStat2, ErrMsg2 ) - IF ( ErrStat >= AbortErrLev ) RETURN - - - !!---------------------- OUTPUT -------------------------------------------------- - !CALL ReadCom( UnIn, InputFile, 'Section Header: Output', ErrStat2, ErrMsg2, UnEc ) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - ! ! SumPrint - Print summary data to .sum (flag): - !CALL ReadVar( UnIn, InputFile, InputFileData%SumPrint, "SumPrint", "Print summary data to .sum (flag)", ErrStat2, ErrMsg2, UnEc) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - !!---------------------- OUTLIST -------------------------------------------- - ! CALL ReadCom( UnIn, InputFile, 'Section Header: OutList', ErrStat2, ErrMsg2, UnEc ) - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - ! OutList - List of user-requested output channels (-): - !CALL ReadOutputList ( UnIn, InputFile, InputFileData%OutList, InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc ) ! Routine in NWTC Subroutine Library - ! CALL CheckError( ErrStat2, ErrMsg2 ) - ! IF ( ErrStat >= AbortErrLev ) RETURN - - !---------------------- END OF FILE ----------------------------------------- - - CLOSE ( UnIn ) - RETURN - - -CONTAINS - !............................................................................................................................... - SUBROUTINE CheckError(ErrID,Msg) - ! This subroutine sets the error message and level - !............................................................................................................................... - - ! Passed arguments - INTEGER(IntKi), INTENT(IN) :: ErrID ! The error identifier (ErrStat) - CHARACTER(*), INTENT(IN) :: Msg ! The error message (ErrMsg) - - - !............................................................................................................................ - ! Set error status/message; - !............................................................................................................................ - - IF ( ErrID /= ErrID_None ) THEN - - IF (ErrStat /= ErrID_None) ErrMsg = TRIM(ErrMsg)//NewLine - ErrMsg = TRIM(ErrMsg)//'ReadPrimaryFile:'//TRIM(Msg) - ErrStat = MAX(ErrStat, ErrID) - - !......................................................................................................................... - ! Clean up if we're going to return on error: close file, deallocate local arrays - !......................................................................................................................... - IF ( ErrStat >= AbortErrLev ) THEN - CLOSE( UnIn ) -! IF ( UnEc > 0 ) CLOSE ( UnEc ) - END IF - - END IF - - - END SUBROUTINE CheckError - !............................................................................................................................... -END SUBROUTINE ReadPrimaryFile -!---------------------------------------------------------------------------------------------------------------------------------- -!> This subroutine sets the parameters, based on the data stored in InputFileData. -SUBROUTINE TMD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) -!.................................................................................................................................. - - TYPE(TMD_InputFile), INTENT(IN) :: InputFileData !< Data stored in the module's input file - TYPE(TMD_ParameterType), INTENT(INOUT) :: p !< The module's parameter data - INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code - CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred - - ! Local variables - INTEGER(IntKi) :: ErrStat2 ! Temporary error ID - !CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary message describing error - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_SetParameters' - - - ! Initialize variables - - ErrStat = ErrID_None - ErrMsg = '' - - - !p%DT = InputFileData%DT - !p%RootName = 'TMD' - ! DOFs - - - p%TMD_DOF_MODE = InputFileData%TMD_DOF_MODE - p%TMD_X_DOF = InputFileData%TMD_X_DOF - p%TMD_Y_DOF = InputFileData%TMD_Y_DOF - - ! TMD X parameters - p%X_DSP = InputFileData%TMD_X_DSP - p%M_X = InputFileData%TMD_X_M - p%K_X = InputFileData%TMD_X_K - p%C_X = InputFileData%TMD_X_C - - ! TMD Y parameters - p%Y_DSP = InputFileData%TMD_Y_DSP - p%M_Y = InputFileData%TMD_Y_M - p%K_Y = InputFileData%TMD_Y_K - p%C_Y = InputFileData%TMD_Y_C - - p%M_XY = InputFileData%TMD_XY_M - - ! vector parameters - ! stop positions - p%P_SP(1) = InputFileData%TMD_X_DWSP - p%P_SP(2) = InputFileData%TMD_Y_PLSP - p%N_SP(1) = InputFileData%TMD_X_UWSP - p%N_SP(2) = InputFileData%TMD_Y_NLSP - ! stop force stiffness - p%K_S(1) = InputFileData%TMD_X_KS - p%K_S(2) = InputFileData%TMD_Y_KS - ! stop force damping - p%C_S(1) = InputFileData%TMD_X_CS - p%C_S(2) = InputFileData%TMD_Y_CS - - ! ground hook control damping files - p%TMD_CMODE = InputFileData%TMD_CMODE - p%TMD_SA_MODE = InputFileData%TMD_SA_MODE - p%TMD_X_C_HIGH = InputFileData%TMD_X_C_HIGH - p%TMD_X_C_LOW = InputFileData%TMD_X_C_LOW - p%TMD_Y_C_HIGH = InputFileData%TMD_Y_C_HIGH - p%TMD_Y_C_LOW = InputFileData%TMD_Y_C_LOW - p%TMD_X_C_BRAKE = InputFileData%TMD_X_C_BRAKE - p%TMD_Y_C_BRAKE = InputFileData%TMD_Y_C_BRAKE - - ! User Defined Stiffness Table - p%Use_F_TBL = InputFileData%Use_F_TBL - ALLOCATE (p%F_TBL(SIZE(InputFiledata%F_TBL,1),SIZE(InputFiledata%F_TBL,2)), STAT=ErrStat2) - IF (ErrStat2/=0) THEN - CALL SetErrStat(ErrID_Fatal,"Error allocating p%F_TBL.",ErrStat,ErrMsg,RoutineName) - RETURN - END IF - - p%F_TBL = InputFileData%F_TBL; - -END SUBROUTINE TMD_SetParameters -!---------------------------------------------------------------------------------------------------------------------------------- -END MODULE TMD -!********************************************************************************************************************************** \ No newline at end of file diff --git a/modules/servodyn/src/TMD_Registry.txt b/modules/servodyn/src/TMD_Registry.txt deleted file mode 100644 index c2d74036c8..0000000000 --- a/modules/servodyn/src/TMD_Registry.txt +++ /dev/null @@ -1,122 +0,0 @@ -################################################################################################################################### -# Registry for TMD in the FAST Modularization Framework -# This Registry file is used to create MODULE TMD_Types, which contains all of the user-defined types needed in TMD. -# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. -# Entries are of the form -# keyword -# -# Use ^ as a shortcut for the value from the previous line. -################################################################################################################################### - -# ..... Input File data ....................................................................................................... -typedef TMD/TMD TMD_InputFile CHARACTER(1024) TMDFileName - - - "Name of the input file; remove if there is no file" - -typedef ^ ^ INTEGER TMD_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} " - -typedef ^ ^ INTEGER TMD_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - -typedef ^ ^ INTEGER TMD_DOF_MODE - - - "DOF mode {0: NO TMD_DOF; 1: TMD_X_DOF and TMD_Y_DOF; 2: TMD_XY_DOF} " - -typedef ^ ^ LOGICAL TMD_X_DOF - - - "DOF on or off" - -typedef ^ ^ LOGICAL TMD_Y_DOF - - - "DOF on or off" - -typedef ^ ^ ReKi TMD_X_DSP - - - "TMD_X initial displacement" m -typedef ^ ^ ReKi TMD_Y_DSP - - - "TMD_Y initial displacement" m -typedef ^ ^ ReKi TMD_X_M - - - "TMD mass" kg -typedef ^ ^ ReKi TMD_Y_M - - - "TMD mass" kg -typedef ^ ^ ReKi TMD_XY_M - - - "TMDXY mass" kg -typedef ^ ^ ReKi TMD_X_K - - - "TMD stiffness" "N/m" -typedef ^ ^ ReKi TMD_Y_K - - - "TMD stiffness" "N/m" -typedef ^ ^ ReKi TMD_X_C - - - "TMD damping" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C - - - "TMD damping" "N/(m/s)" -typedef ^ ^ ReKi TMD_X_DWSP - - - "DW stop position (maximum X mass displacement)" m -typedef ^ ^ ReKi TMD_X_UWSP - - - "UW stop position (minimum X mass displacement)" m -typedef ^ ^ ReKi TMD_X_KS - - - "stop spring stiffness" "N/m" -typedef ^ ^ ReKi TMD_X_CS - - - "stop spring damping" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_PLSP - - - "positive lateral stop position (maximum Y mass displacement)" m -typedef ^ ^ ReKi TMD_Y_NLSP - - - "negative lateral stop position (minimum Y mass displacement)" m -typedef ^ ^ ReKi TMD_Y_KS - - - "stop spring stiffness" "N/m" -typedef ^ ^ ReKi TMD_Y_CS - - - "stop spring damping" "N/(m/s)" -typedef ^ ^ ReKi TMD_P_X - - - "rest position of TMDs w.r.t. nacelle" m -typedef ^ ^ ReKi TMD_P_Y - - - "rest position of TMDs w.r.t. nacelle" m -typedef ^ ^ ReKi TMD_P_Z - - - "rest position of TMDs w.r.t. nacelle" m -typedef ^ ^ ReKi TMD_X_C_HIGH - - - "TMD X high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_X_C_LOW - - - "TMD X low damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_HIGH - - - "TMD Y high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_LOW - - - "TMD Y high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_X_C_BRAKE - - - "TMD X high damping for braking the TMD" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_BRAKE - - - "TMD X high damping for braking the TMD" "N/(m/s)" -typedef ^ ^ LOGICAL USE_F_TBL - - - "use spring force from user-defined table (flag)" - -typedef ^ ^ CHARACTER(1024) TMD_F_TBL_FILE - - - "user-defined spring table filename" - -typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" -# ..... Initialization data ....................................................................................................... -# Define inputs that the initialization routine may need here: -# e.g., the name of the input file, the file root name, etc. -typedef TMD/TMD InitInputType CHARACTER(1024) InputFile - - - "Name of the input file; remove if there is no file" - -typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - -typedef ^ ^ ReKi Gravity - - - "Gravitational acceleration" m/s^2 -typedef ^ ^ ReKi r_N_O_G {3} - - "nacelle origin for setting up mesh" - -# Define outputs from the initialization routine here: -typedef ^ InitOutputType SiKi DummyInitOut - - - "dummy init output" - -#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - -#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:}- - "Units of the output-to-file channels" - - -# ..... States .................................................................................................................... -# Define continuous (differentiable) states here: -typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - -typedef ^ ContinuousStateType ReKi tmd_x {4} - - "Continuous States" - -# Define discrete (nondifferentiable) states here: -typedef ^ DiscreteStateType ReKi DummyDiscState - - - "Remove this variable if you have discrete states" - -# Define constraint states here: -typedef ^ ConstraintStateType ReKi DummyConstrState - - - "Remove this variable if you have constraint states" - -# Define any other states (e.g. logical states): -typedef ^ OtherStateType Reki DummyOtherState - - - "Remove this variable if you have other/logical states" - - -# Define any misc data used only for efficiency purposes (indices for searching in an array, copies of previous calculations of output -# at a given time, etc.) or other data that do not depend on time -typedef ^ MiscVarType Reki F_stop {2} - - "Stop forces" - -typedef ^ MiscVarType ReKi F_ext {2} - - "External forces (user defined)" - -typedef ^ MiscVarType ReKi F_fr {2} - - "Friction forces" - -typedef ^ MiscVarType ReKi C_ctrl {2} - - "Controlled Damping (On/Off)" - -typedef ^ MiscVarType ReKi C_Brake {2} - - "Braking Damping" - -typedef ^ MiscVarType ReKi F_table {2} - - "Tabled Stiffness" - -typedef ^ MiscVarType ReKi F_k_x - - - "Factor for x-component stiffness force" - -typedef ^ MiscVarType ReKi F_k_y - - - "Factor for y-component stiffness force" - - - -# ..... Parameters ................................................................................................................ -# Define parameters here: -# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: -typedef ^ ParameterType DbKi DT - - - "Time step for cont. state integration & disc. state update" seconds -typedef ^ ^ CHARACTER(1024) RootName - - - "RootName for writing output files" - -typedef ^ ^ INTEGER TMD_DOF_MODE - - - "DOF mode {0: NO TMD_DOF; 1: TMD_X_DOF and TMD_Y_DOF; 2: TMD_XY_DOF} " - -typedef ^ ^ LOGICAL TMD_X_DOF - - - "DOF on or off" - -typedef ^ ^ LOGICAL TMD_Y_DOF - - - "DOF on or off" - -typedef ^ ^ ReKi X_DSP - - - "TMD_X initial displacement" m -typedef ^ ^ ReKi Y_DSP - - - "TMD_Y initial displacement" m -typedef ^ ^ ReKi M_X - - - "TMD mass" kg -typedef ^ ^ ReKi M_Y - - - "TMD mass" kg -typedef ^ ^ ReKi M_XY - - - "TMDXY mass" kg -typedef ^ ^ ReKi K_X - - - "TMD stiffness" "N/m" -typedef ^ ^ ReKi K_Y - - - "TMD stiffness" "N/m" -typedef ^ ^ ReKi C_X - - - "TMD damping" "N/(m/s)" -typedef ^ ^ ReKi C_Y - - - "TMD damping" "N/(m/s)" -typedef ^ ^ ReKi K_S {2} - - "TMD stop stiffness" "N/m" -typedef ^ ^ ReKi C_S {2} - - "TMD stop damping" "N/(m/s)" -typedef ^ ^ ReKi P_SP {2} - - "Positive stop position (maximum mass displacement)" m -typedef ^ ^ ReKi N_SP {2} - - "Negative stop position (minimum X mass displacement)" m -typedef ^ ^ ReKi F_ext {3} - - "External forces (for user modification)" - -typedef ^ ^ ReKi Gravity - - - "Gravitational acceleration" "m/s^2" -typedef ^ ^ INTEGER TMD_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} " - -typedef ^ ^ INTEGER TMD_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - -typedef ^ ^ ReKi TMD_X_C_HIGH - - - "TMD X high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_X_C_LOW - - - "TMD X low damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_HIGH - - - "TMD Y high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_LOW - - - "TMD Y high damping for ground hook control" "N/(m/s)" -typedef ^ ^ ReKi TMD_X_C_BRAKE - - - "TMD X high damping for braking the TMD" "N/(m/s)" -typedef ^ ^ ReKi TMD_Y_C_BRAKE - - - "TMD X high damping for braking the TMD" "N/(m/s)" -typedef ^ ^ LOGICAL Use_F_TBL - - - "use spring force from user-defined table (flag)" - -typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" -# ..... Inputs .................................................................................................................... -# Define inputs that are contained on the mesh here: -typedef ^ InputType MeshType Mesh - - - "Displacements at the TMD reference point P in the inertial frame" - -# ..... Outputs ................................................................................................................... -# Define outputs that are contained on the mesh here: -typedef ^ OutputType MeshType Mesh - - - "Loads at the TMD reference point in the inertial frame" - -# Define outputs that are not on this mesh here: -#typedef ^ OutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" diff --git a/modules/servodyn/src/TMD_Types.f90 b/modules/servodyn/src/TMD_Types.f90 deleted file mode 100644 index c0ba34ab4c..0000000000 --- a/modules/servodyn/src/TMD_Types.f90 +++ /dev/null @@ -1,2692 +0,0 @@ -!STARTOFREGISTRYGENERATEDFILE 'TMD_Types.f90' -! -! WARNING This file is generated automatically by the FAST registry. -! Do not edit. Your changes to this file will be lost. -! -! FAST Registry -!********************************************************************************************************************************* -! TMD_Types -!................................................................................................................................. -! This file is part of TMD. -! -! Copyright (C) 2012-2016 National Renewable Energy Laboratory -! -! Licensed under the Apache License, Version 2.0 (the "License"); -! you may not use this file except in compliance with the License. -! You may obtain a copy of the License at -! -! http://www.apache.org/licenses/LICENSE-2.0 -! -! Unless required by applicable law or agreed to in writing, software -! distributed under the License is distributed on an "AS IS" BASIS, -! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -! See the License for the specific language governing permissions and -! limitations under the License. -! -! -! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. -! -!********************************************************************************************************************************* -!> This module contains the user-defined types needed in TMD. It also contains copy, destroy, pack, and -!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. -MODULE TMD_Types -!--------------------------------------------------------------------------------------------------------------------------------- -USE NWTC_Library -IMPLICIT NONE -! ========= TMD_InputFile ======= - TYPE, PUBLIC :: TMD_InputFile - CHARACTER(1024) :: TMDFileName !< Name of the input file; remove if there is no file [-] - INTEGER(IntKi) :: TMD_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} [-] - INTEGER(IntKi) :: TMD_SA_MODE !< Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} [-] - INTEGER(IntKi) :: TMD_DOF_MODE !< DOF mode {0: NO TMD_DOF; 1: TMD_X_DOF and TMD_Y_DOF; 2: TMD_XY_DOF} [-] - LOGICAL :: TMD_X_DOF !< DOF on or off [-] - LOGICAL :: TMD_Y_DOF !< DOF on or off [-] - REAL(ReKi) :: TMD_X_DSP !< TMD_X initial displacement [m] - REAL(ReKi) :: TMD_Y_DSP !< TMD_Y initial displacement [m] - REAL(ReKi) :: TMD_X_M !< TMD mass [kg] - REAL(ReKi) :: TMD_Y_M !< TMD mass [kg] - REAL(ReKi) :: TMD_XY_M !< TMDXY mass [kg] - REAL(ReKi) :: TMD_X_K !< TMD stiffness [N/m] - REAL(ReKi) :: TMD_Y_K !< TMD stiffness [N/m] - REAL(ReKi) :: TMD_X_C !< TMD damping [N/(m/s)] - REAL(ReKi) :: TMD_Y_C !< TMD damping [N/(m/s)] - REAL(ReKi) :: TMD_X_DWSP !< DW stop position (maximum X mass displacement) [m] - REAL(ReKi) :: TMD_X_UWSP !< UW stop position (minimum X mass displacement) [m] - REAL(ReKi) :: TMD_X_KS !< stop spring stiffness [N/m] - REAL(ReKi) :: TMD_X_CS !< stop spring damping [N/(m/s)] - REAL(ReKi) :: TMD_Y_PLSP !< positive lateral stop position (maximum Y mass displacement) [m] - REAL(ReKi) :: TMD_Y_NLSP !< negative lateral stop position (minimum Y mass displacement) [m] - REAL(ReKi) :: TMD_Y_KS !< stop spring stiffness [N/m] - REAL(ReKi) :: TMD_Y_CS !< stop spring damping [N/(m/s)] - REAL(ReKi) :: TMD_P_X !< rest position of TMDs w.r.t. nacelle [m] - REAL(ReKi) :: TMD_P_Y !< rest position of TMDs w.r.t. nacelle [m] - REAL(ReKi) :: TMD_P_Z !< rest position of TMDs w.r.t. nacelle [m] - REAL(ReKi) :: TMD_X_C_HIGH !< TMD X high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_X_C_LOW !< TMD X low damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_HIGH !< TMD Y high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_LOW !< TMD Y high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_X_C_BRAKE !< TMD X high damping for braking the TMD [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_BRAKE !< TMD X high damping for braking the TMD [N/(m/s)] - LOGICAL :: USE_F_TBL !< use spring force from user-defined table (flag) [-] - CHARACTER(1024) :: TMD_F_TBL_FILE !< user-defined spring table filename [-] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_TBL !< user-defined spring force [N] - END TYPE TMD_InputFile -! ======================= -! ========= TMD_InitInputType ======= - TYPE, PUBLIC :: TMD_InitInputType - CHARACTER(1024) :: InputFile !< Name of the input file; remove if there is no file [-] - CHARACTER(1024) :: RootName !< RootName for writing output files [-] - REAL(ReKi) :: Gravity !< Gravitational acceleration [m/s^2] - REAL(ReKi) , DIMENSION(1:3) :: r_N_O_G !< nacelle origin for setting up mesh [-] - END TYPE TMD_InitInputType -! ======================= -! ========= TMD_InitOutputType ======= - TYPE, PUBLIC :: TMD_InitOutputType - REAL(SiKi) :: DummyInitOut !< dummy init output [-] - END TYPE TMD_InitOutputType -! ======================= -! ========= TMD_ContinuousStateType ======= - TYPE, PUBLIC :: TMD_ContinuousStateType - REAL(ReKi) :: DummyContState !< Remove this variable if you have continuous states [-] - REAL(ReKi) , DIMENSION(1:4) :: tmd_x !< Continuous States [-] - END TYPE TMD_ContinuousStateType -! ======================= -! ========= TMD_DiscreteStateType ======= - TYPE, PUBLIC :: TMD_DiscreteStateType - REAL(ReKi) :: DummyDiscState !< Remove this variable if you have discrete states [-] - END TYPE TMD_DiscreteStateType -! ======================= -! ========= TMD_ConstraintStateType ======= - TYPE, PUBLIC :: TMD_ConstraintStateType - REAL(ReKi) :: DummyConstrState !< Remove this variable if you have constraint states [-] - END TYPE TMD_ConstraintStateType -! ======================= -! ========= TMD_OtherStateType ======= - TYPE, PUBLIC :: TMD_OtherStateType - REAL(ReKi) :: DummyOtherState !< Remove this variable if you have other/logical states [-] - END TYPE TMD_OtherStateType -! ======================= -! ========= TMD_MiscVarType ======= - TYPE, PUBLIC :: TMD_MiscVarType - REAL(ReKi) , DIMENSION(1:2) :: F_stop !< Stop forces [-] - REAL(ReKi) , DIMENSION(1:2) :: F_ext !< External forces (user defined) [-] - REAL(ReKi) , DIMENSION(1:2) :: F_fr !< Friction forces [-] - REAL(ReKi) , DIMENSION(1:2) :: C_ctrl !< Controlled Damping (On/Off) [-] - REAL(ReKi) , DIMENSION(1:2) :: C_Brake !< Braking Damping [-] - REAL(ReKi) , DIMENSION(1:2) :: F_table !< Tabled Stiffness [-] - REAL(ReKi) :: F_k_x !< Factor for x-component stiffness force [-] - REAL(ReKi) :: F_k_y !< Factor for y-component stiffness force [-] - END TYPE TMD_MiscVarType -! ======================= -! ========= TMD_ParameterType ======= - TYPE, PUBLIC :: TMD_ParameterType - REAL(DbKi) :: DT !< Time step for cont. state integration & disc. state update [seconds] - CHARACTER(1024) :: RootName !< RootName for writing output files [-] - INTEGER(IntKi) :: TMD_DOF_MODE !< DOF mode {0: NO TMD_DOF; 1: TMD_X_DOF and TMD_Y_DOF; 2: TMD_XY_DOF} [-] - LOGICAL :: TMD_X_DOF !< DOF on or off [-] - LOGICAL :: TMD_Y_DOF !< DOF on or off [-] - REAL(ReKi) :: X_DSP !< TMD_X initial displacement [m] - REAL(ReKi) :: Y_DSP !< TMD_Y initial displacement [m] - REAL(ReKi) :: M_X !< TMD mass [kg] - REAL(ReKi) :: M_Y !< TMD mass [kg] - REAL(ReKi) :: M_XY !< TMDXY mass [kg] - REAL(ReKi) :: K_X !< TMD stiffness [N/m] - REAL(ReKi) :: K_Y !< TMD stiffness [N/m] - REAL(ReKi) :: C_X !< TMD damping [N/(m/s)] - REAL(ReKi) :: C_Y !< TMD damping [N/(m/s)] - REAL(ReKi) , DIMENSION(1:2) :: K_S !< TMD stop stiffness [N/m] - REAL(ReKi) , DIMENSION(1:2) :: C_S !< TMD stop damping [N/(m/s)] - REAL(ReKi) , DIMENSION(1:2) :: P_SP !< Positive stop position (maximum mass displacement) [m] - REAL(ReKi) , DIMENSION(1:2) :: N_SP !< Negative stop position (minimum X mass displacement) [m] - REAL(ReKi) , DIMENSION(1:3) :: F_ext !< External forces (for user modification) [-] - REAL(ReKi) :: Gravity !< Gravitational acceleration [m/s^2] - INTEGER(IntKi) :: TMD_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} [-] - INTEGER(IntKi) :: TMD_SA_MODE !< Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} [-] - REAL(ReKi) :: TMD_X_C_HIGH !< TMD X high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_X_C_LOW !< TMD X low damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_HIGH !< TMD Y high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_LOW !< TMD Y high damping for ground hook control [N/(m/s)] - REAL(ReKi) :: TMD_X_C_BRAKE !< TMD X high damping for braking the TMD [N/(m/s)] - REAL(ReKi) :: TMD_Y_C_BRAKE !< TMD X high damping for braking the TMD [N/(m/s)] - LOGICAL :: Use_F_TBL !< use spring force from user-defined table (flag) [-] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_TBL !< user-defined spring force [N] - END TYPE TMD_ParameterType -! ======================= -! ========= TMD_InputType ======= - TYPE, PUBLIC :: TMD_InputType - TYPE(MeshType) :: Mesh !< Displacements at the TMD reference point P in the inertial frame [-] - END TYPE TMD_InputType -! ======================= -! ========= TMD_OutputType ======= - TYPE, PUBLIC :: TMD_OutputType - TYPE(MeshType) :: Mesh !< Loads at the TMD reference point in the inertial frame [-] - END TYPE TMD_OutputType -! ======================= -CONTAINS - SUBROUTINE TMD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_InputFile), INTENT(IN) :: SrcInputFileData - TYPE(TMD_InputFile), INTENT(INOUT) :: DstInputFileData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyInputFile' -! - ErrStat = ErrID_None - ErrMsg = "" - DstInputFileData%TMDFileName = SrcInputFileData%TMDFileName - DstInputFileData%TMD_CMODE = SrcInputFileData%TMD_CMODE - DstInputFileData%TMD_SA_MODE = SrcInputFileData%TMD_SA_MODE - DstInputFileData%TMD_DOF_MODE = SrcInputFileData%TMD_DOF_MODE - DstInputFileData%TMD_X_DOF = SrcInputFileData%TMD_X_DOF - DstInputFileData%TMD_Y_DOF = SrcInputFileData%TMD_Y_DOF - DstInputFileData%TMD_X_DSP = SrcInputFileData%TMD_X_DSP - DstInputFileData%TMD_Y_DSP = SrcInputFileData%TMD_Y_DSP - DstInputFileData%TMD_X_M = SrcInputFileData%TMD_X_M - DstInputFileData%TMD_Y_M = SrcInputFileData%TMD_Y_M - DstInputFileData%TMD_XY_M = SrcInputFileData%TMD_XY_M - DstInputFileData%TMD_X_K = SrcInputFileData%TMD_X_K - DstInputFileData%TMD_Y_K = SrcInputFileData%TMD_Y_K - DstInputFileData%TMD_X_C = SrcInputFileData%TMD_X_C - DstInputFileData%TMD_Y_C = SrcInputFileData%TMD_Y_C - DstInputFileData%TMD_X_DWSP = SrcInputFileData%TMD_X_DWSP - DstInputFileData%TMD_X_UWSP = SrcInputFileData%TMD_X_UWSP - DstInputFileData%TMD_X_KS = SrcInputFileData%TMD_X_KS - DstInputFileData%TMD_X_CS = SrcInputFileData%TMD_X_CS - DstInputFileData%TMD_Y_PLSP = SrcInputFileData%TMD_Y_PLSP - DstInputFileData%TMD_Y_NLSP = SrcInputFileData%TMD_Y_NLSP - DstInputFileData%TMD_Y_KS = SrcInputFileData%TMD_Y_KS - DstInputFileData%TMD_Y_CS = SrcInputFileData%TMD_Y_CS - DstInputFileData%TMD_P_X = SrcInputFileData%TMD_P_X - DstInputFileData%TMD_P_Y = SrcInputFileData%TMD_P_Y - DstInputFileData%TMD_P_Z = SrcInputFileData%TMD_P_Z - DstInputFileData%TMD_X_C_HIGH = SrcInputFileData%TMD_X_C_HIGH - DstInputFileData%TMD_X_C_LOW = SrcInputFileData%TMD_X_C_LOW - DstInputFileData%TMD_Y_C_HIGH = SrcInputFileData%TMD_Y_C_HIGH - DstInputFileData%TMD_Y_C_LOW = SrcInputFileData%TMD_Y_C_LOW - DstInputFileData%TMD_X_C_BRAKE = SrcInputFileData%TMD_X_C_BRAKE - DstInputFileData%TMD_Y_C_BRAKE = SrcInputFileData%TMD_Y_C_BRAKE - DstInputFileData%USE_F_TBL = SrcInputFileData%USE_F_TBL - DstInputFileData%TMD_F_TBL_FILE = SrcInputFileData%TMD_F_TBL_FILE -IF (ALLOCATED(SrcInputFileData%F_TBL)) THEN - i1_l = LBOUND(SrcInputFileData%F_TBL,1) - i1_u = UBOUND(SrcInputFileData%F_TBL,1) - i2_l = LBOUND(SrcInputFileData%F_TBL,2) - i2_u = UBOUND(SrcInputFileData%F_TBL,2) - IF (.NOT. ALLOCATED(DstInputFileData%F_TBL)) THEN - ALLOCATE(DstInputFileData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%F_TBL.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstInputFileData%F_TBL = SrcInputFileData%F_TBL -ENDIF - END SUBROUTINE TMD_CopyInputFile - - SUBROUTINE TMD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) - TYPE(TMD_InputFile), INTENT(INOUT) :: InputFileData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyInputFile' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" -IF (ALLOCATED(InputFileData%F_TBL)) THEN - DEALLOCATE(InputFileData%F_TBL) -ENDIF - END SUBROUTINE TMD_DestroyInputFile - - SUBROUTINE TMD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_InputFile), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackInputFile' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1*LEN(InData%TMDFileName) ! TMDFileName - Int_BufSz = Int_BufSz + 1 ! TMD_CMODE - Int_BufSz = Int_BufSz + 1 ! TMD_SA_MODE - Int_BufSz = Int_BufSz + 1 ! TMD_DOF_MODE - Int_BufSz = Int_BufSz + 1 ! TMD_X_DOF - Int_BufSz = Int_BufSz + 1 ! TMD_Y_DOF - Re_BufSz = Re_BufSz + 1 ! TMD_X_DSP - Re_BufSz = Re_BufSz + 1 ! TMD_Y_DSP - Re_BufSz = Re_BufSz + 1 ! TMD_X_M - Re_BufSz = Re_BufSz + 1 ! TMD_Y_M - Re_BufSz = Re_BufSz + 1 ! TMD_XY_M - Re_BufSz = Re_BufSz + 1 ! TMD_X_K - Re_BufSz = Re_BufSz + 1 ! TMD_Y_K - Re_BufSz = Re_BufSz + 1 ! TMD_X_C - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C - Re_BufSz = Re_BufSz + 1 ! TMD_X_DWSP - Re_BufSz = Re_BufSz + 1 ! TMD_X_UWSP - Re_BufSz = Re_BufSz + 1 ! TMD_X_KS - Re_BufSz = Re_BufSz + 1 ! TMD_X_CS - Re_BufSz = Re_BufSz + 1 ! TMD_Y_PLSP - Re_BufSz = Re_BufSz + 1 ! TMD_Y_NLSP - Re_BufSz = Re_BufSz + 1 ! TMD_Y_KS - Re_BufSz = Re_BufSz + 1 ! TMD_Y_CS - Re_BufSz = Re_BufSz + 1 ! TMD_P_X - Re_BufSz = Re_BufSz + 1 ! TMD_P_Y - Re_BufSz = Re_BufSz + 1 ! TMD_P_Z - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_HIGH - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_LOW - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_HIGH - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_LOW - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_BRAKE - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_BRAKE - Int_BufSz = Int_BufSz + 1 ! USE_F_TBL - Int_BufSz = Int_BufSz + 1*LEN(InData%TMD_F_TBL_FILE) ! TMD_F_TBL_FILE - Int_BufSz = Int_BufSz + 1 ! F_TBL allocated yes/no - IF ( ALLOCATED(InData%F_TBL) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! F_TBL upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%F_TBL) ! F_TBL - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DO I = 1, LEN(InData%TMDFileName) - IntKiBuf(Int_Xferred) = ICHAR(InData%TMDFileName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = InData%TMD_CMODE - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TMD_SA_MODE - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TMD_DOF_MODE - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TMD_X_DOF, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TMD_Y_DOF, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_DSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_DSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_M - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_M - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_XY_M - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_K - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_K - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_DWSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_UWSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_KS - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_CS - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_PLSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_NLSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_KS - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_CS - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_P_X - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_P_Y - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_P_Z - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_HIGH - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_LOW - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_HIGH - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_LOW - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_BRAKE - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_BRAKE - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%USE_F_TBL, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(InData%TMD_F_TBL_FILE) - IntKiBuf(Int_Xferred) = ICHAR(InData%TMD_F_TBL_FILE(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( .NOT. ALLOCATED(InData%F_TBL) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%F_TBL,2), UBOUND(InData%F_TBL,2) - DO i1 = LBOUND(InData%F_TBL,1), UBOUND(InData%F_TBL,1) - ReKiBuf(Re_Xferred) = InData%F_TBL(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE TMD_PackInputFile - - SUBROUTINE TMD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_InputFile), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackInputFile' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - DO I = 1, LEN(OutData%TMDFileName) - OutData%TMDFileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%TMD_CMODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_SA_MODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_DOF_MODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_X_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%TMD_X_DOF) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_Y_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%TMD_Y_DOF) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_X_DSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_DSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_M = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_M = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_XY_M = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_K = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_K = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_DWSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_UWSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_KS = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_CS = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_PLSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_NLSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_KS = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_CS = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_P_X = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_P_Y = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_P_Z = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C_HIGH = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C_LOW = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_HIGH = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_LOW = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C_BRAKE = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_BRAKE = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%USE_F_TBL = TRANSFER(IntKiBuf(Int_Xferred), OutData%USE_F_TBL) - Int_Xferred = Int_Xferred + 1 - DO I = 1, LEN(OutData%TMD_F_TBL_FILE) - OutData%TMD_F_TBL_FILE(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_TBL not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%F_TBL)) DEALLOCATE(OutData%F_TBL) - ALLOCATE(OutData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_TBL.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%F_TBL,2), UBOUND(OutData%F_TBL,2) - DO i1 = LBOUND(OutData%F_TBL,1), UBOUND(OutData%F_TBL,1) - OutData%F_TBL(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE TMD_UnPackInputFile - - SUBROUTINE TMD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_InitInputType), INTENT(IN) :: SrcInitInputData - TYPE(TMD_InitInputType), INTENT(INOUT) :: DstInitInputData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyInitInput' -! - ErrStat = ErrID_None - ErrMsg = "" - DstInitInputData%InputFile = SrcInitInputData%InputFile - DstInitInputData%RootName = SrcInitInputData%RootName - DstInitInputData%Gravity = SrcInitInputData%Gravity - DstInitInputData%r_N_O_G = SrcInitInputData%r_N_O_G - END SUBROUTINE TMD_CopyInitInput - - SUBROUTINE TMD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) - TYPE(TMD_InitInputType), INTENT(INOUT) :: InitInputData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyInitInput' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyInitInput - - SUBROUTINE TMD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_InitInputType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackInitInput' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1*LEN(InData%InputFile) ! InputFile - Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName - Re_BufSz = Re_BufSz + 1 ! Gravity - Re_BufSz = Re_BufSz + SIZE(InData%r_N_O_G) ! r_N_O_G - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DO I = 1, LEN(InData%InputFile) - IntKiBuf(Int_Xferred) = ICHAR(InData%InputFile(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - DO I = 1, LEN(InData%RootName) - IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - ReKiBuf(Re_Xferred) = InData%Gravity - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%r_N_O_G,1), UBOUND(InData%r_N_O_G,1) - ReKiBuf(Re_Xferred) = InData%r_N_O_G(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE TMD_PackInitInput - - SUBROUTINE TMD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_InitInputType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackInitInput' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - DO I = 1, LEN(OutData%InputFile) - OutData%InputFile(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - DO I = 1, LEN(OutData%RootName) - OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%Gravity = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%r_N_O_G,1) - i1_u = UBOUND(OutData%r_N_O_G,1) - DO i1 = LBOUND(OutData%r_N_O_G,1), UBOUND(OutData%r_N_O_G,1) - OutData%r_N_O_G(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE TMD_UnPackInitInput - - SUBROUTINE TMD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_InitOutputType), INTENT(IN) :: SrcInitOutputData - TYPE(TMD_InitOutputType), INTENT(INOUT) :: DstInitOutputData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyInitOutput' -! - ErrStat = ErrID_None - ErrMsg = "" - DstInitOutputData%DummyInitOut = SrcInitOutputData%DummyInitOut - END SUBROUTINE TMD_CopyInitOutput - - SUBROUTINE TMD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) - TYPE(TMD_InitOutputType), INTENT(INOUT) :: InitOutputData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyInitOutput' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyInitOutput - - SUBROUTINE TMD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_InitOutputType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackInitOutput' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyInitOut - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%DummyInitOut - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_PackInitOutput - - SUBROUTINE TMD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_InitOutputType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackInitOutput' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyInitOut = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_UnPackInitOutput - - SUBROUTINE TMD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_ContinuousStateType), INTENT(IN) :: SrcContStateData - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: DstContStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyContState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstContStateData%DummyContState = SrcContStateData%DummyContState - DstContStateData%tmd_x = SrcContStateData%tmd_x - END SUBROUTINE TMD_CopyContState - - SUBROUTINE TMD_DestroyContState( ContStateData, ErrStat, ErrMsg ) - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: ContStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyContState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyContState - - SUBROUTINE TMD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_ContinuousStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackContState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyContState - Re_BufSz = Re_BufSz + SIZE(InData%tmd_x) ! tmd_x - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%DummyContState - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%tmd_x,1), UBOUND(InData%tmd_x,1) - ReKiBuf(Re_Xferred) = InData%tmd_x(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE TMD_PackContState - - SUBROUTINE TMD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_ContinuousStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackContState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyContState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%tmd_x,1) - i1_u = UBOUND(OutData%tmd_x,1) - DO i1 = LBOUND(OutData%tmd_x,1), UBOUND(OutData%tmd_x,1) - OutData%tmd_x(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END SUBROUTINE TMD_UnPackContState - - SUBROUTINE TMD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData - TYPE(TMD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyDiscState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstDiscStateData%DummyDiscState = SrcDiscStateData%DummyDiscState - END SUBROUTINE TMD_CopyDiscState - - SUBROUTINE TMD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) - TYPE(TMD_DiscreteStateType), INTENT(INOUT) :: DiscStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyDiscState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyDiscState - - SUBROUTINE TMD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_DiscreteStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackDiscState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyDiscState - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%DummyDiscState - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_PackDiscState - - SUBROUTINE TMD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_DiscreteStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackDiscState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyDiscState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_UnPackDiscState - - SUBROUTINE TMD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData - TYPE(TMD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyConstrState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState - END SUBROUTINE TMD_CopyConstrState - - SUBROUTINE TMD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) - TYPE(TMD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyConstrState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyConstrState - - SUBROUTINE TMD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_ConstraintStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackConstrState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyConstrState - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%DummyConstrState - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_PackConstrState - - SUBROUTINE TMD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_ConstraintStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackConstrState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyConstrState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_UnPackConstrState - - SUBROUTINE TMD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_OtherStateType), INTENT(IN) :: SrcOtherStateData - TYPE(TMD_OtherStateType), INTENT(INOUT) :: DstOtherStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyOtherState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstOtherStateData%DummyOtherState = SrcOtherStateData%DummyOtherState - END SUBROUTINE TMD_CopyOtherState - - SUBROUTINE TMD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) - TYPE(TMD_OtherStateType), INTENT(INOUT) :: OtherStateData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyOtherState' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyOtherState - - SUBROUTINE TMD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_OtherStateType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackOtherState' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyOtherState - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - ReKiBuf(Re_Xferred) = InData%DummyOtherState - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_PackOtherState - - SUBROUTINE TMD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_OtherStateType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackOtherState' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DummyOtherState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_UnPackOtherState - - SUBROUTINE TMD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_MiscVarType), INTENT(IN) :: SrcMiscData - TYPE(TMD_MiscVarType), INTENT(INOUT) :: DstMiscData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyMisc' -! - ErrStat = ErrID_None - ErrMsg = "" - DstMiscData%F_stop = SrcMiscData%F_stop - DstMiscData%F_ext = SrcMiscData%F_ext - DstMiscData%F_fr = SrcMiscData%F_fr - DstMiscData%C_ctrl = SrcMiscData%C_ctrl - DstMiscData%C_Brake = SrcMiscData%C_Brake - DstMiscData%F_table = SrcMiscData%F_table - DstMiscData%F_k_x = SrcMiscData%F_k_x - DstMiscData%F_k_y = SrcMiscData%F_k_y - END SUBROUTINE TMD_CopyMisc - - SUBROUTINE TMD_DestroyMisc( MiscData, ErrStat, ErrMsg ) - TYPE(TMD_MiscVarType), INTENT(INOUT) :: MiscData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyMisc' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - END SUBROUTINE TMD_DestroyMisc - - SUBROUTINE TMD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_MiscVarType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackMisc' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Re_BufSz = Re_BufSz + SIZE(InData%F_stop) ! F_stop - Re_BufSz = Re_BufSz + SIZE(InData%F_ext) ! F_ext - Re_BufSz = Re_BufSz + SIZE(InData%F_fr) ! F_fr - Re_BufSz = Re_BufSz + SIZE(InData%C_ctrl) ! C_ctrl - Re_BufSz = Re_BufSz + SIZE(InData%C_Brake) ! C_Brake - Re_BufSz = Re_BufSz + SIZE(InData%F_table) ! F_table - Re_BufSz = Re_BufSz + 1 ! F_k_x - Re_BufSz = Re_BufSz + 1 ! F_k_y - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DO i1 = LBOUND(InData%F_stop,1), UBOUND(InData%F_stop,1) - ReKiBuf(Re_Xferred) = InData%F_stop(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%F_ext,1), UBOUND(InData%F_ext,1) - ReKiBuf(Re_Xferred) = InData%F_ext(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%F_fr,1), UBOUND(InData%F_fr,1) - ReKiBuf(Re_Xferred) = InData%F_fr(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%C_ctrl,1), UBOUND(InData%C_ctrl,1) - ReKiBuf(Re_Xferred) = InData%C_ctrl(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%C_Brake,1), UBOUND(InData%C_Brake,1) - ReKiBuf(Re_Xferred) = InData%C_Brake(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%F_table,1), UBOUND(InData%F_table,1) - ReKiBuf(Re_Xferred) = InData%F_table(i1) - Re_Xferred = Re_Xferred + 1 - END DO - ReKiBuf(Re_Xferred) = InData%F_k_x - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%F_k_y - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_PackMisc - - SUBROUTINE TMD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_MiscVarType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackMisc' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - i1_l = LBOUND(OutData%F_stop,1) - i1_u = UBOUND(OutData%F_stop,1) - DO i1 = LBOUND(OutData%F_stop,1), UBOUND(OutData%F_stop,1) - OutData%F_stop(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%F_ext,1) - i1_u = UBOUND(OutData%F_ext,1) - DO i1 = LBOUND(OutData%F_ext,1), UBOUND(OutData%F_ext,1) - OutData%F_ext(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%F_fr,1) - i1_u = UBOUND(OutData%F_fr,1) - DO i1 = LBOUND(OutData%F_fr,1), UBOUND(OutData%F_fr,1) - OutData%F_fr(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%C_ctrl,1) - i1_u = UBOUND(OutData%C_ctrl,1) - DO i1 = LBOUND(OutData%C_ctrl,1), UBOUND(OutData%C_ctrl,1) - OutData%C_ctrl(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%C_Brake,1) - i1_u = UBOUND(OutData%C_Brake,1) - DO i1 = LBOUND(OutData%C_Brake,1), UBOUND(OutData%C_Brake,1) - OutData%C_Brake(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%F_table,1) - i1_u = UBOUND(OutData%F_table,1) - DO i1 = LBOUND(OutData%F_table,1), UBOUND(OutData%F_table,1) - OutData%F_table(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - OutData%F_k_x = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%F_k_y = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE TMD_UnPackMisc - - SUBROUTINE TMD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_ParameterType), INTENT(IN) :: SrcParamData - TYPE(TMD_ParameterType), INTENT(INOUT) :: DstParamData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyParam' -! - ErrStat = ErrID_None - ErrMsg = "" - DstParamData%DT = SrcParamData%DT - DstParamData%RootName = SrcParamData%RootName - DstParamData%TMD_DOF_MODE = SrcParamData%TMD_DOF_MODE - DstParamData%TMD_X_DOF = SrcParamData%TMD_X_DOF - DstParamData%TMD_Y_DOF = SrcParamData%TMD_Y_DOF - DstParamData%X_DSP = SrcParamData%X_DSP - DstParamData%Y_DSP = SrcParamData%Y_DSP - DstParamData%M_X = SrcParamData%M_X - DstParamData%M_Y = SrcParamData%M_Y - DstParamData%M_XY = SrcParamData%M_XY - DstParamData%K_X = SrcParamData%K_X - DstParamData%K_Y = SrcParamData%K_Y - DstParamData%C_X = SrcParamData%C_X - DstParamData%C_Y = SrcParamData%C_Y - DstParamData%K_S = SrcParamData%K_S - DstParamData%C_S = SrcParamData%C_S - DstParamData%P_SP = SrcParamData%P_SP - DstParamData%N_SP = SrcParamData%N_SP - DstParamData%F_ext = SrcParamData%F_ext - DstParamData%Gravity = SrcParamData%Gravity - DstParamData%TMD_CMODE = SrcParamData%TMD_CMODE - DstParamData%TMD_SA_MODE = SrcParamData%TMD_SA_MODE - DstParamData%TMD_X_C_HIGH = SrcParamData%TMD_X_C_HIGH - DstParamData%TMD_X_C_LOW = SrcParamData%TMD_X_C_LOW - DstParamData%TMD_Y_C_HIGH = SrcParamData%TMD_Y_C_HIGH - DstParamData%TMD_Y_C_LOW = SrcParamData%TMD_Y_C_LOW - DstParamData%TMD_X_C_BRAKE = SrcParamData%TMD_X_C_BRAKE - DstParamData%TMD_Y_C_BRAKE = SrcParamData%TMD_Y_C_BRAKE - DstParamData%Use_F_TBL = SrcParamData%Use_F_TBL -IF (ALLOCATED(SrcParamData%F_TBL)) THEN - i1_l = LBOUND(SrcParamData%F_TBL,1) - i1_u = UBOUND(SrcParamData%F_TBL,1) - i2_l = LBOUND(SrcParamData%F_TBL,2) - i2_u = UBOUND(SrcParamData%F_TBL,2) - IF (.NOT. ALLOCATED(DstParamData%F_TBL)) THEN - ALLOCATE(DstParamData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%F_TBL.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstParamData%F_TBL = SrcParamData%F_TBL -ENDIF - END SUBROUTINE TMD_CopyParam - - SUBROUTINE TMD_DestroyParam( ParamData, ErrStat, ErrMsg ) - TYPE(TMD_ParameterType), INTENT(INOUT) :: ParamData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyParam' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" -IF (ALLOCATED(ParamData%F_TBL)) THEN - DEALLOCATE(ParamData%F_TBL) -ENDIF - END SUBROUTINE TMD_DestroyParam - - SUBROUTINE TMD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_ParameterType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackParam' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - Db_BufSz = Db_BufSz + 1 ! DT - Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName - Int_BufSz = Int_BufSz + 1 ! TMD_DOF_MODE - Int_BufSz = Int_BufSz + 1 ! TMD_X_DOF - Int_BufSz = Int_BufSz + 1 ! TMD_Y_DOF - Re_BufSz = Re_BufSz + 1 ! X_DSP - Re_BufSz = Re_BufSz + 1 ! Y_DSP - Re_BufSz = Re_BufSz + 1 ! M_X - Re_BufSz = Re_BufSz + 1 ! M_Y - Re_BufSz = Re_BufSz + 1 ! M_XY - Re_BufSz = Re_BufSz + 1 ! K_X - Re_BufSz = Re_BufSz + 1 ! K_Y - Re_BufSz = Re_BufSz + 1 ! C_X - Re_BufSz = Re_BufSz + 1 ! C_Y - Re_BufSz = Re_BufSz + SIZE(InData%K_S) ! K_S - Re_BufSz = Re_BufSz + SIZE(InData%C_S) ! C_S - Re_BufSz = Re_BufSz + SIZE(InData%P_SP) ! P_SP - Re_BufSz = Re_BufSz + SIZE(InData%N_SP) ! N_SP - Re_BufSz = Re_BufSz + SIZE(InData%F_ext) ! F_ext - Re_BufSz = Re_BufSz + 1 ! Gravity - Int_BufSz = Int_BufSz + 1 ! TMD_CMODE - Int_BufSz = Int_BufSz + 1 ! TMD_SA_MODE - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_HIGH - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_LOW - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_HIGH - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_LOW - Re_BufSz = Re_BufSz + 1 ! TMD_X_C_BRAKE - Re_BufSz = Re_BufSz + 1 ! TMD_Y_C_BRAKE - Int_BufSz = Int_BufSz + 1 ! Use_F_TBL - Int_BufSz = Int_BufSz + 1 ! F_TBL allocated yes/no - IF ( ALLOCATED(InData%F_TBL) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! F_TBL upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%F_TBL) ! F_TBL - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - DbKiBuf(Db_Xferred) = InData%DT - Db_Xferred = Db_Xferred + 1 - DO I = 1, LEN(InData%RootName) - IntKiBuf(Int_Xferred) = ICHAR(InData%RootName(I:I), IntKi) - Int_Xferred = Int_Xferred + 1 - END DO ! I - IntKiBuf(Int_Xferred) = InData%TMD_DOF_MODE - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TMD_X_DOF, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%TMD_Y_DOF, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%X_DSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%Y_DSP - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%M_X - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%M_Y - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%M_XY - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%K_X - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%K_Y - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%C_X - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%C_Y - Re_Xferred = Re_Xferred + 1 - DO i1 = LBOUND(InData%K_S,1), UBOUND(InData%K_S,1) - ReKiBuf(Re_Xferred) = InData%K_S(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%C_S,1), UBOUND(InData%C_S,1) - ReKiBuf(Re_Xferred) = InData%C_S(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%P_SP,1), UBOUND(InData%P_SP,1) - ReKiBuf(Re_Xferred) = InData%P_SP(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%N_SP,1), UBOUND(InData%N_SP,1) - ReKiBuf(Re_Xferred) = InData%N_SP(i1) - Re_Xferred = Re_Xferred + 1 - END DO - DO i1 = LBOUND(InData%F_ext,1), UBOUND(InData%F_ext,1) - ReKiBuf(Re_Xferred) = InData%F_ext(i1) - Re_Xferred = Re_Xferred + 1 - END DO - ReKiBuf(Re_Xferred) = InData%Gravity - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TMD_CMODE - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%TMD_SA_MODE - Int_Xferred = Int_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_HIGH - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_LOW - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_HIGH - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_LOW - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_X_C_BRAKE - Re_Xferred = Re_Xferred + 1 - ReKiBuf(Re_Xferred) = InData%TMD_Y_C_BRAKE - Re_Xferred = Re_Xferred + 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%Use_F_TBL, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%F_TBL) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%F_TBL,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%F_TBL,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%F_TBL,2), UBOUND(InData%F_TBL,2) - DO i1 = LBOUND(InData%F_TBL,1), UBOUND(InData%F_TBL,1) - ReKiBuf(Re_Xferred) = InData%F_TBL(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE TMD_PackParam - - SUBROUTINE TMD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_ParameterType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackParam' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - OutData%DT = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - DO I = 1, LEN(OutData%RootName) - OutData%RootName(I:I) = CHAR(IntKiBuf(Int_Xferred)) - Int_Xferred = Int_Xferred + 1 - END DO ! I - OutData%TMD_DOF_MODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_X_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%TMD_X_DOF) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_Y_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%TMD_Y_DOF) - Int_Xferred = Int_Xferred + 1 - OutData%X_DSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Y_DSP = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%M_X = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%M_Y = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%M_XY = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%K_X = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%K_Y = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%C_X = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%C_Y = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - i1_l = LBOUND(OutData%K_S,1) - i1_u = UBOUND(OutData%K_S,1) - DO i1 = LBOUND(OutData%K_S,1), UBOUND(OutData%K_S,1) - OutData%K_S(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%C_S,1) - i1_u = UBOUND(OutData%C_S,1) - DO i1 = LBOUND(OutData%C_S,1), UBOUND(OutData%C_S,1) - OutData%C_S(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%P_SP,1) - i1_u = UBOUND(OutData%P_SP,1) - DO i1 = LBOUND(OutData%P_SP,1), UBOUND(OutData%P_SP,1) - OutData%P_SP(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%N_SP,1) - i1_u = UBOUND(OutData%N_SP,1) - DO i1 = LBOUND(OutData%N_SP,1), UBOUND(OutData%N_SP,1) - OutData%N_SP(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - i1_l = LBOUND(OutData%F_ext,1) - i1_u = UBOUND(OutData%F_ext,1) - DO i1 = LBOUND(OutData%F_ext,1), UBOUND(OutData%F_ext,1) - OutData%F_ext(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - OutData%Gravity = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_CMODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_SA_MODE = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%TMD_X_C_HIGH = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C_LOW = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_HIGH = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_LOW = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_X_C_BRAKE = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%TMD_Y_C_BRAKE = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - OutData%Use_F_TBL = TRANSFER(IntKiBuf(Int_Xferred), OutData%Use_F_TBL) - Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! F_TBL not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%F_TBL)) DEALLOCATE(OutData%F_TBL) - ALLOCATE(OutData%F_TBL(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%F_TBL.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%F_TBL,2), UBOUND(OutData%F_TBL,2) - DO i1 = LBOUND(OutData%F_TBL,1), UBOUND(OutData%F_TBL,1) - OutData%F_TBL(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF - END SUBROUTINE TMD_UnPackParam - - SUBROUTINE TMD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_InputType), INTENT(INOUT) :: SrcInputData - TYPE(TMD_InputType), INTENT(INOUT) :: DstInputData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyInput' -! - ErrStat = ErrID_None - ErrMsg = "" - CALL MeshCopy( SrcInputData%Mesh, DstInputData%Mesh, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE TMD_CopyInput - - SUBROUTINE TMD_DestroyInput( InputData, ErrStat, ErrMsg ) - TYPE(TMD_InputType), INTENT(INOUT) :: InputData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyInput' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL MeshDestroy( InputData%Mesh, ErrStat, ErrMsg ) - END SUBROUTINE TMD_DestroyInput - - SUBROUTINE TMD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_InputType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackInput' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! Mesh: size of buffers for each call to pack subtype - CALL MeshPack( InData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! Mesh - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! Mesh - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! Mesh - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - CALL MeshPack( InData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE TMD_PackInput - - SUBROUTINE TMD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_InputType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackInput' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE TMD_UnPackInput - - SUBROUTINE TMD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(TMD_OutputType), INTENT(INOUT) :: SrcOutputData - TYPE(TMD_OutputType), INTENT(INOUT) :: DstOutputData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_CopyOutput' -! - ErrStat = ErrID_None - ErrMsg = "" - CALL MeshCopy( SrcOutputData%Mesh, DstOutputData%Mesh, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE TMD_CopyOutput - - SUBROUTINE TMD_DestroyOutput( OutputData, ErrStat, ErrMsg ) - TYPE(TMD_OutputType), INTENT(INOUT) :: OutputData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_DestroyOutput' - INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 -! - ErrStat = ErrID_None - ErrMsg = "" - CALL MeshDestroy( OutputData%Mesh, ErrStat, ErrMsg ) - END SUBROUTINE TMD_DestroyOutput - - SUBROUTINE TMD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) - REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(TMD_OutputType), INTENT(IN) :: InData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly - ! Local variables - INTEGER(IntKi) :: Re_BufSz - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_BufSz - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_BufSz - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 - LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_PackOutput' - ! buffers to store subtypes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - - OnlySize = .FALSE. - IF ( PRESENT(SizeOnly) ) THEN - OnlySize = SizeOnly - ENDIF - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_BufSz = 0 - Db_BufSz = 0 - Int_BufSz = 0 - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! Mesh: size of buffers for each call to pack subtype - CALL MeshPack( InData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! Mesh - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! Mesh - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! Mesh - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF - IF ( Re_BufSz .GT. 0 ) THEN - ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Db_BufSz .GT. 0 ) THEN - ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF ( Int_BufSz .GT. 0 ) THEN - ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) - - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - - CALL MeshPack( InData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE TMD_PackOutput - - SUBROUTINE TMD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(TMD_OutputType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg - ! Local variables - INTEGER(IntKi) :: Buf_size - INTEGER(IntKi) :: Re_Xferred - INTEGER(IntKi) :: Db_Xferred - INTEGER(IntKi) :: Int_Xferred - INTEGER(IntKi) :: i - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_UnPackOutput' - ! buffers to store meshes, if any - REAL(ReKi), ALLOCATABLE :: Re_Buf(:) - REAL(DbKi), ALLOCATABLE :: Db_Buf(:) - INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) - ! - ErrStat = ErrID_None - ErrMsg = "" - Re_Xferred = 1 - Db_Xferred = 1 - Int_Xferred = 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%Mesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! Mesh - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE TMD_UnPackOutput - - - SUBROUTINE TMD_Input_ExtrapInterp(u, t, u_out, t_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time -! values of u (which has values associated with times in t). Order of the interpolation is given by the size of u -! -! expressions below based on either -! -! f(t) = a -! f(t) = a + b * t, or -! f(t) = a + b * t + c * t**2 -! -! where a, b and c are determined as the solution to -! f(t1) = u1, f(t2) = u2, f(t3) = u3 (as appropriate) -! -!.................................................................................................................................. - - TYPE(TMD_InputType), INTENT(INOUT) :: u(:) ! Input at t1 > t2 > t3 - REAL(DbKi), INTENT(IN ) :: t(:) ! Times associated with the Inputs - TYPE(TMD_InputType), INTENT(INOUT) :: u_out ! Input at tin_out - REAL(DbKi), INTENT(IN ) :: t_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - INTEGER(IntKi) :: order ! order of polynomial fit (max 2) - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Input_ExtrapInterp' - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - if ( size(t) .ne. size(u)) then - CALL SetErrStat(ErrID_Fatal,'size(t) must equal size(u)',ErrStat,ErrMsg,RoutineName) - RETURN - endif - order = SIZE(u) - 1 - IF ( order .eq. 0 ) THEN - CALL TMD_CopyInput(u(1), u_out, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE IF ( order .eq. 1 ) THEN - CALL TMD_Input_ExtrapInterp1(u(1), u(2), t, u_out, t_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE IF ( order .eq. 2 ) THEN - CALL TMD_Input_ExtrapInterp2(u(1), u(2), u(3), t, u_out, t_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE - CALL SetErrStat(ErrID_Fatal,'size(u) must be less than 4 (order must be less than 3).',ErrStat,ErrMsg,RoutineName) - RETURN - ENDIF - END SUBROUTINE TMD_Input_ExtrapInterp - - - SUBROUTINE TMD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time -! values of u (which has values associated with times in t). Order of the interpolation is 1. -! -! f(t) = a + b * t, or -! -! where a and b are determined as the solution to -! f(t1) = u1, f(t2) = u2 -! -!.................................................................................................................................. - - TYPE(TMD_InputType), INTENT(INOUT) :: u1 ! Input at t1 > t2 - TYPE(TMD_InputType), INTENT(INOUT) :: u2 ! Input at t2 - REAL(DbKi), INTENT(IN ) :: tin(2) ! Times associated with the Inputs - TYPE(TMD_InputType), INTENT(INOUT) :: u_out ! Input at tin_out - REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - REAL(DbKi) :: t(2) ! Times associated with the Inputs - REAL(DbKi) :: t_out ! Time to which to be extrap/interpd - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Input_ExtrapInterp1' - REAL(DbKi) :: b ! temporary for extrapolation/interpolation - REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - ! we'll subtract a constant from the times to resolve some - ! numerical issues when t gets large (and to simplify the equations) - t = tin - tin(1) - t_out = tin_out - tin(1) - - IF ( EqualRealNos( t(1), t(2) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - - ScaleFactor = t_out / t(2) - CALL MeshExtrapInterp1(u1%Mesh, u2%Mesh, tin, u_out%Mesh, tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - END SUBROUTINE TMD_Input_ExtrapInterp1 - - - SUBROUTINE TMD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Input u_out at time t_out, from previous/future time -! values of u (which has values associated with times in t). Order of the interpolation is 2. -! -! expressions below based on either -! -! f(t) = a + b * t + c * t**2 -! -! where a, b and c are determined as the solution to -! f(t1) = u1, f(t2) = u2, f(t3) = u3 -! -!.................................................................................................................................. - - TYPE(TMD_InputType), INTENT(INOUT) :: u1 ! Input at t1 > t2 > t3 - TYPE(TMD_InputType), INTENT(INOUT) :: u2 ! Input at t2 > t3 - TYPE(TMD_InputType), INTENT(INOUT) :: u3 ! Input at t3 - REAL(DbKi), INTENT(IN ) :: tin(3) ! Times associated with the Inputs - TYPE(TMD_InputType), INTENT(INOUT) :: u_out ! Input at tin_out - REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - REAL(DbKi) :: t(3) ! Times associated with the Inputs - REAL(DbKi) :: t_out ! Time to which to be extrap/interpd - INTEGER(IntKi) :: order ! order of polynomial fit (max 2) - REAL(DbKi) :: b ! temporary for extrapolation/interpolation - REAL(DbKi) :: c ! temporary for extrapolation/interpolation - REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Input_ExtrapInterp2' - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - ! we'll subtract a constant from the times to resolve some - ! numerical issues when t gets large (and to simplify the equations) - t = tin - tin(1) - t_out = tin_out - tin(1) - - IF ( EqualRealNos( t(1), t(2) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - ELSE IF ( EqualRealNos( t(2), t(3) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(2) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - ELSE IF ( EqualRealNos( t(1), t(3) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - - ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) - CALL MeshExtrapInterp2(u1%Mesh, u2%Mesh, u3%Mesh, tin, u_out%Mesh, tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - END SUBROUTINE TMD_Input_ExtrapInterp2 - - - SUBROUTINE TMD_Output_ExtrapInterp(y, t, y_out, t_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time -! values of y (which has values associated with times in t). Order of the interpolation is given by the size of y -! -! expressions below based on either -! -! f(t) = a -! f(t) = a + b * t, or -! f(t) = a + b * t + c * t**2 -! -! where a, b and c are determined as the solution to -! f(t1) = y1, f(t2) = y2, f(t3) = y3 (as appropriate) -! -!.................................................................................................................................. - - TYPE(TMD_OutputType), INTENT(INOUT) :: y(:) ! Output at t1 > t2 > t3 - REAL(DbKi), INTENT(IN ) :: t(:) ! Times associated with the Outputs - TYPE(TMD_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out - REAL(DbKi), INTENT(IN ) :: t_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - INTEGER(IntKi) :: order ! order of polynomial fit (max 2) - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Output_ExtrapInterp' - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - if ( size(t) .ne. size(y)) then - CALL SetErrStat(ErrID_Fatal,'size(t) must equal size(y)',ErrStat,ErrMsg,RoutineName) - RETURN - endif - order = SIZE(y) - 1 - IF ( order .eq. 0 ) THEN - CALL TMD_CopyOutput(y(1), y_out, MESH_UPDATECOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE IF ( order .eq. 1 ) THEN - CALL TMD_Output_ExtrapInterp1(y(1), y(2), t, y_out, t_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE IF ( order .eq. 2 ) THEN - CALL TMD_Output_ExtrapInterp2(y(1), y(2), y(3), t, y_out, t_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ELSE - CALL SetErrStat(ErrID_Fatal,'size(y) must be less than 4 (order must be less than 3).',ErrStat,ErrMsg,RoutineName) - RETURN - ENDIF - END SUBROUTINE TMD_Output_ExtrapInterp - - - SUBROUTINE TMD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time -! values of y (which has values associated with times in t). Order of the interpolation is 1. -! -! f(t) = a + b * t, or -! -! where a and b are determined as the solution to -! f(t1) = y1, f(t2) = y2 -! -!.................................................................................................................................. - - TYPE(TMD_OutputType), INTENT(INOUT) :: y1 ! Output at t1 > t2 - TYPE(TMD_OutputType), INTENT(INOUT) :: y2 ! Output at t2 - REAL(DbKi), INTENT(IN ) :: tin(2) ! Times associated with the Outputs - TYPE(TMD_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out - REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - REAL(DbKi) :: t(2) ! Times associated with the Outputs - REAL(DbKi) :: t_out ! Time to which to be extrap/interpd - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Output_ExtrapInterp1' - REAL(DbKi) :: b ! temporary for extrapolation/interpolation - REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - ! we'll subtract a constant from the times to resolve some - ! numerical issues when t gets large (and to simplify the equations) - t = tin - tin(1) - t_out = tin_out - tin(1) - - IF ( EqualRealNos( t(1), t(2) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - - ScaleFactor = t_out / t(2) - CALL MeshExtrapInterp1(y1%Mesh, y2%Mesh, tin, y_out%Mesh, tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - END SUBROUTINE TMD_Output_ExtrapInterp1 - - - SUBROUTINE TMD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, ErrMsg ) -! -! This subroutine calculates a extrapolated (or interpolated) Output y_out at time t_out, from previous/future time -! values of y (which has values associated with times in t). Order of the interpolation is 2. -! -! expressions below based on either -! -! f(t) = a + b * t + c * t**2 -! -! where a, b and c are determined as the solution to -! f(t1) = y1, f(t2) = y2, f(t3) = y3 -! -!.................................................................................................................................. - - TYPE(TMD_OutputType), INTENT(INOUT) :: y1 ! Output at t1 > t2 > t3 - TYPE(TMD_OutputType), INTENT(INOUT) :: y2 ! Output at t2 > t3 - TYPE(TMD_OutputType), INTENT(INOUT) :: y3 ! Output at t3 - REAL(DbKi), INTENT(IN ) :: tin(3) ! Times associated with the Outputs - TYPE(TMD_OutputType), INTENT(INOUT) :: y_out ! Output at tin_out - REAL(DbKi), INTENT(IN ) :: tin_out ! time to be extrap/interp'd to - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - ! local variables - REAL(DbKi) :: t(3) ! Times associated with the Outputs - REAL(DbKi) :: t_out ! Time to which to be extrap/interpd - INTEGER(IntKi) :: order ! order of polynomial fit (max 2) - REAL(DbKi) :: b ! temporary for extrapolation/interpolation - REAL(DbKi) :: c ! temporary for extrapolation/interpolation - REAL(DbKi) :: ScaleFactor ! temporary for extrapolation/interpolation - INTEGER(IntKi) :: ErrStat2 ! local errors - CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors - CHARACTER(*), PARAMETER :: RoutineName = 'TMD_Output_ExtrapInterp2' - ! Initialize ErrStat - ErrStat = ErrID_None - ErrMsg = "" - ! we'll subtract a constant from the times to resolve some - ! numerical issues when t gets large (and to simplify the equations) - t = tin - tin(1) - t_out = tin_out - tin(1) - - IF ( EqualRealNos( t(1), t(2) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(2) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - ELSE IF ( EqualRealNos( t(2), t(3) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(2) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - ELSE IF ( EqualRealNos( t(1), t(3) ) ) THEN - CALL SetErrStat(ErrID_Fatal, 't(1) must not equal t(3) to avoid a division-by-zero error.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - - ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) - CALL MeshExtrapInterp2(y1%Mesh, y2%Mesh, y3%Mesh, tin, y_out%Mesh, tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - END SUBROUTINE TMD_Output_ExtrapInterp2 - -END MODULE TMD_Types -!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/servodyn/src/UserSubs.f90 b/modules/servodyn/src/UserSubs.f90 index bd276dcdb3..64c3501f65 100644 --- a/modules/servodyn/src/UserSubs.f90 +++ b/modules/servodyn/src/UserSubs.f90 @@ -426,6 +426,7 @@ SUBROUTINE UserYawCont ( YawPos, YawRate, WindDir, YawError, NumBl, ZTime, DT, D USE Precision +USE NWTC_Library IMPLICIT NONE @@ -451,6 +452,21 @@ SUBROUTINE UserYawCont ( YawPos, YawRate, WindDir, YawError, NumBl, ZTime, DT, D YawPosCom = 0.0 YawRateCom = 0.0 +!JASON: IMPOSE YAW STEP FOR FAST.Farm CALIBRATION CASE - START +IF ( ( ZTime >= 648.0_DbKi ) .AND. ( ZTime < 650.0_DbKi ) ) THEN + YawRateCom = ( 10.0_ReKi/2.0_ReKi )*D2R + YawPosCom = 0.0 + YawRateCom*( ZTime - 648.0_DbKi ) +ELSE IF ( ( ZTime >= 650.0_DbKi ) .AND. ( ZTime < 948.0_DbKi ) ) THEN + YawRateCom = 0.0 + YawPosCom = 10.0_ReKi*D2R +ELSE IF ( ( ZTime >= 948.0_DbKi ) .AND. ( ZTime < 950.0_DbKi ) ) THEN + YawRateCom = ( 15.0_ReKi/2.0_ReKi )*D2R + YawPosCom = 10.0_ReKi*D2R + YawRateCom*( ZTime - 948.0_DbKi ) +ELSE IF ( ( ZTime >= 950.0_DbKi ) ) THEN + YawRateCom = 0.0 + YawPosCom = 25.0_ReKi*D2R +END IF +!JASON: IMPOSE YAW STEP FOR FAST.Farm CALIBRATION CASE - END RETURN diff --git a/modules/supercontroller/CMakeLists.txt b/modules/supercontroller/CMakeLists.txt index 8020da2016..4dfde3048c 100644 --- a/modules/supercontroller/CMakeLists.txt +++ b/modules/supercontroller/CMakeLists.txt @@ -16,19 +16,27 @@ if (GENERATE_TYPES) generate_f90_types(src/SuperController_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/SuperController_Types.f90 -ccode) + generate_f90_types(src/SC_DataEx_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/SCDataEx_Types.f90 -ccode -noextrap) endif() # copy the header files to their build location configure_file(src/SuperController_Types.h ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) +configure_file(src/SCDataEx_Types.h ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) -add_library(sctypeslib src/SuperController_Types.f90) +add_library(scdataextypeslib src/SCDataEx_Types.f90) +target_link_libraries(scdataextypeslib nwtclibs) + +add_library(scdataexlib src/SC_DataEx.f90) +target_link_libraries(scdataexlib scdataextypeslib openfast_prelib nwtclibs) + +add_library(sctypeslib src/SuperController_Types.f90) target_link_libraries(sctypeslib nwtclibs) add_library(scfastlib src/SuperController.f90) target_link_libraries(scfastlib sctypeslib openfast_prelib nwtclibs) -install(TARGETS sctypeslib scfastlib +install(TARGETS sctypeslib scfastlib scdataextypeslib scdataexlib EXPORT "${CMAKE_PROJECT_NAME}Libraries" RUNTIME DESTINATION bin LIBRARY DESTINATION lib @@ -36,4 +44,5 @@ install(TARGETS sctypeslib scfastlib install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SuperController_Types.h + ${CMAKE_CURRENT_BINARY_DIR}/SCDataEx_Types.h DESTINATION include) diff --git a/modules/supercontroller/src/SCDataEx_Types.f90 b/modules/supercontroller/src/SCDataEx_Types.f90 new file mode 100644 index 0000000000..87f9b83253 --- /dev/null +++ b/modules/supercontroller/src/SCDataEx_Types.f90 @@ -0,0 +1,1257 @@ +!STARTOFREGISTRYGENERATEDFILE 'SCDataEx_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! SCDataEx_Types +!................................................................................................................................. +! This file is part of SCDataEx. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in SCDataEx. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE SCDataEx_Types +!--------------------------------------------------------------------------------------------------------------------------------- +!USE, INTRINSIC :: ISO_C_Binding +USE NWTC_Library +IMPLICIT NONE +! ========= SC_DX_InitInputType_C ======= + TYPE, BIND(C) :: SC_DX_InitInputType_C + TYPE(C_PTR) :: object = C_NULL_PTR + INTEGER(KIND=C_INT) :: NumSC2Ctrl + INTEGER(KIND=C_INT) :: NumSC2CtrlGlob + INTEGER(KIND=C_INT) :: NumCtrl2SC + END TYPE SC_DX_InitInputType_C + TYPE, PUBLIC :: SC_DX_InitInputType + TYPE( SC_DX_InitInputType_C ) :: C_obj + INTEGER(IntKi) :: NumSC2Ctrl !< number of turbine specific controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumCtrl2SC !< number of controller outputs [to supercontroller] [-] + END TYPE SC_DX_InitInputType +! ======================= +! ========= SC_DX_InitOutputType_C ======= + TYPE, BIND(C) :: SC_DX_InitOutputType_C + TYPE(C_PTR) :: object = C_NULL_PTR + END TYPE SC_DX_InitOutputType_C + TYPE, PUBLIC :: SC_DX_InitOutputType + TYPE( SC_DX_InitOutputType_C ) :: C_obj + TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] + END TYPE SC_DX_InitOutputType +! ======================= +! ========= SC_DX_ParameterType_C ======= + TYPE, BIND(C) :: SC_DX_ParameterType_C + TYPE(C_PTR) :: object = C_NULL_PTR + LOGICAL(KIND=C_BOOL) :: useSC + END TYPE SC_DX_ParameterType_C + TYPE, PUBLIC :: SC_DX_ParameterType + TYPE( SC_DX_ParameterType_C ) :: C_obj + LOGICAL :: useSC = .FALSE. !< Flag that tells this module if supercontroller is on. [-] + END TYPE SC_DX_ParameterType +! ======================= +! ========= SC_DX_InputType_C ======= + TYPE, BIND(C) :: SC_DX_InputType_C + TYPE(C_PTR) :: object = C_NULL_PTR + TYPE(C_ptr) :: toSC = C_NULL_PTR + INTEGER(C_int) :: toSC_Len = 0 + END TYPE SC_DX_InputType_C + TYPE, PUBLIC :: SC_DX_InputType + TYPE( SC_DX_InputType_C ) :: C_obj + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: toSC => NULL() !< inputs to the super controller (from the turbine controller) [-] + END TYPE SC_DX_InputType +! ======================= +! ========= SC_DX_OutputType_C ======= + TYPE, BIND(C) :: SC_DX_OutputType_C + TYPE(C_PTR) :: object = C_NULL_PTR + TYPE(C_ptr) :: fromSC = C_NULL_PTR + INTEGER(C_int) :: fromSC_Len = 0 + TYPE(C_ptr) :: fromSCglob = C_NULL_PTR + INTEGER(C_int) :: fromSCglob_Len = 0 + END TYPE SC_DX_OutputType_C + TYPE, PUBLIC :: SC_DX_OutputType + TYPE( SC_DX_OutputType_C ) :: C_obj + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: fromSC => NULL() !< global outputs of the super controller (to the turbine controller) [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: fromSCglob => NULL() !< turbine specific outputs of the super controller (to the turbine controller) [-] + END TYPE SC_DX_OutputType +! ======================= +CONTAINS + SUBROUTINE SC_DX_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DX_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(SC_DX_InitInputType), INTENT(INOUT) :: DstInitInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInitInputData%NumSC2Ctrl = SrcInitInputData%NumSC2Ctrl + DstInitInputData%C_obj%NumSC2Ctrl = SrcInitInputData%C_obj%NumSC2Ctrl + DstInitInputData%NumSC2CtrlGlob = SrcInitInputData%NumSC2CtrlGlob + DstInitInputData%C_obj%NumSC2CtrlGlob = SrcInitInputData%C_obj%NumSC2CtrlGlob + DstInitInputData%NumCtrl2SC = SrcInitInputData%NumCtrl2SC + DstInitInputData%C_obj%NumCtrl2SC = SrcInitInputData%C_obj%NumCtrl2SC + END SUBROUTINE SC_DX_CopyInitInput + + SUBROUTINE SC_DX_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(SC_DX_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE SC_DX_DestroyInitInput + + SUBROUTINE SC_DX_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DX_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob + Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumCtrl2SC + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE SC_DX_PackInitInput + + SUBROUTINE SC_DX_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DX_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2Ctrl = OutData%NumSC2Ctrl + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2CtrlGlob = OutData%NumSC2CtrlGlob + OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumCtrl2SC = OutData%NumCtrl2SC + END SUBROUTINE SC_DX_UnPackInitInput + + SUBROUTINE SC_DX_C2Fary_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitInputData%NumSC2Ctrl = InitInputData%C_obj%NumSC2Ctrl + InitInputData%NumSC2CtrlGlob = InitInputData%C_obj%NumSC2CtrlGlob + InitInputData%NumCtrl2SC = InitInputData%C_obj%NumCtrl2SC + END SUBROUTINE SC_DX_C2Fary_CopyInitInput + + SUBROUTINE SC_DX_F2C_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitInputData%C_obj%NumSC2Ctrl = InitInputData%NumSC2Ctrl + InitInputData%C_obj%NumSC2CtrlGlob = InitInputData%NumSC2CtrlGlob + InitInputData%C_obj%NumCtrl2SC = InitInputData%NumCtrl2SC + END SUBROUTINE SC_DX_F2C_CopyInitInput + + SUBROUTINE SC_DX_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DX_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(SC_DX_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE SC_DX_CopyInitOutput + + SUBROUTINE SC_DX_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(SC_DX_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) + END SUBROUTINE SC_DX_DestroyInitOutput + + SUBROUTINE SC_DX_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DX_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE SC_DX_PackInitOutput + + SUBROUTINE SC_DX_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DX_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE SC_DX_UnPackInitOutput + + SUBROUTINE SC_DX_C2Fary_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + END SUBROUTINE SC_DX_C2Fary_CopyInitOutput + + SUBROUTINE SC_DX_F2C_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + END SUBROUTINE SC_DX_F2C_CopyInitOutput + + SUBROUTINE SC_DX_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DX_ParameterType), INTENT(IN) :: SrcParamData + TYPE(SC_DX_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%useSC = SrcParamData%useSC + DstParamData%C_obj%useSC = SrcParamData%C_obj%useSC + END SUBROUTINE SC_DX_CopyParam + + SUBROUTINE SC_DX_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(SC_DX_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE SC_DX_DestroyParam + + SUBROUTINE SC_DX_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DX_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! useSC + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = TRANSFER(InData%useSC, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE SC_DX_PackParam + + SUBROUTINE SC_DX_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DX_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%useSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%useSC) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%useSC = OutData%useSC + END SUBROUTINE SC_DX_UnPackParam + + SUBROUTINE SC_DX_C2Fary_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ParamData%useSC = ParamData%C_obj%useSC + END SUBROUTINE SC_DX_C2Fary_CopyParam + + SUBROUTINE SC_DX_F2C_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ParamData%C_obj%useSC = ParamData%useSC + END SUBROUTINE SC_DX_F2C_CopyParam + + SUBROUTINE SC_DX_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DX_InputType), INTENT(IN) :: SrcInputData + TYPE(SC_DX_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(SrcInputData%toSC)) THEN + i1_l = LBOUND(SrcInputData%toSC,1) + i1_u = UBOUND(SrcInputData%toSC,1) + IF (.NOT. ASSOCIATED(DstInputData%toSC)) THEN + ALLOCATE(DstInputData%toSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%toSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstInputData%c_obj%toSC_Len = SIZE(DstInputData%toSC) + IF (DstInputData%c_obj%toSC_Len > 0) & + DstInputData%c_obj%toSC = C_LOC( DstInputData%toSC(i1_l) ) + END IF + DstInputData%toSC = SrcInputData%toSC +ENDIF + END SUBROUTINE SC_DX_CopyInput + + SUBROUTINE SC_DX_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(SC_DX_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(InputData%toSC)) THEN + DEALLOCATE(InputData%toSC) + InputData%toSC => NULL() + InputData%C_obj%toSC = C_NULL_PTR + InputData%C_obj%toSC_Len = 0 +ENDIF + END SUBROUTINE SC_DX_DestroyInput + + SUBROUTINE SC_DX_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DX_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no + IF ( ASSOCIATED(InData%toSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ASSOCIATED(InData%toSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%toSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%toSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%toSC,1), UBOUND(InData%toSC,1) + ReKiBuf(Re_Xferred) = InData%toSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_DX_PackInput + + SUBROUTINE SC_DX_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DX_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%toSC)) DEALLOCATE(OutData%toSC) + ALLOCATE(OutData%toSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%toSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%toSC_Len = SIZE(OutData%toSC) + IF (OutData%c_obj%toSC_Len > 0) & + OutData%c_obj%toSC = C_LOC( OutData%toSC(i1_l) ) + DO i1 = LBOUND(OutData%toSC,1), UBOUND(OutData%toSC,1) + OutData%toSC(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_DX_UnPackInput + + SUBROUTINE SC_DX_C2Fary_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- toSC Input Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( InputData%C_obj%toSC ) ) THEN + NULLIFY( InputData%toSC ) + ELSE + CALL C_F_POINTER(InputData%C_obj%toSC, InputData%toSC, (/InputData%C_obj%toSC_Len/)) + END IF + END IF + END SUBROUTINE SC_DX_C2Fary_CopyInput + + SUBROUTINE SC_DX_F2C_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- toSC Input Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(InputData%toSC)) THEN + InputData%c_obj%toSC_Len = 0 + InputData%c_obj%toSC = C_NULL_PTR + ELSE + InputData%c_obj%toSC_Len = SIZE(InputData%toSC) + IF (InputData%c_obj%toSC_Len > 0) & + InputData%c_obj%toSC = C_LOC( InputData%toSC( LBOUND(InputData%toSC,1) ) ) + END IF + END IF + END SUBROUTINE SC_DX_F2C_CopyInput + + SUBROUTINE SC_DX_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DX_OutputType), INTENT(IN) :: SrcOutputData + TYPE(SC_DX_OutputType), INTENT(INOUT) :: DstOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_CopyOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(SrcOutputData%fromSC)) THEN + i1_l = LBOUND(SrcOutputData%fromSC,1) + i1_u = UBOUND(SrcOutputData%fromSC,1) + IF (.NOT. ASSOCIATED(DstOutputData%fromSC)) THEN + ALLOCATE(DstOutputData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstOutputData%c_obj%fromSC_Len = SIZE(DstOutputData%fromSC) + IF (DstOutputData%c_obj%fromSC_Len > 0) & + DstOutputData%c_obj%fromSC = C_LOC( DstOutputData%fromSC(i1_l) ) + END IF + DstOutputData%fromSC = SrcOutputData%fromSC +ENDIF +IF (ASSOCIATED(SrcOutputData%fromSCglob)) THEN + i1_l = LBOUND(SrcOutputData%fromSCglob,1) + i1_u = UBOUND(SrcOutputData%fromSCglob,1) + IF (.NOT. ASSOCIATED(DstOutputData%fromSCglob)) THEN + ALLOCATE(DstOutputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstOutputData%c_obj%fromSCglob_Len = SIZE(DstOutputData%fromSCglob) + IF (DstOutputData%c_obj%fromSCglob_Len > 0) & + DstOutputData%c_obj%fromSCglob = C_LOC( DstOutputData%fromSCglob(i1_l) ) + END IF + DstOutputData%fromSCglob = SrcOutputData%fromSCglob +ENDIF + END SUBROUTINE SC_DX_CopyOutput + + SUBROUTINE SC_DX_DestroyOutput( OutputData, ErrStat, ErrMsg ) + TYPE(SC_DX_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_DestroyOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(OutputData%fromSC)) THEN + DEALLOCATE(OutputData%fromSC) + OutputData%fromSC => NULL() + OutputData%C_obj%fromSC = C_NULL_PTR + OutputData%C_obj%fromSC_Len = 0 +ENDIF +IF (ASSOCIATED(OutputData%fromSCglob)) THEN + DEALLOCATE(OutputData%fromSCglob) + OutputData%fromSCglob => NULL() + OutputData%C_obj%fromSCglob = C_NULL_PTR + OutputData%C_obj%fromSCglob_Len = 0 +ENDIF + END SUBROUTINE SC_DX_DestroyOutput + + SUBROUTINE SC_DX_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DX_OutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_PackOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ASSOCIATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF + Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no + IF ( ASSOCIATED(InData%fromSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ASSOCIATED(InData%fromSC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ASSOCIATED(InData%fromSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) + ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_DX_PackOutput + + SUBROUTINE SC_DX_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DX_OutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_UnPackOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%fromSC_Len = SIZE(OutData%fromSC) + IF (OutData%c_obj%fromSC_Len > 0) & + OutData%c_obj%fromSC = C_LOC( OutData%fromSC(i1_l) ) + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) + ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%fromSCglob_Len = SIZE(OutData%fromSCglob) + IF (OutData%c_obj%fromSCglob_Len > 0) & + OutData%c_obj%fromSCglob = C_LOC( OutData%fromSCglob(i1_l) ) + DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) + OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_DX_UnPackOutput + + SUBROUTINE SC_DX_C2Fary_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- fromSC Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( OutputData%C_obj%fromSC ) ) THEN + NULLIFY( OutputData%fromSC ) + ELSE + CALL C_F_POINTER(OutputData%C_obj%fromSC, OutputData%fromSC, (/OutputData%C_obj%fromSC_Len/)) + END IF + END IF + + ! -- fromSCglob Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( OutputData%C_obj%fromSCglob ) ) THEN + NULLIFY( OutputData%fromSCglob ) + ELSE + CALL C_F_POINTER(OutputData%C_obj%fromSCglob, OutputData%fromSCglob, (/OutputData%C_obj%fromSCglob_Len/)) + END IF + END IF + END SUBROUTINE SC_DX_C2Fary_CopyOutput + + SUBROUTINE SC_DX_F2C_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DX_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- fromSC Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(OutputData%fromSC)) THEN + OutputData%c_obj%fromSC_Len = 0 + OutputData%c_obj%fromSC = C_NULL_PTR + ELSE + OutputData%c_obj%fromSC_Len = SIZE(OutputData%fromSC) + IF (OutputData%c_obj%fromSC_Len > 0) & + OutputData%c_obj%fromSC = C_LOC( OutputData%fromSC( LBOUND(OutputData%fromSC,1) ) ) + END IF + END IF + + ! -- fromSCglob Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(OutputData%fromSCglob)) THEN + OutputData%c_obj%fromSCglob_Len = 0 + OutputData%c_obj%fromSCglob = C_NULL_PTR + ELSE + OutputData%c_obj%fromSCglob_Len = SIZE(OutputData%fromSCglob) + IF (OutputData%c_obj%fromSCglob_Len > 0) & + OutputData%c_obj%fromSCglob = C_LOC( OutputData%fromSCglob( LBOUND(OutputData%fromSCglob,1) ) ) + END IF + END IF + END SUBROUTINE SC_DX_F2C_CopyOutput + +END MODULE SCDataEx_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/supercontroller/src/SCDataEx_Types.h b/modules/supercontroller/src/SCDataEx_Types.h new file mode 100644 index 0000000000..8be949b34c --- /dev/null +++ b/modules/supercontroller/src/SCDataEx_Types.h @@ -0,0 +1,57 @@ +//!STARTOFREGISTRYGENERATEDFILE 'SCDataEx_Types.h' +//! +//! WARNING This file is generated automatically by the FAST registry. +//! Do not edit. Your changes to this file will be lost. +//! + +#ifndef _SCDataEx_TYPES_H +#define _SCDataEx_TYPES_H + + +#ifdef _WIN32 //define something for Windows (32-bit) +# include "stdbool.h" +# define CALL __declspec( dllexport ) +#elif _WIN64 //define something for Windows (64-bit) +# include "stdbool.h" +# define CALL __declspec( dllexport ) +#else +# include +# define CALL +#endif + + + typedef struct SC_DX_InitInputType { + void * object ; + int NumSC2Ctrl ; + int NumSC2CtrlGlob ; + int NumCtrl2SC ; + } SC_DX_InitInputType_t ; + typedef struct SC_DX_InitOutputType { + void * object ; + + } SC_DX_InitOutputType_t ; + typedef struct SC_DX_ParameterType { + void * object ; + bool useSC ; + } SC_DX_ParameterType_t ; + typedef struct SC_DX_InputType { + void * object ; + float * toSC ; int toSC_Len ; + } SC_DX_InputType_t ; + typedef struct SC_DX_OutputType { + void * object ; + float * fromSC ; int fromSC_Len ; + float * fromSCglob ; int fromSCglob_Len ; + } SC_DX_OutputType_t ; + typedef struct SC_DX_UserData { + SC_DX_InitInputType_t SC_DX_InitInput ; + SC_DX_InitOutputType_t SC_DX_InitOutput ; + SC_DX_ParameterType_t SC_DX_Param ; + SC_DX_InputType_t SC_DX_Input ; + SC_DX_OutputType_t SC_DX_Output ; + } SC_DX_t ; + +#endif // _SCDataEx_TYPES_H + + +//!ENDOFREGISTRYGENERATEDFILE diff --git a/modules/supercontroller/src/SC_DLL.F90 b/modules/supercontroller/src/SC_DLL.F90 new file mode 100644 index 0000000000..7d138a3762 --- /dev/null +++ b/modules/supercontroller/src/SC_DLL.F90 @@ -0,0 +1,323 @@ + +!subroutine sc_init_obfuscator() +! +! CALL RANDOM_SEED ( SIZE = 1 ) +! CALL RANDOM_SEED ( PUT=3459872 ) +! +!end subroutine sc_init_obfuscator + + + +!======================================================================= +!SUBROUTINE sc_init ( ) BIND (C, NAME='sc_init') +!subroutine sc_init ( nTurbines, nInpGlobal, NumCtrl2SC, NumParamGlobal, ParamGlobal, NumParamTurbine, & +! ParamTurbine, NumStatesGlobal, NumStatesTurbine, NumSC2CtrlGlob, & +! NumSC2Ctrl, errStat, errMsg ) bind (C, NAME='sc_init') +subroutine sc_init ( nTurbines, nInpGlobal, NumCtrl2SC, NumParamGlobal, NumParamTurbine, & + NumStatesGlobal, NumStatesTurbine, NumSC2CtrlGlob, & + NumSC2Ctrl, errStat, errMsg ) bind (C, NAME='sc_init') +!subroutine sc_init ( t, nTurbines, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & +! nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, NumSC2CtrlGlob, from_SCglob, & +! NumSC2Ctrl, from_SC, errStat, errMsg ) bind (C, NAME='sc_calcOutputs') + + + ! This DLL super controller is used to implement a ... + + ! Modified by B. Jonkman to conform to ISO C Bindings (standard Fortran 2003) and + ! compile with either gfortran or Intel Visual Fortran (IVF) + ! DO NOT REMOVE or MODIFY LINES starting with "!DEC$" or "!GCC$" + ! !DEC$ specifies attributes for IVF and !GCC$ specifies attributes for gfortran + ! + ! Note that gfortran v5.x on Mac produces compiler errors with the DLLEXPORT attribute, + ! so I've added the compiler directive IMPLICIT_DLLEXPORT. + + use, intrinsic :: ISO_C_Binding + + implicit none +#ifndef IMPLICIT_DLLEXPORT +!DEC$ ATTRIBUTES DLLEXPORT :: sc_init +!GCC$ ATTRIBUTES DLLEXPORT :: sc_init +#endif + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent( out) :: nInpGlobal !< number of global inputs to supercontroller + integer(C_INT), intent( out) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + integer(C_INT), intent( out) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent( out) :: NumParamTurbine !< number of parameters per turbine + integer(C_INT), intent( out) :: NumStatesGlobal !< number of global states + integer(C_INT), intent( out) :: NumStatesTurbine !< number of states per turbine + integer(C_INT), intent( out) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + integer(C_INT), intent( out) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + integer(C_INT), intent( out) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + + !errMsg = TRANSFER( TRIM(avcMSG)//C_NULL_CHAR, avcMSG, SIZE(avcMSG) ) + errStat = 0 + !errMsg = '' + + nInpGlobal = 0 + NumCtrl2SC = 2 + NumParamGlobal = 5 + NumParamTurbine = 4 + NumStatesGlobal = 1 + NumStatesTurbine = 2 + NumSC2CtrlGlob = 2 + NumSC2Ctrl = 3 + + + return + + end subroutine sc_init +subroutine sc_getInitData(nTurbines, NumParamGlobal, NumParamTurbine, ParamGlobal, ParamTurbine, & + NumSC2CtrlGlob, from_SCglob, NumSC2Ctrl, from_SC,& + & nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine,& + & errStat, errMsg ) bind (C, NAME='sc_getInitData') +use, intrinsic :: ISO_C_Binding + + implicit none +#ifndef IMPLICIT_DLLEXPORT +!DEC$ ATTRIBUTES DLLEXPORT :: sc_getInitData +!GCC$ ATTRIBUTES DLLEXPORT :: sc_getInitData +#endif + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(inout) :: ParamGlobal (*) !< global parameters + real(C_FLOAT), intent(inout) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n=0 (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n=0 (total of nTurbines*nStatesTurbine of these states) + + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + integer :: i,j + real(C_FLOAT), allocatable :: mask1(:) + integer :: seedVal(1), nSeeds + + ! Add a data obfuscator for your proprietary Parameter data + + + + !nSeeds = 1 + !seedVal(1) = 3459872 + !call random_seed ( size = nSeeds ) + !call random_seed ( put = seedVal ) + !allocate(mask1(NumParamGlobal), stat = errStat) + !call random_number( mask1 ) + do i = 1, NumParamGlobal + ParamGlobal(i) = real(0.6,C_FLOAT) !real(i*mask1(i),C_FLOAT) + end do + + do j = 1, nTurbines + do i = 1, NumParamTurbine + ParamTurbine((j-1)*NumParamTurbine+i) = real((j-1)*NumParamTurbine+i,C_FLOAT) + end do + end do + + do i = 1, NumSC2CtrlGlob + from_SCglob(i) = real(i,C_FLOAT) !real(i*mask1(i),C_FLOAT) + end do + + do j = 1, nTurbines + do i = 1, NumSC2Ctrl + from_SC((j-1)*NumSC2Ctrl+i) = real((j-1)*NumSC2Ctrl+i,C_FLOAT) + end do + end do + + end subroutine sc_getInitData +!======================================================================= +!SUBROUTINE sc_calcOutputs ( ) BIND (C, NAME='sc_calcOutputs') +subroutine sc_calcOutputs ( t, nTurbines, nParamGlobal, paramGlobal, nParamTurbine, paramTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, NumSC2CtrlGlob, from_SCglob, & + NumSC2Ctrl, from_SC, errStat, errMsg ) bind (C, NAME='sc_calcOutputs') + + + ! This DLL super controller is used to implement a ... + + ! Modified by B. Jonkman to conform to ISO C Bindings (standard Fortran 2003) and + ! compile with either gfortran or Intel Visual Fortran (IVF) + ! DO NOT REMOVE or MODIFY LINES starting with "!DEC$" or "!GCC$" + ! !DEC$ specifies attributes for IVF and !GCC$ specifies attributes for gfortran + ! + ! Note that gfortran v5.x on Mac produces compiler errors with the DLLEXPORT attribute, + ! so I've added the compiler directive IMPLICIT_DLLEXPORT. + + use, intrinsic :: ISO_C_Binding + + implicit none +#ifndef IMPLICIT_DLLEXPORT +!DEC$ ATTRIBUTES DLLEXPORT :: sc_calcOutputs +!GCC$ ATTRIBUTES DLLEXPORT :: sc_calcOutputs +#endif + + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: nParamGlobal !< number of global parameters for the supercontroller + real(C_FLOAT), intent(in ) :: paramGlobal (*) !< global parameters for the supercontroller + integer(C_INT), intent(in ) :: nParamTurbine !< number of turbine-based parameters for supercontroller + real(C_FLOAT), intent(in ) :: paramTurbine (*) !< turbine-based parameters for the supercontroller + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(in ) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(in ) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + integer :: i, j, c + + ! For this demo control we have: + ! nInpGlobal = 0 + ! NumCtrl2SC = 2 + ! NumParamGlobal = 5 + ! NumParamTurbine = 4 + ! NumStatesGlobal = 1 + ! NumStatesTurbine = 2 + ! NumSC2CtrlGlob = 2 + ! NumSC2Ctrl = 3 + + !c = 1 + do j = 1, nTurbines + do i = 1, NumSC2Ctrl + from_SC((j-1)*NumSC2Ctrl+i) = (j-1)*NumSC2Ctrl+i! StatesTurbine(c) + StatesTurbine(c+2) + !from_SC((i-1)*NumSC2Ctrl+2) = StatesTurbine(c+1) + StatesTurbine(c+2) + !c = c+3 + end do + end do + + do i = 1, NumSC2CtrlGlob + from_SCglob(i) = StatesGlob(1) + end do + + !errMsg = TRANSFER( TRIM(avcMSG)//C_NULL_CHAR, avcMSG, SIZE(avcMSG) ) + return +end subroutine sc_calcOutputs + +!======================================================================= +!SUBROUTINE sc_updateStates ( ) BIND (C, NAME='sc_updateStates') +subroutine sc_updateStates ( t, nTurbines, nParamGlobal, paramGlobal, nParamTurbine, paramTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, errStat, errMsg ) bind (C, NAME='sc_updateStates') + + + ! This DLL super controller is used to implement a ... + + ! Modified by B. Jonkman to conform to ISO C Bindings (standard Fortran 2003) and + ! compile with either gfortran or Intel Visual Fortran (IVF) + ! DO NOT REMOVE or MODIFY LINES starting with "!DEC$" or "!GCC$" + ! !DEC$ specifies attributes for IVF and !GCC$ specifies attributes for gfortran + ! + ! Note that gfortran v5.x on Mac produces compiler errors with the DLLEXPORT attribute, + ! so I've added the compiler directive IMPLICIT_DLLEXPORT. + + use, intrinsic :: ISO_C_Binding + + implicit none +#ifndef IMPLICIT_DLLEXPORT +!DEC$ ATTRIBUTES DLLEXPORT :: sc_updateStates +!GCC$ ATTRIBUTES DLLEXPORT :: sc_updateStates +#endif + + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: nParamGlobal !< number of global parameters for the supercontroller + real(C_FLOAT), intent(in ) :: paramGlobal (*) !< global parameters for the supercontroller + integer(C_INT), intent(in ) :: nParamTurbine !< number of turbine-based parameters for supercontroller + real(C_FLOAT), intent(in ) :: paramTurbine (*) !< turbine-based parameters for the supercontroller + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + integer :: i + real(C_FLOAT) :: sum + ! Turbine-based inputs (one per turbine): to_SC + ! 0 - Time + ! 1 - GenTorque + ! + ! Meaning of scOutputs + ! 0 - Minimum Blade pitch + + ! Update the turbine-related states + + ! For this demo control we have: + ! nInpGlobal = 0 + ! NumCtrl2SC = 2 + ! NumParamGlobal = 5 + ! NumParamTurbine = 4 + ! NumStatesGlobal = 1 + ! NumStatesTurbine = 2 + ! NumSC2CtrlGlob = 2 + ! NumSC2Ctrl = 3 + sum = 0.0 + do i = 1, nTurbines*nStatesTurbine + StatesTurbine(i) = i !paramGlobal(1)*to_SC(i)*paramTurbine(2*i-1) / paramTurbine(2*i) + (1-paramGlobal(1)*StatesTurbine(i)) + sum = sum + StatesTurbine(i) + end do + + do i = 1,nStatesGlobal + StatesGlob(i) = paramGlobal(2)*sum + end do + + !double d2R = M_PI/180.0; + ! Copy inputs into states first + !for(int iTurb=0; iTurb < nTurbines; iTurb++) { + ! for(int i=0; i < nScInputsTurbine; i++) { + ! turbineStates_np1[iTurb][i] = sc_inputsTurbine[iTurb][i]; + ! } + !} + ! + !turbineStates_np1[0][nScInputsTurbine] = sc_inputsTurbine[0][0]/60.0 * 0.2 * d2R ; + !turbineStates_np1[1][nScInputsTurbine] = sc_inputsTurbine[1][0]/60.0 * 0.45 * d2R ; + !errMsg = TRANSFER( TRIM(avcMSG)//C_NULL_CHAR, avcMSG, SIZE(avcMSG) ) + + return +end subroutine sc_updateStates + +subroutine sc_end ( errStat, errMsg ) bind (C, NAME='sc_end') + + + ! This DLL super controller is used to implement a ... + + ! Modified by B. Jonkman to conform to ISO C Bindings (standard Fortran 2003) and + ! compile with either gfortran or Intel Visual Fortran (IVF) + ! DO NOT REMOVE or MODIFY LINES starting with "!DEC$" or "!GCC$" + ! !DEC$ specifies attributes for IVF and !GCC$ specifies attributes for gfortran + ! + ! Note that gfortran v5.x on Mac produces compiler errors with the DLLEXPORT attribute, + ! so I've added the compiler directive IMPLICIT_DLLEXPORT. + + use, intrinsic :: ISO_C_Binding + + implicit none +#ifndef IMPLICIT_DLLEXPORT +!DEC$ ATTRIBUTES DLLEXPORT :: sc_end +!GCC$ ATTRIBUTES DLLEXPORT :: sc_end +#endif + + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + + + + return +end subroutine sc_end + + + + + diff --git a/modules/supercontroller/src/SC_DataEx.f90 b/modules/supercontroller/src/SC_DataEx.f90 new file mode 100644 index 0000000000..f0a7ab05e6 --- /dev/null +++ b/modules/supercontroller/src/SC_DataEx.f90 @@ -0,0 +1,192 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2015 National Renewable Energy Laboratory +! +! SuperController DataExchange, a submodule of openfast +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +! File last committed: $Date: $ +! (File) Revision #: $Rev: $ +! URL: $HeadURL: $ +!********************************************************************************************************************************** +MODULE SC_DataEx + +! This is a pseudo module used to couple FAST v8 with SuperController; it is considered part of the FAST glue code + USE FAST_Types + USE SCDataEx_Types + + IMPLICIT NONE + + PRIVATE + + TYPE(ProgDesc), PARAMETER :: SC_DX_Ver = ProgDesc( 'SuperController DataExchange', '', '' ) + + +! ===================================================================================================" + + + ! ..... Public Subroutines ................................................................................................... + + PUBLIC :: SC_DX_Init ! Initialization routine + PUBLIC :: SC_DX_SetInputs ! Glue-code routine to update inputs for SuperController + PUBLIC :: SC_DX_SetOutputs ! Glue-code routine to update inputs to turbine controller from SuperController + + +CONTAINS +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE SC_DX_Init( NumSC2CtrlGlob, NumSC2Ctrl, NumCtrl2SC, SC_DX, ErrStat, ErrMsg ) +!.................................................................................................................................. + INTEGER(IntKi), INTENT(IN ) :: NumSC2CtrlGlob + INTEGER(IntKi), INTENT(IN ) :: NumSC2Ctrl + INTEGER(IntKi), INTENT(IN ) :: NumCtrl2SC + TYPE(SCDataEx_Data), INTENT(INOUT) :: SC_DX ! data for the SuperController integration module + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + ! local variables + INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation + CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_Init' + + ! Initialize variables + + ErrStat = ErrID_None + ErrMsg = "" + + IF (NumCtrl2SC > 0) THEN + CALL AllocPAry( SC_DX%u%toSC, NumCtrl2SC, 'u%toSC', ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + END IF + + IF (ErrStat >= AbortErrLev) RETURN + + ! make sure the C versions are synced with these arrays + if (NumCtrl2SC > 0) then + SC_DX%u%c_obj%toSC_Len = NumCtrl2SC + SC_DX%u%c_obj%toSC = C_LOC( SC_DX%u%toSC(1) ) + else + SC_DX%u%c_obj%toSC_Len = 0 + SC_DX%u%c_obj%toSC = C_NULL_PTR + end if + + + !............................................................................................ + ! Define system output initializations (set up mesh) here: + !............................................................................................ + if (NumSC2CtrlGlob > 0) then + CALL AllocPAry( SC_DX%y%fromSCglob, NumSC2CtrlGlob, 'y%fromSCglob', ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + end if + + IF (ErrStat >= AbortErrLev) RETURN + + ! make sure the C versions are synced with these arrays + if (NumSC2CtrlGlob > 0) then + SC_DX%y%c_obj%fromSCglob_Len = NumSC2CtrlGlob + SC_DX%y%c_obj%fromSCglob = C_LOC( SC_DX%y%fromSCglob(1) ) + else + SC_DX%y%c_obj%fromSCglob_Len = 0 + SC_DX%y%c_obj%fromSCglob = C_NULL_PTR + end if + + if (NumSC2Ctrl > 0) then + CALL AllocPAry( SC_DX%y%fromSC, NumSC2Ctrl, 'y%fromSC', ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + end if + + IF (ErrStat >= AbortErrLev) RETURN + + ! make sure the C versions are synced with these arrays + if (NumSC2Ctrl > 0) then + SC_DX%y%c_obj%fromSC_Len = NumSC2Ctrl + SC_DX%y%c_obj%fromSC = C_LOC( SC_DX%y%fromSC(1) ) + else + SC_DX%y%c_obj%fromSC_Len = 0 + SC_DX%y%c_obj%fromSC = C_NULL_PTR + end if + + if( (NumSC2CtrlGlob > 0) .or. (NumSC2Ctrl > 0) .or. (NumSC2Ctrl > 0)) then + SC_DX%p%UseSC = .true. + else + SC_DX%p%UseSC = .false. + end if + + RETURN + +END SUBROUTINE SC_DX_Init + +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE SC_DX_SetInputs(p_FAST, y_SrvD, SC_DX, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST ! Parameters for the glue code + TYPE(SrvD_OutputType), INTENT(IN) :: y_SrvD ! The outputs of the ServoDyn module (control) + TYPE(SCDataEx_Data), INTENT(INOUT) :: SC_DX ! data for the SuperController integration module + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + ! local variables + INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation + CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_SetInputs' + + + ErrStat = ErrID_None + ErrMsg = "" + + ! set SuperController inputs + if (SC_DX%p%UseSC) then + if (allocated(y_SrvD%toSC).and. associated(SC_DX%u%toSC)) SC_DX%u%toSC = y_SrvD%toSC + end if + + +END SUBROUTINE SC_DX_SetInputs +!---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE SC_DX_SetOutputs(p_FAST, u_SrvD, SC_DX, ErrStat, ErrMsg ) +!.................................................................................................................................. + + TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST ! Parameters for the glue code + TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD ! The inputs of the ServoDyn module (control) + TYPE(SCDataEx_Data), INTENT(IN ) :: SC_DX ! data for the SuperController integration module + INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None + + ! local variables + INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation + CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DX_SetOutputs' + + + ErrStat = ErrID_None + ErrMsg = "" + + ! set SuperController inputs + if (SC_DX%p%UseSC) then + if (allocated(u_SrvD%fromSC) .and. associated(SC_DX%y%fromSC)) u_SrvD%fromSC = SC_DX%y%fromSC + if (allocated(u_SrvD%fromSCglob).and. associated(SC_DX%y%fromSCglob)) u_SrvD%fromSCglob = SC_DX%y%fromSCglob + end if + + +END SUBROUTINE SC_DX_SetOutputs +!---------------------------------------------------------------------------------------------------------------------------------- +END MODULE SC_DataEx +!********************************************************************************************************************************** + + + + diff --git a/modules/supercontroller/src/SC_DataEx_Registry.txt b/modules/supercontroller/src/SC_DataEx_Registry.txt new file mode 100644 index 0000000000..d4b49aa314 --- /dev/null +++ b/modules/supercontroller/src/SC_DataEx_Registry.txt @@ -0,0 +1,36 @@ +################################################################################################################################### +# Registry for SuperController DataExchange types in the FAST Modularization Framework +# Entries are of the form +# +# +# Use ^ as a shortcut for the value in the same column from the previous line. +################################################################################################################################### +# File last committed $Date$ +# (File) Revision #: $Rev$ +# URL: $HeadURL$ +################################################################################################################################### +# ...... Include files (definitions from NWTC Library) ............................................................................ +include Registry_NWTC_Library.txt + + + +# ..... SC_DX_InitInputType data ....................................................................................................... +typedef SCDataEx/SC_DX InitInputType IntKi NumSC2Ctrl - - - "number of turbine specific controller inputs [from supercontroller]" - +typedef ^ ^ IntKi NumSC2CtrlGlob - - - "number of global controller inputs [from supercontroller]" - +typedef ^ ^ IntKi NumCtrl2SC - - - "number of controller outputs [to supercontroller]" - + +# ..... SuperController_InitOutputType data ....................................................................................................... +# Define outputs from the initialization routine here: +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - + +# ..... MiscVars ................................................................................................................ + +# ..... Parameters ................................................................................................................ +typedef SCDataEx/SC_DX ParameterType Logical useSC - .FALSE. - "Flag that tells this module if supercontroller is on." - + +# ..... SC_DX_InputType data ....................................................................................................... +typedef SCDataEx/SC_DX InputType ReKi toSC {:} - - "inputs to the super controller (from the turbine controller)" - + +# ..... SC_DX_OutputType data ....................................................................................................... +typedef SCDataEx/SC_DX OutputType ReKi fromSC {:} - - "global outputs of the super controller (to the turbine controller)" - +typedef SCDataEx/SC_DX OutputType ReKi fromSCglob {:} - - "turbine specific outputs of the super controller (to the turbine controller)" - diff --git a/modules/supercontroller/src/SuperController.f90 b/modules/supercontroller/src/SuperController.f90 index decde0e905..52f427b3af 100644 --- a/modules/supercontroller/src/SuperController.f90 +++ b/modules/supercontroller/src/SuperController.f90 @@ -1,166 +1,551 @@ !********************************************************************************************************************************** -! LICENSING -! Copyright (C) 2015 National Renewable Energy Laboratory -! -! Lidar module, a submodule of InflowWind -! -! Licensed under the Apache License, Version 2.0 (the "License"); -! you may not use this file except in compliance with the License. -! You may obtain a copy of the License at -! -! http://www.apache.org/licenses/LICENSE-2.0 -! -! Unless required by applicable law or agreed to in writing, software -! distributed under the License is distributed on an "AS IS" BASIS, -! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -! See the License for the specific language governing permissions and -! limitations under the License. -! +!> ## SC +!! The SuperController module implements a super controller for the FAST.Farm code. +!! SuperController_Types will be auto-generated by the FAST registry program, based on the variables specified in the +!! SuperController_Registry.txt file. +!! +! .................................................................................................................................. +!! ## LICENSING +!! Copyright (C) 2017 National Renewable Energy Laboratory +!! +!! This file is part of FAST_Farm. +!! +!! Licensed under the Apache License, Version 2.0 (the "License"); +!! you may not use this file except in compliance with the License. +!! You may obtain a copy of the License at +!! +!! http://www.apache.org/licenses/LICENSE-2.0 +!! +!! Unless required by applicable law or agreed to in writing, software +!! distributed under the License is distributed on an "AS IS" BASIS, +!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +!! See the License for the specific language governing permissions and +!! limitations under the License. !********************************************************************************************************************************** -MODULE SuperController +module SuperController -! This is a pseudo module used to couple FAST v8 with SuperController; it is considered part of the FAST glue code - USE FAST_Types + use SuperController_Types + use NWTC_Library - IMPLICIT NONE + implicit none + private - PRIVATE + type(ProgDesc), parameter :: SC_Ver = ProgDesc( 'Super Controller', '', '' ) - TYPE(ProgDesc), PARAMETER :: SC_Ver = ProgDesc( 'SuperController Integration', '', '' ) + !> Definition of the DLL Interface for the SuperController + !! + abstract interface + subroutine SC_DLL_Init_PROC ( nTurbines, nInpGlobal, NumCtrl2SC, NumParamGlobal, NumParamTurbine, NumStatesGlobal, NumStatesTurbine, NumSC2CtrlGlob, NumSC2Ctrl, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent( out) :: nInpGlobal !< number of global inputs to supercontroller + integer(C_INT), intent( out) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + integer(C_INT), intent( out) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent( out) :: NumParamTurbine !< number of parameters per turbine + integer(C_INT), intent( out) :: NumStatesGlobal !< number of global states + integer(C_INT), intent( out) :: NumStatesTurbine !< number of states per turbine + integer(C_INT), intent( out) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + integer(C_INT), intent( out) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + integer(C_INT), intent( out) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_Init_PROC + end interface - -! ===================================================================================================" +#ifdef STATIC_DLL_LOAD + interface + subroutine SC_DLL_Init ( nTurbines, nInpGlobal, NumCtrl2SC, NumParamGlobal, NumParamTurbine, NumStatesGlobal, NumStatesTurbine, NumSC2CtrlGlob, NumSC2Ctrl, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent( out) :: nInpGlobal !< number of global inputs to supercontroller + integer(C_INT), intent( out) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + integer(C_INT), intent( out) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent( out) :: NumParamTurbine !< number of parameters per turbine + integer(C_INT), intent( out) :: NumStatesGlobal !< number of global states + integer(C_INT), intent( out) :: NumStatesTurbine !< number of states per turbine + integer(C_INT), intent( out) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + integer(C_INT), intent( out) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + integer(C_INT), intent( out) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_Init + end interface +#endif - - ! ..... Public Subroutines ................................................................................................... - - PUBLIC :: Init_SC ! Initialization routine - PUBLIC :: SC_SetInputs ! Glue-code routine to update inputs for SuperController - PUBLIC :: SC_SetOutputs ! Glue-code routine to update inputs to turbine controller from SuperController - - -CONTAINS -!---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE Init_SC( InitInp, SC, ErrStat, ErrMsg ) -!.................................................................................................................................. + abstract interface + subroutine SC_DLL_GetInitData_PROC (nTurbines, NumParamGlobal, NumParamTurbine, ParamGlobal, ParamTurbine, NumSC2CtrlGlob, from_SCglob, NumSC2Ctrl, from_SC, nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(inout) :: ParamGlobal (*) !< global parameters + real(C_FLOAT), intent(inout) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_GetInitData_PROC + end interface - TYPE(SC_InitInputType), INTENT(IN ) :: InitInp ! Input data for initialization routine - TYPE(SuperController_Data), INTENT(INOUT) :: SC ! data for the SuperController integration module - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - - ! local variables - INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation - CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None - - CHARACTER(*), PARAMETER :: RoutineName = 'Init_SC' - - ! Initialize variables - - ErrStat = ErrID_None - ErrMsg = "" - - IF (InitInp%NumCtrl2SC > 0) THEN - CALL AllocPAry( SC%u%toSC, InitInp%NumCtrl2SC, 'u%toSC', ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - END IF - - IF (ErrStat >= AbortErrLev) RETURN - - ! make sure the C versions are synced with these arrays - if (InitInp%NumCtrl2SC > 0) then - SC%u%c_obj%toSC_Len = InitInp%NumCtrl2SC - SC%u%c_obj%toSC = C_LOC( SC%u%toSC(1) ) - SC%u%toSC = 0.0_ReKi - end if - - ! initialize the arrays: - ! - - !............................................................................................ - ! Define system output initializations (set up mesh) here: - !............................................................................................ - if (InitInp%NumSC2Ctrl > 0) then - CALL AllocPAry( SC%y%fromSC, InitInp%NumSC2Ctrl, 'y%fromSC', ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - end if - - IF (ErrStat >= AbortErrLev) RETURN - - ! make sure the C versions are synced with these arrays - if (InitInp%NumSC2Ctrl > 0) then - SC%y%c_obj%fromSC_Len = InitInp%NumSC2Ctrl - SC%y%c_obj%fromSC = C_LOC( SC%y%fromSC(1) ) - end if - - - if( (InitInp%NumSC2Ctrl > 0) .and. (InitInp%NumSC2Ctrl > 0)) then - SC%p%scOn = .true. - else - SC%p%scOn = .false. - end if - - RETURN - -END SUBROUTINE Init_SC -!---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE SC_SetInputs(p_FAST, y_SrvD, SC, ErrStat, ErrMsg ) -!.................................................................................................................................. +#ifdef STATIC_DLL_LOAD + interface + subroutine SC_DLL_GetInitData ( nTurbines, NumParamGlobal, NumParamTurbine, ParamGlobal, ParamTurbine, NumSC2CtrlGlob, from_SCglob, NumSC2Ctrl, from_SC, nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(inout) :: ParamGlobal (*) !< global parameters + real(C_FLOAT), intent(inout) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_GetInitData + end interface +#endif + + + abstract interface + subroutine SC_DLL_CalcOutput_PROC ( t, nTurbines, NumParamGlobal, ParamGlobal, NumParamTurbine, ParamTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, NumSC2CtrlGlob, from_SCglob, & + NumSC2Ctrl, from_SC, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + real(C_FLOAT), intent(in ) :: ParamGlobal (*) !< global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(in ) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(in ) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(in ) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_CalcOutput_PROC + end interface + +#ifdef STATIC_DLL_LOAD + interface + subroutine SC_DLL_CalcOutput ( t, nTurbines, NumParamGlobal, ParamGlobal, NumParamTurbine, ParamTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, NumSC2CtrlGlob, from_SCglob, & + NumSC2Ctrl, from_SC, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + real(C_FLOAT), intent(in ) :: ParamGlobal (*) !< global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(in ) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(in ) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(in ) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(in ) :: NumSC2CtrlGlob !< number of global controller inputs [from supercontroller] + real(C_FLOAT), intent(inout) :: from_SCglob (*) !< global outputs of the super controller (to the turbine controller) + integer(C_INT), intent(in ) :: NumSC2Ctrl !< number of turbine specific controller inputs [output from supercontroller] + real(C_FLOAT), intent(inout) :: from_SC (*) !< turbine specific outputs of the super controller (to the turbine controller) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_CalcOutput + end interface +#endif + +abstract interface + subroutine SC_DLL_UpdateStates_PROC ( t, nTurbines, NumParamGlobal, ParamGlobal, NumParamTurbine, ParamTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + real(C_FLOAT), intent(in ) :: ParamGlobal (*) !< global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(in ) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_UpdateStates_PROC + end interface + +#ifdef STATIC_DLL_LOAD + interface + subroutine SC_DLL_UpdateStates ( t, nTurbines, NumParamGlobal, ParamGlobal, NumParamTurbine, ParamTurbine, nInpGlobal, to_SCglob, NumCtrl2SC, to_SC, & + nStatesGlobal, StatesGlob, nStatesTurbine, StatesTurbine, errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + real(C_DOUBLE), INTENT(IN ) :: t !< time (s) + integer(C_INT), intent(in ) :: nTurbines !< number of turbines connected to this supercontroller + integer(C_INT), intent(in ) :: NumParamGlobal !< number of global parameters + real(C_FLOAT), intent(in ) :: ParamGlobal (*) !< global parameters + integer(C_INT), intent(in ) :: NumParamTurbine !< number of parameters per turbine + real(C_FLOAT), intent(in ) :: ParamTurbine (*) !< turbine-based parameters + integer(C_INT), intent(in ) :: nInpGlobal !< number of global inputs to supercontroller + real(C_FLOAT), intent(in ) :: to_SCglob (*) !< global inputs to the supercontroller + integer(C_INT), intent(in ) :: NumCtrl2SC !< number of turbine controller outputs [inputs to supercontroller] + real(C_FLOAT), intent(in ) :: to_SC (*) !< inputs to the super controller (from the turbine controller) + integer(C_INT), intent(in ) :: nStatesGlobal !< number of global states + real(C_FLOAT), intent(inout) :: StatesGlob (*) !< global states at time increment, n (total of nStatesGlobal of these states) + integer(C_INT), intent(in ) :: nStatesTurbine !< number of states per turbine + real(C_FLOAT), intent(inout) :: StatesTurbine(*) !< turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_UpdateStates + end interface +#endif + + abstract interface + subroutine SC_DLL_End_PROC ( errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_End_PROC + end interface + +#ifdef STATIC_DLL_LOAD + interface + subroutine SC_DLL_End ( errStat, errMsg ) BIND(C) + use, intrinsic :: ISO_C_Binding + integer(C_INT), intent(inout) :: errStat !< error status code (uses NWTC_Library error codes) + character(kind=C_CHAR), intent(inout) :: errMsg (*) !< Error Message from DLL to simulation code + end subroutine SC_DLL_End + end interface +#endif + public :: SC_Init ! Initialization routine + public :: SC_End ! Ending routine (includes clean up) + public :: SC_UpdateStates ! Loose coupling routine for solving for constraint states, integrating + ! continuous states, and updating discrete states + public :: SC_CalcOutput ! Routine for computing outputs + !public :: SC_CalcContStateDeriv ! Tight coupling routine for computing derivatives of continuous states + + + contains + + SUBROUTINE SC_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) + + TYPE(SC_InputType), INTENT(INOUT) :: u !< System inputs + TYPE(SC_ParameterType), INTENT(INOUT) :: p !< Parameters + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: x !< Continuous states + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: xd !< Discrete states + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: z !< Constraint states + TYPE(SC_OtherStateType), INTENT(INOUT) :: OtherState !< Other states + TYPE(SC_OutputType), INTENT(INOUT) :: y !< System outputs + TYPE(SC_MiscVarType), INTENT(INOUT) :: m !< Initial misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + + ! local variables + character(*), parameter :: routineName = 'SC_End' + integer(IntKi) :: errStat2 ! The error status code + character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred + procedure(SC_DLL_End_PROC), pointer :: DLL_SC_Subroutine ! The address of the supercontroller sc_end procedure in the DLL + + errStat = ErrID_None + errMsg= '' + +#ifdef STATIC_DLL_LOAD + + ! if we're statically loading the library (i.e., OpenFOAM), we can just call DISCON(); + ! I'll leave some options for whether the supercontroller is being used + + call SC_DLL_End ( errStat, errMsg ) + +#else + + ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): + call C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(5), DLL_SC_Subroutine) + call DLL_SC_Subroutine ( errStat, errMsg ) + +#endif + + + call FreeDynamicLib( p%DLL_Trgt, errStat2, errMsg2 ) ! this doesn't do anything #ifdef STATIC_DLL_LOAD because p%DLL_Trgt is 0 (NULL) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, routineName ) + + end subroutine SC_End + + subroutine SC_Init(InitInp, u, p, x, xd, z, OtherState, y, m, interval, InitOut, errStat, errMsg ) + type(SC_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(SC_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined + type(SC_ParameterType), intent( out) :: p !< Parameters + type(SC_ContinuousStateType), intent( out) :: x !< Initial continuous states + type(SC_DiscreteStateType), intent( out) :: xd !< Initial discrete states + type(SC_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states + type(SC_OtherStateType), intent( out) :: OtherState !< Initial other states + type(SC_OutputType), intent( out) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(SC_MiscVarType), intent( out) :: m !< Misc variables for optimization (not copied in glue code) + real(DbKi), intent(in ) :: interval !< Coupling interval in seconds + type(SC_InitOutputType), intent( out) :: InitOut !< Output for initialization routine + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(1024), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None + + + ! local variables + character(*), parameter :: routineName = 'SC_Init' + integer(IntKi) :: errStat2 ! The error status code + character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred + procedure(SC_DLL_Init_PROC),pointer :: DLL_SC_Init_Subroutine ! The address of the supercontroller sc_init procedure in the DLL + procedure(SC_DLL_GetInitData_PROC),pointer :: DLL_SC_GetInitData_Subroutine + + integer(IntKi) :: nParams + + + errStat2 = ErrID_None + errMsg2 = '' + + call DispNVD( SC_Ver ) ! Display the version of this interface + + ! p%UseSC = InitInp%UseSC + ! if ( p%UseSC ) then + + ! The Glue code needs to tell the super controller how many turbines are in the plant/farm. + p%nTurbines = InitInp%nTurbines + + + + ! The following parameters are determined by the super controller implementation, which is done inside the shared + ! library, so first load the library. +#ifdef STATIC_DLL_LOAD + ! because OpenFOAM needs the MPI task to copy the library, we're not going to dynamically load it; it needs to be loaded at runtime. + p%DLL_Trgt%FileName = '' + p%DLL_Trgt%ProcName = '' +#else + + ! Define and load the DLL: + + p%DLL_Trgt%FileName = InitInp%DLL_FileName + + p%DLL_Trgt%ProcName = "" ! initialize all procedures to empty so we try to load only one + p%DLL_Trgt%ProcName(1) = 'sc_init' + p%DLL_Trgt%ProcName(2) = 'sc_getInitData' + p%DLL_Trgt%ProcName(3) = 'sc_updateStates' + p%DLL_Trgt%ProcName(4) = 'sc_calcOutputs' + p%DLL_Trgt%ProcName(5) = 'sc_end' - TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST ! Parameters for the glue code - TYPE(SrvD_OutputType), INTENT(IN) :: y_SrvD ! The outputs of the ServoDyn module (control) - TYPE(SuperController_Data), INTENT(INOUT) :: SC ! data for the SuperController integration module - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - - ! local variables - INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation - CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None - - CHARACTER(*), PARAMETER :: RoutineName = 'SC_SetInputs' - - - ErrStat = ErrID_None - ErrMsg = "" - - ! set SuperController inputs - if (p_FAST%CompServo == Module_SrvD) then - if (allocated(y_SrvD%SuperController).and. associated(SC%u%toSC)) SC%u%toSC = y_SrvD%SuperController - end if - + call LoadDynamicLib ( p%DLL_Trgt, errStat2, errMsg2 ) + call SetErrStat( errStat2, errMsg2, errStat, errMsg, routineName ) + if (errStat > AbortErrLev ) return +#endif + + ! Now that the library is loaded, call SC_Init() to obtain the user-specified inputs/output/states + + p%nInpGlobal = 0 + p%NumParamGlobal = 0 + p%NumParamTurbine = 0 + p%NumSC2CtrlGlob = 0 + p%NumSC2Ctrl = 0 + p%NumCtrl2SC = 0 + p%NumStatesGlobal = 0 + p%NumStatesTurbine = 0 + +#ifdef STATIC_DLL_LOAD + + ! if we're statically loading the library (i.e., OpenFOAM), we can just call SC_INIT(); + call SC_DLL_INIT( p%nTurbines, p%nInpGlobal, p%NumCtrl2SC, p%NumParamGlobal, p%NumParamTurbine, p%NumStatesGlobal, p%NumStatesTurbine, p%NumSC2CtrlGlob, p%NumSC2Ctrl, errStat, errMsg ) + ! TODO: Check errors +#else + + ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): + call C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(1), DLL_SC_Init_Subroutine) + !call DLL_SC_Subroutine ( p%nTurbines, p%nInpGlobal, p%NumCtrl2SC, p%NumParamGlobal, ParamGlobal, p%NumParamTurbine, ParamTurbine, p%NumStatesGlobal, p%NumStatesTurbine, p%NumSC2CtrlGlob, p%NumSC2Ctrl, errStat, errMsg ) + call DLL_SC_Init_Subroutine ( p%nTurbines, p%nInpGlobal, p%NumCtrl2SC, p%NumParamGlobal, p%NumParamTurbine, p%NumStatesGlobal, p%NumStatesTurbine, p%NumSC2CtrlGlob, p%NumSC2Ctrl, errStat, errMsg ) + ! TODO: Check errors + +#endif + + ! NOTE: For now we have not implemented the global super controller inputs in any of the openfast glue codes, + ! so the number must be set to zero + if (p%nInpGlobal /= 0) call SetErrStat( ErrID_Fatal, "nInpGlobal must to be equal to zero." , errStat, errMsg, RoutineName ) + if (p%NumSC2CtrlGlob < 0) call SetErrStat( ErrID_Fatal, "NumSC2CtrlGlob must to be greater than or equal to zero." , errStat, errMsg, RoutineName ) + if (p%NumSC2Ctrl < 0) call SetErrStat( ErrID_Fatal, "NumSC2Ctrl must to be greater than or equal to zero." , errStat, errMsg, RoutineName ) + if (p%NumCtrl2SC < 0) call SetErrStat( ErrID_Fatal, "NumCtrl2SC must to be greater than or equal to zero." , errStat, errMsg, RoutineName ) + if (p%NumStatesGlobal < 0) call SetErrStat( ErrID_Fatal, "NumStatesGlobal must to be greater than or equal to zero." , errStat, errMsg, RoutineName ) + if (p%NumStatesTurbine < 0) call SetErrStat( ErrID_Fatal, "NumStatesTurbine must to be greater than or equal to zero." , errStat, errMsg, RoutineName ) + + if (errStat > AbortErrLev ) return + + ! allocate state arrays + ! TODO Fix allocations for error handling + allocate(xd%Global(p%NumStatesGlobal)) + !CALL AllocAry( xd%Global, p%nStatesGlobal, 'xd%Global', errStat2, errMsg2 ) + ! call SetErrStat( errStat2, errMsg2, errStat, errMsg, routineName ) + allocate(xd%Turbine(p%NumStatesTurbine*p%nTurbines) ) + ! CALL AllocAry( xd%Turbine, p%nStatesTurbine, 'xd%Turbine', errStat2, errMsg2 ) + ! call SetErrStat( errStat2, errMsg2, errStat, errMsg, routineName ) -END SUBROUTINE SC_SetInputs + ! allocate output arrays + allocate(y%fromSCglob(p%NumSC2CtrlGlob)) + allocate(y%fromSC (p%NumSC2Ctrl*p%nTurbines )) + + ! allocate input arrays + allocate(u%toSCglob(p%nInpGlobal)) + allocate(u%toSC (p%NumCtrl2SC*p%nTurbines)) + + ! Copy the Parameter and Output data created by the SuperController library into the FAST-framework parameters data structure + if ( (p%NumParamGlobal > 0) .or. (p%NumParamTurbine > 0) .or. (p%NumSC2CtrlGlob > 0) .or. (p%NumSC2Ctrl > 0) ) then + allocate(p%ParamGlobal(p%NumParamGlobal)) + nParams = p%NumParamTurbine*p%nTurbines + allocate(p%ParamTurbine(nParams)) + +#ifdef STATIC_DLL_LOAD + + ! if we're statically loading the library (i.e., OpenFOAM), we can just call SC_INIT(); + call SC_DLL_GetInitData( p%nTurbines, p%NumParamGlobal, p%NumParamTurbine, p%ParamGlobal, p%ParamTurbine, p%NumSC2CtrlGlob, y%fromSCglob, p%NumSC2Ctrl, y%fromSC, & + p%NumStatesGlobal, xd%Global, p%NumStatesTurbine, xd%Turbine, errStat, errMsg ) + ! TODO: Check errors +#else + + ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): + call C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(2), DLL_SC_GetInitData_Subroutine) + !call DLL_SC_Subroutine ( p%nTurbines, p%nInpGlobal, p%NumCtrl2SC, p%NumParamGlobal, ParamGlobal, p%NumParamTurbine, ParamTurbine, p%NumStatesGlobal, p%NumStatesTurbine, p%NumSC2CtrlGlob, p%NumSC2Ctrl, errStat, errMsg ) + call DLL_SC_GetInitData_Subroutine ( p%nTurbines, p%NumParamGlobal, p%NumParamTurbine, p%ParamGlobal, p%ParamTurbine, p%NumSC2CtrlGlob, y%fromSCglob, p%NumSC2Ctrl, y%fromSC, & + p%NumStatesGlobal, xd%Global, p%NumStatesTurbine, xd%Turbine, errStat, errMsg ) + ! TODO: Check errors + +#endif + + end if !IDEALLY THROW AN ERROR AND QUIT HERE IF THIS CRITERIA IS NOT MET + + p%DT = interval + + + ! Set the initialization output data for the glue code so that it knows + ! how many inputs/outputs there are + InitOut%nInpGlobal = p%nInpGlobal + InitOut%NumSC2CtrlGlob = p%NumSC2CtrlGlob + InitOut%NumSC2Ctrl = p%NumSC2Ctrl + InitOut%NumCtrl2SC = p%NumCtrl2SC + ! + + end subroutine SC_Init + + subroutine SC_CalcOutput(t, u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + type(SC_InputType), intent(in ) :: u !< Inputs at Time t + type(SC_ParameterType), intent(in ) :: p !< Parameters + type(SC_ContinuousStateType), intent(in ) :: x !< Continuous states at t + type(SC_DiscreteStateType), intent(in ) :: xd !< Discrete states at t + type(SC_ConstraintStateType), intent(in ) :: z !< Constraint states at t + type(SC_OtherStateType), intent(in ) :: OtherState !< Other states + type(SC_OutputType), intent(inout) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(SC_MiscVarType), intent(inout) :: m !< Misc variables for optimization (not copied in glue code) + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if ErrStat /= ErrID_None + + + character(*), parameter :: routineName = 'SC_CalcOutput' + integer(IntKi) :: errStat2 ! The error status code + character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred + procedure(SC_DLL_CalcOutput_PROC),pointer :: DLL_SC_Subroutine ! The address of the supercontroller sc_calcoutputs procedure in the DLL + + + errStat2 = ErrID_None + errMsg2 = '' + + +#ifdef STATIC_DLL_LOAD + + ! if we're statically loading the library (i.e., OpenFOAM), we can just call DISCON(); + ! I'll leave some options for whether the supercontroller is being used + + call SC_DLL_CalcOutput ( REAL(t,C_DOUBLE), p%nTurbines, p%NumParamGlobal, p%ParamGlobal, p%NumParamTurbine, p%ParamTurbine, p%nInpGlobal, u%toSCglob, p%NumCtrl2SC, u%toSC, & + p%nStatesGlobal, xd%Global, p%nStatesTurbine, xd%Turbine, p%NumSC2CtrlGlob, y%fromSCglob, & + p%NumSC2Ctrl, y%fromSC, errStat, errMsg ) + +#else + + ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): + call C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(4), DLL_SC_Subroutine) + call DLL_SC_Subroutine ( REAL(t,C_DOUBLE), p%nTurbines, p%NumParamGlobal, p%ParamGlobal, p%NumParamTurbine, p%ParamTurbine, p%nInpGlobal, u%toSCglob, p%NumCtrl2SC, u%toSC, & + p%NumStatesGlobal, xd%Global, p%NumStatesTurbine, xd%Turbine, p%NumSC2CtrlGlob, y%fromSCglob, & + p%NumSC2Ctrl, y%fromSC, errStat, errMsg ) + +#endif + + end subroutine SC_CalcOutput + !---------------------------------------------------------------------------------------------------------------------------------- -SUBROUTINE SC_SetOutputs(p_FAST, u_SrvD, SC, ErrStat, ErrMsg ) +!> This is a loose coupling routine for solving constraint states, integrating continuous states, and updating discrete and other +!! states. Continuous, constraint, discrete, and other states are updated to values at t + Interval. + subroutine SC_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg ) !.................................................................................................................................. - TYPE(FAST_ParameterType), INTENT(IN ) :: p_FAST ! Parameters for the glue code - TYPE(SrvD_InputType), INTENT(INOUT) :: u_SrvD ! The inputs of the ServoDyn module (control) - TYPE(SuperController_Data), INTENT(IN) :: SC ! data for the SuperController integration module - INTEGER(IntKi), INTENT( OUT) :: ErrStat ! Error status of the operation - CHARACTER(*), INTENT( OUT) :: ErrMsg ! Error message if ErrStat /= ErrID_None - - ! local variables - INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation - CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None - - CHARACTER(*), PARAMETER :: RoutineName = 'SC_SetOutputs' - - - ErrStat = ErrID_None - ErrMsg = "" - - ! set SuperController inputs - if (p_FAST%CompServo == Module_SrvD) then - if (allocated(u_SrvD%SuperController).and. associated(SC%y%fromSC)) u_SrvD%SuperController = SC%y%fromSC - end if - - -END SUBROUTINE SC_SetOutputs -!---------------------------------------------------------------------------------------------------------------------------------- -END MODULE SuperController -!********************************************************************************************************************************** + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + integer(IntKi), intent(in ) :: n !< Current simulation time step n = 0,1,... + type(SC_InputType), intent(inout) :: u !< Inputs at utimes (out only for mesh record-keeping in ExtrapInterp routine) + real(DbKi), intent(in ) :: utimes(:) !< Times associated with u(:), in seconds + type(SC_ParameterType), intent(in ) :: p !< Parameters + type(SC_ContinuousStateType), intent(inout) :: x !< Input: Continuous states at t; + !! Output: Continuous states at t + Interval + type(SC_DiscreteStateType), intent(inout) :: xd !< Input: Discrete states at t; + !! Output: Discrete states at t + Interval + type(SC_ConstraintStateType), intent(inout) :: z !< Input: Constraint states at t; + !! Output: Constraint states at t + Interval + type(SC_OtherStateType), intent(inout) :: OtherState !< Other states: Other states at t; + !! Output: Other states at t + Interval + type(SC_MiscVarType), intent(inout) :: m !< Misc variables for optimization (not copied in glue code) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables + character(*), parameter :: routineName = 'SC_UpdateStates' + integer(IntKi) :: errStat2 ! The error status code + character(ErrMsgLen) :: errMsg2 ! The error message, if an error occurred + + procedure(SC_DLL_UpdateStates_PROC),pointer :: DLL_SC_Subroutine ! The address of the supercontroller sc_updatestates procedure in the DLL + + errStat2 = ErrID_None + errMsg2 = '' + +#ifdef STATIC_DLL_LOAD + + ! if we're statically loading the library (i.e., OpenFOAM), we can just call DISCON(); + ! I'll leave some options for whether the supercontroller is being used + + !CALL DISCON( dll_data%avrSWAP, filt_fromSCglob, filt_fromSC, dll_data%toSC, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) + call SC_DLL_UpdateStates ( REAL(t,C_DOUBLE), p%nTurbines, p%NumParamGlobal, p%ParamGlobal, p%NumParamTurbine, p%ParamTurbine, p%nInpGlobal, u%toSCglob, p%NumCtrl2SC, u%toSC, & + p%NumStatesGlobal, xd%Global, p%NumStatesTurbine, xd%Turbine, errStat, errMsg ) + +#else + + ! Call the DLL (first associate the address from the procedure in the DLL with the subroutine): + call C_F_PROCPOINTER( p%DLL_Trgt%ProcAddr(3), DLL_SC_Subroutine) + call DLL_SC_Subroutine ( REAL(t,C_DOUBLE), p%nTurbines, p%NumParamGlobal, p%ParamGlobal, p%NumParamTurbine, p%ParamTurbine, p%nInpGlobal, u%toSCglob, p%NumCtrl2SC, u%toSC, & + p%NumStatesGlobal, xd%Global, p%NumStatesTurbine, xd%Turbine, errStat, errMsg ) +#endif + end subroutine SC_UpdateStates +end module SuperController diff --git a/modules/supercontroller/src/SuperController_Registry.txt b/modules/supercontroller/src/SuperController_Registry.txt index 1c7f86f70b..b2ef55a8ab 100644 --- a/modules/supercontroller/src/SuperController_Registry.txt +++ b/modules/supercontroller/src/SuperController_Registry.txt @@ -1,30 +1,54 @@ ################################################################################################################################### -# Registry for SuperController interface types in the FAST Modularization Framework +# Registry for SuperController in the FAST Modularization Framework +# This Registry file is used to create MODULE FARM_SC_Types, which contains all of the user-defined types needed in SuperController. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# # Entries are of the form -# +# keyword # -# Use ^ as a shortcut for the value in the same column from the previous line. +# Use ^ as a shortcut for the value from the previous line. +# See NWTC Programmer's Handbook at https://nwtc.nrel.gov/FAST-Developers for further information on the format/contents of this file. ################################################################################################################################### +# # ...... Include files (definitions from NWTC Library) ............................................................................ -include Registry_NWTC_Library.txt - - - -# ..... SuperController_InitInputType data ....................................................................................................... -typedef SuperController/SC InitInputType IntKi NumSC2Ctrl - - - "number of controller inputs [from supercontroller]" - -typedef ^ ^ IntKi NumCtrl2SC - - - "number of controller outputs [to supercontroller]" - - -# ..... SuperController_InitOutputType data ....................................................................................................... -# Define outputs from the initialization routine here: -typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - - -# ..... MiscVars ................................................................................................................ - +include Registry_NWTC_Library.txt +# ..... InitInput ................................................................................................................ +typedef SuperController/SC InitInputType IntKi nTurbines - - - "Number of turbines in the simulation" - +typedef ^ InitInputType CHARACTER(1024) DLL_FileName - - - "Name of the shared library which the super controller logic" - +# ..... InitOutput ................................................................................................................ +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - +typedef ^ InitOutputType IntKi NumCtrl2SC - - - "Number of turbine controller outputs [to supercontroller]" - +typedef ^ InitOutputType IntKi nInpGlobal - - - "Number of global inputs to SC" - +typedef ^ InitOutputType IntKi NumSC2Ctrl - - - "Number of turbine specific controller inputs [from supercontroller]" +typedef ^ InitOutputType IntKi NumSC2CtrlGlob - - - "Number of global controller inputs [from supercontroller]" - # ..... Parameters ................................................................................................................ -typedef SuperController/SC ParameterType Logical scOn - .FALSE. - "Flag that tells this module if supercontroller is on." - - -# ..... SuperController_InputType data ....................................................................................................... -typedef SuperController/SC InputType ReKi toSC {:} - - "inputs to the super controller (from the turbine controller)" - - -# ..... SuperController_OutputType data ....................................................................................................... -typedef SuperController/SC OutputType ReKi fromSC {:} - - "outputs of the super controller (to the turbine controller)" - +typedef ^ ParameterType DbKi DT - - - "Time step for continuous state integration & discrete state update" secondstypedef ^ ParameterType IntKi NumTurbines - - - "Number of turbines in the simulation" - +typedef ^ ParameterType IntKi nTurbines - - - "Number of turbines in the simulation" - +typedef ^ ParameterType IntKi NumCtrl2SC - - - "Number of turbine controller outputs [to supercontroller]" - +typedef ^ ParameterType IntKi nInpGlobal - - - "Number of global inputs" - +typedef ^ ParameterType IntKi NumSC2Ctrl - - - "Number of turbine specific controller inputs [from supercontroller]" - +typedef ^ ParameterType IntKi NumSC2CtrlGlob - - - "Number of global controller inputs [from supercontroller]" - +typedef ^ ParameterType IntKi NumStatesGlobal - - - "Number of global states" - +typedef ^ ParameterType IntKi NumStatesTurbine - - - "Number of states per turbine" - +typedef ^ ParameterType IntKi NumParamGlobal - - - "Number of global parameters" - +typedef ^ ParameterType IntKi NumParamTurbine - - - "Number of parameters per turbine" - +typedef ^ ParameterType SiKi ParamGlobal {:} - - "Global parameters" - +typedef ^ ParameterType SiKi ParamTurbine {:} - - "Parameters per turbine" - +typedef ^ ParameterType DLL_Type DLL_Trgt - - - "The addresses and names of the super controller shared library and its procedures" - +# ..... Discrete (nondifferentiable) States ......................................................................................................... +typedef ^ DiscreteStateType SiKi Global {:} - - "Global states at time increment, n (total of nStatesGlobal of these states)" - +typedef ^ DiscreteStateType SiKi Turbine {:} - - "Turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states)" - +# ..... Continuous States ...................................................................................... +typedef ^ ContinuousStateType SiKi Dummy - - - "Remove this variable if you have continuous states" - +# ..... constraint states here: +typedef ^ ConstraintStateType SiKi Dummy - - - "Remove this variable if you have constraint states" - +# ..... misc vars here: +typedef ^ MiscVarType SiKi Dummy - - - "Remove this variable if you have misc vars" - +# ..... Other States .............................................................................................................. +typedef ^ OtherStateType IntKi Dummy - - - "Dummy Other State" - +# ..... Inputs .................................................................................................................... +typedef ^ InputType SiKi toSCglob {:} - - "Global inputs" - +typedef ^ InputType SiKi toSC {:} - - "inputs to the super controller (from the turbine controller)" - +# ..... Outputs ................................................................................................................... +typedef ^ OutputType SiKi fromSCglob {:} - - "Global outputs of the super controller (to the turbine controller)" - +typedef ^ OutputType SiKi fromSC {:} - - "Turbine specific outputs of the super controller (to the turbine controller)" - \ No newline at end of file diff --git a/modules/supercontroller/src/SuperController_Types.f90 b/modules/supercontroller/src/SuperController_Types.f90 index 0f3078661c..06db9d3cdb 100644 --- a/modules/supercontroller/src/SuperController_Types.f90 +++ b/modules/supercontroller/src/SuperController_Types.f90 @@ -37,54 +37,147 @@ MODULE SuperController_Types ! ========= SC_InitInputType_C ======= TYPE, BIND(C) :: SC_InitInputType_C TYPE(C_PTR) :: object = C_NULL_PTR - INTEGER(KIND=C_INT) :: NumSC2Ctrl - INTEGER(KIND=C_INT) :: NumCtrl2SC + INTEGER(KIND=C_INT) :: nTurbines + CHARACTER(KIND=C_CHAR), DIMENSION(1024) :: DLL_FileName END TYPE SC_InitInputType_C TYPE, PUBLIC :: SC_InitInputType TYPE( SC_InitInputType_C ) :: C_obj - INTEGER(IntKi) :: NumSC2Ctrl !< number of controller inputs [from supercontroller] [-] - INTEGER(IntKi) :: NumCtrl2SC !< number of controller outputs [to supercontroller] [-] + INTEGER(IntKi) :: nTurbines !< Number of turbines in the simulation [-] + CHARACTER(1024) :: DLL_FileName !< Name of the shared library which the super controller logic [-] END TYPE SC_InitInputType ! ======================= ! ========= SC_InitOutputType_C ======= TYPE, BIND(C) :: SC_InitOutputType_C TYPE(C_PTR) :: object = C_NULL_PTR + INTEGER(KIND=C_INT) :: NumCtrl2SC + INTEGER(KIND=C_INT) :: nInpGlobal + INTEGER(KIND=C_INT) :: NumSC2Ctrl + INTEGER(KIND=C_INT) :: NumSC2CtrlGlob END TYPE SC_InitOutputType_C TYPE, PUBLIC :: SC_InitOutputType TYPE( SC_InitOutputType_C ) :: C_obj TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] + INTEGER(IntKi) :: NumCtrl2SC !< Number of turbine controller outputs [to supercontroller] [-] + INTEGER(IntKi) :: nInpGlobal !< Number of global inputs to SC [-] + INTEGER(IntKi) :: NumSC2Ctrl !< Number of turbine specific controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< Number of global controller inputs [from supercontroller] [-] END TYPE SC_InitOutputType ! ======================= ! ========= SC_ParameterType_C ======= TYPE, BIND(C) :: SC_ParameterType_C TYPE(C_PTR) :: object = C_NULL_PTR - LOGICAL(KIND=C_BOOL) :: scOn + REAL(KIND=C_DOUBLE) :: DT + INTEGER(KIND=C_INT) :: nTurbines + INTEGER(KIND=C_INT) :: NumCtrl2SC + INTEGER(KIND=C_INT) :: nInpGlobal + INTEGER(KIND=C_INT) :: NumSC2Ctrl + INTEGER(KIND=C_INT) :: NumSC2CtrlGlob + INTEGER(KIND=C_INT) :: NumStatesGlobal + INTEGER(KIND=C_INT) :: NumStatesTurbine + INTEGER(KIND=C_INT) :: NumParamGlobal + INTEGER(KIND=C_INT) :: NumParamTurbine + TYPE(C_ptr) :: ParamGlobal = C_NULL_PTR + INTEGER(C_int) :: ParamGlobal_Len = 0 + TYPE(C_ptr) :: ParamTurbine = C_NULL_PTR + INTEGER(C_int) :: ParamTurbine_Len = 0 END TYPE SC_ParameterType_C TYPE, PUBLIC :: SC_ParameterType TYPE( SC_ParameterType_C ) :: C_obj - LOGICAL :: scOn = .FALSE. !< Flag that tells this module if supercontroller is on. [-] + REAL(DbKi) :: DT !< Time step for continuous state integration & discrete state update [secondstypedef] + INTEGER(IntKi) :: nTurbines !< Number of turbines in the simulation [-] + INTEGER(IntKi) :: NumCtrl2SC !< Number of turbine controller outputs [to supercontroller] [-] + INTEGER(IntKi) :: nInpGlobal !< Number of global inputs [-] + INTEGER(IntKi) :: NumSC2Ctrl !< Number of turbine specific controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumSC2CtrlGlob !< Number of global controller inputs [from supercontroller] [-] + INTEGER(IntKi) :: NumStatesGlobal !< Number of global states [-] + INTEGER(IntKi) :: NumStatesTurbine !< Number of states per turbine [-] + INTEGER(IntKi) :: NumParamGlobal !< Number of global parameters [-] + INTEGER(IntKi) :: NumParamTurbine !< Number of parameters per turbine [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: ParamGlobal => NULL() !< Global parameters [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: ParamTurbine => NULL() !< Parameters per turbine [-] + TYPE(DLL_Type) :: DLL_Trgt !< The addresses and names of the super controller shared library and its procedures [-] END TYPE SC_ParameterType ! ======================= +! ========= SC_DiscreteStateType_C ======= + TYPE, BIND(C) :: SC_DiscreteStateType_C + TYPE(C_PTR) :: object = C_NULL_PTR + TYPE(C_ptr) :: Global = C_NULL_PTR + INTEGER(C_int) :: Global_Len = 0 + TYPE(C_ptr) :: Turbine = C_NULL_PTR + INTEGER(C_int) :: Turbine_Len = 0 + END TYPE SC_DiscreteStateType_C + TYPE, PUBLIC :: SC_DiscreteStateType + TYPE( SC_DiscreteStateType_C ) :: C_obj + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: Global => NULL() !< Global states at time increment, n (total of nStatesGlobal of these states) [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: Turbine => NULL() !< Turbine-dependent states at time increment, n (total of nTurbines*nStatesTurbine of these states) [-] + END TYPE SC_DiscreteStateType +! ======================= +! ========= SC_ContinuousStateType_C ======= + TYPE, BIND(C) :: SC_ContinuousStateType_C + TYPE(C_PTR) :: object = C_NULL_PTR + REAL(KIND=C_FLOAT) :: Dummy + END TYPE SC_ContinuousStateType_C + TYPE, PUBLIC :: SC_ContinuousStateType + TYPE( SC_ContinuousStateType_C ) :: C_obj + REAL(SiKi) :: Dummy !< Remove this variable if you have continuous states [-] + END TYPE SC_ContinuousStateType +! ======================= +! ========= SC_ConstraintStateType_C ======= + TYPE, BIND(C) :: SC_ConstraintStateType_C + TYPE(C_PTR) :: object = C_NULL_PTR + REAL(KIND=C_FLOAT) :: Dummy + END TYPE SC_ConstraintStateType_C + TYPE, PUBLIC :: SC_ConstraintStateType + TYPE( SC_ConstraintStateType_C ) :: C_obj + REAL(SiKi) :: Dummy !< Remove this variable if you have constraint states [-] + END TYPE SC_ConstraintStateType +! ======================= +! ========= SC_MiscVarType_C ======= + TYPE, BIND(C) :: SC_MiscVarType_C + TYPE(C_PTR) :: object = C_NULL_PTR + REAL(KIND=C_FLOAT) :: Dummy + END TYPE SC_MiscVarType_C + TYPE, PUBLIC :: SC_MiscVarType + TYPE( SC_MiscVarType_C ) :: C_obj + REAL(SiKi) :: Dummy !< Remove this variable if you have misc vars [-] + END TYPE SC_MiscVarType +! ======================= +! ========= SC_OtherStateType_C ======= + TYPE, BIND(C) :: SC_OtherStateType_C + TYPE(C_PTR) :: object = C_NULL_PTR + INTEGER(KIND=C_INT) :: Dummy + END TYPE SC_OtherStateType_C + TYPE, PUBLIC :: SC_OtherStateType + TYPE( SC_OtherStateType_C ) :: C_obj + INTEGER(IntKi) :: Dummy !< Dummy Other State [-] + END TYPE SC_OtherStateType +! ======================= ! ========= SC_InputType_C ======= TYPE, BIND(C) :: SC_InputType_C TYPE(C_PTR) :: object = C_NULL_PTR + TYPE(C_ptr) :: toSCglob = C_NULL_PTR + INTEGER(C_int) :: toSCglob_Len = 0 TYPE(C_ptr) :: toSC = C_NULL_PTR INTEGER(C_int) :: toSC_Len = 0 END TYPE SC_InputType_C TYPE, PUBLIC :: SC_InputType TYPE( SC_InputType_C ) :: C_obj + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: toSCglob => NULL() !< Global inputs [-] REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: toSC => NULL() !< inputs to the super controller (from the turbine controller) [-] END TYPE SC_InputType ! ======================= ! ========= SC_OutputType_C ======= TYPE, BIND(C) :: SC_OutputType_C TYPE(C_PTR) :: object = C_NULL_PTR + TYPE(C_ptr) :: fromSCglob = C_NULL_PTR + INTEGER(C_int) :: fromSCglob_Len = 0 TYPE(C_ptr) :: fromSC = C_NULL_PTR INTEGER(C_int) :: fromSC_Len = 0 END TYPE SC_OutputType_C TYPE, PUBLIC :: SC_OutputType TYPE( SC_OutputType_C ) :: C_obj - REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: fromSC => NULL() !< outputs of the super controller (to the turbine controller) [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: fromSCglob => NULL() !< Global outputs of the super controller (to the turbine controller) [-] + REAL(KIND=C_FLOAT) , DIMENSION(:), POINTER :: fromSC => NULL() !< Turbine specific outputs of the super controller (to the turbine controller) [-] END TYPE SC_OutputType ! ======================= CONTAINS @@ -96,35 +189,1497 @@ SUBROUTINE SC_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrSt CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInitInputData%nTurbines = SrcInitInputData%nTurbines + DstInitInputData%C_obj%nTurbines = SrcInitInputData%C_obj%nTurbines + DstInitInputData%DLL_FileName = SrcInitInputData%DLL_FileName + DstInitInputData%C_obj%DLL_FileName = SrcInitInputData%C_obj%DLL_FileName + END SUBROUTINE SC_CopyInitInput + + SUBROUTINE SC_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE SC_DestroyInitInput + + SUBROUTINE SC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! nTurbines + Int_BufSz = Int_BufSz + 1*LEN(InData%DLL_FileName) ! DLL_FileName + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = InData%nTurbines + Int_Xferred = Int_Xferred + 1 + DO I = 1, LEN(InData%DLL_FileName) + IntKiBuf(Int_Xferred) = ICHAR(InData%DLL_FileName(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END SUBROUTINE SC_PackInitInput + + SUBROUTINE SC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%nTurbines = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%nTurbines = OutData%nTurbines + DO I = 1, LEN(OutData%DLL_FileName) + OutData%DLL_FileName(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + OutData%C_obj%DLL_FileName = TRANSFER(OutData%DLL_FileName, OutData%C_obj%DLL_FileName ) + END SUBROUTINE SC_UnPackInitInput + + SUBROUTINE SC_C2Fary_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitInputData%nTurbines = InitInputData%C_obj%nTurbines + InitInputData%DLL_FileName = TRANSFER(InitInputData%C_obj%DLL_FileName, InitInputData%DLL_FileName ) + END SUBROUTINE SC_C2Fary_CopyInitInput + + SUBROUTINE SC_F2C_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitInputData%C_obj%nTurbines = InitInputData%nTurbines + InitInputData%C_obj%DLL_FileName = TRANSFER(InitInputData%DLL_FileName, InitInputData%C_obj%DLL_FileName ) + END SUBROUTINE SC_F2C_CopyInitInput + + SUBROUTINE SC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(SC_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstInitOutputData%NumCtrl2SC = SrcInitOutputData%NumCtrl2SC + DstInitOutputData%C_obj%NumCtrl2SC = SrcInitOutputData%C_obj%NumCtrl2SC + DstInitOutputData%nInpGlobal = SrcInitOutputData%nInpGlobal + DstInitOutputData%C_obj%nInpGlobal = SrcInitOutputData%C_obj%nInpGlobal + DstInitOutputData%NumSC2Ctrl = SrcInitOutputData%NumSC2Ctrl + DstInitOutputData%C_obj%NumSC2Ctrl = SrcInitOutputData%C_obj%NumSC2Ctrl + DstInitOutputData%NumSC2CtrlGlob = SrcInitOutputData%NumSC2CtrlGlob + DstInitOutputData%C_obj%NumSC2CtrlGlob = SrcInitOutputData%C_obj%NumSC2CtrlGlob + END SUBROUTINE SC_CopyInitOutput + + SUBROUTINE SC_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) + END SUBROUTINE SC_DestroyInitOutput + + SUBROUTINE SC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + Int_BufSz = Int_BufSz + 1 ! nInpGlobal + Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = InData%NumCtrl2SC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nInpGlobal + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE SC_PackInitOutput + + SUBROUTINE SC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumCtrl2SC = OutData%NumCtrl2SC + OutData%nInpGlobal = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%nInpGlobal = OutData%nInpGlobal + OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2Ctrl = OutData%NumSC2Ctrl + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2CtrlGlob = OutData%NumSC2CtrlGlob + END SUBROUTINE SC_UnPackInitOutput + + SUBROUTINE SC_C2Fary_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitOutputData%NumCtrl2SC = InitOutputData%C_obj%NumCtrl2SC + InitOutputData%nInpGlobal = InitOutputData%C_obj%nInpGlobal + InitOutputData%NumSC2Ctrl = InitOutputData%C_obj%NumSC2Ctrl + InitOutputData%NumSC2CtrlGlob = InitOutputData%C_obj%NumSC2CtrlGlob + END SUBROUTINE SC_C2Fary_CopyInitOutput + + SUBROUTINE SC_F2C_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + InitOutputData%C_obj%NumCtrl2SC = InitOutputData%NumCtrl2SC + InitOutputData%C_obj%nInpGlobal = InitOutputData%nInpGlobal + InitOutputData%C_obj%NumSC2Ctrl = InitOutputData%NumSC2Ctrl + InitOutputData%C_obj%NumSC2CtrlGlob = InitOutputData%NumSC2CtrlGlob + END SUBROUTINE SC_F2C_CopyInitOutput + + SUBROUTINE SC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_ParameterType), INTENT(IN) :: SrcParamData + TYPE(SC_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%DT = SrcParamData%DT + DstParamData%C_obj%DT = SrcParamData%C_obj%DT + DstParamData%nTurbines = SrcParamData%nTurbines + DstParamData%C_obj%nTurbines = SrcParamData%C_obj%nTurbines + DstParamData%NumCtrl2SC = SrcParamData%NumCtrl2SC + DstParamData%C_obj%NumCtrl2SC = SrcParamData%C_obj%NumCtrl2SC + DstParamData%nInpGlobal = SrcParamData%nInpGlobal + DstParamData%C_obj%nInpGlobal = SrcParamData%C_obj%nInpGlobal + DstParamData%NumSC2Ctrl = SrcParamData%NumSC2Ctrl + DstParamData%C_obj%NumSC2Ctrl = SrcParamData%C_obj%NumSC2Ctrl + DstParamData%NumSC2CtrlGlob = SrcParamData%NumSC2CtrlGlob + DstParamData%C_obj%NumSC2CtrlGlob = SrcParamData%C_obj%NumSC2CtrlGlob + DstParamData%NumStatesGlobal = SrcParamData%NumStatesGlobal + DstParamData%C_obj%NumStatesGlobal = SrcParamData%C_obj%NumStatesGlobal + DstParamData%NumStatesTurbine = SrcParamData%NumStatesTurbine + DstParamData%C_obj%NumStatesTurbine = SrcParamData%C_obj%NumStatesTurbine + DstParamData%NumParamGlobal = SrcParamData%NumParamGlobal + DstParamData%C_obj%NumParamGlobal = SrcParamData%C_obj%NumParamGlobal + DstParamData%NumParamTurbine = SrcParamData%NumParamTurbine + DstParamData%C_obj%NumParamTurbine = SrcParamData%C_obj%NumParamTurbine +IF (ASSOCIATED(SrcParamData%ParamGlobal)) THEN + i1_l = LBOUND(SrcParamData%ParamGlobal,1) + i1_u = UBOUND(SrcParamData%ParamGlobal,1) + IF (.NOT. ASSOCIATED(DstParamData%ParamGlobal)) THEN + ALLOCATE(DstParamData%ParamGlobal(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%ParamGlobal.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstParamData%c_obj%ParamGlobal_Len = SIZE(DstParamData%ParamGlobal) + IF (DstParamData%c_obj%ParamGlobal_Len > 0) & + DstParamData%c_obj%ParamGlobal = C_LOC( DstParamData%ParamGlobal(i1_l) ) + END IF + DstParamData%ParamGlobal = SrcParamData%ParamGlobal +ENDIF +IF (ASSOCIATED(SrcParamData%ParamTurbine)) THEN + i1_l = LBOUND(SrcParamData%ParamTurbine,1) + i1_u = UBOUND(SrcParamData%ParamTurbine,1) + IF (.NOT. ASSOCIATED(DstParamData%ParamTurbine)) THEN + ALLOCATE(DstParamData%ParamTurbine(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%ParamTurbine.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstParamData%c_obj%ParamTurbine_Len = SIZE(DstParamData%ParamTurbine) + IF (DstParamData%c_obj%ParamTurbine_Len > 0) & + DstParamData%c_obj%ParamTurbine = C_LOC( DstParamData%ParamTurbine(i1_l) ) + END IF + DstParamData%ParamTurbine = SrcParamData%ParamTurbine +ENDIF + DstParamData%DLL_Trgt = SrcParamData%DLL_Trgt + END SUBROUTINE SC_CopyParam + + SUBROUTINE SC_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(ParamData%ParamGlobal)) THEN + DEALLOCATE(ParamData%ParamGlobal) + ParamData%ParamGlobal => NULL() + ParamData%C_obj%ParamGlobal = C_NULL_PTR + ParamData%C_obj%ParamGlobal_Len = 0 +ENDIF +IF (ASSOCIATED(ParamData%ParamTurbine)) THEN + DEALLOCATE(ParamData%ParamTurbine) + ParamData%ParamTurbine => NULL() + ParamData%C_obj%ParamTurbine = C_NULL_PTR + ParamData%C_obj%ParamTurbine_Len = 0 +ENDIF + CALL FreeDynamicLib( ParamData%DLL_Trgt, ErrStat, ErrMsg ) + END SUBROUTINE SC_DestroyParam + + SUBROUTINE SC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! DT + Int_BufSz = Int_BufSz + 1 ! nTurbines + Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + Int_BufSz = Int_BufSz + 1 ! nInpGlobal + Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl + Int_BufSz = Int_BufSz + 1 ! NumSC2CtrlGlob + Int_BufSz = Int_BufSz + 1 ! NumStatesGlobal + Int_BufSz = Int_BufSz + 1 ! NumStatesTurbine + Int_BufSz = Int_BufSz + 1 ! NumParamGlobal + Int_BufSz = Int_BufSz + 1 ! NumParamTurbine + Int_BufSz = Int_BufSz + 1 ! ParamGlobal allocated yes/no + IF ( ASSOCIATED(InData%ParamGlobal) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ParamGlobal upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%ParamGlobal) ! ParamGlobal + END IF + Int_BufSz = Int_BufSz + 1 ! ParamTurbine allocated yes/no + IF ( ASSOCIATED(InData%ParamTurbine) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ParamTurbine upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%ParamTurbine) ! ParamTurbine + END IF + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! DLL_Trgt: size of buffers for each call to pack subtype + CALL DLLTypePack( InData%DLL_Trgt, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! DLL_Trgt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! DLL_Trgt + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! DLL_Trgt + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! DLL_Trgt + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%DT + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nTurbines + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumCtrl2SC + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%nInpGlobal + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumSC2CtrlGlob + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumStatesGlobal + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumStatesTurbine + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumParamGlobal + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumParamTurbine + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ASSOCIATED(InData%ParamGlobal) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ParamGlobal,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ParamGlobal,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ParamGlobal,1), UBOUND(InData%ParamGlobal,1) + ReKiBuf(Re_Xferred) = InData%ParamGlobal(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ASSOCIATED(InData%ParamTurbine) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ParamTurbine,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ParamTurbine,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ParamTurbine,1), UBOUND(InData%ParamTurbine,1) + ReKiBuf(Re_Xferred) = InData%ParamTurbine(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + CALL DLLTypePack( InData%DLL_Trgt, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! DLL_Trgt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE SC_PackParam + + SUBROUTINE SC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DT = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%C_obj%DT = OutData%DT + OutData%nTurbines = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%nTurbines = OutData%nTurbines + OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumCtrl2SC = OutData%NumCtrl2SC + OutData%nInpGlobal = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%nInpGlobal = OutData%nInpGlobal + OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2Ctrl = OutData%NumSC2Ctrl + OutData%NumSC2CtrlGlob = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumSC2CtrlGlob = OutData%NumSC2CtrlGlob + OutData%NumStatesGlobal = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumStatesGlobal = OutData%NumStatesGlobal + OutData%NumStatesTurbine = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumStatesTurbine = OutData%NumStatesTurbine + OutData%NumParamGlobal = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumParamGlobal = OutData%NumParamGlobal + OutData%NumParamTurbine = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_obj%NumParamTurbine = OutData%NumParamTurbine + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ParamGlobal not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%ParamGlobal)) DEALLOCATE(OutData%ParamGlobal) + ALLOCATE(OutData%ParamGlobal(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ParamGlobal.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%ParamGlobal_Len = SIZE(OutData%ParamGlobal) + IF (OutData%c_obj%ParamGlobal_Len > 0) & + OutData%c_obj%ParamGlobal = C_LOC( OutData%ParamGlobal(i1_l) ) + DO i1 = LBOUND(OutData%ParamGlobal,1), UBOUND(OutData%ParamGlobal,1) + OutData%ParamGlobal(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ParamTurbine not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%ParamTurbine)) DEALLOCATE(OutData%ParamTurbine) + ALLOCATE(OutData%ParamTurbine(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ParamTurbine.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%ParamTurbine_Len = SIZE(OutData%ParamTurbine) + IF (OutData%c_obj%ParamTurbine_Len > 0) & + OutData%c_obj%ParamTurbine = C_LOC( OutData%ParamTurbine(i1_l) ) + DO i1 = LBOUND(OutData%ParamTurbine,1), UBOUND(OutData%ParamTurbine,1) + OutData%ParamTurbine(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL DLLTypeUnpack( OutData%DLL_Trgt, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! DLL_Trgt + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE SC_UnPackParam + + SUBROUTINE SC_C2Fary_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ParamData%DT = ParamData%C_obj%DT + ParamData%nTurbines = ParamData%C_obj%nTurbines + ParamData%NumCtrl2SC = ParamData%C_obj%NumCtrl2SC + ParamData%nInpGlobal = ParamData%C_obj%nInpGlobal + ParamData%NumSC2Ctrl = ParamData%C_obj%NumSC2Ctrl + ParamData%NumSC2CtrlGlob = ParamData%C_obj%NumSC2CtrlGlob + ParamData%NumStatesGlobal = ParamData%C_obj%NumStatesGlobal + ParamData%NumStatesTurbine = ParamData%C_obj%NumStatesTurbine + ParamData%NumParamGlobal = ParamData%C_obj%NumParamGlobal + ParamData%NumParamTurbine = ParamData%C_obj%NumParamTurbine + + ! -- ParamGlobal Param Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( ParamData%C_obj%ParamGlobal ) ) THEN + NULLIFY( ParamData%ParamGlobal ) + ELSE + CALL C_F_POINTER(ParamData%C_obj%ParamGlobal, ParamData%ParamGlobal, (/ParamData%C_obj%ParamGlobal_Len/)) + END IF + END IF + + ! -- ParamTurbine Param Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( ParamData%C_obj%ParamTurbine ) ) THEN + NULLIFY( ParamData%ParamTurbine ) + ELSE + CALL C_F_POINTER(ParamData%C_obj%ParamTurbine, ParamData%ParamTurbine, (/ParamData%C_obj%ParamTurbine_Len/)) + END IF + END IF + END SUBROUTINE SC_C2Fary_CopyParam + + SUBROUTINE SC_F2C_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ParamData%C_obj%DT = ParamData%DT + ParamData%C_obj%nTurbines = ParamData%nTurbines + ParamData%C_obj%NumCtrl2SC = ParamData%NumCtrl2SC + ParamData%C_obj%nInpGlobal = ParamData%nInpGlobal + ParamData%C_obj%NumSC2Ctrl = ParamData%NumSC2Ctrl + ParamData%C_obj%NumSC2CtrlGlob = ParamData%NumSC2CtrlGlob + ParamData%C_obj%NumStatesGlobal = ParamData%NumStatesGlobal + ParamData%C_obj%NumStatesTurbine = ParamData%NumStatesTurbine + ParamData%C_obj%NumParamGlobal = ParamData%NumParamGlobal + ParamData%C_obj%NumParamTurbine = ParamData%NumParamTurbine + + ! -- ParamGlobal Param Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(ParamData%ParamGlobal)) THEN + ParamData%c_obj%ParamGlobal_Len = 0 + ParamData%c_obj%ParamGlobal = C_NULL_PTR + ELSE + ParamData%c_obj%ParamGlobal_Len = SIZE(ParamData%ParamGlobal) + IF (ParamData%c_obj%ParamGlobal_Len > 0) & + ParamData%c_obj%ParamGlobal = C_LOC( ParamData%ParamGlobal( LBOUND(ParamData%ParamGlobal,1) ) ) + END IF + END IF + + ! -- ParamTurbine Param Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(ParamData%ParamTurbine)) THEN + ParamData%c_obj%ParamTurbine_Len = 0 + ParamData%c_obj%ParamTurbine = C_NULL_PTR + ELSE + ParamData%c_obj%ParamTurbine_Len = SIZE(ParamData%ParamTurbine) + IF (ParamData%c_obj%ParamTurbine_Len > 0) & + ParamData%c_obj%ParamTurbine = C_LOC( ParamData%ParamTurbine( LBOUND(ParamData%ParamTurbine,1) ) ) + END IF + END IF + END SUBROUTINE SC_F2C_CopyParam + + SUBROUTINE SC_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(SrcDiscStateData%Global)) THEN + i1_l = LBOUND(SrcDiscStateData%Global,1) + i1_u = UBOUND(SrcDiscStateData%Global,1) + IF (.NOT. ASSOCIATED(DstDiscStateData%Global)) THEN + ALLOCATE(DstDiscStateData%Global(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Global.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstDiscStateData%c_obj%Global_Len = SIZE(DstDiscStateData%Global) + IF (DstDiscStateData%c_obj%Global_Len > 0) & + DstDiscStateData%c_obj%Global = C_LOC( DstDiscStateData%Global(i1_l) ) + END IF + DstDiscStateData%Global = SrcDiscStateData%Global +ENDIF +IF (ASSOCIATED(SrcDiscStateData%Turbine)) THEN + i1_l = LBOUND(SrcDiscStateData%Turbine,1) + i1_u = UBOUND(SrcDiscStateData%Turbine,1) + IF (.NOT. ASSOCIATED(DstDiscStateData%Turbine)) THEN + ALLOCATE(DstDiscStateData%Turbine(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Turbine.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstDiscStateData%c_obj%Turbine_Len = SIZE(DstDiscStateData%Turbine) + IF (DstDiscStateData%c_obj%Turbine_Len > 0) & + DstDiscStateData%c_obj%Turbine = C_LOC( DstDiscStateData%Turbine(i1_l) ) + END IF + DstDiscStateData%Turbine = SrcDiscStateData%Turbine +ENDIF + END SUBROUTINE SC_CopyDiscState + + SUBROUTINE SC_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ASSOCIATED(DiscStateData%Global)) THEN + DEALLOCATE(DiscStateData%Global) + DiscStateData%Global => NULL() + DiscStateData%C_obj%Global = C_NULL_PTR + DiscStateData%C_obj%Global_Len = 0 +ENDIF +IF (ASSOCIATED(DiscStateData%Turbine)) THEN + DEALLOCATE(DiscStateData%Turbine) + DiscStateData%Turbine => NULL() + DiscStateData%C_obj%Turbine = C_NULL_PTR + DiscStateData%C_obj%Turbine_Len = 0 +ENDIF + END SUBROUTINE SC_DestroyDiscState + + SUBROUTINE SC_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! Global allocated yes/no + IF ( ASSOCIATED(InData%Global) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Global upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Global) ! Global + END IF + Int_BufSz = Int_BufSz + 1 ! Turbine allocated yes/no + IF ( ASSOCIATED(InData%Turbine) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Turbine upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Turbine) ! Turbine + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ASSOCIATED(InData%Global) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Global,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Global,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Global,1), UBOUND(InData%Global,1) + ReKiBuf(Re_Xferred) = InData%Global(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ASSOCIATED(InData%Turbine) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Turbine,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Turbine,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Turbine,1), UBOUND(InData%Turbine,1) + ReKiBuf(Re_Xferred) = InData%Turbine(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_PackDiscState + + SUBROUTINE SC_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Global not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%Global)) DEALLOCATE(OutData%Global) + ALLOCATE(OutData%Global(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Global.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%Global_Len = SIZE(OutData%Global) + IF (OutData%c_obj%Global_Len > 0) & + OutData%c_obj%Global = C_LOC( OutData%Global(i1_l) ) + DO i1 = LBOUND(OutData%Global,1), UBOUND(OutData%Global,1) + OutData%Global(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Turbine not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%Turbine)) DEALLOCATE(OutData%Turbine) + ALLOCATE(OutData%Turbine(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Turbine.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%Turbine_Len = SIZE(OutData%Turbine) + IF (OutData%c_obj%Turbine_Len > 0) & + OutData%c_obj%Turbine = C_LOC( OutData%Turbine(i1_l) ) + DO i1 = LBOUND(OutData%Turbine,1), UBOUND(OutData%Turbine,1) + OutData%Turbine(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE SC_UnPackDiscState + + SUBROUTINE SC_C2Fary_CopyDiscState( DiscStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- Global DiscState Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( DiscStateData%C_obj%Global ) ) THEN + NULLIFY( DiscStateData%Global ) + ELSE + CALL C_F_POINTER(DiscStateData%C_obj%Global, DiscStateData%Global, (/DiscStateData%C_obj%Global_Len/)) + END IF + END IF + + ! -- Turbine DiscState Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( DiscStateData%C_obj%Turbine ) ) THEN + NULLIFY( DiscStateData%Turbine ) + ELSE + CALL C_F_POINTER(DiscStateData%C_obj%Turbine, DiscStateData%Turbine, (/DiscStateData%C_obj%Turbine_Len/)) + END IF + END IF + END SUBROUTINE SC_C2Fary_CopyDiscState + + SUBROUTINE SC_F2C_CopyDiscState( DiscStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + + ! -- Global DiscState Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(DiscStateData%Global)) THEN + DiscStateData%c_obj%Global_Len = 0 + DiscStateData%c_obj%Global = C_NULL_PTR + ELSE + DiscStateData%c_obj%Global_Len = SIZE(DiscStateData%Global) + IF (DiscStateData%c_obj%Global_Len > 0) & + DiscStateData%c_obj%Global = C_LOC( DiscStateData%Global( LBOUND(DiscStateData%Global,1) ) ) + END IF + END IF + + ! -- Turbine DiscState Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(DiscStateData%Turbine)) THEN + DiscStateData%c_obj%Turbine_Len = 0 + DiscStateData%c_obj%Turbine = C_NULL_PTR + ELSE + DiscStateData%c_obj%Turbine_Len = SIZE(DiscStateData%Turbine) + IF (DiscStateData%c_obj%Turbine_Len > 0) & + DiscStateData%c_obj%Turbine = C_LOC( DiscStateData%Turbine( LBOUND(DiscStateData%Turbine,1) ) ) + END IF + END IF + END SUBROUTINE SC_F2C_CopyDiscState + + SUBROUTINE SC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstContStateData%Dummy = SrcContStateData%Dummy + DstContStateData%C_obj%Dummy = SrcContStateData%C_obj%Dummy + END SUBROUTINE SC_CopyContState + + SUBROUTINE SC_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE SC_DestroyContState + + SUBROUTINE SC_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SC_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! Dummy + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + IF (C_ASSOCIATED(InData%C_obj%object)) CALL SetErrStat(ErrID_Severe,'C_obj%object cannot be packed.',ErrStat,ErrMsg,RoutineName) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%Dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE SC_PackContState + + SUBROUTINE SC_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%Dummy = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + OutData%C_obj%Dummy = OutData%Dummy + END SUBROUTINE SC_UnPackContState + + SUBROUTINE SC_C2Fary_CopyContState( ContStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ContStateData%Dummy = ContStateData%C_obj%Dummy + END SUBROUTINE SC_C2Fary_CopyContState + + SUBROUTINE SC_F2C_CopyContState( ContStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers + ! + LOGICAL :: SkipPointers_local + ErrStat = ErrID_None + ErrMsg = "" + + IF (PRESENT(SkipPointers)) THEN + SkipPointers_local = SkipPointers + ELSE + SkipPointers_local = .false. + END IF + ContStateData%C_obj%Dummy = ContStateData%Dummy + END SUBROUTINE SC_F2C_CopyContState + + SUBROUTINE SC_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyConstrState' ! ErrStat = ErrID_None ErrMsg = "" - DstInitInputData%NumSC2Ctrl = SrcInitInputData%NumSC2Ctrl - DstInitInputData%C_obj%NumSC2Ctrl = SrcInitInputData%C_obj%NumSC2Ctrl - DstInitInputData%NumCtrl2SC = SrcInitInputData%NumCtrl2SC - DstInitInputData%C_obj%NumCtrl2SC = SrcInitInputData%C_obj%NumCtrl2SC - END SUBROUTINE SC_CopyInitInput + DstConstrStateData%Dummy = SrcConstrStateData%Dummy + DstConstrStateData%C_obj%Dummy = SrcConstrStateData%C_obj%Dummy + END SUBROUTINE SC_CopyConstrState - SUBROUTINE SC_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) - TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + SUBROUTINE SC_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: ConstrStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyConstrState' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - END SUBROUTINE SC_DestroyInitInput + END SUBROUTINE SC_DestroyConstrState - SUBROUTINE SC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE SC_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SC_InitInputType), INTENT(IN) :: InData + TYPE(SC_ConstraintStateType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -139,7 +1694,7 @@ SUBROUTINE SC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackConstrState' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -155,8 +1710,7 @@ SUBROUTINE SC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! NumSC2Ctrl - Int_BufSz = Int_BufSz + 1 ! NumCtrl2SC + Re_BufSz = Re_BufSz + 1 ! Dummy IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -186,17 +1740,15 @@ SUBROUTINE SC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = InData%NumSC2Ctrl - Int_Xferred = Int_Xferred + 1 - IntKiBuf(Int_Xferred) = InData%NumCtrl2SC - Int_Xferred = Int_Xferred + 1 - END SUBROUTINE SC_PackInitInput + ReKiBuf(Re_Xferred) = InData%Dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE SC_PackConstrState - SUBROUTINE SC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE SC_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SC_InitInputType), INTENT(INOUT) :: OutData + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -205,10 +1757,9 @@ SUBROUTINE SC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackInitInput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackConstrState' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -219,16 +1770,13 @@ SUBROUTINE SC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Err Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%NumSC2Ctrl = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%C_obj%NumSC2Ctrl = OutData%NumSC2Ctrl - OutData%NumCtrl2SC = IntKiBuf(Int_Xferred) - Int_Xferred = Int_Xferred + 1 - OutData%C_obj%NumCtrl2SC = OutData%NumCtrl2SC - END SUBROUTINE SC_UnPackInitInput + OutData%Dummy = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + OutData%C_obj%Dummy = OutData%Dummy + END SUBROUTINE SC_UnPackConstrState - SUBROUTINE SC_C2Fary_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + SUBROUTINE SC_C2Fary_CopyConstrState( ConstrStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: ConstrStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -242,12 +1790,11 @@ SUBROUTINE SC_C2Fary_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ELSE SkipPointers_local = .false. END IF - InitInputData%NumSC2Ctrl = InitInputData%C_obj%NumSC2Ctrl - InitInputData%NumCtrl2SC = InitInputData%C_obj%NumCtrl2SC - END SUBROUTINE SC_C2Fary_CopyInitInput + ConstrStateData%Dummy = ConstrStateData%C_obj%Dummy + END SUBROUTINE SC_C2Fary_CopyConstrState - SUBROUTINE SC_F2C_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_InitInputType), INTENT(INOUT) :: InitInputData + SUBROUTINE SC_F2C_CopyConstrState( ConstrStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_ConstraintStateType), INTENT(INOUT) :: ConstrStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -261,13 +1808,12 @@ SUBROUTINE SC_F2C_CopyInitInput( InitInputData, ErrStat, ErrMsg, SkipPointers ) ELSE SkipPointers_local = .false. END IF - InitInputData%C_obj%NumSC2Ctrl = InitInputData%NumSC2Ctrl - InitInputData%C_obj%NumCtrl2SC = InitInputData%NumCtrl2SC - END SUBROUTINE SC_F2C_CopyInitInput + ConstrStateData%C_obj%Dummy = ConstrStateData%Dummy + END SUBROUTINE SC_F2C_CopyConstrState - SUBROUTINE SC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SC_InitOutputType), INTENT(IN) :: SrcInitOutputData - TYPE(SC_InitOutputType), INTENT(INOUT) :: DstInitOutputData + SUBROUTINE SC_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(SC_MiscVarType), INTENT(INOUT) :: DstMiscData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -275,32 +1821,30 @@ SUBROUTINE SC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyMisc' ! ErrStat = ErrID_None ErrMsg = "" - CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - END SUBROUTINE SC_CopyInitOutput + DstMiscData%Dummy = SrcMiscData%Dummy + DstMiscData%C_obj%Dummy = SrcMiscData%C_obj%Dummy + END SUBROUTINE SC_CopyMisc - SUBROUTINE SC_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) - TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + SUBROUTINE SC_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(SC_MiscVarType), INTENT(INOUT) :: MiscData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyMisc' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) - END SUBROUTINE SC_DestroyInitOutput + END SUBROUTINE SC_DestroyMisc - SUBROUTINE SC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE SC_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SC_InitOutputType), INTENT(IN) :: InData + TYPE(SC_MiscVarType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -315,7 +1859,7 @@ SUBROUTINE SC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackMisc' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -331,24 +1875,7 @@ SUBROUTINE SC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype - CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! Ver - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! Ver - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! Ver - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF + Re_BufSz = Re_BufSz + 1 ! Dummy IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -378,41 +1905,15 @@ SUBROUTINE SC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Db_Xferred = 1 Int_Xferred = 1 - CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - END SUBROUTINE SC_PackInitOutput + ReKiBuf(Re_Xferred) = InData%Dummy + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE SC_PackMisc - SUBROUTINE SC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE SC_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SC_InitOutputType), INTENT(INOUT) :: OutData + TYPE(SC_MiscVarType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -423,7 +1924,7 @@ SUBROUTINE SC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er INTEGER(IntKi) :: i INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackMisc' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -434,50 +1935,13 @@ SUBROUTINE SC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN + OutData%Dummy = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + OutData%C_obj%Dummy = OutData%Dummy + END SUBROUTINE SC_UnPackMisc - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END SUBROUTINE SC_UnPackInitOutput - - SUBROUTINE SC_C2Fary_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + SUBROUTINE SC_C2Fary_CopyMisc( MiscData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_MiscVarType), INTENT(INOUT) :: MiscData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -491,10 +1955,11 @@ SUBROUTINE SC_C2Fary_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointe ELSE SkipPointers_local = .false. END IF - END SUBROUTINE SC_C2Fary_CopyInitOutput + MiscData%Dummy = MiscData%C_obj%Dummy + END SUBROUTINE SC_C2Fary_CopyMisc - SUBROUTINE SC_F2C_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_InitOutputType), INTENT(INOUT) :: InitOutputData + SUBROUTINE SC_F2C_CopyMisc( MiscData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_MiscVarType), INTENT(INOUT) :: MiscData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -508,11 +1973,12 @@ SUBROUTINE SC_F2C_CopyInitOutput( InitOutputData, ErrStat, ErrMsg, SkipPointers ELSE SkipPointers_local = .false. END IF - END SUBROUTINE SC_F2C_CopyInitOutput + MiscData%C_obj%Dummy = MiscData%Dummy + END SUBROUTINE SC_F2C_CopyMisc - SUBROUTINE SC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SC_ParameterType), INTENT(IN) :: SrcParamData - TYPE(SC_ParameterType), INTENT(INOUT) :: DstParamData + SUBROUTINE SC_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SC_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(SC_OtherStateType), INTENT(INOUT) :: DstOtherStateData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg @@ -520,30 +1986,30 @@ SUBROUTINE SC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyParam' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_CopyOtherState' ! ErrStat = ErrID_None ErrMsg = "" - DstParamData%scOn = SrcParamData%scOn - DstParamData%C_obj%scOn = SrcParamData%C_obj%scOn - END SUBROUTINE SC_CopyParam + DstOtherStateData%Dummy = SrcOtherStateData%Dummy + DstOtherStateData%C_obj%Dummy = SrcOtherStateData%C_obj%Dummy + END SUBROUTINE SC_CopyOtherState - SUBROUTINE SC_DestroyParam( ParamData, ErrStat, ErrMsg ) - TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + SUBROUTINE SC_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(SC_OtherStateType), INTENT(INOUT) :: OtherStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyParam' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_DestroyOtherState' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - END SUBROUTINE SC_DestroyParam + END SUBROUTINE SC_DestroyOtherState - SUBROUTINE SC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE SC_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SC_ParameterType), INTENT(IN) :: InData + TYPE(SC_OtherStateType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -558,7 +2024,7 @@ SUBROUTINE SC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackParam' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_PackOtherState' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -574,7 +2040,7 @@ SUBROUTINE SC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Int_BufSz = Int_BufSz + 1 ! scOn + Int_BufSz = Int_BufSz + 1 ! Dummy IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -604,15 +2070,15 @@ SUBROUTINE SC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Db_Xferred = 1 Int_Xferred = 1 - IntKiBuf(Int_Xferred) = TRANSFER(InData%scOn, IntKiBuf(1)) + IntKiBuf(Int_Xferred) = InData%Dummy Int_Xferred = Int_Xferred + 1 - END SUBROUTINE SC_PackParam + END SUBROUTINE SC_PackOtherState - SUBROUTINE SC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + SUBROUTINE SC_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SC_ParameterType), INTENT(INOUT) :: OutData + TYPE(SC_OtherStateType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -623,7 +2089,7 @@ SUBROUTINE SC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg INTEGER(IntKi) :: i INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackParam' + CHARACTER(*), PARAMETER :: RoutineName = 'SC_UnPackOtherState' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -634,13 +2100,13 @@ SUBROUTINE SC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%scOn = TRANSFER(IntKiBuf(Int_Xferred), OutData%scOn) + OutData%Dummy = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - OutData%C_obj%scOn = OutData%scOn - END SUBROUTINE SC_UnPackParam + OutData%C_obj%Dummy = OutData%Dummy + END SUBROUTINE SC_UnPackOtherState - SUBROUTINE SC_C2Fary_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + SUBROUTINE SC_C2Fary_CopyOtherState( OtherStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_OtherStateType), INTENT(INOUT) :: OtherStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -654,11 +2120,11 @@ SUBROUTINE SC_C2Fary_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) ELSE SkipPointers_local = .false. END IF - ParamData%scOn = ParamData%C_obj%scOn - END SUBROUTINE SC_C2Fary_CopyParam + OtherStateData%Dummy = OtherStateData%C_obj%Dummy + END SUBROUTINE SC_C2Fary_CopyOtherState - SUBROUTINE SC_F2C_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) - TYPE(SC_ParameterType), INTENT(INOUT) :: ParamData + SUBROUTINE SC_F2C_CopyOtherState( OtherStateData, ErrStat, ErrMsg, SkipPointers ) + TYPE(SC_OtherStateType), INTENT(INOUT) :: OtherStateData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL,INTENT(IN ) :: SkipPointers @@ -672,8 +2138,8 @@ SUBROUTINE SC_F2C_CopyParam( ParamData, ErrStat, ErrMsg, SkipPointers ) ELSE SkipPointers_local = .false. END IF - ParamData%C_obj%scOn = ParamData%scOn - END SUBROUTINE SC_F2C_CopyParam + OtherStateData%C_obj%Dummy = OtherStateData%Dummy + END SUBROUTINE SC_F2C_CopyOtherState SUBROUTINE SC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) TYPE(SC_InputType), INTENT(IN) :: SrcInputData @@ -690,6 +2156,21 @@ SUBROUTINE SC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" +IF (ASSOCIATED(SrcInputData%toSCglob)) THEN + i1_l = LBOUND(SrcInputData%toSCglob,1) + i1_u = UBOUND(SrcInputData%toSCglob,1) + IF (.NOT. ASSOCIATED(DstInputData%toSCglob)) THEN + ALLOCATE(DstInputData%toSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%toSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstInputData%c_obj%toSCglob_Len = SIZE(DstInputData%toSCglob) + IF (DstInputData%c_obj%toSCglob_Len > 0) & + DstInputData%c_obj%toSCglob = C_LOC( DstInputData%toSCglob(i1_l) ) + END IF + DstInputData%toSCglob = SrcInputData%toSCglob +ENDIF IF (ASSOCIATED(SrcInputData%toSC)) THEN i1_l = LBOUND(SrcInputData%toSC,1) i1_u = UBOUND(SrcInputData%toSC,1) @@ -716,6 +2197,12 @@ SUBROUTINE SC_DestroyInput( InputData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" +IF (ASSOCIATED(InputData%toSCglob)) THEN + DEALLOCATE(InputData%toSCglob) + InputData%toSCglob => NULL() + InputData%C_obj%toSCglob = C_NULL_PTR + InputData%C_obj%toSCglob_Len = 0 +ENDIF IF (ASSOCIATED(InputData%toSC)) THEN DEALLOCATE(InputData%toSC) InputData%toSC => NULL() @@ -759,6 +2246,11 @@ SUBROUTINE SC_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! toSCglob allocated yes/no + IF ( ASSOCIATED(InData%toSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSCglob) ! toSCglob + END IF Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no IF ( ASSOCIATED(InData%toSC) ) THEN Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension @@ -793,6 +2285,21 @@ SUBROUTINE SC_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Db_Xferred = 1 Int_Xferred = 1 + IF ( .NOT. ASSOCIATED(InData%toSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%toSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%toSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%toSCglob,1), UBOUND(InData%toSCglob,1) + ReKiBuf(Re_Xferred) = InData%toSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF IF ( .NOT. ASSOCIATED(InData%toSC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -837,6 +2344,27 @@ SUBROUTINE SC_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%toSCglob)) DEALLOCATE(OutData%toSCglob) + ALLOCATE(OutData%toSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%toSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%toSCglob_Len = SIZE(OutData%toSCglob) + IF (OutData%c_obj%toSCglob_Len > 0) & + OutData%c_obj%toSCglob = C_LOC( OutData%toSCglob(i1_l) ) + DO i1 = LBOUND(OutData%toSCglob,1), UBOUND(OutData%toSCglob,1) + OutData%toSCglob(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! toSC not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -876,6 +2404,15 @@ SUBROUTINE SC_C2Fary_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) SkipPointers_local = .false. END IF + ! -- toSCglob Input Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( InputData%C_obj%toSCglob ) ) THEN + NULLIFY( InputData%toSCglob ) + ELSE + CALL C_F_POINTER(InputData%C_obj%toSCglob, InputData%toSCglob, (/InputData%C_obj%toSCglob_Len/)) + END IF + END IF + ! -- toSC Input Data fields IF ( .NOT. SkipPointers_local ) THEN IF ( .NOT. C_ASSOCIATED( InputData%C_obj%toSC ) ) THEN @@ -902,6 +2439,18 @@ SUBROUTINE SC_F2C_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers ) SkipPointers_local = .false. END IF + ! -- toSCglob Input Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(InputData%toSCglob)) THEN + InputData%c_obj%toSCglob_Len = 0 + InputData%c_obj%toSCglob = C_NULL_PTR + ELSE + InputData%c_obj%toSCglob_Len = SIZE(InputData%toSCglob) + IF (InputData%c_obj%toSCglob_Len > 0) & + InputData%c_obj%toSCglob = C_LOC( InputData%toSCglob( LBOUND(InputData%toSCglob,1) ) ) + END IF + END IF + ! -- toSC Input Data fields IF ( .NOT. SkipPointers_local ) THEN IF ( .NOT. ASSOCIATED(InputData%toSC)) THEN @@ -930,6 +2479,21 @@ SUBROUTINE SC_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMs ! ErrStat = ErrID_None ErrMsg = "" +IF (ASSOCIATED(SrcOutputData%fromSCglob)) THEN + i1_l = LBOUND(SrcOutputData%fromSCglob,1) + i1_u = UBOUND(SrcOutputData%fromSCglob,1) + IF (.NOT. ASSOCIATED(DstOutputData%fromSCglob)) THEN + ALLOCATE(DstOutputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DstOutputData%c_obj%fromSCglob_Len = SIZE(DstOutputData%fromSCglob) + IF (DstOutputData%c_obj%fromSCglob_Len > 0) & + DstOutputData%c_obj%fromSCglob = C_LOC( DstOutputData%fromSCglob(i1_l) ) + END IF + DstOutputData%fromSCglob = SrcOutputData%fromSCglob +ENDIF IF (ASSOCIATED(SrcOutputData%fromSC)) THEN i1_l = LBOUND(SrcOutputData%fromSC,1) i1_u = UBOUND(SrcOutputData%fromSC,1) @@ -956,6 +2520,12 @@ SUBROUTINE SC_DestroyOutput( OutputData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" +IF (ASSOCIATED(OutputData%fromSCglob)) THEN + DEALLOCATE(OutputData%fromSCglob) + OutputData%fromSCglob => NULL() + OutputData%C_obj%fromSCglob = C_NULL_PTR + OutputData%C_obj%fromSCglob_Len = 0 +ENDIF IF (ASSOCIATED(OutputData%fromSC)) THEN DEALLOCATE(OutputData%fromSC) OutputData%fromSC => NULL() @@ -999,6 +2569,11 @@ SUBROUTINE SC_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no + IF ( ASSOCIATED(InData%fromSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob + END IF Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no IF ( ASSOCIATED(InData%fromSC) ) THEN Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension @@ -1033,6 +2608,21 @@ SUBROUTINE SC_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Db_Xferred = 1 Int_Xferred = 1 + IF ( .NOT. ASSOCIATED(InData%fromSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) + ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF IF ( .NOT. ASSOCIATED(InData%fromSC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -1077,6 +2667,27 @@ SUBROUTINE SC_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ASSOCIATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) + ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + OutData%c_obj%fromSCglob_Len = SIZE(OutData%fromSCglob) + IF (OutData%c_obj%fromSCglob_Len > 0) & + OutData%c_obj%fromSCglob = C_LOC( OutData%fromSCglob(i1_l) ) + DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) + OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), C_FLOAT) + Re_Xferred = Re_Xferred + 1 + END DO + END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -1116,6 +2727,15 @@ SUBROUTINE SC_C2Fary_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) SkipPointers_local = .false. END IF + ! -- fromSCglob Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. C_ASSOCIATED( OutputData%C_obj%fromSCglob ) ) THEN + NULLIFY( OutputData%fromSCglob ) + ELSE + CALL C_F_POINTER(OutputData%C_obj%fromSCglob, OutputData%fromSCglob, (/OutputData%C_obj%fromSCglob_Len/)) + END IF + END IF + ! -- fromSC Output Data fields IF ( .NOT. SkipPointers_local ) THEN IF ( .NOT. C_ASSOCIATED( OutputData%C_obj%fromSC ) ) THEN @@ -1142,6 +2762,18 @@ SUBROUTINE SC_F2C_CopyOutput( OutputData, ErrStat, ErrMsg, SkipPointers ) SkipPointers_local = .false. END IF + ! -- fromSCglob Output Data fields + IF ( .NOT. SkipPointers_local ) THEN + IF ( .NOT. ASSOCIATED(OutputData%fromSCglob)) THEN + OutputData%c_obj%fromSCglob_Len = 0 + OutputData%c_obj%fromSCglob = C_NULL_PTR + ELSE + OutputData%c_obj%fromSCglob_Len = SIZE(OutputData%fromSCglob) + IF (OutputData%c_obj%fromSCglob_Len > 0) & + OutputData%c_obj%fromSCglob = C_LOC( OutputData%fromSCglob( LBOUND(OutputData%fromSCglob,1) ) ) + END IF + END IF + ! -- fromSC Output Data fields IF ( .NOT. SkipPointers_local ) THEN IF ( .NOT. ASSOCIATED(OutputData%fromSC)) THEN @@ -1250,6 +2882,12 @@ SUBROUTINE SC_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg ) END IF ScaleFactor = t_out / t(2) +IF (ASSOCIATED(u_out%toSCglob) .AND. ASSOCIATED(u1%toSCglob)) THEN + DO i1 = LBOUND(u_out%toSCglob,1),UBOUND(u_out%toSCglob,1) + b = -(u1%toSCglob(i1) - u2%toSCglob(i1)) + u_out%toSCglob(i1) = u1%toSCglob(i1) + b * ScaleFactor + END DO +END IF ! check if allocated IF (ASSOCIATED(u_out%toSC) .AND. ASSOCIATED(u1%toSC)) THEN DO i1 = LBOUND(u_out%toSC,1),UBOUND(u_out%toSC,1) b = -(u1%toSC(i1) - u2%toSC(i1)) @@ -1313,6 +2951,13 @@ SUBROUTINE SC_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, ErrM END IF ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) +IF (ASSOCIATED(u_out%toSCglob) .AND. ASSOCIATED(u1%toSCglob)) THEN + DO i1 = LBOUND(u_out%toSCglob,1),UBOUND(u_out%toSCglob,1) + b = (t(3)**2*(u1%toSCglob(i1) - u2%toSCglob(i1)) + t(2)**2*(-u1%toSCglob(i1) + u3%toSCglob(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%toSCglob(i1) + t(3)*u2%toSCglob(i1) - t(2)*u3%toSCglob(i1) ) * scaleFactor + u_out%toSCglob(i1) = u1%toSCglob(i1) + b + c * t_out + END DO +END IF ! check if allocated IF (ASSOCIATED(u_out%toSC) .AND. ASSOCIATED(u1%toSC)) THEN DO i1 = LBOUND(u_out%toSC,1),UBOUND(u_out%toSC,1) b = (t(3)**2*(u1%toSC(i1) - u2%toSC(i1)) + t(2)**2*(-u1%toSC(i1) + u3%toSC(i1)))* scaleFactor @@ -1417,6 +3062,12 @@ SUBROUTINE SC_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg END IF ScaleFactor = t_out / t(2) +IF (ASSOCIATED(y_out%fromSCglob) .AND. ASSOCIATED(y1%fromSCglob)) THEN + DO i1 = LBOUND(y_out%fromSCglob,1),UBOUND(y_out%fromSCglob,1) + b = -(y1%fromSCglob(i1) - y2%fromSCglob(i1)) + y_out%fromSCglob(i1) = y1%fromSCglob(i1) + b * ScaleFactor + END DO +END IF ! check if allocated IF (ASSOCIATED(y_out%fromSC) .AND. ASSOCIATED(y1%fromSC)) THEN DO i1 = LBOUND(y_out%fromSC,1),UBOUND(y_out%fromSC,1) b = -(y1%fromSC(i1) - y2%fromSC(i1)) @@ -1480,6 +3131,13 @@ SUBROUTINE SC_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, Err END IF ScaleFactor = t_out / (t(2) * t(3) * (t(2) - t(3))) +IF (ASSOCIATED(y_out%fromSCglob) .AND. ASSOCIATED(y1%fromSCglob)) THEN + DO i1 = LBOUND(y_out%fromSCglob,1),UBOUND(y_out%fromSCglob,1) + b = (t(3)**2*(y1%fromSCglob(i1) - y2%fromSCglob(i1)) + t(2)**2*(-y1%fromSCglob(i1) + y3%fromSCglob(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%fromSCglob(i1) + t(3)*y2%fromSCglob(i1) - t(2)*y3%fromSCglob(i1) ) * scaleFactor + y_out%fromSCglob(i1) = y1%fromSCglob(i1) + b + c * t_out + END DO +END IF ! check if allocated IF (ASSOCIATED(y_out%fromSC) .AND. ASSOCIATED(y1%fromSC)) THEN DO i1 = LBOUND(y_out%fromSC,1),UBOUND(y_out%fromSC,1) b = (t(3)**2*(y1%fromSC(i1) - y2%fromSC(i1)) + t(2)**2*(-y1%fromSC(i1) + y3%fromSC(i1)))* scaleFactor diff --git a/modules/supercontroller/src/SuperController_Types.h b/modules/supercontroller/src/SuperController_Types.h index c38bcf67a0..365cc9d1ae 100644 --- a/modules/supercontroller/src/SuperController_Types.h +++ b/modules/supercontroller/src/SuperController_Types.h @@ -22,29 +22,73 @@ typedef struct SC_InitInputType { void * object ; - int NumSC2Ctrl ; - int NumCtrl2SC ; + int nTurbines ; + char DLL_FileName[1024] ; } SC_InitInputType_t ; typedef struct SC_InitOutputType { void * object ; + int NumCtrl2SC ; + int nInpGlobal ; + int NumSC2Ctrl ; + int NumSC2CtrlGlob ; } SC_InitOutputType_t ; typedef struct SC_ParameterType { void * object ; - bool scOn ; + double DT ; + int nTurbines ; + int NumCtrl2SC ; + int nInpGlobal ; + int NumSC2Ctrl ; + int NumSC2CtrlGlob ; + int NumStatesGlobal ; + int NumStatesTurbine ; + int NumParamGlobal ; + int NumParamTurbine ; + float * ParamGlobal ; int ParamGlobal_Len ; + float * ParamTurbine ; int ParamTurbine_Len ; + } SC_ParameterType_t ; + typedef struct SC_DiscreteStateType { + void * object ; + float * Global ; int Global_Len ; + float * Turbine ; int Turbine_Len ; + } SC_DiscreteStateType_t ; + typedef struct SC_ContinuousStateType { + void * object ; + float Dummy ; + } SC_ContinuousStateType_t ; + typedef struct SC_ConstraintStateType { + void * object ; + float Dummy ; + } SC_ConstraintStateType_t ; + typedef struct SC_MiscVarType { + void * object ; + float Dummy ; + } SC_MiscVarType_t ; + typedef struct SC_OtherStateType { + void * object ; + int Dummy ; + } SC_OtherStateType_t ; typedef struct SC_InputType { void * object ; + float * toSCglob ; int toSCglob_Len ; float * toSC ; int toSC_Len ; } SC_InputType_t ; typedef struct SC_OutputType { void * object ; + float * fromSCglob ; int fromSCglob_Len ; float * fromSC ; int fromSC_Len ; } SC_OutputType_t ; typedef struct SC_UserData { SC_InitInputType_t SC_InitInput ; SC_InitOutputType_t SC_InitOutput ; SC_ParameterType_t SC_Param ; + SC_DiscreteStateType_t SC_DiscState ; + SC_ContinuousStateType_t SC_ContState ; + SC_ConstraintStateType_t SC_ConstrState ; + SC_MiscVarType_t SC_Misc ; + SC_OtherStateType_t SC_OtherState ; SC_InputType_t SC_Input ; SC_OutputType_t SC_Output ; } SC_t ; diff --git a/modules/turbsim/src/TS_FileIO.f90 b/modules/turbsim/src/TS_FileIO.f90 index 1689f5e2f8..d13fd8d0d3 100644 --- a/modules/turbsim/src/TS_FileIO.f90 +++ b/modules/turbsim/src/TS_FileIO.f90 @@ -3426,7 +3426,7 @@ SUBROUTINE WrSum_Stats(p, V, USig, VSig, WSig, ErrStat, ErrMsg) DO IVec=1,3 - WRITE(p%US,"(/,3X'Height Standard deviation at grid points for the ',A,' component:')") Comp(IVec) + WRITE(p%US,"(/,3X,'Height Standard deviation at grid points for the ',A,' component:')") Comp(IVec) DO IZ=p%grid%NumGrid_Z,1,-1 diff --git a/modules/wakedynamics/CMakeLists.txt b/modules/wakedynamics/CMakeLists.txt new file mode 100644 index 0000000000..a298eec337 --- /dev/null +++ b/modules/wakedynamics/CMakeLists.txt @@ -0,0 +1,33 @@ +# +# Copyright 2016 National Renewable Energy Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +if (GENERATE_TYPES) + generate_f90_types(src/WakeDynamics_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/WakeDynamics_Types.f90 -noextrap) +endif() + +set(WD_LIBS_SOURCES + src/WakeDynamics.f90 + #src/WakeDynamics_IO.f90 + src/WakeDynamics_Types.f90 + ) + +add_library(wdlib ${WD_LIBS_SOURCES}) +target_link_libraries(wdlib nwtclibs) + +install(TARGETS wdlib + EXPORT "${CMAKE_PROJECT_NAME}Libraries" + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/modules/wakedynamics/src/WakeDynamics.f90 b/modules/wakedynamics/src/WakeDynamics.f90 new file mode 100644 index 0000000000..289d9d1244 --- /dev/null +++ b/modules/wakedynamics/src/WakeDynamics.f90 @@ -0,0 +1,1105 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2015-2016 National Renewable Energy Laboratory +! +! This file is part of WakeDynamics. +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +! File last committed: $Date$ +! (File) Revision #: $Rev$ +! URL: $HeadURL$ +!********************************************************************************************************************************** +!> WakeDynamics is a time-domain module for modeling wake dynamics of one or more horizontal-axis wind turbines. +module WakeDynamics + + use NWTC_Library + use WakeDynamics_Types + + implicit none + + private + + type(ProgDesc), parameter :: WD_Ver = ProgDesc( 'WakeDynamics', '', '' ) + character(*), parameter :: WD_Nickname = 'WD' + + ! ..... Public Subroutines ................................................................................................... + + public :: WD_Init ! Initialization routine + public :: WD_End ! Ending routine (includes clean up) + public :: WD_UpdateStates ! Loose coupling routine for solving for constraint states, integrating + ! continuous states, and updating discrete states + public :: WD_CalcOutput ! Routine for computing outputs + public :: WD_CalcConstrStateResidual ! Tight coupling routine for returning the constraint state residual + + contains + +function WD_Interp ( yVal, xArr, yArr ) + real(ReKi) :: WD_Interp + real(ReKi), intent(in ) :: yVal + real(ReKi), intent(in ) :: xArr(:) + real(ReKi), intent(in ) :: yArr(:) + + integer(IntKi) :: i, nPts + real(ReKi) :: y1,y2,x1,x2,dy + + + nPts = size(xArr) + WD_Interp = 0.0_ReKi + y2 = yArr(nPts) - yVal + x2 = xArr(nPts) + do i=nPts-1,1,-1 + y1 = yArr(i) - yVal + x1 = xArr(i) + if( nint( sign(1.0_ReKi, y1) ) /= nint( sign(1.0_ReKi, y2) ) ) then + + dy = y2-y1 + if (EqualRealNos(dy,0.0_ReKi) ) then + WD_Interp = x2 + else + WD_Interp = (x2-x1)*(yVal-y1)/(dy) + x1 + end if + exit + + end if + + y2 = y1 + x2 = x1 + end do + +end function WD_Interp +!---------------------------------------------------------------------------------------------------------------------------------- +!> This function sets the nacelle-yaw-related directional term for the yaw correction deflection calculations +!! +function GetYawCorrection(yawErr, xhat_disk, dx, p, errStat, errMsg) + real(ReKi), dimension(3) :: GetYawCorrection + real(ReKi), intent(in ) :: yawErr !< Nacelle-yaw error at the wake planes + real(ReKi), intent(in ) :: xhat_disk(3) !< Orientation of rotor centerline, normal to disk + real(ReKi), intent(in ) :: dx !< Dot_product(xhat_plane,V_plane)*DT_low + type(WD_ParameterType), intent(in ) :: p !< Parameters + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + real(ReKi) :: xydisk(3),yxdisk(3),yydisk(3),xxdisk(3),xydisknorm + + errStat = ErrID_None + errMsg = '' + + xydisk = (/0.0_ReKi, xhat_disk(1), 0.0_ReKi/) + yxdisk = (/xhat_disk(2), 0.0_ReKi, 0.0_ReKi/) + yydisk = (/0.0_ReKi, xhat_disk(2), 0.0_ReKi/) + xxdisk = (/xhat_disk(1), 0.0_ReKi, 0.0_ReKi/) + xydisknorm = TwoNorm(xxdisk + yydisk) + + if (EqualRealNos(xydisknorm,0.0_ReKi)) then + ! TEST: E3 + call SetErrStat( ErrID_Fatal, 'Orientation of the rotor centerline at the rotor plane is directed vertically upward or downward, whereby the nacelle-yaw error and horizontal wake-deflection correction is undefined.', errStat, errMsg, 'GetYawCorrectionTermA' ) + return + end if + + if (EqualRealNos(dx,0.0_ReKi)) then + GetYawCorrection = ( p%C_HWkDfl_O + p%C_HWkDfl_OY*YawErr ) * ( ( xydisk - yxdisk ) / (xydisknorm) ) + else + GetYawCorrection = ( p%C_HWkDfl_x + p%C_HWkDfl_xY*yawErr ) * dx * ( ( xydisk - yxdisk ) / (xydisknorm) ) + end if + +end function GetYawCorrection + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine calculates the eddy viscosity filter functions, prepresenting the delay in the turbulent stress generated by +!! ambient turbulence or the development of turbulent stresses generated by the shear layer +real(ReKi) function EddyFilter(x_plane, D_rotor, C_Dmin, C_Dmax, C_Fmin, C_Exp) + + real(ReKi), intent(in ) :: x_plane !< Downwind distance from rotor to each wake plane (m) + real(ReKi), intent(in ) :: D_rotor !< Rotor diameter (m) + real(ReKi), intent(in ) :: C_Dmin !< Calibrated parameter defining the transitional diameter fraction between the minimum and exponential regions + real(ReKi), intent(in ) :: C_Dmax !< Calibrated parameter defining the transitional diameter fraction between the exponential and maximum regions + real(ReKi), intent(in ) :: C_Fmin !< Calibrated parameter defining the functional value in the minimum region + real(ReKi), intent(in ) :: C_Exp !< Calibrated parameter defining the exponent in the exponential region + + + ! Any errors due to invalid choices of the calibrated parameters have been raised when this module was initialized + + if ( x_plane <= C_Dmin*D_rotor ) then + EddyFilter = C_Fmin + else if (x_plane >= C_Dmax*D_rotor) then + EddyFilter = 1_ReKi + else + EddyFilter = C_Fmin + (1_ReKi-C_Fmin)*( ( (x_plane/D_rotor) - C_DMin ) / (C_Dmax-C_Dmin) )**C_Exp + end if + + +end function EddyFilter + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine calculates the wake diameter at a wake plane, based on one of four models +real(ReKi) function WakeDiam( Mod_WakeDiam, nr, dr, rArr, Vx_wake, Vx_wind_disk, D_rotor, C_WakeDiam) + + integer(intKi), intent(in ) :: Mod_WakeDiam !< Wake diameter calculation model [ 1=Rotor diameter, 2=Velocity, 3=Mass flux, 4=Momentum flux] + integer(intKi), intent(in ) :: nr !< Number of radii in the radial finite-difference grid + real(ReKi), intent(in ) :: dr !< Radial increment of radial finite-difference grid (m) + real(ReKi), intent(in ) :: rArr(0:) !< Discretization of radial finite-difference grid (m) + real(ReKi), intent(in ) :: Vx_wake(0:) !< Axial wake velocity deficit at a wake plane, distributed radially (m/s) + real(ReKi), intent(in ) :: Vx_wind_disk !< Rotor-disk-averaged ambient wind speed, normal to planes (m/s) + real(ReKi), intent(in ) :: D_rotor !< Rotor diameter (m) + real(ReKi), intent(in ) :: C_WakeDiam !< Calibrated parameter for wake diameter calculation + + integer(IntKi) :: ILo + real(ReKi) :: m(0:nr-1) + integer(IntKi) :: i + ILo = 0 + + ! Any errors due to invalid values of dr and C_WakeDiam have been raised when this module was initialized + + select case ( Mod_WakeDiam ) + case (WakeDiamMod_RotDiam) + + WakeDiam = D_rotor + + case (WakeDiamMod_Velocity) + + ! Ensure the wake diameter is at least as large as the rotor diameter + + WakeDiam = max(D_rotor, 2.0_ReKi*WD_Interp( (C_WakeDiam-1_ReKi)*Vx_wind_disk, rArr, Vx_wake ) ) + + case (WakeDiamMod_MassFlux) + + m(0) = 0.0 + do i = 1,nr-1 + m(i) = m(i-1) + pi*dr*(Vx_wake(i)*rArr(i) + Vx_wake(i-1)*rArr(i-1)) + end do + + WakeDiam = max(D_rotor, 2.0_ReKi*WD_Interp( C_WakeDiam*m(nr-1), rArr, m ) ) + + case (WakeDiamMod_MtmFlux) + + m(0) = 0.0 + do i = 1,nr-1 + m(i) = m(i-1) + pi*dr*( (Vx_wake(i)**2)*rArr(i) + (Vx_wake(i-1)**2)*rArr(i-1)) + end do + + WakeDiam = max(D_rotor, 2.0_ReKi*WD_Interp( C_WakeDiam*m(nr-1), rArr, m ) ) + + end select + + +end function WakeDiam + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine computes the near wake correction : Vx_wake +subroutine NearWakeCorrection( Ct_azavg_filt, Vx_rel_disk_filt, p, m, Vx_wake, D_rotor, errStat, errMsg ) + real(ReKi), intent(in ) :: Ct_azavg_filt(0:) !< Time-filtered azimuthally averaged thrust force coefficient (normal to disk), distributed radially + real(ReKi), intent(in ) :: D_rotor !< Rotor diameter + real(ReKi), intent(in ) :: Vx_rel_disk_filt !< Time-filtered rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk + type(WD_ParameterType), intent(in ) :: p !< Parameters + type(WD_MiscVarType), intent(inout) :: m !< Initial misc/optimization variables + real(ReKi), intent(inout) :: Vx_wake(0:) !< Axial wake velocity deficit at first plane + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + real(ReKi) :: alpha + real(ReKi) :: Ct_avg ! Rotor-disk averaged Ct + integer(IntKi) :: j, errStat2 + character(*), parameter :: RoutineName = 'NearWakeCorrection' + real(ReKi), parameter :: Ct_low = 0.96_ReKi, Ct_high = 1.10_ReKi ! Limits for blending + + errStat = ErrID_None + errMsg = '' + + ! Computing average Ct = \int r Ct dr / \int r dr = 2/R^2 \int r Ct dr using trapz + ! NOTE: r goes beyond the rotor (works since Ct=0 beyond that) + Ct_avg = 0.0_ReKi + do j=1,p%NumRadii-1 + Ct_avg = Ct_avg + 0.5_ReKi * (p%r(j) * Ct_azavg_filt(j) + p%r(j-1) * Ct_azavg_filt(j-1)) * p%dr + enddo + Ct_avg = 8.0_ReKi*Ct_avg/(D_rotor*D_rotor) + + if (Ct_avg > 2.0_ReKi ) then + ! THROW ERROR because we are in the prop-brake region + ! TEST: E5 + call SetErrStat(ErrID_FATAL, 'Wake model is not valid in the propeller-brake region, i.e., Ct > 2.0.', errStat, errMsg, RoutineName) + return + + else if ( Ct_avg < Ct_low ) then + ! Low Ct region + call Vx_low_Ct(Vx_wake, p%r) ! Compute Vx_wake at p%r + + else if ( Ct_avg > Ct_high ) then + ! high Ct region + call Vx_high_Ct(Vx_wake, p%r, Ct_avg) ! Compute Vx_wake at p%r + ! m%r_wake = p%r ! No distinction between r_wake and r, r_wake is just a temp variable anyway + + else + ! Blending Ct region between Ct_low and Ct_high + call Vx_low_Ct (Vx_wake, p%r) ! Evaluate Vx_wake (Ct_low) at p%r + call Vx_high_Ct(m%Vx_high, p%r, Ct_avg) ! Evaluate Vx_high (Ct_high) at p%r + + alpha = 1.0_ReKi - (Ct_avg - Ct_low) / (Ct_high-Ct_low) ! linear blending coefficient + do j=0,p%NumRadii-1 + Vx_wake(j) = alpha*Vx_wake(j)+(1.0_ReKi-alpha)*m%Vx_high(j) ! Blended CT velocity + end do + end if + +contains + + !> Compute the induced velocity distribution in the wake for low thrust region + subroutine Vx_low_Ct(Vx, r_eval) + real(ReKi), dimension(0:), intent(out) :: Vx !< Wake induced velocity (<0) + real(ReKi), dimension(0:), intent(in ) :: r_eval !< Radial position where velocity is to be evaluated + integer(IntKi) :: ILo ! index for interpolation + real(ReKi) :: a_interp + + ! compute r_wake and m%a using Ct_azavg_filt + m%r_wake(0) = 0.0_ReKi + do j=0,p%NumRadii-1 + ! NOTE: Ct clipped instead of (2.0_ReKi + 3.0_ReKi*sqrt(14.0_ReKi*Ct_azavg_filt(j)-12.0_ReKi))/14.0_ReKi + m%a(j) = 0.5_ReKi - 0.5_ReKi*sqrt( 1.0_ReKi-min(Ct_azavg_filt(j),24.0_ReKi/25.0_ReKi)) + if (j > 0) then + m%r_wake(j) = sqrt(m%r_wake(j-1)**2.0_ReKi + p%dr*( ((1.0_ReKi - m%a(j))*p%r(j)) / (1.0_ReKi-p%C_NearWake*m%a(j)) + ((1.0_ReKi - m%a(j-1))*p%r(j-1)) / (1.0_ReKi-p%C_NearWake*m%a(j-1)) ) ) + end if + end do + ! Use a and rw to determine Vx + Vx(0) = -Vx_rel_disk_filt*p%C_Nearwake*m%a(0) + ILo = 0 + do j=1,p%NumRadii-1 + ! given r_wake and m%a at p%dr increments, find value of m%a(r_wake) using interpolation + a_interp = InterpBin( r_eval(j), m%r_wake, m%a, ILo, p%NumRadii ) !( XVal, XAry, YAry, ILo, AryLen ) + Vx(j) = -Vx_rel_disk_filt*p%C_NearWake*a_interp !! Low CT velocity + end do + end subroutine Vx_low_Ct + + !> Compute the induced velocity distribution in the wake for high thrust region + subroutine Vx_high_Ct(Vx, r_eval, Ct_avg) + real(ReKi), dimension(0:), intent(out) :: Vx !< Wake induced velocity (<0) + real(ReKi), dimension(0:), intent(in ) :: r_eval !< Wake radial coordinate + real(ReKi), intent(in ) :: Ct_avg !< Rotor-disk averaged Ct + real(ReKi) :: mu, sigma ! Gaussian shape parameters for high thrust region + real(ReKi), parameter :: x_bar=4._ReKi ! dimensionless downstream distance used to tune the model + mu = (3._ReKi/(2._ReKi*Ct_avg*Ct_avg-1._ReKi) + 4._ReKi -0.5_ReKi*x_bar) /10._ReKi + sigma = D_rotor* (0.5_ReKi*Ct_avg + x_bar/(25._ReKi)) + do j=0,p%NumRadii-1 + Vx(j) = -Vx_rel_disk_filt*mu*exp(-r_eval(j)*r_eval(j)/(sigma*sigma)) !! High CT Velocity + end do + end subroutine Vx_high_Ct + +end subroutine NearWakeCorrection + + + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This subroutine solves the tridiagonal linear system for x() using the Thomas algorithm +subroutine ThomasAlgorithm(nr, a, b, c, d, x, errStat, errMsg) + + integer(IntKi), intent(in ) :: nr !< Number of radii in the radial finite-difference grid + real(ReKi), intent(inout) :: a(0:) !< Sub diagonal + real(ReKi), intent(inout) :: b(0:) !< Main diagonal + real(ReKi), intent(inout) :: c(0:) !< Super diagonal + real(ReKi), intent(inout) :: d(0:) !< Right-hand side + real(ReKi), intent(inout) :: x(0:) !< Solution of the linear solve + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + real(ReKi) :: m + integer(IntKi) :: i + character(*), parameter :: RoutineName = 'ThomasAlgorithm' + + errStat = ErrID_None + errMsg = '' + + ! Assumes all arrays are the same length + + ! Check that tridiagonal matrix is not diagonally dominant + if ( abs(b(0)) <= abs(c(0)) ) then + ! TEST: E16 + call SetErrStat( ErrID_Fatal, 'Tridiagonal matrix is not diagonally dominant, i.e., abs(b(0)) <= abs(c(0)). Try reducing the FAST.Farm timestep.', errStat, errMsg, RoutineName ) + return + end if + do i = 1,nr-2 + if ( abs(b(i)) <= ( abs(a(i))+abs(c(i)) ) ) then + ! TEST: E17 + call SetErrStat( ErrID_Fatal, 'Tridiagonal matrix is not diagonally dominant, i.e., abs(b(i)) <= ( abs(a(i))+abs(c(i)) ). Try reducing the FAST.Farm timestep.', errStat, errMsg, RoutineName ) + return + end if + end do + if ( abs(b(nr-1)) <= abs(a(nr-1)) ) then + ! TEST: E18 + call SetErrStat( ErrID_Fatal, 'Tridiagonal matrix is not diagonally dominant, i.e., abs(b(nr-1)) <= abs(a(nr-1)). Try reducing the FAST.Farm timestep.', errStat, errMsg, RoutineName ) + return + end if + + do i = 1,nr-1 + m = -a(i)/b(i-1) + b(i) = b(i) + m*c(i-1) + d(i) = d(i) + m*d(i-1) + end do + + x(nr-1) = d(nr-1)/b(nr-1) + do i = nr-2,0, -1 + x(i) = ( d(i) - c(i)*x(i+1) ) / b(i) + end do + +end subroutine ThomasAlgorithm + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the start of the simulation to perform initialization steps. +!! The parameters are set here and not changed during the simulation. +!! The initial states and initial guess for the input are defined. +subroutine WD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, errStat, errMsg ) +!.................................................................................................................................. + + type(WD_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(WD_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined + type(WD_ParameterType), intent( out) :: p !< Parameters + type(WD_ContinuousStateType), intent( out) :: x !< Initial continuous states + type(WD_DiscreteStateType), intent( out) :: xd !< Initial discrete states + type(WD_ConstraintStateType), intent( out) :: z !< Initial guess of the constraint states + type(WD_OtherStateType), intent( out) :: OtherState !< Initial other states + type(WD_OutputType), intent( out) :: y !< Initial system outputs (outputs are not calculated; + !! only the output mesh is initialized) + type(WD_MiscVarType), intent( out) :: m !< Initial misc/optimization variables + real(DbKi), intent(in ) :: interval !< Coupling interval in seconds: the rate that + !! (1) WD_UpdateStates() is called in loose coupling & + !! (2) WD_UpdateDiscState() is called in tight coupling. + !! Input is the suggested time from the glue code; + !! Output is the actual coupling interval that will be used + !! by the glue code. + type(WD_InitOutputType), intent( out) :: InitOut !< Output for initialization routine + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + + ! Local variables + integer(IntKi) :: i ! loop counter + + integer(IntKi) :: errStat2 ! temporary error status of the operation + character(ErrMsgLen) :: errMsg2 ! temporary error message + character(*), parameter :: RoutineName = 'WD_Init' + + + ! Initialize variables for this routine + + errStat = ErrID_None + errMsg = "" + + ! Initialize the NWTC Subroutine Library + + call NWTC_Init( EchoLibVer=.FALSE. ) + + + ! Display the module information + + if (InitInp%TurbNum <= 1) call DispNVD( WD_Ver ) + + ! Validate the initialization inputs + call ValidateInitInputData( interval, InitInp, InitInp%InputFileData, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, errStat, errMsg, RoutineName ) + if (errStat >= AbortErrLev) return + + !............................................................................................ + ! Define parameters + !............................................................................................ + + + + ! set the rest of the parameters + p%DT_low = interval + p%NumPlanes = InitInp%InputFileData%NumPlanes + p%NumRadii = InitInp%InputFileData%NumRadii + p%dr = InitInp%InputFileData%dr + p%C_HWkDfl_O = InitInp%InputFileData%C_HWkDfl_O + p%C_HWkDfl_OY = InitInp%InputFileData%C_HWkDfl_OY + p%C_HWkDfl_x = InitInp%InputFileData%C_HWkDfl_x + p%C_HWkDfl_xY = InitInp%InputFileData%C_HWkDfl_xY + p%C_NearWake = InitInp%InputFileData%C_NearWake + p%C_vAmb_DMin = InitInp%InputFileData%C_vAmb_DMin + p%C_vAmb_DMax = InitInp%InputFileData%C_vAmb_DMax + p%C_vAmb_FMin = InitInp%InputFileData%C_vAmb_FMin + p%C_vAmb_Exp = InitInp%InputFileData%C_vAmb_Exp + p%C_vShr_DMin = InitInp%InputFileData%C_vShr_DMin + p%C_vShr_DMax = InitInp%InputFileData%C_vShr_DMax + p%C_vShr_FMin = InitInp%InputFileData%C_vShr_FMin + p%C_vShr_Exp = InitInp%InputFileData%C_vShr_Exp + p%k_vAmb = InitInp%InputFileData%k_vAmb + p%k_vShr = InitInp%InputFileData%k_vShr + p%Mod_WakeDiam = InitInp%InputFileData%Mod_WakeDiam + p%C_WakeDiam = InitInp%InputFileData%C_WakeDiam + + allocate( p%r(0:p%NumRadii-1),stat=errStat2) + if (errStat2 /= 0) then + call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for p%r.', errStat, errMsg, RoutineName ) + return + end if + + do i = 0,p%NumRadii-1 + p%r(i) = p%dr*i + end do + + p%filtParam = exp(-2.0_ReKi*pi*p%dt_low*InitInp%InputFileData%f_c) + p%oneMinusFiltParam = 1.0_ReKi - p%filtParam + !............................................................................................ + ! Define and initialize inputs here + !............................................................................................ + + allocate( u%V_plane (3,0:p%NumPlanes-1),stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%V_plane.', errStat, errMsg, RoutineName ) + allocate( u%Ct_azavg ( 0:p%NumRadii-1 ),stat=errStat2) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for u%Ct_azavg.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + + + + !............................................................................................ + ! Define outputs here + !............................................................................................ + + + + !............................................................................................ + ! Initialize states and misc vars : Note these are not the correct initializations because + ! that would require valid input data, which we do not have here. Instead we will check for + ! an firstPass flag on the miscVars and if it is false we will properly initialize these state + ! in CalcOutput or UpdateStates, as necessary. + !............................................................................................ + + allocate ( xd%xhat_plane (3, 0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%xhat_plane.', errStat, errMsg, RoutineName ) + allocate ( xd%p_plane (3, 0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%p_plane.', errStat, errMsg, RoutineName ) + allocate ( xd%V_plane_filt (3, 0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%V_plane_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%Vx_wind_disk_filt(0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%Vx_wind_disk_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%x_plane (0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%x_plane.', errStat, errMsg, RoutineName ) + allocate ( xd%YawErr_filt (0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%YawErr_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%TI_amb_filt (0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%TI_amb_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%D_rotor_filt (0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%D_rotor_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%Ct_azavg_filt (0:p%NumRadii-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%Ct_azavg_filt.', errStat, errMsg, RoutineName ) + allocate ( xd%Vx_wake (0:p%NumRadii-1,0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%Vx_wake.', errStat, errMsg, RoutineName ) + allocate ( xd%Vr_wake (0:p%NumRadii-1,0:p%NumPlanes-1) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for xd%Vr_wake.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + xd%xhat_plane = 0.0_ReKi + xd%p_plane = 0.0_ReKi + xd%x_plane = 0.0_ReKi + xd%Vx_wake = 0.0_ReKi + xd%Vr_wake = 0.0_ReKi + xd%V_plane_filt = 0.0_ReKi + xd%Vx_wind_disk_filt = 0.0_ReKi + xd%TI_amb_filt = 0.0_ReKi + xd%D_rotor_filt = 0.0_ReKi + xd%Vx_rel_disk_filt = 0.0_ReKi + xd%Ct_azavg_filt = 0.0_ReKi + OtherState%firstPass = .true. + + ! miscvars to avoid the allocation per timestep + allocate ( m%dvdr(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%dvdr.', errStat, errMsg, RoutineName ) + allocate ( m%dvtdr(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%dvtdr.', errStat, errMsg, RoutineName ) + allocate ( m%vt_tot(0:p%NumRadii-1,0:p%NumPlanes-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%vt_tot.', errStat, errMsg, RoutineName ) + allocate ( m%vt_amb(0:p%NumRadii-1,0:p%NumPlanes-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%vt_amb.', errStat, errMsg, RoutineName ) + allocate ( m%vt_shr(0:p%NumRadii-1,0:p%NumPlanes-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%vt_shr.', errStat, errMsg, RoutineName ) + + allocate ( m%a(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%a.', errStat, errMsg, RoutineName ) + allocate ( m%b(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%b.', errStat, errMsg, RoutineName ) + allocate ( m%c(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%c.', errStat, errMsg, RoutineName ) + allocate ( m%d(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%d.', errStat, errMsg, RoutineName ) + allocate ( m%r_wake(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%r_wake.', errStat, errMsg, RoutineName ) + allocate ( m%Vx_high(0:p%NumRadii-1 ) , STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for m%Vx_high.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + !............................................................................................ + ! Define initialization output here + !............................................................................................ + + InitOut%Ver = WD_Ver + + allocate ( y%xhat_plane(3,0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%xhat_plane.', errStat, errMsg, RoutineName ) + allocate ( y%p_plane (3,0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%p_plane.', errStat, errMsg, RoutineName ) + allocate ( y%Vx_wake (0:p%NumRadii-1,0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%Vx_wake.', errStat, errMsg, RoutineName ) + allocate ( y%Vr_wake (0:p%NumRadii-1,0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%Vr_wake.', errStat, errMsg, RoutineName ) + allocate ( y%D_wake (0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%D_wake.', errStat, errMsg, RoutineName ) + allocate ( y%x_plane (0:p%NumPlanes-1), STAT=ErrStat2 ) + if (errStat2 /= 0) call SetErrStat ( ErrID_Fatal, 'Could not allocate memory for y%x_plane.', errStat, errMsg, RoutineName ) + if (errStat /= ErrID_None) return + + y%xhat_plane = 0.0_Reki + y%p_plane = 0.0_Reki + y%Vx_wake = 0.0_Reki + y%Vr_wake = 0.0_Reki + y%D_wake = 0.0_Reki + y%x_plane = 0.0_Reki + + +end subroutine WD_Init + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine is called at the end of the simulation. +subroutine WD_End( u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) +!.................................................................................................................................. + + type(WD_InputType), intent(inout) :: u !< System inputs + type(WD_ParameterType), intent(inout) :: p !< Parameters + type(WD_ContinuousStateType), intent(inout) :: x !< Continuous states + type(WD_DiscreteStateType), intent(inout) :: xd !< Discrete states + type(WD_ConstraintStateType), intent(inout) :: z !< Constraint states + type(WD_OtherStateType), intent(inout) :: OtherState !< Other states + type(WD_OutputType), intent(inout) :: y !< System outputs + type(WD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + + + ! Initialize errStat + + errStat = ErrID_None + errMsg = "" + + + ! Place any last minute operations or calculations here: + + + ! Close files here: + + + + ! Destroy the input data: + + call WD_DestroyInput( u, errStat, errMsg ) + + + ! Destroy the parameter data: + + call WD_DestroyParam( p, errStat, errMsg ) + + + ! Destroy the state data: + + call WD_DestroyContState( x, errStat, errMsg ) + call WD_DestroyDiscState( xd, errStat, errMsg ) + call WD_DestroyConstrState( z, errStat, errMsg ) + call WD_DestroyOtherState( OtherState, errStat, errMsg ) + call WD_DestroyMisc( m, errStat, errMsg ) + + ! Destroy the output data: + + call WD_DestroyOutput( y, errStat, errMsg ) + + + + +end subroutine WD_End +!---------------------------------------------------------------------------------------------------------------------------------- +!> Loose coupling routine for solving for constraint states, integrating continuous states, and updating discrete and other states. +!! Continuous, constraint, discrete, and other states are updated for t + Interval +subroutine WD_UpdateStates( t, n, u, p, x, xd, z, OtherState, m, errStat, errMsg ) +!.................................................................................................................................. + + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + integer(IntKi), intent(in ) :: n !< Current simulation time step n = 0,1,... + type(WD_InputType), intent(in ) :: u !< Inputs at utimes (out only for mesh record-keeping in ExtrapInterp routine) + ! real(DbKi), intent(in ) :: utimes !< Times associated with u(:), in seconds + type(WD_ParameterType), intent(in ) :: p !< Parameters + type(WD_ContinuousStateType), intent(inout) :: x !< Input: Continuous states at t; + !! Output: Continuous states at t + Interval + type(WD_DiscreteStateType), intent(inout) :: xd !< Input: Discrete states at t; + !! Output: Discrete states at t + Interval + type(WD_ConstraintStateType), intent(inout) :: z !< Input: Constraint states at t; + !! Output: Constraint states at t+dt + type(WD_OtherStateType), intent(inout) :: OtherState !< Input: Other states at t; + !! Output: Other states at t+dt + type(WD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + integer(IntKi), intent( out) :: errStat !< Error status of the operation + character(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + + ! local variables + type(WD_InputType) :: uInterp ! Interpolated/Extrapolated input + integer(intKi) :: errStat2 ! temporary Error status + character(ErrMsgLen) :: errMsg2 ! temporary Error message + character(*), parameter :: RoutineName = 'WD_UpdateStates' + real(ReKi) :: dx, absdx, norm2_xhat_plane + real(ReKi) :: dy_HWkDfl(3), EddyTermA, EddyTermB, lstar, Vx_wake_min + integer(intKi) :: i,j, maxPln + + errStat = ErrID_None + errMsg = "" + + + if ( EqualRealNos(u%D_Rotor,0.0_ReKi) .or. u%D_Rotor < 0.0_ReKi ) then + ! TEST: E7 + call SetErrStat(ErrID_Fatal, 'Rotor diameter must be greater than zero.', errStat, errMsg, RoutineName) + return + end if + + ! Check if we are fully initialized + if ( OtherState%firstPass ) then + call InitStatesWithInputs(p%NumPlanes, p%NumRadii, u, p, xd, m, errStat2, errMsg2) + call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName) + OtherState%firstPass = .false. + if (errStat >= AbortErrLev) then + ! TEST: E3 + return + end if + + end if + + + ! Update V_plane_filt to [n+1]: + + maxPln = min(n,p%NumPlanes-2) + do i = 0,maxPln + xd%V_plane_filt(:,i ) = xd%V_plane_filt(:,i)*p%filtParam + u%V_plane(:,i )*p%oneMinusFiltParam + end do + xd%V_plane_filt (:,maxPln+1) = u%V_plane(:,maxPln+1) + + + maxPln = min(n+2,p%NumPlanes-1) + + ! create eddy viscosity info for most downstream plane + i = maxPln+1 + lstar = WakeDiam( p%Mod_WakeDiam, p%numRadii, p%dr, p%r, xd%Vx_wake(:,i-1), xd%Vx_wind_disk_filt(i-1), xd%D_rotor_filt(i-1), p%C_WakeDiam) / 2.0_ReKi + + Vx_wake_min = huge(ReKi) + do j = 0,p%NumRadii-1 + Vx_wake_min = min(Vx_wake_min, xd%Vx_wake(j,i-1)) + end do + + EddyTermA = EddyFilter(xd%x_plane(i-1),xd%D_rotor_filt(i-1), p%C_vAmb_DMin, p%C_vAmb_DMax, p%C_vAmb_FMin, p%C_vAmb_Exp) * p%k_vAmb * xd%TI_amb_filt(i-1) * xd%Vx_wind_disk_filt(i-1) * xd%D_rotor_filt(i-1)/2.0_ReKi + EddyTermB = EddyFilter(xd%x_plane(i-1),xd%D_rotor_filt(i-1), p%C_vShr_DMin, p%C_vShr_DMax, p%C_vShr_FMin, p%C_vShr_Exp) * p%k_vShr + do j = 0,p%NumRadii-1 + if ( j == 0 ) then + m%dvdr(j) = 0.0_ReKi + elseif (j <= p%NumRadii-2) then + m%dvdr(j) = ( xd%Vx_wake(j+1,i-1) - xd%Vx_wake(j-1,i-1) ) / (2_ReKi*p%dr) + else + m%dvdr(j) = - xd%Vx_wake(j-1,i-1) / (2_ReKi*p%dr) + end if + ! All of the following states are at [n] + m%vt_amb(j,i-1) = EddyTermA + m%vt_shr(j,i-1) = EddyTermB * max( (lstar**2)*abs(m%dvdr(j)) , lstar*(xd%Vx_wind_disk_filt(i-1) + Vx_wake_min ) ) + m%vt_tot(j,i-1) = m%vt_amb(j,i-1) + m%vt_shr(j,i-1) + end do + + ! We are going to update Vx_Wake + ! The quantities in these loops are all at time [n], so we need to compute prior to updating the states to [n+1] + do i = maxPln, 1, -1 + + lstar = WakeDiam( p%Mod_WakeDiam, p%numRadii, p%dr, p%r, xd%Vx_wake(:,i-1), xd%Vx_wind_disk_filt(i-1), xd%D_rotor_filt(i-1), p%C_WakeDiam) / 2.0_ReKi + + ! The following two quantities need to be for the time increments: + ! [n+1] [n] + ! dx = xd%x_plane(i) - xd%x_plane(i-1) + ! This is equivalent to + + dx = dot_product(xd%xhat_plane(:,i-1),xd%V_plane_filt(:,i-1))*p%DT_low + absdx = abs(dx) + if ( EqualRealNos( dx, 0.0_ReKi ) ) absdx = 1.0_ReKi ! This is to avoid division by zero problems in the formation of m%b and m%d below, which are not used when dx=0; the value of unity is arbitrary + + Vx_wake_min = huge(ReKi) + do j = 0,p%NumRadii-1 + Vx_wake_min = min(Vx_wake_min, xd%Vx_wake(j,i-1)) + end do + + EddyTermA = EddyFilter(xd%x_plane(i-1),xd%D_rotor_filt(i-1), p%C_vAmb_DMin, p%C_vAmb_DMax, p%C_vAmb_FMin, p%C_vAmb_Exp) * p%k_vAmb * xd%TI_amb_filt(i-1) * xd%Vx_wind_disk_filt(i-1) * xd%D_rotor_filt(i-1)/2.0_ReKi + EddyTermB = EddyFilter(xd%x_plane(i-1),xd%D_rotor_filt(i-1), p%C_vShr_DMin, p%C_vShr_DMax, p%C_vShr_FMin, p%C_vShr_Exp) * p%k_vShr + do j = 0,p%NumRadii-1 + if ( j == 0 ) then + m%dvdr(j) = 0.0_ReKi + elseif (j <= p%NumRadii-2) then + m%dvdr(j) = ( xd%Vx_wake(j+1,i-1) - xd%Vx_wake(j-1,i-1) ) / (2_ReKi*p%dr) + else + m%dvdr(j) = - xd%Vx_wake(j-1,i-1) / (2_ReKi*p%dr) + end if + ! All of the following states are at [n] + m%vt_amb(j,i-1) = EddyTermA + m%vt_shr(j,i-1) = EddyTermB * max( (lstar**2)*abs(m%dvdr(j)) , lstar*(xd%Vx_wind_disk_filt(i-1) + Vx_wake_min ) ) + m%vt_tot(j,i-1) = m%vt_amb(j,i-1) + m%vt_shr(j,i-1) + end do + + ! All of the m%a,m%b,m%c,m%d vectors use states at time increment [n] + ! These need to be inside another radial loop because m%dvtdr depends on the j+1 and j-1 indices of m%vt() + + m%dvtdr(0) = 0.0_ReKi + m%a(0) = 0.0_ReKi + m%b(0) = p%dr * ( xd%Vx_wind_disk_filt(i-1) + xd%Vx_wake(0,i-1)) / absdx + m%vt_tot(0,i-1)/p%dr + m%c(0) = -m%vt_tot(0,i-1)/p%dr + m%c(p%NumRadii-1) = 0.0_ReKi + m%d(0) = (p%dr * (xd%Vx_wind_disk_filt(i-1) + xd%Vx_wake(0,i-1)) / absdx - m%vt_tot(0,i-1)/p%dr ) * xd%Vx_wake(0,i-1) + ( m%vt_tot(0,i-1)/p%dr ) * xd%Vx_wake(1,i-1) + + do j = p%NumRadii-1, 1, -1 + + if (j <= p%NumRadii-2) then + m%dvtdr(j) = ( m%vt_tot(j+1,i-1) - m%vt_tot(j-1,i-1) ) / (2_ReKi*p%dr) + m%c(j) = real(j,ReKi)*xd%Vr_wake(j,i-1)/4.0_ReKi - (1_ReKi+2_ReKi*real(j,ReKi))*m%vt_tot(j,i-1)/(4.0_ReKi*p%dr) - real(j,ReKi)*m%dvtdr(j)/4.0_ReKi + m%d(j) = ( real(j,ReKi)*xd%Vr_wake(j,i-1)/4.0_ReKi - (1_ReKi-2_ReKi*real(j,ReKi))*m%vt_tot(j,i-1)/(4.0_ReKi*p%dr) - real(j,ReKi)*m%dvtdr(j)/4.0_ReKi) * xd%Vx_wake(j-1,i-1) & + + ( p%r(j)*( xd%Vx_wind_disk_filt(i-1) + xd%Vx_wake(j,i-1) )/absdx - real(j,ReKi)*m%vt_tot(j,i-1)/p%dr ) * xd%Vx_wake(j,i-1) & + + (-real(j,ReKi)*xd%Vr_wake(j,i-1)/4.0_ReKi + (1_ReKi+2_ReKi*real(j,ReKi))*m%vt_tot(j,i-1)/(4.0_ReKi*p%dr) + real(j,ReKi)*m%dvtdr(j)/4.0_ReKi ) * xd%Vx_wake(j+1,i-1) + + else + m%dvtdr(j) = 0.0_ReKi + m%d(j) = ( real(j,ReKi)*xd%Vr_wake(j,i-1)/4.0_ReKi - (1_ReKi-2_ReKi*real(j,ReKi))*m%vt_tot(j,i-1)/(4.0_ReKi*p%dr) - real(j,ReKi)*m%dvtdr(j)/4.0_ReKi) * xd%Vx_wake(j-1,i-1) & + + ( p%r(j)*( xd%Vx_wind_disk_filt(i-1) + xd%Vx_wake(j,i-1) )/absdx - real(j,ReKi)*m%vt_tot(j,i-1)/p%dr ) * xd%Vx_wake(j,i-1) + + end if + + m%a(j) = -real(j,ReKi)*xd%Vr_wake(j,i-1)/4.0_ReKi + (1.0_ReKi-2.0_ReKi*real(j,ReKi))*m%vt_tot(j,i-1)/(4.0_ReKi*p%dr) + real(j,ReKi)*m%dvtdr(j)/4.0_ReKi + m%b(j) = p%r(j) * ( xd%Vx_wind_disk_filt(i-1) + xd%Vx_wake(j,i-1) ) / absdx + real(j,ReKi)*m%vt_tot(j,i-1)/p%dr + + + end do ! j = 1,p%NumRadii-1 + + ! Update these states to [n+1] + + xd%x_plane (i) = xd%x_plane (i-1) + abs(dx) ! dx = dot_product(xd%xhat_plane(:,i-1),xd%V_plane_filt(:,i-1))*p%DT_low ; don't use absdx here + xd%YawErr_filt (i) = xd%YawErr_filt(i-1) + xd%xhat_plane(:,i) = xd%xhat_plane(:,i-1) + + ! The function state-related arguments must be at time [n+1], so we must update YawErr_filt and xhat_plane before computing the deflection + + dy_HWkDfl = GetYawCorrection(xd%YawErr_filt(i), xd%xhat_plane(:,i), dx, p, errStat2, errMsg2) + call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName) + if (errStat >= AbortErrLev) then + ! TEST: E3 + call Cleanup() + return + end if + xd%p_plane (:,i) = xd%p_plane(:,i-1) + xd%xhat_plane(:,i-1)*dx + dy_HWkDfl & + + ( u%V_plane(:,i-1) - xd%xhat_plane(:,i-1)*dot_product(xd%xhat_plane(:,i-1),u%V_plane(:,i-1)) )*p%DT_low + + xd%Vx_wind_disk_filt(i) = xd%Vx_wind_disk_filt(i-1) + xd%TI_amb_filt (i) = xd%TI_amb_filt(i-1) + xd%D_rotor_filt (i) = xd%D_rotor_filt(i-1) + + ! Update Vx_wake and Vr_wake to [n+1] + if ( EqualRealNos( dx, 0.0_ReKi ) ) then + xd%Vx_wake(:,i) = xd%Vx_wake(:,i-1) + xd%Vr_wake(:,i) = xd%Vr_wake(:,i-1) + else + call ThomasAlgorithm(p%NumRadii, m%a, m%b, m%c, m%d, xd%Vx_wake(:,i), errStat2, errMsg2) + call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName) + if (errStat >= AbortErrLev) then + ! TEST: E16, E17, or E18 + call Cleanup() + return + end if + do j = 1,p%NumRadii-1 + ! NOTE: xd%Vr_wake(0,:) was initialized to 0 and remains 0. + xd%Vr_wake(j,i) = real( j-1,ReKi)*( xd%Vr_wake(j-1,i) )/real(j,ReKi) & + ! Vx_wake is for the [n+1] , [n+1] , [n] , and [n] increments + - real(2*j-1,ReKi)*p%dr * ( xd%Vx_wake(j,i) + xd%Vx_wake(j-1,i) - xd%Vx_wake(j,i-1) - xd%Vx_wake(j-1,i-1) ) / ( real(4*j,ReKi) * absdx ) + end do + end if + end do ! i = 1,min(n+2,p%NumPlanes-1) + + + + ! Update states at disk-plane to [n+1] + + xd%xhat_plane (:,0) = xd%xhat_plane(:,0)*p%filtParam + u%xhat_disk(:)*p%oneMinusFiltParam ! 2-step calculation for xhat_plane at disk + norm2_xhat_plane = TwoNorm( xd%xhat_plane(:,0) ) + if ( EqualRealNos(norm2_xhat_plane, 0.0_ReKi) ) then + ! TEST: E1 + call SetErrStat(ErrID_FATAL, 'The nacelle-yaw has rotated 180 degrees between time steps, i.e., the L2 norm of xd%xhat_plane(:,0)*p%filtParam + u%xhat_disk(:)*(1-p%filtParam) is zero.', errStat, errMsg, RoutineName) + call Cleanup() + return + end if + + xd%xhat_plane (:,0) = xd%xhat_plane(:,0) / norm2_xhat_plane + + xd%YawErr_filt (0) = xd%YawErr_filt(0)*p%filtParam + u%YawErr*p%oneMinusFiltParam + + if ( EqualRealNos(abs(xd%YawErr_filt(0)), pi/2) .or. abs(xd%YawErr_filt(0)) > pi/2 ) then + ! TEST: E4 + call SetErrStat(ErrID_FATAL, 'The time-filtered nacelle-yaw error has reached +/- pi/2.', errStat, errMsg, RoutineName) + call Cleanup() + return + end if + + ! The function state-related arguments must be at time [n+1], so we must update YawErr_filt and xhat_plane before computing the deflection + dx = 0.0_ReKi + dy_HWkDfl = GetYawCorrection(xd%YawErr_filt(0), xd%xhat_plane(:,0), dx, p, errStat2, errMsg2) + call SetErrStat(ErrStat2, ErrMsg2, errStat, errMsg, RoutineName) + if (errStat /= ErrID_None) then + ! TEST: E3 + call Cleanup() + return + end if + + ! NOTE: xd%x_plane(0) was already initialized to zero + + xd%p_plane (:,0) = xd%p_plane(:,0)*p%filtParam + ( u%p_hub(:) + dy_HWkDfl(:) )*p%oneMinusFiltParam + xd%Vx_wind_disk_filt(0) = xd%Vx_wind_disk_filt(0)*p%filtParam + u%Vx_wind_disk*p%oneMinusFiltParam + xd%TI_amb_filt (0) = xd%TI_amb_filt(0)*p%filtParam + u%TI_amb*p%oneMinusFiltParam + xd%D_rotor_filt (0) = xd%D_rotor_filt(0)*p%filtParam + u%D_rotor*p%oneMinusFiltParam + xd%Vx_rel_disk_filt = xd%Vx_rel_disk_filt*p%filtParam + u%Vx_rel_disk*p%oneMinusFiltParam + + + ! filtered, azimuthally-averaged Ct values at each radial station + xd%Ct_azavg_filt (:) = xd%Ct_azavg_filt(:)*p%filtParam + u%Ct_azavg(:)*p%oneMinusFiltParam + + call NearWakeCorrection( xd%Ct_azavg_filt, xd%Vx_rel_disk_filt, p, m, xd%Vx_wake(:,0), xd%D_rotor_filt(0), errStat, errMsg ) + + !Used for debugging: write(51,'(I5,100(1x,ES10.2E2))') n, xd%x_plane(n), xd%x_plane(n)/xd%D_rotor_filt(n), xd%Vx_wind_disk_filt(n) + xd%Vx_wake(:,n), xd%Vr_wake(:,n) + + call Cleanup() + +contains + subroutine Cleanup() + + + + end subroutine Cleanup + +end subroutine WD_UpdateStates +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing outputs, used in both loose and tight coupling. +!! This subroutine is used to compute the output channels (motions and loads) and place them in the WriteOutput() array. +!! The descriptions of the output channels are not given here. Please see the included OutListParameters.xlsx sheet for +!! for a complete description of each output parameter. +subroutine WD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, errStat, errMsg ) +! NOTE: no matter how many channels are selected for output, all of the outputs are calcalated +! All of the calculated output channels are placed into the m%AllOuts(:), while the channels selected for outputs are +! placed in the y%WriteOutput(:) array. +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + TYPE(WD_InputType), INTENT(IN ) :: u !< Inputs at Time t + TYPE(WD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(WD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at t + TYPE(WD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(WD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t + TYPE(WD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at t + TYPE(WD_OutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- + !! nectivity information does not have to be recalculated) + type(WD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + INTEGER(IntKi), INTENT( OUT) :: errStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: errMsg !< Error message if errStat /= ErrID_None + + + integer, parameter :: indx = 1 + integer(intKi) :: n, i + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'WD_CalcOutput' + real(ReKi) :: correction(3) + errStat = ErrID_None + errMsg = "" + + n = nint(t/p%DT_low) + + ! Check if we are fully initialized + if ( OtherState%firstPass ) then + + correction = 0.0_ReKi + do i = 0, 1 + y%x_plane(i) = u%Vx_rel_disk*real(i,ReKi)*real(p%DT_low,ReKi) + + correction = correction + GetYawCorrection(u%YawErr, u%xhat_disk, y%x_plane(i), p, errStat2, errMsg2) + call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName) + if (errStat >= AbortErrLev) then + ! TEST: E3 + return + end if + + y%p_plane (:,i) = u%p_hub(:) + y%x_plane(i)*u%xhat_disk(:) + correction + y%xhat_plane(:,i) = u%xhat_disk(:) + + + ! NOTE: Since we are in firstPass=T, then xd%Vx_wake is already set to zero, so just pass that into WakeDiam + y%D_wake(i) = WakeDiam( p%Mod_WakeDiam, p%NumRadii, p%dr, p%r, xd%Vx_wake(:,i), u%Vx_wind_disk, u%D_rotor, p%C_WakeDiam) + end do + + ! Initialze Vx_wake; Vr_wake is already initialized to zero, so, we don't need to do that here. + call NearWakeCorrection( u%Ct_azavg, u%Vx_rel_disk, p, m, y%Vx_wake(:,0), u%D_rotor, errStat, errMsg ) + if (errStat > AbortErrLev) return + y%Vx_wake(:,1) = y%Vx_wake(:,0) + + return + + else + y%x_plane = xd%x_plane + y%p_plane = xd%p_plane + y%xhat_plane = xd%xhat_plane + y%Vx_wake = xd%Vx_wake + y%Vr_wake = xd%Vr_wake + do i = 0, min(n+1,p%NumPlanes-1) + + y%D_wake(i) = WakeDiam( p%Mod_WakeDiam, p%NumRadii, p%dr, p%r, xd%Vx_wake(:,i), xd%Vx_wind_disk_filt(i), xd%D_rotor_filt(i), p%C_WakeDiam) + + end do + end if + +end subroutine WD_CalcOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Tight coupling routine for solving for the residual of the constraint state equations +subroutine WD_CalcConstrStateResidual( Time, u, p, x, xd, z, OtherState, m, z_residual, errStat, errMsg ) +!.................................................................................................................................. + + REAL(DbKi), INTENT(IN ) :: Time !< Current simulation time in seconds + TYPE(WD_InputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(WD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(WD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time + TYPE(WD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at Time + TYPE(WD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at Time (possibly a guess) + TYPE(WD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at Time + TYPE(WD_MiscVarType), INTENT(INOUT) :: m !< Misc/optimization variables + TYPE(WD_ConstraintStateType), INTENT(INOUT) :: Z_residual !< Residual of the constraint state equations using + !! the input values described above + INTEGER(IntKi), INTENT( OUT) :: errStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: errMsg !< Error message if errStat /= ErrID_None + + + + ! Local variables + integer, parameter :: indx = 1 + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + character(*), parameter :: RoutineName = 'WD_CalcConstrStateResidual' + + + + errStat = ErrID_None + errMsg = "" + + + + +end subroutine WD_CalcConstrStateResidual + +subroutine InitStatesWithInputs(numPlanes, numRadii, u, p, xd, m, errStat, errMsg) + + integer(IntKi), intent(in ) :: numPlanes + integer(IntKi), intent(in ) :: numRadii + TYPE(WD_InputType), intent(in ) :: u !< Inputs at Time + TYPE(WD_ParameterType), intent(in ) :: p !< Parameters + TYPE(WD_DiscreteStateType), intent(inout) :: xd !< Discrete states at Time + type(WD_MiscVarType), intent(inout) :: m !< Misc/optimization variables + INTEGER(IntKi), intent( out) :: errStat !< Error status of the operation + CHARACTER(*), intent( out) :: errMsg !< Error message if errStat /= ErrID_None + character(*), parameter :: RoutineName = 'InitStatesWithInputs' + integer(IntKi) :: i + integer(intKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + real(ReKi) :: correction(3) + ! Note, all of these states will have been set to zero in the WD_Init routine + + + ErrStat = ErrID_None + ErrMsg = "" + + + correction = 0.0_ReKi + do i = 0, 1 + xd%x_plane (i) = u%Vx_rel_disk*real(i,ReKi)*real(p%DT_low,ReKi) + xd%YawErr_filt (i) = u%YawErr + + correction = correction + GetYawCorrection(u%YawErr, u%xhat_disk, xd%x_plane(i), p, errStat2, errMsg2) + call SetErrStat(errStat2, errMsg2, errStat, errMsg, RoutineName) + if (errStat >= AbortErrLev) then + ! TEST: E3 + return + end if + + !correction = ( p%C_HWkDfl_x + p%C_HWkDfl_xY*u%YawErr )*xd%x_plane(i) + correctionA + + xd%p_plane (:,i) = u%p_hub(:) + xd%x_plane(i)*u%xhat_disk(:) + correction + xd%xhat_plane(:,i) = u%xhat_disk(:) + xd%V_plane_filt(:,i) = u%V_plane(:,i) + xd%Vx_wind_disk_filt(i) = u%Vx_wind_disk + xd%TI_amb_filt (i) = u%TI_amb + xd%D_rotor_filt (i) = u%D_rotor + + + end do + + xd%Vx_rel_disk_filt = u%Vx_rel_disk + + ! Initialze Ct_azavg_filt and Vx_wake; Vr_wake is already initialized to zero, so, we don't need to do that here. + xd%Ct_azavg_filt (:) = u%Ct_azavg(:) + + call NearWakeCorrection( xd%Ct_azavg_filt, xd%Vx_rel_disk_filt, p, m, xd%Vx_wake(:,0), xd%D_rotor_filt(0), errStat, errMsg ) + xd%Vx_wake(:,1) = xd%Vx_wake(:,0) + +end subroutine InitStatesWithInputs + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine validates the inputs from the WakeDynamics input files. +SUBROUTINE ValidateInitInputData( DT_low, InitInp, InputFileData, errStat, errMsg ) +!.................................................................................................................................. + + ! Passed variables: + real(DbKi), intent(in ) :: DT_low !< requested simulation time step size (s) + type(WD_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(WD_InputFileType), intent(in) :: InputFileData !< All the data in the WakeDynamics input file + integer(IntKi), intent(out) :: errStat !< Error status + character(*), intent(out) :: errMsg !< Error message + + + ! local variables + integer(IntKi) :: k ! Blade number + integer(IntKi) :: j ! node number + character(*), parameter :: RoutineName = 'ValidateInitInputData' + + errStat = ErrID_None + errMsg = "" + + + ! TODO: Talk to Bonnie about whether we want to convert <= or >= checks to EqualRealNos() .or. > checks, etc. GJH + ! TEST: E13, + !if (NumBl > MaxBl .or. NumBl < 1) call SetErrStat( ErrID_Fatal, 'Number of blades must be between 1 and '//trim(num2lstr(MaxBl))//'.', ErrSTat, errMsg, RoutineName ) + if ( DT_low <= 0.0) call SetErrStat ( ErrID_Fatal, 'DT_low must be greater than zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%NumPlanes < 2 ) call SetErrStat ( ErrID_Fatal, 'Number of wake planes must be greater than one.', ErrSTat, errMsg, RoutineName ) + if ( InputFileData%NumRadii < 2 ) call SetErrStat ( ErrID_Fatal, 'Number of radii in the radial finite-difference grid must be greater than one.', ErrSTat, errMsg, RoutineName ) + if ( InputFileData%dr <= 0.0) call SetErrStat ( ErrID_Fatal, 'dr must be greater than zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%f_c <= 0.0) call SetErrStat ( ErrID_Fatal, 'f_c must be greater than or equal to zero.', errStat, errMsg, RoutineName ) + if ( (InputFileData%C_NearWake <= 1.0) .or. (InputFileData%C_NearWake >= 2.5)) call SetErrStat ( ErrID_Fatal, 'C_NearWake must be greater than 1.0 and less than 2.5.', errStat, errMsg, RoutineName ) + if ( InputFileData%k_vAmb < 0.0) call SetErrStat ( ErrID_Fatal, 'k_vAmb must be greater than or equal to zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%k_vShr < 0.0) call SetErrStat ( ErrID_Fatal, 'k_vShr must be greater than or equal to zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vAmb_DMin < 0.0) call SetErrStat ( ErrID_Fatal, 'C_vAmb_DMin must be greater than or equal to zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vAmb_DMax <= InputFileData%C_vAmb_DMin) call SetErrStat ( ErrID_Fatal, 'C_vAmb_DMax must be greater than C_vAmb_DMin.', errStat, errMsg, RoutineName ) + if ( (InputFileData%C_vAmb_FMin < 0.0) .or. (InputFileData%C_vAmb_FMin > 1.0) ) call SetErrStat ( ErrID_Fatal, 'C_vAmb_FMin must be greater than or equal to zero and less than or equal to 1.0.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vAmb_Exp <= 0.0) call SetErrStat ( ErrID_Fatal, 'C_vAmb_Exp must be greater than zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vShr_DMin < 0.0) call SetErrStat ( ErrID_Fatal, 'C_vShr_DMin must be greater than or equal to zero.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vShr_DMax <= InputFileData%C_vShr_DMin) call SetErrStat ( ErrID_Fatal, 'C_vShr_DMax must be greater than C_vShr_DMin.', errStat, errMsg, RoutineName ) + if ( (InputFileData%C_vShr_FMin < 0.0) .or. (InputFileData%C_vShr_FMin > 1.0) ) call SetErrStat ( ErrID_Fatal, 'C_vShr_FMin must be greater than or equal to zero and less than or equal to 1.0.', errStat, errMsg, RoutineName ) + if ( InputFileData%C_vShr_Exp <= 0.0) call SetErrStat ( ErrID_Fatal, 'C_vShr_Exp must be greater than zero.', errStat, errMsg, RoutineName ) + if (.not. ((InputFileData%Mod_WakeDiam == 1) .or. (InputFileData%Mod_WakeDiam == 2) .or. (InputFileData%Mod_WakeDiam == 3) .or. (InputFileData%Mod_WakeDiam == 4)) ) call SetErrStat ( ErrID_Fatal, 'Mod_WakeDiam must be equal to 1, 2, 3, or 4.', errStat, errMsg, RoutineName ) + if ( (.not. (InputFileData%Mod_WakeDiam == 1)) .and.( (InputFileData%C_WakeDiam <= 0.0) .or. (InputFileData%C_WakeDiam >= 1.0)) ) call SetErrStat ( ErrID_Fatal, 'When Mod_WakeDiam is not equal to 1, then C_WakeDiam must be greater than zero and less than 1.0.', errStat, errMsg, RoutineName ) + +END SUBROUTINE ValidateInitInputData + +end module WakeDynamics diff --git a/modules/wakedynamics/src/WakeDynamics_Registry.txt b/modules/wakedynamics/src/WakeDynamics_Registry.txt new file mode 100644 index 0000000000..e5e3b7831f --- /dev/null +++ b/modules/wakedynamics/src/WakeDynamics_Registry.txt @@ -0,0 +1,149 @@ +################################################################################################################################### +# Registry for FAST.Farm's WakeDynamics module in the FAST Modularization Framework +# This Registry file is used to create MODULE WakeDynamics_Types, which contains all of the user-defined types needed in WakeDynamics. +# It also contains copy, destroy, pack, and unpack routines associated with each defined data types. +# +# Entries are of the form +# keyword +# +# Use ^ as a shortcut for the value from the previous line. +# See NWTC Programmer's Handbook at https://nwtc.nrel.gov/FAST-Developers for further information on the format/contents of this file. +################################################################################################################################### + +# ...... Include files (definitions from NWTC Library) ............................................................................ +include Registry_NWTC_Library.txt + +# ..... Constants ....................................................................................................... +param WakeDynamics/WD - INTEGER WakeDiamMod_RotDiam - 1 - "Wake diameter calculation model: rotor diameter" - +param ^ - INTEGER WakeDiamMod_Velocity - 2 - "Wake diameter calculation model: velocity-based" - +param ^ - INTEGER WakeDiamMod_MassFlux - 3 - "Wake diameter calculation model: mass-flux based" - +param ^ - INTEGER WakeDiamMod_MtmFlux - 4 - "Wake diameter calculation model: momentum-flux based" - + +# ..... InputFile Data ....................................................................................................... +typedef ^ WD_InputFileType ReKi dr - - - "Radial increment of radial finite-difference grid [>0.0]" m +typedef ^ WD_InputFileType IntKi NumRadii - - - "Number of radii in the radial finite-difference grid [>=2]" - +typedef ^ WD_InputFileType IntKi NumPlanes - - - "Number of wake planes [>=2]" - +typedef ^ WD_InputFileType ReKi f_c - - - "Cut-off frequency of the low-pass time-filter for the wake advection, deflection, and meandering model [>0.0]" Hz +typedef ^ WD_InputFileType ReKi C_HWkDfl_O - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor" m +typedef ^ WD_InputFileType ReKi C_HWkDfl_OY - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error" m/rad +typedef ^ WD_InputFileType ReKi C_HWkDfl_x - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance" - +typedef ^ WD_InputFileType ReKi C_HWkDfl_xY - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error" 1/rad +typedef ^ WD_InputFileType ReKi C_NearWake - - - "Calibrated parameter for the near-wake correction [>-1.0]" - +typedef ^ WD_InputFileType ReKi k_vAmb - - - "Calibrated parameter for the influence of ambient turbulence in the eddy viscosity [>=0.0]" - +typedef ^ WD_InputFileType ReKi k_vShr - - - "Calibrated parameter for the influence of the shear layer in the eddy viscosity [>=0.0]" - +typedef ^ WD_InputFileType ReKi C_vAmb_DMin - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions [>=0.0 ]" - +typedef ^ WD_InputFileType ReKi C_vAmb_DMax - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions [> C_vAmb_DMin]" - +typedef ^ WD_InputFileType ReKi C_vAmb_FMin - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region [>=0.0 and <=1.0]" - +typedef ^ WD_InputFileType ReKi C_vAmb_Exp - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region [> 0.0]" - +typedef ^ WD_InputFileType ReKi C_vShr_DMin - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions [>=0.0]" - +typedef ^ WD_InputFileType ReKi C_vShr_DMax - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions [> C_vShr_DMin]" - +typedef ^ WD_InputFileType ReKi C_vShr_FMin - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the value in the minimum region [>=0.0 and <=1.0]" - +typedef ^ WD_InputFileType ReKi C_vShr_Exp - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region [> 0.0]" - +typedef ^ WD_InputFileType IntKi Mod_WakeDiam - - - "Wake diameter calculation model {1: rotor diameter, 2: velocity-based, 3: mass-flux based, 4: momentum-flux based} [DEFAULT=1]" - +typedef ^ WD_InputFileType ReKi C_WakeDiam - - - "Calibrated parameter for wake diameter calculation [>0.0 and <1.0] [unused for Mod_WakeDiam=1]" - + + +# ..... Initialization data ....................................................................................................... +# Define inputs that the initialization routine may need here: +# e.g., the name of the input file, the file root name, etc. +typedef ^ InitInputType WD_InputFileType InputFileData - - - "FAST.Farm input-file data for wake dynamics" - +typedef ^ InitInputType IntKi TurbNum - 0 - "Turbine ID number (start with 1; end with number of turbines)" - + + +# Define outputs from the initialization routine here: +typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - +typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:} - - "Units of the output-to-file channels" - +typedef ^ InitOutputType ProgDesc Ver - - - "This module's name, version, and date" - + + +# ..... States .................................................................................................................... +# Define continuous (differentiable) states here: +typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - + +# Define discrete (nondifferentiable) states here: +typedef ^ DiscreteStateType ReKi xhat_plane {:}{:} - - "Orientations of wake planes, normal to wake planes" - +typedef ^ DiscreteStateType ReKi p_plane {:}{:} - - "Center positions of wake planes" m +typedef ^ DiscreteStateType ReKi x_plane {:} - - "Downwind distance from rotor to each wake plane" m +typedef ^ DiscreteStateType ReKi Vx_wake {:}{:} - - "Axial wake velocity deficit at wake planes, distributed radially" m/s +typedef ^ DiscreteStateType ReKi Vr_wake {:}{:} - - "Radial wake velocity deficit at wake planes, distributed radially" m/s +typedef ^ DiscreteStateType ReKi V_plane_filt {:}{:} - - "Time-filtered advection, deflection, and meandering velocity of wake planes" m/s +typedef ^ DiscreteStateType ReKi Vx_wind_disk_filt {:} - - "Time-filtered rotor-disk-averaged ambient wind speed of wake planes, normal to planes" m/s +typedef ^ DiscreteStateType ReKi TI_amb_filt {:} - - "Time-filtered ambient turbulence intensity of wind at wake planes" - +typedef ^ DiscreteStateType ReKi D_rotor_filt {:} - - "Time-filtered rotor diameter associated with each wake plane" m +typedef ^ DiscreteStateType ReKi Vx_rel_disk_filt - - - "Time-filtered rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk" m/s +typedef ^ DiscreteStateType ReKi Ct_azavg_filt {:} - - "Time-filtered azimuthally averaged thrust force coefficient (normal to disk), distributed radially" - +typedef ^ DiscreteStateType ReKi YawErr_filt {:} - - "Time-filtered nacelle-yaw error at the wake planes" rad + +# Define constraint states here: +typedef ^ ConstraintStateType ReKi DummyConstrState - - - "Remove this variable if you have constraint states" - + +# Define any other states, including integer or logical states here: +typedef ^ OtherStateType LOGICAL firstPass - - - "Flag indicating whether or not the states have been initialized with proper inputs" - + +# ..... Misc/Optimization variables................................................................................................. +# Define any data that are used only for efficiency purposes (these variables are not associated with time): +# e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc. +typedef ^ MiscVarType ReKi dvdr {:} - - "" +typedef ^ MiscVarType ReKi dvtdr {:} - - "" +typedef ^ MiscVarType ReKi vt_tot {:}{:} - - "" +typedef ^ MiscVarType ReKi vt_amb {:}{:} - - "" +typedef ^ MiscVarType ReKi vt_shr {:}{:} - - "" +typedef ^ MiscVarType ReKi a {:} - - "" +typedef ^ MiscVarType ReKi b {:} - - "" +typedef ^ MiscVarType ReKi c {:} - - "" +typedef ^ MiscVarType ReKi d {:} - - "" +typedef ^ MiscVarType ReKi r_wake {:} - - "" +typedef ^ MiscVarType ReKi Vx_high {:} - - "" + + +# ..... Parameters ................................................................................................................ +# Define parameters here: +# Time step for integration of continuous states (if a fixed-step integrator is used) and update of discrete states: +typedef ^ ParameterType DbKi dt_low - - - "Time interval for wake dynamics calculations {or default}" s +#typedef ^ ParameterType DbKi tmax - - - "Total run time" seconds +typedef ^ ParameterType IntKi NumPlanes - - - "Number of wake planes" - +typedef ^ ParameterType IntKi NumRadii - - - "Number of radii in the radial finite-difference grid" - +typedef ^ ParameterType ReKi dr - - - "Radial increment of radial finite-difference grid" m +typedef ^ ParameterType ReKi r {:} - - "Discretization of radial finite-difference grid" m +typedef ^ ParameterType ReKi filtParam - - - "Low-pass time-filter parameter, with a value between 0 (minimum filtering) and 1 (maximum filtering) (exclusive)" - +typedef ^ ParameterType ReKi oneMinusFiltParam - - - "1.0 - filtParam" - +typedef ^ ParameterType ReKi C_HWkDfl_O - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor" m +typedef ^ ParameterType ReKi C_HWkDfl_OY - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error" m/rad +typedef ^ ParameterType ReKi C_HWkDfl_x - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance" - +typedef ^ ParameterType ReKi C_HWkDfl_xY - - - "Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error" 1/rad +typedef ^ ParameterType ReKi C_NearWake - - - "Calibrated parameter for near-wake correction" - +typedef ^ ParameterType ReKi C_vAmb_DMin - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions" - +typedef ^ ParameterType ReKi C_vAmb_DMax - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions" - +typedef ^ ParameterType ReKi C_vAmb_FMin - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the functional value in the minimum region" - +typedef ^ ParameterType ReKi C_vAmb_Exp - - - "Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region" - +typedef ^ ParameterType ReKi C_vShr_DMin - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions" - +typedef ^ ParameterType ReKi C_vShr_DMax - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions" - +typedef ^ ParameterType ReKi C_vShr_FMin - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the functional value in the minimum region" - +typedef ^ ParameterType ReKi C_vShr_Exp - - - "Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region" - +typedef ^ ParameterType ReKi k_vAmb - - - "Calibrated parameter for the influence of ambient turbulence in the eddy viscosity" - +typedef ^ ParameterType ReKi k_vShr - - - "Calibrated parameter for the influence of the shear layer in the eddy viscosity" - +typedef ^ ParameterType IntKi Mod_WakeDiam - - - "Wake diameter calculation model" - +typedef ^ ParameterType ReKi C_WakeDiam - - - "Calibrated parameter for wake diameter calculation" - + +# ..... Inputs .................................................................................................................... +# Define inputs that are contained on the mesh here: +typedef ^ InputType ReKi xhat_disk {3} - - "Orientation of rotor centerline, normal to disk" - +typedef ^ InputType ReKi p_hub {3} - - "Center position of hub" m +typedef ^ InputType ReKi V_plane {:}{:} - - "Advection, deflection, and meandering velocity of wake planes" m/s +typedef ^ InputType ReKi Vx_wind_disk - - - "Rotor-disk-averaged ambient wind speed, normal to planes" m/s +typedef ^ InputType ReKi TI_amb - - - "Ambient turbulence intensity of wind at rotor disk" - +typedef ^ InputType ReKi D_rotor - - - "Rotor diameter" m +typedef ^ InputType ReKi Vx_rel_disk - - - "Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk" m/s +typedef ^ InputType ReKi Ct_azavg {:} - - "Azimuthally averaged thrust force coefficient (normal to disk), distributed radially" - +typedef ^ InputType ReKi YawErr - - - "Nacelle-yaw error at the wake planes" rad + + +# ..... Outputs ................................................................................................................... +# Define outputs that are contained on the mesh here: +typedef ^ OutputType ReKi xhat_plane {:}{:} - - "Orientations of wake planes, normal to wake planes" - +typedef ^ OutputType ReKi p_plane {:}{:} - - "Center positions of wake planes" m +typedef ^ OutputType ReKi Vx_wake {:}{:} - - "Axial wake velocity deficit at wake planes, distributed radially" m/s +typedef ^ OutputType ReKi Vr_wake {:}{:} - - "Radial wake velocity deficit at wake planes, distributed radially" m/s +typedef ^ OutputType ReKi D_wake {:} - - "Wake diameters at wake planes" m +typedef ^ OutputType ReKi x_plane {:} - - "Downwind distance from rotor to each wake plane" m + diff --git a/modules/wakedynamics/src/WakeDynamics_Types.f90 b/modules/wakedynamics/src/WakeDynamics_Types.f90 new file mode 100644 index 0000000000..b5a9c60fe2 --- /dev/null +++ b/modules/wakedynamics/src/WakeDynamics_Types.f90 @@ -0,0 +1,3951 @@ +!STARTOFREGISTRYGENERATEDFILE 'WakeDynamics_Types.f90' +! +! WARNING This file is generated automatically by the FAST registry. +! Do not edit. Your changes to this file will be lost. +! +! FAST Registry +!********************************************************************************************************************************* +! WakeDynamics_Types +!................................................................................................................................. +! This file is part of WakeDynamics. +! +! Copyright (C) 2012-2016 National Renewable Energy Laboratory +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +! +! W A R N I N G : This file was automatically generated from the FAST registry. Changes made to this file may be lost. +! +!********************************************************************************************************************************* +!> This module contains the user-defined types needed in WakeDynamics. It also contains copy, destroy, pack, and +!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry. +MODULE WakeDynamics_Types +!--------------------------------------------------------------------------------------------------------------------------------- +USE NWTC_Library +IMPLICIT NONE + INTEGER(IntKi), PUBLIC, PARAMETER :: WakeDiamMod_RotDiam = 1 ! Wake diameter calculation model: rotor diameter [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: WakeDiamMod_Velocity = 2 ! Wake diameter calculation model: velocity-based [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: WakeDiamMod_MassFlux = 3 ! Wake diameter calculation model: mass-flux based [-] + INTEGER(IntKi), PUBLIC, PARAMETER :: WakeDiamMod_MtmFlux = 4 ! Wake diameter calculation model: momentum-flux based [-] +! ========= WD_InputFileType ======= + TYPE, PUBLIC :: WD_InputFileType + REAL(ReKi) :: dr !< Radial increment of radial finite-difference grid [>0.0] [m] + INTEGER(IntKi) :: NumRadii !< Number of radii in the radial finite-difference grid [>=2] [-] + INTEGER(IntKi) :: NumPlanes !< Number of wake planes [>=2] [-] + REAL(ReKi) :: f_c !< Cut-off frequency of the low-pass time-filter for the wake advection, deflection, and meandering model [>0.0] [Hz] + REAL(ReKi) :: C_HWkDfl_O !< Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor [m] + REAL(ReKi) :: C_HWkDfl_OY !< Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error [m/rad] + REAL(ReKi) :: C_HWkDfl_x !< Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance [-] + REAL(ReKi) :: C_HWkDfl_xY !< Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error [1/rad] + REAL(ReKi) :: C_NearWake !< Calibrated parameter for the near-wake correction [>-1.0] [-] + REAL(ReKi) :: k_vAmb !< Calibrated parameter for the influence of ambient turbulence in the eddy viscosity [>=0.0] [-] + REAL(ReKi) :: k_vShr !< Calibrated parameter for the influence of the shear layer in the eddy viscosity [>=0.0] [-] + REAL(ReKi) :: C_vAmb_DMin !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions [>=0.0 ] [-] + REAL(ReKi) :: C_vAmb_DMax !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions [> C_vAmb_DMin] [-] + REAL(ReKi) :: C_vAmb_FMin !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the value in the minimum region [>=0.0 and <=1.0] [-] + REAL(ReKi) :: C_vAmb_Exp !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region [> 0.0] [-] + REAL(ReKi) :: C_vShr_DMin !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions [>=0.0] [-] + REAL(ReKi) :: C_vShr_DMax !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions [> C_vShr_DMin] [-] + REAL(ReKi) :: C_vShr_FMin !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the value in the minimum region [>=0.0 and <=1.0] [-] + REAL(ReKi) :: C_vShr_Exp !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region [> 0.0] [-] + INTEGER(IntKi) :: Mod_WakeDiam !< Wake diameter calculation model {1: rotor diameter, 2: velocity-based, 3: mass-flux based, 4: momentum-flux based} [DEFAULT=1] [-] + REAL(ReKi) :: C_WakeDiam !< Calibrated parameter for wake diameter calculation [>0.0 and <1.0] [unused for Mod_WakeDiam=1] [-] + END TYPE WD_InputFileType +! ======================= +! ========= WD_InitInputType ======= + TYPE, PUBLIC :: WD_InitInputType + TYPE(WD_InputFileType) :: InputFileData !< FAST.Farm input-file data for wake dynamics [-] + INTEGER(IntKi) :: TurbNum = 0 !< Turbine ID number (start with 1; end with number of turbines) [-] + END TYPE WD_InitInputType +! ======================= +! ========= WD_InitOutputType ======= + TYPE, PUBLIC :: WD_InitOutputType + CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputHdr !< Names of the output-to-file channels [-] + CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: WriteOutputUnt !< Units of the output-to-file channels [-] + TYPE(ProgDesc) :: Ver !< This module's name, version, and date [-] + END TYPE WD_InitOutputType +! ======================= +! ========= WD_ContinuousStateType ======= + TYPE, PUBLIC :: WD_ContinuousStateType + REAL(ReKi) :: DummyContState !< Remove this variable if you have continuous states [-] + END TYPE WD_ContinuousStateType +! ======================= +! ========= WD_DiscreteStateType ======= + TYPE, PUBLIC :: WD_DiscreteStateType + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: xhat_plane !< Orientations of wake planes, normal to wake planes [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: p_plane !< Center positions of wake planes [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: x_plane !< Downwind distance from rotor to each wake plane [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Vx_wake !< Axial wake velocity deficit at wake planes, distributed radially [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Vr_wake !< Radial wake velocity deficit at wake planes, distributed radially [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: V_plane_filt !< Time-filtered advection, deflection, and meandering velocity of wake planes [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Vx_wind_disk_filt !< Time-filtered rotor-disk-averaged ambient wind speed of wake planes, normal to planes [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TI_amb_filt !< Time-filtered ambient turbulence intensity of wind at wake planes [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: D_rotor_filt !< Time-filtered rotor diameter associated with each wake plane [m] + REAL(ReKi) :: Vx_rel_disk_filt !< Time-filtered rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Ct_azavg_filt !< Time-filtered azimuthally averaged thrust force coefficient (normal to disk), distributed radially [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: YawErr_filt !< Time-filtered nacelle-yaw error at the wake planes [rad] + END TYPE WD_DiscreteStateType +! ======================= +! ========= WD_ConstraintStateType ======= + TYPE, PUBLIC :: WD_ConstraintStateType + REAL(ReKi) :: DummyConstrState !< Remove this variable if you have constraint states [-] + END TYPE WD_ConstraintStateType +! ======================= +! ========= WD_OtherStateType ======= + TYPE, PUBLIC :: WD_OtherStateType + LOGICAL :: firstPass !< Flag indicating whether or not the states have been initialized with proper inputs [-] + END TYPE WD_OtherStateType +! ======================= +! ========= WD_MiscVarType ======= + TYPE, PUBLIC :: WD_MiscVarType + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dvdr !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: dvtdr !< [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: vt_tot !< [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: vt_amb !< [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: vt_shr !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: a !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: b !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: c !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: d !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: r_wake !< [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Vx_high !< [-] + END TYPE WD_MiscVarType +! ======================= +! ========= WD_ParameterType ======= + TYPE, PUBLIC :: WD_ParameterType + REAL(DbKi) :: dt_low !< Time interval for wake dynamics calculations {or default} [s] + INTEGER(IntKi) :: NumPlanes !< Number of wake planes [-] + INTEGER(IntKi) :: NumRadii !< Number of radii in the radial finite-difference grid [-] + REAL(ReKi) :: dr !< Radial increment of radial finite-difference grid [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: r !< Discretization of radial finite-difference grid [m] + REAL(ReKi) :: filtParam !< Low-pass time-filter parameter, with a value between 0 (minimum filtering) and 1 (maximum filtering) (exclusive) [-] + REAL(ReKi) :: oneMinusFiltParam !< 1.0 - filtParam [-] + REAL(ReKi) :: C_HWkDfl_O !< Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor [m] + REAL(ReKi) :: C_HWkDfl_OY !< Calibrated parameter in the correction for wake deflection defining the horizontal offset at the rotor scaled with yaw error [m/rad] + REAL(ReKi) :: C_HWkDfl_x !< Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance [-] + REAL(ReKi) :: C_HWkDfl_xY !< Calibrated parameter in the correction for wake deflection defining the horizontal offset scaled with downstream distance and yaw error [1/rad] + REAL(ReKi) :: C_NearWake !< Calibrated parameter for near-wake correction [-] + REAL(ReKi) :: C_vAmb_DMin !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the minimum and exponential regions [-] + REAL(ReKi) :: C_vAmb_DMax !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the transitional diameter fraction between the exponential and maximum regions [-] + REAL(ReKi) :: C_vAmb_FMin !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the functional value in the minimum region [-] + REAL(ReKi) :: C_vAmb_Exp !< Calibrated parameter in the eddy viscosity filter function for ambient turbulence defining the exponent in the exponential region [-] + REAL(ReKi) :: C_vShr_DMin !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the minimum and exponential regions [-] + REAL(ReKi) :: C_vShr_DMax !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the transitional diameter fraction between the exponential and maximum regions [-] + REAL(ReKi) :: C_vShr_FMin !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the functional value in the minimum region [-] + REAL(ReKi) :: C_vShr_Exp !< Calibrated parameter in the eddy viscosity filter function for the shear layer defining the exponent in the exponential region [-] + REAL(ReKi) :: k_vAmb !< Calibrated parameter for the influence of ambient turbulence in the eddy viscosity [-] + REAL(ReKi) :: k_vShr !< Calibrated parameter for the influence of the shear layer in the eddy viscosity [-] + INTEGER(IntKi) :: Mod_WakeDiam !< Wake diameter calculation model [-] + REAL(ReKi) :: C_WakeDiam !< Calibrated parameter for wake diameter calculation [-] + END TYPE WD_ParameterType +! ======================= +! ========= WD_InputType ======= + TYPE, PUBLIC :: WD_InputType + REAL(ReKi) , DIMENSION(1:3) :: xhat_disk !< Orientation of rotor centerline, normal to disk [-] + REAL(ReKi) , DIMENSION(1:3) :: p_hub !< Center position of hub [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: V_plane !< Advection, deflection, and meandering velocity of wake planes [m/s] + REAL(ReKi) :: Vx_wind_disk !< Rotor-disk-averaged ambient wind speed, normal to planes [m/s] + REAL(ReKi) :: TI_amb !< Ambient turbulence intensity of wind at rotor disk [-] + REAL(ReKi) :: D_rotor !< Rotor diameter [m] + REAL(ReKi) :: Vx_rel_disk !< Rotor-disk-averaged relative wind speed (ambient + deficits + motion), normal to disk [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: Ct_azavg !< Azimuthally averaged thrust force coefficient (normal to disk), distributed radially [-] + REAL(ReKi) :: YawErr !< Nacelle-yaw error at the wake planes [rad] + END TYPE WD_InputType +! ======================= +! ========= WD_OutputType ======= + TYPE, PUBLIC :: WD_OutputType + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: xhat_plane !< Orientations of wake planes, normal to wake planes [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: p_plane !< Center positions of wake planes [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Vx_wake !< Axial wake velocity deficit at wake planes, distributed radially [m/s] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: Vr_wake !< Radial wake velocity deficit at wake planes, distributed radially [m/s] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: D_wake !< Wake diameters at wake planes [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: x_plane !< Downwind distance from rotor to each wake plane [m] + END TYPE WD_OutputType +! ======================= +CONTAINS + SUBROUTINE WD_CopyInputFileType( SrcInputFileTypeData, DstInputFileTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_InputFileType), INTENT(IN) :: SrcInputFileTypeData + TYPE(WD_InputFileType), INTENT(INOUT) :: DstInputFileTypeData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyInputFileType' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInputFileTypeData%dr = SrcInputFileTypeData%dr + DstInputFileTypeData%NumRadii = SrcInputFileTypeData%NumRadii + DstInputFileTypeData%NumPlanes = SrcInputFileTypeData%NumPlanes + DstInputFileTypeData%f_c = SrcInputFileTypeData%f_c + DstInputFileTypeData%C_HWkDfl_O = SrcInputFileTypeData%C_HWkDfl_O + DstInputFileTypeData%C_HWkDfl_OY = SrcInputFileTypeData%C_HWkDfl_OY + DstInputFileTypeData%C_HWkDfl_x = SrcInputFileTypeData%C_HWkDfl_x + DstInputFileTypeData%C_HWkDfl_xY = SrcInputFileTypeData%C_HWkDfl_xY + DstInputFileTypeData%C_NearWake = SrcInputFileTypeData%C_NearWake + DstInputFileTypeData%k_vAmb = SrcInputFileTypeData%k_vAmb + DstInputFileTypeData%k_vShr = SrcInputFileTypeData%k_vShr + DstInputFileTypeData%C_vAmb_DMin = SrcInputFileTypeData%C_vAmb_DMin + DstInputFileTypeData%C_vAmb_DMax = SrcInputFileTypeData%C_vAmb_DMax + DstInputFileTypeData%C_vAmb_FMin = SrcInputFileTypeData%C_vAmb_FMin + DstInputFileTypeData%C_vAmb_Exp = SrcInputFileTypeData%C_vAmb_Exp + DstInputFileTypeData%C_vShr_DMin = SrcInputFileTypeData%C_vShr_DMin + DstInputFileTypeData%C_vShr_DMax = SrcInputFileTypeData%C_vShr_DMax + DstInputFileTypeData%C_vShr_FMin = SrcInputFileTypeData%C_vShr_FMin + DstInputFileTypeData%C_vShr_Exp = SrcInputFileTypeData%C_vShr_Exp + DstInputFileTypeData%Mod_WakeDiam = SrcInputFileTypeData%Mod_WakeDiam + DstInputFileTypeData%C_WakeDiam = SrcInputFileTypeData%C_WakeDiam + END SUBROUTINE WD_CopyInputFileType + + SUBROUTINE WD_DestroyInputFileType( InputFileTypeData, ErrStat, ErrMsg ) + TYPE(WD_InputFileType), INTENT(INOUT) :: InputFileTypeData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyInputFileType' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE WD_DestroyInputFileType + + SUBROUTINE WD_PackInputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_InputFileType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackInputFileType' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! dr + Int_BufSz = Int_BufSz + 1 ! NumRadii + Int_BufSz = Int_BufSz + 1 ! NumPlanes + Re_BufSz = Re_BufSz + 1 ! f_c + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_O + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_OY + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_x + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_xY + Re_BufSz = Re_BufSz + 1 ! C_NearWake + Re_BufSz = Re_BufSz + 1 ! k_vAmb + Re_BufSz = Re_BufSz + 1 ! k_vShr + Re_BufSz = Re_BufSz + 1 ! C_vAmb_DMin + Re_BufSz = Re_BufSz + 1 ! C_vAmb_DMax + Re_BufSz = Re_BufSz + 1 ! C_vAmb_FMin + Re_BufSz = Re_BufSz + 1 ! C_vAmb_Exp + Re_BufSz = Re_BufSz + 1 ! C_vShr_DMin + Re_BufSz = Re_BufSz + 1 ! C_vShr_DMax + Re_BufSz = Re_BufSz + 1 ! C_vShr_FMin + Re_BufSz = Re_BufSz + 1 ! C_vShr_Exp + Int_BufSz = Int_BufSz + 1 ! Mod_WakeDiam + Re_BufSz = Re_BufSz + 1 ! C_WakeDiam + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%dr + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumRadii + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumPlanes + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%f_c + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_O + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_OY + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_x + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_xY + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_NearWake + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%k_vAmb + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%k_vShr + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_DMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_DMax + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_FMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_Exp + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_DMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_DMax + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_FMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_Exp + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%Mod_WakeDiam + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_WakeDiam + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_PackInputFileType + + SUBROUTINE WD_UnPackInputFileType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_InputFileType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackInputFileType' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%NumRadii = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumPlanes = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%f_c = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_O = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_OY = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_x = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_xY = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_NearWake = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%k_vAmb = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%k_vShr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_DMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_DMax = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_FMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_Exp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_DMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_DMax = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_FMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_Exp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Mod_WakeDiam = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_WakeDiam = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_UnPackInputFileType + + SUBROUTINE WD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_InitInputType), INTENT(IN) :: SrcInitInputData + TYPE(WD_InitInputType), INTENT(INOUT) :: DstInitInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyInitInput' +! + ErrStat = ErrID_None + ErrMsg = "" + CALL WD_Copyinputfiletype( SrcInitInputData%InputFileData, DstInitInputData%InputFileData, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstInitInputData%TurbNum = SrcInitInputData%TurbNum + END SUBROUTINE WD_CopyInitInput + + SUBROUTINE WD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) + TYPE(WD_InitInputType), INTENT(INOUT) :: InitInputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyInitInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL WD_Destroyinputfiletype( InitInputData%InputFileData, ErrStat, ErrMsg ) + END SUBROUTINE WD_DestroyInitInput + + SUBROUTINE WD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_InitInputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackInitInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! InputFileData: size of buffers for each call to pack subtype + CALL WD_Packinputfiletype( Re_Buf, Db_Buf, Int_Buf, InData%InputFileData, ErrStat2, ErrMsg2, .TRUE. ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! InputFileData + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! InputFileData + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! InputFileData + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! TurbNum + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + CALL WD_Packinputfiletype( Re_Buf, Db_Buf, Int_Buf, InData%InputFileData, ErrStat2, ErrMsg2, OnlySize ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = InData%TurbNum + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE WD_PackInitInput + + SUBROUTINE WD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_InitInputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackInitInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL WD_Unpackinputfiletype( Re_Buf, Db_Buf, Int_Buf, OutData%InputFileData, ErrStat2, ErrMsg2 ) ! InputFileData + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%TurbNum = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE WD_UnPackInitInput + + SUBROUTINE WD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(WD_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInitOutputData%WriteOutputHdr)) THEN + i1_l = LBOUND(SrcInitOutputData%WriteOutputHdr,1) + i1_u = UBOUND(SrcInitOutputData%WriteOutputHdr,1) + IF (.NOT. ALLOCATED(DstInitOutputData%WriteOutputHdr)) THEN + ALLOCATE(DstInitOutputData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%WriteOutputHdr = SrcInitOutputData%WriteOutputHdr +ENDIF +IF (ALLOCATED(SrcInitOutputData%WriteOutputUnt)) THEN + i1_l = LBOUND(SrcInitOutputData%WriteOutputUnt,1) + i1_u = UBOUND(SrcInitOutputData%WriteOutputUnt,1) + IF (.NOT. ALLOCATED(DstInitOutputData%WriteOutputUnt)) THEN + ALLOCATE(DstInitOutputData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%WriteOutputUnt = SrcInitOutputData%WriteOutputUnt +ENDIF + CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + END SUBROUTINE WD_CopyInitOutput + + SUBROUTINE WD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(WD_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InitOutputData%WriteOutputHdr)) THEN + DEALLOCATE(InitOutputData%WriteOutputHdr) +ENDIF +IF (ALLOCATED(InitOutputData%WriteOutputUnt)) THEN + DEALLOCATE(InitOutputData%WriteOutputUnt) +ENDIF + CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) + END SUBROUTINE WD_DestroyInitOutput + + SUBROUTINE WD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! WriteOutputHdr allocated yes/no + IF ( ALLOCATED(InData%WriteOutputHdr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WriteOutputHdr upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputHdr)*LEN(InData%WriteOutputHdr) ! WriteOutputHdr + END IF + Int_BufSz = Int_BufSz + 1 ! WriteOutputUnt allocated yes/no + IF ( ALLOCATED(InData%WriteOutputUnt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! WriteOutputUnt upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%WriteOutputUnt)*LEN(InData%WriteOutputUnt) ! WriteOutputUnt + END IF + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! Ver: size of buffers for each call to pack subtype + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, .TRUE. ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! Ver + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! Ver + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! Ver + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%WriteOutputHdr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputHdr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputHdr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WriteOutputHdr,1), UBOUND(InData%WriteOutputHdr,1) + DO I = 1, LEN(InData%WriteOutputHdr) + IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputHdr(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( .NOT. ALLOCATED(InData%WriteOutputUnt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%WriteOutputUnt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%WriteOutputUnt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%WriteOutputUnt,1), UBOUND(InData%WriteOutputUnt,1) + DO I = 1, LEN(InData%WriteOutputUnt) + IntKiBuf(Int_Xferred) = ICHAR(InData%WriteOutputUnt(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + CALL NWTC_Library_Packprogdesc( Re_Buf, Db_Buf, Int_Buf, InData%Ver, ErrStat2, ErrMsg2, OnlySize ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END SUBROUTINE WD_PackInitOutput + + SUBROUTINE WD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputHdr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WriteOutputHdr)) DEALLOCATE(OutData%WriteOutputHdr) + ALLOCATE(OutData%WriteOutputHdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputHdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WriteOutputHdr,1), UBOUND(OutData%WriteOutputHdr,1) + DO I = 1, LEN(OutData%WriteOutputHdr) + OutData%WriteOutputHdr(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WriteOutputUnt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%WriteOutputUnt)) DEALLOCATE(OutData%WriteOutputUnt) + ALLOCATE(OutData%WriteOutputUnt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%WriteOutputUnt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%WriteOutputUnt,1), UBOUND(OutData%WriteOutputUnt,1) + DO I = 1, LEN(OutData%WriteOutputUnt) + OutData%WriteOutputUnt(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackprogdesc( Re_Buf, Db_Buf, Int_Buf, OutData%Ver, ErrStat2, ErrMsg2 ) ! Ver + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END SUBROUTINE WD_UnPackInitOutput + + SUBROUTINE WD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(WD_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstContStateData%DummyContState = SrcContStateData%DummyContState + END SUBROUTINE WD_CopyContState + + SUBROUTINE WD_DestroyContState( ContStateData, ErrStat, ErrMsg ) + TYPE(WD_ContinuousStateType), INTENT(INOUT) :: ContStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyContState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE WD_DestroyContState + + SUBROUTINE WD_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_ContinuousStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackContState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyContState + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyContState + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_PackContState + + SUBROUTINE WD_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_ContinuousStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackContState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyContState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_UnPackContState + + SUBROUTINE WD_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_DiscreteStateType), INTENT(IN) :: SrcDiscStateData + TYPE(WD_DiscreteStateType), INTENT(INOUT) :: DstDiscStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyDiscState' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcDiscStateData%xhat_plane)) THEN + i1_l = LBOUND(SrcDiscStateData%xhat_plane,1) + i1_u = UBOUND(SrcDiscStateData%xhat_plane,1) + i2_l = LBOUND(SrcDiscStateData%xhat_plane,2) + i2_u = UBOUND(SrcDiscStateData%xhat_plane,2) + IF (.NOT. ALLOCATED(DstDiscStateData%xhat_plane)) THEN + ALLOCATE(DstDiscStateData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%xhat_plane = SrcDiscStateData%xhat_plane +ENDIF +IF (ALLOCATED(SrcDiscStateData%p_plane)) THEN + i1_l = LBOUND(SrcDiscStateData%p_plane,1) + i1_u = UBOUND(SrcDiscStateData%p_plane,1) + i2_l = LBOUND(SrcDiscStateData%p_plane,2) + i2_u = UBOUND(SrcDiscStateData%p_plane,2) + IF (.NOT. ALLOCATED(DstDiscStateData%p_plane)) THEN + ALLOCATE(DstDiscStateData%p_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%p_plane = SrcDiscStateData%p_plane +ENDIF +IF (ALLOCATED(SrcDiscStateData%x_plane)) THEN + i1_l = LBOUND(SrcDiscStateData%x_plane,1) + i1_u = UBOUND(SrcDiscStateData%x_plane,1) + IF (.NOT. ALLOCATED(DstDiscStateData%x_plane)) THEN + ALLOCATE(DstDiscStateData%x_plane(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%x_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%x_plane = SrcDiscStateData%x_plane +ENDIF +IF (ALLOCATED(SrcDiscStateData%Vx_wake)) THEN + i1_l = LBOUND(SrcDiscStateData%Vx_wake,1) + i1_u = UBOUND(SrcDiscStateData%Vx_wake,1) + i2_l = LBOUND(SrcDiscStateData%Vx_wake,2) + i2_u = UBOUND(SrcDiscStateData%Vx_wake,2) + IF (.NOT. ALLOCATED(DstDiscStateData%Vx_wake)) THEN + ALLOCATE(DstDiscStateData%Vx_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%Vx_wake = SrcDiscStateData%Vx_wake +ENDIF +IF (ALLOCATED(SrcDiscStateData%Vr_wake)) THEN + i1_l = LBOUND(SrcDiscStateData%Vr_wake,1) + i1_u = UBOUND(SrcDiscStateData%Vr_wake,1) + i2_l = LBOUND(SrcDiscStateData%Vr_wake,2) + i2_u = UBOUND(SrcDiscStateData%Vr_wake,2) + IF (.NOT. ALLOCATED(DstDiscStateData%Vr_wake)) THEN + ALLOCATE(DstDiscStateData%Vr_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%Vr_wake = SrcDiscStateData%Vr_wake +ENDIF +IF (ALLOCATED(SrcDiscStateData%V_plane_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%V_plane_filt,1) + i1_u = UBOUND(SrcDiscStateData%V_plane_filt,1) + i2_l = LBOUND(SrcDiscStateData%V_plane_filt,2) + i2_u = UBOUND(SrcDiscStateData%V_plane_filt,2) + IF (.NOT. ALLOCATED(DstDiscStateData%V_plane_filt)) THEN + ALLOCATE(DstDiscStateData%V_plane_filt(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%V_plane_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%V_plane_filt = SrcDiscStateData%V_plane_filt +ENDIF +IF (ALLOCATED(SrcDiscStateData%Vx_wind_disk_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%Vx_wind_disk_filt,1) + i1_u = UBOUND(SrcDiscStateData%Vx_wind_disk_filt,1) + IF (.NOT. ALLOCATED(DstDiscStateData%Vx_wind_disk_filt)) THEN + ALLOCATE(DstDiscStateData%Vx_wind_disk_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Vx_wind_disk_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%Vx_wind_disk_filt = SrcDiscStateData%Vx_wind_disk_filt +ENDIF +IF (ALLOCATED(SrcDiscStateData%TI_amb_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%TI_amb_filt,1) + i1_u = UBOUND(SrcDiscStateData%TI_amb_filt,1) + IF (.NOT. ALLOCATED(DstDiscStateData%TI_amb_filt)) THEN + ALLOCATE(DstDiscStateData%TI_amb_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%TI_amb_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%TI_amb_filt = SrcDiscStateData%TI_amb_filt +ENDIF +IF (ALLOCATED(SrcDiscStateData%D_rotor_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%D_rotor_filt,1) + i1_u = UBOUND(SrcDiscStateData%D_rotor_filt,1) + IF (.NOT. ALLOCATED(DstDiscStateData%D_rotor_filt)) THEN + ALLOCATE(DstDiscStateData%D_rotor_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%D_rotor_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%D_rotor_filt = SrcDiscStateData%D_rotor_filt +ENDIF + DstDiscStateData%Vx_rel_disk_filt = SrcDiscStateData%Vx_rel_disk_filt +IF (ALLOCATED(SrcDiscStateData%Ct_azavg_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%Ct_azavg_filt,1) + i1_u = UBOUND(SrcDiscStateData%Ct_azavg_filt,1) + IF (.NOT. ALLOCATED(DstDiscStateData%Ct_azavg_filt)) THEN + ALLOCATE(DstDiscStateData%Ct_azavg_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%Ct_azavg_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%Ct_azavg_filt = SrcDiscStateData%Ct_azavg_filt +ENDIF +IF (ALLOCATED(SrcDiscStateData%YawErr_filt)) THEN + i1_l = LBOUND(SrcDiscStateData%YawErr_filt,1) + i1_u = UBOUND(SrcDiscStateData%YawErr_filt,1) + IF (.NOT. ALLOCATED(DstDiscStateData%YawErr_filt)) THEN + ALLOCATE(DstDiscStateData%YawErr_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstDiscStateData%YawErr_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstDiscStateData%YawErr_filt = SrcDiscStateData%YawErr_filt +ENDIF + END SUBROUTINE WD_CopyDiscState + + SUBROUTINE WD_DestroyDiscState( DiscStateData, ErrStat, ErrMsg ) + TYPE(WD_DiscreteStateType), INTENT(INOUT) :: DiscStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyDiscState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(DiscStateData%xhat_plane)) THEN + DEALLOCATE(DiscStateData%xhat_plane) +ENDIF +IF (ALLOCATED(DiscStateData%p_plane)) THEN + DEALLOCATE(DiscStateData%p_plane) +ENDIF +IF (ALLOCATED(DiscStateData%x_plane)) THEN + DEALLOCATE(DiscStateData%x_plane) +ENDIF +IF (ALLOCATED(DiscStateData%Vx_wake)) THEN + DEALLOCATE(DiscStateData%Vx_wake) +ENDIF +IF (ALLOCATED(DiscStateData%Vr_wake)) THEN + DEALLOCATE(DiscStateData%Vr_wake) +ENDIF +IF (ALLOCATED(DiscStateData%V_plane_filt)) THEN + DEALLOCATE(DiscStateData%V_plane_filt) +ENDIF +IF (ALLOCATED(DiscStateData%Vx_wind_disk_filt)) THEN + DEALLOCATE(DiscStateData%Vx_wind_disk_filt) +ENDIF +IF (ALLOCATED(DiscStateData%TI_amb_filt)) THEN + DEALLOCATE(DiscStateData%TI_amb_filt) +ENDIF +IF (ALLOCATED(DiscStateData%D_rotor_filt)) THEN + DEALLOCATE(DiscStateData%D_rotor_filt) +ENDIF +IF (ALLOCATED(DiscStateData%Ct_azavg_filt)) THEN + DEALLOCATE(DiscStateData%Ct_azavg_filt) +ENDIF +IF (ALLOCATED(DiscStateData%YawErr_filt)) THEN + DEALLOCATE(DiscStateData%YawErr_filt) +ENDIF + END SUBROUTINE WD_DestroyDiscState + + SUBROUTINE WD_PackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_DiscreteStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackDiscState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! xhat_plane allocated yes/no + IF ( ALLOCATED(InData%xhat_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! xhat_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xhat_plane) ! xhat_plane + END IF + Int_BufSz = Int_BufSz + 1 ! p_plane allocated yes/no + IF ( ALLOCATED(InData%p_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! p_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%p_plane) ! p_plane + END IF + Int_BufSz = Int_BufSz + 1 ! x_plane allocated yes/no + IF ( ALLOCATED(InData%x_plane) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! x_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%x_plane) ! x_plane + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wake allocated yes/no + IF ( ALLOCATED(InData%Vx_wake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Vx_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wake) ! Vx_wake + END IF + Int_BufSz = Int_BufSz + 1 ! Vr_wake allocated yes/no + IF ( ALLOCATED(InData%Vr_wake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Vr_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vr_wake) ! Vr_wake + END IF + Int_BufSz = Int_BufSz + 1 ! V_plane_filt allocated yes/no + IF ( ALLOCATED(InData%V_plane_filt) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! V_plane_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%V_plane_filt) ! V_plane_filt + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wind_disk_filt allocated yes/no + IF ( ALLOCATED(InData%Vx_wind_disk_filt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vx_wind_disk_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wind_disk_filt) ! Vx_wind_disk_filt + END IF + Int_BufSz = Int_BufSz + 1 ! TI_amb_filt allocated yes/no + IF ( ALLOCATED(InData%TI_amb_filt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TI_amb_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%TI_amb_filt) ! TI_amb_filt + END IF + Int_BufSz = Int_BufSz + 1 ! D_rotor_filt allocated yes/no + IF ( ALLOCATED(InData%D_rotor_filt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! D_rotor_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%D_rotor_filt) ! D_rotor_filt + END IF + Re_BufSz = Re_BufSz + 1 ! Vx_rel_disk_filt + Int_BufSz = Int_BufSz + 1 ! Ct_azavg_filt allocated yes/no + IF ( ALLOCATED(InData%Ct_azavg_filt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Ct_azavg_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Ct_azavg_filt) ! Ct_azavg_filt + END IF + Int_BufSz = Int_BufSz + 1 ! YawErr_filt allocated yes/no + IF ( ALLOCATED(InData%YawErr_filt) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! YawErr_filt upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%YawErr_filt) ! YawErr_filt + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%xhat_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%xhat_plane,2), UBOUND(InData%xhat_plane,2) + DO i1 = LBOUND(InData%xhat_plane,1), UBOUND(InData%xhat_plane,1) + ReKiBuf(Re_Xferred) = InData%xhat_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%p_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%p_plane,2), UBOUND(InData%p_plane,2) + DO i1 = LBOUND(InData%p_plane,1), UBOUND(InData%p_plane,1) + ReKiBuf(Re_Xferred) = InData%p_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%x_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%x_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%x_plane,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%x_plane,1), UBOUND(InData%x_plane,1) + ReKiBuf(Re_Xferred) = InData%x_plane(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Vx_wake,2), UBOUND(InData%Vx_wake,2) + DO i1 = LBOUND(InData%Vx_wake,1), UBOUND(InData%Vx_wake,1) + ReKiBuf(Re_Xferred) = InData%Vx_wake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vr_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Vr_wake,2), UBOUND(InData%Vr_wake,2) + DO i1 = LBOUND(InData%Vr_wake,1), UBOUND(InData%Vr_wake,1) + ReKiBuf(Re_Xferred) = InData%Vr_wake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%V_plane_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane_filt,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane_filt,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane_filt,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%V_plane_filt,2), UBOUND(InData%V_plane_filt,2) + DO i1 = LBOUND(InData%V_plane_filt,1), UBOUND(InData%V_plane_filt,1) + ReKiBuf(Re_Xferred) = InData%V_plane_filt(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wind_disk_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wind_disk_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wind_disk_filt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vx_wind_disk_filt,1), UBOUND(InData%Vx_wind_disk_filt,1) + ReKiBuf(Re_Xferred) = InData%Vx_wind_disk_filt(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TI_amb_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TI_amb_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TI_amb_filt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TI_amb_filt,1), UBOUND(InData%TI_amb_filt,1) + ReKiBuf(Re_Xferred) = InData%TI_amb_filt(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%D_rotor_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%D_rotor_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%D_rotor_filt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%D_rotor_filt,1), UBOUND(InData%D_rotor_filt,1) + ReKiBuf(Re_Xferred) = InData%D_rotor_filt(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + ReKiBuf(Re_Xferred) = InData%Vx_rel_disk_filt + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%Ct_azavg_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Ct_azavg_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Ct_azavg_filt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Ct_azavg_filt,1), UBOUND(InData%Ct_azavg_filt,1) + ReKiBuf(Re_Xferred) = InData%Ct_azavg_filt(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%YawErr_filt) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%YawErr_filt,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%YawErr_filt,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%YawErr_filt,1), UBOUND(InData%YawErr_filt,1) + ReKiBuf(Re_Xferred) = InData%YawErr_filt(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_PackDiscState + + SUBROUTINE WD_UnPackDiscState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_DiscreteStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackDiscState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xhat_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xhat_plane)) DEALLOCATE(OutData%xhat_plane) + ALLOCATE(OutData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%xhat_plane,2), UBOUND(OutData%xhat_plane,2) + DO i1 = LBOUND(OutData%xhat_plane,1), UBOUND(OutData%xhat_plane,1) + OutData%xhat_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! p_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%p_plane)) DEALLOCATE(OutData%p_plane) + ALLOCATE(OutData%p_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%p_plane,2), UBOUND(OutData%p_plane,2) + DO i1 = LBOUND(OutData%p_plane,1), UBOUND(OutData%p_plane,1) + OutData%p_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! x_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%x_plane)) DEALLOCATE(OutData%x_plane) + ALLOCATE(OutData%x_plane(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%x_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%x_plane,1), UBOUND(OutData%x_plane,1) + OutData%x_plane(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wake)) DEALLOCATE(OutData%Vx_wake) + ALLOCATE(OutData%Vx_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Vx_wake,2), UBOUND(OutData%Vx_wake,2) + DO i1 = LBOUND(OutData%Vx_wake,1), UBOUND(OutData%Vx_wake,1) + OutData%Vx_wake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vr_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vr_wake)) DEALLOCATE(OutData%Vr_wake) + ALLOCATE(OutData%Vr_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Vr_wake,2), UBOUND(OutData%Vr_wake,2) + DO i1 = LBOUND(OutData%Vr_wake,1), UBOUND(OutData%Vr_wake,1) + OutData%Vr_wake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! V_plane_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%V_plane_filt)) DEALLOCATE(OutData%V_plane_filt) + ALLOCATE(OutData%V_plane_filt(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%V_plane_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%V_plane_filt,2), UBOUND(OutData%V_plane_filt,2) + DO i1 = LBOUND(OutData%V_plane_filt,1), UBOUND(OutData%V_plane_filt,1) + OutData%V_plane_filt(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wind_disk_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wind_disk_filt)) DEALLOCATE(OutData%Vx_wind_disk_filt) + ALLOCATE(OutData%Vx_wind_disk_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wind_disk_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vx_wind_disk_filt,1), UBOUND(OutData%Vx_wind_disk_filt,1) + OutData%Vx_wind_disk_filt(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TI_amb_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TI_amb_filt)) DEALLOCATE(OutData%TI_amb_filt) + ALLOCATE(OutData%TI_amb_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TI_amb_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TI_amb_filt,1), UBOUND(OutData%TI_amb_filt,1) + OutData%TI_amb_filt(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! D_rotor_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%D_rotor_filt)) DEALLOCATE(OutData%D_rotor_filt) + ALLOCATE(OutData%D_rotor_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%D_rotor_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%D_rotor_filt,1), UBOUND(OutData%D_rotor_filt,1) + OutData%D_rotor_filt(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%Vx_rel_disk_filt = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Ct_azavg_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Ct_azavg_filt)) DEALLOCATE(OutData%Ct_azavg_filt) + ALLOCATE(OutData%Ct_azavg_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Ct_azavg_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Ct_azavg_filt,1), UBOUND(OutData%Ct_azavg_filt,1) + OutData%Ct_azavg_filt(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! YawErr_filt not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%YawErr_filt)) DEALLOCATE(OutData%YawErr_filt) + ALLOCATE(OutData%YawErr_filt(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%YawErr_filt.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%YawErr_filt,1), UBOUND(OutData%YawErr_filt,1) + OutData%YawErr_filt(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_UnPackDiscState + + SUBROUTINE WD_CopyConstrState( SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_ConstraintStateType), INTENT(IN) :: SrcConstrStateData + TYPE(WD_ConstraintStateType), INTENT(INOUT) :: DstConstrStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyConstrState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState + END SUBROUTINE WD_CopyConstrState + + SUBROUTINE WD_DestroyConstrState( ConstrStateData, ErrStat, ErrMsg ) + TYPE(WD_ConstraintStateType), INTENT(INOUT) :: ConstrStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyConstrState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE WD_DestroyConstrState + + SUBROUTINE WD_PackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_ConstraintStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackConstrState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + 1 ! DummyConstrState + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + ReKiBuf(Re_Xferred) = InData%DummyConstrState + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_PackConstrState + + SUBROUTINE WD_UnPackConstrState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_ConstraintStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackConstrState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%DummyConstrState = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_UnPackConstrState + + SUBROUTINE WD_CopyOtherState( SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_OtherStateType), INTENT(IN) :: SrcOtherStateData + TYPE(WD_OtherStateType), INTENT(INOUT) :: DstOtherStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyOtherState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstOtherStateData%firstPass = SrcOtherStateData%firstPass + END SUBROUTINE WD_CopyOtherState + + SUBROUTINE WD_DestroyOtherState( OtherStateData, ErrStat, ErrMsg ) + TYPE(WD_OtherStateType), INTENT(INOUT) :: OtherStateData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyOtherState' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + END SUBROUTINE WD_DestroyOtherState + + SUBROUTINE WD_PackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_OtherStateType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackOtherState' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! firstPass + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IntKiBuf(Int_Xferred) = TRANSFER(InData%firstPass, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE WD_PackOtherState + + SUBROUTINE WD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_OtherStateType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackOtherState' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%firstPass = TRANSFER(IntKiBuf(Int_Xferred), OutData%firstPass) + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE WD_UnPackOtherState + + SUBROUTINE WD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_MiscVarType), INTENT(IN) :: SrcMiscData + TYPE(WD_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcMiscData%dvdr)) THEN + i1_l = LBOUND(SrcMiscData%dvdr,1) + i1_u = UBOUND(SrcMiscData%dvdr,1) + IF (.NOT. ALLOCATED(DstMiscData%dvdr)) THEN + ALLOCATE(DstMiscData%dvdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%dvdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%dvdr = SrcMiscData%dvdr +ENDIF +IF (ALLOCATED(SrcMiscData%dvtdr)) THEN + i1_l = LBOUND(SrcMiscData%dvtdr,1) + i1_u = UBOUND(SrcMiscData%dvtdr,1) + IF (.NOT. ALLOCATED(DstMiscData%dvtdr)) THEN + ALLOCATE(DstMiscData%dvtdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%dvtdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%dvtdr = SrcMiscData%dvtdr +ENDIF +IF (ALLOCATED(SrcMiscData%vt_tot)) THEN + i1_l = LBOUND(SrcMiscData%vt_tot,1) + i1_u = UBOUND(SrcMiscData%vt_tot,1) + i2_l = LBOUND(SrcMiscData%vt_tot,2) + i2_u = UBOUND(SrcMiscData%vt_tot,2) + IF (.NOT. ALLOCATED(DstMiscData%vt_tot)) THEN + ALLOCATE(DstMiscData%vt_tot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%vt_tot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%vt_tot = SrcMiscData%vt_tot +ENDIF +IF (ALLOCATED(SrcMiscData%vt_amb)) THEN + i1_l = LBOUND(SrcMiscData%vt_amb,1) + i1_u = UBOUND(SrcMiscData%vt_amb,1) + i2_l = LBOUND(SrcMiscData%vt_amb,2) + i2_u = UBOUND(SrcMiscData%vt_amb,2) + IF (.NOT. ALLOCATED(DstMiscData%vt_amb)) THEN + ALLOCATE(DstMiscData%vt_amb(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%vt_amb.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%vt_amb = SrcMiscData%vt_amb +ENDIF +IF (ALLOCATED(SrcMiscData%vt_shr)) THEN + i1_l = LBOUND(SrcMiscData%vt_shr,1) + i1_u = UBOUND(SrcMiscData%vt_shr,1) + i2_l = LBOUND(SrcMiscData%vt_shr,2) + i2_u = UBOUND(SrcMiscData%vt_shr,2) + IF (.NOT. ALLOCATED(DstMiscData%vt_shr)) THEN + ALLOCATE(DstMiscData%vt_shr(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%vt_shr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%vt_shr = SrcMiscData%vt_shr +ENDIF +IF (ALLOCATED(SrcMiscData%a)) THEN + i1_l = LBOUND(SrcMiscData%a,1) + i1_u = UBOUND(SrcMiscData%a,1) + IF (.NOT. ALLOCATED(DstMiscData%a)) THEN + ALLOCATE(DstMiscData%a(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%a.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%a = SrcMiscData%a +ENDIF +IF (ALLOCATED(SrcMiscData%b)) THEN + i1_l = LBOUND(SrcMiscData%b,1) + i1_u = UBOUND(SrcMiscData%b,1) + IF (.NOT. ALLOCATED(DstMiscData%b)) THEN + ALLOCATE(DstMiscData%b(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%b.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%b = SrcMiscData%b +ENDIF +IF (ALLOCATED(SrcMiscData%c)) THEN + i1_l = LBOUND(SrcMiscData%c,1) + i1_u = UBOUND(SrcMiscData%c,1) + IF (.NOT. ALLOCATED(DstMiscData%c)) THEN + ALLOCATE(DstMiscData%c(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%c.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%c = SrcMiscData%c +ENDIF +IF (ALLOCATED(SrcMiscData%d)) THEN + i1_l = LBOUND(SrcMiscData%d,1) + i1_u = UBOUND(SrcMiscData%d,1) + IF (.NOT. ALLOCATED(DstMiscData%d)) THEN + ALLOCATE(DstMiscData%d(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%d.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%d = SrcMiscData%d +ENDIF +IF (ALLOCATED(SrcMiscData%r_wake)) THEN + i1_l = LBOUND(SrcMiscData%r_wake,1) + i1_u = UBOUND(SrcMiscData%r_wake,1) + IF (.NOT. ALLOCATED(DstMiscData%r_wake)) THEN + ALLOCATE(DstMiscData%r_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%r_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%r_wake = SrcMiscData%r_wake +ENDIF +IF (ALLOCATED(SrcMiscData%Vx_high)) THEN + i1_l = LBOUND(SrcMiscData%Vx_high,1) + i1_u = UBOUND(SrcMiscData%Vx_high,1) + IF (.NOT. ALLOCATED(DstMiscData%Vx_high)) THEN + ALLOCATE(DstMiscData%Vx_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%Vx_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%Vx_high = SrcMiscData%Vx_high +ENDIF + END SUBROUTINE WD_CopyMisc + + SUBROUTINE WD_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(WD_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(MiscData%dvdr)) THEN + DEALLOCATE(MiscData%dvdr) +ENDIF +IF (ALLOCATED(MiscData%dvtdr)) THEN + DEALLOCATE(MiscData%dvtdr) +ENDIF +IF (ALLOCATED(MiscData%vt_tot)) THEN + DEALLOCATE(MiscData%vt_tot) +ENDIF +IF (ALLOCATED(MiscData%vt_amb)) THEN + DEALLOCATE(MiscData%vt_amb) +ENDIF +IF (ALLOCATED(MiscData%vt_shr)) THEN + DEALLOCATE(MiscData%vt_shr) +ENDIF +IF (ALLOCATED(MiscData%a)) THEN + DEALLOCATE(MiscData%a) +ENDIF +IF (ALLOCATED(MiscData%b)) THEN + DEALLOCATE(MiscData%b) +ENDIF +IF (ALLOCATED(MiscData%c)) THEN + DEALLOCATE(MiscData%c) +ENDIF +IF (ALLOCATED(MiscData%d)) THEN + DEALLOCATE(MiscData%d) +ENDIF +IF (ALLOCATED(MiscData%r_wake)) THEN + DEALLOCATE(MiscData%r_wake) +ENDIF +IF (ALLOCATED(MiscData%Vx_high)) THEN + DEALLOCATE(MiscData%Vx_high) +ENDIF + END SUBROUTINE WD_DestroyMisc + + SUBROUTINE WD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! dvdr allocated yes/no + IF ( ALLOCATED(InData%dvdr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dvdr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dvdr) ! dvdr + END IF + Int_BufSz = Int_BufSz + 1 ! dvtdr allocated yes/no + IF ( ALLOCATED(InData%dvtdr) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! dvtdr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%dvtdr) ! dvtdr + END IF + Int_BufSz = Int_BufSz + 1 ! vt_tot allocated yes/no + IF ( ALLOCATED(InData%vt_tot) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! vt_tot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%vt_tot) ! vt_tot + END IF + Int_BufSz = Int_BufSz + 1 ! vt_amb allocated yes/no + IF ( ALLOCATED(InData%vt_amb) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! vt_amb upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%vt_amb) ! vt_amb + END IF + Int_BufSz = Int_BufSz + 1 ! vt_shr allocated yes/no + IF ( ALLOCATED(InData%vt_shr) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! vt_shr upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%vt_shr) ! vt_shr + END IF + Int_BufSz = Int_BufSz + 1 ! a allocated yes/no + IF ( ALLOCATED(InData%a) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! a upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%a) ! a + END IF + Int_BufSz = Int_BufSz + 1 ! b allocated yes/no + IF ( ALLOCATED(InData%b) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! b upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%b) ! b + END IF + Int_BufSz = Int_BufSz + 1 ! c allocated yes/no + IF ( ALLOCATED(InData%c) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! c upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%c) ! c + END IF + Int_BufSz = Int_BufSz + 1 ! d allocated yes/no + IF ( ALLOCATED(InData%d) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! d upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%d) ! d + END IF + Int_BufSz = Int_BufSz + 1 ! r_wake allocated yes/no + IF ( ALLOCATED(InData%r_wake) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! r_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r_wake) ! r_wake + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_high allocated yes/no + IF ( ALLOCATED(InData%Vx_high) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Vx_high upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_high) ! Vx_high + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%dvdr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dvdr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dvdr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dvdr,1), UBOUND(InData%dvdr,1) + ReKiBuf(Re_Xferred) = InData%dvdr(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%dvtdr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%dvtdr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%dvtdr,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%dvtdr,1), UBOUND(InData%dvtdr,1) + ReKiBuf(Re_Xferred) = InData%dvtdr(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%vt_tot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_tot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_tot,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_tot,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_tot,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%vt_tot,2), UBOUND(InData%vt_tot,2) + DO i1 = LBOUND(InData%vt_tot,1), UBOUND(InData%vt_tot,1) + ReKiBuf(Re_Xferred) = InData%vt_tot(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%vt_amb) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_amb,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_amb,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_amb,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_amb,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%vt_amb,2), UBOUND(InData%vt_amb,2) + DO i1 = LBOUND(InData%vt_amb,1), UBOUND(InData%vt_amb,1) + ReKiBuf(Re_Xferred) = InData%vt_amb(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%vt_shr) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_shr,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_shr,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%vt_shr,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%vt_shr,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%vt_shr,2), UBOUND(InData%vt_shr,2) + DO i1 = LBOUND(InData%vt_shr,1), UBOUND(InData%vt_shr,1) + ReKiBuf(Re_Xferred) = InData%vt_shr(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%a) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%a,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%a,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%a,1), UBOUND(InData%a,1) + ReKiBuf(Re_Xferred) = InData%a(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%b) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%b,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%b,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%b,1), UBOUND(InData%b,1) + ReKiBuf(Re_Xferred) = InData%b(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%c) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%c,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%c,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%c,1), UBOUND(InData%c,1) + ReKiBuf(Re_Xferred) = InData%c(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%d) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%d,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%d,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%d,1), UBOUND(InData%d,1) + ReKiBuf(Re_Xferred) = InData%d(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%r_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r_wake,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%r_wake,1), UBOUND(InData%r_wake,1) + ReKiBuf(Re_Xferred) = InData%r_wake(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_high) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_high,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_high,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Vx_high,1), UBOUND(InData%Vx_high,1) + ReKiBuf(Re_Xferred) = InData%Vx_high(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_PackMisc + + SUBROUTINE WD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dvdr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dvdr)) DEALLOCATE(OutData%dvdr) + ALLOCATE(OutData%dvdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dvdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dvdr,1), UBOUND(OutData%dvdr,1) + OutData%dvdr(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! dvtdr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%dvtdr)) DEALLOCATE(OutData%dvtdr) + ALLOCATE(OutData%dvtdr(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%dvtdr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%dvtdr,1), UBOUND(OutData%dvtdr,1) + OutData%dvtdr(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! vt_tot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%vt_tot)) DEALLOCATE(OutData%vt_tot) + ALLOCATE(OutData%vt_tot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%vt_tot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%vt_tot,2), UBOUND(OutData%vt_tot,2) + DO i1 = LBOUND(OutData%vt_tot,1), UBOUND(OutData%vt_tot,1) + OutData%vt_tot(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! vt_amb not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%vt_amb)) DEALLOCATE(OutData%vt_amb) + ALLOCATE(OutData%vt_amb(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%vt_amb.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%vt_amb,2), UBOUND(OutData%vt_amb,2) + DO i1 = LBOUND(OutData%vt_amb,1), UBOUND(OutData%vt_amb,1) + OutData%vt_amb(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! vt_shr not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%vt_shr)) DEALLOCATE(OutData%vt_shr) + ALLOCATE(OutData%vt_shr(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%vt_shr.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%vt_shr,2), UBOUND(OutData%vt_shr,2) + DO i1 = LBOUND(OutData%vt_shr,1), UBOUND(OutData%vt_shr,1) + OutData%vt_shr(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! a not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%a)) DEALLOCATE(OutData%a) + ALLOCATE(OutData%a(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%a.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%a,1), UBOUND(OutData%a,1) + OutData%a(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! b not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%b)) DEALLOCATE(OutData%b) + ALLOCATE(OutData%b(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%b.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%b,1), UBOUND(OutData%b,1) + OutData%b(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! c not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%c)) DEALLOCATE(OutData%c) + ALLOCATE(OutData%c(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%c.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%c,1), UBOUND(OutData%c,1) + OutData%c(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! d not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%d)) DEALLOCATE(OutData%d) + ALLOCATE(OutData%d(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%d.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%d,1), UBOUND(OutData%d,1) + OutData%d(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r_wake)) DEALLOCATE(OutData%r_wake) + ALLOCATE(OutData%r_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%r_wake,1), UBOUND(OutData%r_wake,1) + OutData%r_wake(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_high not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_high)) DEALLOCATE(OutData%Vx_high) + ALLOCATE(OutData%Vx_high(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_high.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Vx_high,1), UBOUND(OutData%Vx_high,1) + OutData%Vx_high(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_UnPackMisc + + SUBROUTINE WD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_ParameterType), INTENT(IN) :: SrcParamData + TYPE(WD_ParameterType), INTENT(INOUT) :: DstParamData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyParam' +! + ErrStat = ErrID_None + ErrMsg = "" + DstParamData%dt_low = SrcParamData%dt_low + DstParamData%NumPlanes = SrcParamData%NumPlanes + DstParamData%NumRadii = SrcParamData%NumRadii + DstParamData%dr = SrcParamData%dr +IF (ALLOCATED(SrcParamData%r)) THEN + i1_l = LBOUND(SrcParamData%r,1) + i1_u = UBOUND(SrcParamData%r,1) + IF (.NOT. ALLOCATED(DstParamData%r)) THEN + ALLOCATE(DstParamData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%r = SrcParamData%r +ENDIF + DstParamData%filtParam = SrcParamData%filtParam + DstParamData%oneMinusFiltParam = SrcParamData%oneMinusFiltParam + DstParamData%C_HWkDfl_O = SrcParamData%C_HWkDfl_O + DstParamData%C_HWkDfl_OY = SrcParamData%C_HWkDfl_OY + DstParamData%C_HWkDfl_x = SrcParamData%C_HWkDfl_x + DstParamData%C_HWkDfl_xY = SrcParamData%C_HWkDfl_xY + DstParamData%C_NearWake = SrcParamData%C_NearWake + DstParamData%C_vAmb_DMin = SrcParamData%C_vAmb_DMin + DstParamData%C_vAmb_DMax = SrcParamData%C_vAmb_DMax + DstParamData%C_vAmb_FMin = SrcParamData%C_vAmb_FMin + DstParamData%C_vAmb_Exp = SrcParamData%C_vAmb_Exp + DstParamData%C_vShr_DMin = SrcParamData%C_vShr_DMin + DstParamData%C_vShr_DMax = SrcParamData%C_vShr_DMax + DstParamData%C_vShr_FMin = SrcParamData%C_vShr_FMin + DstParamData%C_vShr_Exp = SrcParamData%C_vShr_Exp + DstParamData%k_vAmb = SrcParamData%k_vAmb + DstParamData%k_vShr = SrcParamData%k_vShr + DstParamData%Mod_WakeDiam = SrcParamData%Mod_WakeDiam + DstParamData%C_WakeDiam = SrcParamData%C_WakeDiam + END SUBROUTINE WD_CopyParam + + SUBROUTINE WD_DestroyParam( ParamData, ErrStat, ErrMsg ) + TYPE(WD_ParameterType), INTENT(INOUT) :: ParamData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyParam' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(ParamData%r)) THEN + DEALLOCATE(ParamData%r) +ENDIF + END SUBROUTINE WD_DestroyParam + + SUBROUTINE WD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_ParameterType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackParam' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! dt_low + Int_BufSz = Int_BufSz + 1 ! NumPlanes + Int_BufSz = Int_BufSz + 1 ! NumRadii + Re_BufSz = Re_BufSz + 1 ! dr + Int_BufSz = Int_BufSz + 1 ! r allocated yes/no + IF ( ALLOCATED(InData%r) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! r upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%r) ! r + END IF + Re_BufSz = Re_BufSz + 1 ! filtParam + Re_BufSz = Re_BufSz + 1 ! oneMinusFiltParam + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_O + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_OY + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_x + Re_BufSz = Re_BufSz + 1 ! C_HWkDfl_xY + Re_BufSz = Re_BufSz + 1 ! C_NearWake + Re_BufSz = Re_BufSz + 1 ! C_vAmb_DMin + Re_BufSz = Re_BufSz + 1 ! C_vAmb_DMax + Re_BufSz = Re_BufSz + 1 ! C_vAmb_FMin + Re_BufSz = Re_BufSz + 1 ! C_vAmb_Exp + Re_BufSz = Re_BufSz + 1 ! C_vShr_DMin + Re_BufSz = Re_BufSz + 1 ! C_vShr_DMax + Re_BufSz = Re_BufSz + 1 ! C_vShr_FMin + Re_BufSz = Re_BufSz + 1 ! C_vShr_Exp + Re_BufSz = Re_BufSz + 1 ! k_vAmb + Re_BufSz = Re_BufSz + 1 ! k_vShr + Int_BufSz = Int_BufSz + 1 ! Mod_WakeDiam + Re_BufSz = Re_BufSz + 1 ! C_WakeDiam + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%dt_low + Db_Xferred = Db_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumPlanes + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumRadii + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%dr + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%r) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%r,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%r,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%r,1), UBOUND(InData%r,1) + ReKiBuf(Re_Xferred) = InData%r(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + ReKiBuf(Re_Xferred) = InData%filtParam + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%oneMinusFiltParam + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_O + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_OY + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_x + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_HWkDfl_xY + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_NearWake + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_DMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_DMax + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_FMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vAmb_Exp + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_DMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_DMax + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_FMin + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_vShr_Exp + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%k_vAmb + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%k_vShr + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%Mod_WakeDiam + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%C_WakeDiam + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_PackParam + + SUBROUTINE WD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_ParameterType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackParam' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%dt_low = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + OutData%NumPlanes = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumRadii = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%dr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! r not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%r)) DEALLOCATE(OutData%r) + ALLOCATE(OutData%r(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%r.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%r,1), UBOUND(OutData%r,1) + OutData%r(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%filtParam = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%oneMinusFiltParam = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_O = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_OY = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_x = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_HWkDfl_xY = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_NearWake = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_DMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_DMax = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_FMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vAmb_Exp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_DMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_DMax = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_FMin = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%C_vShr_Exp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%k_vAmb = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%k_vShr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Mod_WakeDiam = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%C_WakeDiam = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_UnPackParam + + SUBROUTINE WD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_InputType), INTENT(IN) :: SrcInputData + TYPE(WD_InputType), INTENT(INOUT) :: DstInputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyInput' +! + ErrStat = ErrID_None + ErrMsg = "" + DstInputData%xhat_disk = SrcInputData%xhat_disk + DstInputData%p_hub = SrcInputData%p_hub +IF (ALLOCATED(SrcInputData%V_plane)) THEN + i1_l = LBOUND(SrcInputData%V_plane,1) + i1_u = UBOUND(SrcInputData%V_plane,1) + i2_l = LBOUND(SrcInputData%V_plane,2) + i2_u = UBOUND(SrcInputData%V_plane,2) + IF (.NOT. ALLOCATED(DstInputData%V_plane)) THEN + ALLOCATE(DstInputData%V_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%V_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%V_plane = SrcInputData%V_plane +ENDIF + DstInputData%Vx_wind_disk = SrcInputData%Vx_wind_disk + DstInputData%TI_amb = SrcInputData%TI_amb + DstInputData%D_rotor = SrcInputData%D_rotor + DstInputData%Vx_rel_disk = SrcInputData%Vx_rel_disk +IF (ALLOCATED(SrcInputData%Ct_azavg)) THEN + i1_l = LBOUND(SrcInputData%Ct_azavg,1) + i1_u = UBOUND(SrcInputData%Ct_azavg,1) + IF (.NOT. ALLOCATED(DstInputData%Ct_azavg)) THEN + ALLOCATE(DstInputData%Ct_azavg(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Ct_azavg.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%Ct_azavg = SrcInputData%Ct_azavg +ENDIF + DstInputData%YawErr = SrcInputData%YawErr + END SUBROUTINE WD_CopyInput + + SUBROUTINE WD_DestroyInput( InputData, ErrStat, ErrMsg ) + TYPE(WD_InputType), INTENT(INOUT) :: InputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyInput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InputData%V_plane)) THEN + DEALLOCATE(InputData%V_plane) +ENDIF +IF (ALLOCATED(InputData%Ct_azavg)) THEN + DEALLOCATE(InputData%Ct_azavg) +ENDIF + END SUBROUTINE WD_DestroyInput + + SUBROUTINE WD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_InputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackInput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Re_BufSz = Re_BufSz + SIZE(InData%xhat_disk) ! xhat_disk + Re_BufSz = Re_BufSz + SIZE(InData%p_hub) ! p_hub + Int_BufSz = Int_BufSz + 1 ! V_plane allocated yes/no + IF ( ALLOCATED(InData%V_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! V_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%V_plane) ! V_plane + END IF + Re_BufSz = Re_BufSz + 1 ! Vx_wind_disk + Re_BufSz = Re_BufSz + 1 ! TI_amb + Re_BufSz = Re_BufSz + 1 ! D_rotor + Re_BufSz = Re_BufSz + 1 ! Vx_rel_disk + Int_BufSz = Int_BufSz + 1 ! Ct_azavg allocated yes/no + IF ( ALLOCATED(InData%Ct_azavg) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Ct_azavg upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Ct_azavg) ! Ct_azavg + END IF + Re_BufSz = Re_BufSz + 1 ! YawErr + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DO i1 = LBOUND(InData%xhat_disk,1), UBOUND(InData%xhat_disk,1) + ReKiBuf(Re_Xferred) = InData%xhat_disk(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%p_hub,1), UBOUND(InData%p_hub,1) + ReKiBuf(Re_Xferred) = InData%p_hub(i1) + Re_Xferred = Re_Xferred + 1 + END DO + IF ( .NOT. ALLOCATED(InData%V_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%V_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%V_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%V_plane,2), UBOUND(InData%V_plane,2) + DO i1 = LBOUND(InData%V_plane,1), UBOUND(InData%V_plane,1) + ReKiBuf(Re_Xferred) = InData%V_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + ReKiBuf(Re_Xferred) = InData%Vx_wind_disk + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%TI_amb + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%D_rotor + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%Vx_rel_disk + Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%Ct_azavg) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Ct_azavg,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Ct_azavg,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Ct_azavg,1), UBOUND(InData%Ct_azavg,1) + ReKiBuf(Re_Xferred) = InData%Ct_azavg(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + ReKiBuf(Re_Xferred) = InData%YawErr + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_PackInput + + SUBROUTINE WD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_InputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackInput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + i1_l = LBOUND(OutData%xhat_disk,1) + i1_u = UBOUND(OutData%xhat_disk,1) + DO i1 = LBOUND(OutData%xhat_disk,1), UBOUND(OutData%xhat_disk,1) + OutData%xhat_disk(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%p_hub,1) + i1_u = UBOUND(OutData%p_hub,1) + DO i1 = LBOUND(OutData%p_hub,1), UBOUND(OutData%p_hub,1) + OutData%p_hub(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! V_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%V_plane)) DEALLOCATE(OutData%V_plane) + ALLOCATE(OutData%V_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%V_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%V_plane,2), UBOUND(OutData%V_plane,2) + DO i1 = LBOUND(OutData%V_plane,1), UBOUND(OutData%V_plane,1) + OutData%V_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + OutData%Vx_wind_disk = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%TI_amb = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%D_rotor = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%Vx_rel_disk = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Ct_azavg not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Ct_azavg)) DEALLOCATE(OutData%Ct_azavg) + ALLOCATE(OutData%Ct_azavg(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Ct_azavg.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Ct_azavg,1), UBOUND(OutData%Ct_azavg,1) + OutData%Ct_azavg(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + OutData%YawErr = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END SUBROUTINE WD_UnPackInput + + SUBROUTINE WD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(WD_OutputType), INTENT(IN) :: SrcOutputData + TYPE(WD_OutputType), INTENT(INOUT) :: DstOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_CopyOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcOutputData%xhat_plane)) THEN + i1_l = LBOUND(SrcOutputData%xhat_plane,1) + i1_u = UBOUND(SrcOutputData%xhat_plane,1) + i2_l = LBOUND(SrcOutputData%xhat_plane,2) + i2_u = UBOUND(SrcOutputData%xhat_plane,2) + IF (.NOT. ALLOCATED(DstOutputData%xhat_plane)) THEN + ALLOCATE(DstOutputData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%xhat_plane = SrcOutputData%xhat_plane +ENDIF +IF (ALLOCATED(SrcOutputData%p_plane)) THEN + i1_l = LBOUND(SrcOutputData%p_plane,1) + i1_u = UBOUND(SrcOutputData%p_plane,1) + i2_l = LBOUND(SrcOutputData%p_plane,2) + i2_u = UBOUND(SrcOutputData%p_plane,2) + IF (.NOT. ALLOCATED(DstOutputData%p_plane)) THEN + ALLOCATE(DstOutputData%p_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%p_plane = SrcOutputData%p_plane +ENDIF +IF (ALLOCATED(SrcOutputData%Vx_wake)) THEN + i1_l = LBOUND(SrcOutputData%Vx_wake,1) + i1_u = UBOUND(SrcOutputData%Vx_wake,1) + i2_l = LBOUND(SrcOutputData%Vx_wake,2) + i2_u = UBOUND(SrcOutputData%Vx_wake,2) + IF (.NOT. ALLOCATED(DstOutputData%Vx_wake)) THEN + ALLOCATE(DstOutputData%Vx_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%Vx_wake = SrcOutputData%Vx_wake +ENDIF +IF (ALLOCATED(SrcOutputData%Vr_wake)) THEN + i1_l = LBOUND(SrcOutputData%Vr_wake,1) + i1_u = UBOUND(SrcOutputData%Vr_wake,1) + i2_l = LBOUND(SrcOutputData%Vr_wake,2) + i2_u = UBOUND(SrcOutputData%Vr_wake,2) + IF (.NOT. ALLOCATED(DstOutputData%Vr_wake)) THEN + ALLOCATE(DstOutputData%Vr_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%Vr_wake = SrcOutputData%Vr_wake +ENDIF +IF (ALLOCATED(SrcOutputData%D_wake)) THEN + i1_l = LBOUND(SrcOutputData%D_wake,1) + i1_u = UBOUND(SrcOutputData%D_wake,1) + IF (.NOT. ALLOCATED(DstOutputData%D_wake)) THEN + ALLOCATE(DstOutputData%D_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%D_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%D_wake = SrcOutputData%D_wake +ENDIF +IF (ALLOCATED(SrcOutputData%x_plane)) THEN + i1_l = LBOUND(SrcOutputData%x_plane,1) + i1_u = UBOUND(SrcOutputData%x_plane,1) + IF (.NOT. ALLOCATED(DstOutputData%x_plane)) THEN + ALLOCATE(DstOutputData%x_plane(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%x_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%x_plane = SrcOutputData%x_plane +ENDIF + END SUBROUTINE WD_CopyOutput + + SUBROUTINE WD_DestroyOutput( OutputData, ErrStat, ErrMsg ) + TYPE(WD_OutputType), INTENT(INOUT) :: OutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'WD_DestroyOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(OutputData%xhat_plane)) THEN + DEALLOCATE(OutputData%xhat_plane) +ENDIF +IF (ALLOCATED(OutputData%p_plane)) THEN + DEALLOCATE(OutputData%p_plane) +ENDIF +IF (ALLOCATED(OutputData%Vx_wake)) THEN + DEALLOCATE(OutputData%Vx_wake) +ENDIF +IF (ALLOCATED(OutputData%Vr_wake)) THEN + DEALLOCATE(OutputData%Vr_wake) +ENDIF +IF (ALLOCATED(OutputData%D_wake)) THEN + DEALLOCATE(OutputData%D_wake) +ENDIF +IF (ALLOCATED(OutputData%x_plane)) THEN + DEALLOCATE(OutputData%x_plane) +ENDIF + END SUBROUTINE WD_DestroyOutput + + SUBROUTINE WD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(WD_OutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_PackOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! xhat_plane allocated yes/no + IF ( ALLOCATED(InData%xhat_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! xhat_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xhat_plane) ! xhat_plane + END IF + Int_BufSz = Int_BufSz + 1 ! p_plane allocated yes/no + IF ( ALLOCATED(InData%p_plane) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! p_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%p_plane) ! p_plane + END IF + Int_BufSz = Int_BufSz + 1 ! Vx_wake allocated yes/no + IF ( ALLOCATED(InData%Vx_wake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Vx_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vx_wake) ! Vx_wake + END IF + Int_BufSz = Int_BufSz + 1 ! Vr_wake allocated yes/no + IF ( ALLOCATED(InData%Vr_wake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! Vr_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Vr_wake) ! Vr_wake + END IF + Int_BufSz = Int_BufSz + 1 ! D_wake allocated yes/no + IF ( ALLOCATED(InData%D_wake) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! D_wake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%D_wake) ! D_wake + END IF + Int_BufSz = Int_BufSz + 1 ! x_plane allocated yes/no + IF ( ALLOCATED(InData%x_plane) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! x_plane upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%x_plane) ! x_plane + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%xhat_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xhat_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xhat_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%xhat_plane,2), UBOUND(InData%xhat_plane,2) + DO i1 = LBOUND(InData%xhat_plane,1), UBOUND(InData%xhat_plane,1) + ReKiBuf(Re_Xferred) = InData%xhat_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%p_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%p_plane,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%p_plane,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%p_plane,2), UBOUND(InData%p_plane,2) + DO i1 = LBOUND(InData%p_plane,1), UBOUND(InData%p_plane,1) + ReKiBuf(Re_Xferred) = InData%p_plane(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vx_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vx_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vx_wake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Vx_wake,2), UBOUND(InData%Vx_wake,2) + DO i1 = LBOUND(InData%Vx_wake,1), UBOUND(InData%Vx_wake,1) + ReKiBuf(Re_Xferred) = InData%Vx_wake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Vr_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Vr_wake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Vr_wake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%Vr_wake,2), UBOUND(InData%Vr_wake,2) + DO i1 = LBOUND(InData%Vr_wake,1), UBOUND(InData%Vr_wake,1) + ReKiBuf(Re_Xferred) = InData%Vr_wake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%D_wake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%D_wake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%D_wake,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%D_wake,1), UBOUND(InData%D_wake,1) + ReKiBuf(Re_Xferred) = InData%D_wake(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%x_plane) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%x_plane,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%x_plane,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%x_plane,1), UBOUND(InData%x_plane,1) + ReKiBuf(Re_Xferred) = InData%x_plane(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_PackOutput + + SUBROUTINE WD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(WD_OutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'WD_UnPackOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xhat_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xhat_plane)) DEALLOCATE(OutData%xhat_plane) + ALLOCATE(OutData%xhat_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xhat_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%xhat_plane,2), UBOUND(OutData%xhat_plane,2) + DO i1 = LBOUND(OutData%xhat_plane,1), UBOUND(OutData%xhat_plane,1) + OutData%xhat_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! p_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%p_plane)) DEALLOCATE(OutData%p_plane) + ALLOCATE(OutData%p_plane(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%p_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%p_plane,2), UBOUND(OutData%p_plane,2) + DO i1 = LBOUND(OutData%p_plane,1), UBOUND(OutData%p_plane,1) + OutData%p_plane(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vx_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vx_wake)) DEALLOCATE(OutData%Vx_wake) + ALLOCATE(OutData%Vx_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vx_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Vx_wake,2), UBOUND(OutData%Vx_wake,2) + DO i1 = LBOUND(OutData%Vx_wake,1), UBOUND(OutData%Vx_wake,1) + OutData%Vx_wake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Vr_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Vr_wake)) DEALLOCATE(OutData%Vr_wake) + ALLOCATE(OutData%Vr_wake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Vr_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%Vr_wake,2), UBOUND(OutData%Vr_wake,2) + DO i1 = LBOUND(OutData%Vr_wake,1), UBOUND(OutData%Vr_wake,1) + OutData%Vr_wake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! D_wake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%D_wake)) DEALLOCATE(OutData%D_wake) + ALLOCATE(OutData%D_wake(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%D_wake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%D_wake,1), UBOUND(OutData%D_wake,1) + OutData%D_wake(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! x_plane not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%x_plane)) DEALLOCATE(OutData%x_plane) + ALLOCATE(OutData%x_plane(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%x_plane.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%x_plane,1), UBOUND(OutData%x_plane,1) + OutData%x_plane(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + END SUBROUTINE WD_UnPackOutput + +END MODULE WakeDynamics_Types +!ENDOFREGISTRYGENERATEDFILE diff --git a/reg_tests/CMakeLists.txt b/reg_tests/CMakeLists.txt index 7f1beb912e..30db7c1067 100644 --- a/reg_tests/CMakeLists.txt +++ b/reg_tests/CMakeLists.txt @@ -37,6 +37,14 @@ option(CTEST_PLOT_ERRORS "Generate plots of regression test errors." OFF) # Set the OpenFAST executable configuration option and default set(CTEST_OPENFAST_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast/openfast" CACHE FILEPATH "Specify the OpenFAST executable to use in testing.") +if(BUILD_OPENFAST_CPP_API) + # Set the OpenFAST executable configuration option and default + set(CTEST_OPENFASTCPP_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast-cpp/openfastcpp" CACHE FILEPATH "Specify the OpenFAST C++ executable to use in testing.") +endif() + +# Set the FASTFarm executable configuration option and default +set(CTEST_FASTFARM_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/fast-farm/FAST.Farm" CACHE FILEPATH "Specify the FASTFarm executable to use in testing.") + # Set the AeroDyn executable configuration option and default set(CTEST_AERODYN_EXECUTABLE "${CMAKE_BINARY_DIR}/modules/aerodyn/aerodyn_driver" CACHE FILEPATH "Specify the AeroDyn driver executable to use in testing.") @@ -70,7 +78,7 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/r-test") # build and seed the test directories with the data they need to run the tests file(MAKE_DIRECTORY ${CTEST_BINARY_DIR}) -foreach(regTest glue-codes/openfast modules/aerodyn modules/beamdyn modules/hydrodyn modules/subdyn) +foreach(regTest glue-codes/openfast glue-codes/openfast-cpp modules/aerodyn modules/beamdyn modules/hydrodyn modules/subdyn) file(MAKE_DIRECTORY ${CTEST_BINARY_DIR}/${regTest}) endforeach() @@ -80,28 +88,60 @@ foreach(turbineDirectory 5MW_Baseline AOC AWT27 SWRT UAE_VI WP_Baseline) DESTINATION "${CTEST_BINARY_DIR}/glue-codes/openfast/") endforeach() +## fastfarm seed +foreach(turbineDirectory 5MW_Baseline) + file(COPY "${CMAKE_CURRENT_LIST_DIR}/r-test/glue-codes/fast-farm/${turbineDirectory}" + DESTINATION "${CTEST_BINARY_DIR}/glue-codes/fast-farm/") +endforeach() + # add the tests include(${CMAKE_CURRENT_LIST_DIR}/CTestList.cmake) +# Copy the DISCON controllers to the 5MW turbine directories set(src "${CMAKE_CURRENT_LIST_DIR}/r-test/glue-codes/openfast/5MW_Baseline/ServoData") -set(dest "${CTEST_BINARY_DIR}/glue-codes/openfast/5MW_Baseline/ServoData/") + +set(of_dest "${CTEST_BINARY_DIR}/glue-codes/openfast/5MW_Baseline/ServoData/") add_custom_command( - OUTPUT "${dest}/DISCON.dll" + OUTPUT "${of_dest}/DISCON.dll" DEPENDS DISCON - COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON/build/DISCON.dll" "${dest}" + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON/build/DISCON.dll" "${of_dest}" ) add_custom_command( - OUTPUT "${dest}/DISCON_ITIBarge.dll" + OUTPUT "${of_dest}/DISCON_ITIBarge.dll" DEPENDS DISCON_ITIBarge - COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON_ITI/build/DISCON_ITIBarge.dll" "${dest}" + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON_ITI/build/DISCON_ITIBarge.dll" "${of_dest}" ) add_custom_command( - OUTPUT "${dest}/DISCON_OC3Hywind.dll" + OUTPUT "${of_dest}/DISCON_OC3Hywind.dll" DEPENDS DISCON_OC3Hywind - COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON_OC3/build/DISCON_OC3Hywind.dll" "${dest}" + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON_OC3/build/DISCON_OC3Hywind.dll" "${of_dest}" +) + +set(ff_dest "${CTEST_BINARY_DIR}/glue-codes/fast-farm/5MW_Baseline/ServoData/") +add_custom_command( + OUTPUT "${ff_dest}/DISCON_WT1.dll" + DEPENDS DISCON + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON/build/DISCON.dll" "${ff_dest}/DISCON_WT1.dll" +) +add_custom_command( + OUTPUT "${ff_dest}/DISCON_WT2.dll" + DEPENDS DISCON + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON/build/DISCON.dll" "${ff_dest}/DISCON_WT2.dll" +) +add_custom_command( + OUTPUT "${ff_dest}/DISCON_WT3.dll" + DEPENDS DISCON + COMMAND "${CMAKE_COMMAND}" -E copy "${src}/DISCON/build/DISCON.dll" "${ff_dest}/DISCON_WT3.dll" ) add_custom_target( regression_tests - DEPENDS openfast "${dest}/DISCON.dll" "${dest}/DISCON_ITIBarge.dll" "${dest}/DISCON_OC3Hywind.dll" + DEPENDS + openfast + "${of_dest}/DISCON.dll" + "${of_dest}/DISCON_ITIBarge.dll" + "${of_dest}/DISCON_OC3Hywind.dll" + "${ff_dest}/DISCON_WT1.dll" + "${ff_dest}/DISCON_WT2.dll" + "${ff_dest}/DISCON_WT3.dll" ) diff --git a/reg_tests/CTestList.cmake b/reg_tests/CTestList.cmake index d9fd1a471b..01e689db66 100644 --- a/reg_tests/CTestList.cmake +++ b/reg_tests/CTestList.cmake @@ -74,7 +74,15 @@ function(of_regression_aeroacoustic TESTNAME LABEL) regression(${TEST_SCRIPT} ${OPENFAST_EXECUTABLE} ${SOURCE_DIRECTORY} ${BUILD_DIRECTORY} ${TESTNAME} "${LABEL}") endfunction(of_regression_aeroacoustic) -# beamdyn +# FAST Farm +function(ff_regression TESTNAME LABEL) + set(TEST_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/executeFASTFarmRegressionCase.py") + set(FASTFARM_EXECUTABLE "${CTEST_FASTFARM_EXECUTABLE}") + set(SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/..") + set(BUILD_DIRECTORY "${CTEST_BINARY_DIR}/glue-codes/fast-farm") + regression(${TEST_SCRIPT} ${FASTFARM_EXECUTABLE} ${SOURCE_DIRECTORY} ${BUILD_DIRECTORY} ${TESTNAME} "${LABEL}") +endfunction(ff_regression) + # openfast linearized function(of_regression_linear TESTNAME LABEL) set(TEST_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/executeOpenfastLinearRegressionCase.py") @@ -84,6 +92,15 @@ function(of_regression_linear TESTNAME LABEL) regression(${TEST_SCRIPT} ${OPENFAST_EXECUTABLE} ${SOURCE_DIRECTORY} ${BUILD_DIRECTORY} ${TESTNAME} "${LABEL}") endfunction(of_regression_linear) +# openfast c-interface +function(of_regression_cpp TESTNAME LABEL) + set(TEST_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/executeOpenfastCppRegressionCase.py") + set(OPENFAST_CPP_EXECUTABLE "${CTEST_OPENFASTCPP_EXECUTABLE}") + set(SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/..") + set(BUILD_DIRECTORY "${CTEST_BINARY_DIR}/glue-codes/openfast-cpp") + regression(${TEST_SCRIPT} ${OPENFAST_CPP_EXECUTABLE} ${SOURCE_DIRECTORY} ${BUILD_DIRECTORY} ${TESTNAME} "${LABEL}") +endfunction(of_regression_cpp) + # aerodyn function(ad_regression TESTNAME LABEL) set(TEST_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/executeAerodynRegressionCase.py") @@ -153,6 +170,12 @@ of_regression("5MW_Land_BD_DLL_WTurb" "openfast;beamdyn;aerodyn of_regression("5MW_OC4Jckt_ExtPtfm" "openfast;elastodyn;extptfm") of_regression("HelicalWake_OLAF" "openfast;aerodyn15;olaf") of_regression("EllipticalWing_OLAF" "openfast;aerodyn15;olaf") +of_regression("StC_test_OC4Semi" "openfast;servodyn;hydrodyn;moordyn;offshore") + +# OpenFAST C++ API test +if(BUILD_OPENFAST_CPP_API) + of_regression_cpp("5MW_Land_DLL_WTurb_cpp" "openfast;cpp") +endif() # AeroAcoustic regression test of_regression_aeroacoustic("IEA_LB_RWT-AeroAcoustics" "openfast;aerodyn15;aeroacoustics") @@ -164,6 +187,12 @@ of_regression_linear("Ideal_Beam_Free_Free_Linear" "openfast;linear;beamdyn") of_regression_linear("5MW_Land_BD_Linear" "openfast;linear;beamdyn;servodyn") of_regression_linear("5MW_OC4Semi_Linear" "openfast;linear;hydrodyn;servodyn") +# FAST Farm regression tests +if(BUILD_FASTFARM) + ff_regression("TSinflow" "fastfarm") + ff_regression("LESinflow" "fastfarm") +endif() + # AeroDyn regression tests ad_regression("ad_timeseries_shutdown" "aerodyn;bem") @@ -182,6 +211,7 @@ hd_regression("hd_5MW_ITIBarge_DLL_WTurb_WavesIrr" "hydrodyn;offshore") hd_regression("hd_5MW_OC3Spar_DLL_WTurb_WavesIrr" "hydrodyn;offshore") hd_regression("hd_5MW_OC4Semi_WSt_WavesWN" "hydrodyn;offshore") hd_regression("hd_5MW_TLP_DLL_WTurb_WavesIrr_WavesMulti" "hydrodyn;offshore") +hd_regression("hd_TaperCylinderPitchMoment" "hydrodyn;offshore") # SubDyn regression tests sd_regression("SD_Cable_5Joints" "subdyn;offshore") diff --git a/reg_tests/executeFASTFarmRegressionCase.py b/reg_tests/executeFASTFarmRegressionCase.py new file mode 100644 index 0000000000..34acdf28cb --- /dev/null +++ b/reg_tests/executeFASTFarmRegressionCase.py @@ -0,0 +1,179 @@ +# +# Copyright 2017 National Renewable Energy Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +""" + This program executes FASTFarm and a regression test for a single test case. + The test data is contained in a git submodule, r-test, which must be initialized + prior to running. See the r-test README or OpenFAST documentation for more info. + + Get usage with: `executeFASTFarmRegressionCase.py -h` +""" + +import os +import sys +basepath = os.path.sep.join(sys.argv[0].split(os.path.sep)[:-1]) if os.path.sep in sys.argv[0] else "." +sys.path.insert(0, os.path.sep.join([basepath, "lib"])) +import argparse +import shutil +import subprocess +import rtestlib as rtl +import openfastDrivers +import pass_fail +from errorPlotting import exportCaseSummary + +##### Helper functions +def ignoreBaselineItems(directory, contents): + itemFilter = ['linux-intel', 'linux-gnu', 'macos-gnu', 'windows-intel'] + caught = [] + for c in contents: + if c in itemFilter: + caught.append(c) + return tuple(caught) + +##### Main program + +### Store the python executable for future python calls +pythonCommand = sys.executable + +### Verify input arguments +parser = argparse.ArgumentParser(description="Executes OpenFAST and a regression test for a single test case.") +parser.add_argument("caseName", metavar="Case-Name", type=str, nargs=1, help="The name of the test case.") +parser.add_argument("executable", metavar="OpenFAST", type=str, nargs=1, help="The path to the OpenFAST executable.") +parser.add_argument("sourceDirectory", metavar="path/to/openfast_repo", type=str, nargs=1, help="The path to the OpenFAST repository.") +parser.add_argument("buildDirectory", metavar="path/to/openfast_repo/build", type=str, nargs=1, help="The path to the OpenFAST repository build directory.") +parser.add_argument("tolerance", metavar="Test-Tolerance", type=float, nargs=1, help="Tolerance defining pass or failure in the regression test.") +parser.add_argument("systemName", metavar="System-Name", type=str, nargs=1, help="The current system\'s name: [Darwin,Linux,Windows]") +parser.add_argument("compilerId", metavar="Compiler-Id", type=str, nargs=1, help="The compiler\'s id: [Intel,GNU]") +parser.add_argument("-p", "-plot", dest="plot", action='store_true', help="bool to include plots in failed cases") +parser.add_argument("-n", "-no-exec", dest="noExec", action='store_true', help="bool to prevent execution of the test cases") +parser.add_argument("-v", "-verbose", dest="verbose", action='store_true', help="bool to include verbose system output") + +args = parser.parse_args() + +caseName = args.caseName[0] +executable = args.executable[0] +sourceDirectory = args.sourceDirectory[0] +buildDirectory = args.buildDirectory[0] +tolerance = args.tolerance[0] +systemName = args.systemName[0] +compilerId = args.compilerId[0] +plotError = args.plot +noExec = args.noExec +verbose = args.verbose + +# validate inputs +rtl.validateExeOrExit(executable) +rtl.validateDirOrExit(sourceDirectory) +if not os.path.isdir(buildDirectory): + os.makedirs(buildDirectory) + +### Map the system and compiler configurations to a solution set +# Internal names -> Human readable names +systemName_map = { + "darwin": "macos", + "linux": "linux", + "windows": "windows" +} +compilerId_map = { + "gnu": "gnu", + "intel": "intel" +} +# Build the target output directory name or choose the default +supportedBaselines = ["macos-gnu", "linux-intel", "linux-gnu", "windows-intel"] +targetSystem = systemName_map.get(systemName.lower(), "") +targetCompiler = compilerId_map.get(compilerId.lower(), "") +outputType = os.path.join(targetSystem+"-"+targetCompiler) +if outputType not in supportedBaselines: + outputType = supportedBaselines[0] +print("-- Using gold standard files with machine-compiler type {}".format(outputType)) + +### Build the filesystem navigation variables for running openfast on the test case +regtests = os.path.join(sourceDirectory, "reg_tests") +lib = os.path.join(regtests, "lib") +rtest = os.path.join(regtests, "r-test") +moduleDirectory = os.path.join(rtest, "glue-codes", "fast-farm") +inputsDirectory = os.path.join(moduleDirectory, caseName) +targetOutputDirectory = os.path.join(inputsDirectory) #, outputType) +testBuildDirectory = os.path.join(buildDirectory, caseName) + +# verify all the required directories exist +if not os.path.isdir(rtest): + rtl.exitWithError("The test data directory, {}, does not exist. If you haven't already, run `git submodule update --init --recursive`".format(rtest)) +if not os.path.isdir(targetOutputDirectory): + rtl.exitWithError("The test data outputs directory, {}, does not exist. Try running `git submodule update`".format(targetOutputDirectory)) +if not os.path.isdir(inputsDirectory): + rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory)) + +# create the local output directory if it does not already exist +dst = os.path.join(buildDirectory, "5MW_Baseline") +src = os.path.join(moduleDirectory, "5MW_Baseline") +if not os.path.isdir(dst): + shutil.copytree(src, dst) +else: + names = os.listdir(src) + for name in names: + if name == "ServoData": + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + if os.path.isdir(srcname): + if not os.path.isdir(dstname): + shutil.copytree(srcname, dstname) + else: + shutil.copy2(srcname, dstname) + +if not os.path.isdir(testBuildDirectory): + shutil.copytree(inputsDirectory, testBuildDirectory, ignore=ignoreBaselineItems) + +### Run openfast on the test case +if not noExec: + caseInputFile = os.path.join(testBuildDirectory, caseName + ".fstf") + returnCode = openfastDrivers.runOpenfastCase(caseInputFile, executable) + if returnCode != 0: + rtl.exitWithError("") + +### Build the filesystem navigation variables for running the regression test +localOutFile = os.path.join(testBuildDirectory, caseName + ".out") +baselineOutFile = os.path.join(targetOutputDirectory, caseName + ".out") +rtl.validateFileOrExit(localOutFile) +rtl.validateFileOrExit(baselineOutFile) + +testData, testInfo, testPack = pass_fail.readFASTOut(localOutFile) +baselineData, baselineInfo, _ = pass_fail.readFASTOut(baselineOutFile) +performance = pass_fail.calculateNorms(testData, baselineData) +normalizedNorm = performance[:, 1] + +# export all case summaries +results = list(zip(testInfo["attribute_names"], [*performance])) +results_max = performance.max(axis=0) +exportCaseSummary(testBuildDirectory, caseName, results, results_max, tolerance) + +# failing case +if not pass_fail.passRegressionTest(normalizedNorm, tolerance): + if plotError: + from errorPlotting import finalizePlotDirectory, plotOpenfastError + for channel in testInfo["attribute_names"]: + try: + plotOpenfastError(localOutFile, baselineOutFile, channel) + except: + error = sys.exc_info()[1] + print("Error generating plots: {}".format(error)) + finalizePlotDirectory(localOutFile, testInfo["attribute_names"], caseName) + + sys.exit(1) + +# passing case +sys.exit(0) diff --git a/reg_tests/executeOpenfastCppRegressionCase.py b/reg_tests/executeOpenfastCppRegressionCase.py new file mode 100644 index 0000000000..22a4bace4f --- /dev/null +++ b/reg_tests/executeOpenfastCppRegressionCase.py @@ -0,0 +1,174 @@ +# +# Copyright 2017 National Renewable Energy Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +basepath = os.path.sep.join(sys.argv[0].split(os.path.sep)[:-1]) if os.path.sep in sys.argv[0] else "." +sys.path.insert(0, os.path.sep.join([basepath, "lib"])) +import argparse +import shutil +import subprocess +import rtestlib as rtl +import openfastDrivers +import pass_fail +from errorPlotting import exportCaseSummary + +##### Helper functions +def ignoreBaselineItems(directory, contents): + itemFilter = ['linux-intel', 'linux-gnu', 'macos-gnu', 'windows-intel'] + caught = [] + for c in contents: + if c in itemFilter: + caught.append(c) + return tuple(caught) + +##### Main program + +### Store the python executable for future python calls +pythonCommand = sys.executable + +### Verify input arguments +parser = argparse.ArgumentParser(description="Executes OpenFAST and a regression test for a single test case.") +parser.add_argument("caseName", metavar="Case-Name", type=str, nargs=1, help="The name of the test case.") +parser.add_argument("executable", metavar="OpenFAST", type=str, nargs=1, help="The path to the OpenFAST executable.") +parser.add_argument("sourceDirectory", metavar="path/to/openfast_repo", type=str, nargs=1, help="The path to the OpenFAST repository.") +parser.add_argument("buildDirectory", metavar="path/to/openfast_repo/build", type=str, nargs=1, help="The path to the OpenFAST repository build directory.") +parser.add_argument("tolerance", metavar="Test-Tolerance", type=float, nargs=1, help="Tolerance defining pass or failure in the regression test.") +parser.add_argument("systemName", metavar="System-Name", type=str, nargs=1, help="The current system\'s name: [Darwin,Linux,Windows]") +parser.add_argument("compilerId", metavar="Compiler-Id", type=str, nargs=1, help="The compiler\'s id: [Intel,GNU]") +parser.add_argument("-p", "-plot", dest="plot", action='store_true', help="bool to include plots in failed cases") +parser.add_argument("-n", "-no-exec", dest="noExec", action='store_true', help="bool to prevent execution of the test cases") +parser.add_argument("-v", "-verbose", dest="verbose", action='store_true', help="bool to include verbose system output") + +args = parser.parse_args() + +caseName = args.caseName[0] +executable = os.path.abspath(args.executable[0]) +sourceDirectory = args.sourceDirectory[0] +buildDirectory = args.buildDirectory[0] +tolerance = args.tolerance[0] +systemName = args.systemName[0] +compilerId = args.compilerId[0] +plotError = args.plot +noExec = args.noExec +verbose = args.verbose + +# validate inputs +rtl.validateExeOrExit(executable) +rtl.validateDirOrExit(sourceDirectory) +if not os.path.isdir(buildDirectory): + os.makedirs(buildDirectory) + +### Map the system and compiler configurations to a solution set +# Internal names -> Human readable names +systemName_map = { + "darwin": "macos", + "linux": "linux", + "windows": "windows" +} +compilerId_map = { + "gnu": "gnu", + "intel": "intel" +} +# Build the target output directory name or choose the default +supportedBaselines = ["macos-gnu", "linux-intel", "linux-gnu", "windows-intel"] +targetSystem = systemName_map.get(systemName.lower(), "") +targetCompiler = compilerId_map.get(compilerId.lower(), "") +outputType = os.path.join(targetSystem+"-"+targetCompiler) +if outputType not in supportedBaselines: + outputType = supportedBaselines[0] +print("-- Using gold standard files with machine-compiler type {}".format(outputType)) + +### Build the filesystem navigation variables for running openfast on the test case +rtest = os.path.join(sourceDirectory, "reg_tests", "r-test") +moduleDirectory = os.path.join(rtest, "glue-codes", "openfast-cpp") +openfast_gluecode_directory = os.path.join(rtest, "glue-codes", "openfast") +inputsDirectory = os.path.join(moduleDirectory, caseName) +targetOutputDirectory = os.path.join(openfast_gluecode_directory, caseName.replace('_cpp', ''), outputType) +testBuildDirectory = os.path.join(buildDirectory, caseName) + +# verify all the required directories exist +if not os.path.isdir(rtest): + rtl.exitWithError("The test data directory, {}, does not exist. If you haven't already, run `git submodule update --init --recursive`".format(rtest)) +if not os.path.isdir(targetOutputDirectory): + rtl.exitWithError("The test data outputs directory, {}, does not exist. Try running `git submodule update`".format(targetOutputDirectory)) +if not os.path.isdir(inputsDirectory): + rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory)) + +# create the local output directory if it does not already exist +dst = os.path.join(buildDirectory, "5MW_Baseline") +src = os.path.join(openfast_gluecode_directory, "5MW_Baseline") +if not os.path.isdir(dst): + shutil.copytree(src, dst) +else: + names = os.listdir(src) + for name in names: + if name == "ServoData": + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + if os.path.isdir(srcname): + if not os.path.isdir(dstname): + shutil.copytree(srcname, dstname) + else: + shutil.copy2(srcname, dstname) + +if not os.path.isdir(testBuildDirectory): + shutil.copytree(inputsDirectory, testBuildDirectory, ignore=ignoreBaselineItems) + +### Run openfast on the test case +if not noExec: + cwd = os.getcwd() + os.chdir(testBuildDirectory) + print("** CWD: ", os.getcwd()) + caseInputFile = os.path.abspath("cDriver.yaml") + returnCode = openfastDrivers.runOpenfastCase(caseInputFile, executable) + if returnCode != 0: + rtl.exitWithError("") + os.chdir(cwd) + +### Build the filesystem navigation variables for running the regression test +localOutFile = os.path.join(testBuildDirectory, caseName + ".outb") +baselineOutFile = os.path.join(targetOutputDirectory, caseName.replace('_cpp', '') + ".outb") +rtl.validateFileOrExit(localOutFile) +rtl.validateFileOrExit(baselineOutFile) + +testData, testInfo, testPack = pass_fail.readFASTOut(localOutFile) +baselineData, baselineInfo, _ = pass_fail.readFASTOut(baselineOutFile) +performance = pass_fail.calculateNorms(testData, baselineData) +normalizedNorm = performance[:, 1] + +# export all case summaries +results = list(zip(testInfo["attribute_names"], [*performance])) +results_max = performance.max(axis=0) +exportCaseSummary(testBuildDirectory, caseName, results, results_max, tolerance) + +# failing case +if not pass_fail.passRegressionTest(normalizedNorm, tolerance): + if plotError: + from errorPlotting import finalizePlotDirectory, plotOpenfastError + for channel in testInfo["attribute_names"]: + try: + plotOpenfastError(localOutFile, baselineOutFile, channel) + except: + error = sys.exc_info()[1] + print("Error generating plots: {}".format(error)) + finalizePlotDirectory(localOutFile, testInfo["attribute_names"], caseName) + + sys.exit(1) + +# passing case +sys.exit(0) diff --git a/reg_tests/lib/fast_io.py b/reg_tests/lib/fast_io.py index c730f99373..9a2b3d0fb0 100644 --- a/reg_tests/lib/fast_io.py +++ b/reg_tests/lib/fast_io.py @@ -59,16 +59,16 @@ def load_ascii_output(filename): with open(filename) as f: info = {} info['name'] = os.path.splitext(os.path.basename(filename))[0] - try: - header = [f.readline() for _ in range(8)] - info['description'] = header[4].strip() - info['attribute_names'] = header[6].split() - info['attribute_units'] = [unit[1:-1] for unit in header[7].split()] #removing "()" - data = np.array([line.split() for line in f.readlines()]).astype(np.float) - return data, info - - except (ValueError, AssertionError): - raise + header = [f.readline() for _ in range(8)] + info['description'] = header[4].strip() + info['attribute_names'] = header[6].split() + info['attribute_units'] = [unit[1:-1] for unit in header[7].split()] #removing "()" + data = np.array([line.split() for line in f.readlines()], dtype=np.float) + if np.any(np.isnan(data)): + raise ValueError("NaN found in test data: {}".format(filename)) + if np.any(np.isinf(data)): + raise ValueError("Infinity found in test data: {}".format(filename)) + return data, info def load_binary_output(filename): """ diff --git a/reg_tests/r-test b/reg_tests/r-test index adffb7e3ba..78d763effa 160000 --- a/reg_tests/r-test +++ b/reg_tests/r-test @@ -1 +1 @@ -Subproject commit adffb7e3baa3ef4b8b2ea4b777ba6b23b8048069 +Subproject commit 78d763effae41fb41ecff5143f0b486a6ac0593c diff --git a/share/discon/CMakeLists.txt b/share/discon/CMakeLists.txt index 7ca94e253a..c6814bcbed 100644 --- a/share/discon/CMakeLists.txt +++ b/share/discon/CMakeLists.txt @@ -72,7 +72,7 @@ endif (NOT CMAKE_BUILD_TYPE) # set the build flags if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") set_gfortran() -elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") +elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel") set_ifort() endif() set(CMAKE_SHARE_LINKER_FLAGS "-shared") diff --git a/unit_tests/beamdyn/CMakeLists.txt b/unit_tests/beamdyn/CMakeLists.txt index c93ac28494..0ed60108ff 100644 --- a/unit_tests/beamdyn/CMakeLists.txt +++ b/unit_tests/beamdyn/CMakeLists.txt @@ -47,6 +47,7 @@ set(testlist test_BD_diffmtc test_BD_InitShpDerJaco test_BD_MemberEta + test_BD_QuadraturePointData test_BD_TrapezoidalPointWeight test_InitializeNodalLocations ) diff --git a/unit_tests/nwtc-library/CMakeLists.txt b/unit_tests/nwtc-library/CMakeLists.txt index 7b425944ab..a78dda84b2 100644 --- a/unit_tests/nwtc-library/CMakeLists.txt +++ b/unit_tests/nwtc-library/CMakeLists.txt @@ -31,6 +31,7 @@ include_directories( ) set(testlist + NWTC_Library_test_tools test_NWTC_IO_CheckArgs test_NWTC_IO_FileInfo test_NWTC_RandomNumber diff --git a/vs-build/AeroDyn/AeroDyn_Driver.vfproj b/vs-build/AeroDyn/AeroDyn_Driver.vfproj index 72d14743c4..5926d2f2a3 100644 --- a/vs-build/AeroDyn/AeroDyn_Driver.vfproj +++ b/vs-build/AeroDyn/AeroDyn_Driver.vfproj @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -298,23 +298,7 @@ - - - - - - - - - - - - - - - - - + diff --git a/vs-build/BeamDyn/BeamDyn.vfproj b/vs-build/BeamDyn/BeamDyn.vfproj index 852d40158e..e476eb1783 100644 --- a/vs-build/BeamDyn/BeamDyn.vfproj +++ b/vs-build/BeamDyn/BeamDyn.vfproj @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + diff --git a/vs-build/Discon/Discon.sln b/vs-build/Discon/Discon.sln index 7c5b5beb58..494c965f95 100644 --- a/vs-build/Discon/Discon.sln +++ b/vs-build/Discon/Discon.sln @@ -9,6 +9,8 @@ Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Discon_ITIBarge", "Discon_I EndProject Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Discon_OC3Hywind", "Discon_OC3Hywind.vfproj", "{3BA7CEDE-8D58-4D18-8A59-A4114FB70B9C}" EndProject +Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Discon_SC", "Discon_SC.vfproj", "{183CC593-AD4C-4A15-81C1-78624551A5ED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -41,6 +43,14 @@ Global {3BA7CEDE-8D58-4D18-8A59-A4114FB70B9C}.Release|Win32.Build.0 = Release|Win32 {3BA7CEDE-8D58-4D18-8A59-A4114FB70B9C}.Release|x64.ActiveCfg = Release|x64 {3BA7CEDE-8D58-4D18-8A59-A4114FB70B9C}.Release|x64.Build.0 = Release|x64 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Debug|Win32.Build.0 = Debug|Win32 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Debug|x64.ActiveCfg = Debug|x64 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Debug|x64.Build.0 = Debug|x64 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Release|Win32.ActiveCfg = Release|Win32 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Release|Win32.Build.0 = Release|Win32 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Release|x64.ActiveCfg = Release|x64 + {183CC593-AD4C-4A15-81C1-78624551A5ED}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vs-build/Discon/Discon_SC.vfproj b/vs-build/Discon/Discon_SC.vfproj new file mode 100644 index 0000000000..c575e10d0c --- /dev/null +++ b/vs-build/Discon/Discon_SC.vfproj @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs-build/FAST-farm/FAST-Farm.sln b/vs-build/FAST-farm/FAST-Farm.sln new file mode 100644 index 0000000000..b7159f95f0 --- /dev/null +++ b/vs-build/FAST-farm/FAST-Farm.sln @@ -0,0 +1,86 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "FASTlib", "..\FASTlib\FASTlib.vfproj", "{1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}" + ProjectSection(ProjectDependencies) = postProject + {BF86702A-CB17-4050-8AE9-078CDC5910D3} = {BF86702A-CB17-4050-8AE9-078CDC5910D3} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAP_dll", "..\MAPlib\MAP_dll.vcxproj", "{BF86702A-CB17-4050-8AE9-078CDC5910D3}" + ProjectSection(ProjectDependencies) = postProject + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16} = {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FAST_Registry", "..\Registry\FAST_Registry.vcxproj", "{DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}" +EndProject +Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "FAST-Farm", "FAST-Farm.vfproj", "{F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}" + ProjectSection(ProjectDependencies) = postProject + {BF86702A-CB17-4050-8AE9-078CDC5910D3} = {BF86702A-CB17-4050-8AE9-078CDC5910D3} + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9} = {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release_OpenMP|Win32 = Release_OpenMP|Win32 + Release_OpenMP|x64 = Release_OpenMP|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Debug|Win32.ActiveCfg = Debug|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Debug|Win32.Build.0 = Debug|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Debug|x64.ActiveCfg = Debug|x64 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Debug|x64.Build.0 = Debug|x64 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release_OpenMP|Win32.ActiveCfg = Release_OpenMP|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release_OpenMP|Win32.Build.0 = Release_OpenMP|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release_OpenMP|x64.ActiveCfg = Release_OpenMP|x64 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release_OpenMP|x64.Build.0 = Release_OpenMP|x64 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release|Win32.ActiveCfg = Release|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release|Win32.Build.0 = Release|Win32 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release|x64.ActiveCfg = Release|x64 + {1A440C5B-CBA6-47D9-9CC2-C1CBA8C00BF9}.Release|x64.Build.0 = Release|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Debug|Win32.Build.0 = Debug|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Debug|x64.ActiveCfg = Debug|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Debug|x64.Build.0 = Debug|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release_OpenMP|Win32.ActiveCfg = Release|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release_OpenMP|Win32.Build.0 = Release|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release_OpenMP|x64.ActiveCfg = Release|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release_OpenMP|x64.Build.0 = Release|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release|Win32.ActiveCfg = Release|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release|Win32.Build.0 = Release|Win32 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release|x64.ActiveCfg = Release|x64 + {BF86702A-CB17-4050-8AE9-078CDC5910D3}.Release|x64.Build.0 = Release|x64 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Debug|Win32.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Debug|Win32.Build.0 = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Debug|x64.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Debug|x64.Build.0 = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release_OpenMP|Win32.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release_OpenMP|Win32.Build.0 = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release_OpenMP|x64.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release_OpenMP|x64.Build.0 = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release|Win32.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release|Win32.Build.0 = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release|x64.ActiveCfg = Release|Win32 + {DA16A3A6-3297-4628-9E46-C6FA0E3C4D16}.Release|x64.Build.0 = Release|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Debug|Win32.ActiveCfg = Debug|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Debug|Win32.Build.0 = Debug|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Debug|x64.ActiveCfg = Debug|x64 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Debug|x64.Build.0 = Debug|x64 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release_OpenMP|Win32.ActiveCfg = Release_OpenMP|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release_OpenMP|Win32.Build.0 = Release_OpenMP|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release_OpenMP|x64.ActiveCfg = Release_OpenMP|x64 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release_OpenMP|x64.Build.0 = Release_OpenMP|x64 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release|Win32.ActiveCfg = Release|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release|Win32.Build.0 = Release|Win32 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release|x64.ActiveCfg = Release|x64 + {F47C7C94-2A7F-4CBE-B834-1BC7DD3FE692}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs-build/FAST-farm/FAST-Farm.vfproj b/vs-build/FAST-farm/FAST-Farm.vfproj new file mode 100644 index 0000000000..f3baaa575d --- /dev/null +++ b/vs-build/FAST-farm/FAST-Farm.vfproj @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs-build/FASTlib/FASTlib.vfproj b/vs-build/FASTlib/FASTlib.vfproj index 0f174f2f11..c78ea5f9df 100644 --- a/vs-build/FASTlib/FASTlib.vfproj +++ b/vs-build/FASTlib/FASTlib.vfproj @@ -111,6 +111,24 @@ + + + + + + + + + + + + + + + + + + @@ -136,6 +154,10 @@ + + + + @@ -166,6 +188,10 @@ + + + + @@ -200,6 +226,10 @@ + + + + @@ -234,6 +264,10 @@ + + + + @@ -268,6 +302,10 @@ + + + + @@ -302,6 +340,10 @@ + + + + @@ -336,6 +378,10 @@ + + + + @@ -391,6 +437,10 @@ + + + + @@ -428,6 +478,10 @@ + + + + @@ -467,6 +521,10 @@ + + + + @@ -498,6 +556,10 @@ + + + + @@ -538,6 +600,10 @@ + + + + @@ -576,6 +642,10 @@ + + + + @@ -616,6 +686,10 @@ + + + + @@ -650,6 +724,10 @@ + + + + @@ -684,6 +762,10 @@ + + + + @@ -718,6 +800,10 @@ + + + + @@ -752,6 +838,10 @@ + + + + @@ -786,6 +876,10 @@ + + + + @@ -820,6 +914,10 @@ + + + + @@ -845,6 +943,10 @@ + + + + @@ -888,6 +990,10 @@ + + + + @@ -913,6 +1019,10 @@ + + + + @@ -984,6 +1094,10 @@ + + + + @@ -1012,6 +1126,10 @@ + + + + @@ -1061,6 +1179,10 @@ + + + + @@ -1095,6 +1217,10 @@ + + + + @@ -1129,6 +1255,10 @@ + + + + @@ -1163,6 +1293,10 @@ + + + + @@ -1197,6 +1331,10 @@ + + + + @@ -1231,6 +1369,10 @@ + + + + @@ -1265,6 +1407,10 @@ + + + + @@ -1299,6 +1445,10 @@ + + + + @@ -1333,6 +1483,10 @@ + + + + @@ -1380,6 +1534,10 @@ + + + + @@ -1417,6 +1575,10 @@ + + + + @@ -1451,6 +1613,10 @@ + + + + @@ -1488,6 +1654,10 @@ + + + + @@ -1526,6 +1696,10 @@ + + + + @@ -1564,6 +1738,10 @@ + + + + @@ -1576,6 +1754,8 @@ + + @@ -1590,6 +1770,10 @@ + + + + @@ -1615,6 +1799,10 @@ + + + + @@ -1641,6 +1829,10 @@ + + + + @@ -1666,6 +1858,10 @@ + + + + @@ -1691,8 +1887,14 @@ + + + + + + @@ -1703,6 +1905,8 @@ + + @@ -1716,6 +1920,10 @@ + + + + @@ -1741,6 +1949,10 @@ + + + + @@ -1766,6 +1978,10 @@ + + + + @@ -1791,6 +2007,10 @@ + + + + @@ -1816,8 +2036,14 @@ + + + + + + @@ -1828,6 +2054,8 @@ + + @@ -1841,6 +2069,10 @@ + + + + @@ -1866,6 +2098,10 @@ + + + + @@ -1891,6 +2127,10 @@ + + + + @@ -1916,6 +2156,10 @@ + + + + @@ -1941,6 +2185,10 @@ + + + + @@ -1998,16 +2246,22 @@ - + + + + + + + @@ -2045,6 +2299,10 @@ + + + + @@ -2078,32 +2336,36 @@ - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - + + @@ -2115,12 +2377,17 @@ - + + + + + + @@ -2162,34 +2429,38 @@ - + - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - + + @@ -2198,6 +2469,6 @@ - + diff --git a/vs-build/HydroDyn/HydroDynDriver.vfproj b/vs-build/HydroDyn/HydroDynDriver.vfproj index 4bec1b3320..124b485616 100644 --- a/vs-build/HydroDyn/HydroDynDriver.vfproj +++ b/vs-build/HydroDyn/HydroDynDriver.vfproj @@ -6,7 +6,7 @@ - + @@ -14,9 +14,9 @@ - + - + @@ -24,9 +24,9 @@ - + - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -54,9 +54,9 @@ - + - + diff --git a/vs-build/InflowWind/InflowWind_driver.vfproj b/vs-build/InflowWind/InflowWind_driver.vfproj index c7179bd934..90611f4697 100644 --- a/vs-build/InflowWind/InflowWind_driver.vfproj +++ b/vs-build/InflowWind/InflowWind_driver.vfproj @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + diff --git a/vs-build/MAPlib/MAP_dll.vcxproj b/vs-build/MAPlib/MAP_dll.vcxproj index 1c17aebaaf..aaf82fd788 100644 --- a/vs-build/MAPlib/MAP_dll.vcxproj +++ b/vs-build/MAPlib/MAP_dll.vcxproj @@ -92,7 +92,7 @@ NotUsing Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;MAP_DLL_EXPORTS;CMINPACK_NO_DLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CMINPACK_NO_DLL;%(PreprocessorDefinitions) true MultiThreadedDebug ..\..\modules\map\src @@ -107,7 +107,7 @@ NotUsing Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;MAP_DLL_EXPORTS;CMINPACK_NO_DLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CMINPACK_NO_DLL;%(PreprocessorDefinitions) true MultiThreadedDebug @@ -123,7 +123,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;MAP_DLL_EXPORTS;CMINPACK_NO_DLL;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;CMINPACK_NO_DLL;%(PreprocessorDefinitions) true MultiThreaded @@ -140,7 +140,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;MAP_DLL_EXPORTS;CMINPACK_NO_DLL;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;CMINPACK_NO_DLL;%(PreprocessorDefinitions) true MultiThreaded diff --git a/vs-build/ReadMe.md b/vs-build/ReadMe.md index afb0097ab6..eafadb0588 100644 --- a/vs-build/ReadMe.md +++ b/vs-build/ReadMe.md @@ -3,6 +3,8 @@ The following solution files are available for code development on Windows using - [OpenFAST](FAST/FAST.sln) This contains builds for both the command-line OpenFAST executable as well as the DLL for use with the OpenFAST-Simulink interface. +- [FAST.Farm](FAST-farm/FAST-Farm.sln) + This contains the build configurations for FAST.Farm. - Module-level drivers: - AeroDynamics: - [AeroDyn driver](AeroDyn/AeroDyn_Driver.sln) @@ -10,11 +12,14 @@ The following solution files are available for code development on Windows using - Structural: - [BeamDyn driver](BeamDyn/BeamDyn-w-registry.sln) - [SubDyn driver](SubDyn/SubDyn.sln) - - Wind/Wave conditions + - Wind/Wave conditions: - [TurbSim](TurbSim/TurbSim.sln) Generates wind files - [InflowWind driver](InflowWind/InflowWind_driver.sln) Reads and interpolates existing wind files - [HydroDyn driver](HydroDyn/HydroDynDriver.sln) - Other: - - [Discon](Discon/Discon.sln) This solution file contains all 3 controllers used in the OpenFAST r-test (with the NREL 5MW model). + - [Discon](Discon/Discon.sln) + This solution file contains all 3 controllers used in the OpenFAST r-test (with the NREL 5MW model). + It also contains the controller used with the FAST.Farm super-controller. + - [SC_DLL](SC_DLL.sln) This solution file builds a template supercontroller to be used with FAST.Farm. - [OpenFAST Registry](Registry/Registry.sln) The Registry project is included in almost every other solution file, so this solution file is only for debugging changes to the OpenFAST Registry. diff --git a/vs-build/RunRegistry.bat b/vs-build/RunRegistry.bat index e85beb48d8..3480ba5260 100644 --- a/vs-build/RunRegistry.bat +++ b/vs-build/RunRegistry.bat @@ -43,6 +43,10 @@ SET SrvD_Loc=%Modules_Loc%\servodyn\src SET BD_Loc=%Modules_Loc%\beamdyn\src SET SC_Loc=%Modules_Loc%\supercontroller\src +SET AWAE_Loc=%Modules_Loc%\awae\src +SET WD_Loc=%Modules_Loc%\wakedynamics\src +SET Farm_Loc=%Root_Loc%\glue-codes\fast-farm\src + SET ALL_FAST_Includes=-I "%FAST_Loc%" -I "%NWTC_Lib_Loc%" -I "%ED_Loc%" -I "%SrvD_Loc%" -I "%AD14_Loc%" -I^ "%AD_Loc%" -I "%BD_Loc%" -I "%SC_Loc%" -I^ "%IfW_Loc%" -I "%SD_Loc%" -I "%HD_Loc%" -I "%MAP_Loc%" -I "%FEAM_Loc%" -I^ @@ -87,13 +91,20 @@ SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\SuperController_Registry.txt" -I "%NWTC_Lib_Loc%" -O "%Output_Loc%" -ccode GOTO checkError +:SCDataEx: +SET CURR_LOC=%SC_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\SC_DataEx_Registry.txt" -I "%NWTC_Lib_Loc%" -O "%Output_Loc%" -ccode -noextrap +GOTO checkError + + :ElastoDyn SET CURR_LOC=%ED_Loc% SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\%ModuleName%_Registry.txt" -I "%NWTC_Lib_Loc%" -O "%Output_Loc%" GOTO checkError -:TMD +:StrucCtrl :ServoDyn SET CURR_LOC=%SrvD_Loc% SET Output_Loc=%CURR_LOC% @@ -176,60 +187,16 @@ SET Output_Loc=%CURR_LOC% GOTO checkError :HydroDyn -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :Current -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :Waves -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :Waves2 -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :SS_Excitation -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :SS_Radiation -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :Conv_Radiation -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :WAMIT -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :WAMIT2 -SET CURR_LOC=%HD_Loc% -SET Output_Loc=%CURR_LOC% -%REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" -GOTO checkError - :Morison + SET CURR_LOC=%HD_Loc% SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" @@ -277,6 +244,30 @@ SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\%ModuleName%_Registry.txt" -I "%NWTC_Lib_Loc%" -O "%Output_Loc%" GOTO checkError +:FarmDriver +SET CURR_LOC=%Farm_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\FAST_Farm_Registry.txt" -I %WD_Loc% -I %AWAE_Loc% -I %Farm_Loc% %ALL_FAST_INCLUDES% -noextrap -O "%Output_Loc%" +GOTO checkError + +:FASTWrapper +SET CURR_LOC=%Farm_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\FASTWrapper_Registry.txt" -I %NWTC_Lib_Loc% %ALL_FAST_INCLUDES% -noextrap -O "%Output_Loc%" +GOTO checkError + +:WakeDynamics +SET CURR_LOC=%WD_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\WakeDynamics_Registry.txt" -I %NWTC_Lib_Loc% -noextrap -O "%Output_Loc%" +GOTO checkError + +:AWAE +SET CURR_LOC=%AWAE_Loc% +SET Output_Loc=%CURR_LOC% +%REGISTRY% "%CURR_LOC%\AWAE_Registry.txt" -I %NWTC_Lib_Loc% -I %IfW_Loc% -noextrap -O "%Output_Loc%" +GOTO checkError + :Version DEL "%Root_Loc%\VersionInfo.obj" "%Root_Loc%\versioninfo.mod" GOTO end diff --git a/vs-build/SC_DLL/SC_DLL.sln b/vs-build/SC_DLL/SC_DLL.sln new file mode 100644 index 0000000000..54daab58ef --- /dev/null +++ b/vs-build/SC_DLL/SC_DLL.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "SC_DLL", "SC_DLL.vfproj", "{183CC593-AD4C-9643-81C1-7D6085A9A5ED}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Debug|Win32.Build.0 = Debug|Win32 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Debug|x64.ActiveCfg = Debug|x64 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Debug|x64.Build.0 = Debug|x64 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Release|Win32.ActiveCfg = Release|Win32 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Release|Win32.Build.0 = Release|Win32 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Release|x64.ActiveCfg = Release|x64 + {183CC593-AD4C-9643-81C1-7D6085A9A5ED}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs-build/SC_DLL/SC_DLL.vfproj b/vs-build/SC_DLL/SC_DLL.vfproj new file mode 100644 index 0000000000..efc2191044 --- /dev/null +++ b/vs-build/SC_DLL/SC_DLL.vfproj @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs-build/SubDyn/SubDyn.vfproj b/vs-build/SubDyn/SubDyn.vfproj index b8e89e3c0c..06c25bbbf4 100644 --- a/vs-build/SubDyn/SubDyn.vfproj +++ b/vs-build/SubDyn/SubDyn.vfproj @@ -5,8 +5,8 @@ - - + + @@ -16,7 +16,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + diff --git a/vs-build/UnsteadyAero/UnsteadyAero.vfproj b/vs-build/UnsteadyAero/UnsteadyAero.vfproj index 93f686c979..77735ed5be 100644 --- a/vs-build/UnsteadyAero/UnsteadyAero.vfproj +++ b/vs-build/UnsteadyAero/UnsteadyAero.vfproj @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - +